about summary refs log tree commit diff
path: root/src/game
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2008-03-21 19:05:35 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-03-21 19:05:35 +0000
commit48d4aa0e89df0160437bafa71b0f51e61ea0e727 (patch)
treee7b44ee4ead2f8d811d872d661cfeaacea730f73 /src/game
parent45a047ce478e31297eba35e2e3121b25cabeae12 (diff)
downloadzcatch-48d4aa0e89df0160437bafa71b0f51e61ea0e727.tar.gz
zcatch-48d4aa0e89df0160437bafa71b0f51e61ea0e727.zip
added the rifle to the maps and removed it from the starting inventory
Diffstat (limited to 'src/game')
-rw-r--r--src/game/editor/ed_layer_tiles.cpp4
-rw-r--r--src/game/g_mapitems.h1
-rw-r--r--src/game/server/gs_game.cpp5
-rw-r--r--src/game/server/gs_server.cpp8
4 files changed, 12 insertions, 6 deletions
diff --git a/src/game/editor/ed_layer_tiles.cpp b/src/game/editor/ed_layer_tiles.cpp
index d24d67c4..555c26a3 100644
--- a/src/game/editor/ed_layer_tiles.cpp
+++ b/src/game/editor/ed_layer_tiles.cpp
@@ -145,8 +145,8 @@ void LAYER_TILES::brush_flip_x()
 		for(int x = 0; x < width/2; x++)
 		{
 			TILE tmp = tiles[y*width+x];
-			tiles[y*width+x] = tiles[y*width+x+width-1-x];
-			tiles[y*width+x+width-1-x] = tmp;
+			tiles[y*width+x] = tiles[y*width+width-1-x];
+			tiles[y*width+width-1-x] = tmp;
 		}
 
 	for(int y = 0; y < height; y++)
diff --git a/src/game/g_mapitems.h b/src/game/g_mapitems.h
index 48ae492d..3caa5303 100644
--- a/src/game/g_mapitems.h
+++ b/src/game/g_mapitems.h
@@ -38,6 +38,7 @@ enum
 	ENTITY_WEAPON_SHOTGUN,
 	ENTITY_WEAPON_GRENADE,
 	ENTITY_POWERUP_NINJA,
+	ENTITY_WEAPON_RIFLE,
 	NUM_ENTITIES,
 	
 	TILE_AIR=0,
diff --git a/src/game/server/gs_game.cpp b/src/game/server/gs_game.cpp
index 74bb8569..6482fc3d 100644
--- a/src/game/server/gs_game.cpp
+++ b/src/game/server/gs_game.cpp
@@ -65,6 +65,11 @@ bool gameobject::on_entity(int index, vec2 pos)
 		type = POWERUP_WEAPON;
 		subtype = WEAPON_GRENADE;
 	}
+	else if(index == ENTITY_WEAPON_RIFLE)
+	{
+		type = POWERUP_WEAPON;
+		subtype = WEAPON_RIFLE;
+	}
 	else if(index == ENTITY_POWERUP_NINJA)
 	{
 		type = POWERUP_NINJA;
diff --git a/src/game/server/gs_server.cpp b/src/game/server/gs_server.cpp
index 8b9e406f..7eae91e6 100644
--- a/src/game/server/gs_server.cpp
+++ b/src/game/server/gs_server.cpp
@@ -854,8 +854,8 @@ void player::try_respawn()
 	weapons[WEAPON_GUN].got = true;
 	weapons[WEAPON_GUN].ammo = data->weapons[WEAPON_GUN].maxammo;
 
-	weapons[WEAPON_RIFLE].got = true;
-	weapons[WEAPON_RIFLE].ammo = -1;
+	/*weapons[WEAPON_RIFLE].got = true;
+	weapons[WEAPON_RIFLE].ammo = -1;*/
 	
 	active_weapon = WEAPON_GUN;
 	last_weapon = WEAPON_HAMMER;
@@ -1648,10 +1648,10 @@ void powerup::tick()
 		case POWERUP_WEAPON:
 			if(subtype >= 0 && subtype < NUM_WEAPONS)
 			{
-				if(pplayer->weapons[subtype].ammo < 10 || !pplayer->weapons[subtype].got)
+				if(pplayer->weapons[subtype].ammo < data->weapons[subtype].maxammo || !pplayer->weapons[subtype].got)
 				{
 					pplayer->weapons[subtype].got = true;
-					pplayer->weapons[subtype].ammo = min(10, pplayer->weapons[subtype].ammo + data->powerupinfo[type].amount);
+					pplayer->weapons[subtype].ammo = min(data->weapons[subtype].maxammo, pplayer->weapons[subtype].ammo + data->powerupinfo[type].amount);
 					respawntime = data->powerupinfo[type].respawntime;
 
 					// TODO: data compiler should take care of stuff like this