Skip to content

Commit

Permalink
Merge pull request flareteam#309 from dorkster/bugfixes
Browse files Browse the repository at this point in the history
Allow menus to be opened after death
  • Loading branch information
clintbellanger committed Dec 30, 2012
2 parents e3ee779 + 618e8a3 commit 4efea1b
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
4 changes: 4 additions & 0 deletions src/Avatar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Avatar::Avatar(PowerManager *_powers, MapRenderer *_map)
, attacking (false)
, drag_walking(false)
, respawn(false)
, close_menus(false)
{

init();
Expand Down Expand Up @@ -623,6 +624,9 @@ void Avatar::logic(int actionbar_power, bool restrictPowerUse) {
// raise the death penalty flag. Another module will read this and reset.
stats.death_penalty = true;

// close menus in GameStatePlay
close_menus = true;

if (sound_die)
Mix_PlayChannel(-1, sound_die, 0);
if (stats.permadeath) {
Expand Down
1 change: 1 addition & 0 deletions src/Avatar.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class Avatar : public Entity {
bool drag_walking;
bool newLevelNotification;
bool respawn;
bool close_menus;

private:
void handlePower(int actionbar_power);
Expand Down
6 changes: 6 additions & 0 deletions src/GameStatePlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,12 @@ void GameStatePlay::logic() {

}

// close menus when the player dies, but still allow them to be reopened
if (pc->close_menus) {
pc->close_menus = false;
menu->closeAll(false);
}

// these actions occur whether the game is paused or not.
checkNotifications();
checkLootDrop();
Expand Down
2 changes: 1 addition & 1 deletion src/MenuCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ void MenuCharacter::logic() {
int spent = stats->physical_character + stats->mental_character + stats->offense_character + stats->defense_character -4;
skill_points = (stats->level * stats->stat_points_per_level) - spent;

if (spent < (stats->level * stats->stat_points_per_level) && spent < stats->max_spendable_stat_points) {
if (stats->hp > 0 && spent < (stats->level * stats->stat_points_per_level) && spent < stats->max_spendable_stat_points) {
if (stats->physical_character < stats->max_points_per_stat && show_upgrade[0]) upgradeButton[0]->enabled = true;
if (stats->mental_character < stats->max_points_per_stat && show_upgrade[1]) upgradeButton[1]->enabled = true;
if (stats->offense_character < stats->max_points_per_stat && show_upgrade[2]) upgradeButton[2]->enabled = true;
Expand Down
10 changes: 1 addition & 9 deletions src/MenuLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,11 @@ void MenuLog::logic() {
visible = false;
}

tabControl->logic();
int active_log = tabControl->getActiveTab();
msg_buffer[active_log]->logic();
}

/**
* Run the logic for the tabs control.
*/
void MenuLog::tabsLogic()
{
tabControl->logic();
}


/**
* Render graphics for this frame when the menu is open
*/
Expand Down
1 change: 0 additions & 1 deletion src/MenuLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class MenuLog : public Menu {

void update();
void logic();
void tabsLogic();
void render();
void refresh(int log_type);
void add(const std::string& s, int log_type);
Expand Down
2 changes: 0 additions & 2 deletions src/MenuManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ void MenuManager::logic() {

if (log->visible && isWithin(log->window_area,inpt->mouse)) {
inpt->lock[MAIN1] = true;
log->tabsLogic();
}

// pick up an inventory item
Expand Down Expand Up @@ -667,7 +666,6 @@ void MenuManager::logic() {
drag_src = -1;
dragging = false;
}
closeAll(false);
}

// handle equipment changes affecting hero stats
Expand Down

0 comments on commit 4efea1b

Please sign in to comment.