]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make the speed values customizable via cvars, and set default values to be faster...
authorMario <zacjardine@y7mail.com>
Fri, 25 Sep 2015 07:36:47 +0000 (17:36 +1000)
committerMario <zacjardine@y7mail.com>
Fri, 25 Sep 2015 07:36:47 +0000 (17:36 +1000)
minigames.cfg
qcsrc/common/minigames/cl_minigames.qc
qcsrc/common/minigames/minigame/snake.qc

index 9922d7e5674db21aa80098de1f956eb4f8863791..167df2df91d05cf78e0586f2d2c601c1b5152ba1 100644 (file)
@@ -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)"
index b88d219916edc4bd764e085467e1a9a0ec099701..24f0b2dbc7af1b5f3315bf45d57192d7e09b074d 100644 (file)
@@ -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
index c14f79c4d450e60e6c8ca096404dddf5ac26f3dd..40e253d4743f4d1375a6753bfd0c4d7761ac4df2 100644 (file)
@@ -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;
                }