GameBearShootWindow.h (3895B)
1 /* 2 =========================================================================== 3 4 Doom 3 BFG Edition GPL Source Code 5 Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. 6 7 This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). 8 9 Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation, either version 3 of the License, or 12 (at your option) any later version. 13 14 Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>. 21 22 In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. 23 24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 26 =========================================================================== 27 */ 28 #ifndef __GAME_BEARSHOOT_WINDOW_H__ 29 #define __GAME_BEARSHOOT_WINDOW_H__ 30 31 class idGameBearShootWindow; 32 33 class BSEntity { 34 public: 35 const idMaterial * material; 36 idStr materialName; 37 float width, height; 38 bool visible; 39 40 idVec4 entColor; 41 idVec2 position; 42 float rotation; 43 float rotationSpeed; 44 idVec2 velocity; 45 46 bool fadeIn; 47 bool fadeOut; 48 49 idGameBearShootWindow * game; 50 51 public: 52 BSEntity(idGameBearShootWindow* _game); 53 virtual ~BSEntity(); 54 55 virtual void WriteToSaveGame( idFile *savefile ); 56 virtual void ReadFromSaveGame( idFile *savefile, idGameBearShootWindow* _game ); 57 58 void SetMaterial(const char* name); 59 void SetSize( float _width, float _height ); 60 void SetVisible( bool isVisible ); 61 62 virtual void Update( float timeslice ); 63 virtual void Draw(); 64 65 private: 66 }; 67 68 69 class idGameBearShootWindow : public idWindow { 70 public: 71 idGameBearShootWindow(idUserInterfaceLocal *gui); 72 ~idGameBearShootWindow(); 73 74 virtual void WriteToSaveGame( idFile *savefile ); 75 virtual void ReadFromSaveGame( idFile *savefile ); 76 77 virtual const char* HandleEvent(const sysEvent_t *event, bool *updateVisuals); 78 virtual void PostParse(); 79 virtual void Draw(int time, float x, float y); 80 virtual const char* Activate(bool activate); 81 virtual idWinVar * GetWinVarByName (const char *_name, bool winLookup = false, drawWin_t** owner = NULL); 82 83 private: 84 void CommonInit(); 85 void ResetGameState(); 86 87 void UpdateBear(); 88 void UpdateHelicopter(); 89 void UpdateTurret(); 90 void UpdateButtons(); 91 void UpdateGame(); 92 void UpdateScore(); 93 94 virtual bool ParseInternalVar(const char *name, idTokenParser *src); 95 96 private: 97 98 idWinBool gamerunning; 99 idWinBool onFire; 100 idWinBool onContinue; 101 idWinBool onNewGame; 102 103 float timeSlice; 104 float timeRemaining; 105 bool gameOver; 106 107 int currentLevel; 108 int goalsHit; 109 bool updateScore; 110 bool bearHitTarget; 111 112 float bearScale; 113 bool bearIsShrinking; 114 int bearShrinkStartTime; 115 116 float turretAngle; 117 float turretForce; 118 119 float windForce; 120 int windUpdateTime; 121 122 idList<BSEntity*> entities; 123 124 BSEntity *turret; 125 BSEntity *bear; 126 BSEntity *helicopter; 127 BSEntity *goal; 128 BSEntity *wind; 129 BSEntity *gunblast; 130 }; 131 132 #endif //__GAME_BEARSHOOT_WINDOW_H__