Server: Populate Power-Up Array manually

Overcomes what is likely an FTEQCC compiler bug where just using a = b
copying would result in a mis-match of first-values (id). Fixes dogs not
always dropping Max Ammo's on NON-FTE.
This commit is contained in:
Steam Deck User 2022-12-20 15:43:15 -05:00
parent 5e09033a07
commit 16a77c1e0f

View file

@ -76,6 +76,23 @@ PU_AddToStruct =
powerup_count++;
};
//
// PU_CopyStruct(to, from)
// Copies a powerup_struct from to.
//
powerup_struct(powerup_struct to, powerup_struct from) 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;
}
//
// PU_PopulateArray()
// Generates a Power-Up array with the Fisher-Yates shuffle
@ -89,9 +106,10 @@ void() PU_PopulateArray =
amount -= 1;
powerup_struct temp;
temp = powerup_array[i];
powerup_array[i] = powerup_array[amount];
powerup_array[amount] = temp;
PU_CopyStruct(temp, powerup_array[i]);
PU_CopyStruct(powerup_array[i], powerup_array[amount]);
PU_CopyStruct(powerup_array[amount], temp);
}
};