From 8ff6a8b62624a3aa4848f26ce04462df814a6aaa Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 25 Sep 2015 17:36:47 +1000 Subject: [PATCH] Make the speed values customizable via cvars, and set default values to be faster (and crazier) --- minigames.cfg | 7 ++++++- qcsrc/common/minigames/cl_minigames.qc | 6 +++--- qcsrc/common/minigames/minigame/snake.qc | 12 +++++++----- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/minigames.cfg b/minigames.cfg index 9922d7e56..167df2df9 100644 --- a/minigames.cfg +++ b/minigames.cfg @@ -11,4 +11,9 @@ set sv_minigames_pong_ball_radius 0.03125 "Ball radius relative to the board s set sv_minigames_pong_ball_number 1 "Number of balls to be played at once" set sv_minigames_pong_ai_thinkspeed 0.1 "Seconds between AI actions" -set sv_minigames_pong_ai_tolerance 0.33 "Distance of the ball relative to the paddle size" \ No newline at end of file +set sv_minigames_pong_ai_tolerance 0.33 "Distance of the ball relative to the paddle size" + + +// Snake? Snake! SNAAAAKE!! +set sv_minigames_snake_delay_initial 0.7 "Initial delay between snake movement" +set sv_minigames_snake_delay_multiplier 50 "Multiplier of incremental of movement speed (player_score / cvar)" diff --git a/qcsrc/common/minigames/cl_minigames.qc b/qcsrc/common/minigames/cl_minigames.qc index b88d21991..24f0b2dbc 100644 --- a/qcsrc/common/minigames/cl_minigames.qc +++ b/qcsrc/common/minigames/cl_minigames.qc @@ -258,9 +258,9 @@ void ent_read_minigame() if ( sf & MINIG_SF_CREATE ) { - LOG_TRACE("CL Reading entity: ",ftos(num_for_edict(self)), - " classname:",self.classname," enttype:",ftos(self.enttype) ); - LOG_TRACE(" sf:",ftos(sf)," netname:",self.netname,"\n\n"); + //LOG_TRACE("CL Reading entity: ",ftos(num_for_edict(self)), + // " classname:",self.classname," enttype:",ftos(self.enttype) ); + //LOG_TRACE(" sf:",ftos(sf)," netname:",self.netname,"\n\n"); } } #undef ReadString diff --git a/qcsrc/common/minigames/minigame/snake.qc b/qcsrc/common/minigames/minigame/snake.qc index c14f79c4d..40e253d47 100644 --- a/qcsrc/common/minigames/minigame/snake.qc +++ b/qcsrc/common/minigames/minigame/snake.qc @@ -10,7 +10,8 @@ const int SNAKE_NUM_CNT = 15; const int SNAKE_TILE_SIZE = 15; -const int SNAKE_DELAY_INITIAL = 0.7; +float autocvar_sv_minigames_snake_delay_initial = 0.7; +float autocvar_sv_minigames_snake_delay_multiplier = 50; .int snake_score; .entity snake_head; @@ -52,8 +53,9 @@ bool snake_valid_tile(string tile) void snake_new_mouse(entity minigame) { RandomSelection_Init(); - for(int i = 0; i < SNAKE_LET_CNT; ++i) - for(int j = 0; j < SNAKE_NUM_CNT; ++j) + int i, j; + for(i = 0; i < SNAKE_LET_CNT; ++i) + for(j = 0; j < SNAKE_NUM_CNT; ++j) { string pos = minigame_tile_buildname(i, j); if(!snake_find_piece(minigame, pos)) @@ -139,7 +141,7 @@ void snake_move_body(entity minigame, bool ate_mouse) if(tail && ate_mouse) { int newcnt = tail.cnt + 1; - minigame.snake_delay = max(0.1, SNAKE_DELAY_INITIAL - (newcnt / 100)); + minigame.snake_delay = max(0.1, autocvar_sv_minigames_snake_delay_initial - (newcnt / autocvar_sv_minigames_snake_delay_multiplier)); snake_add_score(minigame, 1); entity piece = msle_spawn(minigame,"minigame_board_piece"); @@ -236,7 +238,7 @@ int snake_server_event(entity minigame, string event, ...) case "start": { snake_setup_pieces(minigame); - minigame.snake_delay = SNAKE_DELAY_INITIAL; + minigame.snake_delay = autocvar_sv_minigames_snake_delay_initial; minigame.minigame_flags = SNAKE_TURN_WAIT; return true; } -- 2.39.2