- When saving game, clear all polymer lights before. Not doing this makes

the SE ones douple, triple, ... after each save.  Maphack lights are reloaded
with polymer_resetlights() (though I've had them disappearing after load, I
couldn't reproduce it afterwards).
- in debugging builds, print a message when polymer_resetlight is called on a
nonexistent one.  The problem is not so much the call itself (it's guarded),
but the fact that resources on the caller side may not have been freed if it
thinks that those lights do in fact exist. Right now, it's not the case though.
- add 'loaded map hack' messages after some other successful loadmaphack calls

git-svn-id: https://svn.eduke32.com/eduke32@2236 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-01-05 21:58:23 +00:00
parent 146e1f1c09
commit b926e2a496
3 changed files with 18 additions and 4 deletions

View file

@ -232,7 +232,6 @@ static void correct_ornamented_sprite(int32_t i, int32_t hitw);
static int32_t getfilenames(const char *path, const char *kind);
static void clearfilenames(void);
void loadmhk(int32_t domessage);
void clearkeys(void) { Bmemset(keystatus,0,sizeof(keystatus)); }
@ -801,7 +800,7 @@ void showmouse(void)
*/
static int32_t mhk=0;
void loadmhk(int32_t domessage)
static void loadmhk(int32_t domessage)
{
char *p; char levname[BMAX_PATH];

View file

@ -880,7 +880,8 @@ void polymer_resetlights(void)
lightcount = 0;
loadmaphack(NULL);
if (!loadmaphack(NULL))
OSD_Printf("polymer_resetlights: reloaded maphack\n");
}
void polymer_loadboard(void)
@ -1494,7 +1495,15 @@ int16_t polymer_addlight(_prlight* light)
void polymer_deletelight(int16_t lighti)
{
if (!prlights[lighti].flags.active)
{
#ifdef DEBUGGINGAIDS
if (pr_verbosity >= 1)
OSD_Printf("PR : Called polymer_deletelight on inactive light\n");
// currently known cases: when reloading maphack lights (didn't set maphacklightcnt=0
// but did loadmaphack()->delete_maphack_lights() after polymer_resetlights())
#endif
return;
}
polymer_removelight(lighti);

View file

@ -522,7 +522,8 @@ int32_t G_LoadPlayer(int32_t spot)
p[4]=0;
}
loadmaphack(currentboardfilename);
if (!loadmaphack(currentboardfilename))
OSD_Printf("Loaded map hack file '%s'\n",currentboardfilename);
}
Bmemcpy(&currentboardfilename[0],&boardfilename[0],BMAX_PATH);
@ -885,6 +886,11 @@ int32_t G_SavePlayer(int32_t spot)
return -1;
}
#ifdef POLYMER
if (rendmode == 4)
polymer_resetlights();
#endif
// SAVE!
sv_saveandmakesnapshot(fil, spot, 0, 0, 0);