Compare commits

..
Author SHA1 Message Date
chief1983 dbbb4f96ac Trunk sync r8420 2012-02-02 16:39:25 +00:00
chief1983 3b7ae521a9 Trunk sync r8310 2012-01-22 22:30:57 +00:00
chief1983 54aaad33a3 Trunk sync r8200 2012-01-22 22:21:53 +00:00
chief1983 cc80807f13 Trunk sync r8120 2012-01-22 22:17:01 +00:00
chief1983 a351c7b721 Trunk sync r8020 2012-01-22 22:06:59 +00:00
chief1983 1ebb04d419 Trunk sync r7920 2012-01-22 21:43:05 +00:00
chief1983 d51e897ead Trunk sync r7820 2012-01-22 21:36:33 +00:00
chief1983 06c355ddf0 Trunk sync r7720 2012-01-22 21:31:48 +00:00
chief1983 8bb6f7f68e Trunk sync r7620 2012-01-22 21:24:26 +00:00
chief1983 5b8176bb4b Trunk sync r7520 2012-01-22 21:12:25 +00:00
chief1983 80cce2377c Trunk sync r7420 2012-01-22 20:01:06 +00:00
chief1983 e0c9583a3b Trunk sync r7320 2012-01-22 19:52:57 +00:00
chief1983 0cf3e4b408 Trunk sync r7220 2012-01-22 19:23:07 +00:00
chief1983 d06b09dfd2 Trunk sync r7119 2012-01-22 19:16:08 +00:00
chief1983 7151887f2e Resync with r7019: Sync all the things 2012-01-22 19:00:26 +00:00
Wanderer 3fd955efe5 synced with r7019 2011-02-19 10:54:40 +00:00
Wanderer 6c65202e9e fix for shield impact effects - local/global 2011-02-17 21:11:28 +00:00
Wanderer 2f2d33dae9 synced with r7008 - on request 2011-02-12 15:21:13 +00:00
Wanderer f2283dc4f3 sync with r5809 2010-01-11 21:27:30 +00:00
Wanderer b92dd314df sync with trunk (r5806) 2010-01-11 16:47:45 +00:00
Wanderer cdbae474e0 sync with trunk (r5566) 2009-09-05 20:55:34 +00:00
Wanderer c4eafa628f commit of alternate - impact explosion style - shield impact effects 2009-07-11 21:39:22 +00:00
Wanderer b8282cf074 merge with trunk (r5427) - add vmallocator.h 2009-07-11 21:26:46 +00:00
Wanderer 8517ec180c sync with trunk (r5373) 2009-06-26 19:19:38 +00:00
Wanderer 1d345eb946 more assert fixes from chief to his shield changes 2009-06-26 15:37:43 +00:00
Wanderer e981522f8a chief's fix to help compiling with VC6 2009-06-21 19:34:34 +00:00
Wanderer 1ad8ae9b1c chief1983's change to the earlier patch to make a function simpler 2009-06-20 06:56:40 +00:00
Wanderer f67f6fb331 sync with trunk r5342, also add missing cpp and h files to the branch 2009-06-17 05:42:41 +00:00
Wanderer 9627408f3a commit the shield changes back to the wanderer branch. 2009-06-13 12:22:41 +00:00
Wanderer 8f667bcfce reverting wanderer branch back to trunk (r5334)after most of the features have been included to trunk 2009-06-12 15:18:13 +00:00
Wanderer 6fff633d64 facepalm... forgot to include the new calc method also for the old style shields 2009-04-16 16:54:24 +00:00
Wanderer 66c1c6b9d3 on request... make sure shield strength matches that of max strength. 2009-04-13 08:01:20 +00:00
Wanderer 135e12df6a fixed a wanderer branch bug caused by fov test of fs beams ignoring turret normals. 2009-04-12 20:03:08 +00:00
Wanderer ff71992449 fix compiling issue (of which msvc++ 2008 didn't bother to warn...) 2009-04-06 20:37:52 +00:00
Wanderer bd8a44c273 fix for shield balancing issue in wanderer branch 2009-04-06 11:56:25 +00:00
Wanderer 5f884aea5e fixing problems related to shield commits 2009-04-02 22:08:15 +00:00
Wanderer c6adace344 allow optionally individual shield segments to have separate maximum strengths 2009-04-02 20:56:29 +00:00
Wanderer 27e6a4ca7a bah... remove the references to non-included flag 2009-04-02 10:58:03 +00:00
Wanderer d516b8495e add option to limit shield recharging 2009-04-02 10:46:55 +00:00
Wanderer 1f55d2499f change the new non-static subsys options in wanderer branch from model_subsystem to ship_subsys - and fix the required functions to use ship_subsys instead of model_subsystem as well 2009-03-30 20:45:42 +00:00
Wanderer 8b72e3fb3b add fixes to both subobj_name vs name and to multiline subsysy name strings 2009-03-30 19:51:35 +00:00
Wanderer db9c33ce71 sync with trunk r5123 2009-03-30 18:03:16 +00:00
Wanderer c3141364b2 fixes to sort out corkscrew missile issues (position changes) 2009-03-20 11:06:18 +00:00
Wanderer c0730d572f add chief1983's force shield/intrinsic no shields options 2009-03-20 06:28:44 +00:00
Wanderer dd0230d33b add option to purge existing contrails
add option to draw small fade to the leading edge of a trail
2009-03-20 05:46:19 +00:00
Wanderer ab7663889e sync with trunk (r5106) 2009-03-20 05:25:42 +00:00
Wanderer 0461fe36c5 add additional Lua control (mouse) options.
add struct for handling HUD draw data to Lua. 
fix lua override vs forced control issue
2009-03-06 12:56:08 +00:00
Wanderer d09cfc624a make sure lua control info is updated even in default mode 2009-02-26 17:33:02 +00:00
Wanderer 1907fe08f8 add beginnings of lua control system.
allow lua controls to override normal controls. 
allow lua to use network variables. 
add option for lua to retrieve current mp status of the cpu.
2009-02-25 16:21:57 +00:00
Wanderer 4b11575f3f sync with trunk (r5070) 2009-02-25 16:17:40 +00:00
Wanderer 9c31fc6749 copied from wrong patch... fix possible endless loop caused by r5059 2009-02-01 13:59:01 +00:00
Wanderer c6e3495605 option for setting emp resistance 2009-02-01 13:56:27 +00:00
Wanderer 4e06e5d033 option to allow weapons with hitpoints to ignore EMP 2009-02-01 13:48:42 +00:00
Wanderer a1d7d9a7d8 sync with trunk - r5056 2009-02-01 13:39:50 +00:00
Wanderer 5591189a46 on request - multiline alt subsys name & alternate damage popup subsystem names with localization option 2009-01-18 16:25:52 +00:00
Wanderer 1e9d9326f7 merging with trunk r5042 2009-01-18 16:16:01 +00:00
Wanderer 76ce3e3a2b commenting away the 'g3_start_frame' notifications 2009-01-12 07:11:58 +00:00
Wanderer 0f4d46a997 fix for crashed caused by turret swarm bookkeeping mismatch. 2009-01-09 12:25:09 +00:00
Wanderer e151e54d9e fix for using objnum instead of distance. also merging with the 5033 2009-01-06 08:43:38 +00:00
Wanderer f31301db4c sync again with trunk (r5031).
commit of turret target priority setup. 
weapon hitpoints.
2009-01-05 03:15:55 +00:00
Wanderer 930e50fa9d sync'd with trunk - r5029 2009-01-04 16:06:33 +00:00
Wanderer aad2cc2842 sync with trunk (r5004) 2008-12-16 14:26:30 +00:00
Wanderer fba51c734f added (1 and) 2 segment (front/back) shields on fotg request 2008-11-03 20:38:50 +00:00
Wanderer 9d5a177d1a sync with trunk r4933 2008-11-03 20:10:23 +00:00
Wanderer fcab17c9ea sync with trunk r4839
force radar(s) to use blips instead of images when distorted
2008-09-29 17:15:25 +00:00
Wanderer 4ce7e50ad7 fix for the converging autoaim 2008-09-07 18:19:12 +00:00
Wanderer 21cd34df25 Sync with trunk (r4804)
Added converging autoaim option for testing due FotG request
2008-09-06 23:10:00 +00:00
Wanderer ccfffdf5bd fix a stupid bug 2008-08-25 19:15:01 +00:00
Wanderer e18022b96a added option for setting turret reset delay
fixed the issue with non-square radar images
2008-08-22 16:29:37 +00:00
Wanderer a68f03eedc sync with trunk r4763 2008-08-22 11:29:36 +00:00
Wanderer e4a8b212ab Fix problem caused by duplicated code 2008-07-27 16:00:01 +00:00
Wanderer d2d3585a8c Merged with r4718
Fixed 3d radar images
2008-07-25 13:02:20 +00:00
Wanderer 1992c48b80 merged with r4704 2008-07-14 15:02:49 +00:00
Wanderer 5aa587ad8d turret related feature commit:
reset when idle option
   limited elevation and base rotation
2008-06-11 14:49:50 +00:00
Wanderer d30416cb51 updating wanderer branch up to date with trunk 4657 2008-06-11 13:47:02 +00:00
Wanderer 0cf1863c22 added phreak's MSVC 2008 project 2008-06-11 11:18:50 +00:00
Wanderer 991ca99a42 Initial commit of my local code changes 2008-05-31 16:44:53 +00:00
Goober5000 443d1671fb made a copy 2008-05-31 03:46:46 +00:00
245 changed files with 9228 additions and 12661 deletions

No files matched your search

+17 -20
View File
@@ -191,10 +191,7 @@ AM_LDFLAGS = @D_LDFLAGS@ @FS2_LDFLAGS@
noinst_LIBRARIES = libcode.a
noinst_PROGRAMS = @FS2_BINARY@
EXTRA_PROGRAMS = fs2_open_@PACKAGE_VERSION@ fs2_open_@PACKAGE_VERSION@_NOINF \
fs2_open_@PACKAGE_VERSION@_DEBUG fs2_open_@PACKAGE_VERSION@_NOINF_DEBUG \
wxFRED2_@PACKAGE_VERSION@ wxFRED2_@PACKAGE_VERSION@_NOINF \
wxFRED2_@PACKAGE_VERSION@_DEBUG wxFRED2_@PACKAGE_VERSION@_NOINF_DEBUG
EXTRA_PROGRAMS = fs2_open_r fs2_open_d wxFRED2_r wxFRED2_d fs2_open_INF_r fs2_open_INF_d wxFRED2_INF_r wxFRED2_INF_d
###############################################################################
##
@@ -794,22 +791,22 @@ FS2OPEN_SOURCES = \
freespace2/levelpaging.cpp \
freespace2/levelpaging.h
fs2_open_@PACKAGE_VERSION@_DEBUG_SOURCES = \
fs2_open_d_SOURCES = \
${FS2OPEN_SOURCES}
fs2_open_@PACKAGE_VERSION@_SOURCES = \
fs2_open_r_SOURCES = \
${FS2OPEN_SOURCES}
fs2_open_@PACKAGE_VERSION@_NOINF_DEBUG_SOURCES = \
fs2_open_INF_d_SOURCES = \
${FS2OPEN_SOURCES}
fs2_open_@PACKAGE_VERSION@_NOINF_SOURCES = \
fs2_open_INF_r_SOURCES = \
${FS2OPEN_SOURCES}
fs2_open_@PACKAGE_VERSION@_DEBUG_LDADD = libcode.a
fs2_open_@PACKAGE_VERSION@_LDADD = libcode.a
fs2_open_@PACKAGE_VERSION@_NOINF_DEBUG_LDADD = libcode.a
fs2_open_@PACKAGE_VERSION@_NOINF_LDADD = libcode.a
fs2_open_d_LDADD = libcode.a
fs2_open_r_LDADD = libcode.a
fs2_open_INF_d_LDADD = libcode.a
fs2_open_INF_r_LDADD = libcode.a
##
## End MAIN binary
@@ -829,22 +826,22 @@ wxFRED_SOURCES = \
wxfred2/wxfred_xrc.cpp \
wxfred2/wxfred_xrc.h
wxFRED2_@PACKAGE_VERSION@_DEBUG_SOURCES = \
wxFRED2_d_SOURCES = \
${wxFRED_SOURCES}
wxFRED2_@PACKAGE_VERSION@_SOURCES = \
wxFRED2_r_SOURCES = \
${wxFRED_SOURCES}
wxFRED2_@PACKAGE_VERSION@_NOINF_DEBUG_SOURCES = \
wxFRED2_INF_d_SOURCES = \
${wxFRED_SOURCES}
wxFRED2_@PACKAGE_VERSION@_NOINF_SOURCES = \
wxFRED2_INF_r_SOURCES = \
${wxFRED_SOURCES}
wxFRED2_@PACKAGE_VERSION@_DEBUG_LDADD = libcode.a
wxFRED2_@PACKAGE_VERSION@_LDADD = libcode.a
wxFRED2_@PACKAGE_VERSION@_NOINF_DEBUG_LDADD = libcode.a
wxFRED2_@PACKAGE_VERSION@_NOINF_LDADD = libcode.a
wxFRED2_d_LDADD = libcode.a
wxFRED2_r_LDADD = libcode.a
wxFRED2_INF_d_LDADD = libcode.a
wxFRED2_INF_r_LDADD = libcode.a
##
## End wxFRED2 binary
+20
View File
@@ -347,6 +347,24 @@ void parse_ai_profiles_tbl(char *filename)
if (optional_string("$Turret Max Aim Update Delay:"))
parse_float_list(profile->turret_max_aim_update_delay, NUM_SKILL_LEVELS);
if (optional_string("$Player Autoaim FOV:"))
{
float fov_list[NUM_SKILL_LEVELS];
parse_float_list(fov_list, NUM_SKILL_LEVELS);
for (i = 0; i < NUM_SKILL_LEVELS; i++)
{
//Enforce range
if (fov_list[i] < 0.0f || fov_list[i] >= 360.0f)
{
Warning(LOCATION, "$Player Autoaim FOV should be >= 0 and < 360.0 (read %f). Setting to 0.", fov_list[i]);
fov_list[i] = 0.0f;
}
//Convert units
profile->player_autoaim_fov[i] = fov_list[i] * PI / 180.0f;
}
}
if (optional_string("$Detail Distance Multiplier:"))
parse_float_list(profile->detail_distance_mult, NUM_SKILL_LEVELS);
@@ -462,6 +480,8 @@ void parse_ai_profiles_tbl(char *filename)
Default_ship_select_effect = 0;
}
set_flag(profile, "$no warp camera:", AIPF2_NO_WARP_CAMERA, AIP_FLAG2);
// if we've been through once already and are at the same place, force a move
if ( saved_Mp && (saved_Mp == Mp) )
{
+4
View File
@@ -61,6 +61,7 @@
#define AIPF2_ALLOW_PRIMARY_LINK_DELAY (1 << 7)
#define AIPF2_BEAMS_DAMAGE_WEAPONS (1 << 8)
#define AIPF2_PLAYER_WEAPON_SCALE_FIX (1 << 9)
#define AIPF2_NO_WARP_CAMERA (1 << 10)
// AI Path types
#define AI_PATH_MODE_NORMAL 0
@@ -139,6 +140,9 @@ typedef struct ai_profile_t {
// the chance (x/7) that ship is allowed to fire missiles at player ship.
int chance_to_use_missiles_on_plr[NUM_SKILL_LEVELS];
// Player-specific autoaim FOV override
float player_autoaim_fov[NUM_SKILL_LEVELS];
float detail_distance_mult[MAX_DETAIL_LEVEL + 1]; //MAX_DETAIL_LEVEL really needs to be 4
int ai_path_mode;
+107 -117
View File
@@ -1223,7 +1223,7 @@ objp_orient_copy = objp->orient;
vel_in = vel_in_copy; // HERE //-V587
objp->orient = objp_orient_copy; //-V587
#endif
if (rvec != NULL) {
matrix out_orient, goal_orient;
@@ -1233,7 +1233,7 @@ objp->orient = objp_orient_copy; //-V587
} else {
vm_forward_interpolate(&desired_fvec, &curr_orient, &vel_in, delta_time, delta_bank, &objp->orient, &vel_out, &vel_limit, &acc_limit);
}
#ifndef NDEBUG
if (!((objp->type == OBJ_WEAPON) && (Weapon_info[Weapons[objp->instance].weapon_info_index].subtype == WP_MISSILE))) {
Assertion(!(delta_time < 0.25f && vm_vec_dot(&objp->orient.vec.fvec, &tvec) < 0.1f), "A ship rotated too far. Offending vessel is %s, please investigate.\n", Ships[objp->instance].ship_name);
@@ -2169,9 +2169,9 @@ int find_enemy(int objnum, float range, int max_attackers)
aip->target_signature = -1;
}
}
return get_nearest_objnum(objnum, enemy_team_mask, aip->enemy_wing, range, max_attackers);
} else {
aip->target_objnum = -1;
aip->target_signature = -1;
@@ -3830,7 +3830,7 @@ float ai_path_0()
min_dist_to_goal = MIN_DIST_TO_WAYPOINT_GOAL + Pl_objp->radius;
if ( (vm_vec_dist_quick(&Pl_objp->pos, &gcvp) < min_dist_to_goal) ||
(((r >= 0.0f) && (r <= 1.0f)) && (vm_vec_dist_quick(&nearest_point, &gcvp) < (MIN_DIST_TO_WAYPOINT_GOAL + Pl_objp->radius)))) {
((r >= 0.0f) && (r <= 1.0f)) && (vm_vec_dist_quick(&nearest_point, &gcvp) < (MIN_DIST_TO_WAYPOINT_GOAL + Pl_objp->radius))) {
aip->path_cur += aip->path_dir;
if (((aip->path_cur - aip->path_start) > (num_points+1)) || (aip->path_cur < aip->path_start)) {
Assert(aip->mode != AIM_DOCK); // If docking, should never get this far, getting to last point handled outside ai_path()
@@ -4007,7 +4007,7 @@ float ai_path_1()
}
if ( (vm_vec_dist_quick(&Pl_objp->pos, &gcvp) < min_dist_to_goal) ||
(((r >= 0.0f) && (r <= 1.0f)) && (vm_vec_dist_quick(&nearest_point, &gcvp) < (MIN_DIST_TO_WAYPOINT_GOAL + Pl_objp->radius)))) {
((r >= 0.0f) && (r <= 1.0f)) && (vm_vec_dist_quick(&nearest_point, &gcvp) < (MIN_DIST_TO_WAYPOINT_GOAL + Pl_objp->radius))) {
aip->path_cur += aip->path_dir;
if (((aip->path_cur - aip->path_start) > (num_points+1)) || (aip->path_cur < aip->path_start)) {
Assert(aip->mode != AIM_DOCK); // If docking, should never get this far, getting to last point handled outside ai_path()
@@ -4429,7 +4429,7 @@ void ai_waypoints()
ai_start_waypoints(Pl_objp, aip->wp_list, WPF_REPEAT);
}
}
Assert(!aip->wp_list->get_waypoints().empty()); // What? Is this zero? Probably never got initialized!
bool done, treat_as_ship;
@@ -4784,12 +4784,11 @@ void evade_weapon()
locked_weapon_objp = &Objects[aip->nearest_locked_object];
}
if (aip->danger_weapon_objnum != -1) {
if (aip->danger_weapon_objnum != -1)
if (Objects[aip->danger_weapon_objnum].signature == aip->danger_weapon_signature)
unlocked_weapon_objp = &Objects[aip->danger_weapon_objnum];
else
aip->danger_weapon_objnum = -1; // Signatures don't match, so no longer endangered.
}
if (locked_weapon_objp != NULL) {
if (unlocked_weapon_objp != NULL) {
@@ -7456,9 +7455,9 @@ void update_aspect_lock_information(ai_info *aip, vec3d *vec_to_enemy, float dis
float needed_dot = 0.9f - 0.5f * enemy_radius/(dist_to_enemy + enemy_radius); // Replaced MIN_TRACKABLE_DOT with 0.9f
if (dot_to_enemy > needed_dot &&
(wip->wi_flags & WIF_HOMING_ASPECT ||
(wip->wi_flags & WIF_HOMING_JAVELIN &&
wip->wi_flags & WIF_HOMING_JAVELIN &&
(tshpp == NULL ||
ship_get_closest_subsys_in_sight(tshpp, SUBSYSTEM_ENGINE, &aiobjp->pos))))) {
ship_get_closest_subsys_in_sight(tshpp, SUBSYSTEM_ENGINE, &aiobjp->pos)))) {
aip->aspect_locked_time += flFrametime;
if (aip->aspect_locked_time >= wip->min_lock_time) {
aip->aspect_locked_time = wip->min_lock_time;
@@ -8453,14 +8452,13 @@ void ai_chase()
case SM_AVOID:
if ((dot_to_enemy > -0.2f) && (dist_to_enemy / (dot_to_enemy + 0.3f) < 100.0f)) {
aip->submode_start_time = Missiontime;
} else if (Missiontime - aip->submode_start_time > i2f(1)/2) {
} else if (Missiontime - aip->submode_start_time > i2f(1)/2)
if (might_collide_with_ship(Pl_objp, En_objp, dot_to_enemy, dist_to_enemy, 3.0f)) {
aip->submode_start_time = Missiontime;
} else {
aip->submode = SM_GET_BEHIND;
aip->submode_start_time = Missiontime;
}
}
break;
@@ -9004,6 +9002,7 @@ float dock_orient_and_approach(object *docker_objp, int docker_index, object *do
rdinfo->submodel_r = submodel_radius;
rdinfo->submodel_w = submodel_omega;
float speed_scale = 1.0f;
if (sip0->flags & SIF_SUPPORT) {
speed_scale = 3.0f;
@@ -9118,6 +9117,7 @@ float dock_orient_and_approach(object *docker_objp, int docker_index, object *do
int desired_index;
Assert(aip->path_length >= 2);
desired_index = aip->path_length-2;
fdist = dock_move_towards_point(docker_objp, &docker_objp->pos, &Path_points[aip->path_start + desired_index].pos, speed_scale, 0.0f, rdinfo);
@@ -9682,7 +9682,7 @@ void ai_big_guard()
// how often to choose new desired_z
// 1*(64) sec < 2000, 2*(64) < 2-4000 3*(64) > 4-8000, etc (Missiontime >> 22 is 64 sec intervals)
int time_choose = int(floor(log(length * 0.001f) / log(2.0f)));
float desired_z = min_z + length * static_randf( (Pl_objp-Objects) ^ (Missiontime >> (22 + time_choose)) );
float desired_z = min_z + length * static_randf( Pl_objp-Objects ^ (Missiontime >> (22 + time_choose)) );
// get r from guard_ship
float cur_guard_rad = vm_vec_dist(&Pl_objp->pos, &axis_pt);
@@ -10106,12 +10106,14 @@ void ai_do_objects_repairing_stuff( object *repaired_objp, object *repair_objp,
Int3(); // bogus type of repair info
}
if (repair_objp){
Ai_info[Ships[repair_objp->instance].ai_index].warp_out_timestamp = stamp;
}
// repair_objp might be NULL is we are cleaning up this mode because of the support ship
// getting killed.
if ( repair_objp ) {
Ai_info[Ships[repair_objp->instance].ai_index].warp_out_timestamp = stamp;
aip = &Ai_info[Ships[repair_objp->instance].ai_index];
switch ( how ) {
case REPAIR_INFO_ONWAY:
Assert( repaired_objp != NULL );
@@ -10630,7 +10632,6 @@ void ai_dock()
case AIS_DOCK_4A:
{
if (aigp == NULL) { // Can happen for initially docked ships.
// this now "just sits here" for docked ships
ai_do_default_behavior( &Objects[Ships[aip->shipnum].objnum] ); // do the default behavior
} else {
mission_log_add_entry(LOG_SHIP_DOCKED, shipp->ship_name, goal_shipp->ship_name);
@@ -11001,16 +11002,13 @@ void process_subobjects(int objnum)
// Karajorma - if Player_use_ai is ever fixed to work on multiplayer it should be checked that any player ships
// aren't under AI control here
if ( (!(objp->flags & OF_PLAYER_SHIP) ) && (sip->flags & (SIF_FIGHTER | SIF_BOMBER)) && !(shipp->flags & SF_DYING) ) {
// Goober5000 - don't do anything if docked
if (!object_is_docked(objp)) {
// AL: Only attack forever if not trying to depart to a docking bay. Need to have this in, since
// a ship may get repaired... and it should still try to depart. Since docking bay departures
// are not handled as goals, we don't want to leave the AIM_BAY_DEPART mode.
if ( aip->mode != AIM_BAY_DEPART ) {
ai_attack_object(objp, NULL, NULL); // Regardless of current mode, enter attack mode.
aip->submode = SM_ATTACK_FOREVER; // Never leave attack submode, don't avoid, evade, etc.
aip->submode_start_time = Missiontime;
}
// AL: Only attack forever if not trying to depart to a docking bay. Need to have this in, since
// a ship may get repaired... and it should still try to depart. Since docking bay departures
// are not handled as goals, we don't want to leave the AIM_BAY_DEPART mode.
if ( aip->mode != AIM_BAY_DEPART ) {
ai_attack_object(objp, NULL, NULL); // Regardless of current mode, enter attack mode.
aip->submode = SM_ATTACK_FOREVER; // Never leave attack submode, don't avoid, evade, etc.
aip->submode_start_time = Missiontime;
}
}
}
@@ -11394,7 +11392,10 @@ int formation_is_leader_chaotic(object *objp)
Leader_chaos *= (1.0f - flFrametime*0.2f);
CLAMP(Leader_chaos, 0.0f, 1.7f);
if (Leader_chaos < 0.0f)
Leader_chaos = 0.0f;
else if (Leader_chaos > 1.7f)
Leader_chaos = 1.7f;
Chaos_frame = Framecount;
}
@@ -11781,9 +11782,6 @@ void ai_maybe_launch_cmeasure(object *objp, ai_info *aip)
if (!(sip->flags & (SIF_SMALL_SHIP | SIF_TRANSPORT)))
return;
if (object_is_docked(objp))
return;
if (!shipp->cmeasure_count)
return;
@@ -11933,15 +11931,18 @@ void ai_transfer_shield(object *objp, int quadrant_num)
float transfer_delta;
float max_quadrant_strength;
max_quadrant_strength = get_max_shield_quad(objp);
if(objp->n_shield_segments == 1)
return;
max_quadrant_strength = get_max_shield_quad(objp,quadrant_num);
transfer_amount = 0.0f;
transfer_delta = (SHIELD_BALANCE_RATE/2) * max_quadrant_strength;
if (objp->shield_quadrant[quadrant_num] + (MAX_SHIELD_SECTIONS-1)*transfer_delta > max_quadrant_strength)
transfer_delta = (max_quadrant_strength - objp->shield_quadrant[quadrant_num])/(MAX_SHIELD_SECTIONS-1);
if (objp->shield_quadrant[quadrant_num] + (objp->n_shield_segments-1)*transfer_delta > max_quadrant_strength)
transfer_delta = (max_quadrant_strength - objp->shield_quadrant[quadrant_num])/(objp->n_shield_segments-1);
for (i=0; i<MAX_SHIELD_SECTIONS; i++)
for (i=0; i<objp->n_shield_segments; i++)
if (i != quadrant_num) {
if (objp->shield_quadrant[i] >= transfer_delta) {
objp->shield_quadrant[i] -= transfer_delta;
@@ -11962,21 +11963,25 @@ void ai_balance_shield(object *objp)
float delta;
// if we are already at the max shield strength for all quads then just bail now
if ( Ships[objp->instance].ship_max_shield_strength == shield_get_strength(objp) )
if ( (Ships[objp->instance].ship_max_shield_strength == shield_get_strength(objp)) || (Ships[objp->instance].ship_max_shield_strength == 0.0f) )
return;
if(objp->n_shield_segments == 1)
return;
shield_strength_avg = shield_get_strength(objp)/MAX_SHIELD_SECTIONS;
shield_strength_avg = shield_get_strength(objp)/objp->n_shield_segments;
float shield_multiplier = shield_get_strength(objp) / Ships[objp->instance].ship_max_shield_strength;
delta = SHIELD_BALANCE_RATE * shield_strength_avg;
for (i=0; i<MAX_SHIELD_SECTIONS; i++) {
for (i=0; i<objp->n_shield_segments; i++) {
shield_strength_avg = Ships[objp->instance].ship_max_shield_segment[i] * shield_multiplier;
if (objp->shield_quadrant[i] < shield_strength_avg) {
// only do it the retail way if using smart shields (since that's a bigger thing) - taylor
if (Ai_info[Ships[objp->instance].ai_index].ai_profile_flags & AIPF_SMART_SHIELD_MANAGEMENT)
shield_add_strength(objp, delta);
else
objp->shield_quadrant[i] += delta/MAX_SHIELD_SECTIONS;
objp->shield_quadrant[i] += delta/objp->n_shield_segments;
if (objp->shield_quadrant[i] > shield_strength_avg)
objp->shield_quadrant[i] = shield_strength_avg;
@@ -11986,7 +11991,7 @@ void ai_balance_shield(object *objp)
if (Ai_info[Ships[objp->instance].ai_index].ai_profile_flags & AIPF_SMART_SHIELD_MANAGEMENT)
shield_add_strength(objp, -delta);
else
objp->shield_quadrant[i] -= delta/MAX_SHIELD_SECTIONS;
objp->shield_quadrant[i] -= delta/objp->n_shield_segments;
if (objp->shield_quadrant[i] < shield_strength_avg)
objp->shield_quadrant[i] = shield_strength_avg;
@@ -12024,7 +12029,7 @@ void ai_manage_shield(object *objp, ai_info *aip)
aip->shield_manage_timestamp = timestamp((int) (delay * 1000.0f));
if (sip->flags & SIF_SMALL_SHIP || (aip->ai_profile_flags2 & AIPF2_ALL_SHIPS_MANAGE_SHIELDS)) {
if (Missiontime - aip->last_hit_time < F1_0*10)
if ((aip->last_hit_time != 0) && (Missiontime - aip->last_hit_time < F1_0*10))
ai_transfer_shield(objp, aip->last_hit_quadrant);
else
ai_balance_shield(objp);
@@ -12047,11 +12052,6 @@ void ai_maybe_evade_locked_missile(object *objp, ai_info *aip)
return;
}
// don't evade missiles if you're docked
if (object_is_docked(objp)) {
return;
}
if (aip->ai_flags & (AIF_NO_DYNAMIC | AIF_KAMIKAZE)) { // If not allowed to pursue dynamic objectives, don't evade. Dumb? Maybe change. -- MK, 3/15/98
return;
}
@@ -12150,11 +12150,6 @@ void maybe_evade_dumbfire_weapon(ai_info *aip)
return;
}
// don't evade missiles if you're docked
if (object_is_docked(Pl_objp)) {
return;
}
// Make sure in a mode in which we evade dumbfire weapons.
switch (aip->mode) {
case AIM_CHASE:
@@ -12902,12 +12897,6 @@ int maybe_request_support(object *objp)
if (!is_support_allowed(objp))
return 0;
// Goober5000 - a ship that is currently docked shouldn't request repair.
// This is to prevent support ships being summoned for a ship that is getting
// towed away by other means.
if (object_is_docked(objp))
return 0;
// Compute a desire value.
// Desire of 0 means no reason to request support.
// 1 is slight, 2 more, etc. Maximum is around 20. Anything larger than 3 is pretty strong.
@@ -13082,7 +13071,10 @@ void ai_warp_out(object *objp)
aip->submode_start_time = Missiontime;
break;
case AIS_WARP_2: // Make sure won't collide with any object.
if (timestamp_elapsed(aip->force_warp_time) || !collide_predict_large_ship(objp, objp->radius*2.0f + 100.0f)) {
if (timestamp_elapsed(aip->force_warp_time)
|| (!collide_predict_large_ship(objp, objp->radius*2.0f + 100.0f)
|| (Ship_info[shipp->ship_info_index].warpout_type == WT_HYPERSPACE
&& !collide_predict_large_ship(objp, 100000.0f)))) {
aip->submode = AIS_WARP_3;
aip->submode_start_time = Missiontime;
@@ -13123,9 +13115,12 @@ void ai_warp_out(object *objp)
}
break;
case AIS_WARP_4: {
shipfx_warpout_start(objp);
aip->submode = AIS_WARP_5;
aip->submode_start_time = Missiontime;
// Only lets the ship warp after waiting for the warpout engage time
if ( (Missiontime / 100) >= (aip->submode_start_time / 100 + Ship_info[shipp->ship_info_index].warpout_engage_time) ) {
shipfx_warpout_start(objp);
aip->submode = AIS_WARP_5;
aip->submode_start_time = Missiontime;
}
break;
}
case AIS_WARP_5:
@@ -13187,8 +13182,7 @@ void ai_announce_ship_dying(object *dying_objp)
object *A = &Objects[so->objnum];
Assert(A->type == OBJ_SHIP);
// Goober5000 - the disallow is now handled uniformly in the ai_avoid_shockwave function
/*if (Ship_info[Ships[A->instance].ship_info_index].flags & (SIF_SMALL_SHIP | SIF_FREIGHTER | SIF_TRANSPORT))*/ {
if (Ship_info[Ships[A->instance].ship_info_index].flags & (SIF_SMALL_SHIP | SIF_FREIGHTER | SIF_TRANSPORT)) {
ai_info *aip = &Ai_info[Ships[A->instance].ai_index];
// AL 1-5-98: only avoid shockwave if not docked or repairing
@@ -13387,8 +13381,7 @@ int ai_avoid_shockwave(object *objp, ai_info *aip)
vec3d safe_pos;
// BIG|HUGE do not respond to shockwaves
// Goober5000 - let's treat shockwave response the same way whether from weapon or ship
if (!(Ship_info[Ships[objp->instance].ship_info_index].flags & (SIF_AVOID_SHOCKWAVE))) {
if (Ship_info[Ships[objp->instance].ship_info_index].flags & (SIF_BIG_SHIP|SIF_HUGE_SHIP)) {
// don't come here again
aip->ai_flags &= ~AIF_AVOID_SHOCKWAVE;
return 0;
@@ -14023,7 +14016,7 @@ void init_ai_object(int objnum)
aip->ignore_new_signatures[i] = -1;
}
// Init stuff from AI class and AI profiles
//Init stuff from AI class and AI profiles
init_aip_from_class_and_profile(aip, &Ai_classes[Ship_info[ship_type].ai_class], The_mission.ai_profile);
aip->wp_list = NULL;
@@ -14239,42 +14232,42 @@ void ai_set_default_behavior(object *obj, int classnum)
void ai_do_default_behavior(object *obj)
{
ai_info *aip;
int ship_flags;
Assert(obj != NULL);
Assert(obj->instance != -1);
Assert(Ships[obj->instance].ai_index != -1);
ai_info *aip = &Ai_info[Ships[obj->instance].ai_index];
int si_flags = Ship_info[Ships[obj->instance].ship_info_index].flags;
aip = &Ai_info[Ships[obj->instance].ai_index];
// default behavior in most cases (especially if we're docked) is to just stay put
aip->mode = AIM_NONE;
ship_flags = Ship_info[Ships[obj->instance].ship_info_index].flags;
if (!is_instructor(obj) && (ship_flags & (SIF_FIGHTER | SIF_BOMBER)))
{
int enemy_objnum = find_enemy(OBJ_INDEX(obj), 1000.0f, The_mission.ai_profile->max_attackers[Game_skill_level]);
set_target_objnum(aip, enemy_objnum);
aip->mode = AIM_CHASE;
aip->submode = SM_ATTACK;
aip->submode_start_time = Missiontime;
}
else if (ship_flags & (SIF_SUPPORT))
{
aip->mode = AIM_SAFETY;
aip->submode = AISS_1;
aip->submode_start_time = Missiontime;
aip->ai_flags &= ~(AIF_REPAIRING);
}
else if ( ship_flags & SIF_SENTRYGUN )
{
aip->mode = AIM_SENTRYGUN;
}
else
{
aip->mode = AIM_NONE;
}
aip->submode_start_time = Missiontime;
aip->active_goal = AI_GOAL_NONE;
// if we're not docked, we may modify the behavior a bit
if (!object_is_docked(obj))
{
// fighters automatically chase things
if (!is_instructor(obj) && (si_flags & (SIF_FIGHTER | SIF_BOMBER)))
{
int enemy_objnum = find_enemy(OBJ_INDEX(obj), 1000.0f, The_mission.ai_profile->max_attackers[Game_skill_level]);
set_target_objnum(aip, enemy_objnum);
aip->mode = AIM_CHASE;
aip->submode = SM_ATTACK;
}
// support ships automatically keep a safe distance
else if (si_flags & SIF_SUPPORT)
{
aip->mode = AIM_SAFETY;
aip->submode = AISS_1;
aip->ai_flags &= ~(AIF_REPAIRING);
}
// sentry guns... do their thing
else if (si_flags & SIF_SENTRYGUN)
{
aip->mode = AIM_SENTRYGUN;
}
}
}
#define FRIENDLY_DAMAGE_THRESHOLD 50.0f // Display a message at this threshold. Note, this gets scaled by Skill_level
@@ -14670,24 +14663,23 @@ void ai_ship_hit(object *objp_ship, object *hit_objp, vec3d *hitpos, int shield_
// Hit by a protected ship, don't attack it.
if (objp_hitter->flags & OF_PROTECTED) {
if (!object_is_docked(objp_ship)) {
if ((Ship_info[shipp->ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)) && (aip->target_objnum == -1)) {
if (aip->mode == AIM_CHASE) {
if (aip->submode != SM_EVADE_WEAPON) {
aip->mode = AIM_CHASE;
aip->submode = SM_EVADE_WEAPON;
aip->submode_start_time = Missiontime;
}
} else if (aip->mode != AIM_EVADE_WEAPON) {
aip->active_goal = AI_ACTIVE_GOAL_DYNAMIC;
aip->previous_mode = aip->mode;
aip->previous_submode = aip->submode;
aip->mode = AIM_EVADE_WEAPON;
aip->submode = -1;
if ((Ship_info[shipp->ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)) && (aip->target_objnum == -1)) {
if (aip->mode == AIM_CHASE) {
if (aip->submode != SM_EVADE_WEAPON) {
aip->mode = AIM_CHASE;
aip->submode = SM_EVADE_WEAPON;
aip->submode_start_time = Missiontime;
aip->mode_time = timestamp(MAX_EVADE_TIME); // Evade for up to five seconds.
}
} else if (aip->mode != AIM_EVADE_WEAPON) {
aip->active_goal = AI_ACTIVE_GOAL_DYNAMIC;
aip->previous_mode = aip->mode;
aip->previous_submode = aip->submode;
aip->mode = AIM_EVADE_WEAPON;
aip->submode = -1;
aip->submode_start_time = Missiontime;
aip->mode_time = timestamp(MAX_EVADE_TIME); // Evade for up to five seconds.
}
}
return;
}
@@ -14766,12 +14758,10 @@ void ai_ship_hit(object *objp_ship, object *hit_objp, vec3d *hitpos, int shield_
// If the hitter object is the ignore object, don't attack it.
ship_info *sip = &Ship_info[shipp->ship_info_index];
if ((is_ignore_object(aip, objp_hitter-Objects)) && (sip->flags & (SIF_BOMBER | SIF_FIGHTER))) {
if (!object_is_docked(objp_ship)) {
if (aip->mode == AIM_NONE) {
aip->mode = AIM_CHASE; // This will cause the ship to move, if not attack.
aip->submode = SM_EVADE;
aip->submode_start_time = Missiontime;
}
if (aip->mode == AIM_NONE) {
aip->mode = AIM_CHASE; // This will cause the ship to move, if not attack.
aip->submode = SM_EVADE;
aip->submode_start_time = Missiontime;
}
return;
}
@@ -15198,7 +15188,7 @@ int ai_return_path_num_from_dockbay(object *dockee_objp, int dockbay_index)
Assert(pm->n_docks > dockbay_index);
Assert(pm->docking_bays[dockbay_index].num_spline_paths > 0);
Assert(pm->docking_bays[dockbay_index].splines != NULL);
if(pm->n_docks <= dockbay_index){
return -1;
}
+41 -22
View File
@@ -131,9 +131,18 @@ char *Ai_goal_text(int goal)
}
// function to maybe add the form on my wing goal for a player's starting wing. Called when a player wing arrives.
// Goober5000 - made more generic
void ai_maybe_add_form_goal( wing *wingp )
{
int j;
char *wing_leader;
// if the wing leader isn't available (ie, dead/departed) then go ahead and bail now
if (wingp->ship_index[wingp->special_ship] < 0)
return;
// Goober5000 - the wing leader is now not necessarily the player
wing_leader = Ships[wingp->ship_index[wingp->special_ship]].ship_name;
// iterate through the ship_index list of this wing and check for orders. We will do
// this for all ships in the wing instead of on a wing only basis in case some ships
@@ -143,15 +152,20 @@ void ai_maybe_add_form_goal( wing *wingp )
Assert( wingp->ship_index[j] != -1 ); // get Allender
// don't process wing leader
if (j == wingp->special_ship)
continue;
aip = &Ai_info[Ships[wingp->ship_index[j]].ai_index];
// don't process Player_ship
if ( aip == Player_ai )
continue;
// it is sufficient enough to check the first goal entry to see if it has a valid goal
if ( aip->goals[0].ai_mode == AI_GOAL_NONE ) {
// need to add a form on my wing goal here. Ships are always forming on the player's wing.
ai_add_ship_goal_player( AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, Player_ship->ship_name, aip );
// need to add a form on my wing goal here
ai_add_ship_goal_player( AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, wing_leader, aip );
}
}
}
@@ -159,28 +173,38 @@ void ai_maybe_add_form_goal( wing *wingp )
void ai_post_process_mission()
{
object *objp;
int i;
/*
// Goober5000 - considering that this is also done in parse_wing_create_ships,
// it's redundant (and possibly premature for some wings) here
// Check ships in player starting wings. Those ships should follow these rules:
// (1) if they have no orders, they should get a form on my wing order
// (2) if they have an order, they are free to act on it.
//
// So basically, we are checking for (1)
if ( !Fred_running ) {
// MK, 5/9/98: Used to iterate through MAX_STARTING_WINGS, but this was too many ships forming on player.
// Goober5000 - MK originally iterated on only the first wing; now we iterate on only the player wing
// because the player wing may not be first
for ( i = 0; i < MAX_STARTING_WINGS; i++ ) {
if ( Starting_wings[i] == Player_ship->wingnum ) {
wing *wingp;
if ( !Fred_running )
{
int i;
wingp = &Wings[Starting_wings[i]];
ai_maybe_add_form_goal( wingp );
}
// Goober5000 - make all wings form on their respective leaders
for ( i = 0; i < Num_wings; i++ )
{
ai_maybe_add_form_goal( &Wings[i] );
}
// for ( i = 0; i < 1; i++ ) { // MK, 5/9/98: Used to iterate through MAX_STARTING_WINGS, but this was too many ships forming on player.
// if ( Starting_wings[i] != -1 ) {
// wing *wingp;
//
// wingp = &Wings[Starting_wings[i]];
//
// ai_maybe_add_form_goal( wingp );
//
// }
// }
}
*/
// for every valid ship object, call process_mission_orders to be sure that ships start the
// mission following the orders in the mission file right away instead of waiting N seconds
@@ -1446,13 +1470,8 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
// for this goal to be valid).
Assert ( aigp->ai_submode >= 0 );
ssp = ship_get_indexed_subsys( &Ships[sindex], aigp->ai_submode );
if (ssp != NULL) {
status = mission_log_get_time( LOG_SHIP_SUBSYS_DESTROYED, aigp->target_name, ssp->system_info->subobj_name, NULL );
} else {
// not supposed to ever happen, but could if there is a mismatch between the table and model subsystems
nprintf(("AI", "Couldn't find subsystem %d for ship %s\n", aigp->ai_submode, Ships[sindex].ship_name));
status = 0;
}
status = mission_log_get_time( LOG_SHIP_SUBSYS_DESTROYED, aigp->target_name, ssp->system_info->subobj_name, NULL );
break;
}
+7 -2
View File
@@ -21,6 +21,7 @@
#include "ai/aiinternal.h" //Included last, so less includes are needed
#include "iff_defs/iff_defs.h"
#include "weapon/muzzleflash.h"
#include "parse/scripting.h"
#include <limits.h>
@@ -1717,6 +1718,12 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
objp=&Objects[weapon_objnum];
wp=&Weapons[objp->instance];
parent_ship->last_fired_turret = turret;
turret->last_fired_weapon_info_index = wp->weapon_info_index;
Script_system.SetHookObjects(3, "Ship", &Objects[parent_objnum], "Weapon", objp, "Target", &Objects[turret->turret_enemy_objnum]);
Script_system.RunCondition(CHA_ONTURRETFIRED, 0, NULL, &Objects[parent_objnum]);
//nprintf(("AI", "Turret_time_enemy_in_range = %7.3f\n", ss->turret_time_enemy_in_range));
if (weapon_objnum != -1) {
wp->target_num = turret->turret_enemy_objnum;
@@ -2153,13 +2160,11 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
if (objnum >= 0 && is_target_beam_valid(&ss->weapons, &Objects[objnum])) {
if (ss->turret_enemy_objnum == -1) {
ss->turret_enemy_objnum = objnum;
ss->targeted_subsys = NULL; // Turret has retargeted; reset subsystem - Valathil for Mantis #2652
ss->turret_enemy_sig = Objects[objnum].signature;
// why return?
return;
} else {
ss->turret_enemy_objnum = objnum;
ss->targeted_subsys = NULL; // Turret has retargeted; reset subsystem - Valathil for Mantis #2652
ss->turret_enemy_sig = Objects[objnum].signature;
}
} else {
+2 -2
View File
@@ -472,7 +472,7 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
if ( instance->last_bitmap != -1 ){
bm_release(instance->last_bitmap);
}
bitmap_id = bm_create(bpp, instance->parent->width, instance->parent->height, instance->frame, bitmap_flags);
bitmap_id = bm_create(16, instance->parent->width, instance->parent->height, instance->frame, bitmap_flags);
}
if ( bitmap_id == -1 ) {
@@ -1000,7 +1000,7 @@ void anim_display_info(char *real_filename)
printf("FPS: %d\n", A.fps);
#ifndef NDEBUG
printf("Transparent RGB: (%u,%u,%u)\n", A.xparent_r, A.xparent_g, A.xparent_b);
printf("Transparent RGB: (%d,%d,%d)\n", A.xparent_r, A.xparent_g, A.xparent_b);
#endif
printf("ac version: %d\n", A.version);
+123 -14
View File
@@ -39,7 +39,8 @@
#include "network/multimsgs.h"
#include "network/multi.h"
#include "parse/scripting.h"
#include <algorithm>
#include "globalincs/compatibility.h"
#define ASTEROID_OBJ_USED (1<<0) // flag used in asteroid_obj struct
#define MAX_ASTEROID_OBJS MAX_ASTEROIDS // max number of asteroids tracked in asteroid list
@@ -1191,15 +1192,20 @@ void asc_get_relvec(vec3d *relvec, object *other_obj, vec3d *hitpos)
float asteroid_get_fireball_scale_multiplier(int num)
{
if (Asteroids[num].flags & AF_USED) {
asteroid_info *asip = &Asteroid_info[Asteroids[num].asteroid_type];
if (asip->fireball_radius_multiplier >= 0) {
return asip->fireball_radius_multiplier;
} else {
switch(Asteroids[num].asteroid_type) {
case ASTEROID_TYPE_LARGE:
return 1.5f;
break;
switch(Asteroids[num].asteroid_type) {
case ASTEROID_TYPE_LARGE:
return 1.5f;
break;
default:
return 1.0f;
break;
default:
return 1.0f;
break;
}
}
}
@@ -1216,10 +1222,22 @@ float asteroid_create_explosion(object *objp)
{
int fireball_objnum;
float explosion_life, fireball_scale_multiplier;
asteroid_info *asip = &Asteroid_info[Asteroids[objp->instance].asteroid_type];
int fireball_type = fireball_asteroid_explosion_type(asip);
if (fireball_type < 0) {
fireball_type = FIREBALL_ASTEROID;
}
if (fireball_type >= Num_fireball_types) {
Warning(LOCATION, "Invalid fireball type %i specified for an asteroid, only %i fireball types are defined.", fireball_type, Num_fireball_types);
return 0;
}
fireball_scale_multiplier = asteroid_get_fireball_scale_multiplier(objp->instance);
fireball_objnum = fireball_create( &objp->pos, FIREBALL_ASTEROID, FIREBALL_LARGE_EXPLOSION, OBJ_INDEX(objp), objp->radius*fireball_scale_multiplier, 0, &objp->phys_info.vel );
fireball_objnum = fireball_create( &objp->pos, fireball_type, FIREBALL_LARGE_EXPLOSION, OBJ_INDEX(objp), objp->radius*fireball_scale_multiplier, 0, &objp->phys_info.vel );
if ( fireball_objnum > -1 ) {
explosion_life = fireball_lifeleft(&Objects[fireball_objnum]);
} else {
@@ -1433,8 +1451,10 @@ int asteroid_count()
void asteroid_maybe_break_up(object *asteroid_obj)
{
asteroid *asp;
asteroid_info *asip;
asp = &Asteroids[asteroid_obj->instance];
asip = &Asteroid_info[asp->asteroid_type];
if ( timestamp_elapsed(asp->final_death_time) ) {
vec3d relvec, vfh, tvec;
@@ -1446,10 +1466,9 @@ void asteroid_maybe_break_up(object *asteroid_obj)
// multiplayer clients won't go through the following code. asteroid_sub_create will send
// a create packet to the client in the above named function
if ( !MULTIPLAYER_CLIENT ) {
// if this isn't true it's just debris, and debris doesn't break up
if (asp->asteroid_type <= ASTEROID_TYPE_LARGE)
{
// if the second condition isn't true it's just debris, and debris doesn't break up
if ( !MULTIPLAYER_CLIENT && (asp->asteroid_type <= ASTEROID_TYPE_LARGE)) {
if (asip->split_info.empty()) {
switch (asp->asteroid_type) {
case ASTEROID_TYPE_SMALL:
break;
@@ -1483,6 +1502,61 @@ void asteroid_maybe_break_up(object *asteroid_obj)
default: // this isn't going to happen.. really
break;
}
} else {
SCP_vector<int> roids_to_create;
SCP_vector<asteroid_split_info>::iterator split;
for (split = asip->split_info.begin(); split != asip->split_info.end(); ++split) {
int num_roids = split->min;
int num_roids_var = split->max - split->min;
if (num_roids_var > 0)
num_roids += rand() % num_roids_var;
if (num_roids > 0)
for (int i=0; i<num_roids; i++)
roids_to_create.push_back(split->asteroid_type);
}
random_shuffle(roids_to_create.begin(), roids_to_create.end());
int total_roids = roids_to_create.size();
for (int i = 0; i < total_roids; i++) {
vec3d dir_vec,final_vec;
vec3d parent_vel,hit_rel_vec;
// The roid directions are picked from the so-called
// "golden section spiral" to prevent them from
// clustering and thus clipping
float inc = PI * (3.0f - sqrt(5.0f));
float offset = 2.0f / total_roids;
float y = i * offset - 1 + (offset / 2);
float r = sqrt(1.0f - y*y);
float phi = i * inc;
dir_vec.xyz.x = cos(phi)*r;
dir_vec.xyz.y = sin(phi)*r;
dir_vec.xyz.z = y;
// Randomize the direction a bit
vec3d tempv = dir_vec;
vm_vec_random_cone(&dir_vec, &tempv, (360.0f / total_roids / 2));
// Make the roid inherit half of the parent's velocity
vm_vec_copy_normalize(&parent_vel, &asteroid_obj->phys_info.vel);
vm_vec_scale(&parent_vel, 0.5f);
// Make the hit position affect the direction, but only a little
vm_vec_sub(&hit_rel_vec, &asteroid_obj->pos, &asp->death_hit_pos);
vm_vec_normalize(&hit_rel_vec);
vm_vec_scale(&hit_rel_vec, 0.25f);
vm_vec_avg3(&final_vec, &parent_vel, &hit_rel_vec, &dir_vec);
vm_vec_normalize(&final_vec);
asteroid_sub_create(asteroid_obj, roids_to_create[i], &final_vec);
}
}
}
asp->final_death_time = timestamp(-1);
@@ -1737,6 +1811,16 @@ void asteroid_parse_section(asteroid_info *asip)
asip->damage_type_idx_sav = damage_type_add(buf);
asip->damage_type_idx = asip->damage_type_idx_sav;
}
if(optional_string("$Explosion Animations:")){
int temp[MAX_FIREBALL_TYPES];
int parsed_ints = stuff_int_list(temp, MAX_FIREBALL_TYPES, RAW_INTEGER_TYPE);
asip->explosion_bitmap_anims.clear();
asip->explosion_bitmap_anims.insert(asip->explosion_bitmap_anims.begin(), temp, temp+parsed_ints);
}
if(optional_string("$Explosion Radius Mult:"))
stuff_float(&asip->fireball_radius_multiplier);
required_string("$Expl inner rad:");
stuff_float(&asip->inner_rad);
@@ -1752,6 +1836,31 @@ void asteroid_parse_section(asteroid_info *asip)
required_string("$Hitpoints:");
stuff_float(&asip->initial_asteroid_strength);
while(optional_string("$Split:")) {
int split_type;
stuff_int(&split_type);
if (split_type>=0 && split_type<NUM_DEBRIS_SIZES) {
asteroid_split_info new_split;
new_split.asteroid_type = split_type;
if(optional_string("+Min:"))
stuff_int(&new_split.min);
else
new_split.min = 0;
if(optional_string("+Max:"))
stuff_int(&new_split.max);
else
new_split.max = 0;
asip->split_info.push_back( new_split );
} else
Warning(LOCATION, "Invalid asteroid reference %i used for $Split in asteroids table, ignoring.", split_type);
}
}
/**
+40 -28
View File
@@ -22,8 +22,8 @@ struct collision_info_struct;
#define MAX_ASTEROIDS 512
#define NUM_DEBRIS_SIZES 3
#define NUM_DEBRIS_POFS 3 // Number of POFs per debris size
#define NUM_DEBRIS_SIZES 3
#define NUM_DEBRIS_POFS 3 // Number of POFs per debris size
#define ASTEROID_TYPE_SMALL 0
#define ASTEROID_TYPE_MEDIUM 1
@@ -44,27 +44,39 @@ typedef struct asteroid_obj {
extern asteroid_obj Asteroid_obj_list;
// Data structure for determining a type and amount of other asteroids an
// asteroid will split to when destroyed.
typedef struct asteroid_split_info {
int asteroid_type;
int min;
int max;
} asteroid_split_info;
typedef struct asteroid_info {
char name[NAME_LENGTH]; // name for the asteroid
char pof_files[NUM_DEBRIS_POFS][MAX_FILENAME_LEN]; // POF files to load/associate with ship
int num_detail_levels; // number of detail levels for this ship
int detail_distance[MAX_ASTEROID_DETAIL_LEVELS]; // distance to change detail levels at
float max_speed; // cap on speed for asteroid
int damage_type_idx; //Damage type of the asteroid
int damage_type_idx_sav; // stored value from table used to reset damage_type_idx
float inner_rad; // radius within which maximum area effect damage is applied
float outer_rad; // radius at which no area effect damage is applied
float damage; // maximum damage applied from area effect explosion
float blast; // maximum blast impulse from area effect explosion
float initial_asteroid_strength; // starting strength of asteroid
char name[NAME_LENGTH]; // name for the asteroid
char pof_files[NUM_DEBRIS_POFS][MAX_FILENAME_LEN]; // POF files to load/associate with ship
int num_detail_levels; // number of detail levels for this ship
int detail_distance[MAX_ASTEROID_DETAIL_LEVELS]; // distance to change detail levels at
float max_speed; // cap on speed for asteroid
int damage_type_idx; //Damage type of the asteroid
int damage_type_idx_sav; // stored value from table used to reset damage_type_idx
float inner_rad; // radius within which maximum area effect damage is applied
float outer_rad; // radius at which no area effect damage is applied
float damage; // maximum damage applied from area effect explosion
float blast; // maximum blast impulse from area effect explosion
float initial_asteroid_strength; // starting strength of asteroid
SCP_vector< asteroid_split_info > split_info;
polymodel *modelp[NUM_DEBRIS_POFS];
int model_num[NUM_DEBRIS_POFS];
SCP_vector<int> explosion_bitmap_anims;
float fireball_radius_multiplier; // the model radius is multiplied by this to determine the fireball size
asteroid_info( )
: num_detail_levels( 0 ), max_speed( 0 ), damage_type_idx( 0 ),
damage_type_idx_sav( -1 ), inner_rad( 0 ), outer_rad( 0 ),
damage( 0 ), blast( 0 ), initial_asteroid_strength( 0 )
{
damage( 0 ), blast( 0 ), initial_asteroid_strength( 0 ),
fireball_radius_multiplier( -1 )
{
name[ 0 ] = NULL;
memset( pof_files, 0, sizeof( pof_files ) );
memset( detail_distance, 0, sizeof( detail_distance ) );
@@ -74,20 +86,20 @@ typedef struct asteroid_info {
} asteroid_info;
#define AF_USED (1<<0) // Set means used.
#define AF_USED (1<<0) // Set means used.
typedef struct asteroid {
int flags;
int objnum;
int asteroid_type; // 0..MAX_DEBRIS_TYPES
int asteroid_subtype; // Index in asteroid_info for modelnum and modelp
int check_for_wrap; // timestamp to check for asteroid wrapping around field
int check_for_wrap; // timestamp to check for asteroid wrapping around field
int check_for_collide; // timestamp to check for asteroid colliding with escort ships
int final_death_time; // timestamp to swap in new models after explosion starts
int final_death_time; // timestamp to swap in new models after explosion starts
int collide_objnum; // set to objnum that asteroid will be impacting soon
int collide_objsig; // object signature corresponding to collide_objnum
vec3d death_hit_pos; // hit pos that caused death
int target_objnum; // Yes, hah! Asteroids can have targets. See asteroid_aim_at_target().
vec3d death_hit_pos; // hit pos that caused death
int target_objnum; // Yes, hah! Asteroids can have targets. See asteroid_aim_at_target().
} asteroid;
@@ -104,15 +116,15 @@ typedef enum {
} field_type_t;
typedef struct asteroid_field {
vec3d min_bound; // Minimum range of field.
vec3d max_bound; // Maximum range of field.
vec3d min_bound; // Minimum range of field.
vec3d max_bound; // Maximum range of field.
int has_inner_bound;
vec3d inner_min_bound;
vec3d inner_max_bound;
vec3d vel; // Average asteroid moves at this velocity.
float speed; // Average speed of field
int num_initial_asteroids; // Number of asteroids at creation.
field_type_t field_type; // active throws and wraps, passive does not
vec3d vel; // Average asteroid moves at this velocity.
float speed; // Average speed of field
int num_initial_asteroids; // Number of asteroids at creation.
field_type_t field_type; // active throws and wraps, passive does not
debris_genre_t debris_genre; // type of debris (ship or asteroid) [generic type]
int field_debris_type[MAX_ACTIVE_DEBRIS_TYPES]; // one of the debris type defines above
} asteroid_field;
@@ -124,7 +136,7 @@ extern asteroid_field Asteroid_field;
extern int Num_asteroids;
extern int Asteroids_enabled;
void asteroid_init();
void asteroid_init();
void asteroid_level_init();
void asteroid_level_close();
void asteroid_create_all();
+2 -2
View File
@@ -54,7 +54,7 @@ int camMovingTime;
//float CameraSpeed;
bool CinematicStarted, CameraMoving;
vec3d cameraPos, cameraTarget;
std::map<int,int> autopilot_wings;
SCP_map<int,int> autopilot_wings;
int AutopilotMinEnemyDistance;
int AutopilotMinAsteroidDistance;
@@ -1255,7 +1255,7 @@ void NavSystem_Init()
void parse_autopilot_table(char *filename)
{
int rval;
SCP_vector<std::string> lines;
SCP_vector<SCP_string> lines;
// open localization
lcl_ext_open();
+1 -1
View File
@@ -59,7 +59,7 @@ extern int CurrentNav;
extern NavPoint Navs[MAX_NAVPOINTS];
extern NavMessage NavMsgs[NP_NUM_MESSAGES];
extern int LockAPConv;
extern std::map<int,int> autopilot_wings;
extern SCP_map<int,int> autopilot_wings;
// Cycles through the NavPoint List
bool Sel_NextNav();
+15 -40
View File
@@ -604,6 +604,14 @@ Done:
return handle;
}
/**
* Same as bm_load above, just with an SCP_string
*/
int bm_load(const SCP_string& filename)
{
return bm_load(const_cast<char*> (filename.c_str()));
}
/**
* Special load function. Basically allows you to load a bitmap which already exists (by filename).
*
@@ -626,37 +634,6 @@ int bm_load_duplicate(char *filename)
return ret;
}
/**
* This function is used to reload a different bitmap into an existing slot.
* This should only be used if you are certain the new picture has the same type, dimensions etc.
*
* @return negative if the given handle doesn't exist, the filename was empty or the slot is still locked
* @return the bitmap_handle on success
*/
int bm_reload(int bitmap_handle, char* filename)
{
if ( !bm_inited )
bm_init();
// if no file was passed then get out now
if ( (filename == NULL) || (strlen(filename) <= 0) )
return -1;
int bitmapnum = bitmap_handle % MAX_BITMAPS;
if ( bm_bitmaps[bitmapnum].type == BM_TYPE_NONE )
return -1;
if ( bm_bitmaps[bitmapnum].ref_count )
{
nprintf(("BmpMan", "Trying to reload a bitmap that is still locked. Filename: %s, ref_count: %d", bm_bitmaps[bitmapnum].filename, bm_bitmaps[bitmapnum].ref_count));
return -1;
}
strncpy(bm_bitmaps[bitmapnum].filename, filename, MAX_FILENAME_LEN);
return bitmap_handle;
}
DCF(bm_frag,"Shows BmpMan fragmentation")
{
if ( Dc_command ) {
@@ -1639,7 +1616,7 @@ MONITOR( SizeBitmapPage )
*
* Only lock a bitmap when you need it! This will convert it into the appropriate format also.
*/
bitmap * bm_lock( int handle, ubyte bpp, ubyte flags, bool nodebug)
bitmap * bm_lock( int handle, ubyte bpp, ubyte flags )
{
bitmap *bmp;
bitmap_entry *be;
@@ -1699,7 +1676,7 @@ bitmap * bm_lock( int handle, ubyte bpp, ubyte flags, bool nodebug)
#endif
// read the file data
if ( gr_bm_lock( be->filename, handle, bitmapnum, bpp, flags, nodebug ) == -1 ) {
if ( gr_bm_lock( be->filename, handle, bitmapnum, bpp, flags ) == -1 ) {
// oops, this isn't good - reset and return NULL
bm_unlock( bitmapnum );
bm_unload( bitmapnum );
@@ -1913,7 +1890,7 @@ int bm_release(int handle, int clear_render_targets)
*
* @return 1 on successful release, 0 otherwise
*/
int bm_unload( int handle, int clear_render_targets, bool nodebug )
int bm_unload( int handle, int clear_render_targets )
{
bitmap_entry *be;
bitmap *bmp;
@@ -1935,7 +1912,7 @@ int bm_unload( int handle, int clear_render_targets, bool nodebug )
Assert( be->handle == handle ); // INVALID BITMAP HANDLE!
// If it is locked, cannot free it.
if (be->ref_count != 0 && !nodebug) {
if (be->ref_count != 0) {
nprintf(("BmpMan", "Tried to unload %s that has a lock count of %d.. not unloading\n", be->filename, be->ref_count));
return 0;
}
@@ -1947,7 +1924,7 @@ int bm_unload( int handle, int clear_render_targets, bool nodebug )
if ( be->load_count > 0 )
be->load_count--;
if ( be->load_count != 0 && !nodebug) {
if ( be->load_count != 0 ) {
nprintf(("BmpMan", "Tried to unload %s that has a load count of %d.. not unloading\n", be->filename, be->load_count + 1));
return 0;
}
@@ -1963,13 +1940,11 @@ int bm_unload( int handle, int clear_render_targets, bool nodebug )
return 1;
for (i = 0; i < bm_bitmaps[first].info.ani.num_frames; i++) {
if(!nodebug)
nprintf(("BmpMan", "Unloading %s frame %d. %dx%dx%d\n", be->filename, i, bmp->w, bmp->h, bmp->bpp));
nprintf(("BmpMan", "Unloading %s frame %d. %dx%dx%d\n", be->filename, i, bmp->w, bmp->h, bmp->bpp));
bm_free_data(first+i); // clears flags, bbp, data, etc
}
} else {
if(!nodebug)
nprintf(("BmpMan", "Unloading %s. %dx%dx%d\n", be->filename, bmp->w, bmp->h, bmp->bpp));
nprintf(("BmpMan", "Unloading %s. %dx%dx%d\n", be->filename, bmp->w, bmp->h, bmp->bpp));
bm_free_data(n); // clears flags, bbp, data, etc
}
+3 -6
View File
@@ -89,6 +89,7 @@ extern int bm_texture_ram;
// the bitmap. On success, it returns the bitmap
// number.
int bm_load(char * filename);
int bm_load(const SCP_string& filename);
// special load function. basically allows you to load a bitmap which already exists (by filename).
// this is useful because in some cases we need to have a bitmap which is locked in screen format
@@ -108,7 +109,7 @@ int bm_create( int bpp, int w, int h, void *data = NULL, int flags = 0);
// Frees up a bitmap's data, but bitmap number 'n' can
// still be used, it will just have to be paged in next
// time it is locked.
int bm_unload( int n, int clear_render_targets = 0, bool nodebug = false);
int bm_unload( int n, int clear_render_targets = 0 );
// like bm_unload() except that it's safe to use to free data without worrying about
// load_count so it's safe to use in relation to bm_release() and in gr_*_texture functions
@@ -132,7 +133,7 @@ extern int bm_load_either(char *filename, int *nframes = NULL, int *fps = NULL,
// that can be accessed until you call bm_unlock. Only lock
// a bitmap when you need it! This will convert it into the
// appropriate format also.
extern bitmap * bm_lock( int bitmapnum, ubyte bpp, ubyte flags, bool nodebug = false);
extern bitmap * bm_lock( int bitmapnum, ubyte bpp, ubyte flags );
// The signature is a field that gets filled in with
// a unique signature for each bitmap. The signature for each bitmap
@@ -171,9 +172,6 @@ void bm_gfx_get_pixel( int bitmap, float u, float v, ubyte *r, ubyte *g, ubyte *
// nnew = number of bytes of bitmaps locked this frame that weren't locked last frame
void bm_get_frame_usage(int *ntotal, int *nnew);
// Reload a different image into an existing bmpman slot
int bm_reload(int bitmap_handle, char* filename);
/*
* Example on using bm_create
*
@@ -282,5 +280,4 @@ int bm_make_render_target( int width, int height, int flags );
int bm_is_render_target(int bitmap_id);
int bm_set_render_target(int handle, int face = -1);
int bm_load_and_parse_eff(char *filename, int dir_type, int *nframes, int *nfps, int *key, ubyte *type);
#endif
+2 -2
View File
@@ -522,7 +522,7 @@ subtitle::subtitle(int in_x_pos, int in_y_pos, char* in_text, char* in_imageanim
int split_width = (in_width > 0) ? in_width : 200;
num_text_lines = split_str(in_text, split_width, text_line_lens, text_line_ptrs, MAX_SUBTITLE_LINES);
std::string temp_str;
SCP_string temp_str;
for(int i = 0; i < num_text_lines; i++)
{
temp_str.assign(text_line_ptrs[i], text_line_lens[i]);
@@ -669,7 +669,7 @@ void subtitle::do_frame(float frametime)
int y = text_pos.y;
for(SCP_vector<std::string>::iterator line = text_lines.begin(); line != text_lines.end(); ++line)
for(SCP_vector<SCP_string>::iterator line = text_lines.begin(); line != text_lines.end(); ++line)
{
gr_string(x, y, (char*)line->c_str(), false);
y += font_height;
+1 -1
View File
@@ -116,7 +116,7 @@ class subtitle
private:
void clone(const subtitle &sub);
SCP_vector<std::string> text_lines;
SCP_vector<SCP_string> text_lines;
struct { int x; int y; } text_pos;
float display_time;
+2 -2
View File
@@ -358,7 +358,7 @@ namespace cfile
{
}
cfile_error(const std::string &excuse) : m_excuse(excuse)
cfile_error(const std::string &excuse) : m_excuse(excuse)
{
}
@@ -378,7 +378,7 @@ namespace cfile
class max_read_length : public cfile_error
{
public:
max_read_length(const std::string &excuse) : cfile_error(excuse)
max_read_length(const std::string &excuse) : cfile_error(excuse)
{
}
+1 -1
View File
@@ -97,7 +97,7 @@ typedef struct vp_fileinfo {
~vp_fileinfo() {}
} vp_fileinfo;
std::vector<vp_fileinfo> VP_FileInfo;
SCP_vector<vp_fileinfo> VP_FileInfo;
// just like strlwr() but without actually including it here
void lowercase(char *s)
+17 -13
View File
@@ -116,7 +116,6 @@ Flag exe_params[] =
{ "-spec", "Enable specular", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-spec", },
{ "-glow", "Enable glow maps", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-glow", },
{ "-env", "Enable environment maps", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-env", },
{ "-mipmap", "Enable mipmapping", true, 0, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-mipmap", },
{ "-nomotiondebris", "Disable motion debris", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomotiondebris",},
{ "-noscalevid", "Disable scale-to-window for movies", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noscalevid", },
{ "-missile_lighting", "Apply lighting to missiles" , true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-missile_lighting", },
@@ -125,6 +124,7 @@ Flag exe_params[] =
{ "-post_process", "Enable post processing", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-post_process" },
{ "-soft_particles", "Enable soft particles", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-soft_particles" },
{ "-fxaa", "Enable FXAA anti-aliasing", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fxaa" },
{ "-flightshaftsoff", "Force Lightshafts off", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-flightshaftsoff"},
{ "-img2dds", "Compress non-compressed images", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-img2dds", },
{ "-no_vsync", "Disable vertical sync", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_vsync", },
@@ -167,6 +167,7 @@ Flag exe_params[] =
{ "-ati_swap", "Fix colour issues on some ATI cards", true, 0, EASY_DEFAULT, "Troubleshoot", "http://scp.indiegames.us/mantis/view.php?id=1669", },
{ "-no_3d_sound", "Use only 2D/stereo for sound effects", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_3d_sound", },
{ "-disable_glsl_model","Don't use shaders for model rendering", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-disable_glsl_model", },
{ "-mipmap", "Enable mipmapping", true, 0, EASY_DEFAULT_MEM, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-mipmap", },
#ifndef SCP_UNIX
{ "-disable_di_mouse", "Don't use DirectInput for mouse control", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
#endif
@@ -198,6 +199,7 @@ Flag exe_params[] =
#ifdef SCP_UNIX
{ "-nograb", "Don't grab mouse/keyboard in a window", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nograb", },
#endif
{ "-reparse_mainhall", "Reparse mainhall.tbl when loading halls", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-reparse_mainhall", },
};
// here are the command line parameters that we will be using for FreeSpace
@@ -256,7 +258,6 @@ cmdline_parm spec_point_arg("-spec_point", NULL);
cmdline_parm spec_tube_arg("-spec_tube", NULL);
cmdline_parm ambient_factor_arg("-ambient_factor", NULL); // Cmdline_ambient_factor
cmdline_parm env("-env", NULL); // Cmdline_env
cmdline_parm mipmap_arg("-mipmap", NULL); // Cmdline_mipmap
cmdline_parm missile_lighting_arg("-missile_lighting", NULL); // Cmdline_missile_lighting
cmdline_parm glow_arg("-glow", NULL); // Cmdline_glow -- use Bobs glow code
cmdline_parm nomotiondebris_arg("-nomotiondebris", NULL); // Cmdline_nomotiondebris -- Removes those ugly floating rocks -C
@@ -272,6 +273,7 @@ cmdline_parm bloom_intensity_arg("-bloom_intensity", NULL);
cmdline_parm fxaa_arg("-fxaa", NULL);
cmdline_parm fxaa_preset_arg("-fxaa_preset", NULL);
cmdline_parm fb_explosions_arg("-fb_explosions", NULL);
cmdline_parm flightshaftsoff_arg("-flightshaftsoff", NULL);
float Cmdline_clip_dist = Default_min_draw_distance;
float Cmdline_fov = 0.75f;
@@ -295,6 +297,7 @@ bool Cmdline_fxaa = false;
int Cmdline_fxaa_preset = 6;
extern int Fxaa_preset_last_frame;
bool Cmdline_fb_explosions = 0;
extern bool ls_force_off;
// Game Speed related
cmdline_parm cache_bitmaps_arg("-cache_bitmaps", NULL); // Cmdline_cache_bitmaps
@@ -371,6 +374,7 @@ cmdline_parm no_set_gamma_arg("-no_set_gamma", NULL); // Cmdline_no_set_gamma
cmdline_parm no_vbo_arg("-novbo", NULL); // Cmdline_novbo
cmdline_parm no_fbo_arg("-disable_fbo", NULL); // Cmdline_no_fbo
cmdline_parm noglsl_arg("-no_glsl", NULL); // Cmdline_noglsl -- disable GLSL support in OpenGL
cmdline_parm mipmap_arg("-mipmap", NULL); // Cmdline_mipmap
cmdline_parm atiswap_arg("-ati_swap", NULL); // Cmdline_atiswap - Fix ATI color swap issue for screenshots.
cmdline_parm no3dsound_arg("-no_3d_sound", NULL); // Cmdline_no_3d_sound - Disable use of full 3D sounds
cmdline_parm no_glsl_models_arg("-disable_glsl_model", NULL); // Cmdline_no_glsl_model_rendering -- switches model rendering to fixed pipeline
@@ -414,6 +418,7 @@ cmdline_parm parse_cmdline_only(PARSE_COMMAND_LINE_STRING, NULL);
#ifdef SCP_UNIX
cmdline_parm no_grab("-nograb", NULL); // Cmdline_no_grab
#endif
cmdline_parm reparse_mainhall_arg("-reparse_mainhall", NULL); //Cmdline_reparse_mainhall
char *Cmdline_start_mission = NULL;
int Cmdline_dis_collisions = 0;
@@ -433,18 +438,13 @@ int Cmdline_verify_vps = 0;
#ifdef SCP_UNIX
int Cmdline_no_grab = 0;
#endif
int Cmdline_reparse_mainhall = 0;
// Other
cmdline_parm get_flags_arg("-get_flags", NULL);
cmdline_parm output_sexp_arg("-output_sexps", NULL); //WMC - outputs all SEXPs to sexps.html
cmdline_parm output_scripting_arg("-output_scripting", NULL); //WMC
float Cmdline_percentflashtobang = -1.0;
int Cmdline_enforce_concurrent_sound_count = 1;
cmdline_parm percent_flashtobang_arg("-percent_flashtobang", NULL);
cmdline_parm do_not_enforce_concurrent_sound("-donotenforce", NULL);
#ifndef NDEBUG
@@ -1416,7 +1416,11 @@ bool SetCmdlineParams()
if ( ogl_spec_arg.found() ) {
Cmdline_ogl_spec = ogl_spec_arg.get_float();
CLAMP(Cmdline_ogl_spec, 0.0f, 128.0f);
if ( Cmdline_ogl_spec < 0.0f )
Cmdline_ogl_spec = 0.0f;
if ( Cmdline_ogl_spec > 128.0f )
Cmdline_ogl_spec = 128.0f;
}
if ( rearm_timer_arg.found() )
@@ -1467,14 +1471,14 @@ bool SetCmdlineParams()
Cmdline_bloom_intensity = bloom_intensity_arg.get_int();
}
if ( percent_flashtobang_arg.found() )
if ( flightshaftsoff_arg.found() )
{
Cmdline_percentflashtobang = percent_flashtobang_arg.get_float();
ls_force_off = true;
}
if ( do_not_enforce_concurrent_sound.found() )
if( reparse_mainhall_arg.found() )
{
Cmdline_enforce_concurrent_sound_count = 0;
Cmdline_reparse_mainhall = 1;
}
return true;
+2 -6
View File
@@ -62,7 +62,6 @@ extern float static_point_factor;
extern float static_tube_factor;
extern int Cmdline_ambient_factor;
extern int Cmdline_env;
extern int Cmdline_mipmap;
extern int Cmdline_missile_lighting;
extern int Cmdline_glow;
extern int Cmdline_nomotiondebris;
@@ -122,6 +121,7 @@ extern int Cmdline_no_set_gamma;
extern int Cmdline_novbo;
extern int Cmdline_no_fbo;
extern int Cmdline_noglsl;
extern int Cmdline_mipmap;
extern int Cmdline_ati_color_swap;
extern int Cmdline_no_3d_sound;
extern int Cmdline_no_glsl_model_rendering;
@@ -145,10 +145,6 @@ extern int Cmdline_verify_vps;
#ifdef SCP_UNIX
extern int Cmdline_no_grab;
#endif
extern int Cmdline_reparse_mainhall;
// Temp, only for evaluating new defaults
extern float Cmdline_percentflashtobang;
extern int Cmdline_enforce_concurrent_sound_count;
//extern char FreeSpace_Directory[]; // allievating a cfilesystem problem caused by fred -- Kazan
#endif
+1 -1
View File
@@ -91,7 +91,7 @@ void cmeasure_maybe_alert_success(object *objp)
if ( objp->parent == OBJ_INDEX(Player_obj) ) {
hud_start_text_flash(XSTR("Evaded", 1430), 800);
snd_play(&Snds[SND_MISSILE_EVADED_POPUP]);
snd_play(&Snds[ship_get_sound(Player_obj, SND_MISSILE_EVADED_POPUP)]);
} else if ( Objects[objp->parent].flags & OF_PLAYER_SHIP ) {
send_countermeasure_success_packet( objp->parent );
}
+7 -23
View File
@@ -1610,8 +1610,8 @@ void control_config_do_frame(float frametime)
for (i=0; i<CCFG_MAX; i++) {
if (Control_config[i].joy_id == j) {
z = i;
for (size_t buttonid=0; buttonid<NUM_BUTTONS; buttonid++){
CC_Buttons[gr_screen.res][buttonid].button.reset();
for (j=0; j<NUM_BUTTONS; j++){
CC_Buttons[gr_screen.res][j].button.reset();
}
break;
}
@@ -2100,7 +2100,7 @@ void control_check_indicate()
Control_check_count = 0;
}
int check_control_used(int id, int key)
int check_control(int id, int key)
{
int z, mask;
static int last_key = 0;
@@ -2152,8 +2152,10 @@ int check_control_used(int id, int key)
z &= KEY_MASK;
if (keyd_pressed[z] || key_down_count(z)) {
control_used(id);
return 1;
if ( !hud_squadmsg_read_key(z) ) {
control_used(id);
return 1;
}
}
}
@@ -2169,24 +2171,6 @@ int check_control_used(int id, int key)
return 0;
}
/**
* Wrapper for check_control_used. Allows the game to ignore the key if told to do so by the ignore-key SEXP.
*/
int check_control(int id, int key)
{
if (check_control_used(id, key)) {
if (Ignored_keys[id]) {
if (Ignored_keys[id] > 0) {
Ignored_keys[id]--;
}
return 0;
}
return 1;
}
return 0;
}
// get heading, pitch, bank, throttle abs. and throttle rel. values.
void control_get_axes_readings(int *h, int *p, int *b, int *ta, int *tr)
{
+5 -5
View File
@@ -163,10 +163,10 @@ config_item Control_config[CCFG_MAX + 1] = {
{ KEY_SHIFTED | KEY_B, -1, TARGET_TAB, true, "Target Previous Hostile Bomb or Bomber" },
// multiplayer messaging keys
{ KEY_1, -1, COMPUTER_TAB, true, "(Multiplayer) Message All" },
{ KEY_2, -1, COMPUTER_TAB, true, "(Multiplayer) Message Friendly" },
{ KEY_3, -1, COMPUTER_TAB, true, "(Multiplayer) Message Hostile" },
{ KEY_4, -1, COMPUTER_TAB, true, "(Multiplayer) Message Target" },
{ KEY_1, -1, COMPUTER_TAB, true, "(Multiplayer) Message All", CC_TYPE_CONTINUOUS },
{ KEY_2, -1, COMPUTER_TAB, true, "(Multiplayer) Message Friendly", CC_TYPE_CONTINUOUS },
{ KEY_3, -1, COMPUTER_TAB, true, "(Multiplayer) Message Hostile", CC_TYPE_CONTINUOUS },
{ KEY_4, -1, COMPUTER_TAB, true, "(Multiplayer) Message Target", CC_TYPE_CONTINUOUS },
{ KEY_ALTED | KEY_X, -1, COMPUTER_TAB, true, "(Multiplayer) Observer Zoom to Target"},
{ KEY_SHIFTED | KEY_PERIOD, -1, COMPUTER_TAB, true, "Increase Time Compression" },
{ KEY_SHIFTED | KEY_COMMA, -1, COMPUTER_TAB, true, "Decrease Time Compression" },
@@ -556,7 +556,7 @@ void control_config_common_init()
#include <map>
#include <string>
std::map<std::string, int> mEnumNameToVal;
SCP_map<SCP_string, int> mEnumNameToVal;
void LoadEnumsIntoMap();
void control_config_common_load_overrides()
-2
View File
@@ -127,7 +127,6 @@ bool movie_play(char *name)
} else {
// uh-oh, movie is invalid... Abory, Retry, Fail?
mprintf(("MOVIE ERROR: Found invalid movie! (%s)\n", name));
Mouse_hidden--; // show the mouse cursor!
return false;
}
} else if (rc == MOVIE_MVE) {
@@ -144,7 +143,6 @@ bool movie_play(char *name)
} else {
// uh-oh, movie is invalid... Abory, Retry, Fail?
mprintf(("MOVIE ERROR: Found invalid movie! (%s)\n", name));
Mouse_hidden--; // show the mouse cursor!
return false;
}
}
+19 -1
View File
@@ -20,6 +20,7 @@
#include "cmdline/cmdline.h"
#include "parse/parselo.h"
#include "globalincs/pstypes.h"
#include "asteroid/asteroid.h"
#include <stdlib.h>
@@ -450,7 +451,7 @@ void fireball_render(object * obj)
}
/**
* Delete a fireball.
* Delete a fireball.
* Called by object_delete() code... do not call directly.
*/
void fireball_delete( object * obj )
@@ -1009,6 +1010,23 @@ int fireball_ship_explosion_type(ship_info *sip)
return index;
}
int fireball_asteroid_explosion_type(asteroid_info *aip)
{
Assert( aip != NULL );
if (aip->explosion_bitmap_anims.empty())
return -1;
int index = -1;
int roid_fireballs = (int)aip->explosion_bitmap_anims.size();
if (roid_fireballs > 0) {
index = aip->explosion_bitmap_anims[rand()%roid_fireballs];
}
return index;
}
float fireball_wormhole_intensity( object *obj )
{
int num, objnum;
+22 -18
View File
@@ -16,6 +16,7 @@
struct object;
struct ship_info;
struct asteroid_info;
// values correspond to the fireball render types
#define FIREBALL_MEDIUM_EXPLOSION 0
@@ -23,15 +24,15 @@ struct ship_info;
#define FIREBALL_WARP_EFFECT 2
// these values correspond to the fireball.tbl default entries
#define FIREBALL_EXPLOSION_MEDIUM 0 // Used for the 4 little explosions before a ship explodes
#define FIREBALL_WARP 1 // Used for the warp in / warp out effect
#define FIREBALL_KNOSSOS 2 // Used for the KNOSSOS warp in / warp out effect
#define FIREBALL_ASTEROID 3
#define FIREBALL_EXPLOSION_LARGE1 4 // Used for the big explosion when a ship breaks into pieces
#define FIREBALL_EXPLOSION_LARGE2 5 // Used for the big explosion when a ship breaks into pieces
#define FIREBALL_EXPLOSION_MEDIUM 0 // Used for the 4 little explosions before a ship explodes
#define FIREBALL_WARP 1 // Used for the warp in / warp out effect
#define FIREBALL_KNOSSOS 2 // Used for the KNOSSOS warp in / warp out effect
#define FIREBALL_ASTEROID 3
#define FIREBALL_EXPLOSION_LARGE1 4 // Used for the big explosion when a ship breaks into pieces
#define FIREBALL_EXPLOSION_LARGE2 5 // Used for the big explosion when a ship breaks into pieces
#define MAX_FIREBALL_TYPES 32 // The maximum number of fireballs that can be defined
#define NUM_DEFAULT_FIREBALLS 6
#define MAX_FIREBALL_TYPES 32 // The maximum number of fireballs that can be defined
#define NUM_DEFAULT_FIREBALLS 6
#define FIREBALL_NUM_LARGE_EXPLOSIONS 2
@@ -41,12 +42,12 @@ extern int Num_fireball_types;
// all this moved here by Goober5000 because it makes more sense in the H file
typedef struct fireball_lod {
char filename[MAX_FILENAME_LEN];
int bitmap_id;
int num_frames;
int fps;
int bitmap_id;
int num_frames;
int fps;
} fireball_lod;
typedef struct fireball_info {
typedef struct fireball_info {
int lod_count;
float exp_color[3];
fireball_lod lod[4];
@@ -59,18 +60,18 @@ typedef struct fireball_info {
#define FBF_WARP_3D (1<<3) // Goober5000
#define FBF_WARP_VIA_SEXP (1<<4) // Goober5000
typedef struct fireball {
typedef struct fireball {
int objnum; // If -1 this object is unused
int fireball_info_index; // Index into Fireball_info array
int fireball_render_type;
int current_bitmap;
int orient; // For fireballs, which orientation. For warps, 0 is warpin, 1 is warpout
int flags; // see #define FBF_*
char lod; // current LOD
float time_elapsed; // in seconds
float total_time; // total lifetime of animation in seconds
int warp_open_sound_index; // for warp-effect - Goober5000
int warp_close_sound_index; // for warp-effect - Goober5000
char lod; // current LOD
float time_elapsed; // in seconds
float total_time; // total lifetime of animation in seconds
int warp_open_sound_index; // for warp-effect - Goober5000
int warp_close_sound_index; // for warp-effect - Goober5000
} fireball;
// end move
@@ -104,6 +105,9 @@ void fireball_get_color(int idx, float *red, float *green, float *blue);
// returns the index of the fireball bitmap for this ship. -1 if there is none.
int fireball_ship_explosion_type(ship_info *sip);
// returns the index of the fireball bitmap for this asteroid. -1 if there is none.
int fireball_asteroid_explosion_type(asteroid_info *aip);
// returns the intensity of a wormhole
float fireball_wormhole_intensity( object *obj );
+7 -4
View File
@@ -916,7 +916,7 @@ void briefing_editor_dlg::OnMakeIcon()
iconp = &Briefing->stages[m_cur_stage].icons[m_cur_icon];
ship = waypoint = -1;
team = 0;
jump_node *jnp = NULL;
SCP_list<jump_node>::iterator jnp;
vm_vec_make(&min, 9e19f, 9e19f, 9e19f);
vm_vec_make(&max, -9e19f, -9e19f, -9e19f);
@@ -947,7 +947,10 @@ void briefing_editor_dlg::OnMakeIcon()
break;
case OBJ_JUMP_NODE:
jnp = ptr->jnp;
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
if(jnp->get_obj() == ptr)
break;
}
break;
default:
@@ -993,7 +996,7 @@ void briefing_editor_dlg::OnMakeIcon()
Assert(wp_list != NULL);
name = wp_list->get_name();
}
else if (jnp != NULL)
else if (jnp != Jump_nodes.end())
name = jnp->get_name_ptr();
else
return;
@@ -1088,7 +1091,7 @@ void briefing_editor_dlg::OnMakeIcon()
}
}
// jumpnodes
else if(jnp != NULL){
else if(jnp != Jump_nodes.end()){
// find the first navbuoy
iconp->ship_class = -1;
for (int i = 0; i < Num_ship_classes; i++)
+2
View File
@@ -21,6 +21,8 @@
#include "cfile/cfile.h"
#include "sound/audiostr.h"
#include "localization/localize.h"
#include "jumpnode/jumpnode.h"
#ifdef _DEBUG
#undef THIS_FILE
+5 -3
View File
@@ -400,13 +400,15 @@ void DumpStats::get_object_stats(CString &buffer)
// Jumpnodes
buffer += "\r\nJUMPNODES\r\n";
for ( jump_node *jnp = (jump_node *)Jump_nodes.get_first(); !Jump_nodes.is_end(jnp); jnp = (jump_node *)jnp->get_next() ) {
SCP_list<jump_node>::iterator jnp;
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
temp.Format("\tJumpnode: %s\r\n", jnp->get_name_ptr());
buffer += temp;
}
if (Jump_nodes.get_num_elements() > 0) {
temp.Format("\ttotal_jumpnodes: %d\r\n", Jump_nodes.get_num_elements());
if (Jump_nodes.size() > 0) {
temp.Format("\ttotal_jumpnodes: %d\r\n", Jump_nodes.size());
buffer += temp;
}
+1 -1
View File
@@ -1254,7 +1254,7 @@ void event_editor::OnBrowseAvi()
z = cfile_push_chdir(CF_TYPE_INTERFACE);
CFileDialog dlg(TRUE, "ani", m_avi_filename, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,
"Ani Files (*.ani)|*.ani|Eff Files (*.eff)|*.eff|Avi Files (*.avi)|*.avi|Both (*.ani, *.avi)|*.ani;*.avi||");
"Ani Files (*.ani)|*.ani|Avi Files (*.avi)|*.avi|Both (*.ani, *.avi)|*.ani;*.avi||");
if (dlg.DoModal() == IDOK) {
m_avi_filename = dlg.GetFileName();
+3
View File
@@ -703,3 +703,6 @@ int CFREDApp::ExitInstance()
// Empty functions to make fred link with the sexp_mission_set_subspace
void game_start_subspace_ambient_sound() {}
void game_stop_subspace_ambient_sound() {}
// Variables to make fred.ccp more like freespace2.cpp so fred will link
float Sun_spot = 0.0f;
+16 -11
View File
@@ -18,11 +18,13 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -622,7 +624,7 @@ CAPTION "About FRED2"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,10,17,20,20,SS_REALSIZEIMAGE
LTEXT "FRED2_OPEN - FreeSpace Editor, Version 3.6.14 OpenGL",IDC_STATIC,39,8,184,10,SS_NOPREFIX
LTEXT "FRED2_OPEN - FreeSpace Editor, Version 3.6.13 OpenGL",IDC_STATIC,39,8,184,10,SS_NOPREFIX
LTEXT "Copyright © 1999 Volition, Inc. All Rights Reserved",IDC_STATIC,39,17,164,8
DEFPUSHBUTTON "OK",IDOK,229,7,48,14,WS_GROUP
LTEXT """Fred2 is the omega of all giant unwieldy pieces of code. Its big, its horrifying, and it just doesn't care. View it at your own risk."" - Dave Baranec",IDC_STATIC,39,62,238,20
@@ -1439,7 +1441,7 @@ BEGIN
EDITTEXT IDC_HULL,57,24,40,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Spin1",IDC_HULL_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,98,24,11,14
CONTROL "Has Shield System",IDC_HAS_SHIELDS,"Button",BS_3STATE | WS_TABSTOP,7,43,75,10
CONTROL "Locked",IDC_LOCKED,"Button",BS_3STATE | WS_TABSTOP,7,78,40,10
CONTROL "Ship Locked",IDC_SHIP_LOCKED,"Button",BS_3STATE | WS_TABSTOP,7,78,56,10
EDITTEXT IDC_SHIELDS,57,55,40,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Spin3",IDC_SHIELDS_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,99,56,9,14
COMBOBOX IDC_DOCKEE,103,142,80,106,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@@ -1464,6 +1466,7 @@ BEGIN
CONTROL "Turrets Locked",IDC_TURRETS_LOCKED,"Button",BS_3STATE | WS_TABSTOP,7,101,81,8
CONTROL "Afterburner Locked",IDC_AFTERBURNER_LOCKED,"Button",BS_3STATE | WS_TABSTOP,93,101,83,10
CONTROL "Force Shields On",IDC_FORCE_SHIELDS,"Button",BS_3STATE | WS_TABSTOP,86,43,84,8
CONTROL "Weapon Locked",IDC_WEAPONS_LOCKED,"Button",BS_3STATE | WS_TABSTOP,93,79,69,10
END
IDD_ASTEROID_EDITOR DIALOG 0, 0, 376, 210
@@ -2071,8 +2074,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,6,14,9276
PRODUCTVERSION 3,6,14,9276
FILEVERSION 3,6,13,0
PRODUCTVERSION 3,6,13,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -2089,12 +2092,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Volition Inc."
VALUE "FileDescription", "Fred 2 Open"
VALUE "FileVersion", "3.6.14.9276"
VALUE "FileVersion", "3.6.13.0000"
VALUE "InternalName", "Fred 2 Open"
VALUE "LegalCopyright", "Copyright © 1998"
VALUE "OriginalFilename", "fred2.exe"
VALUE "ProductName", "Fred 2 Open"
VALUE "ProductVersion", "3.6.14"
VALUE "ProductVersion", "3.6.13"
END
END
BLOCK "VarFileInfo"
@@ -2665,7 +2668,7 @@ IDC_CURSOR2 CURSOR "res\\cursor2.cur"
STRINGTABLE
BEGIN
IDR_MAINFRAME "FRED2_OPEN 3.6.14 RC6 - FreeSpace2 Mission Editor\nUntitled\nFRED2\nFreeSpace2 Missions (*.fs2)\n.fs2\nFreeSpace2Mission\nFreeSpace2 Mission"
IDR_MAINFRAME "FRED2_OPEN 3.6.13 - FreeSpace2 Mission Editor\nUntitled\nFRED2\nFreeSpace2 Missions (*.fs2)\n.fs2\nFreeSpace2Mission\nFreeSpace2 Mission"
END
STRINGTABLE
@@ -2953,16 +2956,18 @@ BEGIN
ID_FORMAT_FS1_RETAIL "Save missions compatible with FS1 retail"
END
#endif // English (United States) resources
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (United Kingdom) resources
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
@@ -3008,7 +3013,7 @@ BEGIN
END
#endif // APSTUDIO_INVOKED
#endif // English (United Kingdom) resources
#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
+1 -1
View File
@@ -905,7 +905,7 @@ void render_one_model_htl(object *objp)
if (Fred_outline) {
model_set_outline_color(Fred_outline >> 16, (Fred_outline >> 8) & 0xff, Fred_outline & 0xff);
j |= MR_SHOW_OUTLINE_HTL;
j |= MR_SHOW_OUTLINE;
}
g3_done_instance(0);
+6 -1
View File
@@ -1394,6 +1394,7 @@ void CFREDView::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
CMenu menu;
int objnum;
CPoint local = point;
SCP_list<jump_node>::iterator jnp;
if (button_down) {
cancel_drag();
@@ -1420,7 +1421,11 @@ void CFREDView::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
else if (Objects[objnum].type == OBJ_JUMP_NODE) {
id = ID_EDITORS_WAYPOINT;
str.Format("Edit %s", Objects[objnum].jnp->get_name_ptr());
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
if(jnp->get_obj() == &Objects[objnum])
break;
}
str.Format("Edit %s", jnp->get_name_ptr());
} else if (Objects[objnum].type == OBJ_WAYPOINT) {
int idx;
+108 -84
View File
@@ -43,7 +43,8 @@ initial_status::initial_status(CWnd* pParent /*=NULL*/)
m_hull = 0;
m_has_shields = FALSE;
m_force_shields = FALSE;
m_locked = FALSE;
m_ship_locked = FALSE;
m_weapons_locked = FALSE;
m_primaries_locked = FALSE;
m_secondaries_locked = FALSE;
m_turrets_locked = FALSE;
@@ -83,7 +84,8 @@ void initial_status::DoDataExchange(CDataExchange* pDX)
DDV_MinMaxInt(pDX, m_damage, 0, 100);
DDX_Check(pDX, IDC_HAS_SHIELDS, m_has_shields);
DDX_Check(pDX, IDC_FORCE_SHIELDS, m_force_shields);
DDX_Check(pDX, IDC_LOCKED, m_locked);
DDX_Check(pDX, IDC_SHIP_LOCKED, m_ship_locked);
DDX_Check(pDX, IDC_WEAPONS_LOCKED, m_weapons_locked);
DDX_Check(pDX, IDC_PRIMARIES_LOCKED, m_primaries_locked);
DDX_Check(pDX, IDC_SECONDARIES_LOCKED, m_secondaries_locked);
DDX_Check(pDX, IDC_TURRETS_LOCKED, m_turrets_locked);
@@ -124,7 +126,8 @@ BEGIN_MESSAGE_MAP(initial_status, CDialog)
ON_CBN_SELCHANGE(IDC_DOCKEE_POINT, OnSelchangeDockeePoint)
ON_BN_CLICKED(IDC_HAS_SHIELDS, OnHasShields)
ON_BN_CLICKED(IDC_FORCE_SHIELDS, OnForceShields)
ON_BN_CLICKED(IDC_LOCKED, OnLocked)
ON_BN_CLICKED(IDC_SHIP_LOCKED, OnShipLocked)
ON_BN_CLICKED(IDC_WEAPONS_LOCKED, OnWeaponsLocked)
ON_BN_CLICKED(IDC_PRIMARIES_LOCKED, OnPrimariesLocked)
ON_BN_CLICKED(IDC_SECONDARIES_LOCKED, OnSecondariesLocked)
ON_BN_CLICKED(IDC_TURRETS_LOCKED, OnTurretsLocked)
@@ -185,10 +188,15 @@ BOOL initial_status::OnInitDialog()
else
m_force_shields = 0;
if (Ships[m_ship].flags & SF_LOCKED)
m_locked = 1;
if (Ships[m_ship].flags2 & SF2_SHIP_LOCKED)
m_ship_locked = 1;
else
m_locked = 0;
m_ship_locked = 0;
if (Ships[m_ship].flags2 & SF2_WEAPONS_LOCKED)
m_weapons_locked = 1;
else
m_weapons_locked = 0;
// Lock primaries
if (Ships[m_ship].flags2 & SF2_PRIMARIES_LOCKED) {
@@ -252,13 +260,23 @@ BOOL initial_status::OnInitDialog()
if (m_force_shields)
m_force_shields = 2;
}
if (Ships[get_ship_from_obj(objp)].flags & SF_LOCKED) {
if (!m_locked)
m_locked = 2;
if (Ships[get_ship_from_obj(objp)].flags2 & SF2_SHIP_LOCKED) {
if (!m_ship_locked)
m_ship_locked = 2;
} else {
if (m_locked)
m_locked = 2;
if (m_ship_locked)
m_ship_locked = 2;
}
if (Ships[get_ship_from_obj(objp)].flags2 & SF2_WEAPONS_LOCKED) {
if (!m_weapons_locked)
m_weapons_locked = 2;
} else {
if (m_weapons_locked)
m_weapons_locked = 2;
}
if (Ships[get_ship_from_obj(objp)].flags2 & SF2_PRIMARIES_LOCKED){
@@ -403,10 +421,15 @@ void initial_status::OnOK()
Ships[get_ship_from_obj(objp)].flags2 &= ~SF2_FORCE_SHIELDS_ON;
}
if (m_locked == 1)
Ships[get_ship_from_obj(objp)].flags |= SF_LOCKED;
else if (!m_locked)
Ships[get_ship_from_obj(objp)].flags &= ~SF_LOCKED;
if (m_ship_locked == 1)
Ships[get_ship_from_obj(objp)].flags2 |= SF2_SHIP_LOCKED;
else if (!m_ship_locked)
Ships[get_ship_from_obj(objp)].flags2 &= ~SF2_SHIP_LOCKED;
if (m_weapons_locked == 1)
Ships[get_ship_from_obj(objp)].flags2 |= SF2_WEAPONS_LOCKED;
else if (!m_weapons_locked)
Ships[get_ship_from_obj(objp)].flags2 &= ~SF2_WEAPONS_LOCKED;
if (m_primaries_locked == 1) {
Ships[get_ship_from_obj(objp)].flags2 |= SF2_PRIMARIES_LOCKED;
@@ -454,10 +477,15 @@ void initial_status::OnOK()
else if (!m_force_shields)
Ships[m_ship].flags2 &= ~SF2_FORCE_SHIELDS_ON;
if (m_locked == 1)
Ships[m_ship].flags |= SF_LOCKED;
else if (!m_locked)
Ships[m_ship].flags &= ~SF_LOCKED;
if (m_ship_locked == 1)
Ships[m_ship].flags2 |= SF2_SHIP_LOCKED;
else if (!m_ship_locked)
Ships[m_ship].flags2 &= ~SF2_SHIP_LOCKED;
if (m_weapons_locked == 1)
Ships[m_ship].flags2 |= SF2_WEAPONS_LOCKED;
else if (!m_weapons_locked)
Ships[m_ship].flags2 &= ~SF2_WEAPONS_LOCKED;
if (m_primaries_locked == 1)
Ships[m_ship].flags2 |= SF2_PRIMARIES_LOCKED;
@@ -534,14 +562,24 @@ void initial_status::OnForceShields()
((CButton *) GetDlgItem(IDC_FORCE_SHIELDS))->SetCheck(m_force_shields);
}
void initial_status::OnLocked()
void initial_status::OnShipLocked()
{
if (m_locked == 1)
m_locked = 0;
if (m_ship_locked == 1)
m_ship_locked = 0;
else
m_locked = 1;
m_ship_locked = 1;
((CButton *) GetDlgItem(IDC_LOCKED))->SetCheck(m_locked);
((CButton *) GetDlgItem(IDC_SHIP_LOCKED))->SetCheck(m_ship_locked);
}
void initial_status::OnWeaponsLocked()
{
if (m_weapons_locked == 1)
m_weapons_locked = 0;
else
m_weapons_locked = 1;
((CButton *) GetDlgItem(IDC_WEAPONS_LOCKED))->SetCheck(m_weapons_locked);
}
void initial_status::OnSelchangeSubsys()
@@ -941,7 +979,7 @@ void initial_status::undock(object *objp1, object *objp2)
ship_num = get_ship_from_obj(OBJ_INDEX(objp1));
other_ship_num = get_ship_from_obj(OBJ_INDEX(objp2));
if (ship_class_compare(Ships[ship_num].ship_info_index, Ships[other_ship_num].ship_info_index) <= 0)
if (ship_class_compare(Ships[ship_num].ship_info_index, Ships[other_ship_num].ship_info_index) > 0)
vm_vec_scale_add2(&objp2->pos, &v, objp2->radius * 2.0f);
else
vm_vec_scale_add2(&objp1->pos, &v, objp1->radius * -2.0f);
@@ -973,6 +1011,51 @@ void initial_status::undock(object *objp1, object *objp2)
// ----- the following are not contained in the class because of apparent scope issues -----
// NOTE - in both retail and SCP, the dock "leader" is defined as the only guy in his
// group with a non-false arrival cue
void initial_status_mark_dock_leader_helper(object *objp, dock_function_info *infop)
{
ship *shipp = &Ships[objp->instance];
// all ships except the leader should have a locked false arrival cue
if (shipp->arrival_cue != Locked_sexp_false)
{
object *existing_leader;
// increment number of leaders found
infop->maintained_variables.int_value++;
// see if we already found a leader
existing_leader = infop->maintained_variables.objp_value;
if (existing_leader != NULL)
{
ship *leader_shipp = &Ships[existing_leader->instance];
// keep existing leader if he has a higher priority than us
if (ship_class_compare(shipp->ship_info_index, leader_shipp->ship_info_index) < 0)
{
// set my arrival cue to false
reset_arrival_to_false(SHIP_INDEX(shipp), true);
return;
}
// otherwise, unmark the existing leader and set his arrival cue to false
leader_shipp->flags &= ~SF_DOCK_LEADER;
reset_arrival_to_false(SHIP_INDEX(leader_shipp), true);
}
// mark and save me as the leader
shipp->flags |= SF_DOCK_LEADER;
infop->maintained_variables.objp_value = objp;
}
}
// self-explanatory, really
void initial_status_unmark_dock_handled_flag(object *objp, dock_function_info *infop)
{
objp->flags &= ~OF_DOCKED_ALREADY_HANDLED;
}
bool set_cue_to_false(int *cue)
{
// if the cue is not false, make it false. Be sure to set all ship editor dialog functions
@@ -980,13 +1063,11 @@ bool set_cue_to_false(int *cue)
if (*cue != Locked_sexp_false)
{
Ship_editor_dialog.update_data(1);
Wing_editor_dialog.update_data(1);
free_sexp2(*cue);
*cue = Locked_sexp_false;
Ship_editor_dialog.initialize_data(1);
Wing_editor_dialog.initialize_data(1);
return true;
}
@@ -1024,63 +1105,6 @@ void reset_arrival_to_false(int shipnum, bool reset_wing)
}
}
// NOTE - in both retail and SCP, the dock "leader" is defined as the only guy in his
// group with a non-false arrival cue
void initial_status_mark_dock_leader_helper(object *objp, dock_function_info *infop)
{
ship *shipp = &Ships[objp->instance];
int cue_to_check;
// if this guy is part of a wing, he uses his wing's arrival cue
if (shipp->wingnum >= 0)
{
cue_to_check = Wings[shipp->wingnum].arrival_cue;
}
// check the ship's arrival cue
else
{
cue_to_check = shipp->arrival_cue;
}
// all ships except the leader should have a locked false arrival cue
if (cue_to_check != Locked_sexp_false)
{
object *existing_leader;
// increment number of leaders found
infop->maintained_variables.int_value++;
// see if we already found a leader
existing_leader = infop->maintained_variables.objp_value;
if (existing_leader != NULL)
{
ship *leader_shipp = &Ships[existing_leader->instance];
// keep existing leader if he has a higher priority than us
if (ship_class_compare(shipp->ship_info_index, leader_shipp->ship_info_index) >= 0)
{
// set my arrival cue to false
reset_arrival_to_false(SHIP_INDEX(shipp), true);
return;
}
// otherwise, unmark the existing leader and set his arrival cue to false
leader_shipp->flags &= ~SF_DOCK_LEADER;
reset_arrival_to_false(SHIP_INDEX(leader_shipp), true);
}
// mark and save me as the leader
shipp->flags |= SF_DOCK_LEADER;
infop->maintained_variables.objp_value = objp;
}
}
// self-explanatory, really
void initial_status_unmark_dock_handled_flag(object *objp, dock_function_info *infop)
{
objp->flags &= ~OF_DOCKED_ALREADY_HANDLED;
}
void initial_status::OnPrimariesLocked()
{
if (m_primaries_locked == 1)
+4 -2
View File
@@ -51,7 +51,8 @@ public:
int m_velocity;
int m_hull;
BOOL m_has_shields;
int m_locked;
int m_ship_locked;
int m_weapons_locked;
CString m_cargo_name;
int m_primaries_locked;
int m_secondaries_locked;
@@ -80,7 +81,8 @@ protected:
afx_msg void OnSelchangeDockeePoint();
afx_msg void OnHasShields();
afx_msg void OnForceShields();
afx_msg void OnLocked();
afx_msg void OnShipLocked();
afx_msg void OnWeaponsLocked();
afx_msg void OnPrimariesLocked();
afx_msg void OnSecondariesLocked();
afx_msg void OnTurretsLocked();
+10 -2
View File
@@ -750,7 +750,9 @@ int create_object(vec3d *pos, int waypoint_instance)
obj = create_player(Player_starts, pos, NULL, Default_player_model);
} else if (cur_model_index == Id_select_type_jump_node) {
obj = (new jump_node(pos))->get_objnum();
jump_node* jnp = new jump_node(pos);
obj = jnp->get_objnum();
Jump_nodes.push_back(*jnp);
} else if(Ship_info[cur_model_index].flags & SIF_NO_FRED){
obj = -1;
} else { // creating a ship
@@ -1256,6 +1258,7 @@ int common_object_delete(int obj)
char msg[255], *name;
int i, z, r, type;
object *objp;
SCP_list<jump_node>::iterator jnp;
type = Objects[obj].type;
if (type == OBJ_START) {
@@ -1376,7 +1379,12 @@ int common_object_delete(int obj)
return 0;
} else if (type == OBJ_JUMP_NODE) {
delete Objects[obj].jnp;
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
if(jnp->get_obj() == &Objects[obj])
break;
}
Jump_nodes.erase(jnp);
}
unmark_object(obj);
+2
View File
@@ -16,6 +16,8 @@
#include "globalincs/pstypes.h"
#include "ship/ship.h"
#include "ai/aigoals.h"
#include "jumpnode/jumpnode.h"
#define SHIP_FILTER_PLAYERS (1<<0) // set: add players to list as well
#define SHIP_FILTER_FLYABLE (1<<1) // set: filter out non-flyable ships
+1 -2
View File
@@ -630,12 +630,11 @@ void CMissionNotesDlg::OnSquadLogo()
}
}
char *Load_screen_ext = "Image Files (*.dds, *.pcx, *.jpg, *.jpeg, *.tga, *.png)|*.dds;*.pcx;*.jpg;*.jpeg;*.tga;*.png|"
char *Load_screen_ext = "Image Files (*.dds, *.pcx, *.jpg, *.jpeg, *.tga)|*.dds;*.pcx;*.jpg;*.jpeg;*.tga|"
"DDS Files (*.dds)|*.dds|"
"PCX Files (*.pcx)|*.pcx|"
"JPG Files (*.jpg; *.jpeg)|*.jpg;*.jpeg|"
"TGA Files (*.tga)|*.tga|"
"PNG Files (*.png)|*.png|"
"All Files (*.*)|*.*|"
"|";
+14 -21
View File
@@ -710,10 +710,7 @@ int CFred_mission_save::save_cutscenes()
break;
case MOVIE_PRE_DEBRIEF:
strcpy_s(type, "$Debriefing Cutscene:");
break;
case MOVIE_END_CAMPAIGN:
strcpy_s(type, "$Campaign End Cutscene:");
break;
break;
default:
Int3();
continue;
@@ -1582,8 +1579,6 @@ int CFred_mission_save::save_objects()
fout(" \"no-arrival-warp\"");
if (shipp->flags & SF_NO_DEPARTURE_WARP)
fout(" \"no-departure-warp\"");
if (shipp->flags & SF_LOCKED)
fout(" \"locked\"");
if (Objects[shipp->objnum].flags & OF_INVULNERABLE)
fout(" \"invulnerable\"");
if (shipp->flags & SF_HIDDEN_FROM_SENSORS)
@@ -1616,6 +1611,9 @@ int CFred_mission_save::save_objects()
fout(" \"friendly-stealth-invisible\"");
if (shipp->flags2 & SF2_DONT_COLLIDE_INVIS)
fout(" \"don't-collide-invisible\"");
//for compatibility reasons ship locked or weapons locked are saved as both locked in retail mode
if ((Format_fs2_open == FSO_FORMAT_RETAIL) && ((shipp->flags2 & SF2_SHIP_LOCKED) || (shipp->flags2 & SF2_WEAPONS_LOCKED)))
fout(" \"locked\"");
fout(" )");
// flags2 added by Goober5000 --------------------------------
@@ -1667,6 +1665,10 @@ int CFred_mission_save::save_objects()
fout(" \"no-ets\"");
if (shipp->flags2 & SF2_CLOAKED)
fout(" \"cloaked\"");
if (shipp->flags2 & SF2_SHIP_LOCKED)
fout(" \"ship-locked\"");
if (shipp->flags2 & SF2_WEAPONS_LOCKED)
fout(" \"weapons-locked\"");
fout(" )");
}
// -----------------------------------------------------------
@@ -2072,13 +2074,8 @@ int CFred_mission_save::save_common_object_data(object *objp, ship *shipp)
fout("\n+Primary Banks:");
fout(" ( ");
for (j=0; j<wp->num_primary_banks; j++) {
if (wp->primary_bank_weapons[j] != -1) { // Just in case someone has set a weapon bank to empty
fout("\"%s\" ", Weapon_info[wp->primary_bank_weapons[j]].name);
} else {
fout("\"\" ");
}
}
for (j=0; j<wp->num_primary_banks; j++)
fout("\"%s\" ", Weapon_info[wp->primary_bank_weapons[j]].name);
fout(")");
}
@@ -2096,13 +2093,8 @@ int CFred_mission_save::save_common_object_data(object *objp, ship *shipp)
fout("\n+Secondary Banks:");
fout(" ( ");
for (j=0; j<wp->num_secondary_banks; j++) {
if (wp->secondary_bank_weapons[j] != -1) {
fout("\"%s\" ", Weapon_info[wp->secondary_bank_weapons[j]].name);
} else {
fout("\"\" ");
}
}
for (j=0; j<wp->num_secondary_banks; j++)
fout("\"%s\" ", Weapon_info[wp->secondary_bank_weapons[j]].name);
fout(")");
}
@@ -2530,7 +2522,8 @@ int CFred_mission_save::save_waypoints()
parse_comments(2);
fout("\t\t;! %d lists total\n", Waypoint_lists.size());
for ( jump_node *jnp = (jump_node *)Jump_nodes.get_first(); !Jump_nodes.is_end(jnp); jnp = (jump_node *)jnp->get_next() )
SCP_list<jump_node>::iterator jnp;
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp)
{
required_string_fred("$Jump Node:", "$Jump Node Name:");
parse_comments(2);
+2 -1
View File
@@ -915,9 +915,10 @@
#define IDC_EXACT_PLAYERS 1455
#define IDC_HEADING 1456
#define IDC_NO_ARRIVAL_MESSAGE 1457
#define IDC_LOCKED 1458
#define IDC_NO_MUSIC 1459
#define ID_UPDATE 1460
#define IDC_SHIP_LOCKED 1461
#define IDC_WEAPONS_LOCKED 1462
#define IDC_INITIAL_LIST 1464
#define IDC_FULL_WAR 1465
#define IDC_NEW_MSG 1466
+3 -1
View File
@@ -5687,7 +5687,8 @@ sexp_list_item *sexp_tree::get_listing_opf_jump_nodes()
{
sexp_list_item head;
for ( jump_node *jnp = (jump_node *)Jump_nodes.get_first(); !Jump_nodes.is_end(jnp); jnp = (jump_node *)jnp->get_next() ) {
SCP_list<jump_node>::iterator jnp;
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
head.add_data( jnp->get_name_ptr());
}
@@ -5792,6 +5793,7 @@ sexp_list_item *sexp_tree::get_listing_opf_post_effect()
for (i=0; i < ppe_names.size(); i++) {
head.add_data_dup(const_cast<char*>(ppe_names[i].c_str()));
}
head.add_data_dup("lightshafts");
return head.next;
}
-12
View File
@@ -2277,12 +2277,6 @@ void CShipEditorDlg::OnRestrictArrival()
CComboBox *box;
restrict_paths dlg;
if (multi_edit)
{
MessageBox("Please select only one ship.", "Too many ships selected");
return;
}
// grab stuff from GUI
UpdateData(TRUE);
@@ -2321,12 +2315,6 @@ void CShipEditorDlg::OnRestrictDeparture()
CComboBox *box;
restrict_paths dlg;
if (multi_edit)
{
MessageBox("Please select only one ship.", "Too many ships selected");
return;
}
// grab stuff from GUI
UpdateData(TRUE);
+21 -11
View File
@@ -73,6 +73,7 @@ void waypoint_path_dlg::OnInitMenu(CMenu* pMenu)
{
int i;
SCP_list<waypoint_list>::iterator ii;
SCP_list<jump_node>::iterator jnp;
CMenu *m;
m = pMenu->GetSubMenu(0);
@@ -83,7 +84,7 @@ void waypoint_path_dlg::OnInitMenu(CMenu* pMenu)
}
i = 0;
for ( jump_node *jnp = (jump_node *)Jump_nodes.get_first(); !Jump_nodes.is_end(jnp); jnp = (jump_node *)jnp->get_next() ) {
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
m->AppendMenu(MF_ENABLED | MF_STRING, ID_JUMP_NODE_MENU + i, jnp->get_name_ptr());
if (jnp->get_objnum() == cur_object_index) {
m->CheckMenuItem(ID_JUMP_NODE_MENU + i, MF_BYCOMMAND | MF_CHECKED);
@@ -122,6 +123,7 @@ void waypoint_path_dlg::OnClose()
void waypoint_path_dlg::initialize_data(int full_update)
{
int enable = TRUE;
SCP_list<jump_node>::iterator jnp;
if (!GetSafeHwnd())
return;
@@ -135,7 +137,12 @@ void waypoint_path_dlg::initialize_data(int full_update)
m_name = _T(cur_waypoint_list->get_name());
} else if (Objects[cur_object_index].type == OBJ_JUMP_NODE) {
m_name = _T(Objects[cur_object_index].jnp->get_name_ptr());
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
if(jnp->get_obj() == &Objects[cur_object_index])
break;
}
m_name = _T(jnp->get_name_ptr());
} else {
m_name = _T("");
@@ -153,6 +160,7 @@ int waypoint_path_dlg::update_data(int redraw)
char *str, old_name[255];
int i, z;
object *ptr;
SCP_list<jump_node>::iterator jnp;
if (!GetSafeHwnd())
return 0;
@@ -302,7 +310,10 @@ int waypoint_path_dlg::update_data(int redraw)
}
} else if (Objects[cur_object_index].type == OBJ_JUMP_NODE) {
jump_node *jnp = Objects[cur_object_index].jnp;
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
if(jnp->get_obj() == &Objects[cur_object_index])
break;
}
for (i=0; i<MAX_WINGS; i++)
{
@@ -409,10 +420,8 @@ int waypoint_path_dlg::update_data(int redraw)
UpdateData(FALSE);
}
strcpy_s(old_name, jnp->get_name_ptr());
string_copy(jnp->get_name_ptr(), m_name, NAME_LENGTH, 1);
if(jumpnode_check_for_duplicates())
jump_node* found = jumpnode_get_by_name(m_name);
if(found != NULL && &(*jnp) != found)
{
if (bypass_errors)
return 1;
@@ -421,15 +430,16 @@ int waypoint_path_dlg::update_data(int redraw)
z = MessageBox("This jump node name is already being used by another jump node\n"
"Press OK to restore old name", "Error", MB_ICONEXCLAMATION | MB_OKCANCEL);
strcpy(jnp->get_name_ptr(), old_name);
if (z == IDCANCEL)
return -1;
m_name = _T(old_name);
m_name = _T(jnp->get_name_ptr());
UpdateData(FALSE);
}
strcpy_s(old_name, jnp->get_name_ptr());
jnp->set_name(const_cast<char *>((const char *) m_name));
str = (char *) (LPCTSTR) m_name;
if (strcmp(old_name, str)) {
update_sexp_references(old_name, str);
@@ -466,7 +476,7 @@ BOOL waypoint_path_dlg::OnCommand(WPARAM wParam, LPARAM lParam)
}
}
if ((id >= ID_JUMP_NODE_MENU) && (id < ID_JUMP_NODE_MENU + Jump_nodes.get_num_elements())) {
if ((id >= ID_JUMP_NODE_MENU) && (id < ID_JUMP_NODE_MENU + (int) Jump_nodes.size())) {
if (!update_data()) {
point = id - ID_JUMP_NODE_MENU;
unmark_all();
+1 -1
View File
@@ -229,7 +229,7 @@ int create_wing()
leader = cur_object_index;
ptr = GET_FIRST(&obj_used_list);
while (ptr != END_OF_LIST(&obj_used_list)) {
if (( (ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START) ) && (ptr->flags & OF_MARKED)) {
if ((ptr->type == OBJ_SHIP) && (ptr->flags & OF_MARKED)) {
count++;
i = -1;
switch (ptr->type) {
+30 -35
View File
@@ -675,6 +675,8 @@ DCF(sn_glare, "")
float Supernova_last_glare = 0.0f;
bool stars_sun_has_glare(int index);
extern bool ls_on;
extern bool ls_force_off;
void game_sunspot_process(float frametime)
{
int n_lights, idx;
@@ -747,23 +749,21 @@ void game_sunspot_process(float frametime)
n_lights = light_get_global_count();
// check
for(idx=0; idx<n_lights; idx++){
if ( !shipfx_eye_in_shadow( &Eye_position, Viewer_obj, idx ) ) {
for(idx=0; idx<n_lights; idx++) {
if ( (ls_on && !ls_force_off) || !shipfx_eye_in_shadow( &Eye_position, Viewer_obj, idx ) ) {
vec3d light_dir;
light_get_global_dir(&light_dir, idx);
//only do sunglare stuff if this sun has one
if (stars_sun_has_glare(idx))
{
if (stars_sun_has_glare(idx)) {
float dot = vm_vec_dot( &light_dir, &Eye_matrix.vec.fvec )*0.5f+0.5f;
Sun_spot_goal += (float)pow(dot,85.0f);
}
// draw the glow for this sun
stars_draw_sun_glow(idx);
}
if (!shipfx_eye_in_shadow( &Eye_position, Viewer_obj, idx ) ) {
// draw the glow for this sun
stars_draw_sun_glow(idx);
}
}
Sun_drew = 0;
@@ -848,7 +848,7 @@ void game_flash_diminish(float frametime)
g = fl2i( Game_flash_green*128.0f );
b = fl2i( Game_flash_blue*128.0f );
if ( Sun_spot > 0.0f ) {
if ( Sun_spot > 0.0f && (!ls_on || ls_force_off)) {
r += fl2i(Sun_spot*128.0f);
g += fl2i(Sun_spot*128.0f);
b += fl2i(Sun_spot*128.0f);
@@ -1061,7 +1061,7 @@ void game_level_init(int seed)
Game_no_clear = 0;
// campaign wasn't ended
Campaign_ending_via_supernova = 0;
Campaign_ended_in_mission = 0;
Env_cubemap_drawn = false;
@@ -1244,7 +1244,8 @@ void game_loading_callback_init()
if (Game_loading_background < 0)
Game_loading_background = bm_load(Game_loading_bground_fname[gr_screen.res]);
generic_anim_init(&Game_loading_ani, Game_loading_ani_fname[gr_screen.res]);
strcpy_s(Game_loading_ani.filename, Game_loading_ani_fname[gr_screen.res]);
generic_anim_init(&Game_loading_ani, Game_loading_ani.filename);
generic_anim_load(&Game_loading_ani);
Assertion( Game_loading_ani.num_frames > 0, "Load Screen animation %s not found, or corrupted. Needs to be an animation with at least 1 frame.", Game_loading_ani.filename );
@@ -2024,6 +2025,11 @@ void game_init()
old_alpha_colors_init();
}
if(!Cmdline_reparse_mainhall)
{
main_hall_read_table();
}
if (Cmdline_env) {
ENVMAP = Default_env_map = bm_load("cubemap");
}
@@ -3577,7 +3583,7 @@ DCF_BOOL( subspace, Game_subspace_effect )
void clip_frame_view();
// Does everything needed to render a frame
extern std::vector<object*> effect_ships;
extern SCP_vector<object*> effect_ships;
void game_render_frame( camid cid )
{
@@ -3677,7 +3683,7 @@ void game_render_frame( camid cid )
neb2_render_player();
// render all ships with shader effects on them
std::vector<object*>::iterator obji = effect_ships.begin();
SCP_vector<object*>::iterator obji = effect_ships.begin();
for(;obji != effect_ships.end();++obji)
ship_render(*obji);
effect_ships.clear();
@@ -3686,7 +3692,6 @@ void game_render_frame( camid cid )
if(draw_viewer_last && Viewer_obj)
{
gr_post_process_save_zbuffer();
gr_zbuffer_clear(TRUE);
ship_render(Viewer_obj);
}
@@ -3704,10 +3709,9 @@ void game_render_frame( camid cid )
}
//Draw viewer cockpit
if(Viewer_obj != NULL && Viewer_mode != VM_TOPDOWN)
if(Viewer_obj != NULL && Viewer_mode != VM_TOPDOWN && Ship_info[Ships[Viewer_obj->instance].ship_info_index].cockpit_model_num > 0)
{
gr_post_process_save_zbuffer();
gr_zbuffer_clear(TRUE);
ship_render_cockpit(Viewer_obj);
}
@@ -4074,7 +4078,7 @@ void game_simulation_frame()
obj_snd_do_frame(); // update the object-linked persistant sounds
game_maybe_update_sound_environment();
snd_update_listener(&Eye_position, &Player_obj->phys_info.vel, &Eye_matrix);
snd_update_listener(&View_position, &Player_obj->phys_info.vel, &Player_obj->orient);
// AL: debug code used for testing ambient subspace sound (ie when enabling subspace through debug console)
#ifndef NDEBUG
@@ -4502,10 +4506,6 @@ void game_frame(int paused)
}
}
// Goober5000 - check if we should red-alert
// (this is approximately where the red_alert_check_status() function tree began in the pre-HUD-overhaul code)
red_alert_maybe_move_to_next_mission();
DEBUG_GET_TIME( render3_time2 )
DEBUG_GET_TIME( render2_time1 )
@@ -5171,14 +5171,7 @@ void game_process_event( int current_state, int event )
break;
case GS_EVENT_DEBRIEF:
// did we end the campaign in the main freespace 2 single player campaign?
// (specifically, did we successfully jump out when the supernova was in progress
// and the campaign was ending?)
if (Campaign_ending_via_supernova && (Game_mode & GM_CAMPAIGN_MODE)/* && !stricmp(Campaign.filename, "freespace2")*/) {
gameseq_post_event(GS_EVENT_END_CAMPAIGN);
} else {
gameseq_set_state(GS_STATE_DEBRIEF);
}
gameseq_set_state(GS_STATE_DEBRIEF);
break;
case GS_EVENT_SHIP_SELECTION:
@@ -5415,10 +5408,12 @@ void game_process_event( int current_state, int event )
mprintf(( "Hit target speed. Starting warp effect and moving to stage 2!\n" ));
shipfx_warpout_start( Player_obj );
Player->control_mode = PCM_WARPOUT_STAGE2;
Player->saved_viewer_mode = Viewer_mode;
Viewer_mode |= VM_WARP_CHASE;
Warp_camera = warp_camera(Player_obj);
if (!(The_mission.ai_profile->flags2 & AIPF2_NO_WARP_CAMERA)) {
Player->saved_viewer_mode = Viewer_mode;
Viewer_mode |= VM_WARP_CHASE;
Warp_camera = warp_camera(Player_obj);
}
}
break;
@@ -7331,7 +7326,7 @@ void game_shutdown(void)
// load up common multiplayer icons
multi_unload_common_icons();
hud_close();
hud_close();
fireball_close(); // free fireball system
particle_close(); // close out the particle system
weapon_close(); // free any memory that was allocated for the weapons
+452 -452
View File
@@ -1,452 +1,452 @@
//Microsoft Developer Studio generated resource script.
//
#include "freespaceresource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <windows.h>
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"freespaceresource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include <windows.h>\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
DEBUG_MENU DIALOG DISCARDABLE 0, 0, 185, 159
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Debug Menu"
FONT 8, "MS Sans Serif"
BEGIN
LISTBOX IDC_LIST_DEBUG,7,7,171,121,LBS_OWNERDRAWFIXED |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Ok",IDOK,7,137,171,14
END
FIND_DIALOG DIALOG DISCARDABLE 0, 0, 119, 47
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Find Text"
FONT 8, "MS Sans Serif"
BEGIN
EDITTEXT IDC_TEXT,7,7,105,14,ES_AUTOHSCROLL
DEFPUSHBUTTON "Find",IDOK,7,26,50,14
PUSHBUTTON "Cancel",IDCANCEL,62,26,50,14
END
IDD_CONNECT DIALOG DISCARDABLE 0, 0, 215, 253
STYLE DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Server"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "# Connections :",IDC_CON_COUNT,7,54,148,10
LISTBOX IDC_CONPING,7,79,148,167,WS_VSCROLL | WS_TABSTOP
LTEXT "Address and Ping",IDC_STATIC,7,66,143,10
PUSHBUTTON "Reset All",IDC_RESET_MULTI,162,174,46,72
PUSHBUTTON "Kick",IDC_KICK_BUTTON,161,80,47,19
CONTROL "",IDC_STATIC,"Static",SS_GRAYRECT,7,48,201,1
EDITTEXT IDC_STD_NAME,64,14,144,14,ES_AUTOHSCROLL
LTEXT "Server Name",IDC_STATIC,7,17,42,8
EDITTEXT IDC_STD_HOST_PASSWD,64,32,144,14,ES_AUTOHSCROLL
LTEXT "Host Password",IDC_STATIC,7,33,48,8
PUSHBUTTON "Refresh Missions",IDC_PXO_REFRESH,161,116,47,36,
BS_MULTILINE
END
IDD_MULTI DIALOG DISCARDABLE 0, 0, 215, 253
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU
CAPTION "Multi-Player"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Frame Cap :",10,7,28,43,8
LTEXT "",IDC_FRAMECAP_STATIC,53,29,46,10,SS_SUNKEN
LTEXT "Realized FPS :",IDC_STATIC_A,119,30,49,12
LTEXT "",IDC_STANDALONE_FPS,172,29,34,11,SS_SUNKEN
LTEXT "Mission Time :",IDC_STATIC_A2,13,91,49,12
LTEXT "",IDC_STANDALONE_MTIME,71,90,125,11,SS_SUNKEN
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_SUNKEN,7,43,199,
1
LTEXT "Mission Name :",IDC_STATIC,13,80,52,11
LTEXT "",IDC_MISSION_NAME,71,78,125,11,SS_SUNKEN
LTEXT "Mission Goals",IDC_STATIC,7,140,74,8
LTEXT "Netgame Information",IDC_STATIC,133,140,66,8
LTEXT "Max Players",IDC_STATIC,117,158,42,8
LTEXT "Max Observers",IDC_STATIC,117,184,48,8
LTEXT "Security",IDC_STATIC,117,210,26,8
LTEXT "Respawns",IDC_STATIC,117,236,34,8
LTEXT "",IDC_NG_MAXPLAYERS,178,158,28,8
LTEXT "",IDC_NG_MAXOBSERVERS,178,184,28,8
LTEXT "",IDC_NG_SECURITY,178,210,28,8
LTEXT "",IDC_NG_RESPAWNS,178,236,28,8
END
IDD_PLAYER_DIALOG DIALOG DISCARDABLE 0, 0, 215, 253
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Player Info"
FONT 8, "MS Sans Serif"
BEGIN
COMBOBOX IDC_PLAYER_LIST,77,6,112,169,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Ship Type",IDC_STATIC,7,24,38,10
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_NOTIFY |
SS_SUNKEN,7,55,201,1
LTEXT "",IDC_PSHIP_TYPE,53,24,49,10,SS_SUNKEN
LTEXT "Mission Stats",IDC_STATIC,133,59,44,10
LTEXT "Primary Shots",IDC_STATIC,7,118,45,9
LTEXT "Primary Hits",IDC_STATIC,7,129,40,9
LTEXT "Primary BH Hits",IDC_STATIC,7,140,50,9
LTEXT "Primary Hit %",IDC_STATIC,7,151,43,9
LTEXT "Primary BH Hit %",IDC_STATIC,7,162,55,9
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_NOTIFY |
SS_SUNKEN,106,24,1,222
LTEXT "All Time Stats",IDC_STATIC,33,59,44,10
LTEXT "Primary Shots",IDC_STATIC,109,118,45,9
LTEXT "Primary Hits",IDC_STATIC,109,129,40,9
LTEXT "Primary BH Hits",IDC_STATIC,109,140,50,9
LTEXT "Primary Hit %",IDC_STATIC,109,151,43,9
LTEXT "Primary BH Hit %",IDC_STATIC,109,162,55,9
LTEXT "Secondary Shots",IDC_STATIC,7,173,56,9
LTEXT "Secondary Hits",IDC_STATIC,7,184,49,9
LTEXT "Secondary BH Hits",IDC_STATIC,7,195,63,9
LTEXT "Secondary Hit %",IDC_STATIC,7,206,55,9
LTEXT "Secondary BH Hit %",IDC_STATIC,7,217,65,9
LTEXT "Secondary Shots",IDC_STATIC,109,173,56,9
LTEXT "Secondary Hits",IDC_STATIC,109,184,49,9
LTEXT "Secondary BH Hits",IDC_STATIC,109,195,63,9
LTEXT "Secondary Hit %",IDC_STATIC,109,206,55,9
LTEXT "Secondary BH Hit %",IDC_STATIC,109,217,65,9
LTEXT "",IDC_PSHOTS,75,118,28,8,SS_SUNKEN
LTEXT "",IDC_PHITS,75,129,28,8,SS_SUNKEN
LTEXT "",IDC_PBHHITS,75,140,28,8,SS_SUNKEN
LTEXT "",IDC_PPCT,75,151,28,8,SS_SUNKEN
LTEXT "",IDC_PBHPCT,75,162,28,8,SS_SUNKEN
LTEXT "",IDC_SSHOTS,75,173,28,8,SS_SUNKEN
LTEXT "",IDC_SECHITS,75,184,28,8,SS_SUNKEN
LTEXT "",IDC_SBHHITS,75,195,28,8,SS_SUNKEN
LTEXT "",IDC_SPCT,75,206,28,8,SS_SUNKEN
LTEXT "",IDC_SBHPCT,75,217,28,8,SS_SUNKEN
LTEXT "",IDC_MPSHOTS,180,118,28,8,SS_SUNKEN
LTEXT "",IDC_MPHITS,180,129,28,8,SS_SUNKEN
LTEXT "",IDC_MPBHHITS,180,140,28,8,SS_SUNKEN
LTEXT "",IDC_MPPCT,180,151,28,8,SS_SUNKEN
LTEXT "",IDC_MPBHPCT,180,162,28,9,SS_SUNKEN
LTEXT "",IDC_MSSHOTS,180,173,28,8,SS_SUNKEN
LTEXT "",IDC_MSECHITS,180,184,28,8,SS_SUNKEN
LTEXT "",IDC_MSBHHITS,180,195,28,8,SS_SUNKEN
LTEXT "",IDC_MSPCT,180,206,28,8,SS_SUNKEN
LTEXT "",IDC_MSBHPCT,180,217,28,8,SS_SUNKEN
CONTROL "",IDC_PINFO_PING,"Static",SS_WHITERECT | SS_NOTIFY |
SS_SUNKEN,7,235,201,1
LTEXT "Player",IDC_STATIC,44,6,20,8
LTEXT "",IDC_PING_TIME,53,38,49,10,SS_SUNKEN
LTEXT "Avg Ping",IDC_STATIC,7,38,32,9
LTEXT "Assists",IDC_STATIC,7,107,54,10
LTEXT "Assists",IDC_STATIC,109,107,54,10
LTEXT "",IDC_ASSISTS,75,107,28,8,SS_SUNKEN
LTEXT "",IDC_MASSISTS,180,107,28,8,SS_SUNKEN
LTEXT "Score",IDC_STATIC,7,73,20,8
LTEXT "Score",IDC_STATIC,109,73,20,8
LTEXT "Kills",IDC_STATIC,7,84,13,8
LTEXT "Kills",IDC_STATIC,109,84,13,8
LTEXT "Friendly Kills",IDC_STATIC,109,96,39,8
LTEXT "Friendly Kills",IDC_STATIC,7,96,39,8
LTEXT "",IDC_SCORE,75,74,28,8,SS_SUNKEN
LTEXT "",IDC_KILL_COUNT,75,85,28,8,SS_SUNKEN
LTEXT "",IDC_KILL_COUNT_BH,75,96,28,8,SS_SUNKEN
LTEXT "",IDC_MSCORE,180,74,28,8,SS_SUNKEN
LTEXT "",IDC_MKILL_COUNT,180,85,28,8,SS_SUNKEN
LTEXT "",IDC_MKILL_COUNT_BH,180,96,28,8,SS_SUNKEN
END
IDD_GODSTUFF DIALOG DISCARDABLE 0, 0, 215, 253
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "God Stuff"
FONT 8, "MS Sans Serif"
BEGIN
COMBOBOX IDC_PLAYER_GOD_LIST,39,7,101,211,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "",IDC_GODSTUFF_FPS,177,7,31,8,SS_SUNKEN
LTEXT "FPS",IDC_STATIC,154,7,16,8
LTEXT "Player ",IDC_STATIC,7,7,20,12
EDITTEXT IDC_GODSTUFF_BROADCAST,7,47,201,12,ES_MULTILINE
LTEXT "Server Message",IDC_STATIC,7,39,54,8
PUSHBUTTON "Send",IDC_GODSTUFF_SENDMESS,7,59,70,13
LISTBOX IDC_GOD_CHAT,7,84,201,162,LBS_NOINTEGRALHEIGHT |
LBS_NOSEL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
END
IDD_DEBUG_DIALOG DIALOG DISCARDABLE 0, 0, 215, 253
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Debug"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Standalone State :",IDC_STATIC,7,7,61,11
LTEXT "",IDC_STANDALONE_STATE,71,7,125,11,SS_SUNKEN
LTEXT "Multi log:",IDC_STATIC,8,26,29,8
LISTBOX IDC_MULTILOG,7,37,201,209,NOT LBS_NOTIFY |
LBS_NOINTEGRALHEIGHT | LBS_NOSEL | WS_VSCROLL |
WS_HSCROLL | WS_TABSTOP
END
IDD_GEN DIALOG DISCARDABLE 0, 0, 186, 95
STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
CTEXT "",IDC_FIELD1,27,11,136,8
CTEXT "",IDC_FIELD2,28,30,130,8
CTEXT "",IDC_FIELD3,27,49,138,8
END
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 95
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
"DEBUG_MENU", DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 178
TOPMARGIN, 7
BOTTOMMARGIN, 152
END
"FIND_DIALOG", DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 112
TOPMARGIN, 7
BOTTOMMARGIN, 40
END
IDD_CONNECT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 208
TOPMARGIN, 7
BOTTOMMARGIN, 246
END
IDD_MULTI, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 206
TOPMARGIN, 7
BOTTOMMARGIN, 246
END
IDD_PLAYER_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 208
TOPMARGIN, 6
BOTTOMMARGIN, 246
END
IDD_GODSTUFF, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 208
TOPMARGIN, 7
BOTTOMMARGIN, 246
END
IDD_DEBUG_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 208
TOPMARGIN, 7
BOTTOMMARGIN, 246
END
IDD_GEN, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 5
BOTTOMMARGIN, 88
END
IDD_DIALOG1, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 88
END
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,6,14,9276
PRODUCTVERSION 3,6,14,9276
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Volition Inc."
VALUE "FileDescription", "FreeSpace 2 Open"
VALUE "FileVersion", "3.6.14.9276"
VALUE "InternalName", "FreeSpace 2 Open"
VALUE "LegalCopyright", "Copyright © 1998"
VALUE "OriginalFilename", "fs2.exe"
VALUE "ProductName", "FreeSpace 2 Open"
VALUE "ProductVersion", "3.6.14"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_GOAL_INC BITMAP DISCARDABLE "goal_inc.bmp"
IDB_GOAL_COMP BITMAP DISCARDABLE "goal_com.bmp"
IDB_GOAL_ORD BITMAP DISCARDABLE "goal_ord.bmp"
IDB_GOAL_NONE BITMAP DISCARDABLE "goal_none.bmp"
IDB_GOAL_FAIL BITMAP DISCARDABLE "goal_fail.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
/* VS2008 can support stuff that these builds can't */
#ifndef _VC08
/* Non-VS2008 builds get one of two icons */
#ifdef _DEBUG
IDI_APP_ICON ICON DISCARDABLE "dbg_icon.ico"
#else
IDI_APP_ICON ICON DISCARDABLE "app_icon.ico"
#endif
#else
/* VS2008 builds get cool icons */
#ifdef _DEBUG
#ifdef _SSE2
IDI_APP_ICON ICON DISCARDABLE "V_sse-d.ico"
#else
IDI_APP_ICON ICON DISCARDABLE "V_debug.ico"
#endif
#else
#ifdef _SSE2
IDI_APP_ICON ICON DISCARDABLE "V_sse.ico"
#else
IDI_APP_ICON ICON DISCARDABLE "V_app.ico"
#endif
#endif
#endif
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// SRGRAMMAR
//
#ifdef FS2_VOICER
IDR_CMD_CFG SRGRAMMAR DISCARDABLE "..\..\code\sound\phrases.cfg"
#endif
//Microsoft Developer Studio generated resource script.
//
#include "freespaceresource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <windows.h>
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"freespaceresource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include <windows.h>\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
DEBUG_MENU DIALOG DISCARDABLE 0, 0, 185, 159
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Debug Menu"
FONT 8, "MS Sans Serif"
BEGIN
LISTBOX IDC_LIST_DEBUG,7,7,171,121,LBS_OWNERDRAWFIXED |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Ok",IDOK,7,137,171,14
END
FIND_DIALOG DIALOG DISCARDABLE 0, 0, 119, 47
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Find Text"
FONT 8, "MS Sans Serif"
BEGIN
EDITTEXT IDC_TEXT,7,7,105,14,ES_AUTOHSCROLL
DEFPUSHBUTTON "Find",IDOK,7,26,50,14
PUSHBUTTON "Cancel",IDCANCEL,62,26,50,14
END
IDD_CONNECT DIALOG DISCARDABLE 0, 0, 215, 253
STYLE DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Server"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "# Connections :",IDC_CON_COUNT,7,54,148,10
LISTBOX IDC_CONPING,7,79,148,167,WS_VSCROLL | WS_TABSTOP
LTEXT "Address and Ping",IDC_STATIC,7,66,143,10
PUSHBUTTON "Reset All",IDC_RESET_MULTI,162,174,46,72
PUSHBUTTON "Kick",IDC_KICK_BUTTON,161,80,47,19
CONTROL "",IDC_STATIC,"Static",SS_GRAYRECT,7,48,201,1
EDITTEXT IDC_STD_NAME,64,14,144,14,ES_AUTOHSCROLL
LTEXT "Server Name",IDC_STATIC,7,17,42,8
EDITTEXT IDC_STD_HOST_PASSWD,64,32,144,14,ES_AUTOHSCROLL
LTEXT "Host Password",IDC_STATIC,7,33,48,8
PUSHBUTTON "Refresh Missions",IDC_PXO_REFRESH,161,116,47,36,
BS_MULTILINE
END
IDD_MULTI DIALOG DISCARDABLE 0, 0, 215, 253
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU
CAPTION "Multi-Player"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Frame Cap :",10,7,28,43,8
LTEXT "",IDC_FRAMECAP_STATIC,53,29,46,10,SS_SUNKEN
LTEXT "Realized FPS :",IDC_STATIC_A,119,30,49,12
LTEXT "",IDC_STANDALONE_FPS,172,29,34,11,SS_SUNKEN
LTEXT "Mission Time :",IDC_STATIC_A2,13,91,49,12
LTEXT "",IDC_STANDALONE_MTIME,71,90,125,11,SS_SUNKEN
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_SUNKEN,7,43,199,
1
LTEXT "Mission Name :",IDC_STATIC,13,80,52,11
LTEXT "",IDC_MISSION_NAME,71,78,125,11,SS_SUNKEN
LTEXT "Mission Goals",IDC_STATIC,7,140,74,8
LTEXT "Netgame Information",IDC_STATIC,133,140,66,8
LTEXT "Max Players",IDC_STATIC,117,158,42,8
LTEXT "Max Observers",IDC_STATIC,117,184,48,8
LTEXT "Security",IDC_STATIC,117,210,26,8
LTEXT "Respawns",IDC_STATIC,117,236,34,8
LTEXT "",IDC_NG_MAXPLAYERS,178,158,28,8
LTEXT "",IDC_NG_MAXOBSERVERS,178,184,28,8
LTEXT "",IDC_NG_SECURITY,178,210,28,8
LTEXT "",IDC_NG_RESPAWNS,178,236,28,8
END
IDD_PLAYER_DIALOG DIALOG DISCARDABLE 0, 0, 215, 253
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Player Info"
FONT 8, "MS Sans Serif"
BEGIN
COMBOBOX IDC_PLAYER_LIST,77,6,112,169,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Ship Type",IDC_STATIC,7,24,38,10
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_NOTIFY |
SS_SUNKEN,7,55,201,1
LTEXT "",IDC_PSHIP_TYPE,53,24,49,10,SS_SUNKEN
LTEXT "Mission Stats",IDC_STATIC,133,59,44,10
LTEXT "Primary Shots",IDC_STATIC,7,118,45,9
LTEXT "Primary Hits",IDC_STATIC,7,129,40,9
LTEXT "Primary BH Hits",IDC_STATIC,7,140,50,9
LTEXT "Primary Hit %",IDC_STATIC,7,151,43,9
LTEXT "Primary BH Hit %",IDC_STATIC,7,162,55,9
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_NOTIFY |
SS_SUNKEN,106,24,1,222
LTEXT "All Time Stats",IDC_STATIC,33,59,44,10
LTEXT "Primary Shots",IDC_STATIC,109,118,45,9
LTEXT "Primary Hits",IDC_STATIC,109,129,40,9
LTEXT "Primary BH Hits",IDC_STATIC,109,140,50,9
LTEXT "Primary Hit %",IDC_STATIC,109,151,43,9
LTEXT "Primary BH Hit %",IDC_STATIC,109,162,55,9
LTEXT "Secondary Shots",IDC_STATIC,7,173,56,9
LTEXT "Secondary Hits",IDC_STATIC,7,184,49,9
LTEXT "Secondary BH Hits",IDC_STATIC,7,195,63,9
LTEXT "Secondary Hit %",IDC_STATIC,7,206,55,9
LTEXT "Secondary BH Hit %",IDC_STATIC,7,217,65,9
LTEXT "Secondary Shots",IDC_STATIC,109,173,56,9
LTEXT "Secondary Hits",IDC_STATIC,109,184,49,9
LTEXT "Secondary BH Hits",IDC_STATIC,109,195,63,9
LTEXT "Secondary Hit %",IDC_STATIC,109,206,55,9
LTEXT "Secondary BH Hit %",IDC_STATIC,109,217,65,9
LTEXT "",IDC_PSHOTS,75,118,28,8,SS_SUNKEN
LTEXT "",IDC_PHITS,75,129,28,8,SS_SUNKEN
LTEXT "",IDC_PBHHITS,75,140,28,8,SS_SUNKEN
LTEXT "",IDC_PPCT,75,151,28,8,SS_SUNKEN
LTEXT "",IDC_PBHPCT,75,162,28,8,SS_SUNKEN
LTEXT "",IDC_SSHOTS,75,173,28,8,SS_SUNKEN
LTEXT "",IDC_SECHITS,75,184,28,8,SS_SUNKEN
LTEXT "",IDC_SBHHITS,75,195,28,8,SS_SUNKEN
LTEXT "",IDC_SPCT,75,206,28,8,SS_SUNKEN
LTEXT "",IDC_SBHPCT,75,217,28,8,SS_SUNKEN
LTEXT "",IDC_MPSHOTS,180,118,28,8,SS_SUNKEN
LTEXT "",IDC_MPHITS,180,129,28,8,SS_SUNKEN
LTEXT "",IDC_MPBHHITS,180,140,28,8,SS_SUNKEN
LTEXT "",IDC_MPPCT,180,151,28,8,SS_SUNKEN
LTEXT "",IDC_MPBHPCT,180,162,28,9,SS_SUNKEN
LTEXT "",IDC_MSSHOTS,180,173,28,8,SS_SUNKEN
LTEXT "",IDC_MSECHITS,180,184,28,8,SS_SUNKEN
LTEXT "",IDC_MSBHHITS,180,195,28,8,SS_SUNKEN
LTEXT "",IDC_MSPCT,180,206,28,8,SS_SUNKEN
LTEXT "",IDC_MSBHPCT,180,217,28,8,SS_SUNKEN
CONTROL "",IDC_PINFO_PING,"Static",SS_WHITERECT | SS_NOTIFY |
SS_SUNKEN,7,235,201,1
LTEXT "Player",IDC_STATIC,44,6,20,8
LTEXT "",IDC_PING_TIME,53,38,49,10,SS_SUNKEN
LTEXT "Avg Ping",IDC_STATIC,7,38,32,9
LTEXT "Assists",IDC_STATIC,7,107,54,10
LTEXT "Assists",IDC_STATIC,109,107,54,10
LTEXT "",IDC_ASSISTS,75,107,28,8,SS_SUNKEN
LTEXT "",IDC_MASSISTS,180,107,28,8,SS_SUNKEN
LTEXT "Score",IDC_STATIC,7,73,20,8
LTEXT "Score",IDC_STATIC,109,73,20,8
LTEXT "Kills",IDC_STATIC,7,84,13,8
LTEXT "Kills",IDC_STATIC,109,84,13,8
LTEXT "Friendly Kills",IDC_STATIC,109,96,39,8
LTEXT "Friendly Kills",IDC_STATIC,7,96,39,8
LTEXT "",IDC_SCORE,75,74,28,8,SS_SUNKEN
LTEXT "",IDC_KILL_COUNT,75,85,28,8,SS_SUNKEN
LTEXT "",IDC_KILL_COUNT_BH,75,96,28,8,SS_SUNKEN
LTEXT "",IDC_MSCORE,180,74,28,8,SS_SUNKEN
LTEXT "",IDC_MKILL_COUNT,180,85,28,8,SS_SUNKEN
LTEXT "",IDC_MKILL_COUNT_BH,180,96,28,8,SS_SUNKEN
END
IDD_GODSTUFF DIALOG DISCARDABLE 0, 0, 215, 253
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "God Stuff"
FONT 8, "MS Sans Serif"
BEGIN
COMBOBOX IDC_PLAYER_GOD_LIST,39,7,101,211,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "",IDC_GODSTUFF_FPS,177,7,31,8,SS_SUNKEN
LTEXT "FPS",IDC_STATIC,154,7,16,8
LTEXT "Player ",IDC_STATIC,7,7,20,12
EDITTEXT IDC_GODSTUFF_BROADCAST,7,47,201,12,ES_MULTILINE
LTEXT "Server Message",IDC_STATIC,7,39,54,8
PUSHBUTTON "Send",IDC_GODSTUFF_SENDMESS,7,59,70,13
LISTBOX IDC_GOD_CHAT,7,84,201,162,LBS_NOINTEGRALHEIGHT |
LBS_NOSEL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
END
IDD_DEBUG_DIALOG DIALOG DISCARDABLE 0, 0, 215, 253
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Debug"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Standalone State :",IDC_STATIC,7,7,61,11
LTEXT "",IDC_STANDALONE_STATE,71,7,125,11,SS_SUNKEN
LTEXT "Multi log:",IDC_STATIC,8,26,29,8
LISTBOX IDC_MULTILOG,7,37,201,209,NOT LBS_NOTIFY |
LBS_NOINTEGRALHEIGHT | LBS_NOSEL | WS_VSCROLL |
WS_HSCROLL | WS_TABSTOP
END
IDD_GEN DIALOG DISCARDABLE 0, 0, 186, 95
STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
CTEXT "",IDC_FIELD1,27,11,136,8
CTEXT "",IDC_FIELD2,28,30,130,8
CTEXT "",IDC_FIELD3,27,49,138,8
END
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 95
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
"DEBUG_MENU", DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 178
TOPMARGIN, 7
BOTTOMMARGIN, 152
END
"FIND_DIALOG", DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 112
TOPMARGIN, 7
BOTTOMMARGIN, 40
END
IDD_CONNECT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 208
TOPMARGIN, 7
BOTTOMMARGIN, 246
END
IDD_MULTI, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 206
TOPMARGIN, 7
BOTTOMMARGIN, 246
END
IDD_PLAYER_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 208
TOPMARGIN, 6
BOTTOMMARGIN, 246
END
IDD_GODSTUFF, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 208
TOPMARGIN, 7
BOTTOMMARGIN, 246
END
IDD_DEBUG_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 208
TOPMARGIN, 7
BOTTOMMARGIN, 246
END
IDD_GEN, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 5
BOTTOMMARGIN, 88
END
IDD_DIALOG1, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 88
END
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,6,13,0000
PRODUCTVERSION 3,6,13,0000
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Volition Inc."
VALUE "FileDescription", "FreeSpace 2 Open"
VALUE "FileVersion", "3.6.13.0000"
VALUE "InternalName", "FreeSpace 2 Open"
VALUE "LegalCopyright", "Copyright © 1998"
VALUE "OriginalFilename", "fs2.exe"
VALUE "ProductName", "FreeSpace 2 Open"
VALUE "ProductVersion", "3.6.13"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_GOAL_INC BITMAP DISCARDABLE "goal_inc.bmp"
IDB_GOAL_COMP BITMAP DISCARDABLE "goal_com.bmp"
IDB_GOAL_ORD BITMAP DISCARDABLE "goal_ord.bmp"
IDB_GOAL_NONE BITMAP DISCARDABLE "goal_none.bmp"
IDB_GOAL_FAIL BITMAP DISCARDABLE "goal_fail.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
/* VS2008 can support stuff that these builds can't */
#ifndef _VC08
/* Non-VS2008 builds get one of two icons */
#ifdef _DEBUG
IDI_APP_ICON ICON DISCARDABLE "dbg_icon.ico"
#else
IDI_APP_ICON ICON DISCARDABLE "app_icon.ico"
#endif
#else
/* VS2008 builds get cool icons */
#ifdef _DEBUG
#ifdef _SSE2
IDI_APP_ICON ICON DISCARDABLE "V_sse-d.ico"
#else
IDI_APP_ICON ICON DISCARDABLE "V_debug.ico"
#endif
#else
#ifdef _SSE2
IDI_APP_ICON ICON DISCARDABLE "V_sse.ico"
#else
IDI_APP_ICON ICON DISCARDABLE "V_app.ico"
#endif
#endif
#endif
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// SRGRAMMAR
//
#ifdef FS2_VOICER
IDR_CMD_CFG SRGRAMMAR DISCARDABLE "..\..\code\sound\phrases.cfg"
#endif
+2 -2
View File
@@ -71,7 +71,7 @@ static int Last_activity = -1;
static int Login_retry_time = -1;
static SCP_vector<file_record> FS2NetD_file_list;
static SCP_vector<std::string> FS2NetD_ban_list;
static SCP_vector<SCP_string> FS2NetD_ban_list;
SCP_vector<crc_valid_status> Table_valid_status;
@@ -1183,7 +1183,7 @@ void fs2netd_update_ban_list()
CFILE *banlist_cfg = cfopen("banlist.cfg", "wt", CFILE_NORMAL, CF_TYPE_DATA);
if (banlist_cfg != NULL) {
for (SCP_vector<std::string>::iterator bl = FS2NetD_ban_list.begin(); bl != FS2NetD_ban_list.end(); ++bl) {
for (SCP_vector<SCP_string>::iterator bl = FS2NetD_ban_list.begin(); bl != FS2NetD_ban_list.end(); ++bl) {
cfputs( const_cast<char*>(bl->c_str()), banlist_cfg );
}
+1 -1
View File
@@ -313,7 +313,7 @@ int FS2NetD_GetPlayerData(const char *player_name, player *pl, bool can_create,
return -1;
}
int FS2NetD_GetBanList(SCP_vector<std::string> &mask_list, bool do_send)
int FS2NetD_GetBanList(SCP_vector<SCP_string> &mask_list, bool do_send)
{
int buffer_size, buffer_offset;
bool my_packet = false;
+1 -1
View File
@@ -31,7 +31,7 @@ int FS2NetD_CheckSingleMission(const char *m_name, uint crc32, bool do_send);
int FS2NetD_SendPlayerData(const char *player_name, player *pl, bool do_send);
int FS2NetD_GetPlayerData(const char *player_name, player *pl, bool can_create, bool do_send);
int FS2NetD_GetBanList(SCP_vector<std::string> &mask_list, bool do_send);
int FS2NetD_GetBanList(SCP_vector<SCP_string> &mask_list, bool do_send);
int FS2NetD_GetMissionsList(SCP_vector<file_record> &m_list, bool do_send);
+13
View File
@@ -433,3 +433,16 @@ int gameseq_get_state_idx(char *s)
return -1;
}
// If the given state exists in the stack then return the index, -1 if not
int gameseq_get_state_idx(int state)
{
for(int i = 0; i <= gs_current_stack; i++)
{
if (gs[i].current_state == state) {
return i;
}
}
return -1;
}
+3
View File
@@ -193,4 +193,7 @@ bool GameState_Stack_Valid();
int gameseq_get_event_idx(char *s);
int gameseq_get_state_idx(char *s);
//zookeeper
int gameseq_get_state_idx(int state);
#endif /* __GAMESEQUENCE_H__ */
+6 -1
View File
@@ -1778,7 +1778,7 @@ int event_music_get_soundtrack_index(char *name)
return -1;
}
int event_music_get_spooled_music_index(char *name)
int event_music_get_spooled_music_index(const char *name)
{
// find the correct index for the event music
for ( int i = 0; i < Num_music_files; i++ ) {
@@ -1790,6 +1790,11 @@ int event_music_get_spooled_music_index(char *name)
return -1;
}
int event_music_get_spooled_music_index(const SCP_string& name)
{
return event_music_get_spooled_music_index(name.c_str());
}
// set a score based on name
void event_music_set_score(int score_index, char *name)
{
+2 -1
View File
@@ -123,7 +123,8 @@ void event_sexp_change_soundtrack(char *name);
void event_music_set_soundtrack(char *name);
void event_music_set_score(int score_index, char *name);
int event_music_get_soundtrack_index(char *name);
int event_music_get_spooled_music_index(char *name);
int event_music_get_spooled_music_index(const char *name);
int event_music_get_spooled_music_index(const SCP_string& name);
void event_music_reset_choices();
int event_music_player_respawn();
int event_music_player_respawn_as_observer();
+188 -179
View File
@@ -16,16 +16,9 @@
#include "sound/ds.h"
#include <limits.h>
SCP_vector<game_snd> Snds;
SCP_vector<game_snd> Snds_iface;
SCP_vector<int> Snds_iface_handle;
#define GAME_SND 0
#define IFACE_SND 1
void gamesnd_add_sound_slot(int type, int num);
SCP_vector<game_snd> Snds;
SCP_vector<game_snd> Snds_iface;
SCP_vector<int> Snds_iface_handle;
void gamesnd_play_iface(int n)
{
@@ -59,6 +52,30 @@ int gamesnd_get_by_name(char* name)
return -1;
}
int gamesnd_get_by_iface_name(char* name)
{
Assert( Snds_iface.size() <= INT_MAX );
Assert( Snds_iface.size() == Snds_iface_handle.size() );
int i = 0;
for(SCP_vector<game_snd>::iterator snd = Snds_iface.begin(); snd != Snds_iface.end(); ++snd)
{
char *p = strrchr( snd->filename, '.' );
if(p == NULL)
{
if(!stricmp(snd->filename, name))
{
return i;
}
}
else if(!strnicmp(snd->filename, name, p-snd->filename))
{
return i;
}
i++;
}
return -1;
}
int gamesnd_get_by_tbl_index(int index)
{
//if we get passed -1, don't bother trying to look it up.
@@ -78,10 +95,13 @@ int gamesnd_get_by_tbl_index(int index)
int gamesnd_get_by_iface_tbl_index(int index)
{
//if we get passed -1, don't bother trying to look it up.
if (index == -1)
return -1;
Assert( Snds_iface.size() <= INT_MAX );
Assert( Snds_iface.size() == Snds_iface_handle.size() );
int i = 0;
for(SCP_vector<game_snd>::iterator snd = Snds.begin(); snd != Snds.end(); ++snd) {
for(SCP_vector<game_snd>::iterator snd = Snds_iface.begin(); snd != Snds_iface.end(); ++snd) {
if ( snd->sig == index )
{
return i;
@@ -91,44 +111,139 @@ int gamesnd_get_by_iface_tbl_index(int index)
return -1;
}
//Takes a tag, a sound index destination, and the object name being parsed
//tag and object_name are mostly so that we can debug stuff
//This also means you shouldn't use optional_string or required_string,
//just make sure the destination sound index can handle -1 if things
//don't work out.
void parse_sound(char* tag, int *idx_dest, char* object_name)
/**
* Helper function for parse_sound and parse_sound_list. Do not use directly.
*
* @param tag Tag
* @param idx_dest Sound index destination
* @param object_name Object name being parsed
* @param buf Buffer holding string to be parsed
* @param flags See the parse_sound_flags enum
*
*/
void parse_sound_core(char* tag, int *idx_dest, char* object_name, char* buf, parse_sound_flags flags)
{
char buf[MAX_FILENAME_LEN];
int idx;
if(flags & PARSE_SOUND_INTERFACE_SOUND)
idx = gamesnd_get_by_iface_name(buf);
else
idx = gamesnd_get_by_name(buf);
if(idx != -1)
{
(*idx_dest) = idx;
}
else
{
if(flags & PARSE_SOUND_INTERFACE_SOUND)
idx = gamesnd_get_by_iface_tbl_index(atoi(buf));
else
idx = gamesnd_get_by_tbl_index(atoi(buf));
if (idx != -1)
(*idx_dest) = idx;
}
int size_to_check = 0;
if(flags & PARSE_SOUND_INTERFACE_SOUND)
{
size_to_check = Snds_iface.size();
Assert( Snds_iface.size() == Snds_iface_handle.size() );
}
else
{
size_to_check = Snds.size();
}
Assert( size_to_check <= INT_MAX );
//Ensure sound is in range
if((*idx_dest) < -1 || (*idx_dest) >= (int)size_to_check)
{
(*idx_dest) = -1;
Warning(LOCATION, "%s sound index out of range on '%s'. Must be between 0 and %d. Forcing to -1 (Nonexistent sound).\n", tag, object_name, size_to_check);
}
}
/**
* Parse a sound. When using this function for a table entry,
* required_string and optional_string aren't needed, as this function deals with
* that as its tag parameter, just make sure that the destination sound index can
* handle -1 if things don't work out.
*
* @param tag Tag
* @param idx_dest Sound index destination
* @param object_name Object name being parsed
* @param flags See the parse_sound_flags enum
*
*/
void parse_sound(char* tag, int *idx_dest, char* object_name, parse_sound_flags flags)
{
if(optional_string(tag))
{
char buf[MAX_FILENAME_LEN];
stuff_string(buf, F_NAME, MAX_FILENAME_LEN);
idx = gamesnd_get_by_name(buf);
if(idx != -1)
(*idx_dest) = idx;
else
parse_sound_core(tag, idx_dest, object_name, buf, flags);
}
}
/**
* CommanderDJ - Parse a list of sounds. When using this function for a table entry,
* required_string and optional_string aren't needed, as this function deals with
* that as its tag parameter, just make sure that the destination sound index(es) can
* handle -1 if things don't work out.
*
* @param destination Vector where sound indexes are to be stored
* @param tag Tag
* @param object_name Name of object being parsed
* @param flags See the parse_sound_flags enum
*
*/
void parse_sound_list(char* tag, SCP_vector<int>& destination, char* object_name, parse_sound_flags flags)
{
if(optional_string(tag))
{
int check=0;
//if we're using the old format, parse the first entry separately
if(!(flags & PARSE_SOUND_SCP_SOUND_LIST))
{
idx = gamesnd_get_by_tbl_index(atoi(buf));
if (idx != -1)
(*idx_dest) = idx;
stuff_int(&check);
}
Assert( Snds.size() <= INT_MAX );
//Ensure sound is in range
if((*idx_dest) < -1 || (*idx_dest) >= (int)Snds.size())
//now read the rest of the entries on the line
for(int i=0;!check_for_eoln();i++)
{
(*idx_dest) = -1;
Warning(LOCATION, "%s sound index out of range on '%s'. Must be between 0 and %d. Forcing to -1 (Nonexistant sound).\n", tag, object_name, Snds.size());
char buf[MAX_FILENAME_LEN];
stuff_string_white(buf, MAX_FILENAME_LEN);
//we do this conditionally to avoid adding needless entries when reparsing
if(destination.size() <= (unsigned)i)
{
destination.push_back(-1);
}
parse_sound_core(tag, &destination.at(i), object_name, buf, flags);
}
//if we're using the old format, double check the size)
if(!(flags & PARSE_SOUND_SCP_SOUND_LIST) && (destination.size() != (unsigned)check))
{
mprintf(("%s in '%s' has %i entries. This does not match entered size of %i.", tag, object_name, destination.size(), check));
}
}
}
// load in sounds that we expect will get played
//
// The method currently used is to load all those sounds that have the hardware flag
// set. This works well since we don't want to try and load hardware sounds in on the
// fly (too slow).
/**
* Load in sounds that we expect will get played
*
* The method currently used is to load all those sounds that have the hardware flag
* set. This works well since we don't want to try and load hardware sounds in on the
* fly (too slow).
*/
void gamesnd_preload_common_sounds()
{
if ( !Sound_enabled )
@@ -145,11 +260,9 @@ void gamesnd_preload_common_sounds()
}
}
// -------------------------------------------------------------------------------------------------
// gamesnd_load_gameplay_sounds()
//
// Load the ingame sounds into memory
//
/**
* Load the ingame sounds into memory
*/
void gamesnd_load_gameplay_sounds()
{
if ( !Sound_enabled )
@@ -166,11 +279,9 @@ void gamesnd_load_gameplay_sounds()
}
}
// -------------------------------------------------------------------------------------------------
// gamesnd_unload_gameplay_sounds()
//
// Unload the ingame sounds from memory
//
/**
* Unload the ingame sounds from memory
*/
void gamesnd_unload_gameplay_sounds()
{
Assert( Snds.size() <= INT_MAX );
@@ -182,11 +293,9 @@ void gamesnd_unload_gameplay_sounds()
}
}
// -------------------------------------------------------------------------------------------------
// gamesnd_load_interface_sounds()
//
// Load the interface sounds into memory
//
/**
* Load the interface sounds into memory
*/
void gamesnd_load_interface_sounds()
{
if ( !Sound_enabled )
@@ -200,11 +309,9 @@ void gamesnd_load_interface_sounds()
}
}
// -------------------------------------------------------------------------------------------------
// gamesnd_unload_interface_sounds()
//
// Unload the interface sounds from memory
//
/**
* Unload the interface sounds from memory
*/
void gamesnd_unload_interface_sounds()
{
Assert( Snds_iface.size() < INT_MAX );
@@ -217,11 +324,9 @@ void gamesnd_unload_interface_sounds()
}
}
// -------------------------------------------------------------------------------------------------
// gamesnd_parse_line()
//
// Parse a sound effect line
//
/**
* Parse a sound effect line
*/
void gamesnd_parse_line(game_snd *gs, char *tag)
{
int is_3d;
@@ -249,23 +354,18 @@ void gamesnd_parse_line(game_snd *gs, char *tag)
advance_to_eoln(NULL);
}
// -------------------------------------------------------------------------------------------------
// gamesnd_parse_soundstbl() will parse the sounds.tbl file, and load the specified sounds.
//
//
/**
* Parse the sounds.tbl file, and load the specified sounds.
*/
void gamesnd_parse_soundstbl()
{
int rval;
int num_game_sounds = 0;
int num_iface_sounds = 0;
int i;
size_t i;
char cstrtemp[NAME_LENGTH+3];
char *missing_species_names = NULL;
ubyte *missing_species = NULL;
int sanity_check = 0;
gamesnd_init_sounds();
// open localization
lcl_ext_open();
@@ -281,22 +381,20 @@ void gamesnd_parse_soundstbl()
// Parse the gameplay sounds section
required_string("#Game Sounds Start");
while (required_string_either("#Game Sounds End","$Name:")) {
Assert( Snds.size() < INT_MAX );
Assert( num_game_sounds < (int)Snds.size() );
gamesnd_parse_line( &Snds[num_game_sounds], "$Name:" );
num_game_sounds++;
gamesnd_add_sound_slot( GAME_SND, num_game_sounds );
game_snd tempSound;
gamesnd_parse_line( &tempSound, "$Name:" );
Snds.push_back(game_snd(tempSound));
}
required_string("#Game Sounds End");
// Parse the interface sounds section
required_string("#Interface Sounds Start");
while (required_string_either("#Interface Sounds End","$Name:")) {
Assert( Snds_iface_handle.size() < INT_MAX );
Assert( num_iface_sounds < (int)Snds_iface.size() );
gamesnd_parse_line(&Snds_iface[num_iface_sounds], "$Name:");
num_iface_sounds++;
gamesnd_add_sound_slot( IFACE_SND, num_iface_sounds );
game_snd tempSound;
gamesnd_parse_line( &tempSound, "$Name:");
Snds_iface.push_back(game_snd(tempSound));
Snds_iface_handle.push_back(-1);
}
required_string("#Interface Sounds End");
@@ -311,7 +409,7 @@ void gamesnd_parse_soundstbl()
while ( !check_for_string("#Flyby Sounds End") && (sanity_check <= (int)Species_info.size()) )
{
for (i = 0; i < (int)Species_info.size(); i++) {
for (i = 0; i < Species_info.size(); i++) {
species_info *species = &Species_info[i];
sprintf(cstrtemp, "$%s:", species->species_name);
@@ -328,7 +426,7 @@ void gamesnd_parse_soundstbl()
}
// if we are missing any species then report it
for (i = 0; i < (int)Species_info.size(); i++) {
for (i = 0; i < Species_info.size(); i++) {
if ( missing_species[i] ) {
strcat(missing_species_names, Species_info[i].species_name);
strcat(missing_species_names, "\n");
@@ -488,56 +586,9 @@ void gamesnd_parse_soundstbl()
lcl_ext_close();
}
// -------------------------------------------------------------------------------------------------
// gamesnd_init_struct()
//
void gamesnd_init_struct(game_snd *gs)
{
gs->sig = -1;
gs->filename[0] = 0;
gs->id = -1;
gs->id_sig = -1;
// gs->is_3d = 0;
// gs->use_ds3d = 0;
gs->flags = 0;
}
// -------------------------------------------------------------------------------------------------
// gamesnd_init_sounds() will initialize the Snds[] and Snds_iface[] arrays
//
void gamesnd_init_sounds()
{
int i = 0;
Snds.clear();
Snds.resize(MIN_GAME_SOUNDS);
Assert( Snds.size() > 0 );
Assert( Snds.size() <= INT_MAX );
// init the gameplay sounds
for (SCP_vector<game_snd>::iterator gs = Snds.begin(); gs != Snds.end(); ++gs) {
gamesnd_init_struct(&(*gs));
}
Snds_iface.clear();
Snds_iface.resize(MIN_INTERFACE_SOUNDS);
Snds_iface_handle.resize(MIN_INTERFACE_SOUNDS);
Assert( Snds_iface.size() > 0 );
Assert( Snds_iface.size() < INT_MAX );
// init the interface sounds
for (SCP_vector<game_snd>::iterator si = Snds_iface.begin(); si != Snds_iface.end(); ++si) {
gamesnd_init_struct(&(*si));
Snds_iface_handle[i] = -1;
i++;
}
}
// close out gamesnd, ONLY CALL FROM game_shutdown()!!!!
/**
* Close out gamesnd, ONLY CALL FROM game_shutdown()!!!!
*/
void gamesnd_close()
{
Snds.clear();
@@ -545,60 +596,18 @@ void gamesnd_close()
Snds_iface_handle.clear();
}
// callback function for the UI code to call when the mouse first goes over a button.
/**
* Callback function for the UI code to call when the mouse first goes over a button.
*/
void common_play_highlight_sound()
{
gamesnd_play_iface(SND_USER_OVER);
}
/**
* Callback function for the UI code to call when an error beep needed.
*/
void gamesnd_play_error_beep()
{
gamesnd_play_iface(SND_GENERAL_FAIL);
}
void gamesnd_add_sound_slot(int type, int num)
{
const int increase_by = 5;
int i;
switch (type) {
case GAME_SND:
{
Assert( Snds.size() <= INT_MAX );
Assert( num < ((int)Snds.size() + increase_by) );
if (num >= (int)Snds.size()) {
Snds.resize(Snds.size() + increase_by);
// default all new entries
for (i = ((int)Snds.size() - increase_by); i < (int)Snds.size(); i++) {
gamesnd_init_struct(&Snds[i]);
}
}
}
break;
case IFACE_SND:
{
Assert( Snds_iface.size() < INT_MAX );
Assert( num < ((int)Snds_iface.size() + increase_by) );
if (num >= (int)Snds_iface.size()) {
Snds_iface.resize(Snds_iface.size() + increase_by);
Snds_iface_handle.resize(Snds_iface.size());
Assert( Snds_iface.size() < INT_MAX );
// default all new entries
for (i = ((int)Snds_iface_handle.size() - increase_by); i < (int)Snds_iface_handle.size(); i++) {
gamesnd_init_struct(&Snds_iface[i]);
Snds_iface_handle[i] = -1;
}
}
}
break;
default:
Int3();
}
}
+14 -2
View File
@@ -17,22 +17,34 @@
void gamesnd_parse_soundstbl(); // Loads in general game sounds from sounds.tbl
void gamesnd_init_sounds(); // Initializes the Snds and Snds_iface STL vectors
void gamesnd_close(); // close out gamesnd... only call from game_shutdown()!
void gamesnd_load_gameplay_sounds();
void gamesnd_unload_gameplay_sounds();
void gamesnd_load_interface_sounds();
void gamesnd_unload_interface_sounds();
void gamesnd_preload_common_sounds();
void gamesnd_load_gameplay_sounds();
void gamesnd_unload_gameplay_sounds();
void gamesnd_play_iface(int n);
void gamesnd_play_error_beep();
int gamesnd_get_by_name(char* name);
int gamesnd_get_by_iface_name(char* name);
int gamesnd_get_by_tbl_index(int index);
int gamesnd_get_by_iface_tbl_index(int index);
//flags for parse_sound and parse_sound_list
enum parse_sound_flags
{
PARSE_SOUND_GENERAL_SOUND = 0, //!< search for sound in the general table in sound.tbl
PARSE_SOUND_INTERFACE_SOUND = (1 << 0), //!< Search for sound in the interface part of sounds.tbl
PARSE_SOUND_SCP_SOUND_LIST = (1 << 1), //!< Parse the list of sounds SCP style (just indexes and/or files names, no count first)
PARSE_SOUND_MAX
};
//This should handle NO_SOUND just fine since it doesn't directly access lowlevel code
//Does all parsing for a sound
void parse_sound(char* tag, int *idx_dest, char* object_name);
void parse_sound(char* tag, int* idx_dest, char* object_name, parse_sound_flags = PARSE_SOUND_GENERAL_SOUND);
void parse_sound_list(char* tag, SCP_vector<int>& destination, char* object_name, parse_sound_flags = PARSE_SOUND_GENERAL_SOUND);
// this is a callback, so it needs to be a real function
void common_play_highlight_sound();
+29
View File
@@ -0,0 +1,29 @@
#include "globalincs/compatibility.h"
#include "stdlib.h"
int rand_function(int limit)
{
return (rand() % limit);
}
// adapted from http://www.cplusplus.com/reference/algorithm/random_shuffle/
void random_shuffle(int *first, int *last)
{
random_shuffle(first, last, rand_function);
}
// adapted from http://www.cplusplus.com/reference/algorithm/random_shuffle/
template <class RandomNumberGenerator>
void random_shuffle(int *first, int *last, RandomNumberGenerator& custom_rand)
{
int i, n, temp;
n = (last-first);
for (i=n-1; i>0; --i)
{
int pos = custom_rand(i+1);
temp = first[i];
first[i] = first[pos];
first[pos] = temp;
}
}
+9
View File
@@ -0,0 +1,9 @@
#ifndef __COMPATIBILITY_H__
#define __COMPATIBILITY_H__
void random_shuffle(int *first, int *last);
template <class RandomNumberGenerator>
void random_shuffle(int *first, int *last, RandomNumberGenerator& custom_rand);
#endif
+58 -36
View File
@@ -39,6 +39,7 @@ extern char* Default_post_vertex_shader;
extern char* Default_fxaa_prepass_shader;
extern char* Default_particle_vertex_shader;
extern char* Default_particle_fragment_shader;
extern char* Default_lightshaft_fragment_shader;
extern char* Default_video_vertex_shader;
extern char* Default_video_fragment_shader;
//**********
@@ -66,6 +67,7 @@ def_file Default_files[] =
{ "fxaapre-f.sdr", Default_fxaa_prepass_shader},
{ "soft-v.sdr", Default_particle_vertex_shader},
{ "soft-f.sdr", Default_particle_fragment_shader},
{ "ls-f.sdr", Default_lightshaft_fragment_shader},
{ "video-v.sdr", Default_video_vertex_shader},
{ "video-f.sdr", Default_video_fragment_shader}
};
@@ -886,8 +888,14 @@ $Max Aim Update Delay: 0, 0, 0, 0, 0 \n\
;; aim. Applies for turrets vs small ships \n\
$Turret Max Aim Update Delay: 0, 0, 0, 0, 0 \n\
\n\
;; The maximum amount of delay allowed before turret AI will update its \n\
;; aim. Applies for turrets vs small ships \n\
;; Size of the player autoaim cone for each difficulty level \n\
;; Only affects the player. If the ship has autoaim, the wider FOV value\n\
;; will be used. Uses convergence. \n\
$Player Autoaim FOV: 0, 0, 0, 0, 0 \n\
\n\
;; The multiplier that affects at what range LOD switching will occur. \n\
;; NOTE THAT THIS IS NOT BY DIFFICULTY LEVEL (it's by model detail level\n\
;; in the Options menu) \n\
$Detail Distance Multiplier: 0.125, 0.25, 1.0, 4.0, 8.0 \n\
\n\
;; General AI-related flags. These were previously all lumped together \n\
@@ -1223,7 +1231,10 @@ char* Default_main_vertex_shader =
" #ifdef FLAG_FOG\n"
" fogDist = clamp((gl_Position.z - gl_Fog.start) * 0.75 * gl_Fog.scale, 0.0, 1.0);\n"
" #endif\n"
" #ifdef __GLSL_CG_DATA_TYPES\n"
" // Check necessary for ATI specific behavior\n"
" gl_ClipVertex = (gl_ModelViewMatrix * gl_Vertex);\n"
" #endif\n"
"}";
char *Default_main_fragment_shader =
@@ -1267,12 +1278,12 @@ char *Default_main_fragment_shader =
"#endif\n"
"#define SPEC_INTENSITY_POINT 5.3 // Point light\n"
"#define SPEC_INTENSITY_DIRECTIONAL 3.0 // Directional light\n"
"#define SPECULAR_FACTOR 1.75\n"
"#define SPECULAR_FACTOR 1.75\n"
"#define SPECULAR_ALPHA 0.1\n"
"#define SPEC_FACTOR_NO_SPEC_MAP 0.6\n"
"#define SPEC_FACTOR_NO_SPEC_MAP 0.6\n"
"#define ENV_ALPHA_FACTOR 0.3\n"
"#define GLOW_MAP_INTENSITY 1.5\n"
"#define AMBIENT_LIGHT_BOOST 1.0\n"
"#define AMBIENT_LIGHT_BOOST 1.0\n"
"void main()\n"
"{\n"
" vec3 eyeDir = vec3(normalize(-position).xyz); // Camera is at (0,0,0) in ModelView space\n"
@@ -2155,16 +2166,9 @@ char* Default_fxaa_prepass_shader =
char* Default_particle_vertex_shader =
"attribute float radius_in;\n"
"varying float radius;\n"
"#ifdef FLAG_DISTORTION\n"
"attribute float offset_in;\n"
"varying float offset_out;\n"
"#endif\n"
"void main()\n"
"{\n"
" radius = radius_in;\n"
" #ifdef FLAG_DISTORTION\n"
" offset_out = offset_in;\n"
" #endif\n"
" gl_TexCoord[0] = gl_MultiTexCoord0;\n"
" gl_Position = ftransform();\n"
" gl_FrontColor = gl_Color;\n"
@@ -2186,51 +2190,69 @@ char* Default_particle_fragment_shader =
"#ifdef FLAG_DISTORTION\n"
"uniform sampler2D distMap;\n"
"uniform sampler2D frameBuffer;\n"
"varying float offset_out;\n"
"#endif\n"
"void main()\n"
"{\n"
" #ifndef FLAG_DISTORTION\n"
" vec2 offset = vec2(\n"
" radius * abs(0.5 - gl_TexCoord[0].x) * 2.0,\n"
" radius * abs(0.5 - gl_TexCoord[0].y) * 2.0\n"
" );\n"
" #ifndef FLAG_DISTORTION\n"
" vec2 offset = vec2(radius * abs(0.5 - gl_TexCoord[0].x) * 2.0, radius * abs(0.5 - gl_TexCoord[0].y) * 2.0);\n"
" float offset_len = length(offset);\n"
" if (offset_len > radius)\n"
" {\n"
" if (offset_len > radius) {\n"
" gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
" return;\n"
" }\n"
" vec2 depthCoord = vec2(\n"
" gl_FragCoord.x / window_width,\n"
" gl_FragCoord.y / window_height\n"
" );\n"
" vec2 depthCoord = vec2(gl_FragCoord.x / window_width, gl_FragCoord.y / window_height );\n"
" vec4 sceneDepth = texture2D(depthMap, depthCoord);\n"
" float sceneDepthLinear = ( 2.0 * farZ * nearZ ) / ( farZ + nearZ - sceneDepth.x * (farZ-nearZ) );\n"
" float fragDepthLinear = ( 2.0 * farZ * nearZ ) / ( farZ + nearZ - gl_FragCoord.z * (farZ-nearZ) );\n"
" // assume UV of 0.5, 0.5 is the centroid of this sphere volume\n"
" float depthOffset = sqrt(\n"
" pow(radius, 2.0) -\n"
" pow(offset_len, 2.0)\n"
" );\n"
" float depthOffset = sqrt(pow(radius, 2.0) - pow(offset_len, 2.0));\n"
" float frontDepth = fragDepthLinear - depthOffset;\n"
" float backDepth = fragDepthLinear + depthOffset;\n"
" float ds = min(sceneDepthLinear, backDepth) - max(nearZ, frontDepth);\n"
" vec4 fragmentColor = texture2D(baseMap, gl_TexCoord[0].xy)*gl_Color.a;\n"
" fragmentColor = fragmentColor * ( ds / (depthOffset*2.0) );\n"
" gl_FragColor = fragmentColor;\n"
" #else\n"
" vec2 depthCoord = vec2(\n"
" gl_FragCoord.x / window_width,\n"
" gl_FragCoord.y / window_height\n"
" );\n"
" #else\n"
" vec2 depthCoord = vec2(gl_FragCoord.x / window_width, gl_FragCoord.y / window_height);\n"
" vec4 fragmentColor = texture2D(baseMap, gl_TexCoord[0].xy)*gl_Color.a;\n"
" vec2 distortion = texture2D(distMap, gl_TexCoord[0].xy+vec2(0.0, offset_out)).rg;\n"
" vec2 distortion = texture2D(distMap, gl_TexCoord[0].xy).rg;\n"
" float alpha = clamp(dot(fragmentColor.rgb,vec3(0.3333))*10.0,0.0,1.0);\n"
" distortion = ((distortion - 0.5) * 0.01) * alpha;\n"
" gl_FragColor = texture2D(frameBuffer,depthCoord+distortion);\n"
" gl_FragColor.a = alpha;\n"
" #endif\n"
" #endif\n"
"}";
char* Default_lightshaft_fragment_shader =
"uniform sampler2D scene;\n"
"uniform sampler2D cockpit;\n"
"uniform vec2 sun_pos;\n"
"uniform float density;\n"
"uniform float weight;\n"
"uniform float falloff;\n"
"uniform float intensity;\n"
"uniform float cp_intensity;\n"
"void main()\n"
"{\n"
" vec2 step = vec2( gl_TexCoord[0].st - sun_pos.xy );\n"
" vec2 pos = gl_TexCoord[0].st;\n"
" step *= 1.0 / float(SAMPLE_NUM) * density;\n"
" float decay = 1.0;\n"
" vec4 sum = vec4(0.0);\n"
" vec4 mask = texture2D(cockpit, gl_TexCoord[0].st);\n"
" if (mask.r < 1.0) {\n"
" gl_FragColor = vec4(cp_intensity);\n"
" return;\n"
" }\n"
" for(int i=0; i < SAMPLE_NUM ; i++) {\n"
" pos.st -= step;\n"
" vec4 sample = texture2D(scene, pos);\n"
" if (sample.r == 1.0)\n"
" sum += decay * weight;\n"
" decay *= falloff;\n"
" }\n"
" gl_FragColor = sum * intensity;\n"
" gl_FragColor.a = 1.0;\n"
"}";
char *Default_video_vertex_shader =
@@ -2242,7 +2264,7 @@ char *Default_video_vertex_shader =
" gl_FrontSecondaryColor = vec4(0.0, 0.0, 0.0, 1.0);\n"
"}";
char * Default_video_fragment_shader =
char * Default_video_fragment_shader =
"uniform sampler2D ytex;\n"
"uniform sampler2D utex;\n"
"uniform sampler2D vtex;\n"
+2 -57
View File
@@ -55,7 +55,7 @@ do { \
(b)->prev->next = (a); \
} while (0)
// Removes an element from listit's in
// Removes an element from the list
#define list_remove( head, elem ) \
do { \
(elem)->prev->next = (elem)->next; \
@@ -64,17 +64,7 @@ do { \
(elem)->prev = NULL; \
} while(0)
//Moves elem to be after destelem
/*
#define list_move_append(destelem, elem) \
do { \
(elem)->prev->next = (elem)->next; \
(elem)->next->prev = (elem)->prev; \
(elem)->prev = (destelem); \
(elem)->next = (destelem)->next; \
(destelem)->next->prev = (elem); \
(destelem)->next = (elem); \
} while (0)*/
// Moves elem to be after head
#define list_move_append(head, elem) \
do { \
(elem)->prev->next = (elem)->next; \
@@ -93,49 +83,4 @@ do { \
#define NOT_EMPTY(head) ((head)->next != (head))
#define EMPTY(head) ((head)->next == (head))
template <class StoreType> class linked_list
{
protected:
StoreType *m_next;
StoreType *m_prev;
int n_elem;
public:
linked_list()
{
m_next=(StoreType*)this;
m_prev=(StoreType*)this;
n_elem=0;
}
~linked_list(){n_elem=0;}
//Getting
StoreType *get_first(){return m_next;}
//Setting
void append(StoreType *ptr)
{
ptr->m_prev=m_prev;
ptr->m_next=(StoreType*)this;
m_prev->m_next=ptr; m_prev=ptr;
n_elem++;
}
void remove(StoreType *ptr)
{
ptr->m_prev->m_next=ptr->m_next;
ptr->m_next->m_prev=ptr->m_prev;
ptr->m_next = 0; //These should both be 0
ptr->m_prev = 0; //But stupid MSVC doesn't like a NULL here
n_elem--;
}
StoreType *get_next(){return m_next;}
//Querying
bool is_end(StoreType *ptr){return (ptr==this);}
int get_num_elements() { return n_elem;}
};
#endif
+1 -1
View File
@@ -40,7 +40,7 @@
#define FS_VERSION_MAJOR 3 // major version
#define FS_VERSION_MINOR 6 // increase by 1 for minor revs
#define FS_VERSION_BUILD 13 // bugfix release
#define FS_VERSION_REVIS 9276 // SVN revision
#define FS_VERSION_REVIS 0000 // SVN revision
#define VERSION_LOC_FNAME "version.nfo"
#define MOTD_LOC_FNAME "motd.txt"
+8 -8
View File
@@ -157,9 +157,9 @@ public:
UNREFERENCED_PARAMETER( error );
}
std::string DumpToString( )
SCP_string DumpToString( )
{
std::string callstack;
SCP_string callstack;
for ( size_t i = 0; i < m_stackFrames.size( ); i++ )
{
callstack += m_stackFrames[ i ].module + "! " + m_stackFrames[ i ].symbol + "\n";
@@ -170,8 +170,8 @@ public:
private:
struct StackEntry
{
std::string module;
std::string symbol;
SCP_string module;
SCP_string symbol;
};
SCP_vector< StackEntry > m_stackFrames;
@@ -870,7 +870,7 @@ void _cdecl WinAssert(char * text, char * filename, int linenum )
SCP_DumpStack( dynamic_cast< SCP_IDumpHandler* >( &callStack ) );
/* Format the string */
std::string assertString( AssertText1 );
SCP_string assertString( AssertText1 );
assertString += "\n";
assertString += callStack.DumpToString( );
@@ -935,7 +935,7 @@ void _cdecl WinAssert(char * text, char * filename, int linenum, const char * fo
SCP_DumpStack( dynamic_cast< SCP_IDumpHandler* >( &callStack ) );
/* Format the string */
std::string assertString( AssertText1 );
SCP_string assertString( AssertText1 );
assertString += "\n";
assertString += callStack.DumpToString( );
@@ -1111,7 +1111,7 @@ void _cdecl Error( const char * filename, int line, const char * format, ... )
SCP_DumpStack( dynamic_cast< SCP_IDumpHandler* >( &callStack ) );
/* Format the string */
std::string assertString( AssertText1 );
SCP_string assertString( AssertText1 );
assertString += "\n";
assertString += callStack.DumpToString( );
@@ -1227,7 +1227,7 @@ void _cdecl Warning( char *filename, int line, const char *format, ... )
SCP_DumpStack( dynamic_cast< SCP_IDumpHandler* >( &callStack ) );
/* Format the string */
std::string assertString( AssertText1 );
SCP_string assertString( AssertText1 );
assertString += "\n";
assertString += callStack.DumpToString( );
+6 -35
View File
@@ -109,12 +109,7 @@ struct buffer_data {
size_t index_offset;
const uint *get_index() const
{
return index;
}
uint i_first, i_last;
uint *index;
void release()
{
@@ -124,26 +119,10 @@ struct buffer_data {
}
}
void assign(int i, uint j)
buffer_data() :
flags(0), texture(-1), n_verts(0), index_offset(0), index(NULL)
{
const_cast<uint *>(index)[i] = j;
if (i_first > i_last)
i_first = i_last = j;
else if (i_first > j)
i_first = j;
else if (i_last < j)
i_last = j;
}
buffer_data(int n_vrts) :
flags(0), texture(-1), n_verts(n_vrts), index_offset(0),
i_first(1), i_last(0)
{
index = new(std::nothrow) uint[n_verts];
}
private:
uint *index;
};
struct vertex_buffer {
@@ -173,8 +152,8 @@ struct vertex_buffer {
model_list = NULL;
}
for (size_t i = 0; i < tex_buf.size(); i++) {
tex_buf[i].release();
for (SCP_vector<buffer_data>::iterator tbi = tex_buf.begin(); tbi != tex_buf.end(); ++tbi) {
tbi->release();
}
}
@@ -383,7 +362,7 @@ typedef struct screen {
int (*gf_bm_load)(ubyte type, int n, char *filename, CFILE *img_cfp, int *w, int *h, int *bpp, ubyte *c_type, int *mm_lvl, int *size);
void (*gf_bm_init)(int n);
void (*gf_bm_page_in_start)();
int (*gf_bm_lock)(char *filename, int handle, int bitmapnum, ubyte bpp, ubyte flags, bool nodebug);
int (*gf_bm_lock)(char *filename, int handle, int bitmapnum, ubyte bpp, ubyte flags);
int (*gf_bm_make_render_target)(int n, int *width, int *height, ubyte *bpp, int *mm_lvl, int flags );
int (*gf_bm_set_render_target)(int n, int face);
@@ -455,8 +434,6 @@ typedef struct screen {
void (*gf_line_htl)(vec3d *start, vec3d* end);
void (*gf_sphere_htl)(float rad);
void (*gf_update_texture)(int bitmap_handle, int bpp, ubyte* data, int width, int height);
} screen;
// handy macro
@@ -729,8 +706,6 @@ __inline void gr_render_buffer(int start, const vertex_buffer *bufferp, int texi
#define gr_line_htl GR_CALL(*gr_screen.gf_line_htl)
#define gr_sphere_htl GR_CALL(*gr_screen.gf_sphere_htl)
#define gr_update_texture GR_CALL(*gr_screen.gf_update_texture)
// color functions
void gr_get_color( int *r, int *g, int b );
void gr_init_color(color *c, int r, int g, int b);
@@ -748,10 +723,6 @@ void gr_bitmap_uv(int _x, int _y, int _w, int _h, float _u0, float _v0, float _u
void gr_bitmap_list(bitmap_2d_list* list, int n_bm, bool allow_scaling);
void gr_bitmap_list(bitmap_rect_list* list, int n_bm, bool allow_scaling);
// texture update functions
ubyte* gr_opengl_get_texture_update_pointer(int bitmap_handle);
void gr_opengl_update_texture(int bitmap_handle, int bpp, ubyte* data, int width, int height);
// special function for drawing polylines. this function is specifically intended for
// polylines where each section is no more than 90 degrees away from a previous section.
// Moreover, it is _really_ intended for use with 45 degree angles.
+24 -74
View File
@@ -99,7 +99,13 @@ void generic_anim_init(generic_anim *ga, char *filename)
ga->height = 0;
ga->width = 0;
ga->bitmap_id = -1;
ga->colored = false;
}
/**
* CommanderDJ - same as generic_anim_init, just with an SCP_string
*/
void generic_anim_init(generic_anim *ga, const SCP_string& filename)
{
generic_anim_init(ga, const_cast<char*> (filename.c_str()));
}
// Goober5000
@@ -175,8 +181,6 @@ int generic_anim_stream(generic_anim *ga)
//TODO: add streaming EFF
if(ga->type == BM_TYPE_ANI) {
bpp = ANI_BPP_CHECK;
if(ga->colored)
bpp = 8;
ga->ani.animation = anim_load(ga->filename, CF_TYPE_ANY, 0);
ga->ani.instance = init_anim_instance(ga->ani.animation, bpp);
@@ -190,7 +194,7 @@ int generic_anim_stream(generic_anim *ga)
ga->height = ga->ani.animation->height;
ga->width = ga->ani.animation->width;
ga->buffer = ga->ani.instance->frame;
ga->bitmap_id = bm_create(bpp, ga->width, ga->height, ga->buffer, (bpp==8)?BMP_AABITMAP:0);
ga->bitmap_id = bm_create(bpp, ga->width, ga->height, ga->buffer, 0);
ga->ani.instance->last_bitmap = -1;
ga->ani.instance->file_offset = ga->ani.animation->file_offset;
@@ -199,24 +203,8 @@ int generic_anim_stream(generic_anim *ga)
ga->previous_frame = -1;
}
else {
bpp = 32;
if(ga->colored)
bpp = 8;
bm_load_and_parse_eff(ga->filename, CF_TYPE_ANY, &ga->num_frames, &anim_fps, &ga->keyframe, 0);
char *p = strrchr( ga->filename, '.' );
if ( p )
*p = 0;
char frame_name[32];
snprintf(frame_name, 32, "%s_0000", ga->filename);
ga->bitmap_id = bm_load(frame_name);
if(ga->bitmap_id < 0) {
mprintf(("Cannot find first frame for eff streaming. eff Filename: %s", ga->filename));
return -1;
}
snprintf(frame_name, 32, "%s_0001", ga->filename);
ga->eff.next_frame = bm_load(frame_name);
bm_get_info(ga->bitmap_id, &ga->width, &ga->height);
ga->previous_frame = 0;
//placeholder until we get eff streaming working
return generic_anim_load(ga);
}
// keyframe info
@@ -243,6 +231,9 @@ int generic_anim_stream(generic_anim *ga)
}
}
}
else {
// EFF not handled yet; code shouldn't get here anyway per above block
}
ga->streaming = 1;
@@ -275,12 +266,6 @@ void generic_anim_unload(generic_anim *ga)
anim_free(ga->ani.animation);
free_anim_instance(ga->ani.instance);
}
if(ga->type == BM_TYPE_EFF) {
if(ga->eff.next_frame >= 0)
bm_release(ga->eff.next_frame);
if(ga->bitmap_id >= 0)
bm_release(ga->bitmap_id);
}
}
else {
//trying to release the first frame will release ALL frames
@@ -294,43 +279,11 @@ void generic_anim_unload(generic_anim *ga)
}
//for timer debug, #define TIMER
void generic_render_eff_stream(generic_anim *ga)
{
if(ga->current_frame == ga->previous_frame)
return;
ubyte bpp = 32;
if(ga->colored)
bpp = 8;
#ifdef TIMER
int start_time = timer_get_fixed_seconds();
#endif
#ifdef TIMER
mprintf(("=========================\n"));
mprintf(("frame: %d\n", ga->current_frame));
#endif
char frame_name[32];
snprintf(frame_name, 32, "%s_%.4d", ga->filename, ga->current_frame);
if(bm_reload(ga->eff.next_frame, frame_name) == ga->eff.next_frame)
{
bitmap* next_frame_bmp = bm_lock(ga->eff.next_frame, bpp, (bpp==8)?BMP_AABITMAP:BMP_TEX_NONCOMP, true);
if(next_frame_bmp->data)
gr_update_texture(ga->bitmap_id, bpp, (ubyte*)next_frame_bmp->data, ga->width, ga->height);
bm_unlock(ga->eff.next_frame);
bm_unload(ga->eff.next_frame, 0, true);
}
#ifdef TIMER
mprintf(("end: %d\n", timer_get_fixed_seconds() - start_time));
mprintf(("=========================\n"));
#endif
}
void generic_render_ani_stream(generic_anim *ga)
{
int i;
int bpp = ANI_BPP_CHECK;
if(ga->colored)
bpp = 8;
#ifdef TIMER
int start_time = timer_get_fixed_seconds();
#endif
@@ -354,10 +307,10 @@ void generic_render_ani_stream(generic_anim *ga)
ga->ani.instance->data = ga->ani.animation->data + ga->ani.animation->keys[ga->current_frame].offset;
}
if(ga->ani.animation->flags & ANF_STREAMED) {
ga->ani.instance->file_offset = unpack_frame_from_file(ga->ani.instance, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, (bpp==8)?1:0, bpp);
ga->ani.instance->file_offset = unpack_frame_from_file(ga->ani.instance, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, 0, bpp);
}
else {
ga->ani.instance->data = unpack_frame(ga->ani.instance, ga->ani.instance->data, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, (bpp==8)?1:0, bpp);
ga->ani.instance->data = unpack_frame(ga->ani.instance, ga->ani.instance->data, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, 0, bpp);
}
}
else {
@@ -385,18 +338,20 @@ void generic_render_ani_stream(generic_anim *ga)
#endif
for(i = ga->previous_frame + 1; i <= ga->current_frame; i++) {
if(ga->ani.animation->flags & ANF_STREAMED) {
ga->ani.instance->file_offset = unpack_frame_from_file(ga->ani.instance, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, (bpp==8)?1:0, bpp);
ga->ani.instance->file_offset = unpack_frame_from_file(ga->ani.instance, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, 0, bpp);
}
else {
ga->ani.instance->data = unpack_frame(ga->ani.instance, ga->ani.instance->data, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, (bpp==8)?1:0, bpp);
ga->ani.instance->data = unpack_frame(ga->ani.instance, ga->ani.instance->data, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, 0, bpp);
}
}
}
// always go back to screen format
BM_SELECT_SCREEN_FORMAT();
//we need to use this because performance is worse if we flush the gfx card buffer
gr_update_texture(ga->bitmap_id, bpp, ga->buffer, ga->width, ga->height);
if ( ga->ani.instance->last_bitmap != -1 ){
bm_release(ga->ani.instance->last_bitmap);
}
ga->bitmap_id = bm_create(bpp, ga->width, ga->height, ga->buffer, 0);
//in case we want to check that the frame is actually changing
//mprintf(("frame crc = %08X\n", cf_add_chksum_long(0, ga->buffer, ga->width * ga->height * (bpp >> 3))));
@@ -443,7 +398,7 @@ void generic_anim_render(generic_anim *ga, float frametime, int x, int y)
if(ga->direction & GENERIC_ANIM_DIRECTION_NOLOOP) {
ga->anim_time = ga->total_time - 0.001f; //stop on last frame when playing - if it's equal we jump to the first frame
}
if(!ga->done_playing){
else if(!ga->done_playing){
//we've played this at least once
ga->done_playing = 1;
}
@@ -467,8 +422,6 @@ void generic_anim_render(generic_anim *ga, float frametime, int x, int y)
//TODO: add EFF streaming
if(ga->type == BM_TYPE_ANI) {
generic_render_ani_stream(ga);
} else {
generic_render_eff_stream(ga);
}
gr_set_bitmap(ga->bitmap_id);
}
@@ -476,9 +429,6 @@ void generic_anim_render(generic_anim *ga, float frametime, int x, int y)
gr_set_bitmap(ga->first_frame + ga->current_frame);
}
ga->previous_frame = ga->current_frame;
if(ga->colored)
gr_aabitmap(x,y);
else
gr_bitmap(x,y);
gr_bitmap(x, y);
}
}
+3 -2
View File
@@ -33,8 +33,9 @@ typedef struct generic_anim {
anim_instance *instance;
unsigned char bg_type; //to store background type to avoid messed up colours
} ani;
//reserved for eff streaming
struct {
int next_frame;
//
} eff;
};
ubyte type;
@@ -43,7 +44,6 @@ typedef struct generic_anim {
int height;
int width;
int bitmap_id;
bool colored;
} generic_anim;
// Goober5000
@@ -54,6 +54,7 @@ typedef struct generic_bitmap {
int generic_anim_init_and_stream(generic_anim *anim, char *anim_filename, ubyte bg_type, bool attempt_hi_res);
void generic_anim_init(generic_anim *ga, char *filename = NULL);
void generic_anim_init(generic_anim *ga, const SCP_string& filename);
void generic_bitmap_init(generic_bitmap *gb, char *filename = NULL);
int generic_anim_load(generic_anim *ga);
int generic_anim_stream(generic_anim *ga);
+3 -11
View File
@@ -5118,17 +5118,9 @@ typedef unsigned long long int uint64_t;
#elif defined(_WIN32) && defined(__GNUC__)
#include <stdint.h>
#elif defined(_WIN32)
// per stdint.h
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
// realize that, e.g. char has the same size as __int8
// so we give up on __intX for them.
#if (_MSC_VER < 1300)
typedef signed int int32_t;
#else
typedef signed __int32 int32_t;
#endif
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
/* Fallback if nothing above works */
#include <inttypes.h>
+4 -8
View File
@@ -357,7 +357,7 @@ void geometry_batcher::draw_quad(vertex* verts)
}
void geometry_batcher::draw_beam(vec3d *start, vec3d *end, float width, float intensity, float offset)
void geometry_batcher::draw_beam(vec3d *start, vec3d *end, float width, float intensity)
{
vec3d p[4];
vertex *P = &vert[n_to_render * 3];
@@ -413,11 +413,7 @@ void geometry_batcher::draw_beam(vec3d *start, vec3d *end, float width, float in
for(int i = 0; i < 6; i++){
P[i].r = P[i].g = P[i].b = P[i].a = _color;
if(offset > 0.0f) {
R[i] = offset;
} else {
R[i] = width;
}
R[i] = width;
}
n_to_render += 2;
@@ -749,7 +745,7 @@ int distortion_add_bitmap_rotated(int texture, int tmap_flags, vertex *pnt, floa
return 0;
}
int distortion_add_beam(int texture, int tmap_flags, vec3d *start, vec3d *end, float width, float intensity, float offset)
int distortion_add_beam(int texture, int tmap_flags, vec3d *start, vec3d *end, float width, float intensity)
{
if (texture < 0) {
Int3();
@@ -768,7 +764,7 @@ int distortion_add_beam(int texture, int tmap_flags, vec3d *start, vec3d *end, f
item->add_allocate(1);
item->draw_beam(start,end,width,intensity,offset);
item->draw_beam(start,end,width,intensity);
return 0;
}
+2 -2
View File
@@ -53,7 +53,7 @@ public:
void draw_quad(vertex *verts);
// draw a beam
void draw_beam(vec3d *start, vec3d *end, float width, float intensity = 1.0f, float offset = 0.0f);
void draw_beam(vec3d *start, vec3d *end, float width, float intensity = 1.0f);
//draw a laser
float draw_laser(vec3d *p0, float width1, vec3d *p1, float width2, int r, int g, int b);
@@ -74,7 +74,7 @@ int batch_add_bitmap(int texture, int tmap_flags, vertex *pnt, int orient, float
int batch_add_bitmap_rotated(int texture, int tmap_flags, vertex *pnt, float angle, float rad, float alpha = 1.0f, float depth = 0.0f);
int batch_add_beam(int texture, int tmap_flags, vec3d *start, vec3d *end, float width, float intensity = 1.0f);
int distortion_add_bitmap_rotated(int texture, int tmap_flags, vertex *pnt, float angle, float rad, float alpha = 1.0f, float depth = 0.0f);
int distortion_add_beam(int texture, int tmap_flags, vec3d *start, vec3d *end, float width, float intensity = 1.0f, float offset = 0.0f);
int distortion_add_beam(int texture, int tmap_flags, vec3d *start, vec3d *end, float width, float intensity = 1.0f);
void batch_render_all();
void batch_render_geometry_map_bitmaps();
void batch_render_lasers();
+4 -4
View File
@@ -1834,8 +1834,6 @@ void opengl_setup_function_pointers()
gr_screen.gf_line_htl = gr_opengl_line_htl;
gr_screen.gf_sphere_htl = gr_opengl_sphere_htl;
gr_screen.gf_update_texture = gr_opengl_update_texture;
// NOTE: All function pointers here should have a Cmdline_nohtl check at the top
// if they shouldn't be run in non-HTL mode, Don't keep separate entries.
// *****************************************************************************
@@ -1976,11 +1974,13 @@ bool gr_opengl_init()
mprintf(( " Using %s texture filter.\n", (GL_mipmap_filter) ? NOX("trilinear") : NOX("bilinear") ));
if (Use_GLSL) {
if (Use_GLSL > 1) {
mprintf(( " Using GLSL for model rendering.\n" ));
}
mprintf(( " OpenGL Shader Version: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION_ARB) ));
}
// This stops fred crashing if no textures are set
gr_screen.current_bitmap = -1;
+3 -3
View File
@@ -418,7 +418,7 @@ extern bool opengl_texture_slot_valid(int n, int handle);
/**
* Lock an image files data into memory
*/
int gr_opengl_bm_lock( char *filename, int handle, int bitmapnum, ubyte bpp, ubyte flags, bool nodebug)
int gr_opengl_bm_lock( char *filename, int handle, int bitmapnum, ubyte bpp, ubyte flags )
{
ubyte c_type = BM_TYPE_NONE;
ubyte true_bpp;
@@ -438,13 +438,13 @@ int gr_opengl_bm_lock( char *filename, int handle, int bitmapnum, ubyte bpp, uby
if ( (bmp->data == 0) && !opengl_texture_slot_valid(bitmapnum, handle) ) {
Assert(be->ref_count == 1);
if (be->type != BM_TYPE_USER && !nodebug) {
if (be->type != BM_TYPE_USER) {
if (bmp->data == 0)
nprintf (("BmpMan", "Loading %s for the first time.\n", be->filename));
}
if ( !Bm_paging ) {
if (be->type != BM_TYPE_USER && !nodebug)
if (be->type != BM_TYPE_USER)
nprintf(("Paging", "Loading %s (%dx%dx%d)\n", be->filename, bmp->w, bmp->h, true_bpp));
}
+1 -1
View File
@@ -43,7 +43,7 @@ void gr_opengl_bm_init(int n);
void gr_opengl_bm_page_in_start();
// Lock an image files data into memory
int gr_opengl_bm_lock(char *filename, int handle, int bitmapnum, ubyte bpp, ubyte flags, bool nodebug);
int gr_opengl_bm_lock(char *filename, int handle, int bitmapnum, ubyte bpp, ubyte flags);
void gr_opengl_bm_save_render_target(int slot);
int gr_opengl_bm_make_render_target(int n, int *width, int *height, ubyte *bpp, int *mm_lvl, int flags);
+26 -14
View File
@@ -39,6 +39,7 @@ GLuint Scene_color_texture;
GLuint Scene_luminance_texture;
GLuint Scene_effect_texture;
GLuint Scene_depth_texture;
GLuint Cockpit_depth_texture;
GLuint Distortion_framebuffer;
GLuint Distortion_texture[2];
@@ -1335,13 +1336,6 @@ void gr_opengl_render_effect(int nverts, vertex *verts, float *radius_list, uint
vglEnableVertexAttribArrayARB(attrib_index);
}
if(flags & TMAP_FLAG_DISTORTION_THRUSTER)
{
attrib_index = opengl_shader_get_attribute("offset_in");
vglVertexAttribPointerARB(attrib_index, 1, GL_FLOAT, GL_FALSE, 0, radius_list);
vglEnableVertexAttribArrayARB(attrib_index);
}
GL_state.Texture.SetActiveUnit(1);
GL_state.Texture.SetTarget(GL_TEXTURE_2D);
GL_state.Texture.Enable(Scene_depth_texture);
@@ -1405,10 +1399,8 @@ void gr_opengl_render_effect(int nverts, vertex *verts, float *radius_list, uint
GL_state.Lighting(lighting);
gr_zbuffer_set(zbuff);
if( (flags & TMAP_FLAG_DISTORTION) || (flags & TMAP_FLAG_DISTORTION_THRUSTER) ) {
GLenum buffers[] = { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT };
vglDrawBuffers(2, buffers);
}
GLenum buffers[] = { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT };
vglDrawBuffers(2, buffers);
GL_CHECK_FOR_ERRORS("end of render3d()");
}
@@ -2074,6 +2066,25 @@ void opengl_setup_scene_textures()
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, Scene_texture_width, Scene_texture_height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
vglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_2D, Scene_effect_texture, 0);
// setup cockpit depth texture
glGenTextures(1, &Cockpit_depth_texture);
GL_state.Texture.SetActiveUnit(0);
GL_state.Texture.SetTarget(GL_TEXTURE_2D);
GL_state.Texture.Enable(Cockpit_depth_texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, Scene_texture_width, Scene_texture_height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
vglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, Cockpit_depth_texture, 0);
gr_zbuffer_set(GR_ZBUFF_FULL);
glClear(GL_DEPTH_BUFFER_BIT);
// setup main depth texture
glGenTextures(1, &Scene_depth_texture);
@@ -2292,13 +2303,13 @@ void gr_opengl_scene_texture_end()
glBegin(GL_QUADS);
glTexCoord2f(Scene_texture_u_scale, 0.0f);
glVertex2f(0.0f, (float)gr_screen.max_h);
glTexCoord2f(0.0f, 0.0f);
glVertex2f((float)gr_screen.max_w, (float)gr_screen.max_h);
glTexCoord2f(0.0f, Scene_texture_v_scale);
glVertex2f((float)gr_screen.max_w, 0.0f);
glTexCoord2f(Scene_texture_u_scale, Scene_texture_v_scale);
glVertex2f(0.0f, 0.0f);
glEnd();
@@ -2332,6 +2343,7 @@ void gr_opengl_scene_texture_end()
}
// Reset the UV scale values
Scene_texture_u_scale = 1.0f;
Scene_texture_v_scale = 1.0f;
+20 -24
View File
@@ -20,7 +20,6 @@
#include "graphics/gropengltexture.h"
#include "cmdline/cmdline.h"
#include "ddsutils/ddsutils.h"
#include "popup/popup.h"
#include "osapi/outwnd.h"
@@ -131,10 +130,10 @@ ogl_extension GL_Extensions[NUM_OGL_EXTENSIONS] =
{ false, false, 1, { "GL_ARB_shading_language_100" }, 0, { NULL } },
// shader objects and program object management
{ false, false, 1, { "GL_ARB_shader_objects" }, 17, { "glDeleteObjectARB", "glCreateShaderObjectARB", "glShaderSourceARB",
{ false, false, 1, { "GL_ARB_shader_objects" }, 18, { "glDeleteObjectARB", "glCreateShaderObjectARB", "glShaderSourceARB",
"glCompileShaderARB", "glGetObjectParameterivARB", "glGetInfoLogARB", "glCreateProgramObjectARB",
"glAttachObjectARB", "glLinkProgramARB", "glUseProgramObjectARB", "glValidateProgramARB", "glGetUniformLocationARB",
"glGetUniformivARB", "glUniform1fARB", "glUniform3fARB", "glUniform1iARB", "glUniformMatrix4fvARB" } },
"glGetUniformivARB", "glUniform1fARB", "glUniform2fARB", "glUniform3fARB", "glUniform1iARB", "glUniformMatrix4fvARB" } },
// programmable vertex level processing
// some of functions are provided by GL_ARB_vertex_program
@@ -370,22 +369,9 @@ void opengl_extensions_init()
Use_PBOs = 1;
}
// setup the best fog function found
if ( !Fred_running ) {
if ( Is_Extension_Enabled(OGL_EXT_FOG_COORD) ) {
OGL_fogmode = 2;
} else {
OGL_fogmode = 1;
}
}
// if we can't do cubemaps then turn off Cmdline_env
if ( !(Is_Extension_Enabled(OGL_ARB_TEXTURE_CUBE_MAP) && Is_Extension_Enabled(OGL_ARB_TEXTURE_ENV_COMBINE)) ) {
Cmdline_env = 0;
}
if ( !Cmdline_noglsl && Is_Extension_Enabled(OGL_ARB_SHADER_OBJECTS) && Is_Extension_Enabled(OGL_ARB_FRAGMENT_SHADER)
&& Is_Extension_Enabled(OGL_ARB_VERTEX_SHADER) ) {
&& Is_Extension_Enabled(OGL_ARB_VERTEX_SHADER) )
{
int ver = 0, major = 0, minor = 0;
const char *glsl_ver = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION_ARB);
@@ -401,19 +387,29 @@ void opengl_extensions_init()
Use_GLSL = 3;
}
// SM 2.0 compatible
else if (ver >= 120) {
else if (ver >= 110) {
Use_GLSL = 2;
}
// we require GLSL 1.20 or higher
// we require GLSL 1.10 or higher
else if (ver < 110) {
Use_GLSL = 0;
mprintf((" OpenGL Shading Language version %s is not sufficient to use GLSL mode in FSO. Defaulting to fixed-function renderer.\n", glGetString(GL_SHADING_LANGUAGE_VERSION_ARB) ));
#ifdef NDEBUG
popup(0, 1, POPUP_OK, "GLSL support not available on this GPU. Disabling shader support and defaulting to fixed-function rendering.\n");
#endif
}
}
// setup the best fog function found
if ( !Fred_running ) {
if ( Is_Extension_Enabled(OGL_EXT_FOG_COORD) ) {
OGL_fogmode = 2;
} else {
OGL_fogmode = 1;
}
}
// if we can't do cubemaps then turn off Cmdline_env
if ( !(Is_Extension_Enabled(OGL_ARB_TEXTURE_CUBE_MAP) && Is_Extension_Enabled(OGL_ARB_TEXTURE_ENV_COMBINE)) ) {
Cmdline_env = 0;
}
// can't have this stuff without GLSL support
if ( !Use_GLSL ) {
Cmdline_normal = 0;
+1
View File
@@ -228,6 +228,7 @@ typedef void (* glDrawRangeElementsProcPtr) (GLenum mode, GLuint start, GLuint e
#define PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARBProcPtr
#define PFNGLGETUNIFORMIVARBPROC glGetUniformivARBProcPtr
#define PFNGLUNIFORM1FARBPROC glUniform1fARBProcPtr
#define PFNGLUNIFORM2FARBPROC glUniform2fARBProcPtr
#define PFNGLUNIFORM3FARBPROC glUniform3fARBProcPtr
#define PFNGLUNIFORM4FARBPROC glUnifrom4fARBProcPtr
#define PFNGLUNIFORM3FVARBPROC glUniform3fvARBProcPtr
+129 -6
View File
@@ -12,6 +12,8 @@
#include "cmdline/cmdline.h"
#include "globalincs/def_files.h"
#include "ship/ship.h"
#include "freespace2/freespace.h"
#include "lighting/lighting.h"
extern bool PostProcessing_override;
@@ -22,18 +24,29 @@ size_t fxaa_shader_id;
//In case we don't find the shaders at all, this override is needed
bool fxaa_unavailable = false;
int Fxaa_preset_last_frame;
bool zbuffer_saved = false;
// lightshaft parameters
bool ls_on = false;
bool ls_force_off = false;
float ls_density = 0.5f;
float ls_weight = 0.02f;
float ls_falloff = 1.0f;
float ls_intensity = 0.5f;
float ls_cpintensity = 0.5f * 50 * 0.02f;
int ls_samplenum = 50;
#define SDR_POST_FLAG_MAIN (1<<0)
#define SDR_POST_FLAG_BRIGHT (1<<1)
#define SDR_POST_FLAG_BLUR (1<<2)
#define SDR_POST_FLAG_PASS1 (1<<3)
#define SDR_POST_FLAG_PASS2 (1<<4)
#define SDR_POST_FLAG_LIGHTSHAFT (1<<5)
static SCP_vector<opengl_shader_t> GL_post_shader;
// NOTE: The order of this list *must* be preserved! Additional shaders can be
// added, but the first 5 are used with magic numbers so their position
// added, but the first 7 are used with magic numbers so their position
// is assumed to never change.
static opengl_shader_file_t GL_post_shader_files[] = {
// NOTE: the main post-processing shader has any number of uniforms, but
@@ -54,7 +67,10 @@ static opengl_shader_file_t GL_post_shader_files[] = {
3, { "tex0", "rt_w", "rt_h"} },
{ "post-v.sdr", "fxaapre-f.sdr", NULL,
1, { "tex"} }
1, { "tex"} },
{ "post-v.sdr", "ls-f.sdr", SDR_POST_FLAG_LIGHTSHAFT,
8, { "scene", "cockpit", "sun_pos", "weight", "intensity", "falloff", "density", "cp_intensity" } }
};
static const unsigned int Num_post_shader_files = sizeof(GL_post_shader_files) / sizeof(opengl_shader_file_t);
@@ -343,6 +359,11 @@ void opengl_post_pass_fxaa() {
opengl_shader_set_current();
}
extern GLuint shadow_map[2];
extern GLuint Scene_depth_texture;
extern GLuint Cockpit_depth_texture;
extern bool stars_sun_has_glare(int index);
extern float Sun_spot;
void gr_opengl_post_process_end()
{
// state switch just the once (for bloom pass and final render-to-screen)
@@ -358,9 +379,75 @@ void gr_opengl_post_process_end()
if (Cmdline_fxaa && !fxaa_unavailable && !GL_rendering_to_texture) {
opengl_post_pass_fxaa();
}
opengl_shader_set_current( &GL_post_shader[6] );
float x,y;
// should we even be here?
if (!Game_subspace_effect && ls_on && !ls_force_off)
{
int n_lights = light_get_global_count();
for(int idx=0; idx<n_lights; idx++)
{
vec3d light_dir;
vec3d local_light_dir;
light_get_global_dir(&light_dir, idx);
vm_vec_rotate(&local_light_dir, &light_dir, &Eye_matrix);
if (!stars_sun_has_glare(idx))
continue;
float dot;
if((dot=vm_vec_dot( &light_dir, &Eye_matrix.vec.fvec )) > 0.7f)
{
x = asin(vm_vec_dot( &light_dir, &Eye_matrix.vec.rvec ))/PI*1.5f+0.5f; //cant get the coordinates right but this works for the limited glare fov
y = asin(vm_vec_dot( &light_dir, &Eye_matrix.vec.uvec ))/PI*1.5f*gr_screen.clip_aspect+0.5f;
vglUniform2fARB( opengl_shader_get_uniform("sun_pos"), x, y);
vglUniform1iARB( opengl_shader_get_uniform("scene"), 0);
vglUniform1iARB( opengl_shader_get_uniform("cockpit"), 1);
vglUniform1fARB( opengl_shader_get_uniform("density"), ls_density);
vglUniform1fARB( opengl_shader_get_uniform("falloff"), ls_falloff);
vglUniform1fARB( opengl_shader_get_uniform("weight"), ls_weight);
vglUniform1fARB( opengl_shader_get_uniform("intensity"), Sun_spot * ls_intensity);
vglUniform1fARB( opengl_shader_get_uniform("cp_intensity"), Sun_spot * ls_cpintensity);
GL_state.Texture.SetActiveUnit(0);
GL_state.Texture.SetTarget(GL_TEXTURE_2D);
GL_state.Texture.Enable(Scene_depth_texture);
GL_state.Texture.SetActiveUnit(1);
GL_state.Texture.SetTarget(GL_TEXTURE_2D);
GL_state.Texture.Enable(Cockpit_depth_texture);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
GL_state.Blend(GL_TRUE);
GL_state.SetAlphaBlendMode(ALPHA_BLEND_ADDITIVE);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex2f(-1.0f, -1.0f);
glTexCoord2f(Scene_texture_u_scale, 0.0f);
glVertex2f(1.0f, -1.0f);
glTexCoord2f(Scene_texture_u_scale, Scene_texture_v_scale);
glVertex2f(1.0f, 1.0f);
glTexCoord2f(0.0f, Scene_texture_v_scale);
glVertex2f(-1.0f, 1.0f);
glEnd();
GL_state.Blend(GL_FALSE);
break;
}
}
}
if(zbuffer_saved)
{
zbuffer_saved = false;
gr_zbuffer_set(GR_ZBUFF_FULL);
glClear(GL_DEPTH_BUFFER_BIT);
gr_zbuffer_set(GR_ZBUFF_NONE);
vglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, Scene_depth_texture, 0);
}
// Bind the correct framebuffer. opengl_get_rtt_framebuffer returns 0 if not doing RTT
vglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, opengl_get_rtt_framebuffer());
vglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, opengl_get_rtt_framebuffer());
// do bloom, hopefully ;)
bool bloomed = opengl_post_pass_bloom();
@@ -425,7 +512,6 @@ void gr_opengl_post_process_end()
glVertex2f(-1.0f, 1.0f);
glEnd();
vglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
// Done!
GL_state.Texture.SetActiveUnit(1);
@@ -550,6 +636,13 @@ void gr_opengl_post_process_set_effect(const char *name, int value)
int sflags = 0;
bool need_change = true;
if(!stricmp("lightshafts",name))
{
ls_intensity = value / 100.0f;
ls_on = !!value;
return;
}
for (idx = 0; idx < Post_effects.size(); idx++) {
const char *eff_name = Post_effects[idx].name.c_str();
@@ -624,11 +717,15 @@ void gr_opengl_post_process_set_defaults()
Post_active_shader_index = 0;
}
extern GLuint Cockpit_depth_texture;
void gr_opengl_post_process_save_zbuffer()
{
if ( !Post_initialized ) {
return;
}
vglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, Cockpit_depth_texture, 0);
gr_zbuffer_clear(TRUE);
zbuffer_saved = true;
}
@@ -699,7 +796,7 @@ static bool opengl_post_init_table()
Ship_effects.push_back(se1);
if (optional_string("#Ship Effects")) {
while ( required_string_either("#End", "$Name:") ) {
while ( !required_string_3("$Name:", "#Light Shafts", "#End") ) {
ship_effect se;
char tbuf[NAME_LENGTH] = { 0 };
@@ -720,6 +817,26 @@ static bool opengl_post_init_table()
}
}
if (optional_string("#Light Shafts")) {
required_string("$AlwaysOn:");
stuff_boolean(&ls_on);
required_string("$Density:");
stuff_float(&ls_density);
required_string("$Falloff:");
stuff_float(&ls_falloff);
required_string("$Weight:");
stuff_float(&ls_weight);
required_string("$Intensity:");
stuff_float(&ls_intensity);
required_string("$Sample Number:");
stuff_int(&ls_samplenum);
ls_cpintensity = ls_weight;
for(int i = 1; i < ls_samplenum; i++)
ls_cpintensity += ls_weight * pow(ls_falloff, i);
ls_cpintensity *= ls_intensity;
}
required_string("#End");
return true;
@@ -727,7 +844,7 @@ static bool opengl_post_init_table()
static char *opengl_post_load_shader(char *filename, int flags, int flags2)
{
std::string sflags;
SCP_string sflags;
if (Use_GLSL >= 4) {
sflags += "#define SHADER_MODEL 4\n";
@@ -750,6 +867,12 @@ static char *opengl_post_load_shader(char *filename, int flags, int flags2)
} else if (flags & SDR_POST_FLAG_PASS2) {
sflags += "#define PASS_1\n";
}
if (flags & SDR_POST_FLAG_LIGHTSHAFT) {
char temp[42];
sprintf(temp, "#define SAMPLE_NUM %d\n", ls_samplenum);
sflags += temp;
}
switch (Cmdline_fxaa_preset) {
case 0:
+7 -16
View File
@@ -51,12 +51,6 @@ struct opengl_shader_file_t {
static opengl_shader_file_t GL_shader_file[] = {
{ "null-v.sdr", "null-f.sdr", (0), 0, { NULL }, 0, { NULL } },
{ "soft-v.sdr", "soft-f.sdr", (SDR_FLAG_SOFT_QUAD),
6, {"baseMap", "depthMap", "window_width", "window_height", "nearZ", "farZ"}, 1, { "radius_in" } },
{ "soft-v.sdr", "soft-f.sdr", (SDR_FLAG_SOFT_QUAD | SDR_FLAG_DISTORTION),
5, {"baseMap", "window_width", "window_height", "distMap", "frameBuffer"}, 1, { "offset_in" } },
// with diffuse Textures
{ "lne-v.sdr", "lbgsne-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP),
8, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" }, 0, { NULL } },
@@ -253,7 +247,7 @@ static opengl_shader_file_t GL_shader_file[] = {
13, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer", "effect_num", "sFramebuffer", "vpwidth", "vpheight" }, 0, { NULL } },
{ "lfnea-v.sdr", "lfbsnea-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP | SDR_FLAG_ANIMATED),
12, { "sBasemap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer", "effect_num", "sFramebuffer", "vpwidth", "vpheight" }, 0, { NULL } }
12, { "sBasemap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer", "effect_num", "sFramebuffer", "vpwidth", "vpheight" }, 0, { NULL } },
/* No Heightmapping for now - Valathil
{ "lne-v.sdr", "lgsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
@@ -310,6 +304,11 @@ static opengl_shader_file_t GL_shader_file[] = {
{ "ln-v.sdr", "lsnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
4, { "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" }, 0, { NULL } }*/
{ "soft-v.sdr", "soft-f.sdr", (SDR_FLAG_SOFT_QUAD),
6, {"baseMap", "depthMap", "window_width", "window_height", "nearZ", "farZ"}, 1, { "radius_in" } },
{ "soft-v.sdr", "soft-f.sdr", (SDR_FLAG_SOFT_QUAD | SDR_FLAG_DISTORTION),
5, {"baseMap", "window_width", "window_height", "distMap", "frameBuffer"}, 0, { NULL } }
};
static const int Num_shader_files = sizeof(GL_shader_file) / sizeof(opengl_shader_file_t);
@@ -392,9 +391,7 @@ void opengl_shader_shutdown()
static char *opengl_load_shader(char *filename, int flags, bool unified)
{
std::string sflags;
//sflags += "#version 120\n";
SCP_string sflags;
if (Use_GLSL >= 4) {
sflags += "#define SHADER_MODEL 4\n";
@@ -450,8 +447,6 @@ static char *opengl_load_shader(char *filename, int flags, bool unified)
}
}
const char *shader_flags = sflags.c_str();
int flags_len = strlen(shader_flags);
@@ -475,11 +470,9 @@ static char *opengl_load_shader(char *filename, int flags, bool unified)
strcpy(shader, shader_flags);
strcat(shader, def_shader);
//memset(shader + flags_len, 0, len + 1);
return shader;
}
}
void opengl_shader_init()
@@ -511,8 +504,6 @@ void opengl_shader_init()
bool main_vert = cf_exists_full("main-v.sdr", CF_TYPE_EFFECTS) != 0;
bool main_frag = cf_exists_full("main-f.sdr", CF_TYPE_EFFECTS) != 0;
GL_shader.reserve(Num_shader_files+1);
for (idx = 0; idx < Num_shader_files; idx++) {
bool in_error = false;
opengl_shader_t new_shader;
+1 -1
View File
@@ -58,7 +58,7 @@ struct opengl_shader_file_t {
};
typedef struct opengl_shader_uniform_t {
std::string text_id;
SCP_string text_id;
GLint location;
opengl_shader_uniform_t() : location(-1) {}
+2 -66
View File
@@ -40,7 +40,7 @@ GLint GL_supported_texture_units = 2;
int GL_should_preload = 0;
ubyte GL_xlat[256];
GLfloat GL_anisotropy = 1.0f;
GLfloat GL_max_anisotropy = -1.0f;
GLfloat GL_max_anisotropy = 2.0f;
int GL_mipmap_filter = 0;
GLenum GL_texture_target = GL_TEXTURE_2D;
GLenum GL_texture_face = GL_TEXTURE_2D;
@@ -96,7 +96,7 @@ GLfloat opengl_get_max_anisotropy()
return 0.0f;
}
if ( GL_max_anisotropy < 0.0f ) {
if ( !GL_max_anisotropy ) {
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &GL_max_anisotropy);
}
@@ -1388,70 +1388,6 @@ int opengl_export_image( int slot, int width, int height, int alpha, int num_mip
return m_offset;
}
void gr_opengl_update_texture(int bitmap_handle, int bpp, ubyte* data, int width, int height)
{
GLenum texFormat, glFormat;
int n = bm_get_cache_slot (bitmap_handle, 1);
tcache_slot_opengl *t = &Textures[n];
if(!t->texture_id)
return;
int byte_mult = (bpp >> 3);
int true_byte_mult = (t->bpp >> 3);
ubyte* texmem = NULL;
// GL_BGRA_EXT is *much* faster with some hardware/drivers
if (true_byte_mult == 4) {
texFormat = GL_UNSIGNED_INT_8_8_8_8_REV;
glFormat = GL_BGRA;
} else if (true_byte_mult == 3) {
texFormat = GL_UNSIGNED_BYTE;
glFormat = GL_BGR;
} else {
texFormat = GL_UNSIGNED_SHORT_1_5_5_5_REV;
glFormat = GL_BGRA;
}
if (byte_mult == 1) {
texFormat = GL_UNSIGNED_BYTE;
glFormat = GL_ALPHA;
texmem = (ubyte *) vm_malloc (width*height*byte_mult);
ubyte* texmemp = texmem;
Assert( texmem != NULL );
int luminance = 0;
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
if ( (i < height) && (j < width) ) {
if ( true_byte_mult > 1 ) {
luminance = 0;
if ( true_byte_mult > 3 ) {
for (int k = 0; k < 3; k++) {
luminance += data[(i*width+j)*true_byte_mult+k];
}
*texmemp++ = (ubyte)((luminance / 3) * (data[(i*width+j)*true_byte_mult+3]/255.0f));
} else {
for (int k = 0; k < true_byte_mult; k++) {
luminance += data[(i*width+j)*true_byte_mult+k];
}
*texmemp++ = (ubyte)(luminance / true_byte_mult);
}
} else {
*texmemp++ = GL_xlat[data[i*width+j]];
}
} else {
*texmemp++ = 0;
}
}
}
}
glBindTexture(GL_TEXTURE_2D, t->texture_id);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, glFormat, texFormat, (texmem)?texmem:data);
if (texmem != NULL)
vm_free(texmem);
}
// -----------------------------------------------------------------------------
// GL_EXT_framebuffer_object stuff (ie, render-to-texture)
//
+2 -7
View File
@@ -194,11 +194,6 @@ int gr_opengl_create_buffer()
opengl_vertex_buffer vbuffer;
// allocate additional blocks if we need them to prevent memory fragmentation, 15 at a time
if ( GL_vertex_buffers.size() >= GL_vertex_buffers.capacity() ) {
GL_vertex_buffers.reserve( GL_vertex_buffers.size() + 15 );
}
GL_vertex_buffers.push_back( vbuffer );
GL_vertex_buffers_in_use++;
@@ -362,7 +357,7 @@ bool gr_opengl_pack_buffer(const int buffer_id, vertex_buffer *vb)
for (j = 0; j < vb->tex_buf.size(); j++) {
n_verts = vb->tex_buf[j].n_verts;
uint offset = vb->tex_buf[j].index_offset;
const uint *index = vb->tex_buf[j].get_index();
uint *index = vb->tex_buf[j].index;
// bump to our spot in the buffer
GLubyte *ibuf = m_vbp->index_list + offset;
@@ -499,7 +494,7 @@ static void opengl_init_arrays(opengl_vertex_buffer *vbp, const vertex_buffer *b
if (Cmdline_drawelements) \
glDrawElements(GL_TRIANGLES, count, element_type, ibuffer + (datap->index_offset + start)); \
else \
vglDrawRangeElements(GL_TRIANGLES, datap->i_first, datap->i_last, count, element_type, ibuffer + (datap->index_offset + start));
vglDrawRangeElements(GL_TRIANGLES, start, end, count, element_type, ibuffer + (datap->index_offset + start));
int GL_last_shader_flags = -1;
int GL_last_shader_index = -1;
+1 -6
View File
@@ -434,10 +434,6 @@ void gr_stub_draw_line_list(colored_vector *lines, int num)
{
}
void gr_stub_update_texture(int bitmap_handle, int bpp, ubyte* data, int width, int height)
{
}
// bitmap functions
int gr_stub_bm_load(ubyte type, int n, char *filename, CFILE *img_cfp, int *w, int *h, int *bpp, ubyte *c_type, int *mm_lvl, int *size)
{
@@ -528,7 +524,7 @@ int gr_stub_bm_load(ubyte type, int n, char *filename, CFILE *img_cfp, int *w, i
return 0;
}
int gr_stub_bm_lock(char *filename, int handle, int bitmapnum, ubyte bpp, ubyte flags, bool nodebug)
int gr_stub_bm_lock(char *filename, int handle, int bitmapnum, ubyte bpp, ubyte flags)
{
ubyte c_type = BM_TYPE_NONE;
ubyte true_bpp;
@@ -815,6 +811,5 @@ bool gr_stub_init()
gr_screen.gf_line_htl = gr_stub_draw_htl_line;
gr_screen.gf_sphere_htl = gr_stub_draw_htl_sphere;
gr_screen.gf_update_texture = gr_stub_update_texture;
return true;
}
+40 -68
View File
@@ -290,7 +290,7 @@ static int Damage_flash_bright;
static int Damage_flash_timer;
HudGauge::HudGauge():
base_w(0), base_h(0), gauge_config(-1), font_num(FONT1), reticle_follow(false), lock_color(false), sexp_lock_color(false),
base_w(0), base_h(0), gauge_config(-1), font_num(FONT1), config_override(true), reticle_follow(false),
active(false), off_by_default(false), sexp_override(false), pop_up(false), disabled_views(0), custom_gauge(false),
texture_target(-1), canvas_w(-1), canvas_h(-1), target_w(-1), target_h(-1)
{
@@ -307,15 +307,15 @@ texture_target(-1), canvas_w(-1), canvas_h(-1), target_w(-1), target_h(-1)
texture_target_fname[0] = '\0';
custom_name[0] = '\0';
custom_text = "";
custom_text[0] = '\0';
custom_frame.first_frame = -1;
custom_frame.num_frames = 0;
custom_frame_offset = 0;
}
HudGauge::HudGauge(int _gauge_object, int _gauge_config, bool _slew, bool _message, int _disabled_views, int r, int g, int b):
base_w(0), base_h(0), gauge_config(_gauge_config), gauge_object(_gauge_object), font_num(FONT1),
reticle_follow(_slew), lock_color(false), sexp_lock_color(false), active(false), off_by_default(false), sexp_override(false), pop_up(false), message_gauge(_message),
HudGauge::HudGauge(int _gauge_object, int _gauge_config, bool _allow_override, bool _slew, bool _message, int _disabled_views, int r, int g, int b):
base_w(0), base_h(0), gauge_config(_gauge_config), gauge_object(_gauge_object), font_num(FONT1), config_override(_allow_override),
reticle_follow(_slew), active(false), off_by_default(false), sexp_override(false), pop_up(false), message_gauge(_message),
disabled_views(_disabled_views), custom_gauge(false), textoffset_x(0), textoffset_y(0), texture_target(-1),
canvas_w(-1), canvas_h(-1), target_w(-1), target_h(-1)
{
@@ -341,8 +341,8 @@ canvas_w(-1), canvas_h(-1), target_w(-1), target_h(-1)
texture_target_fname[0] = '\0';
custom_name[0] = '\0';
custom_text = "";
default_text = "";
custom_text[0] = '\0';
default_text[0] = '\0';
custom_frame.first_frame = -1;
custom_frame.num_frames = 0;
custom_frame_offset = 0;
@@ -350,8 +350,8 @@ canvas_w(-1), canvas_h(-1), target_w(-1), target_h(-1)
// constructor for custom gauges
HudGauge::HudGauge(int _gauge_config, bool _slew, int r, int g, int b, char* _custom_name, char* _custom_text, char* frame_fname, int txtoffset_x, int txtoffset_y):
base_w(0), base_h(0), gauge_config(_gauge_config), gauge_object(HUD_OBJECT_CUSTOM), font_num(FONT1),
reticle_follow(_slew), lock_color(false), sexp_lock_color(false), active(false), off_by_default(false), sexp_override(false), pop_up(false), message_gauge(false),
base_w(0), base_h(0), gauge_config(_gauge_config), gauge_object(HUD_OBJECT_CUSTOM), font_num(FONT1), config_override(true),
reticle_follow(_slew), active(false), off_by_default(false), sexp_override(false), pop_up(false), message_gauge(false),
disabled_views(VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY), custom_gauge(true), textoffset_x(txtoffset_x),
textoffset_y(txtoffset_y), texture_target(-1), canvas_w(-1), canvas_h(-1), target_w(-1), target_h(-1)
{
@@ -379,11 +379,11 @@ disabled_views(VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY), cus
}
if(_custom_text) {
custom_text = _custom_text;
default_text = _custom_text;
strcpy_s(custom_text, _custom_text);
strcpy_s(default_text, _custom_text);
} else {
custom_text = "";
default_text = "";
custom_text[0] = '\0';
default_text[0] = '\0';
}
custom_frame.first_frame = -1;
@@ -431,9 +431,9 @@ char* HudGauge::getCustomGaugeName()
return custom_name;
}
const char* HudGauge::getCustomGaugeText()
char* HudGauge::getCustomGaugeText()
{
return custom_text.c_str();
return custom_text;
}
void HudGauge::updateCustomGaugeCoords(int _x, int _y)
@@ -455,22 +455,18 @@ void HudGauge::updateCustomGaugeFrame(int frame_offset)
custom_frame_offset = frame_offset;
}
void HudGauge::updateCustomGaugeText(const char* txt)
void HudGauge::updateCustomGaugeText(char* txt)
{
if(!custom_gauge) {
return;
}
custom_text = txt;
strcpy_s(custom_text, txt);
}
void HudGauge::updateCustomGaugeText(SCP_string& txt)
bool HudGauge::configOverride()
{
if(!custom_gauge) {
return;
}
custom_text = txt;
return config_override;
}
void HudGauge::setFont()
@@ -553,21 +549,8 @@ int HudGauge::getObjectType()
return gauge_object;
}
void HudGauge::lockConfigColor(bool lock)
{
lock_color = lock;
}
void HudGauge::sexpLockConfigColor(bool lock)
{
sexp_lock_color = lock;
}
void HudGauge::updateColor(int r, int g, int b, int a)
{
if(sexp_lock_color || lock_color)
return;
gr_init_alphacolor(&gauge_color, r, g, b, a);
}
@@ -678,14 +661,11 @@ void HudGauge::render(float frametime)
setGaugeColor();
if( !custom_text.empty() ) {
char *text = new char[custom_text.size()+1];
strcpy(text, custom_text.c_str());
hud_num_make_mono(text);
renderString(position[0] + textoffset_x, position[1] + textoffset_y, text);
delete[] text;
if(custom_text) {
if(custom_text[0] != '\0') {
hud_num_make_mono(custom_text);
renderString(position[0] + textoffset_x, position[1] + textoffset_y, custom_text);
}
}
if(custom_frame.first_frame > -1) {
@@ -1036,9 +1016,7 @@ void HudGauge::pageIn()
void HudGauge::initialize()
{
//Reset text to default
custom_text = default_text;
sexp_lock_color = false;
strcpy_s(custom_text, default_text);
}
bool HudGauge::canRender()
@@ -1414,7 +1392,7 @@ void hud_update_frame(float frametime)
// to deal with the message. hud_sqaudmsg_do_frame will return 0 if the key
// wasn't used in messaging mode, otherwise 1. In the event the key was used,
// return immediately out of this function.
if ( Players[Player_num].flags & PLAYER_FLAGS_MSG_MODE ) {
if ( Players->flags & PLAYER_FLAGS_MSG_MODE ) {
hud_squadmsg_do_frame();
}
@@ -1614,7 +1592,7 @@ void hud_render_preprocess(float frametime)
}
HudGaugeMissionTime::HudGaugeMissionTime():
HudGauge(HUD_OBJECT_MISSION_TIME, HUD_MISSION_TIME, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_MISSION_TIME, HUD_MISSION_TIME, true, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -1842,7 +1820,7 @@ void update_throttle_sound()
}
else {
if ( Player_engine_snd_loop == -1 ){
Player_engine_snd_loop = snd_play_looping( &Snds[Ship_info[Ships[Player_obj->instance].ship_info_index].engine_snd_cockpit], 0.0f , -1, -1, percent_throttle * ENGINE_MAX_VOL );
Player_engine_snd_loop = snd_play_looping( &Snds[ship_get_sound(Player_obj, SND_ENGINE)], 0.0f , -1, -1, percent_throttle * ENGINE_MAX_VOL, FALSE);
} else {
// The sound may have been trashed at the low-level if sound channel overflow.
// TODO: implement system where certain sounds cannot be interrupted (priority?)
@@ -1881,7 +1859,7 @@ void hud_damage_popup_init()
}
HudGaugeDamage::HudGaugeDamage():
HudGauge(HUD_OBJECT_DAMAGE, HUD_DAMAGE_GAUGE, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_DAMAGE, HUD_DAMAGE_GAUGE, true, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -1947,8 +1925,6 @@ void HudGaugeDamage::initialize()
Damage_flash_timer = timestamp(1);
next_flash = timestamp(1);
flash_status = false;
HudGauge::initialize();
}
void HudGaugeDamage::pageIn()
@@ -2288,7 +2264,7 @@ void hud_start_text_flash(char *txt, int t, int interval)
}
HudGaugeTextWarnings::HudGaugeTextWarnings():
HudGauge(HUD_OBJECT_TEXT_WARNINGS, HUD_TEXT_FLASH, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_TEXT_WARNINGS, HUD_TEXT_FLASH, true, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -2297,8 +2273,6 @@ void HudGaugeTextWarnings::initialize()
{
next_flash = timestamp(0);
flash_flags = false;
HudGauge::initialize();
}
int HudGaugeTextWarnings::maybeTextFlash()
@@ -2344,7 +2318,7 @@ void HudGaugeTextWarnings::render(float frametime)
}
HudGaugeKills::HudGaugeKills():
HudGauge(HUD_OBJECT_KILLS, HUD_KILLS_GAUGE, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_KILLS, HUD_KILLS_GAUGE, true, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -2404,7 +2378,7 @@ void HudGaugeKills::render(float frametime)
}
HudGaugeLag::HudGaugeLag():
HudGauge(HUD_OBJECT_LAG, HUD_LAG_GAUGE, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_LAG, HUD_LAG_GAUGE, true, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -2708,7 +2682,7 @@ void hud_support_view_update()
}
HudGaugeSupport::HudGaugeSupport():
HudGauge(HUD_OBJECT_SUPPORT, HUD_SUPPORT_GAUGE, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_SUPPORT, HUD_SUPPORT_GAUGE, true, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -3222,7 +3196,7 @@ void hud_add_objective_messsage(int type, int status)
}
HudGaugeObjectiveNotify::HudGaugeObjectiveNotify():
HudGauge(HUD_OBJECT_OBJ_NOTIFY, HUD_OBJECTIVES_NOTIFY_GAUGE, false, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP, 255, 255, 255)
HudGauge(HUD_OBJECT_OBJ_NOTIFY, HUD_OBJECTIVES_NOTIFY_GAUGE, true, false, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP, 255, 255, 255)
{
}
@@ -3270,8 +3244,6 @@ void HudGaugeObjectiveNotify::initialize()
flash_timer[0] = timestamp(1);
flash_timer[1] = timestamp(1);
flash_flag = false;
HudGauge::initialize();
}
void HudGaugeObjectiveNotify::pageIn()
@@ -3357,7 +3329,7 @@ void HudGaugeObjectiveNotify::renderRedAlert()
{
int w, h;
if ( !red_alert_in_progress() ) {
if ( !red_alert_check_status() ) {
return;
}
@@ -3376,7 +3348,7 @@ void HudGaugeObjectiveNotify::renderRedAlert()
// Blit the background
gr_set_color_fast(&Color_red); // Color box red, because it's an emergency
renderBitmap(Objective_display_gauge.first_frame, position[0], position[1]);
GR_AABITMAP(Objective_display_gauge.first_frame, position[0], position[1]);
startFlashNotify();
if(maybeFlashNotify()) {
@@ -3726,7 +3698,7 @@ HudGauge* hud_get_gauge(char* name)
}
HudGaugeMultiMsg::HudGaugeMultiMsg():
HudGauge(HUD_OBJECT_MULTI_MSG, HUD_MESSAGE_LINES, false, true, 0, 255, 255, 255)
HudGauge(HUD_OBJECT_MULTI_MSG, HUD_MESSAGE_LINES, true, false, true, 0, 255, 255, 255)
{
}
@@ -3753,7 +3725,7 @@ void HudGaugeMultiMsg::render(float frametime)
}
HudGaugeVoiceStatus::HudGaugeVoiceStatus():
HudGauge(HUD_OBJECT_VOICE_STATUS, HUD_MESSAGE_LINES, false, true, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY, 255, 255, 255)
HudGauge(HUD_OBJECT_VOICE_STATUS, HUD_MESSAGE_LINES, true, false, true, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY, 255, 255, 255)
{
}
@@ -3792,7 +3764,7 @@ void HudGaugeVoiceStatus::render(float frametime)
}
HudGaugePing::HudGaugePing():
HudGauge(HUD_OBJECT_PING, HUD_LAG_GAUGE, false, false, 0, 255, 255, 255)
HudGauge(HUD_OBJECT_PING, HUD_LAG_GAUGE, true, false, false, 0, 255, 255, 255)
{
}
@@ -3829,7 +3801,7 @@ void HudGaugePing::render(float frametime)
}
HudGaugeSupernova::HudGaugeSupernova():
HudGauge(HUD_OBJECT_SUPERNOVA, HUD_DIRECTIVES_VIEW, false, false, 0, 255, 255, 255)
HudGauge(HUD_OBJECT_SUPERNOVA, HUD_DIRECTIVES_VIEW, true, false, false, 0, 255, 255, 255)
{
}
+8 -13
View File
@@ -13,7 +13,6 @@
#include "hud/hudgauges.h"
#include "graphics/2d.h"
#include "hud/hudparse.h"
#include "globalincs/vmallocator.h"
struct object;
struct cockpit_display;
@@ -215,8 +214,7 @@ protected:
int font_num;
bool lock_color;
bool sexp_lock_color;
bool config_override;
bool reticle_follow;
bool active;
bool off_by_default;
@@ -236,9 +234,8 @@ protected:
int custom_frame_offset;
int textoffset_x, textoffset_y;
char custom_name[NAME_LENGTH];
SCP_string custom_text;
SCP_string default_text;
char custom_text[NAME_LENGTH];
char default_text[NAME_LENGTH];
// Render to texture stuff
char texture_target_fname[MAX_FILENAME_LEN];
@@ -249,7 +246,7 @@ protected:
public:
// constructors
HudGauge();
HudGauge(int _gauge_object, int _gauge_config, bool _slew, bool _message, int _disabled_views, int r, int g, int b);
HudGauge(int _gauge_object, int _gauge_config, bool _allow_override, bool _slew, bool _message, int _disabled_views, int r, int g, int b);
// constructor for custom gauges
HudGauge(int _gauge_config, bool _slew, int r, int g, int b, char* _custom_name, char* _custom_text, char* frame_fname, int txtoffset_x, int txtoffset_y);
@@ -265,9 +262,8 @@ public:
bool isOffbyDefault();
bool isActive();
void updateColor(int r, int g, int b, int a = 255);
void lockConfigColor(bool lock);
void sexpLockConfigColor(bool lock);
bool configOverride();
void updateColor(int r, int g, int b, int a);
void updateActive(bool show);
void updatePopUp(bool pop_up_flag);
void updateSexpOverride(bool sexp);
@@ -284,9 +280,8 @@ public:
char* getCustomGaugeName();
void updateCustomGaugeCoords(int _x, int _y);
void updateCustomGaugeFrame(int frame_offset);
void updateCustomGaugeText(const char* txt);
void updateCustomGaugeText(SCP_string& txt);
const char* getCustomGaugeText();
void updateCustomGaugeText(char* txt);
char* getCustomGaugeText();
void startPopUp(int time=4000);
int popUpActive();
+22 -8
View File
@@ -514,6 +514,7 @@ void draw_bounding_brackets(int x1, int y1, int x2, int y2, int w_correction, in
char* tinfo_class = NULL;
char temp_name[NAME_LENGTH*2+3];
char temp_class[NAME_LENGTH];
SCP_list<jump_node>::iterator jnp;
switch(t_objp->type)
{
@@ -560,7 +561,12 @@ void draw_bounding_brackets(int x1, int y1, int x2, int y2, int w_correction, in
}
break;
case OBJ_JUMP_NODE:
strcpy_s(temp_name, t_objp->jnp->get_name_ptr());
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
if(jnp->get_obj() == t_objp)
break;
}
strcpy_s(temp_name, jnp->get_name_ptr());
end_string_at_first_hash_symbol(temp_name);
tinfo_name = temp_name;
break;
@@ -584,7 +590,7 @@ void draw_bounding_brackets(int x1, int y1, int x2, int y2, int w_correction, in
}
HudGaugeBrackets::HudGaugeBrackets():
HudGauge(HUD_OBJECT_BRACKETS, HUD_OFFSCREEN_INDICATOR, false, true, VM_DEAD_VIEW, 255, 255, 255)
HudGauge(HUD_OBJECT_BRACKETS, HUD_OFFSCREEN_INDICATOR, true, false, true, VM_DEAD_VIEW, 255, 255, 255)
{
}
@@ -642,6 +648,7 @@ void HudGaugeBrackets::renderObjectBrackets(object *targetp, color *clr, int w_c
int x1,x2,y1,y2;
int draw_box = true;
int bound_rc;
SCP_list<jump_node>::iterator jnp;
if ( Player->target_is_dying <= 0 ) {
int modelnum;
@@ -664,7 +671,6 @@ void HudGaugeBrackets::renderObjectBrackets(object *targetp, color *clr, int w_c
break;
case OBJ_WEAPON:
//Assert(Weapon_info[Weapons[targetp->instance].weapon_info_index].subtype == WP_MISSILE);
modelnum = Weapon_info[Weapons[targetp->instance].weapon_info_index].model_num;
if (modelnum != -1)
bound_rc = model_find_2d_bound_min( modelnum, &targetp->orient, &targetp->pos,&x1,&y1,&x2,&y2 );
@@ -688,7 +694,12 @@ void HudGaugeBrackets::renderObjectBrackets(object *targetp, color *clr, int w_c
break;
case OBJ_JUMP_NODE:
modelnum = targetp->jnp->get_modelnum();
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
if(jnp->get_obj() == targetp)
break;
}
modelnum = jnp->get_modelnum();
bound_rc = model_find_2d_bound_min( modelnum, &targetp->orient, &targetp->pos,&x1,&y1,&x2,&y2 );
break;
@@ -861,6 +872,7 @@ void HudGaugeBrackets::renderBoundingBrackets(int x1, int y1, int x2, int y2, in
char* tinfo_class = NULL;
char temp_name[NAME_LENGTH*2+3];
char temp_class[NAME_LENGTH];
SCP_list<jump_node>::iterator jnp;
switch(t_objp->type) {
case OBJ_SHIP:
@@ -901,7 +913,12 @@ void HudGaugeBrackets::renderBoundingBrackets(int x1, int y1, int x2, int y2, in
}
break;
case OBJ_JUMP_NODE:
strcpy_s(temp_name, t_objp->jnp->get_name_ptr());
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
if(jnp->get_obj() == t_objp)
break;
}
strcpy_s(temp_name, jnp->get_name_ptr());
end_string_at_first_hash_symbol(temp_name);
tinfo_name = temp_name;
break;
@@ -913,9 +930,6 @@ void HudGaugeBrackets::renderBoundingBrackets(int x1, int y1, int x2, int y2, in
if(tinfo_class && (flags & TARGET_DISPLAY_CLASS)) {
gr_string(x2+3, y1+9, tinfo_class);
}
/* if(tinfo_callsign) {
gr_string(x2+3, y1+18, tinfo_callsign);
} */
}
// we're done, so bring the scale back to normal
+2 -5
View File
@@ -140,7 +140,7 @@ char *Escort_gauge_filenames[GR_NUM_RESOLUTIONS][MAX_ESCORT_SHIPS] =
static int Last_target_index; // index into Escort_gauges for last targeted via 'Next Escort Target' key
HudGaugeEscort::HudGaugeEscort():
HudGauge(HUD_OBJECT_ESCORT, HUD_ESCORT_VIEW, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_ESCORT, HUD_ESCORT_VIEW, true, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -465,15 +465,12 @@ void hud_escort_init()
// ----------------------------------------------------------------------
// hud_escort_clear_all()
//
void hud_escort_clear_all(bool clear_flags)
void hud_escort_clear_all()
{
int i;
Num_escort_ships = 0;
for ( i = 0; i < Max_escort_ships; i++ ) {
if(clear_flags && (Escort_ships[i].objnum >= 0) && (Objects[Escort_ships[i].objnum].type == OBJ_SHIP) && (Objects[Escort_ships[i].objnum].instance >= 0)){
Ships[Objects[Escort_ships[i].objnum].instance].flags &= ~SF_ESCORT;
}
Escort_ships[i].obj_signature = -99;
Escort_ships[i].np_id = -1;
shield_info_reset(&Escort_ships[i].hit_info);
+1 -1
View File
@@ -26,7 +26,7 @@ void hud_escort_init();
void hud_setup_escort_list(int level = 1);
void hud_escort_view_toggle();
void hud_add_remove_ship_escort(int objnum, int supress_feedback = 0);
void hud_escort_clear_all(bool clear_flags = false);
void hud_escort_clear_all();
void hud_escort_ship_hit(object *objp, int quadrant);
void hud_escort_target_next();
void hud_escort_cull_list();
+32 -117
View File
@@ -129,9 +129,24 @@ void update_ets(object* objp, float fl_frametime)
shield_add_strength(objp, shield_delta);
if ( (_ss = shield_get_strength(objp)) > ship_p->ship_max_shield_strength ){
for (int i=0; i<MAX_SHIELD_SECTIONS; i++){
objp->shield_quadrant[i] *= ship_p->ship_max_shield_strength / _ss;
int i;
float total_shield_strength = shield_get_strength(objp);
float max_shield_recharge = ship_p->ship_max_shield_strength * ship_p->max_shield_recharge_pct;
float shield_balance = 1.0f;
if ((max_shield_recharge > 0) && (total_shield_strength > max_shield_recharge))
shield_balance = total_shield_strength/max_shield_recharge;
// prevent any of the segments from going over the limits
for (i=0; i<objp->n_shield_segments; i++){
if ((total_shield_strength > 0.0f) && (ship_p->ship_max_shield_segment[i] > 0.0f)) {
objp->shield_quadrant[i] /= shield_balance;
if ( (_ss = shield_get_quad(objp,i)) > ship_p->ship_max_shield_segment[i] ){
objp->shield_quadrant[i] *= ship_p->ship_max_shield_segment[i] / _ss;
}
} else {
objp->shield_quadrant[i] = 0.0f;
}
}
@@ -657,13 +672,13 @@ void transfer_energy_to_weapons(object* obj)
}
HudGaugeEts::HudGaugeEts():
HudGauge(HUD_OBJECT_ETS_ENGINES, HUD_ETS_GAUGE, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255),
HudGauge(HUD_OBJECT_ETS_ENGINES, HUD_ETS_GAUGE, true, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255),
System_type(0)
{
}
HudGaugeEts::HudGaugeEts(int _gauge_object, int _system_type):
HudGauge(_gauge_object, HUD_ETS_GAUGE, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255),
HudGauge(_gauge_object, HUD_ETS_GAUGE, true, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255),
System_type(_system_type)
{
}
@@ -713,13 +728,13 @@ void HudGaugeEts::pageIn()
bm_page_in_aabitmap( Ets_bar.first_frame, Ets_bar.num_frames );
}
/**
* Draw one ETS bar to screen
*/
void HudGaugeEts::blitGauge(int index)
{
int y_start, y_end, clip_h, w, h, x, y;
// draw the letters for the gauges first, before any clipping occurs
renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter);
clip_h = fl2i( (1 - Energy_levels[index]) * ETS_bar_h );
bm_get_info(Ets_bar.first_frame,&w,&h);
@@ -772,97 +787,6 @@ void HudGaugeEts::blitGauge(int index)
}
}
/**
* Default ctor for retail ETS gauge
* 2nd arg (0) is not used
*/
HudGaugeEtsRetail::HudGaugeEtsRetail():
HudGaugeEts(HUD_OBJECT_ETS_RETAIL, 0)
{
}
/**
* Render the ETS retail gauge to the screen (weapon+shield+engine)
*/
void HudGaugeEtsRetail::render(float frametime)
{
int i;
int initial_position;
ship* ship_p = &Ships[Player_obj->instance];
if ( Ets_bar.first_frame < 0 ) {
return;
}
// if at least two gauges are not shown, don't show any
i = 0;
if (!ship_has_energy_weapons(ship_p)) i++;
if (Player_obj->flags & OF_NO_SHIELDS) i++;
if (!ship_has_engine_power(ship_p)) i++;
if (i >= 2) return;
setGaugeColor();
// draw the letters for the gauges first, before any clipping occurs
// skip letter for any missing gauges (max one, see check above)
initial_position = 0;
if (ship_has_energy_weapons(ship_p)) {
Letter = Letters[0];
position[0] = Gauge_positions[initial_position++];
renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter);
}
if (!(Player_obj->flags & OF_NO_SHIELDS)) {
Letter = Letters[1];
position[0] = Gauge_positions[initial_position++];
renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter);
}
if (ship_has_engine_power(ship_p)) {
Letter = Letters[2];
position[0] = Gauge_positions[initial_position++];
renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter);
}
// draw gauges, skipping any gauge that is missing
initial_position = 0;
if (ship_has_energy_weapons(ship_p)) {
Letter = Letters[0];
position[0] = Gauge_positions[initial_position++];
blitGauge(ship_p->weapon_recharge_index);
}
if (!(Player_obj->flags & OF_NO_SHIELDS)) {
Letter = Letters[1];
position[0] = Gauge_positions[initial_position++];
blitGauge(ship_p->shield_recharge_index);
}
if (ship_has_engine_power(ship_p)) {
Letter = Letters[2];
position[0] = Gauge_positions[initial_position++];
blitGauge(ship_p->engine_recharge_index);
}
}
/**
* Set ETS letters for retail ETS gauge
* Allows for different languages to be used in the hud
*/
void HudGaugeEtsRetail::initLetters(char *_letters)
{
int i;
for ( i = 0; i < num_retail_ets_gauges; ++i)
Letters[i] = _letters[i];
}
/**
* Set the three possible positions for ETS bars
*/
void HudGaugeEtsRetail::initGaugePositions(int *_gauge_positions)
{
int i;
for ( i = 0; i < num_retail_ets_gauges; ++i)
Gauge_positions[i] = _gauge_positions[i];
}
HudGaugeEtsWeapons::HudGaugeEtsWeapons():
HudGaugeEts(HUD_OBJECT_ETS_WEAPONS, (int)WEAPONS)
{
@@ -885,7 +809,7 @@ void HudGaugeEtsWeapons::render(float frametime)
if (!ship_has_engine_power(ship_p)) i++;
if (i >= 2) return;
// no weapon energy, no weapon gauge
// now actually check if this
if (!ship_has_energy_weapons(ship_p))
{
return;
@@ -893,9 +817,6 @@ void HudGaugeEtsWeapons::render(float frametime)
setGaugeColor();
// draw the letters for the gauge first, before any clipping occurs
renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter);
// draw the gauges for the weapon system
blitGauge(ship_p->weapon_recharge_index);
}
@@ -922,17 +843,14 @@ void HudGaugeEtsShields::render(float frametime)
if (!ship_has_engine_power(ship_p)) i++;
if (i >= 2) return;
// no shields, no shields gauge
setGaugeColor();
// draw the letters for the gauges first, before any clipping occurs
if (Player_obj->flags & OF_NO_SHIELDS) {
return;
}
setGaugeColor();
// draw the letters for the gauge first, before any clipping occurs
renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter);
// draw the gauge for the shield system
// draw the gauges for the weapon system
blitGauge(ship_p->shield_recharge_index);
}
@@ -958,16 +876,13 @@ void HudGaugeEtsEngines::render(float frametime)
if (!ship_has_engine_power(ship_p)) i++;
if (i >= 2) return;
// no engines, no engine gauge
setGaugeColor();
// draw the letters for the gauges first, before any clipping occurs
if (!ship_has_engine_power(ship_p)) {
return;
}
setGaugeColor();
// draw the letters for the gauge first, before any clipping occurs
renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter);
// draw the gauge for the engine system
// draw the gauges for the weapon system
blitGauge(ship_p->engine_recharge_index);
}
-14
View File
@@ -18,8 +18,6 @@ struct object;
#define ETS_RECHARGE_RATE 4.0f // Recharge this percent of total shields/second
const int num_retail_ets_gauges = 3;
extern float Energy_levels[];
extern int Weapon_energy_cheat;
@@ -83,16 +81,4 @@ public:
void render(float frametime);
};
class HudGaugeEtsRetail: public HudGaugeEts
{
protected:
char Letters[num_retail_ets_gauges];
int Gauge_positions[num_retail_ets_gauges];
public:
HudGaugeEtsRetail();
void render(float frametime);
void initLetters(char *_letters);
void initGaugePositions(int *_gauge_positions);
};
#endif
+5 -7
View File
@@ -145,7 +145,7 @@ void hud_draw_diamond(int x, int y, int width, int height)
}
HudGaugeLock::HudGaugeLock():
HudGauge(HUD_OBJECT_LOCK, HUD_LEAD_INDICATOR, false, false, VM_DEAD_VIEW, 255, 255, 255)
HudGauge(HUD_OBJECT_LOCK, HUD_LEAD_INDICATOR, true, false, false, VM_DEAD_VIEW, 255, 255, 255)
{
}
@@ -196,8 +196,6 @@ void HudGaugeLock::initialize()
Lock_gauge_draw_stamp = -1;
Lock_gauge_draw = 0;
Rotate_time_id = 1;
HudGauge::initialize();
}
// hud_show_lock_indicator() will display the lock indicator for homing missiles.
@@ -629,7 +627,7 @@ void hud_do_lock_indicator(float frametime)
if ( Missile_track_loop > -1 ) {
snd_stop(Missile_track_loop);
Missile_track_loop = -1;
Missile_lock_loop = snd_play(&Snds[SND_MISSILE_LOCK]);
Missile_lock_loop = snd_play(&Snds[ship_get_sound(Player_obj, SND_MISSILE_LOCK)]);
}
}
else {
@@ -849,7 +847,7 @@ void hud_calculate_lock_position(float frametime)
}
if ( Missile_track_loop == -1 ) {
Missile_track_loop = snd_play_looping( &Snds[SND_MISSILE_TRACKING], 0.0f , -1, -1);
Missile_track_loop = snd_play_looping( &Snds[ship_get_sound(Player_obj, SND_MISSILE_TRACKING)], 0.0f , -1, -1);
}
if (!Players[Player_num].lock_time_to_target) {
@@ -1061,7 +1059,7 @@ void hud_lock_get_new_lock_pos(object *target_objp)
}
ss = GET_NEXT( ss );
}
} else if ( (target_shipp) && (wip->wi_flags & WIF_HOMING_JAVELIN)) {
} else if ((target_shipp) && wip->wi_flags & WIF_HOMING_JAVELIN) {
Player->locking_subsys = ship_get_closest_subsys_in_sight(target_shipp, SUBSYSTEM_ENGINE, &Player_obj->pos);
if (Player->locking_subsys != NULL) {
get_subsystem_world_pos(target_objp, Player->locking_subsys, &lock_world_pos);
@@ -1105,7 +1103,7 @@ void hud_lock_determine_lock_point(vec3d *lock_world_pos_out)
Player->locking_on_center=0;
Player->locking_subsys=Player_ai->targeted_subsys;
Player->locking_subsys_parent=Player_ai->target_objnum;
} else if ( (wip->wi_flags & WIF_HOMING_JAVELIN) && (target_objp->type == OBJ_SHIP)) {
} else if ( wip->wi_flags & WIF_HOMING_JAVELIN && target_objp->type == OBJ_SHIP) {
if (!Player->locking_subsys ||
Player->locking_subsys->system_info->type != SUBSYSTEM_ENGINE) {
Player->locking_subsys = ship_get_closest_subsys_in_sight(&Ships[target_objp->instance], SUBSYSTEM_ENGINE, &Player_obj->pos);
+19 -39
View File
@@ -248,7 +248,7 @@ void hud_clear_msg_buffer()
}
HudGaugeMessages::HudGaugeMessages():
HudGauge(HUD_OBJECT_MESSAGES, HUD_MESSAGE_LINES, false, true, (VM_WARP_CHASE), 255, 255, 255)
HudGauge(HUD_OBJECT_MESSAGES, HUD_MESSAGE_LINES, true, false, true, (VM_WARP_CHASE), 255, 255, 255)
{
}
@@ -288,13 +288,11 @@ void HudGaugeMessages::initialize()
Window_height = Max_lines * Line_h;
active_messages.clear();
pending_messages = SCP_queue<HUD_message_data>(); // there's no clear() method for queues :/
pending_messages = SCP_queue<HUD_message_data>(); // there's no clear() method for queues :\
Scroll_needed = false;
Scroll_in_progress = false;
Scroll_time_id = 1;
HudGauge::initialize();
}
void HudGaugeMessages::pageIn()
@@ -415,11 +413,6 @@ void HudGaugeMessages::scrollMessages()
}
}
void HudGaugeMessages::clearMessages()
{
active_messages.clear();
}
void HudGaugeMessages::preprocess()
{
setFont();
@@ -427,10 +420,10 @@ void HudGaugeMessages::preprocess()
scrollMessages();
}
/**
* HudGaugeMessages::render() will display the active HUD messages on the HUD. It will scroll
* the messages up when a new message arrives.
*/
// ---------------------------------------------------------------------------------------
// HudGaugeMessages::render() will display the active HUD messages on the HUD. It will scroll
// the messages up when a new message arrives.
//
void HudGaugeMessages::render(float frametime)
{
hud_set_default_color();
@@ -1169,7 +1162,7 @@ void hud_scrollback_exit()
}
HudGaugeTalkingHead::HudGaugeTalkingHead():
HudGauge(HUD_OBJECT_TALKING_HEAD, HUD_TALKING_HEAD, false, true, (VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY), 255, 255, 255)
HudGauge(HUD_OBJECT_TALKING_HEAD, HUD_TALKING_HEAD, true, false, true, (VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY), 255, 255, 255)
{
}
@@ -1177,8 +1170,6 @@ void HudGaugeTalkingHead::initialize()
{
head_anim = NULL;
msg_id = -1;
HudGauge::initialize();
}
void HudGaugeTalkingHead::initHeaderOffsets(int x, int y)
@@ -1207,9 +1198,6 @@ void HudGaugeTalkingHead::initBitmaps(char *fname)
}
}
/**
* Create a new head animation object
*/
anim_instance* HudGaugeTalkingHead::createAnim(int anim_start_frame, anim* anim_data)
{
anim_play_struct aps;
@@ -1225,11 +1213,6 @@ anim_instance* HudGaugeTalkingHead::createAnim(int anim_start_frame, anim* anim_
return anim_play(&aps);
}
/**
* Renders everything for a head animation except the actual head animation
* ANI (see anim_render_all), i.e. the background, border & title
* Also checks for when new head ani's need to start playing
*/
void HudGaugeTalkingHead::render(float frametime)
{
if ( Head_frame.first_frame == -1 ){
@@ -1237,7 +1220,7 @@ void HudGaugeTalkingHead::render(float frametime)
}
if(msg_id != -1 && head_anim != NULL) {
if(!head_anim->done_playing) {
if(anim_playing(head_anim)) {
// draw frame
// hud_set_default_color();
setGaugeColor();
@@ -1247,20 +1230,12 @@ void HudGaugeTalkingHead::render(float frametime)
gr_clear();
resetClip();
renderBitmap(Head_frame.first_frame, position[0], position[1]); // head ani border
gr_set_screen_scale(base_w, base_h);
setGaugeColor();
generic_anim_render(head_anim,frametime, position[0] + Anim_offsets[0] + fl2i(HUD_offset_x), position[1] + Anim_offsets[1] + fl2i(HUD_offset_y));
renderBitmap(Head_frame.first_frame, position[0], position[1]);
// draw title
renderString(position[0] + Header_offsets[0], position[1] + Header_offsets[1], XSTR("message", 217));
} else {
for (int j = 0; j < Num_messages_playing; ++j) {
if (Playing_messages[j].id == msg_id) {
Playing_messages[j].play_anim = false;
break; // only one head ani plays at a time
}
}
msg_id = -1; // allow repeated messages to display a new head ani
anim_stop_playing(head_anim);
head_anim = NULL; // Nothing to see here anymore, move along
}
}
@@ -1268,8 +1243,13 @@ void HudGaugeTalkingHead::render(float frametime)
for (int i = 0; i < Num_messages_playing; i++ ) {
if(Playing_messages[i].play_anim && Playing_messages[i].id != msg_id ) {
msg_id = Playing_messages[i].id;
if(head_anim) {
if(anim_playing(head_anim)) {
anim_stop_playing(head_anim);
}
}
if (Playing_messages[i].anim_data)
head_anim = Playing_messages[i].anim_data;
head_anim = createAnim(Playing_messages[i].start_frame, Playing_messages[i].anim_data);
else
head_anim = NULL;
@@ -1314,7 +1294,7 @@ bool HudGaugeTalkingHead::canRender()
}
HudGaugeFixedMessages::HudGaugeFixedMessages():
HudGauge(HUD_OBJECT_FIXED_MESSAGES, HUD_MESSAGE_LINES, false, true, (VM_WARP_CHASE), 255, 255, 255)
HudGauge(HUD_OBJECT_FIXED_MESSAGES, HUD_MESSAGE_LINES, true, false, true, (VM_WARP_CHASE), 255, 255, 255)
{
}
@@ -1333,4 +1313,4 @@ void HudGaugeFixedMessages::render(float frametime) {
void HudGaugeFixedMessages::pageIn()
{
}
}
+1 -4
View File
@@ -14,7 +14,6 @@
#include "hud/hud.h"
#include "anim/packunpack.h"
#include "graphics/generic.h"
#define MAX_HUD_LINE_LEN 256 // maximum number of characters for a HUD message
@@ -107,7 +106,6 @@ public:
void initStepSize(int h);
void initTotalLife(int ms);
void clearMessages();
void processMessageBuffer();
void addPending(char *text, int source, int x = 0);
void scrollMessages();
@@ -125,8 +123,7 @@ class HudGaugeTalkingHead: public HudGauge // HUD_TALKING_HEAD
int Anim_offsets[2];
int Anim_size[2];
generic_anim *head_anim;
anim_instance *head_anim;
int msg_id;
public:
HudGaugeTalkingHead();
+182 -1029
View File
File diff suppressed because it is too large. Load diff
+52 -57
View File
@@ -7,7 +7,6 @@
#include "globalincs/globals.h"
#include "ai/ai.h"
#include "graphics/2d.h"
//Variables
extern int Num_custom_gauges;
@@ -27,163 +26,159 @@ void hud_positions_init();
void set_current_hud();
void init_hud();
void load_missing_retail_gauges();
void check_color(int *color);
#define NUM_HUD_OBJECT_ENTRIES 54 // not used anywhere?
#define NUM_HUD_OBJECT_ENTRIES 54
int parse_gauge_type();
void load_gauge(int gauge, int base_w = -1, int base_h = -1, int font = -1, int ship_idx = -1, color *use_clr = NULL);
void load_gauge(int gauge, int base_w = -1, int base_h = -1, int font = -1, int ship_idx = -1);
#define HUD_OBJECT_CUSTOM 0
void load_gauge_custom(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_custom(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_MESSAGES 1
void load_gauge_messages(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_messages(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_TRAINING_MESSAGES 2
void load_gauge_training_messages(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_training_messages(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_SUPPORT 3
void load_gauge_support(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_support(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_DAMAGE 4
void load_gauge_damage(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_damage(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_WINGMAN_STATUS 5
void load_gauge_wingman_status(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_wingman_status(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_AUTO_SPEED 6
void load_gauge_auto_speed(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_auto_speed(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_AUTO_TARGET 7
void load_gauge_auto_target(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_auto_target(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_CMEASURES 8
void load_gauge_countermeasures(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_countermeasures(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_TALKING_HEAD 9
void load_gauge_talking_head(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_talking_head(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_DIRECTIVES 10
void load_gauge_directives(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_directives(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_WEAPONS 11
void load_gauge_weapons(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_weapons(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_OBJ_NOTIFY 12
void load_gauge_objective_notify(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_objective_notify(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_SQUAD_MSG 13
void load_gauge_squad_message(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_squad_message(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_LAG 14
void load_gauge_lag(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_lag(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_MINI_SHIELD 15
void load_gauge_mini_shields(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_mini_shields(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_PLAYER_SHIELD 16
void load_gauge_player_shields(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_player_shields(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_TARGET_SHIELD 17
void load_gauge_target_shields(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_target_shields(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_ESCORT 18
void load_gauge_escort_view(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_escort_view(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_MISSION_TIME 19
void load_gauge_mission_time(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_mission_time(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_ETS_WEAPONS 20
void load_gauge_ets_weapons(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_ets_weapons(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_ETS_SHIELDS 21
void load_gauge_ets_shields(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_ets_shields(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_ETS_ENGINES 22
void load_gauge_ets_engines(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_ets_engines(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_TARGET_MONITOR 23
void load_gauge_target_monitor(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_target_monitor(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_EXTRA_TARGET_DATA 24
void load_gauge_extra_target_data(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_extra_target_data(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_RADAR_STD 25
void load_gauge_radar_std(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_radar_std(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_RADAR_ORB 26
void load_gauge_radar_orb(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_radar_orb(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_RADAR_BSG 27
void load_gauge_radar_dradis(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_radar_dradis(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_AFTERBURNER 28
void load_gauge_afterburner(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_afterburner(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_WEAPON_ENERGY 29
void load_gauge_weapon_energy(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_weapon_energy(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_TEXT_WARNINGS 30
void load_gauge_text_warnings(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_text_warnings(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_CENTER_RETICLE 31
void load_gauge_center_reticle(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_center_reticle(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_THROTTLE 32
void load_gauge_throttle(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_throttle(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_THREAT 33
void load_gauge_threat_indicator(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_threat_indicator(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_LEAD 34
void load_gauge_lead(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_lead(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_LEAD_SIGHT 35
void load_gauge_lead_sight(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_lead_sight(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_LOCK 36
void load_gauge_lock(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_lock(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_WEAPON_LINKING 37
void load_gauge_weapon_linking(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_weapon_linking(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_MULTI_MSG 38
void load_gauge_multi_msg(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_multi_msg(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_VOICE_STATUS 39
void load_gauge_voice_status(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_voice_status(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_PING 40
void load_gauge_ping(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_ping(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_SUPERNOVA 41
void load_gauge_supernova(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_supernova(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_OFFSCREEN 42
void load_gauge_offscreen(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_offscreen(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_BRACKETS 43
void load_gauge_brackets(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_brackets(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_ORIENTATION_TEE 44
void load_gauge_orientation_tee(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_orientation_tee(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_HOSTILE_TRI 45
void load_gauge_hostile_tri(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_hostile_tri(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_TARGET_TRI 46
void load_gauge_target_tri(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_target_tri(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_MISSILE_TRI 47
void load_gauge_missile_tri(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_missile_tri(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_KILLS 48
void load_gauge_kills(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_kills(int base_w, int base_h, int font, int ship_idx = -1);
#define HUD_OBJECT_FIXED_MESSAGES 49
void load_gauge_fixed_messages(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL);
#define HUD_OBJECT_ETS_RETAIL 50
void load_gauge_ets_retail(int base_w, int base_h, int hud_font, int ship_idx = -1, color *use_clr = NULL);
void load_gauge_fixed_messages(int base_w, int base_h, int font, int ship_idx = -1);
#endif // _HUDPARSE_H
+5 -9
View File
@@ -244,7 +244,7 @@ static int Zero_speed_coords[GR_NUM_RESOLUTIONS][2] = {
};
HudGaugeReticle::HudGaugeReticle():
HudGauge(HUD_OBJECT_CENTER_RETICLE, HUD_CENTER_RETICLE, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_TOPDOWN | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_CENTER_RETICLE, HUD_CENTER_RETICLE, true, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_TOPDOWN | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -337,7 +337,7 @@ void HudGaugeReticle::pageIn()
}
HudGaugeThrottle::HudGaugeThrottle():
HudGauge(HUD_OBJECT_THROTTLE, HUD_THROTTLE_GAUGE, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_THROTTLE, HUD_THROTTLE_GAUGE, true, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -570,7 +570,7 @@ void HudGaugeThrottle::renderThrottleBackground(int y_end)
}
HudGaugeThreatIndicator::HudGaugeThreatIndicator():
HudGauge(HUD_OBJECT_THREAT, HUD_THREAT_GAUGE, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_THREAT, HUD_THREAT_GAUGE, true, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -611,8 +611,6 @@ void HudGaugeThreatIndicator::initialize()
lock_warn_timer = timestamp(1);
lock_warn_frame = 0;
HudGauge::initialize();
}
void HudGaugeThreatIndicator::pageIn()
@@ -686,7 +684,7 @@ void HudGaugeThreatIndicator::renderLockThreat()
}
HudGaugeWeaponLinking::HudGaugeWeaponLinking():
HudGauge(HUD_OBJECT_WEAPON_LINKING, HUD_THREAT_GAUGE, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_WEAPON_LINKING, HUD_THREAT_GAUGE, true, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -773,8 +771,6 @@ void HudGaugeWeaponLinking::render(float frametime)
int gauge_index=0, frame_offset=0;
ship_weapon *swp;
setGaugeColor();
renderBitmap(arc.first_frame+1, position[0], position[1]);
swp = &Player_ship->weapons;
@@ -918,7 +914,7 @@ void hud_update_reticle( player *pp )
Threat_lock_frame = 1;
}
if ( (Threat_lock_frame == 2) && (Player->threat_flags & THREAT_ATTEMPT_LOCK ) ) {
snd_play( &Snds[SND_THREAT_FLASH]);
snd_play( &Snds[ship_get_sound(Player_obj, SND_THREAT_FLASH)]);
}
}
}
+104 -53
View File
@@ -37,12 +37,12 @@
#define SHIELD_HIT_DURATION_SHORT 300 // time a shield quadrant flashes after being hit
#define SHIELD_FLASH_INTERVAL_FAST 200 // time between shield quadrant flashes
// CommanderDJ - now dynamic
// #define MAX_SHIELD_ICONS 80
// now read in from hud.tbl
#define MAX_SHIELD_ICONS 80 //DTP bumped from 40 to 80
int Hud_shield_filename_count = 0;
char Hud_shield_filenames[MAX_SHIELD_ICONS][MAX_FILENAME_LEN];
SCP_vector<SCP_string> Hud_shield_filenames;
SCP_vector<hud_frames> Shield_gauges;
hud_frames Shield_gauges[MAX_SHIELD_ICONS];
static int Hud_shield_inited = 0;
/*static int Player_shield_coords[GR_NUM_RESOLUTIONS][2] =
@@ -122,16 +122,14 @@ ubyte Quadrant_xlate[MAX_SHIELD_SECTIONS] = {1,0,2,3};
// called at the start of each level from HUD_init. Use Hud_shield_init so we only init Shield_gauges[] once.
void hud_shield_level_init()
{
unsigned int i;
hud_frames temp;
int i;
hud_shield_hit_reset(1); // reset for the player
if ( !Hud_shield_inited ) {
for ( i = 0; i < Hud_shield_filenames.size(); i++ ) {
Shield_gauges.push_back(temp);
Shield_gauges.at(i).first_frame = -1;
Shield_gauges.at(i).num_frames = 0;
for ( i = 0; i < MAX_SHIELD_ICONS; i++ ) {
Shield_gauges[i].first_frame = -1;
Shield_gauges[i].num_frames = 0;
}
Hud_shield_inited = 1;
@@ -185,13 +183,13 @@ void hud_ship_icon_page_in(ship_info *sip)
}
// load in shield frames if not already loaded
Assert(sip->shield_icon_index < (ubyte)Hud_shield_filenames.size());
sgp = &Shield_gauges.at(sip->shield_icon_index);
Assert(sip->shield_icon_index < Hud_shield_filename_count);
sgp = &Shield_gauges[sip->shield_icon_index];
if ( sgp->first_frame == -1 ) {
sgp->first_frame = bm_load_animation(const_cast<char*>(Hud_shield_filenames.at(sip->shield_icon_index).c_str()), &sgp->num_frames);
sgp->first_frame = bm_load_animation(Hud_shield_filenames[sip->shield_icon_index], &sgp->num_frames);
if ( sgp->first_frame == -1 ) {
Warning(LOCATION, "Could not load in the HUD shield ani: %s\n", Hud_shield_filenames.at(sip->shield_icon_index).c_str());
Warning(LOCATION, "Could not load in the HUD shield ani: %s\n", Hud_shield_filenames[sip->shield_icon_index]);
return;
}
}
@@ -230,10 +228,17 @@ void hud_shield_equalize(object *objp, player *pl)
if (objp->flags & OF_NO_SHIELDS)
return;
if (objp->n_shield_segments == 1)
return;
// are all quadrants equal?
all_equal = 1;
for (idx = 0; idx < MAX_SHIELD_SECTIONS - 1; idx++) {
if (objp->shield_quadrant[idx] != objp->shield_quadrant[idx + 1]) {
for (idx = 0; idx < objp->n_shield_segments - 1; idx++) {
if ((Ships[objp->instance].ship_max_shield_segment[idx] == 0) || (Ships[objp->instance].ship_max_shield_segment[idx + 1] == 0)) {
all_equal = 0;
break;
}
if ((objp->shield_quadrant[idx]/Ships[objp->instance].ship_max_shield_segment[idx]) != (objp->shield_quadrant[idx + 1]/Ships[objp->instance].ship_max_shield_segment[idx + 1])) {
all_equal = 0;
break;
}
@@ -254,7 +259,10 @@ void hud_shield_equalize(object *objp, player *pl)
pl->shield_penalty_stamp = timestamp(1000);
}
shield_set_strength(objp, strength);
float shield_str_pct = strength / Ships[objp->instance].ship_max_shield_strength;
for (idx = 0; idx < objp->n_shield_segments; idx++) {
shield_set_quad(objp,idx, shield_str_pct * Ships[objp->instance].ship_max_shield_segment[idx]);
}
// beep
if (objp == Player_obj) {
@@ -283,6 +291,18 @@ void hud_augment_shield_quadrant(object *objp, int direction)
float max_quadrant_val;
int i;
switch (objp->n_shield_segments) {
case 1:
return;
case 2:
if (direction == 0)
direction = 4;
direction--;
if (direction > 1)
return;
break;
}
Assert(direction >= 0 && direction < MAX_SHIELD_SECTIONS);
Assert(objp->type == OBJ_SHIP);
@@ -302,7 +322,7 @@ void hud_augment_shield_quadrant(object *objp, int direction)
}
energy_avail = 0.0f;
for ( i = 0; i < MAX_SHIELD_SECTIONS; i++ ) {
for ( i = 0; i < objp->n_shield_segments; i++ ) {
if ( i == direction )
continue;
energy_avail += objp->shield_quadrant[i];
@@ -312,7 +332,7 @@ void hud_augment_shield_quadrant(object *objp, int direction)
if ( percent_to_take > 1.0f )
percent_to_take = 1.0f;
for ( i = 0; i < MAX_SHIELD_SECTIONS; i++ ) {
for ( i = 0; i < objp->n_shield_segments; i++ ) {
if ( i == direction )
continue;
delta = percent_to_take * objp->shield_quadrant[i];
@@ -331,16 +351,19 @@ void hud_shield_assign_info(ship_info *sip, char *filename)
{
ubyte i;
for ( i = 0; i < (ubyte)Hud_shield_filenames.size(); i++ ) {
if ( !stricmp(filename, Hud_shield_filenames.at(i).c_str()) ) {
for ( i = 0; i < Hud_shield_filename_count; i++ ) {
if ( !stricmp(filename, Hud_shield_filenames[i]) ) {
sip->shield_icon_index = i;
return;
}
}
//No HUD icon found. Add one!
sip->shield_icon_index = (unsigned char) Hud_shield_filenames.size();
Hud_shield_filenames.push_back((SCP_string)filename);
Assert(Hud_shield_filename_count < MAX_SHIELD_ICONS);
if(Hud_shield_filename_count < MAX_SHIELD_ICONS){
sip->shield_icon_index = (unsigned char) Hud_shield_filename_count;
strcpy_s(Hud_shield_filenames[Hud_shield_filename_count++], filename);
}
}
void hud_show_mini_ship_integrity(object *objp, int x_force, int y_force)
@@ -553,12 +576,12 @@ void hud_shield_quadrant_hit(object *objp, int quadrant)
}
HudGaugeShield::HudGaugeShield():
HudGauge(HUD_OBJECT_PLAYER_SHIELD, HUD_PLAYER_SHIELD_ICON, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_PLAYER_SHIELD, HUD_PLAYER_SHIELD_ICON, true, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
HudGaugeShield::HudGaugeShield(int _gauge_object, int _gauge_config):
HudGauge(_gauge_object, _gauge_config, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(_gauge_object, _gauge_config, true, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -594,15 +617,16 @@ void HudGaugeShield::showShields(object *objp, int mode)
setGaugeColor();
// load in shield frames if not already loaded
if (sip->shield_icon_index != 255) {
sgp = &Shield_gauges.at(sip->shield_icon_index);
if(sip->shield_icon_index != 255)
{
sgp = &Shield_gauges[sip->shield_icon_index];
if ( (sgp->first_frame == -1) && (sip->shield_icon_index < Hud_shield_filenames.size()) ) {
sgp->first_frame = bm_load_animation(const_cast<char*>(Hud_shield_filenames.at(sip->shield_icon_index).c_str()), &sgp->num_frames);
if (sgp->first_frame == -1) {
if (!shield_ani_warning_displayed_already) {
if ( sgp->first_frame == -1 && sip->shield_icon_index < Hud_shield_filename_count) {
sgp->first_frame = bm_load_animation(Hud_shield_filenames[sip->shield_icon_index], &sgp->num_frames);
if ( sgp->first_frame == -1 ) {
if(!shield_ani_warning_displayed_already){
shield_ani_warning_displayed_already = true;
Warning(LOCATION, "Could not load in the HUD shield ani: %s\n", Hud_shield_filenames.at(sip->shield_icon_index).c_str());
Warning(LOCATION, "Could not load in the HUD shield ani: %s\n", Hud_shield_filenames[sip->shield_icon_index]);
}
return;
}
@@ -693,22 +717,25 @@ void HudGaugeShield::showShields(object *objp, int mode)
// draw the four quadrants
//
// Draw shield quadrants at one of NUM_SHIELD_LEVELS
max_shield = get_max_shield_quad(objp);
int j, x_val, y_val, mid_val;
for ( i = 0; i < MAX_SHIELD_SECTIONS; i++ ) {
for ( i = 0; i < objp->n_shield_segments; i++ ) {
if ( objp->flags & OF_NO_SHIELDS ) {
break;
}
if ( objp->shield_quadrant[Quadrant_xlate[i]] < 0.1f ) {
int segment = (objp->n_shield_segments == 1) ? i : Quadrant_xlate[i];
if ( objp->shield_quadrant[segment] < 0.1f ) {
continue;
}
max_shield = get_max_shield_quad(objp,segment);
range = MAX(HUD_COLOR_ALPHA_MAX, HUD_color_alpha + 4);
hud_color_index = fl2i( (objp->shield_quadrant[Quadrant_xlate[i]] / max_shield) * range);
hud_color_index = fl2i( (objp->shield_quadrant[segment] / max_shield) * range);
Assert(hud_color_index >= 0 && hud_color_index <= range);
if ( hud_color_index < 0 ) {
@@ -768,7 +795,7 @@ void HudGaugeShield::showShields(object *objp, int mode)
renderGradientLine(sx + j, y_val, sx + j, sy);
break;
//Left
case 3:
case 1:
sx += 1;
x_val = sx + 10;
y_val = sy + 15;
@@ -801,7 +828,7 @@ void HudGaugeShield::showShields(object *objp, int mode)
sx += 2;
break;
//Right
case 1:
case 2:
x_val = sx + 109; //-3 for border
y_val = sy + 15;
for(j = 0; j < 6; j++)
@@ -832,7 +859,7 @@ void HudGaugeShield::showShields(object *objp, int mode)
renderGradientLine(mid_val, y_val + j, x_val, y_val + j);
break;
//Bottom
case 2:
case 3:
y_val = sy + 80; //-3 for border
for(j = 0; j < 6; j++)
renderGradientLine(sx + j,
@@ -854,10 +881,6 @@ void HudGaugeShield::showShields(object *objp, int mode)
y_val += 3;
for(j = 0; j < 112; j++)
renderGradientLine(sx + j, mid_val, sx + j, y_val);
//Whoops?
default:
Warning(LOCATION, "Invalid shield quadrant %d specified!", i);
}
}
}
@@ -922,7 +945,7 @@ void HudGaugeShieldTarget::render(float frametime)
}
HudGaugeShieldMini::HudGaugeShieldMini(): // HUD_TARGET_MINI_ICON
HudGauge(HUD_OBJECT_MINI_SHIELD, HUD_TARGET_MINI_ICON, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_MINI_SHIELD, HUD_TARGET_MINI_ICON, true, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -997,7 +1020,9 @@ void HudGaugeShieldMini::showMiniShields(object *objp)
// draw the four quadrants
// Draw shield quadrants at one of NUM_SHIELD_LEVELS
max_shield = get_max_shield_quad(objp);
bool single_segment_flash = false;
int segment;
for ( i = 0; i < MAX_SHIELD_SECTIONS; i++ ) {
@@ -1005,18 +1030,44 @@ void HudGaugeShieldMini::showMiniShields(object *objp)
break;
}
if ( objp->shield_quadrant[Quadrant_xlate[i]] < 0.1f ) {
if (objp->n_shield_segments == 1) {
if ( objp->shield_quadrant[0] < 0.1f ) {
break;
}
} else if ( objp->shield_quadrant[Quadrant_xlate[i]] < 0.1f ) {
continue;
}
if ( maybeFlashShield(SHIELD_HIT_TARGET, i) ) {
frame_offset = i+MAX_SHIELD_SECTIONS;
} else {
frame_offset = i;
segment = i;
if (objp->n_shield_segments == 2) {
if (i == 1)
segment = 0;
if (i == 0)
segment = 2;
}
frame_offset = segment;
max_shield = get_max_shield_quad(objp,Quadrant_xlate[i]);
if (objp->n_shield_segments == 1) {
if ( maybeFlashShield(SHIELD_HIT_TARGET, i) ) {
single_segment_flash = true;
}
if (single_segment_flash) {
frame_offset = i+MAX_SHIELD_SECTIONS;
}
} else if ( maybeFlashShield(SHIELD_HIT_TARGET, i) ) {
frame_offset = segment+MAX_SHIELD_SECTIONS;
}
range = HUD_color_alpha;
hud_color_index = fl2i( (objp->shield_quadrant[Quadrant_xlate[i]] / max_shield) * range + 0.5);
if (objp->n_shield_segments == 1)
hud_color_index = fl2i( (objp->shield_quadrant[0] / max_shield) * range + 0.5);
else
hud_color_index = fl2i( (objp->shield_quadrant[Quadrant_xlate[i]] / max_shield) * range + 0.5);
Assert(hud_color_index >= 0 && hud_color_index <= range);
if ( hud_color_index < 0 ) {
-2
View File
@@ -30,8 +30,6 @@ typedef struct shield_hit_info
extern ubyte Quadrant_xlate[4];
extern SCP_vector<SCP_string> Hud_shield_filenames;
struct player;
struct object;
struct ship_info;
+2 -4
View File
@@ -1611,7 +1611,7 @@ void hud_squadmsg_type_select( )
// check to see if the player is a traitor. If so, then he will not
// be able to do anything from this menu
if ((Player_ship != NULL) && (Player_ship->team == Iff_traitor)) {
if ( Player_ship->team == Iff_traitor ) {
for (i = 0; i < MAX_MENU_ITEMS; i++ )
MsgItems[i].active = 0;
goto do_main_menu;
@@ -2498,7 +2498,7 @@ int hud_query_order_issued(char *to, char *order_name, char *target_name, int ti
}
HudGaugeSquadMessage::HudGaugeSquadMessage():
HudGauge(HUD_OBJECT_SQUAD_MSG, HUD_MESSAGE_BOX, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_SQUAD_MSG, HUD_MESSAGE_BOX, true, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -2507,8 +2507,6 @@ void HudGaugeSquadMessage::initialize()
flash_timer[0] = timestamp(1);
flash_timer[1] = timestamp(1);
flash_flag = false;
HudGauge::initialize();
}
void HudGaugeSquadMessage::initHeaderOffsets(int x, int y)
+64 -44
View File
@@ -45,6 +45,7 @@
#include "network/multi.h"
#include "graphics/font.h"
#include "network/multiutil.h"
#include "model/model.h"
// If any of these bits in the ship->flags are set, ignore this ship when targetting
int TARGET_SHIP_IGNORE_FLAGS = (SF_EXPLODED|SF_DEPART_WARP|SF_DYING|SF_ARRIVING_STAGE_1|SF_HIDDEN_FROM_SENSORS);
@@ -628,10 +629,16 @@ void hud_reticle_list_update(object *objp, float measure, int dot_flag)
{
reticle_list *rl, *new_rl;
int i;
SCP_list<jump_node>::iterator jnp;
if (objp->type == OBJ_JUMP_NODE) {
if ( objp->jnp->is_hidden() )
return;
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
if( jnp->get_obj() != objp )
continue;
if( jnp->is_hidden() )
return;
}
}
for ( rl = GET_FIRST(&Reticle_cur_list); rl != END_OF_LIST(&Reticle_cur_list); rl = GET_NEXT(rl) ) {
@@ -1160,7 +1167,8 @@ void hud_target_common(int team_mask, int next_flag)
{
object *A, *start, *start2;
ship *shipp;
int is_ship, target_found = FALSE;
int is_ship, target_found = FALSE;
SCP_list<jump_node>::iterator jnp;
if (Player_ai->target_objnum == -1)
start = &obj_used_list;
@@ -1198,7 +1206,12 @@ void hud_target_common(int team_mask, int next_flag)
}
if (A->type == OBJ_JUMP_NODE) {
if ( A->jnp->is_hidden() )
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
if( jnp->get_obj() == A )
break;
}
if( jnp->is_hidden() )
continue;
}
@@ -2279,16 +2292,26 @@ void hud_target_targets_target()
int object_targetable_in_reticle(object *target_objp)
{
int obj_type;
SCP_list<jump_node>::iterator jnp;
if (target_objp == Player_obj ) {
return 0;
}
obj_type = target_objp->type;
if ( (obj_type == OBJ_SHIP) || (obj_type == OBJ_DEBRIS) || (obj_type == OBJ_WEAPON) || (obj_type == OBJ_ASTEROID)
|| ((obj_type == OBJ_JUMP_NODE) && !target_objp->jnp->is_hidden()) )
if ( (obj_type == OBJ_SHIP) || (obj_type == OBJ_DEBRIS) || (obj_type == OBJ_WEAPON) || (obj_type == OBJ_ASTEROID) )
{
return 1;
} else if ( obj_type == OBJ_JUMP_NODE )
{
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
if(jnp->get_obj() == target_objp)
break;
}
if (!jnp->is_hidden())
return 1;
}
return 0;
@@ -2315,6 +2338,7 @@ void hud_target_in_reticle_new()
object *A;
mc_info mc;
float dist;
SCP_list<jump_node>::iterator jnp;
hud_reticle_clear_list(&Reticle_cur_list);
Reticle_save_timestamp = timestamp(RESET_TARGET_IN_RETICLE);
@@ -2369,7 +2393,12 @@ void hud_target_in_reticle_new()
}
break;
case OBJ_JUMP_NODE:
mc.model_num = A->jnp->get_modelnum();
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
if(jnp->get_obj() == A)
break;
}
mc.model_num = jnp->get_modelnum();
break;
default:
Int3(); // Illegal object type.
@@ -2714,13 +2743,13 @@ void hud_tri_empty(float x1,float y1,float x2,float y2,float x3,float y3)
}
HudGaugeReticleTriangle::HudGaugeReticleTriangle():
HudGauge(HUD_OBJECT_HOSTILE_TRI, HUD_HOSTILE_TRIANGLE, false, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP, 255, 255, 255)
HudGauge(HUD_OBJECT_HOSTILE_TRI, HUD_HOSTILE_TRIANGLE, true, false, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP, 255, 255, 255)
{
}
HudGaugeReticleTriangle::HudGaugeReticleTriangle(int _gauge_object, int _gauge_config):
HudGauge(_gauge_object, _gauge_config, true, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP, 255, 255, 255)
HudGauge(_gauge_object, _gauge_config, true, true, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP, 255, 255, 255)
{
}
@@ -2832,15 +2861,17 @@ void HudGaugeReticleTriangle::renderTriangle(vec3d *hostile_pos, int aspect_flag
g3_project_vertex(&hostile_vertex);
if (hostile_vertex.codes == 0) { // on screen
int projected_x, projected_y;
float projected_x, projected_y;
if (!(hostile_vertex.flags & PF_OVERFLOW)) { // make sure point projected
int mag_squared;
float mag_squared;
projected_x = fl2i(hostile_vertex.screen.xyw.x);
projected_y = fl2i(hostile_vertex.screen.xyw.y);
projected_x = hostile_vertex.screen.xyw.x;
projected_y = hostile_vertex.screen.xyw.y;
unsize(&projected_x, &projected_y);
gr_set_screen_scale(base_w, base_h);
gr_unsize_screen_posf( &projected_x, &projected_x );
gr_reset_screen_scale();
mag_squared = (projected_x - position[0]) * (projected_x - position[0]) +
(projected_y - position[1]) * (projected_y - position[1]);
@@ -2860,7 +2891,9 @@ void HudGaugeReticleTriangle::renderTriangle(vec3d *hostile_pos, int aspect_flag
gr_resize_screen_pos(&HUD_nose_scaled_x, &HUD_nose_scaled_y);
unsize( &hostile_vertex.world.xyz.x, &hostile_vertex.world.xyz.y );
gr_set_screen_scale(base_w, base_h);
gr_unsize_screen_posf( &hostile_vertex.world.xyz.x, &hostile_vertex.world.xyz.y );
gr_reset_screen_scale();
ang = atan2_safe(hostile_vertex.world.xyz.y,hostile_vertex.world.xyz.x);
sin_ang=(float)sin(ang);
@@ -2966,9 +2999,9 @@ void hud_process_homing_missiles()
}
if ( closest_is_aspect ) {
Homing_beep.snd_handle = snd_play(&Snds[SND_PROXIMITY_ASPECT_WARNING]);
Homing_beep.snd_handle = snd_play(&Snds[ship_get_sound(Player_obj, SND_PROXIMITY_ASPECT_WARNING)]);
} else {
Homing_beep.snd_handle = snd_play(&Snds[SND_PROXIMITY_WARNING]);
Homing_beep.snd_handle = snd_play(&Snds[ship_get_sound(Player_obj, SND_PROXIMITY_WARNING)]);
}
}
}
@@ -3009,7 +3042,7 @@ void HudGaugeMissileTriangles::render(float frametime)
}
HudGaugeOrientationTee::HudGaugeOrientationTee():
HudGauge(HUD_OBJECT_ORIENTATION_TEE, HUD_ORIENTATION_TEE, true, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP, 255, 255, 255)
HudGauge(HUD_OBJECT_ORIENTATION_TEE, HUD_ORIENTATION_TEE, true, true, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP, 255, 255, 255)
{
}
@@ -3238,13 +3271,6 @@ void hud_show_selection_set()
continue;
}
// Goober5000 - don't draw indicators for non-visible ships, per Mantis #1972
// (the only way we could get here is if the hotkey set contained a mix of visible
// and invisible ships)
if (awacs_get_level(targetp, Player_ship, 1) < 1) {
continue;
}
// find the current target vertex
//
g3_rotate_vertex(&target_point,&targetp->pos);
@@ -3615,7 +3641,7 @@ void polish_predicted_target_pos(weapon_info *wip, object *targetp, vec3d *enemy
}
HudGaugeLeadIndicator::HudGaugeLeadIndicator():
HudGauge(HUD_OBJECT_LEAD, HUD_LEAD_INDICATOR, false, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP, 255, 255, 255)
HudGauge(HUD_OBJECT_LEAD, HUD_LEAD_INDICATOR, true, false, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP, 255, 255, 255)
{
}
@@ -3941,7 +3967,7 @@ void HudGaugeLeadIndicator::renderLeadQuick(vec3d *target_world_pos, object *tar
}
HudGaugeLeadSight::HudGaugeLeadSight():
HudGauge(HUD_OBJECT_LEAD_SIGHT, HUD_LEAD_INDICATOR, true, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP, 255, 255, 255)
HudGauge(HUD_OBJECT_LEAD_SIGHT, HUD_LEAD_INDICATOR, true, true, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP, 255, 255, 255)
{
}
@@ -4208,17 +4234,11 @@ void hud_restore_subsystem_target(ship* shipp)
}
// --------------------------------------------------------------------------------
// get_subsystem_world_pos() returns the world position for a given subobject on a ship
// get_subsystem_world_pos() returns the world position for a given subsystem on a ship
//
vec3d* get_subsystem_world_pos(object* parent_obj, ship_subsys* subsys, vec3d* world_pos)
{
if (subsys == NULL) {
*world_pos = parent_obj->pos;
return world_pos;
}
vm_vec_unrotate(world_pos, &subsys->system_info->pnt, &parent_obj->orient);
vm_vec_add2(world_pos, &parent_obj->pos);
get_subsystem_pos(world_pos, parent_obj, subsys);
return world_pos;
}
@@ -4241,7 +4261,7 @@ void hud_target_change_check()
if (Player_ai->last_target != Player_ai->target_objnum) {
if ( Player_ai->target_objnum != -1){
snd_play( &Snds[SND_TARGET_ACQUIRE], 0.0f );
snd_play( &Snds[ship_get_sound(Player_obj, SND_TARGET_ACQUIRE)], 0.0f );
}
// if we have a hotkey set active, see if new target is in set. If not in
@@ -4583,7 +4603,7 @@ void hud_target_next_list(int hostile, int next_flag)
}
HudGaugeAutoTarget::HudGaugeAutoTarget():
HudGauge(HUD_OBJECT_AUTO_TARGET, HUD_AUTO_TARGET, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_AUTO_TARGET, HUD_AUTO_TARGET, true, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -4641,7 +4661,7 @@ void HudGaugeAutoTarget::pageIn()
}
HudGaugeAutoSpeed::HudGaugeAutoSpeed():
HudGauge(HUD_OBJECT_AUTO_SPEED, HUD_AUTO_SPEED, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_AUTO_SPEED, HUD_AUTO_SPEED, true, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -5192,7 +5212,7 @@ void hud_stuff_ship_class(char *ship_class_text, ship *shipp)
}
HudGaugeCmeasures::HudGaugeCmeasures():
HudGauge(HUD_OBJECT_CMEASURES, HUD_CMEASURE_GAUGE, false, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP, 255, 255, 255)
HudGauge(HUD_OBJECT_CMEASURES, HUD_CMEASURE_GAUGE, true, false, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP, 255, 255, 255)
{
}
@@ -5249,7 +5269,7 @@ void HudGaugeCmeasures::render(float frametime)
}
HudGaugeAfterburner::HudGaugeAfterburner():
HudGauge(HUD_OBJECT_AFTERBURNER, HUD_AFTERBURNER_ENERGY, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_AFTERBURNER, HUD_AFTERBURNER_ENERGY, true, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -5310,7 +5330,7 @@ void HudGaugeAfterburner::pageIn()
}
HudGaugeWeaponEnergy::HudGaugeWeaponEnergy():
HudGauge(HUD_OBJECT_WEAPON_ENERGY, HUD_WEAPONS_ENERGY, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_WEAPON_ENERGY, HUD_WEAPONS_ENERGY, true, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
@@ -5499,7 +5519,7 @@ void HudGaugeWeaponEnergy::render(float frametime)
}
HudGaugeWeapons::HudGaugeWeapons():
HudGauge(HUD_OBJECT_WEAPONS, HUD_WEAPONS_GAUGE, false, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP, 255, 255, 255)
HudGauge(HUD_OBJECT_WEAPONS, HUD_WEAPONS_GAUGE, true, false, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP, 255, 255, 255)
{
}
@@ -5944,7 +5964,7 @@ void hud_target_clear_display_list()
}
HudGaugeOffscreen::HudGaugeOffscreen():
HudGauge(HUD_OBJECT_OFFSCREEN, HUD_OFFSCREEN_INDICATOR, false, true, VM_DEAD_VIEW | VM_OTHER_SHIP, 255, 255, 255)
HudGauge(HUD_OBJECT_OFFSCREEN, HUD_OFFSCREEN_INDICATOR, true, false, true, VM_DEAD_VIEW | VM_OTHER_SHIP, 255, 255, 255)
{
}
+174 -107
View File
@@ -34,6 +34,7 @@
#include "species_defs/species_defs.h"
#include "iff_defs/iff_defs.h"
#include "network/multi.h"
#include "graphics/gropenglshader.h"
#ifndef NDEBUG
#include "hud/hudets.h"
@@ -102,6 +103,7 @@ int Cargo_scan_coords[GR_NUM_RESOLUTIONS][4] = {
int Targetbox_flash_timers[NUM_TBOX_FLASH_TIMERS];
int Targetbox_wire = 0;
int Targetbox_shader_effect = -1;
bool Lock_targetbox_mode = false;
// Different target states. This drives the text display right below the hull integrity on the targetbox.
@@ -176,7 +178,7 @@ void hud_targetbox_truncate_subsys_name(char *outstr)
}
HudGaugeTargetBox::HudGaugeTargetBox():
HudGauge(HUD_OBJECT_TARGET_MONITOR, HUD_TARGET_MONITOR, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY), 255, 255, 255)
HudGauge(HUD_OBJECT_TARGET_MONITOR, HUD_TARGET_MONITOR, true, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY), 255, 255, 255)
{
}
@@ -279,8 +281,6 @@ void HudGaugeTargetBox::initialize()
for(int i = 0; i < NUM_TBOX_FLASH_TIMERS; i++) {
initFlashTimer(i);
}
HudGauge::initialize();
}
void HudGaugeTargetBox::initFlashTimer(int index)
@@ -483,38 +483,50 @@ void HudGaugeTargetBox::renderTargetShip(object *target_objp)
renderTargetSetup(&camera_eye, &camera_orient, target_sip->closeup_zoom);
ship_model_start( target_objp );
if (Targetbox_wire!=0)
{
int is_bright = 1;
switch (Targetbox_wire) {
case 0:
flags |= MR_NO_LIGHTING;
if (ship_is_tagged(target_objp))
model_set_outline_color_fast(iff_get_color(IFF_COLOR_TAGGED, is_bright));
else
{
model_set_outline_color_fast(iff_get_color_by_team_and_object(target_shipp->team, Player_ship->team, is_bright, target_objp));
}
break;
case 1:
if (ship_is_tagged(target_objp))
model_set_outline_color_fast(iff_get_color(IFF_COLOR_TAGGED, true));
else
model_set_outline_color_fast(iff_get_color_by_team_and_object(target_shipp->team, Player_ship->team, true, target_objp));
flags = (Cmdline_nohtl) ? MR_SHOW_OUTLINE : MR_SHOW_OUTLINE_HTL;
flags = (Cmdline_nohtl) ? MR_SHOW_OUTLINE : MR_SHOW_OUTLINE_HTL;
flags |= MR_NO_POLYS | MR_NO_LIGHTING;
if (Targetbox_wire==1)
flags |=MR_NO_POLYS;
break;
case 2:
break;
case 3:
if (ship_is_tagged(target_objp))
model_set_outline_color_fast(iff_get_color(IFF_COLOR_TAGGED, true));
else
model_set_outline_color_fast(iff_get_color_by_team_and_object(target_shipp->team, Player_ship->team, true, target_objp));
flags |= MR_NO_LIGHTING | MR_NO_TEXTURING;
break;
}
if (target_sip->hud_target_lod >= 0) {
model_set_detail_level(target_sip->hud_target_lod);
}
if(Targetbox_wire != 2) flags |= MR_NO_LIGHTING;
if (!Glowpoint_override)
Glowpoint_override = true;
if(Targetbox_shader_effect > -1) {
flags |= MR_ANIMATED_SHADER;
opengl_shader_set_animated_effect(Targetbox_shader_effect);
}
// maybe render a special hud-target-only model
if(target_sip->model_num_hud >= 0){
model_render( target_sip->model_num_hud, &target_objp->orient, &obj_pos, flags | MR_LOCK_DETAIL | MR_AUTOCENTER | MR_NO_FOGGING);
} else {
model_render( target_sip->model_num, &target_objp->orient, &obj_pos, flags | MR_LOCK_DETAIL | MR_AUTOCENTER | MR_NO_FOGGING, -1, -1, target_shipp->ship_replacement_textures);
}
Glowpoint_override = false;
ship_model_stop( target_objp );
sx = 0;
@@ -590,19 +602,37 @@ void HudGaugeTargetBox::renderTargetDebris(object *target_objp)
// the objects position
vm_vec_copy_scale(&obj_pos,&orient_vec,factor);
if (Targetbox_wire!=0)
{
model_set_outline_color(255,255,255);
flags = (Cmdline_nohtl) ? MR_SHOW_OUTLINE : MR_SHOW_OUTLINE_HTL;
if (Targetbox_wire==1)
flags |=MR_NO_POLYS;
}
renderTargetSetup(&camera_eye, &camera_orient, 0.5f);
model_clear_instance(debrisp->model_num);
if(Targetbox_wire != 2) flags |= MR_NO_LIGHTING;
switch (Targetbox_wire) {
case 0:
flags |= MR_NO_LIGHTING;
break;
case 1:
model_set_outline_color(255,255,255);
flags = (Cmdline_nohtl) ? MR_SHOW_OUTLINE : MR_SHOW_OUTLINE_HTL;
flags |= MR_NO_POLYS | MR_NO_LIGHTING;
break;
case 2:
break;
case 3:
model_set_outline_color(255,255,255);
flags |= MR_NO_LIGHTING | MR_NO_TEXTURING;
break;
}
if(Targetbox_shader_effect > -1) {
flags |= MR_ANIMATED_SHADER;
opengl_shader_set_animated_effect(Targetbox_shader_effect);
}
// This calls the colour that doesn't get reset
submodel_render( debrisp->model_num, debrisp->submodel_num, &target_objp->orient, &obj_pos, flags | MR_LOCK_DETAIL | MR_NO_FOGGING );
renderTargetClose();
@@ -677,19 +707,6 @@ void HudGaugeTargetBox::renderTargetWeapon(object *target_objp)
hud_target_lod = homing_sip->hud_target_lod;
}
if (Targetbox_wire!=0)
{
int is_bright = 0;
model_set_outline_color_fast(iff_get_color_by_team_and_object(target_team, Player_ship->team, is_bright, target_objp));
flags = (Cmdline_nohtl) ? MR_SHOW_OUTLINE : MR_SHOW_OUTLINE_HTL;
if (Targetbox_wire==1)
flags |=MR_NO_POLYS;
}
// take the forward orientation to be the vector from the player to the current target
vm_vec_sub(&orient_vec, &viewed_obj->pos, &viewer_obj->pos);
vm_vec_normalize(&orient_vec);
@@ -710,12 +727,38 @@ void HudGaugeTargetBox::renderTargetWeapon(object *target_objp)
renderTargetSetup(&camera_eye, &camera_orient, View_zoom/3);
model_clear_instance(viewed_model_num);
switch (Targetbox_wire) {
case 0:
flags |= MR_NO_LIGHTING;
break;
case 1:
model_set_outline_color_fast(iff_get_color_by_team_and_object(target_team, Player_ship->team, 0, target_objp));
flags = (Cmdline_nohtl) ? MR_SHOW_OUTLINE : MR_SHOW_OUTLINE_HTL;
flags |= MR_NO_POLYS | MR_NO_LIGHTING;
break;
case 2:
break;
case 3:
model_set_outline_color_fast(iff_get_color_by_team_and_object(target_team, Player_ship->team, 0, target_objp));
flags |= MR_NO_LIGHTING | MR_NO_TEXTURING;
break;
}
if (hud_target_lod >= 0) {
model_set_detail_level(hud_target_lod);
}
if(Targetbox_wire != 2) flags |= MR_NO_LIGHTING;
if(Targetbox_shader_effect > -1) {
flags |= MR_ANIMATED_SHADER;
opengl_shader_set_animated_effect(Targetbox_shader_effect);
}
model_render( viewed_model_num, &viewed_obj->orient, &obj_pos, flags | MR_LOCK_DETAIL | MR_AUTOCENTER | MR_IS_MISSILE | MR_NO_FOGGING, -1, -1, replacement_textures);
renderTargetClose();
}
@@ -790,21 +833,40 @@ void HudGaugeTargetBox::renderTargetAsteroid(object *target_objp)
renderTargetSetup(&camera_eye, &camera_orient, 0.5f);
model_clear_instance(Asteroid_info[asteroidp->asteroid_type].model_num[pof]);
if (Targetbox_wire!=0)
{
if (time_to_impact>=0)
model_set_outline_color(255,255,255);
else
model_set_outline_color(64,64,0);
switch (Targetbox_wire) {
case 0:
flags |= MR_NO_LIGHTING;
flags = (Cmdline_nohtl) ? MR_SHOW_OUTLINE : MR_SHOW_OUTLINE_HTL;
break;
case 1:
if (time_to_impact>=0)
model_set_outline_color(255,255,255);
else
model_set_outline_color(64,64,0);
if (Targetbox_wire==1)
flags |=MR_NO_POLYS;
flags = (Cmdline_nohtl) ? MR_SHOW_OUTLINE : MR_SHOW_OUTLINE_HTL;
flags |= MR_NO_POLYS | MR_NO_LIGHTING;
break;
case 2:
break;
case 3:
if (time_to_impact>=0)
model_set_outline_color(255,255,255);
else
model_set_outline_color(64,64,0);
flags |= MR_NO_LIGHTING | MR_NO_TEXTURING;
break;
}
if(Targetbox_shader_effect > -1) {
flags |= MR_ANIMATED_SHADER;
opengl_shader_set_animated_effect(Targetbox_shader_effect);
}
if(Targetbox_wire != 2) flags |= MR_NO_LIGHTING;
model_render(Asteroid_info[asteroidp->asteroid_type].model_num[pof], &target_objp->orient, &obj_pos, flags | MR_LOCK_DETAIL | MR_NO_FOGGING );
renderTargetClose();
}
@@ -847,54 +909,60 @@ void HudGaugeTargetBox::renderTargetJumpNode(object *target_objp)
vec3d orient_vec, up_vector;
float factor, dist;
int hx, hy, w, h;
if ( target_objp->jnp->is_hidden() ) {
set_target_objnum( Player_ai, -1 );
return;
}
if ( Detail.targetview_model ) {
// take the forward orientation to be the vector from the player to the current target
vm_vec_sub(&orient_vec, &target_objp->pos, &Player_obj->pos);
vm_vec_normalize(&orient_vec);
factor = target_objp->radius*4.0f;
// use the player's up vector, and construct the viewers orientation matrix
up_vector = Player_obj->orient.vec.uvec;
vm_vector_2_matrix(&camera_orient,&orient_vec,&up_vector,NULL);
// normalize the vector from the player to the current target, and scale by a factor to calculate
// the objects position
vm_vec_copy_scale(&obj_pos,&orient_vec,factor);
renderTargetSetup(&camera_eye, &camera_orient, 0.5f);
target_objp->jnp->render( &obj_pos );
renderTargetClose();
}
renderTargetForeground();
renderTargetIntegrity(1);
setGaugeColor();
strcpy_s(outstr, target_objp->jnp->get_name_ptr());
end_string_at_first_hash_symbol(outstr);
renderString(position[0] + Name_offsets[0], position[1] + Name_offsets[1], EG_TBOX_NAME, outstr);
dist = vm_vec_dist_quick(&target_objp->pos, &Player_obj->pos);
if ( Hud_unit_multiplier > 0.0f ) { // use a different displayed distance scale
dist = dist * Hud_unit_multiplier;
}
// account for hud shaking
hx = fl2i(HUD_offset_x);
hy = fl2i(HUD_offset_y);
sprintf(outstr,XSTR( "d: %.0f", 340), dist);
hud_num_make_mono(outstr);
gr_get_string_size(&w,&h,outstr);
SCP_list<jump_node>::iterator jnp;
renderPrintf(position[0] + Dist_offsets[0]+hx, position[1] + Dist_offsets[1]+hy, EG_TBOX_DIST, outstr);
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
if(jnp->get_obj() != target_objp)
continue;
if ( jnp->is_hidden() ) {
set_target_objnum( Player_ai, -1 );
return;
}
if ( Detail.targetview_model ) {
// take the forward orientation to be the vector from the player to the current target
vm_vec_sub(&orient_vec, &target_objp->pos, &Player_obj->pos);
vm_vec_normalize(&orient_vec);
factor = target_objp->radius*4.0f;
// use the player's up vector, and construct the viewers orientation matrix
up_vector = Player_obj->orient.vec.uvec;
vm_vector_2_matrix(&camera_orient,&orient_vec,&up_vector,NULL);
// normalize the vector from the player to the current target, and scale by a factor to calculate
// the objects position
vm_vec_copy_scale(&obj_pos,&orient_vec,factor);
renderTargetSetup(&camera_eye, &camera_orient, 0.5f);
jnp->render( &obj_pos );
renderTargetClose();
}
renderTargetForeground();
renderTargetIntegrity(1);
setGaugeColor();
strcpy_s(outstr, jnp->get_name_ptr());
end_string_at_first_hash_symbol(outstr);
renderString(position[0] + Name_offsets[0], position[1] + Name_offsets[1], EG_TBOX_NAME, outstr);
dist = vm_vec_dist_quick(&target_objp->pos, &Player_obj->pos);
if ( Hud_unit_multiplier > 0.0f ) { // use a different displayed distance scale
dist = dist * Hud_unit_multiplier;
}
// account for hud shaking
hx = fl2i(HUD_offset_x);
hy = fl2i(HUD_offset_y);
sprintf(outstr,XSTR( "d: %.0f", 340), dist);
hud_num_make_mono(outstr);
gr_get_string_size(&w,&h,outstr);
renderPrintf(position[0] + Dist_offsets[0]+hx, position[1] + Dist_offsets[1]+hy, EG_TBOX_DIST, outstr);
}
}
/**
@@ -988,7 +1056,7 @@ void hud_get_target_strength(object *objp, float *shields, float *integrity)
}
HudGaugeExtraTargetData::HudGaugeExtraTargetData():
HudGauge(HUD_OBJECT_EXTRA_TARGET_DATA, HUD_TARGET_MONITOR_EXTRA_DATA, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY), 255, 255, 255)
HudGauge(HUD_OBJECT_EXTRA_TARGET_DATA, HUD_TARGET_MONITOR_EXTRA_DATA, true, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY), 255, 255, 255)
{
initDockFlashTimer();
}
@@ -996,8 +1064,6 @@ HudGauge(HUD_OBJECT_EXTRA_TARGET_DATA, HUD_TARGET_MONITOR_EXTRA_DATA, false, fal
void HudGaugeExtraTargetData::initialize()
{
initDockFlashTimer();
HudGauge::initialize();
}
void HudGaugeExtraTargetData::initBracketOffsets(int x, int y)
@@ -1393,7 +1459,8 @@ int hud_targetbox_subsystem_in_view(object *target_objp, int *sx, int *sy)
subsys = Player_ai->targeted_subsys;
if (subsys != NULL ) {
get_subsystem_pos(&subobj_pos, target_objp, subsys);
vm_vec_unrotate(&subobj_pos, &subsys->system_info->pnt, &target_objp->orient);
vm_vec_add2(&subobj_pos, &target_objp->pos);
// is it subsystem in view
if ( Player->subsys_in_view == -1 ) {
+1
View File
@@ -37,6 +37,7 @@ extern int Target_window_coords[GR_NUM_RESOLUTIONS][4];
//used to track if the player has wireframe hud target box turned on
extern int Targetbox_wire;
extern int Targetbox_shader_effect;
extern bool Lock_targetbox_mode;
class HudGaugeTargetBox: public HudGauge // HUD_TARGET_MONITOR
+1 -3
View File
@@ -205,15 +205,13 @@ void hud_wingman_status_update()
}
HudGaugeWingmanStatus::HudGaugeWingmanStatus():
HudGauge(HUD_OBJECT_WINGMAN_STATUS, HUD_WINGMEN_STATUS, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
HudGauge(HUD_OBJECT_WINGMAN_STATUS, HUD_WINGMEN_STATUS, true, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
{
}
void HudGaugeWingmanStatus::initialize()
{
initFlash();
HudGauge::initialize();
}
void HudGaugeWingmanStatus::initHeaderOffsets(int x, int y)
{
+1 -1
View File
@@ -536,7 +536,7 @@ int iff_lookup(char *iff_name)
{
// bogus
Assert(iff_name);
if(iff_name == NULL)
return -1;
Loaded 100 of 245 files, more files were not shown because too many files have changed in this diff. Show more