Codebase commit, most notably including objecttypes.tbl

This commit is contained in:
wmcoolmon committed 2005-12-29 08:08:42 +00:00
1 parent 56886a1234
commit 246cfcfa65
69 files changed
+2561 -1340

No files matched your search

+31 -20
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Ship/AiCode.cpp $
* $Revision: 1.48 $
* $Date: 2005-12-06 03:15:47 $
* $Author: taylor $
* $Revision: 1.49 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
* AI code that does interesting stuff
*
* $Log: not supported by cvs2svn $
* Revision 1.48 2005/12/06 03:15:47 taylor
* add a couple of Assert()'s that it doesn't otherwise check for
*
* Revision 1.47 2005/12/04 19:07:48 wmcoolmon
* Final commit of codebase
*
@@ -156,7 +159,7 @@
* Removed FS2_DEMO defines that looked like they wouldn't cause the universe to collapse
*
* Revision 1.8 2005/04/25 00:04:30 wmcoolmon
* MAX_SHIP_TYPES -> Num_ship_types
* MAX_SHIP_CLASSES -> Num_ship_classes
*
* Revision 1.7 2005/04/16 04:16:57 wmcoolmon
* More optional tag-making for ships.tbl
@@ -2107,7 +2110,7 @@ void init_ship_info()
if (Ship_info_inited)
return;
for (i=0; i<Num_ship_types; i++) {
for (i=0; i<Num_ship_classes; i++) {
Ship_info[i].min_speed = - Ship_info[i].max_rear_vel;
Ship_info[i].max_accel = Ship_info[i].max_vel.xyz.z;
}
@@ -5990,7 +5993,7 @@ int ai_select_primary_weapon_OLD(object *objp, object *other_objp, int flags)
ship_info *sip;
//Assert( other_objp != NULL );
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_types);
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes);
sip = &Ship_info[shipp->ship_info_index];
@@ -6087,7 +6090,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
return ai_select_primary_weapon_OLD(objp, other_objp, flags);
}
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_types);
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes);
// Debugging //
sip = &Ship_info[shipp->ship_info_index];
@@ -6386,7 +6389,7 @@ int ai_fire_primary_weapon(object *objp)
ai_info *aip;
object *enemy_objp;
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_types);
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes);
sip = &Ship_info[shipp->ship_info_index];
aip = &Ai_info[shipp->ai_index];
@@ -6783,7 +6786,7 @@ int ai_fire_secondary_weapon(object *objp, int priority1, int priority2)
shipp = &Ships[objp->instance];
swp = &shipp->weapons;
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_types);
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes);
sip = &Ship_info[shipp->ship_info_index];
// Select secondary weapon.
@@ -8598,11 +8601,13 @@ void ai_cruiser_chase()
ship *shipp = &Ships[Pl_objp->instance];
ai_info *aip = &Ai_info[shipp->ai_index];
//WMC - We don't need/want this anymore.
/*
if (!(sip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) {
Int3(); // Hmm, not a very big ship, how did we get in this function?
aip->mode = AIM_NONE;
return;
}
}*/
if (En_objp->type != OBJ_SHIP) {
Int3();
@@ -8620,11 +8625,16 @@ void ai_cruiser_chase()
eshipp = &Ships[En_objp->instance];
esip = &Ship_info[eshipp->ship_info_index];
//WMC - Again, I don't think we need/want this anymore.
//However. It could conceivably break backwards compatibility.
//In that case, bug me. I would like to stay away from 'big' and 'small'
//designations for types if possible.
/*
if (!(esip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) {
// Int3(); // Hmm, we're big and we're pursuing something other than a big ship?
aip->mode = AIM_NONE;
return;
}
}*/
vec3d goal_pos;
float turn_time = Ship_info[Ships[Pl_objp->instance].ship_info_index].srotation_time;
@@ -8789,17 +8799,18 @@ void ai_chase()
Int3();
}
if (sip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) {
if (sip->class_type > -1 && (Ship_types[sip->class_type].ai_bools & STI_AI_ATTEMPT_BROADSIDE)) {
ai_cruiser_chase();
return;
}
//WMC - go away.
/*
if (!(sip->flags & (SIF_FIGHTER | SIF_BOMBER | SIF_ESCAPEPOD))) {
Warning(LOCATION, "Ship %s is not 'small', but is in chase mode.\nSwitching to AI=none.\n", shipp->ship_name);
aip->mode = AIM_NONE;
return;
}
*/
//nprintf(("AI", "%7s ", Submode_text[aip->submode]));
Assert( En_objp != NULL );
@@ -10148,7 +10159,7 @@ void ai_guard_find_nearby_ship(object *guarding_objp, object *guarded_objp)
ship *eshipp = &Ships[enemy_objp->instance];
// Don't attack a cargo container or other harmless ships
if (!(Ship_info[eshipp->ship_info_index].flags & SIF_HARMLESS)) {
if (Ship_info[eshipp->ship_info_index].class_type > -1 && (Ship_types[Ship_info[eshipp->ship_info_index].class_type].ai_bools & STI_AI_GUARDS_ATTACK)) {
if (guarding_shipp->team != eshipp->team) {
dist = vm_vec_dist_quick(&enemy_objp->pos, &guarded_objp->pos);
if (dist < (MAX_GUARD_DIST + guarded_objp->radius)*3) {
@@ -14372,7 +14383,7 @@ void ai_frame(int objnum)
aip->active_goal = AI_GOAL_NONE;
} else if (aip->resume_goal_time == -1) {
// AL 12-9-97: Don't allow cargo and navbuoys to set their aip->target_objnum
if ( !(Ship_info[shipp->ship_info_index].flags & SIF_HARMLESS) ) {
if ( Ship_info[shipp->ship_info_index].class_type > -1 && (Ship_types[Ship_info[shipp->ship_info_index].class_type].ai_bools & STI_AI_AUTO_ATTACKS) ) {
target_objnum = find_enemy(objnum, MAX_ENEMY_DISTANCE, The_mission.ai_profile->max_attackers[Game_skill_level]); // Attack up to 25K units away.
if (target_objnum != -1) {
if (aip->target_objnum != target_objnum)
@@ -14418,7 +14429,7 @@ void ai_frame(int objnum)
}
*/
// AL 12-10-97: ensure that cargo and navbuoys aip->target_objnum is always -1.
if ( Ship_info[shipp->ship_info_index].flags & SIF_HARMLESS ) {
if ( Ship_info[shipp->ship_info_index].class_type > -1 && !(Ship_types[Ship_info[shipp->ship_info_index].class_type].ai_bools & STI_AI_AUTO_ATTACKS)) {
aip->target_objnum = -1;
}
@@ -14512,7 +14523,7 @@ int find_ship_name(char *name)
{
int i;
for (i=0; i<Num_ship_types; i++)
for (i=0; i<Num_ship_classes; i++)
if (!strcmp(Ship_info[i].name, name))
return i;
@@ -14962,8 +14973,8 @@ void maybe_process_friendly_hit(object *objp_hitter, object *objp_hit, object *o
}
// Don't penalize much at all for hitting cargo
if (sip->flags & (SIF_CARGO | SIF_SENTRYGUN)) {
damage /= 10.0f;
if (sip->class_type > -1) {
damage *= Ship_types[sip->class_type].ff_multiplier;
}
// Hit ship, but not targeting it, so it's not so heinous, maybe an accident.
+80 -81
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Ship/AiGoals.cpp $
* $Revision: 1.14 $
* $Date: 2005-10-29 22:09:28 $
* $Author: Goober5000 $
* $Revision: 1.15 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
* File to deal with manipulating AI goals, etc.
*
* $Log: not supported by cvs2svn $
* Revision 1.14 2005/10/29 22:09:28 Goober5000
* multiple ship docking implemented for initially docked ships
* --Goober5000
*
* Revision 1.13 2005/10/10 17:21:03 taylor
* remove NO_NETWORK
*
@@ -666,6 +670,35 @@ int Ai_goal_signature;
int Num_ai_dock_names = 0;
char Ai_dock_names[MAX_AI_DOCK_NAMES][NAME_LENGTH];
ai_goal_list Ai_goal_names[] = {
{"Attack ship", AI_GOAL_CHASE},
{"Dock", AI_GOAL_DOCK},
{"Waypoints", AI_GOAL_WAYPOINTS},
{"Waypoints once", AI_GOAL_WAYPOINTS_ONCE},
{"Depart", AI_GOAL_WARP},
{"Attack subsys", AI_GOAL_DESTROY_SUBSYSTEM},
{"Form on wing", AI_GOAL_FORM_ON_WING},
{"Undock", AI_GOAL_UNDOCK},
{"Attack wing", AI_GOAL_CHASE_WING},
{"Guard ship", AI_GOAL_GUARD},
{"Disable ship", AI_GOAL_DISABLE_SHIP},
{"Disarm ship", AI_GOAL_DISARM_SHIP},
{"Attack any", AI_GOAL_CHASE_ANY},
{"Ignore ship", AI_GOAL_IGNORE},
{"Guard wing", AI_GOAL_GUARD_WING},
{"Evade ship", AI_GOAL_EVADE_SHIP},
{"Stay near ship", AI_GOAL_STAY_NEAR_SHIP},
{"keep safe dist", AI_GOAL_KEEP_SAFE_DISTANCE},
{"Rearm ship", AI_GOAL_REARM_REPAIR},
{"Stay still", AI_GOAL_STAY_STILL},
{"Play dead", AI_GOAL_PLAY_DEAD},
{"Attack weapon", AI_GOAL_CHASE_WEAPON},
{"Attack besides", AI_GOAL_CHASE_ANY_EXCEPT},
{"Fly to ship", AI_GOAL_FLY_TO_SHIP},
};
int Num_ai_goals = sizeof(Ai_goal_names)/sizeof(ai_goal_list);
// AL 11-17-97: A text description of the AI goals. This is used for printing out on the
// HUD what a ship's current orders are. If the AI goal doesn't correspond to something that
// ought to be printable, then NULL is used.
@@ -802,87 +835,15 @@ int ai_query_goal_valid( int ship, int ai_goal )
return 1; // anything can have no orders.
accepted = 0;
switch (Ship_info[Ships[ship].ship_info_index].flags & SIF_ALL_SHIP_TYPES) {
case SIF_CARGO:
if (!Fred_running)
Int3(); // get Hoffoss or Allender -- cargo containers shouldn't have a goal!!!
break;
case SIF_FIGHTER:
if ( ai_goal & AI_GOAL_ACCEPT_FIGHTER ){
//WMC - This is much simpler with shiptypes.tbl
//Except you have to add the orders into it by hand.
int ship_type = Ship_info[Ships[ship].ship_info_index].class_type;
if(ship_type > -1)
{
if(ai_goal & Ship_types[ship_type].ai_valid_goals) {
accepted = 1;
}
break;
case SIF_BOMBER:
if ( ai_goal & AI_GOAL_ACCEPT_BOMBER ){
accepted = 1;
}
break;
case SIF_CRUISER:
if ( ai_goal & AI_GOAL_ACCEPT_CRUISER ){
accepted = 1;
}
break;
case SIF_FREIGHTER:
if ( ai_goal & AI_GOAL_ACCEPT_FREIGHTER ){
accepted = 1;
}
break;
case SIF_CAPITAL:
if ( ai_goal & AI_GOAL_ACCEPT_CAPITAL ){
accepted = 1;
}
break;
case SIF_TRANSPORT:
if ( ai_goal & AI_GOAL_ACCEPT_TRANSPORT ){
accepted = 1;
}
break;
case SIF_SUPPORT:
if ( ai_goal & AI_GOAL_ACCEPT_SUPPORT ){
accepted = 1;
}
break;
case SIF_ESCAPEPOD:
if ( ai_goal & AI_GOAL_ACCEPT_ESCAPEPOD ){
accepted = 1;
}
break;
case SIF_SUPERCAP:
if ( ai_goal & AI_GOAL_ACCEPT_SUPERCAP ){
accepted = 1;
}
break;
case SIF_SHIP_CLASS_STEALTH:
if ( ai_goal & AI_GOAL_ACCEPT_STEALTH ){
accepted = 1;
}
break;
case SIF_CORVETTE:
if ( ai_goal & AI_GOAL_ACCEPT_CORVETTE ){
accepted = 1;
}
break;
case SIF_GAS_MINER:
if ( ai_goal & AI_GOAL_ACCEPT_GAS_MINER ){
accepted = 1;
}
break;
case SIF_AWACS:
if ( ai_goal & AI_GOAL_ACCEPT_AWACS ){
accepted = 1;
}
break;
case SIF_NO_SHIP_TYPE:
if (!Fred_running){
Int3(); // HUH? doesn't make sense
}
break;
default:
if (!Fred_running){
Int3(); // get allender or hoffos -- unknown ship type
}
break;
}
return accepted;
@@ -1214,7 +1175,44 @@ void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
docker_index = -1;
dockee_index = -1;
//WMC - This gets a bit complex with shiptypes.tbl
//Basically this finds the common dockpoint.
//For this, the common flags for aip's active point (ie point it wants to dock with)
//and aigp's passive point (point it wants to be docked with) are combined
//and the common ones are used, in order of precedence.
//Yes, it does sound vaguely like a double-entree.
int aip_type_dock = Ship_info[Ships[aip->shipnum].ship_info_index].class_type;
int aigp_type_dock = Ship_info[Ships[shipnum].ship_info_index].class_type;
int common_docks = 0;
if(aip_type_dock > -1) {
aip_type_dock = Ship_types[aip_type_dock].ai_active_dock;
} else {
aip_type_dock = 0;
}
if(aigp_type_dock > -1) {
aigp_type_dock = Ship_types[aigp_type_dock].ai_passive_dock;
} else {
aigp_type_dock = 0;
}
common_docks = aip_type_dock & aigp_type_dock;
//Now iterate through types.
for(int i = 0; i < Num_dock_type_names; i++)
{
if(common_docks & Dock_type_names[i].def) {
docker_index = ai_goal_find_dockpoint(aip->shipnum, Dock_type_names[i].def);
dockee_index = ai_goal_find_dockpoint(shipnum, Dock_type_names[i].def);
break;
}
}
// look for docking points of the appriopriate type. Use cargo docks for cargo ships.
/*
if (Ship_info[Ships[shipnum].ship_info_index].flags & SIF_CARGO) {
docker_index = ai_goal_find_dockpoint(aip->shipnum, DOCK_TYPE_CARGO);
dockee_index = ai_goal_find_dockpoint(shipnum, DOCK_TYPE_CARGO);
@@ -1222,6 +1220,7 @@ void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
docker_index = ai_goal_find_dockpoint(aip->shipnum, DOCK_TYPE_REARM);
dockee_index = ai_goal_find_dockpoint(shipnum, DOCK_TYPE_REARM);
}
*/
// if we didn't find dockpoints above, then we should just look for generic docking points
if ( docker_index == -1 )
+17 -3
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Ship/AiGoals.h $
* $Revision: 1.2 $
* $Date: 2005-07-13 02:50:48 $
* $Author: Goober5000 $
* $Revision: 1.3 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
* <insert description of file here>
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2005/07/13 02:50:48 Goober5000
* remove PreProcDefine #includes in FS2
* --Goober5000
*
* Revision 1.1 2005/03/25 06:45:13 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.
*
@@ -168,6 +172,7 @@
#define _AIGOALS_H
#include "globalincs/globals.h"
#include "globalincs/pstypes.h"
struct wing;
struct ai_info;
@@ -213,6 +218,7 @@ struct ai_goal;
// add it to ai_update_goal_references() or ai_query_goal_references(). I also didn't add it
// to the list in Fred\Management.cpp, because it can't be specified as an initial order - it
// can only be specified through a sexp.
//WMC - Oh and add them to Ai_goal_names plz. TY! :)
#define AI_GOAL_CHASE_ANY_EXCEPT (1<<23) // hey Hoffoss! I added a new goal! :p
#define AI_GOAL_FLY_TO_SHIP (1<<24) // kazan
@@ -220,6 +226,8 @@ struct ai_goal;
// now the masks for ship types
// Goober5000: added AI_GOAL_STAY_NEAR_SHIP and AI_GOAL_KEEP_SAFE_DISTANCE as valid for fighters
//WMC - Don't need these anymore. Whee!
/*
#define AI_GOAL_ACCEPT_FIGHTER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_CHASE | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_DESTROY_SUBSYSTEM | AI_GOAL_CHASE_WING | AI_GOAL_GUARD | AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP | AI_GOAL_CHASE_ANY | AI_GOAL_IGNORE | AI_GOAL_GUARD_WING | AI_GOAL_EVADE_SHIP | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE | AI_GOAL_CHASE_ANY_EXCEPT )
#define AI_GOAL_ACCEPT_BOMBER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FIGHTER | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_STEALTH ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FIGHTER | AI_GOAL_STAY_NEAR_SHIP )
@@ -233,9 +241,15 @@ struct ai_goal;
#define AI_GOAL_ACCEPT_SUPERCAP ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CAPITAL | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_SUPPORT ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_DOCK | AI_GOAL_UNDOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD)
#define AI_GOAL_ACCEPT_ESCAPEPOD ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_TRANSPORT| AI_GOAL_STAY_NEAR_SHIP )
*/
#define MAX_AI_DOCK_NAMES 25
typedef flag_def_list ai_goal_list;
extern ai_goal_list Ai_goal_names[];
extern int Num_ai_goals;
extern int Num_ai_dock_names;
extern char Ai_dock_names[MAX_AI_DOCK_NAMES][NAME_LENGTH];
+9 -5
View File
@@ -1,12 +1,16 @@
/*
* $Logfile: /Freespace2/code/ai/aiturret.cpp $
* $Revision: 1.26 $
* $Date: 2005-11-21 02:43:30 $
* $Author: Goober5000 $
* $Revision: 1.27 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
* Functions for AI control of turrets
*
* $Log: not supported by cvs2svn $
* Revision 1.26 2005/11/21 02:43:30 Goober5000
* change from "setting" to "profile"; this way makes more sense
* --Goober5000
*
* Revision 1.25 2005/11/21 00:46:05 Goober5000
* add ai_settings.tbl
* --Goober5000
@@ -392,7 +396,7 @@ bool valid_turret_enemy(object *eobjp, object *turret_parent, ship_subsys *turre
return false;
// Goober5000 - don't fire at cargo containers (let me know if you want to discuss this) ;)
if ( Ship_info[shipp->ship_info_index].flags & SIF_CARGO ) {
if ( sip->class_type > -1 && !(Ship_types[sip->class_type].ai_bools & STI_AI_TURRETS_ATTACK) ) {
return false;
}
@@ -1201,7 +1205,7 @@ void turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
flak_muzzle_flash(turret_pos, turret_fvec, &Objects[parent_ship->objnum].phys_info, turret_weapon_class);
// pick a firing range so that it detonates properly
flak_pick_range(objp, predicted_pos, ship_get_subsystem_strength(parent_ship, SUBSYSTEM_WEAPONS));
flak_pick_range(objp, turret_pos, predicted_pos, ship_get_subsystem_strength(parent_ship, SUBSYSTEM_WEAPONS));
// determine what that range was
flak_range = flak_get_range(objp);
+23 -7
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Debris/Debris.cpp $
* $Revision: 2.21 $
* $Date: 2005-10-30 06:44:56 $
* $Revision: 2.22 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
* Code for the pieces of exploding object debris.
*
* $Log: not supported by cvs2svn $
* Revision 2.21 2005/10/30 06:44:56 wmcoolmon
* Codebase commit - nebula.tbl, scripting, new dinky explosion/shockwave stuff, moving muzzle flashes
*
* Revision 2.20 2005/10/10 17:21:03 taylor
* remove NO_NETWORK
*
@@ -945,9 +948,19 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
#ifdef DEBRIS_SPEED_DEBUG
// check that debris is not created with too high a velocity
if (hull_flag) {
int ship_info_flag = Ship_info[Ships[source_obj->instance].ship_info_index].flags;
if (ship_info_flag & (SIF_SMALL_SHIP | SIF_NOT_FLYABLE | SIF_HARMLESS)) {
if (hull_flag)
{
int ship_type = Ship_info[Ships[source_obj->instance].ship_info_index].class_type;
if(ship_type > -1)
{
if(vm_vec_mag_squared(&obj->phys_info.vel) > Ship_types[ship_type].debris_max_speed) {
float scale = Ship_types[ship_type].debris_max_speed / vm_vec_mag(&obj->phys_info.vel);
vm_vec_scale(&obj->phys_info.vel, scale);
}
}
/*
if (ship_info_flag & (SIF_SMALL_SHIP | SIF_NOT_FLYABLE | SIF_HARMLESS))
{
if (vm_vec_mag_squared(&obj->phys_info.vel) > MAX_SPEED_SMALL_DEBRIS*MAX_SPEED_SMALL_DEBRIS) {
float scale = MAX_SPEED_SMALL_DEBRIS / vm_vec_mag(&obj->phys_info.vel);
vm_vec_scale(&obj->phys_info.vel, scale);
@@ -962,8 +975,11 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
float scale = MAX_SPEED_CAPITAL_DEBRIS / vm_vec_mag(&obj->phys_info.vel);
vm_vec_scale(&obj->phys_info.vel, scale);
}
} else {
Warning(LOCATION, "Ship has info flag that is not among the following: SMALL, NOT_FLYABLE, HARMLESS, BIG, CAPITAL, SUPERCAP");
*/
}
else
{
Warning(LOCATION, "Ship does not have a type!");
}
}
#endif
+10 -4
View File
@@ -9,13 +9,19 @@
/*
* $Logfile: /Freespace2/code/Fireball/FireBalls.cpp $
* $Revision: 2.29 $
* $Date: 2005-12-28 22:17:01 $
* $Author: taylor $
* $Revision: 2.30 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
* Code to move, render and otherwise deal with fireballs.
*
* $Log: not supported by cvs2svn $
* Revision 2.29 2005/12/28 22:17:01 taylor
* deal with cf_find_file_location() changes
* add a central parse_modular_table() function which anything can use
* fix up weapon_expl so that it can properly handle modular tables and LOD count changes
* add support for for a fireball TBM (handled a little different than a normal TBM is since it only changes rather than adds)
*
* Revision 2.28 2005/12/01 07:45:21 Goober5000
* bypass annoying warnings when loading optional models
* --Goober5000
@@ -505,7 +511,7 @@ void fireball_play_warphole_open_sound(int ship_class, fireball *fb)
sound_index = SND_WARP_IN;
if((ship_class >= 0) && (ship_class < Num_ship_types)){
if((ship_class >= 0) && (ship_class < Num_ship_classes)){
if ( Ship_info[ship_class].flags & SIF_HUGE_SHIP ) {
sound_index = SND_CAPITAL_WARP_IN;
fb->flags |= FBF_WARP_CAPITAL_SIZE;
+15 -9
View File
@@ -9,13 +9,19 @@
/*
* $Logfile: /Freespace2/code/Freespace2/FreeSpace.cpp $
* $Revision: 2.200 $
* $Date: 2005-12-28 22:17:01 $
* $Author: taylor $
* $Revision: 2.201 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
* Freespace main body
*
* $Log: not supported by cvs2svn $
* Revision 2.200 2005/12/28 22:17:01 taylor
* deal with cf_find_file_location() changes
* add a central parse_modular_table() function which anything can use
* fix up weapon_expl so that it can properly handle modular tables and LOD count changes
* add support for for a fireball TBM (handled a little different than a normal TBM is since it only changes rather than adds)
*
* Revision 2.199 2005/12/06 03:13:49 taylor
* fix quite a few CFILE issues:
* use #define's for path lengths when possible so it's easier to move between functions
@@ -2936,7 +2942,7 @@ int game_start_mission()
ship *shipp;
while((moveup != END_OF_LIST(&Ship_obj_list)) && (moveup != NULL)){
// bogus
if((moveup->objnum < 0) || (moveup->objnum >= MAX_OBJECTS) || (Objects[moveup->objnum].type != OBJ_SHIP) || (Objects[moveup->objnum].instance < 0) || (Objects[moveup->objnum].instance >= MAX_SHIPS) || (Ships[Objects[moveup->objnum].instance].ship_info_index < 0) || (Ships[Objects[moveup->objnum].instance].ship_info_index >= Num_ship_types)){
if((moveup->objnum < 0) || (moveup->objnum >= MAX_OBJECTS) || (Objects[moveup->objnum].type != OBJ_SHIP) || (Objects[moveup->objnum].instance < 0) || (Objects[moveup->objnum].instance >= MAX_SHIPS) || (Ships[Objects[moveup->objnum].instance].ship_info_index < 0) || (Ships[Objects[moveup->objnum].instance].ship_info_index >= Num_ship_classes)){
moveup = GET_NEXT(moveup);
continue;
}
@@ -4369,7 +4375,7 @@ void game_tst_mark(object *objp, ship *shipp)
}
// bogus
if((objp == NULL) || (shipp == NULL) || (shipp->ship_info_index < 0) || (shipp->ship_info_index >= Num_ship_types)){
if((objp == NULL) || (shipp == NULL) || (shipp->ship_info_index < 0) || (shipp->ship_info_index >= Num_ship_classes)){
return;
}
sip = &Ship_info[shipp->ship_info_index];
@@ -5375,7 +5381,7 @@ void game_simulation_frame()
ship_info *sip;
while((moveup != END_OF_LIST(&Ship_obj_list)) && (moveup != NULL)){
// bogus
if((moveup->objnum < 0) || (moveup->objnum >= MAX_OBJECTS) || (Objects[moveup->objnum].type != OBJ_SHIP) || (Objects[moveup->objnum].instance < 0) || (Objects[moveup->objnum].instance >= MAX_SHIPS) || (Ships[Objects[moveup->objnum].instance].ship_info_index < 0) || (Ships[Objects[moveup->objnum].instance].ship_info_index >= Num_ship_types)){
if((moveup->objnum < 0) || (moveup->objnum >= MAX_OBJECTS) || (Objects[moveup->objnum].type != OBJ_SHIP) || (Objects[moveup->objnum].instance < 0) || (Objects[moveup->objnum].instance >= MAX_SHIPS) || (Ships[Objects[moveup->objnum].instance].ship_info_index < 0) || (Ships[Objects[moveup->objnum].instance].ship_info_index >= Num_ship_classes)){
moveup = GET_NEXT(moveup);
continue;
}
@@ -8481,8 +8487,8 @@ int game_main(char *cmdline)
int state;
// check if networking should be disabled, this could probably be done later but the sooner the better
// TODO: remove this when multi is fixed to handle more than MAX_SHIP_TYPES_MULTI
if ( MAX_SHIP_TYPES > MAX_SHIP_TYPES_MULTI ) {
// TODO: remove this when multi is fixed to handle more than MAX_SHIP_CLASSES_MULTI
if ( Num_ship_classes > MAX_SHIP_CLASSES_MULTI ) {
Networking_disabled = 1;
}
@@ -9395,7 +9401,7 @@ void Do_model_timings_test()
}
// Load them all
for (i=0; i<Num_ship_types; i++ ) {
for (i=0; i<Num_ship_classes; i++ ) {
Ship_info[i].modelnum = model_load( Ship_info[i].pof_file, 0, NULL );
model_used[Ship_info[i].modelnum%MAX_POLYGON_MODELS]++;
+12 -9
View File
@@ -10,12 +10,15 @@
/*
* $Logfile: /Freespace2/code/fs2open_pxo/Client.cpp $
* $Revision: 1.22 $
* $Date: 2005-10-10 17:21:04 $
* $Author: taylor $
* $Revision: 1.23 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
*
* $Log: not supported by cvs2svn $
* Revision 1.22 2005/10/10 17:21:04 taylor
* remove NO_NETWORK
*
* Revision 1.21 2005/07/13 02:50:49 Goober5000
* remove PreProcDefine #includes in FS2
* --Goober5000
@@ -202,9 +205,9 @@ int SendPlayerData(int SID, const char* player_name, const char* user, player *p
p_update->SecShots = pl->stats.s_shots_fired;
p_update->SecHits = pl->stats.s_shots_hit;
p_update->SecFHits = pl->stats.s_bonehead_hits;
p_update->ship_types = MAX_SHIP_TYPES;
p_update->ship_types = MAX_SHIP_CLASSES;
for (int i = 0; i < MAX_SHIP_TYPES; i++)
for (int i = 0; i < MAX_SHIP_CLASSES; i++)
{
strncpy(type_kills[i].name, Ship_info[i].name, 32);
@@ -213,7 +216,7 @@ int SendPlayerData(int SID, const char* player_name, const char* user, player *p
int packet_size = 194; // size of all the ints only
packet_size += sizeof(fs2open_ship_typekill) * MAX_SHIP_TYPES; // add the size of the ship_kills array
packet_size += sizeof(fs2open_ship_typekill) * MAX_SHIP_CLASSES; // add the size of the ship_kills array
// send Packet
if (Socket.SendPacket(PacketBuffer, packet_size, sender, port) == -1)
@@ -303,11 +306,11 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
if (p_reply->ship_types == 0)
memset(pl->stats.kills, 0, sizeof(int) * MAX_SHIP_TYPES);
memset(pl->stats.kills, 0, sizeof(int) * MAX_SHIP_CLASSES);
else
{
// i should really assert p_reply->ship_types == MAX_SHIP_TYPES
for (int i = 0; i < MAX_SHIP_TYPES && p_reply->ship_types; i++)
// i should really assert p_reply->ship_types == MAX_SHIP_CLASSES
for (int i = 0; i < MAX_SHIP_CLASSES && p_reply->ship_types; i++)
{
pl->stats.kills[i] = type_kills[i].kills;
}
+14 -11
View File
@@ -11,11 +11,14 @@
/*
* $Logfile: /Freespace2/code/fs2open_pxo/TCP_Client.cpp $
* $Revision: 1.32 $
* $Date: 2005-10-10 17:21:04 $
* $Author: taylor $
* $Revision: 1.33 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
* $Log: not supported by cvs2svn $
* Revision 1.32 2005/10/10 17:21:04 taylor
* remove NO_NETWORK
*
* Revision 1.31 2005/07/13 02:50:49 Goober5000
* remove PreProcDefine #includes in FS2
* --Goober5000
@@ -233,7 +236,7 @@ int SendPlayerData(int SID, const char* player_name, const char* user, player *p
fs2open_pilot_update *p_update = (fs2open_pilot_update *) PacketBuffer;
fs2open_ship_typekill *type_kills = (fs2open_ship_typekill *) (PacketBuffer + 204);
int *medals = (int*)(PacketBuffer + 204 + (sizeof(fs2open_ship_typekill) * MAX_SHIP_TYPES));
int *medals = (int*)(PacketBuffer + 204 + (sizeof(fs2open_ship_typekill) * MAX_SHIP_CLASSES));
p_update->pid = PCKT_PILOT_UPDATE2;
@@ -255,12 +258,12 @@ int SendPlayerData(int SID, const char* player_name, const char* user, player *p
p_update->SecShots = pl->stats.s_shots_fired;
p_update->SecHits = pl->stats.s_shots_hit;
p_update->SecFHits = pl->stats.s_bonehead_hits;
p_update->ship_types = MAX_SHIP_TYPES;
p_update->ship_types = MAX_SHIP_CLASSES;
p_update->num_medals = MAX_MEDALS;
p_update->rank = pl->stats.rank;
int i;
for (i = 0; i < MAX_SHIP_TYPES; i++)
for (i = 0; i < MAX_SHIP_CLASSES; i++)
{
strncpy(type_kills[i].name, Ship_info[i].name, 32);
@@ -274,7 +277,7 @@ int SendPlayerData(int SID, const char* player_name, const char* user, player *p
}
int packet_size = 204; // size of all the ints only
packet_size += sizeof(fs2open_ship_typekill) * MAX_SHIP_TYPES; // add the size of the ship_kills array
packet_size += sizeof(fs2open_ship_typekill) * MAX_SHIP_CLASSES; // add the size of the ship_kills array
packet_size += sizeof(int) * MAX_MEDALS; // add the size of the ship_kills array
// send Packet
@@ -400,11 +403,11 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
if (p_reply->ship_types == 0)
memset(pl->stats.kills, 0, sizeof(int) * MAX_SHIP_TYPES);
memset(pl->stats.kills, 0, sizeof(int) * MAX_SHIP_CLASSES);
else
{
// i should really assert p_reply->ship_types == MAX_SHIP_TYPES
for (i = 0; i < MAX_SHIP_TYPES && p_reply->ship_types; i++)
// i should really assert p_reply->ship_types == MAX_SHIP_CLASSES
for (i = 0; i < MAX_SHIP_CLASSES && p_reply->ship_types; i++)
{
pl->stats.kills[i] = type_kills[i].kills;
}
@@ -414,7 +417,7 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
memset(pl->stats.medals, 0, sizeof(int) * MAX_MEDALS);
else
{
// i should really assert p_reply->ship_types == MAX_SHIP_TYPES
// i should really assert p_reply->ship_types == MAX_SHIP_CLASSES
for (i = 0; i < MAX_MEDALS && p_reply->num_medals; i++)
{
pl->stats.medals[i] = medals[i];
+582
View File
@@ -0,0 +1,582 @@
#include <string.h>
#include "globalincs/pstypes.h"
//Struct used to hold data about file defaults
typedef struct def_file
{
char* filename;
char *contents;
}def_file;
//:PART 1:
//**********
extern char *Default_species_table;
extern char *Default_iff_table;
extern char *Default_shiptypes_table;
//**********
//:PART 2:
//**********
def_file Default_files[] = {
{"species_defs.tbl", Default_species_table},
{"iff_defs.tbl", Default_iff_table},
{"shiptypes.tbl", Default_shiptypes_table},
};
static int Num_default_files = sizeof(Default_files)/sizeof(def_file);
//**********
char *defaults_get_file(char *filename)
{
for(int i = 0; i < Num_default_files; i++)
{
if(!stricmp(Default_files[i].filename, filename))
{
return Default_files[i].contents;
}
}
//WMC - This is really bad, because it means we have a default table missing.
Warning(LOCATION, "Default table '%s' missing from executable - contact a coder.", filename);
return NULL;
}
//:PART 3:
//**********
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// This is the default table
// Please note that the {\n\}s should be removed from the end of each line
// if you intend to use this to format your own species_defs.tbl.
char *Default_species_table = "\
\n\
#SPECIES DEFS \n\
\n\
;------------------------ \n\
; Terran \n\
;------------------------ \n\
$Species_Name: Terran \n\
$Default IFF: Friendly \n\
$FRED Color: ( 0, 0, 192 ) \n\
$MiscAnims: \n\
+Debris_Texture: debris01a \n\
+Shield_Hit_ani: shieldhit01a \n\
$ThrustAnims: \n\
+Normal: thruster01 \n\
+Afterburn: thruster01a \n\
$ThrustGlows: \n\
+Normal: thrusterglow01 \n\
+Afterburn: thrusterglow01a \n\
$AwacsMultiplier: 1.00 \n\
\n\
;------------------------ \n\
; Vasudan \n\
;------------------------ \n\
$Species_Name: Vasudan \n\
$Default IFF: Friendly \n\
$FRED Color: ( 0, 128, 0 ) \n\
$MiscAnims: \n\
+Debris_Texture: debris01b \n\
+Shield_Hit_ani: shieldhit01a \n\
$ThrustAnims: \n\
+Normal: thruster02 \n\
+Afterburn: thruster02a \n\
$ThrustGlows: \n\
+Normal: thrusterglow02 \n\
+Afterburn: thrusterglow02a \n\
$AwacsMultiplier: 1.25 \n\
\n\
;------------------------ \n\
; Shivan \n\
;------------------------ \n\
$Species_Name: Shivan \n\
$Default IFF: Hostile \n\
$FRED Color: ( 192, 0, 0 ) \n\
$MiscAnims: \n\
+Debris_Texture: debris01c \n\
+Shield_Hit_ani: shieldhit01a \n\
$ThrustAnims: \n\
+Normal: thruster03 \n\
+Afterburn: thruster03a \n\
$ThrustGlows: \n\
+Normal: thrusterglow03 \n\
+Afterburn: thrusterglow03a \n\
$AwacsMultiplier: 1.50 \n\
\n\
#END \n\
";
//=============================================================================
// This is the default table
// Please note that the {\n\}s should be removed from the end of each line and
// the {\"}s should be replaced with {"}s if you intend to use this to format
// your own iff_defs.tbl.
char *Default_iff_table = "\
\n\
#IFFs \n\
\n\
;; Every iff_defs.tbl must contain a Traitor entry. Traitors attack one \n\
;; another (required by the dogfighting code) but it is up to you to \n\
;; decide who attacks the traitor or whom else the traitor attacks. \n\
$Traitor IFF: Traitor \n\
\n\
;------------------------ \n\
; Friendly \n\
;------------------------ \n\
$IFF Name: Friendly \n\
$Color: ( 0, 255, 0 ) \n\
$Attacks: ( \"Hostile\" \"Neutral\" \"Traitor\" ) \n\
$Default Ship Flags: ( \"cargo-known\" ) \n\
\n\
;------------------------ \n\
; Hostile \n\
;------------------------ \n\
$IFF Name: Hostile \n\
$Color: ( 255, 0, 0 ) \n\
$Attacks: ( \"Friendly\" \"Neutral\" \"Traitor\" ) \n\
+Sees Friendly As: ( 255, 0, 0 ) \n\
+Sees Hostile As: ( 0, 255, 0 ) \n\
\n\
;------------------------ \n\
; Neutral \n\
;------------------------ \n\
$IFF Name: Neutral \n\
$Color: ( 255, 0, 0 ) \n\
$Attacks: ( \"Friendly\" \"Traitor\" ) \n\
+Sees Friendly As: ( 255, 0, 0 ) \n\
+Sees Hostile As: ( 0, 255, 0 ) \n\
+Sees Neutral As: ( 0, 255, 0 ) \n\
\n\
;------------------------ \n\
; Unknown \n\
;------------------------ \n\
$IFF Name: Unknown \n\
$Color: ( 255, 0, 255 ) \n\
$Attacks: ( \"Hostile\" ) \n\
+Sees Neutral As: ( 0, 255, 0 ) \n\
+Sees Traitor As: ( 0, 255, 0 ) \n\
$Flags: ( \"exempt from all teams at war\" ) \n\
\n\
;------------------------ \n\
; Traitor \n\
;------------------------ \n\
$IFF Name: Traitor \n\
$Color: ( 255, 0, 0 ) \n\
$Attacks: ( \"Friendly\" \"Hostile\" \"Neutral\" \"Traitor\" ) \n\
+Sees Friendly As: ( 255, 0, 0 ) \n\
\n\
#End \n\
";
//=============================================================================
//=============================================================================
//char *Default_shiptypes_table = "";
char *Default_shiptypes_table = "\
#Ship types\n\
""$Name: Navbuoy\n\
$Max Debris Speed: 200\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 10.0\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 500.0\n\
$AI:\n\
+Turrets attack this: YES\n\
\n\
""$Name: Sentry gun\n\
$Counts for Alone: YES\n\
$On Hotkey List: YES\n\
$Target as Threat: YES\n\
$Show Attack Direction: YES\n\
$Max Debris Speed: 200\n\
$FF Multiplier: 0.10\n\
$EMP Multiplier: 10.0\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 500.0\n\
$AI:\n\
+Accept Player Orders: NO\n\
+Auto attacks: YES\n\
+Guards attack this: YES\n\
+Turrets attack this: YES\n\
\n\
""$Name: Escape pod\n\
$Praise Destruction: YES\n\
$On Hotkey List: YES\n\
$Warp Pushable: YES\n\
$Max Debris Speed: 200\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 10.0\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 600.0\n\
$AI:\n\
+Valid goals: (\"fly to ship\" \"attack ship\" \"attack wing\" \"dock\" \"waypoints\" \"waypoints once\" \"depart\" \"undock\" \"stay still\" \"play dead\" \"stay near ship\")\n\
+Turrets attack this: YES\n\
\n\
""$Name: Cargo\n\
$Scannable: YES\n\
$Max Debris Speed: 200\n\
$FF Multiplier: 0.10\n\
$EMP Multiplier: 10.0\n\
$Beams Easily Hit: YES\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 500.0\n\
$AI:\n\
+Passive docks: (\"cargo\")\n\
\n\
""$Name: Support\n\
$Counts for Alone: YES\n\
$Praise Destruction: YES\n\
$On Hotkey List: YES\n\
$Target as Threat: YES\n\
$Show Attack Direction: YES\n\
$Warp Pushable: YES\n\
$Max Debris Speed: 200\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 3.5\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 500.0\n\
$AI:\n\
+Valid goals: (\"fly to ship\" \"dock\" \"undock\" \"waypoints\" \"waypoints once\" \"stay near ship\" \"keep safe dist\" \"stay still\" \"play dead\")\n\
+Accept Player Orders: YES\n\
+Player orders: (\"rearm me\" \"abort rearm\" \"stay near me\" \"stay near ship\" \"keep safe dist\" \"depart\")\n\
+Auto attacks: YES\n\
+Guards attack this: YES\n\
+Turrets attack this: YES\n\
+Active docks: (\"support\")\n\
\n\
;;WMC - Stealth ships always have another type, so this isn't used\n\
""$Name: Stealth\n\
$Counts for Alone: YES\n\
$Praise Destruction: YES\n\
$On Hotkey List: YES\n\
$Target as Threat: YES\n\
$Show Attack Direction: YES\n\
$Max Debris Speed: 200\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 4.0\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 500.0\n\
$AI:\n\
+Valid goals: (\"fly to ship\" \"attack ship\" \"waypoints\" \"waypoints once\" \"depart\" \"attack subsys\" \"attack wing\" \"guard ship\" \"disable ship\" \"disarm ship\" \"attack any\" \"ignore ship\" \"guard wing\" \"evade ship\" \"stay still\" \"play dead\" \"stay near ship\" \"keep safe dist\" \"attack besides\")\n\
+Accept Player Orders: YES\n\
+Player Orders: (\"attack ship\" \"disable ship\" \"disarm ship\" \"guard ship\" \"ignore ship\" \"form on wing\" \"cover me\" \"attack any\" \"depart\" \"disable subsys\")\n\
+Auto attacks: YES\n\
+Guards attack this: YES\n\
+Turrets attack this: YES\n\
+Passive docks: (\"support\")\n\
\n\
""$Name: Fighter\n\
$Counts for Alone: YES\n\
$Praise Destruction: YES\n\
$On Hotkey List: YES\n\
$Target as Threat: YES\n\
$Show Attack Direction: YES\n\
$Warp Pushable: YES\n\
$Max Debris Speed: 200\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 4.0\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 500.0\n\
$AI:\n\
+Valid goals: (\"fly to ship\" \"attack ship\" \"waypoints\" \"waypoints once\" \"depart\" \"attack subsys\" \"attack wing\" \"guard ship\" \"disable ship\" \"disarm ship\" \"attack any\" \"ignore ship\" \"guard wing\" \"evade ship\" \"stay still\" \"play dead\" \"stay near ship\" \"keep safe dist\" \"attack besides\")\n\
+Accept Player Orders: YES\n\
+Player Orders: (\"attack ship\" \"disable ship\" \"disarm ship\" \"guard ship\" \"ignore ship\" \"form on wing\" \"cover me\" \"attack any\" \"depart\" \"disable subsys\")\n\
+Auto attacks: YES\n\
+Guards attack this: YES\n\
+Turrets attack this: YES\n\
+Can Form Wing: YES\n\
+Passive docks: (\"support\")\n\
\n\
""$Name: Bomber\n\
$Counts for Alone: YES\n\
$Praise Destruction: YES\n\
$On Hotkey List: YES\n\
$Target as Threat: YES\n\
$Show Attack Direction: YES\n\
$Warp Pushable: YES\n\
$Max Debris Speed: 200\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 4.0\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 500.0\n\
$AI:\n\
+Valid goals: (\"fly to ship\" \"attack ship\" \"waypoints\" \"waypoints once\" \"depart\" \"attack subsys\" \"attack wing\" \"guard ship\" \"disable ship\" \"disarm ship\" \"attack any\" \"ignore ship\" \"guard wing\" \"evade ship\" \"stay still\" \"play dead\" \"stay near ship\" \"keep safe dist\" \"attack besides\")\n\
+Accept Player Orders: YES\n\
+Player Orders: (\"attack ship\" \"disable ship\" \"disarm ship\" \"guard ship\" \"ignore ship\" \"form on wing\" \"cover me\" \"attack any\" \"depart\" \"disable subsys\")\n\
+Auto attacks: YES\n\
+Guards attack this: YES\n\
+Turrets attack this: YES\n\
+Can Form Wing: YES\n\
+Passive docks: (\"support\")\n\
\n\
;;WMC - This fighter/bomber type doesn't seem to be used anywhere, because no ship is set as both fighter and bomber\n\
""$Name: Fighter/bomber\n\
$Counts for Alone: YES\n\
$Praise Destruction: YES\n\
$On Hotkey List: YES\n\
$Target as Threat: YES\n\
$Show Attack Direction: YES\n\
$Warp Pushable: YES\n\
$Max Debris Speed: 200\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 4.0\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 500.0\n\
$AI:\n\
+Valid goals: (\"fly to ship\" \"attack ship\" \"waypoints\" \"waypoints once\" \"depart\" \"attack subsys\" \"attack wing\" \"guard ship\" \"disable ship\" \"disarm ship\" \"attack any\" \"ignore ship\" \"guard wing\" \"evade ship\" \"stay still\" \"play dead\" \"stay near ship\" \"keep safe dist\" \"attack besides\")\n\
+Accept Player Orders: YES\n\
+Player Orders: (\"attack ship\" \"disable ship\" \"disarm ship\" \"guard ship\" \"ignore ship\" \"form on wing\" \"cover me\" \"attack any\" \"depart\" \"disable subsys\")\n\
+Auto attacks: YES\n\
+Guards attack this: YES\n\
+Turrets attack this: YES\n\
+Can Form Wing: YES\n\
+Passive docks: (\"support\")\n\
\n\
""$Name: Transport\n\
$Counts for Alone: YES\n\
$Praise Destruction: YES\n\
$On Hotkey List: YES\n\
$Target as Threat: YES\n\
$Show Attack Direction: YES\n\
$Max Debris Speed: 150\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 2.0\n\
$Beams Easily Hit: YES\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 500.0\n\
$AI:\n\
+Valid goals: (\"fly to ship\" \"attack ship\" \"attack wing\" \"dock\" \"waypoints\" \"waypoints once\" \"depart\" \"undock\" \"stay still\" \"play dead\" \"stay near ship\")\n\
+Accept Player Orders: YES\n\
+Player Orders: (\"attack ship\" \"dock\" \"depart\")\n\
+Auto attacks: YES\n\
+Attempt Broadside: YES\n\
+Guards attack this: YES\n\
+Turrets attack this: YES\n\
+Can Form Wing: YES\n\
+Passive docks: (\"support\")\n\
\n\
""$Name: Freighter\n\
$Counts for Alone: YES\n\
$Praise Destruction: YES\n\
$On Hotkey List: YES\n\
$Target as Threat: YES\n\
$Show Attack Direction: YES\n\
$Scannable: YES\n\
$Max Debris Speed: 150\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 1.75\n\
$Beams Easily Hit: YES\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 600.0\n\
$AI:\n\
+Valid goals: (\"fly to ship\" \"attack ship\" \"attack wing\" \"dock\" \"waypoints\" \"waypoints once\" \"depart\" \"undock\" \"stay still\" \"play dead\" \"stay near ship\")\n\
+Accept Player Orders: YES\n\
+Player Orders: (\"attack ship\" \"dock\" \"depart\")\n\
+Auto attacks: YES\n\
+Attempt Broadside: YES\n\
+Guards attack this: YES\n\
+Turrets attack this: YES\n\
+Can Form Wing: YES\n\
+Active docks: (\"cargo\")\n\
+Passive docks: (\"support\")\n\
\n\
""$Name: AWACS\n\
$Counts for Alone: YES\n\
$Praise Destruction: YES\n\
$On Hotkey List: YES\n\
$Target as Threat: YES\n\
$Show Attack Direction: YES\n\
$Max Debris Speed: 150\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 0.8\n\
$Beams Easily Hit: YES\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 600.0\n\
$AI:\n\
+Valid goals: (\"fly to ship\" \"attack ship\" \"attack wing\" \"dock\" \"waypoints\" \"waypoints once\" \"depart\" \"undock\" \"stay still\" \"play dead\" \"stay near ship\")\n\
+Accept Player Orders: YES\n\
+Player Orders: (\"attack ship\" \"depart\")\n\
+Auto attacks: YES\n\
+Attempt Broadside: YES\n\
+Guards attack this: YES\n\
+Turrets attack this: YES\n\
+Can Form Wing: YES\n\
+Passive docks: (\"support\")\n\
\n\
""$Name: Gas Miner\n\
$Counts for Alone: YES\n\
$Praise Destruction: YES\n\
$On Hotkey List: YES\n\
$Target as Threat: YES\n\
$Show Attack Direction: YES\n\
$Max Debris Speed: 150\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 1.0\n\
$Beams Easily Hit: YES\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 600.0\n\
$AI:\n\
+Valid goals: (\"fly to ship\" \"attack ship\" \"attack wing\" \"dock\" \"waypoints\" \"waypoints once\" \"depart\" \"undock\" \"stay still\" \"play dead\" \"stay near ship\")\n\
+Accept Player Orders: YES\n\
+Player Orders: (\"attack ship\" \"depart\")\n\
+Auto attacks: YES\n\
+Attempt Broadside: YES\n\
+Guards attack this: YES\n\
+Turrets attack this: YES\n\
+Can Form Wing: YES\n\
+Passive docks: (\"support\")\n\
\n\
""$Name: Cruiser\n\
$Counts for Alone: YES\n\
$Praise Destruction: YES\n\
$On Hotkey List: YES\n\
$Target as Threat: YES\n\
$Show Attack Direction: YES\n\
$Max Debris Speed: 150\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 0.9\n\
$Beams Easily Hit: YES\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 600.0\n\
$AI:\n\
+Valid goals: (\"fly to ship\" \"attack ship\" \"attack wing\" \"dock\" \"waypoints\" \"waypoints once\" \"depart\" \"undock\" \"stay still\" \"play dead\" \"stay near ship\")\n\
+Accept Player Orders: YES\n\
+Player Orders: (\"attack ship\" \"depart\")\n\
+Auto attacks: YES\n\
+Attempt Broadside: YES\n\
+Guards attack this: YES\n\
+Turrets attack this: YES\n\
+Can Form Wing: YES\n\
+Passive docks: (\"support\")\n\
\n\
""$Name: Corvette\n\
$Counts for Alone: YES\n\
$Praise Destruction: YES\n\
$On Hotkey List: YES\n\
$Target as Threat: YES\n\
$Show Attack Direction: YES\n\
$Max Debris Speed: 150\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 0.3333\n\
$Beams Easily Hit: YES\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 600.0\n\
$AI:\n\
+Valid goals: (\"fly to ship\" \"attack ship\" \"attack wing\" \"dock\" \"waypoints\" \"waypoints once\" \"depart\" \"undock\" \"stay still\" \"play dead\" \"stay near ship\")\n\
+Accept Player Orders: YES\n\
+Player Orders: (\"attack ship\" \"depart\")\n\
+Auto attacks: YES\n\
+Attempt Broadside: YES\n\
+Guards attack this: YES\n\
+Turrets attack this: YES\n\
+Can Form Wing: YES\n\
+Passive docks: (\"support\")\n\
\n\
""$Name: Capital\n\
$Counts for Alone: YES\n\
$Praise Destruction: YES\n\
$On Hotkey List: YES\n\
$Target as Threat: YES\n\
$Show Attack Direction: YES\n\
$Warp Pushes: YES\n\
$Max Debris Speed: 100\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 0.2\n\
$Beams Easily Hit: YES\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 750.0\n\
$AI:\n\
+Valid goals: (\"fly to ship\" \"attack ship\" \"attack wing\" \"waypoints\" \"waypoints once\" \"depart\" \"stay still\" \"play dead\" \"stay near ship\")\n\
+Accept Player Orders: YES\n\
+Player Orders: (\"depart\")\n\
+Auto attacks: YES\n\
+Attempt Broadside: YES\n\
+Guards attack this: YES\n\
+Turrets attack this: YES\n\
+Can Form Wing: YES\n\
+Passive docks: (\"support\")\n\
\n\
""$Name: Super cap\n\
$Counts for Alone: YES\n\
$Praise Destruction: YES\n\
$On Hotkey List: YES\n\
$Target as Threat: YES\n\
$Show Attack Direction: YES\n\
$Warp Pushes: YES\n\
$Max Debris Speed: 100\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 0.075\n\
$Beams Easily Hit: YES\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 1000.0\n\
$AI:\n\
+Valid goals: (\"fly to ship\" \"attack ship\" \"attack wing\" \"waypoints\" \"waypoints once\" \"depart\" \"stay still\" \"play dead\" \"stay near ship\")\n\
+Auto attacks: YES\n\
+Attempt Broadside: YES\n\
+Guards attack this: YES\n\
+Turrets attack this: YES\n\
+Can Form Wing: YES\n\
+Passive docks: (\"support\")\n\
\n\
""$Name: Drydock\n\
$Counts for Alone: YES\n\
$Praise Destruction: YES\n\
$On Hotkey List: YES\n\
$Target as Threat: YES\n\
$Show Attack Direction: YES\n\
$Max Debris Speed: 100\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 0.5\n\
$Beams Easily Hit: YES\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 750.0\n\
$AI:\n\
+Accept Player Orders: YES\n\
+Auto attacks: YES\n\
+Attempt Broadside: YES\n\
+Guards attack this: YES\n\
+Turrets attack this: YES\n\
+Passive docks: (\"support\")\n\
\n\
""$Name: Knossos Device\n\
$Counts for Alone: YES\n\
$Praise Destruction: YES\n\
$On Hotkey List: YES\n\
$Target as Threat: YES\n\
$Show Attack Direction: YES\n\
$Max Debris Speed: 100\n\
$FF Multiplier: 1.0\n\
$EMP Multiplier: 0.10\n\
$Fog:\n\
+Start dist: 10.0\n\
+Compl dist: 1000.0\n\
$AI:\n\
+Auto attacks: YES\n\
+Attempt Broadside: YES\n\
+Guards attack this: YES\n\
+Turrets attack this: YES\n\
+Passive docks: (\"support\")\n\
#End\n\
";
+9
View File
@@ -0,0 +1,9 @@
//Used to retrieve pointer to file data from def_files.cpp
char *defaults_get_file(char *filename);
//WMC -
//There are three parts to adding a file
//:PART 1: Add variable declaration for new file
//:PART 2: Add filename of default file to Default_files[] array, along with content variable
//:PART 3: Define the content using the variable declared in part 1.
//Do a search in def_files.cpp for the individual part labels for examples and locations.
+10 -7
View File
@@ -7,13 +7,16 @@
/*
* $Logfile: /Freespace2/code/GlobalIncs/globals.h $
* $Revision: 1.19 $
* $Date: 2005-10-10 17:21:04 $
* $Author: taylor $
* $Revision: 1.20 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
* Header for common global #defines, to cut down on #includes
*
* $Log: not supported by cvs2svn $
* Revision 1.19 2005/10/10 17:21:04 taylor
* remove NO_NETWORK
*
* Revision 1.18 2005/09/27 05:25:18 Goober5000
* initial commit of basic IFF code
* --Goober5000
@@ -142,12 +145,12 @@
// DO NOT CHANGE THIS - IT WILL LIKELY BREAK FREESPACE2 PXO SUPPORT
// TALK TO DAVE B FIRST
// ****************************************************************
#define MAX_SHIP_TYPES_MULTI 130
#define MAX_SHIP_CLASSES_MULTI 130
#ifdef INF_BUILD
#define MAX_SHIP_TYPES 250
#define MAX_SHIP_CLASSES 250
#else
#define MAX_SHIP_TYPES 130
#define MAX_SHIP_CLASSES 130
#endif
@@ -230,7 +233,7 @@
// from scoring.h
// ARGH. IMPORTANT : do not change NUM_MEDALS without talking to DaveB first. It will affect the size of the scoring struct and hence, will break
// a lot of PXO related stuff. SEE ALSO : MAX_SHIP_TYPES
// a lot of PXO related stuff. SEE ALSO : MAX_SHIP_CLASSES
#ifdef FS2_DEMO
//#define NUM_MEDALS 16
#else
+18 -6
View File
@@ -9,16 +9,22 @@
/*
* $Logfile: /Freespace2/code/GlobalIncs/PsTypes.h $
* $Revision: 2.38 $
* $Date: 2005-12-28 22:17:01 $
* $Author: taylor $
* $Revision: 2.38 $
* $Date: 2005-12-28 22:17:01 $
* $Author: taylor $
* $Revision: 2.39 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
* $Revision: 2.39 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
* Header file containg global typedefs, constants and macros
*
* $Log: not supported by cvs2svn $
* Revision 2.38 2005/12/28 22:17:01 taylor
* deal with cf_find_file_location() changes
* add a central parse_modular_table() function which anything can use
* fix up weapon_expl so that it can properly handle modular tables and LOD count changes
* add support for for a fireball TBM (handled a little different than a normal TBM is since it only changes rather than adds)
*
* Revision 2.37 2005/12/06 02:55:22 taylor
* little consolidation:
* move path separator stuff here from cfile.h
@@ -534,6 +540,12 @@ inline void vec3d::set_screen_vert(vertex&vert){
memcpy(this,&vert.sx,sizeof(vec3d));
}
//def_list
typedef struct flag_def_list {
char *name;
int def;
} def_list;
extern int spec;
//This are defined in MainWin.c
+51 -3
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Graphics/2d.cpp $
* $Revision: 2.62 $
* $Date: 2005-12-06 02:53:02 $
* $Author: taylor $
* $Revision: 2.63 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
* Main file for 2d primitives.
*
* $Log: not supported by cvs2svn $
* Revision 2.62 2005/12/06 02:53:02 taylor
* clean up some D3D debug messages to better match new OGL messages (for easier debugging)
* remove D3D_32bit variable since it's basically useless and the same thing can be done another way
*
* Revision 2.61 2005/12/04 18:59:18 wmcoolmon
* Attempt to fix OpenGL crash-on-debug-exit
*
@@ -2074,3 +2078,47 @@ void gr_flip()
}
gr_screen.gf_flip();
}
//WMC - bump mapping thing
void poly_tsb_calc(vertex *v0, vertex *v1, vertex *v2, vec3d *o_norm, vec3d *o_stan, vec3d *o_ttan)
{
vec3d side0, side1;
vec3d vt0, vt1; //temp vecs
float ft0, ft1; //temp floats
side0.xyz.x = v0->x - v1->x;
side0.xyz.y = v0->y - v1->y;
side0.xyz.z = v0->z - v1->z;
side1.xyz.x = v2->x - v1->x;
side1.xyz.y = v2->y - v1->y;
side1.xyz.z = v2->z - v1->z;
//Normal
vm_vec_crossprod(o_norm, &side1, &side0);
vm_vec_normalize(o_norm);
//sTangent
ft0 = v0->v - v1->v;
ft1 = v2->v - v1->v;
vm_vec_copy_scale(&vt0, &side0, ft1);
vm_vec_copy_scale(&vt1, &side1, ft0);
vm_vec_sub(o_stan, &vt0, &vt1);
vm_vec_normalize(o_stan);
//tTangent
ft0 = v0->u - v1->u;
ft1 = v2->u - v1->u;
vm_vec_copy_scale(&vt0, &side0, ft1);
vm_vec_copy_scale(&vt1, &side1, ft0);
vm_vec_sub(o_ttan, &vt0, &vt1);
vm_vec_normalize(o_ttan);
//Maybe reverse
vm_vec_crossprod(&vt0, o_stan, o_ttan);
if(vm_vec_dotprod(&vt0, o_norm) < 0.0f)
{
vm_vec_scale(o_stan, -1.0f);
vm_vec_scale(o_ttan, -1.0f);
}
}
+9 -3
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Graphics/2d.h $
* $Revision: 2.68 $
* $Date: 2005-12-29 00:52:57 $
* $Author: phreak $
* $Revision: 2.69 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
* Header file for 2d primitives.
*
* $Log: not supported by cvs2svn $
* Revision 2.68 2005/12/29 00:52:57 phreak
* changed around aabitmap calls to accept a "mirror" parameter. defaults to false, and is only true for mirrored briefing icons.
* If the mirror param is true, then the picture is mirrored about the y-axis so left becomes right and vice versa.
*
* Revision 2.67 2005/10/30 06:44:57 wmcoolmon
* Codebase commit - nebula.tbl, scripting, new dinky explosion/shockwave stuff, moving muzzle flashes
*
@@ -1430,5 +1434,7 @@ void gr_pline_special(vec3d **pts, int num_pts, int thickness,bool resize=true);
#define VERTEX_FLAG_UV3 (1<<7)
#define VERTEX_FLAG_UV4 (1<<8)
void poly_tsb_calc(vertex *v0, vertex *v1, vertex *v2, vec3d *o_norm, vec3d *o_stan, vec3d *o_ttan);
#endif
+70 -3
View File
@@ -2,13 +2,16 @@
/*
* $Logfile: /Freespace2/code/Graphics/GrOpenGL.cpp $
* $Revision: 2.152 $
* $Date: 2005-12-29 04:33:15 $
* $Author: taylor $
* $Revision: 2.153 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
* Code that uses the OpenGL graphics library
*
* $Log: not supported by cvs2svn $
* Revision 2.152 2005/12/29 04:33:15 taylor
* put texture filter debug message back (was commented out for some reason in phreak's commit)
*
* Revision 2.151 2005/12/29 00:52:57 phreak
* changed around aabitmap calls to accept a "mirror" parameter. defaults to false, and is only true for mirrored briefing icons.
* If the mirror param is true, then the picture is mirrored about the y-axis so left becomes right and vice versa.
@@ -4174,6 +4177,60 @@ void opengl_setup_function_pointers()
// *****************************************************************************
}
extern GLuint normalisationCubeMap;
//Taken from http://www.paulsprojects.net/tutorials/simplebump/simplebump.html
//modified by WMC
bool GenerateNormalisationCubeMap()
{
//some useful variables
int size=32;
float offset=0.5f;
float halfSize=16.0f;
vec3d tempVector;
unsigned char * bytePtr;
unsigned char * data=new unsigned char[32*32*3];
if(!data)
{
//Error("Unable to allocate memory for texture data for cube map\n");
return false;
}
//positive x
bytePtr=data;
//packvec
vec3d packVec = {0.5f, 0.5f, 0.5f};
for(int j=0; j<size; j++)
{
for(int i=0; i<size; i++)
{
tempVector.xyz.x = halfSize;
tempVector.xyz.y = -(j+offset-halfSize);
tempVector.xyz.z = -(i+offset-halfSize);
vm_vec_normalize(&tempVector);
//Packto1
vm_vec_normalize(&tempVector);
vm_vec_scale(&tempVector, 0.5f);
vm_vec_add2(&tempVector, &packVec);
bytePtr[0]=(unsigned char)(tempVector.xyz.x*255);
bytePtr[1]=(unsigned char)(tempVector.xyz.y*255);
bytePtr[2]=(unsigned char)(tempVector.xyz.z*255);
bytePtr+=3;
}
}
glTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, 0, GL_RGBA8, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
delete [] data;
return true;
}
void gr_opengl_init(int reinit)
{
char *ver;
@@ -4338,6 +4395,16 @@ void gr_opengl_init(int reinit)
atexit( gr_opengl_close );
//WMC - Generate normalization bump map
glGenTextures(1, &normalisationCubeMap);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, normalisationCubeMap);
GenerateNormalisationCubeMap();
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
mprintf(("... OpenGL init is complete!\n"));
}
+177 -6
View File
@@ -10,13 +10,21 @@
/*
* $Logfile: /Freespace2/code/Graphics/GrOpenGLTNL.cpp $
* $Revision: 1.34 $
* $Date: 2005-12-16 06:48:28 $
* $Author: taylor $
* $Revision: 1.35 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
* source for doing the fun TNL stuff
*
* $Log: not supported by cvs2svn $
* Revision 1.34 2005/12/16 06:48:28 taylor
* "House Keeping!!"
* - minor cleanup of things that have bothered me at one time or another
* - slight speedup from state switching
* - slightly better specmap handling, fixes a couple of (not frequent) strange and sorta random issues
* - make sure to only disable HTL arb stuff when in HTL mode
* - handle any extra lighting pass before spec pass so the light can be applied properly
*
* Revision 1.33 2005/12/08 15:07:57 taylor
* remove GL_NO_HTL define since it's basically useless at this point and can produced non-functioning builds
* minor cleanup and readability changes
@@ -185,6 +193,7 @@
#include "globalincs/pstypes.h"
#include "graphics/2d.h"
#include "lighting/lighting.h"
#include "graphics/grinternal.h"
#include "graphics/gropengl.h"
#include "graphics/gropenglextension.h"
@@ -203,6 +212,7 @@ extern int VBO_ENABLED;
extern int GLOWMAP;
extern int CLOAKMAP;
extern int SPECMAP;
extern int BUMPMAP;
extern vec3d G3_user_clip_normal;
extern vec3d G3_user_clip_point;
extern int Interp_multitex_cloakmap;
@@ -231,6 +241,13 @@ struct opengl_vertex_buffer
GLuint vbo; // buffer for VBO
uint flags; // FVF
int vbo_size;
#ifdef BUMPMAPPING
//Bumping
float *b_array_list;
GLuint b_vbo;
int b_vbo_size;
int b_stride;
#endif
};
@@ -327,7 +344,11 @@ int gr_opengl_make_buffer(poly_list *list, uint flags)
// defaults
vbp->format = 0;
vbp->vbo = 0;
#ifdef BUMPMAPPING
//Bumping
vbp->b_vbo = 0;
vbp->b_array_list = NULL;
#endif
// don't create vbo for small stuff, performance gain
// FIXME: This little speed increase appears to cause problems with some cards/drivers.
// Disabling it until I can find a solution that works better.
@@ -409,6 +430,65 @@ int gr_opengl_make_buffer(poly_list *list, uint flags)
vbp->array_list = NULL;
}
}
#ifdef BUMPMAPPING
if(flags & VERTEX_FLAG_POSITION)
{
//WMC - since we should know the format, don't bother with setting flags and such.
vbp->b_stride = 3 * sizeof(float);
arsize = 0;
list_size = list_size = vbp->b_stride * list->n_verts;
// allocate the storage list
vbp->b_array_list = (float*)vm_malloc(list_size);
//OH NOES!!!
if (vbp->b_array_list == NULL)
return -1;
vec3d norm, stan, ttan;
//WMC - calc light vector in localspace
//Only know how to do this for one light right now...
float rot_matrix[16];
vec3d lightvec, g_lightvec;
light_get_global_dir(&g_lightvec, 0);
glGetFloatv(GL_MODELVIEW_MATRIX, rot_matrix);
lightvec.xyz.x = g_lightvec.xyz.x * rot_matrix[0]
+g_lightvec.xyz.y * rot_matrix[4]
+g_lightvec.xyz.z * rot_matrix[8];
lightvec.xyz.y = g_lightvec.xyz.x * rot_matrix[1]
+g_lightvec.xyz.y * rot_matrix[5]
+g_lightvec.xyz.z * rot_matrix[9];
lightvec.xyz.z = g_lightvec.xyz.x * rot_matrix[2]
+g_lightvec.xyz.y * rot_matrix[6]
+g_lightvec.xyz.z * rot_matrix[10];
//WMC - I assume all the stuff is in tris
//WMC - Hmm...maybe not.
//Assert(list->n_verts % 3 == 0);
for (i=0; (list->n_verts - i) > 2; i++)
{
poly_tsb_calc(&list->vert[i], &list->vert[i+1], &list->vert[i+2], &norm, &stan, &ttan);
vbp->b_array_list[arsize++] = vm_vec_dotprod(&stan, &lightvec);
vbp->b_array_list[arsize++] = vm_vec_dotprod(&ttan, &lightvec);
vbp->b_array_list[arsize++] = vm_vec_dotprod(&norm, &lightvec);
}
if(make_vbo) {
vbp->b_vbo = opengl_create_vbo(list_size, vbp->b_array_list);
if(vbp->b_vbo) {
vbp->b_vbo_size = list_size;
GL_vertex_data_in += list_size;
vm_free(vbp->b_array_list);
vbp->b_array_list = NULL;
}
}
}
#endif
}
return buffer_num;
@@ -439,6 +519,8 @@ void gr_opengl_destroy_buffer(int idx)
extern float Model_Interp_scale_x,Model_Interp_scale_y,Model_Interp_scale_z;
extern void opengl_default_light_settings(int amb = 1, int emi = 1, int spec = 1);
GLuint normalisationCubeMap = -1;
//start is the first part of the buffer to render, n_prim is the number of primitives, index_list is an index buffer, if index_list == NULL render non-indexed
void gr_opengl_render_buffer(int start, int n_prim, ushort* index_buffer)
{
@@ -481,6 +563,97 @@ void gr_opengl_render_buffer(int start, int n_prim, ushort* index_buffer)
opengl_setup_render_states(r, g, b, a, tmap_type, TMAP_FLAG_TEXTURED);
glColor4ub( (ubyte)r, (ubyte)g, (ubyte)b, (ubyte)a );
// -------- BUMPMAP ------------------------------------------------------- //
//bumpmap?
#ifdef BUMPMAPPING
if(BUMPMAP > -1 && (vbp->flags & VERTEX_FLAG_POSITION))
{
//Bind normal map to texture unit 0
glClientActiveTextureARB(GL_TEXTURE0_ARB+pass_one);
gr_opengl_tcache_set(BUMPMAP, tmap_type, &u_scale, &v_scale, 0, gr_screen.current_bitmap_sx, gr_screen.current_bitmap_sy, 0, pass_one);
glEnable(GL_TEXTURE_2D);
//Bind normalisation cube map to texture unit 1
glClientActiveTextureARB(GL_TEXTURE1_ARB+pass_one);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, normalisationCubeMap);
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
glClientActiveTextureARB(GL_TEXTURE0_ARB+pass_one);
//Set vertex arrays for torus bumpmap
if (vbp->vbo) {
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbp->vbo);
glVertexPointer(3, GL_FLOAT, vbp->stride, (void*)(vbp->stride - (3 * sizeof(float))));
} else {
glVertexPointer(3, GL_FLOAT, vbp->stride, vbp->array_list);
}
glEnableClientState(GL_VERTEX_ARRAY);
//Send texture coords for normal map to unit 0
if (vbp->vbo) {
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbp->vbo);
glTexCoordPointer( 2, GL_FLOAT, vbp->stride, (void*)NULL );
} else {
glTexCoordPointer( 2, GL_FLOAT, vbp->stride, vbp->array_list );
}
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
//Send tangent space light vectors for normalisation to unit 1
glClientActiveTextureARB(GL_TEXTURE1_ARB+pass_one);
if (vbp->b_vbo) {
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbp->b_vbo);
glTexCoordPointer( 3, GL_FLOAT, 0, (void*)NULL );
} else {
glTexCoordPointer( 3, GL_FLOAT, 0, vbp->b_array_list );
}
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glClientActiveTextureARB(GL_TEXTURE0_ARB+pass_one);
//Set up texture environment to do (tex0 dot tex1)*color
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glActiveTextureARB(GL_TEXTURE1_ARB+pass_one);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_DOT3_RGB_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB);
glActiveTextureARB(GL_TEXTURE0_ARB+pass_one);
//WMC - Am I supposed to draw this?
//glDrawElements(GL_TRIANGLES, torus.numIndices, GL_UNSIGNED_INT, torus.indices);
//Disable textures
//glDisable(GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE1_ARB+pass_one);
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
glActiveTextureARB(GL_TEXTURE0_ARB+pass_one);
//disable vertex arrays
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glClientActiveTextureARB(GL_TEXTURE1_ARB+pass_one);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glClientActiveTextureARB(GL_TEXTURE0_ARB+pass_one);
//Return to standard modulate texenv
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
//Enable multiplicative blending
glBlendFunc(GL_DST_COLOR, GL_ZERO);
glEnable(GL_BLEND);
pass_one++; // bump!
opengl_switch_arb(-1,0);
}
#endif
// -------- BUMPMAP ------------------------------------------------------- //
// basic setup of all data and first texture
glClientActiveTextureARB(GL_TEXTURE0_ARB+pass_one);
@@ -573,7 +746,6 @@ void gr_opengl_render_buffer(int start, int n_prim, ushort* index_buffer)
glUnlockArraysEXT();
// -------- End 1st PASS --------------------------------------------------------- //
// -------- Begin lighting pass (conditional but should happen before spec pass) - //
if ( (lighting_is_enabled) && ((n_active_gl_lights-1)/GL_max_lights > 0) ) {
opengl_set_state( TEXTURE_SOURCE_DECAL, ALPHA_BLEND_ALPHA_ADDITIVE, ZBUFFER_TYPE_READ );
@@ -613,7 +785,6 @@ void gr_opengl_render_buffer(int start, int n_prim, ushort* index_buffer)
glUnlockArraysEXT();
}
// -------- End lighting PASS ---------------------------------------------------- //
// -------- Begin 2nd (specular) PASS -------------------------------------------- //
if ( use_spec ) {
// turn all previously used arbs off before the specular pass
+13 -7
View File
@@ -7,13 +7,19 @@
/*
* $Logfile: /Freespace2/code/hud/hudparse.cpp $
* $Revision: 2.40 $
* $Date: 2005-12-28 22:17:01 $
* $Author: taylor $
* $Revision: 2.41 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
* Contains code to parse hud gauge locations
*
* $Log: not supported by cvs2svn $
* Revision 2.40 2005/12/28 22:17:01 taylor
* deal with cf_find_file_location() changes
* add a central parse_modular_table() function which anything can use
* fix up weapon_expl so that it can properly handle modular tables and LOD count changes
* add support for for a fireball TBM (handled a little different than a normal TBM is since it only changes rather than adds)
*
* Revision 2.39 2005/12/21 08:27:37 taylor
* add the name of the modular table about to be parsed to the debug log
* a missing weapon_expl table should just be a note in the debug log rather than a popup warning
@@ -169,11 +175,11 @@
hud_info *current_hud = NULL;
//Storage for the default and ship huds
hud_info default_hud;
hud_info ship_huds[MAX_SHIP_TYPES];
hud_info ship_huds[MAX_SHIP_CLASSES];
#else
hud_info *current_hud = NULL; //If not set, it's NULL. This should always be null outside of a mission.
hud_info default_hud;
hud_info ship_huds[MAX_SHIP_TYPES];
hud_info ship_huds[MAX_SHIP_CLASSES];
#endif
extern int ships_inited; //Need this
@@ -997,7 +1003,7 @@ void parse_hud_gauges_tbl(char* longname)
required_string("#End");
}
for(int i = 0; i < MAX_SHIP_TYPES; i++)
for(int i = 0; i < MAX_SHIP_CLASSES; i++)
{
if(ship_huds[i].loaded)
{
@@ -1065,7 +1071,7 @@ void set_current_hud(int player_ship_num)
#else
static hud_info real_current_hud;
if(player_ship_num >= 0 && player_ship_num < MAX_SHIP_TYPES && ship_huds[player_ship_num].loaded)
if(player_ship_num >= 0 && player_ship_num < MAX_SHIP_CLASSES && ship_huds[player_ship_num].loaded)
{
memcpy(&real_current_hud, &ship_huds[player_ship_num], sizeof(hud_info));
}
+60 -53
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDsquadmsg.cpp $
* $Revision: 2.18 $
* $Date: 2005-10-29 22:09:29 $
* $Author: Goober5000 $
* $Revision: 2.19 $
* $Date: 2005-12-29 08:08:33 $
* $Author: wmcoolmon $
*
* File to control sqaudmate messaging
*
* $Log: not supported by cvs2svn $
* Revision 2.18 2005/10/29 22:09:29 Goober5000
* multiple ship docking implemented for initially docked ships
* --Goober5000
*
* Revision 2.17 2005/10/10 17:21:04 taylor
* remove NO_NETWORK
*
@@ -317,6 +321,7 @@
#include "mission/missionlog.h"
#include "mission/missionmessage.h"
#include "gamesnd/gamesnd.h"
#include "hud/hudsquadmsg.h"
#include "hud/hudtargetbox.h"
#include "ship/subsysdamage.h"
#include "weapon/emp.h"
@@ -480,30 +485,35 @@ char *type_select_str(int n)
return NULL;
}
// data structure to hold character string of commands for comm menu
typedef struct comm_order {
int value; // used to match which command to display on the menu
} comm_order;
// note: If you change this table at all, keep it in sync with version in IgnoreOrdersDlg.cpp
// Also make sure you update comm_order_menu_text below this.
// Also make sure you update MAX_SHIP_ORDERS in HUDsquadmsg.h
comm_order Comm_orders[MAX_SHIP_ORDERS] = {
{ ATTACK_TARGET_ITEM },
{ DISABLE_TARGET_ITEM },
{ DISARM_TARGET_ITEM },
{ DISABLE_SUBSYSTEM_ITEM },
{ PROTECT_TARGET_ITEM },
{ IGNORE_TARGET_ITEM },
{ FORMATION_ITEM },
{ COVER_ME_ITEM },
{ ENGAGE_ENEMY_ITEM },
{ CAPTURE_TARGET_ITEM },
{ REARM_REPAIR_ME_ITEM },
{ ABORT_REARM_REPAIR_ITEM },
{ DEPART_ITEM }
comm_order Comm_orders[] = {
{ "Attack ship", ATTACK_TARGET_ITEM },
{ "Disable ship", DISABLE_TARGET_ITEM },
{ "Disarm ship", DISARM_TARGET_ITEM },
{ "Attack subsys", DISABLE_SUBSYSTEM_ITEM },
{ "Guard ship", PROTECT_TARGET_ITEM },
{ "Ignore ship", IGNORE_TARGET_ITEM },
{ "Form on wing", FORMATION_ITEM },
{ "Guard me", COVER_ME_ITEM },
{ "Attack any", ENGAGE_ENEMY_ITEM },
{ "Dock", CAPTURE_TARGET_ITEM },
{ "Rearm me", REARM_REPAIR_ME_ITEM },
{ "Abort rearm", ABORT_REARM_REPAIR_ITEM },
{ "Depart", DEPART_ITEM },
//WMC - These don't appear for some reason
//support-ship-only
{ "stay near me", STAY_NEAR_ME_ITEM},
{ "stay near ship", STAY_NEAR_TARGET_ITEM},
{ "keep safe dist", KEEP_SAFE_DIST_ITEM},
//All ships
{ "Disable subsys", DISABLE_SUBSYSTEM_ITEM},
};
int Num_valid_comm_orders = 13; //WMC - Number of orders that acutally appear.
int Num_comm_orders = sizeof(Comm_orders)/sizeof(comm_order);
// Text to display on the menu
// Given an index into the Comm_orders array, return the text associated with it.
// MUST BE 1:1 with Comm_orders.
@@ -537,8 +547,8 @@ char *comm_order_hotkey_text( int index )
{
int i;
for (i = 0; i < MAX_SHIP_ORDERS; i++ ) {
if ( Comm_orders[i].value == index )
for (i = 0; i < Num_valid_comm_orders; i++ ) {
if ( Comm_orders[i].def == index )
return comm_order_menu_text(i);
}
@@ -546,9 +556,6 @@ char *comm_order_hotkey_text( int index )
return NULL;
}
// a define of who can receive message
#define CAN_MESSAGE (SIF_FIGHTER | SIF_BOMBER | SIF_CRUISER | SIF_FREIGHTER | SIF_TRANSPORT | SIF_CAPITAL | SIF_SUPPORT | SIF_SUPERCAP | SIF_DRYDOCK | SIF_GAS_MINER | SIF_AWACS | SIF_CORVETTE)
int squadmsg_history_index = 0;
squadmsg_history Squadmsg_history[SQUADMSG_HISTORY_MAX] = { 0 };
@@ -707,7 +714,7 @@ int hud_squadmsg_count_ships( int add_to_menu )
Assert ( shipp->objnum != -1 );
// ships must be able to receive a message
if ( !(Ship_info[shipp->ship_info_index].flags & CAN_MESSAGE) )
if ( Ship_info[shipp->ship_info_index].class_type < 0 || !(Ship_types[Ship_info[shipp->ship_info_index].class_type].ai_bools & STI_AI_ACCEPT_PLAYER_ORDERS) )
continue;
// must be on the same team
@@ -1271,16 +1278,16 @@ int hud_squadmsg_is_target_order_valid(int order, int find_order, ai_info *aip )
// find the comm_menu item for this command
if ( find_order ) {
for (i = 0; i < MAX_SHIP_ORDERS; i++ ) {
if ( Comm_orders[i].value == order )
for (i = 0; i < Num_valid_comm_orders; i++ ) {
if ( Comm_orders[i].def == order )
break;
}
Assert( i < MAX_SHIP_ORDERS );
Assert( i < Num_valid_comm_orders );
order = i;
}
// orders which don't operate on targets are always valid
if ( !(Comm_orders[order].value & TARGET_MESSAGES) )
if ( !(Comm_orders[order].def & TARGET_MESSAGES) )
return 1;
target_objnum = aip->target_objnum;
@@ -1306,7 +1313,7 @@ int hud_squadmsg_is_target_order_valid(int order, int find_order, ai_info *aip )
return 0;
}
if ( (Comm_orders[order].value == ATTACK_TARGET_ITEM )
if ( (Comm_orders[order].def == ATTACK_TARGET_ITEM )
&& (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_BOMB)
&& (Weapons[objp->instance].team != ordering_shipp->team) )
@@ -1330,24 +1337,24 @@ int hud_squadmsg_is_target_order_valid(int order, int find_order, ai_info *aip )
}
// if the order is a disable order or depart, and the ship is disabled, order isn't active
if ( (Comm_orders[order].value == DISABLE_TARGET_ITEM) && (shipp->flags & SF_DISABLED) ){
if ( (Comm_orders[order].def == DISABLE_TARGET_ITEM) && (shipp->flags & SF_DISABLED) ){
return 0;
}
// same as above except for disabled.
if ( (Comm_orders[order].value == DISARM_TARGET_ITEM) && ((shipp->subsys_info[SUBSYSTEM_TURRET].num > 0) && (shipp->subsys_info[SUBSYSTEM_TURRET].current_hits == 0.0f)) ){
if ( (Comm_orders[order].def == DISARM_TARGET_ITEM) && ((shipp->subsys_info[SUBSYSTEM_TURRET].num > 0) && (shipp->subsys_info[SUBSYSTEM_TURRET].current_hits == 0.0f)) ){
return 0;
}
// if order is disable subsystem, and no subsystem targeted or no hits, then order not valid
if ( (Comm_orders[order].value == DISABLE_SUBSYSTEM_ITEM) && ((aip->targeted_subsys == NULL) || (aip->targeted_subsys->current_hits <= 0.0f)) ){
if ( (Comm_orders[order].def == DISABLE_SUBSYSTEM_ITEM) && ((aip->targeted_subsys == NULL) || (aip->targeted_subsys->current_hits <= 0.0f)) ){
return 0;
}
// check based on target's and player's team
if ( (shipp->team == ordering_shipp->team) && (Comm_orders[order].value & FRIENDLY_TARGET_MESSAGES) ){
if ( (shipp->team == ordering_shipp->team) && (Comm_orders[order].def & FRIENDLY_TARGET_MESSAGES) ){
return 1;
} else if ( (shipp->team != ordering_shipp->team) && (Comm_orders[order].value & ENEMY_TARGET_MESSAGES) ){
} else if ( (shipp->team != ordering_shipp->team) && (Comm_orders[order].def & ENEMY_TARGET_MESSAGES) ){
return 1;
} else {
return 0;
@@ -2342,26 +2349,26 @@ void hud_squadmsg_ship_command()
default_orders = ship_get_default_orders_accepted( &Ship_info[Ships[Msg_instance].ship_info_index] );
} else {
default_orders = FIGHTER_MESSAGES;
default_orders = DEFAULT_MESSAGES;
orders = default_orders;
}
First_menu_item = 0;
Num_menu_items = 0;
for ( i = 0; i < MAX_SHIP_ORDERS; i++ ) {
for ( i = 0; i < Num_valid_comm_orders; i++ ) {
// check to see if the comm order should even be added to the menu -- if so, then add it
// the order will be activated if the bit is set for the ship.
if ( default_orders & Comm_orders[i].value ) {
if ( default_orders & Comm_orders[i].def ) {
Assert ( Num_menu_items < MAX_MENU_ITEMS );
strcpy( MsgItems[Num_menu_items].text, comm_order_menu_text(i) );
MsgItems[Num_menu_items].instance = Comm_orders[i].value;
MsgItems[Num_menu_items].instance = Comm_orders[i].def;
MsgItems[Num_menu_items].active = 0;
// check the bit to see if the command is active
if ( orders & Comm_orders[i].value )
if ( orders & Comm_orders[i].def )
MsgItems[Num_menu_items].active = 1;
// if the order cannot be carried out by the ship, then item should be inactive
if ( (Msg_instance != MESSAGE_ALL_FIGHTERS) && !hud_squadmsg_ship_order_valid( Msg_instance, Comm_orders[i].value ) )
if ( (Msg_instance != MESSAGE_ALL_FIGHTERS) && !hud_squadmsg_ship_order_valid( Msg_instance, Comm_orders[i].def ) )
MsgItems[Num_menu_items].active = 0;
// do some other checks to possibly gray out other items.
@@ -2376,7 +2383,7 @@ void hud_squadmsg_ship_command()
ship *shipp;
int partial_accept, all_accept; // value which tells us what to do with menu item
all_accept = Comm_orders[i].value;
all_accept = Comm_orders[i].def;
partial_accept = 0;
for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
@@ -2390,7 +2397,7 @@ void hud_squadmsg_ship_command()
continue;
all_accept &= shipp->orders_accepted; // 'and'ing will either keep this bit set or zero it properly
partial_accept |= (shipp->orders_accepted & Comm_orders[i].value); // 'or'ing will tell us if at least one accepts
partial_accept |= (shipp->orders_accepted & Comm_orders[i].def); // 'or'ing will tell us if at least one accepts
}
if ( !all_accept ) {
@@ -2445,18 +2452,18 @@ void hud_squadmsg_wing_command()
Num_menu_items = 0;
orders = Ships[wingp->ship_index[0]].orders_accepted; // get the orders that the first ship in the wing will accept
for ( i = 0; i < MAX_SHIP_ORDERS; i++ ) {
for ( i = 0; i < Num_valid_comm_orders; i++ ) {
// add the set of default orders to the comm menu. We will currently allow all messages
// to be available in the wing.
if ( default_orders & Comm_orders[i].value ) {
if ( default_orders & Comm_orders[i].def ) {
Assert ( Num_menu_items < MAX_MENU_ITEMS );
strcpy( MsgItems[Num_menu_items].text, comm_order_menu_text(i) );
MsgItems[Num_menu_items].instance = Comm_orders[i].value;
MsgItems[Num_menu_items].instance = Comm_orders[i].def;
MsgItems[Num_menu_items].active = 0;
// possibly grey out the menu item depending on whether or not the "wing" will accept this order
// the "wing" won't accept the order if the first ship in the wing doesn't accept it.
if ( orders & Comm_orders[i].value )
if ( orders & Comm_orders[i].def )
MsgItems[Num_menu_items].active = 1;
// do some other checks to possibly gray out other items.
@@ -2817,9 +2824,9 @@ int hud_query_order_issued(char *name, char *order, char *target)
if (target)
t = get_parse_name_index(target);
for (i=0; i<MAX_SHIP_ORDERS; i++)
for (i=0; i<Num_valid_comm_orders; i++)
if (!stricmp(order, comm_order_menu_text(i)) )
o = Comm_orders[i].value;
o = Comm_orders[i].def;
// Goober5000 - if not found, check compatibility
if (o == -1)
@@ -2827,7 +2834,7 @@ int hud_query_order_issued(char *name, char *order, char *target)
if (!stricmp(order, "Attack my target"))
{
i = 0; // it maps to option 0, "Destroy my target"
o = Comm_orders[i].value;
o = Comm_orders[i].def;
}
}
+18 -6
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDsquadmsg.h $
* $Revision: 2.7 $
* $Date: 2005-07-13 03:15:52 $
* $Author: Goober5000 $
* $Revision: 2.8 $
* $Date: 2005-12-29 08:08:34 $
* $Author: wmcoolmon $
*
* header file for squadmate messaging
*
* $Log: not supported by cvs2svn $
* Revision 2.7 2005/07/13 03:15:52 Goober5000
* remove PreProcDefine #includes in FS2
* --Goober5000
*
* Revision 2.6 2004/08/11 05:06:25 Kazan
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
*
@@ -182,13 +186,21 @@ struct object;
#define DEPART_ITEM (1<<14)
#define DISABLE_SUBSYSTEM_ITEM (1<<15)
//WMC - Just change Comm_orders.
//I hate to leave this MAX_ here, but it's easier for checking flags.
#define MAX_SHIP_ORDERS 13 // Must sync correctly with Comm_orders array in HUDsquadmsg.cpp
// data structure to hold character string of commands for comm menu
typedef flag_def_list comm_order;
extern comm_order Comm_orders[];
extern int Num_comm_orders;
// following defines are the set of possible commands that can be given to a ship. A mission designer
// might not allow some messages
#define FIGHTER_MESSAGES (ATTACK_TARGET_ITEM | DISABLE_TARGET_ITEM | DISARM_TARGET_ITEM | PROTECT_TARGET_ITEM | IGNORE_TARGET_ITEM | FORMATION_ITEM | COVER_ME_ITEM | ENGAGE_ENEMY_ITEM | DEPART_ITEM | DISABLE_SUBSYSTEM_ITEM)
//WMC - Formerly FIGHTER_MESSAGES
#define DEFAULT_MESSAGES (ATTACK_TARGET_ITEM | DISABLE_TARGET_ITEM | DISARM_TARGET_ITEM | PROTECT_TARGET_ITEM | IGNORE_TARGET_ITEM | FORMATION_ITEM | COVER_ME_ITEM | ENGAGE_ENEMY_ITEM | DEPART_ITEM | DISABLE_SUBSYSTEM_ITEM)
/*
#define BOMBER_MESSAGES FIGHTER_MESSAGES // bombers can do the same things as fighters
#define TRANSPORT_MESSAGES (ATTACK_TARGET_ITEM | CAPTURE_TARGET_ITEM | DEPART_ITEM )
@@ -201,7 +213,7 @@ struct object;
#define SUPERCAP_MESSAGES (0) // supercaps ignore you :p
#define SUPPORT_MESSAGES (REARM_REPAIR_ME_ITEM | ABORT_REARM_REPAIR_ITEM | STAY_NEAR_ME_ITEM | STAY_NEAR_TARGET_ITEM | KEEP_SAFE_DIST_ITEM | DEPART_ITEM )
*/
// these messages require an active target. They are also the set of messages
// which cannot be given to a ship when the target is on the same team, or the target
// is not a ship.
+12 -5
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDtarget.cpp $
* $Revision: 2.76 $
* $Date: 2005-12-04 19:07:48 $
* $Revision: 2.77 $
* $Date: 2005-12-29 08:08:34 $
* $Author: wmcoolmon $
*
* C module to provide HUD targeting functions
*
* $Log: not supported by cvs2svn $
* Revision 2.76 2005/12/04 19:07:48 wmcoolmon
* Final commit of codebase
*
* Revision 2.75 2005/10/28 14:52:26 taylor
* hmm, didn't even notice that earlier
*
@@ -2064,7 +2067,7 @@ int hud_target_ship_can_be_scanned(ship *shipp)
}
// ignore ships that don't carry cargo
if ( !(sip->flags & (SIF_CARGO|SIF_FREIGHTER)) ) {
if ( sip->class_type < 0 || !Ship_types[sip->class_type].ship_bools & STI_SHIP_SCANNABLE ) {
return 0;
}
@@ -2629,7 +2632,7 @@ void evaluate_ship_as_closest_target(esct *esct)
}
// bail if harmless
if ( Ship_info[esct->shipp->ship_info_index].flags & SIF_HARMLESS ) {
if ( Ship_info[esct->shipp->ship_info_index].class_type > -1 && !(Ship_types[Ship_info[esct->shipp->ship_info_index].class_type].hud_bools & STI_HUD_TARGET_AS_THREAT)) {
return;
}
@@ -4228,7 +4231,7 @@ void hud_show_hostile_triangle()
}
// always ignore cargo containers and navbuoys
if ( Ship_info[sp->ship_info_index].flags & SIF_HARMLESS ) {
if ( Ship_info[sp->ship_info_index].class_type > -1 && !(Ship_types[Ship_info[sp->ship_info_index].class_type].hud_bools & STI_HUD_SHOW_ATTACK_DIRECTION) ) {
continue;
}
@@ -5534,6 +5537,10 @@ void hud_show_weapons()
weapon_info *wip;
char weapon_name[NAME_LENGTH + 10];
if ( hud_gauge_maybe_flash(HUD_WEAPONS_GAUGE) == i ) {
hud_set_gauge_color(HUD_WEAPONS_GAUGE, HUD_C_BRIGHT);
}
GR_AABITMAP(Weapon_gauges[ballistic_hud_index][2].first_frame, Weapon_gauge_primary_coords[ballistic_hud_index][gr_screen.res][1][0], y);
y+=3; //Unfortunately, the top gauge is a different size than the others
+9 -72
View File
@@ -7,11 +7,15 @@
/*
* $Logfile: /Freespace2/code/iff_defs/iff_defs.cpp $
* $Revision: 1.3 $
* $Date: 2005-09-30 03:40:40 $
* $Author: Goober5000 $
* $Revision: 1.4 $
* $Date: 2005-12-29 08:08:36 $
* $Author: wmcoolmon $
*
* $Log: not supported by cvs2svn $
* Revision 1.3 2005/09/30 03:40:40 Goober5000
* hooray for more work on the iff code
* --Goober5000
*
* Revision 1.2 2005/09/29 04:26:08 Goober5000
* parse fixage
* --Goober5000
@@ -22,7 +26,7 @@
*
*/
#include "globalincs/def_files.h"
#include "iff_defs/iff_defs.h"
#include "parse/parselo.h"
#include "cfile/cfile.h"
@@ -38,73 +42,6 @@ int Iff_traitor;
color Iff_colors[MAX_IFF_COLORS][2];
//=============================================================================
// This is the default table
// Please note that the {\n\}s should be removed from the end of each line and
// the {\"}s should be replaced with {"}s if you intend to use this to format
// your own iff_defs.tbl.
char *default_iff_table = "\
\n\
#IFFs \n\
\n\
;; Every iff_defs.tbl must contain a Traitor entry. Traitors attack one \n\
;; another (required by the dogfighting code) but it is up to you to \n\
;; decide who attacks the traitor or whom else the traitor attacks. \n\
$Traitor IFF: Traitor \n\
\n\
;------------------------ \n\
; Friendly \n\
;------------------------ \n\
$IFF Name: Friendly \n\
$Color: ( 0, 255, 0 ) \n\
$Attacks: ( \"Hostile\" \"Neutral\" \"Traitor\" ) \n\
$Default Ship Flags: ( \"cargo-known\" ) \n\
\n\
;------------------------ \n\
; Hostile \n\
;------------------------ \n\
$IFF Name: Hostile \n\
$Color: ( 255, 0, 0 ) \n\
$Attacks: ( \"Friendly\" \"Neutral\" \"Traitor\" ) \n\
+Sees Friendly As: ( 255, 0, 0 ) \n\
+Sees Hostile As: ( 0, 255, 0 ) \n\
\n\
;------------------------ \n\
; Neutral \n\
;------------------------ \n\
$IFF Name: Neutral \n\
$Color: ( 255, 0, 0 ) \n\
$Attacks: ( \"Friendly\" \"Traitor\" ) \n\
+Sees Friendly As: ( 255, 0, 0 ) \n\
+Sees Hostile As: ( 0, 255, 0 ) \n\
+Sees Neutral As: ( 0, 255, 0 ) \n\
\n\
;------------------------ \n\
; Unknown \n\
;------------------------ \n\
$IFF Name: Unknown \n\
$Color: ( 255, 0, 255 ) \n\
$Attacks: ( \"Hostile\" ) \n\
+Sees Neutral As: ( 0, 255, 0 ) \n\
+Sees Traitor As: ( 0, 255, 0 ) \n\
$Flags: ( \"exempt from all teams at war\" ) \n\
\n\
;------------------------ \n\
; Traitor \n\
;------------------------ \n\
$IFF Name: Traitor \n\
$Color: ( 255, 0, 0 ) \n\
$Attacks: ( \"Friendly\" \"Hostile\" \"Neutral\" \"Traitor\" ) \n\
+Sees Friendly As: ( 255, 0, 0 ) \n\
\n\
#End \n\
";
//=============================================================================
// borrowed from ship.cpp, ship_iff_init_colors
int iff_get_alpha_value(bool alpha_on)
{
@@ -192,7 +129,7 @@ void iff_init()
if (table_exists)
read_file_text("iff_defs.tbl");
else
read_file_text_from_array(default_iff_table);
read_file_text_from_array(defaults_get_file("iff_defs.tbl"));
reset_parse();
+14 -11
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Io/KeyControl.cpp $
* $Revision: 2.66 $
* $Date: 2005-12-04 19:07:48 $
* $Revision: 2.67 $
* $Date: 2005-12-29 08:08:36 $
* $Author: wmcoolmon $
*
* Routines to read and deal with keyboard input.
*
* $Log: not supported by cvs2svn $
* Revision 2.66 2005/12/04 19:07:48 wmcoolmon
* Final commit of codebase
*
* Revision 2.65 2005/11/24 08:46:11 Goober5000
* * cleaned up mission_do_departure
* * fixed a hidden crash (array index being -1; would only
@@ -75,7 +78,7 @@
* --Goober5000
*
* Revision 2.51 2005/04/25 00:23:23 wmcoolmon
* MAX_SHIP_TYPES > Num_ship_types
* MAX_SHIP_CLASSES > Num_ship_classes
*
* Revision 2.50 2005/04/20 04:34:01 phreak
* get the cheat keys for "force weapon" working again
@@ -915,11 +918,11 @@ void debug_cycle_player_ship(int delta)
ship_info *sip;
while ( TRUE ) {
si_index += delta;
if ( si_index > Num_ship_types ){
if ( si_index > Num_ship_classes ){
si_index = 0;
}
if ( si_index < 0 ){
si_index = Num_ship_types - 1;
si_index = Num_ship_classes - 1;
}
sip = &Ship_info[si_index];
if ( sip->flags & SIF_PLAYER_SHIP ){
@@ -928,7 +931,7 @@ void debug_cycle_player_ship(int delta)
// just in case
sanity++;
if ( sanity > Num_ship_types ){
if ( sanity > Num_ship_classes ){
break;
}
}
@@ -960,10 +963,10 @@ void debug_cycle_targeted_ship(int delta)
while ( TRUE ) {
si_index += delta;
if ( si_index > Num_ship_types )
if ( si_index > Num_ship_classes )
si_index = 0;
if ( si_index < 0 )
si_index = Num_ship_types-1;
si_index = Num_ship_classes-1;
sip = &Ship_info[si_index];
@@ -979,7 +982,7 @@ void debug_cycle_targeted_ship(int delta)
// just in case
sanity++;
if ( sanity > Num_ship_types )
if ( sanity > Num_ship_classes )
break;
}
@@ -2080,7 +2083,7 @@ void game_process_cheats(int k)
add.xyz.y += frand_range(-700.0f, 700.0f);
add.xyz.z += frand_range(-700.0f, 700.0f);
int objnum = ship_create(&vmd_identity_matrix, &add, Num_ship_types - 1);
int objnum = ship_create(&vmd_identity_matrix, &add, Num_ship_classes - 1);
if(objnum >= 0){
int collided;
@@ -2153,7 +2156,7 @@ void game_process_cheats(int k)
add.xyz.y = frand_range(-1000.0f, 1000.0f);
add.xyz.z = frand_range(-1000.0f, 1000.0f);
int objnum = ship_create(&vmd_identity_matrix, &add, Num_ship_types - 1);
int objnum = ship_create(&vmd_identity_matrix, &add, Num_ship_classes - 1);
if(objnum >= 0){
shipfx_warpin_start(&Objects[objnum]);
+10 -4
View File
@@ -9,11 +9,14 @@
/*
* $Logfile: /Freespace2/code/lab/lab.cpp $
* $Revision: 1.24 $
* $Date: 2005-12-04 19:12:53 $
* $Revision: 1.25 $
* $Date: 2005-12-29 08:08:36 $
* $Author: wmcoolmon $
*
* $Log: not supported by cvs2svn $
* Revision 1.24 2005/12/04 19:12:53 wmcoolmon
* Post-final commit
*
* Revision 1.22 2005/10/30 06:44:57 wmcoolmon
* Codebase commit - nebula.tbl, scripting, new dinky explosion/shockwave stuff, moving muzzle flashes
*
@@ -90,7 +93,7 @@ void set_ship_flags_ship(ship_info *sip)
soc[i++]->SetFlag(&sip->flags, SIF_ESCAPEPOD);
soc[i++]->SetFlag(&sip->flags, SIF_GAS_MINER);
soc[i++]->SetFlag(&sip->flags, SIF_AWACS);
soc[i++]->SetFlag(&sip->flags, SIF_SHIP_CLASS_STEALTH);
soc[i++]->SetFlag(&sip->flags, SIF_STEALTH);
soc[i++]->SetFlag(&sip->flags, SIF_SUPERCAP);
soc[i++]->SetFlag(&sip->flags, SIF_KNOSSOS_DEVICE);
soc[i++]->SetFlag(&sip->flags, SIF_DRYDOCK);
@@ -214,6 +217,8 @@ void set_ship_variables_ship(ship_info *sip)
svt[i++]->SetText(sip->name);
svt[i]->SetText(sip->species);
svt[i++]->SetSaveLoc(&sip->species, T_ST_ONENTER, Num_species-1, 0);
svt[i]->SetText(sip->class_type);
svt[i++]->SetSaveLoc(&sip->class_type, T_ST_ONENTER, Ship_types.size()-1, 0);
SVW_SET_SI_VAR(density);
SVW_SET_SI_VAR(damp);
@@ -292,6 +297,7 @@ void ship_variables_window(Button *caller)
svt[i] = (Text*) cwp->AddChild(new Text("Ship name", "<None>", SVW_RIGHTX, y, SVW_RIGHTWIDTH, 12));
y += svt[i++]->GetHeight() + 5;
SVW_ADD_TEXT("Species");
SVW_ADD_TEXT("Type");
//Physics
SVW_ADD_TEXT_HEADER("Physics");
@@ -477,7 +483,7 @@ void ships_make_window(Button* caller)
//Now add the ships
std::string lod_name;
char buf[8];
for(i = 0; i < Num_ship_types; i++)
for(i = 0; i < Num_ship_classes; i++)
{
if(Ship_info[i].species >= 0 && Ship_info[i].species < Num_species)
stip = species_nodes[Ship_info[i].species];
+10 -7
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/MenuUI/Barracks.cpp $
* $Revision: 2.28 $
* $Date: 2005-10-10 17:21:05 $
* $Author: taylor $
* $Revision: 2.29 $
* $Date: 2005-12-29 08:08:36 $
* $Author: wmcoolmon $
*
* C file for implementing barracks section
*
* $Log: not supported by cvs2svn $
* Revision 2.28 2005/10/10 17:21:05 taylor
* remove NO_NETWORK
*
* Revision 2.27 2005/09/22 19:16:48 taylor
* fix screen update of pilot list when you delete one of them
*
@@ -227,7 +230,7 @@
int delete_pilot_file( char *pilot_name, int single ); // manage_pilot.cpp
// stats defines
//#define NUM_STAT_LINES (21 + MAX_SHIP_TYPES) // Goober5000
//#define NUM_STAT_LINES (21 + MAX_SHIP_CLASSES) // Goober5000
#define STAT_COLUMN1_W 40
#define STAT_COLUMN2_W 10
@@ -492,7 +495,7 @@ void barracks_squad_change_popup();
void barracks_init_stats(scoring_struct *stats)
{
int Max_stat_lines = Num_ship_types + 21;
int Max_stat_lines = Num_ship_classes + 21;
int i;
float f;
@@ -631,9 +634,9 @@ void barracks_init_stats(scoring_struct *stats)
Num_stat_lines++;
// Goober5000 - make sure we have room for all ships
Assert((Num_stat_lines + Num_ship_types) < Max_stat_lines);
Assert((Num_stat_lines + Num_ship_classes) < Max_stat_lines);
for (i=0; i<Num_ship_types; i++) {
for (i=0; i<Num_ship_classes; i++) {
if (stats->kills[i]) {
Assert(Num_stat_lines < Max_stat_lines);
+14 -34
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/MenuUI/TechMenu.cpp $
* $Revision: 2.35 $
* $Date: 2005-12-21 08:24:51 $
* $Author: taylor $
* $Revision: 2.36 $
* $Date: 2005-12-29 08:08:36 $
* $Author: wmcoolmon $
*
* C module that contains functions to drive the Tech Menu user interface
*
* $Log: not supported by cvs2svn $
* Revision 2.35 2005/12/21 08:24:51 taylor
* allow the show-all hotkey to work on all techroom tabs
* address a couple of possible memory leak issues that could have come up in the future
*
* Revision 2.34 2005/12/06 03:17:48 taylor
* cleanup some debug log messages:
* note that a nprintf() with "Warning" or "General" is basically the same thing as mprintf()
@@ -902,31 +906,6 @@ void techroom_ships_render(float frametime)
gr_set_clip(Tech_ship_display_coords[gr_screen.res][SHIP_X_COORD], Tech_ship_display_coords[gr_screen.res][SHIP_Y_COORD], Tech_ship_display_coords[gr_screen.res][SHIP_W_COORD], Tech_ship_display_coords[gr_screen.res][SHIP_H_COORD]);
// render the ship
#ifdef MULTIPLAYER_BETA_BUILD
if((sip->flags & SIF_SUPERCAP) || (sip->flags & SIF_DRYDOCK)) {
gr_set_color_fast(&Color_bright);
gr_string(Tech_ship_display_coords[gr_screen.res][SHIP_X_COORD], Tech_ship_display_coords[gr_screen.res][SHIP_Y_COORD] + 50, NOX("No soup for you!"));
} else {
g3_start_frame(1);
g3_set_view_matrix(&sip->closeup_pos, &vmd_identity_matrix, sip->closeup_zoom * 1.3f);
// lighting for techroom
light_reset();
vec3d light_dir = vmd_zero_vector;
light_dir.y = 1.0f;
light_add_directional(&light_dir, 0.85f, 1.0f, 1.0f, 1.0f);
// light_filter_reset();
light_rotate_all();
// lighting for techroom
model_clear_instance(Techroom_ship_modelnum);
model_set_detail_level(0);
model_render(Techroom_ship_modelnum, &Techroom_ship_orient, &vmd_zero_vector, MR_NO_LIGHTING | MR_LOCK_DETAIL | MR_AUTOCENTER | MR_NO_FOGGING);
g3_end_frame();
}
#else
g3_start_frame(1);
g3_set_view_matrix(&sip->closeup_pos, &vmd_identity_matrix, sip->closeup_zoom * 1.3f);
@@ -952,7 +931,6 @@ void techroom_ships_render(float frametime)
}
g3_end_frame();
#endif
gr_reset_clip();
}
@@ -1181,15 +1159,17 @@ void techroom_change_tab(int num)
// load ship info if necessary
if ( Ships_loaded == 0 ) {
if (Ship_list == NULL) {
Ship_list = new tech_list_entry[Num_ship_types];
Ship_list = new tech_list_entry[Num_ship_classes];
if (Ship_list == NULL)
Error(LOCATION, "Couldn't init ships list!");
}
Ship_list_size = 0;
for (i=0; i<Num_ship_types; i++) {
if (Techroom_show_all || (Ship_info[i].flags & mask)) {
for (i=0; i<Num_ship_classes; i++)
{
if (Techroom_show_all || (Ship_info[i].flags & mask))
{
// this ship should be displayed, fill out the entry struct
Ship_list[Ship_list_size].bitmap = -1;
Ship_list[Ship_list_size].index = i;
@@ -1633,7 +1613,7 @@ void techroom_init()
help_overlay_set_state(TECH_ROOM_OVERLAY, 0);
// setup slider
Tech_slider.create(&Ui_window, Tech_slider_coords[gr_screen.res][SHIP_X_COORD], Tech_slider_coords[gr_screen.res][SHIP_Y_COORD], Tech_slider_coords[gr_screen.res][SHIP_W_COORD], Tech_slider_coords[gr_screen.res][SHIP_H_COORD], Num_ship_types, Tech_slider_filename[gr_screen.res], &tech_scroll_list_up, &tech_scroll_list_down, &tech_ship_scroll_capture);
Tech_slider.create(&Ui_window, Tech_slider_coords[gr_screen.res][SHIP_X_COORD], Tech_slider_coords[gr_screen.res][SHIP_Y_COORD], Tech_slider_coords[gr_screen.res][SHIP_W_COORD], Tech_slider_coords[gr_screen.res][SHIP_H_COORD], Num_ship_classes, Tech_slider_filename[gr_screen.res], &tech_scroll_list_up, &tech_scroll_list_down, &tech_ship_scroll_capture);
Cur_anim_instance = NULL;
@@ -1948,7 +1928,7 @@ void tech_reset_to_default()
int i;
// ships
for (i=0; i<Num_ship_types; i++)
for (i=0; i<Num_ship_classes; i++)
{
if (Ship_info[i].flags2 & SIF2_DEFAULT_IN_TECH_DATABASE)
Ship_info[i].flags |= SIF_IN_TECH_DATABASE;
+40 -35
View File
@@ -9,13 +9,18 @@
/*
* $Logfile: /Freespace2/code/Mission/MissionCampaign.cpp $
* $Revision: 2.35 $
* $Date: 2005-10-30 20:03:39 $
* $Author: taylor $
* $Revision: 2.36 $
* $Date: 2005-12-29 08:08:36 $
* $Author: wmcoolmon $
*
* source for dealing with campaigns
*
* $Log: not supported by cvs2svn $
* Revision 2.35 2005/10/30 20:03:39 taylor
* add a bunch of Assert()'s and NULL checks to either help debug or avoid errors
* fix Mantis bug #381
* fix a small issue with the starfield bitmap removal sexp since it would read one past the array size
*
* Revision 2.34 2005/10/30 19:21:45 wmcoolmon
* Return an error if mission_campaign_next_mission() is called when the campaign has no missions
*
@@ -54,7 +59,7 @@
* stuff_byte to stuff_ubyte; does the same thing, but with a better name.
*
* Revision 2.23 2005/04/25 00:25:15 wmcoolmon
* MAX_SHIP_TYPES > Num_ship_types
* MAX_SHIP_CLASSES > Num_ship_classes
*
* Revision 2.22 2005/04/12 05:26:36 taylor
* many, many compiler warning and header fixes (Jens Granseuer)
@@ -390,7 +395,7 @@ char *campaign_types[MAX_CAMPAIGN_TYPES] =
// modules local variables to deal with getting new ships/weapons available to the player
int Num_granted_ships, Num_granted_weapons; // per mission counts of new ships and weapons
int Granted_ships[MAX_SHIP_TYPES];
int Granted_ships[MAX_SHIP_CLASSES];
int Granted_weapons[MAX_WEAPON_TYPES];
// variables to control the UI stuff for loading campaigns
@@ -613,11 +618,11 @@ void mission_campaign_build_list( int multiplayer )
// gets optional ship/weapon information
void mission_campaign_get_sw_info()
{
int i, count, ship_list[MAX_SHIP_TYPES], weapon_list[MAX_WEAPON_TYPES];
int i, count, ship_list[MAX_SHIP_CLASSES], weapon_list[MAX_WEAPON_TYPES];
// set allowable ships to the SIF_PLAYER_SHIPs
memset( Campaign.ships_allowed, 0, sizeof(Campaign.ships_allowed) );
for (i = 0; i < Num_ship_types; i++ ) {
for (i = 0; i < Num_ship_classes; i++ ) {
if ( Ship_info[i].flags & SIF_PLAYER_SHIP )
Campaign.ships_allowed[i] = 1;
}
@@ -626,10 +631,10 @@ void mission_campaign_get_sw_info()
Campaign.weapons_allowed[i] = 1;
if ( optional_string("+Starting Ships:") ) {
for (i = 0; i < Num_ship_types; i++ )
for (i = 0; i < Num_ship_classes; i++ )
Campaign.ships_allowed[i] = 0;
count = stuff_int_list(ship_list, MAX_SHIP_TYPES, SHIP_INFO_TYPE);
count = stuff_int_list(ship_list, MAX_SHIP_CLASSES, SHIP_INFO_TYPE);
// now set the array elements stating which ships we are allowed
for (i = 0; i < count; i++ ) {
@@ -1032,10 +1037,10 @@ int mission_campaign_savefile_save()
cfwrite_int( Campaign.loop_enabled, fp );
// write out the information for ships/weapons which this player is allowed to use
cfwrite_int(Num_ship_types, fp);
cfwrite_int(Num_ship_classes, fp);
cfwrite_int(Num_weapon_types, fp);
for ( i = 0; i < Num_ship_types; i++ ){
for ( i = 0; i < Num_ship_classes; i++ ){
cfwrite_char( Campaign.ships_allowed[i], fp );
cfwrite_string_len( Ship_info[i].name, fp );
}
@@ -1077,7 +1082,7 @@ int mission_campaign_savefile_save()
memcpy( &stats_tmp, &Campaign.missions[i].stats, sizeof(scoring_struct) );
// swap values if needed
for ( j = 0; j < Num_ship_types; j++ )
for ( j = 0; j < Num_ship_classes; j++ )
stats_tmp.kills[j] = INTEL_INT(Campaign.missions[i].stats.kills[j]);
stats_tmp.score = INTEL_INT(Campaign.missions[i].stats.score);
@@ -1117,7 +1122,7 @@ int mission_campaign_savefile_save()
cfwrite_int(Intel_info_size, fp);
// write all ship flags out
for (i=0; i<Num_ship_types; i++) {
for (i=0; i<Num_ship_classes; i++) {
out = (Ship_info[i].flags & SIF_IN_TECH_DATABASE) ? (ubyte)1 : (ubyte)0;
cfwrite_ubyte(out, fp);
}
@@ -1142,7 +1147,7 @@ int mission_campaign_savefile_save()
cfwrite_string_len(Player_loadout.last_modified, fp);
// write ship pool
for ( i = 0; i < Num_ship_types; i++ ) {
for ( i = 0; i < Num_ship_classes; i++ ) {
cfwrite_int(Player_loadout.ship_pool[i], fp);
}
@@ -1178,7 +1183,7 @@ int mission_campaign_savefile_save()
cfwrite_int(0, fp);
}
int total = MAX_SHIP_TYPES;
int total = MAX_SHIP_CLASSES;
while (total && !pl->stats.kills[total - 1]){ // find last used element
total--;
}
@@ -1312,12 +1317,12 @@ int mission_campaign_savefile_load( char *cfilename, player *pl )
int id, version, i, num, j, num_stats_blocks, idx;
int type_sig;
ubyte sw;
char s_name[MAX_SHIP_TYPES][NAME_LENGTH];
char s_name[MAX_SHIP_CLASSES][NAME_LENGTH];
char w_name[MAX_WEAPON_TYPES][NAME_LENGTH];
int n_ships;
CFILE *fp;
int force_update = 0;
int kill_count[MAX_SHIP_TYPES];
int kill_count[MAX_SHIP_CLASSES];
int k_count;
int sid = -1, wid = -1;
int set_defaults = 1; // should we zero out tech values or not (yes by default)
@@ -1420,7 +1425,7 @@ int mission_campaign_savefile_load( char *cfilename, player *pl )
// load information about ships/weapons allowed
int ship_count, weapon_count;
// if earlier than mission disk version, use old MAX_SHIP_TYPES, otherwise read from the file
// if earlier than mission disk version, use old MAX_SHIP_CLASSES, otherwise read from the file
if(version <= CAMPAIGN_INITIAL_RELEASE_FILE_VERSION){
ship_count = CAMPAIGN_SAVEFILE_MAX_SHIPS_OLD;
weapon_count = CAMPAIGN_SAVEFILE_MAX_WEAPONS_OLD;
@@ -1429,7 +1434,7 @@ int mission_campaign_savefile_load( char *cfilename, player *pl )
weapon_count = cfread_int(fp);
}
Assert(ship_count <= MAX_SHIP_TYPES);
Assert(ship_count <= MAX_SHIP_CLASSES);
Assert(weapon_count <= MAX_WEAPON_TYPES);
for ( i = 0; i < ship_count; i++ ){
@@ -1587,7 +1592,7 @@ int mission_campaign_savefile_load( char *cfilename, player *pl )
// zero out all data so that we can start anew
if (set_defaults) {
for (idx=0; idx<MAX_SHIP_TYPES; idx++) {
for (idx=0; idx<MAX_SHIP_CLASSES; idx++) {
Ship_info[idx].flags &= ~SIF_IN_TECH_DATABASE;
}
@@ -1791,7 +1796,7 @@ int mission_campaign_savefile_load( char *cfilename, player *pl )
// read in number of ships that were written to the file
n_ships = cfread_int( fp );
Assert( n_ships <= MAX_SHIP_TYPES );
Assert( n_ships <= MAX_SHIP_CLASSES );
// read in ship names
for ( i = 0; i < n_ships; i++ ) {
@@ -1799,7 +1804,7 @@ int mission_campaign_savefile_load( char *cfilename, player *pl )
}
}
const int ORIG_MAX_SHIP_TYPES = 130;
const int ORIG_MAX_SHIP_CLASSES = 130;
int read_size = 0;
// figure out the size of data we need to read each pass
@@ -1807,23 +1812,23 @@ int mission_campaign_savefile_load( char *cfilename, player *pl )
// basic size, start with current and subtract what we don't want
read_size = sizeof(scoring_struct);
// if MAX_SHIP_TYPES has changed from what we expect then come up with a modified size:
// new_max_ship_types - old_max_ship_types * sizeof(int) * 3-times-MAX_SHIP_TYPES-is-used
if (MAX_SHIP_TYPES > ORIG_MAX_SHIP_TYPES)
read_size -= (MAX_SHIP_TYPES - ORIG_MAX_SHIP_TYPES) * sizeof(int) * 3;
// if MAX_SHIP_CLASSES has changed from what we expect then come up with a modified size:
// new_max_ship_types - old_max_ship_types * sizeof(int) * 3-times-MAX_SHIP_CLASSES-is-used
if (MAX_SHIP_CLASSES > ORIG_MAX_SHIP_CLASSES)
read_size -= (MAX_SHIP_CLASSES - ORIG_MAX_SHIP_CLASSES) * sizeof(int) * 3;
} else {
// basic size, start with current and subtract what we don't want
read_size = sizeof(scoring_struct);
// we moved to int from ushort for kills[MAX_SHIP_TYPES], m_kills[MAX_SHIP_TYPES] & m_okKills[MAX_SHIP_TYPES]
read_size -= (sizeof(int) - sizeof(ushort)) * 3 * ORIG_MAX_SHIP_TYPES;
// we moved to int from ushort for kills[MAX_SHIP_CLASSES], m_kills[MAX_SHIP_CLASSES] & m_okKills[MAX_SHIP_CLASSES]
read_size -= (sizeof(int) - sizeof(ushort)) * 3 * ORIG_MAX_SHIP_CLASSES;
// we moved to int from ushort for m_dogfight_kills[MAX_PLAYERS]
read_size -= (sizeof(int) - sizeof(ushort)) * MAX_PLAYERS;
// if MAX_SHIP_TYPES has changed from what we expect then come up with a modified size:
// new_max_ship_types - old_max_ship_types * sizeof(ushort) * 3-times-MAX_SHIP_TYPES-is-used
// if MAX_SHIP_CLASSES has changed from what we expect then come up with a modified size:
// new_max_ship_types - old_max_ship_types * sizeof(ushort) * 3-times-MAX_SHIP_CLASSES-is-used
// we moved from ushort to int for these 3 so take that into account
if (MAX_SHIP_TYPES > ORIG_MAX_SHIP_TYPES)
read_size -= (MAX_SHIP_TYPES - ORIG_MAX_SHIP_TYPES) * (sizeof(int) - sizeof(ushort)) * 3;
if (MAX_SHIP_CLASSES > ORIG_MAX_SHIP_CLASSES)
read_size -= (MAX_SHIP_CLASSES - ORIG_MAX_SHIP_CLASSES) * (sizeof(int) - sizeof(ushort)) * 3;
}
Assert( read_size );
@@ -1835,11 +1840,11 @@ int mission_campaign_savefile_load( char *cfilename, player *pl )
if (version >= 2) {
// copy current values to temp and swap if needed
for ( j = 0; j < MAX_SHIP_TYPES; j++ )
for ( j = 0; j < MAX_SHIP_CLASSES; j++ )
kill_count[j] = INTEL_INT(Campaign.missions[num].stats.kills[j]);
// translate to new tables
for ( j = 0; j < MAX_SHIP_TYPES; j++ ) {
for ( j = 0; j < MAX_SHIP_CLASSES; j++ ) {
idx = ship_info_lookup(s_name[j]);
Campaign.missions[num].stats.kills[idx] = kill_count[j];
}
@@ -2636,7 +2641,7 @@ void mission_campaign_save_persistent( int type, int sindex )
// based on the type of information, save it off for possible saving into the campsign
// savefile when the mission is over
if ( type == CAMPAIGN_PERSISTENT_SHIP ) {
Assert( Num_granted_ships < MAX_SHIP_TYPES );
Assert( Num_granted_ships < MAX_SHIP_CLASSES );
Granted_ships[Num_granted_ships] = sindex;
Num_granted_ships++;
} else if ( type == CAMPAIGN_PERSISTENT_WEAPON ) {
+8 -4
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Mission/MissionCampaign.h $
* $Revision: 2.8 $
* $Date: 2005-07-13 03:25:59 $
* $Author: Goober5000 $
* $Revision: 2.9 $
* $Date: 2005-12-29 08:08:36 $
* $Author: wmcoolmon $
*
* header file for dealing with campaigns
*
* $Log: not supported by cvs2svn $
* Revision 2.8 2005/07/13 03:25:59 Goober5000
* remove PreProcDefine #includes in FS2
* --Goober5000
*
* Revision 2.7 2004/10/31 21:53:24 taylor
* new pilot code support, no-multiplayer and compiler warning fixes, center mouse cursor for redalert missions
*
@@ -407,7 +411,7 @@ typedef struct campaign {
int loop_reentry; // mission number to return to after loop is finished
int realign_required; // are any missions missing alignment info? (Fred)
int num_players; // valid in multiplayer campaigns -- number of players campaign supports.
ubyte ships_allowed[MAX_SHIP_TYPES]; // which ships the player can use
ubyte ships_allowed[MAX_SHIP_CLASSES]; // which ships the player can use
ubyte weapons_allowed[MAX_WEAPON_TYPES]; // which weapons the player can use
cmission missions[MAX_CAMPAIGN_MISSIONS]; // decription of the missions
} campaign;
+9 -9
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Mission/MissionHotKey.cpp $
* $Revision: 2.11 $
* $Date: 2005-10-29 22:09:29 $
* $Author: Goober5000 $
* $Revision: 2.12 $
* $Date: 2005-12-29 08:08:36 $
* $Author: wmcoolmon $
*
* C module for the Hotkey selection screen
*
* $Log: not supported by cvs2svn $
* Revision 2.11 2005/10/29 22:09:29 Goober5000
* multiple ship docking implemented for initially docked ships
* --Goober5000
*
* Revision 2.10 2005/07/02 19:43:54 taylor
* ton of non-standard resolution fixes
*
@@ -800,12 +804,8 @@ int hotkey_build_team_listing(int team, int y)
shipnum = Objects[so->objnum].instance;
// filter out cargo containers, navbouys, etc
if ( (Ship_info[Ships[shipnum].ship_info_index].flags & SIF_HARMLESS) && !(Ship_info[Ships[shipnum].ship_info_index].flags & SIF_ESCAPEPOD) )
continue;
// don't process non-ships (dunno what that would be, though).
if (Ship_info[Ships[shipnum].ship_info_index].flags & SIF_NO_SHIP_TYPE)
// filter out cargo containers, navbouys, etc, and non-ships
if ( Ship_info[Ships[shipnum].ship_info_index].class_type < 0 || !(Ship_types[Ship_info[Ships[shipnum].ship_info_index].class_type].hud_bools & STI_HUD_HOTKEY_ON_LIST ))
continue;
// don't process ships invisible to sensors, dying or departing
+24 -21
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Mission/MissionParse.cpp $
* $Revision: 2.132 $
* $Date: 2005-12-29 00:56:45 $
* $Author: phreak $
* $Revision: 2.133 $
* $Date: 2005-12-29 08:08:36 $
* $Author: wmcoolmon $
*
* main upper level code for parsing stuff
*
* $Log: not supported by cvs2svn $
* Revision 2.132 2005/12/29 00:56:45 phreak
* loading code for flipped briefing icons.
*
* Revision 2.131 2005/12/28 22:31:03 taylor
* unused variable (to make GCC shut up)
*
@@ -1056,7 +1059,7 @@ char *Ai_behavior_names[MAX_AI_BEHAVIORS] = {
char *Cargo_names[MAX_CARGO];
char Cargo_names_buf[MAX_CARGO][NAME_LENGTH];
char *Ship_class_names[MAX_SHIP_TYPES]; // to be filled in from Ship_info array
char *Ship_class_names[MAX_SHIP_CLASSES]; // to be filled in from Ship_info array
char *Icon_names[MAX_BRIEF_ICONS] = {
"Fighter", "Fighter Wing", "Cargo", "Cargo Wing", "Largeship",
@@ -1362,7 +1365,7 @@ void parse_mission_info(mission *pm)
// for each species, store whether support is available
for (int species = 0; species < Num_species; species++)
{
for (int ship_class = 0; ship_class < Num_ship_types; ship_class++)
for (int ship_class = 0; ship_class < Num_ship_classes; ship_class++)
{
if ((Ship_info[ship_class].flags & SIF_SUPPORT) && (Ship_info[ship_class].species == species))
{
@@ -1563,7 +1566,7 @@ void parse_player_info(mission *pm)
void parse_player_info2(mission *pm)
{
char str[NAME_LENGTH];
int nt, i, total, list[MAX_SHIP_TYPES * 2], list2[MAX_WEAPON_TYPES * 2], num_starting_wings;
int nt, i, total, list[MAX_SHIP_CLASSES * 2], list2[MAX_WEAPON_TYPES * 2], num_starting_wings;
team_data *ptr;
char starting_wings[MAX_STARTING_WINGS][NAME_LENGTH];
@@ -1578,7 +1581,7 @@ void parse_player_info2(mission *pm)
stuff_string( Player_start_shipname, F_NAME, NULL );
required_string("$Ship Choices:");
total = stuff_int_list(list, MAX_SHIP_TYPES * 2, SHIP_INFO_TYPE);
total = stuff_int_list(list, MAX_SHIP_CLASSES * 2, SHIP_INFO_TYPE);
Assert(!(total & 0x01)); // make sure we have an even count
@@ -1610,13 +1613,13 @@ void parse_player_info2(mission *pm)
// do we do? choose the first allowable one?
if (Game_mode & GM_CAMPAIGN_MODE || ((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER))) {
if ( !(Campaign.ships_allowed[ptr->default_ship]) ) {
for (i = 0; i < MAX_SHIP_TYPES; i++ ) {
for (i = 0; i < MAX_SHIP_CLASSES; i++ ) {
if ( Campaign.ships_allowed[ptr->default_ship] ) {
ptr->default_ship = i;
break;
}
}
Assert( i < MAX_SHIP_TYPES );
Assert( i < MAX_SHIP_CLASSES );
}
}
}
@@ -1901,7 +1904,7 @@ void parse_briefing(mission *pm)
Assert((team_index >= 0) && (team_index < MAX_TEAM_NAMES));
bi->team = 1 << team_index;
find_and_stuff("$class:", &bi->ship_class, F_NAME, Ship_class_names, Num_ship_types, "ship class");
find_and_stuff("$class:", &bi->ship_class, F_NAME, Ship_class_names, Num_ship_classes, "ship class");
required_string("$pos:");
stuff_vector(&bi->pos);
@@ -2797,7 +2800,7 @@ int parse_object(mission *pm, int flag, p_object *objp)
error_display(0, NOX("Redundant ship name: %s\n"), objp->name);
find_and_stuff("$Class:", &objp->ship_class, F_NAME, Ship_class_names, Num_ship_types, "ship class");
find_and_stuff("$Class:", &objp->ship_class, F_NAME, Ship_class_names, Num_ship_classes, "ship class");
if (objp->ship_class < 0) {
Warning(LOCATION, "Ship \"%s\" has an invalid ship type (ships.tbl probably changed). Making it type 0", objp->name);
@@ -2986,7 +2989,7 @@ int parse_object(mission *pm, int flag, p_object *objp)
}
// set certain flags that used to be in ship_info - Goober5000
if (Ship_info[objp->ship_class].flags & SIF_SHIP_CLASS_STEALTH)
if (Ship_info[objp->ship_class].flags & SIF_STEALTH)
objp->flags |= P_SF2_STEALTH;
if (Ship_info[objp->ship_class].flags & SIF_SHIP_CLASS_DONT_COLLIDE_INVIS)
objp->flags |= P_SF2_DONT_COLLIDE_INVIS;
@@ -4982,7 +4985,7 @@ void post_process_mission()
// else
// num = Wings[Ships[i].wingnum].num_waves;
ship_add_ship_type_count( siflags, num );
ship_add_ship_type_count( Ships[shipnum].ship_info_index, num );
}
// now go through the list of ships yet to arrive
@@ -5003,7 +5006,7 @@ void post_process_mission()
else
num = Wings[p_objp->wingnum].num_waves - 1; // subtract one since we already counted the first wave
ship_add_ship_type_count( siflags, num );
ship_add_ship_type_count( p_objp->ship_class, num );
}
// set player weapons that are selected by default
@@ -5136,9 +5139,9 @@ int parse_main(char *mission_name, int flags, int importFSM)
// fill in Ship_class_names array with the names from the ship_info struct;
Num_parse_names = 0;
Mission_all_attack = 0; // Might get set in mission load.
Assert(Num_ship_types <= MAX_SHIP_TYPES); // Goober5000 - should be <=
Assert(Num_ship_classes <= MAX_SHIP_CLASSES); // Goober5000 - should be <=
for (i = 0; i < Num_ship_types; i++)
for (i = 0; i < Num_ship_classes; i++)
Ship_class_names[i] = Ship_info[i].name;
if ((rval = setjmp(parse_abort)) != 0) {
@@ -6579,12 +6582,12 @@ void mission_bring_in_support_ship( object *requester_objp )
// the species of the caller ship.
// get index of correct species support ship
for (i=0; i < Num_ship_types; i++) {
for (i=0; i < Num_ship_classes; i++) {
if ( (Ship_info[i].species == requester_species) && (Ship_info[i].flags & SIF_SUPPORT) )
break;
}
if ( i < Num_ship_types )
if ( i < Num_ship_classes )
pobj->ship_class = i;
else
Int3(); // BOGUS!!!! gotta figure something out here
@@ -6841,7 +6844,7 @@ void conv_replace_ship_classes()
// Goober5000
void conv_add_alt_names()
{
int flag[MAX_SHIP_TYPES];
int flag[MAX_SHIP_CLASSES];
int i, idx, alt_tally;
char *ch;
char ship_class[NAME_LENGTH * 2];
@@ -6850,7 +6853,7 @@ void conv_add_alt_names()
// initialize stuff
ch = Mission_text;
memset(flag, 0, sizeof(int) * MAX_SHIP_TYPES);
memset(flag, 0, sizeof(int) * MAX_SHIP_CLASSES);
alt_tally = 0;
// get all ship classes (case sensitive, because lowercase
@@ -6901,7 +6904,7 @@ void conv_add_alt_names()
strcpy(alt_section, "#Alternate Types:\n");
// find which classes need to be added
for (i = 0; i < MAX_SHIP_TYPES; i++)
for (i = 0; i < MAX_SHIP_CLASSES; i++)
{
if (flag[i])
{
+10 -6
View File
@@ -9,13 +9,17 @@
/*
* $Source: /cvs/cvsroot/fs2open/fs2_open/code/mission/missionparse.h,v $
* $Revision: 2.73 $
* $Author: Goober5000 $
* $Date: 2005-11-21 02:43:37 $
* $Revision: 2.74 $
* $Author: wmcoolmon $
* $Date: 2005-12-29 08:08:36 $
*
* main header file for parsing code
*
* $Log: not supported by cvs2svn $
* Revision 2.73 2005/11/21 02:43:37 Goober5000
* change from "setting" to "profile"; this way makes more sense
* --Goober5000
*
* Revision 2.72 2005/11/21 00:46:12 Goober5000
* add ai_settings.tbl
* --Goober5000
@@ -630,7 +634,7 @@ extern int Mission_alt_type_count;
#define MAX_SPECIAL_ARRIVAL_ANCHORS 6
extern char *Special_arrival_anchor_names[MAX_SPECIAL_ARRIVAL_ANCHORS];
extern char *Ship_class_names[MAX_SHIP_TYPES];
extern char *Ship_class_names[MAX_SHIP_CLASSES];
extern char *Iff_names[MAX_IFF];
extern char *Ai_behavior_names[MAX_AI_BEHAVIORS];
extern char *Formation_names[MAX_FORMATION_NAMES];
@@ -834,8 +838,8 @@ extern p_object Ship_arrival_list;
typedef struct {
int default_ship; // default ship type for player start point (recommended choice)
int number_choices; // number of ship choices inside ship_list
int ship_list[MAX_SHIP_TYPES];
int ship_count[MAX_SHIP_TYPES];
int ship_list[MAX_SHIP_CLASSES];
int ship_count[MAX_SHIP_CLASSES];
int weaponry_pool[MAX_WEAPON_TYPES];
} team_data;
+7 -4
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/MissionUI/MissionBrief.cpp $
* $Revision: 2.38 $
* $Date: 2005-10-10 17:21:06 $
* $Author: taylor $
* $Revision: 2.39 $
* $Date: 2005-12-29 08:08:36 $
* $Author: wmcoolmon $
*
* C module that contains code to display the mission briefing to the player
*
* $Log: not supported by cvs2svn $
* Revision 2.38 2005/10/10 17:21:06 taylor
* remove NO_NETWORK
*
* Revision 2.37 2005/09/26 04:08:54 Goober5000
* some more cleanup
* --Goober5000
@@ -1959,7 +1962,7 @@ void brief_do_frame(float frametime)
}
case KEY_CTRLED | KEY_PAGEDOWN: {
if (Closeup_icon->ship_class < Num_ship_types - 1) {
if (Closeup_icon->ship_class < Num_ship_classes - 1) {
Closeup_icon->ship_class++;
ship_info *sip = &Ship_info[Closeup_icon->ship_class];
+8 -5
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/MissionUI/MissionDebrief.cpp $
* $Revision: 2.44 $
* $Date: 2005-10-10 17:21:06 $
* $Author: taylor $
* $Revision: 2.45 $
* $Date: 2005-12-29 08:08:36 $
* $Author: wmcoolmon $
*
* C module for running the debriefing
*
* $Log: not supported by cvs2svn $
* Revision 2.44 2005/10/10 17:21:06 taylor
* remove NO_NETWORK
*
* Revision 2.43 2005/09/27 02:36:57 Goober5000
* clarification
* --Goober5000
@@ -2264,7 +2267,7 @@ void debrief_setup_ship_kill_stats(int stage_num)
if(Debrief_stats_kills == NULL)
{
Debrief_stats_kills = new debrief_stats_kill_info[Num_ship_types];
Debrief_stats_kills = new debrief_stats_kill_info[Num_ship_classes];
}
Assert(Debrief_player != NULL);
@@ -2277,7 +2280,7 @@ void debrief_setup_ship_kill_stats(int stage_num)
}
Num_text_lines = 0;
for ( i=0; i<MAX_SHIP_TYPES; i++ ) {
for ( i=0; i<MAX_SHIP_CLASSES; i++ ) {
// code used to add in mission kills, but the new system assumes that the player will accept, so
// all time stats already have mission stats added in.
+13 -10
View File
@@ -9,11 +9,14 @@
/*
* $Logfile: /Freespace2/code/MissionUI/MissionScreenCommon.cpp $
* $Revision: 2.28 $
* $Date: 2005-11-16 05:46:27 $
* $Author: taylor $
* $Revision: 2.29 $
* $Date: 2005-12-29 08:08:36 $
* $Author: wmcoolmon $
*
* $Log: not supported by cvs2svn $
* Revision 2.28 2005/11/16 05:46:27 taylor
* bunch of error checking and code cleanup for the team stuff in ship/weapon select
*
* Revision 2.27 2005/10/29 22:09:29 Goober5000
* multiple ship docking implemented for initially docked ships
* --Goober5000
@@ -445,12 +448,12 @@ loadout_data Player_loadout; // what the ship and weapon loadout is... used sinc
//wss_unit Wss_slots[MAX_WSS_SLOTS]; // slot data struct
//int Wl_pool[MAX_WEAPON_TYPES]; // weapon pool
//int Ss_pool[MAX_SHIP_TYPES]; // ship pool
//int Ss_pool[MAX_SHIP_CLASSES]; // ship pool
//int Wss_num_wings; // number of player wings
wss_unit Wss_slots_teams[MAX_TVT_TEAMS][MAX_WSS_SLOTS];
int Wl_pool_teams[MAX_TVT_TEAMS][MAX_WEAPON_TYPES];
int Ss_pool_teams[MAX_TVT_TEAMS][MAX_SHIP_TYPES];
int Ss_pool_teams[MAX_TVT_TEAMS][MAX_SHIP_CLASSES];
int Wss_num_wings_teams[MAX_TVT_TEAMS];
wss_unit *Wss_slots = NULL;
@@ -1400,7 +1403,7 @@ void wss_save_loadout()
Assert( (Ss_pool != NULL) && (Wl_pool != NULL) && (Wss_slots != NULL) );
// save the ship pool
for ( i = 0; i < MAX_SHIP_TYPES; i++ ) {
for ( i = 0; i < MAX_SHIP_CLASSES; i++ ) {
Player_loadout.ship_pool[i] = Ss_pool[i];
}
@@ -1434,7 +1437,7 @@ void wss_restore_loadout()
}
// restore the ship pool
for ( i = 0; i < MAX_SHIP_TYPES; i++ ) {
for ( i = 0; i < MAX_SHIP_CLASSES; i++ ) {
Ss_pool[i] = Player_loadout.ship_pool[i];
}
@@ -1600,7 +1603,7 @@ int store_wss_data(ubyte *block, int max_size, int sound,int player_index)
// write the ship pool
for ( i = 0; i < MAX_SHIP_TYPES; i++ ) {
for ( i = 0; i < MAX_SHIP_CLASSES; i++ ) {
if ( Ss_pool[i] > 0 ) {
block[offset++] = (ubyte)i;
Assert( Ss_pool[i] < UCHAR_MAX );
@@ -1697,9 +1700,9 @@ int restore_wss_data(ubyte *block)
// restore ship pool
sanity=0;
memset(Ss_pool, 0, MAX_SHIP_TYPES*sizeof(int));
memset(Ss_pool, 0, MAX_SHIP_CLASSES*sizeof(int));
for (;;) {
if ( sanity++ > MAX_SHIP_TYPES ) {
if ( sanity++ > MAX_SHIP_CLASSES ) {
Int3();
break;
}
+5 -5
View File
@@ -9,9 +9,9 @@
/*
* $Logfile: /Freespace2/code/MissionUI/MissionScreenCommon.h $
* $Revision: 2.11 $
* $Date: 2005-11-16 05:46:27 $
* $Author: taylor $
* $Revision: 2.12 $
* $Date: 2005-12-29 08:08:36 $
* $Author: wmcoolmon $
*
* $NoKeywords: $
*
@@ -178,7 +178,7 @@ extern int *Wl_pool;
//////////////////////////////////////////////
// Ship pool
//////////////////////////////////////////////
extern int Ss_pool_teams[MAX_TVT_TEAMS][MAX_SHIP_TYPES];
extern int Ss_pool_teams[MAX_TVT_TEAMS][MAX_SHIP_CLASSES];
extern int *Ss_pool;
//////////////////////////////////////////////
@@ -190,7 +190,7 @@ typedef struct loadout_data
char last_modified[DATE_TIME_LENGTH]; // when mission was last modified
wss_unit unit_data[MAX_WSS_SLOTS]; // ship and weapon data
int weapon_pool[MAX_WEAPON_TYPES]; // available weapons
int ship_pool[MAX_SHIP_TYPES]; // available ships
int ship_pool[MAX_SHIP_CLASSES]; // available ships
} loadout_data;
extern loadout_data Player_loadout;
+24 -19
View File
@@ -9,13 +9,18 @@
/*
* $Logfile: /Freespace2/code/MissionUI/MissionShipChoice.cpp $
* $Revision: 2.55 $
* $Date: 2005-12-16 06:51:31 $
* $Author: taylor $
* $Revision: 2.56 $
* $Date: 2005-12-29 08:08:36 $
* $Author: wmcoolmon $
*
* C module to allow player ship selection for the mission
*
* $Log: not supported by cvs2svn $
* Revision 2.55 2005/12/16 06:51:31 taylor
* fix a NULL pointer crash from shipselect screen
* make sure to reset "display_type" for weapon select since it would only render one ship correctly
* (still something wrong here WMC, try using models without -ship_choice_3d, everything is positioned too high on screen)
*
* Revision 2.54 2005/12/04 19:07:48 wmcoolmon
* Final commit of codebase
*
@@ -667,13 +672,13 @@ typedef struct ss_wing_info
ss_slot_info ss_slots[MAX_WING_SLOTS];
} ss_wing_info;
//ss_icon_info Ss_icons[MAX_SHIP_TYPES]; // holds ui info on different ship icons
//ss_icon_info Ss_icons[MAX_SHIP_CLASSES]; // holds ui info on different ship icons
//ss_wing_info Ss_wings[MAX_WING_BLOCKS]; // holds ui info for wings and wing slots
ss_wing_info Ss_wings_teams[MAX_TVT_TEAMS][MAX_WING_BLOCKS];
ss_wing_info *Ss_wings = NULL;
ss_icon_info Ss_icons_teams[MAX_TVT_TEAMS][MAX_SHIP_TYPES];
ss_icon_info Ss_icons_teams[MAX_TVT_TEAMS][MAX_SHIP_CLASSES];
ss_icon_info *Ss_icons = NULL;
int Ss_mouse_down_on_region = -1;
@@ -786,7 +791,7 @@ typedef struct ss_active_item
static ss_active_item SS_active_head;
//static ss_active_item SS_active_items[MAX_WSS_SLOTS];//DTP commented out or else singleplayer will only have a max of MAX_WSS_SLOTS ships
static ss_active_item SS_active_items[MAX_SHIP_TYPES];//DTP, now we have all ships in the TBL, as they can all be playerships
static ss_active_item SS_active_items[MAX_SHIP_CLASSES];//DTP, now we have all ships in the TBL, as they can all be playerships
static int SS_active_list_start;
static int SS_active_list_size;
@@ -1004,7 +1009,7 @@ void ss_set_carried_icon(int from_slot, int ship_class)
void clear_active_list()
{
int i;
for ( i = 0; i < Num_ship_types; i++ ) { //DTP singleplayer ship choice fix
for ( i = 0; i < Num_ship_classes; i++ ) { //DTP singleplayer ship choice fix
//for ( i = 0; i < MAX_WSS_SLOTS; i++ ) {
SS_active_items[i].flags = 0;
SS_active_items[i].ship_class = -1;
@@ -1020,7 +1025,7 @@ void clear_active_list()
ss_active_item *get_free_active_list_node()
{
int i;
for ( i = 0; i < Num_ship_types; i++ ) {
for ( i = 0; i < Num_ship_classes; i++ ) {
//for ( i = 0; i < MAX_WSS_SLOTS; i++ ) { //DTP, ONLY MAX_WSS_SLOTS SHIPS ???
if ( SS_active_items[i].flags == 0 ) {
SS_active_items[i].flags |= SS_ACTIVE_ITEM_USED;
@@ -1072,7 +1077,7 @@ void init_active_list()
clear_active_list();
// build the active list
for ( i = 0; i < MAX_SHIP_TYPES; i++ ) {
for ( i = 0; i < MAX_SHIP_CLASSES; i++ ) {
if ( Ss_pool[i] > 0 ) {
sai = get_free_active_list_node();
if ( sai != NULL ) {
@@ -1214,7 +1219,7 @@ void ship_select_button_do(int i)
//
void ship_select_init()
{
// SS_active_items = new ss_active_item[Num_ship_types];
// SS_active_items = new ss_active_item[Num_ship_classes];
common_set_interface_palette("ShipPalette");
common_flash_button_init();
@@ -2262,7 +2267,7 @@ void ss_unload_icons()
Assert( Ss_icons != NULL );
for ( i = 0; i < MAX_SHIP_TYPES; i++ ) {
for ( i = 0; i < MAX_SHIP_CLASSES; i++ ) {
icon = &Ss_icons[i];
for ( j = 0; j < NUM_ICON_FRAMES; j++ ) {
@@ -2536,7 +2541,7 @@ void unload_ship_anims()
{
Assert( Ss_icons != NULL );
for ( int i = 0; i < MAX_SHIP_TYPES; i++ ) {
for ( int i = 0; i < MAX_SHIP_CLASSES; i++ ) {
if ( Ss_icons[i].ss_anim ) {
anim_free(Ss_icons[i].ss_anim);
Ss_icons[i].ss_anim = NULL;
@@ -2552,7 +2557,7 @@ void unload_ship_anim_instances()
{
Assert( Ss_icons != NULL );
for ( int i = 0; i < MAX_SHIP_TYPES; i++ ) {
for ( int i = 0; i < MAX_SHIP_CLASSES; i++ ) {
if ( Ss_icons[i].ss_anim_instance ) {
anim_release_render_instance(Ss_icons[i].ss_anim_instance);
Ss_icons[i].ss_anim_instance = NULL;
@@ -3195,7 +3200,7 @@ int create_default_player_ship(int use_last_flown)
player_ship_class = Players[Player_num].last_ship_flown_si_index;
}
else {
for (i = 0; i < Num_ship_types; i++) {
for (i = 0; i < Num_ship_classes; i++) {
if ( !stricmp(Ship_info[i].name, default_player_ship) ) {
player_ship_class = i;
Players[Player_num].last_ship_flown_si_index = player_ship_class;
@@ -3203,7 +3208,7 @@ int create_default_player_ship(int use_last_flown)
}
}
if (i == Num_ship_types)
if (i == Num_ship_classes)
return 1;
}
@@ -3368,7 +3373,7 @@ void ss_reset_selected_ship()
if ( Selected_ss_class == -1 ) {
Int3();
for ( i = 0; i < MAX_SHIP_TYPES; i++ ) {
for ( i = 0; i < MAX_SHIP_CLASSES; i++ ) {
if ( Ss_pool[i] > 0 ) {
Selected_ss_class = i;
}
@@ -3474,7 +3479,7 @@ void ss_init_pool(team_data *pteam)
Assert( Ss_pool != NULL );
for ( i = 0; i < MAX_SHIP_TYPES; i++ ) {
for ( i = 0; i < MAX_SHIP_CLASSES; i++ ) {
Ss_pool[i] = -1;
}
@@ -3526,7 +3531,7 @@ void ss_load_all_icons()
Assert( (Ss_pool != NULL) && (Ss_icons != NULL) );
for ( i = 0; i < MAX_SHIP_TYPES; i++ ) {
for ( i = 0; i < MAX_SHIP_CLASSES; i++ ) {
// clear out data
Ss_icons[i].current_icon_bitmap = -1;
Ss_icons[i].ss_anim = NULL;
@@ -3573,7 +3578,7 @@ void ss_load_all_anims()
Assert( Ss_pool != NULL );
for ( i = 0; i < MAX_SHIP_TYPES; i++ ) {
for ( i = 0; i < MAX_SHIP_CLASSES; i++ ) {
if ( Ss_pool[i] > 0 ) {
ss_load_anim(i);
}
+19 -14
View File
@@ -9,13 +9,18 @@
/*
* $Logfile: /Freespace2/code/MissionUI/MissionWeaponChoice.cpp $
* $Revision: 2.64 $
* $Date: 2005-12-16 06:51:31 $
* $Author: taylor $
* $Revision: 2.65 $
* $Date: 2005-12-29 08:08:36 $
* $Author: wmcoolmon $
*
* C module for the weapon loadout screen
*
* $Log: not supported by cvs2svn $
* Revision 2.64 2005/12/16 06:51:31 taylor
* fix a NULL pointer crash from shipselect screen
* make sure to reset "display_type" for weapon select since it would only render one ship correctly
* (still something wrong here WMC, try using models without -ship_choice_3d, everything is positioned too high on screen)
*
* Revision 2.63 2005/12/04 18:55:42 wmcoolmon
* Better overhead-view handling
*
@@ -60,7 +65,7 @@
* ton of non-standard resolution fixes
*
* Revision 2.51 2005/04/25 00:25:46 wmcoolmon
* MAX_SHIP_TYPES > Num_ship_types
* MAX_SHIP_CLASSES > Num_ship_classes
*
* Revision 2.50 2005/04/05 05:53:20 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
@@ -1004,7 +1009,7 @@ typedef struct wl_ship_class_info
anim_instance *wl_anim_instance;
} wl_ship_class_info;
wl_ship_class_info Wl_ships[MAX_SHIP_TYPES];
wl_ship_class_info Wl_ships[MAX_SHIP_CLASSES];
typedef struct wl_icon_info
{
@@ -1442,7 +1447,7 @@ void wl_render_overhead_view(float frametime)
Assert( Wss_slots != NULL );
ship_class = Wss_slots[Selected_wl_slot].ship_class;
if (ship_class < 0 || ship_class > Num_ship_types)
if (ship_class < 0 || ship_class > Num_ship_classes)
{
Warning(LOCATION, "ivalid ship class (%d) passed for render_overhead_view", ship_class);
return;
@@ -1770,7 +1775,7 @@ void wl_set_disabled_weapons(int ship_class)
if ( ship_class == - 1 )
return;
Assert(ship_class >= 0 && ship_class < MAX_SHIP_TYPES);
Assert(ship_class >= 0 && ship_class < MAX_SHIP_CLASSES);
Assert( Wl_icons != NULL );
sip = &Ship_info[ship_class];
@@ -2027,7 +2032,7 @@ void wl_load_all_anims()
}
// init anim member for overhead ship animations
for ( i = 0; i < Num_ship_types; i++ ) {
for ( i = 0; i < Num_ship_classes; i++ ) {
Wl_ships[i].wl_anim = NULL;
Wl_ships[i].wl_anim_instance = NULL;
}
@@ -2058,7 +2063,7 @@ void wl_unload_all_anim_instances()
}
// stop any overhead anim instances
for ( i = 0; i < Num_ship_types; i++ ) {
for ( i = 0; i < Num_ship_classes; i++ ) {
if ( Wl_ships[i].wl_anim_instance != NULL) {
anim_release_render_instance(Wl_ships[i].wl_anim_instance);
Wl_ships[i].wl_anim_instance = NULL;
@@ -2074,7 +2079,7 @@ void wl_unload_all_anims()
Assert( Wl_icons != NULL );
// unload overhead anim instances
for ( i = 0; i < Num_ship_types; i++ ) {
for ( i = 0; i < Num_ship_classes; i++ ) {
if ( Wl_ships[i].wl_anim ) {
anim_free(Wl_ships[i].wl_anim);
Wl_ships[i].wl_anim = NULL;
@@ -2151,7 +2156,7 @@ void wl_init_ship_class_data()
int i;
wl_ship_class_info *wl_ship;
for ( i=0; i<MAX_SHIP_TYPES; i++ ) {
for ( i=0; i<MAX_SHIP_CLASSES; i++ ) {
wl_ship = &Wl_ships[i];
wl_ship->overhead_bitmap = -1;
wl_ship->model_num = -1;
@@ -2166,7 +2171,7 @@ void wl_free_ship_class_data()
int i;
wl_ship_class_info *wl_ship;
for ( i=0; i<Num_ship_types; i++ ) {
for ( i=0; i<Num_ship_classes; i++ ) {
wl_ship = &Wl_ships[i];
if ( wl_ship->overhead_bitmap != -1 ) {
@@ -2387,7 +2392,7 @@ void wl_get_ship_class_weapons(int ship_class, int *wep, int *wep_count)
ship_info *sip;
int i;
Assert(ship_class >= 0 && ship_class < Num_ship_types);
Assert(ship_class >= 0 && ship_class < Num_ship_classes);
sip = &Ship_info[ship_class];
// reset weapons arrays
@@ -3009,7 +3014,7 @@ void wl_check_for_stopped_ship_anims()
{
int i;
anim_instance *ai;
for ( i = 0; i < Num_ship_types; i++ ) {
for ( i = 0; i < Num_ship_classes; i++ ) {
ai = Wl_ships[i].wl_anim_instance;
if ( ai != NULL ) {
if ( !anim_playing(ai) ) {
+15 -6
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Model/MODEL.H $
* $Revision: 2.68 $
* $Date: 2005-12-15 04:31:05 $
* $Author: phreak $
* $Revision: 2.69 $
* $Date: 2005-12-29 08:08:36 $
* $Author: wmcoolmon $
*
* header file for information about polygon models
*
* $Log: not supported by cvs2svn $
* Revision 2.68 2005/12/15 04:31:05 phreak
* [V] can't spell 'turret'
*
* Revision 2.67 2005/12/04 19:07:48 wmcoolmon
* Final commit of codebase
*
@@ -279,7 +282,7 @@
* I also (think) I squashed a bug in the warpmodel code
*
* Revision 2.9 2002/12/04 09:44:34 DTP
* lowered MAX_POLYGON_MODELS FROM 198 to 128 for safety reasons since we bumped back MAX_SHIP_TYPES to 130
* lowered MAX_POLYGON_MODELS FROM 198 to 128 for safety reasons since we bumped back MAX_SHIP_CLASSES to 130
*
* Revision 2.8 2002/12/02 23:55:31 Goober5000
* fixed misspelling
@@ -302,7 +305,7 @@
* Forgot to Bump MAX_MODEL_SUBSYSTEMS from 128 to 200
*
* Revision 2.2 2002/07/29 08:28:00 DTP
* BUMPED MAX_POLYGON_MODELS TO 198 , MAX_SHIP_TYPES - 2 = 198
* BUMPED MAX_POLYGON_MODELS TO 198 , MAX_SHIP_CLASSES - 2 = 198
*
* Revision 2.1 2002/07/10 18:42:14 wmcoolmon
* Added Bobboau's glow code; all comments include "-Bobboau"
@@ -674,8 +677,9 @@ typedef struct stepped_rotation {
#define TRIGGER_TYPE_PRIMARY_BANK 3 //primary banks
#define TRIGGER_TYPE_SECONDARY_BANK 4 //secondary banks
#define TRIGGER_TYPE_DOCK_BAY_DOOR 5 //fighter bays
#define TRIGGER_TYPE_AFTERBURNER 6 //Afterburner -C
#define MAX_TRIGGER_ANIMATION_TYPES 6
#define MAX_TRIGGER_ANIMATION_TYPES 7
extern char* animation_type_names[MAX_TRIGGER_ANIMATION_TYPES];
@@ -989,6 +993,9 @@ typedef struct glow_bank { // glow bank struckture -Bobboau
// defines for docking bay things. The types are essentially flags since docking bays can probably
// be used for multiple things in some cases (i.e. rearming and general docking)
//WMC - IMPORTANT, update Dock_type_names array if you add a new one of these
extern flag_def_list Dock_type_names[];
extern int Num_dock_type_names;
#define DOCK_TYPE_CARGO (1<<0)
#define DOCK_TYPE_REARM (1<<1)
@@ -1138,6 +1145,8 @@ typedef struct polymodel {
int specular_original_textures[MAX_MODEL_TEXTURES]; //map modulated with the specular -Bobboau
int specular_textures[MAX_MODEL_TEXTURES];
int bump_textures[MAX_MODEL_TEXTURES];
int ambient[MAX_MODEL_TEXTURES]; // ambient light-Bobboau
int transparent[MAX_MODEL_TEXTURES]; // flag this texture as being a transparent blend-Bobboau
+22 -7
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Model/ModelInterp.cpp $
* $Revision: 2.136 $
* $Date: 2005-12-16 06:54:10 $
* $Author: taylor $
* $Revision: 2.137 $
* $Date: 2005-12-29 08:08:37 $
* $Author: wmcoolmon $
*
* Rendering models, I think.
*
* $Log: not supported by cvs2svn $
* Revision 2.136 2005/12/16 06:54:10 taylor
* apply at least some lighting to ship insignias rather than them being full bright
*
* Revision 2.135 2005/12/15 16:31:03 taylor
* fix limits checking messages to actually be useful and hit sooner (wireframe view of some hi-poly models was going out-of-bounds from normals)
*
@@ -1769,6 +1772,7 @@ void model_interp_tmappoly(ubyte * p,polymodel * pm)
if((Interp_flags & MR_EDGE_ALPHA))model_interp_edge_alpha(&Interp_list[i]->r, &Interp_list[i]->g, &Interp_list[i]->b, Interp_verts[verts[i].vertnum], Interp_norms[verts[i].normnum], Warp_Alpha, false);
if((Interp_flags & MR_CENTER_ALPHA))model_interp_edge_alpha(&Interp_list[i]->r, &Interp_list[i]->g, &Interp_list[i]->b, Interp_verts[verts[i].vertnum], Interp_norms[verts[i].normnum], Warp_Alpha, true);
SPECMAP = -1;
BUMPMAP = -1;
} else {
int vertnum = verts[i].vertnum;
@@ -1861,7 +1865,11 @@ void model_interp_tmappoly(ubyte * p,polymodel * pm)
texture = pm->textures[tmap_num];//here is were it picks the texture to render for normal-Bobboau
}
if((Detail.lighting > 2) && (model_current_LOD < 1))SPECMAP = pm->specular_textures[tmap_num];
if((Detail.lighting > 2) && (model_current_LOD < 1))
{
BUMPMAP = pm->bump_textures[tmap_num];
SPECMAP = pm->specular_textures[tmap_num];
}
if(glow_maps_active)
{
@@ -1915,6 +1923,7 @@ void model_interp_tmappoly(ubyte * p,polymodel * pm)
cell_enabled = false;
GLOWMAP = -1;
SPECMAP = -1;
BUMPMAP = -1;
if (Interp_flags & (MR_SHOW_OUTLINE|MR_SHOW_OUTLINE_PRESET) ) {
@@ -5073,7 +5082,7 @@ void model_page_in_textures(int modelnum, int ship_info_index)
return;
}
if ((ship_info_index >= 0) && (ship_info_index < Num_ship_types)) {
if ((ship_info_index >= 0) && (ship_info_index < Num_ship_classes)) {
sip = &Ship_info[ship_info_index];
// set nondarkening pixels
@@ -5944,7 +5953,11 @@ void model_render_buffers(bsp_info* model, polymodel * pm){
texture = pm->textures[model->buffer[i].texture];//here is were it picks the texture to render for normal-Bobboau
}
if((Detail.lighting > 2) && (model_current_LOD < 2))SPECMAP = pm->specular_textures[model->buffer[i].texture];
if((Detail.lighting > 2) && (model_current_LOD < 2))
{
SPECMAP = pm->specular_textures[model->buffer[i].texture];
BUMPMAP = pm->bump_textures[model->buffer[i].texture];
}
if(glow_maps_active)
{
@@ -6005,6 +6018,7 @@ void model_render_buffers(bsp_info* model, polymodel * pm){
}
GLOWMAP = -1;
SPECMAP = -1;
BUMPMAP = -1;
// if(model->flat_buffer != -1)gr_render_buffer(model->flat_buffer);
//we don't need this
@@ -6343,7 +6357,8 @@ char* animation_type_names[MAX_TRIGGER_ANIMATION_TYPES] = {
"\"docked\"",
"\"primary_bank\"",
"\"secondary_bank\"",
"\"door\""
"\"door\"",
"\"afterburner\"",
};
+49 -6
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Model/ModelRead.cpp $
* $Revision: 2.84 $
* $Date: 2005-12-15 04:31:05 $
* $Author: phreak $
* $Revision: 2.85 $
* $Date: 2005-12-29 08:08:37 $
* $Author: wmcoolmon $
*
* file which reads and deciphers POF information
*
* $Log: not supported by cvs2svn $
* Revision 2.84 2005/12/15 04:31:05 phreak
* [V] can't spell 'turret'
*
* Revision 2.83 2005/11/13 06:47:26 taylor
* make sure that we don't get "-transport" in with the transparent filename check (TBP bug)
*
@@ -1116,6 +1119,17 @@ static int Model_signature = 0;
void generate_vertex_buffers(bsp_info*, polymodel*);
//WMC - For general compatibility stuff.
//Note that the order of the items in this list
//determine the order that they are tried in ai_goal_fixup_dockpoints
flag_def_list Dock_type_names[] = {
{"cargo", DOCK_TYPE_CARGO},
{"rearm", DOCK_TYPE_REARM},
{"generic", DOCK_TYPE_GENERIC},
};
int Num_dock_type_names = sizeof(Dock_type_names)/sizeof(flag_def_list);
// Free up a model, getting rid of all its memory
// With the basic page in system this can be called from outside of modelread.cpp
void model_unload(int modelnum, int force)
@@ -2835,7 +2849,19 @@ void model_load_texture(polymodel *pm, int i, char *file)
pm->specular_original_textures[i] = pm->specular_textures[i];
}
//WMC: BUMP mapping
if(1)
{
memset(tmp_name, 0, MAX_FILENAME_LEN);
strncpy(tmp_name, file, MAX_FILENAME_LEN-1);
strncat(tmp_name, "-bump", MAX_FILENAME_LEN - strlen(tmp_name) - 1);
strlwr(tmp_name);
pm->bump_textures[i] = bm_load(tmp_name);
if (pm->bump_textures[i]<0) {
nprintf(("Maps", "For \"%s\" I couldn't find %s.pcx\n", pm->filename, tmp_name));
}
}
}
@@ -3888,17 +3914,26 @@ void model_make_turret_matrix(int model_num, model_subsystem * turret )
pm = model_get(model_num);
bsp_info * sm = &pm->submodel[turret->turret_gun_sobj];
bsp_info * sm_parent = &pm->submodel[turret->subobj_num];
float offset_base_h = 0.0f;
float offset_barrel_h = 0.0f;
#ifdef WMC_SIDE_TURRETS
offset_base_h = -PI/2.0f;
offset_barrel_h = -PI/2.0f;
#endif
model_clear_instance(model_num);
sm_parent->angs.h = offset_base_h;
sm->angs.h = offset_barrel_h;
model_find_world_dir(&fvec, &turret->turret_norm, model_num, turret->turret_gun_sobj, &vmd_identity_matrix, NULL );
sm_parent->angs.h = -PI/2.0f;
sm_parent->angs.h = -PI/2.0f + offset_base_h;
sm->angs.p = -PI/2.0f;
sm->angs.h = offset_barrel_h;
model_find_world_dir(&rvec, &turret->turret_norm, model_num, turret->turret_gun_sobj, &vmd_identity_matrix, NULL );
sm_parent->angs.h = 0.0f;
sm_parent->angs.h = 0.0f + offset_base_h;
sm->angs.p = -PI/2.0f;
sm->angs.h = offset_barrel_h;
model_find_world_dir(&uvec, &turret->turret_norm, model_num, turret->turret_gun_sobj, &vmd_identity_matrix, NULL );
vm_vec_normalize(&fvec);
@@ -4491,12 +4526,20 @@ int model_find_dock_name_index( int modelnum, char *name )
// check the generic names and call previous function to find first dock point of
// the specified type
for(i = 0; i < Num_dock_type_names; i++)
{
if(!stricmp(name, Dock_type_names[i].name)) {
return model_find_dock_index(modelnum, Dock_type_names[i].def);
}
}
/*
if ( !stricmp(name, "cargo") )
return model_find_dock_index( modelnum, DOCK_TYPE_CARGO );
else if (!stricmp( name, "rearm") )
return model_find_dock_index( modelnum, DOCK_TYPE_REARM );
else if (!stricmp( name, "generic") )
return model_find_dock_index( modelnum, DOCK_TYPE_GENERIC );
*/
// look for a dockpoint with this name
for (i = 0; i < pm->n_docks; i++ )
+39 -25
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Nebula/Neb.cpp $
* $Revision: 2.43 $
* $Date: 2005-12-08 15:17:34 $
* $Author: taylor $
* $Revision: 2.44 $
* $Date: 2005-12-29 08:08:39 $
* $Author: wmcoolmon $
*
* Nebula effect
*
* $Log: not supported by cvs2svn $
* Revision 2.43 2005/12/08 15:17:34 taylor
* fix several bad crash related problems from WMC's commits on the 4th
*
* Revision 2.42 2005/12/04 19:07:48 wmcoolmon
* Final commit of codebase
*
@@ -394,6 +397,7 @@ float Neb_ship_fog_vals_glide[MAX_SHIP_TYPE_COUNTS][2] = {
{10.0f, 1000.0f}, // SHIP_TYPE_KNOSSOS_DEVICE
};
*/
/*
float Neb_ship_fog_vals_d3d[MAX_SHIP_TYPE_COUNTS][2] = {
{0.0f, 0.0f}, // SHIP_TYPE_NONE
{10.0f, 500.0f}, // SHIP_TYPE_CARGO
@@ -416,6 +420,10 @@ float Neb_ship_fog_vals_d3d[MAX_SHIP_TYPE_COUNTS][2] = {
{10.0f, 600.0f}, // SHIP_TYPE_CORVETTE
{10.0f, 1000.0f}, // SHIP_TYPE_KNOSSOS_DEVICE
};
*/
//WMC - these were originally indexed to SHIP_TYPE_FIGHTER_BOMBER
const static float Default_fog_near = 10.0f;
const static float Default_fog_far = 500.0f;
// fog near and far values for rendering the background nebula
#define NEB_BACKG_FOG_NEAR_GLIDE 2.5f
@@ -571,6 +579,8 @@ void neb2_init()
}
//Distance
//WMC - Obsolete! Obsolete! Obsolete!
/*
if(optional_string("#Fog Distance"))
{
char buf[32];
@@ -588,7 +598,7 @@ void neb2_init()
}
required_string("#End");
}
}*/
// should always have 6 neb poofs
Assert(Neb2_poof_count == 6);
@@ -1488,8 +1498,7 @@ void neb2_eye_changed()
// get near and far fog values based upon object type and rendering mode
void neb2_get_fog_values(float *fnear, float *ffar, object *objp)
{
int nNfog_index = -1;
int type_index = -1;
// default values in case something truly nasty happens
*fnear = 10.0f;
@@ -1498,19 +1507,26 @@ void neb2_get_fog_values(float *fnear, float *ffar, object *objp)
if (objp == NULL)
return;
//Otherwise, use defaults
*fnear = Default_fog_near;
*ffar = Default_fog_far;
// determine what fog index to use
if(objp->type == OBJ_SHIP){
if(objp->type == OBJ_SHIP)
{
Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS));
if((objp->instance < 0) || (objp->instance >= MAX_SHIPS)){
nNfog_index = SHIP_TYPE_FIGHTER_BOMBER;
} else {
nNfog_index = ship_query_general_type(objp->instance);
Assert(nNfog_index >= 0);
if(nNfog_index < 0){
nNfog_index = SHIP_TYPE_FIGHTER_BOMBER;
if((objp->instance >= 0) && (objp->instance < MAX_SHIPS))
{
type_index = ship_query_general_type(objp->instance);
if(type_index > 0)
{
*fnear = Ship_types[type_index].fog_start_dist;
*ffar = Ship_types[type_index].fog_complete_dist;
}
}
}else if(objp->type == OBJ_FIREBALL){//mostly here for the warp effect
}
else if(objp->type == OBJ_FIREBALL)
{//mostly here for the warp effect
*fnear = objp->radius*2;
*ffar = (objp->radius*objp->radius*200)+objp->radius*200;
return;
@@ -1520,12 +1536,7 @@ void neb2_get_fog_values(float *fnear, float *ffar, object *objp)
*ffar = 10000.0f;
return;
// fog everything else like a fighter
*/ }else {
nNfog_index = SHIP_TYPE_FIGHTER_BOMBER;
}
*fnear = Neb_ship_fog_vals_d3d[nNfog_index][0];
*ffar = Neb_ship_fog_vals_d3d[nNfog_index][1];
*/ }
}
float nNf_near, nNf_far;
@@ -1870,7 +1881,9 @@ DCF(neb2_jitter, "")
dc_get_arg(ARG_FLOAT);
Nd->hj = Nd->dj = Nd->wj = Dc_arg_float;
}
//WMC - unfortunately, this has to go bye-bye
//I don't think anyone used it anyway so I'm not going to try to resurrect it
/*
DCF(neb2_fog, "")
{
int index;
@@ -1891,7 +1904,7 @@ DCF(neb2_fog, "")
Neb_ship_fog_vals_d3d[index][1] = ffar;
}
}
}
}*/
DCF(neb2_max_alpha, "")
{
@@ -1995,7 +2008,8 @@ DCF(neb2_background, "")
Neb2_background_color[1] = g;
Neb2_background_color[2] = b;
}
//WMC - Going bye-bye for ship types too
/*
DCF(neb2_fog_vals, "")
{
dc_printf("neb2_fog : \n");
@@ -2025,7 +2039,7 @@ DCF(neb2_fog_vals, "")
dc_printf("neb2_jitter : %f\n", Nd->wj);
dc_printf("neb2_ff : %f\n", neb2_flash_fade);
dc_printf("neb2_background : %d %d %d\n", Neb2_background_color[0], Neb2_background_color[1], Neb2_background_color[2]);
}
}*/
/* Obsolete !?
DCF(neb2_create, "create a basic nebula")
+15 -12
View File
@@ -9,11 +9,14 @@
/*
* $Logfile: /Freespace2/code/Network/multi_campaign.cpp $
* $Revision: 2.13 $
* $Date: 2005-10-10 17:21:07 $
* $Author: taylor $
* $Revision: 2.14 $
* $Date: 2005-12-29 08:08:39 $
* $Author: wmcoolmon $
*
* $Log: not supported by cvs2svn $
* Revision 2.13 2005/10/10 17:21:07 taylor
* remove NO_NETWORK
*
* Revision 2.12 2005/07/13 03:25:59 Goober5000
* remove PreProcDefine #includes in FS2
* --Goober5000
@@ -23,7 +26,7 @@
* fixes various problems and is past time to make the switch
*
* Revision 2.10 2005/04/25 00:28:17 wmcoolmon
* MAX_SHIP_TYPES > Num_ship_types
* MAX_SHIP_CLASSES > Num_ship_classes
*
* Revision 2.9 2005/04/11 05:50:36 taylor
* some limits.h fixes to make GCC happier
@@ -448,7 +451,7 @@ void multi_campaign_client_store_goals(int mission_num)
// ------------------------------------------------------------------------------------
// MULTIPLAYER CAMPAIGN PACKET HANDLERS
//
extern int Num_ship_types;
extern int Num_ship_classes;
// process a campaign update packet
void multi_campaign_process_update(ubyte *data, header *hinfo)
{
@@ -475,17 +478,17 @@ void multi_campaign_process_update(ubyte *data, header *hinfo)
// if we're not in campaign mode, bash all weapons and ships to be "allowed"
if(!val){
// all ships
for(idx=0;idx<Num_ship_types;idx++){
for(idx=0;idx<Num_ship_classes;idx++){
Campaign.ships_allowed[idx] = 1;
}
// all weapons
for(idx=0;idx<Num_ship_types;idx++){
for(idx=0;idx<Num_ship_classes;idx++){
Campaign.weapons_allowed[idx] = 1;
}
} else {
// clear the ships and weapons allowed arrays
memset(Campaign.ships_allowed,0,MAX_SHIP_TYPES);
memset(Campaign.ships_allowed,0,MAX_SHIP_CLASSES);
memset(Campaign.weapons_allowed,0,MAX_WEAPON_TYPES);
// get all ship classes
@@ -656,7 +659,7 @@ void multi_campaign_send_pool_status()
// determine how many ship types we're going to add
spool_size = 0;
for(idx=0;idx<Num_ship_types;idx++){
for(idx=0;idx<Num_ship_classes;idx++){
if(Campaign.ships_allowed[idx]){
spool_size++;
}
@@ -664,7 +667,7 @@ void multi_campaign_send_pool_status()
// determine how many weapon types we're going to add
wpool_size = 0;
for(idx=0;idx<Num_ship_types;idx++){
for(idx=0;idx<Num_ship_classes;idx++){
if(Campaign.weapons_allowed[idx]){
wpool_size++;
}
@@ -676,7 +679,7 @@ void multi_campaign_send_pool_status()
// add all ship types
val = (ubyte)spool_size;
ADD_DATA(val);
for(idx=0;idx<Num_ship_types;idx++){
for(idx=0;idx<Num_ship_classes;idx++){
if(Campaign.ships_allowed[idx]){
val = (ubyte)idx;
ADD_DATA(val);
@@ -686,7 +689,7 @@ void multi_campaign_send_pool_status()
// add all weapon types
val = (ubyte)wpool_size;
ADD_DATA(val);
for(idx=0;idx<Num_ship_types;idx++){
for(idx=0;idx<Num_ship_classes;idx++){
if(Campaign.weapons_allowed[idx]){
val = (ubyte)idx;
ADD_DATA(val);
+8 -5
View File
@@ -9,11 +9,14 @@
/*
* $Logfile: /Freespace2/code/Network/multi_ingame.cpp $
* $Revision: 2.27 $
* $Date: 2005-10-30 20:20:43 $
* $Author: Goober5000 $
* $Revision: 2.28 $
* $Date: 2005-12-29 08:08:39 $
* $Author: wmcoolmon $
*
* $Log: not supported by cvs2svn $
* Revision 2.27 2005/10/30 20:20:43 Goober5000
* comment fixage
*
* Revision 2.26 2005/10/29 22:09:30 Goober5000
* multiple ship docking implemented for initially docked ships
* --Goober5000
@@ -32,7 +35,7 @@
* ton of non-standard resolution fixes
*
* Revision 2.21 2005/04/25 00:28:17 wmcoolmon
* MAX_SHIP_TYPES > Num_ship_types
* MAX_SHIP_CLASSES > Num_ship_classes
*
* Revision 2.20 2005/04/11 05:50:36 taylor
* some limits.h fixes to make GCC happier
@@ -948,7 +951,7 @@ void multi_ingame_load_icons()
Multi_ingame_num_ship_icons = 0;
// traverse through all ship types
for(idx=0;idx<Num_ship_types;idx++){
for(idx=0;idx<Num_ship_classes;idx++){
// if there is a valid icon for this ship
if((strlen(Ship_info[idx].icon_filename) > 0) && (Multi_ingame_num_ship_icons < MULTI_INGAME_MAX_SHIP_ICONS)){
// set the ship class
+2 -2
View File
@@ -235,7 +235,7 @@ void multi_oo_build_ship_list(net_player *pl)
}
// never update the knossos device
if ((Ships[Objects[moveup->objnum].instance].ship_info_index >= 0) && (Ships[Objects[moveup->objnum].instance].ship_info_index < Num_ship_types) && (Ship_info[Ships[Objects[moveup->objnum].instance].ship_info_index].flags & SIF_KNOSSOS_DEVICE)){
if ((Ships[Objects[moveup->objnum].instance].ship_info_index >= 0) && (Ships[Objects[moveup->objnum].instance].ship_info_index < Num_ship_classes) && (Ship_info[Ships[Objects[moveup->objnum].instance].ship_info_index].flags & SIF_KNOSSOS_DEVICE)){
continue;
}
@@ -735,7 +735,7 @@ int multi_oo_unpack_data(net_player *pl, ubyte *data)
// if we can't find the object, set pointer to bogus object to continue reading the data
// ignore out of sequence packets here as well
if ( (pobjp == NULL) || (pobjp->type != OBJ_SHIP) || (pobjp->instance < 0) || (pobjp->instance >= MAX_SHIPS) || (Ships[pobjp->instance].ship_info_index < 0) || (Ships[pobjp->instance].ship_info_index >= Num_ship_types)){
if ( (pobjp == NULL) || (pobjp->type != OBJ_SHIP) || (pobjp->instance < 0) || (pobjp->instance >= MAX_SHIPS) || (Ships[pobjp->instance].ship_info_index < 0) || (Ships[pobjp->instance].ship_info_index >= Num_ship_classes)){
offset += data_size;
return offset;
}
+7 -4
View File
@@ -9,11 +9,14 @@
/*
* $Logfile: /Freespace2/code/Network/multi_pinfo.cpp $
* $Revision: 2.13 $
* $Date: 2005-10-10 17:21:07 $
* $Author: taylor $
* $Revision: 2.14 $
* $Date: 2005-12-29 08:08:39 $
* $Author: wmcoolmon $
*
* $Log: not supported by cvs2svn $
* Revision 2.13 2005/10/10 17:21:07 taylor
* remove NO_NETWORK
*
* Revision 2.12 2005/07/18 03:45:08 taylor
* more non-standard res fixing
* - I think everything should default to resize now (much easier than having to figure that crap out)
@@ -818,7 +821,7 @@ void multi_pinfo_build_stats()
/*
fighter_kills = 0;
other_kills = 0;
for(idx=0;idx<MAX_SHIP_TYPES;idx++){
for(idx=0;idx<MAX_SHIP_CLASSES;idx++){
if(sc->kills[idx] > 0){
if(Ship_info[idx].flags & SIF_FIGHTER){
fighter_kills += sc->kills[idx];
+11 -7
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Network/MultiMsgs.cpp $
* $Revision: 2.52 $
* $Date: 2005-12-22 04:35:04 $
* $Author: taylor $
* $Revision: 2.53 $
* $Date: 2005-12-29 08:08:39 $
* $Author: wmcoolmon $
*
* C file that holds functions for the building and processing of multiplayer packets
*
* $Log: not supported by cvs2svn $
* Revision 2.52 2005/12/22 04:35:04 taylor
* more big-endian fixes
* fix the totally retarded check I made for multi fighter beams (they really don't work right yet anyway) since it broke normal beams for clients
*
* Revision 2.51 2005/12/04 19:07:49 wmcoolmon
* Final commit of codebase
*
@@ -6870,7 +6874,7 @@ void send_player_stats_block_packet(net_player *pl, int stats_code, net_player *
switch(stats_code){
case STATS_ALLTIME:
// alltime kills
for(idx=0;idx<MAX_SHIP_TYPES;idx++){
for(idx=0;idx<MAX_SHIP_CLASSES;idx++){
u_tmp = (ushort)sc->kills[idx];
ADD_USHORT(u_tmp);
}
@@ -6901,7 +6905,7 @@ void send_player_stats_block_packet(net_player *pl, int stats_code, net_player *
case STATS_MISSION:
// mission OKkills
for(idx=0;idx<MAX_SHIP_TYPES;idx++){
for(idx=0;idx<MAX_SHIP_CLASSES;idx++){
u_tmp = (ushort)sc->m_okKills[idx];
ADD_USHORT(u_tmp);
}
@@ -6989,7 +6993,7 @@ void process_player_stats_block_packet(ubyte *data, header *hinfo)
ml_string("Received STATS_ALLTIME\n");
// kills - alltime
for (idx=0; idx<MAX_SHIP_TYPES; idx++) {
for (idx=0; idx<MAX_SHIP_CLASSES; idx++) {
GET_USHORT(u_tmp);
sc->kills[idx] = u_tmp;
}
@@ -7023,7 +7027,7 @@ void process_player_stats_block_packet(ubyte *data, header *hinfo)
ml_string("Received STATS_MISSION\n");
// kills - mission OK
for (idx=0; idx<MAX_SHIP_TYPES; idx++) {
for (idx=0; idx<MAX_SHIP_CLASSES; idx++) {
GET_USHORT(u_tmp);
sc->m_okKills[idx] = u_tmp;
}
+10 -7
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Network/MultiTeamSelect.cpp $
* $Revision: 2.19 $
* $Date: 2005-11-16 05:46:27 $
* $Author: taylor $
* $Revision: 2.20 $
* $Date: 2005-12-29 08:08:39 $
* $Author: wmcoolmon $
*
* Multiplayer Team Selection Code
*
* $Log: not supported by cvs2svn $
* Revision 2.19 2005/11/16 05:46:27 taylor
* bunch of error checking and code cleanup for the team stuff in ship/weapon select
*
* Revision 2.18 2005/10/10 17:21:07 taylor
* remove NO_NETWORK
*
@@ -47,7 +50,7 @@
* ton of non-standard resolution fixes
*
* Revision 2.11 2005/04/25 00:28:17 wmcoolmon
* MAX_SHIP_TYPES > Num_ship_types
* MAX_SHIP_CLASSES > Num_ship_classes
*
* Revision 2.10 2005/04/03 08:48:31 Goober5000
* brought weapon loadout banks into agreement with ship info banks
@@ -1023,7 +1026,7 @@ void multi_ts_sync_interface()
// item 1 - determine how many ship types are available in the ship pool
Multi_ts_avail_count = 0;
for(idx=0;idx<Num_ship_types;idx++){
for(idx=0;idx<Num_ship_classes;idx++){
if(Ss_pool[idx] > 0){
Multi_ts_avail_count++;
}
@@ -1538,7 +1541,7 @@ void multi_ts_blit_avail_ships()
// blit the availability of all ship counts
display_count = 0;
ship_count = 0;
for(idx=0;idx<Num_ship_types;idx++){
for(idx=0;idx<Num_ship_classes;idx++){
if(Ss_pool[idx] > 0){
// if our starting display index is after this, then skip it
if(ship_count < Multi_ts_avail_start){
@@ -2628,7 +2631,7 @@ int multi_ts_get_avail_ship_class(int index)
ship_count = index + Multi_ts_avail_start;
class_index = 0;
while((ship_count >= 0) && (class_index < MAX_SHIP_TYPES)){
while((ship_count >= 0) && (class_index < MAX_SHIP_CLASSES)){
if(Ss_pool[class_index] > 0){
ship_count--;
}
+12 -8
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Network/MultiUtil.cpp $
* $Revision: 2.41 $
* $Date: 2005-12-22 04:35:04 $
* $Author: taylor $
* $Revision: 2.42 $
* $Date: 2005-12-29 08:08:39 $
* $Author: wmcoolmon $
*
* C file that contains misc. functions to support multiplayer
*
* $Log: not supported by cvs2svn $
* Revision 2.41 2005/12/22 04:35:04 taylor
* more big-endian fixes
* fix the totally retarded check I made for multi fighter beams (they really don't work right yet anyway) since it broke normal beams for clients
*
* Revision 2.40 2005/10/10 17:21:08 taylor
* remove NO_NETWORK
*
@@ -763,14 +767,14 @@ int multi_ship_class_lookup(char* ship_name)
// find the ship_info index for the ship_name
player_ship_class = -1;
for (i = 0; i < Num_ship_types; i++) {
for (i = 0; i < Num_ship_classes; i++) {
if ( !stricmp(Ship_info[i].name, ship_name) ) {
player_ship_class = i;
break;
}
} // end for
if (i == Num_ship_types){
if (i == Num_ship_classes){
return -1;
}
@@ -1082,18 +1086,18 @@ int multi_create_player( int net_player_num, player *pl, char* name, net_addr* a
// find the ship that matches the string stored in default_player_ship
for (i = 0; i < Num_ship_types; i++) {
for (i = 0; i < Num_ship_classes; i++) {
if ( !stricmp(Ship_info[i].name, default_player_ship) ) {
player_ship_class = i;
break;
}
}
if (i == Num_ship_types)
if (i == Num_ship_classes)
Assert(0);
}
if ( player_ship_class >= Num_ship_types ) {
if ( player_ship_class >= Num_ship_classes ) {
player_ship_class = multi_ship_class_lookup(default_player_ship);
nprintf(("Network","Network ==> Ship class was %d Creating a default ship for multiplayer\n", player_ship_class));
}
+9 -4
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Object/CollideShipShip.cpp $
* $Revision: 2.16 $
* $Date: 2005-10-09 09:13:29 $
* $Revision: 2.17 $
* $Date: 2005-12-29 08:08:39 $
* $Author: wmcoolmon $
*
* Routines to detect collisions and do physics, damage, etc for ships and ships
*
* $Log: not supported by cvs2svn $
* Revision 2.16 2005/10/09 09:13:29 wmcoolmon
* Added warpin/warpout speed override values to ships.tbl
*
* Revision 2.15 2005/09/25 08:25:14 Goober5000
* Okay, everything should now work again. :p Still have to do a little more with the asteroids.
* --Goober5000
@@ -1595,8 +1598,10 @@ void maybe_push_little_ship_from_fast_big_ship(object *big_obj, object *small_ob
{
// Move player out of the way of a BIG|HUGE ship warping in or out
if (Ship_info[Ships[big_obj->instance].ship_info_index].flags & (SIF_CAPITAL|SIF_SUPERCAP)) {
if (Ship_info[Ships[small_obj->instance].ship_info_index].flags & (SIF_SMALL_SHIP)) {
int big_class = Ship_info[Ships[big_obj->instance].ship_info_index].class_type;
int small_class = Ship_info[Ships[small_obj->instance].ship_info_index].class_type;
if (big_class > -1 && Ship_types[big_class].ship_bools & STI_SHIP_WARP_PUSHES) {
if (small_class > -1 && Ship_types[small_class].ship_bools & STI_SHIP_WARP_PUSHABLE) {
float big_speed = vm_vec_mag_quick(&big_obj->phys_info.vel);
if (big_speed > 3*big_obj->phys_info.max_vel.xyz.z) {
// push player away in direction perp to forward of big ship
+10 -4
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Object/ObjectSort.cpp $
* $Revision: 2.9 $
* $Date: 2005-05-24 20:55:21 $
* $Author: taylor $
* $Revision: 2.10 $
* $Date: 2005-12-29 08:08:39 $
* $Author: wmcoolmon $
*
* Sorting code for objects.
*
* $Log: not supported by cvs2svn $
* Revision 2.9 2005/05/24 20:55:21 taylor
* make sure batch rendering of lasers happens after fog is disabled in nebula missions
*
* Revision 2.8 2005/04/05 05:53:22 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
@@ -380,7 +383,10 @@ void obj_render_all(void (*render_function)(object *objp), bool *draw_viewer_las
sorted_obj * os = &Sorted_objects[Object_sort_order[i]];
os->obj->flags |= OF_WAS_RENDERED;
//This is for ship cockpits. Bobb, feel free to optimize this any way you see fit
if(os->obj == Viewer_obj && os->obj->type == OBJ_SHIP && (!Viewer_mode || (Viewer_mode & VM_PADLOCK_ANY)) && (Ship_info[Ships[os->obj->instance].ship_info_index].flags2 & SIF2_SHOW_SHIP_MODEL))
if(os->obj == Viewer_obj
&& os->obj->type == OBJ_SHIP
&& (!Viewer_mode || (Viewer_mode & VM_PADLOCK_ANY) || (Viewer_mode & VM_OTHER_SHIP))
&& (Ship_info[Ships[os->obj->instance].ship_info_index].flags2 & SIF2_SHOW_SHIP_MODEL))
{
(*draw_viewer_last) = true;
continue;
+43 -3
View File
@@ -9,13 +9,19 @@
/*
* $Source: /cvs/cvsroot/fs2open/fs2_open/code/parse/parselo.cpp,v $
* $Revision: 2.60 $
* $Author: taylor $
* $Date: 2005-12-28 22:17:01 $
* $Revision: 2.61 $
* $Author: wmcoolmon $
* $Date: 2005-12-29 08:08:39 $
*
* low level parse routines common to all types of parsers
*
* $Log: not supported by cvs2svn $
* Revision 2.60 2005/12/28 22:17:01 taylor
* deal with cf_find_file_location() changes
* add a central parse_modular_table() function which anything can use
* fix up weapon_expl so that it can properly handle modular tables and LOD count changes
* add support for for a fireball TBM (handled a little different than a normal TBM is since it only changes rather than adds)
*
* Revision 2.59 2005/12/13 21:48:39 wmcoolmon
* Music TBL to proper XMT file (-mus)
*
@@ -2039,6 +2045,16 @@ void stuff_boolean(int *i, bool a_to_eol)
*i = 0;
}
void stuff_boolean_flag(int *i, int flag, bool a_to_eol)
{
bool temp;
stuff_boolean(&temp, a_to_eol);
if(temp)
*i |= flag;
else
*i &= ~(flag);
}
// Stuffs a boolean value pointed at by Mp.
// YES/NO (supporting 1/0 now as well)
// Now supports localization :) -WMC
@@ -2165,6 +2181,30 @@ void stuff_ubyte(ubyte *i)
diag_printf("Stuffed byte: %i\n", *i);
}
int parse_string_flag_list(int *dest, flag_def_list defs[], int defs_size)
{
Assert(dest!=NULL); //wtf?
char (*slp)[NAME_LENGTH] = (char(*)[32])new char[defs_size*NAME_LENGTH];
int num_strings = stuff_string_list(slp, defs_size);
int i, j;
for(i = 0; i < num_strings; i++)
{
for(j = 0; j < defs_size; j++)
{
if(!stricmp(slp[i], defs[j].name)) {
(*dest) |= defs[j].def;
}
}
}
delete[] slp; //>_>
//nobody saw that right
return num_strings;
}
// Stuffs a list of strings
int stuff_string_list(char slp[][NAME_LENGTH], int max_strings)
{
+11 -3
View File
@@ -9,15 +9,21 @@
/*
* $Source: /cvs/cvsroot/fs2open/fs2_open/code/parse/parselo.h,v $
* $Revision: 2.38 $
* $Author: taylor $
* $Date: 2005-12-28 22:17:01 $
* $Revision: 2.39 $
* $Author: wmcoolmon $
* $Date: 2005-12-29 08:08:39 $
*
* Header for parselo.c
* 20-07-02 21:20 DTP
* Bumped MISSION_TEXT_SIZE from 390000 to 1000000
*
* $Log: not supported by cvs2svn $
* Revision 2.38 2005/12/28 22:17:01 taylor
* deal with cf_find_file_location() changes
* add a central parse_modular_table() function which anything can use
* fix up weapon_expl so that it can properly handle modular tables and LOD count changes
* add support for for a fireball TBM (handled a little different than a normal TBM is since it only changes rather than adds)
*
* Revision 2.37 2005/12/13 21:48:39 wmcoolmon
* Music TBL to proper XMT file (-mus)
*
@@ -487,6 +493,7 @@ extern void stuff_int(int *i);
extern void stuff_sound(int *dest);
extern void stuff_ubyte(ubyte *i);
extern int stuff_string_list(char slp[][NAME_LENGTH], int max_strings);
extern int parse_string_flag_list(int *dest, flag_def_list defs[], int defs_size);
extern int stuff_int_list(int *ilp, int max_ints, int lookup_type = RAW_INTEGER_TYPE);
extern int stuff_float_list(float* flp, int max_floats);
extern int stuff_vector_list(vec3d *vlp, int max_vecs);
@@ -503,6 +510,7 @@ extern int get_string(char *str);
extern void stuff_parenthesized_vector(vec3d *vp);
extern void stuff_boolean(int *i, bool a_to_eol=true);
extern void stuff_boolean(bool *b, bool a_to_eol=true);
extern void stuff_boolean_flag(int *i, int flag, bool a_to_eol=true);
extern int check_for_string(char *pstr);
extern int check_for_string_raw(char *pstr);
+22 -25
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/parse/SEXP.CPP $
* $Revision: 2.192 $
* $Date: 2005-12-06 03:01:25 $
* $Author: taylor $
* $Revision: 2.193 $
* $Date: 2005-12-29 08:08:39 $
* $Author: wmcoolmon $
*
* main sexpression generator
*
* $Log: not supported by cvs2svn $
* Revision 2.192 2005/12/06 03:01:25 taylor
* add a nomusic check to not get an error when eval on the change soundtrack sexp
*
* Revision 2.191 2005/11/23 06:55:47 taylor
* make sure all weapons that will get used later in a mission get preloaded
*
@@ -2726,7 +2729,7 @@ int check_sexp_syntax(int node, int return_type, int recursive, int *bad_node, i
if (!stricmp(CTEXT(node), "<any support ship class>"))
break;
for (i = 0; i < Num_ship_types; i++ ) {
for (i = 0; i < Num_ship_classes; i++ ) {
if ( !stricmp(CTEXT(node), Ship_info[i].name) )
{
if (Ship_info[i].flags & SIF_SUPPORT)
@@ -2736,7 +2739,7 @@ int check_sexp_syntax(int node, int return_type, int recursive, int *bad_node, i
}
}
if ( i == Num_ship_types )
if ( i == Num_ship_classes )
return SEXP_CHECK_INVALID_SUPPORT_SHIP_CLASS;
break;
@@ -2831,13 +2834,9 @@ int check_sexp_syntax(int node, int return_type, int recursive, int *bad_node, i
return SEXP_CHECK_TYPE_MISMATCH;
}
for (i=0; i<MAX_SHIP_TYPE_COUNTS; i++){
if (!stricmp( Ship_type_names[i], CTEXT(node))){
break;
}
}
i = ship_type_name_lookup(CTEXT(node));
if (i == MAX_SHIP_TYPE_COUNTS){
if (i < 0){
return SEXP_CHECK_INVALID_SHIP_TYPE;
}
@@ -3156,12 +3155,12 @@ int check_sexp_syntax(int node, int return_type, int recursive, int *bad_node, i
if ( type2 != SEXP_ATOM_STRING )
return SEXP_CHECK_TYPE_MISMATCH;
for (i = 0; i < Num_ship_types; i++ ) {
for (i = 0; i < Num_ship_classes; i++ ) {
if ( !stricmp(CTEXT(node), Ship_info[i].name) )
break;
}
if ( i == Num_ship_types )
if ( i == Num_ship_classes )
return SEXP_CHECK_INVALID_SHIP_CLASS_NAME;
break;
@@ -4844,22 +4843,20 @@ int sexp_ship_type_destroyed( int n )
percent = eval_num(n);
shiptype = CTEXT(CDR(n));
for ( type = 0; type < MAX_SHIP_TYPE_COUNTS; type++ ) {
if ( !stricmp( Ship_type_names[type], shiptype) )
break;
}
type = ship_type_name_lookup(shiptype);
// bogus if we reach the end of this array!!!!
if ( type == MAX_SHIP_TYPE_COUNTS ) {
if ( type < 0 ) {
Warning(LOCATION, "Invalid shiptype passed to sexp_ship_type_destroyed");
return 0;
}
if ( Ship_counts[type].total == 0 )
if ( type <= Ship_type_counts.size() || Ship_type_counts[type].total == 0 )
return 0;
//We are safe from array indexing probs b/c of previous if.
// determine if the percentage of killed/total is >= percentage given in the expression
if ( (Ship_counts[type].killed * 100 / Ship_counts[type].total) >= percent)
if ( (Ship_type_counts[type].killed * 100 / Ship_type_counts[type].total) >= percent)
return SEXP_KNOWN_TRUE;
return 0;
@@ -7490,7 +7487,7 @@ int sexp_is_ship_type( int n )
return SEXP_CANT_EVAL;
// if it doesn't match, return false
if (!(Ship_info[Ships[ship_num].ship_info_index].flags & Ship_type_flags[ship_type_num]))
if(ship_class_query_general_type(Ships[ship_num].ship_info_index) != ship_type_num)
return SEXP_FALSE;
// increment
@@ -11010,7 +11007,7 @@ int sexp_shield_quad_low(int node)
if((Ships[sindex].objnum < 0) || (Ships[sindex].objnum >= MAX_OBJECTS)){
return 0;
}
if((Ships[sindex].ship_info_index < 0) || (Ships[sindex].ship_info_index >= Num_ship_types)){
if((Ships[sindex].ship_info_index < 0) || (Ships[sindex].ship_info_index >= Num_ship_classes)){
return 0;
}
objp = &Objects[Ships[sindex].objnum];
@@ -12605,8 +12602,8 @@ int sexp_num_type_kills(int node)
// look stuff up
total = 0;
for(idx=0; idx<Num_ship_types; idx++){
if((p->stats.m_okKills[idx] > 0) && (Ship_info[idx].flags & Ship_type_flags[st_index])){
for(idx=0; idx<Num_ship_classes; idx++){
if((p->stats.m_okKills[idx] > 0) && ship_class_query_general_type(idx)==st_index){
total += p->stats.m_okKills[idx];
}
}
@@ -12654,7 +12651,7 @@ int sexp_num_class_kills(int node)
// get the ship type we're looking for
si_index = ship_info_lookup(CTEXT(CDR(node)));
if((si_index < 0) || (si_index > Num_ship_types)){
if((si_index < 0) || (si_index > Num_ship_classes)){
return 0;
}
+17 -14
View File
@@ -9,14 +9,17 @@
/*
* $Logfile: /Freespace2/code/Playerman/ManagePilot.cpp $
* $Revision: 2.23 $
* $Date: 2005-10-10 17:21:09 $
* $Author: taylor $
* $Revision: 2.24 $
* $Date: 2005-12-29 08:08:42 $
* $Author: wmcoolmon $
*
* ManagePilot.cpp has code to load and save pilot files, and to select and
* manage the pilot
*
* $Log: not supported by cvs2svn $
* Revision 2.23 2005/10/10 17:21:09 taylor
* remove NO_NETWORK
*
* Revision 2.22 2005/07/22 10:18:39 Goober5000
* CVS header tweaks
* --Goober5000
@@ -595,12 +598,12 @@ void pilot_write_techroom_data(CFILE *file, int multi)
return;
// write the ship and weapon count
cfwrite_int(Num_ship_types, file);
cfwrite_int(Num_ship_classes, file);
cfwrite_int(Num_weapon_types, file);
cfwrite_int(Intel_info_size, file);
// write all ship flags out
for (idx=0; idx<Num_ship_types; idx++) {
for (idx=0; idx<Num_ship_classes; idx++) {
out = (Ship_info[idx].flags & SIF_IN_TECH_DATABASE) ? (ubyte)1 : (ubyte)0;
cfwrite_ubyte(out, file);
}
@@ -629,7 +632,7 @@ void pilot_read_techroom_data(CFILE *file, int pfile_version)
// read in ship and weapon counts
ship_count = cfread_int(file);
weapon_count = cfread_int(file);
Assert(ship_count <= MAX_SHIP_TYPES);
Assert(ship_count <= MAX_SHIP_CLASSES);
Assert(weapon_count <= MAX_WEAPON_TYPES);
// maintain compatibility w/ demo version
@@ -693,11 +696,11 @@ void pilot_write_loadout(CFILE *file, int multi)
cfwrite_string_len(Player_loadout.last_modified, file);
// write ship and weapon counts
cfwrite_int(Num_ship_types, file);
cfwrite_int(Num_ship_classes, file);
cfwrite_int(Num_weapon_types, file);
// write ship pool
for ( i = 0; i < Num_ship_types; i++ ) {
for ( i = 0; i < Num_ship_classes; i++ ) {
cfwrite_int(Player_loadout.ship_pool[i], file);
cfwrite_string_len(Ship_info[i].name, file);
}
@@ -741,7 +744,7 @@ void pilot_read_loadout(CFILE *file, int pfile_version)
// read in ship and weapon counts
ship_count = cfread_int(file);
weapon_count = cfread_int(file);
Assert(ship_count <= MAX_SHIP_TYPES);
Assert(ship_count <= MAX_SHIP_CLASSES);
Assert(weapon_count <= MAX_WEAPON_TYPES);
// read in ship pool
@@ -1159,11 +1162,11 @@ void read_stats_block(CFILE *file, int pfile_version, scoring_struct *stats)
}
total = cfread_int(file);
if (total > MAX_SHIP_TYPES){
Warning(LOCATION, "Some ship kill information will be lost due to MAX_SHIP_TYPES decrease");
if (total > MAX_SHIP_CLASSES){
Warning(LOCATION, "Some ship kill information will be lost due to MAX_SHIP_CLASSES decrease");
}
for (i=0; i<total && i<MAX_SHIP_TYPES; i++){
for (i=0; i<total && i<MAX_SHIP_CLASSES; i++){
if (pfile_version >= 142) {
k_count = cfread_ushort(file);
cfread_string_len(kname, NAME_LENGTH, file);
@@ -1283,7 +1286,7 @@ int write_pilot_file_core(player *p)
// write the ship name for last ship flown by the player
si_index = p->last_ship_flown_si_index;
if((si_index < 0) || (si_index >= Num_ship_types)){
if((si_index < 0) || (si_index >= Num_ship_classes)){
si_index = 0;
}
@@ -1468,7 +1471,7 @@ void write_stats_block(CFILE *file,scoring_struct *stats, int multi)
cfwrite_int(0, file);
}
total = MAX_SHIP_TYPES;
total = MAX_SHIP_CLASSES;
while (total && !stats->kills[total - 1]){ // find last used element
total--;
}
+9 -4
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Playerman/PlayerControl.cpp $
* $Revision: 2.36 $
* $Date: 2005-10-24 02:15:41 $
* $Revision: 2.37 $
* $Date: 2005-12-29 08:08:42 $
* $Author: wmcoolmon $
*
* Routines to deal with player ship movement
*
* $Log: not supported by cvs2svn $
* Revision 2.36 2005/10/24 02:15:41 wmcoolmon
* Removed max_overclock restriction related to warpout
*
* Revision 2.35 2005/10/20 17:50:00 taylor
* fix player warpout
* basic code cleanup (that previous braces change did nothing for readability)
@@ -1528,7 +1531,8 @@ void player_init_all_alone_msg()
}
if ( Ships[objp->instance].team == Player_ship->team ) {
if ( !(Ship_info[Ships[objp->instance].ship_info_index].flags & SIF_HARMLESS) ) {
int ship_type = Ship_info[Ships[objp->instance].ship_info_index].class_type;
if ( ship_type != -1 && (Ship_types[ship_type].message_bools & STI_MSG_COUNTS_FOR_ALONE) ) {
return;
}
}
@@ -2239,7 +2243,8 @@ void player_maybe_play_all_alone_msg()
}
if ( Ships[objp->instance].team == Player_ship->team ) {
if ( !(Ship_info[Ships[objp->instance].ship_info_index].flags & SIF_HARMLESS) ) {
int ship_type = Ship_info[Ships[objp->instance].ship_info_index].class_type;
if ( ship_type != -1 && (Ship_types[ship_type].message_bools & STI_MSG_COUNTS_FOR_ALONE) ) {
return;
}
}
+16 -6
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Ship/Afterburner.cpp $
* $Revision: 2.19 $
* $Date: 2005-11-21 02:43:30 $
* $Author: Goober5000 $
* $Revision: 2.20 $
* $Date: 2005-12-29 08:08:42 $
* $Author: wmcoolmon $
*
* C file for managing the afterburners
*
* $Log: not supported by cvs2svn $
* Revision 2.19 2005/11/21 02:43:30 Goober5000
* change from "setting" to "profile"; this way makes more sense
* --Goober5000
*
* Revision 2.18 2005/11/21 00:46:05 Goober5000
* add ai_settings.tbl
* --Goober5000
@@ -298,7 +302,7 @@ void afterburners_start(object *objp)
return;
shipp = &Ships[objp->instance];
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_types );
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes );
sip = &Ship_info[shipp->ship_info_index];
if ( !(sip->flags & SIF_AFTERBURNER) ) {
@@ -319,6 +323,9 @@ void afterburners_start(object *objp)
percent_left = shipp->afterburner_fuel / sip->afterburner_fuel_capacity;
//Do anim
ship_start_animation_type(shipp, TRIGGER_TYPE_DOCK_BAY_DOOR, 0, 1);
if ( objp == Player_obj ) {
Player_afterburner_start_time = timer_get_milliseconds();
Player_disengage_timer = 1;
@@ -364,7 +371,7 @@ void afterburners_update(object *objp, float fl_frametime)
shipp = &Ships[objp->instance];
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_types );
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes );
sip = &Ship_info[shipp->ship_info_index];
if ( (objp->flags & OF_PLAYER_SHIP ) && (Game_mode & GM_DEAD) ) {
@@ -476,7 +483,7 @@ void afterburners_stop(object *objp, int key_released)
shipp = &Ships[objp->instance];
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_types );
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes );
sip = &Ship_info[shipp->ship_info_index];
if ( (objp->flags & OF_PLAYER_SHIP) && key_released ) {
@@ -496,6 +503,9 @@ void afterburners_stop(object *objp, int key_released)
float percent_left;
percent_left = shipp->afterburner_fuel / sip->afterburner_fuel_capacity;
//Do anim
ship_start_animation_type(shipp, TRIGGER_TYPE_DOCK_BAY_DOOR, 0, -1);
if ( objp == Player_obj ) {
if ( !key_released ) {
+8 -5
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Ship/Shield.cpp $
* $Revision: 2.36 $
* $Date: 2005-10-10 17:21:10 $
* $Author: taylor $
* $Revision: 2.37 $
* $Date: 2005-12-29 08:08:42 $
* $Author: wmcoolmon $
*
* Stuff pertaining to shield graphical effects, etc.
*
* $Log: not supported by cvs2svn $
* Revision 2.36 2005/10/10 17:21:10 taylor
* remove NO_NETWORK
*
* Revision 2.35 2005/09/24 07:07:16 Goober5000
* another species overhaul
* --Goober5000
@@ -944,7 +947,7 @@ void copy_shield_to_globals( int objnum, shield_info *shieldp )
Shield_hits[shnum].rgb[0] = 255;
Shield_hits[shnum].rgb[1] = 255;
Shield_hits[shnum].rgb[2] = 255;
if((objnum >= 0) && (objnum < MAX_OBJECTS) && (Objects[objnum].type == OBJ_SHIP) && (Objects[objnum].instance >= 0) && (Objects[objnum].instance < MAX_SHIPS) && (Ships[Objects[objnum].instance].ship_info_index >= 0) && (Ships[Objects[objnum].instance].ship_info_index < Num_ship_types)){
if((objnum >= 0) && (objnum < MAX_OBJECTS) && (Objects[objnum].type == OBJ_SHIP) && (Objects[objnum].instance >= 0) && (Objects[objnum].instance < MAX_SHIPS) && (Ships[Objects[objnum].instance].ship_info_index >= 0) && (Ships[Objects[objnum].instance].ship_info_index < Num_ship_classes)){
ship_info *sip = &Ship_info[Ships[Objects[objnum].instance].ship_info_index];
Shield_hits[shnum].rgb[0] = sip->shield_color[0];
@@ -1014,7 +1017,7 @@ void create_shield_low_detail(int objnum, int model_num, matrix *orient, vec3d *
Shield_hits[shnum].rgb[0] = 255;
Shield_hits[shnum].rgb[1] = 255;
Shield_hits[shnum].rgb[2] = 255;
if((objnum >= 0) && (objnum < MAX_OBJECTS) && (Objects[objnum].type == OBJ_SHIP) && (Objects[objnum].instance >= 0) && (Objects[objnum].instance < MAX_SHIPS) && (Ships[Objects[objnum].instance].ship_info_index >= 0) && (Ships[Objects[objnum].instance].ship_info_index < Num_ship_types)){
if((objnum >= 0) && (objnum < MAX_OBJECTS) && (Objects[objnum].type == OBJ_SHIP) && (Objects[objnum].instance >= 0) && (Objects[objnum].instance < MAX_SHIPS) && (Ships[Objects[objnum].instance].ship_info_index >= 0) && (Ships[Objects[objnum].instance].ship_info_index < Num_ship_classes)){
ship_info *sip = &Ship_info[Ships[Objects[objnum].instance].ship_info_index];
Shield_hits[shnum].rgb[0] = sip->shield_color[0];
+457 -484
View File
File diff suppressed because it is too large. Load diff
+91 -27
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Ship/Ship.h $
* $Revision: 2.125 $
* $Date: 2005-12-13 22:32:30 $
* $Revision: 2.126 $
* $Date: 2005-12-29 08:08:42 $
* $Author: wmcoolmon $
*
* all sorts of cool stuff about ships
*
* $Log: not supported by cvs2svn $
* Revision 2.125 2005/12/13 22:32:30 wmcoolmon
* Ability to disable damage particle spew on ships
*
* Revision 2.124 2005/12/12 21:32:14 taylor
* allow use of a specific LOD for ship and weapon rendering in the hud targetbox
*
@@ -515,7 +518,7 @@
* I also (think) I squashed a bug in the warpmodel code
*
* Revision 2.6 2002/11/10 19:57:36 DTP
* DTP bumped back MAX_SHIP_TYPES to 130
* DTP bumped back MAX_SHIP_CLASSES to 130
*
* Revision 2.5 2002/10/31 21:56:44 DTP
* DTP Bumped Max_exited_ships from 200 to double that of MAX_SHIPS = 800 . make sense ehh. for logging effect.
@@ -1392,7 +1395,7 @@ extern int ship_find_exited_ship_by_signature( int signature);
#define SIF_IN_TECH_DATABASE (1 << 19) // is ship type to be listed in the tech database?
#define SIF_IN_TECH_DATABASE_M (1 << 20) // is ship type to be listed in the tech database for multiplayer?
#define SIF_SHIP_CLASS_STEALTH (1 << 21) // the ship is a stealth ship
#define SIF_STEALTH (1 << 21) // the ship has stealth capabilities
#define SIF_SUPERCAP (1 << 22) // the ship is a supercap
#define SIF_DRYDOCK (1 << 23) // the ship is a drydock
#define SIF_SHIP_CLASS_DONT_COLLIDE_INVIS (1 << 24) // Don't collide with this ship's invisible polygons
@@ -1430,10 +1433,27 @@ extern int ship_find_exited_ship_by_signature( int signature);
// for ships of this type, we make beam weapons miss a little bit otherwise they'd be way too powerful
#define SIF_BEAM_JITTER (SIF_CARGO | SIF_FIGHTER | SIF_BOMBER | SIF_FREIGHTER | SIF_TRANSPORT | SIF_SENTRYGUN | SIF_NAVBUOY | SIF_ESCAPEPOD)
#define REGULAR_WEAPON (1<<0)
#define DOGFIGHT_WEAPON (1<<1)
#define MAX_THRUSTER_PARTICLES 3
typedef struct thruster_particles{
char thruster_particle_bitmap01_name[NAME_LENGTH];
int thruster_particle_bitmap01;
int thruster_particle_bitmap01_nframes;
float min_rad;
float max_rad;
int n_high;
int n_low;
float variance;
}thruster_particles;
// defines for ship types. These defines are distinct from the flag values in the ship_info struct. These
// values are used for array lookups, etc.
/*
#define MAX_SHIP_TYPE_COUNTS 20
*/
/*
#define SHIP_TYPE_NONE 0
#define SHIP_TYPE_CARGO 1
#define SHIP_TYPE_FIGHTER_BOMBER 2
@@ -1454,27 +1474,69 @@ extern int ship_find_exited_ship_by_signature( int signature);
#define SHIP_TYPE_GAS_MINER 17
#define SHIP_TYPE_CORVETTE 18
#define SHIP_TYPE_KNOSSOS_DEVICE 19
*/
#define REGULAR_WEAPON (1<<0)
#define DOGFIGHT_WEAPON (1<<1)
#define STI_MSG_COUNTS_FOR_ALONE (1<<0)
#define STI_MSG_PRAISE_DESTRUCTION (1<<1)
#define MAX_THRUSTER_PARTICLES 3
typedef struct thruster_particles{
char thruster_particle_bitmap01_name[NAME_LENGTH];
int thruster_particle_bitmap01;
int thruster_particle_bitmap01_nframes;
float min_rad;
float max_rad;
int n_high;
int n_low;
float variance;
}thruster_particles;
#define STI_HUD_HOTKEY_ON_LIST (1<<0)
#define STI_HUD_TARGET_AS_THREAT (1<<1)
#define STI_HUD_SHOW_ATTACK_DIRECTION (1<<2)
#define STI_SHIP_SCANNABLE (1<<0)
#define STI_SHIP_WARP_PUSHES (1<<1)
#define STI_SHIP_WARP_PUSHABLE (1<<2)
#define STI_WEAP_BEAMS_EASILY_HIT (1<<0)
#define STI_AI_ACCEPT_PLAYER_ORDERS (1<<0)
#define STI_AI_AUTO_ATTACKS (1<<1)
#define STI_AI_ATTEMPT_BROADSIDE (1<<2)
#define STI_AI_GUARDS_ATTACK (1<<3)
#define STI_AI_TURRETS_ATTACK (1<<4)
#define STI_AI_CAN_FORM_WING (1<<5)
typedef struct ship_type_info {
char name[NAME_LENGTH];
//Messaging?
int message_bools;
//HUD
int hud_bools;
//Ship
int ship_bools; //For lack of better term
float debris_max_speed;
//Weapons
int weapon_bools;
float ff_multiplier;
float emp_multiplier;
//Fog
float fog_start_dist;
float fog_complete_dist;
//AI
int ai_valid_goals;
int ai_player_orders;
int ai_bools;
int ai_active_dock;
int ai_passive_dock;
ship_type_info(){memset(this, 0, sizeof(ship_type_info));}
} ship_type_info;
extern std::vector<ship_type_info> Ship_types;
// The real FreeSpace ship_info struct.
typedef struct ship_info {
char name[NAME_LENGTH]; // name for the ship
char short_name[NAME_LENGTH]; // short name, for use in the editor?
int species; // which species this craft belongs to
int species; // which species this craft belongs to
int class_type; //For type table
char *type_str; // type string used by tooltips
char *maneuverability_str; // string used by tooltips
char *armor_str; // string used by tooltips
@@ -1742,8 +1804,8 @@ extern int ai_paused;
extern int CLOAKMAP;
extern int Num_reinforcements;
extern int Num_ship_types;
extern ship_info Ship_info[MAX_SHIP_TYPES];
extern int Num_ship_classes;
extern ship_info Ship_info[MAX_SHIP_CLASSES];
extern reinforcements Reinforcements[MAX_REINFORCEMENTS];
// structure definition for ship type counts. Used to give a count of the number of ships
@@ -1753,12 +1815,14 @@ extern reinforcements Reinforcements[MAX_REINFORCEMENTS];
typedef struct ship_counts {
int total;
int killed;
ship_counts(){total=0;killed=0;}
} ship_counts;
extern char *Ship_type_names[MAX_SHIP_TYPE_COUNTS];
extern int Ship_type_flags[MAX_SHIP_TYPE_COUNTS]; // SIF_* flags for each ship type
extern ship_counts Ship_counts[MAX_SHIP_TYPE_COUNTS];
extern int Ship_type_priorities[MAX_SHIP_TYPE_COUNTS];
extern std::vector<ship_counts> Ship_type_counts;
//extern int Ship_type_flags[MAX_SHIP_TYPE_COUNTS]; // SIF_* flags for each ship type
//extern ship_counts Ship_counts[MAX_SHIP_TYPE_COUNTS];
//extern int Ship_type_priorities[MAX_SHIP_TYPE_COUNTS];
// Use the below macros when you want to find the index of an array element in the
@@ -1895,8 +1959,8 @@ extern void ship_close(); // called in game_shutdown() to free malloced memory
extern void ship_assign_sound_all();
extern void ship_assign_sound(ship *sp);
extern void ship_add_ship_type_count( int ship_info_flag, int num );
extern void ship_add_ship_type_kill_count( int ship_info_flag );
extern void ship_add_ship_type_count( int ship_info_index, int num );
extern void ship_add_ship_type_kill_count( int ship_info_index );
extern int ship_get_type(char* output, ship_info* sip);
extern int ship_get_default_orders_accepted( ship_info *sip );
+6 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Ship/ShipFX.cpp $
* $Revision: 2.58 $
* $Date: 2005-12-13 22:32:30 $
* $Revision: 2.59 $
* $Date: 2005-12-29 08:08:42 $
* $Author: wmcoolmon $
*
* Routines for ship effects (as in special)
*
* $Log: not supported by cvs2svn $
* Revision 2.58 2005/12/13 22:32:30 wmcoolmon
* Ability to disable damage particle spew on ships
*
* Revision 2.57 2005/12/04 18:58:07 wmcoolmon
* subsystem + shockwave armor support; countermeasures as weapons
*
@@ -3461,6 +3464,6 @@ void shipfx_stop_cloak(ship *shipp, int warmdown)
{
shipp->cloak_stage=3;
shipp->time_until_full_cloak=timestamp(warmdown);
if (!(Ship_info[shipp->ship_info_index].flags & SIF_SHIP_CLASS_STEALTH))
if (!(Ship_info[shipp->ship_info_index].flags & SIF_STEALTH))
shipp->flags2 &= ~(SF2_STEALTH);
}
+11 -72
View File
@@ -9,11 +9,14 @@
/*
* $Logfile: /Freespace2/code/species_defs/species_defs.cpp $
* $Revision: 1.26 $
* $Date: 2005-12-29 00:01:29 $
* $Author: taylor $
* $Revision: 1.27 $
* $Date: 2005-12-29 08:08:42 $
* $Author: wmcoolmon $
*
* $Log: not supported by cvs2svn $
* Revision 1.26 2005/12/29 00:01:29 taylor
* add support for a species_defs modular table with XMT support (*-sdf.tbm)
*
* Revision 1.25 2005/11/21 23:57:26 taylor
* some minor thruster cleanup, if you could actually use the term "clean"
*
@@ -118,6 +121,7 @@
#pragma warning(disable:4710) // function not inlined
#include "globalincs/def_files.h"
#include "species_defs/species_defs.h"
#include "cfile/cfile.h"
#include "parse/parselo.h"
@@ -129,72 +133,6 @@
int Num_species;
species_info Species_info[MAX_SPECIES];
static int species_initted;
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// This is the default table
// Please note that the {\n\}s should be removed from the end of each line
// if you intend to use this to format your own species_defs.tbl.
char *default_species_table = "\
\n\
#SPECIES DEFS \n\
\n\
;------------------------ \n\
; Terran \n\
;------------------------ \n\
$Species_Name: Terran \n\
$Default IFF: Friendly \n\
$FRED Color: ( 0, 0, 192 ) \n\
$MiscAnims: \n\
+Debris_Texture: debris01a \n\
+Shield_Hit_ani: shieldhit01a \n\
$ThrustAnims: \n\
+Normal: thruster01 \n\
+Afterburn: thruster01a \n\
$ThrustGlows: \n\
+Normal: thrusterglow01 \n\
+Afterburn: thrusterglow01a \n\
$AwacsMultiplier: 1.00 \n\
\n\
;------------------------ \n\
; Vasudan \n\
;------------------------ \n\
$Species_Name: Vasudan \n\
$Default IFF: Friendly \n\
$FRED Color: ( 0, 128, 0 ) \n\
$MiscAnims: \n\
+Debris_Texture: debris01b \n\
+Shield_Hit_ani: shieldhit01a \n\
$ThrustAnims: \n\
+Normal: thruster02 \n\
+Afterburn: thruster02a \n\
$ThrustGlows: \n\
+Normal: thrusterglow02 \n\
+Afterburn: thrusterglow02a \n\
$AwacsMultiplier: 1.25 \n\
\n\
;------------------------ \n\
; Shivan \n\
;------------------------ \n\
$Species_Name: Shivan \n\
$Default IFF: Hostile \n\
$FRED Color: ( 192, 0, 0 ) \n\
$MiscAnims: \n\
+Debris_Texture: debris01c \n\
+Shield_Hit_ani: shieldhit01a \n\
$ThrustAnims: \n\
+Normal: thruster03 \n\
+Afterburn: thruster03a \n\
$ThrustGlows: \n\
+Normal: thrusterglow03 \n\
+Afterburn: thrusterglow03a \n\
$AwacsMultiplier: 1.50 \n\
\n\
#END \n\
";
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// This function parses the data from the species_defs.tbl
@@ -296,7 +234,7 @@ void parse_species_tbl(char *longname)
mprintf(("Unable to parse %s! Code = %i.\n", rval, (longname) ? longname : NOX("<default>")));
} else {
if (longname == NULL) {
read_file_text_from_array(default_species_table);
read_file_text_from_array(defaults_get_file("species_defs.tbl"));
} else {
read_file_text(longname);
}
@@ -482,10 +420,11 @@ void parse_species_tbl(char *longname)
lcl_ext_close();
}
int Species_initted = 0;
void species_init()
{
if (species_initted)
if (Species_initted)
return;
Num_species = 0;
@@ -500,5 +439,5 @@ void species_init()
parse_modular_table("*-sdf.tbm", parse_species_tbl);
species_initted = 1;
Species_initted = 1;
}
+115 -58
View File
@@ -9,14 +9,17 @@
/*
* $Logfile: /Freespace2/code/Starfield/StarField.cpp $
* $Revision: 2.59 $
* $Date: 2005-11-13 06:50:57 $
* $Author: taylor $
* $Revision: 2.60 $
* $Date: 2005-12-29 08:08:42 $
* $Author: wmcoolmon $
*
* Code to handle and draw starfields, background space image bitmaps, floating
* debris, etc.
*
* $Log: not supported by cvs2svn $
* Revision 2.59 2005/11/13 06:50:57 taylor
* don't fail if not a starfield pof to load, regular starfield bitmaps don't hard fail so this shouldn't either
*
* Revision 2.58 2005/10/30 20:03:40 taylor
* add a bunch of Assert()'s and NULL checks to either help debug or avoid errors
* fix Mantis bug #381
@@ -815,88 +818,85 @@ void starfield_kill_bitmap_buffer()
}
}
// call on game startup
void stars_init()
int Num_starfields = 0;
int Num_starfield_suns = 0;
int Num_debris_normal = 0;
int Num_debris_nebula = 0;
void parse_startbl(char *longname)
{
starfield_bitmap *bm;
int count, idx, j;
char filename[MAX_FILENAME_LEN+1] = "";
starfield_bitmap *bm;
char glow_filename[MAX_FILENAME_LEN+1] = "";
float r, g, b, i, spec_r, spec_g, spec_b;
int sun_glare;
int flarecount,flaretexcount, isflare;
flare_info flares[MAX_FLARE_COUNT];
char flare_filenames[MAX_FLARE_BMP][MAX_FILENAME_LEN+1];
int j;
char tempf[16];
flarecount = flaretexcount = isflare = 0; //get rid of warnings
// parse stars.tbl
read_file_text("stars.tbl");
read_file_text(longname);
reset_parse();
// make all bitmaps invalid
for(idx=0; idx<MAX_STARFIELD_BITMAPS; idx++){
Starfield_bitmaps[idx].bitmap = -1;
Starfield_bitmaps[idx].n_frames = 0;
Starfield_bitmaps[idx].fps = 0;
Starfield_bitmaps[idx].glow_bitmap = -1;
Starfield_bitmaps[idx].glow_n_frames = 1;
Starfield_bitmaps[idx].glow_fps = 0;
strcpy(Starfield_bitmaps[idx].filename, "");
strcpy(Starfield_bitmaps[idx].glow_filename, "");
Sun_bitmaps[idx].bitmap = -1;
Sun_bitmaps[idx].n_frames = 0;
Sun_bitmaps[idx].fps = 0;
Sun_bitmaps[idx].glow_bitmap = -1;
Sun_bitmaps[idx].glow_n_frames = 1;
Sun_bitmaps[idx].glow_fps = 0;
strcpy(Sun_bitmaps[idx].filename, "");
strcpy(Sun_bitmaps[idx].glow_filename, "");
}
// starfield bitmaps
count = 0;
while(!optional_string("#end")){
while(!optional_string("#end"))
{
// intensity alpha bitmap
if(optional_string("$Bitmap:")){
if(optional_string("$Bitmap:"))
{
stuff_string(filename, F_NAME, NULL);
if(count < MAX_STARFIELD_BITMAPS){
bm = &Starfield_bitmaps[count++];
if(Num_starfields < MAX_STARFIELD_BITMAPS)
{
bm = &Starfield_bitmaps[Num_starfields++];
strcpy(bm->filename, filename);
bm->xparent = 0;
bm->bitmap = bm_load(bm->filename);
if(bm->bitmap == -1){
if(bm->bitmap == -1)
{
bm->bitmap = bm_load_animation(bm->filename, &bm->n_frames, &bm->fps, 1);
if(bm->bitmap == -1){
Warning(LOCATION, "cannot find bitmap %s", filename);
}
}
}
else
{
Warning(LOCATION, "Could not add starfield intensity bitmap %s; Maximum limit of %d reached", filename, MAX_STARFIELD_BITMAPS);
}
}
// green xparency bitmap
else if(optional_string("$BitmapX:")){
else if(optional_string("$BitmapX:"))
{
stuff_string(filename, F_NAME, NULL);
if(count < MAX_STARFIELD_BITMAPS){
bm = &Starfield_bitmaps[count++];
if(Num_starfields < MAX_STARFIELD_BITMAPS)
{
bm = &Starfield_bitmaps[Num_starfields++];
strcpy(bm->filename, filename);
bm->xparent = 1;
bm->bitmap = bm_load(bm->filename);
if(bm->bitmap == -1){
if(bm->bitmap == -1)
{
bm->bitmap = bm_load_animation(bm->filename, &bm->n_frames, &bm->fps, 1);
if(bm->bitmap == -1){
Warning(LOCATION, "cannot find bitmap %s", filename);
}
}
}
else
{
Warning(LOCATION, "Could not add starfield transparency bitmap %s; Maximum limit of %d reached", filename, MAX_STARFIELD_BITMAPS);
}
}
}
// sun bitmaps
count = 0;
while(!optional_string("#end")){
if(optional_string("$Sun:")){
while(!optional_string("#end"))
{
if(optional_string("$Sun:"))
{
stuff_string(filename, F_NAME, NULL);
// associated glow
@@ -920,7 +920,8 @@ void stars_init()
spec_b = b;
}
//lens flare stuff
if(optional_string("$Flare:")) {
if(optional_string("$Flare:"))
{
isflare = 1;
required_string("+FlareCount:");
stuff_int(&flarecount);
@@ -971,8 +972,9 @@ void stars_init()
sun_glare=!optional_string("$NoGlare:");
if(count < MAX_STARFIELD_BITMAPS){
bm = &Sun_bitmaps[count++];
if(Num_starfield_suns < MAX_STARFIELD_BITMAPS)
{
bm = &Sun_bitmaps[Num_starfield_suns++];
strcpy(bm->filename, filename);
strcpy(bm->glow_filename, glow_filename);
bm->xparent = 1;
@@ -1014,6 +1016,10 @@ void stars_init()
bm->spec_b = spec_b;
}
}
else
{
Warning(LOCATION, "Too many suns in stars.tbl or modular tables. Maximum of %d exceeded.", MAX_STARFIELD_BITMAPS);
}
}
//Don't parse motion debris if we don't have to.
@@ -1023,28 +1029,79 @@ void stars_init()
}
// normal debris pieces
count = 0;
while(!optional_string("#end")){
while(!optional_string("#end"))
{
required_string("$Debris:");
stuff_string(filename, F_NAME, NULL);
if(count < MAX_DEBRIS_VCLIPS){
strcpy(Debris_vclips_normal[count++].name, filename);
if(Num_debris_normal < MAX_DEBRIS_VCLIPS){
strcpy(Debris_vclips_normal[Num_debris_normal++].name, filename);
} else {
Warning(LOCATION, "Could not load normal motion debris '%s'; maximum of %d exceeded.", MAX_DEBRIS_VCLIPS);
}
}
Assert(count == 4);
// nebula debris pieces
count = 0;
while(!optional_string("#end")){
while(!optional_string("#end"))
{
required_string("$DebrisNeb:");
stuff_string(filename, F_NAME, NULL);
if(count < MAX_DEBRIS_VCLIPS){
strcpy(Debris_vclips_nebula[count++].name, filename);
if(Num_debris_nebula < MAX_DEBRIS_VCLIPS){
strcpy(Debris_vclips_nebula[Num_debris_nebula++].name, filename);
} else {
Warning(LOCATION, "Could not load nebula motion debris '%s'; maximum of %d exceeded.", MAX_DEBRIS_VCLIPS);
}
}
Assert(count == 4);
}
// call on game startup
void stars_init()
{
int idx;
// parse stars.tbl
// make all bitmaps invalid
for(idx=0; idx<MAX_STARFIELD_BITMAPS; idx++){
Starfield_bitmaps[idx].bitmap = -1;
Starfield_bitmaps[idx].n_frames = 0;
Starfield_bitmaps[idx].fps = 0;
Starfield_bitmaps[idx].glow_bitmap = -1;
Starfield_bitmaps[idx].glow_n_frames = 1;
Starfield_bitmaps[idx].glow_fps = 0;
strcpy(Starfield_bitmaps[idx].filename, "");
strcpy(Starfield_bitmaps[idx].glow_filename, "");
Sun_bitmaps[idx].bitmap = -1;
Sun_bitmaps[idx].n_frames = 0;
Sun_bitmaps[idx].fps = 0;
Sun_bitmaps[idx].glow_bitmap = -1;
Sun_bitmaps[idx].glow_n_frames = 1;
Sun_bitmaps[idx].glow_fps = 0;
strcpy(Sun_bitmaps[idx].filename, "");
strcpy(Sun_bitmaps[idx].glow_filename, "");
}
// starfield bitmaps
Num_starfields = 0;
Num_starfield_suns = 0;
Num_debris_normal = 0;
Num_debris_nebula = 0;
parse_startbl("stars.tbl");
char tbl_file_arr[MAX_TBL_PARTS][MAX_FILENAME_LEN];
char *tbl_file_names[MAX_TBL_PARTS];
int num_files = cf_get_file_list_preallocated(MAX_TBL_PARTS, tbl_file_arr, tbl_file_names, CF_TYPE_TABLES, "*-str.tbm", CF_SORT_REVERSE);
for(idx = 0; idx < num_files; idx++)
{
//HACK HACK HACK
Modular_tables_loaded = true;
strcat(tbl_file_names[idx], ".tbm");
mprintf(("TBM => Starting parse of '%s'...\n", tbl_file_names[idx]));
parse_startbl(tbl_file_names[idx]);
}
}
// call this in game_post_level_init() so we know whether we're running in full nebula mode or not
+11 -8
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Stats/Scoring.cpp $
* $Revision: 2.14 $
* $Date: 2005-10-10 17:21:10 $
* $Author: taylor $
* $Revision: 2.15 $
* $Date: 2005-12-29 08:08:42 $
* $Author: wmcoolmon $
*
* Scoring system code, medals, rank, etc.
*
* $Log: not supported by cvs2svn $
* Revision 2.14 2005/10/10 17:21:10 taylor
* remove NO_NETWORK
*
* Revision 2.13 2005/07/22 10:18:40 Goober5000
* CVS header tweaks
* --Goober5000
@@ -353,7 +356,7 @@ void init_scoring_element(scoring_struct *s)
s->medals[i] = 0;
}
for (i=0; i<MAX_SHIP_TYPES; i++){
for (i=0; i<MAX_SHIP_CLASSES; i++){
s->kills[i] = 0;
s->m_kills[i] = 0;
}
@@ -430,7 +433,7 @@ void scoring_level_init( scoring_struct *scp )
scp->ms_bonehead_hits=0;
scp->m_bonehead_kills=0;
for (i=0; i<MAX_SHIP_TYPES; i++){
for (i=0; i<MAX_SHIP_CLASSES; i++){
scp->m_kills[i] = 0;
scp->m_okKills[i]=0;
}
@@ -490,7 +493,7 @@ void scoring_eval_badges(scoring_struct *sc)
// to determine badges, we count kills based on fighter/bomber types. We must count kills in
// all time stats + current mission stats. And, only for enemy fighters/bombers
total_kills = 0;
for (i = 0; i < MAX_SHIP_TYPES; i++ ) {
for (i = 0; i < MAX_SHIP_CLASSES; i++ ) {
if ( (Ship_info[i].flags & SIF_FIGHTER) || (Ship_info[i].flags & SIF_BOMBER) ) {
total_kills += sc->m_okKills[i];
total_kills += sc->kills[i];
@@ -556,7 +559,7 @@ void scoring_do_accept(scoring_struct *score)
score->s_bonehead_hits += score->ms_bonehead_hits;
score->bonehead_kills += score->m_bonehead_kills;
for(idx=0;idx<MAX_SHIP_TYPES;idx++){
for(idx=0;idx<MAX_SHIP_CLASSES;idx++){
score->kills[idx] = (int)(score->kills[idx] + score->m_okKills[idx]);
}
@@ -599,7 +602,7 @@ void scoring_backout_accept( scoring_struct *score )
score->s_bonehead_hits -= score->ms_bonehead_hits;
score->bonehead_kills -= score->m_bonehead_kills;
for(idx=0;idx<MAX_SHIP_TYPES;idx++){
for(idx=0;idx<MAX_SHIP_CLASSES;idx++){
score->kills[idx] = (unsigned short)(score->kills[idx] - score->m_okKills[idx]);
}
+13 -9
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Stats/Scoring.h $
* $Revision: 2.7 $
* $Date: 2005-07-13 03:35:32 $
* $Author: Goober5000 $
* $Revision: 2.8 $
* $Date: 2005-12-29 08:08:42 $
* $Author: wmcoolmon $
*
* Scoring system structures, medals, rank, etc.
*
* $Log: not supported by cvs2svn $
* Revision 2.7 2005/07/13 03:35:32 Goober5000
* remove PreProcDefine #includes in FS2
* --Goober5000
*
* Revision 2.6 2005/05/08 20:20:46 wmcoolmon
* Dynamically allocated medals
*
@@ -258,8 +262,8 @@ typedef struct scoring_struct {
int rank; // all time rank
int medals[MAX_MEDALS]; // all time medal counts
//ushort kills[MAX_SHIP_TYPES]; // only valid kills (i.e. not on friendlies).
int kills[MAX_SHIP_TYPES]; //DTP for bumped max_ships
//ushort kills[MAX_SHIP_CLASSES]; // only valid kills (i.e. not on friendlies).
int kills[MAX_SHIP_CLASSES]; //DTP for bumped max_ships
int assists; // alltime assists
int kill_count; // total alltime kills
int kill_count_ok; // total valid alltime kills (no friendlies)
@@ -284,10 +288,10 @@ typedef struct scoring_struct {
int m_promotion_earned; // was a promotion earned. Calculated after mission is over
int m_score;
//ushort m_kills[MAX_SHIP_TYPES]; // this will represent all kills in the mission (bonehead or not)
int m_kills[MAX_SHIP_TYPES]; //DTP max
//ushort m_okKills[MAX_SHIP_TYPES]; // this will be only the "valid" kills the player made
int m_okKills[MAX_SHIP_TYPES]; //DTP max
//ushort m_kills[MAX_SHIP_CLASSES]; // this will represent all kills in the mission (bonehead or not)
int m_kills[MAX_SHIP_CLASSES]; //DTP max
//ushort m_okKills[MAX_SHIP_CLASSES]; // this will be only the "valid" kills the player made
int m_okKills[MAX_SHIP_CLASSES]; //DTP max
int m_kill_count; // total kills for this mission
int m_kill_count_ok; // total (non-friendly) kills for this mission
int m_assists; // player assits for the mission
+8 -4
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Weapon/Beam.cpp $
* $Revision: 2.63 $
* $Date: 2005-12-14 08:07:33 $
* $Author: phreak $
* $Revision: 2.64 $
* $Date: 2005-12-29 08:08:42 $
* $Author: wmcoolmon $
*
* all sorts of cool stuff about ships
*
* $Log: not supported by cvs2svn $
* Revision 2.63 2005/12/14 08:07:33 phreak
* Handling of exit explosions for beams when a ship is about to get destroyed, or according to the code: "tooled".
* Bumped beam frame collisions to 10 to compensate.
*
* Revision 2.62 2005/11/21 02:43:30 Goober5000
* change from "setting" to "profile"; this way makes more sense
* --Goober5000
@@ -942,7 +946,7 @@ int beam_fire(beam_fire_info *fire_info)
ship *target_ship = &Ships[fire_info->target->instance];
// maybe force to be a type A
if(Ship_info[target_ship->ship_info_index].flags & (SIF_BIG_SHIP | SIF_CAPITAL | SIF_SUPERCAP | SIF_FREIGHTER | SIF_DRYDOCK | SIF_CARGO)){
if(Ship_info[target_ship->ship_info_index].class_type > -1 && (Ship_types[Ship_info[target_ship->ship_info_index].class_type].weapon_bools & STI_WEAP_BEAMS_EASILY_HIT)){
new_item->type = BEAM_TYPE_A;
}
}
+13 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Weapon/Flak.cpp $
* $Revision: 2.6 $
* $Date: 2005-10-30 06:44:59 $
* $Revision: 2.7 $
* $Date: 2005-12-29 08:08:42 $
* $Author: wmcoolmon $
*
* flak functions
*
* $Log: not supported by cvs2svn $
* Revision 2.6 2005/10/30 06:44:59 wmcoolmon
* Codebase commit - nebula.tbl, scripting, new dinky explosion/shockwave stuff, moving muzzle flashes
*
* Revision 2.5 2005/04/05 05:53:25 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
@@ -164,7 +167,7 @@ void flak_delete(int flak_index)
}
// given a just fired flak shell, pick a detonating distance for it
void flak_pick_range(object *objp, vec3d *predicted_target_pos, float weapon_subsys_strength)
void flak_pick_range(object *objp, vec3d *firing_pos, vec3d *predicted_target_pos, float weapon_subsys_strength)
{
float final_range;
vec3d temp;
@@ -180,6 +183,13 @@ void flak_pick_range(object *objp, vec3d *predicted_target_pos, float weapon_sub
return;
}
final_range = Weapon_info[Weapons[objp->instance].weapon_info_index].det_range;
if(final_range != 0.0f) {
flak_set_range(objp, firing_pos, final_range);
return;
}
// get the range to the target
vm_vec_sub(&temp, &objp->pos, predicted_target_pos);
final_range = vm_vec_mag(&temp);
+6 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Weapon/Flak.h $
* $Revision: 2.5 $
* $Date: 2005-10-30 06:44:59 $
* $Revision: 2.6 $
* $Date: 2005-12-29 08:08:42 $
* $Author: wmcoolmon $
*
* flak functions
*
* $Log: not supported by cvs2svn $
* Revision 2.5 2005/10/30 06:44:59 wmcoolmon
* Codebase commit - nebula.tbl, scripting, new dinky explosion/shockwave stuff, moving muzzle flashes
*
* Revision 2.4 2005/07/13 03:35:30 Goober5000
* remove PreProcDefine #includes in FS2
* --Goober5000
@@ -77,7 +80,7 @@ void flak_create(weapon *wp);
void flak_delete(int flak_index);
// given a just fired flak shell, pick a detonating distance for it
void flak_pick_range(object *objp, vec3d *predicted_target_pos, float weapon_subsys_strength);
void flak_pick_range(object *objp, vec3d *firing_pos, vec3d *predicted_target_pos, float weapon_subsys_strength);
// add some jitter to a flak gun's aiming direction, take into account range to target so that we're never _too_ far off
// assumes dir is normalized
+13
View File
@@ -12,6 +12,18 @@
* <insert description of file here>
*
* $Log: not supported by cvs2svn $
* Revision 2.64 2005/12/15 06:03:50 phreak
* Countermeasres parameters. Lets users specify how easily missiles are spoofed by countermeasures
*
* A missile is given a seeker strength. Aspect default of 2. Heat default of 3. This is a missile's resistance to spoofage
* A countermesaure is given an effectiveness for each type. The defaults for countermeasure heat and aspect effectiveness are both 1.
* Also gave the countermeasure an effective range. Default is 300 meters.
*
* A missiles chance of being spoofed is calculated by <cm type effectiveness>/<seeker strength>
* So by default, 1/2 of aspect seekers will be fooled by a countermeasures, while 1/3 of heat seekers would be spoofed by default.
*
* Also i gave the option of aspect missiles having a view cone different from 180 degrees. This parameter is optional and doesn't effect anything already there.
*
* Revision 2.63 2005/12/12 21:32:14 taylor
* allow use of a specific LOD for ship and weapon rendering in the hud targetbox
*
@@ -755,6 +767,7 @@ typedef struct weapon_info {
fix arm_time;
float arm_dist;
float arm_radius;
float det_range;
/*float blast_force; // force this weapon exhibits when hitting an object
float inner_radius, outer_radius; // damage radii for missiles (0 means impact only)
float shockwave_speed; // speed of shockwave ( 0 means none )*/
+18 -4
View File
@@ -12,6 +12,12 @@
* <insert description of file here>
*
* $Log: not supported by cvs2svn $
* Revision 2.164 2005/12/28 22:17:02 taylor
* deal with cf_find_file_location() changes
* add a central parse_modular_table() function which anything can use
* fix up weapon_expl so that it can properly handle modular tables and LOD count changes
* add support for for a fireball TBM (handled a little different than a normal TBM is since it only changes rather than adds)
*
* Revision 2.163 2005/12/24 04:18:57 taylor
* fix a couple of beam section issues when using modular tables
*
@@ -1716,6 +1722,7 @@ void init_weapon_entry(int weap_info_index)
wip->arm_time = 0;
wip->arm_dist = 0.0f;
wip->arm_radius = 0.0f;
wip->det_range = 0.0f;
wip->armor_factor = 1.0f;
wip->shield_factor = 1.0f;
@@ -2217,6 +2224,10 @@ int parse_weapon(int subtype, bool replace)
stuff_float(&wip->arm_radius);
}
if(optional_string("$Detonation Range:")) {
stuff_float(&wip->det_range);
}
parse_shockwave_info(&wip->shockwave, "$");
//Retain compatibility
@@ -5541,8 +5552,8 @@ void weapon_hit_do_sound(object *hit_obj, weapon_info *wip, vec3d *hitpos, bool
Weapon_impact_timer = timestamp(IMPACT_SOUND_DELTA);
}
}
const float weapon_electronics_scale[MAX_SHIP_TYPES]=
/*
const float weapon_electronics_scale[MAX_SHIP_TYPE_COUNTS]=
{
0.0f, //SHIP_TYPE_NONE
10.0f, //SHIP_TYPE_CARGO
@@ -5564,7 +5575,7 @@ const float weapon_electronics_scale[MAX_SHIP_TYPES]=
1.0f, //SHIP_TYPE_GAS_MINER
0.3333f, //SHIP_TYPE_CORVETTE
0.10f, //SHIP_TYPE_KNOSSOS_DEVICE
};
};*/
extern bool turret_weapon_has_flags(ship_weapon *swp, int flags);
@@ -5586,7 +5597,10 @@ void weapon_do_electronics_affect(object *ship_objp, vec3d *blast_pos, int wi_in
wip = &Weapon_info[wi_index];
int ship_type=ship_query_general_type(shipp);
float base_time=((float)wip->elec_time*(weapon_electronics_scale[ship_type]*wip->elec_intensity));
float base_time = (float)wip->elec_time;
if(ship_type > -1) {
base_time *= (Ship_types[ship_type].emp_multiplier * wip->elec_intensity);
}
float sub_time;
for ( ss = GET_FIRST(&shipp->subsys_list); ss != END_OF_LIST(&shipp->subsys_list); ss = GET_NEXT(ss) )