mirror of
https://github.com/nzp-team/quakec.git
synced 2024-11-14 16:30:47 +00:00
SERVER: Use a define macro for Power-Up shuffling instead
This commit is contained in:
parent
6cadd1d0e2
commit
93258d8f4b
1 changed files with 17 additions and 25 deletions
|
@ -44,8 +44,6 @@ var struct powerup_struct
|
||||||
float() requirement_function;
|
float() requirement_function;
|
||||||
} powerup_array[MAX_POWERUPS] = {};
|
} powerup_array[MAX_POWERUPS] = {};
|
||||||
|
|
||||||
powerup_struct temp_struct;
|
|
||||||
|
|
||||||
float powerup_count;
|
float powerup_count;
|
||||||
float powerup_index;
|
float powerup_index;
|
||||||
|
|
||||||
|
@ -82,16 +80,13 @@ PU_AddToStruct =
|
||||||
// PU_CopyStruct(to, from)
|
// PU_CopyStruct(to, from)
|
||||||
// Copies a powerup_struct from to.
|
// Copies a powerup_struct from to.
|
||||||
//
|
//
|
||||||
void(__inout powerup_struct to) PU_CopyStruct =
|
#define PU_CopyStruct(to, from) \
|
||||||
{
|
to.id = from.id; \
|
||||||
to.id = temp_struct.id;
|
to.occupied = from.occupied; \
|
||||||
to.occupied = temp_struct.occupied;
|
to.model_path = from.model_path; \
|
||||||
to.flash_screen = temp_struct.flash_screen;
|
to.voiceover_path = from.voiceover_path; \
|
||||||
to.model_path = temp_struct.model_path;
|
to.function = from.function; \
|
||||||
to.voiceover_path = temp_struct.voiceover_path;
|
to.requirement_function = from.requirement_function; \
|
||||||
to.function = temp_struct.function;
|
|
||||||
to.requirement_function = temp_struct.requirement_function;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// PU_PopulateArray()
|
// PU_PopulateArray()
|
||||||
|
@ -100,20 +95,17 @@ void(__inout powerup_struct to) PU_CopyStruct =
|
||||||
void() PU_PopulateArray =
|
void() PU_PopulateArray =
|
||||||
{
|
{
|
||||||
float amount = powerup_count;
|
float amount = powerup_count;
|
||||||
|
float i;
|
||||||
|
powerup_struct t;
|
||||||
|
|
||||||
while(amount > 0) {
|
while(amount) {
|
||||||
float i = floor(random() * amount);
|
i = floor(random() * amount--);
|
||||||
amount -= 1;
|
|
||||||
|
|
||||||
powerup_struct temp;
|
// macro'd these to avoid hell with __inout :)
|
||||||
temp.id = -1;
|
PU_CopyStruct(t, powerup_array[amount])
|
||||||
|
PU_CopyStruct(powerup_array[amount], powerup_array[i])
|
||||||
temp_struct = powerup_array[i];
|
PU_CopyStruct(powerup_array[i], t)
|
||||||
PU_CopyStruct(temp);
|
bprint(PRINT_HIGH, strcat(ftos(i),"\n"));
|
||||||
temp_struct = powerup_array[amount];
|
|
||||||
PU_CopyStruct(powerup_array[i]);
|
|
||||||
temp_struct = temp;
|
|
||||||
PU_CopyStruct(powerup_array[amount]);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue