1 /* 2 Copyright © 2011-2012 Clint Bellanger 3 Copyright © 2012 Igor Paliychuk 4 Copyright © 2012-2015 Justin Jacobs 5 6 This file is part of FLARE. 7 8 FLARE is free software: you can redistribute it and/or modify it under the terms 9 of the GNU General Public License as published by the Free Software Foundation, 10 either version 3 of the License, or (at your option) any later version. 11 12 FLARE is distributed in the hope that it will be useful, but WITHOUT ANY 13 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License along with 17 FLARE. If not, see http://www.gnu.org/licenses/ 18 */ 19 20 /** 21 * class GameStatePlay 22 * 23 * Handles logic and rendering of the main action game play 24 * Also handles message passing between child objects, often to avoid circular dependencies. 25 */ 26 27 #ifndef GAMESTATEPLAY_H 28 #define GAMESTATEPLAY_H 29 30 #include "CommonIncludes.h" 31 #include "GameState.h" 32 #include "Utils.h" 33 34 class Avatar; 35 class Entity; 36 class MenuManager; 37 class QuestLog; 38 class WidgetLabel; 39 40 class ActionData; 41 42 class Title { 43 public: 44 std::string title; 45 int level; 46 PowerID power; 47 std::vector<StatusID> requires_status; 48 std::vector<StatusID> requires_not_status; 49 std::string primary_stat_1; 50 std::string primary_stat_2; 51 Title()52 Title() 53 : title("") 54 , level(0) 55 , power(0) 56 , requires_status() 57 , requires_not_status() 58 , primary_stat_1("") 59 , primary_stat_2("") { 60 } 61 }; 62 63 class GameStatePlay : public GameState { 64 private: 65 Entity *enemy; 66 67 QuestLog *quests; 68 69 void checkEnemyFocus(); 70 void checkNPCFocus(); 71 void checkLoot(); 72 void checkLootDrop(); 73 void checkTeleport(); 74 void checkCancel(); 75 void checkLog(); 76 void checkBook(); 77 void checkEquipmentChange(); 78 void checkTitle(); 79 void checkUsedItems(); 80 void checkNotifications(); 81 void checkNPCInteraction(); 82 void checkStash(); 83 void checkCutscene(); 84 void checkSaveEvent(); 85 void updateActionBar(unsigned index); 86 void loadTitles(); 87 void resetNPC(); 88 bool checkPrimaryStat(const std::string& first, const std::string& second); 89 90 int npc_id; 91 92 std::vector<Title> titles; 93 94 Timer second_timer; 95 96 bool is_first_map_load; 97 98 static const unsigned UPDATE_ACTIONBAR_ALL = 0; 99 100 public: 101 GameStatePlay(); 102 ~GameStatePlay(); 103 void refreshWidgets(); 104 105 bool isPaused(); 106 void logic(); 107 void render(); 108 void resetGame(); 109 }; 110 111 #endif 112 113