Skip to content

Commit

Permalink
Merge pull request #800 from WALLOFJUSTICE/dev-23-q1
Browse files Browse the repository at this point in the history
* last ghosty bits?
  • Loading branch information
WALLOFJUSTICE authored Oct 5, 2023
2 parents dc9db30 + 9b6d028 commit adc476d
Show file tree
Hide file tree
Showing 13 changed files with 317 additions and 34 deletions.
2 changes: 2 additions & 0 deletions lang/en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7832,5 +7832,7 @@ intro - God Rest Ye Merry Gentlemen by NaturesEye#
6047 Haunt#
6048 Push#
6049 View Wheel#
6050 SPECTATE#
6051 SPAWN AS GHOST#

6100 end#
31 changes: 19 additions & 12 deletions src/actplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ void Player::Ghost_t::handleActions()
target = my;
}

if ( calloutMenu.createParticleCallout(target) )
if ( calloutMenu.createParticleCallout(target, CalloutRadialMenu::CALLOUT_CMD_LOOK) )
{
calloutMenu.sendCalloutText(CalloutRadialMenu::CALLOUT_CMD_LOOK);
}
Expand Down Expand Up @@ -900,7 +900,7 @@ void Player::Ghost_t::handleActions()
}

if ( !player.usingCommand() && player.bControlEnabled
&& !gamePaused )
&& !gamePaused && CalloutRadialMenu::calloutMenuEnabledForGamemode() )
{
bool showCalloutCommandsOnGamepad = false;
auto showCalloutCommandsFind = b.find("Call Out");
Expand Down Expand Up @@ -2075,6 +2075,7 @@ void actDeathGhost(Entity* my)
#define DEATHCAM_IDLETIME my->skill[3]
#define DEATHCAM_IDLEROTATEDIRYAW my->skill[4]
#define DEATHCAM_IDLEROTATEPITCHINIT my->skill[5]
#define DEATHCAM_DISABLE_GAMEOVER my->skill[6]
#define DEATHCAM_ROTX my->fskill[0]
#define DEATHCAM_ROTY my->fskill[1]
#define DEATHCAM_IDLEPITCH my->fskill[2]
Expand All @@ -2091,9 +2092,8 @@ void actDeathCam(Entity* my)
}*/
DEATHCAM_TIME++;

/*Uint32 deathcamGameoverPromptTicks = *MainMenu::cvar_fastRestart ? TICKS_PER_SECOND :
(splitscreen ? TICKS_PER_SECOND * 3 : TICKS_PER_SECOND * 6);*/
Uint32 deathcamGameoverPromptTicks = 25;
Uint32 deathcamGameoverPromptTicks = *MainMenu::cvar_fastRestart ? TICKS_PER_SECOND :
(splitscreen ? TICKS_PER_SECOND * 3 : TICKS_PER_SECOND * 6);
if ( gameModeManager.getMode() == GameModeManager_t::GAME_MODE_TUTORIAL )
{
deathcamGameoverPromptTicks = TICKS_PER_SECOND * 3;
Expand All @@ -2118,13 +2118,20 @@ void actDeathCam(Entity* my)
DEATHCAM_PLAYERTARGET = DEATHCAM_PLAYERNUM;
DEATHCAM_IDLEROTATEDIRYAW = (local_rng.rand() % 2 == 0) ? 1 : -1;
}
else if ( DEATHCAM_TIME < deathcamGameoverPromptTicks )
{
if ( players[DEATHCAM_PLAYERNUM]->ghost.isActive() )
{
DEATHCAM_DISABLE_GAMEOVER = 1;
}
}
else if ( DEATHCAM_TIME == deathcamGameoverPromptTicks )
{
if ( gameModeManager.getMode() == GameModeManager_t::GAME_MODE_TUTORIAL )
{
gameModeManager.Tutorial.openGameoverWindow();
}
else
else if ( !players[DEATHCAM_PLAYERNUM]->ghost.isActive() && DEATHCAM_DISABLE_GAMEOVER == 0 )
{
MainMenu::openGameoverWindow(DEATHCAM_PLAYERNUM);
}
Expand Down Expand Up @@ -2279,7 +2286,7 @@ void actDeathCam(Entity* my)
DEATHCAM_PLAYERTARGET = 0;
}
int c = 0;
while (!players[DEATHCAM_PLAYERTARGET] || !players[DEATHCAM_PLAYERTARGET]->entity)
while ( !Player::getPlayerInteractEntity(DEATHCAM_PLAYERTARGET) )
{
if (c > MAXPLAYERS)
{
Expand All @@ -2296,10 +2303,10 @@ void actDeathCam(Entity* my)

if (DEATHCAM_PLAYERTARGET >= 0)
{
if (players[DEATHCAM_PLAYERTARGET] && players[DEATHCAM_PLAYERTARGET]->entity)
if ( auto entity = Player::getPlayerInteractEntity(DEATHCAM_PLAYERTARGET) )
{
my->x = players[DEATHCAM_PLAYERTARGET]->entity->x;
my->y = players[DEATHCAM_PLAYERTARGET]->entity->y;
my->x = entity->x;
my->y = entity->y;
}
else
{
Expand Down Expand Up @@ -6373,7 +6380,7 @@ void actPlayer(Entity* my)
target = my;
}

if ( calloutMenu.createParticleCallout(target) )
if ( calloutMenu.createParticleCallout(target, CalloutRadialMenu::CALLOUT_CMD_LOOK) )
{
calloutMenu.sendCalloutText(CalloutRadialMenu::CALLOUT_CMD_LOOK);
}
Expand Down Expand Up @@ -6448,7 +6455,7 @@ void actPlayer(Entity* my)

bool skipFollowerMenu = false;
if ( !players[PLAYER_NUM]->usingCommand() && players[PLAYER_NUM]->bControlEnabled
&& !gamePaused )
&& !gamePaused && CalloutRadialMenu::calloutMenuEnabledForGamemode() )
{
bool showCalloutCommandsOnGamepad = false;
auto showCalloutCommandsFind = b.find("Call Out");
Expand Down
13 changes: 11 additions & 2 deletions src/collision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ Entity* entityClicked(bool* clickedOnGUI, bool clickCheckOverride, int player, E

bool entityInsideTile(Entity* entity, int x, int y, int z, bool checkSafeTiles)
{
if ( !entity )
{
return false;
}
if ( x < 0 || x >= map.width || y < 0 || y >= map.height || z < 0 || z >= MAPLAYERS )
{
return false;
Expand All @@ -364,7 +368,10 @@ bool entityInsideTile(Entity* entity, int x, int y, int z, bool checkSafeTiles)
{
if ( !checkSafeTiles && !map.tiles[z + y * MAPLAYERS + x * MAPLAYERS * map.height] )
{
return true;
if ( entity->behavior != &actDeathGhost )
{
return true;
}
}
else if ( checkSafeTiles && map.tiles[z + y * MAPLAYERS + x * MAPLAYERS * map.height] )
{
Expand Down Expand Up @@ -656,7 +663,9 @@ int barony_clear(real_t tx, real_t ty, Entity* my)
{
continue; // monsters don't have hard collision with door frames
}
if ( my->behavior == &actDeathGhost && (entity->behavior == &actMonster || entity->behavior == &actPlayer) )
if ( my->behavior == &actDeathGhost && (entity->behavior == &actMonster
|| entity->behavior == &actPlayer
|| (entity->behavior == &actBoulder && entityInsideEntity(my, entity))) )
{
continue;
}
Expand Down
6 changes: 6 additions & 0 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1856,6 +1856,7 @@ void gameLogic(void)
FollowerMenu[i].followerToCommand = nullptr;
FollowerMenu[i].entityToInteractWith = nullptr;
CalloutMenu[i].closeCalloutMenuGUI();
CalloutMenu[i].callouts.clear();
}

// stop all sounds
Expand Down Expand Up @@ -5024,6 +5025,10 @@ void ingameHud()
{
players[player]->bControlEnabled = true;
}
else if ( players[player]->ghost.isActive() )
{
players[player]->bControlEnabled = true;
}
#ifdef USE_IMGUI
if ( ImGui_t::isInit )
{
Expand Down Expand Up @@ -6788,6 +6793,7 @@ int main(int argc, char** argv)
FollowerMenu[i].followerToCommand = nullptr;
FollowerMenu[i].entityToInteractWith = nullptr;
CalloutMenu[i].closeCalloutMenuGUI();
CalloutMenu[i].callouts.clear();
}

// black background
Expand Down
29 changes: 29 additions & 0 deletions src/interface/consolecommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4674,5 +4674,34 @@ namespace ConsoleCommands {
static ConsoleCommand ccmd_reloadtiles("/reloadtiles", "reloads tile textures", []CCMD{
generateTileTextures();
});

static ConsoleCommand ccmd_spawnghost("/respawnasghost", "respawn as a ghost", []CCMD{
if ( !(svFlags & SV_FLAG_CHEATS) )
{
messagePlayer(clientnum, MESSAGE_MISC, Language::get(277));
return;
}

if ( players[clientnum]->ghost.my )
{
players[clientnum]->ghost.setActive(!players[clientnum]->ghost.isActive());
return;
}

if ( stats[clientnum]->HP > 0 )
{
stats[clientnum]->HP = 0;
}

if ( players[clientnum]->entity )
{
players[clientnum]->ghost.initTeleportLocations(players[clientnum]->entity->x / 16, players[clientnum]->entity->y / 16);
}
else
{
players[clientnum]->ghost.initTeleportLocations(players[clientnum]->ghost.startRoomX, players[clientnum]->ghost.startRoomY);
}
players[clientnum]->ghost.spawnGhost();
});
}

Loading

0 comments on commit adc476d

Please sign in to comment.