From: Mario Date: Sat, 26 Sep 2015 08:50:43 +0000 (+1000) Subject: Add an option for classic style wrapping around the screen, rather than instant death... X-Git-Tag: xonotic-v0.8.2~1906^2~6 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0411f28a1b3199991b41dac3c92443ffb03565ff;p=xonotic%2Fxonotic-data.pk3dir.git Add an option for classic style wrapping around the screen, rather than instant death on the touch of a wall --- diff --git a/minigames.cfg b/minigames.cfg index e18b13b07..6dfec5088 100644 --- a/minigames.cfg +++ b/minigames.cfg @@ -15,6 +15,7 @@ set sv_minigames_pong_ai_tolerance 0.33 "Distance of the ball relative to th // Snake? Snake! SNAAAAKE!! +set sv_minigames_snake_wrap 0 "Wrap around the edges of the screen instead of dying on touch" 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)" set sv_minigames_snake_delay_min 0.1 "Minimum delay between snake movement (at fastest rate)" diff --git a/qcsrc/common/minigames/minigame/snake.qc b/qcsrc/common/minigames/minigame/snake.qc index 47cf81ab9..493e7250c 100644 --- a/qcsrc/common/minigames/minigame/snake.qc +++ b/qcsrc/common/minigames/minigame/snake.qc @@ -10,6 +10,7 @@ const int SNAKE_NUM_CNT = 15; const int SNAKE_TILE_SIZE = 15; +bool autocvar_sv_minigames_snake_wrap = false; float autocvar_sv_minigames_snake_delay_initial = 0.7; float autocvar_sv_minigames_snake_delay_multiplier = 50; float autocvar_sv_minigames_snake_delay_min = 0.1; @@ -163,10 +164,17 @@ void snake_move_head(entity minigame) int myx = minigame_tile_letter(head.netname); int myy = minigame_tile_number(head.netname); - myx += minigame.snake_dir_x; - myy += minigame.snake_dir_y; + string newpos; - string newpos = minigame_tile_buildname(myx, myy); + if(autocvar_sv_minigames_snake_wrap) + newpos = minigame_relative_tile(head.netname, minigame.snake_dir_x, minigame.snake_dir_y, SNAKE_NUM_CNT, SNAKE_LET_CNT); + else + { + myx += minigame.snake_dir_x; + myy += minigame.snake_dir_y; + + newpos = minigame_tile_buildname(myx, myy); + } if(!snake_valid_tile(newpos) || (snake_find_piece(minigame, newpos)).cnt) {