1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-01 02:40:43 +02:00

GBA packer for delta indices, TNS fix, MinGW compilation fix

This commit is contained in:
XProger
2023-03-01 02:58:53 +03:00
parent c7fe8ec3b4
commit 2763743038
5 changed files with 55 additions and 29 deletions

View File

@@ -146,8 +146,8 @@ _rasterizeF_asm:
cmp/gt Lptr, Rptr // if (!(Rptr > Lptr)) skip zero length scanline
bf/s .scanline_end_f
add pixel, Lptr // Lptr = pixel + (Lx >> 16)
add pixel, Rptr // Rptr = pixel + (Rx >> 16)
add pixel, Lptr // Lptr = pixel + (Lx >> 16)
add pixel, Rptr // Rptr = pixel + (Rx >> 16)
.align_left_f:
mov #1, tmp

View File

@@ -215,8 +215,8 @@ struct out_32X
struct RoomQuad
{
uint16 flags;
uint16 indices[4];
uint32 flags;
int8 indices[4];
void write(FileStream &f) const
{
@@ -1605,23 +1605,43 @@ struct out_32X
roomVerticesCount = 0;
info.quads = f.align4();
int32 prev = 0;
for (int32 i = 0; i < room->qCount; i++)
{
TR1_PC::Quad q = room->quads[i];
uint16 texIndex = q.flags & FACE_TEXTURE;
RoomQuad comp;
comp.indices[0] = addRoomVertex(info.yTop, room->vertices[q.indices[0]]);
comp.indices[1] = addRoomVertex(info.yTop, room->vertices[q.indices[1]]);
comp.indices[2] = addRoomVertex(info.yTop, room->vertices[q.indices[2]]);
comp.indices[3] = addRoomVertex(info.yTop, room->vertices[q.indices[3]]);
comp.flags = remap ? remap->textures[texIndex] : texIndex;
int32 i0 = addRoomVertex(info.yTop, room->vertices[q.indices[0]]);
int32 i1 = addRoomVertex(info.yTop, room->vertices[q.indices[1]]);
int32 i2 = addRoomVertex(info.yTop, room->vertices[q.indices[2]]);
int32 i3 = addRoomVertex(info.yTop, room->vertices[q.indices[3]]);
int32 p0 = i0 - prev;
int32 p1 = i1 - i0;
int32 p2 = i2 - i1;
int32 p3 = i3 - i2;
prev = i3;
// pre-shift
comp.indices[0] <<= 1;
comp.indices[1] <<= 1;
comp.indices[2] <<= 1;
comp.indices[3] <<= 1;
//p0 <<= 1;
//p1 <<= 1;
//p2 <<= 1;
//p3 <<= 1;
ASSERT(p0 >= -128 && p0 <= 127);
ASSERT(p1 >= -128 && p1 <= 127);
ASSERT(p2 >= -128 && p2 <= 127);
ASSERT(p3 >= -128 && p3 <= 127);
RoomQuad comp;
comp.indices[0] = p0;
comp.indices[1] = p1;
comp.indices[2] = p2;
comp.indices[3] = p3;
comp.flags = remap ? remap->textures[texIndex] : texIndex;
if (level->objectTextures[texIndex].attribute & TEX_ATTR_AKILL) {
comp.flags |= (FACE_TYPE_FTA << FACE_TYPE_SHIFT);
@@ -1639,15 +1659,23 @@ struct out_32X
uint16 texIndex = t.flags & FACE_TEXTURE;
RoomTriangle comp;
comp.indices[0] = addRoomVertex(info.yTop, room->vertices[t.indices[0]]);
comp.indices[1] = addRoomVertex(info.yTop, room->vertices[t.indices[1]]);
comp.indices[2] = addRoomVertex(info.yTop, room->vertices[t.indices[2]]);
int32 i0 = addRoomVertex(info.yTop, room->vertices[t.indices[0]]);
int32 i1 = addRoomVertex(info.yTop, room->vertices[t.indices[1]]);
int32 i2 = addRoomVertex(info.yTop, room->vertices[t.indices[2]]);
comp.flags = remap ? remap->textures[texIndex] : texIndex;
// pre-shift
comp.indices[0] <<= 1;
comp.indices[1] <<= 1;
comp.indices[2] <<= 1;
i0 <<= 3;
i1 <<= 3;
i2 <<= 3;
ASSERT(i0 >= 0 && i0 <= 0xFFFF);
ASSERT(i1 >= 0 && i1 <= 0xFFFF);
ASSERT(i2 >= 0 && i2 <= 0xFFFF);
comp.indices[0] = i0;
comp.indices[1] = i1;
comp.indices[2] = i2;
if (level->objectTextures[texIndex].attribute & TEX_ATTR_AKILL) {
comp.flags |= (FACE_TYPE_FTA << FACE_TYPE_SHIFT);

View File

@@ -6,7 +6,7 @@ GXX = nspire-g++
LD = nspire-ld
GENZEHN = genzehn
GCCFLAGS = -marm -march=armv5te -mtune=arm926ej-s -std=c++11 -flto -ffast-math -fomit-frame-pointer -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -D__TNS__ -I../../
GCCFLAGS = -marm -march=armv5te -mtune=arm926ej-s -std=c++11 -flto -ffast-math -fomit-frame-pointer -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -D__TNS__ -I../../fixed/
LDFLAGS = -Wl,--gc-sections -Wl,--as-needed -flto -Wno-alloc-size-larger-than
ZEHNFLAGS = --name "OpenLara"
@@ -36,7 +36,7 @@ all: $(EXE).prg.tns
$(AS) -c $<
$(EXE).elf: $(OBJS)
copy ../gba/render.iwram.cpp render.cpp /Y
cp ../gba/render.iwram.cpp render.cpp
mkdir -p $(DISTDIR)
$(LD) $^ -o $(DISTDIR)/$@ $(LDFLAGS)

View File

@@ -1,8 +1,6 @@
#if defined(_WIN32) || defined(__DOS__)
const void* TRACKS_IMA;
const void* TITLE_SCR;
const void* levelData;
#endif
const void* TRACKS_IMA;
const void* TITLE_SCR;
unsigned char* levelData;
#include "game.h"
@@ -106,7 +104,7 @@ void inputUpdate()
if (tx < -0.5f) keys |= IK_LEFT;
if (tx > 0.5f) keys |= IK_RIGHT;
if (ty > 0.5f) keys |= IK_UP;
if (ty < -0.5f) keys |= IK_DOWN];
if (ty < -0.5f) keys |= IK_DOWN;
}
if (keyDown(KEY_NSPIRE_2)) keys |= IK_A;

View File

@@ -1 +1 @@
C:\MinGW\bin\mingw32-g++ -std=c++11 -O3 -s -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections -DWIN32 -DNDEBUG -DNO_TOUCH_SUPPORT -I../../libs/ main.cpp ../../libs/stb_vorbis/stb_vorbis.c ../../libs/minimp3/minimp3.cpp ../../libs/tinf/tinflate.c -I../../ -o../../../bin/OpenLara_mingw.exe -lopengl32 -lwinmm -lwsock32 -lgdi32 -lm
C:\MinGW\bin\mingw32-g++ -static-libstdc++ -static-libgcc -O3 -s -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections -DWIN32 -DNDEBUG -DNO_TOUCH_SUPPORT -I../../libs/ main.cpp ../../libs/stb_vorbis/stb_vorbis.c ../../libs/minimp3/minimp3.cpp ../../libs/tinf/tinflate.c -I../../ -o../../../bin/OpenLara_mingw.exe -lopengl32 -lwinmm -lwsock32 -lgdi32 -lm