Browse Source

Brought `GetLevelMTypes` very close to binary exact

pull/4/head
Dennis Duda 8 years ago
parent
commit
16a576cd5b
  1. 2
      Source/engine.cpp
  2. 2
      Source/engine.h
  3. 22
      Source/monster.cpp

2
Source/engine.cpp

@ -1843,7 +1843,7 @@ int __cdecl GetRndSeed()
// 52B97C: using guessed type int sglGameSeed; // 52B97C: using guessed type int sglGameSeed;
// 52B998: using guessed type int SeedCount; // 52B998: using guessed type int SeedCount;
int __fastcall random(int idx, int v) int __fastcall random(BYTE idx, int v)
{ {
if ( v <= 0 ) if ( v <= 0 )
return 0; return 0;

2
Source/engine.h

@ -45,7 +45,7 @@ void __fastcall DrawLine(int x0, int y0, int x1, int y1, char col);
int __fastcall GetDirection(int x1, int y1, int x2, int y2); int __fastcall GetDirection(int x1, int y1, int x2, int y2);
void __fastcall SetRndSeed(int s); void __fastcall SetRndSeed(int s);
int __cdecl GetRndSeed(); int __cdecl GetRndSeed();
int __fastcall random(int idx, int v); int __fastcall random(BYTE idx, int v);
void __cdecl engine_cpp_init_2(); void __cdecl engine_cpp_init_2();
void __cdecl mem_init_mutex(); void __cdecl mem_init_mutex();
void __cdecl mem_atexit_mutex(); void __cdecl mem_atexit_mutex();

22
Source/monster.cpp

@ -433,6 +433,7 @@ int __fastcall AddMonsterType(int type, int placeflag)
InitMonsterGFX(i); InitMonsterGFX(i);
InitMonsterSND(i); InitMonsterSND(i);
} }
Monsters[i].mPlaceFlags |= placeflag; Monsters[i].mPlaceFlags |= placeflag;
return i; return i;
} }
@ -447,14 +448,9 @@ void __cdecl GetLevelMTypes()
int minl; // min level int minl; // min level
int maxl; // max level int maxl; // max level
char mamask = 3; // monster availability mask? char mamask = 3; // monster availability mask
int nt; // number of types?
// TODO: local variable QuestMask that was referenced in the psx symbols int nt; // number of types
// didn't find any obvious use for that. the casing/naming of it hints at
// a PSX only variable
// maybe it was used instead of QuestStatus() on the console
AddMonsterType(MT_GOLEM, 2); AddMonsterType(MT_GOLEM, 2);
if ( currlevel == 16 ) if ( currlevel == 16 )
@ -533,14 +529,13 @@ void __cdecl GetLevelMTypes()
{ {
for ( i = 0; i < nt; ) for ( i = 0; i < nt; )
{ {
if ( monsterdata[typelist[i]].mType <= 4000 - monstimgtot ) if ( monsterdata[typelist[i]].mType > 4000 - monstimgtot )
{
i++;
}
else
{ {
typelist[i] = typelist[--nt]; typelist[i] = typelist[--nt];
continue;
} }
i++;
} }
if ( nt != 0 ) if ( nt != 0 )
@ -556,8 +551,9 @@ void __cdecl GetLevelMTypes()
else else
{ {
if ( setlvlnum == SL_SKELKING ) if ( setlvlnum == SL_SKELKING )
{
AddMonsterType(MT_SKING, 4); AddMonsterType(MT_SKING, 4);
return; }
} }
} }

Loading…
Cancel
Save