Merge branch 'master' into antipodes

Conflicts:
	.gitignore
	code/Makefile.am
	code/ai/ai.h
	code/ai/ai_profiles.cpp
	code/ai/ai_profiles.h
	code/ai/aibig.cpp
	code/ai/aicode.cpp
	code/ai/aiturret.cpp
	code/asteroid/asteroid.cpp
	code/asteroid/asteroid.h
	code/bmpman/bm_internal.h
	code/bmpman/bmpman.cpp
	code/bmpman/bmpman.h
	code/camera/camera.cpp
	code/camera/camera.h
	code/cfile/cfile.cpp
	code/cmdline/cmdline.cpp
	code/cmdline/cmdline.h
	code/controlconfig/controlsconfig.h
	code/controlconfig/controlsconfigcommon.cpp
	code/cutscene/movie.cpp
	code/cutscene/oggplayer.cpp
	code/debugconsole/consoleparse.cpp
	code/fred2/campaigneditordlg.cpp
	code/fred2/fred.cpp
	code/fred2/fred.rc
	code/fred2/missionsave.cpp
	code/fred2/resource.h
	code/fred2/sexp_tree.cpp
	code/fred2/sexp_tree.h
	code/fred2/shipflagsdlg.cpp
	code/fred2/shipflagsdlg.h
	code/fred2/shiptexturesdlg.cpp
	code/fred2/voiceactingmanager.cpp
	code/freespace2/freespace.cpp
	code/freespace2/freespace.rc
	code/gamehelp/contexthelp.cpp
	code/globalincs/alphacolors.cpp
	code/globalincs/alphacolors.h
	code/globalincs/version.h
	code/globalincs/vmallocator.h
	code/globalincs/windebug.cpp
	code/graphics/2d.cpp
	code/graphics/font.cpp
	code/graphics/generic.cpp
	code/graphics/generic.h
	code/graphics/grinternal.h
	code/graphics/gropengl.cpp
	code/graphics/gropengldraw.cpp
	code/graphics/gropenglextension.h
	code/graphics/gropenglpostprocessing.cpp
	code/graphics/gropenglstate.cpp
	code/graphics/gropenglstate.h
	code/graphics/gropengltexture.cpp
	code/graphics/gropengltnl.cpp
	code/hud/hud.cpp
	code/hud/hud.h
	code/hud/hudconfig.cpp
	code/hud/hudlock.cpp
	code/hud/hudmessage.cpp
	code/hud/hudparse.cpp
	code/hud/hudreticle.cpp
	code/hud/hudreticle.h
	code/hud/hudshield.cpp
	code/hud/hudsquadmsg.cpp
	code/hud/hudtarget.cpp
	code/hud/hudtarget.h
	code/hud/hudtargetbox.cpp
	code/inetfile/cftp.cpp
	code/inetfile/chttpget.cpp
	code/io/joy.cpp
	code/io/joy_ff.cpp
	code/io/key.cpp
	code/io/keycontrol.cpp
	code/io/mouse.cpp
	code/io/timer.cpp
	code/localization/localize.cpp
	code/localization/localize.h
	code/math/fvi.cpp
	code/math/vecmat.cpp
	code/menuui/credits.cpp
	code/menuui/mainhallmenu.cpp
	code/menuui/mainhallmenu.h
	code/menuui/optionsmenumulti.cpp
	code/menuui/playermenu.cpp
	code/mission/missionbriefcommon.cpp
	code/mission/missioncampaign.cpp
	code/mission/missiongoals.h
	code/mission/missionmessage.cpp
	code/mission/missionparse.cpp
	code/mission/missionparse.h
	code/missionui/missionbrief.cpp
	code/missionui/missioncmdbrief.cpp
	code/missionui/missiondebrief.cpp
	code/missionui/missionscreencommon.cpp
	code/missionui/missionshipchoice.cpp
	code/missionui/missionweaponchoice.cpp
	code/missionui/redalert.cpp
	code/missionui/redalert.h
	code/mod_table/mod_table.cpp
	code/mod_table/mod_table.h
	code/model/model.h
	code/model/modelcollide.cpp
	code/model/modelinterp.cpp
	code/model/modelread.cpp
	code/network/multi.cpp
	code/network/multi_dogfight.cpp
	code/network/multi_ingame.cpp
	code/network/multi_log.cpp
	code/network/multi_rate.cpp
	code/network/multiteamselect.cpp
	code/network/multiui.cpp
	code/network/multiutil.cpp
	code/network/stand_gui-unix.cpp
	code/object/collideshipship.cpp
	code/object/collideshipweapon.cpp
	code/object/object.cpp
	code/object/object.h
	code/object/objectsnd.cpp
	code/object/objectsort.cpp
	code/osapi/osapi.cpp
	code/osapi/osapi_unix.cpp
	code/osapi/outwnd.h
	code/parse/generic_log.cpp
	code/parse/lua.cpp
	code/parse/parselo.cpp
	code/parse/parselo.h
	code/parse/scripting.cpp
	code/parse/scripting.h
	code/parse/sexp.cpp
	code/parse/sexp.h
	code/physics/physics.cpp
	code/pilotfile/csg.cpp
	code/pilotfile/csg_convert.cpp
	code/pilotfile/pilotfile.cpp
	code/pilotfile/pilotfile_convert.h
	code/playerman/playercontrol.cpp
	code/radar/radardradis.cpp
	code/radar/radardradis.h
	code/radar/radarsetup.cpp
	code/radar/radarsetup.h
	code/ship/ship.cpp
	code/ship/ship.h
	code/ship/shipfx.cpp
	code/ship/shiphit.cpp
	code/sound/audiostr.cpp
	code/sound/ds.cpp
	code/sound/openal.cpp
	code/sound/rtvoice.cpp
	code/sound/sound.cpp
	code/sound/voicerec.cpp
	code/stats/medals.cpp
	code/stats/medals.h
	code/stats/scoring.cpp
	code/ui/ui.h
	code/weapon/beam.cpp
	code/weapon/weapon.h
	code/weapon/weapons.cpp
	code/wxfred2/aboutbox.cpp
	code/wxfred2/campaigneditor.cpp
	code/wxfred2/campaigneditor.h
	code/wxfred2/commandbriefingeditor.cpp
	code/wxfred2/debriefingeditor.cpp
	code/wxfred2/fredframe.cpp
	code/wxfred2/fredframe.h
	code/wxfred2/missionspecseditor.cpp
	code/wxfred2/missionspecseditor.h
	code/wxfred2/voiceactingmanagereditor.cpp
	code/wxfred2/wxfred.xrc
	code/wxfred2/wxfred2.cpp
	code/wxfred2/wxfred2.h
	configure.ac
	fs2open.Doxyfile
	jansson/LICENSE
	jansson/dump.c
	jansson/hashtable.c
	jansson/hashtable.h
	jansson/jansson.h
	jansson/jansson_config.h
	jansson/jansson_private.h
	jansson/load.c
	jansson/memory.c
	jansson/pack_unpack.c
	jansson/strbuffer.c
	jansson/strbuffer.h
	jansson/strconv.c
	jansson/utf.c
	jansson/utf.h
	jansson/value.c
	libpng/png.c
	libpng/png.h
	libpng/pngconf.h
	libpng/pngdebug.h
	libpng/pngerror.c
	libpng/pngget.c
	libpng/pnginfo.h
	libpng/pnglibconf.h
	libpng/pngmem.c
	libpng/pngpread.c
	libpng/pngpriv.h
	libpng/pngread.c
	libpng/pngrio.c
	libpng/pngrtran.c
	libpng/pngrutil.c
	libpng/pngset.c
	libpng/pngstruct.h
	libpng/pngtrans.c
	libpng/pngwio.c
	libpng/pngwrite.c
	libpng/pngwtran.c
	libpng/pngwutil.c
	projects/Eclipse/Freespace2/.project
	projects/MSVC_2005/Fred2.vcproj
	projects/MSVC_2005/Freespace2.sln
	projects/MSVC_2005/Freespace2.vcproj
	projects/MSVC_2005/code.vcproj
	projects/MSVC_2005/wxFRED2.vcproj
	projects/MSVC_2008/Fred2.vcproj
	projects/MSVC_2008/Freespace2.doxproj
	projects/MSVC_2008/Freespace2.vcproj
	projects/MSVC_2008/code.vcproj
	projects/MSVC_2010/Fred2.vcxproj
	projects/MSVC_2010/Freespace2.vcxproj
	projects/MSVC_2010/code.vcxproj
	projects/MSVC_2010/code.vcxproj.filters
	projects/MSVC_2010/wxFRED2.vcxproj
	projects/MSVC_2011/Fred2.vcxproj
	projects/MSVC_2011/Freespace2.vcxproj
	projects/MSVC_2011/code.vcxproj
	projects/MSVC_2011/code.vcxproj.filters
	projects/MSVC_2011/wxFRED2.vcxproj
	projects/MSVC_2013/Fred2.vcxproj
	projects/MSVC_2013/Freespace2.vcxproj
	projects/MSVC_2013/code.vcxproj
	projects/MSVC_2013/code.vcxproj.filters
	projects/MSVC_2013/libjpeg.vcxproj
	projects/MSVC_2013/liblua.vcxproj
	projects/MSVC_2013/libpng.vcxproj
	projects/MSVC_2013/wxFRED2.vcxproj
	projects/MSVC_2013/zlib.vcxproj
	projects/MSVC_6/Fred2.dsp
	projects/MSVC_6/Freespace2.dsp
	projects/MSVC_6/code.dsp
	projects/MSVC_6/wxFRED2.dsp
	projects/Xcode/English.lproj/InfoPlist.strings
	projects/Xcode/FS2_Open.xcodeproj/project.pbxproj
	projects/Xcode4/English.lproj/InfoPlist.strings
	projects/Xcode4/FS2_Open.xcodeproj/project.pbxproj
	projects/Xcode4/Frameworks.tgz
	projects/codeblocks/Freespace2/Freespace2.cbp
	zlib/adler32.c
	zlib/compress.c
	zlib/crc32.c
	zlib/crc32.h
	zlib/deflate.c
	zlib/deflate.h
	zlib/infback.c
	zlib/inffast.c
	zlib/inffixed.h
	zlib/inflate.c
	zlib/inftrees.c
	zlib/trees.c
	zlib/uncompr.c
	zlib/zconf.h
	zlib/zlib.h
	zlib/zutil.c
	zlib/zutil.h
This commit is contained in:
asarium committed 2015-04-25 16:48:43 +02:00
commit 7e77b5a67c
327 files changed
+37485 -22795

No files matched your search

+9
View File
@@ -1,5 +1,14 @@
*.o
*.a
.dirstamp
libtool
ltmain.sh
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
compile
.deps/
code/.deps/
Makefile
+4
View File
@@ -119,6 +119,10 @@ do
echo "Running autoreconf..."
autoreconf --install
)
# DIE if the subshell failed
if [ $? -ne 0 ]; then
exit 1
fi
fi
done
+1
View File
@@ -109,6 +109,7 @@ extern ai_flag_name Ai_flag_names[];
#define AIGF_PURGE (1<<5) // purge this goal next time we process
#define AIGF_GOALS_PURGED (1<<6) // this goal has already caused other goals to get purged
#define AIGF_DEPART_SOUND_PLAYED (1<<7) // Goober5000 - replacement for AL's hack ;)
#define AIGF_TARGET_OWN_TEAM (1<<8) // Goober5000 - removes standard precautions against AI ships taking traitorous actions
#define AIGF_DOCK_INDEXES_VALID (AIGF_DOCKER_INDEX_VALID|AIGF_DOCKEE_INDEX_VALID)
+2
View File
@@ -463,6 +463,8 @@ void parse_ai_profiles_tbl(const char *filename)
set_flag(profile, "$fix ai path order bug:", AIPF2_FIX_AI_PATH_ORDER_BUG, AIP_FLAG2);
set_flag(profile, "$strict turret-tagged-only targeting:", AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING, AIP_FLAG2);
// ----------
// compatibility
+1
View File
@@ -65,6 +65,7 @@
#define AIPF2_ASPECT_LOCK_COUNTERMEASURE (1 << 11)
#define AIPF2_AI_GUARDS_SPECIFIC_SHIP_IN_WING (1 << 12)
#define AIPF2_FIX_AI_PATH_ORDER_BUG (1 << 13)
#define AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING (1 << 14)
// AI Path types
#define AI_PATH_MODE_NORMAL 0
+53 -50
View File
@@ -609,8 +609,9 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float d
return;
}
vec3d *rel_pos, vec_to_enemy;
float weapon_travel_dist;
vec3d *rel_pos;
vec3d vec_to_enemy;
float weapon_travel_dist;
start_bank = Ships[aip->shipnum].weapons.current_primary_bank;
@@ -749,70 +750,72 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vec3d *f
if (!(En_objp->flags & OF_PROTECTED) || (aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP))) {
ai_choose_secondary_weapon(Pl_objp, aip, En_objp);
int current_bank = tswp->current_secondary_bank;
weapon_info *swip = &Weapon_info[tswp->secondary_bank_weapons[current_bank]];
if (current_bank > -1) {
weapon_info *swip = &Weapon_info[tswp->secondary_bank_weapons[current_bank]];
if(!(En_objp->flags & OF_PROTECTED) || ((aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) && swip->wi_flags & WIF_PUNCTURE )) { //override lockdown on protected ships when using anti subsystem weapons - Valathil
// If ship is protected and very low on hits, don't fire missiles.
if ((current_bank > -1) && (!(En_objp->flags & OF_PROTECTED) || (En_objp->hull_strength > 10*swip->damage))) {
if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) {
if (timestamp_until(swp->next_secondary_fire_stamp[current_bank]) > swip->fire_wait*1000.0f) {
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (swip->fire_wait*1000.0f));
}
}
if (timestamp_elapsed(swp->next_secondary_fire_stamp[current_bank])) {
float firing_range;
if (swip->wi_flags2 & WIF2_LOCAL_SSM)
firing_range=swip->lssm_lock_range;
else
firing_range = MIN((swip->max_speed * swip->lifetime), swip->weapon_range);
// reduce firing range of secondaries in nebula
extern int Nebula_sec_range;
if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) {
firing_range *= 0.8f;
if(!(En_objp->flags & OF_PROTECTED) || ((aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) && swip->wi_flags & WIF_PUNCTURE )) { //override lockdown on protected ships when using anti subsystem weapons - Valathil
// If ship is protected and very low on hits, don't fire missiles.
if (!(En_objp->flags & OF_PROTECTED) || (En_objp->hull_strength > 10*swip->damage)) {
if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) {
if (timestamp_until(swp->next_secondary_fire_stamp[current_bank]) > swip->fire_wait*1000.0f) {
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (swip->fire_wait*1000.0f));
}
}
float t = 0.25f; // default delay in seconds until next fire.
if (timestamp_elapsed(swp->next_secondary_fire_stamp[current_bank])) {
float firing_range;
if (swip->wi_flags2 & WIF2_LOCAL_SSM)
firing_range=swip->lssm_lock_range;
else
firing_range = MIN((swip->max_speed * swip->lifetime), swip->weapon_range);
// reduce firing range of secondaries in nebula
extern int Nebula_sec_range;
if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) {
firing_range *= 0.8f;
}
if (dist_to_enemy < firing_range*1.0f) {
float t = 0.25f; // default delay in seconds until next fire.
if (dist_to_enemy < firing_range*1.0f) {
//vm_vec_scale_add(&future_enemy_pos, enemy_pos, enemy_vel, dist_to_enemy/swip->max_speed);
//if (vm_vec_dist_quick(&future_enemy_pos, firing_pos) < firing_range * 0.8f) {
if (ai_fire_secondary_weapon(Pl_objp)) {
//vm_vec_scale_add(&future_enemy_pos, enemy_pos, enemy_vel, dist_to_enemy/swip->max_speed);
//if (vm_vec_dist_quick(&future_enemy_pos, firing_pos) < firing_range * 0.8f) {
if (ai_fire_secondary_weapon(Pl_objp)) {
int current_bank_adjusted = MAX_SHIP_PRIMARY_BANKS + current_bank;
int current_bank_adjusted = MAX_SHIP_PRIMARY_BANKS + current_bank;
if ((aip->ai_flags & AIF_UNLOAD_SECONDARIES) || (swip->burst_flags & WBF_FAST_FIRING)) {
if (swip->burst_shots > swp->burst_counter[current_bank_adjusted]) {
t = swip->burst_delay;
swp->burst_counter[current_bank_adjusted]++;
} else {
t = swip->fire_wait;
if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
swp->burst_counter[current_bank_adjusted] = myrand() % swip->burst_shots;
if ((aip->ai_flags & AIF_UNLOAD_SECONDARIES) || (swip->burst_flags & WBF_FAST_FIRING)) {
if (swip->burst_shots > swp->burst_counter[current_bank_adjusted]) {
t = swip->burst_delay;
swp->burst_counter[current_bank_adjusted]++;
} else {
swp->burst_counter[current_bank_adjusted] = 0;
t = swip->fire_wait;
if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
swp->burst_counter[current_bank_adjusted] = myrand() % swip->burst_shots;
} else {
swp->burst_counter[current_bank_adjusted] = 0;
}
}
}
} else {
if (swip->burst_shots > swp->burst_counter[current_bank_adjusted]) {
t = set_secondary_fire_delay(aip, temp_shipp, swip, true);
swp->burst_counter[current_bank_adjusted]++;
} else {
t = set_secondary_fire_delay(aip, temp_shipp, swip, false);
if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
swp->burst_counter[current_bank_adjusted] = myrand() % swip->burst_shots;
if (swip->burst_shots > swp->burst_counter[current_bank_adjusted]) {
t = set_secondary_fire_delay(aip, temp_shipp, swip, true);
swp->burst_counter[current_bank_adjusted]++;
} else {
swp->burst_counter[current_bank_adjusted] = 0;
t = set_secondary_fire_delay(aip, temp_shipp, swip, false);
if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
swp->burst_counter[current_bank_adjusted] = myrand() % swip->burst_shots;
} else {
swp->burst_counter[current_bank_adjusted] = 0;
}
}
}
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
}
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
}
//}
//}
}
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
}
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
}
}
}
+62 -50
View File
@@ -1991,7 +1991,7 @@ void evaluate_object_as_nearest_objnum(eval_nearest_objnum *eno)
dist = dist * 0.5f;
}
num_attacking = num_enemies_attacking(eno->trial_objp-Objects);
num_attacking = num_enemies_attacking(OBJ_INDEX(eno->trial_objp));
if ((sip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) || (num_attacking < eno->max_attackers)) {
if (!(sip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))){
dist *= (float) (num_attacking+2)/2.0f; // prevents lots of ships from attacking same target
@@ -2008,7 +2008,7 @@ void evaluate_object_as_nearest_objnum(eval_nearest_objnum *eno)
if (dist < eno->nearest_dist) {
eno->nearest_dist = dist;
eno->nearest_objnum = eno->trial_objp-Objects;
eno->nearest_objnum = OBJ_INDEX(eno->trial_objp);
}
}
}
@@ -2123,7 +2123,7 @@ int find_nearby_threat(int objnum, int enemy_team_mask, float range, int *count)
if (dist < nearest_dist) {
nearest_dist = dist;
nearest_objnum = objp-Objects;
nearest_objnum = OBJ_INDEX(objp);
}
}
}
@@ -2284,13 +2284,13 @@ void ai_attack_object(object *attacker, object *attacked, ship_subsys *ssp)
if (attacked == NULL) {
aip->choose_enemy_timestamp = timestamp(0);
// nebula safe
set_target_objnum(aip, find_enemy(attacker-Objects, 99999.9f, 4));
set_target_objnum(aip, find_enemy(OBJ_INDEX(attacker), 99999.9f, 4));
} else {
// check if we can see atacked in nebula
if (aip->target_objnum != attacked - Objects) {
if (aip->target_objnum != OBJ_INDEX(attacked)) {
aip->aspect_locked_time = 0.0f;
}
set_target_objnum(aip, attacked - Objects);
set_target_objnum(aip, OBJ_INDEX(attacked));
}
ai_set_goal_maybe_abort_dock(attacker, aip);
@@ -2377,7 +2377,7 @@ void ai_evade_object(object *evader, object *evaded)
aip = &Ai_info[Ships[evader->instance].ai_index];
set_target_objnum(aip, evaded - Objects);
set_target_objnum(aip, OBJ_INDEX(evaded));
aip->mode = AIM_EVADE;
}
@@ -2776,7 +2776,7 @@ void create_model_path(object *pl_objp, object *mobjp, int path_num, int subsys_
aip->path_cur = aip->path_start;
aip->path_dir = PD_FORWARD;
aip->path_objnum = mobjp-Objects;
aip->path_objnum = OBJ_INDEX(mobjp);
aip->mp_index = path_num;
aip->path_length = Ppfp - ppfp_start;
aip->path_next_check_time = timestamp(1);
@@ -2837,7 +2837,7 @@ void create_model_exit_path(object *pl_objp, object *mobjp, int path_num, int co
aip->path_cur = aip->path_start;
aip->path_dir = PD_FORWARD;
aip->path_objnum = mobjp-Objects;
aip->path_objnum = OBJ_INDEX(mobjp);
aip->mp_index = path_num;
aip->path_length = Ppfp - ppfp_start;
aip->path_next_check_time = timestamp(1);
@@ -3275,7 +3275,7 @@ void ai_do_stay_near(object *objp, object *other_objp, float dist)
aip->submode = -1;
aip->submode_start_time = Missiontime;
aip->stay_near_distance = dist;
aip->goal_objnum = other_objp-Objects;
aip->goal_objnum = OBJ_INDEX(other_objp);
aip->goal_signature = other_objp->signature;
}
@@ -3328,7 +3328,7 @@ void ai_form_on_wing(object *objp, object *goal_objp)
aip->ai_flags &= ~AIF_FORMATION_WING;
aip->ai_flags |= AIF_FORMATION_OBJECT;
aip->goal_objnum = goal_objp-Objects;
aip->goal_objnum = OBJ_INDEX(goal_objp);
ai_set_goal_maybe_abort_dock(objp, aip);
aip->ok_to_target_timestamp = timestamp(DELAY_TARGET_TIME*4); // Super extra long time until can target another ship.
@@ -4834,9 +4834,9 @@ int ai_maybe_fire_afterburner(object *objp, ai_info *aip)
else {
//If ai_aburn_use_factor is not specified, calculate a number based on the AI class. Otherwise, use that value.
if (aip->ai_aburn_use_factor == INT_MIN)
return static_rand_timed(objp-Objects, Num_ai_classes - aip->ai_class);
return static_rand_timed(OBJ_INDEX(objp), Num_ai_classes - aip->ai_class);
else
return static_rand_timed(objp-Objects, aip->ai_aburn_use_factor);
return static_rand_timed(OBJ_INDEX(objp), aip->ai_aburn_use_factor);
}
}
}
@@ -5077,7 +5077,7 @@ void evade_ship()
int rand_int;
float accel_val;
rand_int = static_rand(Pl_objp-Objects);
rand_int = static_rand(OBJ_INDEX(Pl_objp));
accel_val = (float) (((Missiontime^rand_int) >> 14) & 0x0f)/32.0f + 0.5f;
accelerate_ship(aip, accel_val);
} else
@@ -5085,13 +5085,13 @@ void evade_ship()
if ((Missiontime - aip->submode_start_time > F1_0/2) && (sip->afterburner_fuel_capacity > 0.0f)) {
float percent_left = 100.0f * shipp->afterburner_fuel / sip->afterburner_fuel_capacity;
if (percent_left > 30.0f + ((Pl_objp-Objects) & 0x0f)) {
if (percent_left > 30.0f + ((OBJ_INDEX(Pl_objp)) & 0x0f)) {
afterburners_start(Pl_objp);
if (aip->ai_profile_flags & AIPF_SMART_AFTERBURNER_MANAGEMENT) {
aip->afterburner_stop_time = (fix) (Missiontime + F1_0 + static_randf(Pl_objp-Objects) * F1_0 / 4);
aip->afterburner_stop_time = (fix) (Missiontime + F1_0 + static_randf(OBJ_INDEX(Pl_objp)) * F1_0 / 4);
} else {
aip->afterburner_stop_time = Missiontime + F1_0 + static_rand(Pl_objp-Objects)/4;
aip->afterburner_stop_time = Missiontime + F1_0 + static_rand(OBJ_INDEX(Pl_objp))/4;
}
}
}
@@ -5644,7 +5644,7 @@ int ai_fire_primary_weapon(object *objp)
float dot;
vec3d v2t;
if (!( vm_vec_mag_quick(&G_predicted_pos) < AICODE_SMALL_MAGNITUDE )) {
if ( !(vm_vec_mag_quick(&G_predicted_pos) < AICODE_SMALL_MAGNITUDE ) && !(aip->submode == SM_AVOID) ) {
if ( vm_vec_cmp(&G_predicted_pos, &G_fire_pos) ) {
vm_vec_normalized_dir(&v2t, &G_predicted_pos, &G_fire_pos);
dot = vm_vec_dot(&v2t, &objp->orient.vec.fvec);
@@ -6356,7 +6356,7 @@ void set_predicted_enemy_pos_turret(vec3d *predicted_enemy_pos, vec3d *gun_pos,
scale = (1.0f - aip->ai_accuracy) * 4.0f * (1.0f + 4.0f * (1.0f - time_enemy_in_range/(2*range_time)));
}
static_randvec(((pobjp-Objects) ^ (Missiontime >> 16)) & 7, &rand_vec);
static_randvec(((OBJ_INDEX(pobjp)) ^ (Missiontime >> 16)) & 7, &rand_vec);
vm_vec_scale_add2(predicted_enemy_pos, &rand_vec, scale);
G_collision_time = collision_time;
@@ -6469,7 +6469,7 @@ void set_predicted_enemy_pos(vec3d *predicted_enemy_pos, object *pobjp, vec3d *e
}
// get a random vector that changes slowly over time (1x / sec)
static_randvec(((pobjp-Objects) ^ (Missiontime >> 16)) & 7, &rand_vec);
static_randvec(((OBJ_INDEX(pobjp)) ^ (Missiontime >> 16)) & 7, &rand_vec);
vm_vec_scale_add2(predicted_enemy_pos, &rand_vec, scale);
@@ -6673,7 +6673,7 @@ void attack_set_accel(ai_info *aip, ship_info *sip, float dist_to_enemy, float d
if (sip_local->afterburner_fuel_capacity > 0.0f) {
percent_left = 100.0f * shipp->afterburner_fuel / sip_local->afterburner_fuel_capacity;
if (percent_left > 30.0f + ((Pl_objp-Objects) & 0x0f)) {
if (percent_left > 30.0f + ((OBJ_INDEX(Pl_objp)) & 0x0f)) {
afterburners_start(Pl_objp);
if (aip->ai_profile_flags & AIPF_SMART_AFTERBURNER_MANAGEMENT) {
float max_ab_vel;
@@ -6696,7 +6696,7 @@ void attack_set_accel(ai_info *aip, ship_info *sip, float dist_to_enemy, float d
aip->afterburner_stop_time = (fix) (Missiontime + F1_0 * ab_time);
} else {
aip->afterburner_stop_time = Missiontime + F1_0 + static_rand(Pl_objp-Objects)/4;
aip->afterburner_stop_time = Missiontime + F1_0 + static_rand(OBJ_INDEX(Pl_objp))/4;
}
}
}
@@ -7230,7 +7230,7 @@ void ai_chase_attack(ai_info *aip, ship_info *sip, vec3d *predicted_enemy_pos, f
// If ship moving slowly relative to its size, then don't attack its center point.
// How far from center we attack is based on speed, size and distance to enemy
if (En_objp->radius > En_objp->phys_info.speed) {
static_randvec(Pl_objp-Objects, &randvec);
static_randvec(OBJ_INDEX(Pl_objp), &randvec);
scale = dist_to_enemy/(dist_to_enemy + En_objp->radius) * En_objp->radius;
scale *= 0.5f * En_objp->radius/(En_objp->phys_info.speed + En_objp->radius); // scale downward by 1/2 to 1/4
vm_vec_scale_add(&new_pos, predicted_enemy_pos, &randvec, scale);
@@ -7321,7 +7321,7 @@ void ai_chase_ga(ai_info *aip, ship_info *sip)
if (ai_maybe_fire_afterburner(Pl_objp, aip)) {
if (!(Pl_objp->phys_info.flags & PF_AFTERBURNER_ON )) {
float percent_left = 100.0f * Ships[Pl_objp->instance].afterburner_fuel / sip->afterburner_fuel_capacity;
if (percent_left > 30.0f + ((Pl_objp-Objects) & 0x0f)) {
if (percent_left > 30.0f + ((OBJ_INDEX(Pl_objp)) & 0x0f)) {
afterburners_start(Pl_objp);
aip->afterburner_stop_time = Missiontime + 3*F1_0/2;
}
@@ -7531,7 +7531,7 @@ void ai_set_guard_object(object *objp, object *other_objp)
ai_set_guard_wing(objp, Ai_info[Ships[other_objp->instance].ai_index].wing);
} else {
other_objnum = other_objp-Objects;
other_objnum = OBJ_INDEX(other_objp);
aip->guard_objnum = other_objnum;
aip->guard_signature = other_objp->signature;
@@ -8238,8 +8238,12 @@ void ai_chase()
// If seeking lock, try to point directly at ship, else predict position so lasers can hit it.
// If just acquired target, or target is not in reasonable cone, don't refine believed enemy position.
if ((real_dot_to_enemy < 0.25f) || (aip->target_time < 1.0f) || (aip->ai_flags & AIF_SEEK_LOCK)) {
if ((real_dot_to_enemy < 0.25f) || (aip->target_time < 1.0f)) {
predicted_enemy_pos = enemy_pos;
} else if (aip->ai_flags & AIF_SEEK_LOCK) {
set_predicted_enemy_pos(&predicted_enemy_pos, Pl_objp, &aip->last_aim_enemy_pos, &aip->last_aim_enemy_vel, aip); // Set G_fire_pos
predicted_enemy_pos = enemy_pos;
G_predicted_pos = predicted_enemy_pos;
} else {
// Set predicted_enemy_pos.
// See if attacking a subsystem.
@@ -8763,9 +8767,9 @@ void ai_chase()
if (!(En_objp->flags & OF_PROTECTED)) {
ai_choose_secondary_weapon(Pl_objp, aip, En_objp);
int current_bank = tswp->current_secondary_bank;
weapon_info *swip = &Weapon_info[tswp->secondary_bank_weapons[tswp->current_secondary_bank]];
if (current_bank > -1) {
weapon_info *swip = &Weapon_info[tswp->secondary_bank_weapons[current_bank]];
if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) {
if (timestamp_until(swp->next_secondary_fire_stamp[current_bank]) > swip->fire_wait*1000.0f) {
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (swip->fire_wait*1000.0f));
@@ -8773,7 +8777,7 @@ void ai_chase()
}
if (timestamp_elapsed(swp->next_secondary_fire_stamp[current_bank])) {
if (tswp->current_secondary_bank >= 0) {
if (current_bank >= 0) {
float firing_range;
if (swip->wi_flags2 & WIF2_LOCAL_SSM)
@@ -9557,7 +9561,7 @@ void guard_object_was_hit(object *guard_objp, object *hitter_objp)
return;
}
}
set_target_objnum(aip, hitter_objp-Objects);
set_target_objnum(aip, OBJ_INDEX(hitter_objp));
aip->mode = AIM_CHASE;
aip->submode = SM_ATTACK;
aip->submode_start_time = Missiontime;
@@ -9582,7 +9586,7 @@ void maybe_update_guard_object(object *hit_objp, object *hitter_objp)
aip = &Ai_info[Ships[objp->instance].ai_index];
if ((aip->mode == AIM_GUARD) || (aip->active_goal == AI_ACTIVE_GOAL_DYNAMIC)) {
if (aip->guard_objnum == hit_objp-Objects) {
if (aip->guard_objnum == OBJ_INDEX(hit_objp)) {
guard_object_was_hit(objp, hitter_objp);
} else if ((aip->guard_wingnum != -1) && (aip->guard_wingnum == Ai_info[Ships[hit_objp->instance].ai_index].wing)) {
guard_object_was_hit(objp, hitter_objp);
@@ -9609,7 +9613,7 @@ int ai_guard_find_nearby_bomb(object *guarding_objp, object *guarded_objp)
wp = &Weapons[bomb_objp->instance];
wip = &Weapon_info[wp->weapon_info_index];
if ( !(wip->wi_flags & WIF_BOMB) ) {
if ( !((wip->wi_flags & WIF_BOMB) || (wip->wi_flags3 & WIF3_FIGHTER_INTERCEPTABLE)) ) {
continue;
}
@@ -9802,7 +9806,7 @@ void ai_big_guard()
float radius, extended_z;
// get random [0 to 1] based on OBJNUM
float objval = static_randf(Pl_objp-Objects);
float objval = static_randf(OBJ_INDEX(Pl_objp));
// get position relative to cylinder of guard_objp
extended_z = get_cylinder_points(Pl_objp, guard_objp, &axis_pt, &r_vec, &radius);
@@ -9828,7 +9832,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( (OBJ_INDEX(Pl_objp)) ^ (Missiontime >> (22 + time_choose)) );
// get r from guard_ship
float cur_guard_rad = vm_vec_dist(&Pl_objp->pos, &axis_pt);
@@ -9940,7 +9944,7 @@ void ai_big_guard()
}
// Periodically, scan for a nearby ship to attack.
if (((AI_FrameCount ^ (Pl_objp-Objects)) & 0x07) == 0) {
if (((AI_FrameCount ^ (OBJ_INDEX(Pl_objp))) & 0x07) == 0) {
ai_guard_find_nearby_object();
}
}
@@ -10011,7 +10015,7 @@ void ai_guard()
vec3d v2g, rvec;
// get random [0 to 1] based on OBJNUM
objval = static_randf(Pl_objp-Objects);
objval = static_randf(OBJ_INDEX(Pl_objp));
switch (aip->submode) {
case AIS_GUARD_STATIC:
@@ -10143,7 +10147,7 @@ void ai_guard()
}
// Periodically, scan for a nearby ship to attack.
if (((AI_FrameCount ^ (Pl_objp-Objects)) & 0x07) == 0) {
if (((AI_FrameCount ^ (OBJ_INDEX(Pl_objp))) & 0x07) == 0) {
ai_guard_find_nearby_object();
}
break;
@@ -10534,7 +10538,7 @@ void ai_stay_near()
goal_objp = &Objects[goal_objnum];
// Make not all ships pursue same point.
static_randvec(Pl_objp-Objects, &rand_vec);
static_randvec(OBJ_INDEX(Pl_objp), &rand_vec);
// Make sure point is in front hemisphere (relative to Pl_objp's position.
vm_vec_sub(&vec_to_goal, &goal_objp->pos, &Pl_objp->pos);
@@ -12099,10 +12103,8 @@ void ai_maybe_launch_cmeasure(object *objp, ai_info *aip)
if ((aip->nearest_locked_object != -1) && (Objects[aip->nearest_locked_object].type == OBJ_WEAPON)) {
object *weapon_objp;
weapon *weaponp;
weapon_objp = &Objects[aip->nearest_locked_object];
weaponp = &Weapons[weapon_objp->instance];
if ((dist = vm_vec_dist_quick(&objp->pos, &weapon_objp->pos)) < weapon_objp->phys_info.speed*2.0f) {
@@ -12458,6 +12460,7 @@ void maybe_evade_dumbfire_weapon(ai_info *aip)
if (aip->submode == SM_ATTACK_FOREVER) {
return;
}
break;
case AIM_GUARD:
// If in guard mode and far away from guard object, don't pursue guy that hit me.
if ((aip->guard_objnum != -1) && (aip->guard_signature == Objects[aip->guard_objnum].signature)) {
@@ -13846,8 +13849,17 @@ int ai_need_new_target(object *pl_objp, int target_objnum)
if ( objp->type == OBJ_SHIP ) {
if ( Ships[objp->instance].flags & SF_DYING ) {
return 1;
} else if (Ships[objp->instance].team == Ships[pl_objp->instance].team)
} else if (Ships[objp->instance].team == Ships[pl_objp->instance].team) {
// Goober5000 - targeting the same team is allowed if pl_objp is going bonkers
ai_info *pl_aip = &Ai_info[Ships[pl_objp->instance].ai_index];
if (pl_aip->active_goal != AI_GOAL_NONE && pl_aip->active_goal != AI_ACTIVE_GOAL_DYNAMIC) {
if (pl_aip->goals[pl_aip->active_goal].flags & AIGF_TARGET_OWN_TEAM) {
return 0;
}
}
return 1;
}
}
return 0;
@@ -14072,7 +14084,7 @@ void ai_frame(int objnum)
}
if ((En_objp != NULL) && (En_objp->pos.xyz.x == Pl_objp->pos.xyz.x) && (En_objp->pos.xyz.y == Pl_objp->pos.xyz.y) && (En_objp->pos.xyz.z == Pl_objp->pos.xyz.z)) {
mprintf(("Warning: Object and its enemy have same position. Object #%i\n", Pl_objp-Objects));
mprintf(("Warning: Object and its enemy have same position. Object #%i\n", OBJ_INDEX(Pl_objp)));
En_objp = NULL;
}
@@ -14218,7 +14230,7 @@ void ai_process( object * obj, int ai_index, float frametime )
Assert( ai_index >= 0 );
AI_frametime = frametime;
if (obj-Objects <= Last_ai_obj) {
if (OBJ_INDEX(obj) <= Last_ai_obj) {
AI_FrameCount++;
}
@@ -14264,7 +14276,7 @@ void ai_process( object * obj, int ai_index, float frametime )
}
}
Last_ai_obj = obj-Objects;
Last_ai_obj = OBJ_INDEX(obj);
}
/**
@@ -14999,7 +15011,7 @@ void ai_ship_hit(object *objp_ship, object *hit_objp, vec3d *hitpos, int shield_
if (shipp->team == Ships[hit_objp->instance].team) // Don't have AI react to collisions between teammates.
return;
objp_hitter = hit_objp;
hitter_objnum = hit_objp-Objects;
hitter_objnum = OBJ_INDEX(hit_objp);
} else {
Int3(); // Hmm, what kind of object hit this if not weapon or ship? Get MikeK.
return;
@@ -15065,7 +15077,7 @@ 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 ((is_ignore_object(aip, OBJ_INDEX(objp_hitter))) && (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.
@@ -15086,14 +15098,14 @@ void ai_ship_hit(object *objp_ship, object *hit_objp, vec3d *hitpos, int shield_
if ( ai_big_maybe_enter_strafe_mode(objp_ship, OBJ_INDEX(hit_objp), 1) )
return;
}
break;
case AIM_GUARD:
// If in guard mode and far away from guard object, don't pursue guy that hit me.
if ((aip->guard_objnum != -1) && (aip->guard_signature == Objects[aip->guard_objnum].signature)) {
if (vm_vec_dist_quick(&objp_ship->pos, &Objects[aip->guard_objnum].pos) > 500.0f) {
return;
}
if ((aip->guard_objnum != -1) && (aip->guard_signature == Objects[aip->guard_objnum].signature)) {
if (vm_vec_dist_quick(&objp_ship->pos, &Objects[aip->guard_objnum].pos) > 500.0f) {
return;
}
}
case AIM_STILL:
case AIM_STAY_NEAR:
// Note: Dealt with above, at very top. case AIM_PLAY_DEAD:
+10
View File
@@ -979,6 +979,16 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
aigp->priority = MAX_GOAL_PRIORITY;
}
// Goober5000 - we now have an extra optional chase argument to allow chasing our own team
if ( op == OP_AI_CHASE || op == OP_AI_CHASE_WING || op == OP_AI_DISABLE_SHIP || op == OP_AI_DISARM_SHIP ) {
if ((CDDDR(node) != -1) && is_sexp_true(CDDDR(node)))
aigp->flags |= AIGF_TARGET_OWN_TEAM;
}
if ( op == OP_AI_DESTROY_SUBSYS ) {
if ((CDDDDR(node) != -1) && is_sexp_true(CDDDDR(node)))
aigp->flags |= AIGF_TARGET_OWN_TEAM;
}
// Goober5000 - since none of the goals act on the actor,
// don't assign the goal if the actor's goal target is itself
if (aigp->target_name != NULL && !strcmp(aigp->target_name, actor_name))
+88 -21
View File
@@ -354,6 +354,54 @@ bool turret_weapon_has_flags2(ship_weapon *swp, int flags)
return false;
}
/**
* Just gloms all the flags from all the weapons into one variable. More efficient if all you need to do is test for the existence of a flag.
*/
int turret_weapon_aggregate_flags(ship_weapon *swp)
{
Assert(swp != NULL);
int i = 0, flags = 0;
for (i = 0; i < swp->num_primary_banks; i++)
{
if (swp->primary_bank_weapons[i] >= 0) {
flags |= Weapon_info[swp->primary_bank_weapons[i]].wi_flags;
}
}
for (i = 0; i < swp->num_secondary_banks; i++)
{
if (swp->secondary_bank_weapons[i] >= 0) {
flags |= Weapon_info[swp->secondary_bank_weapons[i]].wi_flags;
}
}
return flags;
}
/**
* Just gloms all the flags from all the weapons into one variable. More efficient if all you need to do is test for the existence of a flag.
*/
int turret_weapon_aggregate_flags2(ship_weapon *swp)
{
Assert(swp != NULL);
int i = 0, flags2 = 0;
for (i = 0; i < swp->num_primary_banks; i++)
{
if (swp->primary_bank_weapons[i] >= 0) {
flags2 |= Weapon_info[swp->primary_bank_weapons[i]].wi_flags2;
}
}
for (i = 0; i < swp->num_secondary_banks; i++)
{
if (swp->secondary_bank_weapons[i] >= 0) {
flags2 |= Weapon_info[swp->secondary_bank_weapons[i]].wi_flags2;
}
}
return flags2;
}
/**
* Returns true if any of the weapons in swp have the subtype specified
*
@@ -479,7 +527,7 @@ int valid_turret_enemy(object *objp, object *turret_parent)
}
// don't shoot at ships without collision check
if (sip->flags & SIF_NO_COLLIDE) {
if (!(objp->flags & OF_COLLIDES)) {
return 0;
}
@@ -501,7 +549,11 @@ int valid_turret_enemy(object *objp, object *turret_parent)
weapon *wp = &Weapons[objp->instance];
weapon_info *wip = &Weapon_info[wp->weapon_info_index];
if ( (!(wip->wi_flags & WIF_BOMB) && !(Ai_info[Ships[turret_parent->instance].ai_index].ai_profile_flags & AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY) ) ) {
if (wip->subtype == WP_LASER && !(wip->wi_flags3 & WIF3_TURRET_INTERCEPTABLE)) { // If the thing can't be shot down, don't try. -MageKing17
return 0;
}
if ( (!((wip->wi_flags & WIF_BOMB) || (wip->wi_flags3 & WIF3_TURRET_INTERCEPTABLE)) && !(Ai_info[Ships[turret_parent->instance].ai_index].ai_profile_flags & AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY) ) ) {
return 0;
}
@@ -598,9 +650,15 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
}
}
// check if turret flagged to only target tagged ships
// check if turret flagged to only target tagged ships
// Note: retail behaviour was turrets with tagged-only could fire at bombs
// and could fire their spawn weapons
// this check is almost redundant; see the almost identical check in ai_fire_from_turret
// however if this is removed turrets still track targets but don't fire at them (which looks silly)
if (eeo->eeo_flags & EEOF_TAGGED_ONLY) {
if (!ship_is_tagged(objp)) {
if (!ship_is_tagged(objp) &&
( (The_mission.ai_profile->flags2 & AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING) ||
( !(objp->type == OBJ_WEAPON) && !(turret_weapon_has_flags(&eeo->turret_subsys->weapons, WIF_SPAWN))) )) {
return;
}
}
@@ -1049,7 +1107,7 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
objp = &Objects[mo->objnum];
Assert(objp->type == OBJ_WEAPON);
if (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_BOMB)
if ((Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_BOMB) || (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags3 & WIF3_TURRET_INTERCEPTABLE))
{
evaluate_obj_as_target(objp, &eeo);
}
@@ -1826,8 +1884,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
}
// now do anything else
else {
for (int i=0; i < wip->shots; i++)
{
for (int i = 0; i < wip->shots; i++) {
// zookeeper - Firepoints should cycle normally between shots,
// so we need to get the position info separately for each shot
ship_get_global_turret_gun_info(&Objects[parent_objnum], turret, turret_pos, turret_fvec, 1, NULL);
@@ -1837,9 +1894,9 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
//nprintf(("AI", "Turret_time_enemy_in_range = %7.3f\n", ss->turret_time_enemy_in_range));
if (weapon_objnum != -1) {
objp=&Objects[weapon_objnum];
wp=&Weapons[objp->instance];
wip=&Weapon_info[wp->weapon_info_index];
objp = &Objects[weapon_objnum];
wp = &Weapons[objp->instance];
wip = &Weapon_info[wp->weapon_info_index];
parent_ship->last_fired_turret = turret;
turret->last_fired_weapon_info_index = wp->weapon_info_index;
@@ -1852,7 +1909,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
Script_system.RunCondition(CHA_ONTURRETFIRED, 0, NULL, &Objects[parent_objnum]);
// if the gun is a flak gun
if(wip->wi_flags & WIF_FLAK){
if (wip->wi_flags & WIF_FLAK) {
// show a muzzle flash
flak_muzzle_flash(turret_pos, turret_fvec, &Objects[parent_ship->objnum].phys_info, turret_weapon_class);
@@ -1868,8 +1925,10 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
{
flak_set_range(objp, flak_range_override);
}
} else if(wip->muzzle_flash > -1) {
mflash_create(turret_pos, turret_fvec, &Objects[parent_ship->objnum].phys_info, Weapon_info[turret_weapon_class].muzzle_flash);
}
// otherwise just do mflash if the weapon has it
else if (wip->muzzle_flash >= 0) {
mflash_create(turret_pos, turret_fvec, &Objects[parent_ship->objnum].phys_info, wip->muzzle_flash);
}
// in multiplayer (and the master), then send a turret fired packet.
@@ -1959,6 +2018,11 @@ void turret_swarm_fire_from_turret(turret_swarm_info *tsi)
Weapons[Objects[weapon_objnum].instance].turret_subsys = tsi->turret;
Weapons[Objects[weapon_objnum].instance].target_num = tsi->turret->turret_enemy_objnum;
// muzzle flash?
if (Weapon_info[tsi->weapon_class].muzzle_flash >= 0) {
mflash_create(&turret_pos, &turret_fvec, &Objects[tsi->parent_objnum].phys_info, Weapon_info[tsi->weapon_class].muzzle_flash);
}
// maybe sound
if ( Weapon_info[tsi->weapon_class].launch_snd != -1 ) {
// Don't play turret firing sound if turret sits on player ship... it gets annoying.
@@ -1966,8 +2030,7 @@ void turret_swarm_fire_from_turret(turret_swarm_info *tsi)
snd_play_3d( &Snds[Weapon_info[tsi->weapon_class].launch_snd], &turret_pos, &View_position );
}
}
if(Weapon_info[tsi->weapon_class].muzzle_flash > -1)
mflash_create(&turret_pos, &turret_fvec, &Objects[tsi->parent_objnum].phys_info, Weapon_info[tsi->weapon_class].muzzle_flash);
// in multiplayer (and the master), then send a turret fired packet.
if ( MULTIPLAYER_MASTER && (weapon_objnum != -1) ) {
int subsys_index;
@@ -2054,7 +2117,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
// (NOTE: this will probably get changed by other parts of the code (swarming, beams, etc) to be
// a more accurate time, but we need to give it a long enough time for the other parts of the code
// to change the timestamp before it gets acted upon - taylor)
ss->turret_animation_done_time = timestamp(1000);
ss->turret_animation_done_time = timestamp(200);
} else {
return;
}
@@ -2224,6 +2287,8 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
}
}
bool tagged_only = ((wip->wi_flags2 & WIF2_TAGGED_ONLY) || (ss->weapons.flags & SW_FLAG_TAGGED_ONLY));
if (lep->type == OBJ_SHIP) {
// Check if we're targeting a protected ship
if (lep->flags & OF_PROTECTED) {
@@ -2256,14 +2321,16 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
ss->turret_time_enemy_in_range = 0.0f;
continue;
}
// Check if weapon or turret is set to tagged-only
// must check here in case turret has multiple weapons and not all are tagged-only
else if (!ship_is_tagged(lep) && tagged_only) {
continue;
}
}
else
{
//can't tag anything else, other than asteroids
//but we don't want to waste this type of
//weaponary on asteroids now do we?
if ((wip->wi_flags2 & WIF2_TAGGED_ONLY) || (ss->weapons.flags & SW_FLAG_TAGGED_ONLY))
{
// check tagged-only for non-ship targets
if (tagged_only && (!(lep->type == OBJ_WEAPON) || (The_mission.ai_profile->flags2 & AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING))) {
continue;
}
}
-2
View File
@@ -301,7 +301,6 @@ int pack_key_frame(ubyte *frame, ubyte *save, long size, long max, int compress_
Assert(packed_size == (save-dest_start) );
return packed_size;
break;
}
default:
@@ -467,7 +466,6 @@ int pack_frame(ubyte *frame, ubyte *frame2, ubyte *save, long size, long max, in
Assert(packed_size == (save-dest_start) );
return packed_size;
break;
}
default:
+2 -2
View File
@@ -861,7 +861,7 @@ void asteroid_maybe_reposition(object *objp, asteroid_field *asfieldp)
dist = vm_vec_normalized_dir(&vec_to_asteroid, &objp->pos, &Eye_position);
dot = vm_vec_dot(&Eye_matrix.vec.fvec, &vec_to_asteroid);
if ((dot < 0.7f) || (dist > 3000.0f)) {
if ( (dot < 0.7f) || (dist > asfieldp->bound_rad) ) {
if (Num_asteroids > MAX_ASTEROIDS-10) {
objp->flags |= OF_SHOULD_BE_DEAD;
} else {
@@ -872,7 +872,7 @@ void asteroid_maybe_reposition(object *objp, asteroid_field *asfieldp)
dist = vm_vec_normalized_dir(&vec_to_asteroid, &objp->pos, &Eye_position);
dot = vm_vec_dot(&Eye_matrix.vec.fvec, &vec_to_asteroid);
if (( dot > 0.7f) && (dist < 3000.0f)) {
if ( (dot > 0.7f) && (dist < (asfieldp->bound_rad * 1.3f)) ) {
// player would see asteroid pop out other side, so reverse velocity instead of wrapping
objp->pos = old_asteroid_pos;
vm_vec_copy_scale(&objp->phys_info.vel, &old_vel, -1.0f);
+1
View File
@@ -124,6 +124,7 @@ typedef enum {
typedef struct asteroid_field {
vec3d min_bound; // Minimum range of field.
vec3d max_bound; // Maximum range of field.
float bound_rad;
int has_inner_bound;
vec3d inner_min_bound;
vec3d inner_max_bound;
+54
View File
@@ -0,0 +1,54 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
/**
* @file bm_examples.cpp
* This file contains example code for using bmpman.
*/
#include "bmpman/bmpman.h"
#include "graphics/2d.h"
void bm_create_example() {
static int test_inited = 0;
static int test_bmp;
static uint test_bmp_data[128 * 64];
if (!test_inited) {
test_inited = 1;
// Create the new bitmap and fill in its data.
// When you're done with it completely, call
// bm_release to free up the bitmap handle
test_bmp = bm_create(32, 128, 64, test_bmp_data);
int i, j;
for (i = 0; i < 64; i++) {
for (j = 0; j < 64; j++) {
uint r = i * 4;
test_bmp_data[j + i * 128] = r;
}
}
}
// page out the data, so that the next bm_lock will convert the new data to
// the correct bpp
bm_unload(test_bmp);
// put in new data
int x, y;
gr_reset_clip();
for (y = 0; y < 64; y++) {
for (x = 0; x < 128; x++) {
test_bmp_data[y * 128 + x] = 15;
}
}
// Draw the bitmap, the upper left corner is the origin (0, 0)
gr_set_bitmap(test_bmp);
gr_bitmap(0, 0);
}
+77 -81
View File
@@ -1,121 +1,119 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
#ifndef __BM_INTERNAL_H__
#define __BM_INTERNAL_H__
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
/**
* @file bm_internal.h
* These are functions and types used by bmpman and a few others.
*
* @details It is a "protected" header that requires BMPMAN_INTERNAL to be defined before it can be included. This is to
* provide a small measure of safety since this functions can cause problems if not used correctly
*/
// extra check to make sure this stuff doesn't end up in normal files
// don't use any of this unless BMPMAN_INTERNAL is defined
#ifdef BMPMAN_INTERNAL
#ifndef BMPMAN_INTERNAL
#error The file header "bmpman/bm_internal.h" is protected. Make sure you know what you are doing!
#endif
#include "globalincs/pstypes.h"
#include "bmpman/bmpman.h"
#include "globalincs/pstypes.h"
// Bitmap types
enum BM_TYPE
{
BM_TYPE_NONE = 0, //!< No type
BM_TYPE_USER, //!< in-memory
BM_TYPE_PCX, //!< PCX
BM_TYPE_TGA, //!< 16 or 32 bit targa
BM_TYPE_DDS, //!< generic identifier for DDS
BM_TYPE_PNG, //!< PNG
BM_TYPE_JPG, //!< 32 bit jpeg
BM_TYPE_ANI, //!< in-house ANI format
BM_TYPE_EFF, //!< specifies any type of animated image, the EFF itself is just text
// no-type ( used in: bm_bitmaps[i].type )
#define BM_TYPE_NONE 0
// in-memory type ( used in: bm_bitmaps[i].type )
#define BM_TYPE_USER 1
// file-type types ( used in: bm_bitmaps[i].type )
#define BM_TYPE_PCX 2
#define BM_TYPE_TGA 3 // 16 or 32 bit targa
#define BM_TYPE_DDS 4 // generic identifier for DDS
#define BM_TYPE_PNG 5 // PNG
#define BM_TYPE_JPG 6 // 32 bit jpeg
#define BM_TYPE_ANI 7 // in-house ANI format
#define BM_TYPE_EFF 8 // specifies any type of animated image, the EFF itself is just text
// c-type types ( used in: bm_bitmaps[i].c_type )
#define BM_TYPE_DXT1 9 // 24 bit with switchable alpha (compressed)
#define BM_TYPE_DXT3 10 // 32 bit with 4 bit alpha (compressed)
#define BM_TYPE_DXT5 11 // 32 bit with 8 bit alpha (compressed)
#define BM_TYPE_CUBEMAP_DDS 12 // generic DDS cubemap (uncompressed cubemap surface)
#define BM_TYPE_CUBEMAP_DXT1 13 // 24-bit cubemap (compressed cubemap surface)
#define BM_TYPE_CUBEMAP_DXT3 14 // 32-bit cubemap (compressed cubemap surface)
#define BM_TYPE_CUBEMAP_DXT5 15 // 32-bit cubemap (compressed cubemap surface)
// special types ( used in: bm_bitmaps[i].type )
#define BM_TYPE_RENDER_TARGET_STATIC 16 // 24/32 bit setup internally as a static render target
#define BM_TYPE_RENDER_TARGET_DYNAMIC 17 // 24/32 bit setup internally as a dynamic render target
// special types
BM_TYPE_RENDER_TARGET_STATIC, //!< 24/32 bit setup internally as a static render target
BM_TYPE_RENDER_TARGET_DYNAMIC, //!< 24/32 bit setup internally as a dynamic render target
// Compressed types (bitmap.c_type)
BM_TYPE_DXT1, //!< 24 bit with switchable alpha
BM_TYPE_DXT3, //!< 32 bit with 4 bit alpha
BM_TYPE_DXT5, //!< 32 bit with 8 bit alpha
BM_TYPE_CUBEMAP_DDS, //!< generic DDS cubemap (uncompressed cubemap surface)
BM_TYPE_CUBEMAP_DXT1, //!< 24-bit cubemap (compressed cubemap surface)
BM_TYPE_CUBEMAP_DXT3, //!< 32-bit cubemap (compressed cubemap surface)
BM_TYPE_CUBEMAP_DXT5 //!< 32-bit cubemap (compressed cubemap surface)
};
/// Moved from cpp file ///////////////////
// Consider these 'protected' structures and functions that should only be used by special bitmap functions
typedef union bm_extra_info {
union bm_extra_info {
struct {
// Stuff needed for animations
int first_frame; // used for animations -- points to index of first frame
int num_frames; // used for animation -- number of frames in the animation
int keyframe; // used for animation -- keyframe info
ubyte fps; // used for animation -- frames per second
int first_frame; //!< used for animations -- points to index of first frame
int num_frames; //!< used for animations -- number of frames in the animation
int keyframe; //!< used for animations -- keyframe info
ubyte fps; //!< used for animations -- frames per second
struct {
// stuff for static animations
ubyte type; // type for individual images
char filename[MAX_FILENAME_LEN]; // filename for individual images
ubyte type; //!< type for individual images
char filename[MAX_FILENAME_LEN]; //!< filename for individual images
} eff;
} ani;
struct {
// Stuff needed for user bitmaps
void *data; // For user bitmaps, this is where the data comes from
ubyte bpp; // For user bitmaps, this is what format the data is
ubyte flags; // Flags passed to bm_create
void* data; //!< For user bitmaps, this is where the data comes from
ubyte bpp; //!< For user bitmaps, this is what format the data is
ubyte flags; //!< For user bitmaps, Flags passed to bm_create
} user;
} bm_extra_info;
};
typedef struct bitmap_entry {
struct bitmap_entry {
// identification
char filename[MAX_FILENAME_LEN]; // filename for this bitmap
char filename[MAX_FILENAME_LEN]; //!< filename for this bitmap
uint signature; // a unique signature identifying the data
uint palette_checksum; // checksum used to be sure bitmap is in current palette
int handle; // Handle = id*MAX_BITMAPS + bitmapnum
int last_used; // When this bitmap was last used
uint signature; //!< a unique signature identifying the data
uint palette_checksum; //!< checksum used to be sure bitmap is in current palette
int handle; //!< Handle = id*MAX_BITMAPS + bitmapnum
int last_used; //!< When this bitmap was last used
ubyte type; // PCX, USER, ANI, etc
ubyte comp_type; // What sort of compressed type, BM_TYPE_NONE if not compressed
signed char ref_count; // Number of locks on bitmap. Can't unload unless ref_count is 0.
ubyte type; //!< PCX, USER, ANI, etc
ubyte comp_type; //!< What sort of compressed type, BM_TYPE_NONE if not compressed
signed char ref_count; //!< Number of locks on bitmap. Can't unload unless ref_count is 0.
int dir_type; // which directory this was loaded from (to skip other locations with same name)
int dir_type; //!< which directory this was loaded from (to skip other locations with same name)
// compressed bitmap stuff (.dds) - RT please take a look at this and tell me if we really need it
int mem_taken; // How much memory does this bitmap use? - UnknownPlayer
int num_mipmaps; // number of mipmap levels, we need to read all of them
int mem_taken; //!< How much memory does this bitmap use? - UnknownPlayer
int num_mipmaps; //!< number of mipmap levels, we need to read all of them
// Stuff to keep track of usage
ubyte preloaded; // If set, then this was loaded from the lst file
int preload_count; // how many times this gets used in game, for unlocking
ubyte used_flags; // What flags it was accessed thru
int load_count;
ubyte preloaded; //!< If set, then this was loaded from the lst file
int preload_count; //!< how many times this gets used in game, for unlocking
ubyte used_flags; //!< What flags it was accessed thru
int load_count;
// Bitmap info
bitmap bm;
bitmap bm; //!< Bitmap info
// Data for animations and user bitmaps
bm_extra_info info;
bm_extra_info info; //!< Data for animations and user bitmaps
#ifdef BMPMAN_NDEBUG
// bookeeping
ubyte used_last_frame; // If set, then it was used last frame
ubyte used_this_frame; // If set, then it was used this frame
int data_size; // How much data this bitmap uses
int used_count; // How many times it was accessed
ubyte used_last_frame; // If set, then it was used last frame
ubyte used_this_frame; // If set, then it was used this frame
int data_size; // How much data this bitmap uses
int used_count; // How many times it was accessed
#endif
} bitmap_entry;
};
extern bitmap_entry bm_bitmaps[MAX_BITMAPS];
// image specific lock functions
void bm_lock_ani( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
void bm_lock_dds( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
@@ -126,6 +124,4 @@ void bm_lock_tga( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyt
void bm_lock_user( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
#endif // BMPMAN_INTERNAL
#endif // __BM_INTERNAL_H__
+1742 -1940
View File
File diff suppressed because it is too large. Load diff
+550 -201
View File
@@ -1,288 +1,637 @@
#ifndef _BMPMAN_H
#define _BMPMAN_H
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
*/
/**
* @file bmpman.h
* Header file for the bitmap manager (bmpman)
*/
/**
* @example bm_examples.cpp
* @brief This containes examples of bmpman usage
*/
#ifndef _BMPMAN_H
#define _BMPMAN_H
#include "globalincs/pstypes.h"
#include "cfile/cfile.h"
#include "globalincs/pstypes.h"
#ifndef NDEBUG
#define BMPMAN_NDEBUG
#define BMPMAN_NDEBUG //!< Enables BMPMAN debugging code
#endif
#define MAX_BITMAPS 4750 // How many bitmaps the game can handle
// NOTE: MAX_BITMAPS shouldn't need to be bumped again. With the fixed bm_release() and it's
// proper use even the largest missions should stay under this number. With the largest retail
// missions and wasteful content we should still have about 20% of the slots free. If it still
// goes over then it's something the artists need to fix. For instance the Terran Mara fighter,
// with -spec and -glow and using the Shinepack, needs 117 bitmap slots alone. 111 of those is
// just for the glowmaps. This number can be greatly reduced if the number of ani frames for
// another LOD than LOD0 has fewer or no ani frames. A 37 frame glow ani for LOD2 is little
// more than a waste of resources. Future reports of texture corruption should be initially
// approached with content as the cause and not code. If anything we could/should reduce
// MAX_BITMAPS in the future. Where it's at now should accomidate even the largest mods.
// -- Taylor
/**
* @defgroup BMPMAN_CONSTANTS Macro constants used in/with bmpman.h
*
* @{
*/
/**
* @brief How many bitmaps the game can handle
*
* @attention MAX_BITMAPS shouldn't need to be bumped again. With the fixed bm_release() and it's proper use even the
* largest missions should stay under this number. With the largest retail missions and wasteful content we should
* still have about 20% of the slots free. If it still goes over then it's something the artists need to fix.
* For instance the Terran Mara fighter, with -spec and -glow and using the Shinepack, needs 117 bitmap slots alone.
* 111 of those is just for the glowmaps. This number can be greatly reduced if the number of ani frames for another
* LOD than LOD0 has fewer or no ani frames. A 37 frame glow ani for LOD2 is little more than a waste of resources.
* Future reports of texture corruption should be initially approached with content as the cause and not code.
* If anything we could/should reduce MAX_BITMAPS in the future. Where it's at now should accomidate even the
* largest mods. -- Taylor
*/
#define MAX_BITMAPS 4750
#define BMP_AABITMAP (1<<0) // antialiased bitmap
#define BMP_TEX_XPARENT (1<<1) // transparent texture
#define BMP_TEX_OTHER (1<<2) // so we can identify all "normal" textures
#define BMP_TEX_DXT1 (1<<3) // dxt1 compressed 8r8g8b1a (24bit)
#define BMP_TEX_DXT3 (1<<4) // dxt3 compressed 8r8g8b4a (32bit)
#define BMP_TEX_DXT5 (1<<5) // dxt5 compressed 8r8g8b8a (32bit)
#define BMP_TEX_CUBEMAP (1<<6) // a texture made for cubic environment map
// Flag positions for bitmap.flags
// ***** NOTE: bitmap.flags is an 8-bit value, no more BMP_TEX_* flags can be added unless the type is changed!! ******
#define BMP_AABITMAP (1<<0) //!< antialiased bitmap
#define BMP_TEX_XPARENT (1<<1) //!< transparent texture
#define BMP_TEX_OTHER (1<<2) //!< so we can identify all "normal" textures
#define BMP_TEX_DXT1 (1<<3) //!< dxt1 compressed 8r8g8b1a (24bit)
#define BMP_TEX_DXT3 (1<<4) //!< dxt3 compressed 8r8g8b4a (32bit)
#define BMP_TEX_DXT5 (1<<5) //!< dxt5 compressed 8r8g8b8a (32bit)
#define BMP_TEX_CUBEMAP (1<<6) //!< a texture made for cubic environment map
//compressed texture types
#define BMP_TEX_COMP ( BMP_TEX_DXT1 | BMP_TEX_DXT3 | BMP_TEX_DXT5 )
// Combined flags
#define BMP_TEX_COMP ( BMP_TEX_DXT1 | BMP_TEX_DXT3 | BMP_TEX_DXT5 ) //!< Compressed textures
#define BMP_TEX_NONCOMP ( BMP_TEX_XPARENT | BMP_TEX_OTHER ) //!< Non-compressed textures
#define BMP_TEX_ANY ( BMP_TEX_COMP | BMP_TEX_NONCOMP ) //!< Any texture
//non compressed textures
#define BMP_TEX_NONCOMP ( BMP_TEX_XPARENT | BMP_TEX_OTHER )
// Flag positions for bitmap.type
#define BMP_FLAG_RENDER_TARGET_STATIC (1<<0) //!< Texture is a static type
#define BMP_FLAG_RENDER_TARGET_DYNAMIC (1<<1) //!< Texture is a dynamic type (animation)
#define BMP_FLAG_CUBEMAP (1<<2) //!< Texture is a cubemap
// any texture type
#define BMP_TEX_ANY ( BMP_TEX_COMP | BMP_TEX_NONCOMP )
/**
* @}
*/
#define BMP_FLAG_RENDER_TARGET_STATIC (1<<0)
#define BMP_FLAG_RENDER_TARGET_DYNAMIC (1<<1)
#define BMP_FLAG_CUBEMAP (1<<2)
struct bitmap
{
short w; //!< Width, in number of pixels
short h; //!< Height, in number of pixels
short rowsize; //!< What you need to add to go to next row
ubyte bpp; //!< Requested bitdepth of each pixel. ( 7, 8, 15, 16, 24, 32)
ubyte true_bpp; //!< The image's actual bitdepth
ubyte flags; //!< Various texture type flags. @see BMPMAN_CONSTANTS
ptr_u data; //!< Pointer to data, or maybe offset into VRAM.
ubyte *palette; /**< @brief Pointer to this bitmap's palette (if it has one).
* @details If BMP_NO_PALETTE_MAP flag is cleared, this palette just points to the screen palette. (gr_palette)
*/
};
typedef struct bitmap {
short w, h; // Width and height
short rowsize; // What you need to add to go to next row
ubyte bpp; // How many bits per pixel it is. (7,8,15,16,24,32) (what is requested)
ubyte true_bpp; // How many bits per pixel the image actually is.
ubyte flags; // See the BMP_???? defines for values (this isn't for the BMP_FLAG_* stuff)
ptr_u data; // Pointer to data, or maybe offset into VRAM.
ubyte *palette; // If bpp==8, this is pointer to palette. If the BMP_NO_PALETTE_MAP flag
// is not set, this palette just points to the screen palette. (gr_palette)
} bitmap;
extern int bm_texture_ram; //!< how many bytes of textures are used.
extern int Bm_paging; //!< Bool type that indicates if BMPMAN is currently paging.
extern int Bm_paging;
extern const ubyte bm_type_list[]; //!< List of valid bitmap types
extern const char *bm_ext_list[]; //!< List of extensions for those types
extern const int BM_NUM_TYPES; //!< Calculated number of bitmap types
extern const ubyte bm_ani_type_list[]; //!< List of valid bitmap animation types
extern const char *bm_ani_ext_list[]; //!< List of extensions for those types
extern const int BM_ANI_NUM_TYPES; //!< Calculated number of bitmap animation types
extern int GLOWMAP; //!< References a map that is a fully lit version of its index -Bobboau
extern int SPECMAP; //!< References a map that is for specular mapping -Bobboau
extern int ENVMAP; //!< References a map that is for environment mapping -Bobboau
extern int NORMMAP; //!< Normal mapping
extern int HEIGHTMAP; //!< Height map for normal mapping
extern int MISCMAP; //!< Utility map, to be utilized for various things shader authors can come up with
/**
* @brief Initilizes the bitmap manager
*/
void bm_init();
/**
* @brief Closes the bitmap manager, freeing any allocated memory used by bitmaps. Is called at program close.
*/
void bm_close();
int bm_get_cache_slot( int bitmap_id, int separate_ani_frames );
/**
* Gets the cache slot of the bitmap indexed by handle.
*
* @details if the bitmap is an ani, gets the first frame
*
* @returns The cache slot index of the bitmap if handle is valid
*
* @note If the handle is invalid, an Assert() fails
*/
int bm_get_cache_slot(int bitmap_id, int separate_ani_frames);
/**
* @brief Gets the next available bitmap slot.
*/
int bm_get_next_handle();
void *bm_malloc(int n, int size);
/**
* @brief Allocates memory for the given handle.
*
* @returns A pointer to the allocated vm if successful,
* @returns Null, if unsuccessful
*
* @note z64 - This function looks fishy. Not only is handle not used in release builds, but bm_bitmaps[handle].size
* and bm_texture_size aren't modified unless this is a debug build
*/
void *bm_malloc(int handle, int size);
/**
* @brief (DEBUG) Similar to bm_malloc, but only updates how much memory is used
*
* @note z64 - Also fishy (see bm_malloc)
*/
void bm_update_memory_used(int n, int size);
// how many bytes of textures are used.
extern int bm_texture_ram;
// This loads a bitmap so we can draw with it later.
// It returns a negative number if it couldn't load
// the bitmap. On success, it returns the bitmap
// number.
/**
* @brief Loads a bitmap so we can draw with it later.
*
* @param filename
*
* @returns The bitmap number if successful, else
* @returns a negative value if not
*/
int bm_load(const char* filename);
/**
* @brief Loads a bitmap so we can draw with it later. (Preferred version)
*
* @param filename
*
* @returns The bitmap number if successful, else
* @returns a negative value if not
*/
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
// _and_ texture format, such as pilot pics and squad logos
/**
* @brief Reloads a bitmap as a duplicate.
*
* @details This 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 _and_ texture format, such as
* the pilot pics and squad logos
*
* @param filename
*
* @returns The bitmap number if successful, else
* @returns a negative value if not
*/
int bm_load_duplicate(const char *filename);
// Creates a bitmap that exists in RAM somewhere, instead
// of coming from a disk file. You pass in a pointer to a
// block of data. The data can be in the following formats:
// 8 bpp (mapped into game palette)
// 32 bpp
// On success, it returns the bitmap number. You cannot
// free that RAM until bm_release is called on that bitmap.
// See example at bottom of this file
int bm_create( int bpp, int w, int h, void *data = NULL, int flags = 0);
/**
* Loads a bitmap which exists somewhere in the RAM.
*
* @param bpp The bitdepth of the bitmap
* @param w The width of the bitmap
* @param h The height of the bitmap
* @param[in] data The bitmap's data glob
* @param flags
*
* @note The used RAM cannot be freed until bm_release is called on the created bitmap
*/
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);
/**
* @brief Unloads a bitmap's data, but not the bitmap info
*
* @details The bm number (n) may be reused once this function has been called on it. However, it will have to be paged
* in the next time it is locked.
// 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
int bm_unload_fast( int n, int clear_render_targets = 0 );
* @param handle The index number of the bitmap to free
* @param clear_render_targets If true, release a render target
* @param nodebug If true, exclude certain debug messages
*
* @returns 0 if not successful,
* @returns 1 if successful
*/
int bm_unload(int handle, int clear_render_targets = 0, bool nodebug = false);
// Frees up a bitmap's data, and it's slot, so bitmap
// number 'n' cannot be used anymore, and bm_load or
// bm_create might reuse the slot.
int bm_release( int n, int clear_render_targets = 0 );
/**
* @brief Quickly unloads a bitmap's data, ignoring the load_count
*
* @details Similar to bm_unload(), except that it can be safely used to free data without worrying about load_count.
* It's safe to use in relation to bm_release() and in gr_*_texture functions
*
* @param handle The bm number of the bitmap to free
* @param clear_render_targets If true, release a render target
*
* @note bm_free_data_fast() is used here and NOT bm_free_data()
*/
int bm_unload_fast(int handle, int clear_render_targets = 0);
// This loads a bitmap sequence so we can draw with it later.
// It returns a negative number if it couldn't load
// the bitmap. On success, it returns the bitmap
// number of the first frame and nframes is set.
extern int bm_load_animation( const char *filename, int *nframes = NULL, int *fps = NULL, int *keyframe = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY );
/**
* @brief Frees both a bitmap's data and it's associated slot.
*
* @details Once called, the bm number 'n' cannot be used until bm_load or bm_create is re-inits the slot.
*
* @param handle The index number of the bitmap to release
* @param clear_render_targets If nonzero, also release render targets
*
* @returns 1 on success,
* @returns 0 otherwise
*
* @note If the passed handle is that of an ANI, it frees EVERY frame. Be sure to only pass the handle of the first frame!
*
* @todo upgrade return type and clear_render_targets type to bools
*/
int bm_release(int handle, int clear_render_targets = 0);
//Loads either animation (bm_load_animation) or still image (bm_load)
extern int bm_load_either(const char *filename, int *nframes = NULL, int *fps = NULL, int *keyframe = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY);
/**
* @brief Loads a bitmap sequance so we can draw with it.
*
* @param[in] filename
* @param[out] nframes If non-null, set to the number of frames the animation has
* @param[out] fps If non-null, set to the fps of this animation
* @param[out] keyframe if non null, set to the keyframe index of this animation
* @param[in] can_drop_frames If set, allows dropped frames
* @param[in] dir_type Directory type
*
* @returns The bm number of the first bitmap in the sequence if successful, or
* @returns A negative value if unsuccessful
*/
int bm_load_animation(const char *filename, int *nframes = NULL, int *fps = NULL, int *keyframe = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY);
// This locks down a bitmap and returns a pointer to a bitmap
// 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);
/**
* @brief Loads either animation (bm_load_animation) or still image (bm_load)
*
* @param[in] filename
* @param[out] nframes If non-null and loading was successful, set to the number of frames the animation has
* @param[out] fps If non-null and loading was successful, set to the fps of this animation
* @param[out] keyframe if non null and loading was successful, set to the keyframe index of this animation
* @param[in] can_drop_frames
* @param[in] dir_type
*
* @returns The bm number of the first bitmap in the sequence if successful, or
* @returns A negative value if unsuccessful
*/
int bm_load_either(const char *filename, int *nframes = NULL, int *fps = NULL, int *keyframe = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY);
// The signature is a field that gets filled in with
// a unique signature for each bitmap. The signature for each bitmap
// will also change when the bitmap's data changes.
extern uint bm_get_signature( int bitmapnum);
/**
* @brief Locks down the bitmap indexed by bitmapnum.
*
* @details Also converts the bitmap to the appropriate format specified by bpp and flags. Only lock a bitmap when you
* need it!
*
* @param bitmapnum The number indexing the desired bitmap
* @param bpp The desired bpp of the bitmep
* @param flags The desired bitmap format
* @param nodebug
//gets the image type
* @returns A pointer to the bitmap that's valid until bm_unlock is called if successful, or
* @returns NULL if unsuccessful
*/
bitmap* bm_lock(int handle, ubyte bpp, ubyte flags, bool nodebug = false);
/**
* @brief Returns a unique signiature for the bitmap indexed by handle
*
* @details A signature will change when the bitmap's data changes
*/
uint bm_get_signature(int handle);
/**
* @brief Returns the image type of the given bitmap handle
*/
ubyte bm_get_type(int handle);
// Unlocks a bitmap
extern void bm_unlock( int bitmapnum );
/**
* @brief Unlocks a bitmap
*
* @details Decrements the ref_count member of the bitmap_entry struct, A bitmap can only be unloaded when the
* ref_count is 0
*/
void bm_unlock(int handle);
//WMC - Returns 0 if invalid, nonzero if valid
extern int bm_is_valid(int handle);
/**
* @brief Checks if the bitmap indexed by handle is valid
*
* @details Some early known false or out of range handles (such as negative) are checked within
* an initial routine pass, followed by a more thorough check routine to ensure the
* series of bitmaps within the bm_bitmaps[] structure have not become invalid.
*
* @returns Nonzero if valid, else
* @returns Zero otherwise
*
* @todo z64 - Returned value is essentially a bool type, need to check all caller functions to see if it can safely
* be updated to reflect this
*/
int bm_is_valid(int handle);
// Gets info. w,h,or flags,nframes or fps can be NULL if you don't care.
//WMC - Returns -1 on failure, handle or first frame handle on success.
int bm_get_info( int bitmapnum, int *w=NULL, int * h=NULL, ubyte * flags=NULL, int *nframes=NULL, int *fps=NULL );
/**
* @brief Gets info on the bitmap indexed by handle.
*
* @param[out] w If non-null, gets the width
* @param[out] h If non-null, gets the heigth
* @param[out] flags If non-null, gets the flags
* @param[out] nframs If non-null, gets the nframes
* @param[out] fps If non-null, gets the fps
*
* @returns The handle on success, or
* @returns The handle to the first frame on success, or
* @returns -1 on failure
*/
int bm_get_info(int handle, int *w = NULL, int * h = NULL, ubyte * flags = NULL, int *nframes = NULL, int *fps = NULL);
// get filename
extern void bm_get_filename(int bitmapnum, char *filename);
/**
* @brief Gets the filename of the bitmap indexed by handle
*
* @param[out] filename The filename of the bitmap, if successful. Is set to an empty string if unseccessful
*
* @todo z64 - maybe deprecate this in favor of an SCP_string version
*/
void bm_get_filename(int bitmapnum, char *filename);
// call to load all data for all bitmaps that have been requested to be loaded
extern void bm_gfx_load_all();
extern void bm_unload_all();
/**
* @brief Gets the filename of the bitmap indexed by handle, which must exist.
*
* @details If the bitmap does not exist (i.e. the handle is invalid), then an Assertion halts program execution.
*
* @returns A const char* to the filename of the bitmap
*
* @todo z64 - maybe deprecate this in favor of an SCP_string version.
* @todo z64 - maybe combine this with the other bm_get_filename function like so:
* void bm_get_filename(int handle, SCP_string *filename, bool must_exist = false);
*/
const char *bm_get_filename(int handle);
// call to get the palette for a bitmap
void bm_get_palette(int n, ubyte *pal, char *name);
/**
* @brief Loads all data for all bitmaps that have been requested to be loaded
*
* @note This function is not defined.
*/
void bm_gfx_load_all();
// Hacked function to get a pixel from a bitmap.
// Only works good in 8bpp mode.
void bm_gfx_get_pixel( int bitmap, float u, float v, ubyte *r, ubyte *g, ubyte *b );
/**
* @brief Unloads all used bitmaps, should only ever be called by game_shutdown()
*
* @todo Maybe move this declaration into bmpman.cpp and then extern this function within game_shutdown() to
* ensure it only ever gets called there.
*/
void bm_unload_all();
// Returns number of bytes of bitmaps locked this frame
// ntotal = number of bytes of bitmaps locked this frame
// nnew = number of bytes of bitmaps locked this frame that weren't locked last frame
/**
* @brief Gets the palette for a given bitmap indexed by handle, and optionally the filename
*
* @param[out] pal Is set to reference the bitmap's palette
* @param[out] name (optional) Is set to the bitmap's filename
*
* @todo Maybe get rid of the optional filename and have the callers call bm_get_filename. Less efficient, however.
*/
void bm_get_palette(int handle, ubyte *pal, char *name);
/**
* @brief Hack to get a pixel from a bitmap
*
* @details only works good in 8bpp mode
*
* @note This function is not defined.
*/
void bm_gfx_get_pixel(int bitmap, float u, float v, ubyte *r, ubyte *g, ubyte *b);
/**
* @brief (DEBUG) Gets memory size, in bytes, of the locked bitmaps
*
* @details Both params are non-optional, and must be non-null. There's currently no safety checks on either.
*
* @param ntotal[out] Memory size, in bytes, of the locked bitmaps
* @param nnew[out] Memory size, in bytes, of the bitmaps that were locked since the last frame
*
* @note This is a debug function, and is undefined within release builds
*/
void bm_get_frame_usage(int *ntotal, int *nnew);
// Reload a different image into an existing bmpman slot
/**
* @brief Reloads an existing bmpman slot with different bitmap
*
* @param[in] filename The filename of the image to load
*
* @returns The bitmap handle on success, or
* @returns A negative value on failure
*
* @note This should only be used if you are certain the new picture is the same type, has same dimensions, etc.
*/
int bm_reload(int bitmap_handle, const char* filename);
/*
* Example on using bm_create
*
{
static int test_inited = 0;
static int test_bmp;
static uint test_bmp_data[128*64];
if ( !test_inited ) {
test_inited = 1;
// Create the new bitmap and fill in its data.
// When you're done with it completely, call
// bm_release to free up the bitmap handle
test_bmp = bm_create( 32, 128, 64, test_bmp_data );
int i,j;
for (i=0; i<64; i++ ) {
for (j=0; j<64; j++ ) {
uint r=i*4;
test_bmp_data[j+i*128] = r;
}
}
}
bm_unload(test_bmp); // this pages out the data, so that the
// next bm_lock will convert the new data to the
// correct bpp
// put in new data
int x,y;
gr_reset_clip();
for (y=0; y<64; y++)
for (x=0; x<128; x++ )
test_bmp_data[y*128+x] = 15;
// Draw the bitmap to upper left corner
gr_set_bitmap(test_bmp);
gr_bitmap( 0,0 );
}
*/
//============================================================================
// Paging stuff
//============================================================================
/**
* @brief Tells bmpman to start keeping track of what bitmaps are used where
*/
void bm_page_in_start();
/**
* @brief Tells bmpman to stop paging (?)
*/
void bm_page_in_stop();
// Paging code in a library should call these functions
// in its page in function.
// Marks a texture as being used for this level
// If num_frames is passed, assume this is an animation
void bm_page_in_texture( int bitmapnum, int num_frames = 0 );
/**
* @brief Marks a texture as being used for this level
*
* @param[in] num_frames If specified, assumes this is an animated texture
*/
void bm_page_in_texture(int bitmapnum, int num_frames = 0);
// marks a texture as being a transparent textyre used for this level
// Marks a texture as being used for this level
// If num_frames is passed, assume this is an animation
void bm_page_in_xparent_texture( int bitmapnum, int num_frames=1 );
/**
* @brief Marks a textures as being used for level and is transparant
*
* @param[in] num_frames If specified, assumes this is an animated texture
*/
void bm_page_in_xparent_texture(int bitmapnum, int num_frames = 1);
// Marks an aabitmap as being used for this level
// If num_frames is passed, assume this is an animation
void bm_page_in_aabitmap( int bitmapnum, int num_frames=1 );
/**
* @brief Marks a texture as being used for this level, and is anti-aliased
*
* @param[in] num_frames If specified, assumes this is an animated texture
*/
void bm_page_in_aabitmap(int bitmapnum, int num_frames = 1);
// unload a texture that was paged in
int bm_page_out( int handle );
/**
* @brief Unloads the bitmap indexed by handle that was previously paged-in
*
* @returns 0 If the bitmap had already been released, or
* @returns 0 If the handle is invalid, or
* @returns 1 If successful
*
* @todo The return type should be a bool
*/
int bm_page_out(int handle);
//
// Mode: 0 = High memory
// 1 = Low memory ( every other frame of ani's)
// 2 = Debug low memory ( only use first frame of each ani )
void bm_set_low_mem( int mode );
const char *bm_get_filename(int handle);
/**
* @brief Sets BMPMAN's memory mode
*
* @details 0 = High memory;
* 1 = Low memory (loads every other frame of ani's);
* 2 = Debug low memory (only use first frame of each ani)
*
* @todo This should use an enum, or instead allow an arbitrary number to drop frames (like 1/2, 1/3, etc.)
*/
void bm_set_low_mem(int mode);
/**
* @brief Sets bm_set_components and bm_get_components to reference screen format functions
*/
void BM_SELECT_SCREEN_FORMAT();
/**
* @brief Sets bm_set_components and bm_get_components to reference texture format functions
*/
void BM_SELECT_TEX_FORMAT();
/**
* @brief Sets bm_set_components and bm_get_components to reference texture format functions (with alpha)
*/
void BM_SELECT_ALPHA_TEX_FORMAT();
// set the rgba components of a pixel, any of the parameters can be NULL
extern void (*bm_set_components)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
extern void (*bm_set_components_32)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
void bm_set_components_argb_d3d_16_screen(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
void bm_set_components_argb_d3d_32_screen(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
void bm_set_components_argb_d3d_16_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
void bm_set_components_argb_d3d_32_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
/**
* @brief Functional pointer that references any of the bm_set_components functions.
*
* @details The bm_set_components functions packs the RGBA values into the ubyte array referenced by pixel, whose
* format differs according to its bpp value and presence of an alpha channel. The RGBA values are scaled accordingly.
*
* @param[out] pixel The pixel to set
* @param[in] r Red value (may not be NULL)
* @param[in] g Green value (may not be NULL)
* @param[in] b Blue value (may not be NULL)
* @param[in] a Alpha value (currently ignored)
*
* @note z64 - These functions were made predating the introduction of C++ classes, and are basically the equivalent
* of Pixel::set(ubyte *r, ubyte *b, ubyte *g). The original comment mentions that any of the rgba params may be
* NULL, but this is by far _NOT_ the case, as a NULL value will cause undefined behavior (really really bad chroma
* corruption)
*
* @note These functions assume the incoming bitdepth will always be >= to the outgoing bitdepth of the pixel. Should
* the incoming bitdepth be lower, the outgoing values will appear darker than they should be
*/
extern void(*bm_set_components)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
// get the rgba components of a pixel, any of the parameters can be NULL
/**
* @brief Functional pointer that references any of the bm_set_components_32 functions.
*
* @details The bm_set_components functions packs the RGBA values into the ubyte array referenced by pixel, whose
* format differs according to its bpp value and presence of an alpha channel. The RGBA values are scaled accordingly.
*
* @see bm_set_components
*/
extern void(*bm_set_components_32)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
/**
* @brief Sets the 16bpp screen pixel to the specified RGBA value
*
* @see bm_set_components
*/
void bm_set_components_argb_16_screen(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
/**
* @brief Sets the 32bpp screen pixel to the specified RGBA value
*
* @see bm_set_components
*/
void bm_set_components_argb_32_screen(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
/**
* @brief Sets the 16bpp texture pixel to the specified RGBA value
*
* @see bm_set_components
*/
void bm_set_components_argb_16_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
/**
* @brief Sets the 32bpp texture pixel to the specified RGBA value
*
* @see bm_set_components
*/
void bm_set_components_argb_32_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
/**
* @brief Gets the RGBA components of a pixel according to the selected mode
*
* @see BM_SELECT_SCREEN_FORMAT() BM_SELECT_TEX_FORMAT() BM_SELECT_ALPHA_TEX_FORMAT()
*/
void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
extern int GLOWMAP; //this holds a reference to a map that is a fully lit version of its index -Bobboau
extern int SPECMAP; //this holds a reference to a map that is for specular mapping -Bobboau
extern int ENVMAP; //this holds a reference to a map that is for environment mapping -Bobboau
extern int NORMMAP; // normal mapping
extern int HEIGHTMAP; // height map for normal mapping
extern int MISCMAP; // Utility map, to be utilized for various things shader authors can come up with
/**
* @brief Returns the compression type of the bitmap indexed by handle
*/
int bm_is_compressed(int handle);
int bm_is_compressed(int num);
int bm_get_tcache_type(int num);
int bm_get_size(int num);
int bm_get_num_mipmaps(int num);
/**
* @brief Gets the correct TCACHE_TYPE for compressed graphics (uncompressed are assumed TCACHE_TYPE_NORMAL)
*/
int bm_get_tcache_type(int handle);
/**
* @brief Gets the size, in bytes, taken up by the bitmap indexed by handle
*
* @todo retval should be a size_t
*/
int bm_get_size(int handle);
/**
* @brief Gets the number of mipmaps of the indexed texture
*/
int bm_get_num_mipmaps(int handle);
/**
* @brief Checks to see if the indexed bitmap has an alpha channel
*
* @note Currently just checks if the bitmap is 32bpp and is not a .PCX
*
* @todo retval should be a bool
*/
int bm_has_alpha_channel(int handle);
/**
* @brief (DEBUG) Prints all loaded bitmaps to an outwindow
*/
void bm_print_bitmaps();
int bm_make_render_target( int width, int height, int flags );
int bm_is_render_target(int bitmap_id);
/**
* @brief Creates a render target as close to the desired resolution as possible.
*
* @returns the handle of an avilable render target if successful, or
* @returns -1 if not successful
*
* @note BM_FLAG_RENDER_TARGET_STATIC are drawn once/infrequently, while BM_FLAG_RENDER_TARGET_DYNAMIC are drawn roughly once every frame
*/
int bm_make_render_target(int width, int height, int flags);
/**
* @brief Checks to see if the given bitmap indexed by handle is a render target
*
* @returns The render type (BM_TYPE) if it is a render target, or
* @returns 0 if it is not
*/
int bm_is_render_target(int handle);
/**
* @brief (GR function) Calls gr_bm_set_render target for the given bitmap indexed by handle
*
* @returns 1 if successful, or
* @returns 0 if unsuccessful
*
* @todo retval should be a bool
*/
int bm_set_render_target(int handle, int face = -1);
/**
* @brief Loads and parses an .EFF
*
* @param[in] filename The filename of the .EFF
* @param[in] dir_type
* @param[out] nframes (optional) If given, is set to the number of frames this .EFF has
* @param[out] nfps (optional) If given, is set to the fps of this .EFF
* @param[out] key (optional) If given, is set to the keyframe index of this .EFF
* @param[out] type (optional) If given, is set to the BM_TYPE of the .EFF
*
* @returns 0 If successful,
* @returns -1 if not successful
*
* @todo retval should be a bool
*/
int bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int *nfps, int *key, ubyte *type);
#endif
+8 -8
View File
@@ -540,8 +540,10 @@ void warp_camera::get_info(vec3d *position, matrix *orientation)
//*************************subtitle*************************
#define MAX_SUBTITLE_LINES 64
subtitle::subtitle(int in_x_pos, int in_y_pos, char* in_text, char* in_imageanim, float in_display_time, float in_fade_time, color *in_text_color, int in_text_fontnum, bool center_x, bool center_y, int in_width, int in_height, bool in_post_shaded)
subtitle::subtitle(int in_x_pos, int in_y_pos, const char* in_text, const char* in_imageanim, float in_display_time, float in_fade_time, const color *in_text_color, int in_text_fontnum, bool center_x, bool center_y, int in_width, int in_height, bool in_post_shaded)
{
SCP_string text_buf;
// basic init, this always has to be done
memset( imageanim, 0, sizeof(imageanim) );
memset( &text_pos, 0, 2*sizeof(int) );
@@ -551,12 +553,11 @@ subtitle::subtitle(int in_x_pos, int in_y_pos, char* in_text, char* in_imageanim
if ( ((in_text != NULL) && (strlen(in_text) <= 0)) && ((in_imageanim != NULL) && (strlen(in_imageanim) <= 0)) )
return;
char text_buf[256];
if (in_text != NULL && in_text[0] != '\0')
{
strcpy_s(text_buf, in_text);
sexp_replace_variable_names_with_values(text_buf, 256);
in_text = text_buf;
text_buf = in_text;
sexp_replace_variable_names_with_values(text_buf);
in_text = text_buf.c_str();
}
@@ -569,11 +570,10 @@ 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);
SCP_string temp_str;
for(int i = 0; i < num_text_lines; i++)
{
temp_str.assign(text_line_ptrs[i], text_line_lens[i]);
text_lines.push_back(temp_str);
text_buf.assign(text_line_ptrs[i], text_line_lens[i]);
text_lines.push_back(text_buf);
}
}
+2 -2
View File
@@ -137,8 +137,8 @@ private:
bool post_shaded;
public:
subtitle(int in_x_pos, int in_y_pos, char* in_text = NULL, char* in_imageanim = NULL,
float in_display_time = 0, float in_fade_time = 0.0f, color *in_text_color = NULL, int in_text_fontnum = -1,
subtitle(int in_x_pos, int in_y_pos, const char* in_text = NULL, const char* in_imageanim = NULL,
float in_display_time = 0, float in_fade_time = 0.0f, const color *in_text_color = NULL, int in_text_fontnum = -1,
bool center_x = false, bool center_y = false, int in_width = 0, int in_height = 0, bool post_shaded=false);
~subtitle();
+10 -16
View File
@@ -35,7 +35,6 @@
#include "osapi/osapi.h"
char Cfile_root_dir[CFILE_ROOT_DIRECTORY_LEN] = "";
#ifdef SCP_UNIX
char Cfile_user_dir[CFILE_ROOT_DIRECTORY_LEN] = "";
@@ -185,7 +184,7 @@ int cfile_init(const char *exe_dir, const char *cdrom_dir)
// are we in a root directory?
if(cfile_in_root_dir(buf)){
SCP_Messagebox(MESSAGEBOX_ERROR, "FreeSpace2/Fred2 cannot be run from a drive root directory!");
MessageBox((HWND)NULL, "FreeSpace2/Fred2 cannot be run from a drive root directory!", "Error", MB_OK);
return 1;
}
@@ -199,7 +198,7 @@ int cfile_init(const char *exe_dir, const char *cdrom_dir)
buf[i] = 0;
cfile_chdir(buf);
} else {
SCP_Messagebox(MESSAGEBOX_ERROR, "Error trying to determine executable root directory!");
MessageBox((HWND)NULL, "Error trying to determine executable root directory!", "Error", MB_OK);
return 1;
}
@@ -492,23 +491,17 @@ int cf_access(const char *filename, int dir_type, int mode)
// Returns 1 if the file exists, 0 if not.
// Checks only the file system.
// cf_find_file_location checks the filesystem before VPs
// If offset is 0, it was found in the filesystem, so offset is boolean false
// If offset equates to boolean true, it was found in a VP and the logic will negate the function return
int cf_exists(const char *filename, int dir_type)
{
char longname[MAX_PATH_LEN];
int offset = 1;
Assert(CF_TYPE_SPECIFIED(dir_type));
if ( (filename == NULL) || !strlen(filename) )
return 0;
cf_create_default_path_string(longname, sizeof(longname) - 1, dir_type, filename);
FILE *fp = fopen(longname, "rb");
if (fp)
{
// Goober5000 - these were switched, causing the fclose to be unreachable
fclose(fp);
return 1;
}
return 0;
return (cf_find_file_location(filename, dir_type, 0, NULL, &offset, NULL) && !offset);
}
// Goober5000
@@ -736,6 +729,7 @@ CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, b
if ( cf_find_file_location( copy_file_path, dir_type, sizeof(longname) - 1, longname, &size, &offset, localize ) ) {
// Fount it, now create a cfile out of it
nprintf(("CFileDebug", "Requested file %s found at: %s\n", file_path, longname));
if ( type & CFILE_MEMORY_MAPPED ) {
+69 -17
View File
@@ -28,6 +28,11 @@
#include <CoreFoundation/CoreFoundation.h>
#endif
#ifdef SCP_UNIX
#include "osapi/osapi.h"
#include <dirent.h>
#endif
#include <string.h>
#include <stdlib.h>
@@ -186,14 +191,13 @@ Flag exe_params[] =
{ "-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", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-disable_di_mouse", },
#endif
{ "-use_gldrawelements","Don't use glDrawRangeElements", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-use_gldrawelements", },
{ "-old_collision", "Use old collision detection system", true, EASY_DEFAULT, EASY_ALL_ON, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-old_collision", },
{ "-gl_finish", "Fix input lag on some ATI+Linux systems", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-gl_finish", },
{ "-ingame_join", "Allow in-game joining", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ingame_join", },
{ "-voicer", "Enable voice recognition", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-voicer", },
{ "-brief_lighting", "Enable lighting on briefing models", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-brief_lighting", },
{ "-fps", "Show frames per second on HUD", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fps", },
{ "-pos", "Show position of camera", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-pos", },
@@ -293,6 +297,7 @@ cmdline_parm fxaa_arg("-fxaa", NULL, AT_NONE);
cmdline_parm fxaa_preset_arg("-fxaa_preset", "FXAA quality (0-9), requires -post_process and -fxaa", AT_INT);
cmdline_parm fb_explosions_arg("-fb_explosions", NULL, AT_NONE);
cmdline_parm flightshaftsoff_arg("-nolightshafts", NULL, AT_NONE);
cmdline_parm brieflighting_arg("-brief_lighting", NULL, AT_NONE);
float Cmdline_clip_dist = Default_min_draw_distance;
float Cmdline_fov = 0.75f;
@@ -317,6 +322,7 @@ int Cmdline_fxaa_preset = 6;
extern int Fxaa_preset_last_frame;
bool Cmdline_fb_explosions = 0;
extern bool ls_force_off;
bool Cmdline_brief_lighting = 0;
// Game Speed related
cmdline_parm cache_bitmaps_arg("-cache_bitmaps", NULL, AT_NONE); // Cmdline_cache_bitmaps
@@ -400,10 +406,10 @@ cmdline_parm mipmap_arg("-mipmap", NULL, AT_NONE); // Cmdline_mipmap
cmdline_parm atiswap_arg("-ati_swap", NULL, AT_NONE); // Cmdline_atiswap - Fix ATI color swap issue for screenshots.
cmdline_parm no3dsound_arg("-no_3d_sound", NULL, AT_NONE); // Cmdline_no_3d_sound - Disable use of full 3D sounds
cmdline_parm no_glsl_models_arg("-disable_glsl_model", NULL, AT_NONE); // Cmdline_no_glsl_model_rendering -- switches model rendering to fixed pipeline
cmdline_parm no_di_mouse_arg("-disable_di_mouse", "Disable DirectInput mouse code (Windows only)", AT_NONE); // Cmdline_no_di_mouse -- Disables directinput use for mouse control
cmdline_parm no_drawrangeelements("-use_gldrawelements", NULL, AT_NONE); // Cmdline_drawelements -- Uses glDrawElements instead of glDrawRangeElements
cmdline_parm keyboard_layout("-keyboard_layout", "Specify keyboard layout (qwertz or azerty)", AT_STRING);
cmdline_parm old_collision_system("-old_collision", NULL, AT_NONE); // Cmdline_old_collision_sys
cmdline_parm gl_finish ("-gl_finish", NULL, AT_NONE);
int Cmdline_load_all_weapons = 0;
int Cmdline_nohtl = 0;
@@ -419,6 +425,7 @@ int Cmdline_no_3d_sound = 0;
int Cmdline_no_glsl_model_rendering = 0;
int Cmdline_drawelements = 0;
char* Cmdline_keyboard_layout = NULL;
bool Cmdline_gl_finish = false;
// Developer/Testing related
cmdline_parm start_mission_arg("-start_mission", "Skip mainhall and run this mission", AT_STRING); // Cmdline_start_mission
@@ -899,18 +906,17 @@ cmdline_parm::cmdline_parm(const char *name_, const char *help_, const int arg_t
name_found = 0;
if (Parm_list_inited == 0) {
list_init(&Parm_list);
Assertion(&Parm_list == this, "Coding error! 1st initialised cmdline_parm must be static Parm_list\n");
list_init(this);
Parm_list_inited = 1;
}
if (name != NULL) {
} else {
Assertion(name, "Coding error! cmdline_parm's must have a non-NULL name\n");
Assertion(name[0] == '-', "Coding error! cmdline_parm's must start with a '-'\n");
// not in the static Parm_list init, so lookup the NULL help args
if (help == NULL) {
help = get_param_desc(name);
}
list_append(&Parm_list, this);
} else {
list_init(&Parm_list);
}
}
@@ -1267,12 +1273,6 @@ bool SetCmdlineParams()
if(mod_arg.found() ) {
Cmdline_mod = mod_arg.str();
// be sure that this string fits in our limits
/* This has to be disabled because the max size is going to be mods*MAX_FILENAME_LEN
if ( strlen(Cmdline_mod) > MAX_FILENAME_LEN ) {
Cmdline_mod[MAX_FILENAME_LEN-1] = '\0';
}*/
// strip off blank space it it's there
if ( Cmdline_mod[strlen(Cmdline_mod)-1] == ' ' ) {
Cmdline_mod[strlen(Cmdline_mod)-1] = '\0';
@@ -1284,7 +1284,49 @@ bool SetCmdlineParams()
memset( modlist, 0, len + 2 );
strcpy_s(modlist, len+2, Cmdline_mod);
//modlist[len]= '\0'; // double null termination at the end
#ifdef SCP_UNIX
// for case sensitive filesystems (e.g. Linux/BSD) perform case-insensitive dir matches
DIR *dp;
dirent *dirp;
char *cur_pos, *temp;
char cur_dir[CF_MAX_PATHNAME_LENGTH], delim[] = ",";
SCP_vector<SCP_string> temp_modlist;
size_t total_len = 0;
if ( !_getcwd(cur_dir, CF_MAX_PATHNAME_LENGTH ) ) {
Error(LOCATION, "Can't get current working directory -- %d", errno );
}
for (cur_pos = strtok(modlist, delim); cur_pos != NULL; cur_pos = strtok(NULL, delim))
{
if ((dp = opendir(cur_dir)) == NULL) {
Error(LOCATION, "Can't open directory '%s' -- %d", cur_dir, errno );
}
while ((dirp = readdir(dp)) != NULL) {
if (!stricmp(dirp->d_name, cur_pos)) {
temp_modlist.push_back(dirp->d_name);
total_len += (strlen(dirp->d_name) + 1);
}
}
(void)closedir(dp);
}
// create new char[] to replace modlist
char *new_modlist = new char[total_len+1];
memset( new_modlist, 0, total_len + 1 );
SCP_vector<SCP_string>::iterator ii, end = temp_modlist.end();
for (ii = temp_modlist.begin(); ii != end; ++ii) {
strcat_s(new_modlist, total_len+1, ii->c_str());
strcat_s(new_modlist, total_len+1, ","); // replace later with NUL
}
// make the rest of the function unaware that anything happened here
temp = modlist;
modlist = new_modlist;
delete [] temp;
len = total_len;
#endif
// null terminate each individual
for (int i = 0; i < len; i++)
@@ -1471,6 +1513,11 @@ bool SetCmdlineParams()
Cmdline_keyboard_layout = keyboard_layout.str();
}
if (gl_finish.found())
{
Cmdline_gl_finish = true;
}
if ( snd_preload_arg.found() )
{
Cmdline_snd_preload = 1;
@@ -1553,6 +1600,11 @@ bool SetCmdlineParams()
Cmdline_fb_explosions = 1;
}
if ( brieflighting_arg.found() )
{
Cmdline_brief_lighting = 1;
}
if ( postprocess_arg.found() )
{
Cmdline_postprocess = 1;
+1
View File
@@ -129,6 +129,7 @@ extern int Cmdline_no_3d_sound;
extern int Cmdline_no_glsl_model_rendering;
extern int Cmdline_drawelements;
extern char* Cmdline_keyboard_layout;
extern bool Cmdline_gl_finish;
// Developer/Testing related
extern char *Cmdline_start_mission;
+121 -121
View File
@@ -77,203 +77,203 @@ typedef struct config_item {
* This is the value of the id field in config_item
* The first group of items are ship targeting.
*/
enum IoActionId {
TARGET_NEXT =0, //!< target next
TARGET_PREV =1, //!< target previous
TARGET_NEXT_CLOSEST_HOSTILE =2, //!< target the next hostile target
TARGET_PREV_CLOSEST_HOSTILE =3, //!< target the previous closest hostile
TOGGLE_AUTO_TARGETING =4, //!< toggle auto-targeting
TARGET_NEXT_CLOSEST_FRIENDLY =5, //!< target the next friendly ship
TARGET_PREV_CLOSEST_FRIENDLY =6, //!< target the closest friendly ship
TARGET_SHIP_IN_RETICLE =7, //!< target ship closest to center of reticle
TARGET_CLOSEST_SHIP_ATTACKING_TARGET =8, //!< target the closest ship attacking current target
TARGET_LAST_TRANMISSION_SENDER =9, //!< TARGET_LAST_TRANMISSION_SENDER
STOP_TARGETING_SHIP =10, //!< stop targeting ship
enum IoActionId {
TARGET_NEXT =0, //!< target next
TARGET_PREV =1, //!< target previous
TARGET_NEXT_CLOSEST_HOSTILE =2, //!< target the next hostile target
TARGET_PREV_CLOSEST_HOSTILE =3, //!< target the previous closest hostile
TOGGLE_AUTO_TARGETING =4, //!< toggle auto-targeting
TARGET_NEXT_CLOSEST_FRIENDLY =5, //!< target the next friendly ship
TARGET_PREV_CLOSEST_FRIENDLY =6, //!< target the closest friendly ship
TARGET_SHIP_IN_RETICLE =7, //!< target ship closest to center of reticle
TARGET_CLOSEST_SHIP_ATTACKING_TARGET =8, //!< target the closest ship attacking current target
TARGET_LAST_TRANMISSION_SENDER =9, //!< TARGET_LAST_TRANMISSION_SENDER
STOP_TARGETING_SHIP =10, //!< stop targeting ship
//!< @n
//!< Targeting a Ship's Subsystem
//!< ------------------------------
TARGET_SUBOBJECT_IN_RETICLE =11, //!< target ships subsystem in reticle
TARGET_NEXT_SUBOBJECT =12, //!< target next subsystem on current target
TARGET_PREV_SUBOBJECT =13, //!< TARGET_PREV_SUBOBJECT
STOP_TARGETING_SUBSYSTEM =14, //!< stop targeting subsystems on ship
TARGET_SUBOBJECT_IN_RETICLE =11, //!< target ships subsystem in reticle
TARGET_NEXT_SUBOBJECT =12, //!< target next subsystem on current target
TARGET_PREV_SUBOBJECT =13, //!< TARGET_PREV_SUBOBJECT
STOP_TARGETING_SUBSYSTEM =14, //!< stop targeting subsystems on ship
//!< @n
//!< Speed Matching
//!< ----------------
MATCH_TARGET_SPEED =15, //!< match target speed
TOGGLE_AUTO_MATCH_TARGET_SPEED =16, //!< toggle auto-match target speed
MATCH_TARGET_SPEED =15, //!< match target speed
TOGGLE_AUTO_MATCH_TARGET_SPEED =16, //!< toggle auto-match target speed
//!< @n
//!< Weapons
//!< ---------
FIRE_PRIMARY =17, //!< FIRE_PRIMARY
FIRE_SECONDARY =18, //!< FIRE_SECONDARY
CYCLE_NEXT_PRIMARY =19, //!< cycle to next primary weapon
CYCLE_PREV_PRIMARY =20, //!< cycle to previous primary weapon
CYCLE_SECONDARY =21, //!< cycle to next secondary weapon
CYCLE_NUM_MISSLES =22, //!< cycle number of missiles fired from secondary bank
LAUNCH_COUNTERMEASURE =23, //!< LAUNCH_COUNTERMEASURE
FIRE_PRIMARY =17, //!< FIRE_PRIMARY
FIRE_SECONDARY =18, //!< FIRE_SECONDARY
CYCLE_NEXT_PRIMARY =19, //!< cycle to next primary weapon
CYCLE_PREV_PRIMARY =20, //!< cycle to previous primary weapon
CYCLE_SECONDARY =21, //!< cycle to next secondary weapon
CYCLE_NUM_MISSLES =22, //!< cycle number of missiles fired from secondary bank
LAUNCH_COUNTERMEASURE =23, //!< LAUNCH_COUNTERMEASURE
//!< @n
//!< Controls
//!< ----------
FORWARD_THRUST =24, //!< FORWARD_THRUST
REVERSE_THRUST =25, //!< REVERSE_THRUST
BANK_LEFT =26, //!< BANK_LEFT
BANK_RIGHT =27, //!< BANK_RIGHT
PITCH_FORWARD =28, //!< PITCH_FORWARD
PITCH_BACK =29, //!< PITCH_BACK
YAW_LEFT =30, //!< YAW_LEFT
YAW_RIGHT =31, //!< YAW_RIGHT
FORWARD_THRUST =24, //!< FORWARD_THRUST
REVERSE_THRUST =25, //!< REVERSE_THRUST
BANK_LEFT =26, //!< BANK_LEFT
BANK_RIGHT =27, //!< BANK_RIGHT
PITCH_FORWARD =28, //!< PITCH_FORWARD
PITCH_BACK =29, //!< PITCH_BACK
YAW_LEFT =30, //!< YAW_LEFT
YAW_RIGHT =31, //!< YAW_RIGHT
//!< @n
//!< Throttle Control
//!< ------------------
ZERO_THROTTLE =32, //!< ZERO_THROTTLE
MAX_THROTTLE =33, //!< MAX_THROTTLE
ONE_THIRD_THROTTLE =34, //!< ONE_THIRD_THROTTLE
TWO_THIRDS_THROTTLE =35, //!< TWO_THIRDS_THROTTLE
PLUS_5_PERCENT_THROTTLE =36, //!< PLUS_5_PERCENT_THROTTLE
MINUS_5_PERCENT_THROTTLE =37, //!< MINUS_5_PERCENT_THROTTLE
ZERO_THROTTLE =32, //!< ZERO_THROTTLE
MAX_THROTTLE =33, //!< MAX_THROTTLE
ONE_THIRD_THROTTLE =34, //!< ONE_THIRD_THROTTLE
TWO_THIRDS_THROTTLE =35, //!< TWO_THIRDS_THROTTLE
PLUS_5_PERCENT_THROTTLE =36, //!< PLUS_5_PERCENT_THROTTLE
MINUS_5_PERCENT_THROTTLE =37, //!< MINUS_5_PERCENT_THROTTLE
//!< @n
//!< Squadmate Messaging Keys
//!< --------------------------
ATTACK_MESSAGE =38, //!< wingman message: attack current target
DISARM_MESSAGE =39, //!< wingman message: disarm current target
DISABLE_MESSAGE =40, //!< wingman message: disable current target
ATTACK_SUBSYSTEM_MESSAGE =41, //!< wingman message: disable current target
CAPTURE_MESSAGE =42, //!< wingman message: capture current target
ENGAGE_MESSAGE =43, //!< wingman message: engage enemy
FORM_MESSAGE =44, //!< wingman message: form on my wing
IGNORE_MESSAGE =45, //!< IGNORE_MESSAGE
PROTECT_MESSAGE =46, //!< wingman message: protect current target
COVER_MESSAGE =47, //!< wingman message: cover me
WARP_MESSAGE =48, //!< wingman message: warp out
REARM_MESSAGE =49, //!< REARM_MESSAGE
TARGET_CLOSEST_SHIP_ATTACKING_SELF =50, //!< target closest ship that is attacking player
ATTACK_MESSAGE =38, //!< wingman message: attack current target
DISARM_MESSAGE =39, //!< wingman message: disarm current target
DISABLE_MESSAGE =40, //!< wingman message: disable current target
ATTACK_SUBSYSTEM_MESSAGE =41, //!< wingman message: disable current target
CAPTURE_MESSAGE =42, //!< wingman message: capture current target
ENGAGE_MESSAGE =43, //!< wingman message: engage enemy
FORM_MESSAGE =44, //!< wingman message: form on my wing
IGNORE_MESSAGE =45, //!< IGNORE_MESSAGE
PROTECT_MESSAGE =46, //!< wingman message: protect current target
COVER_MESSAGE =47, //!< wingman message: cover me
WARP_MESSAGE =48, //!< wingman message: warp out
REARM_MESSAGE =49, //!< REARM_MESSAGE
TARGET_CLOSEST_SHIP_ATTACKING_SELF =50, //!< target closest ship that is attacking player
//!< @n
//!< Views
//!< -------
VIEW_CHASE =51, //!< VIEW_CHASE
VIEW_EXTERNAL =52, //!< VIEW_EXTERNAL
VIEW_EXTERNAL_TOGGLE_CAMERA_LOCK =53, //!< VIEW_EXTERNAL_TOGGLE_CAMERA_LOCK
VIEW_SLEW =54, //!< VIEW_SLEW
VIEW_OTHER_SHIP =55, //!< VIEW_OTHER_SHIP
VIEW_DIST_INCREASE =56, //!< VIEW_DIST_INCREASE
VIEW_DIST_DECREASE =57, //!< VIEW_DIST_DECREASE
VIEW_CENTER =58, //!< VIEW_CENTER
PADLOCK_UP =59, //!< PADLOCK_UP
PADLOCK_DOWN =60, //!< PADLOCK_DOWN
PADLOCK_LEFT =61, //!< PADLOCK_LEFT
PADLOCK_RIGHT =62, //!< PADLOCK_RIGHT
VIEW_CHASE =51, //!< VIEW_CHASE
VIEW_EXTERNAL =52, //!< VIEW_EXTERNAL
VIEW_EXTERNAL_TOGGLE_CAMERA_LOCK =53, //!< VIEW_EXTERNAL_TOGGLE_CAMERA_LOCK
VIEW_SLEW =54, //!< VIEW_SLEW
VIEW_OTHER_SHIP =55, //!< VIEW_OTHER_SHIP
VIEW_DIST_INCREASE =56, //!< VIEW_DIST_INCREASE
VIEW_DIST_DECREASE =57, //!< VIEW_DIST_DECREASE
VIEW_CENTER =58, //!< VIEW_CENTER
PADLOCK_UP =59, //!< PADLOCK_UP
PADLOCK_DOWN =60, //!< PADLOCK_DOWN
PADLOCK_LEFT =61, //!< PADLOCK_LEFT
PADLOCK_RIGHT =62, //!< PADLOCK_RIGHT
//!< @n
//!< Misc Controls 1
//!< -----------------
RADAR_RANGE_CYCLE =63, //!< cycle to next radar range
SQUADMSG_MENU =64, //!< toggle the squadmate messaging menu
SHOW_GOALS =65, //!< show the mission goals screen
END_MISSION =66, //!< end the mission
TARGET_TARGETS_TARGET =67, //!< target your target's target
AFTERBURNER =68, //!< AFTERBURNER
RADAR_RANGE_CYCLE =63, //!< cycle to next radar range
SQUADMSG_MENU =64, //!< toggle the squadmate messaging menu
SHOW_GOALS =65, //!< show the mission goals screen
END_MISSION =66, //!< end the mission
TARGET_TARGETS_TARGET =67, //!< target your target's target
AFTERBURNER =68, //!< AFTERBURNER
//!< @n
//!< ETS
//!< -----
INCREASE_WEAPON =69, //!< increase weapon recharge rate
DECREASE_WEAPON =70, //!< decrease weapon recharge rate
INCREASE_SHIELD =71, //!< increase shield recharge rate
DECREASE_SHIELD =72, //!< decrease shield recharge rate
INCREASE_ENGINE =73, //!< increase energy to engines
DECREASE_ENGINE =74, //!< decrease energy to engines
ETS_EQUALIZE =75, //!< equalize recharge rates
SHIELD_EQUALIZE =76, //!< equalize shield energy to all quadrants
SHIELD_XFER_TOP =77, //!< transfer shield energy to front
SHIELD_XFER_BOTTOM =78, //!< transfer shield energy to rear
SHIELD_XFER_LEFT =79, //!< transfer shield energy to left
SHIELD_XFER_RIGHT =80, //!< transfer shield energy to right
XFER_SHIELD =81, //!< transfer energy to shield from weapons
XFER_LASER =82, //!< transfer energy to weapons from shield
INCREASE_WEAPON =69, //!< increase weapon recharge rate
DECREASE_WEAPON =70, //!< decrease weapon recharge rate
INCREASE_SHIELD =71, //!< increase shield recharge rate
DECREASE_SHIELD =72, //!< decrease shield recharge rate
INCREASE_ENGINE =73, //!< increase energy to engines
DECREASE_ENGINE =74, //!< decrease energy to engines
ETS_EQUALIZE =75, //!< equalize recharge rates
SHIELD_EQUALIZE =76, //!< equalize shield energy to all quadrants
SHIELD_XFER_TOP =77, //!< transfer shield energy to front
SHIELD_XFER_BOTTOM =78, //!< transfer shield energy to rear
SHIELD_XFER_LEFT =79, //!< transfer shield energy to left
SHIELD_XFER_RIGHT =80, //!< transfer shield energy to right
XFER_SHIELD =81, //!< transfer energy to shield from weapons
XFER_LASER =82, //!< transfer energy to weapons from shield
//!< @n
//!< Misc Controls 2
//!< -----------------
GLIDE_WHEN_PRESSED =83, //!< GLIDE_WHEN_PRESSED
GLIDE_WHEN_PRESSED =83, //!< GLIDE_WHEN_PRESSED
//!< @remark Backslash -- this was a convenient place for Glide When Pressed, since Show Damage Popup isn't used
BANK_WHEN_PRESSED =84, //!< BANK_WHEN_PRESSED
SHOW_NAVMAP =85, //!< SHOW_NAVMAP
ADD_REMOVE_ESCORT =86, //!< ADD_REMOVE_ESCORT
ESCORT_CLEAR =87, //!< ESCORT_CLEAR
BANK_WHEN_PRESSED =84, //!< BANK_WHEN_PRESSED
SHOW_NAVMAP =85, //!< SHOW_NAVMAP
ADD_REMOVE_ESCORT =86, //!< ADD_REMOVE_ESCORT
ESCORT_CLEAR =87, //!< ESCORT_CLEAR
TARGET_NEXT_ESCORT_SHIP =88, //!< TARGET_NEXT_ESCORT_SHIP
TARGET_CLOSEST_REPAIR_SHIP =89, //!< target the closest repair ship
TARGET_NEXT_UNINSPECTED_CARGO =90, //!< TARGET_NEXT_UNINSPECTED_CARGO
TARGET_PREV_UNINSPECTED_CARGO =91, //!< TARGET_PREV_UNINSPECTED_CARGO
TARGET_NEWEST_SHIP =92, //!< TARGET_NEWEST_SHIP
TARGET_NEXT_ESCORT_SHIP =88, //!< TARGET_NEXT_ESCORT_SHIP
TARGET_CLOSEST_REPAIR_SHIP =89, //!< target the closest repair ship
TARGET_NEXT_UNINSPECTED_CARGO =90, //!< TARGET_NEXT_UNINSPECTED_CARGO
TARGET_PREV_UNINSPECTED_CARGO =91, //!< TARGET_PREV_UNINSPECTED_CARGO
TARGET_NEWEST_SHIP =92, //!< TARGET_NEWEST_SHIP
TARGET_NEXT_LIVE_TURRET =93, //!< TARGET_NEXT_LIVE_TURRET
TARGET_PREV_LIVE_TURRET =94, //!< TARGET_PREV_LIVE_TURRET
TARGET_NEXT_LIVE_TURRET =93, //!< TARGET_NEXT_LIVE_TURRET
TARGET_PREV_LIVE_TURRET =94, //!< TARGET_PREV_LIVE_TURRET
TARGET_NEXT_BOMB =95, //!< TARGET_NEXT_BOMB
TARGET_PREV_BOMB =96, //!< TARGET_PREV_BOMB
TARGET_NEXT_BOMB =95, //!< TARGET_NEXT_BOMB
TARGET_PREV_BOMB =96, //!< TARGET_PREV_BOMB
//!< @n
//!< Multiplayer messaging keys
//!< ----------------------------
MULTI_MESSAGE_ALL =97, //!< message all netplayers
MULTI_MESSAGE_FRIENDLY =98, //!< message all friendlies
MULTI_MESSAGE_HOSTILE =99, //!< message all hostiles
MULTI_MESSAGE_TARGET =100, //!< message targeted ship (if player)
MULTI_MESSAGE_ALL =97, //!< message all netplayers
MULTI_MESSAGE_FRIENDLY =98, //!< message all friendlies
MULTI_MESSAGE_HOSTILE =99, //!< message all hostiles
MULTI_MESSAGE_TARGET =100, //!< message targeted ship (if player)
//!< @n
//!< Multiplayer misc keys
//!< -----------------------
MULTI_OBSERVER_ZOOM_TO =101, //!< if i'm an observer, zoom to my targeted object
MULTI_OBSERVER_ZOOM_TO =101, //!< if i'm an observer, zoom to my targeted object
TIME_SPEED_UP =102, //!< TIME_SPEED_UP
TIME_SLOW_DOWN =103, //!< TIME_SLOW_DOWN
TIME_SPEED_UP =102, //!< TIME_SPEED_UP
TIME_SLOW_DOWN =103, //!< TIME_SLOW_DOWN
TOGGLE_HUD_CONTRAST =104, //!< toggle between high and low HUD contrast
TOGGLE_HUD_CONTRAST =104, //!< toggle between high and low HUD contrast
MULTI_TOGGLE_NETINFO =105, //!< toggle network info
MULTI_TOGGLE_NETINFO =105, //!< toggle network info
MULTI_SELF_DESTRUCT =106, //!< self destruct (multiplayer only)
MULTI_SELF_DESTRUCT =106, //!< self destruct (multiplayer only)
//!< @n
//!< Misc Controls 3
//!< -----------------
TOGGLE_HUD =107, //!< TOGGLE_HUD
RIGHT_SLIDE_THRUST =108, //!< RIGHT_SLIDE_THRUST
LEFT_SLIDE_THRUST =109, //!< LEFT_SLIDE_THRUST
UP_SLIDE_THRUST =110, //!< UP_SLIDE_THRUST
DOWN_SLIDE_THRUST =111, //!< DOWN_SLIDE_THRUST
HUD_TARGETBOX_TOGGLE_WIREFRAME =112, //!< HUD_TARGETBOX_TOGGLE_WIREFRAME
VIEW_TOPDOWN =113, //!< VIEW_TOPDOWN
VIEW_TRACK_TARGET =114, //!< VIEW_TRACK_TARGET
TOGGLE_HUD =107, //!< TOGGLE_HUD
RIGHT_SLIDE_THRUST =108, //!< RIGHT_SLIDE_THRUST
LEFT_SLIDE_THRUST =109, //!< LEFT_SLIDE_THRUST
UP_SLIDE_THRUST =110, //!< UP_SLIDE_THRUST
DOWN_SLIDE_THRUST =111, //!< DOWN_SLIDE_THRUST
HUD_TARGETBOX_TOGGLE_WIREFRAME =112, //!< HUD_TARGETBOX_TOGGLE_WIREFRAME
VIEW_TOPDOWN =113, //!< VIEW_TOPDOWN
VIEW_TRACK_TARGET =114, //!< VIEW_TRACK_TARGET
//!< @n
//!< AutoPilot - Kazan
//!< -------------------
AUTO_PILOT_TOGGLE =115, //!< Autopilot key control
NAV_CYCLE =116, //!< NAV_CYCLE
AUTO_PILOT_TOGGLE =115, //!< Autopilot key control
NAV_CYCLE =116, //!< NAV_CYCLE
//!< @n
//!< Gliding
//!< ---------
TOGGLE_GLIDING =117, //!< TOGGLE_GLIDING
TOGGLE_GLIDING =117, //!< TOGGLE_GLIDING
//!< @n
//!< Additional weapon controls
//!< ----------------------------
CYCLE_PRIMARY_WEAPON_SEQUENCE =118, //!< cycle num primaries to fire at once
CYCLE_PRIMARY_WEAPON_SEQUENCE =118, //!< cycle num primaries to fire at once
/*!
* This must always be below the last defined item
*/
CCFG_MAX //!< The total number of defined control actions (or last define + 1)
CCFG_MAX //!< The total number of defined control actions (or last define + 1)
};
extern int Failed_key_index;
+191 -154
View File
@@ -41,167 +41,168 @@ int Invert_axis[JOY_NUM_AXES] = { 0, 0, 0, 0, 0, 0 };
int Invert_axis_defaults[JOY_NUM_AXES] = { 0, 0, 0, 0, 0, 0 };
//! arrays which hold the key mappings. The array index represents a key-independent action.
//! please use SPACES for aligning the fields of this array
//XSTR:OFF
config_item Control_config[CCFG_MAX + 1] = {
// targeting a ship
{ KEY_T, -1, TARGET_TAB, true, "Target Next Ship" },
{ KEY_SHIFTED | KEY_T, -1, TARGET_TAB, true, "Target Previous Ship" },
{ KEY_H, 2, TARGET_TAB, true, "Target Next Closest Hostile Ship" },
{ KEY_SHIFTED | KEY_H, -1, TARGET_TAB, true, "Target Previous Closest Hostile Ship" },
{ KEY_ALTED | KEY_H, -1, TARGET_TAB, true, "Toggle Auto Targeting" },
{ KEY_F, -1, TARGET_TAB, true, "Target Next Closest Friendly Ship" },
{ KEY_SHIFTED | KEY_F, -1, TARGET_TAB, true, "Target Previous Closest Friendly Ship" },
{ KEY_Y, 4, TARGET_TAB, true, "Target Ship in Reticle" },
{ KEY_G, -1, TARGET_TAB, true, "Target Target's Nearest Attacker" },
{ KEY_ALTED | KEY_Y, -1, TARGET_TAB, true, "Target Last Ship to Send Transmission" },
{ KEY_ALTED | KEY_T, -1, TARGET_TAB, true, "Turn Off Targeting" },
{ KEY_T, -1, TARGET_TAB, true, "Target Next Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_T, -1, TARGET_TAB, true, "Target Previous Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_H, 2, TARGET_TAB, true, "Target Next Closest Hostile Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_H, -1, TARGET_TAB, true, "Target Previous Closest Hostile Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_ALTED | KEY_H, -1, TARGET_TAB, true, "Toggle Auto Targeting", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_F, -1, TARGET_TAB, true, "Target Next Closest Friendly Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_F, -1, TARGET_TAB, true, "Target Previous Closest Friendly Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_Y, 4, TARGET_TAB, true, "Target Ship in Reticle", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_G, -1, TARGET_TAB, true, "Target Target's Nearest Attacker", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_ALTED | KEY_Y, -1, TARGET_TAB, true, "Target Last Ship to Send Transmission", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_ALTED | KEY_T, -1, TARGET_TAB, true, "Turn Off Targeting", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
// targeting a ship's subsystem
{ KEY_V, -1, TARGET_TAB, true, "Target Subsystem in Reticle" },
{ KEY_S, -1, TARGET_TAB, true, "Target Next Subsystem" },
{ KEY_SHIFTED | KEY_S, -1, TARGET_TAB, true, "Target Previous Subsystem" },
{ KEY_ALTED | KEY_S, -1, TARGET_TAB, true, "Turn Off Targeting of Subsystems" },
{ KEY_V, -1, TARGET_TAB, true, "Target Subsystem in Reticle", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_S, -1, TARGET_TAB, true, "Target Next Subsystem", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_S, -1, TARGET_TAB, true, "Target Previous Subsystem", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_ALTED | KEY_S, -1, TARGET_TAB, true, "Turn Off Targeting of Subsystems", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
// matching speed
{ KEY_M, -1, COMPUTER_TAB, true, "Match Target Speed" },
{ KEY_ALTED | KEY_M, -1, COMPUTER_TAB, true, "Toggle Auto Speed Matching" },
{ KEY_M, -1, COMPUTER_TAB, true, "Match Target Speed", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_ALTED | KEY_M, -1, COMPUTER_TAB, true, "Toggle Auto Speed Matching", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
// weapons
{ KEY_LCTRL, 0, WEAPON_TAB, true, "Fire Primary Weapon", CC_TYPE_CONTINUOUS },
{ KEY_SPACEBAR, 1, WEAPON_TAB, true, "Fire Secondary Weapon", CC_TYPE_CONTINUOUS },
{ KEY_PERIOD, -1, WEAPON_TAB, true, "Cycle Forward Primary Weapon" },
{ KEY_COMMA, -1, WEAPON_TAB, true, "Cycle Backward Primary Weapon" },
{ KEY_DIVIDE, -1, WEAPON_TAB, true, "Cycle Secondary Weapon Bank" },
{ KEY_SHIFTED | KEY_DIVIDE, -1, WEAPON_TAB, true, "Cycle Secondary Weapon Firing Rate" },
{ KEY_X, 3, WEAPON_TAB, true, "Launch Countermeasure" },
{ KEY_LCTRL, 0, WEAPON_TAB, true, "Fire Primary Weapon", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_SPACEBAR, 1, WEAPON_TAB, true, "Fire Secondary Weapon", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_PERIOD, -1, WEAPON_TAB, true, "Cycle Forward Primary Weapon", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_COMMA, -1, WEAPON_TAB, true, "Cycle Backward Primary Weapon", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_DIVIDE, -1, WEAPON_TAB, true, "Cycle Secondary Weapon Bank", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_DIVIDE, -1, WEAPON_TAB, true, "Cycle Secondary Weapon Firing Rate", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_X, 3, WEAPON_TAB, true, "Launch Countermeasure", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
// controls
{ KEY_A, -1, SHIP_TAB, true, "Forward Thrust", CC_TYPE_CONTINUOUS },
{ KEY_Z, -1, SHIP_TAB, true, "Reverse Thrust", CC_TYPE_CONTINUOUS },
{ KEY_PAD7, -1, SHIP_TAB, true, "Bank Left", CC_TYPE_CONTINUOUS },
{ KEY_PAD9, -1, SHIP_TAB, true, "Bank Right", CC_TYPE_CONTINUOUS },
{ KEY_PAD8, -1, SHIP_TAB, true, "Pitch Forward", CC_TYPE_CONTINUOUS },
{ KEY_PAD2, -1, SHIP_TAB, true, "Pitch Backward", CC_TYPE_CONTINUOUS },
{ KEY_PAD4, -1, SHIP_TAB, true, "Turn Left", CC_TYPE_CONTINUOUS },
{ KEY_PAD6, -1, SHIP_TAB, true, "Turn Right", CC_TYPE_CONTINUOUS },
{ KEY_A, -1, SHIP_TAB, true, "Forward Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_Z, -1, SHIP_TAB, true, "Reverse Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_PAD7, -1, SHIP_TAB, true, "Bank Left", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_PAD9, -1, SHIP_TAB, true, "Bank Right", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_PAD8, -1, SHIP_TAB, true, "Pitch Forward", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_PAD2, -1, SHIP_TAB, true, "Pitch Backward", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_PAD4, -1, SHIP_TAB, true, "Turn Left", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_PAD6, -1, SHIP_TAB, true, "Turn Right", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
// throttle controls
{ KEY_BACKSP, -1, SHIP_TAB, true, "Set Throttle to Zero" },
{ KEY_SLASH, -1, SHIP_TAB, true, "Set Throttle to Max" },
{ KEY_LBRACKET, -1, SHIP_TAB, true, "Set Throttle to One-Third" },
{ KEY_RBRACKET, -1, SHIP_TAB, true, "Set Throttle to Two-Thirds" },
{ KEY_EQUAL, -1, SHIP_TAB, true, "Increase Throttle 5 Percent" },
{ KEY_MINUS, -1, SHIP_TAB, true, "Decrease Throttle 5 Percent" },
{ KEY_BACKSP, -1, SHIP_TAB, true, "Set Throttle to Zero", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SLASH, -1, SHIP_TAB, true, "Set Throttle to Max", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_LBRACKET, -1, SHIP_TAB, true, "Set Throttle to One-Third", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_RBRACKET, -1, SHIP_TAB, true, "Set Throttle to Two-Thirds", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_EQUAL, -1, SHIP_TAB, true, "Increase Throttle 5 Percent", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_MINUS, -1, SHIP_TAB, true, "Decrease Throttle 5 Percent", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
// squadmate messaging
{ KEY_SHIFTED | KEY_A, -1, COMPUTER_TAB, true, "Attack My Target" },
{ KEY_SHIFTED | KEY_Z, -1, COMPUTER_TAB, true, "Disarm My Target" },
{ KEY_SHIFTED | KEY_D, -1, COMPUTER_TAB, true, "Disable My Target" },
{ KEY_SHIFTED | KEY_V, -1, COMPUTER_TAB, true, "Attack My Subsystem" },
{ KEY_SHIFTED | KEY_X, -1, COMPUTER_TAB, true, "Capture My Target" },
{ KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, true, "Engage Enemy" },
{ KEY_SHIFTED | KEY_W, -1, COMPUTER_TAB, true, "Form on My Wing" },
{ KEY_SHIFTED | KEY_I, -1, COMPUTER_TAB, true, "Ignore My Target" },
{ KEY_SHIFTED | KEY_P, -1, COMPUTER_TAB, true, "Protect My Target" },
{ KEY_SHIFTED | KEY_C, -1, COMPUTER_TAB, true, "Cover Me" },
{ KEY_SHIFTED | KEY_J, -1, COMPUTER_TAB, true, "Return to Base" },
{ KEY_SHIFTED | KEY_R, -1, COMPUTER_TAB, true, "Rearm Me" },
{ KEY_SHIFTED | KEY_A, -1, COMPUTER_TAB, true, "Attack My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_Z, -1, COMPUTER_TAB, true, "Disarm My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_D, -1, COMPUTER_TAB, true, "Disable My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_V, -1, COMPUTER_TAB, true, "Attack My Subsystem", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_X, -1, COMPUTER_TAB, true, "Capture My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, true, "Engage Enemy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_W, -1, COMPUTER_TAB, true, "Form on My Wing", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_I, -1, COMPUTER_TAB, true, "Ignore My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_P, -1, COMPUTER_TAB, true, "Protect My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_C, -1, COMPUTER_TAB, true, "Cover Me", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_J, -1, COMPUTER_TAB, true, "Return to Base", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_R, -1, COMPUTER_TAB, true, "Rearm Me", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_R, 6, TARGET_TAB, true, "Target Closest Attacking Ship" },
{ KEY_R, 6, TARGET_TAB, true, "Target Closest Attacking Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
// Views
{ KEY_PADMULTIPLY, -1, COMPUTER_TAB, true, "Chase View" },
{ KEY_PADPERIOD, -1, COMPUTER_TAB, true, "External View"},
{ KEY_PADENTER, -1, COMPUTER_TAB, true, "Toggle External Camera Lock"},
{ KEY_PAD0, -1, COMPUTER_TAB, true, "Free Look View", CC_TYPE_CONTINUOUS }, // Not in use anymore (Swifty)
{ KEY_PADDIVIDE, -1, COMPUTER_TAB, true, "Current Target View" },
{ KEY_PADPLUS, -1, COMPUTER_TAB, true, "Increase View Distance", CC_TYPE_CONTINUOUS },
{ KEY_PADMINUS, -1, COMPUTER_TAB, true, "Decrease View Distance", CC_TYPE_CONTINUOUS },
{ KEY_PAD5, -1, COMPUTER_TAB, true, "Center View", CC_TYPE_CONTINUOUS },
{ -1, 33, COMPUTER_TAB, true, "View Up", CC_TYPE_CONTINUOUS },
{ -1, 32, COMPUTER_TAB, true, "View Rear", CC_TYPE_CONTINUOUS },
{ -1, 34, COMPUTER_TAB, true, "View Left", CC_TYPE_CONTINUOUS },
{ -1, 35, COMPUTER_TAB, true, "View Right", CC_TYPE_CONTINUOUS },
{ KEY_PADMULTIPLY, -1, COMPUTER_TAB, true, "Chase View", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_PADPERIOD, -1, COMPUTER_TAB, true, "External View", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_PADENTER, -1, COMPUTER_TAB, true, "Toggle External Camera Lock", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_PAD0, -1, COMPUTER_TAB, true, "Free Look View", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false }, // Not in use anymore (Swifty)
{ KEY_PADDIVIDE, -1, COMPUTER_TAB, true, "Current Target View", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_PADPLUS, -1, COMPUTER_TAB, true, "Increase View Distance", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_PADMINUS, -1, COMPUTER_TAB, true, "Decrease View Distance", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_PAD5, -1, COMPUTER_TAB, true, "Center View", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ -1, 33, COMPUTER_TAB, true, "View Up", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ -1, 32, COMPUTER_TAB, true, "View Rear", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ -1, 34, COMPUTER_TAB, true, "View Left", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ -1, 35, COMPUTER_TAB, true, "View Right", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_RAPOSTRO, -1, COMPUTER_TAB, true, "Cycle Radar Range" },
{ KEY_C, -1, COMPUTER_TAB, true, "Communications Menu" },
{ -1, -1, -1, true, "Show Objectives" },
{ KEY_ALTED | KEY_J, -1, COMPUTER_TAB, true, "Enter Subspace (End Mission)" },
{ KEY_J, -1, TARGET_TAB, true, "Target Target's Target" },
{ KEY_TAB, 5, SHIP_TAB, true, "Afterburner", CC_TYPE_CONTINUOUS },
{ KEY_RAPOSTRO, -1, COMPUTER_TAB, true, "Cycle Radar Range", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_C, -1, COMPUTER_TAB, true, "Communications Menu", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ -1, -1, -1, true, "Show Objectives", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_ALTED | KEY_J, -1, COMPUTER_TAB, true, "Enter Subspace (End Mission)", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_J, -1, TARGET_TAB, true, "Target Target's Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_TAB, 5, SHIP_TAB, true, "Afterburner", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_INSERT, -1, COMPUTER_TAB, true, "Increase Weapon Energy" },
{ KEY_DELETE, -1, COMPUTER_TAB, true, "Decrease Weapon Energy" },
{ KEY_HOME, -1, COMPUTER_TAB, true, "Increase Shield Energy" },
{ KEY_END, -1, COMPUTER_TAB, true, "Decrease Shield Energy" },
{ KEY_PAGEUP, -1, COMPUTER_TAB, true, "Increase Engine Energy" },
{ KEY_PAGEDOWN, -1, COMPUTER_TAB, true, "Decrease Engine Energy" },
{ KEY_ALTED | KEY_D, -1, COMPUTER_TAB, true, "Equalize Energy Settings" },
{ KEY_INSERT, -1, COMPUTER_TAB, true, "Increase Weapon Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_DELETE, -1, COMPUTER_TAB, true, "Decrease Weapon Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_HOME, -1, COMPUTER_TAB, true, "Increase Shield Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_END, -1, COMPUTER_TAB, true, "Decrease Shield Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_PAGEUP, -1, COMPUTER_TAB, true, "Increase Engine Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_PAGEDOWN, -1, COMPUTER_TAB, true, "Decrease Engine Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_ALTED | KEY_D, -1, COMPUTER_TAB, true, "Equalize Energy Settings", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_Q, 7, COMPUTER_TAB, true, "Equalize Shields" },
{ KEY_UP, -1, COMPUTER_TAB, true, "Augment Forward Shield" },
{ KEY_DOWN, -1, COMPUTER_TAB, true, "Augment Rear Shield" },
{ KEY_LEFT, -1, COMPUTER_TAB, true, "Augment Left Shield" },
{ KEY_RIGHT, -1, COMPUTER_TAB, true, "Augment Right Shield" },
{ KEY_SCROLLOCK, -1, COMPUTER_TAB, true, "Transfer Energy Laser->Shield" },
{ KEY_SHIFTED | KEY_SCROLLOCK, -1, COMPUTER_TAB, true, "Transfer Energy Shield->Laser" },
// { -1, -1, -1, true, "Show Damage Popup Window" },
{ KEY_Q, 7, COMPUTER_TAB, true, "Equalize Shields", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_UP, -1, COMPUTER_TAB, true, "Augment Forward Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_DOWN, -1, COMPUTER_TAB, true, "Augment Rear Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_LEFT, -1, COMPUTER_TAB, true, "Augment Left Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_RIGHT, -1, COMPUTER_TAB, true, "Augment Right Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SCROLLOCK, -1, COMPUTER_TAB, true, "Transfer Energy Laser->Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_SCROLLOCK, -1, COMPUTER_TAB, true, "Transfer Energy Shield->Laser", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
// { -1, -1, -1, true, "Show Damage Popup Window" },
{ -1, -1, SHIP_TAB, false, "Glide When Pressed", CC_TYPE_CONTINUOUS },
{ -1, -1, SHIP_TAB, false, "Glide When Pressed", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
//Backslash -- this was a convenient place for Glide When Pressed, as Show Damage Popup isn't used
{ -1, -1, SHIP_TAB, true, "Bank When Pressed", CC_TYPE_CONTINUOUS },
{ -1, -1, -1, true, "Show Nav Map" },
{ KEY_ALTED | KEY_E, -1, COMPUTER_TAB, true, "Add or Remove Escort" },
{ KEY_ALTED | KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, true, "Clear Escort List" },
{ KEY_E, -1, TARGET_TAB, true, "Target Next Escort Ship" },
{ KEY_ALTED | KEY_R, -1, TARGET_TAB, true, "Target Closest Repair Ship" },
{ -1, -1, SHIP_TAB, true, "Bank When Pressed", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ -1, -1, -1, true, "Show Nav Map", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_ALTED | KEY_E, -1, COMPUTER_TAB, true, "Add or Remove Escort", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_ALTED | KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, true, "Clear Escort List", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_E, -1, TARGET_TAB, true, "Target Next Escort Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_ALTED | KEY_R, -1, TARGET_TAB, true, "Target Closest Repair Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_U, -1, TARGET_TAB, true, "Target Next Uninspected Cargo" },
{ KEY_SHIFTED | KEY_U, -1, TARGET_TAB, true, "Target Previous Uninspected Cargo" },
{ KEY_N, -1, TARGET_TAB, true, "Target Newest Ship in Area" },
{ KEY_K, -1, TARGET_TAB, true, "Target Next Live Turret" },
{ KEY_SHIFTED | KEY_K, -1, TARGET_TAB, true, "Target Previous Live Turret" },
{ KEY_U, -1, TARGET_TAB, true, "Target Next Uninspected Cargo", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_U, -1, TARGET_TAB, true, "Target Previous Uninspected Cargo", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_N, -1, TARGET_TAB, true, "Target Newest Ship in Area", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_K, -1, TARGET_TAB, true, "Target Next Live Turret", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_K, -1, TARGET_TAB, true, "Target Previous Live Turret", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_B, -1, TARGET_TAB, true, "Target Next Hostile Bomb or Bomber" },
{ KEY_SHIFTED | KEY_B, -1, TARGET_TAB, true, "Target Previous Hostile Bomb or Bomber" },
{ KEY_B, -1, TARGET_TAB, true, "Target Next Hostile Bomb or Bomber", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_B, -1, TARGET_TAB, true, "Target Previous Hostile Bomb or Bomber", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
// 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_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" },
{ KEY_L, -1, COMPUTER_TAB, true, "Toggle High HUD Contrast" },
{ KEY_SHIFTED | KEY_N, -1, COMPUTER_TAB, true, "(Multiplayer) Toggle Network Info"},
{ KEY_SHIFTED | KEY_END, -1, COMPUTER_TAB, true, "(Multiplayer) Self Destruct"},
{ KEY_1, -1, COMPUTER_TAB, true, "(Multiplayer) Message All", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_2, -1, COMPUTER_TAB, true, "(Multiplayer) Message Friendly", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_3, -1, COMPUTER_TAB, true, "(Multiplayer) Message Hostile", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_4, -1, COMPUTER_TAB, true, "(Multiplayer) Message Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_ALTED | KEY_X, -1, COMPUTER_TAB, true, "(Multiplayer) Observer Zoom to Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_PERIOD, -1, COMPUTER_TAB, true, "Increase Time Compression", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_COMMA, -1, COMPUTER_TAB, true, "Decrease Time Compression", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_L, -1, COMPUTER_TAB, true, "Toggle High HUD Contrast", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_N, -1, COMPUTER_TAB, true, "(Multiplayer) Toggle Network Info", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_END, -1, COMPUTER_TAB, true, "(Multiplayer) Self Destruct", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
// Misc
{ KEY_SHIFTED | KEY_O, -1, COMPUTER_TAB, true, "Toggle HUD"},
{ KEY_SHIFTED | KEY_3, -1, SHIP_TAB, true, "Right Thrust", CC_TYPE_CONTINUOUS},
{ KEY_SHIFTED | KEY_1, -1, SHIP_TAB, true, "Left Thrust", CC_TYPE_CONTINUOUS},
{ KEY_SHIFTED | KEY_PADPLUS, -1, SHIP_TAB, true, "Up Thrust", CC_TYPE_CONTINUOUS},
{ KEY_SHIFTED | KEY_PADENTER, -1, SHIP_TAB, true, "Down Thrust", CC_TYPE_CONTINUOUS},
{ KEY_ALTED | KEY_SHIFTED | KEY_Q, -1, COMPUTER_TAB, true, "Toggle HUD Wireframe Target View"},
{ -1, -1, COMPUTER_TAB, false, "Top-Down View"},
{ -1, -1, COMPUTER_TAB, false, "Target Padlock View"}, // (Swifty) Toggle for VM_TRACK
{ KEY_SHIFTED | KEY_O, -1, COMPUTER_TAB, true, "Toggle HUD", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_3, -1, SHIP_TAB, true, "Right Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_1, -1, SHIP_TAB, true, "Left Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_PADPLUS, -1, SHIP_TAB, true, "Up Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_SHIFTED | KEY_PADENTER, -1, SHIP_TAB, true, "Down Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
{ KEY_ALTED | KEY_SHIFTED | KEY_Q, -1, COMPUTER_TAB, true, "Toggle HUD Wireframe Target View", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ -1, -1, COMPUTER_TAB, false, "Top-Down View", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ -1, -1, COMPUTER_TAB, false, "Target Padlock View", CC_TYPE_TRIGGER, -1, -1, 0, false, false }, // (Swifty) Toggle for VM_TRACK
// Auto Navigation Systen
{ KEY_ALTED | KEY_A, -1, COMPUTER_TAB, false, "Toggle Auto Pilot"},
{ KEY_ALTED | KEY_N, -1, COMPUTER_TAB, false, "Cycle Nav Points"},
{ KEY_ALTED | KEY_G, -1, SHIP_TAB, false, "Toggle Gliding"},
{ KEY_O, -1, WEAPON_TAB, false, "Cycle Primary Weapon Firing Rate" },
{ -1, -1, -1, false, "" }
{ KEY_ALTED | KEY_A, -1, COMPUTER_TAB, false, "Toggle Auto Pilot", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_ALTED | KEY_N, -1, COMPUTER_TAB, false, "Cycle Nav Points", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_ALTED | KEY_G, -1, SHIP_TAB, false, "Toggle Gliding", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ KEY_O, -1, WEAPON_TAB, false, "Cycle Primary Weapon Firing Rate", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
{ -1, -1, -1, false, "", CC_TYPE_TRIGGER, -1, -1, 0, false, false }
};
char *Scan_code_text_german[] = {
"", "Esc", "1", "2", "3", "4", "5", "6",
"7", "8", "9", "0", "Akzent '", "\xE1", "R\x81""cktaste", "Tab",
"7", "8", "9", "0", "Akzent '", "Eszett", "R\x81""cktaste", "Tab",
"Q", "W", "E", "R", "T", "Z", "U", "I",
"O", "P", "\x9A", "+", "Eingabe", "Strg Links", "A", "S",
"D", "F", "G", "H", "J", "K", "L", "\x99",
"\xAE", "`", "Shift", "#", "Y", "X", "C", "V",
"\x8E", "`", "Shift", "#", "Y", "X", "C", "V",
"B", "N", "M", ",", ".", "-", "Shift", "Num *",
"Alt", "Leertaste", "Hochstell", "F1", "F2", "F3", "F4", "F5",
@@ -296,6 +297,57 @@ char *Joy_button_text_french[] = {
"Bouton 31", "Bouton 32", "Chapeau Arri\x8Are", "Chapeau Avant", "Chapeau Gauche", "Chapeau Droite"
};
char *Scan_code_text_polish[] = {
"", "Esc", "1", "2", "3", "4", "5", "6",
"7", "8", "9", "0", "-", "=", "Backspace", "Tab",
"Q", "W", "E", "R", "T", "Y", "U", "I",
"O", "P", "[", "]", "Enter", "Lewy Ctrl", "A", "S",
"D", "F", "G", "H", "J", "K", "L", ";",
"'", "`", "LShift", "\\", "Z", "X", "C", "V",
"B", "N", "M", ",", ".", "/", "PShift", "Num *",
"Alt", "Spacja", "CapsLock", "F1", "F2", "F3", "F4", "F5",
"F6", "F7", "F8", "F9", "F10", "Pause", "Scrlock", "Num 7",
"Num 8", "Num 9", "Num -", "Num 4", "Num 5", "Num 6", "Num +", "Num 1",
"Num 2", "Num 3", "Num 0", "Num .", "", "", "", "F11",
"F12", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "Num Enter", "Prawy Ctrl", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "Num /", "", "PrntScr",
"Alt", "", "", "", "", "", "", "",
"", "", "", "", "", "Num Lock", "", "Home",
"Kursor G\xF3ra", "Page Up", "", "Kursor Lewo", "", "Kursor Prawo", "", "End",
"Kursor D\xF3\xB3", "Page Down", "Insert", "Delete", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
};
char *Joy_button_text_polish[] = {
"Przyc.1", "Przyc.2", "Przyc.3", "Przyc.4", "Przyc.5", "Przyc.6",
"Przyc.7", "Przyc.8", "Przyc.9", "Przyc.10", "Przyc.11", "Przyc.12",
"Przyc.13", "Przyc.14", "Przyc.15", "Przyc.16", "Przyc.17", "Przyc.18",
"Przyc.19", "Przyc.20", "Przyc.21", "Przyc.22", "Przyc.23", "Przyc.24",
"Przyc.25", "Przyc.26", "Przyc.27", "Przyc.28", "Przyc.29", "Przyc.30",
"Przyc.31", "Przyc.32", "Hat Ty\xB3", "Hat Prz\xF3\x64", "Hat Lewo", "Hat Prawo"
};
//! This is the text that is displayed on the screen for the keys a player selects
char *Scan_code_text_english[] = {
"", "Esc", "1", "2", "3", "4", "5", "6",
@@ -385,13 +437,7 @@ int translate_key_to_index(const char *key, bool find_override)
{
int i, index = -1, alt = 0, shift = 0, max_scan_codes;
if (Lcl_gr) {
max_scan_codes = sizeof(Scan_code_text_german) / sizeof(char *);
} else if (Lcl_fr) {
max_scan_codes = sizeof(Scan_code_text_french) / sizeof(char *);
} else {
max_scan_codes = sizeof(Scan_code_text_english) / sizeof(char *);
}
max_scan_codes = sizeof(Scan_code_text_english) / sizeof(char *);
// look for modifiers
Assert(key);
@@ -402,17 +448,7 @@ int translate_key_to_index(const char *key, bool find_override)
key++;
}
char *translated_shift;
if(Lcl_gr){
translated_shift = "Shift";
} else if(Lcl_fr){
translated_shift = "Maj.";
} else {
translated_shift = "Shift";
}
if (!strnicmp(key, translated_shift, 5)) {
if (!strnicmp(key, "Shift", 5)) {
shift = 1;
key += 5;
if (*key)
@@ -438,14 +474,14 @@ int translate_key_to_index(const char *key, bool find_override)
// convert scancode to Control_config index
if (find_override) {
for (i=0; i<CCFG_MAX; i++) {
if (Control_config[i].key_id == index) {
if (!Control_config[i].disabled && Control_config[i].key_id == index) {
index = i;
break;
}
}
} else {
for (i=0; i<CCFG_MAX; i++) {
if (Control_config[i].key_default == index) {
if (!Control_config[i].disabled && Control_config[i].key_default == index) {
index = i;
break;
}
@@ -561,15 +597,12 @@ void control_config_common_init()
if(Lcl_gr){
Scan_code_text = Scan_code_text_german;
Joy_button_text = Joy_button_text_german;
// swap init bindings for y and z keys
Control_config[TARGET_SHIP_IN_RETICLE].key_default = KEY_Z;
Control_config[TARGET_LAST_TRANMISSION_SENDER].key_default = KEY_ALTED | KEY_Z;
Control_config[REVERSE_THRUST].key_default = KEY_Y;
Control_config[DISARM_MESSAGE].key_default = KEY_SHIFTED | KEY_Y;
} else if(Lcl_fr){
Scan_code_text = Scan_code_text_french;
Joy_button_text = Joy_button_text_french;
} else if(Lcl_pl){
Scan_code_text = Scan_code_text_polish;
Joy_button_text = Joy_button_text_polish;
} else {
Scan_code_text = Scan_code_text_english;
Joy_button_text = Joy_button_text_english;
@@ -801,8 +834,12 @@ void control_config_common_load_overrides()
int iTemp;
if (optional_string("$Key Default:")) {
stuff_string(szTempBuffer, F_NAME, iBufferLength);
r_ccConfig.key_default = (short)mKeyNameToVal[szTempBuffer];
if (optional_string("NONE")) {
r_ccConfig.key_default = (short)-1;
} else {
stuff_string(szTempBuffer, F_NAME, iBufferLength);
r_ccConfig.key_default = (short)mKeyNameToVal[szTempBuffer];
}
}
if (optional_string("$Joy Default:")) {
@@ -827,7 +864,7 @@ void control_config_common_load_overrides()
if (optional_string("$Category:")) {
stuff_string(szTempBuffer, F_NAME, iBufferLength);
r_ccConfig.tab = (char)mKeyNameToVal[szTempBuffer];
r_ccConfig.tab = (char)mCCTabNameToVal[szTempBuffer];
}
if (optional_string("$Has XStr:")) {
@@ -837,7 +874,7 @@ void control_config_common_load_overrides()
if (optional_string("$Type:")) {
stuff_string(szTempBuffer, F_NAME, iBufferLength);
r_ccConfig.type = (char)mKeyNameToVal[szTempBuffer];
r_ccConfig.type = (char)mCCTypeNameToVal[szTempBuffer];
}
if (optional_string("+Disable")) {
@@ -862,4 +899,4 @@ void control_config_common_load_overrides()
if (Control_config_presets.size() > 0) {
std::copy(Control_config_presets[0], Control_config_presets[0] + CCFG_MAX + 1, Control_config);
}
}
}
+18 -2
View File
@@ -84,8 +84,22 @@ void cutscene_init()
compact_multitext_string(buf);
cutinfo.description = vm_strdup(buf);
required_string("$cd:");
stuff_int( &cutinfo.cd );
if (optional_string("$cd:"))
stuff_int( &cutinfo.cd );
else
cutinfo.cd = 0;
cutinfo.viewable = false;
if (isFirstCutscene) {
isFirstCutscene = false;
// The original code assumes the first movie is the intro, so always viewable
cutinfo.viewable = true;
}
if (optional_string("$Always Viewable:")) {
stuff_boolean(&cutinfo.viewable);
}
cutinfo.viewable = false;
@@ -148,6 +162,8 @@ void cutscene_mark_viewable(char *filename)
}
i++;
}
Warning(LOCATION, "Could not find cutscene '%s' in listing; cannot mark it viewable...", filename);
}
#define NUM_BUTTONS 8
+4 -3
View File
@@ -25,6 +25,9 @@
extern int Game_mode;
const char *movie_ext_list[] = { ".ogg", ".mve" };
const int NUM_MOVIE_EXT = sizeof(movie_ext_list) / sizeof(char*);
#define MOVIE_NONE -1
#define MOVIE_OGG 0
@@ -42,8 +45,6 @@ int movie_find(char *filename, char *out_name)
char full_path[MAX_PATH];
char tmp_name[MAX_PATH];
int size, offset = 0;
const int NUM_EXT = 2;
const char *movie_ext[NUM_EXT] = { ".ogg", ".mve" };
if (out_name == NULL)
return MOVIE_NONE;
@@ -57,7 +58,7 @@ int movie_find(char *filename, char *out_name)
char *p = strrchr(tmp_name, '.');
if ( p ) *p = 0;
int rc = cf_find_file_location_ext(tmp_name, NUM_EXT, movie_ext, CF_TYPE_ANY, sizeof(full_path) - 1, full_path, &size, &offset, 0);
int rc = cf_find_file_location_ext(tmp_name, NUM_MOVIE_EXT, movie_ext_list, CF_TYPE_ANY, sizeof(full_path) - 1, full_path, &size, &offset, 0);
if (rc == MOVIE_NONE)
return MOVIE_NONE;
+3
View File
@@ -12,6 +12,9 @@
#ifndef _MOVIE_HEADER_FILE
#define _MOVIE_HEADER_FILE
extern const char *movie_ext_list[];
extern const int NUM_MOVIE_EXT;
bool movie_play(char *name);
void movie_play_two(char *name1, char *name2);
+1
View File
@@ -694,6 +694,7 @@ static void convert_YUV_to_RGB(yuv_buffer *yuv)
}
}
extern int Mouse_hidden;
static void OGG_video_draw(theora_state *tstate)
{
yuv_buffer yuv;
+2 -2
View File
@@ -526,11 +526,11 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
// Create Debris piece n!
if ( hull_flag ) {
if (rand() < RAND_MAX/6) // Make some pieces blow up shortly after explosion.
db->lifeleft = 2.0f * ((float) myrand()/(float) RAND_MAX) + 0.5f;
db->lifeleft = 2.0f * (myrand() * RAND_MAX_1f) + 0.5f;
else
db->lifeleft = -1.0f; // large hull pieces stay around forever
} else {
db->lifeleft = (i2fl(myrand())/i2fl(RAND_MAX))*2.0f+0.1f;
db->lifeleft = (myrand() * RAND_MAX_1f) * 2.0f + 0.1f;
}
}
+6 -8
View File
@@ -9,10 +9,8 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////
// Testing Goals
// Breakpoints are set at places that need testing:
// * the value of endptr strtol and strtoul needs to investigated, according to cplusplus.com, *endptr = end of the string that was successfully converted
// TODO: Make a fast version of the parse_long, parse_ulong, etc. That just checks the first 1-3 characters. The fast version will be used in retail builds while the slow/safe version will be in debug's
// @todo Make a fast version of the parse_long, parse_ulong, etc. That just checks the first 1-3 characters. The fast version will be used in retail builds while the slow/safe version will be in debug's
// @todo Maybe make parser functions case-insensitive
////////////////
#include "debugconsole/consoleparse.h"
@@ -466,7 +464,7 @@ void dc_required_string(char *pstr)
dc_ignore_gray_space();
if (strnicmp(pstr, Cp, strlen(pstr))) {
if (strncmp(pstr, Cp, strlen(pstr)) == 0) {
str_found = pstr;
}
@@ -492,10 +490,10 @@ int dc_required_string_either(char *str1, char *str2)
dc_ignore_gray_space();
if (strncmp(str1, Cp, strlen(str1) == 0)) {
if (strncmp(str1, Cp, strlen(str1)) == 0) {
str_found = str1;
i = 0;
} else if (strncmp(str2, Cp, strlen(str2) == 0)) {
} else if (strncmp(str2, Cp, strlen(str2)) == 0) {
str_found = str2;
i = 1;
}
@@ -563,7 +561,7 @@ bool dc_optional_string(const char *pstr)
{
dc_ignore_gray_space();
if (strncmp(pstr, Cp, strlen(pstr) != 0)) {
if (strncmp(pstr, Cp, strlen(pstr)) != 0) {
return false;
} // Else, optional string was found
+1 -3
View File
@@ -246,7 +246,6 @@ void campaign_editor::initialize( int init_files )
void campaign_editor::mission_selected(int num)
{
CEdit *bc_dialog, *bc_hall, *bc_persona;
char mainhalltext[10];
char personatext[10];
bc_dialog = (CEdit *) GetDlgItem(IDC_BRIEFING_CUTSCENE);
@@ -259,8 +258,7 @@ void campaign_editor::mission_selected(int num)
bc_dialog->SetWindowText(Campaign.missions[num].briefing_cutscene);
// new main hall stuff
sprintf(mainhalltext, "%s", const_cast<char*>(Campaign.missions[num].main_hall.c_str()));
bc_hall->SetWindowText(CString(mainhalltext));
bc_hall->SetWindowText(Campaign.missions[num].main_hall.c_str());
// new debriefing persona stuff
sprintf(personatext, "%d", Campaign.missions[num].debrief_persona_index);
+25 -1
View File
@@ -442,6 +442,30 @@ void init_pending_messages(void)
Pending_messages[i].frame_to_process = -1;
}
// void win32_blit(HDC hSrcDC, HPALETTE hPalette, int x, int y, int w, int h )
#if 0
void win32_blit(void *xx, void *yy, int x, int y, int w, int h )
{
HPALETTE hOldPalette = NULL;
HDC hdc = GetDC(hwndApp);
if ( !hdc ) return;
if ( !fAppActive ) return;
if (hPalette) {
hOldPalette = SelectPalette(hdc, hPalette, FALSE);
RealizePalette( hdc );
}
BitBlt(hdc, 0, 0, w, h, hSrcDC, x, y, SRCCOPY);
if ( hOldPalette )
SelectPalette(hdc, hOldPalette, FALSE);
ReleaseDC( hwndApp, hdc );
}
#endif
BOOL CFREDApp::OnIdle(LONG lCount)
{
int adjust = 0;
@@ -681,4 +705,4 @@ 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;
float Sun_spot = 0.0f;
+157 -156
View File
@@ -623,7 +623,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.7.1 OpenGL",IDC_STATIC,39,8,184,10,SS_NOPREFIX
LTEXT "FRED2_OPEN - FreeSpace Editor, Version 3.7.3 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
@@ -783,10 +783,10 @@ BEGIN
LTEXT "Warning : Orders with a priority above 89 may be higher priority than those given by the player.",IDC_STATIC,60,183,307,11
END
IDD_MISSION_NOTES DIALOGEX 0, 0, 479, 349
IDD_MISSION_NOTES DIALOGEX 0, 0, 479, 349
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Mission Specs"
FONT 8, "MS Sans Serif", 0, 0, 0x0
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
RTEXT "Title",IDC_STATIC,7,10,29,8
EDITTEXT IDC_MISSION_TITLE,41,7,109,14,ES_AUTOHSCROLL
@@ -842,7 +842,7 @@ BEGIN
COMBOBOX IDC_EVENT_MUSIC,207,199,99,140,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "If music pack is present",IDC_STATIC,161,213,43,16
COMBOBOX IDC_SUBSTITUTE_EVENT_MUSIC,207,215,99,140,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Flags",IDC_STATIC,325,20,154,198
GROUPBOX "Flags",IDC_STATIC,325,20,154,198
CONTROL "All Teams at War",IDC_FULL_WAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,326,31,72,10
CONTROL "Red Alert Mission",IDC_RED_ALERT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,326,41,78,10
CONTROL "Scramble Mission",IDC_SCRAMBLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,326,51,72,10
@@ -877,9 +877,9 @@ BEGIN
EDITTEXT IDC_MAX_RESPAWN_DELAY,86,112,50,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_MAX_RESPAWN_DELAY_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,136,112,11,14
PUSHBUTTON "Sound Environment",IDC_SOUND_ENVIRONMENT_BUTTON,158,244,140,15
CONTROL "Always Show Mission Goals In Briefing",IDC_ALWAYS_SHOW_GOALS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,326,180,142,10
CONTROL "Mission End to Mainhall",IDC_END_TO_MAINHALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,326,190,142,10
CONTROL "Always Show Mission Goals In Briefing",IDC_ALWAYS_SHOW_GOALS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,326,180,142,10
CONTROL "Mission End to Mainhall",IDC_END_TO_MAINHALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,326,190,142,10
END
IDD_PREFERENCES DIALOG 0, 0, 333, 81
@@ -1029,30 +1029,30 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,187,25,50,14
END
IDD_MISSION_GOALS DIALOGEX 0, 0, 380, 270
IDD_MISSION_GOALS DIALOGEX 0, 0, 380, 270
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Mission Objectives"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
CONTROL "Tree1",IDC_GOALS_TREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,6,7,221,153,WS_EX_CLIENTEDGE
COMBOBOX IDC_DISPLAY_GOAL_TYPES_DROP,300,7,73,119,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_GOAL_TYPE_DROP,293,34,73,108,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_GOAL_NAME,293,50,73,14,ES_AUTOHSCROLL
EDITTEXT IDC_GOAL_DESC,239,66,127,14,ES_AUTOHSCROLL
EDITTEXT IDC_GOAL_SCORE,293,82,73,14,ES_AUTOHSCROLL | ES_NUMBER
COMBOBOX IDC_OBJ_TEAM,293,98,73,71,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CONTROL "Objective Invalid",IDC_GOAL_INVALID,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,117,69,10
CONTROL "Don't Play Completion Sound",IDC_NO_MUSIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,127,107,10
PUSHBUTTON "New Obj.",IDC_BUTTON_NEW_GOAL,233,146,44,14,0,WS_EX_STATICEDGE,HIDC_BUTTON_NEW_GOAL
PUSHBUTTON "OK",ID_OK,281,146,44,14
PUSHBUTTON "Cancel",IDCANCEL,329,146,44,14
EDITTEXT IDC_HELP_BOX,6,167,367,95,ES_MULTILINE | ES_READONLY | WS_VSCROLL,WS_EX_TRANSPARENT
GROUPBOX "Current Objective",IDC_STATIC,231,22,142,119
LTEXT "Display Types",IDC_STATIC,251,10,45,8,NOT WS_GROUP
LTEXT "Type",IDC_STATIC,269,37,17,8,NOT WS_GROUP
LTEXT "Name",IDC_STATIC,267,53,20,8
LTEXT "Score",IDC_STATIC,267,85,20,8
LTEXT "Team",IDC_STATIC,267,100,19,8
CONTROL "Tree1",IDC_GOALS_TREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,6,7,221,153,WS_EX_CLIENTEDGE
COMBOBOX IDC_DISPLAY_GOAL_TYPES_DROP,300,7,73,119,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_GOAL_TYPE_DROP,293,34,73,108,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_GOAL_NAME,293,50,73,14,ES_AUTOHSCROLL
EDITTEXT IDC_GOAL_DESC,239,66,127,14,ES_AUTOHSCROLL
EDITTEXT IDC_GOAL_SCORE,293,82,73,14,ES_AUTOHSCROLL | ES_NUMBER
COMBOBOX IDC_OBJ_TEAM,293,98,73,71,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CONTROL "Objective Invalid",IDC_GOAL_INVALID,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,117,69,10
CONTROL "Don't Play Completion Sound",IDC_NO_MUSIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,127,107,10
PUSHBUTTON "New Obj.",IDC_BUTTON_NEW_GOAL,233,146,44,14,0,WS_EX_STATICEDGE,HIDC_BUTTON_NEW_GOAL
PUSHBUTTON "OK",ID_OK,281,146,44,14
PUSHBUTTON "Cancel",IDCANCEL,329,146,44,14
EDITTEXT IDC_HELP_BOX,6,167,367,95,ES_MULTILINE | ES_READONLY | WS_VSCROLL,WS_EX_TRANSPARENT
GROUPBOX "Current Objective",IDC_STATIC,231,22,142,119
LTEXT "Display Types",IDC_STATIC,251,10,45,8,NOT WS_GROUP
LTEXT "Type",IDC_STATIC,269,37,17,8,NOT WS_GROUP
LTEXT "Name",IDC_STATIC,267,53,20,8
LTEXT "Score",IDC_STATIC,267,85,20,8
LTEXT "Team",IDC_STATIC,267,100,19,8
END
IDD_SHIP_SELECT DIALOGEX 0, 0, 204, 207
@@ -1288,7 +1288,7 @@ BEGIN
CONTROL "Last Repeat",IDC_MISSION_LOG_LAST_REPEAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,97,410,55,10
CONTROL "First Trigger",IDC_MISSION_LOG_1ST_TRIGGER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,397,53,10
CONTROL "Last Trigger",IDC_MISSION_LOG_LAST_TRIGGER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,410,53,10
CONTROL "Log Previous",IDC_MISSION_LOG_STATE_CHANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,397,55,10
CONTROL "Log Previous",IDC_MISSION_LOG_STATE_CHANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,397,55,10
CONTROL "Always False",IDC_MISSION_LOG_ALWAYS_FALSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,410,57,10
LTEXT "Log These States To The Event.log",IDC_STATIC,37,386,114,8
END
@@ -1547,47 +1547,47 @@ BEGIN
GROUPBOX "",IDC_STATIC,16,61,159,94
END
IDD_CAMPAIGN DIALOGEX 0, 0, 270, 441
IDD_CAMPAIGN DIALOGEX 0, 0, 270, 441
STYLE DS_SETFONT | WS_CHILD
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
LISTBOX IDC_FILELIST,7,17,254,77,LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL | WS_TABSTOP
EDITTEXT IDC_NAME,63,98,100,12,ES_AUTOHSCROLL
COMBOBOX IDC_CAMPAIGN_TYPE,193,98,68,116,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_DESC2,7,123,254,38,ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL
LISTBOX IDC_FILELIST,7,17,254,77,LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL | WS_TABSTOP
EDITTEXT IDC_NAME,63,98,100,12,ES_AUTOHSCROLL
COMBOBOX IDC_CAMPAIGN_TYPE,193,98,68,116,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_DESC2,7,123,254,38,ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL
CONTROL "Reset tech db at start of campaign",IDC_CUSTOM_TECH_DB,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,136,112,122,9
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,136,112,122,9
EDITTEXT IDC_BRIEFING_CUTSCENE,73,175,66,12,ES_AUTOHSCROLL
EDITTEXT IDC_MAIN_HALL,73,190,49,12,ES_AUTOHSCROLL
EDITTEXT IDC_DEBRIEFING_PERSONA,231,175,21,12,ES_NUMBER,WS_EX_RIGHT
CONTROL "Tree1",IDC_SEXP_TREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,224,188,111,WS_EX_CLIENTEDGE
PUSHBUTTON "Move Up",IDC_MOVE_UP,206,225,53,14,BS_CENTER,WS_EX_STATICEDGE
PUSHBUTTON "Move Down",IDC_MOVE_DOWN,206,242,53,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Toggle Loop",IDC_TOGGLE_LOOP,206,259,53,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Realign Tree",IDC_ALIGN,210,286,53,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Load Mission",ID_LOAD,210,303,53,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Close",ID_CPGN_CLOSE,210,320,53,14,0,WS_EX_STATICEDGE
EDITTEXT IDC_HELP_BOX,7,339,255,24,ES_MULTILINE | ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP,WS_EX_TRANSPARENT
EDITTEXT IDC_MISSISON_LOOP_DESC,7,377,253,24,ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL
EDITTEXT IDC_MAIN_HALL,73,190,49,12,ES_AUTOHSCROLL
EDITTEXT IDC_DEBRIEFING_PERSONA,231,175,21,12,ES_NUMBER,WS_EX_RIGHT
CONTROL "Tree1",IDC_SEXP_TREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,224,188,111,WS_EX_CLIENTEDGE
PUSHBUTTON "Move Up",IDC_MOVE_UP,206,225,53,14,BS_CENTER,WS_EX_STATICEDGE
PUSHBUTTON "Move Down",IDC_MOVE_DOWN,206,242,53,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Toggle Loop",IDC_TOGGLE_LOOP,206,259,53,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Realign Tree",IDC_ALIGN,210,286,53,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Load Mission",ID_LOAD,210,303,53,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Close",ID_CPGN_CLOSE,210,320,53,14,0,WS_EX_STATICEDGE
EDITTEXT IDC_HELP_BOX,7,339,255,24,ES_MULTILINE | ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP,WS_EX_TRANSPARENT
EDITTEXT IDC_MISSISON_LOOP_DESC,7,377,253,24,ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL
EDITTEXT IDC_LOOP_BRIEF_ANIM,69,406,100,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse",IDC_LOOP_BRIEF_BROWSE,175,406,53,13,0,WS_EX_STATICEDGE
EDITTEXT IDC_LOOP_BRIEF_SOUND,69,422,100,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse",IDC_LOOP_BRIEF_SOUND_BROWSE,175,422,53,13,0,WS_EX_STATICEDGE
LTEXT "Available missions",IDC_STATIC,7,7,58,8
LTEXT "Campaign name",IDC_STATIC,7,99,52,8
LTEXT "Type",IDC_STATIC,171,99,17,8
LTEXT "Type",IDC_STATIC,171,99,17,8
LTEXT "Branches",IDC_STATIC,7,214,31,8
LTEXT "Briefing cutscene",IDC_STATIC,13,176,56,8
LTEXT "Number of Players:",IDC_PLAYERS_LABEL,176,7,60,8
LTEXT "Static",IDC_NUM_PLAYERS,239,7,19,8,0,WS_EX_TRANSPARENT
LTEXT "Number of Players:",IDC_PLAYERS_LABEL,176,7,60,8
LTEXT "Static",IDC_NUM_PLAYERS,239,7,19,8,0,WS_EX_TRANSPARENT
LTEXT "Campaign description",IDC_STATIC,7,113,68,8
GROUPBOX "Branch Options",IDC_STATIC,202,214,61,64
GROUPBOX "Branch Options",IDC_STATIC,202,214,61,64
LTEXT "Mission loop description",IDC_STATIC,7,367,76,8
LTEXT "Loop brief anim",IDC_STATIC,13,408,49,8
LTEXT "Loop brief voice",IDC_STATIC,13,423,52,8
LTEXT "Main hall name",IDC_MAINHALL_LABEL,14,192,48,8
GROUPBOX "Mission options",IDC_MISSION_OPTIONS,7,165,254,43
LTEXT "Debriefing persona index",IDC_STATIC,148,176,79,8
LTEXT "Main hall name",IDC_MAINHALL_LABEL,14,192,48,8
GROUPBOX "Mission options",IDC_MISSION_OPTIONS,7,165,254,43
LTEXT "Debriefing persona index",IDC_STATIC,148,176,79,8
END
IDD_TEXT_VIEW DIALOG 0, 0, 324, 285
@@ -1598,61 +1598,61 @@ BEGIN
EDITTEXT IDC_EDIT1,7,7,310,271,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL
END
IDD_BRIEFING_EDITOR DIALOGEX 0, 0, 413, 414
IDD_BRIEFING_EDITOR DIALOGEX 0, 0, 413, 414
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Briefing Editor"
MENU IDR_PLAYER_EDIT_MENU
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
PUSHBUTTON "Prev",IDC_PREV,299,7,23,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Next",IDC_NEXT,325,7,23,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Add Stage",IDC_ADD_STAGE,299,22,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Insert Stage",IDC_INSERT_STAGE,299,38,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Delete Stage",IDC_DELETE_STAGE,299,54,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Save View",IDC_SAVE_VIEW,353,7,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Goto View",IDC_GOTO_VIEW,353,23,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Copy View",IDC_COPY_VIEW,353,39,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Paste View",IDC_PASTE_VIEW,353,55,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Prev",IDC_PREV,299,7,23,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Next",IDC_NEXT,325,7,23,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Add Stage",IDC_ADD_STAGE,299,22,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Insert Stage",IDC_INSERT_STAGE,299,38,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Delete Stage",IDC_DELETE_STAGE,299,54,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Save View",IDC_SAVE_VIEW,353,7,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Goto View",IDC_GOTO_VIEW,353,23,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Copy View",IDC_COPY_VIEW,353,39,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Paste View",IDC_PASTE_VIEW,353,55,50,14,0,WS_EX_STATICEDGE
EDITTEXT IDC_TIME,103,23,31,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Cut to next stage",IDC_CUT_NEXT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,38,69,10
CONTROL "Cut to previous stage",IDC_CUT_PREV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,47,83,10
EDITTEXT IDC_TEXT,7,72,396,85,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
EDITTEXT IDC_VOICE,63,164,83,13,ES_AUTOHSCROLL
PUSHBUTTON "Browse",IDC_BROWSE,150,164,42,14,0,WS_EX_STATICEDGE
PUSHBUTTON "IDB_PLAY",IDC_PLAY,194,164,28,14,BS_BITMAP,WS_EX_TRANSPARENT | WS_EX_STATICEDGE
COMBOBOX IDC_BRIEFING_MUSIC,205,18,83,135,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_SUBSTITUTE_BRIEFING_MUSIC,205,34,83,135,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
CONTROL "Tree1",IDC_TREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,190,200,218,WS_EX_CLIENTEDGE
CONTROL "Draw lines between marked icons",IDC_LINES,"Button",BS_3STATE | WS_TABSTOP,233,353,122,10
EDITTEXT IDC_ICON_LABEL,269,216,108,14,ES_AUTOHSCROLL
COMBOBOX IDC_ICON_IMAGE,269,234,108,135,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_SHIP_TYPE,269,250,107,145,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_TEAM,269,266,107,84,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_ID,269,200,30,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Highlight",IDC_HILIGHT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,367,43,10
CONTROL "Change locally",IDC_LOCAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,367,62,10
CONTROL "Flip Icon",IDC_FLIP_ICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,380,43,10
PUSHBUTTON "Make Icon",IDC_MAKE_ICON,225,182,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Delete Icon",IDC_DELETE_ICON,282,182,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Propagate",IDC_PROPAGATE_ICONS,339,182,50,14,0,WS_EX_STATICEDGE
EDITTEXT IDC_ICON_TEXT,230,293,146,53,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN
EDITTEXT IDC_TEXT,7,72,396,85,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
EDITTEXT IDC_VOICE,63,164,83,13,ES_AUTOHSCROLL
PUSHBUTTON "Browse",IDC_BROWSE,150,164,42,14,0,WS_EX_STATICEDGE
PUSHBUTTON "IDB_PLAY",IDC_PLAY,194,164,28,14,BS_BITMAP,WS_EX_TRANSPARENT | WS_EX_STATICEDGE
COMBOBOX IDC_BRIEFING_MUSIC,205,18,83,135,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_SUBSTITUTE_BRIEFING_MUSIC,205,34,83,135,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
CONTROL "Tree1",IDC_TREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,190,200,218,WS_EX_CLIENTEDGE
CONTROL "Draw lines between marked icons",IDC_LINES,"Button",BS_3STATE | WS_TABSTOP,233,353,122,10
EDITTEXT IDC_ICON_LABEL,269,216,108,14,ES_AUTOHSCROLL
COMBOBOX IDC_ICON_IMAGE,269,234,108,135,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_SHIP_TYPE,269,250,107,145,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_TEAM,269,266,107,84,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_ID,269,200,30,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Highlight",IDC_HILIGHT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,367,43,10
CONTROL "Change locally",IDC_LOCAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,367,62,10
CONTROL "Flip Icon",IDC_FLIP_ICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,380,43,10
PUSHBUTTON "Make Icon",IDC_MAKE_ICON,225,182,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Delete Icon",IDC_DELETE_ICON,282,182,50,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Propagate",IDC_PROPAGATE_ICONS,339,182,50,14,0,WS_EX_STATICEDGE
EDITTEXT IDC_ICON_TEXT,230,293,146,53,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN
LTEXT "Stage 1 of 9",IDC_STAGE_TITLE,7,7,53,8
GROUPBOX "Current Icon Info",IDC_STATIC,222,167,170,241
LTEXT "Label",IDC_STATIC,230,219,18,8
LTEXT "Icon image",IDC_STATIC,229,237,36,8
GROUPBOX "Current Icon Info",IDC_STATIC,222,167,170,241
LTEXT "Label",IDC_STATIC,230,219,18,8
LTEXT "Icon image",IDC_STATIC,229,237,36,8
LTEXT "Text",IDC_STATIC,7,62,15,8
LTEXT "Camera Transition Time (ms)",IDC_STATIC,7,25,90,8
LTEXT "Voice Wave File",IDC_STATIC,7,166,53,8
LTEXT "Text",IDC_STATIC,230,282,15,8
LTEXT "Team",IDC_STATIC,229,269,19,8
LTEXT "Ship Type",IDC_STATIC,229,253,33,8
LTEXT "ID",IDC_STATIC,230,201,8,8
LTEXT "Default",IDC_STATIC,149,18,24,8
LTEXT "Voice Wave File",IDC_STATIC,7,166,53,8
LTEXT "Text",IDC_STATIC,230,282,15,8
LTEXT "Team",IDC_STATIC,229,269,19,8
LTEXT "Ship Type",IDC_STATIC,229,253,33,8
LTEXT "ID",IDC_STATIC,230,201,8,8
LTEXT "Default",IDC_STATIC,149,18,24,8
LTEXT "Usage Formula",IDC_STATIC,7,180,48,8
LTEXT "If music pack is present",IDC_STATIC,149,31,44,17
GROUPBOX "Briefing Music",IDC_STATIC,141,7,150,44
CONTROL "Use Wing Icon",IDC_USE_WING_ICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,380,63,10
CONTROL "Use Cargo Icon",IDC_USE_CARGO_ICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,394,65,10
LTEXT "If music pack is present",IDC_STATIC,149,31,44,17
GROUPBOX "Briefing Music",IDC_STATIC,141,7,150,44
CONTROL "Use Wing Icon",IDC_USE_WING_ICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,380,63,10
CONTROL "Use Cargo Icon",IDC_USE_CARGO_ICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,394,65,10
END
IDD_IGNORE_ORDERS DIALOG 0, 0, 120, 217
@@ -1674,7 +1674,7 @@ BEGIN
CONTROL "order 10",IDC_CHECK10,"Button",BS_3STATE | WS_TABSTOP,7,183,105,10
END
IDD_DEBRIEFING_EDITOR DIALOGEX 0, 0, 541, 330
IDD_DEBRIEFING_EDITOR DIALOGEX 0, 0, 541, 330
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Debriefing Editor"
MENU IDR_PLAYER_EDIT_MENU
@@ -1685,24 +1685,24 @@ BEGIN
PUSHBUTTON "Add",IDC_ADD_STAGE,7,24,38,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Insert",IDC_INSERT_STAGE,48,24,38,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Delete",IDC_DELETE_STAGE,89,24,38,14,0,WS_EX_STATICEDGE
CONTROL "Tree1",IDC_TREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,55,191,260,WS_EX_CLIENTEDGE
CONTROL "Tree1",IDC_TREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,55,191,260,WS_EX_CLIENTEDGE
EDITTEXT IDC_VOICE,193,7,68,14,ES_AUTOHSCROLL
PUSHBUTTON "Browse",IDC_BROWSE,265,7,34,14,0,WS_EX_STATICEDGE
PUSHBUTTON "IDB_PLAY",IDC_PLAY,311,7,13,14,BS_BITMAP,WS_EX_TRANSPARENT | WS_EX_STATICEDGE
EDITTEXT IDC_TEXT,204,34,329,143,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
EDITTEXT IDC_REC_TEXT,204,192,329,73,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
LTEXT "Text",IDC_STATIC,204,24,15,8
PUSHBUTTON "IDB_PLAY",IDC_PLAY,311,7,13,14,BS_BITMAP,WS_EX_TRANSPARENT | WS_EX_STATICEDGE
EDITTEXT IDC_TEXT,204,34,329,143,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
EDITTEXT IDC_REC_TEXT,204,192,329,73,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
LTEXT "Text",IDC_STATIC,204,24,15,8
LTEXT "Voice Wave File",IDC_STATIC,135,10,53,8
LTEXT "Stage 1 of 9",IDC_STAGE_TITLE,7,10,53,8
LTEXT "Usage Formula",IDC_STATIC,7,43,48,8
LTEXT "Recommendation Text",IDC_STATIC,204,180,72,8
GROUPBOX "Debriefing Music",IDC_STATIC,272,270,262,45
LTEXT "Success Music",IDC_STATIC,277,286,53,8
COMBOBOX IDC_SUCCESSFUL_MISSION_TRACK,275,294,80,180,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Average Music",IDC_STATIC,363,286,53,8
COMBOBOX IDC_DEBRIEFING_TRACK,359,294,80,180,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Failure Music",IDC_STATIC,447,286,53,8
COMBOBOX IDC_FAILED_MISSION_TRACK,445,294,80,180,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Recommendation Text",IDC_STATIC,204,180,72,8
GROUPBOX "Debriefing Music",IDC_STATIC,272,270,262,45
LTEXT "Success Music",IDC_STATIC,277,286,53,8
COMBOBOX IDC_SUCCESSFUL_MISSION_TRACK,275,294,80,180,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Average Music",IDC_STATIC,363,286,53,8
COMBOBOX IDC_DEBRIEFING_TRACK,359,294,80,180,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Failure Music",IDC_STATIC,447,286,53,8
COMBOBOX IDC_FAILED_MISSION_TRACK,445,294,80,180,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
IDD_ADJUST_GRID DIALOG 0, 0, 153, 94
@@ -1754,7 +1754,7 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,70,189,50,14
END
IDD_CMD_BRIEF DIALOGEX 0, 0, 391, 223
IDD_CMD_BRIEF DIALOGEX 0, 0, 391, 223
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Command Briefing Editor"
MENU IDR_PLAYER_EDIT_MENU
@@ -1765,18 +1765,18 @@ BEGIN
PUSHBUTTON "Add",IDC_ADD_STAGE,7,24,38,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Insert",IDC_INSERT_STAGE,48,24,38,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Delete",IDC_DELETE_STAGE,89,24,38,14,0,WS_EX_STATICEDGE
EDITTEXT IDC_TEXT,7,55,377,122,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
EDITTEXT IDC_ANI_FILENAME,263,184,68,14,ES_AUTOHSCROLL
PUSHBUTTON "Browse",IDC_BROWSE_ANI,334,184,50,14,0,WS_EX_STATICEDGE
EDITTEXT IDC_WAVE_FILENAME,263,202,68,14,ES_AUTOHSCROLL
PUSHBUTTON "Browse",IDC_BROWSE_WAVE,334,202,34,14,0,WS_EX_STATICEDGE
PUSHBUTTON "IDB_PLAY",IDC_PLAY,371,202,13,14,BS_BITMAP,WS_EX_TRANSPARENT | WS_EX_STATICEDGE
DEFPUSHBUTTON "OK",IDOK,334,14,50,14
PUSHBUTTON "Cancel",IDCANCEL,334,31,50,14
EDITTEXT IDC_TEXT,7,55,377,122,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
EDITTEXT IDC_ANI_FILENAME,263,184,68,14,ES_AUTOHSCROLL
PUSHBUTTON "Browse",IDC_BROWSE_ANI,334,184,50,14,0,WS_EX_STATICEDGE
EDITTEXT IDC_WAVE_FILENAME,263,202,68,14,ES_AUTOHSCROLL
PUSHBUTTON "Browse",IDC_BROWSE_WAVE,334,202,34,14,0,WS_EX_STATICEDGE
PUSHBUTTON "IDB_PLAY",IDC_PLAY,371,202,13,14,BS_BITMAP,WS_EX_TRANSPARENT | WS_EX_STATICEDGE
DEFPUSHBUTTON "OK",IDOK,334,14,50,14
PUSHBUTTON "Cancel",IDCANCEL,334,31,50,14
LTEXT "Briefing Text",IDC_STATIC,7,44,40,8
LTEXT "Ani Filename",IDC_STATIC,209,187,41,8
LTEXT "Ani Filename",IDC_STATIC,209,187,41,8
LTEXT "Stage 1 of 9",IDC_STAGE_TITLE,7,10,53,8
LTEXT "Wave Filename",IDC_STATIC,209,205,50,8
LTEXT "Wave Filename",IDC_STATIC,209,205,50,8
END
IDD_SHIP_FLAGS DIALOGEX 0, 0, 286, 295
@@ -1834,12 +1834,13 @@ BEGIN
CONTROL "Laser Protect Ship",IDC_LASER_PROTECT_SHIP,"Button",BS_3STATE | WS_TABSTOP,12,110,80,8
CONTROL "Missile Protect Ship",IDC_MISSILE_PROTECT_SHIP,"Button",BS_3STATE | WS_TABSTOP,12,118,80,8
GROUPBOX "Turret Threats",IDC_STATIC,7,83,102,48
CONTROL "Does Not Move",IDC_IMMOBILE,"Button",BS_3STATE | WS_TABSTOP,7,274,66,10
CONTROL "Cloaked",IDC_CLOAKED,"Button",BS_3STATE | WS_TABSTOP,165,167,42,10
CONTROL "Does Not Move",IDC_IMMOBILE,"Button",BS_3STATE | WS_TABSTOP,7,274,66,10
CONTROL "Cloaked",IDC_CLOAKED,"Button",BS_3STATE | WS_TABSTOP,165,167,42,10
CONTROL "Scramble Messages",IDC_SCRAMBLE_MESSAGES,"Button",BS_3STATE | WS_TABSTOP,165,177,79,10
END
IDD_ADD_VARIABLE DIALOG 0, 0, 422, 102
CONTROL "No Collisions",IDC_NO_COLLIDE,"Button",BS_3STATE | WS_TABSTOP,165,188,66,10
END
IDD_ADD_VARIABLE DIALOG 0, 0, 422, 102
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Add Variable"
FONT 8, "MS Sans Serif"
@@ -1927,7 +1928,7 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,239,35,50,14
LTEXT "Old texture:",IDC_LABEL1,7,7,44,9
LTEXT "New texture:",IDC_LABEL2,152,7,44,9
COMBOBOX IDC_OLD_TEXTURE_LIST,7,16,137,85,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_OLD_TEXTURE_LIST,7,16,137,85,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
IDD_SPECIAL_HITPOINTS DIALOG 0, 0, 234, 85
@@ -2034,14 +2035,14 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,333,24,50,14
END
IDD_RESTRICT_PATHS DIALOG 0, 0, 241, 87
IDD_RESTRICT_PATHS DIALOG 0, 0, 241, 87
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Restrict Paths"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,184,20,50,14
PUSHBUTTON "Cancel",IDCANCEL,184,37,50,14
LISTBOX IDC_PATH_LIST,7,20,171,58,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,184,20,50,14
PUSHBUTTON "Cancel",IDCANCEL,184,37,50,14
LISTBOX IDC_PATH_LIST,7,20,171,58,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
LTEXT "Restrict departure paths to the following:",IDC_RESTRICT_PATHS_LABEL,7,7,127,11
END
@@ -2055,10 +2056,10 @@ BEGIN
COMBOBOX IDC_BACKGROUND,7,16,83,265,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
END
IDD_FICTION_VIEWER DIALOGEX 0, 0, 205, 85
IDD_FICTION_VIEWER DIALOGEX 0, 0, 205, 85
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Fiction Viewer Editor"
FONT 8, "MS Sans Serif", 0, 0, 0x0
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "OK",IDOK,148,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,148,24,50,14
@@ -2066,10 +2067,10 @@ BEGIN
EDITTEXT IDC_STORY_FILE,45,7,99,14,ES_AUTOHSCROLL
RTEXT "Font File",IDC_STATIC,7,27,32,8
EDITTEXT IDC_FONT_FILE,45,24,99,14,ES_AUTOHSCROLL
RTEXT "Music",IDC_STATIC,15,60,25,8
COMBOBOX IDC_FICTION_MUSIC,45,59,99,140,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Voice File",IDC_STATIC,9,43,32,8
EDITTEXT IDC_VOICE_FILE,45,40,99,14,ES_AUTOHSCROLL
RTEXT "Music",IDC_STATIC,15,60,25,8
COMBOBOX IDC_FICTION_MUSIC,45,59,99,140,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Voice File",IDC_STATIC,9,43,32,8
EDITTEXT IDC_VOICE_FILE,45,40,99,14,ES_AUTOHSCROLL
END
IDD_SOUND_ENVIRONMENT DIALOGEX 0, 0, 315, 89
@@ -2102,8 +2103,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,7,1,000000
PRODUCTVERSION 3,7,1,000000
FILEVERSION 3,7,1,000000
PRODUCTVERSION 3,7,1,000000
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -2119,13 +2120,13 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Volition Inc."
VALUE "FileDescription", "Fred 2 Open"
VALUE "FileVersion", "3.7.1.000000"
VALUE "InternalName", "Fred 2 Open"
VALUE "FileDescription", "Fred 2 Open"
VALUE "FileVersion", "3.7.3.000000"
VALUE "InternalName", "Fred 2 Open"
VALUE "LegalCopyright", "Copyright © 1998"
VALUE "OriginalFilename", "fred2.exe"
VALUE "ProductName", "Fred 2 Open"
VALUE "ProductVersion", "3.7.1"
VALUE "ProductName", "Fred 2 Open"
VALUE "ProductVersion", "3.7.3"
END
END
BLOCK "VarFileInfo"
@@ -2217,7 +2218,7 @@ BEGIN
IDD_MISSION_GOALS, DIALOG
BEGIN
LEFTMARGIN, 6
RIGHTMARGIN, 373
RIGHTMARGIN, 373
TOPMARGIN, 7
BOTTOMMARGIN, 263
END
@@ -2332,7 +2333,7 @@ BEGIN
IDD_CAMPAIGN, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 261
RIGHTMARGIN, 261
TOPMARGIN, 7
BOTTOMMARGIN, 435
END
@@ -2348,11 +2349,11 @@ BEGIN
IDD_BRIEFING_EDITOR, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 403
VERTGUIDE, 173
VERTGUIDE, 222
RIGHTMARGIN, 403
VERTGUIDE, 173
VERTGUIDE, 222
TOPMARGIN, 7
BOTTOMMARGIN, 408
BOTTOMMARGIN, 408
END
IDD_IGNORE_ORDERS, DIALOG
@@ -2366,9 +2367,9 @@ BEGIN
IDD_DEBRIEFING_EDITOR, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 534
RIGHTMARGIN, 534
TOPMARGIN, 7
BOTTOMMARGIN, 315
BOTTOMMARGIN, 315
END
IDD_ADJUST_GRID, DIALOG
@@ -2398,9 +2399,9 @@ BEGIN
IDD_CMD_BRIEF, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 384
RIGHTMARGIN, 384
TOPMARGIN, 7
BOTTOMMARGIN, 216
BOTTOMMARGIN, 216
END
IDD_SHIP_FLAGS, DIALOG
@@ -2695,12 +2696,12 @@ IDC_CURSOR2 CURSOR "res\\cursor2.cur"
// String Table
//
STRINGTABLE
STRINGTABLE
BEGIN
IDR_MAINFRAME "FRED2_OPEN 3.7.1 - FreeSpace2 Mission Editor\nUntitled\nFRED2\nFreeSpace2 Missions (*.fs2)\n.fs2\nFreeSpace2Mission\nFreeSpace2 Mission"
IDR_MAINFRAME "FRED2_OPEN 3.7.3 - FreeSpace2 Mission Editor\nUntitled\nFRED2\nFreeSpace2 Missions (*.fs2)\n.fs2\nFreeSpace2Mission\nFreeSpace2 Mission"
END
STRINGTABLE
STRINGTABLE
BEGIN
AFX_IDS_APP_TITLE "FRED2"
AFX_IDS_IDLEMESSAGE "For Help, press F1"
+10 -2
View File
@@ -1489,7 +1489,11 @@ void render_frame()
gr_set_font(FONT1);
light_reset();
g3_set_view_matrix(&eye_pos, &eye_orient, 0.5f);
if (Briefing_dialog) {
g3_set_view_matrix(&eye_pos, &eye_orient, Briefing_window_FOV);
} else {
g3_set_view_matrix(&eye_pos, &eye_orient, 0.5f);
}
Viewer_pos = eye_pos; // for starfield code
fred_enable_htl();
@@ -1594,7 +1598,11 @@ void render_frame()
gr_set_clip(0, 0, True_rw, True_rh);
g3_start_frame(0); // ** Accounted for
g3_set_view_matrix(&eye_pos, &eye_orient, 0.5f);
if (Briefing_dialog) {
g3_set_view_matrix(&eye_pos, &eye_orient, Briefing_window_FOV);
} else {
g3_set_view_matrix(&eye_pos, &eye_orient, 0.5f);
}
}
void game_do_frame()
+4 -2
View File
@@ -3307,8 +3307,9 @@ int CFREDView::error(const char *msg, ...)
va_list args;
va_start(args, msg);
vsprintf(buf, msg, args);
vsnprintf(buf, sizeof(buf)-1, msg, args);
va_end(args);
buf[sizeof(buf)-1] = '\0';
g_err = 1;
if (MessageBox(buf, "Error", MB_OKCANCEL | MB_ICONEXCLAMATION) == IDOK)
@@ -3323,8 +3324,9 @@ int CFREDView::internal_error(const char *msg, ...)
va_list args;
va_start(args, msg);
vsprintf(buf, msg, args);
vsnprintf(buf, sizeof(buf)-1, msg, args);
va_end(args);
buf[sizeof(buf)-1] = '\0';
g_err = 1;
+3 -22
View File
@@ -73,6 +73,8 @@
#define UNKNOWN_USER "Unknown"
extern void ssm_init(); // Need this to populate Ssm_info so OPF_SSM_CLASS does something. -MageKing17
int cur_wing = -1;
int cur_wing_index;
int cur_object_index = -1;
@@ -420,6 +422,7 @@ bool fred_init()
create_new_mission();
neb2_init(); // fullneb stuff
stars_init();
ssm_init(); // The game calls this after stars_init(), and we need Ssm_info initialized for OPF_SSM_CLASS. -MageKing17
brief_init_colors();
fred_preload_all_briefing_icons(); //phreak. This needs to be done or else the briefing icons won't show up
event_music_init();
@@ -1470,28 +1473,6 @@ int delete_ship_from_wing(int ship)
return 0;
}
// What does this do?
void add_ship_to_wing()
{
int org_object = cur_object_index;
vec3d tvec;
set_cur_object_index();
if (Objects[org_object].type == OBJ_NONE) {
vm_vec_make(&tvec, 10.0f, 10.0f, 10.0f);
create_object(&tvec);
} else {
Objects[cur_object_index] = Objects[org_object];
Objects[cur_object_index].pos.xyz.x += 3.0f;
Objects[cur_object_index].pos.xyz.y += 3.0f;
physics_init(&Objects[cur_object_index].phys_info);
Objects[cur_object_index].orient = Objects[org_object].orient;
}
set_modified();
}
// Return true if current object is valid and is in a wing.
// Else return false.
int query_object_in_wing(int obj)
-1
View File
@@ -90,7 +90,6 @@ void delete_marked();
void delete_reinforcement(int num);
int delete_ship_from_wing(int ship = cur_ship);
int find_free_wing();
void add_ship_to_wing();
int query_object_in_wing(int obj = cur_object_index);
void mark_object(int obj);
void unmark_object(int obj);
+89 -60
View File
@@ -384,13 +384,13 @@ int CFred_mission_save::save_mission_info()
fout(" %d", The_mission.num_respawns);
if ( Format_fs2_open != FSO_FORMAT_RETAIL ) {
fso_comment_push(";;FSO 3.6.11;;");
if (optional_string_fred("+Max Respawn Time:"))
parse_comments(2);
else {
fso_comment_push(";;FSO 3.6.11;;");
fout_version("\n+Max Respawn Time:");
fso_comment_pop();
}
fso_comment_pop();
fout(" %d", The_mission.max_respawn_delay);
}
@@ -561,29 +561,29 @@ int CFred_mission_save::save_mission_info()
if (period != NULL)
*period = 0;
fso_comment_push(";;FSO 3.6.0;;");
if (optional_string_fred("$Skybox Model:")) {
parse_comments(2);
fout(" %s.pof", out_str);
} else {
fso_comment_push(";;FSO 3.6.0;;");
fout_version("\n\n$Skybox Model: %s.pof", out_str);
fso_comment_pop();
}
fso_comment_pop();
} else {
bypass_comment(";;FSO 3.6.0;; $Skybox Model:");
}
// orientation?
if ((strlen(The_mission.skybox_model) > 0) && !vm_matrix_same(&vmd_identity_matrix, &The_mission.skybox_orientation)) {
fso_comment_push(";;FSO 3.6.14;;");
if (optional_string_fred("+Skybox Orientation:")) {
parse_comments(1);
save_matrix(The_mission.skybox_orientation);
} else {
fso_comment_push(";;FSO 3.6.14;;");
fout_version("\n+Skybox Orientation:");
save_matrix(The_mission.skybox_orientation);
fso_comment_pop();
}
fso_comment_pop();
} else {
bypass_comment(";;FSO 3.6.14;; +Skybox Orientation:");
}
@@ -591,14 +591,14 @@ int CFred_mission_save::save_mission_info()
// are skybox flags in use?
if (The_mission.skybox_flags != DEFAULT_NMODEL_FLAGS) {
//char out_str[4096];
fso_comment_push(";;FSO 3.6.11;;");
if (optional_string_fred("+Skybox Flags:")) {
parse_comments(1);
fout( " %d", The_mission.skybox_flags);
} else {
fso_comment_push(";;FSO 3.6.11;;");
fout_version("\n+Skybox Flags: %d", The_mission.skybox_flags);
fso_comment_pop();
}
fso_comment_pop();
} else {
bypass_comment(";;FSO 3.6.11;; +Skybox Flags:");
}
@@ -607,14 +607,14 @@ int CFred_mission_save::save_mission_info()
int profile_index = (The_mission.ai_profile - Ai_profiles);
Assert(profile_index >= 0 && profile_index < MAX_AI_PROFILES);
fso_comment_push(";;FSO 3.6.9;;");
if (optional_string_fred("$AI Profile:")) {
parse_comments(2);
fout(" %s", The_mission.ai_profile->profile_name);
} else {
fso_comment_push(";;FSO 3.6.9;;");
fout_version("\n\n$AI Profile: %s", The_mission.ai_profile->profile_name);
fso_comment_pop();
}
fso_comment_pop();
// sound environment (EFX/EAX) - taylor
sound_env *m_env = &The_mission.sound_environment;
@@ -714,7 +714,7 @@ int CFred_mission_save::save_cutscenes()
}
for (uint i = 0; i < The_mission.cutscenes.size(); i++) {
if ( strlen(The_mission.cutscenes[i].cutscene_name) ) {
if ( strlen(The_mission.cutscenes[i].filename) ) {
// determine the name of this cutscene type
switch (The_mission.cutscenes[i].type) {
case MOVIE_PRE_FICTION:
@@ -742,10 +742,10 @@ int CFred_mission_save::save_cutscenes()
if (optional_string_fred(type)) {
parse_comments();
fout(" %s", The_mission.cutscenes[i].cutscene_name);
fout(" %s", The_mission.cutscenes[i].filename);
}
else {
fout_version("%s %s\n", type, The_mission.cutscenes[i].cutscene_name);
fout_version("%s %s\n", type, The_mission.cutscenes[i].filename);
}
required_string_fred("+formula:");
@@ -1184,6 +1184,13 @@ int CFred_mission_save::save_players()
int var_idx;
int used_pool[MAX_WEAPON_TYPES];
if (optional_string_fred("#Alternate Types:")) { // Make sure the parser doesn't get out of sync
required_string_fred("#end");
}
if (optional_string_fred("#Callsigns:")) {
required_string_fred("#end");
}
// write out alternate name list
if(Mission_alt_type_count > 0){
fout("\n\n#Alternate Types:\n");
@@ -1742,6 +1749,8 @@ int CFred_mission_save::save_objects()
fout(" \"weapons-locked\"");
if (shipp->flags2 & SF2_SCRAMBLE_MESSAGES)
fout(" \"scramble-messages\"");
if (!(objp->flags & OF_COLLIDES))
fout(" \"no-collide\"");
fout(" )");
}
// -----------------------------------------------------------
@@ -1761,6 +1770,7 @@ int CFred_mission_save::save_objects()
// special explosions
if (Format_fs2_open != FSO_FORMAT_RETAIL) {
if (shipp->use_special_explosion) {
fso_comment_push(";;FSO 3.6.13;;");
if (optional_string_fred("$Special Explosion:", "$Name:")) {
parse_comments();
@@ -1786,7 +1796,7 @@ int CFred_mission_save::save_objects()
fout(" %d", shipp->special_exp_shockwave_speed);
}
else {
bypass_comment(";;FSO 3.6.13;; +Special Exp Shockwave Speed:");
bypass_comment(";;FSO 3.6.13;; +Special Exp Shockwave Speed:", "$Name:");
}
if (shipp->special_exp_deathroll_time > 0) {
@@ -1795,11 +1805,10 @@ int CFred_mission_save::save_objects()
fout(" %d", shipp->special_exp_deathroll_time);
}
else {
bypass_comment(";;FSO 3.6.13;; +Special Exp Death Roll Time:");
bypass_comment(";;FSO 3.6.13;; +Special Exp Death Roll Time:", "$Name:");
}
}
else {
fso_comment_push(";;FSO 3.6.13;;");
fout_version("\n$Special Explosion:");
fout_version("\n+Special Exp Damage:");
@@ -1824,12 +1833,12 @@ int CFred_mission_save::save_objects()
fout(" %d", shipp->special_exp_deathroll_time);
}
fso_comment_pop();
}
fso_comment_pop();
}
else {
bypass_comment(";;FSO 3.6.13;; +Special Exp Shockwave Speed:");
bypass_comment(";;FSO 3.6.13;; +Special Exp Death Roll Time:");
bypass_comment(";;FSO 3.6.13;; +Special Exp Shockwave Speed:", "$Name:");
bypass_comment(";;FSO 3.6.13;; +Special Exp Death Roll Time:", "$Name:");
}
}
// retail format special explosions
@@ -1857,33 +1866,33 @@ int CFred_mission_save::save_objects()
if (Format_fs2_open != FSO_FORMAT_RETAIL)
{
if (shipp->special_hitpoints) {
fso_comment_push(";;FSO 3.6.13;;");
if (optional_string_fred("+Special Hitpoints:", "$Name:")) {
parse_comments();
} else {
fso_comment_push(";;FSO 3.6.13;;");
fout_version("\n+Special Hitpoints:");
fso_comment_pop();
}
fso_comment_pop();
fout(" %d", shipp->special_hitpoints);
}
else {
bypass_comment(";;FSO 3.6.13;; +Special Hitpoints:");
bypass_comment(";;FSO 3.6.13;; +Special Hitpoints:", "$Name:");
}
if (shipp->special_shield >= 0) {
fso_comment_push(";;FSO 3.6.13;;");
if (optional_string_fred("+Special Shield Points:", "$Name:")) {
parse_comments();
} else {
fso_comment_push(";;FSO 3.6.13;;");
fout_version("\n+Special Shield Points:");
fso_comment_pop();
}
fso_comment_pop();
fout(" %d", shipp->special_shield);
}
else {
bypass_comment(";;FSO 3.6.13;; +Special Shield Points:");
bypass_comment(";;FSO 3.6.13;; +Special Shield Points:", "$Name:");
}
}
// -----------------------------------------------------------
@@ -1982,16 +1991,16 @@ int CFred_mission_save::save_objects()
// always write out the score to ensure backwards compatibility. If the score is the same as the value
// in the table write out a flag to tell the game to simply use whatever is in the table instead
if (Ship_info[shipp->ship_info_index].score == shipp->score ) {
fso_comment_push(";;FSO 3.6.10;;");
if ( optional_string_fred("+Use Table Score:", "$Name:") ) {
parse_comments();
} else {
fso_comment_push(";;FSO 3.6.10;;");
fout_version("\n+Use Table Score:");
fso_comment_pop();
}
fso_comment_pop();
}
else {
bypass_comment(";;FSO 3.6.10;; +Use Table Score:");
bypass_comment(";;FSO 3.6.10;; +Use Table Score:", "$Name:");
}
if (optional_string_fred("+Score:", "$Name:"))
@@ -2003,18 +2012,18 @@ int CFred_mission_save::save_objects()
if (Format_fs2_open != FSO_FORMAT_RETAIL && shipp->assist_score_pct != 0) {
fso_comment_push(";;FSO 3.6.10;;");
if ( optional_string_fred("+Assist Score Percentage:") ) {
parse_comments();
} else {
fso_comment_push(";;FSO 3.6.10;;");
fout_version("\n+Assist Score Percentage:");
fso_comment_pop();
}
fso_comment_pop();
fout(" %f", shipp->assist_score_pct);
}
else {
bypass_comment(";;FSO 3.6.10;; +Assist Score Percentage:");
bypass_comment(";;FSO 3.6.10;; +Assist Score Percentage:", "$Name:");
}
// deal with the persona for this ship as well.
@@ -2030,6 +2039,7 @@ int CFred_mission_save::save_objects()
// Goober5000 - deal with texture replacement ----------------
if (!Fred_texture_replacements.empty()) {
bool needs_header = true;
fso_comment_push(";;FSO 3.6.8;;");
for (SCP_vector<texture_replace>::iterator ii = Fred_texture_replacements.begin(); ii != Fred_texture_replacements.end(); ++ii) {
if ( !stricmp(shipp->ship_name, ii->ship_name) ) {
@@ -2037,7 +2047,6 @@ int CFred_mission_save::save_objects()
if (optional_string_fred("$Texture Replace:")) {
parse_comments(1);
} else {
fso_comment_push(";;FSO 3.6.8;;");
fout_version("\n$Texture Replace:");
}
@@ -2063,7 +2072,7 @@ int CFred_mission_save::save_objects()
fso_comment_pop();
} else {
bypass_comment(";;FSO 3.6.8;; $Texture Replace:");
bypass_comment(";;FSO 3.6.8;; $Texture Replace:", "$Name:");
}
// end of texture replacement -------------------------------
@@ -2784,11 +2793,16 @@ int CFred_mission_save::save_matrix(matrix &m)
// Goober5000 - move past the comment without copying it to the output file
// (used for special FSO comment tags)
void CFred_mission_save::bypass_comment(char *comment)
void CFred_mission_save::bypass_comment(const char *comment, const char *end)
{
char *ch = strstr(raw_ptr, comment);
if (ch != NULL)
{
if (end != NULL) {
char *ep = strstr(raw_ptr, end);
if (ep != NULL && ep < ch)
return;
}
char *writep = ch;
char *readp = strchr(writep, '\n');
@@ -2810,6 +2824,7 @@ void CFred_mission_save::parse_comments(int newlines)
{
char *comment_start = NULL;
int state = 0, same_line = 0, first_comment = 1, tab = 0, flag = 0;
bool version_added = false;
if (newlines < 0) {
newlines = -newlines;
@@ -2823,12 +2838,13 @@ void CFred_mission_save::parse_comments(int newlines)
while (newlines-- > 0)
fout("\n");
if (tab)
if (tab && token_found)
fout_version("\t%s", token_found);
else if (token_found)
fout_version("%s", token_found);
else if (tab)
fout("\t");
if (token_found)
fout("%s", token_found);
return;
}
@@ -2841,12 +2857,19 @@ void CFred_mission_save::parse_comments(int newlines)
fout("\n");
if (tab) {
fout("\t");
fout_version("\t");
fout("%s", token_found);
} else {
fout("%s", token_found);
fout_version("%s", token_found);
}
// If you have a bunch of lines that all start with the same token (like, say, "+Subsystem:"),
// this makes it so it won't just repeatedly match the first one. -MageKing17
raw_ptr++;
if (version_added)
fso_comment_pop();
return;
}
@@ -2870,9 +2893,9 @@ void CFred_mission_save::parse_comments(int newlines)
s_num = 3;
}
if ( (s_num == 3) && (major <= FS_VERSION_MAJOR) && (minor <= FS_VERSION_MINOR) && (build <= FS_VERSION_BUILD) ) {
if ( (s_num == 3) && ((major < FS_VERSION_MAJOR) || ((major == FS_VERSION_MAJOR) && ((minor < FS_VERSION_MINOR) || ((minor == FS_VERSION_MINOR) && (build <= FS_VERSION_BUILD))))) ) {
state = 3;
} else if ( (s_num == 4) && (major <= FS_VERSION_MAJOR) && (minor <= FS_VERSION_MINOR) && (build <= FS_VERSION_BUILD) && (revis <= FS_VERSION_REVIS) ) {
} else if ( (s_num == 4) && ((major < FS_VERSION_MAJOR) || ((major == FS_VERSION_MAJOR) && ((minor < FS_VERSION_MINOR) || ((minor == FS_VERSION_MINOR) && ((build < FS_VERSION_BUILD) || ((build == FS_VERSION_BUILD) && (revis <= FS_VERSION_REVIS))))))) ) {
state = 3;
} else {
state = 4;
@@ -2938,7 +2961,10 @@ void CFred_mission_save::parse_comments(int newlines)
if ( (*raw_ptr == ';') && (raw_ptr[1] == ';') && (state == 3) ) {
state = raw_ptr[2];
raw_ptr[2] = 0;
fso_comment_pop();
if (version_added)
fso_comment_pop();
else
version_added = true;
fso_comment_push(comment_start);
raw_ptr[2] = (char)state;
state = first_comment = flag = 0;
@@ -2949,6 +2975,9 @@ void CFred_mission_save::parse_comments(int newlines)
raw_ptr++;
}
if (version_added)
fso_comment_pop();
return;
}
@@ -3351,13 +3380,13 @@ int CFred_mission_save::save_events()
}
if (Format_fs2_open != FSO_FORMAT_RETAIL && Mission_events[i].trigger_count != 1 ) {
fso_comment_push(";;FSO 3.6.11;;");
if ( optional_string_fred("+Trigger Count:", "$Formula:")){
parse_comments();
} else {
fso_comment_push(";;FSO 3.6.11;;");
fout_version("\n+Trigger Count:");
fso_comment_pop();
}
fso_comment_pop();
fout(" %d", Mission_events[i].trigger_count);
}
@@ -3422,13 +3451,13 @@ int CFred_mission_save::save_events()
}
if (Format_fs2_open != FSO_FORMAT_RETAIL && Mission_events[i].mission_log_flags != 0 ) {
fso_comment_push(";;FSO 3.6.11;;");
if ( optional_string_fred("+Event Log Flags: (", "$Formula:")){
parse_comments();
} else {
fso_comment_push(";;FSO 3.6.11;;");
fout_version("\n+Event Log Flags: (");
fso_comment_pop();
}
fso_comment_pop();
for (j = 0; j < MAX_MISSION_EVENT_LOG_FLAGS ; j++) {
add_flag = 1 << j;
@@ -3578,10 +3607,10 @@ int CFred_mission_save::save_bitmaps()
bool tag = (i < Num_backgrounds - 1);
background_t *background = &Backgrounds[i];
fso_comment_push(";;FSO 3.6.9;;");
if (optional_string_fred("$Bitmap List:")) {
parse_comments(2);
} else {
fso_comment_push(";;FSO 3.6.9;;");
fout_version("\n\n$Bitmap List:");
}
@@ -3647,14 +3676,14 @@ int CFred_mission_save::save_bitmaps()
// taylor's environment map thingy
if (strlen(The_mission.envmap_name) > 0) { //-V805
fso_comment_push(";;FSO 3.6.9;;");
if (optional_string_fred("$Environment Map:")) {
parse_comments(2);
fout(" %s", The_mission.envmap_name);
} else {
fso_comment_push(";;FSO 3.6.9;;");
fout_version("\n\n$Environment Map: %s", The_mission.envmap_name);
fso_comment_pop();
}
fso_comment_pop();
} else {
bypass_comment(";;FSO 3.6.9;; $Environment Map:");
}
@@ -3773,14 +3802,14 @@ int CFred_mission_save::save_music()
// Goober5000 - save using the special comment prefix
if (stricmp(The_mission.substitute_event_music_name, "None")) {
fso_comment_push(";;FSO 3.6.9;;");
if (optional_string_fred("$Substitute Event Music:")) {
parse_comments(1);
fout(" %s", The_mission.substitute_event_music_name);
} else {
fso_comment_push(";;FSO 3.6.9;;");
fout_version("\n$Substitute Event Music: %s", The_mission.substitute_event_music_name);
fso_comment_pop();
}
fso_comment_pop();
} else {
bypass_comment(";;FSO 3.6.9;; $Substitute Event Music:");
}
@@ -3794,14 +3823,14 @@ int CFred_mission_save::save_music()
// Goober5000 - save using the special comment prefix
if (stricmp(The_mission.substitute_briefing_music_name, "None")) {
fso_comment_push(";;FSO 3.6.9;;");
if (optional_string_fred("$Substitute Briefing Music:")) {
parse_comments(1);
fout(" %s", The_mission.substitute_briefing_music_name);
} else {
fso_comment_push(";;FSO 3.6.9;;");
fout_version("\n$Substitute Briefing Music: %s", The_mission.substitute_briefing_music_name);
fso_comment_pop();
}
fso_comment_pop();
} else {
bypass_comment(";;FSO 3.6.9;; $Substitute Briefing Music:");
}
@@ -3837,14 +3866,14 @@ int CFred_mission_save::save_music()
// Goober5000 - save using the special comment prefix
if (mission_has_fiction() && Mission_music[SCORE_FICTION_VIEWER] >= 0) {
fso_comment_push(";;FSO 3.6.11;;");
if (optional_string_fred("$Fiction Viewer Music:")) {
parse_comments(1);
fout(" %s", Spooled_music[Mission_music[SCORE_FICTION_VIEWER]].name);
} else {
fso_comment_push(";;FSO 3.6.11;;");
fout_version("\n$Fiction Viewer Music: %s", Spooled_music[Mission_music[SCORE_FICTION_VIEWER]].name);
fso_comment_pop();
}
fso_comment_pop();
} else {
bypass_comment(";;FSO 3.6.11;; $Fiction Viewer Music:");
}
@@ -4041,14 +4070,14 @@ int CFred_mission_save::save_campaign_file(char *pathname)
}
if ( Campaign.missions[m].debrief_persona_index > 0 ) {
fso_comment_push(";;FSO 3.6.8;;");
if (optional_string_fred("+Debriefing Persona Index:")) {
parse_comments(1);
fout(" %d", Campaign.missions[m].debrief_persona_index);
} else {
fso_comment_push(";;FSO 3.6.8;;");
fout_version("\n+Debriefing Persona Index: %d", Campaign.missions[m].debrief_persona_index);
fso_comment_pop();
}
fso_comment_pop();
} else {
bypass_comment(";;FSO 3.6.8;; +Debriefing Persona Index:");
}
@@ -4227,10 +4256,10 @@ void CFred_mission_save::fso_comment_push(char *ver)
elem1 = elem2 = 3;
}
if ( (elem1 == 3) && ((major > in_major) || (minor > in_minor) || (build > in_build)) ) {
if ( (elem1 == 3) && ((major > in_major) || ((major == in_major) && ((minor > in_minor) || ((minor == in_minor) && (build > in_build))))) ) {
// the push'd version is older than our current version, so just push a copy of the previous version
fso_ver_comment.push_back( before );
} else if ( (elem1 == 4) && ((major > in_major) || (minor > in_minor) || (build > in_build) || (revis > in_revis)) ) {
} else if ( (elem1 == 4) && ((major > in_major) || ((major == in_major) && ((minor > in_minor) || ((minor == in_minor) && ((build > in_build) || ((build == in_build) || (revis > in_revis))))))) ) {
// the push'd version is older than our current version, so just push a copy of the previous version
fso_ver_comment.push_back( before );
} else {
+1 -1
View File
@@ -80,7 +80,7 @@ public:
void fso_comment_pop(bool pop_all = false);
// Goober5000
void bypass_comment(char *comment);
void bypass_comment(const char *comment, const char *end = NULL);
};
#endif
+2
View File
@@ -65,7 +65,9 @@ BEGIN_MESSAGE_MAP(player_start_editor, CDialog)
//{{AFX_MSG_MAP(player_start_editor)
ON_WM_INITMENU()
ON_LBN_SELCHANGE(IDC_SHIP_LIST, OnSelchangeShipList)
ON_CLBN_CHKCHANGE(IDC_SHIP_LIST, OnSelchangeShipList)
ON_LBN_SELCHANGE(IDC_WEAPON_LIST, OnSelchangeWeaponList)
ON_CLBN_CHKCHANGE(IDC_SHIP_LIST, OnSelchangeWeaponList)
ON_EN_UPDATE(IDC_SHIP_POOL, OnUpdateShipPool)
ON_EN_UPDATE(IDC_WEAPON_POOL, OnUpdateWeaponPool)
ON_LBN_SELCHANGE(IDC_SHIP_VARIABLES_LIST, OnSelchangeShipVariablesList)
+2 -1
View File
@@ -1179,6 +1179,7 @@
#define IDC_MISSION_LOG_LAST_REPEAT 1640
#define IDC_MISSION_LOG_1ST_TRIGGER 1641
#define IDC_MISSION_LOG_LAST_TRIGGER 1642
#define IDC_NO_COLLIDE 1643
#define ID_FILE_MISSIONNOTES 32771
#define ID_DUPLICATE 32774
#define ID_VIEW_ROTATE 32775
@@ -1471,7 +1472,7 @@
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 320
#define _APS_NEXT_COMMAND_VALUE 33098
#define _APS_NEXT_CONTROL_VALUE 1643
#define _APS_NEXT_CONTROL_VALUE 1644
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif
+68 -38
View File
@@ -719,6 +719,12 @@ void sexp_tree::right_clicked(int mode)
type = tree_nodes[first_arg].type;
}
}
// Goober5000 - certain types accept both integers and a list of strings
if (op_type == OPF_GAME_SND || op_type == OPF_WEAPON_BANK_NUMBER)
{
type = SEXPT_NUMBER | SEXPT_STRING;
}
if ( (type & SEXPT_STRING) || (type & SEXPT_NUMBER) ) {
@@ -741,7 +747,8 @@ void sexp_tree::right_clicked(int mode)
if ( Sexp_variables[idx].type & SEXP_VARIABLE_STRING ) {
flag &= ~MF_GRAYED;
}
} else if ( type & SEXPT_NUMBER ) {
}
if ( type & SEXPT_NUMBER ) {
if ( Sexp_variables[idx].type & SEXP_VARIABLE_NUMBER ) {
flag &= ~MF_GRAYED;
}
@@ -1099,15 +1106,20 @@ void sexp_tree::right_clicked(int mode)
} else if (type == OPF_NULL) { // takes operator that doesn't return a value
replace_type = OPR_NULL;
// Goober5000
} else if (type == OPF_FLEXIBLE_ARGUMENT) {
replace_type = OPR_FLEXIBLE_ARGUMENT;
} else if (type == OPF_AI_GOAL) {
replace_type = OPR_AI_GOAL;
}
// Goober5000
else if (type == OPF_FLEXIBLE_ARGUMENT) {
replace_type = OPR_FLEXIBLE_ARGUMENT;
}
// Goober5000
else if (type == OPF_GAME_SND || type == OPF_WEAPON_BANK_NUMBER) {
// enable number even though we are also going to default to string
menu.EnableMenuItem(ID_REPLACE_NUMBER, MF_ENABLED);
}
// default to string
if (replace_type == OPR_STRING) {
menu.EnableMenuItem(ID_REPLACE_STRING, MF_ENABLED);
@@ -2320,9 +2332,6 @@ int sexp_tree::get_default_value(sexp_list_item *item, char *text_buf, int op, i
case 7:
temp = 100;
break;
case 10:
temp = SND_SHIP_EXPLODE_1;
break;
case 11:
temp = (int)EMP_DEFAULT_INTENSITY;
break;
@@ -2351,12 +2360,6 @@ int sexp_tree::get_default_value(sexp_list_item *item, char *text_buf, int op, i
case 7:
temp = 10;
break;
case 8:
temp = SND_CAPITAL_WARP_IN;
break;
case 9:
temp = SND_CAPITAL_WARP_OUT;
break;
default:
temp = 0;
break;
@@ -2419,6 +2422,32 @@ int sexp_tree::get_default_value(sexp_list_item *item, char *text_buf, int op, i
}
return 0;
// Goober5000 - special cases that used to be numbers but are now hybrids
case OPF_GAME_SND:
int sound_index = -1;
if ( (Operators[op].value == OP_EXPLOSION_EFFECT) )
{
sound_index = SND_SHIP_EXPLODE_1;
}
else if ( (Operators[op].value == OP_WARP_EFFECT) )
{
sound_index = (i == 8) ? SND_CAPITAL_WARP_IN : SND_CAPITAL_WARP_OUT;
}
if (sound_index >= 0)
{
game_snd *snd = &Snds[sound_index];
if (can_construe_as_integer(snd->name.c_str()))
item->set_data(snd->name.c_str(), (SEXPT_NUMBER | SEXPT_VALID));
else
item->set_data(snd->name.c_str(), (SEXPT_STRING | SEXPT_VALID));
return 0;
}
// if no hardcoded default, just use the listing default
break;
}
list = get_listing_opf(type, index, i);
@@ -2662,6 +2691,9 @@ int sexp_tree::query_default_argument_available(int op, int i)
case OPF_ANIMATION_TYPE:
case OPF_SHIP_FLAG:
case OPF_NEBULA_PATTERN:
case OPF_NAV_POINT:
case OPF_TEAM_COLOR:
case OPF_GAME_SND:
return 1;
case OPF_SHIP:
@@ -2700,10 +2732,7 @@ int sexp_tree::query_default_argument_available(int op, int i)
return 0;
case OPF_PERSONA:
if (Num_personas)
return 1;
return 0;
return (Num_personas > 0) ? 1 : 0;
case OPF_POINT:
case OPF_WAYPOINT_PATH:
@@ -2765,29 +2794,13 @@ int sexp_tree::query_default_argument_available(int op, int i)
return 0;
case OPF_VARIABLE_NAME:
if (sexp_variable_count() > 0) {
return 1;
} else {
return 0;
}
case OPF_NAV_POINT:
return 1;
return (sexp_variable_count() > 0) ? 1 : 0;
case OPF_SSM_CLASS:
if (Ssm_info_count > 0)
return 1;
else
return 0;
return (Ssm_info_count > 0) ? 1 : 0;
case OPF_MISSION_MOOD:
if (Builtin_moods.empty())
return 0;
else
return 1;
case OPF_TEAM_COLOR:
return 1;
return Builtin_moods.empty() ? 0 : 1;
default:
Int3();
@@ -4453,6 +4466,10 @@ sexp_list_item *sexp_tree::get_listing_opf(int opf, int parent_node, int arg_ind
list = get_listing_opf_nebula_patterns();
break;
case OPF_GAME_SND:
list = get_listing_opf_game_snds();
break;
default:
Int3(); // unknown OPF code
list = NULL;
@@ -6004,7 +6021,20 @@ sexp_list_item *sexp_tree::get_listing_opf_nebula_patterns()
return head.next;
}
sexp_list_item *sexp_tree::get_listing_opf_game_snds()
{
sexp_list_item head;
head.add_data(SEXP_NONE_STRING);
for (SCP_vector<game_snd>::iterator iter = Snds.begin(); iter != Snds.end(); ++iter) {
if (!can_construe_as_integer(iter->name.c_str())) {
head.add_data(iter->name.c_str());
}
}
return head.next;
}
// Deletes sexp_variable from sexp_tree.
// resets tree to not include given variable, and resets text and type
+1
View File
@@ -276,6 +276,7 @@ public:
sexp_list_item *get_listing_opf_ship_flags();
sexp_list_item *get_listing_opf_team_colors();
sexp_list_item *get_listing_opf_nebula_patterns();
sexp_list_item *get_listing_opf_game_snds();
int m_mode;
int item_index;
+31 -1
View File
@@ -74,6 +74,7 @@ void ship_flags_dlg::DoDataExchange(CDataExchange* pDX)
DDX_Control(pDX, IDC_HIDE_SHIP_NAME, m_hide_ship_name);
DDX_Control(pDX, IDC_DISABLE_ETS, m_disable_ets);
DDX_Control(pDX, IDC_CLOAKED, m_cloaked);
DDX_Control(pDX, IDC_NO_COLLIDE, m_no_collide);
DDX_Control(pDX, IDC_SET_CLASS_DYNAMICALLY, m_set_class_dynamically);
DDX_Control(pDX, IDC_SCRAMBLE_MESSAGES, m_scramble_messages);
//}}AFX_DATA_MAP
@@ -140,6 +141,7 @@ BEGIN_MESSAGE_MAP(ship_flags_dlg, CDialog)
ON_BN_CLICKED(IDC_DISABLE_ETS, OnDisableETS)
ON_BN_CLICKED(IDC_CLOAKED, OnCloaked)
ON_BN_CLICKED(IDC_SCRAMBLE_MESSAGES, OnScrambleMessages)
ON_BN_CLICKED(IDC_NO_COLLIDE, OnNoCollide)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -161,7 +163,7 @@ BOOL ship_flags_dlg::OnInitDialog()
int toggle_subsystem_scanning = 0, scannable = 0, kamikaze = 0, no_dynamic = 0, red_alert_carry = 0;
int special_warpin = 0, disable_messages = 0, guardian = 0, vaporize = 0, stealth = 0, friendly_stealth_invisible = 0;
int no_death_scream = 0, always_death_scream = 0, scramble_messages = 0;
int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0;
int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0, no_collide = 0;
object *objp;
ship *shipp;
@@ -210,6 +212,7 @@ BOOL ship_flags_dlg::OnInitDialog()
no_ets = (shipp->flags2 & SF2_NO_ETS) ? 1 : 0;
cloaked = (shipp->flags2 & SF2_CLOAKED) ? 1 : 0;
scramble_messages = (shipp->flags2 & SF2_SCRAMBLE_MESSAGES) ? 1 : 0;
no_collide = (objp->flags & OF_COLLIDES) ? 0 : 1;
destroy_before_mission = (shipp->flags & SF_KILL_BEFORE_MISSION) ? 1 : 0;
m_destroy_value.init(shipp->final_death_time);
@@ -270,6 +273,7 @@ BOOL ship_flags_dlg::OnInitDialog()
no_ets = tristate_set(shipp->flags2 & SF2_NO_ETS, no_ets);
cloaked = tristate_set(shipp->flags2 & SF2_CLOAKED, cloaked);
scramble_messages = tristate_set(shipp->flags2 & SF2_SCRAMBLE_MESSAGES, scramble_messages);
no_collide = tristate_set(!(objp->flags & OF_COLLIDES), no_collide);
// check the final death time and set the internal variable according to whether or not
// the final_death_time is set. Also, the value in the edit box must be set if all the
@@ -344,6 +348,7 @@ BOOL ship_flags_dlg::OnInitDialog()
m_disable_ets.SetCheck(no_ets);
m_cloaked.SetCheck(cloaked);
m_scramble_messages.SetCheck(scramble_messages);
m_no_collide.SetCheck(no_collide);
m_kdamage.setup(IDC_KDAMAGE, this);
m_destroy_value.setup(IDC_DESTROY_VALUE, this);
@@ -961,6 +966,22 @@ void ship_flags_dlg::update_ship(int shipnum)
break;
}
switch (m_no_collide.GetCheck()) {
case 1:
if ( objp->flags & OF_COLLIDES )
set_modified();
objp->flags &= ~OF_COLLIDES;
break;
case 0:
if (!(objp->flags & OF_COLLIDES))
set_modified();
objp->flags |= OF_COLLIDES;
break;
}
switch (m_guardian.GetCheck()) {
case 1:
if ( !(shipp->ship_guardian_threshold) )
@@ -1410,3 +1431,12 @@ void ship_flags_dlg::OnScrambleMessages()
m_scramble_messages.SetCheck(1);
}
}
void ship_flags_dlg::OnNoCollide()
{
if (m_no_collide.GetCheck() == 1) {
m_no_collide.SetCheck(0);
} else {
m_no_collide.SetCheck(1);
}
}
+2
View File
@@ -65,6 +65,7 @@ public:
CButton m_hide_ship_name;
CButton m_disable_ets;
CButton m_cloaked;
CButton m_no_collide;
CButton m_set_class_dynamically;
CButton m_scramble_messages;
@@ -126,6 +127,7 @@ protected:
afx_msg void OnDisableETS();
afx_msg void OnCloaked();
afx_msg void OnScrambleMessages();
afx_msg void OnNoCollide();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
+13 -9
View File
@@ -126,7 +126,9 @@ void CShipTexturesDlg::OnOK()
{
if (!stricmp(ii->ship_name, Ships[self_ship].ship_name))
{
end--;
do {
end--;
} while (end != ii && !stricmp(end->ship_name, Ships[self_ship].ship_name));
if (end == ii)
break;
texture_set(&(*ii), &(*end));
@@ -134,7 +136,7 @@ void CShipTexturesDlg::OnOK()
}
if (end != Fred_texture_replacements.end())
Fred_texture_replacements.erase(end);
Fred_texture_replacements.erase(end, Fred_texture_replacements.end());
// now put the new entries on the end of the list
for (i=0; i<texture_count; i++)
@@ -217,20 +219,22 @@ BOOL CShipTexturesDlg::OnInitDialog()
// make old texture lowercase
strlwr(texture_file);
// now add it to the box
z = box->AddString(texture_file);
// and add it to the field as well
// add it to the field
strcpy_s(old_texture_name[texture_count], texture_file);
// increment
texture_count++;
// sort
sort_textures();
}
}
// now sort the filenames
sort_textures();
// and add them to the box
for (i=0; i<texture_count; i++) {
z = box->AddString(old_texture_name[i]);
}
// now look for new textures
for (SCP_vector<texture_replace>::iterator ii = Fred_texture_replacements.begin(); ii != Fred_texture_replacements.end(); ++ii)
{
+5 -6
View File
@@ -52,8 +52,7 @@ void text_view_dlg::set(int ship_class)
{
char line[256], line2[256], file_text[82];
int i, j, n, found = 0, comment = 0, num_files = 0;
char tbl_file_arr[MAX_TBL_PARTS][MAX_FILENAME_LEN];
char *tbl_file_names[MAX_TBL_PARTS];
SCP_vector<SCP_string> tbl_file_names;
CFILE *fp;
if (ship_class < 0)
@@ -112,12 +111,12 @@ void text_view_dlg::set(int ship_class)
// done with ships.tbl, so now check all modular ship tables...
num_files = cf_get_file_list_preallocated(MAX_TBL_PARTS, tbl_file_arr, tbl_file_names, CF_TYPE_TABLES, NOX("*-shp.tbm"), CF_SORT_REVERSE);
num_files = cf_get_file_list(tbl_file_names, CF_TYPE_TABLES, NOX("*-shp.tbm"), CF_SORT_REVERSE);
for (n = 0; n < num_files; n++){
strcat(tbl_file_names[n], ".tbm");
tbl_file_names[n] += ".tbm";
fp = cfopen(tbl_file_names[n], "r");
fp = cfopen(tbl_file_names[n].c_str(), "r");
Assert(fp);
memset( line, 0, sizeof(line) );
@@ -160,7 +159,7 @@ void text_view_dlg::set(int ship_class)
if (!stricmp(line2 + i, Ship_info[ship_class].name)) {
memset( file_text, 0, sizeof(file_text) );
snprintf(file_text, sizeof(file_text)-1, "-- %s -------------------------------\r\n", tbl_file_names[n]);
snprintf(file_text, sizeof(file_text)-1, "-- %s -------------------------------\r\n", tbl_file_names[n].c_str());
m_edit += file_text;
found = 1;
}
+1 -1
View File
@@ -389,7 +389,7 @@ void VoiceActingManager::OnGenerateFileNames()
// notify user that we are done and how many filenames were changed
char message[128] = { '\0' };
snprintf(message, sizeof(message), "File name generation complete. Modified %u messages.", modified_filenames);
snprintf(message, sizeof(message)-1, "File name generation complete. Modified %u messages.", modified_filenames);
MessageBox(message, "Woohoo!");
}
-105
View File
@@ -512,108 +512,3 @@ int get_free_objnum(void)
return -1;
}
// Create a wing.
// wing_type is the type of wing from the Wing_formations array to create.
// leader_index is the index in Objects of the leader object. This object must
// have a position and an orientation.
// *wingmen is a list of indices of existing ships to be added to the wing.
// The wingmen list is terminated by -1.
// max_size is the maximum number of ships to add to the wing
// fill_flag is set if more ships are to be added to fill out the wing to max_size
void create_wing(int wing_type, int leader_index, int *wingmen, int max_size, int fill_flag)
{
int num_placed, num_vectors, cur_vec_index;
object *lobjp = &Objects[leader_index];
formation *wingp;
object *parent;
int wing_list[MAX_OBJECTS];
matrix rotmat;
initialize_wings();
Assert((wing_type >= 0) && (wing_type < MAX_WING_FORMATIONS));
Assert(Wing_formations[wing_type].num_vectors > 0);
Assert(Wing_formations[wing_type].num_vectors < MAX_WING_VECTORS);
Assert(Objects[leader_index].type != OBJ_NONE);
Assert(max_size < MAX_SHIPS_PER_WING);
num_placed = 0;
wingp = &Wing_formations[wing_type];
num_vectors = wingp->num_vectors;
cur_vec_index = 0;
parent = lobjp;
vm_copy_transpose_matrix(&rotmat, &lobjp->orient);
while (num_placed < max_size) {
vec3d wvec;
int curobj;
if (*wingmen == -1) {
if (!fill_flag)
break;
else {
curobj = get_free_objnum();
Assert(curobj != -1);
Objects[curobj].type = lobjp->type;
Assert(Wings[cur_wing].wave_count < MAX_SHIPS_PER_WING);
// JEH Wings[cur_wing].ship_list[Wings[cur_wing].count] = curobj;
Wings[cur_wing].wave_count++;
}
} else
curobj = *wingmen++;
Objects[curobj] = *lobjp;
vm_vec_rotate(&wvec, &wingp->offsets[cur_vec_index], &rotmat);
cur_vec_index = (cur_vec_index + 1) % num_vectors;
if (num_placed < num_vectors)
parent = lobjp;
else
parent = &Objects[wing_list[num_placed - num_vectors]];
wing_list[num_placed] = curobj;
vm_vec_add(&Objects[curobj].pos, &parent->pos, &wvec);
num_placed++;
}
}
// Create a wing.
// cur_object_index becomes the leader.
// If count == -1, then all objects of wing cur_wing get added to the wing.
// If count == +n, then n objects are added to the wing.
void test_form_wing(int count)
{
int i, wingmen[MAX_OBJECTS];
int j, fill_flag;
j = 0;
Assert(cur_object_index != -1);
Assert(Objects[cur_object_index].type != OBJ_NONE);
Assert(get_wingnum(cur_object_index) != -1);
get_wingnum(cur_object_index);
wingmen[0] = -1;
for (i=1; i<MAX_OBJECTS; i++)
if ((get_wingnum(i) == cur_wing) && (Objects[i].type != OBJ_NONE))
if (i != cur_object_index)
wingmen[j++] = i;
wingmen[j] = -1;
fill_flag = 0;
if (count > 0) {
fill_flag = 1;
j += count;
}
set_wingnum(cur_object_index, cur_wing);
create_wing(0, cur_object_index, wingmen, j, fill_flag);
}
+123 -50
View File
@@ -1199,6 +1199,8 @@ void game_loading_callback(int count)
char filename[35];
int size;
int i;
int line_height = gr_get_font_height() + 1;
memblockinfo_sort();
for(i = 0; i < 30; i++)
{
@@ -1216,10 +1218,10 @@ void game_loading_callback(int count)
short_name++;
sprintf(mem_buffer,"%s:\t%d K", short_name, size);
gr_string( 20, 220 + (i*10), mem_buffer, GR_RESIZE_MENU);
gr_string( 20, 220 + (i*line_height), mem_buffer, GR_RESIZE_MENU);
}
sprintf(mem_buffer,"Total RAM:\t%d K", TotalRam / 1024);
gr_string( 20, 230 + (i*10), mem_buffer, GR_RESIZE_MENU);
gr_string( 20, 230 + (i*line_height), mem_buffer, GR_RESIZE_MENU);
#endif // _WIN32
}
#endif // !NDEBUG
@@ -1420,6 +1422,8 @@ int game_start_mission()
{
mprintf(( "=================== STARTING LEVEL LOAD ==================\n" ));
int s1 = timer_get_milliseconds();
// clear post processing settings
gr_post_process_set_defaults();
@@ -1474,6 +1478,10 @@ int game_start_mission()
#endif
bm_print_bitmaps();
int e1 = timer_get_milliseconds();
mprintf(("Level load took %f seconds.\n", (e1 - s1) / 1000.0f ));
return 1;
}
@@ -1781,6 +1789,8 @@ void game_init()
cmdline_debug_print_cmdline();
#endif
memset(whee, 0, sizeof(whee));
GetCurrentDirectory(MAX_PATH_LEN-1, whee);
strcat_s(whee, DIR_SEPARATOR_STR);
@@ -1889,9 +1899,9 @@ void game_init()
SDL_VERSION(&info.version); // initialize info structure with SDL version info
bool voiceRectOn = false;
if(SDL_GetWindowWMInfo(window, &info)) { // the call returns true on success
if(SDL_GetWindowWMInfo(os_get_window(), &info)) { // the call returns true on success
// success
voiceRectOn = VOICEREC_init(info.HWND, WM_RECOEVENT, GRAMMARID1, IDR_CMD_CFG);
voiceRectOn = VOICEREC_init(info.info.win.window, WM_RECOEVENT, GRAMMARID1, IDR_CMD_CFG);
} else {
// call failed
mprintf(( "Couldn't get window information: %s\n", SDL_GetError() ));
@@ -2044,6 +2054,8 @@ void game_init()
pilot_load_pic_list();
pilot_load_squad_pic_list();
io::mouse::CursorManager::init();
if(!Cmdline_reparse_mainhall)
{
main_hall_table_init();
@@ -2135,6 +2147,7 @@ void game_get_framerate()
void game_show_framerate()
{
float cur_time;
int line_height = gr_get_font_height() + 1;
cur_time = f2fl(timer_get_approx_seconds());
if (cur_time - Start_time > 30.0f) {
@@ -2155,11 +2168,11 @@ void game_show_framerate()
for ( pss = GET_FIRST(&shipp->subsys_list); pss !=END_OF_LIST(&shipp->subsys_list); pss = GET_NEXT(pss) ) {
if (pss->system_info->type == SUBSYSTEM_TURRET) {
if(pss->turret_enemy_objnum == -1)
gr_printf_no_resize(10, t*10, "Turret %d: <None>", t);
gr_printf_no_resize(10, t*line_height, "Turret %d: <None>", t);
else if (Objects[pss->turret_enemy_objnum].type == OBJ_SHIP)
gr_printf_no_resize(10, t*10, "Turret %d: %s", t, Ships[Objects[pss->turret_enemy_objnum].instance].ship_name);
gr_printf_no_resize(10, t*line_height, "Turret %d: %s", t, Ships[Objects[pss->turret_enemy_objnum].instance].ship_name);
else
gr_printf_no_resize(10, t*10, "Turret %d: <Object %d>", t, pss->turret_enemy_objnum);
gr_printf_no_resize(10, t*line_height, "Turret %d: <Object %d>", t, pss->turret_enemy_objnum);
t++;
}
@@ -2172,7 +2185,7 @@ void game_show_framerate()
gr_set_color_fast(&HUD_color_debug);
if (Cmdline_frame_profile) {
gr_string(20, 110, profile_output, GR_RESIZE_NONE);
gr_string(20, 100 + line_height, profile_output, GR_RESIZE_NONE);
}
if (Show_framerate) {
@@ -2204,106 +2217,104 @@ void game_show_framerate()
else
sprintf(mem_buffer,"Using Physical: %d Meg",(Mem_starttime_phys - mem_stats.dwAvailPhys)/1024/1024);
gr_string( 20, 120, mem_buffer, GR_RESIZE_NONE);
gr_string( 20, 100 + (line_height * 2), mem_buffer, GR_RESIZE_NONE);
sprintf(mem_buffer,"Using Pagefile: %d Meg",(Mem_starttime_pagefile - mem_stats.dwAvailPageFile)/1024/1024);
gr_string( 20, 130, mem_buffer, GR_RESIZE_NONE);
gr_string( 20, 100 + (line_height * 3), mem_buffer, GR_RESIZE_NONE);
sprintf(mem_buffer,"Using Virtual: %d Meg",(Mem_starttime_virtual - mem_stats.dwAvailVirtual)/1024/1024);
gr_string( 20, 140, mem_buffer, GR_RESIZE_NONE);
gr_string( 20, 100 + (line_height * 4), mem_buffer, GR_RESIZE_NONE);
if ( ((int)mem_stats.dwAvailPhys == -1) || ((int)mem_stats.dwTotalPhys == -1) )
sprintf(mem_buffer, "Physical Free: *** / *** (>4G)");
else
sprintf(mem_buffer,"Physical Free: %d / %d Meg",mem_stats.dwAvailPhys/1024/1024, mem_stats.dwTotalPhys/1024/1024);
gr_string( 20, 160, mem_buffer, GR_RESIZE_NONE);
gr_string( 20, 100 + (line_height * 6), mem_buffer, GR_RESIZE_NONE);
sprintf(mem_buffer,"Pagefile Free: %d / %d Meg",mem_stats.dwAvailPageFile/1024/1024, mem_stats.dwTotalPageFile/1024/1024);
gr_string( 20, 170, mem_buffer, GR_RESIZE_NONE);
gr_string( 20, 100 + (line_height * 7), mem_buffer, GR_RESIZE_NONE);
sprintf(mem_buffer,"Virtual Free: %d / %d Meg",mem_stats.dwAvailVirtual/1024/1024, mem_stats.dwTotalVirtual/1024/1024);
gr_string( 20, 180, mem_buffer, GR_RESIZE_NONE);
gr_string( 20, 100 + (line_height * 8), mem_buffer, GR_RESIZE_NONE);
}
#endif
#ifndef NDEBUG
if ( Show_cpu == 1 ) {
int sx,sy,dy;
int sx,sy;
sx = gr_screen.max_w - 154;
sy = 15;
dy = gr_get_font_height() + 1;
gr_set_color_fast(&HUD_color_debug);
gr_printf_no_resize( sx, sy, NOX("DMA: %s"), transfer_text );
sy += dy;
sy += line_height;
gr_printf_no_resize( sx, sy, NOX("POLYP: %d"), modelstats_num_polys );
sy += dy;
sy += line_height;
gr_printf_no_resize( sx, sy, NOX("POLYD: %d"), modelstats_num_polys_drawn );
sy += dy;
sy += line_height;
gr_printf_no_resize( sx, sy, NOX("VERTS: %d"), modelstats_num_verts );
sy += dy;
sy += line_height;
{
extern int Num_pairs; // Number of object pairs that were checked.
gr_printf_no_resize( sx, sy, NOX("PAIRS: %d"), Num_pairs );
sy += dy;
sy += line_height;
extern int Num_pairs_checked; // What percent of object pairs were checked.
gr_printf_no_resize( sx, sy, NOX("FVI: %d"), Num_pairs_checked );
sy += dy;
sy += line_height;
Num_pairs_checked = 0;
}
gr_printf_no_resize( sx, sy, NOX("Snds: %d"), snd_num_playing() );
sy += dy;
sy += line_height;
if ( Timing_total > 0.01f ) {
gr_printf_no_resize( sx, sy, NOX("CLEAR: %.0f%%"), Timing_clear*100.0f/Timing_total );
sy += dy;
sy += line_height;
gr_printf_no_resize( sx, sy, NOX("REND2D: %.0f%%"), Timing_render2*100.0f/Timing_total );
sy += dy;
sy += line_height;
gr_printf_no_resize( sx, sy, NOX("REND3D: %.0f%%"), Timing_render3*100.0f/Timing_total );
sy += dy;
sy += line_height;
gr_printf_no_resize( sx, sy, NOX("FLIP: %.0f%%"), Timing_flip*100.0f/Timing_total );
sy += dy;
sy += line_height;
gr_printf_no_resize( sx, sy, NOX("GAME: %.0f%%"), (Timing_total-(Timing_render2+Timing_render3+Timing_flip+Timing_clear))*100.0f/Timing_total );
sy += dy;
sy += line_height;
}
}
if ( Show_mem ) {
int sx,sy,dy;
int sx,sy;
sx = gr_screen.max_w - 154;
sy = 15;
dy = gr_get_font_height() + 1;
gr_set_color_fast(&HUD_color_debug);
{
extern int TotalRam;
gr_printf_no_resize( sx, sy, NOX("DYN: %d KB\n"), TotalRam/1024 );
sy += dy;
sy += line_height;
}
{
extern int Model_ram;
gr_printf_no_resize( sx, sy, NOX("POF: %d KB\n"), Model_ram/1024 );
sy += dy;
sy += line_height;
}
gr_printf_no_resize( sx, sy, NOX("%s: %d KB\n"), (Cmdline_cache_bitmaps) ? NOX("C-BMP") : NOX("BMP"), bm_texture_ram/1024 );
sy += dy;
sy += line_height;
gr_printf_no_resize( sx, sy, NOX("S-SRAM: %d KB\n"), Snd_sram/1024 ); // mem used to store game sound
sy += dy;
sy += line_height;
{
extern int GL_textures_in;
extern int GL_vertex_data_in;
gr_printf_no_resize( sx, sy, NOX("VRAM: %d KB\n"), (GL_textures_in + GL_vertex_data_in)/1024 );
sy += dy;
sy += line_height;
}
}
@@ -2343,11 +2354,11 @@ void game_show_framerate()
short_name++;
sprintf(mem_buffer,"%s:\t%d K", short_name, size);
gr_string( 20, 220 + (mi*10), mem_buffer, GR_RESIZE_NONE);
gr_string( 20, 100 + (line_height * 12) + (mi*line_height), mem_buffer, GR_RESIZE_NONE);
}
sprintf(mem_buffer,"Total RAM:\t%d K", TotalRam / 1024);
gr_string( 20, 230 + (mi*10), mem_buffer, GR_RESIZE_NONE);
gr_string( 20, 100 + (line_height * 13) + (mi*line_height), mem_buffer, GR_RESIZE_NONE);
}
#endif
@@ -3083,7 +3094,7 @@ float get_shake(float intensity, int decay_time, int max_decay_time)
{
int r = myrand();
float shake = intensity * (float) (r-RAND_MAX_2)/RAND_MAX;
float shake = intensity * (float)(r-RAND_MAX_2) * RAND_MAX_1f;
if (decay_time >= 0) {
Assert(max_decay_time > 0);
@@ -3711,7 +3722,9 @@ void game_render_frame( camid cid )
}
// this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
if ( Cmdline_env && !Env_cubemap_drawn ) {
// Note: environment mapping gets disabled when rendering to texture; if you change
// this, make sure that the current render target gets restored right afterwards!
if ( Cmdline_env && !Env_cubemap_drawn && gr_screen.rendering_to_texture == -1 ) {
setup_environment_mapping(cid);
if ( !Dynamic_environment ) {
@@ -5635,7 +5648,7 @@ void game_leave_state( int old_state, int new_state )
} else {
cmd_brief_close();
common_select_close();
common_select_close();
if (new_state == GS_STATE_MAIN_MENU) {
freespace_stop_mission();
}
@@ -7071,7 +7084,8 @@ int game_main(char *cmdline)
return 1;
}
if (Is_standalone) {
if (Is_standalone){
nprintf(("Network", "Standalone running\n"));
}
/* This broke in AP Migrating from Trunk
@@ -7086,7 +7100,8 @@ int game_main(char *cmdline)
game_init();
// calling the function that will init all the function pointers for TrackIR stuff (Swifty)
int trackIrInitResult = gTirDll_TrackIR.Init( (HWND)os_get_window( ) );
if ( trackIrInitResult != SCP_INITRESULT_SUCCESS ) {
if ( trackIrInitResult != SCP_INITRESULT_SUCCESS )
{
mprintf( ("TrackIR Init Failed - %d\n", trackIrInitResult) );
}
game_stop_time();
@@ -7144,13 +7159,7 @@ int game_main(char *cmdline)
}
game_shutdown();
/* This broke in AP migrating from Trunk
#ifdef _WIN32
if ( !Is_standalone ) {
enableWindowsKey( );
}
#endif
*/
return 0;
}
@@ -7195,7 +7204,7 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int nCmdSh
*p = 0;
// Set directory
if ( strlen(exe_dir) > 0 ) { //-V805
if ( strlen(exe_dir) > 0 ) { //-V805
SetCurrentDirectory(exe_dir);
}
}
@@ -7247,6 +7256,7 @@ int main(int argc, char *argv[])
#endif
// create user's directory
memset(userdir, 0, sizeof(userdir));
snprintf(userdir, MAX_PATH - 1, "%s/%s/", detect_home(), Osreg_user_dir);
_mkdir(userdir);
@@ -7920,6 +7930,13 @@ void get_version_string(char *str, int max_size)
if (Cmdline_nohtl)
strcat_s( str, max_size, " non-HT&L" );
// if a custom identifier exists, put it at the very end
#ifdef FS_VERSION_IDENT
strcat_s( str, max_size, " (" );
strcat_s( str, max_size, FS_VERSION_IDENT );
strcat_s( str, max_size, ")" );
#endif
}
void get_version_string_short(char *str)
@@ -8547,6 +8564,58 @@ int game_hacked_data()
void game_title_screen_display()
{
/* _finddata_t find;
long find_handle;
char current_dir[256];
//Get the find string
_getcwd(current_dir, 256);
strcat_s(current_dir, DIR_SEPARATOR_STR);
strcat_s(current_dir, "*.pcx");
//Let the search begin!
find_handle = _findfirst(current_dir, &find);
int i = 0;
if(find_handle != -1)
{
char *p;
do {
if(!(find.attrib & _A_SUBDIR) && (strlen(find.name) < MAX_FILENAME_LEN)) {
p = strchr( find.name, '.' );
if(p) {
*p = '\0';
}
if(stricmp(find.name, Game_logo_screen_fname[gr_screen.res])
&& stricmp(find.name, Game_title_screen_fname[gr_screen.res]))
{
strcpy_s(Splash_screens[i], find.name);
i++;
}
if(i == MAX_SPLASHSCREENS) {
break;
}
}
} while(!_findnext(find_handle, &find));
}
if(i) {
srand(time(NULL));
title_bitmap = bm_load(Splash_screens[rand() % i]);
} else {
title_bitmap = bm_load(Game_title_screen_fname[gr_screen.res]);
}
if (title_bitmap == -1 && title_logo == -1) {
// return;
}
*/
//Script_system.SetHookVar("SplashScreenImage", 's', Game_title_screen_fname[gr_screen.res]);
//Script_system.SetHookVar("SplashScreenLogo", 's', Game_logo_screen_fname[gr_screen.res]);
bool globalhook_override = Script_system.IsOverride(Script_splashhook);
bool condhook_override = Script_system.IsConditionOverride(CHA_SPLASHSCREEN);
mprintf(("SCRIPTING: Splash screen overrides checked\n"));
@@ -8745,6 +8814,10 @@ void game_unpause()
case GS_STATE_GAME_PLAY:
break;
// ditto for if we explicitly paused the game and then minimized it
case GS_STATE_GAME_PAUSED:
break;
case GS_STATE_FICTION_VIEWER:
fiction_viewer_unpause();
break;
+4 -4
View File
@@ -336,8 +336,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,7,1,000000
PRODUCTVERSION 3,7,1,000000
FILEVERSION 3,7,3,000000
PRODUCTVERSION 3,7,3,000000
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -354,12 +354,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Volition Inc."
VALUE "FileDescription", "FreeSpace 2 Open"
VALUE "FileVersion", "3.7.1.000000"
VALUE "FileVersion", "3.7.3.000000"
VALUE "InternalName", "FreeSpace 2 Open"
VALUE "LegalCopyright", "Copyright © 1998"
VALUE "OriginalFilename", "fs2.exe"
VALUE "ProductName", "FreeSpace 2 Open"
VALUE "ProductVersion", "3.7.1"
VALUE "ProductVersion", "3.7.3"
END
END
BLOCK "VarFileInfo"
+1 -1
View File
@@ -286,7 +286,7 @@ void launch_context_help()
void close_help(){
for (int overlay_id=0; overlay_id<MAX_HELP_OVERLAYS; overlay_id++){
if (help_overlaylist[overlay_id].textlist.size() > 0) {
for(SCP_vector<help_text>::iterator ii = help_overlaylist[overlay_id].textlist.at(0).begin(); ii != help_overlaylist[overlay_id].textlist.at(0).end(); ii++) {
for(SCP_vector<help_text>::iterator ii = help_overlaylist[overlay_id].textlist.at(0).begin(); ii != help_overlaylist[overlay_id].textlist.at(0).end(); ++ii) {
safe_kill(ii->string);
}
}
+2 -4
View File
@@ -1360,10 +1360,8 @@ void parse_menumusic()
// Goober5000 - check for existence of file
// taylor - check for all file types
const int NUM_EXT = 2;
const char *exts[NUM_EXT] = { ".ogg", ".wav" };
if ( cf_exists_full_ext(Spooled_music[idx].filename, CF_TYPE_MUSIC, NUM_EXT, exts) )
// chief1983 - use type list defined in audiostr.h
if ( cf_exists_full_ext(Spooled_music[idx].filename, CF_TYPE_MUSIC, NUM_AUDIO_EXT, audio_ext_list) )
Spooled_music[idx].flags |= SMF_VALID;
if (!nocreate)
+14 -4
View File
@@ -26,6 +26,7 @@ SCP_vector<char> Color_Tags;
color Color_text_normal, Color_text_subselected, Color_text_selected;
color Color_text_error, Color_text_error_hi, Color_text_active, Color_text_active_hi;
color Color_text_heading, Color_more_indicator, Color_more_bright, Color_bright, Color_normal;
color Color_briefing_grid;
color Color_blue, Color_bright_blue, Color_green, Color_bright_green;
color Color_black, Color_grey, Color_silver, Color_white, Color_bright_white;
@@ -132,6 +133,7 @@ color *interface_colors[INTERFACE_COLORS] = {
&Color_more_bright,
&Color_bright,
&Color_normal,
&Color_briefing_grid,
};
const int interface_defaults[INTERFACE_COLORS] = {
@@ -147,6 +149,7 @@ const int interface_defaults[INTERFACE_COLORS] = {
13, //"Bright Red"
1, //"Bright Blue"
7, //"White"
5, //"Grey"
};
#define DEFAULT_TAGS 20
@@ -373,10 +376,14 @@ void parse_everything_else(const char *filename)
stuff_string(temp2, F_NAME, NAME_LENGTH);
temp = temp2;
if (!stricmp(temp2, "none")) {
Warning(LOCATION, "Team color in '%s' defined with a name of '%s'; this won't be usable due to 'None' being used for a lack of a team color by the engine.\n", filename, temp2);
}
if (required_string("$Team Stripe Color:")) {
int rgb[3];
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
for (int i = 0; i < 3; i++) {
for (i = 0; i < 3; i++) {
CLAMP(rgb[i], 0, 255);
}
@@ -388,7 +395,7 @@ void parse_everything_else(const char *filename)
if (required_string("$Team Base Color:")) {
int rgb[3];
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
for (int i = 0; i < 3; i++) {
for (i = 0; i < 3; i++) {
CLAMP(rgb[i], 0, 255);
}
@@ -397,8 +404,10 @@ void parse_everything_else(const char *filename)
temp_color.base.b = rgb[2] / 255.0f;
}
if (Team_Colors.find(temp) == Team_Colors.end()) { // Only push to the vector if the team isn't already defined.
Team_Names.push_back(temp);
}
Team_Colors[temp] = temp_color;
Team_Names.push_back(temp);
}
required_string("#End");
}
@@ -418,6 +427,7 @@ void parse_everything_else(const char *filename)
"$Bright More Indicator:",
"$Bright:",
"$Normal:",
"$Briefing Grid:",
};
// now for each color, check if its corresponding string is there
@@ -613,4 +623,4 @@ void parse_everything_else(const char *filename)
}
required_string("#End");
}
}
}
+2 -1
View File
@@ -21,10 +21,11 @@
// Colors for UI
// See FreeSpace.cpp for usage
#define INTERFACE_COLORS 12
#define INTERFACE_COLORS 13
extern color Color_text_normal, Color_text_subselected, Color_text_selected;
extern color Color_text_error, Color_text_error_hi, Color_text_active, Color_text_active_hi;
extern color Color_text_heading, Color_more_indicator, Color_more_bright, Color_bright, Color_normal;
extern color Color_briefing_grid;
#define TOTAL_COLORS 22
extern color Color_blue, Color_bright_blue, Color_green, Color_bright_green;
+1
View File
@@ -313,6 +313,7 @@ const float PI2 = (PI*2.0f);
// half values
const float PI_2 = (PI/2.0f);
const int RAND_MAX_2 = (RAND_MAX/2);
const float RAND_MAX_1f = (1.0f / RAND_MAX);
#define ANG_TO_RAD(x) ((x)*PI/180)
+2 -1
View File
@@ -34,8 +34,9 @@
#define FS_VERSION_MAJOR 3 // major version
#define FS_VERSION_MINOR 7 // increase by 1 for minor revs
#define FS_VERSION_BUILD 1 // bugfix release
#define FS_VERSION_BUILD 3 // bugfix release
#define FS_VERSION_REVIS 000000 // SVN revision
//#define FS_VERSION_IDENT NOX("custom") // special build release identifier, must be a string (don't define unless it's supposed to be used!!)
#define VERSION_LOC_FNAME "version.nfo"
#define MOTD_LOC_FNAME "motd.txt"
+13 -6
View File
@@ -22,12 +22,19 @@
#endif // __GNUC__
#if ! defined __GNUC__
#include <hash_map>
#if defined(_MSC_VER) && _MSC_VER < 1400
#define SCP_hash_map std::hash_map
#else
#define SCP_hash_map stdext::hash_map
#endif
#if defined(_MSC_VER)
#if _MSC_VER < 1900
#include <hash_map>
#if _MSC_VER < 1400
#define SCP_hash_map std::hash_map
#else
#define SCP_hash_map stdext::hash_map
#endif
#else
#include <unordered_map>
#define SCP_hash_map std::unordered_map
#endif
#endif
#endif // ! defined __GNUC__
#if defined(_MSC_VER) && _MSC_VER >= 1400 || !defined(_MSC_VER)
+36 -26
View File
@@ -152,15 +152,20 @@ size_t DumpBuffer :: Size() const
void DumpBuffer :: Printf( const char* format, ... )
{
va_list argPtr ;
int pos = current - buffer;
int max = BUFFER_SIZE - pos;
// protect against obvious buffer overflow
if( current - buffer < BUFFER_SIZE )
{
va_list argPtr ;
va_start( argPtr, format ) ;
int count = vsprintf( current, format, argPtr ) ;
va_end( argPtr ) ;
current += count ;
}
if (pos >= BUFFER_SIZE)
return;
va_start( argPtr, format ) ;
vsnprintf( current, max-1, format, argPtr ) ;
va_end( argPtr ) ;
current[max-1] = '\0';
current += strlen(current);
}
@@ -974,11 +979,13 @@ void _cdecl WinAssert(char * text, char * filename, int linenum )
void _cdecl WinAssert(char * text, char * filename, int linenum, const char * format, ... )
{
int val;
va_list args;
memset( AssertText1, 0, sizeof(AssertText1) );
memset( AssertText2, 0, sizeof(AssertText2) );
va_start(args, format);
vsprintf(AssertText2, format, args);
vsnprintf(AssertText2, sizeof(AssertText2)-1, format, args);
va_end(args);
// this stuff migt be really useful for solving bug reports and user errors. We should output it!
@@ -995,7 +1002,7 @@ void _cdecl WinAssert(char * text, char * filename, int linenum, const char * fo
gr_activate(0);
filename = strrchr(filename, '\\')+1;
sprintf( AssertText1, "Assert: %s\r\nFile: %s\r\nLine: %d\r\n%s\r\n", text, filename, linenum, AssertText2 );
snprintf( AssertText1, sizeof(AssertText1)-1, "Assert: %s\r\nFile: %s\r\nLine: %d\r\n%s\r\n", text, filename, linenum, AssertText2 );
#if defined( SHOW_CALL_STACK ) && defined( PDB_DEBUGGING )
/* Dump the callstack */
@@ -1069,15 +1076,6 @@ void LuaError(struct lua_State *L, char *format, ...)
gr_activate(0);
/*
va_start(args, format);
vsprintf(AssertText1,format,args);
va_end(args);
*/
//filename = strrchr(filename, '\\')+1;
//sprintf(AssertText2,"LuaError: %s\r\nFile: %s\r\nLine: %d\r\n", AssertText1, filename, line );
dumpBuffer.Clear();
//WMC - if format is set to NULL, assume this is acting as an
//error handler for Lua.
@@ -1089,10 +1087,15 @@ void LuaError(struct lua_State *L, char *format, ...)
else
{
va_list args;
memset(AssertText1, 0, sizeof(AssertText1));
memset(AssertText2, 0, sizeof(AssertText2));
va_start(args, format);
vsprintf(AssertText1,format,args);
dumpBuffer.Printf(AssertText1);
vsnprintf(AssertText1, sizeof(AssertText1)-1, format,args);
va_end(args);
dumpBuffer.Printf(AssertText1);
}
dumpBuffer.Printf( "\r\n" );
@@ -1193,12 +1196,15 @@ void _cdecl Error( const char * filename, int line, const char * format, ... )
int val;
va_list args;
memset( AssertText1, 0, sizeof(AssertText1) );
memset( AssertText2, 0, sizeof(AssertText2) );
va_start(args, format);
vsprintf(AssertText1, format, args);
vsnprintf(AssertText1, sizeof(AssertText1)-1, format, args);
va_end(args);
filename = strrchr(filename, '\\')+1;
sprintf(AssertText2, "Error: %s\r\nFile: %s\r\nLine: %d\r\n", AssertText1, filename, line);
snprintf(AssertText2, sizeof(AssertText2)-1, "Error: %s\r\nFile: %s\r\nLine: %d\r\n", AssertText1, filename, line);
mprintf(("ERROR: %s\r\nFile: %s\r\nLine: %d\r\n", AssertText1, filename, line));
Messagebox_active = true;
@@ -1266,9 +1272,13 @@ void _cdecl WarningEx( char *filename, int line, const char *format, ... )
if (Cmdline_extra_warn) {
char msg[sizeof(AssertText1)];
va_list args;
memset(msg, 0, sizeof(msg));
va_start(args, format);
vsprintf(msg, format, args);
vsnprintf(msg, sizeof(msg)-1, format, args);
va_end(args);
Warning(filename, line, msg);
}
#endif
@@ -1290,7 +1300,7 @@ void _cdecl Warning( char *filename, int line, const char *format, ... )
memset( AssertText2, 0, sizeof(AssertText2) );
va_start(args, format);
vsprintf(AssertText1, format, args);
vsnprintf(AssertText1, sizeof(AssertText1) - 1, format, args);
va_end(args);
slen = strlen(AssertText1);
+30 -27
View File
@@ -33,7 +33,6 @@
#include "io/keycontrol.h" // m!m
#include "io/cursor.h"
#include "debugconsole/console.h"
#include "debugconsole/console.h"
#if ( SDL_VERSION_ATLEAST(1, 2, 7) )
@@ -150,21 +149,23 @@ void gr_set_screen_scale(int w, int h, int zoom_w, int zoom_h, int max_w, int ma
gr_screen.custom_size = (w != max_w || h != max_h);
gr_screen.max_w_unscaled = w;
gr_screen.max_h_unscaled = h;
if (gr_screen.rendering_to_texture == -1) {
gr_screen.max_w_unscaled = w;
gr_screen.max_h_unscaled = h;
if (do_zoom) {
gr_screen.max_w_unscaled_zoomed = gr_screen.max_w_unscaled + fl2i(Gr_menu_offset_X * 2.0f / Gr_resize_X);
gr_screen.max_h_unscaled_zoomed = gr_screen.max_h_unscaled + fl2i(Gr_menu_offset_Y * 2.0f / Gr_resize_Y);
if (gr_screen.max_w_unscaled_zoomed > gr_screen.max_w_unscaled) {
if (do_zoom) {
gr_screen.max_w_unscaled_zoomed = gr_screen.max_w_unscaled + fl2i(Gr_menu_offset_X * 2.0f / Gr_resize_X);
gr_screen.max_h_unscaled_zoomed = gr_screen.max_h_unscaled + fl2i(Gr_menu_offset_Y * 2.0f / Gr_resize_Y);
if (gr_screen.max_w_unscaled_zoomed > gr_screen.max_w_unscaled) {
gr_screen.max_w_unscaled_zoomed = gr_screen.max_w_unscaled;
}
if (gr_screen.max_h_unscaled_zoomed > gr_screen.max_h_unscaled) {
gr_screen.max_h_unscaled_zoomed = gr_screen.max_h_unscaled;
}
} else {
gr_screen.max_w_unscaled_zoomed = gr_screen.max_w_unscaled;
}
if (gr_screen.max_h_unscaled_zoomed > gr_screen.max_h_unscaled) {
gr_screen.max_h_unscaled_zoomed = gr_screen.max_h_unscaled;
}
} else {
gr_screen.max_w_unscaled_zoomed = gr_screen.max_w_unscaled;
gr_screen.max_h_unscaled_zoomed = gr_screen.max_h_unscaled;
}
}
@@ -184,8 +185,10 @@ void gr_reset_screen_scale()
gr_screen.custom_size = Save_custom_screen_size;
gr_screen.max_w_unscaled = gr_screen.max_w_unscaled_zoomed = (gr_screen.res == GR_1024) ? 1024 : 640;
gr_screen.max_h_unscaled = gr_screen.max_h_unscaled_zoomed = (gr_screen.res == GR_1024) ? 768 : 480;
if (gr_screen.rendering_to_texture == -1) {
gr_screen.max_w_unscaled = gr_screen.max_w_unscaled_zoomed = (gr_screen.res == GR_1024) ? 1024 : 640;
gr_screen.max_h_unscaled = gr_screen.max_h_unscaled_zoomed = (gr_screen.res == GR_1024) ? 768 : 480;
}
}
/**
@@ -224,8 +227,8 @@ bool gr_resize_screen_pos(int *x, int *y, int *w, int *h, int resize_mode)
case GR_RESIZE_MENU_NO_OFFSET:
xy_tmp = (*x) * Gr_resize_X;
break;
}
(*x) = fl2i(xy_tmp);
}
(*x) = fl2ir(xy_tmp);
}
if ( y ) {
@@ -245,18 +248,18 @@ bool gr_resize_screen_pos(int *x, int *y, int *w, int *h, int resize_mode)
case GR_RESIZE_MENU_NO_OFFSET:
xy_tmp = (*y) * Gr_resize_Y;
break;
}
(*y) = fl2i(xy_tmp);
}
(*y) = fl2ir(xy_tmp);
}
if ( w ) {
xy_tmp = (*w) * ((resize_mode == GR_RESIZE_FULL) ? Gr_full_resize_X : Gr_resize_X);
(*w) = fl2i(xy_tmp);
(*w) = fl2ir(xy_tmp);
}
if ( h ) {
xy_tmp = (*h) * ((resize_mode == GR_RESIZE_FULL) ? Gr_full_resize_Y : Gr_resize_Y);
(*h) = fl2i(xy_tmp);
(*h) = fl2ir(xy_tmp);
}
return true;
@@ -296,8 +299,8 @@ bool gr_unsize_screen_pos(int *x, int *y, int *w, int *h, int resize_mode)
case GR_RESIZE_MENU_NO_OFFSET:
xy_tmp = (*x) / Gr_resize_X;
break;
}
(*x) = fl2i(xy_tmp);
}
(*x) = fl2ir(xy_tmp);
}
if ( y ) {
@@ -317,18 +320,18 @@ bool gr_unsize_screen_pos(int *x, int *y, int *w, int *h, int resize_mode)
case GR_RESIZE_MENU_NO_OFFSET:
xy_tmp = (*y) / Gr_resize_Y;
break;
}
(*y) = fl2i(xy_tmp);
}
(*y) = fl2ir(xy_tmp);
}
if ( w ) {
xy_tmp = (*w) / ((resize_mode == GR_RESIZE_FULL) ? Gr_full_resize_X : Gr_resize_X);
(*w) = fl2i(xy_tmp);
(*w) = fl2ir(xy_tmp);
}
if ( h ) {
xy_tmp = (*h) / ((resize_mode == GR_RESIZE_FULL) ? Gr_full_resize_Y : Gr_resize_Y);
(*h) = fl2i(xy_tmp);
(*h) = fl2ir(xy_tmp);
}
return true;
@@ -703,7 +706,7 @@ static bool gr_init_sub(int mode, int width, int height, int depth)
gr_screen.save_max_h_unscaled = gr_screen.max_h_unscaled;
gr_screen.save_max_w_unscaled_zoomed = gr_screen.max_w_unscaled_zoomed;
gr_screen.save_max_h_unscaled_zoomed = gr_screen.max_h_unscaled_zoomed;
switch (mode) {
case GR_OPENGL:
rc = gr_opengl_init();
+84 -15
View File
@@ -16,6 +16,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <limits.h>
#include "graphics/2d.h"
#include "cfile/cfile.h"
@@ -125,14 +126,13 @@ int get_centered_x(const char *s, bool scaled)
/**
* Draws a character centered on x
*/
void gr_char_centered(int x, int y, char chr, int resize_mode)
void gr_char_centered(int x, int y, char chr, ubyte sc1, int resize_mode)
{
char str[2];
int w, sc;
int w;
sc = Lcl_special_chars;
if (chr == '1')
chr = (char)(sc + 1);
chr = (char)sc1;
str[0] = chr;
str[1] = 0;
@@ -143,7 +143,8 @@ void gr_char_centered(int x, int y, char chr, int resize_mode)
void gr_print_timestamp(int x, int y, fix timestamp, int resize_mode)
{
char h[2], m[3], s[3];
int w, c;
int w, c, font_num;
ubyte sc;
int time = (int)f2fl(timestamp); // convert to seconds
@@ -158,16 +159,29 @@ void gr_print_timestamp(int x, int y, fix timestamp, int resize_mode)
gr_string(x + w, y, ":", resize_mode);
gr_string(x + w * 3 + c, y, ":", resize_mode);
font_num = gr_get_current_fontnum();
if (font_num == -1) {
Warning(LOCATION, "Font not set - timestamps may not work correctly");
sc = 0;
} else {
sc = lcl_get_font_index(font_num);
}
if (sc == 0) {
sc = ubyte ('1'); // make do with non-mono-spaced 1
} else {
sc += 1;
}
x += w / 2;
gr_char_centered(x, y, h[0], resize_mode);
gr_char_centered(x, y, h[0], sc, resize_mode);
x += w + c;
gr_char_centered(x, y, m[0], resize_mode);
gr_char_centered(x, y, m[0], sc, resize_mode);
x += w;
gr_char_centered(x, y, m[1], resize_mode);
gr_char_centered(x, y, m[1], sc, resize_mode);
x += w + c;
gr_char_centered(x, y, s[0], resize_mode);
gr_char_centered(x, y, s[0], sc, resize_mode);
x += w;
gr_char_centered(x, y, s[1], resize_mode);
gr_char_centered(x, y, s[1], sc, resize_mode);
}
int gr_get_font_height()
@@ -290,8 +304,9 @@ void _cdecl gr_printf( int x, int y, const char * format, ... )
if ( !Current_font ) return;
va_start(args, format);
vsprintf(grx_printf_text,format,args);
vsnprintf(grx_printf_text, sizeof(grx_printf_text)-1, format, args);
va_end(args);
grx_printf_text[sizeof(grx_printf_text)-1] = '\0';
gr_string(x,y,grx_printf_text);
}
@@ -303,8 +318,9 @@ void _cdecl gr_printf_menu( int x, int y, const char * format, ... )
if ( !Current_font ) return;
va_start(args, format);
vsprintf(grx_printf_text,format,args);
vsnprintf(grx_printf_text, sizeof(grx_printf_text)-1, format, args);
va_end(args);
grx_printf_text[sizeof(grx_printf_text)-1] = '\0';
gr_string(x,y,grx_printf_text,GR_RESIZE_MENU);
}
@@ -316,8 +332,9 @@ void _cdecl gr_printf_menu_zoomed( int x, int y, const char * format, ... )
if ( !Current_font ) return;
va_start(args, format);
vsprintf(grx_printf_text,format,args);
vsnprintf(grx_printf_text, sizeof(grx_printf_text)-1, format, args);
va_end(args);
grx_printf_text[sizeof(grx_printf_text)-1] = '\0';
gr_string(x,y,grx_printf_text,GR_RESIZE_MENU_ZOOMED);
}
@@ -329,8 +346,9 @@ void _cdecl gr_printf_no_resize( int x, int y, const char * format, ... )
if ( !Current_font ) return;
va_start(args, format);
vsprintf(grx_printf_text,format,args);
vsnprintf(grx_printf_text, sizeof(grx_printf_text)-1, format, args);
va_end(args);
grx_printf_text[sizeof(grx_printf_text)-1] = '\0';
gr_string(x,y,grx_printf_text,GR_RESIZE_NONE);
}
@@ -549,17 +567,19 @@ void gr_set_font(int fontnum)
{
if ( fontnum < 0 ) {
Current_font = NULL;
Lcl_special_chars = 0;
return;
}
if ( fontnum >= 0 && fontnum < Num_fonts) {
Current_font = &Fonts[fontnum];
Lcl_special_chars = lcl_get_font_index(fontnum);
}
}
void parse_fonts_tbl(char *only_parse_first_font, size_t only_parse_first_font_size)
{
int rval;
int rval, i;
char *filename;
// choose file name
@@ -605,6 +625,55 @@ void parse_fonts_tbl(char *only_parse_first_font, size_t only_parse_first_font_s
int font_id = gr_create_font(font_filename);
if (font_id < 0) {
Warning(LOCATION, "Could not create font from typeface '%s'!", font_filename);
skip_to_start_of_string_either("#End","$Font:");
} else {
// max allowed special char index; i.e. 7 special chars in retail fonts 1 & 3
static const int MAX_SPECIAL_CHAR_IDX = UCHAR_MAX-6;
// 'default' special char index for all languages using this font
int default_special_char_index = 0;
if (optional_string("+Default Special Character Index:")) {
stuff_int(&default_special_char_index);
if (default_special_char_index < 0 || default_special_char_index >= MAX_SPECIAL_CHAR_IDX) {
Error(LOCATION, "Default special character index (%d) for font (%s), must be 0 - %u", default_special_char_index, font_filename, MAX_SPECIAL_CHAR_IDX);
}
for (i = 0; i < (int)Lcl_languages.size(); ++i) {
Lcl_languages[i].special_char_indexes[font_id] = (ubyte)default_special_char_index;
}
}
while (optional_string("+Language:")) {
char lang_name[LCL_LANG_NAME_LEN + 1];
int special_char_index, lang_idx = -1;
stuff_string(lang_name, F_NAME, LCL_LANG_NAME_LEN + 1);
// find language and set the index, or if not found move to the next one
for (i = 0; i < (int)Lcl_languages.size(); ++i) {
if (!strcmp(Lcl_languages[i].lang_name, lang_name)) {
lang_idx = i;
break;
}
}
if (lang_idx == -1) {
Warning(LOCATION, "Ignoring invalid language (%s) specified by font (%s); not built-in or in strings.tbl", lang_name, font_filename );
skip_to_start_of_string_either("+Language:","$Font:","#End");
continue;
}
if (optional_string("+Special Character Index:")) {
stuff_int(&special_char_index);
if (special_char_index < 0 || special_char_index >= MAX_SPECIAL_CHAR_IDX) {
Error(LOCATION, "Special character index (%d) for font (%s), language (%s) is invalid, must be 0 - %u", special_char_index, font_filename, lang_name, MAX_SPECIAL_CHAR_IDX);
}
Lcl_languages[lang_idx].special_char_indexes[font_id] = (ubyte)special_char_index;
}
}
}
}
+11
View File
@@ -20,6 +20,17 @@
//we check background type to avoid messed up colours for ANI
#define ANI_BPP_CHECK (ga->ani.bg_type == BM_TYPE_PCX) ? 16 : 32
// These two functions find if a bitmap or animation exists by filename, no extension needed.
bool generic_bitmap_exists(const char *filename)
{
return cf_exists_full_ext(filename, CF_TYPE_ANY, BM_NUM_TYPES, bm_ext_list);
}
bool generic_anim_exists(const char *filename)
{
return cf_exists_full_ext(filename, CF_TYPE_ANY, BM_ANI_NUM_TYPES, bm_ani_ext_list);
}
// Goober5000
int generic_anim_init_and_stream(generic_anim *anim, const char *anim_filename, ubyte bg_type, bool attempt_hi_res)
{
+2
View File
@@ -52,6 +52,8 @@ typedef struct generic_bitmap {
int bitmap_id;
} generic_bitmap;
bool generic_bitmap_exists(const char *filename);
bool generic_anim_exists(const char *filename);
int generic_anim_init_and_stream(generic_anim *anim, const char *anim_filename, ubyte bg_type, bool attempt_hi_res);
void generic_anim_init(generic_anim *ga);
void generic_anim_init(generic_anim *ga, const char *filename);
+91
View File
@@ -0,0 +1,91 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
#ifndef _GRINTERNAL_H
#define _GRINTERNAL_H
#include "graphics/font.h"
#include "graphics/2d.h"
#include "globalincs/pstypes.h" // IAM_64BIT
#include "globalincs/globals.h" // just in case pstypes.h messed up
<<<<<<< HEAD
=======
extern int Gr_cursor;
extern int Gr_cursor_size;
>>>>>>> master
extern ubyte Gr_original_palette[768]; // The palette
extern ubyte Gr_current_palette[768];
extern char Gr_current_palette_name[128];
typedef struct color_gun {
int bits;
int shift;
int scale;
int mask;
} color_gun;
// screen format
extern color_gun Gr_red, Gr_green, Gr_blue, Gr_alpha;
// texture format
extern color_gun Gr_t_red, Gr_t_green, Gr_t_blue, Gr_t_alpha;
// alpha texture format
extern color_gun Gr_ta_red, Gr_ta_green, Gr_ta_blue, Gr_ta_alpha;
// CURRENT FORMAT - note - this is what bmpman uses when fiddling with pixels/colors. so be sure its properly set to one
// of the above values
extern color_gun *Gr_current_red, *Gr_current_green, *Gr_current_blue, *Gr_current_alpha;
extern float Gr_gamma;
extern int Gr_gamma_int;
#define TCACHE_TYPE_AABITMAP 0 // HUD bitmap. All Alpha.
#define TCACHE_TYPE_NORMAL 1 // Normal bitmap. Alpha = 0.
#define TCACHE_TYPE_XPARENT 2 // Bitmap with 0,255,0 = transparent. Alpha=0 if transparent, 1 if not.
#define TCACHE_TYPE_INTERFACE 3 // for graphics that are using in the interface (for special filtering or sizing)
#define TCACHE_TYPE_COMPRESSED 4 // Compressed bitmap type (DXT1, DXT3, DXT5)
#define TCACHE_TYPE_CUBEMAP 5
#define NEBULA_COLORS 20
typedef enum gr_texture_source {
TEXTURE_SOURCE_NONE,
TEXTURE_SOURCE_DECAL,
TEXTURE_SOURCE_NO_FILTERING,
TEXTURE_SOURCE_MODULATE4X
} gr_texture_source;
typedef enum gr_alpha_blend {
ALPHA_BLEND_NONE, // 1*SrcPixel + 0*DestPixel
ALPHA_BLEND_ADDITIVE, // 1*SrcPixel + 1*DestPixel
ALPHA_BLEND_ALPHA_ADDITIVE, // Alpha*SrcPixel + 1*DestPixel
ALPHA_BLEND_ALPHA_BLEND_ALPHA, // Alpha*SrcPixel + (1-Alpha)*DestPixel
ALPHA_BLEND_ALPHA_BLEND_SRC_COLOR // Alpha*SrcPixel + (1-SrcPixel)*DestPixel
} gr_alpha_blend;
typedef enum gr_zbuffer_type {
ZBUFFER_TYPE_NONE,
ZBUFFER_TYPE_READ,
ZBUFFER_TYPE_WRITE,
ZBUFFER_TYPE_FULL,
ZBUFFER_TYPE_DEFAULT
} gr_zbuffer_type;
typedef enum gr_stencil_type {
STENCIL_TYPE_NONE,
STENCIL_TYPE_READ,
STENCIL_TYPE_WRITE
} gr_stencil_type;
#endif
+4
View File
@@ -245,6 +245,10 @@ void gr_opengl_set_clip(int x, int y, int w, int h, int resize_mode)
int max_w = ((to_resize) ? gr_screen.max_w_unscaled : gr_screen.max_w);
int max_h = ((to_resize) ? gr_screen.max_h_unscaled : gr_screen.max_h);
if ((gr_screen.rendering_to_texture != -1) && to_resize) {
gr_unsize_screen_pos(&max_w, &max_h);
}
if (x >= max_w) {
x = max_w - 1;
}
File diff suppressed because it is too large. Load diff
+81 -63
View File
@@ -306,16 +306,18 @@ void gr_opengl_aabitmap(int x, int y, int resize_mode, bool mirror)
opengl_aabitmap_ex_internal(dx1, dy1, (dx2 - dx1 + 1), (dy2 - dy1 + 1), sx, sy, resize_mode, mirror);
}
#define MAX_VERTS_PER_DRAW 120
struct v4 { GLfloat x,y,u,v; };
static v4 GL_string_render_buff[MAX_VERTS_PER_DRAW];
void gr_opengl_string(int sx, int sy, const char *s, int resize_mode)
void gr_opengl_string(float sx, float sy, const char *s, int resize_mode)
{
int width, spacing, letter;
int x, y;
float x, y;
bool do_resize;
float bw, bh;
float u0, u1, v0, v1;
int x1, x2, y1, y2;
float x1, x2, y1, y2;
float u_scale, v_scale;
if ( !Current_font || (*s == 0) ) {
@@ -334,9 +336,7 @@ void gr_opengl_string(int sx, int sy, const char *s, int resize_mode)
return;
}
// conversion from quads to triangles requires six vertices per quad
struct v4 *glVert = (struct v4*) vm_malloc(sizeof(struct v4) * strlen(s) * 6);
int curChar = 0;
int buffer_offset = 0;
int ibw, ibh;
@@ -367,9 +367,9 @@ void gr_opengl_string(int sx, int sy, const char *s, int resize_mode)
x = sx;
y = sy;
if (sx == 0x8000) {
if (sx == (float)0x8000) {
// centered
x = get_centered_x(s, !do_resize);
x = (float)get_centered_x(s, !do_resize);
} else {
x = sx;
}
@@ -378,6 +378,15 @@ void gr_opengl_string(int sx, int sy, const char *s, int resize_mode)
GLboolean cull_face = GL_state.CullFace(GL_FALSE);
GL_state.Array.BindArrayBuffer(0);
GL_state.Array.EnableClientVertex();
GL_state.Array.VertexPointer(2, GL_FLOAT, sizeof(v4), &GL_string_render_buff[0].x);
GL_state.Array.SetActiveClientUnit(0);
GL_state.Array.EnableClientTexture();
GL_state.Array.TexPointer(2, GL_FLOAT, sizeof(v4), &GL_string_render_buff[0].u);
// pick out letter coords, draw it, goto next letter and do the same
while (*s) {
x += spacing;
@@ -386,9 +395,9 @@ void gr_opengl_string(int sx, int sy, const char *s, int resize_mode)
s++;
y += Current_font->h;
if (sx == 0x8000) {
if (sx == (float)0x8000) {
// centered
x = get_centered_x(s, !do_resize);
x = (float)get_centered_x(s, !do_resize);
} else {
x = sx;
}
@@ -401,13 +410,13 @@ void gr_opengl_string(int sx, int sy, const char *s, int resize_mode)
letter = get_char_width(s[0], s[1], &width, &spacing);
s++;
//not in font, draw as space
// not in font, draw as space
if (letter < 0) {
continue;
}
int xd, yd, xc, yc;
int wc, hc;
float xd, yd, xc, yc;
float wc, hc;
// Check if this character is totally clipped
if ( (x + width) < clip_left ) {
@@ -463,8 +472,8 @@ void gr_opengl_string(int sx, int sy, const char *s, int resize_mode)
y2 = y1 + hc;
if (do_resize) {
gr_resize_screen_pos( &x1, &y1, NULL, NULL, resize_mode );
gr_resize_screen_pos( &x2, &y2, NULL, NULL, resize_mode );
gr_resize_screen_posf( &x1, &y1, NULL, NULL, resize_mode );
gr_resize_screen_posf( &x2, &y2, NULL, NULL, resize_mode );
}
u0 = u_scale * (i2fl(u+xd) / bw);
@@ -472,57 +481,69 @@ void gr_opengl_string(int sx, int sy, const char *s, int resize_mode)
u1 = u_scale * (i2fl((u+xd)+wc) / bw);
v1 = v_scale * (i2fl((v+yd)+hc) / bh);
if ( buffer_offset == MAX_VERTS_PER_DRAW ) {
glDrawArrays(GL_TRIANGLES, 0, buffer_offset);
buffer_offset = 0;
}
glVert[curChar*6 + 0].x = (GLfloat)x1;
glVert[curChar*6 + 0].y = (GLfloat)y2;
glVert[curChar*6 + 0].u = u0;
glVert[curChar*6 + 0].v = v1;
GL_string_render_buff[buffer_offset].x = (GLfloat)x1;
GL_string_render_buff[buffer_offset].y = (GLfloat)y1;
GL_string_render_buff[buffer_offset].u = u0;
GL_string_render_buff[buffer_offset].v = v0;
buffer_offset++;
glVert[curChar*6 + 1].x = (GLfloat)x2;
glVert[curChar*6 + 1].y = (GLfloat)y2;
glVert[curChar*6 + 1].u = u1;
glVert[curChar*6 + 1].v = v1;
GL_string_render_buff[buffer_offset].x = (GLfloat)x1;
GL_string_render_buff[buffer_offset].y = (GLfloat)y2;
GL_string_render_buff[buffer_offset].u = u0;
GL_string_render_buff[buffer_offset].v = v1;
buffer_offset++;
glVert[curChar*6 + 2].x = (GLfloat)x1;
glVert[curChar*6 + 2].y = (GLfloat)y1;
glVert[curChar*6 + 2].u = u0;
glVert[curChar*6 + 2].v = v0;
GL_string_render_buff[buffer_offset].x = (GLfloat)x2;
GL_string_render_buff[buffer_offset].y = (GLfloat)y1;
GL_string_render_buff[buffer_offset].u = u1;
GL_string_render_buff[buffer_offset].v = v0;
buffer_offset++;
glVert[curChar*6 + 3] = glVert[curChar*6 + 1];
glVert[curChar*6 + 4] = glVert[curChar*6 + 2];
GL_string_render_buff[buffer_offset].x = (GLfloat)x1;
GL_string_render_buff[buffer_offset].y = (GLfloat)y2;
GL_string_render_buff[buffer_offset].u = u0;
GL_string_render_buff[buffer_offset].v = v1;
buffer_offset++;
glVert[curChar*6 + 5].x = (GLfloat)x2;
glVert[curChar*6 + 5].y = (GLfloat)y1;
glVert[curChar*6 + 5].u = u1;
glVert[curChar*6 + 5].v = v0;
GL_string_render_buff[buffer_offset].x = (GLfloat)x2;
GL_string_render_buff[buffer_offset].y = (GLfloat)y1;
GL_string_render_buff[buffer_offset].u = u1;
GL_string_render_buff[buffer_offset].v = v0;
buffer_offset++;
curChar++;
GL_string_render_buff[buffer_offset].x = (GLfloat)x2;
GL_string_render_buff[buffer_offset].y = (GLfloat)y2;
GL_string_render_buff[buffer_offset].u = u1;
GL_string_render_buff[buffer_offset].v = v1;
buffer_offset++;
}
GL_state.Array.BindArrayBuffer(0);
GL_state.Array.EnableClientVertex();
GL_state.Array.VertexPointer(2, GL_FLOAT, sizeof(struct v4), &glVert[0].x);
GL_state.Array.SetActiveClientUnit(0);
GL_state.Array.EnableClientTexture();
GL_state.Array.TexPointer(2, GL_FLOAT, sizeof(struct v4), &glVert[0].u);
glDrawArrays(GL_TRIANGLES, 0, curChar * 6);
if ( buffer_offset ) {
glDrawArrays(GL_TRIANGLES, 0, buffer_offset);
}
GL_state.Array.DisableClientVertex();
GL_state.Array.DisableClientTexture();
GL_state.CullFace(cull_face);
vm_free(glVert);
GL_CHECK_FOR_ERRORS("end of string()");
}
void gr_opengl_string(int sx, int sy, const char *s, int resize_mode)
{
gr_opengl_string(i2fl(sx), i2fl(sy), s, resize_mode);
}
void gr_opengl_line(int x1,int y1,int x2,int y2, int resize_mode)
{
int do_resize, clipped = 0, swapped = 0;
int do_resize;
float sx1, sy1;
float sx2, sy2;
@@ -540,7 +561,7 @@ void gr_opengl_line(int x1,int y1,int x2,int y2, int resize_mode)
int offset_y = ((do_resize) ? gr_screen.offset_y_unscaled : gr_screen.offset_y);
INT_CLIPLINE(x1, y1, x2, y2, clip_left, clip_top, clip_right, clip_bottom, return, clipped = 1, swapped = 1);
INT_CLIPLINE(x1, y1, x2, y2, clip_left, clip_top, clip_right, clip_bottom, return, ;, ;);
sx1 = i2fl(x1 + offset_x);
sy1 = i2fl(y1 + offset_y);
@@ -657,7 +678,6 @@ void gr_opengl_aaline(vertex *v1, vertex *v2)
// glHint( GL_LINE_SMOOTH_HINT, GL_FASTEST );
// glLineWidth( 1.0 );
int clipped = 0, swapped = 0;
float x1 = v1->screen.xyw.x;
float y1 = v1->screen.xyw.y;
float x2 = v2->screen.xyw.x;
@@ -666,7 +686,7 @@ void gr_opengl_aaline(vertex *v1, vertex *v2)
float sx2, sy2;
FL_CLIPLINE(x1, y1, x2, y2, (float)gr_screen.clip_left, (float)gr_screen.clip_top, (float)gr_screen.clip_right, (float)gr_screen.clip_bottom, return, clipped = 1, swapped = 1);
FL_CLIPLINE(x1, y1, x2, y2, (float)gr_screen.clip_left, (float)gr_screen.clip_top, (float)gr_screen.clip_right, (float)gr_screen.clip_bottom, return, ;, ;);
sx1 = x1 + (float)gr_screen.offset_x;
sy1 = y1 + (float)gr_screen.offset_y;
@@ -736,7 +756,7 @@ void gr_opengl_aaline(vertex *v1, vertex *v2)
void gr_opengl_gradient(int x1, int y1, int x2, int y2, int resize_mode)
{
int clipped = 0, swapped = 0;
int swapped = 0;
if ( !gr_screen.current_color.is_alphacolor ) {
gr_opengl_line(x1, y1, x2, y2, resize_mode);
@@ -748,7 +768,7 @@ void gr_opengl_gradient(int x1, int y1, int x2, int y2, int resize_mode)
gr_resize_screen_pos(&x2, &y2, NULL, NULL, resize_mode);
}
INT_CLIPLINE(x1, y1, x2, y2, gr_screen.clip_left, gr_screen.clip_top, gr_screen.clip_right, gr_screen.clip_bottom, return, clipped = 1, swapped = 1);
INT_CLIPLINE(x1, y1, x2, y2, gr_screen.clip_left, gr_screen.clip_top, gr_screen.clip_right, gr_screen.clip_bottom, return, ;, swapped = 1);
GL_state.SetTextureSource(TEXTURE_SOURCE_NONE);
GL_state.SetAlphaBlendMode(ALPHA_BLEND_ALPHA_BLEND_ALPHA);
@@ -2536,11 +2556,9 @@ void opengl_scene_texture_shutdown()
Scene_framebuffer = 0;
}
if ( Distortion_texture ) {
glDeleteTextures(2, Distortion_texture);
Distortion_texture[0] = 0;
Distortion_texture[1] = 0;
}
glDeleteTextures(2, Distortion_texture);
Distortion_texture[0] = 0;
Distortion_texture[1] = 0;
if ( Distortion_framebuffer ) {
vglDeleteFramebuffersEXT(1, &Distortion_framebuffer);
@@ -2644,7 +2662,7 @@ void gr_opengl_scene_texture_end()
GL_state.Array.EnableClientTexture();
GL_state.Array.TexPointer(2, GL_FLOAT, 0, uvcoords);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDrawArrays(GL_QUADS, 0, 4);
GL_state.Array.DisableClientVertex();
GL_state.Array.DisableClientTexture();
@@ -2749,9 +2767,9 @@ void gr_opengl_update_distortion()
GL_state.Texture.Disable();
SCP_vector<ubyte> colours;
SCP_vector<GLfloat> vertex;
SCP_vector<GLfloat> distortion_vertex;
colours.reserve(33 * 4);
vertex.reserve(33 * 2);
distortion_vertex.reserve(33 * 2);
for(int i = 0; i < 33; i++)
{
colours.push_back((ubyte) rand()%256);
@@ -2759,12 +2777,12 @@ void gr_opengl_update_distortion()
colours.push_back(255);
colours.push_back(255);
vertex.push_back(0.04f);
vertex.push_back((float)gr_screen.max_h*0.03125f*i);
distortion_vertex.push_back(0.04f);
distortion_vertex.push_back((float)gr_screen.max_h*0.03125f*i);
}
GL_state.Array.EnableClientVertex();
GL_state.Array.VertexPointer(2, GL_FLOAT, 0, &vertex.front());
GL_state.Array.VertexPointer(2, GL_FLOAT, 0, &distortion_vertex.front());
GL_state.Array.EnableClientColor();
GL_state.Array.ColorPointer(4, GL_UNSIGNED_BYTE, 0, &colours.front());
+2 -2
View File
@@ -704,7 +704,7 @@ static bool opengl_post_init_table()
if (optional_string("#Effects")) {
while ( !required_string_3("$Name:", "#Ship Effects", "#End") ) {
while ( !required_string_one_of(3, "$Name:", "#Ship Effects", "#End") ) {
char tbuf[NAME_LENGTH+1] = { 0 };
post_effect_t eff;
@@ -752,7 +752,7 @@ static bool opengl_post_init_table()
Ship_effects.push_back(se1);
if (optional_string("#Ship Effects")) {
while ( !required_string_3("$Name:", "#Light Shafts", "#End") ) {
while ( !required_string_one_of(3, "$Name:", "#Light Shafts", "#End") ) {
ship_effect se;
char tbuf[NAME_LENGTH] = { 0 };
+5 -5
View File
@@ -225,13 +225,13 @@ void opengl_texture_state::Enable(GLuint tex_id)
units[active_texture_unit].active = GL_TRUE;
}
void opengl_texture_state::Disable(bool force)
void opengl_texture_state::Disable()
{
if ( !force && !units[active_texture_unit].active ) {
if ( !units[active_texture_unit].active ) {
return;
}
if (force || units[active_texture_unit].enabled) {
if ( units[active_texture_unit].enabled) {
glDisable( units[active_texture_unit].texture_target );
units[active_texture_unit].enabled = GL_FALSE;
}
@@ -252,7 +252,7 @@ void opengl_texture_state::DisableUnused()
for (unsigned int i = 0; i < num_texture_units; i++) {
if (!units[i].used) {
SetActiveUnit(i);
Disable(true);
Disable();
}
}
}
@@ -262,7 +262,7 @@ void opengl_texture_state::DisableAll()
for (unsigned int i = 0; i < num_texture_units; i++) {
if (units[i].active) {
SetActiveUnit(i);
Disable(true);
Disable();
}
}
+1 -1
View File
@@ -70,7 +70,7 @@ class opengl_texture_state
void SetTarget(GLenum tex_target);
void SetActiveUnit(GLuint id = 0);
void Enable(GLuint tex_id = 0);
void Disable(bool force = false);
void Disable();
void DisableUnused();
void DisableAll();
void ResetUsed();
+2 -2
View File
@@ -933,7 +933,7 @@ int opengl_create_texture(int bitmap_handle, int bitmap_type, tcache_slot_opengl
bmp = bm_lock(bitmap_handle, bpp, flags);
if ( bmp == NULL ) {
mprintf(("Couldn't lock bitmap %d.\n", bitmap_handle ));
mprintf(("Couldn't lock bitmap %d (%s).\n", bitmap_handle, bm_get_filename(bitmap_handle) ));
return 0;
}
@@ -1077,7 +1077,7 @@ int gr_opengl_tcache_set_internal(int bitmap_handle, int bitmap_type, float *u_s
}
// gah
else {
mprintf(("Texturing disabled for texture %s due to internal error.\n", bm_get_filename(bitmap_handle)));
mprintf(("Texturing disabled for bitmap %d (%s) due to internal error.\n", bitmap_handle, bm_get_filename(bitmap_handle)));
GL_state.Texture.Disable();
return 0;
+4
View File
@@ -192,6 +192,10 @@ int gr_opengl_create_stream_buffer()
{
opengl_vertex_buffer buffer;
if ( !Use_VBOs ) {
return -1;
}
vglGenBuffersARB(1, &buffer.vbo);
GL_vertex_buffers.push_back(buffer);
+22 -66
View File
@@ -151,49 +151,6 @@ int Supernova_coords[GR_NUM_RESOLUTIONS][2] = {
}
};
// used to draw the kills gauge
hud_frames Kills_gauge;
int Kills_gauge_loaded = 0;
int Kills_gauge_coords[GR_NUM_RESOLUTIONS][2] = {
{ // GR_640
497, 361
},
{ // GR_1024
880, 624
}
};
int Kills_text_coords[GR_NUM_RESOLUTIONS][2] = {
{ // GR_640
503, 365
},
{ // GR_1024
886, 628
}
};
int Kills_text_val_coords_gr[GR_NUM_RESOLUTIONS][2] = {
{ // GR_640
615, 365
},
{ // GR_1024
984, 628
}
};
int Kills_text_val_coords[GR_NUM_RESOLUTIONS][2] = {
{ // GR_640
571, 365
},
{ // GR_1024
954, 628
}
};
char Kills_fname[GR_NUM_RESOLUTIONS][MAX_FILENAME_LEN] = {
"kills1",
"kills1"
};
// used to draw the hud support view
static int Hud_support_view_active;
static int Hud_support_view_abort; // active when we need to display abort message
@@ -237,7 +194,6 @@ int hud_subspace_notify_active();
int hud_objective_notify_active();
void hud_subspace_notify_abort();
void hud_maybe_display_subspace_notify();
void hud_init_kills_gauge();
int hud_maybe_render_emp_icon();
void hud_init_emp_icon();
@@ -425,10 +381,10 @@ void HudGauge::initSlew(bool slew)
reticle_follow = slew;
}
void HudGauge::initFont(int font)
void HudGauge::initFont(int input_font_num)
{
if ( font >= 0 && font < Num_fonts) {
font_num = font;
if ( input_font_num >= 0 && input_font_num < Num_fonts) {
font_num = input_font_num;
}
}
@@ -586,9 +542,9 @@ void HudGauge::updateActive(bool show)
active = show;
}
void HudGauge::initRenderStatus(bool render)
void HudGauge::initRenderStatus(bool do_render)
{
off_by_default = !render;
off_by_default = !do_render;
}
bool HudGauge::isOffbyDefault()
@@ -770,12 +726,13 @@ void HudGauge::renderStringAlignCenter(int x, int y, int area_width, const char
void HudGauge::renderPrintf(int x, int y, const char* format, ...)
{
char tmp[256] = "";
va_list args;
va_list args;
// format the text
va_start(args, format);
vsprintf(tmp, format, args);
vsnprintf(tmp, sizeof(tmp)-1, format, args);
va_end(args);
tmp[sizeof(tmp)-1] = '\0';
renderString(x, y, tmp);
}
@@ -783,12 +740,13 @@ void HudGauge::renderPrintf(int x, int y, const char* format, ...)
void HudGauge::renderPrintf(int x, int y, int gauge_id, const char* format, ...)
{
char tmp[256] = "";
va_list args;
va_list args;
// format the text
va_start(args, format);
vsprintf(tmp, format, args);
vsnprintf(tmp, sizeof(tmp)-1, format, args);
va_end(args);
tmp[sizeof(tmp)-1] = '\0';
renderString(x, y, gauge_id, tmp);
}
@@ -1221,7 +1179,6 @@ void HUD_init()
hud_init_wingman_status_gauge();
hud_init_target_static();
hud_init_text_flash_gauge();
hud_init_kills_gauge();
hud_stop_subspace_notify();
hud_stop_objective_notify();
hud_target_last_transmit_level_init();
@@ -1751,7 +1708,11 @@ void hud_maybe_display_supernova()
}
gr_set_color_fast(&Color_bright_red);
gr_printf(Supernova_coords[gr_screen.res][0], Supernova_coords[gr_screen.res][1], "Supernova Warning: %.2f s", time_left);
if (Lcl_pl) {
gr_printf(Supernova_coords[gr_screen.res][0], Supernova_coords[gr_screen.res][1], "Wybuch supernowej: %.2f s", time_left);
} else {
gr_printf(Supernova_coords[gr_screen.res][0], Supernova_coords[gr_screen.res][1], "Supernova Warning: %.2f s", time_left);
}
}
/**
@@ -2565,14 +2526,6 @@ void HudGaugeLag::render(float frametime)
}
}
/**
* @brief Obsolete initializer for the kills gauge. Now superseded by the new HUD code.
*/
void hud_init_kills_gauge()
{
Kills_gauge_loaded = 1;
}
/**
* @brief Called at mission start to init data, and load support view bitmap if required
*/
@@ -3590,14 +3543,13 @@ void HUD_set_offsets(object *viewer_obj, int wiggedy_wack, matrix *eye_orient)
if ( (viewer_obj == Player_obj) && wiggedy_wack ){
vec3d tmp;
vertex pt;
ubyte flags;
HUD_offset_x = 0.0f;
HUD_offset_y = 0.0f;
vm_vec_scale_add( &tmp, &Eye_position, &eye_orient->vec.fvec, 100.0f );
flags = g3_rotate_vertex(&pt,&tmp);
(void) g3_rotate_vertex(&pt,&tmp);
g3_project_vertex(&pt);
@@ -3915,7 +3867,11 @@ void HudGaugeSupernova::render(float frametime)
}
gr_set_color_fast(&Color_bright_red);
renderPrintf(position[0], position[1], "Supernova Warning: %.2f s", time_left);
if (Lcl_pl) {
renderPrintf(position[0], position[1], "Wybuch supernowej: %.2f s", time_left);
} else {
renderPrintf(position[0], position[1], "Supernova Warning: %.2f s", time_left);
}
}
HudGaugeFlightPath::HudGaugeFlightPath():
+1 -1
View File
@@ -252,7 +252,7 @@ public:
void initPosition(int x, int y);
void initBaseResolution(int w, int h);
void initSlew(bool slew);
void initFont(int font_num);
void initFont(int input_font_num);
void initCockpitTarget(const char* display_name, int _target_x, int _target_y, int _target_w, int _target_h, int _canvas_w, int _canvas_h);
void initRenderStatus(bool render);
+21 -12
View File
@@ -999,26 +999,26 @@ void hud_config_set_gauge_flags(int gauge_index, int on_flag, int popup_flag)
}
}
void hud_config_record_color(int color)
void hud_config_record_color(int in_color)
{
HUD_config.main_color = color;
HUD_color_red = HC_colors[color].r;
HUD_color_green = HC_colors[color].g;
HUD_color_blue = HC_colors[color].b;
HUD_config.main_color = in_color;
HUD_color_red = HC_colors[in_color].r;
HUD_color_green = HC_colors[in_color].g;
HUD_color_blue = HC_colors[in_color].b;
}
// Set the HUD color
void hud_config_set_color(int color)
void hud_config_set_color(int in_color)
{
int idx;
hud_config_record_color(color);
hud_config_record_color(in_color);
HUD_init_hud_color_array();
// apply the color to all gauges
for(idx=0; idx<NUM_HUD_GAUGES; idx++){
gr_init_alphacolor(&HUD_config.clr[idx], HC_colors[color].r, HC_colors[color].g, HC_colors[color].b, (HUD_color_alpha+1)*16);
gr_init_alphacolor(&HUD_config.clr[idx], HC_colors[in_color].r, HC_colors[in_color].g, HC_colors[in_color].b, (HUD_color_alpha+1)*16);
}
}
@@ -1655,17 +1655,26 @@ void hud_config_color_load(char *name)
read_file_text(fname);
reset_parse();
// write out all gauges
for(idx=0; idx<NUM_HUD_GAUGES; idx++){
required_string("+Gauge:");
// First, set all gauges to the current main color
for (idx=0; idx<NUM_HUD_GAUGES; idx++){
gr_init_alphacolor(&HUD_config.clr[idx], HUD_color_red, HUD_color_green, HUD_color_blue, (HUD_color_alpha+1)*16);
}
// Now read in the color values for the gauges
while (optional_string("+Gauge:")) {
stuff_string(str, F_NAME, sizeof(str));
for (idx=0; idx<NUM_HUD_GAUGES; idx++) {
if (!stricmp(str, Hud_Gauge_Names[idx])) {
required_string("+RGBA:");
stuff_ubyte(&HUD_config.clr[idx].red);
stuff_ubyte(&HUD_config.clr[idx].green);
stuff_ubyte(&HUD_config.clr[idx].blue);
stuff_ubyte(&HUD_config.clr[idx].alpha);
}
break;
}
}
}
}
void hud_config_alpha_slider_up()
+25 -16
View File
@@ -38,6 +38,7 @@
#include "network/multi.h"
#include "anim/packunpack.h" // for talking heads
#include "anim/animplay.h"
#include "parse/scripting.h"
/* replaced with those static ints that follow
@@ -482,27 +483,28 @@ void HUD_fixed_printf(float duration, color col, const char *format, ...)
}
va_start(args, format);
vsprintf(tmp, format, args);
vsnprintf(tmp, sizeof(tmp)-1, format, args);
va_end(args);
tmp[sizeof(tmp)-1] = '\0';
msg_length = strlen(tmp);
Assert(msg_length < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway.
if ( !msg_length ) {
nprintf(("Warning", "HUD_fixed_printf ==> attempt to print a 0 length string in msg window\n"));
return;
} else if (msg_length > MAX_HUD_LINE_LEN - 1){
nprintf(("Warning", "HUD_fixed_printf ==> Following string truncated to %d chars: %s\n",MAX_HUD_LINE_LEN,tmp));
nprintf(("Warning", "HUD_fixed_printf ==> Following string truncated to %d chars: %s\n", MAX_HUD_LINE_LEN - 1, tmp));
tmp[MAX_HUD_LINE_LEN-1] = '\0';
}
strcpy_s(HUD_fixed_text[0].text, tmp);
if (duration == 0.0f){
HUD_fixed_text[0].end_time = timestamp(-1);
} else {
HUD_fixed_text[0].end_time = timestamp((int) (1000.0f * duration));
}
strncpy(HUD_fixed_text[0].text, tmp, MAX_HUD_LINE_LEN - 1);
HUD_fixed_text[0].color = col.red << 16 | col.green << 8 | col.blue;
}
@@ -529,7 +531,6 @@ void HUD_printf(const char *format, ...)
{
va_list args;
char tmp[HUD_MSG_LENGTH_MAX];
int len;
// make sure we only print these messages if we're in the correct state
if((Game_mode & GM_MULTIPLAYER) && (Net_player->state != NETPLAYER_STATE_IN_MISSION)){
@@ -538,11 +539,10 @@ void HUD_printf(const char *format, ...)
}
va_start(args, format);
vsprintf(tmp, format, args);
vsnprintf(tmp, sizeof(tmp)-1, format, args);
va_end(args);
tmp[sizeof(tmp)-1] = '\0';
len = strlen(tmp);
Assert(len < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway.
hud_sourced_print(HUD_SOURCE_COMPUTER, tmp);
}
@@ -550,18 +550,17 @@ void HUD_ship_sent_printf(int sh, const char *format, ...)
{
va_list args;
char tmp[HUD_MSG_LENGTH_MAX];
tmp[sizeof(tmp)-1] = '\0';
int len;
sprintf(tmp, NOX("%s: "), Ships[sh].ship_name);
snprintf(tmp, sizeof(tmp)-1, NOX("%s: "), Ships[sh].ship_name);
len = strlen(tmp);
Assert(len < HUD_MSG_LENGTH_MAX);
va_start(args, format);
vsprintf(tmp + len, format, args);
vsnprintf(tmp + len, sizeof(tmp)-1-len, format, args);
va_end(args);
len = strlen(tmp);
Assert(len < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway.
Assert(strlen(tmp) < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway.
hud_sourced_print(HUD_team_get_source(Ships[sh].team), tmp);
}
@@ -584,9 +583,10 @@ void HUD_sourced_printf(int source, const char *format, ...)
}
va_start(args, format);
vsprintf(tmp, format, args);
vsnprintf(tmp, sizeof(tmp)-1, format, args);
va_end(args);
Assert(strlen(tmp) < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway.
tmp[sizeof(tmp)-1] = '\0';
hud_sourced_print(source, tmp);
}
@@ -607,6 +607,15 @@ void hud_sourced_print(int source, const char *msg)
new_msg.x = 0;
HUD_msg_buffer.push_back(new_msg);
// Invoke the scripting hook
Script_system.SetHookVar("Text", 's', const_cast<char*>(msg));
Script_system.SetHookVar("SourceType", 'i', &source);
Script_system.RunCondition(CHA_HUDMSGRECEIVED);
Script_system.RemHookVars(2, "Text", "SourceType");
}
int hud_query_scrollback_size()
+50 -16
View File
@@ -861,6 +861,8 @@ int parse_gauge_type()
if ( optional_string("+Secondary Weapons:") )
return HUD_OBJECT_SECONDARY_WEAPONS;
error_display(1, "Invalid gauge type [%.32s]", next_tokens());
return -1;
}
@@ -1041,7 +1043,8 @@ void load_gauge(int gauge, int base_w, int base_h, int hud_font, bool scale_gaug
load_gauge_secondary_weapons(base_w, base_h, hud_font, scale_gauge, ship_idx, use_clr);
break;
default:
Warning(LOCATION, "Invalid gauge found in hud_gauges.tbl");
// It's either -1, indicating we're ignoring a parse error, or it's a coding error.
Assertion(gauge == -1, "Invalid value '%d' passed to load_gauge(); get a coder!\n", gauge);
break;
}
}
@@ -1193,7 +1196,7 @@ T* gauge_load_common(int base_w, int base_h, int hud_font, bool scale_gauge, SCP
}
if(optional_string("Font:")) {
stuff_int(&Hud_font);
stuff_int(&font_num);
} else {
if ( hud_font >=0 ) {
font_num = hud_font;
@@ -1268,16 +1271,25 @@ void load_gauge_custom(int base_w, int base_h, int hud_font, bool scale_gauge, S
adjust_base_res(base_res, scale_gauge);
// If no positioning information is specified, use the default position
bool use_default_pos = true;
if(optional_string("Origin:")) {
stuff_float_list(origin, 2);
}
use_default_pos = false;
if(optional_string("Offset:")) {
required_string("Offset:");
stuff_int_list(offset, 2);
}
coords[0] = (int)(base_res[0] * origin[0]) + offset[0];
coords[1] = (int)(base_res[1] * origin[1]) + offset[1];
if(optional_string("Offset:")) {
Error(LOCATION, "HUD gauges table: Offset must also have Origin defined");
}
if (!use_default_pos) {
coords[0] = (int)(base_res[0] * origin[0]) + offset[0];
coords[1] = (int)(base_res[1] * origin[1]) + offset[1];
}
}
if ( optional_string("Cockpit Target:") && ship_idx->at(0) >= 0 ) {
@@ -1657,7 +1669,7 @@ void load_gauge_escort_view(int base_w, int base_h, int hud_font, bool scale_gau
int ship_name_max_w = 100;
int ship_integrity_offsets[2];
int ship_status_offsets[2];
char header_text[MAX_FILENAME_LEN] = "monitoring";
char header_text[MAX_FILENAME_LEN] = "";
char fname_top[MAX_FILENAME_LEN] = "escort1";
char fname_middle[MAX_FILENAME_LEN] = "escort2";
char fname_bottom[MAX_FILENAME_LEN] = "escort3";
@@ -1739,6 +1751,10 @@ void load_gauge_escort_view(int base_w, int base_h, int hud_font, bool scale_gau
stuff_int(&ship_name_max_w);
}
if (header_text[0] == '\0') {
strcpy_s(header_text, XSTR("monitoring", 285));
}
hud_gauge->initBitmaps(fname_top, fname_middle, fname_bottom);
hud_gauge->initEntryHeight(entry_h);
hud_gauge->initEntryStaggerWidth(entry_stagger_w);
@@ -2712,6 +2728,7 @@ void load_gauge_radar_std(int base_w, int base_h, int hud_font, bool scale_gauge
hud_gauge->initDistanceLongOffsets(Radar_dist_offsets[1][0], Radar_dist_offsets[1][1]);
hud_gauge->initDistanceShortOffsets(Radar_dist_offsets[0][0], Radar_dist_offsets[0][1]);
hud_gauge->initRadius(Radar_radius[0], Radar_radius[1]);
hud_gauge->initInfinityIcon();
if(ship_idx->at(0) >= 0) {
for (SCP_vector<int>::iterator ship_index = ship_idx->begin(); ship_index != ship_idx->end(); ++ship_index) {
@@ -2814,6 +2831,7 @@ void load_gauge_radar_orb(int base_w, int base_h, int hud_font, bool scale_gauge
hud_gauge->initDistanceLongOffsets(Radar_dist_offsets[1][0], Radar_dist_offsets[1][1]);
hud_gauge->initDistanceShortOffsets(Radar_dist_offsets[0][0], Radar_dist_offsets[0][1]);
hud_gauge->initRadius(Radar_radius[0], Radar_radius[1]);
hud_gauge->initInfinityIcon();
if(ship_idx->at(0) >= 0) {
for (SCP_vector<int>::iterator ship_index = ship_idx->begin(); ship_index != ship_idx->end(); ++ship_index) {
@@ -2842,7 +2860,7 @@ void load_gauge_radar_dradis(int base_w, int base_h, int hud_font, bool scale_ga
// basic radar gauge info
float origin[2] = {0.5, 1.0};
int offset[2];
int coords[2];
int coords[2] = {0, 0};
int base_res[2];
int Radar_radius[2];
@@ -2897,7 +2915,7 @@ void load_gauge_radar_dradis(int base_w, int base_h, int hud_font, bool scale_ga
if(optional_string("Position:")) {
stuff_int_list(coords, 2);
} else {
if (optional_string("$Scale Gauge:")) {
if (optional_string("Scale Gauge:")) {
stuff_boolean(&scale_gauge);
}
@@ -2905,10 +2923,13 @@ void load_gauge_radar_dradis(int base_w, int base_h, int hud_font, bool scale_ga
if(optional_string("Origin:")) {
stuff_float_list(origin, 2);
required_string("Offset:");
stuff_int_list(offset, 2);
}
if(optional_string("Offset:")) {
stuff_int_list(offset, 2);
Error(LOCATION, "HUD gauges table: Offset must also have Origin defined");
}
coords[0] = (int)(base_res[0] * origin[0]) + offset[0];
@@ -2921,8 +2942,8 @@ void load_gauge_radar_dradis(int base_w, int base_h, int hud_font, bool scale_ga
coords[1] = (int)(base_res[1] * origin[1]) + offset[1];
}
if(optional_string("$Font:")) {
stuff_int(&Hud_font);
if(optional_string("Font:")) {
stuff_int(&font_num);
} else {
if ( hud_font >=0 ) {
font_num = hud_font;
@@ -3590,6 +3611,7 @@ void load_gauge_weapons(int base_w, int base_h, int hud_font, bool scale_gauge,
hud_gauge->initSecondaryWeaponOffsets(Weapon_sammo_offset_x, Weapon_sname_offset_x, Weapon_sreload_offset_x, Weapon_slinked_offset_x, Weapon_sunlinked_offset_x);
hud_gauge->initPrimaryHeights(top_primary_h, primary_text_h);
hud_gauge->initSecondaryHeights(top_secondary_h, secondary_text_h);
hud_gauge->initLinkIcon();
if(ship_idx->at(0) >= 0) {
for (SCP_vector<int>::iterator ship_index = ship_idx->begin(); ship_index != ship_idx->end(); ++ship_index) {
@@ -3807,8 +3829,13 @@ void load_gauge_auto_target(int base_w, int base_h, int hud_font, bool scale_gau
auto_text_offset[0] = 13;
auto_text_offset[1] = 2;
target_text_offset[0] = 7;
target_text_offset[1] = 10;
if (Lcl_pl) {
target_text_offset[0] = 2;
target_text_offset[1] = 10;
} else {
target_text_offset[0] = 7;
target_text_offset[1] = 10;
}
HudGaugeAutoTarget* hud_gauge = gauge_load_common<HudGaugeAutoTarget>(base_w, base_h, hud_font, scale_gauge, ship_idx, use_clr, origin[0], origin[1], offset[0], offset[1]);
@@ -3868,8 +3895,13 @@ void load_gauge_auto_speed(int base_w, int base_h, int hud_font, bool scale_gaug
auto_text_offset[0] = 13;
auto_text_offset[1] = 2;
speed_text_offset[0] = 10;
speed_text_offset[1] = 10;
if (Lcl_pl) {
speed_text_offset[0] = 9;
speed_text_offset[1] = 10;
} else {
speed_text_offset[0] = 10;
speed_text_offset[1] = 10;
}
HudGaugeAutoSpeed* hud_gauge = gauge_load_common<HudGaugeAutoSpeed>(base_w, base_h, hud_font, scale_gauge, ship_idx, use_clr, origin[0], origin[1], offset[0], offset[1]);
@@ -5389,6 +5421,7 @@ void load_gauge_primary_weapons(int base_w, int base_h, int hud_font, bool scale
hud_gauge->initPrimaryAmmoOffsetX(ammo_x);
hud_gauge->initPrimaryLinkOffsetX(link_x);
hud_gauge->initPrimaryNameOffsetX(name_x);
hud_gauge->initLinkIcon();
if(ship_idx->at(0) >= 0) {
for (SCP_vector<int>::iterator ship_index = ship_idx->begin(); ship_index != ship_idx->end(); ++ship_index) {
@@ -5516,6 +5549,7 @@ void load_gauge_secondary_weapons(int base_w, int base_h, int hud_font, bool sca
hud_gauge->initSecondaryNameOffsetX(name_x);
hud_gauge->initSecondaryReloadOffsetX(reload_x);
hud_gauge->initSecondaryUnlinkedOffsetX(unlink_x);
hud_gauge->initLinkIcon();
if(ship_idx->at(0) >= 0) {
for (SCP_vector<int>::iterator ship_index = ship_idx->begin(); ship_index != ship_idx->end(); ++ship_index) {
+12 -14
View File
@@ -403,6 +403,16 @@ void HudGaugeThrottle::initMatchSpeedOffsets(int x, int y, bool custom)
Match_speed_offsets[0] = x;
Match_speed_offsets[1] = y;
Use_custom_match_speed = custom;
ubyte sc = lcl_get_font_index(font_num);
// NOTE: default to normal m because either
// a) the german font has no special m (its an a)
// b) the font has no special characters
if (sc == 0 || Lcl_gr) {
Match_speed_icon = ubyte ('m');
} else {
Match_speed_icon = sc + 3;
}
}
void HudGaugeThrottle::initBitmaps(char *fname)
@@ -572,13 +582,7 @@ void HudGaugeThrottle::renderThrottleSpeed(float current_speed, int y_end)
}
} else if ( Players[Player_num].flags & PLAYER_FLAGS_MATCH_TARGET ) {
if ( Use_custom_match_speed ) {
if (Lcl_gr) {
// print an m, cuz the voice says its an m.
// its a normal m cuz the german font has no special m (its an a)
renderString(position[0] + Match_speed_offsets[0], position[1] + Match_speed_offsets[1], "m");
} else {
renderPrintf(position[0] + Match_speed_offsets[0], position[1] + Match_speed_offsets[1], "%c", Lcl_special_chars + 3);
}
renderPrintf(position[0] + Match_speed_offsets[0], position[1] + Match_speed_offsets[1], "%c", Match_speed_icon);
} else {
int offset;
if ( current_speed <= 9.5 ) {
@@ -587,13 +591,7 @@ void HudGaugeThrottle::renderThrottleSpeed(float current_speed, int y_end)
offset = 3;
}
if (Lcl_gr) {
// print an m, cuz the voice says its an m.
// its a normal m cuz the german font has no special m (its an a)
renderString(sx+offset, sy + h, "m");
} else {
renderPrintf(sx+offset, sy + h, "%c", Lcl_special_chars + 3);
}
renderPrintf(sx+offset, sy + h, "%c", Match_speed_icon);
}
}
}
+1
View File
@@ -81,6 +81,7 @@ protected:
int Match_speed_offsets[2];
bool Use_custom_match_speed;
ubyte Match_speed_icon;
bool Show_background;
public:
+12 -17
View File
@@ -473,25 +473,20 @@ void hud_shield_show_mini(object *objp, int x_force, int y_force, int x_hull_off
// associated ship
void shield_info_reset(object *objp, shield_hit_info *shi)
{
int n_quadrants = (objp != NULL) ? objp->n_quadrants : 0;
shi->members = n_quadrants + 1;
shi->hull_hit_index = n_quadrants;
shi->shield_hit_timers.resize(shi->members);
shi->shield_hit_next_flash.resize(shi->members);
for ( int i = 0; i < shi->members; i++ ) {
shi->shield_hit_timers[i] = timestamp(0);
shi->shield_hit_next_flash[i] = timestamp(0);
}
shi->shield_hit_status = 0;
shi->shield_show_bright = 0;
if (objp == NULL) {
shi->members = 0;
shi->hull_hit_index = 0;
shi->shield_hit_timers.clear();
shi->shield_hit_next_flash.clear();
} else {
shi->members = objp->n_quadrants + 1;
shi->hull_hit_index = shi->members - 1;
shi->shield_hit_timers.resize(shi->members);
shi->shield_hit_next_flash.resize(shi->members);
for ( int i = 0; i < shi->members; i++ ) {
shi->shield_hit_timers[i] = 1;
shi->shield_hit_next_flash[i] = 1;
}
}
}
// reset the timers and hit flags for the shield gauges
+8 -2
View File
@@ -832,6 +832,7 @@ int hud_squadmsg_is_target_order_valid(int order, int find_order, ai_info *aip )
// if it's a weapon, then it needs to be a WIF_BOMB weapon. Only attack order valid, and only
// valid on bombs not on the player's team
// MageKing17: Now also works on WIF3_FIGHTER_INTERCEPTABLE weapons.
if ( objp->type == OBJ_WEAPON ) {
if (Weapons[objp->instance].lssm_stage==3){
@@ -839,7 +840,7 @@ int hud_squadmsg_is_target_order_valid(int order, int find_order, ai_info *aip )
}
if ( (Comm_orders[order].item == ATTACK_TARGET_ITEM )
&& (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_BOMB)
&& ((Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_BOMB) || (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags3 & WIF3_FIGHTER_INTERCEPTABLE))
&& (Weapons[objp->instance].team != ordering_shipp->team) )
return 1;
@@ -857,7 +858,7 @@ int hud_squadmsg_is_target_order_valid(int order, int find_order, ai_info *aip )
}
// if we are messaging a ship, and that ship is our target, no target type orders are ever active
if ( (Squad_msg_mode == SM_MODE_SHIP_COMMAND) && (target_objnum == Msg_instance) ){
if ( (Squad_msg_mode == SM_MODE_SHIP_COMMAND) && (Objects[target_objnum].instance == Msg_instance) ){
return 0;
}
@@ -2462,6 +2463,11 @@ int hud_query_order_issued(char *to, char *order_name, char *target_name, int ti
}
int target_ship = ship_name_lookup(target_name);
if(target_ship<0) {
continue;
}
int subsys_index = ship_get_subsys_index(&Ships[target_ship], special_argument, 1);
// if the order is for s different subsystem
if (Squadmsg_history[i].special_index != subsys_index) {
+84 -70
View File
@@ -2068,68 +2068,68 @@ float hud_find_target_distance( object *targetee, object *targeter )
///
/// \return true if either the ship or one of it's turrets are attacking the
/// player. Otherwise, returns false.
bool evaluate_ship_as_closest_target(esct *esct)
bool evaluate_ship_as_closest_target(esct *esct_p)
{
int targeting_player, turret_is_attacking;
ship_subsys *ss;
float new_distance;
// initialize
esct->min_distance = FLT_MAX;
esct->check_nearest_turret = FALSE;
esct_p->min_distance = FLT_MAX;
esct_p->check_nearest_turret = FALSE;
turret_is_attacking = FALSE;
object *objp = &Objects[esct->shipp->objnum];
object *objp = &Objects[esct_p->shipp->objnum];
Assert(objp->type == OBJ_SHIP);
if (objp->type != OBJ_SHIP) {
return false;
}
// player being targeted, so we will want closest distance from player
targeting_player = (esct->attacked_objnum == OBJ_INDEX(Player_obj));
targeting_player = (esct_p->attacked_objnum == OBJ_INDEX(Player_obj));
// filter on team
if ( !iff_matches_mask(esct->shipp->team, esct->team_mask) ) {
if ( !iff_matches_mask(esct_p->shipp->team, esct_p->team_mask) ) {
return false;
}
// check if player or ignore ship
if ( (esct->shipp->objnum == OBJ_INDEX(Player_obj)) || (esct->shipp->flags & TARGET_SHIP_IGNORE_FLAGS) ) {
if ( (esct_p->shipp->objnum == OBJ_INDEX(Player_obj)) || (esct_p->shipp->flags & TARGET_SHIP_IGNORE_FLAGS) ) {
return false;
}
// bail if harmless
if ( Ship_info[esct->shipp->ship_info_index].class_type > -1 && !(Ship_types[Ship_info[esct->shipp->ship_info_index].class_type].hud_bools & STI_HUD_TARGET_AS_THREAT)) {
if ( Ship_info[esct_p->shipp->ship_info_index].class_type > -1 && !(Ship_types[Ship_info[esct_p->shipp->ship_info_index].class_type].hud_bools & STI_HUD_TARGET_AS_THREAT)) {
return false;
}
// only look at targets that are AWACS valid
if (hud_target_invalid_awacs(&Objects[esct->shipp->objnum])) {
if (hud_target_invalid_awacs(&Objects[esct_p->shipp->objnum])) {
return false;
}
// If filter is set, only target fighters and bombers
if ( esct->filter ) {
if ( !(Ship_info[esct->shipp->ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)) ) {
if ( esct_p->filter ) {
if ( !(Ship_info[esct_p->shipp->ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)) ) {
return false;
}
}
// find closest turret to player if BIG or HUGE ship
if (Ship_info[esct->shipp->ship_info_index].flags & (SIF_BIG_SHIP|SIF_HUGE_SHIP)) {
for (ss=GET_FIRST(&esct->shipp->subsys_list); ss!=END_OF_LIST(&esct->shipp->subsys_list); ss=GET_NEXT(ss)) {
if (Ship_info[esct_p->shipp->ship_info_index].flags & (SIF_BIG_SHIP|SIF_HUGE_SHIP)) {
for (ss=GET_FIRST(&esct_p->shipp->subsys_list); ss!=END_OF_LIST(&esct_p->shipp->subsys_list); ss=GET_NEXT(ss)) {
if (ss->flags & SSF_UNTARGETABLE)
continue;
if ( (ss->system_info->type == SUBSYSTEM_TURRET) && (ss->current_hits > 0) ) {
if (esct->check_all_turrets || (ss->turret_enemy_objnum == esct->attacked_objnum)) {
if (esct_p->check_all_turrets || (ss->turret_enemy_objnum == esct_p->attacked_objnum)) {
turret_is_attacking = 1;
esct->check_nearest_turret = TRUE;
esct_p->check_nearest_turret = TRUE;
if ( !esct->turret_attacking_target || (esct->turret_attacking_target && (ss->turret_enemy_objnum == esct->attacked_objnum)) ) {
if ( !esct_p->turret_attacking_target || (esct_p->turret_attacking_target && (ss->turret_enemy_objnum == esct_p->attacked_objnum)) ) {
vec3d gsubpos;
// get world pos of subsystem
vm_vec_unrotate(&gsubpos, &ss->system_info->pnt, &objp->orient);
@@ -2146,8 +2146,8 @@ bool evaluate_ship_as_closest_target(esct *esct)
} */
// get the closest distance
if (new_distance <= esct->min_distance) {
esct->min_distance = new_distance;
if (new_distance <= esct_p->min_distance) {
esct_p->min_distance = new_distance;
}
}
}
@@ -2158,9 +2158,9 @@ bool evaluate_ship_as_closest_target(esct *esct)
// If no turret is attacking, check if objp is actually targeting attacked_objnum
// don't bail if targeting is for player
if ( !targeting_player && !turret_is_attacking ) {
ai_info *aip = &Ai_info[esct->shipp->ai_index];
ai_info *aip = &Ai_info[esct_p->shipp->ai_index];
if (aip->target_objnum != esct->attacked_objnum) {
if (aip->target_objnum != esct_p->attacked_objnum) {
return false;
}
@@ -2174,9 +2174,9 @@ bool evaluate_ship_as_closest_target(esct *esct)
//new_distance = hud_find_target_distance(objp, Player_obj);
new_distance = vm_vec_dist_quick(&objp->pos, &Player_obj->pos);
if (new_distance <= esct->min_distance) {
esct->min_distance = new_distance;
esct->check_nearest_turret = FALSE;
if (new_distance <= esct_p->min_distance) {
esct_p->min_distance = new_distance;
esct_p->check_nearest_turret = FALSE;
}
}
@@ -2220,7 +2220,7 @@ int hud_target_closest(int team_mask, int attacked_objnum, int play_fail_snd, in
int check_nearest_turret = FALSE;
// evaluate ship closest target struct
esct esct;
esct eval_ship_as_closest_target_args;
float min_distance = FLT_MAX;
int target_found = FALSE;
@@ -2251,31 +2251,31 @@ int hud_target_closest(int team_mask, int attacked_objnum, int play_fail_snd, in
}
// check all turrets if for player.
esct.check_all_turrets = (attacked_objnum == player_obj_index);
esct.filter = filter;
esct.team_mask = team_mask;
esct.attacked_objnum = attacked_objnum;
esct.turret_attacking_target = get_closest_turret_attacking_player;
eval_ship_as_closest_target_args.check_all_turrets = (attacked_objnum == player_obj_index);
eval_ship_as_closest_target_args.filter = filter;
eval_ship_as_closest_target_args.team_mask = team_mask;
eval_ship_as_closest_target_args.attacked_objnum = attacked_objnum;
eval_ship_as_closest_target_args.turret_attacking_target = get_closest_turret_attacking_player;
for ( so=GET_FIRST(&Ship_obj_list); so!=END_OF_LIST(&Ship_obj_list); so=GET_NEXT(so) ) {
A = &Objects[so->objnum];
shipp = &Ships[A->instance]; // get a pointer to the ship information
// fill in rest of esct
esct.shipp = shipp;
// fill in rest of eval_ship_as_closest_target_args
eval_ship_as_closest_target_args.shipp = shipp;
// Filter out any target that is not targeting the player --Mastadon
if ( (initial_attacked_objnum == player_obj_index) && (Ai_info[shipp->ai_index].target_objnum != player_obj_index) ) {
continue;
}
// check each shipp on list and update nearest obj and subsys
evaluate_ship_as_closest_target(&esct);
if (esct.min_distance < min_distance) {
evaluate_ship_as_closest_target(&eval_ship_as_closest_target_args);
if (eval_ship_as_closest_target_args.min_distance < min_distance) {
target_found = TRUE;
min_distance = esct.min_distance;
min_distance = eval_ship_as_closest_target_args.min_distance;
nearest_obj = A;
check_nearest_turret = esct.check_nearest_turret;
check_nearest_turret = eval_ship_as_closest_target_args.check_nearest_turret;
}
}
@@ -3290,7 +3290,11 @@ void hud_show_message_sender()
// Karajorma - If we've gone to all the trouble to make our friendly ships stealthed they shouldn't then give away
// their position cause they're feeling chatty
if ( Ships[Message_shipnum].flags2 & SF2_FRIENDLY_STEALTH_INVIS ) {
// MageKing17 - Make the check see if they're actually stealthed at the time, and may as well include a check for
// being hidden from sensors, too; logic copied from a similar check in hudescort.cpp
if ( (Ships[Message_shipnum].flags & SF_HIDDEN_FROM_SENSORS)
|| ((Ships[Message_shipnum].flags2 & SF2_STEALTH) && ((Ships[Message_shipnum].team != Player_ship->team) || (Ships[Message_shipnum].flags2 & SF2_FRIENDLY_STEALTH_INVIS)))
) {
return;
}
@@ -4222,8 +4226,7 @@ void HudGaugeLeadSight::render(float frametime)
polymodel *pm;
ship_weapon *swp;
weapon_info *wip;
weapon_info *tmp=NULL;
float dist_to_target, prange, srange;
float dist_to_target, prange;
int bank_to_fire;
if (Player_ai->target_objnum == -1)
@@ -4287,17 +4290,6 @@ void HudGaugeLeadSight::render(float frametime)
// to the closest point on the bounding box of the target
dist_to_target = hud_find_target_distance(targetp, Player_obj);
srange = ship_get_secondary_weapon_range(Player_ship);
if ( (swp->current_secondary_bank >= 0) && (swp->secondary_bank_weapons[swp->current_secondary_bank] >= 0) ) {
int bank = swp->current_secondary_bank;
tmp = &Weapon_info[swp->secondary_bank_weapons[bank]];
if ( !(tmp->wi_flags & WIF_HOMING) && !(tmp->wi_flags & WIF_LOCKED_HOMING && Player->target_in_lock_cone) ) {
//The secondary lead indicator is handled farther below if it is a non-locking type
srange = -1.0f;
}
}
bool in_frame;
if ( dist_to_target < prange ) {
// fire it up
@@ -5290,6 +5282,8 @@ void hud_stuff_ship_name(char *ship_name_text, ship *shipp)
// handle translation
if (Lcl_gr) {
lcl_translate_targetbox_name_gr(ship_name_text);
} else if (Lcl_pl) {
lcl_translate_targetbox_name_pl(ship_name_text);
}
}
}
@@ -5297,12 +5291,6 @@ void hud_stuff_ship_name(char *ship_name_text, ship *shipp)
extern char Fred_callsigns[MAX_SHIPS][NAME_LENGTH+1];
void hud_stuff_ship_callsign(char *ship_callsign_text, ship *shipp)
{
// only fighters and bombers have callsigns
if ( !(Ship_info[shipp->ship_info_index].flags & (SIF_FIGHTER|SIF_BOMBER)) ) {
*ship_callsign_text = 0;
return;
}
// handle multiplayer callsign
if (Game_mode & GM_MULTIPLAYER) {
// get a player num from the object, then get a callsign from the player structure.
@@ -5330,6 +5318,8 @@ void hud_stuff_ship_callsign(char *ship_callsign_text, ship *shipp)
// handle translation
if (Lcl_gr) {
lcl_translate_targetbox_name_gr(ship_callsign_text);
} else if (Lcl_pl) {
lcl_translate_targetbox_name_pl(ship_callsign_text);
}
}
@@ -5357,6 +5347,8 @@ void hud_stuff_ship_class(char *ship_class_text, ship *shipp)
// handle translation
if (Lcl_gr) {
lcl_translate_targetbox_name_gr(ship_class_text);
} else if (Lcl_pl) {
lcl_translate_targetbox_name_pl(ship_class_text);
}
}
@@ -5556,12 +5548,13 @@ void HudGaugeWeaponEnergy::render(float frametime)
if(use_new_gauge)
{
int currentx, currenty;
int currentx, currenty, line_height;
int y;
int max_w = 100;
float remaining;
currentx = position[0] + 10;
currenty = position[1];
line_height = gr_get_font_height() + 1;
if(gr_screen.max_w_unscaled == 640) {
max_w = 60;
}
@@ -5572,7 +5565,7 @@ void HudGaugeWeaponEnergy::render(float frametime)
//Draw name
renderString(currentx, currenty, "Energy");
currenty += 10;
currenty += line_height;
//Draw background
setGaugeColor(HUD_C_DIM);
@@ -5612,7 +5605,7 @@ void HudGaugeWeaponEnergy::render(float frametime)
}
//Next 'line'
currenty += 10;
currenty += line_height;
//Draw the background for the gauge
setGaugeColor(HUD_C_DIM);
@@ -5780,6 +5773,18 @@ HudGauge(HUD_OBJECT_WEAPONS, HUD_WEAPONS_GAUGE, false, false, VM_EXTERNAL | VM_D
{
}
void HudGaugeWeapons::initLinkIcon()
{
ubyte sc = lcl_get_font_index(font_num);
// default to a '>' if the font has no special chars
// seems about the closest normal char to the triangle
if (sc == 0) {
Weapon_link_icon = ubyte ('>');
} else {
Weapon_link_icon = sc + 2;
}
}
void HudGaugeWeapons::initTopOffsetX(int x, int x_b)
{
top_offset_x[0] = x;
@@ -6030,7 +6035,7 @@ void HudGaugeWeapons::render(float frametime)
// indicate if this is linked or currently armed
if ( ((sw->current_primary_bank == i) && !(Player_ship->flags & SF_PRIMARY_LINKED)) || ((Player_ship->flags & SF_PRIMARY_LINKED) && !(Weapon_info[sw->primary_bank_weapons[i]].wi_flags3 & WIF3_NOLINK))) {
renderPrintf(position[0] + Weapon_plink_offset_x, name_y, EG_NULL, "%c", Lcl_special_chars + 2);
renderPrintf(position[0] + Weapon_plink_offset_x, name_y, EG_NULL, "%c", Weapon_link_icon);
}
// either render this primary's image or its name
@@ -6094,11 +6099,11 @@ void HudGaugeWeapons::render(float frametime)
if ( sw->current_secondary_bank == i ) {
// show that this is the current secondary armed
renderPrintf(position[0] + Weapon_sunlinked_offset_x, name_y, EG_NULL, "%c", Lcl_special_chars + 2);
renderPrintf(position[0] + Weapon_sunlinked_offset_x, name_y, EG_NULL, "%c", Weapon_link_icon);
// indicate if this is linked
if ( Player_ship->flags & SF_SECONDARY_DUAL_FIRE ) {
renderPrintf(position[0] + Weapon_slinked_offset_x, name_y, EG_NULL, "%c", Lcl_special_chars + 2);
renderPrintf(position[0] + Weapon_slinked_offset_x, name_y, EG_NULL, "%c", Weapon_link_icon);
}
// show secondary weapon's image or print its name
@@ -6703,12 +6708,23 @@ void HudGaugeWarheadCount::render(float frametime)
}
}
HudGaugeWeaponList::HudGaugeWeaponList(int gauge_object):
HudGauge(gauge_object, HUD_WEAPONS_GAUGE, false, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY, 255, 255, 255)
HudGaugeWeaponList::HudGaugeWeaponList(int _gauge_object):
HudGauge(_gauge_object, HUD_WEAPONS_GAUGE, false, false, VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY, 255, 255, 255)
{
}
void HudGaugeWeaponList::initLinkIcon() {
ubyte sc = lcl_get_font_index(font_num);
// default to a '>' if the font has no special chars
// seems about the closest normal char to the triangle
if (sc == 0) {
Weapon_link_icon = ubyte ('>');
} else {
Weapon_link_icon = sc + 2;
}
}
void HudGaugeWeaponList::initBitmaps(char *fname_first, char *fname_entry, char *fname_last)
{
_background_first.first_frame = bm_load_animation(fname_first, &_background_first.num_frames);
@@ -6842,7 +6858,6 @@ void HudGaugePrimaryWeapons::initPrimaryAmmoOffsetX(int x)
void HudGaugePrimaryWeapons::render(float frametime)
{
ship_weapon *sw;
int ship_is_ballistic;
int num_primaries; // np == num primary
char name[NAME_LENGTH];
@@ -6854,7 +6869,6 @@ void HudGaugePrimaryWeapons::render(float frametime)
Assert(Player_obj->instance >= 0 && Player_obj->instance < MAX_SHIPS);
sw = &Ships[Player_obj->instance].weapons;
ship_is_ballistic = (Ship_info[Ships[Player_obj->instance].ship_info_index].flags & SIF_BALLISTIC_PRIMARIES);
num_primaries = sw->num_primary_banks;
@@ -6889,7 +6903,7 @@ void HudGaugePrimaryWeapons::render(float frametime)
// indicate if this is linked or currently armed
if ( (sw->current_primary_bank == i) || (Player_ship->flags & SF_PRIMARY_LINKED) ) {
renderPrintf(position[0] + _plink_offset_x, position[1] + text_y_offset, EG_NULL, "%c", Lcl_special_chars + 2);
renderPrintf(position[0] + _plink_offset_x, position[1] + text_y_offset, EG_NULL, "%c", Weapon_link_icon);
}
// either render this primary's image or its name
@@ -6961,7 +6975,6 @@ void HudGaugeSecondaryWeapons::initSecondaryUnlinkedOffsetX(int x)
void HudGaugeSecondaryWeapons::render(float frametime)
{
ship_weapon *sw;
int ship_is_ballistic;
int num_primaries, num_secondaries;
@@ -6969,7 +6982,6 @@ void HudGaugeSecondaryWeapons::render(float frametime)
Assert(Player_obj->instance >= 0 && Player_obj->instance < MAX_SHIPS);
sw = &Ships[Player_obj->instance].weapons;
ship_is_ballistic = (Ship_info[Ships[Player_obj->instance].ship_info_index].flags & SIF_BALLISTIC_PRIMARIES);
num_primaries = sw->num_primary_banks;
num_secondaries = sw->num_secondary_banks;
@@ -7001,11 +7013,11 @@ void HudGaugeSecondaryWeapons::render(float frametime)
if ( sw->current_secondary_bank == i ) {
// show that this is the current secondary armed
renderPrintf(position[0] + _sunlinked_offset_x, position[1] + text_y_offset, EG_NULL, "%c", Lcl_special_chars + 2);
renderPrintf(position[0] + _sunlinked_offset_x, position[1] + text_y_offset, EG_NULL, "%c", Weapon_link_icon);
// indicate if this is linked
if ( Player_ship->flags & SF_SECONDARY_DUAL_FIRE ) {
renderPrintf(position[0] + _slinked_offset_x, position[1] + text_y_offset, EG_NULL, "%c", Lcl_special_chars + 2);
renderPrintf(position[0] + _slinked_offset_x, position[1] + text_y_offset, EG_NULL, "%c", Weapon_link_icon);
}
// show secondary weapon's image or print its name
@@ -7143,6 +7155,8 @@ void HudGaugeHardpoints::render(float frametime)
model_set_alpha( gr_screen.current_color.alpha / 255.0f );
model_set_forced_texture(0);
model_set_outline_color_fast(&gauge_color);
model_render(
sip->model_num,
&object_orient,
+4
View File
@@ -314,6 +314,7 @@ protected:
int Weapon_sreload_offset_x;
int Weapon_slinked_offset_x;
int Weapon_sunlinked_offset_x;
ubyte Weapon_link_icon;
int top_primary_h;
int pname_start_offset_y;
@@ -340,6 +341,7 @@ public:
void initStartNameOffsetsY(int p_y, int s_y);
void initPrimaryHeights(int top_h, int text_h);
void initSecondaryHeights(int top_h, int text_h);
void initLinkIcon();
void render(float frametime);
void pageIn();
@@ -352,6 +354,7 @@ protected:
hud_frames _background_first;
hud_frames _background_entry;
hud_frames _background_last;
ubyte Weapon_link_icon;
int _bg_first_offset_x;
int _bg_entry_offset_x;
@@ -379,6 +382,7 @@ public:
void initHeaderOffsets(int x, int y);
void initEntryStartY(int y);
void initEntryHeight(int h);
void initLinkIcon();
virtual void render(float frametime);
void pageIn();
+53 -14
View File
@@ -166,6 +166,34 @@ void hud_targetbox_truncate_subsys_name(char *outstr)
} else if ( strstr(outstr, "laser") || strstr(outstr, "turret") || strstr(outstr, "missile") ) {
strcpy(outstr, "tourelle");
}
} else if(Lcl_pl){
if ( strstr(outstr, "communication") ) {
strcpy(outstr, "komunikacja");
} else if ( !stricmp(outstr, "weapons") ) {
strcpy(outstr, "uzbrojenie");
} else if ( strstr(outstr, "engine") || strstr(outstr, "Engine")) {
strcpy(outstr, "silnik");
} else if ( !stricmp(outstr, "sensors") ) {
strcpy(outstr, "sensory");
} else if ( strstr(outstr, "navigat") ) {
strcpy(outstr, "nawigacja");
} else if ( strstr(outstr, "fighterbay") || strstr(outstr, "Fighterbay") ) {
strcpy(outstr, "dok my\x9Cliw.");
} else if ( strstr(outstr, "missile") ) {
strcpy(outstr, "wie\xBF. rakiet.");
} else if ( strstr(outstr, "laser") || strstr(outstr, "turret") ) {
strcpy(outstr, "wie\xBFyczka");
} else if ( strstr(outstr, "Command Tower") || strstr(outstr, "Bridge") ) {
strcpy(outstr, "mostek");
} else if ( strstr(outstr, "Barracks") ) {
strcpy(outstr, "koszary");
} else if ( strstr(outstr, "Reactor") ) {
strcpy(outstr, "reaktor");
} else if ( strstr(outstr, "RadarDish") || strstr(outstr, "Radar Dish") ) {
strcpy(outstr, "antena radaru");
} else if (!stricmp(outstr, "Gas Collector")) {
strcpy(outstr, "zbieracz gazu");
}
} else {
if (strstr(outstr, XSTR("communication", 333))) {
strcpy(outstr, XSTR("comm", 334));
@@ -1498,8 +1526,8 @@ void HudGaugeExtraTargetData::endFlashDock()
}
//from aicode.cpp. Less include...problems...this way.
extern bool turret_weapon_has_flags(ship_weapon *swp, int flags);
extern bool turret_weapon_has_flags2(ship_weapon *swp, int flags);
extern int turret_weapon_aggregate_flags(ship_weapon *swp);
extern int turret_weapon_aggregate_flags2(ship_weapon *swp);
extern bool turret_weapon_has_subtype(ship_weapon *swp, int subtype);
void get_turret_subsys_name(ship_weapon *swp, char *outstr)
{
@@ -1507,21 +1535,25 @@ void get_turret_subsys_name(ship_weapon *swp, char *outstr)
//WMC - find the first weapon, if there is one
if (swp->num_primary_banks || swp->num_secondary_banks) {
int flags = turret_weapon_aggregate_flags(swp);
int flags2 = turret_weapon_aggregate_flags2(swp);
// check if beam or flak using weapon flags
if (turret_weapon_has_flags(swp, WIF_BEAM)) {
if (flags & WIF_BEAM) {
sprintf(outstr, "%s", XSTR("Beam turret", 1567));
}else if (turret_weapon_has_flags(swp, WIF_FLAK)) {
} else if (flags & WIF_FLAK) {
sprintf(outstr, "%s", XSTR("Flak turret", 1566));
} else {
if (!turret_weapon_has_subtype(swp, WP_MISSILE) && turret_weapon_has_subtype(swp, WP_LASER)) {
if (turret_weapon_has_subtype(swp, WP_MISSILE)) {
sprintf(outstr, "%s", XSTR("Missile lnchr", 1569));
} else if (turret_weapon_has_subtype(swp, WP_LASER)) {
// ballistic too! - Goober5000
if (turret_weapon_has_flags2(swp, WIF2_BALLISTIC))
if (flags2 & WIF2_BALLISTIC)
{
sprintf(outstr, "%s", XSTR("Turret", 1487));
}
// the TVWP has some primaries flagged as bombs
else if (turret_weapon_has_flags(swp, WIF_BOMB))
else if (flags & WIF_BOMB)
{
sprintf(outstr, "%s", XSTR("Missile lnchr", 1569));
}
@@ -1529,12 +1561,19 @@ void get_turret_subsys_name(ship_weapon *swp, char *outstr)
{
sprintf(outstr, "%s", XSTR("Laser turret", 1568));
}
} else if (turret_weapon_has_subtype(swp, WP_MISSILE)) {
sprintf(outstr, "%s", XSTR("Missile lnchr", 1569));
} else {
// Illegal subtype
Int3();
sprintf(outstr, "%s", XSTR("Turret", 1487));
// Mantis #2226: find out if there are any weapons here at all
if (flags == 0 && flags2 == 0) {
sprintf(outstr, "%s", NOX("Unused"));
} else {
// Illegal subtype
static bool Turret_illegal_subtype_warned = false;
if (!Turret_illegal_subtype_warned) {
Turret_illegal_subtype_warned = true;
Warning(LOCATION, "This turret has an illegal subtype! Trace out and fix!");
}
sprintf(outstr, "%s", XSTR("Turret", 1487));
}
}
}
} else if(swp->num_tertiary_banks) {
@@ -1673,7 +1712,7 @@ void HudGaugeTargetBox::renderTargetShipInfo(object *target_objp)
if (n_linebreaks) {
p_line = strtok(outstr,linebreak);
while (p_line != NULL) {
renderPrintf(subsys_name_pos_x, subsys_name_pos_y-h-(10*n_linebreaks), p_line);
renderPrintf(subsys_name_pos_x, subsys_name_pos_y-h-((h+1)*n_linebreaks), p_line);
p_line = strtok(NULL,linebreak);
n_linebreaks--;
}
+2
View File
@@ -189,6 +189,8 @@ CFtpGet::~CFtpGet()
SDL_WaitThread(thread_id, NULL);
fclose(LOCALFILE);
fclose(LOCALFILE);
if(m_ListenSock != INVALID_SOCKET)
{
+3
View File
@@ -107,6 +107,9 @@ void ChttpGet::GetFile(char *URL,char *localfile)
return;
}
// uint arg = 1;
// ioctlsocket( m_DataSock, FIONBIO, &arg );
char *pURL = URL;
if(strnicmp(URL,"http:",5)==0)
{
+2 -11
View File
@@ -87,15 +87,6 @@ static int Key_numlock_was_on = 0; // Flag to indicate whether NumLock is on at
int Cheats_enabled = 0;
int Key_normal_game = 0;
/**
* Keyboard layouts
*/
enum KeyboardLayout {
KEYBOARD_LAYOUT_DEFAULT, //!< American
KEYBOARD_LAYOUT_QWERTZ, //!< German
KEYBOARD_LAYOUT_AZERTY //!< French
};
void FillSDLArray ()
{
SDLtoFS2[SDL_SCANCODE_0] = KEY_0;
@@ -215,7 +206,7 @@ void FillSDLArray ()
SDLtoFS2[SDL_SCANCODE_PRINTSCREEN] = KEY_PRINT_SCRN;
SDLtoFS2[SDL_SCANCODE_PAUSE] = KEY_PAUSE;
// SDLtoFS2[SDL_SCANCODE_BREAK] = KEY_BREAK;
// SDLtoFS2[SDL_SCANCODE_BREAK] = KEY_BREAK;
}
int key_numlock_is_on()
@@ -572,7 +563,7 @@ void key_mark( uint code, int state, uint latency )
code = KEY_SLASH;
}
// Assert( code < NUM_KEYS );
Assert( code < NUM_KEYS );
event_time = timer_get_milliseconds() - latency;
// event_time = timeGetTime() - latency;
+20 -18
View File
@@ -68,8 +68,6 @@ int count;
int table[ MAX_NUM_SLOTS ];
};
#define MAX_SLOT_COUNT 25
class factor_table
{
public:
@@ -96,9 +94,9 @@ memset( table, 0x00, sizeof( ftable ) * MAX_NUM_SLOTS );
for( int i = 0 ; i < MAX_NUM_SLOTS; ++i )
{
table[ i ].count = 0;
for( int j = 1; j <= i; ++j )
for( int j = 1; j <= i + 1; ++j )
{
if( isAPrimeFactor( j, i ) )
if( isAPrimeFactor( j, i + 1 ) )
{
table[ i ].table[ table[ i ].count ] = j;
table[ i ].count ++;
@@ -109,14 +107,16 @@ for( int i = 0 ; i < MAX_NUM_SLOTS; ++i )
int factor_table::getNextSlots(int slots_on_ship, int cur_slots)
{
Assert( slots_on_ship <= MAX_NUM_SLOTS );
Assert( slots_on_ship >= 0 );
Assertion( slots_on_ship <= MAX_NUM_SLOTS, "factor_table::getNextSlots() called with %d slots, when MAX_NUM_SLOTS is %d; get a coder!\n", slots_on_ship, MAX_NUM_SLOTS );
Assertion( slots_on_ship >= 1, "factor_table::getNextSlots() called with %d slots, when only positive integers make sense; get a coder!\n" );
for( int i = 0; i < table[ slots_on_ship ].count; ++i )
int slots_index = slots_on_ship - 1;
for( int i = 0; i < table[ slots_index ].count; ++i )
{
if( table[ slots_on_ship ].table[ i ] == cur_slots )
if( table[ slots_index ].table[ i ] == cur_slots )
{
if( table[ slots_on_ship ].count == i + 1 )
if( table[ slots_index ].count == i + 1 )
{
//Overflow back to 1
return 1;
@@ -124,13 +124,13 @@ for( int i = 0; i < table[ slots_on_ship ].count; ++i )
else
{
//Next block in the table
return table[ slots_on_ship ].table[ i + 1 ];
return table[ slots_index ].table[ i + 1 ];
}
}
}
//Did not find cur_slots, try and get back on track
Assert( 0 );
Assertion( false, "For some reason, factor_table::getNextSlots() was unable to locate cur_slots. This should never happen; get a coder!\n" );
return 1;
}
@@ -1301,7 +1301,7 @@ void ppsk_hotkeys(int k)
case KEY_F10 + KEY_SHIFTED + KEY_ALTED:
case KEY_F11 + KEY_SHIFTED + KEY_ALTED:
case KEY_F12 + KEY_SHIFTED + KEY_ALTED:
hotkey_set = mission_hotkey_get_set_num(k & ~KEY_SHIFTED+KEY_ALTED);
hotkey_set = mission_hotkey_get_set_num(k & (~(KEY_SHIFTED+KEY_ALTED)));
hud_target_hotkey_clear( hotkey_set );
break;
@@ -1737,12 +1737,14 @@ int button_function_critical(int n, net_player *p = NULL)
ship * shipp = &Ships[objp->instance];
ship_weapon *swp = &shipp->weapons;
ship_info *sip = &Ship_info[shipp->ship_info_index];
polymodel *pm = model_get( sip->model_num );
count = ftables.getNextSlots( pm->gun_banks[ swp->current_primary_bank ].num_slots, swp->primary_bank_slot_count[ swp->current_primary_bank ] );
swp->primary_bank_slot_count[ swp->current_primary_bank ] = count;
shipp->last_fired_point[ swp->current_primary_bank ] += count - ( shipp->last_fired_point[ swp->current_primary_bank ] % count);
shipp->last_fired_point[ swp->current_primary_bank ] -= 1;
shipp->last_fired_point[ swp->current_primary_bank ] %= swp->primary_bank_slot_count[ swp->current_primary_bank ];
if (sip->flags2 & SIF2_DYN_PRIMARY_LINKING) {
polymodel *pm = model_get( sip->model_num );
count = ftables.getNextSlots( pm->gun_banks[ swp->current_primary_bank ].num_slots, swp->primary_bank_slot_count[ swp->current_primary_bank ] );
swp->primary_bank_slot_count[ swp->current_primary_bank ] = count;
shipp->last_fired_point[ swp->current_primary_bank ] += count - ( shipp->last_fired_point[ swp->current_primary_bank ] % count);
shipp->last_fired_point[ swp->current_primary_bank ] -= 1;
shipp->last_fired_point[ swp->current_primary_bank ] %= swp->primary_bank_slot_count[ swp->current_primary_bank ];
}
}
break;
+1
View File
@@ -76,6 +76,7 @@ void mouse_close()
if (!mouse_inited)
return;
mouse_inited = 0;
SDL_DestroyMutex( mouse_lock );
+4 -4
View File
@@ -811,10 +811,10 @@ BOOL SWFF_RegisterVFXObject(IN LPCTSTR pszVFXPath)
&& SWFF_WriteRegString("\\VFX", "VFX Object")
&& SWFF_WriteRegString("\\VFX\\CurVer", "VFX1.0")
&& SWFF_WriteRegString("\\VFX\\CLSID", GUID_VFX_Object)
&& SWFF_WriteRegString("\\CLSID\\"GUID_VFX_Object, "VFX Object")
&& SWFF_WriteRegString("\\CLSID\\"GUID_VFX_Object"\\VersionIndependentProgID", "VFX")
&& SWFF_WriteRegString("\\CLSID\\"GUID_VFX_Object"\\InprocServer32", pszVFXPath)
&& SWFF_WriteRegString("\\CLSID\\"GUID_VFX_Object"\\NotInsertable", "");
&& SWFF_WriteRegString("\\CLSID\\" GUID_VFX_Object, "VFX Object")
&& SWFF_WriteRegString("\\CLSID\\" GUID_VFX_Object "\\VersionIndependentProgID", "VFX")
&& SWFF_WriteRegString("\\CLSID\\" GUID_VFX_Object "\\InprocServer32", pszVFXPath)
&& SWFF_WriteRegString("\\CLSID\\" GUID_VFX_Object "\\NotInsertable", "");
}
// ----------------------------------------------------------------------------
+4 -2
View File
@@ -399,16 +399,18 @@ void timing_display(int x, int y)
#else
int idx;
int line_height = gr_get_font_height() + 1;
gr_set_color_fast(&Color_bright_blue);
// total time
gr_printf_no_resize(x, y, "Total time %f\n", (float)timing_frame_total() / 1000000.0f);
y += 10;
y += line_height;
// each event percentage
for(idx=0; idx<Timing_event_count; idx++){
gr_printf_no_resize(x, y, "%s: %f\n", Timing_events[idx].name, timing_event_pct(Timing_events[idx].name));
y += 10;
y += line_height;
}
#endif
}
+78 -8
View File
@@ -147,7 +147,7 @@ void lcl_init(int lang_init)
if(ret == NULL){
Error(LOCATION, "Default language not found.");
}
}
strcpy_s(lang_string, ret);
@@ -267,7 +267,8 @@ void parse_stringstbl_common(const char *filename, const bool external)
}
if (external && (index < 0 || index >= LCL_MAX_STRINGS)) {
Error(LOCATION, "Invalid tstrings table index specified (%i). Please increment LCL_MAX_STRINGS in localize.cpp.", index);
error_display(0, "Invalid tstrings table index specified (%i). Please increment LCL_MAX_STRINGS in localize.cpp.", index);
return;
} else if (!external && (index < 0 || index >= XSTR_SIZE)) {
Error(LOCATION, "Invalid strings table index specified (%i)", index);
}
@@ -439,14 +440,16 @@ void lcl_xstr_init()
// free Xstr table
void lcl_xstr_close()
{
for (int i=0; i<XSTR_SIZE; i++){
int i;
for (i=0; i<XSTR_SIZE; i++){
if (Xstr_table[i].str != NULL) {
vm_free((void *) Xstr_table[i].str);
Xstr_table[i].str = NULL;
}
}
for (int i=0; i<LCL_MAX_STRINGS; i++){
for (i=0; i<LCL_MAX_STRINGS; i++){
if (Lcl_ext_str[i] != NULL) {
vm_free((void *) Lcl_ext_str[i]);
Lcl_ext_str[i] = NULL;
@@ -711,7 +714,7 @@ void lcl_ext_localize_sub(const char *in, char *out, size_t max_len, int *id)
}
// get the string if it exists
if (Lcl_ext_str[str_id] != NULL) {
if ((str_id < LCL_MAX_STRINGS) && (Lcl_ext_str[str_id] != NULL)) {
// copy to the outgoing string
if ( strlen(Lcl_ext_str[str_id]) > max_len )
error_display(0, "Token too long: [%s]. Length = %i. Max is %i.\n", Lcl_ext_str[str_id], strlen(Lcl_ext_str[str_id]), max_len);
@@ -723,6 +726,9 @@ void lcl_ext_localize_sub(const char *in, char *out, size_t max_len, int *id)
if ( strlen(text_str) > max_len )
error_display(0, "Token too long: [%s]. Length = %i. Max is %i.\n", text_str, strlen(text_str), max_len);
if (str_id >= LCL_MAX_STRINGS)
error_display(0, "Invalid XSTR ID: [%d]. (Must be less than %d.)\n", str_id, LCL_MAX_STRINGS);
strncpy(out, text_str, max_len);
}
@@ -792,13 +798,16 @@ void lcl_ext_localize_sub(const SCP_string &in, SCP_string &out, int *id)
return;
}
// attempt to find the string
if (Lcl_ext_str[str_id] != NULL) {
// get the string if it exists
if ((str_id < LCL_MAX_STRINGS) && (Lcl_ext_str[str_id] != NULL)) {
// copy to the outgoing string
out = Lcl_ext_str[str_id];
}
// otherwise use what we have - probably should Int3() or assert here
else {
if (str_id >= LCL_MAX_STRINGS)
error_display(0, "Invalid XSTR ID: [%d]. (Must be less than %d.)\n", str_id, LCL_MAX_STRINGS);
out = text_str;
}
@@ -1200,7 +1209,7 @@ void lcl_translate_brief_icon_name_gr(char *name)
} else if ((pos = strstr(name, "Transport")) != NULL) {
pos += 9; // strlen of "transport"
strcpy_s(buf, "Transporter");
strcpy_s(buf, "Transportowiec");
strcat_s(buf, pos);
strcpy(name, buf);
@@ -1539,3 +1548,64 @@ void lcl_translate_medal_name_gr(char *name)
strcpy(name, "SEK-Abzeichen ");
}
}
// this is just a hack to display translated names without actually changing the names,
// which would break stuff
// (this used to be in medals.cpp)
void lcl_translate_medal_name_pl(char *name)
{
if (!strcmp(name, "Epsilon Pegasi Liberation")) {
strcpy(name, "Order Wyzwolenia Epsilon Pegasi");
} else if (!strcmp(name, "Imperial Order of Vasuda")) {
strcpy(name, "Imperialny Order Vasudy");
} else if (!strcmp(name, "Distinguished Flying Cross")) {
strcpy(name, "Krzy\xBF Wybitnego Pilota");
} else if (!strcmp(name, "SOC Service Medallion")) {
strcpy(name, "Krzy\xBF S\xB3u\xBF\x62 Specjalnych");
} else if (!strcmp(name, "Intelligence Cross")) {
strcpy(name, "Krzy\xBF Wywiadu");
} else if (!strcmp(name, "Order of Galatea")) {
strcpy(name, "Order Galatei");
} else if (!strcmp(name, "Meritorious Unit Commendation")) {
strcpy(name, "Medal Pochwalny");
} else if (!strcmp(name, "Medal of Valor")) {
strcpy(name, "Medal za Odwag\xEA");
} else if (!strcmp(name, "GTVA Legion of Honor")) {
strcpy(name, "Legia Honorowa GTVA");
} else if (!strcmp(name, "Allied Defense Citation")) {
strcpy(name, "Order za Obron\xEA Sojuszu");
} else if (!strcmp(name, "Nebula Campaign Victory Star")) {
strcpy(name, "Gwiazda Wiktorii Kampanii w Mg\xB3\x61wicy");
} else if (!strcmp(name, "NTF Campaign Victory Star")) {
strcpy(name, "Gwiazda Wiktorii Kampanii NTF");
} else if (!strcmp(name, "Rank")) {
strcpy(name, "Ranga");
} else if (!strcmp(name, "Wings")) {
strcpy(name, "Skrzyd\xB3\x61");
} else if (!strcmp(name, "Ace")) {
strcpy(name, "As");
} else if (!strcmp(name, "Double Ace")) {
strcpy(name, "Podw\xF3jny As");
} else if (!strcmp(name, "Triple Ace")) {
strcpy(name, "Potr\xF3jny As");
} else if (!strcmp(name, "SOC Unit Crest")) {
strcpy(name, "Tarcza S\xB3u\xBF\x62 Specjalnych");
}
}
+1
View File
@@ -121,5 +121,6 @@ void lcl_translate_brief_icon_name_pl(char *name);
void lcl_translate_targetbox_name_gr(char *name);
void lcl_translate_targetbox_name_pl(char *name);
void lcl_translate_medal_name_gr(char *name);
void lcl_translate_medal_name_pl(char *name);
#endif // defined __FREESPACE2_LOCALIZATION_UTILITIES_HEADER_FILE
+1 -1
View File
@@ -40,7 +40,7 @@ float frand()
do {
i_rval = myrand();
} while (i_rval == RAND_MAX);
float rval = ((float) i_rval) / RAND_MAX;
float rval = i2fl(i_rval) * RAND_MAX_1f;
return rval;
}
+1
View File
@@ -29,6 +29,7 @@ float frand_range(float min, float max);
#define fl_abs(fl) fabsf(fl)
#define i2fl(i) ((float)(i))
#define fl2i(fl) ((int)(fl))
#define fl2ir(fl) ((int)(fl + ((fl < 0.0f) ? -0.5f : 0.5f)))
#define flceil(fl) (int)ceil(fl)
#define flfloor(fl) (int)floor(fl)
#define f2fl(fx) ((float)(fx)/65536.0f)
+76 -76
View File
@@ -325,8 +325,7 @@ int fvi_ray_sphere(vec3d *intp,vec3d *p0,vec3d *p1,vec3d *sphere_pos,float spher
*/
int fvi_ray_boundingbox( vec3d *min, vec3d *max, vec3d * p0, vec3d *pdir, vec3d *hitpt )
{
bool inside = true;
bool middle[3] = { true, true, true };
int middle = ((1<<0) | (1<<1) | (1<<2));
int i;
int which_plane;
float maxt[3];
@@ -335,48 +334,51 @@ int fvi_ray_boundingbox( vec3d *min, vec3d *max, vec3d * p0, vec3d *pdir, vec3d
for (i = 0; i < 3; i++) {
if (p0->a1d[i] < min->a1d[i]) {
candidate_plane[i] = min->a1d[i];
middle[i] = false;
inside = false;
middle &= ~(1<<i);
} else if (p0->a1d[i] > max->a1d[i]) {
candidate_plane[i] = max->a1d[i];
middle[i] = false;
inside = false;
middle &= ~(1<<i);
}
}
// ray origin inside bounding box
if ( inside ) {
// ray origin inside bounding box?
// (are all three bits still set?)
if (middle == ((1<<0) | (1<<1) | (1<<2))) {
*hitpt = *p0;
return 1;
}
// calculate T distances to candidate plane
for (i = 0; i < 3; i++) {
if ( !middle[i] && (pdir->a1d[i] != 0.0f) )
maxt[i] = (candidate_plane[i] - p0->a1d[i]) / pdir->a1d[i];
else
if ( (middle & (1<<i)) || (pdir->a1d[i] == 0.0f) ) {
maxt[i] = -1.0f;
} else {
maxt[i] = (candidate_plane[i] - p0->a1d[i]) / pdir->a1d[i];
}
}
// Get largest of the maxt's for final choice of intersection
which_plane = 0;
for (i = 1; i < 3; i++) {
if (maxt[which_plane] < maxt[i])
if (maxt[which_plane] < maxt[i]) {
which_plane = i;
}
}
// check final candidate actually inside box
if (maxt[which_plane] < 0.0f)
if (maxt[which_plane] < 0.0f) {
return 0;
}
for (i = 0; i < 3; i++) {
if (which_plane != i) {
hitpt->a1d[i] = p0->a1d[i] + maxt[which_plane] * pdir->a1d[i];
if ( (hitpt->a1d[i] < min->a1d[i]) || (hitpt->a1d[i] > max->a1d[i]) )
return 0;
} else {
if (which_plane == i) {
hitpt->a1d[i] = candidate_plane[i];
} else {
hitpt->a1d[i] = (maxt[which_plane] * pdir->a1d[i]) + p0->a1d[i];
if ( (hitpt->a1d[i] < min->a1d[i]) || (hitpt->a1d[i] > max->a1d[i]) ) {
return 0;
}
}
}
@@ -700,11 +702,18 @@ int fvi_polyedge_sphereline(vec3d *hit_point, vec3d *xs0, vec3d *vs, float Rs, i
vec3d ve; // edge velocity
float best_sphere_time; // earliest time sphere hits edge
vec3d delta_x;
float delta_x_dot_ve, delta_x_dot_vs, ve_dot_vs, ve_sqr, vs_sqr, delta_x_sqr, inv2A;
float delta_x_dot_ve, delta_x_dot_vs, ve_dot_vs, ve_sqr, vs_sqr, delta_x_sqr;
vec3d temp_edge_hit, temp_sphere_hit;
float t_sphere_hit = 0.0f;
float A, B, C, temp, discriminant, inv2A;
float root, root1, root2;
float Rs2 = (Rs * Rs);
float Rs_point2 = (0.2f * Rs);
best_sphere_time = FLT_MAX;
vs_sqr = vm_vec_mag_squared(vs);
for (i = 0; i < nv; i++) {
// Get vertices of edge to check
v0 = *verts[i];
@@ -726,23 +735,18 @@ int fvi_polyedge_sphereline(vec3d *hit_point, vec3d *xs0, vec3d *vs, float Rs, i
delta_x_sqr = vm_vec_mag_squared(&delta_x);
ve_dot_vs = vm_vec_dotprod(&ve, vs);
ve_sqr = vm_vec_mag_squared(&ve);
vs_sqr = vm_vec_mag_squared(vs);
float t_sphere_hit, temp;
// solve for sphere time
float A, B, C, root, discriminant;
float root1, root2;
A = ve_dot_vs*ve_dot_vs - ve_sqr*vs_sqr;
B = 2 * (delta_x_dot_ve*ve_dot_vs - delta_x_dot_vs*ve_sqr);
C = delta_x_dot_ve*delta_x_dot_ve + Rs*Rs*ve_sqr - delta_x_sqr*ve_sqr;
B = 2.0f * (delta_x_dot_ve*ve_dot_vs - delta_x_dot_vs*ve_sqr);
C = delta_x_dot_ve*delta_x_dot_ve + Rs2*ve_sqr - delta_x_sqr*ve_sqr;
discriminant = B*B - 4*A*C;
if (discriminant > 0) {
root = fl_sqrt(discriminant);
inv2A = 1.0f/(2*A);
root1 = (float) ((-B + root)*inv2A);
root2 = (float) ((-B - root)*inv2A);
discriminant = B*B - 4.0f*A*C;
if (discriminant > 0.0f) {
inv2A = 1.0f / (2.0f * A);
root = sqrt(discriminant);
root1 = (-B + root) * inv2A;
root2 = (-B - root) * inv2A;
// sort root1 and root2
if (root2 < root1) {
@@ -751,12 +755,11 @@ int fvi_polyedge_sphereline(vec3d *hit_point, vec3d *xs0, vec3d *vs, float Rs, i
root2 = temp;
}
if ( (root1 >= -0.05f) && (root1 < 0.0f) ) {
if ( (root1 < 0.0f) && (root1 >= -0.05f) )
root1 = 0.000001f;
}
// look only at first hit
if ( (root1 >= 0) && (root1 <= 1) ) {
if ( (root1 <= 1.0f) && (root1 >= 0.0f) ) {
t_sphere_hit = root1;
} else {
goto TryVertex;
@@ -771,40 +774,40 @@ int fvi_polyedge_sphereline(vec3d *hit_point, vec3d *xs0, vec3d *vs, float Rs, i
continue;
vm_vec_scale_add( &temp_sphere_hit, xs0, vs, t_sphere_hit );
float q;
// solve for edge time
A = ve_sqr * (ve_dot_vs*ve_dot_vs - ve_sqr*vs_sqr);
B = 2*ve_sqr * (delta_x_dot_ve*vs_sqr - delta_x_dot_vs*ve_dot_vs);
C = 2*delta_x_dot_ve*delta_x_dot_vs*ve_dot_vs + Rs*Rs*ve_dot_vs*ve_dot_vs
A *= ve_sqr;
B = 2.0f*ve_sqr * (delta_x_dot_ve*vs_sqr - delta_x_dot_vs*ve_dot_vs);
C = 2.0f*delta_x_dot_ve*delta_x_dot_vs*ve_dot_vs + Rs2*ve_dot_vs*ve_dot_vs
- delta_x_sqr*ve_dot_vs*ve_dot_vs - delta_x_dot_ve*delta_x_dot_ve*vs_sqr;
discriminant = B*B - 4*A*C;
discriminant = B*B - 4.0f*A*C;
inv2A = 1.0f / (2.0f * A);
// guard against nearly perpendicular sphere edge velocities
if ( (discriminant < 0) ) {
discriminant = 0;
}
if (discriminant < 0.0f)
root = 0.0f;
else
root = fl_sqrt(discriminant);
root = fl_sqrt(discriminant);
inv2A = 1.0f/(2*A);
root1 = (float) ((-B + root)*inv2A);
root2 = (float) ((-B - root)*inv2A);
root1 = (-B + root) * inv2A;
root2 = (-B - root) * inv2A;
// given sphere position, find which edge time (position) allows a valid solution
if ( (root1 >= 0) && (root1 <= 1) ) {
if ( (root1 <= 1.0f) && (root1 >= 0.0f) ) {
// try edge root1
vm_vec_scale_add( &temp_edge_hit, &v0, &ve, root1 );
q = vm_vec_dist_squared(&temp_edge_hit, &temp_sphere_hit);
if ( fl_abs(q - Rs*Rs) < 0.2*Rs ) { // error less than 0.1m absolute (2*delta*Radius)
float q = vm_vec_dist_squared(&temp_edge_hit, &temp_sphere_hit);
if ( fl_abs(q - Rs2) < Rs_point2 ) { // error less than 0.1m absolute (2*delta*Radius)
goto Hit;
}
}
if ( (root2 >= 0) && (root2 <= 1) ) {
if ( (root2 <= 1.0f) && (root2 >= 0.0f) ) {
// try edge root2
vm_vec_scale_add( &temp_edge_hit, &v0, &ve, root2 );
q = vm_vec_dist_squared(&temp_edge_hit, &temp_sphere_hit);
if ( fl_abs(q - Rs*Rs) < 0.2*Rs ) { // error less than 0.1m absolute
float q = vm_vec_dist_squared(&temp_edge_hit, &temp_sphere_hit);
if ( fl_abs(q - Rs2) < Rs_point2 ) { // error less than 0.1m absolute
goto Hit;
}
} else {
@@ -815,21 +818,21 @@ int fvi_polyedge_sphereline(vec3d *hit_point, vec3d *xs0, vec3d *vs, float Rs, i
TryVertex:
// try V0
A = vs_sqr;
B = 2*delta_x_dot_vs;
C = delta_x_sqr - Rs*Rs;
B = 2.0f*delta_x_dot_vs;
C = delta_x_sqr - Rs2;
int v0_hit;
float sphere_v0, sphere_v1;
v0_hit = 0;
sphere_v0 = UNINITIALIZED_VALUE;
sphere_v1 = UNINITIALIZED_VALUE;
v0_hit = 0;
discriminant = B*B - 4*A*C;
if (discriminant > 0) {
inv2A = 1.0f / (2.0f * A);
discriminant = B*B - 4.0f*A*C;
if (discriminant > 0.0f) {
root = fl_sqrt(discriminant);
inv2A = 1.0f/(2*A);
root1 = (float) ((-B + root)*inv2A);
root2 = (float) ((-B - root)*inv2A);
root1 = (-B + root) * inv2A;
root2 = (-B - root) * inv2A;
if (root1 > root2) {
temp = root1;
@@ -837,11 +840,10 @@ TryVertex:
root2 = temp;
}
// look only at the fist hit (ignore negative first hit)
if ( (root1 > 0) && (root1 < 1) ) {
// look only at the first hit (ignore negative first hit)
if ( (root1 < 1.0f) && (root1 > 0.0f) ) {
v0_hit = 1;
sphere_v0 = root1;
vm_vec_scale_add( &temp_sphere_hit, xs0, vs, root1 );
}
}
@@ -851,16 +853,15 @@ TryVertex:
delta_x_dot_vs = vm_vec_dotprod( &delta_x, vs );
int v1_hit;
B = 2*delta_x_dot_vs;
C = delta_x_sqr - Rs*Rs;
B = 2.0f*delta_x_dot_vs;
C = delta_x_sqr - Rs2;
v1_hit = 0;
discriminant = B*B - 4*A*C;
if (discriminant > 0) {
discriminant = B*B - 4.0f*A*C;
if (discriminant > 0.0f) {
root = fl_sqrt(discriminant);
inv2A = 1.0f/(2*A);
root1 = (float) ((-B + root)*inv2A);
root2 = (float) ((-B - root)*inv2A);
root1 = (-B + root) * inv2A;
root2 = (-B - root) * inv2A;
if (root1 > root2) {
temp = root1;
@@ -869,10 +870,9 @@ TryVertex:
}
// look only at the first hit (ignore negative first hit)
if ( (root1 > 0) && (root1 < 1) ) {
if ( (root1 < 1.0f) && (root1 > 0.0f) ) {
v1_hit = 1;
sphere_v1 = root1;
vm_vec_scale_add( &temp_sphere_hit, xs0, vs, root1 );
}
}
@@ -897,8 +897,8 @@ TryVertex:
continue;
}
vm_vec_scale_add( &temp_sphere_hit, xs0, vs, t_sphere_hit );
q = vm_vec_dist_squared(&temp_edge_hit, &temp_sphere_hit);
//vm_vec_scale_add( &temp_sphere_hit, xs0, vs, t_sphere_hit );
//q = vm_vec_dist_squared(&temp_edge_hit, &temp_sphere_hit);
Hit:
+57 -16
View File
@@ -321,26 +321,21 @@ float vm_vec_dot3(float x,float y,float z,vec3d *v)
//returns magnitude of a vector
float vm_vec_mag(vec3d *v)
{
float x,y,z,mag1, mag2;
x = v->xyz.x*v->xyz.x;
y = v->xyz.y*v->xyz.y;
z = v->xyz.z*v->xyz.z;
float mag1;
mag1 = x+y+z;
mag1 = (v->xyz.x * v->xyz.x) + (v->xyz.y * v->xyz.y) + (v->xyz.z * v->xyz.z);
mag2 = fl_sqrt(mag1);
return mag2;
if (mag1 <= 0.0f) {
return 0.0f;
}
return fl_sqrt(mag1);
}
//returns squared magnitude of a vector, useful if you want to compare distances
float vm_vec_mag_squared(vec3d *v)
{
float x,y,z,mag1;
x = v->xyz.x*v->xyz.x;
y = v->xyz.y*v->xyz.y;
z = v->xyz.z*v->xyz.z;
mag1 = x+y+z;
return mag1;
return ((v->xyz.x * v->xyz.x) + (v->xyz.y * v->xyz.y) + (v->xyz.z * v->xyz.z));
}
float vm_vec_dist_squared(vec3d *v0, vec3d *v1)
@@ -390,14 +385,20 @@ float vm_vec_mag_quick(vec3d *v)
c = v->xyz.z;
if (a < b) {
float temp=a; a=b; b=temp;
t = a;
a = b;
b = t;
}
if (b < c) {
float temp=b; b=c; c=temp;
t = b;
b = c;
c = t;
if (a < b) {
float temp2=a; a=b; b=temp2;
t = a;
a = b;
b = t;
}
}
@@ -1068,6 +1069,46 @@ angles *vm_extract_angles_matrix(angles *a,matrix *m)
return a;
}
// alternate method for extracting angles which seems to be
// less susceptible to rounding errors -- see section 8.7.2
// (pages 278-281) of 3D Math Primer for Graphics and Game
// Development, 2nd Edition
// http://books.google.com/books?id=X3hmuhBoFF0C&printsec=frontcover#v=onepage&q&f=false
angles *vm_extract_angles_matrix_alternate(angles *a, matrix *m)
{
Assert(a != NULL);
Assert(m != NULL);
// Extract pitch from m32, being careful for domain errors with
// asin(). We could have values slightly out of range due to
// floating point arithmetic.
float sp = -m->vec.fvec.xyz.y;
if (sp <= -1.0f) {
a->p = -PI_2; // -pi/2
} else if (sp >= 1.0f) {
a->p = PI_2; // pi/2
} else {
a->p = asin(sp);
}
// Check for the Gimbal lock case, giving a slight tolerance
// for numerical imprecision
if (fabs(sp) > 0.9999f) {
// We are looking straight up or down.
// Slam bank to zero and just set heading
a->b = 0.0f;
a->h = atan2(-m->vec.rvec.xyz.z, m->vec.rvec.xyz.x);
} else {
// Compute heading
a->h = atan2(m->vec.fvec.xyz.x, m->vec.fvec.xyz.z);
// Compute bank
a->b = atan2(m->vec.rvec.xyz.y, m->vec.uvec.xyz.y);
}
return a;
}
//extract heading and pitch from a vector, assuming bank==0
angles *vm_extract_angles_vector_normalized(angles *a,vec3d *v)
+1
View File
@@ -366,6 +366,7 @@ matrix *vm_matrix_x_matrix(matrix *dest,matrix *src0,matrix *src1);
//extract angles from a matrix
angles *vm_extract_angles_matrix(angles *a,matrix *m);
angles *vm_extract_angles_matrix_alternate(angles *a,matrix *m);
//extract heading and pitch from a vector, assuming bank==0
angles *vm_extract_angles_vector(angles *a,vec3d *v);
+17 -27
View File
@@ -35,9 +35,9 @@
char *fs2_open_credit_text =
"SOURCE CODE PROJECT STAFF:\n"
"\n"
"Project Leaders:\n"
"Project Leader:\n"
"\n"
"Cliff \"chief1983\" Gordon\n"
"Fabian \"The E\" Woltermann\n"
"\n"
"Senior Advisors:\n"
"\n"
@@ -45,6 +45,7 @@ char *fs2_open_credit_text =
"Michael \"Zacam\" LaFleur\n"
"Taylor Richards\n"
"Edward \"Inquisitor\" Gardner\n"
"Cliff \"chief1983\" Gordon\n"
"\n"
"Programmers:\n"
"\n"
@@ -52,19 +53,13 @@ char *fs2_open_credit_text =
"Derek \"Kazan\" Meek\n"
"Nick \"phreak\" Iannetta\n"
"Mike \"Bobboau\" Abegg\n"
"Backslash\n"
"Echelon9\n"
"Flaming_Sword\n"
"FUBAR\n"
"Iss Mneur\n"
"kkmic\n"
"Shade\n"
"Soulstorm\n"
"Sushi\n"
"Swifty\n"
"Wanderer\n"
"Fabian \"The E\" Woltermann\n"
"CommanderDJ\n"
"Backslash, Echelon9, Flaming_Sword\n"
"FUBAR, Iss Mneur, kkmic\n"
"Shade, Soulstorm, Sushi\n"
"Swifty, Wanderer, CommanderDJ\n"
"Valathil, MageKing17, Yarn\n"
"m!m, z64555, zookeeper\n"
"jg18, niffiwan\n"
"\n"
"\n"
"Readme Staff:\n"
@@ -650,10 +645,10 @@ void credits_close()
int i;
for (i=0; i<Credits_num_images; i++) {
if (Credits_bmps[i] >= 0) {
if (Credits_bmps[i] >= 0){
bm_release(Credits_bmps[i]);
}
}
}
Credits_bmps.clear();
credits_stop_music(true);
@@ -786,13 +781,7 @@ void credits_do_frame(float frametime)
gr_set_font(FONT1);
gr_set_color_fast(&Color_normal);
int sy; // The current position of the first text part
if ( Credit_position > 0 ) {
sy = fl2i(Credit_position+0.5f);
} else {
sy = fl2i(Credit_position-0.5f);
}
int y_offset = 0;
for (SCP_vector<SCP_string>::iterator iter = Credit_text_parts.begin(); iter != Credit_text_parts.end(); ++iter)
{
int height;
@@ -800,12 +789,13 @@ void credits_do_frame(float frametime)
gr_get_string_size(NULL, &height, iter->c_str(), iter->length());
// Check if the text part is actually visible
if (sy + height > 0)
if (Credit_position + y_offset + height > 0.0f)
{
gr_string(0x8000, sy, iter->c_str(), GR_RESIZE_MENU);
extern void gr_opengl_string(float sx, float sy, const char *s, int resize_mode);
gr_opengl_string((float)0x8000, Credit_position + y_offset, iter->c_str(), GR_RESIZE_MENU);
}
sy = sy + height;
y_offset += height;
}
int temp_time;
+203 -67
View File
@@ -45,6 +45,8 @@
#endif
// A reference to io/keycontrol.cpp
extern void game_process_cheats(int k);
// ----------------------------------------------------------------------------
// MAIN HALL DATA DEFINES
@@ -53,15 +55,18 @@
#define MISC_ANIM_MODE_HOLD 1 // play to the end and hold the animation
#define MISC_ANIM_MODE_TIMED 2 // uses timestamps to determine when a finished anim should be checked again
#define NUM_REGIONS 7 // (6 + 1 for multiplayer equivalent of campaign room)
#define MAIN_HALL_MAX_CHEAT_LEN 40 // cheat buffer length (also maximum cheat length)
SCP_vector< SCP_vector<main_hall_defines> > Main_hall_defines;
main_hall_defines *Main_hall = NULL;
static main_hall_defines *Main_hall = NULL;
static int Main_hall_music_index = -1;
int Vasudan_funny = 0;
int Vasudan_funny_plate = -1;
char Main_hall_campaign_cheat[512] = "";
SCP_string Main_hall_cheat = "";
// ----------------------------------------------------------------------------
// MISC interface data
@@ -133,7 +138,7 @@ void main_hall_handle_random_intercom_sounds();
SCP_vector<generic_anim> Main_hall_misc_anim;
// render all playing misc animations
void main_hall_render_misc_anims(float frametime);
void main_hall_render_misc_anims(float frametime, bool over_doors);
// ----------------------------------------------------------------------------
@@ -436,7 +441,7 @@ void main_hall_init(const SCP_string &main_hall_name)
}
// if we're switching to a different mainhall we may need to change music
if (main_hall_get_music_index(main_hall_get_index(main_hall_to_load)) != main_hall_get_music_index(main_hall_id())) {
if (main_hall_get_music_index(main_hall_get_index(main_hall_to_load)) != Main_hall_music_index) {
main_hall_stop_music(true);
}
@@ -444,20 +449,22 @@ void main_hall_init(const SCP_string &main_hall_name)
snazzy_menu_init();
// assign the proper main hall data
Assert(main_hall_get_pointer(main_hall_to_load) != NULL);
Main_hall = main_hall_get_pointer(main_hall_to_load);
Assertion(Main_hall != NULL, "Failed to obtain pointer to main hall '%s'; get a coder!\n", main_hall_to_load.c_str());
// check if we have to change the ready room's description
if (Player->flags & PLAYER_FLAGS_IS_MULTI) {
if(Main_hall->default_readyroom) {
if(Main_hall->default_readyroom) {
if (Player->flags & PLAYER_FLAGS_IS_MULTI) {
Main_hall->regions[2].description = XSTR( "Multiplayer - Start or join a multiplayer game", 359);
} else {
Main_hall->regions[2].description = XSTR( "Ready room - Start or continue a campaign", 355);
}
}
// Read the menu regions from mainhall.tbl
SCP_vector<main_hall_region>::iterator it;
for (it = Main_hall->regions.begin(); Main_hall->regions.end() != it; ++it) {
snazzy_menu_add_region(&Main_hall_region[it - Main_hall->regions.begin()], it->description.c_str(), it->mask, 0, -1);
snazzy_menu_add_region(&Main_hall_region[it - Main_hall->regions.begin()], it->description.c_str(), it->mask, it->key, -1);
}
// init tooltip shader // nearly black
@@ -595,8 +602,6 @@ void main_hall_init(const SCP_string &main_hall_name)
Main_hall_region_linger_stamp = -1;
strcpy_s(Main_hall_campaign_cheat, "");
// initialize door sound handles
Main_hall_door_sound_handles.clear();
for (idx = 0; idx < Main_hall->num_door_animations; idx++) {
@@ -685,8 +690,91 @@ void main_hall_do(float frametime)
code = snazzy_menu_do(Main_hall_mask_data, Main_hall_mask_w, Main_hall_mask_h, (int)Main_hall->regions.size(), Main_hall_region, &snazzy_action, 1, &key);
if (key) {
extern void game_process_cheats(int k);
game_process_cheats(key);
Main_hall_cheat += (char) key_to_ascii(key);
if(Main_hall_cheat.size() > MAIN_HALL_MAX_CHEAT_LEN) {
Main_hall_cheat = Main_hall_cheat.substr(Main_hall_cheat.size() - MAIN_HALL_MAX_CHEAT_LEN);
}
int cur_frame;
float anim_time;
bool cheat_anim_found, cheat_found = false;
for (int c_idx = 0; c_idx < (int) Main_hall->cheat.size(); c_idx++) {
cheat_anim_found = false;
if(Main_hall_cheat.find(Main_hall->cheat.at(c_idx)) != SCP_string::npos) {
cheat_found = true;
// switch animations
for (int idx = 0; idx < Main_hall->num_misc_animations; idx++) {
if (Main_hall->misc_anim_name.at(idx) == Main_hall->cheat_anim_from.at(c_idx)) {
Main_hall->misc_anim_name.at(idx) = Main_hall->cheat_anim_to.at(c_idx);
cur_frame = Main_hall_misc_anim.at(idx).current_frame;
anim_time = Main_hall_misc_anim.at(idx).anim_time;
generic_anim_unload(&Main_hall_misc_anim.at(idx));
generic_anim_init(&Main_hall_misc_anim.at(idx), Main_hall->misc_anim_name.at(idx));
if (generic_anim_stream(&Main_hall_misc_anim.at(idx)) == -1) {
nprintf(("General","WARNING! Could not load misc %s anim in main hall\n", Main_hall->misc_anim_name.at(idx).c_str()));
} else {
// start paused
if (Main_hall->misc_anim_modes.at(idx) == MISC_ANIM_MODE_HOLD)
Main_hall_misc_anim.at(idx).direction |= GENERIC_ANIM_DIRECTION_NOLOOP;
}
Main_hall_misc_anim.at(idx).current_frame = cur_frame;
Main_hall_misc_anim.at(idx).anim_time = anim_time;
// null out the delay timestamps
Main_hall->misc_anim_delay.at(idx).at(0) = -1;
cheat_anim_found = true;
break;
}
}
if (!cheat_anim_found) {
for (int idx = 0; idx < Main_hall->num_door_animations; idx++) {
if (Main_hall->door_anim_name.at(idx) == Main_hall->cheat_anim_from.at(c_idx)) {
Main_hall->door_anim_name.at(idx) = Main_hall->cheat_anim_to.at(c_idx);
cur_frame = Main_hall_door_anim.at(idx).current_frame;
anim_time = Main_hall_door_anim.at(idx).anim_time;
generic_anim_unload(&Main_hall_door_anim.at(idx));
generic_anim_init(&Main_hall_door_anim.at(idx), Main_hall->door_anim_name.at(idx));
if (generic_anim_stream(&Main_hall_door_anim.at(idx)) == -1) {
nprintf(("General","WARNING! Could not load door anim %s in main hall\n", Main_hall->door_anim_name.at(idx).c_str()));
} else {
Main_hall_door_anim.at(idx).direction = GENERIC_ANIM_DIRECTION_BACKWARDS | GENERIC_ANIM_DIRECTION_NOLOOP;
}
Main_hall_door_anim.at(idx).current_frame = cur_frame;
Main_hall_door_anim.at(idx).anim_time = anim_time;
cheat_anim_found = true;
break;
}
}
}
if (!cheat_anim_found) {
// Note: This can also happen if the cheat triggers a second time since the animations are already switched at that point.
nprintf(("General", "Could not find animation '%s' for cheat '%s'!", Main_hall->cheat_anim_from.at(c_idx).c_str(), Main_hall->cheat.at(c_idx).c_str()));
}
}
}
if(cheat_found) {
// Found a cheat, clear the buffer.
Main_hall_cheat = "";
}
}
switch(key) {
@@ -728,6 +816,11 @@ void main_hall_do(float frametime)
if (code == ESC_PRESSED) {
region_action = ESC_PRESSED;
} else {
if (code == -1) {
// User didn't click on a valid button, just ignore the event
break;
}
for (it = Main_hall->regions.begin(); Main_hall->regions.end() != it; ++it) {
if (it->mask == code) {
region_action = it->action;
@@ -759,11 +852,7 @@ void main_hall_do(float frametime)
Player->flags &= ~PLAYER_FLAGS_IS_MULTI;
Game_mode = GM_NORMAL;
if (strlen(Main_hall_campaign_cheat)) {
gameseq_post_event(GS_EVENT_CAMPAIGN_CHEAT);
} else {
gameseq_post_event(GS_EVENT_NEW_CAMPAIGN);
}
gameseq_post_event(GS_EVENT_NEW_CAMPAIGN);
gamesnd_play_iface(SND_IFACE_MOUSE_CLICK);
break;
@@ -845,7 +934,9 @@ void main_hall_do(float frametime)
// custom action
case SCRIPT_REGION:
const char *lua = it->lua_action.c_str();
Script_system.EvalString(lua, NULL, NULL, lua);
bool success = Script_system.EvalString(lua, NULL, NULL, lua);
if(!success)
Warning(LOCATION, "mainhall '+Door Action / $Script' failed to evaluate \"%s\"; check your syntax", lua);
break;
} // END switch (code)
@@ -873,11 +964,14 @@ void main_hall_do(float frametime)
}
// render misc animations
main_hall_render_misc_anims(frametime);
main_hall_render_misc_anims(frametime, false);
// render door animtions
main_hall_render_door_anims(frametime);
// render misc animations (over doors)
main_hall_render_misc_anims(frametime, true);
// blit any appropriate tooltips
main_hall_maybe_blit_tooltips();
@@ -1046,7 +1140,6 @@ int main_hall_get_music_index(int main_hall_num)
*/
void main_hall_start_music()
{
int index;
char *filename;
// start a looping ambient sound
@@ -1063,13 +1156,13 @@ void main_hall_start_music()
}
// get music
index = main_hall_get_music_index(main_hall_id());
if (index < 0) {
Main_hall_music_index = main_hall_get_music_index(main_hall_id());
if (Main_hall_music_index < 0) {
nprintf(("Warning", "No music file exists to play music at the main menu!\n"));
return;
}
filename = Spooled_music[index].filename;
filename = Spooled_music[Main_hall_music_index].filename;
Assert(filename != NULL);
// get handle
@@ -1098,7 +1191,7 @@ void main_hall_stop_music(bool fade)
*
* @param frametime Animation frame time
*/
void main_hall_render_misc_anims(float frametime)
void main_hall_render_misc_anims(float frametime, bool over_doors)
{
std::deque<bool> group_anims_weve_checked;
int idx, s_idx, jdx;
@@ -1109,7 +1202,7 @@ void main_hall_render_misc_anims(float frametime)
group_anims_weve_checked.push_back(false);
// render it
if (Main_hall_misc_anim.at(idx).num_frames > 0) {
if (Main_hall_misc_anim.at(idx).num_frames > 0 && Main_hall->misc_anim_over_doors.at(idx) == over_doors) {
// animation is paused
if (Main_hall->misc_anim_paused.at(idx)) {
// if the timestamp is -1, then regenerate it
@@ -1461,7 +1554,7 @@ void main_hall_handle_random_intercom_sounds()
// if we have no timestamp for the next random sound, then set on
if ( (Main_hall_next_intercom_sound_stamp == -1) && (Main_hall_intercom_sound_handle == -1) ) {
Main_hall_next_intercom_sound_stamp = timestamp((int)(((float)rand()/(float)RAND_MAX) *
Main_hall_next_intercom_sound_stamp = timestamp((int)((rand() * RAND_MAX_1f) *
(float)(Main_hall->intercom_delay.at(Main_hall_next_intercom_sound).at(1)
- Main_hall->intercom_delay.at(Main_hall_next_intercom_sound).at(0))) );
}
@@ -1500,7 +1593,7 @@ void main_hall_handle_random_intercom_sounds()
}
// set the timestamp
Main_hall_next_intercom_sound_stamp = timestamp((int)(((float)rand()/(float)RAND_MAX) *
Main_hall_next_intercom_sound_stamp = timestamp((int)((rand() * RAND_MAX_1f) *
(float)(Main_hall->intercom_delay.at(Main_hall_next_intercom_sound).at(1)
- Main_hall->intercom_delay.at(Main_hall_next_intercom_sound).at(0))) );
@@ -1947,15 +2040,16 @@ void region_info_init(main_hall_defines &m)
}
main_hall_region defaults[] = {
{0, XSTR( "Exit FreeSpace 2", 353), EXIT_REGION, ""},
{1, XSTR( "Barracks - Manage your FreeSpace 2 pilots", 354), BARRACKS_REGION, ""},
{2, XSTR( "Ready room - Start or continue a campaign", 355), START_REGION, ""},
{3, XSTR( "Tech room - View specifications of FreeSpace 2 ships and weaponry", 356), TECH_ROOM_REGION, ""},
{4, XSTR( "Options - Change your FreeSpace 2 options", 357), OPTIONS_REGION, ""},
{5, XSTR( "Campaign Room - View all available campaigns", 358), CAMPAIGN_ROOM_REGION, ""}
main_hall_region(0, 0, XSTR( "Exit FreeSpace 2", 353), EXIT_REGION, ""),
main_hall_region(1, 'B', XSTR( "Barracks - Manage your FreeSpace 2 pilots", 354), BARRACKS_REGION, ""),
main_hall_region(2, 'R', XSTR( "Ready room - Start or continue a campaign", 355), START_REGION, ""),
main_hall_region(3, 'T', XSTR( "Tech room - View specifications of FreeSpace 2 ships and weaponry", 356), TECH_ROOM_REGION, ""),
main_hall_region(4, 0, XSTR( "Options - Change your FreeSpace 2 options", 357), OPTIONS_REGION, ""),
main_hall_region(5, 'C', XSTR( "Campaign Room - View all available campaigns", 358), CAMPAIGN_ROOM_REGION, ""),
main_hall_region(6, 'G', "Quick start", QUICK_START_REGION, "")
};
for (int idx = 0; idx < 6; idx++) {
for (int idx = 0; idx < 7; idx++) {
m.regions.push_back(defaults[idx]);
}
@@ -2052,6 +2146,26 @@ void parse_main_hall_table(const char* filename)
m->name = Main_hall_defines.at(count).at(0).name;
}
// add cheats
while (optional_string("+Cheat String:")) {
stuff_string(temp_scp_string, F_RAW);
m->cheat.push_back(temp_scp_string);
if(temp_scp_string.size() > MAIN_HALL_MAX_CHEAT_LEN) {
// Since the value is longer than the cheat buffer it will never match.
Warning(LOCATION, "The value '%s' for '+Cheat String:' is too long! It can be at most %d characters long.", temp_scp_string.size(), MAIN_HALL_MAX_CHEAT_LEN);
}
required_string("+Anim To Change:");
stuff_string(temp_scp_string, F_NAME);
m->cheat_anim_from.push_back(temp_scp_string);
required_string("+Anim To Change To:");
stuff_string(temp_scp_string, F_NAME);
m->cheat_anim_to.push_back(temp_scp_string);
}
// minimum resolution
if (optional_string("+Min Resolution:")) {
stuff_int(&m->min_width);
@@ -2221,8 +2335,54 @@ void parse_main_hall_table(const char* filename)
}
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// render over doors - default to false
if (optional_string("+Misc anim over doors:")) {
bool temp_b;
stuff_boolean(&temp_b);
m->misc_anim_over_doors.push_back(temp_b);
} else {
m->misc_anim_over_doors.push_back(0);
}
}
region_info_init(*m);
// door animations
required_string("+Num Door Animations:");
stuff_int(&m->num_door_animations);
// initialise the door anim vectors
door_anim_init(*m);
for (idx = 0; idx < m->num_door_animations; idx++) {
// door name
required_string("+Door anim:");
stuff_string(temp_string, F_NAME, MAX_FILENAME_LEN);
m->door_anim_name.at(idx) = (SCP_string)temp_string;
}
for (idx = 0; idx < m->num_door_animations; idx++) {
// door coords
required_string("+Door coords:");
stuff_int(&m->door_anim_coords.at(idx).at(0));
stuff_int(&m->door_anim_coords.at(idx).at(1));
stuff_int(&m->door_anim_coords.at(idx).at(2));
stuff_int(&m->door_anim_coords.at(idx).at(3));
}
for (idx = 0; idx < m->num_door_animations; idx++) {
// door open and close sounds
parse_sound_list("+Door sounds:", m->door_sounds.at(idx), "+Door sounds:", (parse_sound_flags)(PARSE_SOUND_INTERFACE_SOUND | PARSE_SOUND_SCP_SOUND_LIST));
}
for (idx = 0; idx < m->num_door_animations; idx++) {
// door pan value
required_string("+Door pan:");
stuff_float(&m->door_sound_pan[idx]);
}
int mask;
for (idx = 0; optional_string("+Door mask value:"); idx++) {
// door mask
@@ -2274,6 +2434,16 @@ void parse_main_hall_table(const char* filename)
}
}
for (idx = 0; optional_string("+Door key:"); idx++) {
// door key
stuff_string(temp_string, F_RAW, MAX_FILENAME_LEN);
if ((int) m->regions.size() <= idx) {
m->regions.resize(idx + 1);
}
m->regions[idx].key = temp_string[0];
}
for (idx = 0; optional_string("+Door description:"); idx++) {
// region description (tooltip)
stuff_string(temp_scp_string, F_MESSAGE);
@@ -2291,40 +2461,6 @@ void parse_main_hall_table(const char* filename)
}
}
// door animations
required_string("+Num Door Animations:");
stuff_int(&m->num_door_animations);
// initialise the door anim vectors
door_anim_init(*m);
for (idx = 0; idx < m->num_door_animations; idx++) {
// door name
required_string("+Door anim:");
stuff_string(temp_string, F_NAME, MAX_FILENAME_LEN);
m->door_anim_name.at(idx) = (SCP_string)temp_string;
}
for (idx = 0; idx < m->num_door_animations; idx++) {
// door coords
required_string("+Door coords:");
stuff_int(&m->door_anim_coords.at(idx).at(0));
stuff_int(&m->door_anim_coords.at(idx).at(1));
stuff_int(&m->door_anim_coords.at(idx).at(2));
stuff_int(&m->door_anim_coords.at(idx).at(3));
}
for (idx = 0; idx < m->num_door_animations; idx++) {
// door open and close sounds
parse_sound_list("+Door sounds:", m->door_sounds.at(idx), "+Door sounds:", (parse_sound_flags)(PARSE_SOUND_INTERFACE_SOUND | PARSE_SOUND_SCP_SOUND_LIST));
}
for (idx = 0; idx < m->num_door_animations; idx++) {
// door pan value
required_string("+Door pan:");
stuff_float(&m->door_sound_pan[idx]);
}
// font for tooltips and other text
if (optional_string("+Font:")) {
stuff_int(&m->font);
+24 -4
View File
@@ -16,17 +16,34 @@
// CommanderDJ - this is now dynamic
// #define MAIN_HALLS_MAX 10
typedef struct main_hall_region {
class main_hall_region
{
public:
int mask;
char key;
SCP_string description;
int action;
SCP_string lua_action;
} main_hall_region;
typedef struct main_hall_defines {
main_hall_region(int _mask, char _key, const SCP_string &_description, int _action, const SCP_string &_lua_action)
: mask(_mask), key(_key), description(_description), action(_action), lua_action(_lua_action)
{}
main_hall_region()
: mask(0), key(0), description(), action(0), lua_action()
{}
};
class main_hall_defines
{
public:
// mainhall name identifier
SCP_string name;
SCP_vector<SCP_string> cheat;
SCP_vector<SCP_string> cheat_anim_from;
SCP_vector<SCP_string> cheat_anim_to;
// minimum resolution and aspect ratio needed to display this main hall
int min_width;
int min_height;
@@ -98,6 +115,9 @@ typedef struct main_hall_defines {
//flags for each of the misc anim sounds
SCP_vector<SCP_vector<int> > misc_anim_sound_flag;
// controls the render order
SCP_vector<bool> misc_anim_over_doors;
// door animations --------------------
@@ -133,7 +153,7 @@ typedef struct main_hall_defines {
// y coord of where to draw tooltip text
int region_yval;
} main_hall_defines;
};
extern SCP_vector< SCP_vector<main_hall_defines> > Main_hall_defines;
Loaded 100 of 327 files, more files were not shown because too many files have changed in this diff. Show more