Skip to content

Commit a98d46d

Browse files
committed
Add death feature in player menu
1 parent 21cfee9 commit a98d46d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/UI/PlayerMenu.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,23 @@ namespace GUI {
113113
player->setFluidCounter((u32) fluidCounter);
114114
}
115115
ImGui::DragFloat("Water depth", player->getDepthUnderWater(), 1.f, -FLT_MAX, FLT_MAX, "%.3f", flags);
116+
if (ImGui::Button("Death")) {
117+
kill();
118+
}
116119

117120
ImGui::TreePop();
118121
}
119122
}
120123

124+
void kill() {
125+
CStateManager *stateManager = CStateManager_INSTANCE;
126+
CPlayerState *playerState = stateManager->GetPlayerState();
127+
128+
// game checks for flags & 0x80000000 to tell if player is alive
129+
// if flag is set then the player is alive
130+
player->flags &= ~0x80000000;
131+
}
132+
121133
void loadPos() {
122134
CStateManager *stateManager = CStateManager_INSTANCE;
123135
CPlayer *player = stateManager->Player();

0 commit comments

Comments
 (0)