From 1498f61986f47c0c1b2b470beb32161eaa0443fb Mon Sep 17 00:00:00 2001 From: Steam Deck User Date: Wed, 15 Feb 2023 20:20:54 -0500 Subject: [PATCH] SERVER: Fix Power-Ups order not being randomized --- source/server/entities/powerups.qc | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/source/server/entities/powerups.qc b/source/server/entities/powerups.qc index 50be4a6..1559366 100644 --- a/source/server/entities/powerups.qc +++ b/source/server/entities/powerups.qc @@ -44,6 +44,8 @@ var struct powerup_struct float() requirement_function; } powerup_array[MAX_POWERUPS] = {}; +powerup_struct temp_struct; + float powerup_count; float powerup_index; @@ -80,17 +82,15 @@ PU_AddToStruct = // PU_CopyStruct(to, from) // Copies a powerup_struct from to. // -powerup_struct(powerup_struct to, powerup_struct from) PU_CopyStruct = +void(__inout powerup_struct to) PU_CopyStruct = { - to.id = from.id; - to.occupied = from.occupied; - to.flash_screen = from.flash_screen; - to.model_path = from.model_path; - to.voiceover_path = from.voiceover_path; - to.function = from.function; - to.requirement_function = from.requirement_function; - - return to; + to.id = temp_struct.id; + to.occupied = temp_struct.occupied; + to.flash_screen = temp_struct.flash_screen; + to.model_path = temp_struct.model_path; + to.voiceover_path = temp_struct.voiceover_path; + to.function = temp_struct.function; + to.requirement_function = temp_struct.requirement_function; } // @@ -108,9 +108,12 @@ void() PU_PopulateArray = powerup_struct temp; temp.id = -1; - PU_CopyStruct(temp, powerup_array[i]); - PU_CopyStruct(powerup_array[i], powerup_array[amount]); - PU_CopyStruct(powerup_array[amount], temp); + temp_struct = powerup_array[i]; + PU_CopyStruct(temp); + temp_struct = powerup_array[amount]; + PU_CopyStruct(powerup_array[i]); + temp_struct = temp; + PU_CopyStruct(powerup_array[amount]); } };