]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Update artwork, make fastest delay configurable
authorMario <zacjardine@y7mail.com>
Sat, 26 Sep 2015 08:12:35 +0000 (18:12 +1000)
committerMario <zacjardine@y7mail.com>
Sat, 26 Sep 2015 08:12:35 +0000 (18:12 +1000)
gfx/hud/default/minigames/snake/board.jpg
gfx/hud/default/minigames/snake/body.tga
gfx/hud/default/minigames/snake/feed.tga [deleted file]
gfx/hud/default/minigames/snake/head.tga
gfx/hud/default/minigames/snake/mouse.tga
gfx/hud/default/minigames/snake/tail.tga
gfx/hud/default/minigames/snake/tongue.tga [new file with mode: 0644]
minigames.cfg
qcsrc/common/minigames/minigame/snake.qc

index 410335791716b903514092ee8e7ad1d97a65fbee..dfc5c3cfac254e4deb2084633cdbb137ebd418f2 100644 (file)
Binary files a/gfx/hud/default/minigames/snake/board.jpg and b/gfx/hud/default/minigames/snake/board.jpg differ
index df449b7f0a4d2286835601ed2301b1a8254ba89a..b8064cc40cad66c250dac72394f76b8dc7cf8e44 100644 (file)
Binary files a/gfx/hud/default/minigames/snake/body.tga and b/gfx/hud/default/minigames/snake/body.tga differ
diff --git a/gfx/hud/default/minigames/snake/feed.tga b/gfx/hud/default/minigames/snake/feed.tga
deleted file mode 100644 (file)
index 217299f..0000000
Binary files a/gfx/hud/default/minigames/snake/feed.tga and /dev/null differ
index fad7dbdb2903f41c952a6a9c7eec63aac73c3507..0679f84e630c22688ea7c72075aeda5ccb325e43 100644 (file)
Binary files a/gfx/hud/default/minigames/snake/head.tga and b/gfx/hud/default/minigames/snake/head.tga differ
index 80a34c21d9db2a1e23a1987d62f94eb406d65506..eda8ef7de3a63a9504b879ad31f0b16498b8ff03 100644 (file)
Binary files a/gfx/hud/default/minigames/snake/mouse.tga and b/gfx/hud/default/minigames/snake/mouse.tga differ
index e27c6ee3c6a0ac176de70330e379dbcb21d32a7a..71a790152f821ab2e575241950ad683c11841b68 100644 (file)
Binary files a/gfx/hud/default/minigames/snake/tail.tga and b/gfx/hud/default/minigames/snake/tail.tga differ
diff --git a/gfx/hud/default/minigames/snake/tongue.tga b/gfx/hud/default/minigames/snake/tongue.tga
new file mode 100644 (file)
index 0000000..9818d4e
Binary files /dev/null and b/gfx/hud/default/minigames/snake/tongue.tga differ
index 167df2df91d05cf78e0586f2d2c601c1b5152ba1..e18b13b07af64abdf1f3b440341ea738744e3706 100644 (file)
@@ -17,3 +17,4 @@ set sv_minigames_pong_ai_tolerance  0.33    "Distance of the ball relative to th
 // 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)"
+set sv_minigames_snake_delay_min 0.1 "Minimum delay between snake movement (at fastest rate)"
index 40e253d4743f4d1375a6753bfd0c4d7761ac4df2..47cf81ab9268fa35a5863b819940bc6edd4dd81f 100644 (file)
@@ -12,6 +12,7 @@ const int SNAKE_TILE_SIZE = 15;
 
 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;
 
 .int snake_score;
 .entity snake_head;
@@ -141,7 +142,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, autocvar_sv_minigames_snake_delay_initial - (newcnt / autocvar_sv_minigames_snake_delay_multiplier));
+               minigame.snake_delay = max(autocvar_sv_minigames_snake_delay_min, 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");
@@ -204,8 +205,8 @@ void snake_move(entity minigame, entity player, string dxs, string dys )
                //if ( snake_valid_tile(pos) )
                //if ( snake_find_piece(minigame, pos) )
                {
-                       int dx = ((dxs) ? stof(dxs) : 0);
-                       int dy = ((dys) ? stof(dys) : 0);
+                       int dx = ((dxs) ? bound(-1, stof(dxs), 1) : 0);
+                       int dy = ((dys) ? bound(-1, stof(dys), 1) : 0);
 
                        int myl = minigame_tile_letter(minigame.snake_head.netname);
                        int myn = minigame_tile_number(minigame.snake_head.netname);
@@ -351,17 +352,81 @@ void snake_hud_board(vector pos, vector mySize)
                                thepiece = "snake/tail";
                        if(e.cnt == 1)
                        {
-                               int dx = minigame_tile_letter(e.netname) + e.snake_dir_x;
-                               int dy = minigame_tile_number(e.netname) + e.snake_dir_y;
+                               int dx = minigame_tile_letter(e.netname) + e.snake_dir_x * 2;
+                               int dy = minigame_tile_number(e.netname) + e.snake_dir_y * 2;
                                entity mouse = snake_find_piece(active_minigame, minigame_tile_buildname(dx, dy));
                                thepiece = "snake/head";
                                if(mouse && !mouse.cnt)
-                                       thepiece = "snake/feed";
+                               {
+                                       float myang = 0;
+                                       int myx = minigame_tile_letter(e.netname);
+                                       int myy = minigame_tile_number(e.netname);
+                                       if(myx - 2 == dx)
+                                               myang = M_PI*3/2;
+                                       if(myx + 2 == dx)
+                                               myang = M_PI/2;
+                                       if(myy - 2 == dy)
+                                               myang = M_PI;
+
+                                       int newx = minigame_tile_letter(e.netname) + e.snake_dir_x;
+                                       int newy = minigame_tile_number(e.netname) + e.snake_dir_y;
+                                       string newpos = minigame_tile_buildname(newx, newy);
+
+                                       vector my_pos = minigame_tile_pos(newpos,SNAKE_NUM_CNT,SNAKE_LET_CNT);
+                                       my_pos = minigame_hud_denormalize(my_pos,pos,mySize);
+
+                                       drawrotpic(my_pos, myang, minigame_texture("snake/tongue"),
+                                                       tile_size, tile_size/2, '1 1 1',
+                                                       panel_fg_alpha, DRAWFLAG_NORMAL );
+                               }
                        }
 
-                       minigame_drawpic_centered( tile_pos,  
-                                       minigame_texture(thepiece),
-                                       tile_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL );
+                       if(e.cnt == 1 || e.cnt == tail.cnt)
+                       {
+                               vector thedir = e.snake_dir;
+                               float theang = 0;
+                               if(e.cnt == tail.cnt)
+                               {
+                                       int thex = minigame_tile_letter(e.netname);
+                                       int they = minigame_tile_number(e.netname);
+                                       entity t = snake_find_cnt(active_minigame, e.cnt - 1);
+                                       int tx = minigame_tile_letter(t.netname);
+                                       int ty = minigame_tile_number(t.netname);
+
+                                       if(thex - 1 == tx)
+                                       {
+                                               thedir_y = 0;
+                                               thedir_x = -1;
+                                       }
+                                       if(they + 1 == ty)
+                                       {
+                                               thedir_x = 0;
+                                               thedir_y = 1;
+                                       }
+                                       if(they - 1 == ty)
+                                       {
+                                               thedir_x = 0;
+                                               thedir_y = -1;
+                                       }
+                               }
+
+                               if(thedir_y == -1)
+                                       theang = M_PI;
+                               if(thedir_x == 1)
+                                       theang = M_PI/2;
+                               if(thedir_x == -1)
+                                       theang = M_PI*3/2;
+
+                               drawrotpic(tile_pos, theang, minigame_texture(thepiece),
+                                                       tile_size, tile_size/2, '1 1 1',
+                                                       panel_fg_alpha, DRAWFLAG_NORMAL );
+                       }
+                       else
+                       {
+                               minigame_drawpic_centered( tile_pos,  
+                                               minigame_texture(thepiece),
+                                               tile_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL );
+                       }
                }
        }