Skip to content

Commit

Permalink
Fixed XG savegame problem
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jun 11, 2003
1 parent 9f3232a commit 11d9766
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
3 changes: 3 additions & 0 deletions doomsday/Doc/ChangeLog.txt
Expand Up @@ -6,6 +6,9 @@

Version 1.7.11 (work in progress)
--------------
XG:
- when loading a savegame, line activators were not correctly restored

Installer:
- fixed: pressing Enter after typing a path will not close the installer
dialog
Expand Down
4 changes: 4 additions & 0 deletions doomsday/Include/Common/p_xgline.h
Expand Up @@ -241,6 +241,9 @@ typedef struct
float chtimer; // Chain sequence timer.
} xgline_t;

// Used as the activator if there is no real activator.
extern mobj_t dummything;

// Initialize extended lines for the map.
void XL_Init(void);

Expand Down Expand Up @@ -274,6 +277,7 @@ int XG_RandomInt(int min, int max);

void SV_WriteXGLine(line_t *li);
void SV_ReadXGLine(line_t *li);
void XL_UnArchiveLines(void);

#endif

12 changes: 4 additions & 8 deletions doomsday/Src/Common/p_saveg.c
Expand Up @@ -135,7 +135,7 @@ void SV_SetArchiveThing(mobj_t *mo, int num)
mobj_t *SV_GetArchiveThing(int num)
{
if(!num) return NULL;
return thing_archive[num-1];
return thing_archive[num-1];
}

unsigned int SV_GameID(void)
Expand Down Expand Up @@ -909,8 +909,6 @@ void P_UnArchiveThinkers (void)
thinker_t* currentthinker;
thinker_t* next;
mobj_t* mobj;
int i;
line_t *li;

// remove all the current thinkers
currentthinker = thinkercap.next;
Expand Down Expand Up @@ -976,11 +974,9 @@ void P_UnArchiveThinkers (void)
mobj = (mobj_t*) currentthinker;
mobj->target = SV_GetArchiveThing((int)mobj->target);
}
for(i=0, li=lines; i<numlines; i++, li++)
{
if(!li->xg) continue;
li->xg->activator = SV_GetArchiveThing((int)li->xg->activator);
}

// The activator mobjs must be set.
XL_UnArchiveLines();
}


Expand Down
18 changes: 18 additions & 0 deletions doomsday/Src/Common/p_xgsave.c
Expand Up @@ -225,3 +225,21 @@ void SV_ReadXGPlaneMover(void)
mov->thinker.function = XS_PlaneMover;
P_AddThinker(&mov->thinker);
}

/*
* This is called after all thinkers have been loaded.
* We need to set the correct pointers to the line activators.
*/
void XL_UnArchiveLines(void)
{
line_t *line;
mobj_t *activator;
int i;

for(i = 0, line = lines; i < numlines; i++, line++)
if(line->xg)
{
activator = SV_GetArchiveThing((int)line->xg->activator);
line->xg->activator = (activator? activator : &dummything);
}
}

0 comments on commit 11d9766

Please sign in to comment.