diff options
| author | Olle Rosenquist <phobos99@gmail.com> | 2007-07-21 21:47:21 +0000 |
|---|---|---|
| committer | Olle Rosenquist <phobos99@gmail.com> | 2007-07-21 21:47:21 +0000 |
| commit | 093c50fd47a9c6aa985342140faa2d0d85933ccb (patch) | |
| tree | 2e17b59a1cbd3f088f0c07c7a7dffbd1264c007e /src | |
| parent | 5f39523f4178430af93af8a7c17ffd9893f415a3 (diff) | |
| download | zcatch-093c50fd47a9c6aa985342140faa2d0d85933ccb.tar.gz zcatch-093c50fd47a9c6aa985342140faa2d0d85933ccb.zip | |
Updated stuff
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/client/game_client.cpp | 169 | ||||
| -rw-r--r-- | src/game/game.h | 2 | ||||
| -rw-r--r-- | src/game/server/game_server.cpp | 5 | ||||
| -rw-r--r-- | src/game/server/game_server.h | 1 |
4 files changed, 134 insertions, 43 deletions
diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp index a0886974..c101b291 100644 --- a/src/game/client/game_client.cpp +++ b/src/game/client/game_client.cpp @@ -354,13 +354,13 @@ public: void addparticle(int projectiletype, int projectileid, vec2 pos, vec2 vel) { - int particlespersecond = data->projectileparticles[projectiletype].particlespersecond; + int particlespersecond = data->projectileinfo[projectiletype].particlespersecond; int lastaddtick = lastadd[projectileid % LISTSIZE]; if ((client_tick() - lastaddtick) > (client_tickspeed() / particlespersecond)) { lastadd[projectileid % LISTSIZE] = client_tick(); - float life = data->projectileparticles[projectiletype].particlelife; - float size = data->projectileparticles[projectiletype].particlesize; + float life = data->projectileinfo[projectiletype].particlelife; + float size = data->projectileinfo[projectiletype].particlesize; vec2 v = vel * 0.2f + normalize(vec2(frandom()-0.5f, -frandom()))*(32.0f+frandom()*32.0f); // add the particle (from projectiletype later on, but meh...) @@ -1339,52 +1339,137 @@ void modc_render() { gfx_mapscreen(0, 0, width, height); - float x = 50.0f; - float y = 150.0f; - - gfx_blend_normal(); - - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_quads_setcolor(0,0,0,0.5f); - gfx_quads_drawTL(x-10.f, y-10.f, 400.0f, 600.0f); - gfx_quads_end(); - - gfx_pretty_text(x, y, 64, "Score Board"); - y += 64.0f; - if(gameobj && gameobj->time_limit) + if (gameobj->gametype == GAMETYPE_DM) { - char buf[64]; - sprintf(buf, "Time Limit: %d min", gameobj->time_limit); - gfx_pretty_text(x, y, 32, buf); - y += 32.0f; - } - if(gameobj && gameobj->score_limit) - { - char buf[64]; - sprintf(buf, "Score Limit: %d", gameobj->score_limit); - gfx_pretty_text(x, y, 32, buf); - y += 32.0f; + // Normal deathmatch + + float x = 50.0f; + float y = 150.0f; + + gfx_blend_normal(); + + gfx_texture_set(-1); + gfx_quads_begin(); + gfx_quads_setcolor(0,0,0,0.5f); + gfx_quads_drawTL(x-10.f, y-10.f, 400.0f, 600.0f); + gfx_quads_end(); + + gfx_pretty_text(x, y, 64, "Score Board"); + y += 64.0f; + if(gameobj && gameobj->time_limit) + { + char buf[64]; + sprintf(buf, "Time Limit: %d min", gameobj->time_limit); + gfx_pretty_text(x, y, 32, buf); + y += 32.0f; + } + if(gameobj && gameobj->score_limit) + { + char buf[64]; + sprintf(buf, "Score Limit: %d", gameobj->score_limit); + gfx_pretty_text(x, y, 32, buf); + y += 32.0f; + } + + int num = snap_num_items(SNAP_CURRENT); + for(int i = 0; i < num; i++) + { + snap_item item; + void *data = snap_get_item(SNAP_CURRENT, i, &item); + + if(item.type == OBJTYPE_PLAYER) + { + obj_player *player = (obj_player *)data; + if(player) + { + char buf[128]; + sprintf(buf, "%4d", player->score); + gfx_pretty_text(x+60-gfx_pretty_text_width(48,buf), y, 48, buf); + gfx_pretty_text(x+128, y, 48, client_datas[player->clientid].name); + + render_tee(&idlestate, player->clientid, vec2(1,0), vec2(x+90, y+24)); + y += 58.0f; + } + } + } } - - int num = snap_num_items(SNAP_CURRENT); - for(int i = 0; i < num; i++) + else if (gameobj->gametype == GAMETYPE_TDM) { - snap_item item; - void *data = snap_get_item(SNAP_CURRENT, i, &item); + // Team deathmatch + gfx_blend_normal(); - if(item.type == OBJTYPE_PLAYER) + float x = 50.0f; + float y = 150.0f; + + gfx_texture_set(-1); + gfx_quads_begin(); + gfx_quads_setcolor(0,0,0,0.5f); + gfx_quads_drawTL(x-10.f, y-10.f, 800.0f, 600.0f); + gfx_quads_end(); + + gfx_pretty_text(x, y, 64, "Score Board"); + if(gameobj && gameobj->time_limit) { - obj_player *player = (obj_player *)data; - if(player) + char buf[64]; + sprintf(buf, "Time Limit: %d min", gameobj->time_limit); + gfx_pretty_text(x + 400, y + 25, 32, buf); + } + if(gameobj && gameobj->score_limit) + { + char buf[64]; + sprintf(buf, "Score Limit: %d", gameobj->score_limit); + gfx_pretty_text(x + 400, y + 25, 32, buf); + } + y += 64.0f; + + // Calculate team scores + int teamscore[2]; + teamscore[0] = 0; + teamscore[1] = 0; + int num = snap_num_items(SNAP_CURRENT); + for(int i = 0; i < num; i++) + { + snap_item item; + void *data = snap_get_item(SNAP_CURRENT, i, &item); + + if(item.type == OBJTYPE_PLAYER) { - char buf[128]; - sprintf(buf, "%4d", player->score); - gfx_pretty_text(x+60-gfx_pretty_text_width(48,buf), y, 48, buf); - gfx_pretty_text(x+128, y, 48, client_datas[player->clientid].name); + obj_player *player = (obj_player *)data; + if(player && player->team >= 0 && player->team < 2) + { + teamscore[player->team] += player->score; + } + } + } - render_tee(&idlestate, player->clientid, vec2(1,0), vec2(x+90, y+24)); - y += 58.0f; + char buf[128]; + gfx_pretty_text(x, y, 40, "Team A - "); + sprintf(buf, "%4d", teamscore[0]); + gfx_pretty_text(x + 110, y, 40, buf); + + gfx_pretty_text(x + 400, y, 40, "Team B - "); + sprintf(buf, "%4d", teamscore[1]); + gfx_pretty_text(x + 510, y, 40, buf); + + y += 50.0f; + + for(int i = 0; i < num; i++) + { + snap_item item; + void *data = snap_get_item(SNAP_CURRENT, i, &item); + + if(item.type == OBJTYPE_PLAYER) + { + obj_player *player = (obj_player *)data; + if(player) + { + sprintf(buf, "%4d", player->score); + gfx_pretty_text(x+60-gfx_pretty_text_width(48,buf), y, 48, buf); + gfx_pretty_text(x+128, y, 48, client_datas[player->clientid].name); + + render_tee(&idlestate, player->clientid, vec2(1,0), vec2(x+90, y+24)); + y += 58.0f; + } } } } diff --git a/src/game/game.h b/src/game/game.h index abf4b1c1..00df52bc 100644 --- a/src/game/game.h +++ b/src/game/game.h @@ -112,6 +112,7 @@ struct obj_game int score_limit; int time_limit; + int gametype; }; struct obj_projectile @@ -150,6 +151,7 @@ struct obj_player int hook_active; int hook_x, hook_y; + int team; }; enum diff --git a/src/game/server/game_server.cpp b/src/game/server/game_server.cpp index 559fa1bd..ecb57716 100644 --- a/src/game/server/game_server.cpp +++ b/src/game/server/game_server.cpp @@ -343,7 +343,7 @@ game_world world; gameobject::gameobject() : entity(OBJTYPE_GAME) { - gametype = GAMETYPE_DM; + gametype = GAMETYPE_TDM; game_over_tick = -1; sudden_death = 0; round_start_tick = server_tick(); @@ -431,6 +431,7 @@ void gameobject::snap(int snapping_client) game->score_limit = config.scorelimit; game->time_limit = config.timelimit; game->round_start_tick = round_start_tick; + game->gametype = gametype; } gameobject gameobj; @@ -596,6 +597,7 @@ void player::reset() vel = vec2(0.0f, 0.0f); direction = vec2(0.0f, 1.0f); score = 0; + team = 0; dead = true; die_tick = 0; } @@ -1244,6 +1246,7 @@ void player::snap(int snaping_client) player->angle = (int)(a*256.0f); player->score = score; + player->team = team; } player players[MAX_CLIENTS]; diff --git a/src/game/server/game_server.h b/src/game/server/game_server.h index 46b451e1..7babfdc8 100644 --- a/src/game/server/game_server.h +++ b/src/game/server/game_server.h @@ -239,6 +239,7 @@ public: int currentmovetime; int score; + int team; bool dead; int die_tick; |