ref: 8f24f63be140a34c9ac19463832bed0e7fabba67
parent: 22200650762b044b2f55026b91a175716d2a73f2
author: James Haley <haleyjd@hotmail.com>
date: Tue Aug 24 23:05:19 EDT 2010
Added riftSpots and fleshed out Strife level exit behavior as far as setting of destmap, riftdest, and riftangle (previously unknown variable dword_9F138). Added functions G_RiftExitLevel, G_RiftPlayer, and G_RiftCheat. Removed G_WorldDone and secretexit variable. Subversion-branch: /branches/strife-branch Subversion-revision: 1967
--- a/src/strife/doomstat.h
+++ b/src/strife/doomstat.h
@@ -235,6 +235,10 @@
// Player spawn spots.
extern mapthing_t playerstarts[MAXPLAYERS];
+// haleyjd 08/24/10: [STRIFE] rift spots
+#define MAXRIFTSPOTS 16
+extern mapthing_t riftSpots[MAXRIFTSPOTS];
+
// Intermission stats.
// Parameters for world map / intermission.
extern wbstartstruct_t wminfo;
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -108,8 +108,13 @@
skill_t gameskill;
boolean respawnmonsters;
int gameepisode;
-int gamemap;
+int gamemap;
+// haleyjd 08/24/10: [STRIFE] New variables
+int destmap; // current destination map when exiting
+int riftdest; // destination spot for player
+angle_t riftangle; // player angle saved during exit
+
// If non-zero, exit the level after this number of minutes.
int timelimit;
@@ -920,7 +925,6 @@
}
// Have we just finished displaying an intermission screen?
-
// haleyjd 08/23/10: [STRIFE] No intermission.
/*
if (oldgamestate == GS_INTERMISSION && gamestate != GS_INTERMISSION)
@@ -938,7 +942,7 @@
P_Ticker ();
ST_Ticker ();
AM_Ticker ();
- HU_Ticker ();
+ HU_Ticker ();
break;
// haleyjd 08/23/10: [STRIFE] No intermission.
@@ -1188,12 +1192,49 @@
//
// G_DoCompleted
//
-boolean secretexit;
+//boolean secretexit;
extern char* pagename;
-
-void G_ExitLevel (void)
-{
- secretexit = false;
+
+//
+// G_RiftExitLevel
+//
+// haleyjd 08/24/10: [STRIFE] New function
+// * Called from some exit linedefs to exit to a specific riftspot in the
+// given destination map.
+//
+void G_RiftExitLevel(int map, int spot, angle_t angle)
+{
+ gameaction = ga_completed;
+ // STRIFE-TODO: special handling for post-Sigil map changes
+ /*
+ if(players[0].weaponowned[wp_sigil])
+ {
+ if(map == 3) // Front Base -> Abandoned Front Base
+ map = 30;
+ if(map == 7) // Castle -> New Front Base
+ map = 10;
+ }
+ */
+ // no rifting in deathmatch games
+ if(deathmatch)
+ spot = 0;
+ riftangle = angle;
+ riftdest = spot;
+ destmap = map;
+}
+
+//
+// G_ExitLevel
+//
+// haleyjd 08/24/10: [STRIFE]:
+// * Default to next map in numeric order; init destmap and riftdest.
+//
+void G_ExitLevel (int dest)
+{
+ if(dest == 0)
+ dest = gamemap + 1;
+ destmap = dest;
+ riftdest = 0;
gameaction = ga_completed;
}
@@ -1224,18 +1265,22 @@
//
void G_DoCompleted (void)
{
- // STRIFE-TODO: save automap powerup state (possibly inlined from G_PlayerFinishLevel)
- // set destmap, stonecold
+ // STRIFE-TODO: save automap powerup state (possibly inlined from G_PlayerFinishLevel);
+ // set stonecold to 0
if (automapactive)
AM_Stop ();
// STRIFE-TODO: needs call to G_DoSaveGame for hubs
+ // if(!deathmatch)
+ // G_DoSaveGame(savepath2);
gameaction = ga_worlddone;
}
+// haleyjd 08/24/10: [STRIFE] No secret exits.
+/*
//
// G_WorldDone
//
@@ -1244,7 +1289,7 @@
gameaction = ga_worlddone;
if (secretexit)
- players[consoleplayer].didsecret = true;
+ players[consoleplayer].didsecret = true;
if ( gamemode == commercial )
{
@@ -1263,18 +1308,56 @@
}
}
}
-
+*/
+
+//
+// G_RiftPlayer
+//
+// haleyjd 08/24/10: [STRIFE] New function
+// Teleports the player to the appropriate rift spot.
+//
+void G_RiftPlayer(void)
+{
+ if(riftdest)
+ {
+ P_TeleportMove(players[0].mo,
+ riftSpots[riftdest - 1].x << FRACBITS,
+ riftSpots[riftdest - 1].y << FRACBITS);
+ players[0].mo->angle = riftangle;
+ players[0].mo->health = players[0].health;
+ }
+}
+
+//
+// G_RiftCheat
+//
+// haleyjd 08/24/10: [STRIFE] New function
+// Called from the cheat code to jump to a rift spot.
+//
+boolean G_RiftCheat(int riftSpotNum)
+{
+ return P_TeleportMove(players[0].mo,
+ riftSpots[riftSpotNum - 1].x << FRACBITS,
+ riftSpots[riftSpotNum - 1].y << FRACBITS);
+}
+
+//
+// G_DoWorldDone
+//
+// haleyjd 08/24/10: [STRIFE] Added destmap -> gamemap set.
+// STRIFE-TODO: Load hub save and other changes.
+//
void G_DoWorldDone (void)
{
gamestate = GS_LEVEL;
- gamemap = wminfo.next+1;
+ gamemap = destmap;
G_DoLoadLevel ();
gameaction = ga_nothing;
viewactive = true;
}
-
+
//
// G_InitFromSavegame
// Can be called by the startup code or the menu task.
@@ -1450,7 +1533,12 @@
// The sky texture to be used instead of the F_SKY1 dummy.
extern int skytexture;
-
+//
+// G_InitNew
+//
+// haleyjd 08/24/10: [STRIFE]:
+// * Added riftdest initialization
+//
void
G_InitNew
( skill_t skill,
@@ -1508,7 +1596,8 @@
respawnmonsters = true;
else
respawnmonsters = false;
-
+
+ // STRIFE-TODO: (broken) Strife skill level mobjinfo/states tweaking
if (fastparm || (skill == sk_nightmare && gameskill != sk_nightmare) )
{
for (i=S_SARG_RUN1 ; i<=S_SARG_PAIN2 ; i++)
@@ -1539,6 +1628,7 @@
gameepisode = episode;
gamemap = map;
gameskill = skill;
+ riftdest = 0; // haleyjd 08/24/10: [STRIFE] init riftdest to zero on new game
viewactive = true;
@@ -1552,6 +1642,7 @@
// restore from a saved game. This was fixed before the Doom
// source release, but this IS the way Vanilla DOS Doom behaves.
+ // STRIFE-TODO: Strife skies (of which there are but two)
if (gamemode == commercial)
{
if (gamemap < 12)
@@ -1585,7 +1676,8 @@
skytexture = R_TextureNumForName(skytexturename);
-
+ // STRIFE-TODO:
+ // G_LoadPath(gamemap)
G_DoLoadLevel ();
}
--- a/src/strife/g_game.h
+++ b/src/strife/g_game.h
@@ -65,10 +65,10 @@
void G_TimeDemo (char* name);
boolean G_CheckDemoStatus (void);
-void G_ExitLevel (void);
+void G_ExitLevel (int dest);
//void G_SecretExitLevel (void);
-void G_WorldDone (void);
+//void G_WorldDone (void);
// Read current data from inputs and build a player movement command.
--- a/src/strife/p_enemy.c
+++ b/src/strife/p_enemy.c
@@ -1766,7 +1766,7 @@
}
}
- G_ExitLevel ();
+ G_ExitLevel (0);
}
@@ -1909,7 +1909,7 @@
void A_BrainDie (mobj_t* mo)
{
- G_ExitLevel ();
+ G_ExitLevel (0);
}
void A_BrainSpit (mobj_t* mo)
--- a/src/strife/p_local.h
+++ b/src/strife/p_local.h
@@ -262,7 +262,6 @@
extern mobj_t** blocklinks; // for thing chains
-
//
// P_INTER
//
--- a/src/strife/p_setup.c
+++ b/src/strife/p_setup.c
@@ -114,6 +114,8 @@
mapthing_t* deathmatch_p;
mapthing_t playerstarts[MAXPLAYERS];
+// haleyjd 08/24/10: [STRIFE] rift spots for player spawning
+mapthing_t riftSpots[MAXRIFTSPOTS];
@@ -319,6 +321,8 @@
//
// P_LoadThings
//
+// haleyjd 08/24/10: [STRIFE]:
+// * Added code to record rift spots
void P_LoadThings (int lump)
{
byte *data;
@@ -330,42 +334,56 @@
data = W_CacheLumpNum (lump,PU_STATIC);
numthings = W_LumpLength (lump) / sizeof(mapthing_t);
-
+
mt = (mapthing_t *)data;
for (i=0 ; i<numthings ; i++, mt++)
{
- spawn = true;
+ spawn = true;
- // Do not spawn cool, new monsters if !commercial
- if (gamemode != commercial)
- {
- switch (SHORT(mt->type))
- {
- case 68: // Arachnotron
- case 64: // Archvile
- case 88: // Boss Brain
- case 89: // Boss Shooter
- case 69: // Hell Knight
- case 67: // Mancubus
- case 71: // Pain Elemental
- case 65: // Former Human Commando
- case 66: // Revenant
- case 84: // Wolf SS
- spawn = false;
- break;
- }
- }
- if (spawn == false)
- break;
+ // Do not spawn cool, new monsters if !commercial
+ // STRIFE-TODO: replace with isregistered stuff
+ if (gamemode != commercial)
+ {
+ switch (SHORT(mt->type))
+ {
+ case 68: // Arachnotron
+ case 64: // Archvile
+ case 88: // Boss Brain
+ case 89: // Boss Shooter
+ case 69: // Hell Knight
+ case 67: // Mancubus
+ case 71: // Pain Elemental
+ case 65: // Former Human Commando
+ case 66: // Revenant
+ case 84: // Wolf SS
+ spawn = false;
+ break;
+ }
+ }
+ if (spawn == false)
+ break;
- // Do spawn all other stuff.
- spawnthing.x = SHORT(mt->x);
- spawnthing.y = SHORT(mt->y);
- spawnthing.angle = SHORT(mt->angle);
- spawnthing.type = SHORT(mt->type);
- spawnthing.options = SHORT(mt->options);
-
- P_SpawnMapThing(&spawnthing);
+ // Do spawn all other stuff.
+ spawnthing.x = SHORT(mt->x);
+ spawnthing.y = SHORT(mt->y);
+ spawnthing.angle = SHORT(mt->angle);
+ spawnthing.type = SHORT(mt->type);
+ spawnthing.options = SHORT(mt->options);
+
+ // haleyjd 08/24/2010: Special Strife checks
+ if(spawnthing.type >= 118 && spawnthing.type < 128)
+ {
+ // initialize riftSpots
+ int riftSpotNum = spawnthing.type - 118;
+ riftSpots[riftSpotNum] = spawnthing;
+ riftSpots[riftSpotNum].type = 1;
+ }
+ else if(spawnthing.type >= 9001 && spawnthing.type < 9011)
+ {
+ // STRIFE-TODO: mystery array of 90xx objects
+ }
+ else
+ P_SpawnMapThing(&spawnthing);
}
W_ReleaseLumpNum(lump);
--- a/src/strife/p_spec.c
+++ b/src/strife/p_spec.c
@@ -694,7 +694,7 @@
case 52:
// EXIT!
- G_ExitLevel ();
+ G_ExitLevel (0);
break;
case 53:
@@ -1077,7 +1077,7 @@
P_DamageMobj (player->mo, NULL, NULL, 20);
if (player->health <= 10)
- G_ExitLevel();
+ G_ExitLevel(0);
break;
default:
@@ -1111,7 +1111,7 @@
{
levelTimeCount--;
if (!levelTimeCount)
- G_ExitLevel();
+ G_ExitLevel(0);
}
// ANIMATE FLATS AND TEXTURES GLOBALLY
--- a/src/strife/p_switch.c
+++ b/src/strife/p_switch.c
@@ -361,7 +361,7 @@
case 11:
// Exit level
P_ChangeSwitchTexture(line,0);
- G_ExitLevel ();
+ G_ExitLevel (0);
break;
case 14: