Browse Source

Clean up doom.cpp

pull/4/head
Anders Jenbo 8 years ago committed by Dennis Duda
parent
commit
0a9b8f1c75
  1. 51
      Source/doom.cpp

51
Source/doom.cpp

@ -10,13 +10,11 @@ int DoomQuestState; // idb
int __cdecl doom_get_frame_from_time()
{
int result; // eax
if ( DoomQuestState == 36001 ) {
return 31;
}
if ( DoomQuestState == 36001 )
result = 31;
else
result = DoomQuestState / 1200;
return result;
return DoomQuestState / 1200;
}
void __cdecl doom_alloc_cel()
@ -26,11 +24,9 @@ void __cdecl doom_alloc_cel()
void __cdecl doom_cleanup()
{
void *v0; // ecx
v0 = pDoomCel;
pDoomCel = 0;
mem_free_dbg(v0);
void *ptr = pDoomCel;
pDoomCel = NULL;
mem_free_dbg(ptr);
}
void __cdecl doom_load_graphics()
@ -39,13 +35,13 @@ void __cdecl doom_load_graphics()
{
strcpy(tempstr, "Items\\Map\\MapZDoom.CEL");
}
else if ( doom_quest_time >= 10 )
else if ( doom_quest_time < 10 )
{
sprintf(tempstr, "Items\\Map\\MapZ00%i.CEL", doom_quest_time);
sprintf(tempstr, "Items\\Map\\MapZ000%i.CEL", doom_quest_time);
}
else
{
sprintf(tempstr, "Items\\Map\\MapZ000%i.CEL", doom_quest_time);
sprintf(tempstr, "Items\\Map\\MapZ00%i.CEL", doom_quest_time);
}
LoadFileWithMem(tempstr, pDoomCel);
}
@ -53,13 +49,9 @@ void __cdecl doom_load_graphics()
void __cdecl doom_init()
{
int v0; // eax
doomflag = 1;
doom_alloc_cel();
v0 = -(doom_get_frame_from_time() != 31);
_LOBYTE(v0) = v0 & 0xE1;
doom_quest_time = v0 + 31;
doom_quest_time = doom_get_frame_from_time() == 31 ? 31 : 0;
doom_load_graphics();
}
// 525750: using guessed type int doom_quest_time;
@ -67,8 +59,7 @@ void __cdecl doom_init()
void __cdecl doom_close()
{
if ( doomflag )
{
if ( doomflag ) {
doomflag = 0;
doom_cleanup();
}
@ -77,17 +68,23 @@ void __cdecl doom_close()
void __cdecl doom_draw()
{
if ( doomflag )
{
if ( doom_quest_time != 31 && ++doom_stars_drawn >= 5 )
{
if ( !doomflag ) {
return;
}
if ( doom_quest_time != 31 ) {
doom_stars_drawn++;
if ( doom_stars_drawn >= 5 ) {
doom_stars_drawn = 0;
if ( ++doom_quest_time > doom_get_frame_from_time() )
doom_quest_time++;
if ( doom_quest_time > doom_get_frame_from_time() ) {
doom_quest_time = 0;
}
doom_load_graphics();
}
CelDecodeOnly(64, 511, pDoomCel, 1, 640);
}
CelDecodeOnly(64, 511, pDoomCel, 1, 640);
}
// 525750: using guessed type int doom_quest_time;
// 525754: using guessed type int doom_stars_drawn;

Loading…
Cancel
Save