-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ade341
commit b542062
Showing
1,552 changed files
with
455,507 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Welcome to Choppuh! | ||
|
||
## What is Choppuh? | ||
It is what you need to get to! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,265 @@ | ||
// Copyright (c) ZeniMax Media Inc. | ||
// Licensed under the GNU General Public License 2.0. | ||
|
||
// g_local.h -- local definitions for game module | ||
#pragma once | ||
|
||
#include "q_std.h" | ||
|
||
// define GAME_INCLUDE so that game.h does not define the | ||
// short, server-visible gclient_t and gentity_t structures, | ||
// because we define the full size ones in this file | ||
#define GAME_INCLUDE | ||
#include "game.h" | ||
|
||
// | ||
// p_move.c | ||
// | ||
struct pm_config_t { | ||
int32_t airaccel = 0; | ||
bool n64_physics = false; | ||
}; | ||
|
||
extern pm_config_t pm_config; | ||
|
||
void Pmove(pmove_t *pmove); | ||
using pm_trace_func_t = trace_t(const vec3_t &start, const vec3_t &mins, const vec3_t &maxs, const vec3_t &end); | ||
using pm_trace_t = std::function<pm_trace_func_t>; | ||
void PM_StepSlideMove_Generic(vec3_t &origin, vec3_t &velocity, float frametime, const vec3_t &mins, const vec3_t &maxs, touch_list_t &touch, bool has_time, pm_trace_t trace); | ||
|
||
enum class stuck_result_t { | ||
GOOD_POSITION, | ||
FIXED, | ||
NO_GOOD_POSITION | ||
}; | ||
|
||
using stuck_object_trace_fn_t = trace_t(const vec3_t &, const vec3_t &, const vec3_t &, const vec3_t &); | ||
|
||
stuck_result_t G_FixStuckObject_Generic(vec3_t &origin, const vec3_t &own_mins, const vec3_t &own_maxs, std::function<stuck_object_trace_fn_t> trace); | ||
|
||
// state for coop respawning; used to select which | ||
// message to print for the player this is set on. | ||
enum coop_respawn_t { | ||
COOP_RESPAWN_NONE, // no messagee | ||
COOP_RESPAWN_IN_COMBAT, // player is in combat | ||
COOP_RESPAWN_BAD_AREA, // player not in a good spot | ||
COOP_RESPAWN_BLOCKED, // spawning was blocked by something | ||
COOP_RESPAWN_WAITING, // for players that are waiting to respawn | ||
COOP_RESPAWN_NO_LIVES, // out of lives, so need to wait until level switch | ||
COOP_RESPAWN_TOTAL | ||
}; | ||
|
||
// reserved general CS ranges | ||
enum { | ||
CONFIG_MATCH_STATE = CS_GENERAL, | ||
CONFIG_TEAMINFO, | ||
CONFIG_CHASE_PLAYER_NAME, | ||
CONFIG_CHASE_PLAYER_NAME_END = CONFIG_CHASE_PLAYER_NAME + MAX_CLIENTS, | ||
|
||
// nb: offset by 1 since NONE is zero | ||
CONFIG_COOP_RESPAWN_STRING, | ||
CONFIG_COOP_RESPAWN_STRING_END = CONFIG_COOP_RESPAWN_STRING + (COOP_RESPAWN_TOTAL - 1), | ||
|
||
// [Paril-KEX] if 1, n64 player physics apply | ||
CONFIG_N64_PHYSICS, | ||
CONFIG_HEALTH_BAR_NAME, // active health bar name | ||
|
||
CONFIG_STORY_SCORELIMIT, // this is also used for scorelimit display in dm | ||
|
||
CONFIG_LAST | ||
}; | ||
|
||
static_assert(CONFIG_LAST <= CS_GENERAL + MAX_GENERAL); | ||
|
||
// ammo IDs | ||
enum ammo_t : uint8_t { | ||
AMMO_BULLETS, | ||
AMMO_SHELLS, | ||
AMMO_ROCKETS, | ||
AMMO_GRENADES, | ||
AMMO_CELLS, | ||
AMMO_SLUGS, | ||
AMMO_MAGSLUG, | ||
AMMO_TRAP, | ||
AMMO_FLECHETTES, | ||
AMMO_TESLA, | ||
AMMO_DISRUPTOR, | ||
AMMO_PROX, | ||
AMMO_MAX | ||
}; | ||
|
||
// powerup IDs | ||
enum powerup_t : uint8_t { | ||
POWERUP_SCREEN, | ||
POWERUP_SHIELD, | ||
|
||
POWERUP_AM_BOMB, | ||
|
||
POWERUP_QUAD, | ||
POWERUP_DUELFIRE, | ||
POWERUP_PROTECTION, | ||
POWERUP_INVISIBILITY, | ||
POWERUP_SILENCER, | ||
POWERUP_REBREATHER, | ||
POWERUP_ENVIROSUIT, | ||
POWERUP_ADRENALINE, | ||
POWERUP_IR_GOGGLES, | ||
POWERUP_DOUBLE, | ||
POWERUP_SPHERE_VENGEANCE, | ||
POWERUP_SPHERE_HUNTER, | ||
POWERUP_SPHERE_DEFENDER, | ||
POWERUP_DOPPELGANGER, | ||
|
||
POWERUP_BALL, | ||
|
||
POWERUP_FLASHLIGHT, | ||
POWERUP_COMPASS, | ||
|
||
POWERUP_TECH_DISRUPTOR_SHIELD, | ||
POWERUP_TECH_POWER_AMP, | ||
POWERUP_TECH_TIME_ACCEL, | ||
POWERUP_TECH_AUTODOC, | ||
|
||
POWERUP_REGEN, | ||
|
||
POWERUP_MAX | ||
}; | ||
|
||
// ammo stats compressed in 9 bits per entry | ||
// since the range is 0-300 | ||
constexpr size_t BITS_PER_AMMO = 9; | ||
|
||
template<typename TI> | ||
constexpr size_t num_of_type_for_bits(size_t num_bits) { | ||
return (num_bits + (sizeof(TI) * 8) - 1) / ((sizeof(TI) * 8) + 1); | ||
} | ||
|
||
template<size_t bits_per_value> | ||
constexpr void set_compressed_integer(uint16_t *start, uint8_t id, uint16_t count) { | ||
uint16_t bit_offset = bits_per_value * id; | ||
uint16_t byte = bit_offset / 8; | ||
uint16_t bit_shift = bit_offset % 8; | ||
uint16_t mask = (bit_v<bits_per_value> -1) << bit_shift; | ||
uint16_t *base = (uint16_t *)((uint8_t *)start + byte); | ||
*base = (*base & ~mask) | ((count << bit_shift) & mask); | ||
} | ||
|
||
template<size_t bits_per_value> | ||
constexpr uint16_t get_compressed_integer(uint16_t *start, uint8_t id) { | ||
uint16_t bit_offset = bits_per_value * id; | ||
uint16_t byte = bit_offset / 8; | ||
uint16_t bit_shift = bit_offset % 8; | ||
uint16_t mask = (bit_v<bits_per_value> -1) << bit_shift; | ||
uint16_t *base = (uint16_t *)((uint8_t *)start + byte); | ||
return (*base & mask) >> bit_shift; | ||
} | ||
|
||
constexpr size_t NUM_BITS_FOR_AMMO = 9; | ||
constexpr size_t NUM_AMMO_STATS = num_of_type_for_bits<uint16_t>(NUM_BITS_FOR_AMMO * AMMO_MAX); | ||
// if this value is set on an STAT_AMMO_INFO_xxx, don't render ammo | ||
constexpr uint16_t AMMO_VALUE_INFINITE = bit_v<NUM_BITS_FOR_AMMO> -1; | ||
|
||
constexpr void G_SetAmmoStat(uint16_t *start, uint8_t ammo_id, uint16_t count) { | ||
set_compressed_integer<NUM_BITS_FOR_AMMO>(start, ammo_id, count); | ||
} | ||
|
||
constexpr uint16_t G_GetAmmoStat(uint16_t *start, uint8_t ammo_id) { | ||
return get_compressed_integer<NUM_BITS_FOR_AMMO>(start, ammo_id); | ||
} | ||
|
||
// powerup stats compressed in 2 bits per entry; | ||
// 3 is the max you'll ever hold, and for some | ||
// (flashlight) it's to indicate on/off state | ||
constexpr size_t NUM_BITS_PER_POWERUP = 2; | ||
constexpr size_t NUM_POWERUP_STATS = num_of_type_for_bits<uint16_t>(NUM_BITS_PER_POWERUP * POWERUP_MAX); | ||
|
||
constexpr void G_SetPowerupStat(uint16_t *start, uint8_t powerup_id, uint16_t count) { | ||
set_compressed_integer<NUM_BITS_PER_POWERUP>(start, powerup_id, count); | ||
} | ||
|
||
constexpr uint16_t G_GetPowerupStat(uint16_t *start, uint8_t powerup_id) { | ||
return get_compressed_integer<NUM_BITS_PER_POWERUP>(start, powerup_id); | ||
} | ||
|
||
// player_state->stats[] indexes | ||
enum player_stat_t { | ||
STAT_HEALTH_ICON = 0, | ||
STAT_HEALTH = 1, | ||
STAT_AMMO_ICON = 2, | ||
STAT_AMMO = 3, | ||
STAT_ARMOR_ICON = 4, | ||
STAT_ARMOR = 5, | ||
STAT_SELECTED_ICON = 6, | ||
STAT_PICKUP_ICON = 7, | ||
STAT_PICKUP_STRING = 8, | ||
STAT_POWERUP_ICON = 9, | ||
STAT_POWERUP_TIME = 10, | ||
STAT_HELPICON = 11, | ||
STAT_SELECTED_ITEM = 12, | ||
STAT_LAYOUTS = 13, | ||
STAT_SCORE = 14, | ||
STAT_FLASHES = 15, // cleared each frame, 1 = health, 2 = armor | ||
STAT_CHASE = 16, | ||
STAT_SPECTATOR = 17, | ||
|
||
STAT_MINISCORE_FIRST_PIC = 18, | ||
STAT_MINISCORE_FIRST_SCORE = 19, | ||
STAT_MINISCORE_SECOND_PIC = 20, | ||
STAT_MINISCORE_SECOND_SCORE = 21, | ||
STAT_CTF_FLAG_PIC = 22, | ||
STAT_MINISCORE_FIRST_POS = 23, | ||
STAT_MINISCORE_SECOND_POS = 24, | ||
STAT_TEAM_RED_HEADER = 25, | ||
STAT_TEAM_BLUE_HEADER = 26, | ||
STAT_TECH = 27, | ||
STAT_CROSSHAIR_ID_VIEW = 28, | ||
STAT_MATCH_STATE = 29, | ||
STAT_CROSSHAIR_ID_VIEW_COLOR = 30, | ||
STAT_TEAMPLAY_INFO = 31, | ||
|
||
// [Kex] More stats for weapon wheel | ||
STAT_WEAPONS_OWNED_1 = 32, | ||
STAT_WEAPONS_OWNED_2 = 33, | ||
STAT_AMMO_INFO_START = 34, | ||
STAT_AMMO_INFO_END = STAT_AMMO_INFO_START + NUM_AMMO_STATS - 1, | ||
STAT_POWERUP_INFO_START, | ||
STAT_POWERUP_INFO_END = STAT_POWERUP_INFO_START + NUM_POWERUP_STATS - 1, | ||
|
||
// [Paril-KEX] Key display | ||
STAT_KEY_A, | ||
STAT_KEY_B, | ||
STAT_KEY_C, | ||
|
||
// [Paril-KEX] currently active wheel weapon (or one we're switching to) | ||
STAT_ACTIVE_WHEEL_WEAPON, | ||
// [Paril-KEX] top of screen coop respawn state | ||
STAT_COOP_RESPAWN, | ||
// [Paril-KEX] respawns remaining | ||
STAT_LIVES, | ||
// [Paril-KEX] hit marker; # of damage we successfully landed | ||
STAT_HIT_MARKER, | ||
// [Paril-KEX] | ||
STAT_SELECTED_ITEM_NAME, | ||
// [Paril-KEX] | ||
STAT_HEALTH_BARS, // two health bar values; 7 bits for value, 1 bit for active | ||
// [Paril-KEX] | ||
STAT_ACTIVE_WEAPON, | ||
|
||
STAT_SCORELIMIT, | ||
STAT_DUEL_HEADER, | ||
|
||
STAT_SHOW_STATUSBAR, | ||
|
||
STAT_COUNTDOWN, | ||
|
||
STAT_MINISCORE_FIRST_VAL, | ||
STAT_MINISCORE_SECOND_VAL, | ||
|
||
STAT_MONSTER_COUNT, | ||
STAT_ROUND_NUMBER, | ||
|
||
// don't use; just for verification | ||
STAT_LAST | ||
}; | ||
|
||
static_assert(STAT_LAST <= MAX_STATS + 1, "stats list overflow"); |
Oops, something went wrong.