26 float Energy_levels[
NUM_ENERGY_LEVELS] = {0.0f, 0.0833f, 0.167f, 0.25f, 0.333f, 0.417f, 0.5f, 0.583f, 0.667f, 0.75f, 0.833f, 0.9167f, 1.0f};
65 float max_new_shield_energy, max_new_weapon_energy, _ss;
67 if ( fl_frametime <= 0 ){
149 Assertion(objp != NULL,
"Invalid object pointer passed!");
151 Assertion(engine_energy >= 0.0
f && engine_energy <= 1.0
f,
"Invalid float passed, needs to be in [0, 1], was %f!", engine_energy);
160 }
else if ( engine_energy == 0.0
f ){
162 }
else if ( engine_energy == 1.0
f ){
167 if ( engine_energy <
Energy_levels[INTIAL_ENGINE_RECHARGE_INDEX] ){
183 #define SHIELDS_MIN_LEVEL_PERCENT 0.3f
184 #define WEAPONS_MIN_LEVEL_PERCENT 0.3f
187 #define SHIELDS_MAX_LEVEL_PERCENT 0.8f
188 #define WEAPONS_MAX_LEVEL_PERCENT 0.8f
191 #define SHIELDS_EMERG_LEVEL_PERCENT 0.10f
192 #define WEAPONS_EMERG_LEVEL_PERCENT 0.05f
195 #define MIN_ENGINE_RECHARGE_INDEX 3
197 #define DEFAULT_CHARGE_INDEX 4
198 #define NORMAL_TOLERANCE_PERCENT .10f
220 if ( weapon_left_percent == 1.0
f) {
296 switch ( ship_properties ) {
351 int *gain_index=NULL, *lose_index1=NULL, *lose_index2=NULL, *tmp=NULL;
358 switch ( ship_system ) {
416 if (!lose_index1 && !lose_index2)
433 *gain_index +=
count;
436 if ( lose_index1 && lose_index2 ) {
437 if ( *lose_index1 < *lose_index2 ) {
439 lose_index1 = lose_index2;
446 if ( lose_index1 && *lose_index1 > 0 ) {
454 if ( lose_index2 && *lose_index2 > 0 ) {
459 if ( sanity++ > 10 ) {
475 int *lose_index=NULL, *gain_index1=NULL, *gain_index2=NULL, *tmp=NULL;
482 switch ( ship_system ) {
540 if (!gain_index1 && !gain_index2)
544 count =
MIN(2, *lose_index);
552 *lose_index -=
count;
555 if ( gain_index1 && gain_index2 ) {
556 if ( *gain_index1 > *gain_index2 ) {
558 gain_index1 = gain_index2;
578 if ( sanity++ > 10 ) {
594 if (to_field + *to_delta + delta > max)
595 delta = max - to_field - *to_delta;
601 if (delta > from_field)
605 *from_delta -=
delta;
685 if ( ets_delta != 0 ) {
686 if ( ets_delta > 0) {
687 while ( ets_delta != 0 ) {
692 if (ets_indexes[i] <= lowest_val ) {
693 lowest_val = ets_indexes[
i];
697 ++ets_indexes[lowest_idx];
701 while ( ets_delta != 0 ) {
706 if (ets_indexes[i] >= highest_val ) {
707 highest_val = ets_indexes[
i];
711 --ets_indexes[highest_idx];
727 if (
Ships[ship_idx].objnum < 0) {
736 int ship_properties = 0;
749 switch ( ship_properties ) {
759 zero_one_ets(&ets_indexes[ENGINES], &ets_indexes[SHIELDS], &ets_indexes[WEAPONS]);
763 zero_one_ets(&ets_indexes[SHIELDS], &ets_indexes[ENGINES], &ets_indexes[WEAPONS]);
788 System_type(_system_type)
842 int y_start, y_end, clip_h,
w,
h,
x,
y;
861 y =
position[1] + Bottom_offsets[1];
863 y_start = y + (ETS_bar_h - clip_h);
883 y_start = y + clip_h;
890 y =
position[1] + Bottom_offsets[1];
911 int initial_position;
930 initial_position = 0;
948 initial_position = 0;
#define DEFAULT_CHARGE_INDEX
#define ENERGY_DIVERT_DELTA
void initBottomOffsets(int _x, int _y)
int timestamp(int delta_ms)
#define WEAPONS_EMERG_LEVEL_PERCENT
void renderBitmapEx(int frame, int x, int y, int w, int h, int sx, int sy)
float ets_get_max_speed(object *objp, float engine_energy)
void decrease_recharge_rate(object *obj, SYSTEM_TYPE ship_system)
float max_overclocked_speed
#define INTIAL_WEAPON_RECHARGE_INDEX
#define INTIAL_SHIELD_RECHARGE_INDEX
void render(float frametime)
GLfloat GLfloat GLfloat GLfloat h
float shield_get_strength(object *objp)
SCP_vector< game_snd > Snds
void setGaugeColor(int bright_index=-4)
float ship_max_shield_strength
void increase_recharge_rate(object *obj, SYSTEM_TYPE ship_system)
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
int weapon_recharge_index
int bm_get_info(int handle, int *w, int *h, ubyte *flags, int *nframes, int *fps)
Gets info on the bitmap indexed by handle.
void transfer_energy_to_weapons(object *obj)
void initLetterOffsets(int _x, int _y)
#define Assertion(expr, msg,...)
#define HUD_OBJECT_ETS_SHIELDS
void set_default_recharge_rates(object *obj)
void update_ets(object *objp, float fl_frametime)
bool validate_ship_ets_indxes(const int &ship_idx, int(&ets_indexes)[num_retail_ets_gauges])
GLenum GLenum GLenum GLenum GLenum scale
int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *keyframe, int can_drop_frames, int dir_type)
Loads a bitmap sequance so we can draw with it.
#define INTIAL_ENGINE_RECHARGE_INDEX
#define HUD_OBJECT_ETS_ENGINES
#define HUD_OBJECT_ETS_RETAIL
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
void initGaugePositions(int *_gauge_positions)
float ship_get_subsystem_strength(ship *shipp, int type)
void render(float frametime)
virtual void blitGauge(int index)
const int num_retail_ets_gauges
ai_profile_t * ai_profile
float target_shields_delta
void zero_one_ets(int *reduce, int *add1, int *add2)
void ai_manage_ets(object *obj)
int snd_play(game_snd *gs, float pan, float vol_scale, int priority, bool is_voice_msg)
int engine_recharge_index
void initTopOffsets(int _x, int _y)
int Gauge_positions[num_retail_ets_gauges]
int ship_has_energy_weapons(ship *shipp)
virtual void render(float frametime)
#define NORMAL_TOLERANCE_PERCENT
void render(float frametime)
void initBitmaps(char *fname)
GLint GLint GLint GLint GLint x
object Objects[MAX_OBJECTS]
void ets_init_ship(object *obj)
void shield_add_strength(object *objp, float delta)
float weapon_energy_scale[NUM_SKILL_LEVELS]
float Energy_levels[NUM_ENERGY_LEVELS]
float target_weapon_energy_delta
#define NUM_ENERGY_LEVELS
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
void render(float frametime)
void sanity_check_ets_inputs(int(&ets_indexes)[num_retail_ets_gauges])
void initLetters(char *_letters)
#define WEAPONS_MIN_LEVEL_PERCENT
float get_shield_pct(object *objp)
void initLetter(char _letter)
void transfer_energy_to_shields(object *obj)
#define SHIP_MIN_ENGINES_FOR_FULL_SPEED
void bm_page_in_aabitmap(int bitmapnum, int nframes)
Marks a texture as being used for this level, and is anti-aliased.
float max_weapon_regen_per_second
char Letters[num_retail_ets_gauges]
SCP_vector< ship_info > Ship_info
#define timestamp_elapsed(stamp)
SCP_vector< float > shield_quadrant
GLsizei GLsizei GLuint * obj
float shield_energy_scale[NUM_SKILL_LEVELS]
void renderPrintf(int x, int y, const char *format,...)
#define AI_MODIFY_ETS_INTERVAL
#define SHIELDS_MIN_LEVEL_PERCENT
int ship_has_engine_power(ship *shipp)
void initBarHeight(int _ets_bar_h)
#define MIN_ENGINE_RECHARGE_INDEX
int shield_recharge_index
#define HUD_OBJECT_ETS_WEAPONS
void transfer_energy_weapon_common(object *objp, float from_field, float to_field, float *from_delta, float *to_delta, float max, float scale)
char ship_name[NAME_LENGTH]
float max_shield_regen_per_second
#define SHIELDS_EMERG_LEVEL_PERCENT