| 1 | /* | 
|---|
| 2 |    orxonox - the future of 3D-vertical-scrollers | 
|---|
| 3 |  | 
|---|
| 4 |    Copyright (C) 2004 orx | 
|---|
| 5 |  | 
|---|
| 6 |    This program is free software; you can redistribute it and/or modify | 
|---|
| 7 |    it under the terms of the GNU General Public License as published by | 
|---|
| 8 |    the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 9 |    any later version. | 
|---|
| 10 |  | 
|---|
| 11 | ### File Specific: | 
|---|
| 12 |    main-programmer: Patrick Boenzli | 
|---|
| 13 | */ | 
|---|
| 14 |  | 
|---|
| 15 | #define DEBUG_MODULE_GAME_RULES | 
|---|
| 16 |  | 
|---|
| 17 | #include "singleplayer_shootemup.h" | 
|---|
| 18 |  | 
|---|
| 19 | #include "util/loading/load_param.h" | 
|---|
| 20 | #include "util/loading/factory.h" | 
|---|
| 21 |  | 
|---|
| 22 | #include "render2D/billboard.h" | 
|---|
| 23 | #include "state.h" | 
|---|
| 24 | #include "class_list.h" | 
|---|
| 25 |  | 
|---|
| 26 | #include "player.h" | 
|---|
| 27 | #include "playable.h" | 
|---|
| 28 | #include "space_ships/space_ship.h" | 
|---|
| 29 |  | 
|---|
| 30 |  | 
|---|
| 31 | #include "shared_network_data.h" | 
|---|
| 32 | #include "terrain.h" | 
|---|
| 33 | #include "class_list.h" | 
|---|
| 34 | #include "space_ships/space_ship.h" | 
|---|
| 35 |  | 
|---|
| 36 |  | 
|---|
| 37 | using namespace std; | 
|---|
| 38 |  | 
|---|
| 39 |  | 
|---|
| 40 | CREATE_FACTORY(SingleplayerShootemup, CL_SINGLEPLAYER_SHOOTEMUP); | 
|---|
| 41 |  | 
|---|
| 42 |  | 
|---|
| 43 | /** | 
|---|
| 44 |  * constructor | 
|---|
| 45 |  */ | 
|---|
| 46 | SingleplayerShootemup::SingleplayerShootemup(const TiXmlElement* root) | 
|---|
| 47 |   : GameRules(root) | 
|---|
| 48 | { | 
|---|
| 49 |   this->setClassID(CL_SINGLEPLAYER_SHOOTEMUP, "SingleplayerShootemup"); | 
|---|
| 50 |  | 
|---|
| 51 |  | 
|---|
| 52 |   if( root != NULL) | 
|---|
| 53 |     this->loadParams(root); | 
|---|
| 54 | } | 
|---|
| 55 |  | 
|---|
| 56 | /** | 
|---|
| 57 |  * decontsructor | 
|---|
| 58 |  */ | 
|---|
| 59 | SingleplayerShootemup::~SingleplayerShootemup() | 
|---|
| 60 | { | 
|---|
| 61 | } | 
|---|
| 62 |  | 
|---|
| 63 |  | 
|---|
| 64 |  | 
|---|
| 65 | void SingleplayerShootemup::loadParams(const TiXmlElement* root) | 
|---|
| 66 | { | 
|---|
| 67 |   GameRules::loadParams(root) ; | 
|---|
| 68 |  | 
|---|
| 69 | //   LoadParam(root, "death-penalty-timeout", this, SingleplayerShootemup, setDeathPenaltyTimeout) | 
|---|
| 70 | //       .describe("sets the time in seconds a player has to wait for respawn"); | 
|---|
| 71 | // | 
|---|
| 72 | //   LoadParam(root, "max-kills", this, SingleplayerShootemup, setMaxKills) | 
|---|
| 73 | //       .describe("sets the maximal kills for winning condition"); | 
|---|
| 74 | // | 
|---|
| 75 | //   LoadParam(root, "death-screen-image", this, SingleplayerShootemup, setDeathScreen) | 
|---|
| 76 | //       .describe("sets the death screen image"); | 
|---|
| 77 |  | 
|---|
| 78 | } | 
|---|
| 79 |  | 
|---|
| 80 |  | 
|---|
| 81 |  | 
|---|
| 82 | void SingleplayerShootemup::setDeathScreen(const std::string& imageName) | 
|---|
| 83 | {} | 
|---|
| 84 |  | 
|---|
| 85 |  | 
|---|
| 86 |  | 
|---|
| 87 | /** | 
|---|
| 88 |  * called when the player enters the game | 
|---|
| 89 |  * @param player the spawned player | 
|---|
| 90 |  */ | 
|---|
| 91 | void SingleplayerShootemup::onPlayerSpawn() | 
|---|
| 92 | { | 
|---|
| 93 | } | 
|---|
| 94 |  | 
|---|
| 95 |  | 
|---|
| 96 | /** | 
|---|
| 97 |  * when the player is killed | 
|---|
| 98 |  * @param player the killed player | 
|---|
| 99 |  */ | 
|---|
| 100 | void SingleplayerShootemup::onPlayerDeath() | 
|---|
| 101 | { | 
|---|
| 102 | } | 
|---|
| 103 |  | 
|---|
| 104 |  | 
|---|
| 105 | /** | 
|---|
| 106 |  * time tick | 
|---|
| 107 |  * @param dt time | 
|---|
| 108 |  */ | 
|---|
| 109 | void SingleplayerShootemup::tick(float dt) | 
|---|
| 110 | { | 
|---|
| 111 |   this->checkGameRules(); | 
|---|
| 112 | } | 
|---|
| 113 |  | 
|---|
| 114 |  | 
|---|
| 115 | /** | 
|---|
| 116 |  * draws the stuff | 
|---|
| 117 |  */ | 
|---|
| 118 | void SingleplayerShootemup::draw() | 
|---|
| 119 | {} | 
|---|
| 120 |  | 
|---|
| 121 |  | 
|---|
| 122 | /** | 
|---|
| 123 |  * check the game rules for consistency | 
|---|
| 124 |  */ | 
|---|
| 125 | void SingleplayerShootemup::checkGameRules() | 
|---|
| 126 | {} | 
|---|
| 127 |  | 
|---|
| 128 |  | 
|---|
| 129 |  | 
|---|
| 130 |  | 
|---|
| 131 |  | 
|---|
| 132 |  | 
|---|