mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
fixed restart command
This commit is contained in:
parent
018abbdd0a
commit
f7b5cfc672
|
@ -21,10 +21,12 @@ MACRO_CONFIG_INT(scroll_weapon, 1, 0, 1)
|
||||||
MACRO_CONFIG_INT(scorelimit, 20, 0, 1000)
|
MACRO_CONFIG_INT(scorelimit, 20, 0, 1000)
|
||||||
MACRO_CONFIG_INT(timelimit, 0, 0, 1000)
|
MACRO_CONFIG_INT(timelimit, 0, 0, 1000)
|
||||||
MACRO_CONFIG_STR(gametype, 32, "dm")
|
MACRO_CONFIG_STR(gametype, 32, "dm")
|
||||||
|
MACRO_CONFIG_INT(restart, 0, 0, 120)
|
||||||
|
|
||||||
MACRO_CONFIG_INT(dbg_bots, 0, 0, 7)
|
MACRO_CONFIG_INT(dbg_bots, 0, 0, 7)
|
||||||
MACRO_CONFIG_INT(cl_predict, 1, 0, 1)
|
MACRO_CONFIG_INT(cl_predict, 1, 0, 1)
|
||||||
|
|
||||||
|
|
||||||
MACRO_CONFIG_STR(sv_maprotation, 512, "")
|
MACRO_CONFIG_STR(sv_maprotation, 512, "")
|
||||||
|
|
||||||
MACRO_CONFIG_INT(dynamic_camera, 1, 0, 1)
|
MACRO_CONFIG_INT(dynamic_camera, 1, 0, 1)
|
||||||
|
|
|
@ -308,8 +308,20 @@ void gameobject::startround()
|
||||||
{
|
{
|
||||||
resetgame();
|
resetgame();
|
||||||
|
|
||||||
if(strlen(config.sv_maprotation))
|
round_start_tick = server_tick();
|
||||||
|
sudden_death = 0;
|
||||||
|
game_over_tick = -1;
|
||||||
|
world->paused = false;
|
||||||
|
teamscore[0] = 0;
|
||||||
|
teamscore[1] = 0;
|
||||||
|
round_count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gameobject::cyclemap()
|
||||||
{
|
{
|
||||||
|
if(!strlen(config.sv_maprotation))
|
||||||
|
return;
|
||||||
|
// handle maprotation
|
||||||
char buf[512];
|
char buf[512];
|
||||||
const char *s = strstr(config.sv_maprotation, config.sv_map);
|
const char *s = strstr(config.sv_maprotation, config.sv_map);
|
||||||
if(s == 0)
|
if(s == 0)
|
||||||
|
@ -342,15 +354,6 @@ void gameobject::startround()
|
||||||
strcpy(config.sv_map, &buf[i]);
|
strcpy(config.sv_map, &buf[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
round_start_tick = server_tick();
|
|
||||||
sudden_death = 0;
|
|
||||||
game_over_tick = -1;
|
|
||||||
world->paused = false;
|
|
||||||
teamscore[0] = 0;
|
|
||||||
teamscore[1] = 0;
|
|
||||||
round_count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gameobject::post_reset()
|
void gameobject::post_reset()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||||
|
@ -374,6 +377,15 @@ void gameobject::on_player_death(class player *victim, class player *killer, int
|
||||||
|
|
||||||
void gameobject::tick()
|
void gameobject::tick()
|
||||||
{
|
{
|
||||||
|
if(game_over_tick != -1)
|
||||||
|
{
|
||||||
|
// game over.. wait for restart
|
||||||
|
if(server_tick() > game_over_tick+server_tickspeed()*10)
|
||||||
|
{
|
||||||
|
cyclemap();
|
||||||
|
startround();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gameobject::snap(int snapping_client)
|
void gameobject::snap(int snapping_client)
|
||||||
|
@ -810,7 +822,7 @@ int player::handle_weapons()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WEAPON_GUN:
|
case WEAPON_GUN:
|
||||||
new projectile(projectile::WEAPON_PROJECTILETYPE_GUN,
|
new projectile(WEAPON_GUN,
|
||||||
client_id,
|
client_id,
|
||||||
pos+vec2(0,0),
|
pos+vec2(0,0),
|
||||||
direction*30.0f,
|
direction*30.0f,
|
||||||
|
@ -821,7 +833,7 @@ int player::handle_weapons()
|
||||||
break;
|
break;
|
||||||
case WEAPON_ROCKET:
|
case WEAPON_ROCKET:
|
||||||
{
|
{
|
||||||
new projectile(projectile::WEAPON_PROJECTILETYPE_ROCKET,
|
new projectile(WEAPON_ROCKET,
|
||||||
client_id,
|
client_id,
|
||||||
pos+vec2(0,0),
|
pos+vec2(0,0),
|
||||||
direction*15.0f,
|
direction*15.0f,
|
||||||
|
@ -838,7 +850,7 @@ int player::handle_weapons()
|
||||||
{
|
{
|
||||||
float a = get_angle(direction);
|
float a = get_angle(direction);
|
||||||
a += i*0.08f;
|
a += i*0.08f;
|
||||||
new projectile(projectile::WEAPON_PROJECTILETYPE_SHOTGUN,
|
new projectile(WEAPON_SHOTGUN,
|
||||||
client_id,
|
client_id,
|
||||||
pos+vec2(0,0),
|
pos+vec2(0,0),
|
||||||
vec2(cosf(a), sinf(a))*25.0f,
|
vec2(cosf(a), sinf(a))*25.0f,
|
||||||
|
@ -1457,6 +1469,12 @@ void mods_tick()
|
||||||
|
|
||||||
if(world->paused) // make sure that the game object always updates
|
if(world->paused) // make sure that the game object always updates
|
||||||
gameobj->tick();
|
gameobj->tick();
|
||||||
|
|
||||||
|
if(config.restart)
|
||||||
|
{
|
||||||
|
gameobj->startround();
|
||||||
|
config.restart = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mods_snap(int client_id)
|
void mods_snap(int client_id)
|
||||||
|
|
|
@ -109,9 +109,8 @@ extern game_world *world;
|
||||||
class gameobject : public entity
|
class gameobject : public entity
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
void cyclemap();
|
||||||
void resetgame();
|
void resetgame();
|
||||||
void startround();
|
|
||||||
void endround();
|
|
||||||
|
|
||||||
int round_start_tick;
|
int round_start_tick;
|
||||||
int game_over_tick;
|
int game_over_tick;
|
||||||
|
@ -124,6 +123,10 @@ protected:
|
||||||
public:
|
public:
|
||||||
int gametype;
|
int gametype;
|
||||||
gameobject();
|
gameobject();
|
||||||
|
|
||||||
|
void startround();
|
||||||
|
void endround();
|
||||||
|
|
||||||
virtual void post_reset();
|
virtual void post_reset();
|
||||||
virtual void tick();
|
virtual void tick();
|
||||||
|
|
||||||
|
@ -160,10 +163,6 @@ public:
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROJECTILE_FLAGS_EXPLODE = 1 << 0,
|
PROJECTILE_FLAGS_EXPLODE = 1 << 0,
|
||||||
|
|
||||||
WEAPON_PROJECTILETYPE_GUN = 0,
|
|
||||||
WEAPON_PROJECTILETYPE_ROCKET = 1,
|
|
||||||
WEAPON_PROJECTILETYPE_SHOTGUN = 2,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
vec2 vel;
|
vec2 vel;
|
||||||
|
|
|
@ -35,11 +35,7 @@ void gameobject_dm::tick()
|
||||||
sudden_death = 1;
|
sudden_death = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
gameobject::tick();
|
||||||
// game over.. wait for restart
|
|
||||||
if(server_tick() > game_over_tick+server_tickspeed()*10)
|
|
||||||
startround();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,6 @@ void gameobject_tdm::tick()
|
||||||
sudden_death = 1;
|
sudden_death = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
gameobject::tick();
|
||||||
// game over.. wait for restart
|
|
||||||
if(server_tick() > game_over_tick+server_tickspeed()*10)
|
|
||||||
startround();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue