Skip to content

Commit

Permalink
Minigame31: Open random platforms on start
Browse files Browse the repository at this point in the history
  • Loading branch information
safalin1 committed Sep 24, 2023
1 parent e81e229 commit a1fceb2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
17 changes: 2 additions & 15 deletions assets/map/warioware_redux_master.vmf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ versioninfo
{
"editorversion" "400"
"editorbuild" "8864"
"mapversion" "8586"
"mapversion" "8587"
"formatversion" "100"
"prefab" "0"
}
Expand Down Expand Up @@ -114,7 +114,7 @@ bgimages_plus
world
{
"id" "1"
"mapversion" "8586"
"mapversion" "8587"
"classname" "worldspawn"
"detailmaterial" "detail/detailsprites"
"detailvbsp" "detail.vbsp"
Expand Down Expand Up @@ -384659,19 +384659,6 @@ entity
"logicalpos" "[0 -14768]"
}
}
entity
{
"id" "5822298"
"classname" "info_null"
"origin" "5388 396 -180"
editor
{
"color" "220 30 220"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[0 -14268]"
}
}
cameras
{
"activecamera" "0"
Expand Down
28 changes: 28 additions & 0 deletions src/scripting/Minigames/Minigame31.sp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
* Land Safely!
*/

#define MINIGAME31_PLATFORM_MIN 1
#define MINIGAME31_PLATFORM_MAX 4

int g_iMinigame31PlayerIndex;

public void Minigame31_EntryPoint()
Expand All @@ -18,6 +21,8 @@ public void Minigame31_OnMinigameSelectedPre()
if (g_iActiveMinigameId == 31)
{
g_iMinigame31PlayerIndex = 0;

Minigame31_OpenPlatforms();
}
}

Expand Down Expand Up @@ -78,4 +83,27 @@ public void Minigame31_OnMinigameFinish()
}
}
}
}

void Minigame31_OpenPlatforms()
{
int platform1 = GetRandomInt(MINIGAME31_PLATFORM_MIN, MINIGAME31_PLATFORM_MAX);
int platform2 = platform1;

do
{
platform2 = GetRandomInt(MINIGAME31_PLATFORM_MIN, MINIGAME31_PLATFORM_MAX);
}
while (platform2 == platform1);

Minigame31_TriggerPlatform(platform1);
Minigame31_TriggerPlatform(platform2);
}

void Minigame31_TriggerPlatform(int platformId)
{
char name[64];

Format(name, sizeof(name), "Minigame31_Platform%d", platformId);
SendEntityInput("func_door", name, "Open");
}

0 comments on commit a1fceb2

Please sign in to comment.