Skip to content

Commit

Permalink
Hexen: Implement "Wand start" game mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Dasperal committed May 12, 2024
1 parent 9f5ec17 commit 61201be
Showing 1 changed file with 42 additions and 6 deletions.
48 changes: 42 additions & 6 deletions src/hexen/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -1219,17 +1219,53 @@ void G_PlayerExitMap(int playerNumber)
}
else
{
if (P_GetMapCluster(gamemap) != P_GetMapCluster(LeaveMap))
{ // Entering new cluster
// Entering new cluster
if(P_GetMapCluster(gamemap) != P_GetMapCluster(LeaveMap))
{
// Strip all keys
player->keys = 0;

// Strip flight artifact
for (i = 0; i < 25; i++)
// Reset player in wandstart mode
if(singleplayer && !vanillaparm && pistol_start)
{
player->powers[pw_flight] = 0;
P_PlayerUseArtifact(player, arti_fly);
memset(player->armorpoints, 0, sizeof(player->armorpoints));
memset(player->weaponowned, 0, sizeof(player->weaponowned));
memset(player->mana, 0, sizeof(player->mana));
player->health = player->mo->health = MAXHEALTH;
player->pieces = 0;
player->readyweapon = player->pendingweapon = player->mo->special1.i = WP_FIRST;
player->weaponowned[WP_FIRST] = true;

// Remove all non-puzzle items
// Keep puzzle items for wad compatibility
for(i = 0; i < player->inventorySlotNum; i++)
{
if(player->inventory[i].type < arti_firstpuzzitem)
{
// Set count to 1 because P_PlayerRemoveArtifact removes only 1 artifact
player->inventory[i].count = 1;
P_PlayerRemoveArtifact(player, i);
// inventory array is shifted when artifact is removed, so stay on the same slot
i--;
}
}
}
else
{
// Remove flight artifact
for(i = 0; i < player->inventorySlotNum; i++)
{
if(player->inventory[i].type == arti_fly)
{
// Set count to 1 because P_PlayerRemoveArtifact removes only 1 artifact
player->inventory[i].count = 1;
P_PlayerRemoveArtifact(player, i);
break;
}
}
}

// Strip flight powerup
player->powers[pw_flight] = 0;
}
}
Expand Down

0 comments on commit 61201be

Please sign in to comment.