-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathROOMLOAD.C
117 lines (95 loc) · 2.18 KB
/
ROOMLOAD.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#include "ROOMLOAD.H"
#include "CD.H"
#include "DRAW.H"
#include "FILE.H"
#include "GPU.H"
#include "LOAD_LEV.H"
#include "SETUP.H"
#include "TYPEDEFS.H"
#include <stdio.h>
#if !DISC_VERSION
#include "GAMEFLOW.H"
#include <LIBSN.H>
#endif
long AnimFilePos;
long AnimFileLen;
short* floor_data;
unsigned long* SetupPtr;
unsigned short ClutStartY;
struct SVECTOR* RoomBBoxes;
short* mesh_base;
struct PSXSPRITESTRUCT* GLOBAL_default_sprites_ptr;
struct PSXTEXTI* AnimatingWaterfalls[6];
int AnimatingWaterfallsV[6];
unsigned long envmap_data[6];
unsigned long* RelocPtr[128];
void ReloadAnims(int name, long len)//600E4(<), 60D20(<) (*) (*) (D) (D)
{
#if DISC_VERSION
cdCurrentSector = AnimFilePos;
DEL_CDFS_Read((char*) frames, len);
#else
int file;
char buf[80];
strcpy(buf, &gfFilenameWad[gfFilenameOffset[name]]);
strcat(buf, ".PSX");
file = PCopen(buf, 0, 0);
PClseek(file, AnimFilePos, 0);
FILE_Read((char*) frames, 1, len, file);
PCclose(file);
#endif
return;
}
void S_LoadLevelFile(int Name)//60188(<), 60D54(<) (F) (*) () (D) (D)
{
#if !DISC_VERSION
char buf[80];
#endif
unsigned long* mod;
int len;
int file;
#if DISC_VERSION
//TITLE is the base file entry index for levels, simply as a result, we must add gameflow level id to this.
DEL_CDFS_OpenFile(Name + TITLE);
#endif
DrawSync(0);
init_game_malloc();
LOAD_Start(Name + TITLE);
SetupPtr = &db.poly_buffer[0][1026];
mod = &db.poly_buffer[0][1024];
#if DISC_VERSION
DEL_CDFS_Read((char*) mod, gwHeader.entries[NONE].fileSize);//jal 5E414
#else
len = FILE_Length("DATA\\SETUP.MOD");
file = PCopen("DATA\\SETUP.MOD", 0, 0);
FILE_Read((char*)mod, 1, len, file);
PCclose(file);
#endif
/*
* SETUP.MOD
* Layout is:
* [SETUP.BIN]
* [SETUP.REL]
*/
#if RELOC
RelocateModule((unsigned long)SetupPtr, (unsigned long*)(*mod + (unsigned long)SetupPtr));
#endif
#if DISC_VERSION
#if RELOC
((VOIDFUNCVOID*)SetupPtr[LOAD_LEVEL])();
#else
LoadLevel();
#endif
#else
strcpy(&buf[0], &gfFilenameWad[gfFilenameOffset[Name]]);
strcat(&buf[0], ".PSX");
FILE_Length(buf);
#if RELOC
((VOIDFUNCINT*)SetupPtr[LOAD_LEVEL])(PCopen(&buf[0], 0, 0));
#else
LoadLevel(PCopen(buf, 0, 0));
#endif
#endif
LOAD_Stop();
return;
}