mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- Shadow Warrior fixes
* added missing entries to saveables. * added several null pointer checks to places where the game crashed.
This commit is contained in:
parent
90ce4a893d
commit
6958e0326d
5 changed files with 31 additions and 13 deletions
|
@ -734,6 +734,7 @@ static saveable_data saveable_coolie_data[] =
|
|||
SAVE_DATA(sg_CoolieDead),
|
||||
|
||||
SAVE_DATA(CoolieActionSet),
|
||||
SAVE_DATA(s_CoolieDeadHead),
|
||||
};
|
||||
|
||||
saveable_module saveable_coolie =
|
||||
|
|
|
@ -2154,6 +2154,7 @@ void
|
|||
UpdatePlayerSprite(PLAYERp pp)
|
||||
{
|
||||
SPRITEp sp = pp->SpriteP;
|
||||
if (!sp) return;
|
||||
|
||||
// Update sprite representation of player
|
||||
|
||||
|
@ -2248,6 +2249,7 @@ DoPlayerZrange(PLAYERp pp)
|
|||
int ceilhit, florhit;
|
||||
short bakcstat;
|
||||
|
||||
if (!pp->SpriteP) return;
|
||||
// Don't let you fall if you're just slightly over a cliff
|
||||
// This function returns the highest and lowest z's
|
||||
// for an entire box, NOT just a point. -Useful for clipping
|
||||
|
@ -8044,7 +8046,7 @@ domovethings(void)
|
|||
ChopsCheck(pp);
|
||||
|
||||
//if (!ScrollMode2D)
|
||||
(*pp->DoPlayerAction)(pp);
|
||||
if (pp->DoPlayerAction) pp->DoPlayerAction(pp);
|
||||
|
||||
UpdatePlayerSprite(pp);
|
||||
|
||||
|
|
|
@ -24,25 +24,22 @@
|
|||
#include "ns.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "tarray.h"
|
||||
BEGIN_SW_NS
|
||||
|
||||
#include "saveable.h"
|
||||
|
||||
|
||||
#define maxModules 35
|
||||
|
||||
static saveable_module *saveablemodules[maxModules];
|
||||
static unsigned nummodules = 0;
|
||||
static TArray<saveable_module*> saveablemodules;
|
||||
|
||||
void Saveable_Init(void)
|
||||
{
|
||||
if (nummodules > 0) return;
|
||||
if (saveablemodules.Size() > 0) return;
|
||||
|
||||
Saveable_Init_Dynamic();
|
||||
|
||||
#define MODULE(x) { \
|
||||
extern saveable_module saveable_ ## x; \
|
||||
saveablemodules[nummodules++] = &saveable_ ## x; \
|
||||
saveablemodules.Push(&saveable_ ## x); \
|
||||
}
|
||||
|
||||
MODULE(actor)
|
||||
|
@ -81,6 +78,7 @@ void Saveable_Init(void)
|
|||
MODULE(zombie)
|
||||
|
||||
MODULE(sector)
|
||||
MODULE(text)
|
||||
}
|
||||
|
||||
int Saveable_FindCodeSym(void *ptr, savedcodesym *sym)
|
||||
|
@ -94,7 +92,7 @@ int Saveable_FindCodeSym(void *ptr, savedcodesym *sym)
|
|||
return 0;
|
||||
}
|
||||
|
||||
for (m=0; m<nummodules; m++)
|
||||
for (m=0; m<saveablemodules.Size(); m++)
|
||||
{
|
||||
for (i=0; i<saveablemodules[m]->numcode; i++)
|
||||
{
|
||||
|
@ -122,7 +120,7 @@ int Saveable_FindDataSym(void *ptr, saveddatasym *sym)
|
|||
return 0;
|
||||
}
|
||||
|
||||
for (m=0; m<nummodules; m++)
|
||||
for (m = 0; m < saveablemodules.Size(); m++)
|
||||
{
|
||||
for (i=0; i<saveablemodules[m]->numdata; i++)
|
||||
{
|
||||
|
@ -148,7 +146,7 @@ int Saveable_RestoreCodeSym(savedcodesym *sym, void **ptr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (sym->module > nummodules) return -1;
|
||||
if (sym->module > saveablemodules.Size()) return -1;
|
||||
if (sym->index >= saveablemodules[sym->module-1]->numcode) return -1;
|
||||
|
||||
*ptr = saveablemodules[sym->module-1]->code[sym->index];
|
||||
|
@ -164,7 +162,7 @@ int Saveable_RestoreDataSym(saveddatasym *sym, void **ptr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (sym->module > nummodules) return -1;
|
||||
if (sym->module > saveablemodules.Size()) return -1;
|
||||
if (sym->index >= saveablemodules[sym->module-1]->numdata) return -1;
|
||||
if (sym->offset >= saveablemodules[sym->module-1]->data[sym->index].size) return -1;
|
||||
|
||||
|
|
|
@ -2598,7 +2598,7 @@ PlayerOperateEnv(PLAYERp pp)
|
|||
{
|
||||
SWBOOL found;
|
||||
|
||||
if (Prediction)
|
||||
if (Prediction || !pp->SpriteP)
|
||||
return;
|
||||
|
||||
////DSPRINTF(ds,"dist %d sectnum %d wallnum %d spritenum %d",nti[nt_ndx].dist, nti[nt_ndx].sectnum, nti[nt_ndx].wallnum, nti[nt_ndx].spritenum);
|
||||
|
|
|
@ -483,4 +483,21 @@ void pMenuClearTextLine(PLAYERp pp)
|
|||
#define TEXT_PLAYER_INFO_TIME (3)
|
||||
#define TEXT_PLAYER_INFO_Y (200 - 40)
|
||||
|
||||
#include "saveable.h"
|
||||
|
||||
static saveable_code saveable_text_code[] =
|
||||
{
|
||||
SAVE_CODE(StringTimer),
|
||||
};
|
||||
|
||||
saveable_module saveable_text =
|
||||
{
|
||||
// code
|
||||
saveable_text_code,
|
||||
SIZ(saveable_text_code),
|
||||
|
||||
// data
|
||||
NULL,0
|
||||
};
|
||||
|
||||
END_SW_NS
|
||||
|
|
Loading…
Reference in a new issue