forked from Ports/goldeneye-pc-port
Fix corpses crash
This commit is contained in:
1 parent
5787e3abbc
commit
aa8c2754d9
3 files changed
+23
-4
No files matched your search
@@ -2,13 +2,11 @@
|
||||
#include "bondtypes.h"
|
||||
#include "initunk_005450.h"
|
||||
|
||||
#define MODELHITENTRIES_LEN 600
|
||||
|
||||
extern struct ModelHitEntry *g_ModelHitFreeList; // canonically freedist
|
||||
|
||||
/**
|
||||
* These are linker/BSS labels. g_ModelHitEntries is the start of a
|
||||
* ModelHitEntry[600] pool. g_ModelHitEntriesPenultimate labels entry 598
|
||||
* ModelHitEntry[MODELHITENTRIES_LEN] pool. g_ModelHitEntriesPenultimate labels entry 598
|
||||
* inside that same pool and is kept as a raw char symbol so IDO emits the
|
||||
* original relocation.
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,16 @@
|
||||
#define _INITUNK_005450_H_
|
||||
#include <ultra64.h>
|
||||
|
||||
/* Hit-test/draw-order entries shared by every model drawn in a frame (each
|
||||
* chr takes one per drawable node, ~20-30). PC: room for many more drawn
|
||||
* chrs, e.g. bodies kept by Game.MaxCorpses; exhausting the pool left later
|
||||
* chrs without entries and crashed the next shot test. */
|
||||
#if defined(PLATFORM_64BIT)
|
||||
#define MODELHITENTRIES_LEN 8192
|
||||
#else
|
||||
#define MODELHITENTRIES_LEN 600
|
||||
#endif
|
||||
|
||||
void initModelHitEntryFreeList(void);
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <ultra64.h>
|
||||
#include <memp.h>
|
||||
#include "objecthandler.h"
|
||||
#include "initunk_005450.h"
|
||||
#include "model.h"
|
||||
|
||||
// bss
|
||||
@@ -11,7 +12,7 @@
|
||||
// writes 600*40 bytes from g_ModelHitEntries and overruns the N64-sized placeholders
|
||||
// by 12KB into adjacent .bss globals. Size the pool for the real struct on PC; keep
|
||||
// the original placeholder chain verbatim on N64.
|
||||
char g_ModelHitEntries[600 * sizeof(ModelHitEntry)];
|
||||
char g_ModelHitEntries[MODELHITENTRIES_LEN * sizeof(ModelHitEntry)];
|
||||
#else
|
||||
//CODE.bss:80076A50
|
||||
char g_ModelHitEntries[0xC];
|
||||
@@ -1269,6 +1270,16 @@ s32 sub_GAME_7F06C010(ModelHitEntry **entryptr, coord3d *modelRayStart, coord3d
|
||||
{
|
||||
ModelHitEntry *entry = *entryptr;
|
||||
|
||||
#ifdef PORT
|
||||
/* No entries (the shared pool ran out while drawing): nothing to hit */
|
||||
if (entry == NULL)
|
||||
{
|
||||
*outModel = NULL;
|
||||
*outNode = NULL;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
while (entry->next != NULL)
|
||||
{
|
||||
entry = entry->next;
|
||||
|
||||
Reference in new issue
Block a user