mirror of
https://github.com/bfbbdecomp/bfbb.git
synced 2025-02-17 04:59:23 +00:00
Matches and stuff (#374)
This commit is contained in:
parent
b6cbed8a21
commit
4a88323236
@ -25,6 +25,8 @@ extern void* MemoryFunctions[4];
|
||||
extern U16 last_error;
|
||||
extern OSContext* last_context;
|
||||
|
||||
extern char stringBase0[];
|
||||
|
||||
void** psGetMemoryFunctions()
|
||||
{
|
||||
return MemoryFunctions;
|
||||
@ -40,8 +42,6 @@ U16 my_dsc(U16 dsc)
|
||||
return dsc;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
void MemoryProtectionErrorHandler(U16 last, OSContext* ctx, U64 unk1, U64 unk2)
|
||||
{
|
||||
last_error = last;
|
||||
@ -68,7 +68,13 @@ void TRCInit()
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
S32 RenderWareExit()
|
||||
{
|
||||
RwEngineStop();
|
||||
RwEngineClose();
|
||||
return RwEngineTerm();
|
||||
}
|
||||
|
||||
void iSystemExit()
|
||||
{
|
||||
xDebugExit();
|
||||
@ -79,14 +85,12 @@ void iSystemExit()
|
||||
iFileExit();
|
||||
iTimeExit();
|
||||
xMemExit();
|
||||
}
|
||||
*/
|
||||
|
||||
S32 RenderWareExit()
|
||||
{
|
||||
RwEngineStop();
|
||||
RwEngineClose();
|
||||
return RwEngineTerm();
|
||||
OSPanic
|
||||
(
|
||||
stringBase0 + 0x113, // "iSystem.cpp"
|
||||
0x21d,
|
||||
stringBase0 + 0x144 // "(With apologies to Jim Morrison) This the end, my only friend, The End."
|
||||
);
|
||||
}
|
||||
|
||||
void null_func()
|
||||
@ -135,11 +139,7 @@ void _rwDolphinHeapFree(void* __ptr)
|
||||
}
|
||||
if (__ptr != NULL)
|
||||
{
|
||||
// TODO: clear this up
|
||||
// some number is compared against 0xbeef in the assembly.
|
||||
// 0xbeef was probably a hardcoded constant Heavy iron used.
|
||||
// if (*(U32*)((S32)__ptr + -4) + 0x2153 == 0xbeef)
|
||||
if (*(S32*)((S32)__ptr + -4) == -0x21524111)
|
||||
if ( *(S32*)((S32)__ptr - 4) == 0xDEADBEEF )
|
||||
{
|
||||
free((void*)((S32)__ptr - 32));
|
||||
}
|
||||
|
@ -3136,12 +3136,11 @@ namespace
|
||||
|
||||
namespace
|
||||
{
|
||||
#if 0
|
||||
xVec2 get_texture_size(RwRaster& raster)
|
||||
{
|
||||
// todo: uses int-to-float conversion
|
||||
xVec2 vec = { raster.width / 640.0f, raster.height / 480.0f };
|
||||
return vec;
|
||||
}
|
||||
#endif
|
||||
|
||||
void reset_tag_tex(xtextbox::jot&, const xtextbox&, const xtextbox&, const xtextbox::split_tag&)
|
||||
{
|
||||
|
@ -4,15 +4,9 @@
|
||||
#include <types.h>
|
||||
#include <string.h>
|
||||
|
||||
extern xLightKit* gLastLightKit;
|
||||
extern S32 iModelHack_DisablePrelight;
|
||||
S32 iModelHack_DisablePrelight;
|
||||
xLightKit* gLastLightKit;
|
||||
|
||||
#if 0
|
||||
F32 MAX_COLOR = 1.0f;
|
||||
#endif
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// Will match once able to use float literals
|
||||
xLightKit* xLightKit_Prepare(void* data)
|
||||
{
|
||||
xLightKit* lkit = (xLightKit*)data;
|
||||
@ -27,8 +21,8 @@ xLightKit* xLightKit_Prepare(void* data)
|
||||
}
|
||||
|
||||
// If any of the colors is greater than 1.0, normalize back to 0-1
|
||||
if (currlight->color.red > MAX_COLOR || currlight->color.green > MAX_COLOR ||
|
||||
currlight->color.blue > MAX_COLOR)
|
||||
if (currlight->color.red > 1.0f || currlight->color.green > 1.0f ||
|
||||
currlight->color.blue > 1.0f)
|
||||
{
|
||||
F32 s;
|
||||
s = MAX(MAX(currlight->color.red, currlight->color.green), currlight->color.blue);
|
||||
@ -93,7 +87,6 @@ xLightKit* xLightKit_Prepare(void* data)
|
||||
|
||||
return (xLightKit*)data;
|
||||
}
|
||||
#endif
|
||||
|
||||
void xLightKit_Enable(xLightKit* lkit, RpWorld* world)
|
||||
{
|
||||
|
@ -6,8 +6,6 @@
|
||||
extern F32 lbl_803CCEE8; // 0.95f
|
||||
extern F32 lbl_803CCEF0; // 176f
|
||||
|
||||
#if 0
|
||||
// Can't figure out how to match the bottom part due to the weird float stuff going on.
|
||||
void XOrdInit(st_XORDEREDARRAY* array, S32 size, S32 tempAlloc)
|
||||
{
|
||||
U32 cnt = 1;
|
||||
@ -21,7 +19,7 @@ void XOrdInit(st_XORDEREDARRAY* array, S32 size, S32 tempAlloc)
|
||||
}
|
||||
else
|
||||
{
|
||||
array->list = (void**)xMemAlloc(cnt << 2);
|
||||
array->list = (void**)xMemAlloc(gActiveHeap, cnt << 2, 0);
|
||||
}
|
||||
array->cnt = 0;
|
||||
array->max = cnt;
|
||||
@ -33,8 +31,6 @@ void XOrdInit(st_XORDEREDARRAY* array, S32 size, S32 tempAlloc)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void XOrdReset(st_XORDEREDARRAY* array)
|
||||
{
|
||||
array->cnt = 0;
|
||||
@ -89,8 +85,8 @@ void XOrdInsert(st_XORDEREDARRAY* array, void* elt, XOrdCompareCallback compare)
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// WIP. The comparisons are probably wrong.
|
||||
|
||||
|
||||
void* XOrdRemove(st_XORDEREDARRAY* array, void* elt, S32 index)
|
||||
{
|
||||
if (elt == NULL)
|
||||
@ -99,41 +95,44 @@ void* XOrdRemove(st_XORDEREDARRAY* array, void* elt, S32 index)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else if (index >= array->max)
|
||||
if (index >= array->max)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (index >= 0)
|
||||
|
||||
if ((index >= 0) && (index < array->max))
|
||||
{
|
||||
if (index < array->max)
|
||||
elt = array->list[index];
|
||||
}
|
||||
else if (elt != NULL)
|
||||
{
|
||||
index = -1;
|
||||
int iVar4 = 0;
|
||||
for (int i = array->cnt; i > 0; i--)
|
||||
{
|
||||
elt = array->list[index]
|
||||
}
|
||||
else
|
||||
{
|
||||
if (elt != NULL)
|
||||
if (array->list[iVar4] == elt)
|
||||
{
|
||||
// LOOP.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ANOTHER LOOP :>
|
||||
return elt;
|
||||
}
|
||||
index = iVar4;
|
||||
break;
|
||||
}
|
||||
iVar4++;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
if (index < 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
array->cnt--;
|
||||
for (; index < array->cnt; index++)
|
||||
{
|
||||
array->list[index] = array->list[index + 1];
|
||||
}
|
||||
|
||||
return elt;
|
||||
}
|
||||
|
||||
#if 0
|
||||
S32 XOrdLookup(st_XORDEREDARRAY* array, const void* key, XOrdTestCallback test)
|
||||
|
Loading…
x
Reference in New Issue
Block a user