mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 17:48:46 -10:00
clarified max hull/shield strength names and added ship guardian thresholds
--Goober5000
This commit is contained in:
1 parent
2efe41b7c2
commit
6c17ef09ab
30 files changed
+375
-266
No files matched your search
+17
-14
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Ship/AiCode.cpp $
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2005-03-25 07:01:53 $
|
||||
* $Author: wmcoolmon $
|
||||
* $Revision: 1.3 $
|
||||
* $Date: 2005-03-27 12:28:31 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* AI code that does interesting stuff
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.2 2005/03/25 07:01:53 wmcoolmon
|
||||
* Added taylor's old-weapon code fix
|
||||
*
|
||||
* Revision 1.1 2005/03/25 06:45:12 wmcoolmon
|
||||
* Initial AI code move commit - note that aigoals.cpp has some escape characters in it, I'm not sure if this is really a problem.
|
||||
*
|
||||
@@ -6259,7 +6262,7 @@ void set_primary_weapon_linkage(object *objp)
|
||||
if (shipp->weapon_energy > Link_energy_levels_always[Game_skill_level]) {
|
||||
shipp->flags |= SF_PRIMARY_LINKED;
|
||||
} else if (shipp->weapon_energy > Link_energy_levels_maybe[Game_skill_level]) {
|
||||
if (objp->hull_strength < shipp->ship_initial_hull_strength/3.0f)
|
||||
if (objp->hull_strength < shipp->ship_max_hull_strength/3.0f)
|
||||
shipp->flags |= SF_PRIMARY_LINKED;
|
||||
}
|
||||
|
||||
@@ -6295,7 +6298,7 @@ void set_primary_weapon_linkage(object *objp)
|
||||
}
|
||||
else if (ammo_pct > Link_ammo_levels_maybe[Game_skill_level])
|
||||
{
|
||||
if (objp->hull_strength < shipp->ship_initial_hull_strength/3.0f)
|
||||
if (objp->hull_strength < shipp->ship_max_hull_strength/3.0f)
|
||||
{
|
||||
shipp->flags |= SF_PRIMARY_LINKED;
|
||||
}
|
||||
@@ -9241,7 +9244,7 @@ void ai_chase()
|
||||
if (count > 3)
|
||||
spawn_fire = 1;
|
||||
else if (count >= 1) {
|
||||
float hull_percent = Pl_objp->hull_strength/temp_shipp->ship_initial_hull_strength;
|
||||
float hull_percent = Pl_objp->hull_strength/temp_shipp->ship_max_hull_strength;
|
||||
|
||||
if (hull_percent < 0.01f)
|
||||
hull_percent = 0.01f;
|
||||
@@ -13388,11 +13391,11 @@ int maybe_request_support(object *objp)
|
||||
desire = 0;
|
||||
|
||||
// Set desire based on hull strength.
|
||||
// No: We no longer repair hull, so this would cause repeated repair requests.
|
||||
// Note: We no longer repair hull, so this would cause repeated repair requests.
|
||||
// Added back in upon mission flag condition - Goober5000
|
||||
if (The_mission.flags & MISSION_FLAG_SUPPORT_REPAIRS_HULL)
|
||||
{
|
||||
desire += 6 - (int) ((objp->hull_strength/shipp->ship_initial_hull_strength) * 6.0f);
|
||||
desire += 6 - (int) (get_hull_pct(objp) * 6.0f);
|
||||
}
|
||||
|
||||
// Set desire based on key subsystems.
|
||||
@@ -13495,7 +13498,7 @@ void ai_maybe_depart(object *objp)
|
||||
if (sip->flags & SIF_SUPPORT) {
|
||||
if ( timestamp_elapsed(aip->warp_out_timestamp) ) {
|
||||
ai_process_mission_orders( OBJ_INDEX(objp), aip );
|
||||
if ( (aip->support_ship_objnum == -1) && (objp->hull_strength/shipp->ship_initial_hull_strength < 0.25f) ) {
|
||||
if ( (aip->support_ship_objnum == -1) && (get_hull_pct(objp) < 0.25f) ) {
|
||||
if (!(shipp->flags & SF_DEPARTING))
|
||||
mission_do_departure(objp);
|
||||
}
|
||||
@@ -14860,8 +14863,8 @@ void maybe_process_friendly_hit(object *objp_hitter, object *objp_hit, object *o
|
||||
|
||||
// wacky stuff here
|
||||
ship_info *sip = &Ship_info[Ships[objp_hit->instance].ship_info_index];
|
||||
if (shipp_hit->ship_initial_hull_strength > 1000.0f) {
|
||||
float factor = shipp_hit->ship_initial_hull_strength / 1000.0f;
|
||||
if (shipp_hit->ship_max_hull_strength > 1000.0f) {
|
||||
float factor = shipp_hit->ship_max_hull_strength / 1000.0f;
|
||||
factor = MIN(100.0f, factor);
|
||||
damage /= factor;
|
||||
}
|
||||
@@ -14900,7 +14903,7 @@ void maybe_process_friendly_hit(object *objp_hitter, object *objp_hit, object *o
|
||||
mission_do_departure(objp_hit);
|
||||
gameseq_post_event( GS_EVENT_PLAYER_WARPOUT_START_FORCED ); // Force player to warp out.
|
||||
|
||||
//ship_apply_global_damage( objp_hitter, objp_hit, NULL, 2*(get_shield_strength(objp_hitter) + shipp_hitter->ship_initial_hull_strength) );
|
||||
//ship_apply_global_damage( objp_hitter, objp_hit, NULL, 2*(get_shield_strength(objp_hitter) + shipp_hitter->ship_max_hull_strength) );
|
||||
//ship_apply_global_damage( objp_hitter, objp_hit, NULL, 1.0f );
|
||||
} else if (Missiontime - pp->last_warning_message_time > F1_0*4) {
|
||||
// warning every 4 sec
|
||||
@@ -15198,8 +15201,8 @@ void ai_ship_hit(object *objp_ship, object *hit_objp, vector *hitpos, int shield
|
||||
|
||||
// If this ship is awaiting repair, abort!
|
||||
if (aip->ai_flags & (AIF_AWAITING_REPAIR | AIF_BEING_REPAIRED)) {
|
||||
if (objp_ship->hull_strength/shipp->ship_initial_hull_strength < 0.3f) {
|
||||
// No, only abort if hull below a certain level.
|
||||
if (get_hull_pct(objp_ship) < 0.3f) {
|
||||
// Note, only abort if hull below a certain level.
|
||||
aip->next_rearm_request_timestamp = timestamp(NEXT_REARM_TIMESTAMP/2); // Might request again after 15 seconds.
|
||||
if ( !(objp_ship->flags & OF_PLAYER_SHIP) ) // mwa -- don't abort rearm for a player
|
||||
ai_abort_rearm_request(objp_ship);
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Debris/Debris.cpp $
|
||||
* $Revision: 2.11 $
|
||||
* $Date: 2005-03-02 21:24:43 $
|
||||
* $Author: taylor $
|
||||
* $Revision: 2.12 $
|
||||
* $Date: 2005-03-27 12:28:32 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Code for the pieces of exploding object debris.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.11 2005/03/02 21:24:43 taylor
|
||||
* more NO_NETWORK/INF_BUILD goodness for Windows, takes care of a few warnings too
|
||||
*
|
||||
* Revision 2.10 2005/01/30 09:27:39 Goober5000
|
||||
* nitpicked some boolean tests, and fixed two small bugs
|
||||
* --Goober5000
|
||||
@@ -868,7 +871,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vecto
|
||||
// -- No long need shield: bset_shield_strength(obj, 100.0f); // Hey! Set to some meaningful value!
|
||||
|
||||
if (source_obj->type == OBJ_SHIP) {
|
||||
obj->hull_strength = Ships[source_obj->instance].ship_initial_hull_strength/8.0f;
|
||||
obj->hull_strength = Ships[source_obj->instance].ship_max_hull_strength/8.0f;
|
||||
} else
|
||||
obj->hull_strength = 10.0f;
|
||||
|
||||
|
||||
@@ -9,13 +9,21 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Gamesnd/EventMusic.cpp $
|
||||
* $Revision: 2.18 $
|
||||
* $Date: 2005-02-23 05:05:39 $
|
||||
* $Author: taylor $
|
||||
* $Revision: 2.19 $
|
||||
* $Date: 2005-03-27 12:28:32 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* C module for high-level control of event driven music
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.18 2005/02/23 05:05:39 taylor
|
||||
* compiler warning fixes (for MSVC++ 6)
|
||||
* have the warp effect only load as many LODs as will get used
|
||||
* head off strange bug in release when corrupt soundtrack number gets used
|
||||
* (will still Assert in debug)
|
||||
* don't ever try and save a campaign savefile in multi or standalone modes
|
||||
* first try at 32bit->16bit color conversion for TGA code (for TGA only ship textures)
|
||||
*
|
||||
* Revision 2.17 2005/01/18 01:14:17 wmcoolmon
|
||||
* OGG fixes, ship selection fixes
|
||||
*
|
||||
@@ -495,8 +503,8 @@ void event_music_force_switch()
|
||||
// AL 06-24-99: maybe switch to battle 2 if hull is less than 70%
|
||||
if (Player_obj != NULL && Player_ship != NULL) {
|
||||
Assert(Player_ship->ship_info_index >= 0);
|
||||
Assert(Player_ship->ship_initial_hull_strength != 0);
|
||||
float integrity = Player_obj->hull_strength / Player_ship->ship_initial_hull_strength;
|
||||
Assert(Player_ship->ship_max_hull_strength != 0);
|
||||
float integrity = Player_obj->hull_strength / Player_ship->ship_max_hull_strength;
|
||||
if (integrity < HULL_VALUE_TO_PLAY_INTENSE_BATTLE_MUSIC) {
|
||||
new_pattern = SONG_BTTL_2;
|
||||
}
|
||||
@@ -898,8 +906,8 @@ int event_music_enemy_arrival()
|
||||
bool play_intense_battle_music = false;
|
||||
if (Player_obj != NULL && Player_ship != NULL) {
|
||||
Assert(Player_ship->ship_info_index >= 0);
|
||||
Assert(Player_ship->ship_initial_hull_strength != 0);
|
||||
float integrity = Player_obj->hull_strength / Player_ship->ship_initial_hull_strength;
|
||||
Assert(Player_ship->ship_max_hull_strength != 0);
|
||||
float integrity = Player_obj->hull_strength / Player_ship->ship_max_hull_strength;
|
||||
if (integrity < HULL_VALUE_TO_PLAY_INTENSE_BATTLE_MUSIC) {
|
||||
play_intense_battle_music = true;
|
||||
}
|
||||
|
||||
+10
-17
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Hud/HUD.cpp $
|
||||
* $Revision: 2.42 $
|
||||
* $Date: 2005-03-25 06:57:34 $
|
||||
* $Author: wmcoolmon $
|
||||
* $Revision: 2.43 $
|
||||
* $Date: 2005-03-27 12:28:33 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* C module that contains all the HUD functions at a high level
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.42 2005/03/25 06:57:34 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
* Revision 2.41 2005/03/10 08:00:06 taylor
|
||||
* change min/max to MIN/MAX to fix GCC problems
|
||||
* add lab stuff to Makefile
|
||||
@@ -1358,16 +1361,7 @@ void hud_update_frame()
|
||||
// Since we need to reference the player's target integrity in several places this upcoming
|
||||
// frame, only calculate once here
|
||||
if ( target_shipp ) {
|
||||
float initial_hull;
|
||||
initial_hull = target_shipp->ship_initial_hull_strength;
|
||||
if ( initial_hull <= 0 ) {
|
||||
Int3(); // illegal initial hull strength
|
||||
Pl_target_integrity = 0.0f;
|
||||
} else {
|
||||
Pl_target_integrity = targetp->hull_strength / initial_hull;
|
||||
if (Pl_target_integrity < 0)
|
||||
Pl_target_integrity = 0.0f;
|
||||
}
|
||||
Pl_target_integrity = get_hull_pct(targetp);
|
||||
}
|
||||
|
||||
hud_update_cargo_scan_sound();
|
||||
@@ -1521,7 +1515,7 @@ void hud_maybe_show_damage()
|
||||
if ( hud_gauge_active(HUD_DAMAGE_GAUGE) ) {
|
||||
int show_gauge_flag;
|
||||
|
||||
if ( (Player_ship->ship_initial_hull_strength - Player_obj->hull_strength) > 1.0f ) {
|
||||
if ( (Player_ship->ship_max_hull_strength - Player_obj->hull_strength) > 1.0f ) {
|
||||
show_gauge_flag = 1;
|
||||
} else {
|
||||
show_gauge_flag = 0;
|
||||
@@ -1553,7 +1547,7 @@ void hud_damage_popup_toggle()
|
||||
|
||||
// if gauge is popup, turn it off if it is current up, otherwise force it to be up
|
||||
if ( hud_gauge_is_popup(HUD_DAMAGE_GAUGE) ) {
|
||||
if ( Player_obj->hull_strength == Player_ship->ship_initial_hull_strength ) {
|
||||
if ( Player_obj->hull_strength == Player_ship->ship_max_hull_strength ) {
|
||||
hud_config_set_gauge_flags(HUD_DAMAGE_GAUGE,1,0);
|
||||
} else {
|
||||
hud_config_set_gauge_flags(HUD_DAMAGE_GAUGE,0,0);
|
||||
@@ -2758,7 +2752,7 @@ void hud_support_view_blit()
|
||||
|
||||
show_time = 0;
|
||||
if ( Player_ai->ai_flags & AIF_BEING_REPAIRED ) {
|
||||
Assert(Player_ship->ship_initial_hull_strength > 0);
|
||||
Assert(Player_ship->ship_max_hull_strength > 0);
|
||||
if ( (ship_get_subsystem_strength(Player_ship, SUBSYSTEM_ENGINE) < 1.0 ) ||
|
||||
(ship_get_subsystem_strength(Player_ship, SUBSYSTEM_SENSORS) < 1.0 ) ||
|
||||
(ship_get_subsystem_strength(Player_ship, SUBSYSTEM_WEAPONS) < 1.0 ) ||
|
||||
@@ -3564,4 +3558,3 @@ void hud_page_in()
|
||||
//CUSTOM gauges
|
||||
// hudcustom_page_in();
|
||||
}
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Hud/HUDescort.cpp $
|
||||
* $Revision: 2.21 $
|
||||
* $Date: 2005-03-02 21:24:44 $
|
||||
* $Author: taylor $
|
||||
* $Revision: 2.22 $
|
||||
* $Date: 2005-03-27 12:28:33 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* C module for managing and displaying ships that are in an escort
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.21 2005/03/02 21:24:44 taylor
|
||||
* more NO_NETWORK/INF_BUILD goodness for Windows, takes care of a few warnings too
|
||||
*
|
||||
* Revision 2.20 2005/02/04 10:12:30 taylor
|
||||
* merge with Linux/OSX tree - p0204
|
||||
*
|
||||
@@ -758,7 +761,7 @@ void hud_escort_show_icon_dogfight(int x, int y, int index)
|
||||
return;
|
||||
}
|
||||
|
||||
hull_integrity = (int)(((float)objp->hull_strength / (float)Ships[objp->instance].ship_initial_hull_strength) * 100.0f);
|
||||
hull_integrity = (int)(((float)objp->hull_strength / (float)Ships[objp->instance].ship_max_hull_strength) * 100.0f);
|
||||
if(hull_integrity < 0){
|
||||
hull_integrity = 0;
|
||||
}
|
||||
|
||||
+17
-8
@@ -9,13 +9,22 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Hud/HUDets.cpp $
|
||||
* $Revision: 2.13 $
|
||||
* $Date: 2005-03-10 08:00:06 $
|
||||
* $Author: taylor $
|
||||
* $Revision: 2.14 $
|
||||
* $Date: 2005-03-27 12:28:33 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* C file that contains code to manage and display the Energy Transfer System (ETS)
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.13 2005/03/10 08:00:06 taylor
|
||||
* change min/max to MIN/MAX to fix GCC problems
|
||||
* add lab stuff to Makefile
|
||||
* build unbreakage for everything that's not MSVC++ 6
|
||||
* lots of warning fixes
|
||||
* fix OpenGL rendering problem with ship insignias
|
||||
* no Warnings() in non-debug mode for Linux (like Windows)
|
||||
* some campaign savefile fixage to stop reverting everyones data
|
||||
*
|
||||
* Revision 2.12 2004/07/26 20:47:32 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
@@ -347,7 +356,7 @@ void update_ets(object* objp, float fl_frametime)
|
||||
ship* ship_p = &Ships[objp->instance];
|
||||
ship_info* sinfo_p = &Ship_info[ship_p->ship_info_index];
|
||||
float max_g=sinfo_p->max_weapon_reserve,
|
||||
max_s=ship_p->ship_initial_shield_strength;
|
||||
max_s=ship_p->ship_max_shield_strength;
|
||||
|
||||
if ( ship_p->flags & SF_DYING ){
|
||||
return;
|
||||
@@ -390,9 +399,9 @@ void update_ets(object* objp, float fl_frametime)
|
||||
|
||||
add_shield_strength(objp, shield_delta);
|
||||
|
||||
if ( (_ss = get_shield_strength(objp)) > ship_p->ship_initial_shield_strength ){
|
||||
if ( (_ss = get_shield_strength(objp)) > ship_p->ship_max_shield_strength ){
|
||||
for (int i=0; i<MAX_SHIELD_SECTIONS; i++){
|
||||
objp->shield_quadrant[i] *= ship_p->ship_initial_shield_strength / _ss;
|
||||
objp->shield_quadrant[i] *= ship_p->ship_max_shield_strength / _ss;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -481,7 +490,7 @@ void ai_manage_ets(object* obj)
|
||||
return;
|
||||
|
||||
// check if any of the three systems are not being used. If so, don't allow energy management.
|
||||
if ( !ship_p->ship_initial_shield_strength || !ship_info_p->max_speed || !ship_info_p->max_weapon_reserve)
|
||||
if ( !ship_p->ship_max_shield_strength || !ship_info_p->max_speed || !ship_info_p->max_weapon_reserve)
|
||||
return;
|
||||
|
||||
float shield_left_percent = get_shield_pct(obj);
|
||||
@@ -1022,7 +1031,7 @@ void transfer_energy_to_shields(object* obj)
|
||||
return;
|
||||
}
|
||||
|
||||
transfer_energy_weapon_common(obj, ship_p->weapon_energy, get_shield_strength(obj), &ship_p->target_weapon_energy_delta, &ship_p->target_shields_delta, ship_p->ship_initial_shield_strength, 0.5f);
|
||||
transfer_energy_weapon_common(obj, ship_p->weapon_energy, get_shield_strength(obj), &ship_p->target_weapon_energy_delta, &ship_p->target_shields_delta, ship_p->ship_max_shield_strength, 0.5f);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
+10
-16
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Hud/HUDshield.cpp $
|
||||
* $Revision: 2.27 $
|
||||
* $Date: 2005-03-25 06:57:34 $
|
||||
* $Author: wmcoolmon $
|
||||
* $Revision: 2.28 $
|
||||
* $Date: 2005-03-27 12:28:33 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* C file for the display and management of the HUD shield
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.27 2005/03/25 06:57:34 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
* Revision 2.26 2005/03/10 08:00:06 taylor
|
||||
* change min/max to MIN/MAX to fix GCC problems
|
||||
* add lab stuff to Makefile
|
||||
@@ -607,7 +610,7 @@ void hud_shield_show(object *objp)
|
||||
HUD_reset_clip();
|
||||
}
|
||||
|
||||
if(!sip->initial_shield_strength)
|
||||
if(!sip->max_shield_strength)
|
||||
return;
|
||||
|
||||
// draw the four quadrants
|
||||
@@ -909,7 +912,7 @@ void hud_augment_shield_quadrant(object *objp, int direction)
|
||||
Assert(direction >= 0 && direction < MAX_SHIELD_SECTIONS);
|
||||
Assert(objp->type == OBJ_SHIP);
|
||||
|
||||
xfer_amount = Ships[objp->instance].ship_initial_shield_strength * SHIELD_TRANSFER_PERCENT;
|
||||
xfer_amount = Ships[objp->instance].ship_max_shield_strength * SHIELD_TRANSFER_PERCENT;
|
||||
max_quadrant_val = get_max_shield_quad(objp);
|
||||
|
||||
if ( (objp->shield_quadrant[direction] + xfer_amount) > max_quadrant_val )
|
||||
@@ -974,19 +977,10 @@ void hud_show_mini_ship_integrity(object *objp, int x_force, int y_force)
|
||||
#ifndef NEW_HUD
|
||||
char text_integrity[64];
|
||||
int numeric_integrity;
|
||||
float p_target_integrity,initial_hull;
|
||||
float p_target_integrity;
|
||||
int final_pos[2];
|
||||
|
||||
initial_hull = Ships[objp->instance].ship_initial_hull_strength;
|
||||
if ( initial_hull <= 0 ) {
|
||||
Int3(); // illegal initial hull strength
|
||||
p_target_integrity = 0.0f;
|
||||
} else {
|
||||
p_target_integrity = objp->hull_strength / initial_hull;
|
||||
if (p_target_integrity < 0){
|
||||
p_target_integrity = 0.0f;
|
||||
}
|
||||
}
|
||||
p_target_integrity = get_hull_pct(objp);
|
||||
|
||||
numeric_integrity = fl2i(p_target_integrity*100 + 0.5f);
|
||||
if(numeric_integrity > 100){
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Hud/HUDtargetbox.cpp $
|
||||
* $Revision: 2.47 $
|
||||
* $Date: 2005-03-25 06:57:34 $
|
||||
* $Author: wmcoolmon $
|
||||
* $Revision: 2.48 $
|
||||
* $Date: 2005-03-27 12:28:33 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* C module for drawing the target monitor box on the HUD
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.47 2005/03/25 06:57:34 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
* Revision 2.46 2005/03/06 11:23:45 wmcoolmon
|
||||
* RE-fixed stuff. Ogg support. Briefings.
|
||||
*
|
||||
@@ -2012,7 +2015,7 @@ void hud_show_target_data(float frametime)
|
||||
sy += dy;
|
||||
|
||||
// data can be found in target montior
|
||||
// gr_printf(TARGET_WINDOW_X1+TARGET_WINDOW_WIDTH+3, TARGET_WINDOW_Y1+5*h, "Shields: %d", (int) Players[Player_num].current_target->ship_initial_shield_strength);
|
||||
// gr_printf(TARGET_WINDOW_X1+TARGET_WINDOW_WIDTH+3, TARGET_WINDOW_Y1+5*h, "Shields: %d", (int) Players[Player_num].current_target->ship_max_shield_strength);
|
||||
if (aip->target_objnum != -1) {
|
||||
char target_str[32];
|
||||
float dot, dist;
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Hud/HUDWingmanStatus.cpp $
|
||||
* $Revision: 2.10 $
|
||||
* $Date: 2005-03-02 21:24:44 $
|
||||
* $Author: taylor $
|
||||
* $Revision: 2.11 $
|
||||
* $Date: 2005-03-27 12:28:33 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Module for the wingman status gauge
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.10 2005/03/02 21:24:44 taylor
|
||||
* more NO_NETWORK/INF_BUILD goodness for Windows, takes care of a few warnings too
|
||||
*
|
||||
* Revision 2.9 2005/01/31 10:34:38 taylor
|
||||
* merge with Linux/OSX tree - p0131
|
||||
*
|
||||
@@ -424,16 +427,6 @@ void hud_set_wingman_status_alive( int wing_index, int wing_pos)
|
||||
HUD_wingman_status[wing_index].status[wing_pos] = HUD_WINGMAN_STATUS_ALIVE;
|
||||
}
|
||||
|
||||
// get the hull percent for a specific ship, return value 0.0 -> 1.0
|
||||
float hud_get_ship_hull_percent(int ship_index)
|
||||
{
|
||||
object *ship_objp;
|
||||
|
||||
ship_objp = &Objects[Ships[ship_index].objnum];
|
||||
|
||||
return (ship_objp->hull_strength / Ships[ship_index].ship_initial_hull_strength);
|
||||
}
|
||||
|
||||
void hud_wingman_status_init_late_wings()
|
||||
{
|
||||
/*
|
||||
@@ -541,7 +534,7 @@ void hud_wingman_status_update()
|
||||
if (!(shipp->flags & SF_DEPARTING) ) {
|
||||
HUD_wingman_status[wing_index].status[wing_pos] = HUD_WINGMAN_STATUS_ALIVE;
|
||||
}
|
||||
HUD_wingman_status[wing_index].hull[wing_pos] = hud_get_ship_hull_percent(ship_objp->instance);
|
||||
HUD_wingman_status[wing_index].hull[wing_pos] = get_hull_pct(ship_objp);
|
||||
if ( HUD_wingman_status[wing_index].hull[wing_pos] <= 0 ) {
|
||||
HUD_wingman_status[wing_index].status[wing_pos] = HUD_WINGMAN_STATUS_DEAD;
|
||||
}
|
||||
|
||||
@@ -9,13 +9,17 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Io/KeyControl.cpp $
|
||||
* $Revision: 2.46 $
|
||||
* $Date: 2005-03-27 04:16:19 $
|
||||
* $Author: wmcoolmon $
|
||||
* $Revision: 2.47 $
|
||||
* $Date: 2005-03-27 12:28:33 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Routines to read and deal with keyboard input.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.46 2005/03/27 04:16:19 wmcoolmon
|
||||
* Fixed possible infinite loop problem
|
||||
* ----------------------------------------------------------------------
|
||||
*
|
||||
* Revision 2.45 2005/03/25 06:57:34 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
@@ -1143,7 +1147,7 @@ void process_debug_keys(int k)
|
||||
case OBJ_SHIP:
|
||||
|
||||
// remove guardian flag -- kazan
|
||||
objp->flags &= ~OF_GUARDIAN;
|
||||
Ships[objp->instance].ship_guardian_threshold = 0;
|
||||
|
||||
ship_apply_local_damage( objp, Player_obj, &objp->pos, 100000.0f, MISS_SHIELDS, CREATE_SPARKS);
|
||||
ship_apply_local_damage( objp, Player_obj, &objp->pos, 1.0f, MISS_SHIELDS, CREATE_SPARKS);
|
||||
@@ -1216,7 +1220,7 @@ void process_debug_keys(int k)
|
||||
object *objp = &Objects[Player_ai->target_objnum];
|
||||
|
||||
if (objp->type == OBJ_SHIP) {
|
||||
ship_apply_local_damage( objp, Player_obj, &objp->pos, Ships[objp->instance].ship_initial_hull_strength * 0.1f + 10.0f, MISS_SHIELDS, CREATE_SPARKS);
|
||||
ship_apply_local_damage( objp, Player_obj, &objp->pos, Ships[objp->instance].ship_max_hull_strength * 0.1f + 10.0f, MISS_SHIELDS, CREATE_SPARKS);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
+2
-2
@@ -178,8 +178,8 @@ void set_ship_variables_ship(ship_info *sip)
|
||||
SVW_SET_SI_VAR(max_vel.xyz.y);
|
||||
SVW_SET_SI_VAR(max_vel.xyz.z);
|
||||
|
||||
SVW_SET_SI_VAR(initial_shield_strength);
|
||||
SVW_SET_SI_VAR(initial_hull_strength);
|
||||
SVW_SET_SI_VAR(max_shield_strength);
|
||||
SVW_SET_SI_VAR(max_hull_strength);
|
||||
SVW_SET_SI_VAR(subsys_repair_rate_percent);
|
||||
SVW_SET_SI_VAR(hull_repair_rate_percent);
|
||||
SVW_SET_SI_VAR(cmeasure_max);
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Mission/MissionParse.cpp $
|
||||
* $Revision: 2.85 $
|
||||
* $Date: 2005-03-25 06:57:35 $
|
||||
* $Author: wmcoolmon $
|
||||
* $Revision: 2.86 $
|
||||
* $Date: 2005-03-27 12:28:33 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* main upper level code for parsing stuff
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.85 2005/03/25 06:57:35 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
* Revision 2.84 2005/03/08 03:50:22 Goober5000
|
||||
* edited for language ;)
|
||||
* --Goober5000
|
||||
@@ -1926,14 +1929,14 @@ int parse_create_object(p_object *objp)
|
||||
|
||||
// Goober5000
|
||||
Ships[shipnum].special_hitpoint_index = objp->special_hitpoint_index;
|
||||
Ships[shipnum].ship_initial_shield_strength = objp->ship_initial_shield_strength;
|
||||
Ships[shipnum].ship_initial_hull_strength = objp->ship_initial_hull_strength;
|
||||
Ships[shipnum].ship_max_shield_strength = objp->ship_max_shield_strength;
|
||||
Ships[shipnum].ship_max_hull_strength = objp->ship_max_hull_strength;
|
||||
|
||||
// Goober5000 - ugh, this is really stupid having to do this here; if the
|
||||
// ship creation code was better organized this wouldn't be necessary
|
||||
if (shipp->special_hitpoint_index >= 0)
|
||||
{
|
||||
float hull_factor = shipp->ship_initial_hull_strength / sip->initial_hull_strength;
|
||||
float hull_factor = shipp->ship_max_hull_strength / sip->max_hull_strength;
|
||||
ship_subsys *ss;
|
||||
|
||||
for ( ss = GET_FIRST(&shipp->subsys_list); ss != END_OF_LIST(&shipp->subsys_list) && ss != NULL; ss = GET_NEXT(ss) )
|
||||
@@ -1950,7 +1953,7 @@ int parse_create_object(p_object *objp)
|
||||
}
|
||||
|
||||
// Goober5000 - this is also stupid; this is in ship_set but it needs to be done here because of the special hitpoints mod
|
||||
Objects[objnum].hull_strength = shipp->ship_initial_hull_strength;
|
||||
Objects[objnum].hull_strength = shipp->ship_max_hull_strength;
|
||||
|
||||
|
||||
Ships[shipnum].respawn_priority = objp->respawn_priority;
|
||||
@@ -2076,7 +2079,7 @@ int parse_create_object(p_object *objp)
|
||||
if ( objp->flags & P_SF_REINFORCEMENT )
|
||||
Ships[shipnum].flags |= SF_REINFORCEMENT;
|
||||
|
||||
if (objp->flags & P_OF_NO_SHIELDS || objp->ship_initial_shield_strength == 0.0f )
|
||||
if (objp->flags & P_OF_NO_SHIELDS || objp->ship_max_shield_strength == 0.0f )
|
||||
Objects[objnum].flags |= OF_NO_SHIELDS;
|
||||
|
||||
if (objp->flags & P_SF_ESCORT)
|
||||
@@ -2180,7 +2183,7 @@ int parse_create_object(p_object *objp)
|
||||
}
|
||||
|
||||
if ( objp->flags & P_SF_GUARDIAN ) {
|
||||
Objects[objnum].flags |= OF_GUARDIAN;
|
||||
Ships[shipnum].ship_guardian_threshold = SHIP_GUARDIAN_THRESHOLD_DEFAULT;
|
||||
}
|
||||
|
||||
if ( objp->flags & P_SF_SCANNABLE )
|
||||
@@ -2297,7 +2300,7 @@ int parse_create_object(p_object *objp)
|
||||
ptr->current_hits = sssp->percent;
|
||||
ptr->max_hits = 100.0f;
|
||||
} else {
|
||||
ptr->max_hits = ptr->system_info->max_subsys_strength * (Ships[shipnum].ship_initial_hull_strength / sip->initial_hull_strength);
|
||||
ptr->max_hits = ptr->system_info->max_subsys_strength * (Ships[shipnum].ship_max_hull_strength / sip->max_hull_strength);
|
||||
|
||||
float new_hits;
|
||||
new_hits = ptr->max_hits * (100.0f - sssp->percent) / 100.f;
|
||||
@@ -2356,7 +2359,7 @@ int parse_create_object(p_object *objp)
|
||||
polymodel *pm;
|
||||
|
||||
// Ships[shipnum].hull_hit_points_taken = (float)objp->initial_hull * sip->max_hull_hit_points / 100.0f;
|
||||
Objects[objnum].hull_strength = objp->initial_hull * Ships[shipnum].ship_initial_hull_strength / 100.0f;
|
||||
Objects[objnum].hull_strength = objp->initial_hull * Ships[shipnum].ship_max_hull_strength / 100.0f;
|
||||
for (i = 0; i<MAX_SHIELD_SECTIONS; i++)
|
||||
Objects[objnum].shield_quadrant[i] = (float)(objp->initial_shields * get_max_shield_quad(&Objects[objnum]) / 100.0f);
|
||||
|
||||
@@ -2700,15 +2703,15 @@ int parse_object(mission *pm, int flag, p_object *objp)
|
||||
// get hitpoint values
|
||||
if (objp->special_hitpoint_index != -1)
|
||||
{
|
||||
objp->ship_initial_shield_strength = (float) atoi(Sexp_variables[objp->special_hitpoint_index+SHIELD_STRENGTH].text);
|
||||
objp->ship_initial_hull_strength = (float) atoi(Sexp_variables[objp->special_hitpoint_index+HULL_STRENGTH].text);
|
||||
objp->ship_max_shield_strength = (float) atoi(Sexp_variables[objp->special_hitpoint_index+SHIELD_STRENGTH].text);
|
||||
objp->ship_max_hull_strength = (float) atoi(Sexp_variables[objp->special_hitpoint_index+HULL_STRENGTH].text);
|
||||
}
|
||||
else
|
||||
{
|
||||
objp->ship_initial_shield_strength = Ship_info[objp->ship_class].initial_shield_strength;
|
||||
objp->ship_initial_hull_strength = Ship_info[objp->ship_class].initial_hull_strength;
|
||||
objp->ship_max_shield_strength = Ship_info[objp->ship_class].max_shield_strength;
|
||||
objp->ship_max_hull_strength = Ship_info[objp->ship_class].max_hull_strength;
|
||||
}
|
||||
Assert(objp->ship_initial_hull_strength > 0.0f); // Goober5000: div-0 check (not shield because we might not have one)
|
||||
Assert(objp->ship_max_hull_strength > 0.0f); // Goober5000: div-0 check (not shield because we might not have one)
|
||||
|
||||
// if the kamikaze flag is set, we should have the next flag
|
||||
if ( optional_string("+Kamikaze Damage:") ) {
|
||||
@@ -6059,8 +6062,8 @@ void mission_bring_in_support_ship( object *requester_objp )
|
||||
}
|
||||
|
||||
// set support ship hitpoints
|
||||
pobj->ship_initial_hull_strength = Ship_info[i].initial_hull_strength;
|
||||
pobj->ship_initial_shield_strength = Ship_info[i].initial_shield_strength;
|
||||
pobj->ship_max_hull_strength = Ship_info[i].max_hull_strength;
|
||||
pobj->ship_max_shield_strength = Ship_info[i].max_shield_strength;
|
||||
|
||||
pobj->team = requester_shipp->team;
|
||||
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Source: /cvs/cvsroot/fs2open/fs2_open/code/mission/missionparse.h,v $
|
||||
* $Revision: 2.56 $
|
||||
* $Author: wmcoolmon $
|
||||
* $Date: 2005-03-25 06:57:35 $
|
||||
* $Revision: 2.57 $
|
||||
* $Author: Goober5000 $
|
||||
* $Date: 2005-03-27 12:28:33 $
|
||||
*
|
||||
* main header file for parsing code
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.56 2005/03/25 06:57:35 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
* Revision 2.55 2005/01/21 08:56:50 taylor
|
||||
* make Subsys_status dynamic but allocate in blocks for speed and to help prevent memory fragmentation
|
||||
*
|
||||
@@ -732,8 +735,8 @@ typedef struct p_object {
|
||||
|
||||
char alt_type_index; // optional alt type index
|
||||
|
||||
float ship_initial_hull_strength;
|
||||
float ship_initial_shield_strength;
|
||||
float ship_max_hull_strength;
|
||||
float ship_max_shield_strength;
|
||||
|
||||
// Goober5000
|
||||
int num_texture_replacements;
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/MissionUI/MissionShipChoice.cpp $
|
||||
* $Revision: 2.39 $
|
||||
* $Date: 2005-03-25 06:57:36 $
|
||||
* $Author: wmcoolmon $
|
||||
* $Revision: 2.40 $
|
||||
* $Date: 2005-03-27 12:28:33 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* C module to allow player ship selection for the mission
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.39 2005/03/25 06:57:36 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
* Revision 2.38 2005/03/14 06:38:06 wmcoolmon
|
||||
* Commented out now-unneccessary Int3()
|
||||
*
|
||||
@@ -1597,7 +1600,7 @@ void ship_select_blit_ship_info()
|
||||
}
|
||||
else
|
||||
{
|
||||
int sum = fl2i(sip->initial_hull_strength + sip->initial_shield_strength);
|
||||
int sum = fl2i(sip->max_hull_strength + sip->max_shield_strength);
|
||||
if(sum <= 600)
|
||||
strcpy(str, "Light");
|
||||
else if(sum <= 700)
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/MissionUI/RedAlert.cpp $
|
||||
* $Revision: 2.12 $
|
||||
* $Date: 2005-03-24 23:29:33 $
|
||||
* $Author: taylor $
|
||||
* $Revision: 2.13 $
|
||||
* $Date: 2005-03-27 12:28:34 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Module for Red Alert mission interface and code
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.12 2005/03/24 23:29:33 taylor
|
||||
* (re)move some uneeded variables to fix compiler warnings
|
||||
*
|
||||
* Revision 2.11 2005/02/23 04:55:08 taylor
|
||||
* more bm_unload() -> bm_release() changes
|
||||
*
|
||||
@@ -1102,7 +1105,7 @@ void red_alert_start_mission()
|
||||
if (Player_obj->type == OBJ_SHIP) {
|
||||
if (Player_obj->hull_strength > 0) {
|
||||
// make sure we don't die
|
||||
Player_obj->flags |= OF_GUARDIAN;
|
||||
Player_ship->ship_guardian_threshold = SHIP_GUARDIAN_THRESHOLD_DEFAULT;
|
||||
|
||||
// do normal red alert stuff
|
||||
Red_alert_new_mission_timestamp = timestamp(RED_ALERT_WARN_TIME);
|
||||
|
||||
@@ -442,7 +442,7 @@ int multi_oo_pack_data(net_player *pl, object *objp, ubyte oo_flags, ubyte *data
|
||||
// hull info
|
||||
if ( oo_flags & OO_HULL_NEW ){
|
||||
// add the hull value for this guy
|
||||
temp = (objp->hull_strength / shipp->ship_initial_hull_strength);
|
||||
temp = get_hull_pct(objp);
|
||||
PACK_PERCENT(temp);
|
||||
multi_rate_add(NET_PLAYER_NUM(pl), "hul", 1);
|
||||
|
||||
@@ -862,7 +862,7 @@ int multi_oo_unpack_data(net_player *pl, ubyte *data)
|
||||
// hull info
|
||||
if ( oo_flags & OO_HULL_NEW ){
|
||||
UNPACK_PERCENT(fpct);
|
||||
pobjp->hull_strength = fpct * Ships[pobjp->instance].ship_initial_hull_strength;
|
||||
pobjp->hull_strength = fpct * Ships[pobjp->instance].ship_max_hull_strength;
|
||||
|
||||
float shield_0, shield_1, shield_2, shield_3;
|
||||
|
||||
|
||||
@@ -803,7 +803,7 @@ int multi_oo_pack_data(net_player *pl, object *objp, ubyte oo_flags, ubyte *data
|
||||
// hull info
|
||||
if ( oo_flags & OO_HULL_NEW ){
|
||||
// add the hull value for this guy
|
||||
temp = (objp->hull_strength / shipp->ship_initial_hull_strength);
|
||||
temp = get_hull_pct(objp);
|
||||
PACK_PERCENT(temp);
|
||||
R_HULL_ADD(pl, 1);
|
||||
|
||||
@@ -1129,7 +1129,7 @@ int multi_oo_unpack_data(net_player *pl, ubyte *data, ushort packet_sequence_num
|
||||
// hull info
|
||||
if ( oo_flags & OO_HULL_NEW ){
|
||||
UNPACK_PERCENT(fpct);
|
||||
pobjp->hull_strength = fpct * Ships[pobjp->instance].ship_initial_hull_strength;
|
||||
pobjp->hull_strength = fpct * Ships[pobjp->instance].ship_max_hull_strength;
|
||||
|
||||
// TEST code
|
||||
#ifndef NDEBUG
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Network/MultiMsgs.cpp $
|
||||
* $Revision: 2.28 $
|
||||
* $Date: 2005-03-25 06:57:36 $
|
||||
* $Author: wmcoolmon $
|
||||
* $Revision: 2.29 $
|
||||
* $Date: 2005-03-27 12:28:34 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* C file that holds functions for the building and processing of multiplayer packets
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.28 2005/03/25 06:57:36 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
* Revision 2.27 2005/03/02 21:18:20 taylor
|
||||
* better support for Inferno builds (in PreProcDefines.h now, no networking support)
|
||||
* make sure NO_NETWORK builds are as friendly on Windows as it is on Linux/OSX
|
||||
@@ -7250,12 +7253,7 @@ void send_client_update_packet(net_player *pl)
|
||||
|
||||
// hull strength and shield mesh information are floats (as a percentage). Pass the integer
|
||||
// percentage value since that should be close enough
|
||||
float temp = (objp->hull_strength / shipp->ship_initial_hull_strength * 100.0f);
|
||||
if(temp < 0.0f){
|
||||
percent = 0;
|
||||
} else {
|
||||
percent = (ubyte)temp;
|
||||
}
|
||||
percent = (ubyte) (get_hull_pct(objp) * 100.0f);
|
||||
ADD_DATA( percent );
|
||||
|
||||
for (i = 0; i < MAX_SHIELD_SECTIONS; i++ ) {
|
||||
@@ -7374,7 +7372,7 @@ void process_client_update_packet(ubyte *data, header *hinfo)
|
||||
objp = Player_obj;
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
fl_val = hull_percent * shipp->ship_initial_hull_strength / 100.0f;
|
||||
fl_val = hull_percent * shipp->ship_max_hull_strength / 100.0f;
|
||||
objp->hull_strength = fl_val;
|
||||
|
||||
for ( i = 0; i < MAX_SHIELD_SECTIONS; i++ ) {
|
||||
|
||||
@@ -9,13 +9,22 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Object/CollideDebrisShip.cpp $
|
||||
* $Revision: 2.7 $
|
||||
* $Date: 2005-03-10 08:00:11 $
|
||||
* $Author: taylor $
|
||||
* $Revision: 2.8 $
|
||||
* $Date: 2005-03-27 12:28:32 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Routines to detect collisions and do physics, damage, etc for ships and debris
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.7 2005/03/10 08:00:11 taylor
|
||||
* change min/max to MIN/MAX to fix GCC problems
|
||||
* add lab stuff to Makefile
|
||||
* build unbreakage for everything that's not MSVC++ 6
|
||||
* lots of warning fixes
|
||||
* fix OpenGL rendering problem with ship insignias
|
||||
* no Warnings() in non-debug mode for Linux (like Windows)
|
||||
* some campaign savefile fixage to stop reverting everyones data
|
||||
*
|
||||
* Revision 2.6 2004/07/26 20:47:45 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
@@ -265,7 +274,7 @@ int collide_debris_ship( obj_pair * pair )
|
||||
// supercaps cap damage at 10-20% max hull ship damage
|
||||
if (Ship_info[Ships[pship->instance].ship_info_index].flags & SIF_SUPERCAP) {
|
||||
float cap_percent_damage = frand_range(0.1f, 0.2f);
|
||||
ship_damage = MIN(ship_damage, cap_percent_damage * Ships[pship->instance].ship_initial_hull_strength);
|
||||
ship_damage = MIN(ship_damage, cap_percent_damage * Ships[pship->instance].ship_max_hull_strength);
|
||||
}
|
||||
|
||||
// apply damage to debris
|
||||
@@ -399,16 +408,16 @@ int collide_asteroid_ship( obj_pair * pair )
|
||||
if (ship_damage > 5.0f)
|
||||
ship_damage = 5.0f + (ship_damage - 5.0f)/2.0f;
|
||||
|
||||
if ((ship_damage > 500.0f) && (ship_damage > Ships[pship->instance].ship_initial_hull_strength/8.0f)) {
|
||||
ship_damage = Ships[pship->instance].ship_initial_hull_strength/8.0f;
|
||||
nprintf(("AI", "Pinning damage to %s from asteroid at %7.3f (%7.3f percent)\n", Ships[pship->instance].ship_name, ship_damage, 100.0f * ship_damage/Ships[pship->instance].ship_initial_hull_strength));
|
||||
if ((ship_damage > 500.0f) && (ship_damage > Ships[pship->instance].ship_max_hull_strength/8.0f)) {
|
||||
ship_damage = Ships[pship->instance].ship_max_hull_strength/8.0f;
|
||||
nprintf(("AI", "Pinning damage to %s from asteroid at %7.3f (%7.3f percent)\n", Ships[pship->instance].ship_name, ship_damage, 100.0f * ship_damage/Ships[pship->instance].ship_max_hull_strength));
|
||||
}
|
||||
|
||||
// Decrease damage during warp out because it's annoying when your escoree dies during warp out.
|
||||
if (Ai_info[Ships[pship->instance].ai_index].mode == AIM_WARP_OUT)
|
||||
ship_damage /= 3.0f;
|
||||
|
||||
//nprintf(("AI", "Asteroid damage on %s = %7.3f (%6.2f percent)\n", Ships[pship->instance].ship_name, ship_damage, 100.0f * ship_damage/Ships[pship->instance].ship_initial_hull_strength));
|
||||
//nprintf(("AI", "Asteroid damage on %s = %7.3f (%6.2f percent)\n", Ships[pship->instance].ship_name, ship_damage, 100.0f * ship_damage/Ships[pship->instance].ship_max_hull_strength));
|
||||
|
||||
// calculate asteroid damage and set asteroid damage to greater or asteroid and ship
|
||||
// asteroid damage is needed since we can really whack some small asteroid with afterburner and not do
|
||||
|
||||
@@ -9,13 +9,22 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Object/CollideShipShip.cpp $
|
||||
* $Revision: 2.11 $
|
||||
* $Date: 2005-03-10 08:00:11 $
|
||||
* $Author: taylor $
|
||||
* $Revision: 2.12 $
|
||||
* $Date: 2005-03-27 12:28:32 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Routines to detect collisions and do physics, damage, etc for ships and ships
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.11 2005/03/10 08:00:11 taylor
|
||||
* change min/max to MIN/MAX to fix GCC problems
|
||||
* add lab stuff to Makefile
|
||||
* build unbreakage for everything that's not MSVC++ 6
|
||||
* lots of warning fixes
|
||||
* fix OpenGL rendering problem with ship insignias
|
||||
* no Warnings() in non-debug mode for Linux (like Windows)
|
||||
* some campaign savefile fixage to stop reverting everyones data
|
||||
*
|
||||
* Revision 2.10 2005/01/26 05:42:37 Goober5000
|
||||
* fixed a nitpicky thing
|
||||
* --Goober5000
|
||||
@@ -1734,7 +1743,7 @@ int collide_ship_ship( obj_pair * pair )
|
||||
//
|
||||
// vm_vec_normalized_dir(&v2h, &ship_ship_hit_info.hit_pos, &Player_obj->pos);
|
||||
// dot = vm_vec_dot(&Player_obj->orient.fvec, &v2h);
|
||||
// // HUD_printf("Collision %s: %i%%. (dot=%5.2f), dist ratio=%5.2f", Ships[other_objp->instance].ship_name, (int) (100.0f * damage/Ships[Player_obj->instance].ship_initial_hull_strength), dot,
|
||||
// // HUD_printf("Collision %s: %i%%. (dot=%5.2f), dist ratio=%5.2f", Ships[other_objp->instance].ship_name, (int) (100.0f * damage/Ships[Player_obj->instance].ship_max_hull_strength), dot,
|
||||
// // vm_vec_dist_quick(&Player_obj->pos, &other_objp->pos) / (Player_obj->radius + other_objp->radius));
|
||||
// }
|
||||
// }
|
||||
|
||||
+10
-7
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Object/Object.cpp $
|
||||
* $Revision: 2.35 $
|
||||
* $Date: 2005-03-25 06:57:36 $
|
||||
* $Author: wmcoolmon $
|
||||
* $Revision: 2.36 $
|
||||
* $Date: 2005-03-27 12:28:32 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Code to manage objects
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.35 2005/03/25 06:57:36 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
* Revision 2.34 2005/03/03 06:05:30 wmcoolmon
|
||||
* Merge of WMC's codebase. "Features and bugs, making Goober say "Grr!", as release would be stalled now for two months for sure"
|
||||
*
|
||||
@@ -767,7 +770,7 @@ float get_max_shield_quad(object *objp)
|
||||
Assert(objp);
|
||||
Assert(objp->type == OBJ_SHIP);
|
||||
|
||||
return Ships[objp->instance].ship_initial_shield_strength / MAX_SHIELD_SECTIONS;
|
||||
return Ships[objp->instance].ship_max_shield_strength / MAX_SHIELD_SECTIONS;
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
@@ -776,7 +779,7 @@ float get_hull_pct(object *objp)
|
||||
Assert(objp);
|
||||
Assert(objp->type == OBJ_SHIP);
|
||||
|
||||
float total_strength = Ships[objp->instance].ship_initial_hull_strength;
|
||||
float total_strength = Ships[objp->instance].ship_max_hull_strength;
|
||||
|
||||
Assert(total_strength > 0.0f); // unlike shield, no ship can have 0 hull
|
||||
|
||||
@@ -798,7 +801,7 @@ float get_shield_pct(object *objp)
|
||||
if (objp->type != OBJ_SHIP)
|
||||
return 0.0f;
|
||||
|
||||
float total_strength = Ships[objp->instance].ship_initial_shield_strength;
|
||||
float total_strength = Ships[objp->instance].ship_max_shield_strength;
|
||||
|
||||
if (total_strength == 0.0f)
|
||||
return 0.0f;
|
||||
@@ -829,7 +832,7 @@ void set_shield_strength(object *objp, float strength)
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( (strength - Ships[objp->instance].ship_initial_shield_strength) > 0.1 ){
|
||||
if ( (strength - Ships[objp->instance].ship_max_shield_strength) > 0.1 ){
|
||||
Int3();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Object/Object.h $
|
||||
* $Revision: 2.11 $
|
||||
* $Date: 2005-03-25 06:57:36 $
|
||||
* $Author: wmcoolmon $
|
||||
* $Revision: 2.12 $
|
||||
* $Date: 2005-03-27 12:28:32 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* <insert description of file here>
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.11 2005/03/25 06:57:36 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
* Revision 2.10 2005/03/03 06:05:30 wmcoolmon
|
||||
* Merge of WMC's codebase. "Features and bugs, making Goober say "Grr!", as release would be stalled now for two months for sure"
|
||||
*
|
||||
@@ -458,9 +461,8 @@ extern char *Object_type_names[MAX_OBJECT_TYPES];
|
||||
#define OF_WAS_RENDERED (1<<10) // Set if this object was rendered this frame. Only gets set if OF_RENDERS set. Gets cleared or set in obj_render_all().
|
||||
#define OF_NOT_IN_COLL (1<<11) // object has not been added to collision list
|
||||
#define OF_BEAM_PROTECTED (1<<12) // don't fire beam weapons at this type of object, probably mission critical.
|
||||
#define OF_GUARDIAN (1<<13) // Don't allow ship to die, keep at least 1% hull
|
||||
#define OF_SPECIAL_WARP (1<<14) // Object has special warp-in enabled.
|
||||
#define OF_DOCKED_ALREADY_HANDLED (1<<15) // Goober5000 - a docked object that we already moved
|
||||
#define OF_SPECIAL_WARP (1<<13) // Object has special warp-in enabled.
|
||||
#define OF_DOCKED_ALREADY_HANDLED (1<<14) // Goober5000 - a docked object that we already moved
|
||||
|
||||
// Flags used by Fred
|
||||
#define OF_MARKED (1<<17) // Object is marked (Fred). Can be reused in Freespace for anything that won't be used by Fred.
|
||||
|
||||
+14
-16
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/parse/SEXP.CPP $
|
||||
* $Revision: 2.141 $
|
||||
* $Date: 2005-03-25 06:57:37 $
|
||||
* $Author: wmcoolmon $
|
||||
* $Revision: 2.142 $
|
||||
* $Date: 2005-03-27 12:28:34 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* main sexpression generator
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.141 2005/03/25 06:57:37 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
* Revision 2.140 2005/03/15 07:26:52 Goober5000
|
||||
* *fixed some sexp declaration formatting
|
||||
* *implemented string comparison sexps
|
||||
@@ -4803,7 +4806,7 @@ int sexp_shields_left(int n)
|
||||
}
|
||||
|
||||
// Goober5000: in case ship has no shields
|
||||
if (Ships[shipnum].ship_initial_shield_strength == 0.0f)
|
||||
if (Ships[shipnum].ship_max_shield_strength == 0.0f)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -4836,7 +4839,7 @@ int sexp_hits_left(int n)
|
||||
// since we are working with total hit points taken, not total remaining.
|
||||
ship *shipp = &Ships[shipnum];
|
||||
object *objp = &Objects[shipp->objnum];
|
||||
percent = (int) (100.0f * objp->hull_strength / shipp->ship_initial_hull_strength);
|
||||
percent = (int) (100.0f * get_hull_pct(objp));
|
||||
return percent;
|
||||
}
|
||||
|
||||
@@ -8137,7 +8140,7 @@ void sexp_sabotage_subsystem( int n )
|
||||
float ihs;
|
||||
object *objp;
|
||||
|
||||
ihs = shipp->ship_initial_hull_strength;
|
||||
ihs = shipp->ship_max_hull_strength;
|
||||
sabotage_hits = ihs * ((float)percentage / 100.0f);
|
||||
objp = &Objects[shipp->objnum];
|
||||
objp->hull_strength -= sabotage_hits;
|
||||
@@ -8199,7 +8202,7 @@ void sexp_repair_subsystem( int n )
|
||||
float ihs;
|
||||
object *objp;
|
||||
|
||||
ihs = shipp->ship_initial_hull_strength;
|
||||
ihs = shipp->ship_max_hull_strength;
|
||||
repair_hits = ihs * ((float)percentage / 100.0f);
|
||||
objp = &Objects[shipp->objnum];
|
||||
objp->hull_strength += repair_hits;
|
||||
@@ -8265,7 +8268,7 @@ void sexp_set_subsystem_strength( int n )
|
||||
if ( percentage == 0 ) {
|
||||
ship_self_destruct( objp );
|
||||
} else {
|
||||
ihs = shipp->ship_initial_hull_strength;
|
||||
ihs = shipp->ship_max_hull_strength;
|
||||
objp->hull_strength = ihs * ((float)percentage / 100.0f);
|
||||
}
|
||||
|
||||
@@ -9723,7 +9726,6 @@ void sexp_ships_invulnerable( int n, int invulnerable )
|
||||
void sexp_ships_guardian( int n, int guardian )
|
||||
{
|
||||
char *ship_name;
|
||||
object *objp;
|
||||
int num;
|
||||
|
||||
for ( ; n != -1; n = CDR(n) ) {
|
||||
@@ -9737,11 +9739,7 @@ void sexp_ships_guardian( int n, int guardian )
|
||||
// in a list until created
|
||||
num = ship_name_lookup(ship_name);
|
||||
if ( num != -1 ) {
|
||||
objp = &Objects[Ships[num].objnum];
|
||||
if ( guardian )
|
||||
objp->flags |= OF_GUARDIAN;
|
||||
else
|
||||
objp->flags &= ~OF_GUARDIAN;
|
||||
Ships[num].ship_guardian_threshold = guardian ? SHIP_GUARDIAN_THRESHOLD_DEFAULT : 0;
|
||||
} else {
|
||||
p_object *parse_obj;
|
||||
|
||||
@@ -11306,7 +11304,7 @@ void sexp_damage_escort_list(int node)
|
||||
shipp=&Ships[shipnum];
|
||||
|
||||
//calc hull integrity and compare
|
||||
current_hull_pct=Objects[shipp->objnum].hull_strength/shipp->ship_initial_hull_strength;
|
||||
current_hull_pct = get_hull_pct(&Objects[Ships[shipnum].objnum]);
|
||||
|
||||
if (current_hull_pct < smallest_hull_pct)
|
||||
{
|
||||
@@ -11473,7 +11471,7 @@ void sexp_damage_escort_list_all(int n)
|
||||
escort_ship[num_escort_ships].index = i;
|
||||
|
||||
// calc and set hull integrity
|
||||
escort_ship[num_escort_ships].hull = Objects[shipp->objnum].hull_strength / shipp->ship_initial_hull_strength;
|
||||
escort_ship[num_escort_ships].hull = get_hull_pct(&Objects[shipp->objnum]);
|
||||
|
||||
num_escort_ships++;
|
||||
}
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Playerman/PlayerControl.cpp $
|
||||
* $Revision: 2.25 $
|
||||
* $Date: 2005-03-25 06:57:37 $
|
||||
* $Author: wmcoolmon $
|
||||
* $Revision: 2.26 $
|
||||
* $Date: 2005-03-27 12:28:34 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Routines to deal with player ship movement
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.25 2005/03/25 06:57:37 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
* Revision 2.24 2005/03/10 08:00:13 taylor
|
||||
* change min/max to MIN/MAX to fix GCC problems
|
||||
* add lab stuff to Makefile
|
||||
@@ -1723,7 +1726,7 @@ int player_process_pending_praise()
|
||||
ship_index = ship_get_random_player_wing_ship( SHIP_GET_NO_PLAYERS, 1000.0f );
|
||||
if ( ship_index >= 0 ) {
|
||||
// Only praise if above 50% integrity
|
||||
if ( Objects[Ships[ship_index].objnum].hull_strength/Ships[ship_index].ship_initial_hull_strength > 0.5f ) {
|
||||
if ( get_hull_pct(&Objects[Ships[ship_index].objnum]) > 0.5f ) {
|
||||
message_send_builtin_to_player(MESSAGE_PRAISE, &Ships[ship_index], MESSAGE_PRIORITY_HIGH, MESSAGE_TIME_SOON, 0, 0, -1, -1);
|
||||
Player->allow_praise_timestamp = timestamp(PLAYER_ALLOW_PRAISE_INTERVAL*(Game_skill_level+1) );
|
||||
Player->allow_scream_timestamp = timestamp(20000); // prevent death scream following praise
|
||||
|
||||
+13
-4
@@ -9,13 +9,22 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Ship/Shield.cpp $
|
||||
* $Revision: 2.26 $
|
||||
* $Date: 2005-03-10 08:00:15 $
|
||||
* $Author: taylor $
|
||||
* $Revision: 2.27 $
|
||||
* $Date: 2005-03-27 12:28:35 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Stuff pertaining to shield graphical effects, etc.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.26 2005/03/10 08:00:15 taylor
|
||||
* change min/max to MIN/MAX to fix GCC problems
|
||||
* add lab stuff to Makefile
|
||||
* build unbreakage for everything that's not MSVC++ 6
|
||||
* lots of warning fixes
|
||||
* fix OpenGL rendering problem with ship insignias
|
||||
* no Warnings() in non-debug mode for Linux (like Windows)
|
||||
* some campaign savefile fixage to stop reverting everyones data
|
||||
*
|
||||
* Revision 2.25 2005/03/02 21:24:47 taylor
|
||||
* more NO_NETWORK/INF_BUILD goodness for Windows, takes care of a few warnings too
|
||||
*
|
||||
@@ -1299,7 +1308,7 @@ int ship_is_shield_up( object *obj, int quadrant )
|
||||
// Check all quadrants
|
||||
float strength = get_shield_strength(obj);
|
||||
|
||||
if ( strength > MAX(2.0f*4.0f, 0.1f * Ships[obj->instance].ship_initial_shield_strength )) {
|
||||
if ( strength > MAX(2.0f*4.0f, 0.1f * Ships[obj->instance].ship_max_shield_strength )) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
+61
-53
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Ship/Ship.cpp $
|
||||
* $Revision: 2.174 $
|
||||
* $Date: 2005-03-25 06:57:37 $
|
||||
* $Author: wmcoolmon $
|
||||
* $Revision: 2.175 $
|
||||
* $Date: 2005-03-27 12:28:35 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Ship (and other object) handling functions
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.174 2005/03/25 06:57:37 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
* Revision 2.173 2005/03/24 23:27:26 taylor
|
||||
* make sounds.tbl dynamic
|
||||
* have snd_time_remaining() be less stupid
|
||||
@@ -2468,9 +2471,9 @@ strcpy(parse_error_text, temp_error);
|
||||
}
|
||||
|
||||
if(optional_string("$Shields:"))
|
||||
stuff_float(&sip->initial_shield_strength);
|
||||
stuff_float(&sip->max_shield_strength);
|
||||
else
|
||||
sip->initial_shield_strength = 0.0f;
|
||||
sip->max_shield_strength = 0.0f;
|
||||
|
||||
// optional shield color
|
||||
sip->shield_color[0] = 255;
|
||||
@@ -2493,11 +2496,11 @@ strcpy(parse_error_text, temp_error);
|
||||
stuff_float(&sip->max_weapon_reserve);
|
||||
|
||||
required_string("$Hitpoints:");
|
||||
stuff_float(&sip->initial_hull_strength);
|
||||
if (sip->initial_hull_strength == 0.0f)
|
||||
stuff_float(&sip->max_hull_strength);
|
||||
if (sip->max_hull_strength == 0.0f)
|
||||
{
|
||||
Warning(LOCATION, "Initial hull strength on ship %s cannot be 0. Defaulting to 100.\n", sip->name);
|
||||
sip->initial_hull_strength = 100.0f;
|
||||
Warning(LOCATION, "Max hull strength on ship %s cannot be 0. Defaulting to 100.\n", sip->name);
|
||||
sip->max_hull_strength = 100.0f;
|
||||
}
|
||||
|
||||
if(optional_string("+Hull Repair Rate:"))
|
||||
@@ -2918,7 +2921,7 @@ strcpy(parse_error_text, temp_error);
|
||||
|
||||
stuff_float(&turning_rate);
|
||||
hull_percentage_of_hits -= percentage_of_hits;
|
||||
sp->max_subsys_strength = sip->initial_hull_strength * (percentage_of_hits / 100.0f);
|
||||
sp->max_subsys_strength = sip->max_hull_strength * (percentage_of_hits / 100.0f);
|
||||
sp->type = SUBSYSTEM_UNKNOWN;
|
||||
// specified as how long to turn 360 degrees in ships.tbl
|
||||
if ( turning_rate > 0.0f ){
|
||||
@@ -3777,11 +3780,11 @@ void ship_set(int ship_index, int objnum, int ship_type)
|
||||
shipp->last_targeted_subobject[i] = NULL;
|
||||
|
||||
if (Fred_running){
|
||||
shipp->ship_initial_hull_strength = 100.0f;
|
||||
shipp->ship_max_hull_strength = 100.0f;
|
||||
} else {
|
||||
shipp->ship_initial_hull_strength = sip->initial_hull_strength;
|
||||
shipp->ship_max_hull_strength = sip->max_hull_strength;
|
||||
}
|
||||
objp->hull_strength = shipp->ship_initial_hull_strength;
|
||||
objp->hull_strength = shipp->ship_max_hull_strength;
|
||||
|
||||
shipp->afterburner_fuel = sip->afterburner_fuel_capacity;
|
||||
|
||||
@@ -3887,13 +3890,13 @@ void ship_set(int ship_index, int objnum, int ship_type)
|
||||
|
||||
physics_ship_init(objp);
|
||||
if (Fred_running) {
|
||||
shipp->ship_initial_shield_strength = 100.0f;
|
||||
shipp->ship_initial_hull_strength = 100.0f;
|
||||
shipp->ship_max_shield_strength = 100.0f;
|
||||
shipp->ship_max_hull_strength = 100.0f;
|
||||
objp->shield_quadrant[0] = 100.0f;
|
||||
} else {
|
||||
shipp->ship_initial_shield_strength = sip->initial_shield_strength;
|
||||
shipp->ship_initial_hull_strength = sip->initial_hull_strength;
|
||||
set_shield_strength(objp, shipp->ship_initial_shield_strength);
|
||||
shipp->ship_max_shield_strength = sip->max_shield_strength;
|
||||
shipp->ship_max_hull_strength = sip->max_hull_strength;
|
||||
set_shield_strength(objp, shipp->ship_max_shield_strength);
|
||||
}
|
||||
|
||||
shipp->target_shields_delta = 0.0f;
|
||||
@@ -3903,6 +3906,9 @@ void ship_set(int ship_index, int objnum, int ship_type)
|
||||
shipp->weapons.ai_class = Ai_info[shipp->ai_index].ai_class;
|
||||
shipp->shield_integrity = NULL;
|
||||
// shipp->sw.blast_duration = -1; // init shockwave struct
|
||||
|
||||
shipp->ship_guardian_threshold = 0.0f;
|
||||
|
||||
subsys_set(objnum);
|
||||
shipp->orders_accepted = ship_get_default_orders_accepted( sip );
|
||||
shipp->num_swarm_missiles_to_fire = 0;
|
||||
@@ -4152,10 +4158,12 @@ void subsys_set(int objnum, int ignore_subsys_info)
|
||||
|
||||
ship_system->system_info = sp; // set the system_info pointer to point to the data read in from the model
|
||||
|
||||
ship_system->subsys_guardian_threshold = 0.0f;
|
||||
|
||||
// Goober5000 - this has to be moved outside back to parse_create_object, because
|
||||
// a lot of the ship creation code is duplicated in several points and overwrites
|
||||
// previous things... ugh.
|
||||
ship_system->max_hits = sp->max_subsys_strength; // * shipp->ship_initial_hull_strength / sinfo->initial_hull_strength;
|
||||
ship_system->max_hits = sp->max_subsys_strength; // * shipp->ship_max_hull_strength / sinfo->max_hull_strength;
|
||||
|
||||
if ( !Fred_running ){
|
||||
ship_system->current_hits = ship_system->max_hits; // set the current hits
|
||||
@@ -5250,7 +5258,7 @@ void do_dying_undock_physics(object *dying_objp, ship *dying_shipp)
|
||||
vector impulse_norm, impulse_vec, pos;
|
||||
|
||||
// damage applied to each docked object
|
||||
damage = 0.2f * dying_shipp->ship_initial_hull_strength;
|
||||
damage = 0.2f * dying_shipp->ship_max_hull_strength;
|
||||
|
||||
// mass of the whole assembly
|
||||
total_docked_mass = dock_calc_total_docked_mass(dying_objp);
|
||||
@@ -5607,7 +5615,7 @@ void ship_chase_shield_energy_targets(ship *shipp, object *obj, float frametime)
|
||||
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
delta = frametime * ETS_RECHARGE_RATE * shipp->ship_initial_shield_strength / 100.0f;
|
||||
delta = frametime * ETS_RECHARGE_RATE * shipp->ship_max_shield_strength / 100.0f;
|
||||
|
||||
// Chase target_shields and target_weapon_energy
|
||||
if (shipp->target_shields_delta > 0.0f) {
|
||||
@@ -5914,13 +5922,13 @@ void ship_auto_repair_frame(int shipnum, float frametime)
|
||||
objp = &Objects[sp->objnum];
|
||||
|
||||
//Repair the hull...or maybe unrepair?
|
||||
if(sip->hull_repair_rate_percent != 0.0f && objp->hull_strength < sp->ship_initial_hull_strength)
|
||||
if(sip->hull_repair_rate_percent != 0.0f && objp->hull_strength < sp->ship_max_hull_strength)
|
||||
{
|
||||
objp->hull_strength += sp->ship_initial_hull_strength * sip->hull_repair_rate_percent * frametime;
|
||||
objp->hull_strength += sp->ship_max_hull_strength * sip->hull_repair_rate_percent * frametime;
|
||||
|
||||
if(objp->hull_strength > sp->ship_initial_hull_strength)
|
||||
if(objp->hull_strength > sp->ship_max_hull_strength)
|
||||
{
|
||||
objp->hull_strength = sp->ship_initial_hull_strength;
|
||||
objp->hull_strength = sp->ship_max_hull_strength;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7218,43 +7226,43 @@ void change_ship_type(int n, int ship_type, int by_sexp)
|
||||
|
||||
// set the correct hull strength
|
||||
if (Fred_running) {
|
||||
sp->ship_initial_hull_strength = 100.0f;
|
||||
sp->ship_max_hull_strength = 100.0f;
|
||||
objp->hull_strength = 100.0f;
|
||||
} else {
|
||||
if (sp->special_hitpoint_index != -1) {
|
||||
sp->ship_initial_hull_strength = (float) atoi(Sexp_variables[sp->special_hitpoint_index+HULL_STRENGTH].text);
|
||||
sp->ship_max_hull_strength = (float) atoi(Sexp_variables[sp->special_hitpoint_index+HULL_STRENGTH].text);
|
||||
} else {
|
||||
sp->ship_initial_hull_strength = sip->initial_hull_strength;
|
||||
sp->ship_max_hull_strength = sip->max_hull_strength;
|
||||
}
|
||||
|
||||
// Goober5000: don't set hull strength if called by sexp
|
||||
if (!by_sexp)
|
||||
{
|
||||
objp->hull_strength = sp->ship_initial_hull_strength;
|
||||
objp->hull_strength = sp->ship_max_hull_strength;
|
||||
}
|
||||
}
|
||||
|
||||
// set the correct shields strength
|
||||
if (Fred_running) {
|
||||
if (sp->ship_initial_shield_strength)
|
||||
sp->ship_initial_shield_strength = 100.0f;
|
||||
if (sp->ship_max_shield_strength)
|
||||
sp->ship_max_shield_strength = 100.0f;
|
||||
objp->shield_quadrant[0] = 100.0f;
|
||||
} else {
|
||||
if (sp->special_hitpoint_index != -1) {
|
||||
sp->ship_initial_shield_strength = (float) atoi(Sexp_variables[sp->special_hitpoint_index+SHIELD_STRENGTH].text);
|
||||
sp->ship_max_shield_strength = (float) atoi(Sexp_variables[sp->special_hitpoint_index+SHIELD_STRENGTH].text);
|
||||
} else {
|
||||
sp->ship_initial_shield_strength = sip->initial_shield_strength;
|
||||
sp->ship_max_shield_strength = sip->max_shield_strength;
|
||||
}
|
||||
|
||||
// Goober5000: don't set shield strength if called by sexp
|
||||
if (!by_sexp)
|
||||
{
|
||||
set_shield_strength(objp, sp->ship_initial_shield_strength);
|
||||
set_shield_strength(objp, sp->ship_max_shield_strength);
|
||||
}
|
||||
}
|
||||
|
||||
// Goober5000: div-0 checks
|
||||
Assert(sp->ship_initial_hull_strength > 0.0f);
|
||||
Assert(sp->ship_max_hull_strength > 0.0f);
|
||||
Assert(objp->hull_strength > 0.0f);
|
||||
|
||||
// subsys stuff done only after hull stuff is set
|
||||
@@ -9980,13 +9988,13 @@ int ship_do_rearm_frame( object *objp, float frametime )
|
||||
if ( !(objp->flags & OF_NO_SHIELDS) )
|
||||
{
|
||||
shield_str = get_shield_strength(objp);
|
||||
if ( shield_str < shipp->ship_initial_shield_strength ) {
|
||||
if ( shield_str < shipp->ship_max_shield_strength ) {
|
||||
if ( objp == Player_obj ) {
|
||||
player_maybe_start_repair_sound();
|
||||
}
|
||||
shield_str += shipp->ship_initial_shield_strength * frametime * SHIELD_REPAIR_RATE;
|
||||
if ( shield_str > shipp->ship_initial_shield_strength ) {
|
||||
shield_str = shipp->ship_initial_shield_strength;
|
||||
shield_str += shipp->ship_max_shield_strength * frametime * SHIELD_REPAIR_RATE;
|
||||
if ( shield_str > shipp->ship_max_shield_strength ) {
|
||||
shield_str = shipp->ship_max_shield_strength;
|
||||
}
|
||||
set_shield_strength(objp, shield_str);
|
||||
}
|
||||
@@ -9995,14 +10003,14 @@ int ship_do_rearm_frame( object *objp, float frametime )
|
||||
// Repair the ship integrity (subsystems + hull). This works by applying the repair points
|
||||
// to the subsystems. Ships integrity is stored is objp->hull_strength, so that always is
|
||||
// incremented by repair_allocated
|
||||
repair_allocated = shipp->ship_initial_hull_strength * frametime * HULL_REPAIR_RATE;
|
||||
repair_allocated = shipp->ship_max_hull_strength * frametime * HULL_REPAIR_RATE;
|
||||
|
||||
|
||||
// AL 11-24-97: remove increase to hull integrity
|
||||
// Comments removed by PhReAk; Note that this is toggled on/off with a mission flag
|
||||
|
||||
//Figure out how much of the ship's hull we can repair
|
||||
max_hull_repair = shipp->ship_initial_hull_strength * (The_mission.support_ships.max_hull_repair_val * 0.01f);
|
||||
max_hull_repair = shipp->ship_max_hull_strength * (The_mission.support_ships.max_hull_repair_val * 0.01f);
|
||||
|
||||
if(The_mission.flags & MISSION_FLAG_SUPPORT_REPAIRS_HULL)
|
||||
{
|
||||
@@ -10011,10 +10019,10 @@ int ship_do_rearm_frame( object *objp, float frametime )
|
||||
objp->hull_strength = max_hull_repair;
|
||||
}
|
||||
|
||||
if ( objp->hull_strength > shipp->ship_initial_hull_strength )
|
||||
if ( objp->hull_strength > shipp->ship_max_hull_strength )
|
||||
{
|
||||
objp->hull_strength = shipp->ship_initial_hull_strength;
|
||||
repair_allocated -= ( shipp->ship_initial_hull_strength - objp->hull_strength);
|
||||
objp->hull_strength = shipp->ship_max_hull_strength;
|
||||
repair_allocated -= ( shipp->ship_max_hull_strength - objp->hull_strength);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10198,12 +10206,12 @@ int ship_do_rearm_frame( object *objp, float frametime )
|
||||
if ( (objp->flags & OF_NO_SHIELDS) ) {
|
||||
shields_full = 1;
|
||||
} else {
|
||||
if ( get_shield_strength(objp) >= shipp->ship_initial_shield_strength )
|
||||
if ( get_shield_strength(objp) >= shipp->ship_max_shield_strength )
|
||||
shields_full = 1;
|
||||
}
|
||||
|
||||
// return 1 if at end of subsystem list, hull damage at 0, and shields full and all secondary banks full.
|
||||
// if ( ((ssp = END_OF_LIST(&shipp->subsys_list)) != NULL )&&(objp->hull_strength == shipp->ship_initial_hull_strength)&&(shields_full) ) {
|
||||
// if ( ((ssp = END_OF_LIST(&shipp->subsys_list)) != NULL )&&(objp->hull_strength == shipp->ship_max_hull_strength)&&(shields_full) ) {
|
||||
if ( (subsys_all_ok && shields_full && (The_mission.flags & MISSION_FLAG_SUPPORT_REPAIRS_HULL) && (objp->hull_strength >= max_hull_repair) ) || (subsys_all_ok && shields_full && !(The_mission.flags & MISSION_FLAG_SUPPORT_REPAIRS_HULL) ) )
|
||||
{
|
||||
if ( objp == Player_obj ) {
|
||||
@@ -10526,7 +10534,7 @@ DCF(set_shield,"Change player ship shield strength")
|
||||
Dc_arg_float = 0.0f;
|
||||
if ( Dc_arg_float > 1.0 )
|
||||
Dc_arg_float = 1.0f;
|
||||
set_shield_strength(Player_obj, Dc_arg_float * Player_ship->ship_initial_shield_strength);
|
||||
set_shield_strength(Player_obj, Dc_arg_float * Player_ship->ship_max_shield_strength);
|
||||
dc_printf("Shields set to %.2f\n", get_shield_strength(Player_obj) );
|
||||
}
|
||||
}
|
||||
@@ -10561,7 +10569,7 @@ DCF(set_hull, "Change player ship hull strength")
|
||||
Dc_arg_float = 0.0f;
|
||||
if ( Dc_arg_float > 1.0 )
|
||||
Dc_arg_float = 1.0f;
|
||||
Player_obj->hull_strength = Dc_arg_float * Player_ship->ship_initial_hull_strength;
|
||||
Player_obj->hull_strength = Dc_arg_float * Player_ship->ship_max_hull_strength;
|
||||
dc_printf("Hull set to %.2f\n", Player_obj->hull_strength );
|
||||
}
|
||||
}
|
||||
@@ -11918,13 +11926,13 @@ void awacs_maybe_ask_for_help(ship *sp, int multi_team_filter)
|
||||
int message = -1;
|
||||
objp = &Objects[sp->objnum];
|
||||
|
||||
if ( objp->hull_strength < ( (AWACS_HELP_HULL_LOW + 0.01f *(static_rand(objp-Objects) & 5)) * sp->ship_initial_hull_strength) ) {
|
||||
if ( objp->hull_strength < ( (AWACS_HELP_HULL_LOW + 0.01f *(static_rand(objp-Objects) & 5)) * sp->ship_max_hull_strength) ) {
|
||||
// awacs ship below 25 + (0-4) %
|
||||
if (!(sp->awacs_warning_flag & AWACS_WARN_25)) {
|
||||
message = MESSAGE_AWACS_25;
|
||||
sp->awacs_warning_flag |= AWACS_WARN_25;
|
||||
}
|
||||
} else if ( objp->hull_strength < ( (AWACS_HELP_HULL_HI + 0.01f*(static_rand(objp-Objects) & 5)) * sp->ship_initial_hull_strength) ) {
|
||||
} else if ( objp->hull_strength < ( (AWACS_HELP_HULL_HI + 0.01f*(static_rand(objp-Objects) & 5)) * sp->ship_max_hull_strength) ) {
|
||||
// awacs ship below 75 + (0-4) %
|
||||
if (!(sp->awacs_warning_flag & AWACS_WARN_75)) {
|
||||
message = MESSAGE_AWACS_75;
|
||||
@@ -11989,7 +11997,7 @@ void ship_maybe_ask_for_help(ship *sp)
|
||||
}
|
||||
|
||||
// first check if hull is at a critical level
|
||||
if ( objp->hull_strength < ASK_HELP_HULL_PERCENT * sp->ship_initial_hull_strength ) {
|
||||
if ( objp->hull_strength < ASK_HELP_HULL_PERCENT * sp->ship_max_hull_strength ) {
|
||||
goto play_ask_help;
|
||||
}
|
||||
|
||||
@@ -11998,7 +12006,7 @@ void ship_maybe_ask_for_help(ship *sp)
|
||||
return; // no shields on ship, no don't check shield levels
|
||||
}
|
||||
|
||||
if ( get_shield_strength(objp) > (ASK_HELP_SHIELD_PERCENT * sp->ship_initial_shield_strength) ) {
|
||||
if ( get_shield_strength(objp) > (ASK_HELP_SHIELD_PERCENT * sp->ship_max_shield_strength) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -12113,7 +12121,7 @@ void ship_maybe_tell_about_rearm(ship *sp)
|
||||
|
||||
int message_type = -1;
|
||||
int heavily_damaged = 0;
|
||||
if ( Objects[sp->objnum].hull_strength/sp->ship_initial_hull_strength < 0.4 ) {
|
||||
if ( get_hull_pct(sp->objnum) < 0.4 ) {
|
||||
heavily_damaged = 1;
|
||||
}
|
||||
|
||||
|
||||
+19
-7
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Ship/Ship.h $
|
||||
* $Revision: 2.84 $
|
||||
* $Date: 2005-03-25 06:57:38 $
|
||||
* $Author: wmcoolmon $
|
||||
* $Revision: 2.85 $
|
||||
* $Date: 2005-03-27 12:28:35 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* all sorts of cool stuff about ships
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.84 2005/03/25 06:57:38 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
* Revision 2.83 2005/03/19 18:02:34 bobboau
|
||||
* added new graphic functions for state blocks
|
||||
* also added a class formanageing a new effect
|
||||
@@ -613,6 +616,8 @@ extern vector Dead_camera_pos, Original_vec_to_deader;
|
||||
#define PDS_DIED 2
|
||||
#define PDS_EJECTED 3
|
||||
|
||||
#define SHIP_GUARDIAN_THRESHOLD_DEFAULT 1 // Goober5000
|
||||
|
||||
#define HULL_DAMAGE_THRESHOLD_PERCENT 0.25f // Apply damage to hull, not shield if shield < this
|
||||
|
||||
// the #defines below are to avoid round-off errors
|
||||
@@ -719,6 +724,8 @@ typedef struct ship_subsys {
|
||||
float current_hits; // current number of hits this subsystem has left.
|
||||
float max_hits;
|
||||
|
||||
int subsys_guardian_threshold; // Goober5000
|
||||
|
||||
// turret info
|
||||
//Important -WMC
|
||||
//With the new turret code, indexes run from 0 to MAX_SHIP_WEAPONS; a value of MAX_SHIP_PRIMARY_WEAPONS
|
||||
@@ -939,8 +946,11 @@ typedef struct ship {
|
||||
int special_exp_index;
|
||||
int special_hitpoint_index;
|
||||
|
||||
float ship_initial_shield_strength;
|
||||
float ship_initial_hull_strength;
|
||||
float ship_max_shield_strength;
|
||||
float ship_max_hull_strength;
|
||||
|
||||
int ship_guardian_threshold; // Goober5000 - now also determines whether ship is guardian'd
|
||||
|
||||
|
||||
char ship_name[NAME_LENGTH];
|
||||
|
||||
@@ -1314,7 +1324,6 @@ typedef struct ship_info {
|
||||
uint flags; // See SIF_xxxx - changed to uint by Goober5000
|
||||
uint flags2; // See SIF2_xxxx - added by Goober5000
|
||||
int ai_class; // Index into Ai_classes[]. Defined in ai.tbl
|
||||
float initial_shield_strength;
|
||||
float max_speed, min_speed, max_accel;
|
||||
|
||||
// ship explosion info
|
||||
@@ -1354,9 +1363,12 @@ typedef struct ship_info {
|
||||
int secondary_bank_weapons[MAX_SHIP_SECONDARY_BANKS]; // Weapon_info[] index for the weapon in the bank
|
||||
int secondary_bank_ammo_capacity[MAX_SHIP_SECONDARY_BANKS]; // Capacity of bank (not number of missiles)
|
||||
|
||||
float initial_hull_strength; // Initial hull strength of this class of ship.
|
||||
float max_hull_strength; // Max hull strength of this class of ship.
|
||||
float max_shield_strength;
|
||||
|
||||
float hull_repair_rate_percent; //How much of the hull is repaired every second
|
||||
float subsys_repair_rate_percent; //How fast
|
||||
|
||||
int engine_snd; // handle to engine sound for ship (-1 if no engine sound)
|
||||
|
||||
vector closeup_pos; // position for camera when using ship in closeup view (eg briefing and hud target monitor)
|
||||
|
||||
+14
-8
@@ -9,13 +9,19 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Ship/ShipFX.cpp $
|
||||
* $Revision: 2.39 $
|
||||
* $Date: 2005-03-24 23:27:26 $
|
||||
* $Author: taylor $
|
||||
* $Revision: 2.40 $
|
||||
* $Date: 2005-03-27 12:28:35 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Routines for ship effects (as in special)
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.39 2005/03/24 23:27:26 taylor
|
||||
* make sounds.tbl dynamic
|
||||
* have snd_time_remaining() be less stupid
|
||||
* some OpenAL error fixerage
|
||||
* be able to turn off some typically useless debug messages
|
||||
*
|
||||
* Revision 2.38 2005/03/15 01:40:07 phreak
|
||||
* Awesome 2-for-1 deal!!!
|
||||
* Firstly, the Colossus should now warp out correctly. No more warphole forming inside of it
|
||||
@@ -1223,7 +1229,7 @@ void shipfx_warpout_start( object *objp )
|
||||
|
||||
// if we're HUGE, keep alive - set guardian
|
||||
if (Ship_info[shipp->ship_info_index].flags & SIF_HUGE_SHIP) {
|
||||
objp->flags |= OF_GUARDIAN;
|
||||
shipp->ship_guardian_threshold = SHIP_GUARDIAN_THRESHOLD_DEFAULT;
|
||||
}
|
||||
|
||||
// post a warpin event
|
||||
@@ -1835,7 +1841,7 @@ void shipfx_emit_spark( int n, int sn )
|
||||
obj = &Objects[shipp->objnum];
|
||||
ship_info* si = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
float hull_percent = obj->hull_strength / shipp->ship_initial_hull_strength;
|
||||
float hull_percent = get_hull_pct(obj);
|
||||
if (hull_percent < 0.001) {
|
||||
hull_percent = 0.001f;
|
||||
}
|
||||
@@ -2569,7 +2575,7 @@ void shipfx_do_damaged_arcs_frame( ship *shipp )
|
||||
should_arc = 1;
|
||||
int disrupted_arc=0;
|
||||
|
||||
float damage = obj->hull_strength / shipp->ship_initial_hull_strength;
|
||||
float damage = get_hull_pct(obj);
|
||||
|
||||
if (damage < 0) {
|
||||
damage = 0.0f;
|
||||
@@ -3166,7 +3172,7 @@ void engine_wash_ship_process(ship *shipp)
|
||||
if (!do_damage) {
|
||||
damage = 0;
|
||||
} else {
|
||||
damage = (0.001f * 0.003f * ENGINE_WASH_CHECK_INTERVAL * shipp->ship_initial_hull_strength * shipp->wash_intensity);
|
||||
damage = (0.001f * 0.003f * ENGINE_WASH_CHECK_INTERVAL * shipp->ship_max_hull_strength * shipp->wash_intensity);
|
||||
}
|
||||
|
||||
ship_apply_wash_damage(&Objects[shipp->objnum], max_ship_intensity_objp, damage);
|
||||
@@ -3302,7 +3308,7 @@ void shipfx_cloak_frame(ship *shipp, float frametime)
|
||||
//find an approiate alpha level for the ship
|
||||
object *obj=&Objects[shipp->objnum];
|
||||
//stop cloaking if <20% hits left. make it look cool tho
|
||||
if ((obj->hull_strength / shipp->ship_initial_hull_strength) < .2f)
|
||||
if (get_hull_pct(obj) < .2f)
|
||||
{
|
||||
shipfx_stop_cloak(shipp,25000);
|
||||
break; //dont need to calc alpha
|
||||
|
||||
+32
-8
@@ -9,13 +9,22 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Ship/ShipHit.cpp $
|
||||
* $Revision: 2.37 $
|
||||
* $Date: 2005-03-10 08:00:16 $
|
||||
* $Author: taylor $
|
||||
* $Revision: 2.38 $
|
||||
* $Date: 2005-03-27 12:28:35 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Code to deal with a ship getting hit by something, be it a missile, dog, or ship.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.37 2005/03/10 08:00:16 taylor
|
||||
* change min/max to MIN/MAX to fix GCC problems
|
||||
* add lab stuff to Makefile
|
||||
* build unbreakage for everything that's not MSVC++ 6
|
||||
* lots of warning fixes
|
||||
* fix OpenGL rendering problem with ship insignias
|
||||
* no Warnings() in non-debug mode for Linux (like Windows)
|
||||
* some campaign savefile fixage to stop reverting everyones data
|
||||
*
|
||||
* Revision 2.36 2005/03/02 21:24:47 taylor
|
||||
* more NO_NETWORK/INF_BUILD goodness for Windows, takes care of a few warnings too
|
||||
*
|
||||
@@ -988,6 +997,7 @@ float do_subobj_hit_stuff(object *ship_obj, object *other_obj, vector *hitpos, f
|
||||
float hitpos_dist = vm_vec_dist( hitpos, &ship_obj->pos );
|
||||
if ( hitpos_dist > ship_obj->radius * 2.0f ) {
|
||||
mprintf(( "BOGUS HITPOS PASSED TO DO_SUBOBJ_HIT_STUFF (%.1f > %.1f)!\n", hitpos_dist, ship_obj->radius * 2.0f ));
|
||||
Assert(false);
|
||||
// Int3(); // Get John ASAP!!!! Someone passed a local coordinate instead of world for hitpos probably.
|
||||
}
|
||||
#endif
|
||||
@@ -1097,8 +1107,22 @@ float do_subobj_hit_stuff(object *ship_obj, object *other_obj, vector *hitpos, f
|
||||
damage_to_apply *= Skill_level_subsys_damage_scale[Game_skill_level];
|
||||
}
|
||||
|
||||
// Goober5000 - subsys guardian
|
||||
if (subsys->subsys_guardian_threshold > 0)
|
||||
{
|
||||
float min_subsys_strength = 0.01f * subsys->subsys_guardian_threshold * subsys->max_hits;
|
||||
if ( (subsys->current_hits - damage_to_apply) < min_subsys_strength ) {
|
||||
// find damage needed to take object to min subsys strength
|
||||
damage_to_apply = subsys->current_hits - min_subsys_strength;
|
||||
|
||||
// make sure damage is positive
|
||||
damage_to_apply = MAX(0, damage_to_apply);
|
||||
}
|
||||
}
|
||||
|
||||
subsys->current_hits -= damage_to_apply;
|
||||
ship_p->subsys_info[subsys->system_info->type].current_hits -= damage_to_apply;
|
||||
|
||||
damage_left -= damage_to_apply; // decrease the damage left to apply to the ship subsystems
|
||||
|
||||
if (subsys->current_hits < 0.0f) {
|
||||
@@ -1423,7 +1447,7 @@ int get_max_sparks(object* ship_obj)
|
||||
ship *ship_p = &Ships[ship_obj->instance];
|
||||
ship_info* si = &Ship_info[ship_p->ship_info_index];
|
||||
if (si->flags & SIF_FIGHTER) {
|
||||
float hull_percent = ship_obj->hull_strength / ship_p->ship_initial_hull_strength;
|
||||
float hull_percent = ship_obj->hull_strength / ship_p->ship_max_hull_strength;
|
||||
|
||||
if (hull_percent > 0.8f) {
|
||||
return 1;
|
||||
@@ -2164,7 +2188,7 @@ void shiphit_hit_after_death(object *ship_obj, float damage)
|
||||
if (ship_obj->radius > BIG_SHIP_MIN_RADIUS)
|
||||
return;
|
||||
|
||||
percent_killed = damage/shipp->ship_initial_hull_strength;
|
||||
percent_killed = damage/shipp->ship_max_hull_strength;
|
||||
if (percent_killed > 1.0f)
|
||||
percent_killed = 1.0f;
|
||||
|
||||
@@ -2455,8 +2479,8 @@ static void ship_do_damage(object *ship_obj, object *other_obj, vector *hitpos,
|
||||
}
|
||||
|
||||
// if ship is flagged as can not die, don't let it die
|
||||
if (ship_obj->flags & OF_GUARDIAN) {
|
||||
float min_hull_strength = 0.01f * Ships[ship_obj->instance].ship_initial_hull_strength;
|
||||
if (shipp->ship_guardian_threshold > 0) {
|
||||
float min_hull_strength = 0.01f * shipp->ship_guardian_threshold * shipp->ship_max_hull_strength;
|
||||
if ( (ship_obj->hull_strength - damage) < min_hull_strength ) {
|
||||
// find damage needed to take object to min hull strength
|
||||
damage = ship_obj->hull_strength - min_hull_strength;
|
||||
@@ -2562,7 +2586,7 @@ static void ship_do_damage(object *ship_obj, object *other_obj, vector *hitpos,
|
||||
shipp->wash_killed = 1;
|
||||
}
|
||||
|
||||
float percent_killed = -ship_obj->hull_strength/shipp->ship_initial_hull_strength;
|
||||
float percent_killed = -get_hull_pct(ship_obj);
|
||||
if (percent_killed > 1.0f){
|
||||
percent_killed = 1.0f;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
* <insert description of file here>
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.101 2005/03/25 06:57:38 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
* Revision 2.100 2005/03/24 23:24:01 taylor
|
||||
* use SWARM_MISSILE_DELAY again so that it's easier to keep up with
|
||||
* fix compiler warnings
|
||||
@@ -5161,7 +5164,7 @@ float weapon_get_damage_scale(weapon_info *wip, object *wep, object *target)
|
||||
sip = &Ship_info[Ships[target->instance].ship_info_index];
|
||||
|
||||
// get hull pct of the ship currently
|
||||
hull_pct = target->hull_strength / shipp->ship_initial_hull_strength;
|
||||
hull_pct = get_hull_pct(target);
|
||||
|
||||
// if it has hit a supercap ship and is not a supercap class weapon
|
||||
if((sip->flags & SIF_SUPERCAP) && !(wip->wi_flags & WIF_SUPERCAP)){
|
||||
|
||||
Reference in new issue
Block a user