[Orxonox-commit 7527] r12133 - in code/branches/wagnis_HS18: data/levels data/levels/templates data/overlays src/modules/wagnis
stadlero at orxonox.net
stadlero at orxonox.net
Sun Dec 2 16:08:27 CET 2018
Author: stadlero
Date: 2018-12-02 16:08:26 +0100 (Sun, 02 Dec 2018)
New Revision: 12133
Added:
code/branches/wagnis_HS18/data/levels/Wagnis_testlevel.oxw
code/branches/wagnis_HS18/data/overlays/WagnisHUD.oxo
Modified:
code/branches/wagnis_HS18/data/levels/templates/wagnisCursor.oxt
code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc
code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc
code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc
Log:
Wagnis now progresses through stages
Added: code/branches/wagnis_HS18/data/levels/Wagnis_testlevel.oxw
===================================================================
--- code/branches/wagnis_HS18/data/levels/Wagnis_testlevel.oxw (rev 0)
+++ code/branches/wagnis_HS18/data/levels/Wagnis_testlevel.oxw 2018-12-02 15:08:26 UTC (rev 12133)
@@ -0,0 +1,91 @@
+<LevelInfo
+ name = "Wagnis_testlevel"
+ description = "A clone of the iconic Risk."
+ tags = ""
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("WagnisHUD.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<?lua
+ include("templates/wagnisCursor.oxt")
+?>
+
+
+<Level plugins="wagnis" gametype="Wagnis">
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/skyBoxBasic"
+ >
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+ <SpawnPoint position="-100, 45, 75" lookat="0,45,75" spawnclass=SpaceShip pawndesign=wagnisCursor />
+
+<WagnisGameboard position="20,20,20" connections_string="1=2+3, 2=1, 3=1">
+
+
+ <Provinces>
+
+ <WagnisProvince ID="1" health = 10000000 maxhealth = 10000000 initialhealth = 10000000 collisionType=dynamic mass=100 continent="1" position="0,<?lua print((50))?>,<?lua print((70))?>" rotationrate="<?lua print(math.random() * 50) ?>" rotationaxis="<?lua print((math.random()-1)*5)?>,<?lua print((math.random()-1)*5)?>,<?lua print((math.random()-1)*5)?>">
+ <attached>
+ <Model position="0,0,0" mesh="ast1.mesh" scale3D="1.4,1.4,1.4" />
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape position="0,0,0" radius="2" />
+ </collisionShapes>
+ </WagnisProvince>
+
+ <WagnisProvince ID="2" health = 10000000 maxhealth = 10000000 initialhealth = 10000000 collisionType=dynamic mass=100 continent="1" position="0,<?lua print((40))?>,<?lua print((70))?>" rotationrate="<?lua print(math.random() * 50) ?>" rotationaxis="<?lua print((math.random()-1)*5)?>,<?lua print((math.random()-1)*5)?>,<?lua print((math.random()-1)*5)?>">
+ <attached>
+ <Model position="0,0,0" mesh="ast1.mesh" scale3D="1.4,1.4,1.4" />
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape position="0,0,0" radius="2" />
+ </collisionShapes>
+ </WagnisProvince>
+
+ <WagnisProvince ID="3" health = 10000000 maxhealth = 10000000 initialhealth = 10000000 collisionType=dynamic mass=100 continent="1" position="0,<?lua print((50))?>,<?lua print((80))?>" rotationrate="<?lua print(math.random() * 50) ?>" rotationaxis="<?lua print((math.random()-1)*5)?>,<?lua print((math.random()-1)*5)?>,<?lua print((math.random()-1)*5)?>">
+ <attached>
+ <Model position="0,0,0" mesh="ast1.mesh" scale3D="1.4,1.4,1.4" />
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape position="0,0,0" radius="2" />
+ </collisionShapes>
+ </WagnisProvince>
+
+ <WagnisProvince ID="1000" health = 10000000 maxhealth = 10000000 initialhealth = 10000000 collisionType=dynamic mass=100 continent="1" position="0,<?lua print((50+7))?>,<?lua print((135-6))?>" pitch=90 rotationrate="0" rotationaxis="0,0,0">
+ <attached>
+ <Model position="0,0,0" mesh="broke-satellite.mesh" scale3D="3,3,3" />
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape position="0,0,0" radius="4" />
+ </collisionShapes>
+ </WagnisProvince>
+
+
+ </Provinces>
+</WagnisGameboard>
+
+<Model position="0,0,0" mesh="Coordinates.mesh" scale="20"/>
+<MovableEntity position="0,0,0">
+ <attached>
+ <Billboard position="100,0,0" material="Examples/Flare" colour="0, 0, 1" scale=1/>
+ </attached>
+</MovableEntity>
+
+
+
+
+ </Scene>
+</Level>
+
Modified: code/branches/wagnis_HS18/data/levels/templates/wagnisCursor.oxt
===================================================================
--- code/branches/wagnis_HS18/data/levels/templates/wagnisCursor.oxt 2018-11-29 18:22:46 UTC (rev 12132)
+++ code/branches/wagnis_HS18/data/levels/templates/wagnisCursor.oxt 2018-12-02 15:08:26 UTC (rev 12133)
@@ -1,6 +1,6 @@
<Template name=wagnisCursor>
<SpaceShip
- hudtemplate = spaceshiphud
+ hudtemplate = WagnisHUD
camerapositiontemplate = spaceshipassffcameras
spawnparticlesource = "Orxonox/fairytwirl"
spawnparticleduration = 3
@@ -12,7 +12,7 @@
shieldhealth = 30
initialshieldhealth = 30
maxshieldhealth = 50
- shieldabsorption = 0.8
+ shieldabsorption = 0.8f
shieldrechargerate = 1
shieldrechargewaittime = 1
Added: code/branches/wagnis_HS18/data/overlays/WagnisHUD.oxo
===================================================================
--- code/branches/wagnis_HS18/data/overlays/WagnisHUD.oxo (rev 0)
+++ code/branches/wagnis_HS18/data/overlays/WagnisHUD.oxo 2018-12-02 15:08:26 UTC (rev 12133)
@@ -0,0 +1,14 @@
+<Template name="WagnisHUD">
+ <OverlayGroup name = "WagnisHuD" scale = "1, 1">
+
+ <HUDNavigation
+ name = "Navigation"
+ correctaspect = true
+ font = "Monofur"
+ textsize = 0.02
+ navMarkerSize = 0.03
+ aimMarkerSize = 0.02
+ />
+
+ </OverlayGroup>
+</Template>
\ No newline at end of file
Modified: code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc 2018-11-29 18:22:46 UTC (rev 12132)
+++ code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc 2018-12-02 15:08:26 UTC (rev 12133)
@@ -42,6 +42,7 @@
this->gameStage = CHOOSE_PROVINCE_STAGE;
this->players.at(0)->gameStage = this->gameStage;
this->players.at(0)->is_active = true;
+ orxout()<<"Player "<<1<<"\'s turn. Please choose province."<<endl;
}
//Tick
@@ -67,27 +68,44 @@
player->is_active = false;
if(this->active_player < this->players.size()){
this->active_player++;
- WagnisPlayer* next = this->players[this->active_player-1];
+ WagnisPlayer* next = this->players[this->active_player - 1];
next->gameStage = CHOOSE_PROVINCE_STAGE;
next->is_active = true;
- orxout()<<"Player "<<next->Player_ID<<"\'s turn. Please choose province"<<endl;
+ orxout()<<"Player "<<next->Player_ID<<"\'s turn. Please choose province."<<endl;
}else{
this->active_player = 1;
- WagnisPlayer* next = this->players[this->active_player-1];
+ WagnisPlayer* next = this->players[this->active_player - 1];
next->gameStage = REINFORCEMENT_STAGE;
this->gameStage = REINFORCEMENT_STAGE;
next->is_active = true;
- orxout()<<"Player "<<next->Player_ID<<"\'s turn. Reinforcement"<<endl;
+ orxout()<<"Player "<<next->Player_ID<<"\'s turn. Reinforcement."<<endl;
}
break;
}
case REINFORCEMENT_STAGE:{
+ player->gameStage = ATTACK_STAGE;
+ this->gameStage = ATTACK_STAGE;
+ orxout()<<"Player "<<player->Player_ID<<"\'s turn. Attack."<<endl;
break;
}
case ATTACK_STAGE:{
+ player->gameStage = MOVE_STAGE;
+ this->gameStage = MOVE_STAGE;
+ orxout()<<"Player "<<player->Player_ID<<"\'s turn. Move."<<endl;
break;
}
case MOVE_STAGE:{
+ player->is_active = false;
+ if(this->active_player < this->players.size()){
+ this->active_player++;
+ }else{
+ this->active_player = 1;
+ }
+ WagnisPlayer* next = this->players[this->active_player - 1];
+ orxout()<<"Player "<<next->Player_ID<<"\'s turn. Reinforcement."<<endl;
+ next->gameStage = REINFORCEMENT_STAGE;
+ this->gameStage = REINFORCEMENT_STAGE;
+ next->is_active = true;
break;
}
default:{}
Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc 2018-11-29 18:22:46 UTC (rev 12132)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc 2018-12-02 15:08:26 UTC (rev 12133)
@@ -39,6 +39,7 @@
//Check if next-player-button was hit
if(prov->getID() == 1000){
master->playerFinishedStageCallback(this);
+ prov->setHealth(prov->getMaxHealth());
break;
}
//Check left/right click
@@ -60,17 +61,25 @@
switch(gameStage){
case CHOOSE_PROVINCE_STAGE:
{
- if (checkMove(SET_TROOPS_INITIAL))
+ if (checkMove(SET_TROOPS_INITIAL)){
this->target_province->owner_ID = this->Player_ID;
-
+ this->target_province->troops += 1;
+ orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province->troops<<endl;
+ master->playerFinishedStageCallback(this);
+ }else{
+ orxout()<<"Sorry, someone already owns this provice"<<endl;
+ }
+
break;
}
case REINFORCEMENT_STAGE:
{
- if (checkMove(SET_TROOPS))
+ if (checkMove(SET_TROOPS)){
this->target_province->troops += 1;
-
+ orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province->troops<<endl;
+ }
+
break;
}
case ATTACK_STAGE:{
Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc 2018-11-29 18:22:46 UTC (rev 12132)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc 2018-12-02 15:08:26 UTC (rev 12133)
@@ -21,7 +21,7 @@
//Constructor
WagnisProvince::WagnisProvince(Context* context) : Pawn(context){
RegisterObject(WagnisProvince);
- this->owner_ID = 0;
+ this->owner_ID = -1;
this->troops = 0;
this->ID = -1;
this->continent = -1;
More information about the Orxonox-commit
mailing list