1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-20 03:41:33 +02:00

#368 GBA fix out of range of Ordering Table for sprites, fix build for WIN, TNS and DOS

This commit is contained in:
XProger
2021-08-07 06:13:46 +03:00
parent c9a91e01c7
commit f8cd4cd100
2 changed files with 12 additions and 3 deletions

View File

@@ -49,6 +49,8 @@ int32 fpsCounter = 0;
return GetTickCount(); return GetTickCount();
} }
void osJoyVibrate(int32 index, int32 L, int32 R) {}
#elif defined(__GBA__) #elif defined(__GBA__)
void paletteSet(const uint16* palette) void paletteSet(const uint16* palette)
{ {
@@ -128,6 +130,8 @@ int32 fpsCounter = 0;
return *timerCLK / 33; return *timerCLK / 33;
} }
void osJoyVibrate(int32 index, int32 L, int32 R) {}
void paletteSet(const uint16* palette) void paletteSet(const uint16* palette)
{ {
memcpy((uint16*)0xC0000200, palette, 256 * 2); memcpy((uint16*)0xC0000200, palette, 256 * 2);
@@ -300,6 +304,8 @@ int32 fpsCounter = 0;
{ {
return 0; return 0;
} }
void osJoyVibrate(int32 index, int32 L, int32 R) {}
#endif #endif
EWRAM_DATA ALIGN16 uint8 soundBufferA[2 * SND_SAMPLES + 32]; // 32 bytes of silence for DMA overrun while interrupt EWRAM_DATA ALIGN16 uint8 soundBufferA[2 * SND_SAMPLES + 32]; // 32 bytes of silence for DMA overrun while interrupt

View File

@@ -557,7 +557,8 @@ void drawGlyph(const Sprite *sprite, int32 x, int32 y)
X_INLINE Face* faceAdd(int32 depth) X_INLINE Face* faceAdd(int32 depth)
{ {
ASSERT(depth < OT_SIZE); ASSERT(depth >= 0 && depth < OT_SIZE);
Face* face = gFaces + gFacesCount++; Face* face = gFaces + gFacesCount++;
face->next = otFaces[depth]; face->next = otFaces[depth];
otFaces[depth] = face; otFaces[depth] = face;
@@ -647,6 +648,8 @@ void faceAddSprite(int32 vx, int32 vy, int32 vz, int32 vg, int32 index)
return; return;
} }
ASSERT(gFacesCount < MAX_FACES);
int32 x = DP43c(m[0], vx, vy, vz); int32 x = DP43c(m[0], vx, vy, vz);
int32 y = DP43c(m[1], vx, vy, vz); int32 y = DP43c(m[1], vx, vy, vz);
@@ -703,9 +706,9 @@ void faceAddSprite(int32 vx, int32 vy, int32 vz, int32 vg, int32 index)
ASSERT(v2.x >= v1.x); ASSERT(v2.x >= v1.x);
ASSERT(v2.y >= v1.y); ASSERT(v2.y >= v1.y);
fogZ -= 128; int32 depth = X_MAX(0, fogZ - 128); // depth hack
Face* f = faceAdd(fogZ >> OT_SHIFT); Face* f = faceAdd(depth >> OT_SHIFT);
f->flags = uint16(FACE_SPRITE); f->flags = uint16(FACE_SPRITE);
f->indices[0] = gVerticesCount - 2; f->indices[0] = gVerticesCount - 2;
f->indices[1] = index; f->indices[1] = index;