diff options
| author | Steven Fuller <relnev@icculus.org> | 2015-02-14 12:00:00 +0100 |
|---|---|---|
| committer | Patryk Obara <dreamer.tan@gmail.com> | 2019-08-20 03:51:33 +0200 |
| commit | 0de664d0a886bcda45a0cd05551b6896c5c46ed0 (patch) | |
| tree | 50127b6ec478d76bc714dbfda69602610334ed0c /src/win95 | |
| parent | 22475d6d94e96056d1550dca00b32d00e3821649 (diff) | |
Import icculus.org release (2015-02-14)
Diffstat (limited to 'src/win95')
| -rw-r--r-- | src/win95/aw.h | 27 | ||||
| -rw-r--r-- | src/win95/awtexld.cpp | 36 | ||||
| -rw-r--r-- | src/win95/awtexld.hpp | 3 | ||||
| -rw-r--r-- | src/win95/inline.h | 18 |
4 files changed, 42 insertions, 42 deletions
diff --git a/src/win95/aw.h b/src/win95/aw.h index 0a7ac4b..8b9985c 100644 --- a/src/win95/aw.h +++ b/src/win95/aw.h @@ -4,31 +4,28 @@ struct AwBackupTexture; typedef struct AwBackupTexture * AW_BACKUPTEXTUREHANDLE; +// fake type used by opengl.c typedef struct DIRECTDRAWSURFACE { unsigned char *buf; int id; - - int w; - int h; - + + unsigned int w; + unsigned int h; + + unsigned int IsNpot; + unsigned int TexWidth; + unsigned int TexHeight; + float RecipW; + float RecipH; + int filter; } DIRECTDRAWSURFACE; typedef DIRECTDRAWSURFACE * LPDIRECTDRAWSURFACE; typedef DIRECTDRAWSURFACE DDSurface; -typedef struct DIRECT3DTEXTURE -{ - unsigned char *buf; - int id; - - int w; - int h; - - int filter; -} DIRECT3DTEXTURE; - +typedef DIRECTDRAWSURFACE DIRECT3DTEXTURE; typedef DIRECT3DTEXTURE * LPDIRECT3DTEXTURE; typedef DIRECT3DTEXTURE D3DTexture; diff --git a/src/win95/awtexld.cpp b/src/win95/awtexld.cpp index 03ef1db..64afca7 100644 --- a/src/win95/awtexld.cpp +++ b/src/win95/awtexld.cpp @@ -386,7 +386,7 @@ AwTl::SurfUnion AwBackupTexture::Restore(AwTl::CreateTextureParms const & rParam if (!pixelFormat.validB) db_log3("AwCreateGraphic(): ERROR: pixel format not valid"); - if (!driverDesc.ddP || !driverDesc.validB && rParams.loadTextureB) + if (!driverDesc.ddP || (!driverDesc.validB && rParams.loadTextureB)) db_log3("AwCreateGraphic(): ERROR: driver description not valid"); awTlLastErr = pixelFormat.validB && driverDesc.ddP && (driverDesc.validB || !rParams.loadTextureB) ? AW_TLE_OK : AW_TLE_NOINIT; @@ -426,13 +426,13 @@ void AwBackupTexture::ChoosePixelFormat(AwTl::CreateTextureParms const & _parmsR unsigned fMyFlags = _parmsR.flags & AW_TLF_PREVSRCALL ? db_assert1(_parmsR.restoreH), m_fFlags : _parmsR.flags & AW_TLF_PREVSRC ? db_assert1(_parmsR.restoreH), - _parmsR.flags & ~AW_TLF_TRANSP | m_fFlags & AW_TLF_TRANSP + ((_parmsR.flags & ~AW_TLF_TRANSP) | (m_fFlags & AW_TLF_TRANSP)) : _parmsR.flags; // transparency? m_bTranspMask = HasTransparentMask(fMyFlags & AW_TLF_TRANSP ? true : false); - if (_parmsR.loadTextureB || fMyFlags & AW_TLF_TEXTURE) + if (_parmsR.loadTextureB || (fMyFlags & AW_TLF_TEXTURE)) { #if 0 // use a texture format @@ -521,13 +521,26 @@ AwTl::SurfUnion AwBackupTexture::CreateTexture(AwTl::CreateTextureParms const & { using namespace AwTl; -// fprintf(stderr, "AwBackupTexture::CreateTexture(...) This is where we could convert the image to RGB/RGBA, and so on\n"); + // which flags to use? + unsigned fMyFlags = + (_parmsR.flags & AW_TLF_PREVSRCALL) ? db_assert1(_parmsR.restoreH), + (_parmsR.flags & (AW_TLF_CHECKLOST|AW_TLF_SKIPNOTLOST)) | (m_fFlags & ~(AW_TLF_CHECKLOST|AW_TLF_SKIPNOTLOST)) + : (_parmsR.flags & AW_TLF_PREVSRC) ? db_assert1(_parmsR.restoreH), + ((_parmsR.flags & ~AW_TLF_TRANSP) | (m_fFlags & AW_TLF_TRANSP)) + : _parmsR.flags; if (_parmsR.originalWidthP) *_parmsR.originalWidthP = m_nWidth; if (_parmsR.originalHeightP) *_parmsR.originalHeightP = m_nHeight; - D3DTexture *Tex = (D3DTexture *)malloc(sizeof(D3DTexture)); + if (_parmsR.rectA != NULL) { + fprintf(stderr, "AwBackupTexture::CreateTexture - rectangle cutouts?\n"); + } + + if (pixelFormat.texB && (m_bTranspMask && (!pixelFormat.alphaB || fMyFlags & AW_TLF_CHROMAKEY))) { + fprintf(stderr, "AwBackupTexture::CreateTexture - chroma\n"); + } + // convert asset to 32-bit rgba unsigned char *buf = (unsigned char *)malloc(m_nWidth * m_nHeight * 4); Colour * paletteP = m_nPaletteSize ? GetPalette() : NULL; @@ -573,19 +586,20 @@ AwTl::SurfUnion AwBackupTexture::CreateTexture(AwTl::CreateTextureParms const & } -/* temp junk */ + // convert to texture + D3DTexture *Tex = (D3DTexture *)calloc(1, sizeof(D3DTexture)); + Tex->w = m_nWidth; Tex->h = m_nHeight; + if (pixelFormat.texB) { - Tex->buf = NULL; /* not used */ - CreateOGLTexture(Tex, buf); /* this will set the id */ - free(buf); + CreateOGLTexture(Tex, buf); } else { - Tex->buf = buf; /* hey, I need this! */ CreateIMGSurface(Tex, buf); } - + return static_cast<SurfUnion>(Tex); + #if 0 // which flags to use? diff --git a/src/win95/awtexld.hpp b/src/win95/awtexld.hpp index e9c70fb..b3b7f32 100644 --- a/src/win95/awtexld.hpp +++ b/src/win95/awtexld.hpp @@ -130,8 +130,7 @@ namespace AwTl { DDSurface * surfaceP; void * voidP; SurfUnion(){} - SurfUnion(D3DTexture * p) : textureP(p){} - SurfUnion(DDSurface * p) : surfaceP(p){} + SurfUnion(void * p) : voidP(p){} }; union PtrUnion diff --git a/src/win95/inline.h b/src/win95/inline.h index 8b162c8..dcb9dff 100644 --- a/src/win95/inline.h +++ b/src/win95/inline.h @@ -581,6 +581,10 @@ a = itmp;} #else +// parts of mathline.c that have been re-inlined. +// MUL_FIXED, f2i +#include "mathline.h" + /* inline assembly has been moved to mathline.c */ void ADD_LL(LONGLONGCH *a, LONGLONGCH *b, LONGLONGCH *c); void ADD_LL_PP(LONGLONGCH *c, LONGLONGCH *a); @@ -592,7 +596,6 @@ void EQUALS_LL(LONGLONGCH *a, LONGLONGCH *b); void NEG_LL(LONGLONGCH *a); void ASR_LL(LONGLONGCH *a, int shift); void IntToLL(LONGLONGCH *a, int *b); -int MUL_FIXED(int a, int b); int DIV_FIXED(int a, int b); #define DIV_INT(a, b) ((a) / (b)) @@ -602,20 +605,7 @@ int WideMulNarrowDiv(int a, int b, int c); void RotateVector_ASM(VECTORCH *v, MATRIXCH *m); void RotateAndCopyVector_ASM(VECTORCH *v1, VECTORCH *v2, MATRIXCH *m); -/* -int FloatToInt(float); -#define f2i(a, b) { a = FloatToInt(b); } -*/ - int SqRoot32(int A); -void FloatToInt(); -extern float fti_fptmp; -extern int fti_itmp; - -#define f2i(a, b) { \ -fti_fptmp = (b); \ -FloatToInt(); \ -a = fti_itmp;} #endif |
