const int BD_TILE_BRICK4 = 7;
const int BD_TILE_BRICK5 = 8;
const int BD_TILE_BRICK6 = 9;
-const int BD_TILE_LAST = 9;
+const int BD_TILE_BRICK7 = 10;
+const int BD_TILE_BRICK8 = 11;
+const int BD_TILE_LAST = 11;
string autocvar_sv_minigames_bulldozer_startlevel = "level1";
{
switch(ttype)
{
+ case BD_TILE_BRICK8:
+ case BD_TILE_BRICK7:
case BD_TILE_BRICK6:
case BD_TILE_BRICK5:
case BD_TILE_BRICK4:
switch(hit.bd_tiletype)
{
case BD_TILE_DOZER: // wtf, but let's do this incase
+ case BD_TILE_BRICK8:
+ case BD_TILE_BRICK7:
case BD_TILE_BRICK6:
case BD_TILE_BRICK5:
case BD_TILE_BRICK4:
bd_string = strcat(bd_string, "\"", e.netname, "\" ");
bd_string = strcat(bd_string, ftos(e.bd_tiletype), " ");
- bd_string = strcat(bd_string, sprintf("\"%.9v\"", e.bd_dir), " ");
- bd_string = strcat(bd_string, "; ");
+ bd_string = strcat(bd_string, sprintf("\"%.9v\"", e.bd_dir));
return bd_string;
}
entity bd_load_piece(entity minigame, string s)
{
// separate pieces between the ; symbols
- tokenizebyseparator(s, "; ");
- string bd_string = argv(0);
+ string bd_string = s;
tokenize_console(bd_string);
minigame.bd_levelname = strzone(autocvar_sv_minigames_bulldozer_startlevel);
bd_setup_pieces(minigame);
minigame.minigame_flags = BD_TURN_MOVE;
-
+
return true;
}
case "end":
switch(argv(0))
{
case "move":
- bd_do_move(minigame, ...(0,entity), ((...(1,int)) >= 2 ? argv(1) : string_null), ((...(1,int)) >= 3 ? argv(2) : string_null), ((...(1,int)) >= 4 ? argv(3) : string_null));
+ bd_do_move(minigame, ...(0,entity), ((...(1,int)) >= 2 ? argv(1) : string_null), ((...(1,int)) >= 3 ? argv(2) : string_null), ((...(1,int)) >= 4 ? argv(3) : string_null));
return true;
case "next":
bd_next_match(minigame,...(0,entity), ((...(1,int) >= 2 ? argv(1) : string_null)));
bd_close_editor(minigame);
return true;
case "fill":
- bd_do_fill(minigame, ...(0,entity), ((...(1,int)) >= 2 ? argv(1) : string_null), ((...(1,int)) >= 3 ? argv(2) : string_null));
+ bd_do_fill(minigame, ...(0,entity), ((...(1,int)) >= 2 ? argv(1) : string_null), ((...(1,int)) >= 3 ? argv(2) : string_null));
return true;
}
return false;
}
}
-
+
return false;
}
int bd_curr_tile;
string bd_curr_pos;
+.entity bd_enemy;
+.bool bd_hide;
+
vector bd_boardpos; // HUD board position
vector bd_boardsize;// HUD board size
case BD_TILE_BRICK4: return "bd/brick4";
case BD_TILE_BRICK5: return "bd/brick5";
case BD_TILE_BRICK6: return "bd/brick6";
+ case BD_TILE_BRICK7: return "bd/brick7";
+ case BD_TILE_BRICK8: return "bd/brick8";
case BD_TILE_TARGET: return "bd/target";
case BD_TILE_DOZER: return "bd/dozer";
}
minigame_hud_fitsqare(pos, mySize);
bd_boardpos = pos;
bd_boardsize = mySize;
-
+
minigame_hud_simpleboard(pos,mySize,minigame_texture("bd/board"));
vector tile_size = minigame_hud_denormalize_size('1 1 0' / BD_TILE_SIZE,pos,mySize);
entity e;
FOREACH_MINIGAME_ENTITY(e)
{
- if ( e.classname == "minigame_board_piece" && e.bd_tiletype != BD_TILE_TARGET && e.bd_tiletype != BD_TILE_DOZER )
- {
- tile_pos = minigame_tile_pos(e.netname,BD_NUM_CNT,BD_LET_CNT);
- tile_pos = minigame_hud_denormalize(tile_pos,pos,mySize);
-
- string thepiece = bd_get_tile_pic(e.bd_tiletype);
-
- minigame_drawpic_centered( tile_pos,
- minigame_texture(thepiece),
- tile_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL );
- }
-
- if ( e.classname == "minigame_board_piece" && e.bd_tiletype == BD_TILE_TARGET && e.bd_tiletype != BD_TILE_DOZER )
- {
- tile_pos = minigame_tile_pos(e.netname,BD_NUM_CNT,BD_LET_CNT);
- tile_pos = minigame_hud_denormalize(tile_pos,pos,mySize);
-
- minigame_drawpic_centered( tile_pos,
- minigame_texture("bd/target"),
- tile_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL );
- }
-
- if ( e.classname == "minigame_board_piece" && e.bd_tiletype != BD_TILE_TARGET && e.bd_tiletype == BD_TILE_DOZER )
+ if(e.classname == "minigame_board_piece")
{
- tile_pos = minigame_tile_pos(e.netname,BD_NUM_CNT,BD_LET_CNT);
- tile_pos = minigame_hud_denormalize(tile_pos,pos,mySize);
-
- vector thedir = e.bd_dir;
- float theang = 0;
-
- 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("bd/dozer"),
- tile_size, tile_size/2, '1 1 1',
- panel_fg_alpha, DRAWFLAG_NORMAL );
+ if(e.bd_tiletype == BD_TILE_TARGET)
+ {
+ e.bd_enemy = world;
+ e.bd_enemy = bd_find_piece(active_minigame, e.netname, false);
+ }
+ else if(e.bd_tiletype == BD_TILE_BOULDER)
+ {
+ e.bd_hide = false; // reset either way
+ e.bd_hide = ((bd_find_piece(active_minigame, e.netname, true)) != world);
+ }
}
}
-
FOREACH_MINIGAME_ENTITY(e)
{
- if ( e.classname == "minigame_board_piece" && e.bd_tiletype == BD_TILE_TARGET )
+ if ( e.classname == "minigame_board_piece" )
{
- tile_pos = minigame_tile_pos(e.netname,BD_NUM_CNT,BD_LET_CNT);
- tile_pos = minigame_hud_denormalize(tile_pos,pos,mySize);
+ if(e.bd_tiletype != BD_TILE_DOZER && !e.bd_hide) // hide boulders
+ {
+ tile_pos = minigame_tile_pos(e.netname,BD_NUM_CNT,BD_LET_CNT);
+ tile_pos = minigame_hud_denormalize(tile_pos,pos,mySize);
+
+ string thepiece = bd_get_tile_pic(e.bd_tiletype);
+
+ if(e.bd_enemy)
+ thepiece = "bd/boulder_target";
- minigame_drawpic_centered( tile_pos,
- minigame_texture("bd/target"),
- tile_size, '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 );
+ }
}
}
+ // draw dozers on top, always
FOREACH_MINIGAME_ENTITY(e)
{
if ( e.classname == "minigame_board_piece" && e.bd_tiletype == BD_TILE_DOZER )
string victory_text = "Game over!";
if(active_minigame.minigame_flags & BD_TURN_WIN)
- victory_text = "You win!";
-
+ victory_text = "Well done! Click 'Next Level' to continue";
+
vector win_pos = pos+eY*(mySize_y-winfs_y)/2;
vector win_sz;
win_sz = minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos,
- sprintf("%s", victory_text),
+ sprintf("%s", victory_text),
winfs, 0, DRAWFLAG_NORMAL, 0.5);
-
+
drawfill(win_pos-eY*hud_fontsize_y,win_sz+2*eY*hud_fontsize_y,'0.3 0.3 1',0.8,DRAWFLAG_ADDITIVE);
-
+
minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos,
- sprintf("%s", victory_text),
+ sprintf("%s", victory_text),
winfs, panel_fg_alpha, DRAWFLAG_NORMAL, 0.5);
}
}
{
mypos = pos;
minigame_drawcolorcodedstring_trunc(mySize_x,mypos,
- GetPlayerName(e.minigame_playerslot-1),
+ entcs_GetName(e.minigame_playerslot-1),
player_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
mypos_y += player_fontsize_y;
if ( turnflags & BD_TURN_WIN )
if(random() > 0.5)
- return _("Tubular! Press ""Next Level"" to continue!");
+ return _("Tubular! Press \"Next Level\" to continue!");
else
- return _("Wicked! Press ""Next Level"" to continue!");
+ return _("Wicked! Press \"Next Level\" to continue!");
if( turnflags & BD_TURN_EDIT )
return _("Press the space bar to change your currently selected tile");
if ( turnflags & BD_TURN_MOVE )
return _("Push the boulders onto the targets");
-
+
return "";
}
return false;
}
-#endif
\ No newline at end of file
+#endif