Some comments :
+ case D3DRENDERSTATE_LINEPATTERN: { + D3DLINEPATTERN pattern; + #ifdef WORDS_BIGENDIAN + pattern.wRepeatFactor = *((WORD*)&pattern + 2); + pattern.wLinePattern = *((WORD*)&pattern); + #else + pattern.wRepeatFactor = *((WORD*)&pattern); + pattern.wLinePattern = *((WORD*)&pattern + 2); + #endif
Why not someting 'simple' as pattern = *((D3DLINEPATTERN *) &dwRenderState); ?
Your code is not working anyway because (AFAICS) you never actually store something in 'pattern'.
+ if(pattern.wRepeatFactor) { + glEnable(GL_LINE_STIPPLE); + FIXME("implement wRepeatFactor parameter for glLineStipple\n"); + glLineStipple(1, pattern.wLinePattern); + } else { + glDisable(GL_LINE_STIPPLE); + } + break; + } +
Well, as long as you are here, I would rather do something like that :
if(pattern.wRepeatFactor > 256) { FIXME("not supported in OpenGL - clamping to 256"); } glLineStipple(pattern.wRepeatFactor, pattern.wLinePattern);
Because, from what I can see in the man page, the first parameter of the LineStipple call is exactly equivalent to 'pattern.wRepeatFactor'.
By the way, which game uses this rendering state ?
@@ -921,16 +940,16 @@ case CONVERT_PALETTED: { IDirectDrawPaletteImpl* pal = current_surface->palette; BYTE table[256][4]; - int i; - int x, y; + unsigned int x, y; BYTE *src = (BYTE *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst; - + if (pal == NULL) { /* Upload a black texture. The real one will be uploaded on palette change */ WARN("Palettized texture Loading with a NULL palette !\n"); memset(table, 0, 256 * 4); } else { /* Get the surface's palette */ + unsigned int i; for (i = 0; i < 256; i++) { table[i][0] = pal->palents[i].peRed; table[i][1] = pal->palents[i].peGreen;
And what are the reasons for all these changes ? I do not see why it's better to have the loop variables signed instead of unsigned (except if you have a compiler warning about signed / unsigned comparison).
Lionel