mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-07 22:56:30 -10:00
Compare commits
210
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
322a152476 | ||
|
|
c72a062a84 | ||
|
|
422753976f | ||
|
|
374383bacb | ||
|
|
adfce4ec60 | ||
|
|
08faf52871 | ||
|
|
d99121cd52 | ||
|
|
6ff292a43c | ||
|
|
09f4f63be4 | ||
|
|
2d67fd3ef8 | ||
|
|
5666eb5014 | ||
|
|
8542e9e113 | ||
|
|
699c9e8d52 | ||
|
|
5b45a89287 | ||
|
|
741fc311cd | ||
|
|
aaa9c779c0 | ||
|
|
bfae614189 | ||
|
|
cb956961f6 | ||
|
|
6d2ebd1ed7 | ||
|
|
d7e6187ba8 | ||
|
|
62f6ee86ef | ||
|
|
56ae91c973 | ||
|
|
dfc8cbd1c9 | ||
|
|
77e61af23c | ||
|
|
7b80b0c564 | ||
|
|
a98d3bb064 | ||
|
|
741ee07249 | ||
|
|
04cefad927 | ||
|
|
3d68476505 | ||
|
|
81c63929b5 | ||
|
|
d6d03fbb14 | ||
|
|
9acd25bc28 | ||
|
|
7e00a8b10f | ||
|
|
bb0df2dc43 | ||
|
|
38f858198b | ||
|
|
a83307402a | ||
|
|
097148c2c2 | ||
|
|
fbf8a931c4 | ||
|
|
32d951b27a | ||
|
|
630e6c3e96 | ||
|
|
72ed33502b | ||
|
|
d3806b2107 | ||
|
|
c9a481f4f3 | ||
|
|
0a02f677fe | ||
|
|
d55e4343f9 | ||
|
|
e902934e89 | ||
|
|
26395f7c12 | ||
|
|
de92fe25e3 | ||
|
|
c72fa0917b | ||
|
|
bc0f47269d | ||
|
|
94469dc43f | ||
|
|
ce335dbcc2 | ||
|
|
6660d21f7e | ||
|
|
e622d81e89 | ||
|
|
10c8e16cda | ||
|
|
25029bfdf1 | ||
|
|
2255616ed5 | ||
|
|
62ab705d75 | ||
|
|
77fc335580 | ||
|
|
981b01eea2 | ||
|
|
366dc3749c | ||
|
|
e693367dd0 | ||
|
|
da53960003 | ||
|
|
687c1ba4f7 | ||
|
|
d901470880 | ||
|
|
7e74153a3d | ||
|
|
6cf75b77dc | ||
|
|
3ec0a9c35e | ||
|
|
519f60a63b | ||
|
|
252da89782 | ||
|
|
0f1b3fd6c2 | ||
|
|
58722425a3 | ||
|
|
211110d415 | ||
|
|
61a8aa5592 | ||
|
|
0692286bba | ||
|
|
72dae916a9 | ||
|
|
189ad9f694 | ||
|
|
b9f9fa0f73 | ||
|
|
dc7e88c888 | ||
|
|
b5dae2a56e | ||
|
|
969bfd0bdd | ||
|
|
63e8ae53c5 | ||
|
|
d57aaac8e4 | ||
|
|
ab981bd415 | ||
|
|
df7c91f3e7 | ||
|
|
ee73694cc8 | ||
|
|
65dcfe0a7c | ||
|
|
ae8f8baade | ||
|
|
86fcdb1502 | ||
|
|
b71fc4595c | ||
|
|
471402ec5d | ||
|
|
97fdca6b52 | ||
|
|
b50833e6fb | ||
|
|
4429cbb21c | ||
|
|
4a6d8573a0 | ||
|
|
2c6039759c | ||
|
|
f3a0d56a85 | ||
|
|
243aac1667 | ||
|
|
19fbe05cee | ||
|
|
e581a3b8a3 | ||
|
|
67a2d99a9b | ||
|
|
569f1ee237 | ||
|
|
e9a8b9d8a2 | ||
|
|
0efb98d4a9 | ||
|
|
ec99bf9c03 | ||
|
|
bd6ff021fd | ||
|
|
69213c3338 | ||
|
|
0bffac7615 | ||
|
|
ba089bd95e | ||
|
|
0a1519284f | ||
|
|
877a138192 | ||
|
|
8a34ceef91 | ||
|
|
d638cacc51 | ||
|
|
871317b5bd | ||
|
|
9b7a87d4c5 | ||
|
|
3b07636a16 | ||
|
|
8840d238d7 | ||
|
|
95128dd734 | ||
|
|
30866afbd6 | ||
|
|
2b43677c82 | ||
|
|
94a542a2a3 | ||
|
|
5c064afd95 | ||
|
|
6ee41c06d8 | ||
|
|
58fa411ad3 | ||
|
|
08c2449672 | ||
|
|
726af82c56 | ||
|
|
c11dce4a92 | ||
|
|
0121eb6123 | ||
|
|
8a325362f6 | ||
|
|
4eb0e41142 | ||
|
|
5528e4e42d | ||
|
|
968695f851 | ||
|
|
8f00c6e842 | ||
|
|
8a9edb1215 | ||
|
|
1c9e47ad3d | ||
|
|
74fd3c0637 | ||
|
|
fe0f0558c2 | ||
|
|
11ded47bd5 | ||
|
|
f8801446db | ||
|
|
7492615a31 | ||
|
|
53cfc1eae4 | ||
|
|
252facb6c4 | ||
|
|
65417be571 | ||
|
|
0da41b3943 | ||
|
|
97f9a6c91b | ||
|
|
10cd82456d | ||
|
|
7878ba0d19 | ||
|
|
a6879a1b40 | ||
|
|
cf7706eb1c | ||
|
|
09ed127d06 | ||
|
|
77c3c79143 | ||
|
|
62b74b8743 | ||
|
|
4d99a3b8b3 | ||
|
|
3a9a840633 | ||
|
|
86f67c3c84 | ||
|
|
28bb3bf914 | ||
|
|
bd4b116188 | ||
|
|
0a429e8a32 | ||
|
|
f70253e219 | ||
|
|
e901e44418 | ||
|
|
651268eeea | ||
|
|
9b7c32d0c1 | ||
|
|
d014e53505 | ||
|
|
00b0a80ad9 | ||
|
|
4a7109e1d5 | ||
|
|
1484ddbe77 | ||
|
|
48b03a1789 | ||
|
|
e790cf209a | ||
|
|
1eea298fe1 | ||
|
|
1de63cc881 | ||
|
|
c7be4734d3 | ||
|
|
fbc2a2dab2 | ||
|
|
e5be2372e1 | ||
|
|
9c69e11fe5 | ||
|
|
0173f44070 | ||
|
|
45559c13a9 | ||
|
|
34888cb1a6 | ||
|
|
b77b425f2f | ||
|
|
49b5c10295 | ||
|
|
0396d5670b | ||
|
|
bb6c00a516 | ||
|
|
4d0703ad98 | ||
|
|
27e91d8f6c | ||
|
|
3c4ab2eef1 | ||
|
|
4e7f29ea88 | ||
|
|
793a3d8dd3 | ||
|
|
49abb88385 | ||
|
|
4c2ed1501e | ||
|
|
6b425c1e6b | ||
|
|
978a58dba2 | ||
|
|
3de05aefef | ||
|
|
da951e8be4 | ||
|
|
483a6096bb | ||
|
|
0ac810e7f0 | ||
|
|
0de1e55fb7 | ||
|
|
3827bb9783 | ||
|
|
69013f1d41 | ||
|
|
3ac7864ac6 | ||
|
|
35a654660f | ||
|
|
f975edd343 | ||
|
|
9219712ff0 | ||
|
|
ead6cd9825 | ||
|
|
a32c5dad27 | ||
|
|
34d4ed5dba | ||
|
|
eb012584d6 | ||
|
|
7cadce113d | ||
|
|
15dc45cc0a | ||
|
|
3c41b56449 | ||
|
|
c667668c17 | ||
|
|
8d4643bc7a |
No files matched your search
@@ -47,6 +47,7 @@ Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: '^(<.*\.(h|hh|hpp)>)$' # Includes of external libraries
|
||||
Priority: 4
|
||||
|
||||
+2
-2
@@ -9,11 +9,11 @@ environment:
|
||||
- BuildID: 0
|
||||
CMAKE_GENERATOR: Visual Studio 14 2015
|
||||
PlatformToolset: v140_xp
|
||||
QT_DIR: C:\Qt\5.9.5\msvc2015
|
||||
QT_DIR: C:\Qt\5.9\msvc2015
|
||||
- BuildID: 1
|
||||
CMAKE_GENERATOR: Visual Studio 14 2015 Win64
|
||||
PlatformToolset: v140_xp
|
||||
QT_DIR: C:\Qt\5.9.5\msvc2015_64
|
||||
QT_DIR: C:\Qt\5.9\msvc2015_64
|
||||
before_build:
|
||||
- git submodule update --init --recursive
|
||||
build_script:
|
||||
|
||||
@@ -14,7 +14,7 @@ $NightlyConfigurations = @(
|
||||
PackageType="Win64";
|
||||
Toolset="v140_xp";
|
||||
SimdType="SSE2";
|
||||
QtDir="C:\Qt\5.9.5\msvc2015_64";
|
||||
QtDir="C:\Qt\5.9\msvc2015_64";
|
||||
SourcePackage=$false;
|
||||
},
|
||||
[BuildConfig]@{
|
||||
@@ -22,7 +22,7 @@ $NightlyConfigurations = @(
|
||||
PackageType="Win32";
|
||||
Toolset="v140_xp";
|
||||
SimdType="SSE2";
|
||||
QtDir="C:\Qt\5.9.5\msvc2015";
|
||||
QtDir="C:\Qt\5.9\msvc2015";
|
||||
SourcePackage=$false;
|
||||
}
|
||||
)
|
||||
@@ -32,7 +32,7 @@ $ReleaseConfigurations = @(
|
||||
PackageType="Win32";
|
||||
Toolset="v140_xp";
|
||||
SimdType="SSE2";
|
||||
QtDir="C:\Qt\5.9.5\msvc2015";
|
||||
QtDir="C:\Qt\5.9\msvc2015";
|
||||
SourcePackage=$true;
|
||||
}
|
||||
[BuildConfig]@{
|
||||
@@ -40,7 +40,7 @@ $ReleaseConfigurations = @(
|
||||
PackageType="Win32-AVX";
|
||||
Toolset="v140_xp";
|
||||
SimdType="AVX";
|
||||
QtDir="C:\Qt\5.9.5\msvc2015";
|
||||
QtDir="C:\Qt\5.9\msvc2015";
|
||||
SourcePackage=$false;
|
||||
}
|
||||
[BuildConfig]@{
|
||||
@@ -48,7 +48,7 @@ $ReleaseConfigurations = @(
|
||||
PackageType="Win64";
|
||||
Toolset="v140_xp";
|
||||
SimdType="SSE2";
|
||||
QtDir="C:\Qt\5.9.5\msvc2015_64";
|
||||
QtDir="C:\Qt\5.9\msvc2015_64";
|
||||
SourcePackage=$false;
|
||||
}
|
||||
[BuildConfig]@{
|
||||
@@ -56,7 +56,7 @@ $ReleaseConfigurations = @(
|
||||
PackageType="Win64-AVX";
|
||||
Toolset="v140_xp";
|
||||
SimdType="AVX";
|
||||
QtDir="C:\Qt\5.9.5\msvc2015_64";
|
||||
QtDir="C:\Qt\5.9\msvc2015_64";
|
||||
SourcePackage=$false;
|
||||
}
|
||||
)
|
||||
|
||||
@@ -9,8 +9,6 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -funroll-loops -fsigned-char -Wno-
|
||||
# Omit "conversion from string literal to 'char *' is deprecated" warnings.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-char-subscripts")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
|
||||
|
||||
@@ -66,8 +66,6 @@ set(COMPILER_FLAGS "${COMPILER_FLAGS} ${SANITIZE_FLAGS}")
|
||||
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wformat-security")
|
||||
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-unused-function")
|
||||
|
||||
# Dear Clang, please tell us if a function does not return a value since that part of the standard is stupid!
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wreturn-type")
|
||||
|
||||
|
||||
@@ -78,8 +78,6 @@ set(COMPILER_FLAGS "${COMPILER_FLAGS} ${SANITIZE_FLAGS}")
|
||||
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wformat-security")
|
||||
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-unused-function")
|
||||
|
||||
# Dear GCC, please tell us if a function does not return a value since that part of the standard is stupid!
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wreturn-type")
|
||||
|
||||
|
||||
@@ -587,13 +587,10 @@ extern void get_absolute_wing_pos_autopilot( vec3d *result_pos, object *leader_o
|
||||
|
||||
// Interface from goals code to AI. Set ship to guard. *objp guards *other_objp
|
||||
extern void ai_set_guard_object(object *objp, object *other_objp);
|
||||
extern void ai_set_evade_object(object *objp, object *other_objp);
|
||||
extern void ai_set_guard_wing(object *objp, int wingnum);
|
||||
extern void ai_warp_out(object *objp, vec3d *vp);
|
||||
extern void ai_attack_wing(object *attacker, int wingnum);
|
||||
extern void ai_deathroll_start(object *ship_obj);
|
||||
extern void ai_fly_in_formation(int wing_num); // Force wing to fly in formation.
|
||||
extern void ai_disband_formation(int wing_num); // Force wing to disband formation flying.
|
||||
extern int set_target_objnum(ai_info *aip, int objnum);
|
||||
extern void ai_form_on_wing(object *objp, object *goal_objp);
|
||||
extern void ai_do_stay_near(object *objp, object *other_obj, float dist);
|
||||
@@ -646,8 +643,6 @@ extern void ai_do_objects_repairing_stuff( object *repaired_obj, object *repair_
|
||||
// Move to a position relative to a dock bay using thrusters.
|
||||
extern float dock_orient_and_approach(object *docker_objp, int docker_index, object *dockee_objp, int dockee_index, int dock_mode, rotating_dockpoint_info *rdinfo = NULL);
|
||||
|
||||
extern int find_danger_weapon(object *sobjp, float dtime, float *atime, float dot_threshhold);
|
||||
|
||||
void ai_set_mode_warp_out(object *objp, ai_info *aip);
|
||||
|
||||
// prototyped by Goober5000
|
||||
|
||||
@@ -110,6 +110,7 @@ namespace AI {
|
||||
Smart_shield_management,
|
||||
Smart_subsystem_targeting_for_turrets,
|
||||
Strict_turred_tagged_only_targeting,
|
||||
Support_dont_add_primaries, //Prevents support ship from equipping new primary as requested in http://scp.indiegames.us/mantis/view.php?id=3198
|
||||
Turrets_ignore_target_radius,
|
||||
Use_actual_primary_range,
|
||||
Use_additive_weapon_velocity,
|
||||
|
||||
@@ -435,6 +435,8 @@ void parse_ai_profiles_tbl(const char *filename)
|
||||
|
||||
set_flag(profile, "$ai guards specific ship in wing:", AI::Profile_Flags::Ai_guards_specific_ship_in_wing);
|
||||
|
||||
set_flag(profile, "$support don't add primaries:", AI::Profile_Flags::Support_dont_add_primaries);
|
||||
|
||||
profile->ai_path_mode = AI_PATH_MODE_NORMAL;
|
||||
if (optional_string("$ai path mode:"))
|
||||
{
|
||||
|
||||
+2
-75
@@ -7478,32 +7478,6 @@ void ai_set_guard_wing(object *objp, int wingnum)
|
||||
}
|
||||
}
|
||||
|
||||
// Make object *objp guard object *other_objp.
|
||||
// To be called from the goals code.
|
||||
void ai_set_evade_object(object *objp, object *other_objp)
|
||||
{
|
||||
ship *shipp;
|
||||
ai_info *aip;
|
||||
int other_objnum;
|
||||
|
||||
Assert(objp->type == OBJ_SHIP);
|
||||
Assert(objp->instance >= 0);
|
||||
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
Assert(shipp->ai_index >= 0);
|
||||
|
||||
aip = &Ai_info[shipp->ai_index];
|
||||
|
||||
other_objnum = OBJ_INDEX(other_objp);
|
||||
Assert(other_objnum >= 0);
|
||||
|
||||
Assert(other_objnum != Ships[aip->shipnum].objnum); // make sure not targeting self
|
||||
aip->target_objnum = other_objnum;
|
||||
|
||||
aip->mode = AIM_EVADE;
|
||||
}
|
||||
|
||||
// Make objp guard other_objp
|
||||
// If other_objp is a member of a wing, objp will guard that whole wing
|
||||
// UNLESS objp is also a member of the wing!
|
||||
@@ -11538,53 +11512,6 @@ void render_wing_phantoms_all()
|
||||
|
||||
#endif
|
||||
|
||||
// Hook from goals code to AI.
|
||||
// Force a wing to fly in formation.
|
||||
// Sets AIF_FORMATION bit in ai_flags.
|
||||
// wingnum Wing to force to fly in formation
|
||||
void ai_fly_in_formation(int wingnum)
|
||||
{
|
||||
object *objp;
|
||||
ship *shipp;
|
||||
ship_obj *so;
|
||||
|
||||
for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
|
||||
objp = &Objects[so->objnum];
|
||||
Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS));
|
||||
|
||||
shipp = &Ships[objp->instance];
|
||||
Assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO));
|
||||
|
||||
if (Ai_info[shipp->ai_index].wing == wingnum) {
|
||||
Ai_info[shipp->ai_index].ai_flags.set(AI::AI_Flags::Formation_wing);
|
||||
Ai_info[shipp->ai_index].ai_flags.remove(AI::AI_Flags::Formation_object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hook from goals code to AI.
|
||||
// Force a wing to abandon formation flying.
|
||||
// Clears AIF_FORMATION bit in ai_flags.
|
||||
// wingnum Wing to force to fly in formation
|
||||
void ai_disband_formation(int wingnum)
|
||||
{
|
||||
object *objp;
|
||||
ship *shipp;
|
||||
ship_obj *so;
|
||||
|
||||
for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
|
||||
objp = &Objects[so->objnum];
|
||||
Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS));
|
||||
|
||||
shipp = &Ships[objp->instance];
|
||||
Assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO));
|
||||
|
||||
if (Ai_info[shipp->ai_index].wing == wingnum) {
|
||||
Ai_info[shipp->ai_index].ai_flags.remove(AI::AI_Flags::Formation_wing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float Leader_chaos = 0.0f;
|
||||
int Chaos_frame = -1;
|
||||
|
||||
@@ -13359,7 +13286,7 @@ void ai_warp_out(object *objp)
|
||||
case AIS_WARP_2: // Make sure won't collide with any object.
|
||||
if (timestamp_elapsed(aip->force_warp_time)
|
||||
|| (!collide_predict_large_ship(objp, objp->radius*2.0f + 100.0f)
|
||||
|| (Ship_info[shipp->ship_info_index].warpout_type == WT_HYPERSPACE
|
||||
|| (Warp_params[shipp->warpout_params_index].warp_type == WT_HYPERSPACE
|
||||
&& !collide_predict_large_ship(objp, 100000.0f)))) {
|
||||
aip->submode = AIS_WARP_3;
|
||||
aip->submode_start_time = Missiontime;
|
||||
@@ -13402,7 +13329,7 @@ void ai_warp_out(object *objp)
|
||||
break;
|
||||
case AIS_WARP_4: {
|
||||
// Only lets the ship warp after waiting for the warpout engage time
|
||||
if ( (Missiontime / 100) >= (aip->submode_start_time / 100 + Ship_info[shipp->ship_info_index].warpout_engage_time) ) {
|
||||
if ( (Missiontime / 100) >= (aip->submode_start_time / 100 + Warp_params[shipp->warpout_params_index].warpout_engage_time) ) {
|
||||
shipfx_warpout_start(objp);
|
||||
aip->submode = AIS_WARP_5;
|
||||
aip->submode_start_time = Missiontime;
|
||||
|
||||
+48
-47
@@ -62,31 +62,32 @@ char Ai_dock_names[MAX_AI_DOCK_NAMES][NAME_LENGTH];
|
||||
// Used in objecttypes.tbl to define custom ship types
|
||||
ai_goal_list Ai_goal_names[] =
|
||||
{
|
||||
{ "Attack ship", AI_GOAL_CHASE, 0 },
|
||||
{ "Dock", AI_GOAL_DOCK, 0 },
|
||||
{ "Waypoints", AI_GOAL_WAYPOINTS, 0 },
|
||||
{ "Waypoints once", AI_GOAL_WAYPOINTS_ONCE, 0 },
|
||||
{ "Depart", AI_GOAL_WARP, 0 },
|
||||
{ "Attack subsys", AI_GOAL_DESTROY_SUBSYSTEM, 0 },
|
||||
{ "Form on wing", AI_GOAL_FORM_ON_WING, 0 },
|
||||
{ "Undock", AI_GOAL_UNDOCK, 0 },
|
||||
{ "Attack wing", AI_GOAL_CHASE_WING, 0 },
|
||||
{ "Guard ship", AI_GOAL_GUARD, 0 },
|
||||
{ "Disable ship", AI_GOAL_DISABLE_SHIP, 0 },
|
||||
{ "Disarm ship", AI_GOAL_DISARM_SHIP, 0 },
|
||||
{ "Attack any", AI_GOAL_CHASE_ANY, 0 },
|
||||
{ "Ignore ship", AI_GOAL_IGNORE, 0 },
|
||||
{ "Ignore ship (new)", AI_GOAL_IGNORE_NEW, 0 },
|
||||
{ "Guard wing", AI_GOAL_GUARD_WING, 0 },
|
||||
{ "Evade ship", AI_GOAL_EVADE_SHIP, 0 },
|
||||
{ "Stay near ship", AI_GOAL_STAY_NEAR_SHIP, 0 },
|
||||
{ "keep safe dist", AI_GOAL_KEEP_SAFE_DISTANCE, 0 },
|
||||
{ "Rearm ship", AI_GOAL_REARM_REPAIR, 0 },
|
||||
{ "Stay still", AI_GOAL_STAY_STILL, 0 },
|
||||
{ "Play dead", AI_GOAL_PLAY_DEAD, 0 },
|
||||
{ "Attack weapon", AI_GOAL_CHASE_WEAPON, 0 },
|
||||
{ "Fly to ship", AI_GOAL_FLY_TO_SHIP, 0 },
|
||||
{ "Attack ship class", AI_GOAL_CHASE_SHIP_CLASS, 0 },
|
||||
{ "Attack ship", AI_GOAL_CHASE, 0 },
|
||||
{ "Dock", AI_GOAL_DOCK, 0 },
|
||||
{ "Waypoints", AI_GOAL_WAYPOINTS, 0 },
|
||||
{ "Waypoints once", AI_GOAL_WAYPOINTS_ONCE, 0 },
|
||||
{ "Depart", AI_GOAL_WARP, 0 },
|
||||
{ "Attack subsys", AI_GOAL_DESTROY_SUBSYSTEM, 0 },
|
||||
{ "Form on wing", AI_GOAL_FORM_ON_WING, 0 },
|
||||
{ "Undock", AI_GOAL_UNDOCK, 0 },
|
||||
{ "Attack wing", AI_GOAL_CHASE_WING, 0 },
|
||||
{ "Guard ship", AI_GOAL_GUARD, 0 },
|
||||
{ "Disable ship", AI_GOAL_DISABLE_SHIP, 0 },
|
||||
{ "Disarm ship", AI_GOAL_DISARM_SHIP, 0 },
|
||||
{ "Attack any", AI_GOAL_CHASE_ANY, 0 },
|
||||
{ "Ignore ship", AI_GOAL_IGNORE, 0 },
|
||||
{ "Ignore ship (new)", AI_GOAL_IGNORE_NEW, 0 },
|
||||
{ "Guard wing", AI_GOAL_GUARD_WING, 0 },
|
||||
{ "Evade ship", AI_GOAL_EVADE_SHIP, 0 },
|
||||
{ "Stay near ship", AI_GOAL_STAY_NEAR_SHIP, 0 },
|
||||
{ "keep safe dist", AI_GOAL_KEEP_SAFE_DISTANCE, 0 },
|
||||
{ "Rearm ship", AI_GOAL_REARM_REPAIR, 0 },
|
||||
{ "Stay still", AI_GOAL_STAY_STILL, 0 },
|
||||
{ "Play dead", AI_GOAL_PLAY_DEAD, 0 },
|
||||
{ "Play dead (persistent)", AI_GOAL_PLAY_DEAD_PERSISTENT, 0 },
|
||||
{ "Attack weapon", AI_GOAL_CHASE_WEAPON, 0 },
|
||||
{ "Fly to ship", AI_GOAL_FLY_TO_SHIP, 0 },
|
||||
{ "Attack ship class", AI_GOAL_CHASE_SHIP_CLASS, 0 },
|
||||
};
|
||||
|
||||
int Num_ai_goals = sizeof(Ai_goal_names) / sizeof(ai_goal_list);
|
||||
@@ -937,6 +938,11 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
|
||||
aigp->ai_mode = AI_GOAL_PLAY_DEAD;
|
||||
break;
|
||||
|
||||
case OP_AI_PLAY_DEAD_PERSISTENT:
|
||||
aigp->priority = atoi( CTEXT(CDR(node)) );
|
||||
aigp->ai_mode = AI_GOAL_PLAY_DEAD_PERSISTENT;
|
||||
break;
|
||||
|
||||
case OP_AI_KEEP_SAFE_DISTANCE:
|
||||
aigp->priority = atoi( CTEXT(CDR(node)) );
|
||||
aigp->ai_mode = AI_GOAL_KEEP_SAFE_DISTANCE;
|
||||
@@ -1126,6 +1132,10 @@ int ai_remove_goal_sexp_sub( int sexp, ai_goal* aigp )
|
||||
goalmode = AI_GOAL_PLAY_DEAD;
|
||||
priority = ( CDR(node) >= 0 ) ? atoi( CTEXT( CDR( node ) ) ) : -1;
|
||||
break;
|
||||
case OP_AI_PLAY_DEAD_PERSISTENT:
|
||||
goalmode = AI_GOAL_PLAY_DEAD_PERSISTENT;
|
||||
priority = ( CDR(node) >= 0 ) ? atoi( CTEXT( CDR( node ) ) ) : -1;
|
||||
break;
|
||||
case OP_AI_KEEP_SAFE_DISTANCE:
|
||||
priority = ( CDR(node) >= 0 ) ? atoi( CTEXT( CDR( node ) ) ) : -1;
|
||||
goalmode = AI_GOAL_KEEP_SAFE_DISTANCE;
|
||||
@@ -1340,25 +1350,6 @@ void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int /*
|
||||
ai_process_mission_orders( Ships[aip->shipnum].objnum, aip );
|
||||
}
|
||||
|
||||
// function to add an internal goal to a wing. Mike K says that the goal doesn't need to persist
|
||||
// across waves of the wing so we merely need to add the goal to each ship in the wing. Certain
|
||||
// goal are simply not valid for wings (like dock, undock). Immediate parameter gets passed to add_ship_goal
|
||||
// to say whether or not we should process this goal right away
|
||||
void ai_add_goal_wing_internal( wing *wingp, int goal_type, char *name, int immediate )
|
||||
{
|
||||
int i;
|
||||
|
||||
// be sure we are not trying to issue dock or undock goals to wings
|
||||
Assert ( (goal_type != AI_GOAL_DOCK) && (goal_type != AI_GOAL_UNDOCK) );
|
||||
|
||||
for (i = 0; i < wingp->current_count; i++) {
|
||||
int num = wingp->ship_index[i];
|
||||
if ( num == -1 ) // ship must have been destroyed or departed
|
||||
continue;
|
||||
ai_add_goal_ship_internal( &Ai_info[Ships[num].ai_index], goal_type, name, -1, -1, immediate);
|
||||
}
|
||||
}
|
||||
|
||||
// this function copies goals from a wing to an ai_info * from a ship.
|
||||
void ai_copy_mission_wing_goal( ai_goal *aigp, ai_info *aip )
|
||||
{
|
||||
@@ -1401,7 +1392,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
// these orders are always achievable.
|
||||
if ( (aigp->ai_mode == AI_GOAL_KEEP_SAFE_DISTANCE)
|
||||
|| (aigp->ai_mode == AI_GOAL_CHASE_ANY) || (aigp->ai_mode == AI_GOAL_STAY_STILL)
|
||||
|| (aigp->ai_mode == AI_GOAL_PLAY_DEAD) )
|
||||
|| (aigp->ai_mode == AI_GOAL_PLAY_DEAD) || (aigp->ai_mode == AI_GOAL_PLAY_DEAD_PERSISTENT) )
|
||||
return AI_GOAL_ACHIEVABLE;
|
||||
|
||||
// warp (depart) only achievable if there's somewhere to depart to
|
||||
@@ -1895,9 +1886,12 @@ int ai_goal_priority_compare(const void *a, const void *b)
|
||||
// check whether or not the goal override flag is set. If it is set, then push this goal higher
|
||||
// in the list
|
||||
|
||||
else if ( (ga->flags[AI::Goal_Flags::Goal_override]) && !(gb->flags[AI::Goal_Flags::Goal_override]) )
|
||||
// Goober5000: the ONLY goals we do not override are play-dead and play-dead-persistent,
|
||||
// because the override flag needs to work in any other situation
|
||||
|
||||
else if ( (ga->flags[AI::Goal_Flags::Goal_override]) && !(gb->flags[AI::Goal_Flags::Goal_override]) && !(gb->ai_mode == AI_GOAL_PLAY_DEAD) && !(gb->ai_mode == AI_GOAL_PLAY_DEAD_PERSISTENT) )
|
||||
return -1;
|
||||
else if ( !(ga->flags[AI::Goal_Flags::Goal_override]) && (gb->flags[AI::Goal_Flags::Goal_override]) )
|
||||
else if ( !(ga->flags[AI::Goal_Flags::Goal_override]) && (gb->flags[AI::Goal_Flags::Goal_override]) && !(ga->ai_mode == AI_GOAL_PLAY_DEAD) && !(ga->ai_mode == AI_GOAL_PLAY_DEAD_PERSISTENT))
|
||||
return 1;
|
||||
|
||||
// now normal priority processing
|
||||
@@ -2290,6 +2284,13 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
aip->submode_start_time = Missiontime;
|
||||
break;
|
||||
|
||||
case AI_GOAL_PLAY_DEAD_PERSISTENT:
|
||||
// same as above, but we don't clear out ship goals
|
||||
aip->mode = AIM_PLAY_DEAD;
|
||||
aip->submode = -1;
|
||||
aip->submode_start_time = Missiontime;
|
||||
break;
|
||||
|
||||
case AI_GOAL_FORM_ON_WING:
|
||||
// for form on wing, we need to clear out all goals for this ship, and then call the form
|
||||
// on wing AI code
|
||||
|
||||
+5
-5
@@ -58,16 +58,17 @@ struct ai_goal;
|
||||
#define AI_GOAL_FLY_TO_SHIP (1<<23) // 0x00800000
|
||||
#define AI_GOAL_IGNORE_NEW (1<<24) // 0x01000000
|
||||
#define AI_GOAL_CHASE_SHIP_CLASS (1<<25) // 0x02000000
|
||||
#define AI_GOAL_PLAY_DEAD_PERSISTENT (1<<26) // 0x03000000
|
||||
|
||||
// now the masks for ship types
|
||||
|
||||
// Goober5000: added AI_GOAL_STAY_NEAR_SHIP and AI_GOAL_KEEP_SAFE_DISTANCE as valid for fighters
|
||||
//WMC - Don't need these anymore. Whee!
|
||||
/*
|
||||
#define AI_GOAL_ACCEPT_FIGHTER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_CHASE | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_DESTROY_SUBSYSTEM | AI_GOAL_CHASE_WING | AI_GOAL_GUARD | AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP | AI_GOAL_CHASE_ANY | AI_GOAL_IGNORE | AI_GOAL_IGNORE_NEW | AI_GOAL_GUARD_WING | AI_GOAL_EVADE_SHIP | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE )
|
||||
#define AI_GOAL_ACCEPT_FIGHTER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_CHASE | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_DESTROY_SUBSYSTEM | AI_GOAL_CHASE_WING | AI_GOAL_GUARD | AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP | AI_GOAL_CHASE_ANY | AI_GOAL_IGNORE | AI_GOAL_IGNORE_NEW | AI_GOAL_GUARD_WING | AI_GOAL_EVADE_SHIP | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD | AI_GOAL_PLAY_DEAD_PERSISTENT | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE )
|
||||
#define AI_GOAL_ACCEPT_BOMBER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FIGHTER | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_STEALTH ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FIGHTER | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_TRANSPORT ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_CHASE | AI_GOAL_CHASE_WING | AI_GOAL_DOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_UNDOCK | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD| AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_TRANSPORT ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_CHASE | AI_GOAL_CHASE_WING | AI_GOAL_DOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_UNDOCK | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD | AI_GOAL_PLAY_DEAD_PERSISTENT | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_FREIGHTER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_TRANSPORT | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_CRUISER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FREIGHTER | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_CORVETTE ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER | AI_GOAL_STAY_NEAR_SHIP )
|
||||
@@ -75,7 +76,7 @@ struct ai_goal;
|
||||
#define AI_GOAL_ACCEPT_AWACS ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_CAPITAL ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER & ~(AI_GOAL_DOCK | AI_GOAL_UNDOCK) | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_SUPERCAP ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CAPITAL | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_SUPPORT ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_DOCK | AI_GOAL_UNDOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD)
|
||||
#define AI_GOAL_ACCEPT_SUPPORT ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_DOCK | AI_GOAL_UNDOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD | AI_GOAL_PLAY_DEAD_PERSISTENT )
|
||||
#define AI_GOAL_ACCEPT_ESCAPEPOD ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_TRANSPORT| AI_GOAL_STAY_NEAR_SHIP )
|
||||
*/
|
||||
|
||||
@@ -102,7 +103,7 @@ extern int ai_goal_num(ai_goal *goals);
|
||||
extern void ai_add_ship_goal_scripting(int mode, int submode, int priority, char *shipname, ai_info *aip);
|
||||
extern void ai_add_ship_goal_sexp( int sexp, int type, ai_info *aip );
|
||||
extern void ai_add_wing_goal_sexp( int sexp, int type, int wingnum );
|
||||
extern void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp );
|
||||
extern void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name );
|
||||
|
||||
extern int ai_remove_goal_sexp_sub( int sexp, ai_goal* aigp );
|
||||
extern void ai_remove_wing_goal_sexp(int sexp, int wingnum);
|
||||
@@ -127,6 +128,5 @@ extern char *ai_add_dock_name(const char *str);
|
||||
extern int ai_query_goal_valid( int ship, int ai_goal_type );
|
||||
|
||||
extern void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int docker_point, int dockee_point, int immediate = 1 );
|
||||
extern void ai_add_goal_wing_internal( wing *wingp, int goal_type, char *name, int immediate = 1 );
|
||||
|
||||
#endif
|
||||
@@ -1290,7 +1290,9 @@ void ship_get_global_turret_gun_info(object *objp, ship_subsys *ssp, vec3d *gpos
|
||||
model_instance_find_world_point(&tmp_pos, &avg, Ships[objp->instance].model_instance_num, tp->turret_gun_sobj, &objp->orient, &objp->pos);
|
||||
|
||||
if (targetp == nullptr) {
|
||||
Assertion(ssp->turret_enemy_objnum >= 0, "The turret enemy object number %d for %s on ship number %d is invalid.", ssp->turret_enemy_objnum, ssp->sub_name, ssp->parent_objnum);
|
||||
ship* shipp = &Ships[Objects[ssp->parent_objnum].instance];
|
||||
Assertion(ssp->turret_enemy_objnum >= 0, "The turret enemy object number %d for %s on ship name %s is invalid.", ssp->turret_enemy_objnum, ssp->sub_name,
|
||||
(shipp->has_display_name()) ? shipp->display_name.c_str() : shipp->ship_name);
|
||||
object *lep = &Objects[ssp->turret_enemy_objnum];
|
||||
|
||||
int best_weapon_tidx = turret_select_best_weapon(ssp, lep);
|
||||
@@ -1301,9 +1303,9 @@ void ship_get_global_turret_gun_info(object *objp, ship_subsys *ssp, vec3d *gpos
|
||||
|
||||
weapon_info *wip = get_turret_weapon_wip(&ssp->weapons, best_weapon_tidx);
|
||||
|
||||
float weapon_system_strength = ship_get_subsystem_strength(&Ships[ssp->parent_objnum], SUBSYSTEM_WEAPONS);
|
||||
float weapon_system_strength = ship_get_subsystem_strength(shipp, SUBSYSTEM_WEAPONS);
|
||||
|
||||
turret_ai_update_aim(&Ai_info[Ships[ssp->parent_objnum].ai_index], &Objects[ssp->turret_enemy_objnum], ssp);
|
||||
turret_ai_update_aim(&Ai_info[shipp->ai_index], &Objects[ssp->turret_enemy_objnum], ssp);
|
||||
|
||||
if ((ssp->targeted_subsys != nullptr) && !(ssp->flags[Ship::Subsystem_Flags::No_SS_targeting])) {
|
||||
vm_vec_unrotate(&enemy_point, &ssp->targeted_subsys->system_info->pnt, &Objects[ssp->turret_enemy_objnum].orient);
|
||||
|
||||
@@ -519,19 +519,6 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Stop an anim instance that is on the anim_render_list from playing
|
||||
*/
|
||||
int anim_stop_playing(anim_instance* instance)
|
||||
{
|
||||
Assert(instance != NULL);
|
||||
|
||||
if ( anim_playing(instance) ) {
|
||||
anim_release_render_instance(instance);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Free a particular animation instance that is on the anim_render_list.
|
||||
* Do not call this function to free an animation instance in general (use
|
||||
@@ -866,20 +853,6 @@ int anim_free(anim *ptr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Return if an anim is playing or not.
|
||||
*/
|
||||
int anim_playing(anim_instance *ai)
|
||||
{
|
||||
Assert(ai != NULL);
|
||||
if ( ai->frame == NULL )
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Called at the beginning of a mission to initialize any mission dependent anim data.
|
||||
* @todo Redundant?
|
||||
@@ -896,138 +869,6 @@ void anim_level_close()
|
||||
anim_release_all_instances();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write the frames of a .ani file out to disk as .pcx files.
|
||||
* @details Use naming convention: filename0000.pcx, filename0001.pcx etc.
|
||||
*
|
||||
* @return If success 0, or if failed -1
|
||||
*/
|
||||
int anim_write_frames_out(char *filename)
|
||||
{
|
||||
anim *source_anim;
|
||||
anim_instance *ai;
|
||||
char root_name[256], pcxname[256];
|
||||
char buf[64];
|
||||
int i,j;
|
||||
ubyte **row_data;
|
||||
|
||||
strcpy_s(root_name, filename);
|
||||
root_name[strlen(filename)-4] = 0;
|
||||
|
||||
source_anim = anim_load(filename);
|
||||
if ( source_anim == NULL )
|
||||
return -1;
|
||||
|
||||
ai = init_anim_instance(source_anim, 16);
|
||||
|
||||
row_data = (ubyte**)vm_malloc((source_anim->height+1) * 4);
|
||||
|
||||
for ( i = 0; i < source_anim->total_frames; i++ ) {
|
||||
anim_get_next_raw_buffer(ai, 0, 0, 16);
|
||||
strcpy_s(pcxname, root_name);
|
||||
sprintf(buf,"%04d",i);
|
||||
strcat_s(pcxname, buf);
|
||||
|
||||
for ( j = 0; j < source_anim->height; j++ ) {
|
||||
row_data[j] = &ai->frame[j*source_anim->width];
|
||||
}
|
||||
|
||||
|
||||
pcx_write_bitmap( pcxname,
|
||||
source_anim->width,
|
||||
source_anim->height,
|
||||
row_data,
|
||||
source_anim->palette);
|
||||
|
||||
printf(".");
|
||||
|
||||
}
|
||||
printf("\n");
|
||||
vm_free(row_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Display information and statistics about a .ani file.
|
||||
* @details This is called when -i switch is on when running ac.exe
|
||||
*/
|
||||
void anim_display_info(char *real_filename)
|
||||
{
|
||||
CFILE *fp;
|
||||
anim A;
|
||||
float percent;
|
||||
int i, uncompressed, compressed, *key_frame_nums=NULL, tmp;
|
||||
char filename[MAX_FILENAME_LEN];
|
||||
|
||||
strcpy_s( filename, real_filename );
|
||||
char *p = strchr( filename, '.' );
|
||||
if ( p ) {
|
||||
*p = 0;
|
||||
}
|
||||
strcat_s( filename, ".ani" );
|
||||
|
||||
fp = cfopen(filename, "rb");
|
||||
if ( !fp ) {
|
||||
printf("Fatal error opening %s", filename);
|
||||
return;
|
||||
}
|
||||
|
||||
anim_read_header(&A, fp);
|
||||
|
||||
if (A.width < 0 || A.height < 0) {
|
||||
Error(LOCATION, "Ani file %s has a faulty header and cannot be loaded.", filename);
|
||||
}
|
||||
|
||||
// read the keyframe frame nums and offsets
|
||||
key_frame_nums = (int*)vm_malloc(sizeof(int)*A.num_keys);
|
||||
Assert(key_frame_nums != NULL);
|
||||
if (key_frame_nums == NULL)
|
||||
return;
|
||||
|
||||
for ( i = 0; i < A.num_keys; i++ ) {
|
||||
key_frame_nums[i] = 0;
|
||||
cfread(&key_frame_nums[i], 2, 1, fp);
|
||||
cfread(&tmp, 4, 1, fp);
|
||||
}
|
||||
|
||||
cfread(&compressed, 4, 1, fp);
|
||||
|
||||
uncompressed = A.width * A.height * A.total_frames; // 8 bits per pixel
|
||||
percent = i2fl(compressed) / uncompressed * 100.0f;
|
||||
|
||||
printf("%% of uncompressed size: %.0f%%\n", percent);
|
||||
printf("Width: %d\n", A.width);
|
||||
printf("Height: %d\n", A.height);
|
||||
printf("Total Frames: %d\n", A.total_frames);
|
||||
|
||||
#ifndef NDEBUG
|
||||
printf("Key Frames: %d\n", A.num_keys);
|
||||
if ( A.num_keys > 1 && (A.total_frames != A.num_keys) ) {
|
||||
printf("key list: (");
|
||||
for ( i = 0; i < A.num_keys; i++ ) {
|
||||
if ( i < A.num_keys-1 )
|
||||
printf("%d, ", key_frame_nums[i]);
|
||||
else
|
||||
printf("%d)\n", key_frame_nums[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("FPS: %d\n", A.fps);
|
||||
|
||||
#ifndef NDEBUG
|
||||
printf("Transparent RGB: (%u,%u,%u)\n", A.xparent_r, A.xparent_g, A.xparent_b);
|
||||
#endif
|
||||
|
||||
printf("ac version: %d\n", A.version);
|
||||
|
||||
if ( key_frame_nums != NULL ) {
|
||||
vm_free(key_frame_nums);
|
||||
}
|
||||
|
||||
cfclose(fp);
|
||||
}
|
||||
|
||||
void anim_reverse_direction(anim_instance *ai)
|
||||
{
|
||||
int temp;
|
||||
@@ -1061,16 +902,6 @@ void anim_reverse_direction(anim_instance *ai)
|
||||
}
|
||||
}
|
||||
|
||||
void anim_pause(anim_instance *ai)
|
||||
{
|
||||
ai->paused = 1;
|
||||
}
|
||||
|
||||
void anim_unpause(anim_instance *ai)
|
||||
{
|
||||
ai->paused = 0;
|
||||
}
|
||||
|
||||
void anim_ignore_next_frametime()
|
||||
{
|
||||
Anim_ignore_frametime=1;
|
||||
|
||||
@@ -54,19 +54,13 @@ void anim_render_one(int screen_id, anim_instance *ani, float frametime);
|
||||
void anim_play_init(anim_play_struct *aps, anim *a_info, int x, int y, int max_x = -1, int max_y = -1);
|
||||
anim_instance *anim_play(anim_play_struct *aps);
|
||||
void anim_ignore_next_frametime();
|
||||
int anim_stop_playing(anim_instance* anim_instance);
|
||||
int anim_show_next_frame(anim_instance *instance, float frametime);
|
||||
void anim_release_all_instances(int screen_id = 0);
|
||||
void anim_release_render_instance(anim_instance* instance);
|
||||
anim *anim_load(const char *name, int cf_dir_type = CF_TYPE_ANY, int file_mapped = PAGE_FROM_DISK);
|
||||
int anim_free(anim *ptr);
|
||||
int anim_playing(anim_instance *ai);
|
||||
int anim_write_frames_out(char *filename);
|
||||
void anim_display_info(char *filename);
|
||||
void anim_read_header(anim *ptr, CFILE *fp);
|
||||
void anim_reverse_direction(anim_instance *ai); // called automatically for ping-ponging, and can also be called externally
|
||||
void anim_pause(anim_instance *ai);
|
||||
void anim_unpause(anim_instance *ai);
|
||||
|
||||
int anim_instance_is_streamed(anim_instance *ai);
|
||||
unsigned char anim_instance_get_byte(anim_instance *ai, int offset);
|
||||
|
||||
@@ -78,52 +78,6 @@ void free_anim_instance(anim_instance *inst)
|
||||
vm_free(inst);
|
||||
}
|
||||
|
||||
int anim_get_next_frame(anim_instance *inst)
|
||||
{
|
||||
int bm, bitmap_flags;
|
||||
int aabitmap = 0;
|
||||
int bpp = 16;
|
||||
|
||||
if ( anim_instance_is_streamed(inst) ) {
|
||||
if ( inst->file_offset <= 0 ) {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
if (!inst->data)
|
||||
return -1;
|
||||
}
|
||||
|
||||
inst->frame_num++;
|
||||
if (inst->frame_num >= inst->parent->total_frames) {
|
||||
inst->data = NULL;
|
||||
inst->file_offset = inst->parent->file_offset;
|
||||
return -1;
|
||||
}
|
||||
|
||||
bitmap_flags = 0;
|
||||
|
||||
bpp = 16;
|
||||
if(inst->aa_color != NULL){
|
||||
bitmap_flags |= BMP_AABITMAP;
|
||||
aabitmap = 1;
|
||||
bpp = 8;
|
||||
}
|
||||
|
||||
anim_check_for_palette_change(inst);
|
||||
|
||||
BM_SELECT_TEX_FORMAT();
|
||||
|
||||
if ( anim_instance_is_streamed(inst) ) {
|
||||
inst->file_offset = unpack_frame_from_file(inst, inst->frame, inst->parent->width*inst->parent->height, inst->parent->palette_translation, aabitmap, bpp);
|
||||
} else {
|
||||
inst->data = unpack_frame(inst, inst->data, inst->frame, inst->parent->width*inst->parent->height, inst->parent->palette_translation, aabitmap, bpp);
|
||||
}
|
||||
|
||||
bm = bm_create(bpp, inst->parent->width, inst->parent->height, inst->frame, bitmap_flags);
|
||||
bm_unload(bm);
|
||||
return bm;
|
||||
}
|
||||
|
||||
ubyte *anim_get_next_raw_buffer(anim_instance *inst, int xlate_pal, int aabitmap, int bpp)
|
||||
{
|
||||
if ( anim_instance_is_streamed(inst) ) {
|
||||
@@ -162,321 +116,6 @@ ubyte *anim_get_next_raw_buffer(anim_instance *inst, int xlate_pal, int aabitmap
|
||||
return inst->frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack key frame
|
||||
*
|
||||
* @param frame Frame pixel data to pack
|
||||
* @param save Memory to store packed data to
|
||||
* @param size Number of bytes to pack
|
||||
* @param max Maximum number of packed bytes (size of buffer)
|
||||
* @param compress_type Compress type
|
||||
* @return Actual number of bytes data packed to or -1 if error
|
||||
*/
|
||||
int pack_key_frame(ubyte *frame, ubyte *save, long size, long max, int compress_type)
|
||||
{
|
||||
int last = -32768, count = 0;
|
||||
long packed_size = 1;
|
||||
|
||||
switch ( compress_type ) {
|
||||
case PACKING_METHOD_RLE_KEY:
|
||||
*save++ = PACKING_METHOD_RLE_KEY;
|
||||
while (size--) {
|
||||
if (*frame != last || count > 255) {
|
||||
if (packed_size + 3 >= max)
|
||||
return -1;
|
||||
|
||||
if (count < 3) {
|
||||
if (last == packer_code) {
|
||||
*save++ = (ubyte)packer_code;
|
||||
*save++ = (ubyte)(count - 1);
|
||||
packed_size += 2;
|
||||
|
||||
} else
|
||||
while (count--) {
|
||||
*save++ = (ubyte)last;
|
||||
packed_size++;
|
||||
}
|
||||
|
||||
} else {
|
||||
*save++ = (ubyte)packer_code;
|
||||
*save++ = (ubyte)(count - 1);
|
||||
*save++ = (ubyte)last;
|
||||
packed_size += 3;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
last = *frame;
|
||||
}
|
||||
|
||||
count++;
|
||||
frame++;
|
||||
}
|
||||
|
||||
if (packed_size + 3 >= max)
|
||||
return -1;
|
||||
|
||||
if (count < 3) {
|
||||
if (last == packer_code) {
|
||||
*save++ = (ubyte)packer_code;
|
||||
*save++ = (ubyte)(count - 1);
|
||||
packed_size += 2;
|
||||
|
||||
} else
|
||||
while (count--) {
|
||||
*save++ = (ubyte)last;
|
||||
packed_size++;
|
||||
}
|
||||
|
||||
} else {
|
||||
*save++ = (ubyte)packer_code;
|
||||
*save++ = (ubyte)(count - 1);
|
||||
*save++ = (ubyte)last;
|
||||
packed_size += 3;
|
||||
}
|
||||
break;
|
||||
|
||||
case PACKING_METHOD_STD_RLE_KEY: {
|
||||
ubyte *dest_start;
|
||||
int i;
|
||||
|
||||
dest_start = save;
|
||||
count = 1;
|
||||
|
||||
last = *frame++;
|
||||
*save++ = PACKING_METHOD_STD_RLE_KEY;
|
||||
for (i=1; i < size; i++ ) {
|
||||
|
||||
if ( *frame != last ) {
|
||||
if ( count ) {
|
||||
|
||||
if (packed_size + 2 >= max)
|
||||
return -1;
|
||||
|
||||
if ( (count == 1) && !(last & STD_RLE_CODE) ) {
|
||||
*save++ = (ubyte)last;
|
||||
packed_size++;
|
||||
Assert( last != STD_RLE_CODE );
|
||||
}
|
||||
else {
|
||||
count |= STD_RLE_CODE;
|
||||
*save++ = (ubyte)count;
|
||||
*save++ = (ubyte)last;
|
||||
packed_size += 2;
|
||||
}
|
||||
}
|
||||
|
||||
last = *frame;
|
||||
count = 0;
|
||||
}
|
||||
|
||||
count++;
|
||||
frame++;
|
||||
|
||||
if ( count == 127 ) {
|
||||
count |= STD_RLE_CODE;
|
||||
*save++ = (ubyte)count;
|
||||
*save++ = (ubyte)last;
|
||||
packed_size += 2;
|
||||
count = 0;
|
||||
}
|
||||
} // end for
|
||||
|
||||
if (count) {
|
||||
|
||||
if (packed_size + 2 >= max)
|
||||
return -1;
|
||||
|
||||
if ( (count == 1) && !(last & STD_RLE_CODE) ) {
|
||||
*save++ = (ubyte)last;
|
||||
packed_size++;
|
||||
Assert( last != STD_RLE_CODE );
|
||||
}
|
||||
else {
|
||||
count |= STD_RLE_CODE;
|
||||
*save++ = (ubyte)count;
|
||||
*save++ = (ubyte)last;
|
||||
packed_size += 2;
|
||||
}
|
||||
}
|
||||
|
||||
Assert(packed_size == (save-dest_start) );
|
||||
return packed_size;
|
||||
}
|
||||
|
||||
default:
|
||||
Assert(0);
|
||||
return -1;
|
||||
break;
|
||||
} // end switch
|
||||
|
||||
return packed_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack frame
|
||||
*
|
||||
* @param frame Frame pixel data to pack
|
||||
* @param frame2 Previous frame's pixel data
|
||||
* @param save Memory to store packed data to
|
||||
* @param size Number of bytes to pack
|
||||
* @param max Maximum number of packed bytes (size of buffer)
|
||||
* @param compress_type Compress type
|
||||
* @return Actual number of bytes data packed to or -1 if error
|
||||
*/
|
||||
int pack_frame(ubyte *frame, ubyte *frame2, ubyte *save, long size, long max, int compress_type)
|
||||
{
|
||||
int pixel, last = -32768, count = 0, i;
|
||||
long packed_size = 1;
|
||||
|
||||
switch ( compress_type ) {
|
||||
case PACKING_METHOD_RLE: // Hoffoss RLE regular frame
|
||||
*save++ = PACKING_METHOD_RLE;
|
||||
while (size--) {
|
||||
if (*frame != *frame2++)
|
||||
pixel = *frame;
|
||||
else
|
||||
pixel = transparent_code;
|
||||
|
||||
if (pixel != last || count > 255) {
|
||||
if (packed_size + 3 >= max)
|
||||
return -1;
|
||||
|
||||
if (count < 3) {
|
||||
if (last == packer_code) {
|
||||
*save++ = (ubyte)packer_code;
|
||||
*save++ = (ubyte)(count - 1);
|
||||
packed_size += 2;
|
||||
|
||||
} else
|
||||
while (count--) {
|
||||
*save++ = (ubyte)last;
|
||||
packed_size++;
|
||||
}
|
||||
|
||||
} else {
|
||||
*save++ = (ubyte)packer_code;
|
||||
*save++ = (ubyte)(count - 1);
|
||||
*save++ = (ubyte)last;
|
||||
packed_size += 3;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
last = pixel;
|
||||
}
|
||||
|
||||
frame++;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (packed_size + 3 >= max)
|
||||
return -1;
|
||||
|
||||
if (count < 3) {
|
||||
if (last == packer_code) {
|
||||
*save++ = (ubyte)packer_code;
|
||||
*save++ = (ubyte)(count - 1);
|
||||
packed_size += 2;
|
||||
|
||||
} else
|
||||
while (count--) {
|
||||
*save++ = (ubyte)last;
|
||||
packed_size++;
|
||||
}
|
||||
|
||||
} else {
|
||||
*save++ = (ubyte)(packer_code);
|
||||
*save++ = (ubyte)(count - 1);
|
||||
*save++ = (ubyte)(last);
|
||||
packed_size += 3;
|
||||
}
|
||||
break;
|
||||
|
||||
case PACKING_METHOD_STD_RLE: { // high bit count regular RLE frame
|
||||
|
||||
ubyte *dest_start;
|
||||
|
||||
dest_start = save;
|
||||
count = 1;
|
||||
|
||||
if (*frame++ != *frame2++)
|
||||
last = *frame;
|
||||
else
|
||||
last = transparent_code;
|
||||
|
||||
*save++ = PACKING_METHOD_STD_RLE;
|
||||
for (i=1; i < size; i++ ) {
|
||||
|
||||
if (*frame != *frame2++)
|
||||
pixel = *frame;
|
||||
else
|
||||
pixel = transparent_code;
|
||||
|
||||
if ( pixel != last ) {
|
||||
if ( count ) {
|
||||
|
||||
if (packed_size + 2 >= max)
|
||||
return -1;
|
||||
|
||||
if ( (count == 1) && !(last & STD_RLE_CODE) ) {
|
||||
*save++ = (ubyte)last;
|
||||
packed_size++;
|
||||
Assert( last != STD_RLE_CODE );
|
||||
}
|
||||
else {
|
||||
count |= STD_RLE_CODE;
|
||||
*save++ = (ubyte)count;
|
||||
*save++ = (ubyte)last;
|
||||
packed_size += 2;
|
||||
}
|
||||
}
|
||||
|
||||
last = pixel;
|
||||
count = 0;
|
||||
}
|
||||
|
||||
count++;
|
||||
frame++;
|
||||
|
||||
if ( count == 127 ) {
|
||||
count |= STD_RLE_CODE;
|
||||
*save++ = (ubyte)count;
|
||||
*save++ = (ubyte)last;
|
||||
packed_size += 2;
|
||||
count = 0;
|
||||
}
|
||||
} // end for
|
||||
|
||||
if (count) {
|
||||
|
||||
if (packed_size + 2 >= max)
|
||||
return -1;
|
||||
|
||||
if ( (count == 1) && !(last & STD_RLE_CODE) ) {
|
||||
*save++ = (ubyte)last;
|
||||
packed_size++;
|
||||
Assert( last != STD_RLE_CODE );
|
||||
}
|
||||
else {
|
||||
count |= STD_RLE_CODE;
|
||||
*save++ = (ubyte)count;
|
||||
*save++ = (ubyte)last;
|
||||
packed_size += 2;
|
||||
}
|
||||
}
|
||||
|
||||
Assert(packed_size == (save-dest_start) );
|
||||
return packed_size;
|
||||
}
|
||||
|
||||
default:
|
||||
Assert(0);
|
||||
return -1;
|
||||
break;
|
||||
} // end switch
|
||||
|
||||
return packed_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert a 24 bit value to a 16 bit value
|
||||
* @param bit_24 24 bit value
|
||||
|
||||
@@ -97,16 +97,12 @@ typedef struct anim_instance {
|
||||
int loop_count; // starts at 0, and is incremented each time it loops
|
||||
} anim_instance;
|
||||
|
||||
int pack_key_frame(ubyte *frame, ubyte *save, long size, long max, int compress_type);
|
||||
int pack_frame(ubyte *frame, ubyte *frame2, ubyte *save, long size, long max, int compress_type);
|
||||
|
||||
ubyte *unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte *pal_translate, int aabitmap, int bpp);
|
||||
int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal_translate, int aabitmap, int bpp);
|
||||
|
||||
void anim_init();
|
||||
anim_instance *init_anim_instance(anim *ptr, int bpp);
|
||||
void free_anim_instance(anim_instance *inst);
|
||||
int anim_get_next_frame(anim_instance *inst);
|
||||
ubyte *anim_get_next_raw_buffer(anim_instance *inst, int xlate_pal, int aabitmap, int bpp);
|
||||
void anim_set_palette(anim *a);
|
||||
void anim_check_for_palette_change(anim_instance *inst);
|
||||
|
||||
@@ -1263,7 +1263,7 @@ static float asteroid_create_explosion(object *objp)
|
||||
|
||||
fireball_scale_multiplier = asteroid_get_fireball_scale_multiplier(objp->instance);
|
||||
|
||||
fireball_objnum = fireball_create( &objp->pos, fireball_type, FIREBALL_LARGE_EXPLOSION, OBJ_INDEX(objp), objp->radius*fireball_scale_multiplier, 0, &objp->phys_info.vel );
|
||||
fireball_objnum = fireball_create( &objp->pos, fireball_type, FIREBALL_LARGE_EXPLOSION, OBJ_INDEX(objp), objp->radius*fireball_scale_multiplier, false, &objp->phys_info.vel );
|
||||
if ( fireball_objnum > -1 ) {
|
||||
explosion_life = fireball_lifeleft(&Objects[fireball_objnum]);
|
||||
} else {
|
||||
|
||||
@@ -122,31 +122,6 @@ vec3d *NavPoint::GetPosition()
|
||||
}
|
||||
}
|
||||
|
||||
char* NavPoint::GetInternalName()
|
||||
{
|
||||
char *NavName;
|
||||
char strtmp[33];
|
||||
|
||||
if (flags & NP_WAYPOINT)
|
||||
{
|
||||
NavName = new char[strlen(((waypoint_list*)target_obj)->get_name())+5];
|
||||
memset(NavName, 0, strlen(((waypoint_list*)target_obj)->get_name())+5);
|
||||
strcpy(NavName, ((waypoint_list*)target_obj)->get_name());
|
||||
|
||||
strcat(NavName, ":");
|
||||
sprintf(strtmp, "%d", waypoint_num);
|
||||
strcat(NavName, strtmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
NavName = new char[strlen(((ship*)target_obj)->ship_name)+1];
|
||||
memset(NavName, 0, strlen(((ship*)target_obj)->ship_name)+1);
|
||||
strcpy(NavName, ((ship*)target_obj)->ship_name);
|
||||
}
|
||||
|
||||
return NavName;
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
bool CanAutopilot(vec3d targetPos, bool send_msg)
|
||||
{
|
||||
@@ -998,7 +973,6 @@ camera* nav_get_set_camera()
|
||||
return nav_camera.getCamera();
|
||||
}
|
||||
|
||||
extern int Cmdline_old_collision_sys;
|
||||
void nav_warp(bool prewarp=false)
|
||||
{
|
||||
/* ok... find our end distance - norm1 is still a unit vector in the
|
||||
@@ -1053,11 +1027,7 @@ void nav_warp(bool prewarp=false)
|
||||
}
|
||||
|
||||
// retime all collision pairs
|
||||
if ( Cmdline_old_collision_sys ) {
|
||||
obj_all_collisions_retime();
|
||||
} else {
|
||||
obj_collide_retime_cached_pairs();
|
||||
}
|
||||
obj_collide_retime_cached_pairs();
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
@@ -1464,22 +1434,6 @@ bool AddNav_Waypoint(char *Nav, char *WP_Path, int node, int flags)
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
//Change Flags
|
||||
bool Nav_Alt_Flags(char *Nav, int flags)
|
||||
{
|
||||
flags &= ~NP_VALIDTYPE; //clear the NP_SHIP and NP_WAYPOINT bits, make sure they haven't been set
|
||||
|
||||
int nav = FindNav(Nav);
|
||||
|
||||
if (nav != -1)
|
||||
{
|
||||
Navs[nav].flags &= NP_VALIDTYPE; // Clear all bits BUT NP_SHIP or NO_WAYPOINT
|
||||
Navs[nav].flags |= flags; // merge
|
||||
}
|
||||
|
||||
return (nav != -1);
|
||||
}
|
||||
|
||||
//Get Flags
|
||||
int Nav_Get_Flags(char *Nav)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,6 @@ public:
|
||||
int waypoint_num; //only used when flags & NP_WAYPOINT
|
||||
|
||||
vec3d *GetPosition();
|
||||
char* GetInternalName();
|
||||
|
||||
void clear()
|
||||
{
|
||||
@@ -129,9 +128,6 @@ void SelectNav(char *Nav);
|
||||
// Deselects any navpoint selected.
|
||||
void DeselectNav();
|
||||
|
||||
// Set A Nav point to "ZERO"
|
||||
void ZeroNav(int i);
|
||||
|
||||
// Removes a Nav
|
||||
bool DelNavPoint(char *Nav);
|
||||
bool DelNavPoint(int nav);
|
||||
@@ -140,9 +136,6 @@ bool DelNavPoint(int nav);
|
||||
bool AddNav_Ship(char *Nav, char *TargetName, int flags);
|
||||
bool AddNav_Waypoint(char *Nav, char *WP_Path, int node, int flags);
|
||||
|
||||
//Change Flags
|
||||
bool Nav_Alt_Flags(char *Nav, int flags);
|
||||
|
||||
// Sexp Accessors
|
||||
bool Nav_Set_Flag(char *Nav, int flag);
|
||||
bool Nav_UnSet_Flag(char *Nav, int flag);
|
||||
|
||||
@@ -67,9 +67,7 @@ struct bitmap_entry {
|
||||
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
|
||||
|
||||
BM_TYPE type; //!< PCX, USER, ANI, etc
|
||||
BM_TYPE comp_type; //!< What sort of compressed type, BM_TYPE_NONE if not compressed
|
||||
|
||||
@@ -55,14 +55,7 @@ MONITOR(SizeBitmapPage)
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Definition of public variables (declared as extern in bmpman.h).
|
||||
int GLOWMAP = -1;
|
||||
int SPECMAP = -1;
|
||||
int SPECGLOSSMAP = -1;
|
||||
int ENVMAP = -1;
|
||||
int NORMMAP = -1;
|
||||
int HEIGHTMAP = -1;
|
||||
int MISCMAP = -1;
|
||||
int AMBIENTMAP = -1;
|
||||
|
||||
size_t bm_texture_ram = 0;
|
||||
int Bm_paging = 0;
|
||||
@@ -80,11 +73,6 @@ const char *bm_ani_ext_list[] = { ".eff", ".ani", ".png" };
|
||||
const int BM_ANI_NUM_TYPES = sizeof(bm_ani_type_list) / sizeof(bm_ani_type_list[0]);
|
||||
|
||||
void(*bm_set_components)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a) = NULL;
|
||||
void(*bm_set_components_32)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a) = NULL;
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Declaration of protected variables (defined in cmdline.cpp).
|
||||
extern int Cmdline_cache_bitmaps;
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Definition of public variables (declared as extern in bm_internal.h).
|
||||
@@ -193,42 +181,6 @@ float bitmap_lookup::map_texture_address(float address)
|
||||
return address - floorf(address);
|
||||
}
|
||||
|
||||
float bitmap_lookup::get_channel_red(float u, float v)
|
||||
{
|
||||
Assert( Bitmap_data != NULL );
|
||||
|
||||
CLAMP(u, 0.0f, 1.0f);
|
||||
CLAMP(v, 0.0f, 1.0f);
|
||||
|
||||
int x = fl2i(map_texture_address(u) * (Width-1));
|
||||
int y = fl2i(map_texture_address(v) * (Height-1));
|
||||
|
||||
return i2fl(Bitmap_data[(y*Width + x)*Num_channels]) / 255.0f;
|
||||
}
|
||||
|
||||
float bitmap_lookup::get_channel_green(float u, float v)
|
||||
{
|
||||
Assert( Bitmap_data != NULL );
|
||||
|
||||
CLAMP(u, 0.0, 1.0f);
|
||||
CLAMP(v, 0.0, 1.0f);
|
||||
|
||||
int x = fl2i(map_texture_address(u) * (Width-1));
|
||||
int y = fl2i(map_texture_address(v) * (Height-1));
|
||||
|
||||
return i2fl(Bitmap_data[(y*Width + x)*Num_channels + 1]) / 255.0f;
|
||||
}
|
||||
|
||||
float bitmap_lookup::get_channel_blue(float u, float v)
|
||||
{
|
||||
Assert( Bitmap_data != NULL );
|
||||
|
||||
int x = fl2i(map_texture_address(u) * (Width-1));
|
||||
int y = fl2i(map_texture_address(v) * (Height-1));
|
||||
|
||||
return i2fl(Bitmap_data[(y*Width + x)*Num_channels + 2]) / 255.0f;
|
||||
}
|
||||
|
||||
float bitmap_lookup::get_channel_alpha(float u, float v)
|
||||
{
|
||||
Assert( Bitmap_data != NULL );
|
||||
@@ -594,7 +546,6 @@ int bm_create(int bpp, int w, int h, void *data, int flags) {
|
||||
sprintf_safe(entry->filename, "TMP%dx%d+%d", w, h, bpp);
|
||||
entry->type = BM_TYPE_USER;
|
||||
entry->comp_type = BM_TYPE_NONE;
|
||||
entry->palette_checksum = 0;
|
||||
|
||||
entry->bm.w = (short)w;
|
||||
entry->bm.h = (short)h;
|
||||
@@ -612,7 +563,6 @@ int bm_create(int bpp, int w, int h, void *data, int flags) {
|
||||
entry->signature = Bm_next_signature++;
|
||||
|
||||
entry->handle = n;
|
||||
entry->last_used = -1;
|
||||
entry->mem_taken = (w * h * (bpp >> 3));
|
||||
|
||||
entry->load_count++;
|
||||
@@ -958,16 +908,6 @@ void bm_get_palette(int handle, ubyte *pal, char *name) {
|
||||
}
|
||||
}
|
||||
|
||||
uint bm_get_signature(int handle) {
|
||||
Assertion(bm_inited, "bmpman must be initialized before this function can be called!");
|
||||
|
||||
return bm_get_entry(handle)->signature;
|
||||
}
|
||||
|
||||
size_t bm_get_size(int handle) {
|
||||
return bm_get_entry(handle)->mem_taken;
|
||||
}
|
||||
|
||||
int bm_get_tcache_type(int num) {
|
||||
if (bm_is_compressed(num))
|
||||
return TCACHE_TYPE_COMPRESSED;
|
||||
@@ -1268,9 +1208,7 @@ int bm_load(const char *real_filename) {
|
||||
entry->num_mipmaps = mm_lvl;
|
||||
entry->mem_taken = (size_t)bm_size;
|
||||
entry->dir_type = CF_TYPE_ANY;
|
||||
entry->palette_checksum = 0;
|
||||
entry->handle = handle;
|
||||
entry->last_used = -1;
|
||||
|
||||
entry->load_count++;
|
||||
|
||||
@@ -1733,10 +1671,8 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
|
||||
entry->bm.palette = nullptr;
|
||||
entry->type = type;
|
||||
entry->comp_type = c_type;
|
||||
entry->palette_checksum = 0;
|
||||
entry->signature = Bm_next_signature++;
|
||||
entry->handle = n + i;
|
||||
entry->last_used = -1;
|
||||
entry->num_mipmaps = mm_lvl;
|
||||
entry->mem_taken = (size_t)img_size;
|
||||
entry->dir_type = dir_type;
|
||||
@@ -1979,8 +1915,6 @@ bitmap * bm_lock(int handle, int bpp, ubyte flags, bool nodebug) {
|
||||
// Mark all the bitmaps in this bitmap or animation as recently used
|
||||
auto frame_entry = bm_get_entry(first + i);
|
||||
|
||||
frame_entry->last_used = timer_get_milliseconds();
|
||||
|
||||
#ifdef BMPMAN_NDEBUG
|
||||
// Mark all the bitmaps in this bitmap or animation as used for the usage tracker.
|
||||
frame_entry->used_count++;
|
||||
@@ -1989,9 +1923,6 @@ bitmap * bm_lock(int handle, int bpp, ubyte flags, bool nodebug) {
|
||||
frame_entry->used_flags = flags;
|
||||
}
|
||||
} else {
|
||||
// Mark all the bitmaps in this bitmap or animation as recently used
|
||||
be->last_used = timer_get_milliseconds();
|
||||
|
||||
#ifdef BMPMAN_NDEBUG
|
||||
// Mark all the bitmaps in this bitmap or animation as used for the usage tracker.
|
||||
be->used_count++;
|
||||
@@ -2536,9 +2467,7 @@ int bm_make_render_target(int width, int height, int flags) {
|
||||
entry->mem_taken = (size_t)size;
|
||||
entry->dir_type = CF_TYPE_ANY;
|
||||
|
||||
entry->palette_checksum = 0;
|
||||
entry->handle = n;
|
||||
entry->last_used = -1;
|
||||
|
||||
if (entry->mem_taken) {
|
||||
entry->bm.data = (ptr_u)bm_malloc(n, entry->mem_taken);
|
||||
@@ -2775,30 +2704,6 @@ void bm_page_in_xparent_texture(int bitmapnum, int nframes) {
|
||||
}
|
||||
}
|
||||
|
||||
bool bm_page_out(int handle) {
|
||||
auto entry = bm_get_entry(handle);
|
||||
|
||||
// in case it's already been released
|
||||
if (entry->type == BM_TYPE_NONE)
|
||||
return 0;
|
||||
|
||||
// it's possible to hit < 0 here when model_page_out_textures() is
|
||||
// called from anywhere other than in a mission
|
||||
if (entry->preload_count > 0) {
|
||||
nprintf(("BmpMan",
|
||||
"PAGE-OUT: %s - preload_count remaining: %d\n",
|
||||
entry->filename,
|
||||
entry->preload_count));
|
||||
|
||||
// lets decrease it for next time around
|
||||
entry->preload_count--;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (bm_unload(handle) == 1);
|
||||
}
|
||||
|
||||
void bm_print_bitmaps() {
|
||||
#ifdef BMPMAN_NDEBUG
|
||||
for (auto& block : bm_blocks) {
|
||||
@@ -2884,7 +2789,6 @@ int bm_release(int handle, int clear_render_targets) {
|
||||
// For debugging:
|
||||
strcpy_s(entry->filename, "IVE_BEEN_RELEASED!");
|
||||
entry->signature = 0xDEADBEEF; // a unique signature identifying the data
|
||||
entry->palette_checksum = 0xDEADBEEF; // checksum used to be sure bitmap is in current palette
|
||||
|
||||
// bookeeping
|
||||
entry->ref_count = -1; // Number of locks on bitmap. Can't unload unless ref_count is 0.
|
||||
@@ -2911,7 +2815,6 @@ int bm_release(int handle, int clear_render_targets) {
|
||||
// For debugging:
|
||||
strcpy_s(entry->filename, "IVE_BEEN_RELEASED!");
|
||||
entry->signature = 0xDEADBEEF; // a unique signature identifying the data
|
||||
entry->palette_checksum = 0xDEADBEEF; // checksum used to be sure bitmap is in current palette
|
||||
|
||||
// bookeeping
|
||||
entry->ref_count = -1; // Number of locks on bitmap. Can't unload unless ref_count is 0.
|
||||
@@ -2953,7 +2856,6 @@ void BM_SELECT_ALPHA_TEX_FORMAT() {
|
||||
Gr_current_alpha = &Gr_ta_alpha;
|
||||
|
||||
// setup pointers
|
||||
bm_set_components_32 = bm_set_components_argb_32_tex;
|
||||
// should always assume that 16-bit is the default request
|
||||
bm_set_components = bm_set_components_argb_16_tex;
|
||||
}
|
||||
@@ -2965,7 +2867,6 @@ void BM_SELECT_SCREEN_FORMAT() {
|
||||
Gr_current_alpha = &Gr_alpha;
|
||||
|
||||
// setup pointers
|
||||
bm_set_components_32 = bm_set_components_argb_32_screen;
|
||||
// should always assume that 16-bit is the default request
|
||||
bm_set_components = bm_set_components_argb_16_screen;
|
||||
}
|
||||
@@ -2977,7 +2878,6 @@ void BM_SELECT_TEX_FORMAT() {
|
||||
Gr_current_alpha = &Gr_t_alpha;
|
||||
|
||||
// setup pointers
|
||||
bm_set_components_32 = bm_set_components_argb_32_tex;
|
||||
// should always assume that 16-bit is the default request
|
||||
bm_set_components = bm_set_components_argb_16_tex;
|
||||
}
|
||||
@@ -3005,29 +2905,6 @@ void bm_set_components_argb_16_tex(ubyte *pixel, ubyte *rv, ubyte *gv, ubyte *bv
|
||||
*((unsigned short*)pixel) |= (unsigned short)(Gr_current_alpha->mask);
|
||||
}
|
||||
|
||||
void bm_set_components_argb_32_screen(ubyte *pixel, ubyte *rv, ubyte *gv, ubyte *bv, ubyte *av) {
|
||||
if (*av == 0) {
|
||||
*((unsigned int*)pixel) = (unsigned int)Gr_current_green->mask;
|
||||
return;
|
||||
}
|
||||
|
||||
*((unsigned int*)pixel) = (unsigned int)(((int)*rv / Gr_current_red->scale) << Gr_current_red->shift);
|
||||
*((unsigned int*)pixel) |= (unsigned int)(((int)*gv / Gr_current_green->scale) << Gr_current_green->shift);
|
||||
*((unsigned int*)pixel) |= (unsigned int)(((int)*bv / Gr_current_blue->scale) << Gr_current_blue->shift);
|
||||
}
|
||||
|
||||
void bm_set_components_argb_32_tex(ubyte *pixel, ubyte *rv, ubyte *gv, ubyte *bv, ubyte *av) {
|
||||
if (*av == 0) {
|
||||
*((unsigned int*)pixel) = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
*((unsigned int*)pixel) = (unsigned int)(((int)*rv / Gr_current_red->scale) << Gr_current_red->shift);
|
||||
*((unsigned int*)pixel) |= (unsigned int)(((int)*gv / Gr_current_green->scale) << Gr_current_green->shift);
|
||||
*((unsigned int*)pixel) |= (unsigned int)(((int)*bv / Gr_current_blue->scale) << Gr_current_blue->shift);
|
||||
*((unsigned int*)pixel) |= (unsigned int)(Gr_current_alpha->mask);
|
||||
}
|
||||
|
||||
void bm_set_low_mem(int mode) {
|
||||
Assert((mode >= 0) && (mode <= 2));
|
||||
|
||||
|
||||
@@ -113,12 +113,7 @@ extern const BM_TYPE bm_ani_type_list[]; //!< List of valid bitmap animation t
|
||||
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
|
||||
@@ -167,9 +162,6 @@ public:
|
||||
|
||||
bool valid();
|
||||
|
||||
float get_channel_red(float u, float v);
|
||||
float get_channel_green(float u, float v);
|
||||
float get_channel_blue(float u, float v);
|
||||
float get_channel_alpha(float u, float v);
|
||||
};
|
||||
|
||||
@@ -311,13 +303,6 @@ int bm_load_either(const char *filename, int *nframes = NULL, int *fps = NULL, i
|
||||
*/
|
||||
bitmap* bm_lock(int handle, int 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
|
||||
*/
|
||||
@@ -459,15 +444,6 @@ void bm_page_in_xparent_texture(int bitmapnum, int num_frames = 1);
|
||||
*/
|
||||
void bm_page_in_aabitmap(int bitmapnum, int num_frames = 1);
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
bool bm_page_out(int handle);
|
||||
|
||||
/**
|
||||
* @brief Sets BMPMAN's memory mode
|
||||
*
|
||||
@@ -516,16 +492,6 @@ void BM_SELECT_ALPHA_TEX_FORMAT();
|
||||
*/
|
||||
extern void(*bm_set_components)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
|
||||
/**
|
||||
* @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
|
||||
*
|
||||
@@ -533,13 +499,6 @@ extern void(*bm_set_components_32)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, u
|
||||
*/
|
||||
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
|
||||
*
|
||||
@@ -561,15 +520,7 @@ void bm_set_components_argb_32_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, u
|
||||
*/
|
||||
void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
|
||||
extern int UNLITMAP; //this holds a reference to a map that is optional used instead of the base map for unlit rendering
|
||||
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 SPECGLOSSMAP; //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 AMBIENTMAP; // ambient occluion map. red channel affects ambient lighting, green channel affects diffuse and specular
|
||||
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
|
||||
@@ -581,10 +532,6 @@ int bm_is_compressed(int handle);
|
||||
*/
|
||||
int bm_get_tcache_type(int handle);
|
||||
|
||||
/**
|
||||
* @brief Gets the size, in bytes, taken up by the bitmap indexed by handle
|
||||
*/
|
||||
size_t bm_get_size(int handle);
|
||||
|
||||
/**
|
||||
* @brief Gets the number of mipmaps of the indexed texture
|
||||
|
||||
+2
-14
@@ -145,7 +145,7 @@ void camera::set_object_target(object *objp, int n_object_target_submodel)
|
||||
* Custom function receives the already-modified current position value.
|
||||
* It should be replaced or added to as the custom function modifier sees fit.
|
||||
*/
|
||||
void camera::set_custom_position_function(void (*n_func_custom_position)(camera *cam, vec3d *camera_pos))
|
||||
void camera::set_custom_position_function(void (*n_func_custom_position)(camera* /*cam*/, vec3d* /*camera_pos*/))
|
||||
{
|
||||
func_custom_position = n_func_custom_position;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ void camera::set_custom_position_function(void (*n_func_custom_position)(camera
|
||||
* Custom function receives the already-modified current orientation value.
|
||||
* It should be replaced or added to as the custom function modifier sees fit.
|
||||
*/
|
||||
void camera::set_custom_orientation_function(void (*n_func_custom_orientation)(camera *cam, matrix *camera_ori))
|
||||
void camera::set_custom_orientation_function(void (*n_func_custom_orientation)(camera* /*cam*/, matrix* /*camera_ori*/))
|
||||
{
|
||||
func_custom_orientation = n_func_custom_orientation;
|
||||
}
|
||||
@@ -185,13 +185,6 @@ void camera::set_position(vec3d *in_position, float in_translation_time, float i
|
||||
pos_z.setAVD(in_position->xyz.z, in_translation_time, in_translation_acceleration_time, in_translation_deceleration_time, in_end_velocity);
|
||||
}
|
||||
|
||||
void camera::set_translation_velocity(vec3d *in_velocity, float in_acceleration_time)
|
||||
{
|
||||
pos_x.setVD(in_acceleration_time, in_acceleration_time, in_velocity->xyz.x);
|
||||
pos_y.setVD(in_acceleration_time, in_acceleration_time, in_velocity->xyz.y);
|
||||
pos_z.setVD(in_acceleration_time, in_acceleration_time, in_velocity->xyz.z);
|
||||
}
|
||||
|
||||
void camera::set_rotation(matrix *in_orientation, float in_rotation_time, float in_rotation_acceleration_time, float in_rotation_deceleration_time)
|
||||
{
|
||||
if(in_orientation != NULL && in_rotation_time == 0.0f && in_rotation_acceleration_time == 0.0f && in_rotation_deceleration_time == 0.0f)
|
||||
@@ -245,11 +238,6 @@ void camera::set_rotation_facing(vec3d *in_target, float in_rotation_time, float
|
||||
set_rotation(&temp_matrix, in_rotation_time, in_rotation_acceleration_time, in_rotation_deceleration_time);
|
||||
}
|
||||
|
||||
void camera::set_rotation_velocity(angles * /*in_rotation_rate*/, float /*in_acceleration_time*/)
|
||||
{
|
||||
Error(LOCATION, "This function is disabled until further notice.");
|
||||
}
|
||||
|
||||
void camera::do_frame(float /*in_frametime*/)
|
||||
{
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
class camera
|
||||
{
|
||||
friend class avd_camera;
|
||||
protected:
|
||||
char name[NAME_LENGTH];
|
||||
int sig;
|
||||
@@ -60,12 +59,10 @@ public:
|
||||
void set_fov(float in_fov, float in_fov_time = 0.0f, float in_fov_acceleration_time = 0.0f, float in_deceleration_time = 0.0f);
|
||||
|
||||
void set_position(vec3d *in_position = NULL, float in_translation_time = 0.0f, float in_translation_acceleration_time = 0.0f, float in_translation_deceleration_time = 0.0f, float in_end_velocity = 0.0f);
|
||||
void set_translation_velocity(vec3d *in_velocity, float in_acceleration_time = 0.0f);
|
||||
|
||||
void set_rotation(matrix *in_orientation = NULL, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f, float in_rotation_deceleration_time = 0.0f);
|
||||
void set_rotation(angles *in_angles, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f, float in_rotation_deceleration_time = 0.0f);
|
||||
void set_rotation_facing(vec3d *in_target, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f, float in_rotation_deceleration_time = 0.0f);
|
||||
void set_rotation_velocity(angles *in_rotation_rate, float in_acceleration_time = 0.0f);
|
||||
|
||||
//Get
|
||||
const char* get_name() { return name; }
|
||||
|
||||
@@ -242,16 +242,6 @@ int cfile_init(const char *exe_dir, const char *cdrom_dir)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Call this if pack files got added or removed or the
|
||||
// cdrom changed. This will refresh the list of filenames
|
||||
// stored in packfiles and on the cdrom.
|
||||
void cfile_refresh()
|
||||
{
|
||||
cf_build_secondary_filelist(Cfile_cdrom_dir);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
// Changes to a drive if valid.. 1=A, 2=B, etc
|
||||
// If flag, then changes to it.
|
||||
@@ -643,9 +633,6 @@ void cf_create_directory(int dir_type, uint32_t location_flags)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern int game_cd_changed();
|
||||
|
||||
// cfopen()
|
||||
//
|
||||
// parameters: *filepath ==> name of file to open (may be path+name)
|
||||
@@ -1168,17 +1155,6 @@ const void *cf_returndata(CFILE *cfile)
|
||||
return cb->data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// version number of opened file. Will be 0 unless you put something else here after you
|
||||
// open a file. Once set, you can use minimum version numbers with the read functions.
|
||||
void cf_set_version( CFILE * cfile, int version )
|
||||
{
|
||||
Assert(cfile != NULL);
|
||||
|
||||
cfile->version = version;
|
||||
}
|
||||
|
||||
// cutoff point where cfread() will throw an error when it hits this limit
|
||||
// if 'len' is 0 then this check will be disabled
|
||||
void cf_set_max_read_len( CFILE * cfile, size_t len )
|
||||
@@ -1296,22 +1272,6 @@ void cfread_vector(vec3d *vec, CFILE *file, int ver, vec3d *deflt)
|
||||
vec->xyz.y = cfread_float(file, ver, deflt ? deflt->xyz.y : 0.0f);
|
||||
vec->xyz.z = cfread_float(file, ver, deflt ? deflt->xyz.z : 0.0f);
|
||||
}
|
||||
|
||||
void cfread_angles(angles *ang, CFILE *file, int ver, angles *deflt)
|
||||
{
|
||||
if (file->version < ver) {
|
||||
if (deflt)
|
||||
*ang = *deflt;
|
||||
else
|
||||
ang->p = ang->b = ang->h = 0.0f;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ang->p = cfread_float(file, ver, deflt ? deflt->p : 0.0f);
|
||||
ang->b = cfread_float(file, ver, deflt ? deflt->b : 0.0f);
|
||||
ang->h = cfread_float(file, ver, deflt ? deflt->h : 0.0f);
|
||||
}
|
||||
|
||||
char cfread_char(CFILE *file, int ver, char deflt)
|
||||
{
|
||||
@@ -1400,28 +1360,6 @@ int cfwrite_ubyte(ubyte b, CFILE *file)
|
||||
return cfwrite(&b, sizeof(b), 1, file);
|
||||
}
|
||||
|
||||
int cfwrite_vector(vec3d *vec, CFILE *file)
|
||||
{
|
||||
if(!cfwrite_float(vec->xyz.x, file)){
|
||||
return 0;
|
||||
}
|
||||
if(!cfwrite_float(vec->xyz.y, file)){
|
||||
return 0;
|
||||
}
|
||||
return cfwrite_float(vec->xyz.z, file);
|
||||
}
|
||||
|
||||
int cfwrite_angles(angles *ang, CFILE *file)
|
||||
{
|
||||
if(!cfwrite_float(ang->p, file)){
|
||||
return 0;
|
||||
}
|
||||
if(!cfwrite_float(ang->b, file)){
|
||||
return 0;
|
||||
}
|
||||
return cfwrite_float(ang->h, file);
|
||||
}
|
||||
|
||||
int cfwrite_char(char b, CFILE *file)
|
||||
{
|
||||
return cfwrite( &b, sizeof(b), 1, file);
|
||||
|
||||
@@ -155,9 +155,6 @@ enum CFileLocationFlags {
|
||||
CF_LOCATION_ALL = CF_LOCATION_ROOT_MASK | CF_LOCATION_TYPE_MASK
|
||||
};
|
||||
|
||||
#define cfread_fix(file) (fix)cfread_int(file)
|
||||
#define cfwrite_fix(i,file) cfwrite_int(i,file)
|
||||
|
||||
// callback function used for get_file_list() to filter files to be added to list. Return 1
|
||||
// to add file to list, or 0 to not add it.
|
||||
extern int (*Get_file_list_filter)(const char *filename);
|
||||
@@ -176,11 +173,6 @@ extern char Cfile_user_dir[CFILE_ROOT_DIRECTORY_LEN];
|
||||
int cfile_init(const char *exe_dir, const char *cdrom_dir=NULL);
|
||||
void cfile_close();
|
||||
|
||||
// Call this if pack files got added or removed or the
|
||||
// cdrom changed. This will refresh the list of filenames
|
||||
// stored in packfiles and on the cdrom.
|
||||
void cfile_refresh();
|
||||
|
||||
// add an extension to a filename if it doesn't already have it
|
||||
char *cf_add_ext(const char *filename, const char *ext);
|
||||
|
||||
@@ -202,10 +194,6 @@ CFILE *_cfopen_special(const char* source_file, int line, const char *file_path,
|
||||
// Flush the open file buffer
|
||||
int cflush(CFILE *cfile);
|
||||
|
||||
// version number of opened file. Will be 0 unless you put something else here after you
|
||||
// open a file. Once set, you can use minimum version numbers with the read functions.
|
||||
void cf_set_version( CFILE * cfile, int version );
|
||||
|
||||
// will throw an error if cfread*() functions read past this mark
|
||||
// converted to raw offsets when used, but gets passed actual length from current position
|
||||
// setting 'len' to zero will disable the check
|
||||
@@ -246,10 +234,6 @@ int cfread(void *buf, int elsize, int nelem, CFILE *fp);
|
||||
// cfwrite() writes to the file
|
||||
int cfwrite(const void *buf, int elsize, int nelem, CFILE *cfile);
|
||||
|
||||
// Reads/writes RLE compressed data.
|
||||
int cfread_compressed(void *buf, int elsize, int nelem, CFILE *cfile);
|
||||
int cfwrite_compressed(void *param_buf, int param_elsize, int param_nelem, CFILE *cfile);
|
||||
|
||||
// Moves the file pointer
|
||||
int cfseek(CFILE *fp, int offset, int where);
|
||||
|
||||
@@ -301,7 +285,6 @@ uint cf_add_chksum_long(uint seed, ubyte *buffer, size_t size);
|
||||
// convenient for misc checksumming purposes ------------------------------------------
|
||||
|
||||
//================= HIGH LEVEL FUNCTIONS ==================
|
||||
int cfexist(const char *filename); // Returns true if file exists on disk (1) or in hog (2).
|
||||
|
||||
// rename a file, utilizing the extension to determine where file is.
|
||||
#define CF_RENAME_SUCCESS 0 // successfully renamed the file
|
||||
@@ -319,7 +302,6 @@ int cfile_flush_dir(int type);
|
||||
// functions for reading from cfile
|
||||
// These are all high level, built up from
|
||||
// cfread.
|
||||
int cfgetc(CFILE *fp);
|
||||
char *cfgets(char *buf, size_t n, CFILE *fp);
|
||||
char cfread_char(CFILE *file, int ver = 0, char deflt = 0);
|
||||
ubyte cfread_ubyte(CFILE *file, int ver = 0, ubyte deflt = 0);
|
||||
@@ -329,7 +311,6 @@ int cfread_int(CFILE *file, int ver = 0, int deflt = 0);
|
||||
uint cfread_uint(CFILE *file, int ver = 0, uint deflt = 0);
|
||||
float cfread_float(CFILE *file, int ver = 0, float deflt = 0.0f);
|
||||
void cfread_vector(vec3d *vec, CFILE *file, int ver = 0, vec3d *deflt = NULL);
|
||||
void cfread_angles(angles *ang, CFILE *file, int ver = 0, angles *deflt = NULL);
|
||||
|
||||
// Reads variable length, null-termined string. Will only read up
|
||||
// to n characters.
|
||||
@@ -360,8 +341,6 @@ int cfwrite_uint(uint i, CFILE *file);
|
||||
int cfwrite_short(short s, CFILE *file);
|
||||
int cfwrite_ushort(ushort s, CFILE *file);
|
||||
int cfwrite_ubyte(ubyte u, CFILE *file);
|
||||
int cfwrite_vector(vec3d *vec, CFILE *file);
|
||||
int cfwrite_angles(angles *ang, CFILE *file);
|
||||
|
||||
// writes variable length, null-termined string.
|
||||
int cfwrite_string(const char *buf, CFILE *file);
|
||||
|
||||
@@ -32,7 +32,6 @@ typedef struct Cfile_block {
|
||||
HANDLE hInFile; // Handle from CreateFile()
|
||||
HANDLE hMapFile; // Handle from CreateFileMapping()
|
||||
#else
|
||||
// int fd; // file descriptor
|
||||
size_t data_length; // length of data for mmap
|
||||
#endif
|
||||
size_t lib_offset;
|
||||
|
||||
+1
-350
@@ -200,353 +200,4 @@ void cf_sort_filenames( int n, char **list, int sort, file_list_info *info )
|
||||
}
|
||||
|
||||
nprintf(("Error", "Unknown sorting method %d passed to cf_sort_filenames()\n", sort));
|
||||
}
|
||||
|
||||
|
||||
#if (0) // these aren't used anywhere now
|
||||
|
||||
// cf_compress - Do Run Length Compression on a block of data. Targa format.
|
||||
//
|
||||
// Usage:
|
||||
// out Buffer to write it out to
|
||||
// in Buffer to compress
|
||||
// bytecount Number of bytes input
|
||||
int cf_compress(char *out, char *in, int bytecount )
|
||||
{
|
||||
int pixcount; // number of pixels in the current packet
|
||||
char *inputpixel=NULL; // current input pixel position
|
||||
char *matchpixel=NULL; // pixel value to match for a run
|
||||
char *flagbyte=NULL; // location of last flag byte to set
|
||||
int rlcount; // current count in r.l. string
|
||||
int rlthresh; // minimum valid run length
|
||||
char *copyloc; // location to begin copying at
|
||||
|
||||
// set the threshold -- the minimum valid run length
|
||||
rlthresh = 2; // Require a 2 pixel span before rle'ing
|
||||
|
||||
// set the first pixel up
|
||||
|
||||
flagbyte = out; // place to put next flag if run
|
||||
inputpixel = in;
|
||||
pixcount = 1;
|
||||
rlcount = 0;
|
||||
copyloc = (char *)0;
|
||||
|
||||
// loop till data processing complete
|
||||
do {
|
||||
|
||||
// if we have accumulated a 128-byte packet, process it
|
||||
if ( pixcount == 129 ) {
|
||||
*flagbyte = 127;
|
||||
|
||||
// set the run flag if this is a run
|
||||
|
||||
if ( rlcount >= rlthresh ) {
|
||||
*flagbyte |= 0x80;
|
||||
pixcount = 2;
|
||||
}
|
||||
|
||||
// copy the data into place
|
||||
++flagbyte;
|
||||
memmove( flagbyte, copyloc, pixcount-1 );
|
||||
flagbyte += pixcount-1;
|
||||
pixcount = 1;
|
||||
|
||||
// set up for next packet
|
||||
continue;
|
||||
}
|
||||
|
||||
// if zeroth byte, handle as special case
|
||||
if ( pixcount == 1 ) {
|
||||
rlcount = 0;
|
||||
copyloc = inputpixel; /* point to 1st guy in packet */
|
||||
matchpixel = inputpixel; /* set pointer to pix to match */
|
||||
pixcount = 2;
|
||||
inputpixel += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// assembling a packet -- look at next pixel
|
||||
|
||||
// current pixel == match pixel?
|
||||
if ( *inputpixel == *matchpixel ) {
|
||||
|
||||
// establishing a run of enough length to
|
||||
// save space by doing it
|
||||
// -- write the non-run length packet
|
||||
// -- start run-length packet
|
||||
|
||||
if ( ++rlcount == rlthresh ) {
|
||||
|
||||
// close a non-run packet
|
||||
|
||||
if ( pixcount > (rlcount+1) ) {
|
||||
// write out length and do not set run flag
|
||||
|
||||
*flagbyte++ = (char)(pixcount - 2 - rlthresh);
|
||||
|
||||
memmove(flagbyte, copyloc, (pixcount-1-rlcount) );
|
||||
flagbyte += (pixcount-1-rlcount);
|
||||
|
||||
copyloc = inputpixel;
|
||||
pixcount = rlcount + 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// no match -- either break a run or continue without one
|
||||
// if a run exists break it:
|
||||
// write the bytes in the string (1+1)
|
||||
// start the next string
|
||||
|
||||
if ( rlcount >= rlthresh ) {
|
||||
|
||||
*flagbyte++ = (char)(0x80 | rlcount);
|
||||
memmove(flagbyte, copyloc, 1 );
|
||||
flagbyte += 1;
|
||||
pixcount = 1;
|
||||
continue;
|
||||
} else {
|
||||
|
||||
// not a match and currently not a run
|
||||
// - save the current pixel
|
||||
// - reset the run-length flag
|
||||
rlcount = 0;
|
||||
matchpixel = inputpixel;
|
||||
}
|
||||
}
|
||||
pixcount++;
|
||||
inputpixel += 1;
|
||||
} while ( inputpixel < (in + bytecount));
|
||||
|
||||
// quit this buffer without loosing any data
|
||||
if ( --pixcount >= 1 ) {
|
||||
*flagbyte = (char)(pixcount - 1);
|
||||
if ( rlcount >= rlthresh ) {
|
||||
*flagbyte |= 0x80;
|
||||
pixcount = 1;
|
||||
}
|
||||
|
||||
// copy the data into place
|
||||
++flagbyte;
|
||||
memmove(flagbyte, copyloc, pixcount );
|
||||
flagbyte += pixcount;
|
||||
}
|
||||
return(flagbyte-out);
|
||||
}
|
||||
|
||||
|
||||
// cf_decompress - Do Decompression on a run-length encoded block of data. Targa format.
|
||||
//
|
||||
// Usage:
|
||||
// out Buffer to write it out to
|
||||
// in Buffer to compress
|
||||
// bytecount Number of bytes input
|
||||
int cf_decompress(char *out, char *in )
|
||||
{
|
||||
int count;
|
||||
|
||||
char *param_out = out;
|
||||
|
||||
while(1) {
|
||||
|
||||
count = int(*in++);
|
||||
int run_span = count & 0x80;
|
||||
|
||||
count &= (~0x80);
|
||||
|
||||
if ( count > 0 ) {
|
||||
if ( run_span ) {
|
||||
// RLE'd data
|
||||
ubyte c = *in++;
|
||||
|
||||
memset( out, c, count );
|
||||
out += count;
|
||||
} else {
|
||||
memmove( out, in, count );
|
||||
in += count;
|
||||
out += count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return out - param_out;
|
||||
|
||||
}
|
||||
|
||||
#endif // 0
|
||||
|
||||
|
||||
// cfread() reads from a file and decompresses it
|
||||
//
|
||||
// returns: returns the number of full elements read
|
||||
//
|
||||
//
|
||||
int cfread_compressed(void *buf, int elsize, int nelem, CFILE *cfile)
|
||||
{
|
||||
char *out = (char *)buf;
|
||||
|
||||
while(1) {
|
||||
|
||||
ubyte count;
|
||||
|
||||
if ( cfread( &count, 1, 1, cfile ) != 1 ) {
|
||||
break;
|
||||
}
|
||||
|
||||
int run_span = count & 0x80;
|
||||
count &= (~0x80);
|
||||
count++;
|
||||
|
||||
if ( count > 0 ) {
|
||||
if ( run_span ) {
|
||||
// RLE'd data
|
||||
ubyte c;
|
||||
if ( cfread( &c, 1, 1, cfile ) != 1 ) {
|
||||
break;
|
||||
}
|
||||
memset( out, c, count );
|
||||
} else {
|
||||
if ( cfread( out, 1, count, cfile ) != count ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
out += count;
|
||||
if ( out >= (char *)buf + (elsize*nelem)) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (int)((out - (char *)buf)/elsize);
|
||||
}
|
||||
|
||||
int cfwrite_compressed(void *param_buf, int param_elsize, int param_nelem, CFILE *cfile)
|
||||
{
|
||||
char *in = (char *)param_buf;
|
||||
int bytecount = (param_elsize * param_nelem );
|
||||
|
||||
int pixcount; // number of pixels in the current packet
|
||||
char *inputpixel=NULL; // current input pixel position
|
||||
char *matchpixel=NULL; // pixel value to match for a run
|
||||
int rlcount; // current count in r.l. string
|
||||
int rlthresh; // minimum valid run length
|
||||
char *copyloc; // location to begin copying at
|
||||
|
||||
// set the threshold -- the minimum valid run length
|
||||
rlthresh = 2; // Require a 2 pixel span before rle'ing
|
||||
|
||||
// set the first pixel up
|
||||
|
||||
inputpixel = in;
|
||||
pixcount = 1;
|
||||
rlcount = 0;
|
||||
copyloc = (char *)0;
|
||||
|
||||
// loop till data processing complete
|
||||
do {
|
||||
|
||||
// if we have accumulated a 128-byte packet, process it
|
||||
if ( pixcount == 129 ) {
|
||||
ubyte code = 127;
|
||||
|
||||
// set the run flag if this is a run
|
||||
|
||||
if ( rlcount >= rlthresh ) {
|
||||
code |= 0x80;
|
||||
pixcount = 2;
|
||||
}
|
||||
|
||||
cfwrite( &code, 1, 1, cfile );
|
||||
|
||||
// copy the data into place
|
||||
cfwrite( copyloc, 1, pixcount-1, cfile );
|
||||
pixcount = 1;
|
||||
|
||||
// set up for next packet
|
||||
continue;
|
||||
}
|
||||
|
||||
// if zeroth byte, handle as special case
|
||||
if ( pixcount == 1 ) {
|
||||
rlcount = 0;
|
||||
copyloc = inputpixel; /* point to 1st guy in packet */
|
||||
matchpixel = inputpixel; /* set pointer to pix to match */
|
||||
pixcount = 2;
|
||||
inputpixel += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// assembling a packet -- look at next pixel
|
||||
|
||||
// current pixel == match pixel?
|
||||
if ( *inputpixel == *matchpixel ) {
|
||||
|
||||
// establishing a run of enough length to
|
||||
// save space by doing it
|
||||
// -- write the non-run length packet
|
||||
// -- start run-length packet
|
||||
|
||||
if ( ++rlcount == rlthresh ) {
|
||||
|
||||
// close a non-run packet
|
||||
|
||||
if ( pixcount > (rlcount+1) ) {
|
||||
// write out length and do not set run flag
|
||||
|
||||
ubyte code = (ubyte)(pixcount - 2 - rlthresh);
|
||||
cfwrite( &code, 1, 1, cfile );
|
||||
|
||||
cfwrite( copyloc, 1, (pixcount-1-rlcount), cfile );
|
||||
copyloc = inputpixel;
|
||||
pixcount = rlcount + 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// no match -- either break a run or continue without one
|
||||
// if a run exists break it:
|
||||
// write the bytes in the string (1+1)
|
||||
// start the next string
|
||||
|
||||
if ( rlcount >= rlthresh ) {
|
||||
|
||||
ubyte code = (ubyte)(0x80 | rlcount);
|
||||
cfwrite( &code, 1, 1, cfile );
|
||||
cfwrite( copyloc, 1, 1, cfile );
|
||||
pixcount = 1;
|
||||
continue;
|
||||
} else {
|
||||
|
||||
// not a match and currently not a run
|
||||
// - save the current pixel
|
||||
// - reset the run-length flag
|
||||
rlcount = 0;
|
||||
matchpixel = inputpixel;
|
||||
}
|
||||
}
|
||||
pixcount++;
|
||||
inputpixel += 1;
|
||||
} while ( inputpixel < (in + bytecount));
|
||||
|
||||
// quit this buffer without loosing any data
|
||||
if ( --pixcount >= 1 ) {
|
||||
ubyte code = ubyte(pixcount - 1);
|
||||
|
||||
// set the run flag if this is a run
|
||||
|
||||
if ( rlcount >= rlthresh ) {
|
||||
code |= 0x80;
|
||||
pixcount = 1;
|
||||
}
|
||||
|
||||
cfwrite( &code, 1, 1, cfile );
|
||||
|
||||
// copy the data into place
|
||||
cfwrite( copyloc, 1, pixcount, cfile );
|
||||
}
|
||||
|
||||
return param_nelem;
|
||||
}
|
||||
}
|
||||
@@ -204,7 +204,6 @@ Flag exe_params[] =
|
||||
{ "-no_set_gamma", "Disable setting of gamma", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_set_gamma", },
|
||||
{ "-nomovies", "Disable video playback", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomovies", },
|
||||
{ "-noparseerrors", "Disable parsing errors", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noparseerrors", },
|
||||
{ "-query_speech", "Check if this build has speech", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-query_speech", },
|
||||
{ "-loadallweps", "Load all weapons, even those not used", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-loadallweps", },
|
||||
{ "-disable_fbo", "Disable OpenGL RenderTargets", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-disable_fbo", },
|
||||
{ "-disable_pbo", "Disable OpenGL Pixel Buffer Objects", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-disable_pbo", },
|
||||
@@ -212,7 +211,6 @@ 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", },
|
||||
{ "-mipmap", "Enable mipmapping", true, 0, EASY_DEFAULT_MEM, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-mipmap", },
|
||||
{ "-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", },
|
||||
{ "-no_geo_effects", "Disable geometry shader for effects", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
{ "-set_cpu_affinity", "Sets processor affinity to config value", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
@@ -395,10 +393,8 @@ int Cmdline_autopilot_interruptable = 1;
|
||||
int Cmdline_stretch_menu = 0;
|
||||
|
||||
// Audio related
|
||||
cmdline_parm query_speech_arg("-query_speech", NULL, AT_NONE); // Cmdline_query_speech
|
||||
cmdline_parm voice_recognition_arg("-voicer", NULL, AT_NONE); // Cmdline_voice_recognition
|
||||
|
||||
int Cmdline_query_speech = 0;
|
||||
int Cmdline_voice_recognition = 0;
|
||||
int Cmdline_no_enhanced_sound = 0;
|
||||
|
||||
@@ -438,7 +434,6 @@ cmdline_parm atiswap_arg("-ati_swap", NULL, AT_NONE); // Cmdline_atiswap
|
||||
cmdline_parm no3dsound_arg("-no_3d_sound", NULL, AT_NONE); // Cmdline_no_3d_sound - Disable use of full 3D sounds
|
||||
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);
|
||||
cmdline_parm no_geo_sdr_effects("-no_geo_effects", NULL, AT_NONE);
|
||||
cmdline_parm set_cpu_affinity("-set_cpu_affinity", NULL, AT_NONE);
|
||||
@@ -495,7 +490,6 @@ cmdline_parm debug_window_arg("-debug_window", NULL, AT_NONE); // Cmdline_debug_
|
||||
|
||||
|
||||
char *Cmdline_start_mission = NULL;
|
||||
int Cmdline_old_collision_sys = 0;
|
||||
int Cmdline_dis_collisions = 0;
|
||||
int Cmdline_dis_weapons = 0;
|
||||
bool Cmdline_output_sexp_info = false;
|
||||
@@ -1879,9 +1873,6 @@ bool SetCmdlineParams()
|
||||
if ( glow_arg.found() )
|
||||
Cmdline_glow = 0;
|
||||
|
||||
if ( query_speech_arg.found() )
|
||||
Cmdline_query_speech = 1;
|
||||
|
||||
if ( ship_choice_3d_arg.found() )
|
||||
Cmdline_ship_choice_3d = 1;
|
||||
|
||||
@@ -1964,9 +1955,6 @@ bool SetCmdlineParams()
|
||||
Cmdline_ballistic_gauge = 1;
|
||||
}
|
||||
|
||||
if(old_collision_system.found())
|
||||
Cmdline_old_collision_sys = 1;
|
||||
|
||||
if(dis_collisions.found())
|
||||
Cmdline_dis_collisions = 1;
|
||||
|
||||
|
||||
@@ -101,7 +101,6 @@ extern int Cmdline_autopilot_interruptable;
|
||||
extern int Cmdline_stretch_menu;
|
||||
|
||||
// Audio related
|
||||
extern int Cmdline_query_speech;
|
||||
extern int Cmdline_voice_recognition;
|
||||
extern int Cmdline_no_enhanced_sound;
|
||||
|
||||
@@ -140,7 +139,6 @@ extern bool Cmdline_alternate_registry_path;
|
||||
|
||||
// Developer/Testing related
|
||||
extern char *Cmdline_start_mission;
|
||||
extern int Cmdline_old_collision_sys;
|
||||
extern int Cmdline_dis_collisions;
|
||||
extern int Cmdline_dis_weapons;
|
||||
extern bool Cmdline_output_sexp_info;
|
||||
|
||||
@@ -53,26 +53,6 @@ void cmeasure_set_ship_launch_vel(object *objp, object *parent_objp, int arand)
|
||||
vm_vec_copy_scale(&objp->phys_info.desired_vel, &objp->orient.vec.fvec, objp->phys_info.max_vel.xyz.z );
|
||||
}
|
||||
|
||||
void cmeasure_select_next(ship *shipp)
|
||||
{
|
||||
Assert(shipp != NULL);
|
||||
int i, new_index;
|
||||
|
||||
for (i = 1; i < Num_weapon_types; i++)
|
||||
{
|
||||
new_index = (shipp->current_cmeasure + i) % Num_weapon_types;
|
||||
|
||||
if(Weapon_info[new_index].wi_flags[Weapon::Info_Flags::Cmeasure])
|
||||
{
|
||||
shipp->current_cmeasure = new_index;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mprintf(("Countermeasure type set to %i in frame %i\n", shipp->current_cmeasure, Framecount));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief If this is a player countermeasure, let the player know they evaded a missile.
|
||||
* @param objp [description]
|
||||
|
||||
@@ -28,7 +28,6 @@ extern int Cmeasures_homing_check;
|
||||
extern int Countermeasures_enabled;
|
||||
|
||||
extern void cmeasure_set_ship_launch_vel(object *objp, object *parent_objp, int arand);
|
||||
extern void cmeasure_select_next(object *objp);
|
||||
extern void cmeasure_maybe_alert_success(object *objp);
|
||||
|
||||
#endif // _CMEASURE_H
|
||||
@@ -38,7 +38,6 @@
|
||||
|
||||
|
||||
|
||||
#define NUM_SYSTEM_KEYS 14
|
||||
#define NUM_BUTTONS 19
|
||||
#define NUM_TABS 4
|
||||
|
||||
@@ -157,11 +156,6 @@ char *Mouse_button_text[NUM_MOUSE_TEXT];
|
||||
char *Mouse_axis_text[NUM_MOUSE_AXIS_TEXT];
|
||||
char *Invert_text[NUM_INVERT_TEXT];
|
||||
|
||||
ubyte System_keys[NUM_SYSTEM_KEYS] = {
|
||||
KEY_ESC, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10,
|
||||
KEY_F11, KEY_F12, KEY_PRINT_SCRN
|
||||
};
|
||||
|
||||
int Control_check_count = 0;
|
||||
|
||||
static int Tab; // which tab we are currently in
|
||||
@@ -2193,17 +2187,6 @@ void control_config_do_frame(float frametime)
|
||||
gr_flip();
|
||||
}
|
||||
|
||||
void clear_key_binding(short key)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<CCFG_MAX; i++) {
|
||||
if (Control_config[i].key_id == key) {
|
||||
Control_config[i].key_id = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float check_control_timef(int id)
|
||||
{
|
||||
float t1, t2;
|
||||
@@ -2447,9 +2430,4 @@ void control_config_clear()
|
||||
for (i=0; i<CCFG_MAX; i++) {
|
||||
Control_config[i].key_id = Control_config[i].joy_id = -1;
|
||||
}
|
||||
}
|
||||
|
||||
int control_config_handle_conflict()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -277,12 +277,6 @@ enum IoActionId {
|
||||
};
|
||||
|
||||
extern int Failed_key_index;
|
||||
extern int Invert_heading;
|
||||
extern int Invert_pitch;
|
||||
extern int Invert_roll;
|
||||
extern int Invert_thrust;
|
||||
extern int Disable_axis2;
|
||||
extern int Disable_axis3;
|
||||
|
||||
extern int Axis_map_to[];
|
||||
extern int Invert_axis[];
|
||||
@@ -336,7 +330,6 @@ int check_control(int id, int key = -1);
|
||||
void control_get_axes_readings(int *h, int *p, int *b, int *ta, int *tr);
|
||||
void control_used(int id);
|
||||
void control_config_clear();
|
||||
void clear_key_binding(short key);
|
||||
void control_check_indicate();
|
||||
void control_config_clear_used_status();
|
||||
|
||||
|
||||
@@ -34,13 +34,6 @@ int Failed_key_index;
|
||||
int Joy_dead_zone_size = 10;
|
||||
int Joy_sensitivity = 9;
|
||||
|
||||
// assume control keys are used as modifiers until we find out
|
||||
int Shift_is_modifier;
|
||||
int Ctrl_is_modifier;
|
||||
int Alt_is_modifier;
|
||||
|
||||
int Axis_enabled[JOY_NUM_AXES] = { 1, 1, 1, 0, 0, 0 };
|
||||
int Axis_enabled_defaults[JOY_NUM_AXES] = { 1, 1, 1, 0, 0, 0 };
|
||||
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 };
|
||||
|
||||
@@ -410,31 +403,6 @@ const char **Joy_button_text = Joy_button_text_english;
|
||||
SCP_vector<config_item*> Control_config_presets;
|
||||
SCP_vector<SCP_string> Control_config_preset_names;
|
||||
|
||||
void set_modifier_status()
|
||||
{
|
||||
int i;
|
||||
|
||||
Alt_is_modifier = 0;
|
||||
Shift_is_modifier = 0;
|
||||
Ctrl_is_modifier = 0;
|
||||
|
||||
for (i=0; i<CCFG_MAX; i++) {
|
||||
if (Control_config[i].key_id < 0)
|
||||
continue;
|
||||
|
||||
if (Control_config[i].key_id & KEY_ALTED)
|
||||
Alt_is_modifier = 1;
|
||||
|
||||
if (Control_config[i].key_id & KEY_SHIFTED)
|
||||
Shift_is_modifier = 1;
|
||||
|
||||
if (Control_config[i].key_id & KEY_CTRLED) {
|
||||
Assert(0); // get Alan
|
||||
Ctrl_is_modifier = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If find_override is set to true, then this returns the index of the action
|
||||
// which has been bound to the given key. Otherwise, the index of the action
|
||||
// which has the given key as its default key will be returned.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace cutscene {
|
||||
FrameSize::FrameSize(size_t in_width, size_t in_height, size_t in_stride)
|
||||
: width(in_width), height(in_height), stride(in_stride)
|
||||
: width(in_width), height(in_height), stride(in_stride)
|
||||
{
|
||||
}
|
||||
FrameSize::FrameSize() = default;
|
||||
@@ -46,10 +46,6 @@ void Decoder::stopDecoder() {
|
||||
m_subtitleQueue->close();
|
||||
}
|
||||
|
||||
bool Decoder::canPushAudioData() {
|
||||
return !isAudioQueueFull();
|
||||
}
|
||||
|
||||
void Decoder::pushAudioData(AudioFramePtr&& data) {
|
||||
Assertion(data, "Invalid audio data passed!");
|
||||
|
||||
@@ -61,9 +57,6 @@ void Decoder::pushAudioData(AudioFramePtr&& data) {
|
||||
}
|
||||
}
|
||||
|
||||
bool Decoder::canPushSubtitleData() {
|
||||
return !isSubtitleQueueFull();
|
||||
}
|
||||
void Decoder::pushSubtitleData(SubtitleFramePtr&& data) {
|
||||
Assertion(data, "Invalid audio data passed!");
|
||||
|
||||
@@ -75,10 +68,6 @@ void Decoder::pushSubtitleData(SubtitleFramePtr&& data) {
|
||||
}
|
||||
}
|
||||
|
||||
bool Decoder::canPushVideoData() {
|
||||
return !isVideoQueueFull();
|
||||
}
|
||||
|
||||
void Decoder::pushFrameData(VideoFramePtr&& frame) {
|
||||
Assertion(frame, "Invalid video data passed!");
|
||||
|
||||
|
||||
+1
-11
@@ -11,8 +11,8 @@ struct FrameSize {
|
||||
size_t height = 0;
|
||||
size_t stride = 0;
|
||||
|
||||
FrameSize(size_t width, size_t in_height, size_t in_stride);
|
||||
FrameSize();
|
||||
FrameSize(size_t width, size_t in_height, size_t in_stride);
|
||||
};
|
||||
|
||||
class VideoFrame {
|
||||
@@ -147,10 +147,6 @@ class Decoder {
|
||||
|
||||
bool isSubtitleQueueFull() { return m_subtitleQueue->size() == m_queueSize; }
|
||||
|
||||
bool isSubtitleFrameAvailable() { return !m_subtitleQueue->empty(); }
|
||||
|
||||
size_t getSubtitleQueueSize() { return m_subtitleQueue->size(); }
|
||||
|
||||
bool tryPopSubtitleData(SubtitleFramePtr&);
|
||||
|
||||
bool isVideoQueueFull() { return m_videoQueue->size() == m_queueSize; }
|
||||
@@ -168,16 +164,10 @@ class Decoder {
|
||||
protected:
|
||||
void initializeQueues(size_t queueSize);
|
||||
|
||||
bool canPushAudioData();
|
||||
|
||||
void pushAudioData(AudioFramePtr&& data);
|
||||
|
||||
bool canPushSubtitleData();
|
||||
|
||||
void pushSubtitleData(SubtitleFramePtr&& data);
|
||||
|
||||
bool canPushVideoData();
|
||||
|
||||
void pushFrameData(VideoFramePtr&& frame);
|
||||
};
|
||||
}
|
||||
+4
-19
@@ -31,7 +31,6 @@
|
||||
#include "weapon/weapon.h"
|
||||
#include "tracing/Monitor.h"
|
||||
|
||||
#define MAX_LIFE 10.0f
|
||||
#define MIN_RADIUS_FOR_PERSISTANT_DEBRIS 50 // ship radius at which debris from it becomes persistant
|
||||
#define DEBRIS_SOUND_DELAY 2000 // time to start debris sound after created
|
||||
#define MAX_HULL_PIECES MAX_DEBRIS_PIECES // limit the number of hull debris chunks that can exist.
|
||||
@@ -52,10 +51,6 @@ int Debris_num_submodels = 0;
|
||||
#define DEBRIS_DISTANCE_CHECK_TIME (10*1000) // Check every 10 seconds.
|
||||
#define DEBRIS_INDEX(dp) (int)(dp-Debris)
|
||||
|
||||
#define MAX_SPEED_SMALL_DEBRIS 200 // maximum velocity of small debris piece
|
||||
#define MAX_SPEED_BIG_DEBRIS 150 // maximum velocity of big debris piece
|
||||
#define MAX_SPEED_CAPITAL_DEBRIS 100 // maximum velocity of capital debris piece
|
||||
|
||||
/**
|
||||
* Start the sequence of a piece of debris writhing in unholy agony!!!
|
||||
*/
|
||||
@@ -270,13 +265,8 @@ void debris_process_post(object * obj, float frame_time)
|
||||
|
||||
vec3d v1, v2, v3, v4;
|
||||
|
||||
if ( Cmdline_old_collision_sys ) {
|
||||
submodel_get_two_random_points( db->model_num, db->submodel_num, &v1, &v2 );
|
||||
submodel_get_two_random_points( db->model_num, db->submodel_num, &v3, &v4 );
|
||||
} else {
|
||||
submodel_get_two_random_points_better( db->model_num, db->submodel_num, &v1, &v2 );
|
||||
submodel_get_two_random_points_better( db->model_num, db->submodel_num, &v3, &v4 );
|
||||
}
|
||||
submodel_get_two_random_points_better(db->model_num, db->submodel_num, &v1, &v2);
|
||||
submodel_get_two_random_points_better(db->model_num, db->submodel_num, &v3, &v4);
|
||||
|
||||
n = 0;
|
||||
|
||||
@@ -352,12 +342,8 @@ void debris_process_post(object * obj, float frame_time)
|
||||
if ( mr < RAND_MAX/5 ) {
|
||||
vec3d v1, v2;
|
||||
|
||||
if ( Cmdline_old_collision_sys ) {
|
||||
submodel_get_two_random_points( db->model_num, db->submodel_num, &v1, &v2 );
|
||||
} else {
|
||||
submodel_get_two_random_points_better( db->model_num, db->submodel_num, &v1, &v2 );
|
||||
}
|
||||
|
||||
submodel_get_two_random_points_better(db->model_num, db->submodel_num, &v1, &v2);
|
||||
|
||||
db->arc_pts[i][mr % 2] = v1;
|
||||
}
|
||||
}
|
||||
@@ -505,7 +491,6 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
db->flags |= DEBRIS_USED;
|
||||
db->is_hull = hull_flag;
|
||||
db->source_objnum = parent_objnum;
|
||||
db->source_sig = source_obj->signature;
|
||||
db->damage_type_idx = shipp->debris_damage_type_idx;
|
||||
db->ship_info_index = shipp->ship_info_index;
|
||||
db->team = shipp->team;
|
||||
|
||||
@@ -24,7 +24,6 @@ typedef struct debris {
|
||||
debris *next, *prev; // used for a linked list of the hull debris chunks
|
||||
int flags; // See DEBRIS_??? defines
|
||||
int source_objnum; // What object this came from
|
||||
int source_sig; // Signature of the source object
|
||||
int damage_type_idx; // Damage type of this debris
|
||||
int ship_info_index; // Ship info index of the ship type debris came from
|
||||
int team; // Team of the ship where the debris came from
|
||||
|
||||
@@ -70,7 +70,6 @@ int dc_font = font::FONT1;
|
||||
|
||||
SCP_string dc_title;
|
||||
|
||||
#define SCROLL_X_MAX (DBCOLS - DCOLS)
|
||||
#define SCROLL_Y_MAX (DBROWS - DROWS)
|
||||
|
||||
// Commands and History
|
||||
@@ -117,11 +116,6 @@ void dc_draw_window(bool show_prompt);
|
||||
*/
|
||||
void dc_putc(char c);
|
||||
|
||||
/**
|
||||
* @brief Predicate function used to sort debug_commands
|
||||
*/
|
||||
bool dcmd_less(debug_command *first, debug_command *second);
|
||||
|
||||
// ============================== IMPLEMENTATIONS =============================
|
||||
void dc_do_command(SCP_string *cmd_str)
|
||||
{
|
||||
@@ -494,11 +488,6 @@ void dc_putc(char c)
|
||||
line_str->push_back(c);
|
||||
}
|
||||
|
||||
bool dcmd_less(debug_command *first, debug_command *second)
|
||||
{
|
||||
return (strcmp(first->name, second->name) < 0);
|
||||
}
|
||||
|
||||
void debug_console(void (*_func)(void))
|
||||
{
|
||||
int done = 0;
|
||||
|
||||
@@ -28,10 +28,6 @@ debug_command *dc_commands[DC_MAX_COMMANDS];
|
||||
int dc_commands_size = 0;
|
||||
|
||||
// ========================= LOCALS ==========================
|
||||
// dcf_shell commands
|
||||
void dc_shell_font( void );
|
||||
void dc_shell_resize( void );
|
||||
void dc_shell_resize_buf( void );
|
||||
|
||||
// =================== class debug_command ===================
|
||||
debug_command::debug_command()
|
||||
@@ -155,6 +151,4 @@ DCF(help, "Displays the help list." )
|
||||
|
||||
dc_printf(" %s - %s\n", dc_commands[i]->name, dc_commands[i]->help);
|
||||
}
|
||||
}
|
||||
|
||||
debug_command dc_man("man", "Also displays the help list", dcf_help);
|
||||
}
|
||||
@@ -226,6 +226,7 @@ void parse_decals_table(const char* filename) {
|
||||
struct Decal {
|
||||
int definition_handle = -1;
|
||||
object_h object;
|
||||
int orig_obj_type = OBJ_NONE;
|
||||
int submodel = -1;
|
||||
|
||||
float creation_time = -1.0f; //!< The mission time at which this decal was created
|
||||
@@ -244,6 +245,12 @@ struct Decal {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (orig_obj_type != object.objp->type) {
|
||||
mprintf(("Decal object type for object %d has changed from %s to %s. Please let m!m know about this\n",
|
||||
OBJ_INDEX(object.objp), Object_type_names[orig_obj_type], Object_type_names[object.objp->type]));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (lifetime > 0.0f) {
|
||||
if (f2fl(Missiontime) >= creation_time + lifetime) {
|
||||
// Decal has expired
|
||||
@@ -525,6 +532,7 @@ addDecal(creation_info& info, object* host, int submodel, const vec3d& local_pos
|
||||
Decal newDecal;
|
||||
newDecal.definition_handle = info.definition_handle;
|
||||
newDecal.object = object_h(host);
|
||||
newDecal.orig_obj_type = host->type;
|
||||
newDecal.submodel = submodel;
|
||||
newDecal.creation_time = f2fl(Missiontime);
|
||||
newDecal.lifetime = info.lifetime.next();
|
||||
|
||||
@@ -45,7 +45,7 @@ $Fog:
|
||||
+Start dist: 10.0
|
||||
+Compl dist: 600.0
|
||||
$AI:
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "dock" "waypoints" "waypoints once" "depart" "undock" "stay still" "play dead" "stay near ship" )
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "dock" "waypoints" "waypoints once" "depart" "undock" "stay still" "play dead" "play dead (persistent)" "stay near ship" )
|
||||
+Actively Pursues: ( "navbuoy" "sentry gun" "escape pod" "cargo" "support" "stealth" "fighter" "bomber" "fighter/bomber" "transport" "freighter" "awacs" "gas miner" "cruiser" "corvette" "capital" "super cap" "drydock" "knossos device" )
|
||||
+Turrets attack this: YES
|
||||
+Ignored on cripple by: ( "navbuoy" "sentry gun" "escape pod" "cargo" "support" "stealth" "fighter" "bomber" "fighter/bomber" "transport" "freighter" "awacs" "gas miner" "cruiser" "corvette" "capital" "super cap" "drydock" "knossos device" )
|
||||
@@ -79,7 +79,7 @@ $Fog:
|
||||
+Start dist: 10.0
|
||||
+Compl dist: 500.0
|
||||
$AI:
|
||||
+Valid goals: ( "fly to ship" "dock" "undock" "waypoints" "waypoints once" "stay near ship" "keep safe dist" "stay still" "play dead" )
|
||||
+Valid goals: ( "fly to ship" "dock" "undock" "waypoints" "waypoints once" "stay near ship" "keep safe dist" "stay still" "play dead" "play dead (persistent)" )
|
||||
+Accept Player Orders: YES
|
||||
+Player orders: ( "rearm me" "abort rearm" "depart" )
|
||||
+Auto attacks: YES
|
||||
@@ -104,7 +104,7 @@ $Fog:
|
||||
+Start dist: 10.0
|
||||
+Compl dist: 500.0
|
||||
$AI:
|
||||
+Valid goals: ( "fly to ship" "attack ship" "waypoints" "waypoints once" "depart" "attack subsys" "attack wing" "guard ship" "disable ship" "disarm ship" "attack any" "attack ship class" "ignore ship" "ignore ship (new)" "guard wing" "evade ship" "stay still" "play dead" "stay near ship" "keep safe dist" )
|
||||
+Valid goals: ( "fly to ship" "attack ship" "waypoints" "waypoints once" "depart" "attack subsys" "attack wing" "guard ship" "disable ship" "disarm ship" "attack any" "attack ship class" "ignore ship" "ignore ship (new)" "guard wing" "evade ship" "stay still" "play dead" "play dead (persistent)" "stay near ship" "keep safe dist" )
|
||||
+Accept Player Orders: YES
|
||||
+Player Orders: ( "attack ship" "disable ship" "disarm ship" "guard ship" "ignore ship" "ignore ship (new)" "form on wing" "cover me" "attack any" "depart" "disable subsys" )
|
||||
+Auto attacks: YES
|
||||
@@ -130,7 +130,7 @@ $Fog:
|
||||
+Start dist: 10.0
|
||||
+Compl dist: 500.0
|
||||
$AI:
|
||||
+Valid goals: ( "fly to ship" "attack ship" "waypoints" "waypoints once" "depart" "attack subsys" "attack wing" "guard ship" "disable ship" "disarm ship" "attack any" "attack ship class" "ignore ship" "ignore ship (new)" "guard wing" "evade ship" "stay still" "play dead" "stay near ship" "keep safe dist" "form on wing")
|
||||
+Valid goals: ( "fly to ship" "attack ship" "waypoints" "waypoints once" "depart" "attack subsys" "attack wing" "guard ship" "disable ship" "disarm ship" "attack any" "attack ship class" "ignore ship" "ignore ship (new)" "guard wing" "evade ship" "stay still" "play dead" "play dead (persistent)" "stay near ship" "keep safe dist" "form on wing")
|
||||
+Accept Player Orders: YES
|
||||
+Player Orders: ( "attack ship" "disable ship" "disarm ship" "guard ship" "ignore ship" "ignore ship (new)" "form on wing" "cover me" "attack any" "depart" "disable subsys" )
|
||||
+Auto attacks: YES
|
||||
@@ -157,7 +157,7 @@ $Fog:
|
||||
+Start dist: 10.0
|
||||
+Compl dist: 500.0
|
||||
$AI:
|
||||
+Valid goals: ( "fly to ship" "attack ship" "waypoints" "waypoints once" "depart" "attack subsys" "attack wing" "guard ship" "disable ship" "disarm ship" "attack any" "attack ship class" "ignore ship" "ignore ship (new)" "guard wing" "evade ship" "stay still" "play dead" "stay near ship" "keep safe dist" "form on wing" )
|
||||
+Valid goals: ( "fly to ship" "attack ship" "waypoints" "waypoints once" "depart" "attack subsys" "attack wing" "guard ship" "disable ship" "disarm ship" "attack any" "attack ship class" "ignore ship" "ignore ship (new)" "guard wing" "evade ship" "stay still" "play dead" "play dead (persistent)" "stay near ship" "keep safe dist" "form on wing" )
|
||||
+Accept Player Orders: YES
|
||||
+Player Orders: ( "attack ship" "disable ship" "disarm ship" "guard ship" "ignore ship" "ignore ship (new)" "form on wing" "cover me" "attack any" "depart" "disable subsys" )
|
||||
+Auto attacks: YES
|
||||
@@ -184,7 +184,7 @@ $Fog:
|
||||
+Start dist: 10.0
|
||||
+Compl dist: 500.0
|
||||
$AI:
|
||||
+Valid goals: ( "fly to ship" "attack ship" "waypoints" "waypoints once" "depart" "attack subsys" "attack wing" "guard ship" "disable ship" "disarm ship" "attack any" "attack ship class" "ignore ship" "ignore ship (new)" "guard wing" "evade ship" "stay still" "play dead" "stay near ship" "keep safe dist" "form on wing" )
|
||||
+Valid goals: ( "fly to ship" "attack ship" "waypoints" "waypoints once" "depart" "attack subsys" "attack wing" "guard ship" "disable ship" "disarm ship" "attack any" "attack ship class" "ignore ship" "ignore ship (new)" "guard wing" "evade ship" "stay still" "play dead" "play dead (persistent)" "stay near ship" "keep safe dist" "form on wing" )
|
||||
+Accept Player Orders: YES
|
||||
+Player Orders: ( "attack ship" "disable ship" "disarm ship" "guard ship" "ignore ship" "ignore ship (new)" "form on wing" "cover me" "attack any" "depart" "disable subsys" )
|
||||
+Auto attacks: YES
|
||||
@@ -210,7 +210,7 @@ $Fog:
|
||||
+Start dist: 10.0
|
||||
+Compl dist: 500.0
|
||||
$AI:
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "dock" "waypoints" "waypoints once" "depart" "undock" "stay still" "play dead" "stay near ship" )
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "dock" "waypoints" "waypoints once" "depart" "undock" "stay still" "play dead" "play dead (persistent)" "stay near ship" )
|
||||
+Accept Player Orders: YES
|
||||
+Player Orders: ( "attack ship" "dock" "depart" )
|
||||
+Auto attacks: YES
|
||||
@@ -238,7 +238,7 @@ $Fog:
|
||||
+Start dist: 10.0
|
||||
+Compl dist: 600.0
|
||||
$AI:
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "dock" "waypoints" "waypoints once" "depart" "undock" "stay still" "play dead" "stay near ship" )
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "dock" "waypoints" "waypoints once" "depart" "undock" "stay still" "play dead" "play dead (persistent)" "stay near ship" )
|
||||
+Accept Player Orders: YES
|
||||
+Player Orders: ( "attack ship" "dock" "depart" )
|
||||
+Auto attacks: YES
|
||||
@@ -266,7 +266,7 @@ $Fog:
|
||||
+Start dist: 10.0
|
||||
+Compl dist: 600.0
|
||||
$AI:
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "dock" "waypoints" "waypoints once" "depart" "undock" "stay still" "play dead" "stay near ship" )
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "dock" "waypoints" "waypoints once" "depart" "undock" "stay still" "play dead" "play dead (persistent)" "stay near ship" )
|
||||
+Accept Player Orders: YES
|
||||
+Player Orders: ( "attack ship" "depart" )
|
||||
+Auto attacks: YES
|
||||
@@ -293,7 +293,7 @@ $Fog:
|
||||
+Start dist: 10.0
|
||||
+Compl dist: 600.0
|
||||
$AI:
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "dock" "waypoints" "waypoints once" "depart" "undock" "stay still" "play dead" "stay near ship" )
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "dock" "waypoints" "waypoints once" "depart" "undock" "stay still" "play dead" "play dead (persistent)" "stay near ship" )
|
||||
+Accept Player Orders: YES
|
||||
+Player Orders: ( "attack ship" "depart" )
|
||||
+Auto attacks: YES
|
||||
@@ -320,7 +320,7 @@ $Fog:
|
||||
+Start dist: 10.0
|
||||
+Compl dist: 600.0
|
||||
$AI:
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "dock" "waypoints" "waypoints once" "depart" "undock" "stay still" "play dead" "stay near ship" )
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "dock" "waypoints" "waypoints once" "depart" "undock" "stay still" "play dead" "play dead (persistent)" "stay near ship" )
|
||||
+Accept Player Orders: YES
|
||||
+Player Orders: ( "attack ship" "depart" )
|
||||
+Auto attacks: YES
|
||||
@@ -347,7 +347,7 @@ $Fog:
|
||||
+Start dist: 10.0
|
||||
+Compl dist: 600.0
|
||||
$AI:
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "dock" "waypoints" "waypoints once" "depart" "undock" "stay still" "play dead" "stay near ship" )
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "dock" "waypoints" "waypoints once" "depart" "undock" "stay still" "play dead" "play dead (persistent)" "stay near ship" )
|
||||
+Accept Player Orders: YES
|
||||
+Player Orders: ( "attack ship" "depart" )
|
||||
+Auto attacks: YES
|
||||
@@ -375,7 +375,7 @@ $Fog:
|
||||
+Start dist: 10.0
|
||||
+Compl dist: 750.0
|
||||
$AI:
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "waypoints" "waypoints once" "depart" "stay still" "play dead" "stay near ship" )
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "waypoints" "waypoints once" "depart" "stay still" "play dead" "play dead (persistent)" "stay near ship" )
|
||||
+Accept Player Orders: YES
|
||||
+Player Orders: ( "depart" )
|
||||
+Auto attacks: YES
|
||||
@@ -403,7 +403,7 @@ $Fog:
|
||||
+Start dist: 10.0
|
||||
+Compl dist: 1000.0
|
||||
$AI:
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "waypoints" "waypoints once" "depart" "stay still" "play dead" "stay near ship" )
|
||||
+Valid goals: ( "fly to ship" "attack ship" "attack wing" "waypoints" "waypoints once" "depart" "stay still" "play dead" "play dead (persistent)" "stay near ship" )
|
||||
+Auto attacks: YES
|
||||
+Attempt Broadside: YES
|
||||
+Actively Pursues: ( "transport" "freighter" "awacs" "gas miner" "cruiser" "corvette" "capital" "super cap" "drydock" "knossos device" )
|
||||
|
||||
@@ -46,8 +46,6 @@ int Num_fireball_types = 0;
|
||||
bool fireballs_inited = false;
|
||||
bool fireballs_parsed = false;
|
||||
|
||||
#define FB_INDEX(fb) (fb-Fireballs)
|
||||
|
||||
/**
|
||||
* Play warp in sound for warp effect
|
||||
*/
|
||||
@@ -767,7 +765,7 @@ int fireball_get_lod(vec3d *pos, fireball_info *fd, float size)
|
||||
/**
|
||||
* Create a fireball, return object index.
|
||||
*/
|
||||
int fireball_create(vec3d *pos, int fireball_type, int render_type, int parent_obj, float size, int reverse, vec3d *velocity, float warp_lifetime, int ship_class, matrix *orient_override, int low_res, int extra_flags, gamesnd_id warp_open_sound, gamesnd_id warp_close_sound, float warp_open_duration, float warp_close_duration)
|
||||
int fireball_create(vec3d *pos, int fireball_type, int render_type, int parent_obj, float size, bool reverse, vec3d *velocity, float warp_lifetime, int ship_class, matrix *orient_override, int low_res, int extra_flags, gamesnd_id warp_open_sound, gamesnd_id warp_close_sound, float warp_open_duration, float warp_close_duration)
|
||||
{
|
||||
int n, objnum, fb_lod;
|
||||
object *obj;
|
||||
|
||||
@@ -103,11 +103,11 @@ void fireball_parse_tbl();
|
||||
|
||||
int fireball_info_lookup(const char *unique_id);
|
||||
|
||||
// reversed is for warp_in/out effects
|
||||
// Velocity: If not NULL, the fireball will move at a constant velocity.
|
||||
// reverse is for warp_in/out effects
|
||||
// velocity: If not NULL, the fireball will move at a constant velocity.
|
||||
// warp_lifetime: If warp_lifetime > 0.0f then makes the explosion loop so it lasts this long. Only works for warp effect
|
||||
int fireball_create(vec3d *pos, int fireball_type, int render_type, int parent_obj, float size, int reversed=0, vec3d *velocity=nullptr, float warp_lifetime=0.0f, int ship_class=-1, matrix *orient=nullptr, int low_res=0, int extra_flags=0, gamesnd_id warp_open_sound=gamesnd_id(), gamesnd_id warp_close_sound=gamesnd_id(), float warp_open_duration=-1.0f, float warp_close_duration=-1.0f);
|
||||
void fireball_render_plane(int plane);
|
||||
int fireball_create(vec3d *pos, int fireball_type, int render_type, int parent_obj, float size, bool reverse=false, vec3d *velocity=nullptr, float warp_lifetime=0.0f, int ship_class=-1, matrix *orient=nullptr, int low_res=0, int extra_flags=0, gamesnd_id warp_open_sound=gamesnd_id(), gamesnd_id warp_close_sound=gamesnd_id(), float warp_open_duration=-1.0f, float warp_close_duration=-1.0f);
|
||||
|
||||
void fireball_close();
|
||||
|
||||
// Returns 1 if you can remove this fireball
|
||||
|
||||
@@ -109,38 +109,6 @@ static int Gameplay_help_inited = 0;
|
||||
|
||||
static int Current_help_page;
|
||||
|
||||
// generate a line for the on-line help for a control item with specified id
|
||||
// input: id => index for control item within Control_config[]
|
||||
// buf => buffer with enough space to hold ouput string
|
||||
const char *gameplay_help_control_text(int id, char *buf)
|
||||
{
|
||||
int has_key=0, has_joy=0;
|
||||
config_item *ci;
|
||||
|
||||
ci = &Control_config[id];
|
||||
|
||||
if ( ci->key_id >= 0 ) {
|
||||
strcpy(buf, textify_scancode(ci->key_id));
|
||||
has_key=1;
|
||||
}
|
||||
|
||||
if ( ci->joy_id >= 0 ) {
|
||||
if ( has_key ) {
|
||||
strcat(buf, XSTR( ", ", 129));
|
||||
}
|
||||
strcat(buf, Joy_button_text[ci->joy_id]);
|
||||
has_joy=1;
|
||||
}
|
||||
|
||||
if ( !has_key && !has_joy ) {
|
||||
strcpy(buf, XSTR( "no binding", 130));
|
||||
}
|
||||
|
||||
strcat(buf, XSTR( " - ", 131));
|
||||
strcat(buf, ci->text);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
void gameplay_help_blit_control_line(int x, int y, int id)
|
||||
{
|
||||
@@ -824,20 +792,3 @@ void gameplay_help_do_frame(float /*frametime*/)
|
||||
gameplay_help_draw_text();
|
||||
gr_flip();
|
||||
}
|
||||
|
||||
|
||||
// called once when leaving the gameplay help state
|
||||
void gameplay_help_close()
|
||||
{
|
||||
if ( Gameplay_help_inited ) {
|
||||
if (Background_bitmap >= 0) {
|
||||
bm_release(Background_bitmap);
|
||||
}
|
||||
|
||||
Ui_window.destroy();
|
||||
common_free_interface_palette(); // restore game palette
|
||||
game_flush();
|
||||
}
|
||||
|
||||
Gameplay_help_inited = 0;
|
||||
}
|
||||
@@ -13,7 +13,6 @@
|
||||
#define __GAMEPLAY_HELP_H__
|
||||
|
||||
void gameplay_help_init();
|
||||
void gameplay_help_close();
|
||||
void gameplay_help_do_frame(float frametime);
|
||||
|
||||
#endif
|
||||
@@ -350,29 +350,6 @@ void gameseq_pop_state()
|
||||
|
||||
}
|
||||
|
||||
// gameseq_pop_and_discard_state() is used to remove a state that was pushed onto the stack, but
|
||||
// will never need to be popped. An example of this is entering a state that may require returning
|
||||
// to the previous state (then you would call gameseq_pop_state). Or you may simply continue to
|
||||
// another part of the game, to avoid filling up the stack with states that may never be popped, you
|
||||
// call this function to discard the top of the gs.
|
||||
//
|
||||
|
||||
void gameseq_pop_and_discard_state()
|
||||
{
|
||||
if (gs_current_stack > 0 ) {
|
||||
gs_current_stack--;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the last state pushed on stack
|
||||
int gameseq_get_pushed_state()
|
||||
{
|
||||
if (gs_current_stack >= 1) {
|
||||
return gs[gs_current_stack-1].current_state;
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
|
||||
// gameseq_process_events gets called every time through high level loops
|
||||
// (i.e. game loops, main menu loop). Function is responsible for pulling
|
||||
// game sequence events off the queue and changing the state when necessary.
|
||||
|
||||
@@ -181,11 +181,8 @@ int gameseq_get_event( void );
|
||||
void gameseq_set_state(int new_state, int override = 0);
|
||||
void gameseq_push_state( int new_state );
|
||||
void gameseq_pop_state( void );
|
||||
int gameseq_get_pushed_state();
|
||||
int gameseq_get_depth();
|
||||
int gameseq_get_previous_state();
|
||||
void gameseq_pop_and_discard_state(void);
|
||||
|
||||
|
||||
// Called by the sequencing code when things happen.
|
||||
void game_process_event(int current_state, int event);
|
||||
|
||||
@@ -57,11 +57,8 @@ SOUNDTRACK_INFO Soundtracks[MAX_SOUNDTRACKS];
|
||||
int Num_soundtracks;
|
||||
int Current_soundtrack_num; // Active soundtrack for the current mission.. index into Soundtracks[]
|
||||
|
||||
#define PATTERN_DELAY 1000 // in ms
|
||||
int Current_pattern = -1; // currently playing part of track
|
||||
int Pending_pattern = -1;
|
||||
int Pattern_timer_id = 0;
|
||||
int Current_nrml = SONG_NRML_1;
|
||||
|
||||
// File Globals
|
||||
static int Num_enemy_arrivals;
|
||||
@@ -240,7 +237,6 @@ static int Event_music_begun = FALSE;
|
||||
|
||||
// forward function declarations
|
||||
int hostile_ships_present();
|
||||
int hostile_ships_to_arrive();
|
||||
extern int hud_target_invalid_awacs(object *objp);
|
||||
|
||||
// Holds file names of spooled music that is played at menus, briefings, credits etc.
|
||||
@@ -544,7 +540,6 @@ void event_music_level_init(int force_soundtrack)
|
||||
return;
|
||||
|
||||
Current_pattern = -1;
|
||||
Current_nrml = SONG_NRML_1;
|
||||
|
||||
if (Event_music_inited == FALSE)
|
||||
return;
|
||||
@@ -556,15 +551,6 @@ void event_music_level_init(int force_soundtrack)
|
||||
if (Current_soundtrack_num < 0)
|
||||
{
|
||||
return;
|
||||
/*
|
||||
// okay, assign a random soundtrack if one exists
|
||||
if ( Num_soundtracks > 0 ) {
|
||||
Current_soundtrack_num = rand()%Num_soundtracks;
|
||||
nprintf(("EVENTMUSIC", "EVENTMUSIC ==> Picking random event music soundtrack: %s\n", Soundtracks[Current_soundtrack_num].name));
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
Assert(Current_soundtrack_num >= 0 && Current_soundtrack_num < Num_soundtracks);
|
||||
@@ -631,9 +617,7 @@ void event_music_level_init(int force_soundtrack)
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// event_music_first_pattern()
|
||||
//
|
||||
// Picks the first pattern to play, based on whether the battle has started. Delay start
|
||||
// by PATTERN_DELAY
|
||||
//
|
||||
// Picks the first pattern to play, based on whether the battle has started.
|
||||
void event_music_first_pattern()
|
||||
{
|
||||
if ( Event_music_inited == FALSE ) {
|
||||
@@ -1520,59 +1504,6 @@ void event_music_start_default()
|
||||
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// event_music_pause()
|
||||
//
|
||||
// Stop any playing pattern, but don't rewind.
|
||||
//
|
||||
void event_music_pause()
|
||||
{
|
||||
if ( Event_music_enabled == FALSE ) {
|
||||
nprintf(("EVENTMUSIC", "EVENTMUSIC ==> Requested a song switch when event music is not enabled\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if ( Event_music_level_inited == FALSE ) {
|
||||
nprintf(("EVENTMUSIC", "EVENTMUSIC ==> Event music is not enabled\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Current_pattern == -1)
|
||||
return;
|
||||
|
||||
Assert( Current_pattern >= 0 && Current_pattern < MAX_PATTERNS );
|
||||
if ( audiostream_is_playing(Patterns[Current_pattern].handle) ) {
|
||||
audiostream_stop(Patterns[Current_pattern].handle, 0); // stop current and don't rewind
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// event_music_unpause()
|
||||
//
|
||||
// Start the Current_pattern if it is paused.
|
||||
//
|
||||
void event_music_unpause()
|
||||
{
|
||||
if ( Event_music_enabled == FALSE ) {
|
||||
nprintf(("EVENTMUSIC", "EVENTMUSIC ==> Requested a song switch when event music is not enabled\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if ( Event_music_level_inited == FALSE ) {
|
||||
nprintf(("EVENTMUSIC", "EVENTMUSIC ==> Event music is not enabled\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Current_pattern == -1)
|
||||
return;
|
||||
|
||||
Assert( Current_pattern >= 0 && Current_pattern < MAX_PATTERNS );
|
||||
if ( audiostream_is_paused(Patterns[Current_pattern].handle) == TRUE ) {
|
||||
audiostream_play(Patterns[Current_pattern].handle, (Master_event_music_volume * aav_music_volume), 0); // no looping
|
||||
audiostream_set_sample_cutoff(Patterns[Current_pattern].handle, fl2i(Patterns[Current_pattern].num_measures * Patterns[Current_pattern].samples_per_measure) );
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// event_music_set_volume_all()
|
||||
//
|
||||
@@ -1628,33 +1559,6 @@ int hostile_ships_present()
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// hostile_ships_to_arrive()
|
||||
//
|
||||
// Determine if there are any non-friendly ships yet to arrive
|
||||
//
|
||||
// NOTE: neutral ships are considered hostile for the purpose of event music
|
||||
//
|
||||
int hostile_ships_to_arrive()
|
||||
{
|
||||
p_object *p_objp;
|
||||
|
||||
for (p_objp = GET_FIRST(&Ship_arrival_list); p_objp != END_OF_LIST(&Ship_arrival_list); p_objp = GET_NEXT(p_objp))
|
||||
{
|
||||
// check if ship can arrive
|
||||
if (p_objp->flags[Mission::Parse_Object_Flags::SF_Cannot_arrive])
|
||||
continue;
|
||||
|
||||
// check if ship is enemy ship (we attack it)
|
||||
if (!(iff_x_attacks_y(Player_ship->team, p_objp->team)))
|
||||
continue;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// event_music_get_info()
|
||||
//
|
||||
|
||||
@@ -102,8 +102,6 @@ void event_music_level_close();
|
||||
void event_music_do_frame();
|
||||
void event_music_disable();
|
||||
void event_music_enable();
|
||||
void event_music_pause();
|
||||
void event_music_unpause();
|
||||
void event_music_set_volume_all(float volume);
|
||||
void event_music_parse_musictbl(const char *filename);
|
||||
void event_music_change_pattern(int new_pattern);
|
||||
|
||||
@@ -27,12 +27,6 @@
|
||||
|
||||
|
||||
|
||||
static inline int is_power_of_two(int w, int h)
|
||||
{
|
||||
// NOTE: OpenGL texture code has a min tex size of 16 (currently), so we need to be at least
|
||||
// the min size here to qualify as power-of-2 and not get resized later on
|
||||
return ( ((w >= GL_min_texture_width) && !(w & (w-1))) && ((h >= GL_min_texture_height) && !(h & (h-1))) );
|
||||
}
|
||||
|
||||
int get_num_mipmap_levels(int w, int h)
|
||||
{
|
||||
|
||||
@@ -31,6 +31,18 @@
|
||||
|
||||
SCP_vector<opengl_shader_t> GL_shader;
|
||||
|
||||
typedef std::pair<int, uint32_t> shader_descriptor_t;
|
||||
|
||||
struct key_hasher
|
||||
{
|
||||
size_t operator()(const shader_descriptor_t &obj) const
|
||||
{
|
||||
return obj.first ^ obj.second;
|
||||
}
|
||||
};
|
||||
|
||||
SCP_unordered_map<shader_descriptor_t, size_t, key_hasher> GL_shader_map;
|
||||
|
||||
GLuint Framebuffer_fallback_texture_id = 0;
|
||||
|
||||
SCP_vector<opengl_vert_attrib> GL_vertex_attrib_info =
|
||||
@@ -296,12 +308,10 @@ void opengl_shader_set_current(int handle)
|
||||
|
||||
size_t opengl_get_shader_idx(shader_type shader_t, unsigned int flags)
|
||||
{
|
||||
for (size_t idx = 0; idx < GL_shader.size(); idx++) {
|
||||
if (GL_shader[idx].shader == shader_t && GL_shader[idx].flags == flags) {
|
||||
return idx;
|
||||
}
|
||||
auto found = GL_shader_map.find(shader_descriptor_t(shader_t, flags));
|
||||
if (found != GL_shader_map.end()) {
|
||||
return found->second;
|
||||
}
|
||||
|
||||
return GL_shader.size();
|
||||
}
|
||||
|
||||
@@ -327,6 +337,8 @@ void opengl_delete_shader(int sdr_handle)
|
||||
{
|
||||
Assert(sdr_handle >= 0);
|
||||
Assert(sdr_handle < (int)GL_shader.size());
|
||||
opengl_shader_t &victim = GL_shader[sdr_handle];
|
||||
GL_shader_map.erase(shader_descriptor_t(victim.shader, victim.flags));
|
||||
|
||||
GL_shader[sdr_handle].program.reset();
|
||||
|
||||
@@ -341,6 +353,7 @@ void opengl_delete_shader(int sdr_handle)
|
||||
void opengl_shader_shutdown()
|
||||
{
|
||||
GL_shader.clear();
|
||||
GL_shader_map.clear();
|
||||
}
|
||||
|
||||
static SCP_string opengl_shader_get_header(shader_type type_id, int flags, bool has_geo_shader) {
|
||||
@@ -840,6 +853,8 @@ int opengl_compile_shader(shader_type sdr, uint flags)
|
||||
}
|
||||
}
|
||||
|
||||
int new_shader_shader = new_shader.shader;
|
||||
uint32_t new_shader_flags = new_shader.flags;
|
||||
// then insert it at an empty slot or at the end
|
||||
if ( empty_idx >= 0 ) {
|
||||
GL_shader[empty_idx] = std::move(new_shader);
|
||||
@@ -848,7 +863,7 @@ int opengl_compile_shader(shader_type sdr, uint flags)
|
||||
sdr_index = (int)GL_shader.size();
|
||||
GL_shader.push_back(std::move(new_shader));
|
||||
}
|
||||
|
||||
GL_shader_map[shader_descriptor_t(new_shader_shader, new_shader_flags)] = sdr_index;
|
||||
return sdr_index;
|
||||
}
|
||||
|
||||
@@ -939,6 +954,7 @@ void opengl_shader_init()
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, &pixels);
|
||||
|
||||
GL_shader.clear();
|
||||
GL_shader_map.clear();
|
||||
|
||||
// Reserve 32 shader slots. This should cover most use cases in real life.
|
||||
GL_shader.reserve(32);
|
||||
|
||||
@@ -284,37 +284,24 @@ int opengl_free_texture(tcache_slot_opengl *t)
|
||||
// bmap_h == height of source bitmap
|
||||
// tex_w == width of final texture
|
||||
// tex_h == height of final texture
|
||||
int opengl_texture_set_level(int bitmap_handle,
|
||||
int bitmap_type,
|
||||
int bmap_w,
|
||||
int bmap_h,
|
||||
int tex_w,
|
||||
int tex_h,
|
||||
ubyte* data,
|
||||
tcache_slot_opengl* tSlot,
|
||||
int /*base_level*/,
|
||||
bool resize,
|
||||
GLenum intFormat)
|
||||
{
|
||||
static int opengl_texture_set_level(int bitmap_handle, int bitmap_type, int bmap_w, int bmap_h, int tex_w, int tex_h,
|
||||
ubyte* data, tcache_slot_opengl* tSlot, int base_level, int mipmap_levels,
|
||||
bool resize, GLenum intFormat) {
|
||||
GR_DEBUG_SCOPE("Upload single frame");
|
||||
|
||||
int ret_val = 1;
|
||||
ubyte *bmp_data = data;
|
||||
int ret_val = 1;
|
||||
ubyte* bmp_data = data;
|
||||
ubyte *texmem = NULL, *texmemp = NULL;
|
||||
int skip_size = 0, mipmap_levels = 0;
|
||||
int skip_size = 0;
|
||||
|
||||
GL_CHECK_FOR_ERRORS("start of create_texture_sub()");
|
||||
|
||||
// bogus
|
||||
if ( (tSlot == NULL) || (bmp_data == NULL) ) {
|
||||
if ((tSlot == nullptr) || (bmp_data == nullptr)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// for everything that might use mipmaps
|
||||
auto mipmap_w = tex_w;
|
||||
auto mipmap_h = tex_h;
|
||||
|
||||
if ( (bitmap_type == TCACHE_TYPE_AABITMAP) || (bitmap_type == TCACHE_TYPE_INTERFACE) ) {
|
||||
if ((bitmap_type == TCACHE_TYPE_AABITMAP) || (bitmap_type == TCACHE_TYPE_INTERFACE)) {
|
||||
tSlot->u_scale = (float)bmap_w / (float)tex_w;
|
||||
tSlot->v_scale = (float)bmap_h / (float)tex_h;
|
||||
} else {
|
||||
@@ -326,73 +313,207 @@ int opengl_texture_set_level(int bitmap_handle,
|
||||
auto byte_mult = (tSlot->bpp >> 3);
|
||||
|
||||
GLenum texFormat = GL_UNSIGNED_SHORT_1_5_5_5_REV;
|
||||
GLenum glFormat = GL_BGRA;
|
||||
GLenum glFormat = GL_BGRA;
|
||||
// GL_BGRA_EXT is *much* faster with some hardware/drivers
|
||||
if (byte_mult == 4) {
|
||||
texFormat = GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||
intFormat = (gr_screen.bits_per_pixel == 32) ? GL_RGBA8 : GL_RGB5_A1;
|
||||
glFormat = GL_BGRA;
|
||||
glFormat = GL_BGRA;
|
||||
} else if (byte_mult == 3) {
|
||||
texFormat = GL_UNSIGNED_BYTE;
|
||||
intFormat = (gr_screen.bits_per_pixel == 32) ? GL_RGB8 : GL_RGB5;
|
||||
glFormat = GL_BGR;
|
||||
glFormat = GL_BGR;
|
||||
} else if (byte_mult == 2) {
|
||||
texFormat = GL_UNSIGNED_SHORT_1_5_5_5_REV;
|
||||
intFormat = GL_RGB5_A1;
|
||||
glFormat = GL_BGRA;
|
||||
glFormat = GL_BGRA;
|
||||
} else if (byte_mult == 1) {
|
||||
Assertion( bitmap_type == TCACHE_TYPE_AABITMAP, "Invalid type for bitmap: %s BMPMAN handle: %d. Type expected was 0, we got %d instead.\nThis can be caused by using texture compression on a non-power-of-2 texture.\n", bm_get_filename(bitmap_handle), bitmap_handle, bitmap_type );
|
||||
Assertion(bitmap_type == TCACHE_TYPE_AABITMAP,
|
||||
"Invalid type for bitmap: %s BMPMAN handle: %d. Type expected was 0, we got %d instead.\nThis can be "
|
||||
"caused by using texture compression on a non-power-of-2 texture.\n",
|
||||
bm_get_filename(bitmap_handle), bitmap_handle, bitmap_type);
|
||||
texFormat = GL_UNSIGNED_BYTE;
|
||||
intFormat = GL_RED;
|
||||
glFormat = GL_RED;
|
||||
glFormat = GL_RED;
|
||||
} else {
|
||||
texFormat = GL_UNSIGNED_SHORT_1_5_5_5_REV;
|
||||
intFormat = GL_RGBA;
|
||||
glFormat = GL_BGRA;
|
||||
glFormat = GL_BGRA;
|
||||
}
|
||||
|
||||
// check for compressed image types
|
||||
auto block_size = 0;
|
||||
switch ( bm_is_compressed(bitmap_handle) ) {
|
||||
case DDS_DXT1:
|
||||
case DDS_CUBEMAP_DXT1:
|
||||
intFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
|
||||
block_size = 8;
|
||||
break;
|
||||
switch (bm_is_compressed(bitmap_handle)) {
|
||||
case DDS_DXT1:
|
||||
case DDS_CUBEMAP_DXT1:
|
||||
intFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
|
||||
block_size = 8;
|
||||
break;
|
||||
|
||||
case DDS_DXT3:
|
||||
case DDS_CUBEMAP_DXT3:
|
||||
intFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||
block_size = 16;
|
||||
break;
|
||||
case DDS_DXT3:
|
||||
case DDS_CUBEMAP_DXT3:
|
||||
intFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||
block_size = 16;
|
||||
break;
|
||||
|
||||
case DDS_DXT5:
|
||||
case DDS_CUBEMAP_DXT5:
|
||||
intFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
block_size = 16;
|
||||
break;
|
||||
case DDS_DXT5:
|
||||
case DDS_CUBEMAP_DXT5:
|
||||
intFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
block_size = 16;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( bitmap_type == TCACHE_TYPE_CUBEMAP ) {
|
||||
if (bitmap_type == TCACHE_TYPE_CUBEMAP) {
|
||||
tSlot->texture_target = GL_TEXTURE_CUBE_MAP;
|
||||
}
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
mipmap_levels = bm_get_num_mipmaps(bitmap_handle);
|
||||
|
||||
auto dsize = 0;
|
||||
auto dsize = 0;
|
||||
auto doffset = 0;
|
||||
|
||||
switch (bitmap_type) {
|
||||
case TCACHE_TYPE_COMPRESSED: {
|
||||
if (block_size > 0) {
|
||||
for (auto i = 0; i < mipmap_levels; i++) {
|
||||
case TCACHE_TYPE_COMPRESSED: {
|
||||
if (block_size > 0) {
|
||||
auto mipmap_w = bmap_w;
|
||||
auto mipmap_h = bmap_h;
|
||||
|
||||
for (auto i = 0; i < mipmap_levels + base_level; i++) {
|
||||
// size of data block (4x4)
|
||||
dsize = ((mipmap_h + 3) / 4) * ((mipmap_w + 3) / 4) * block_size;
|
||||
|
||||
if (i >= base_level) {
|
||||
glCompressedTexSubImage3D(tSlot->texture_target, i - base_level, 0, 0, tSlot->array_index, mipmap_w,
|
||||
mipmap_h, 1, intFormat, dsize, bmp_data + doffset);
|
||||
}
|
||||
|
||||
// adjust the data offset for the next block
|
||||
doffset += dsize;
|
||||
|
||||
// reduce size by half for the next pass
|
||||
mipmap_w >>= 1;
|
||||
mipmap_h >>= 1;
|
||||
|
||||
if (mipmap_w <= 0) {
|
||||
mipmap_w = 1;
|
||||
}
|
||||
|
||||
if (mipmap_h <= 0) {
|
||||
mipmap_h = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Int3();
|
||||
return 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case TCACHE_TYPE_AABITMAP: {
|
||||
texmem = (ubyte*)vm_malloc(tex_w * tex_h * byte_mult);
|
||||
texmemp = texmem;
|
||||
|
||||
Assert(texmem != nullptr);
|
||||
|
||||
int luminance = 0;
|
||||
for (auto i = 0; i < tex_h; i++) {
|
||||
for (auto j = 0; j < tex_w; j++) {
|
||||
if ((i < bmap_h) && (j < bmap_w)) {
|
||||
if (byte_mult > 1) {
|
||||
luminance = 0;
|
||||
|
||||
if (byte_mult > 3) {
|
||||
for (auto k = 0; k < 3; k++) {
|
||||
luminance += bmp_data[(i * bmap_w + j) * byte_mult + k];
|
||||
}
|
||||
|
||||
*texmemp++ =
|
||||
(ubyte)((luminance / 3) * (bmp_data[(i * bmap_w + j) * byte_mult + 3] / 255.0f));
|
||||
} else {
|
||||
for (auto k = 0; k < byte_mult; k++) {
|
||||
luminance += bmp_data[(i * bmap_w + j) * byte_mult + k];
|
||||
}
|
||||
|
||||
*texmemp++ = (ubyte)(luminance / byte_mult);
|
||||
}
|
||||
} else {
|
||||
*texmemp++ = bmp_data[i * bmap_w + j];
|
||||
}
|
||||
} else {
|
||||
*texmemp++ = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GLenum aa_format = GL_RED;
|
||||
|
||||
glTexSubImage3D(tSlot->texture_target, 0, 0, 0, tSlot->array_index, tex_w, tex_h, 1, aa_format,
|
||||
GL_UNSIGNED_BYTE, texmem);
|
||||
|
||||
if (texmem != nullptr) {
|
||||
vm_free(texmem);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case TCACHE_TYPE_INTERFACE: {
|
||||
// if we aren't resizing then we can just use bmp_data directly
|
||||
if (resize) {
|
||||
texmem = (ubyte*)vm_malloc(tex_w * tex_h * byte_mult);
|
||||
texmemp = texmem;
|
||||
|
||||
Assert(texmem != nullptr);
|
||||
|
||||
for (auto i = 0; i < tex_h; i++) {
|
||||
for (auto j = 0; j < tex_w; j++) {
|
||||
if ((i < bmap_h) && (j < bmap_w)) {
|
||||
for (auto k = 0; k < byte_mult; k++) {
|
||||
*texmemp++ = bmp_data[(i * bmap_w + j) * byte_mult + k];
|
||||
}
|
||||
} else {
|
||||
for (auto k = 0; k < byte_mult; k++) {
|
||||
*texmemp++ = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glTexSubImage3D(tSlot->texture_target, 0, 0, 0, tSlot->array_index, tex_w, tex_h, 1, glFormat, texFormat,
|
||||
(resize) ? texmem : bmp_data);
|
||||
|
||||
if (texmem != nullptr) {
|
||||
vm_free(texmem);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case TCACHE_TYPE_CUBEMAP: {
|
||||
Assert(!resize);
|
||||
Assert(texmem == nullptr);
|
||||
|
||||
// we have to load in all 6 faces...
|
||||
doffset = 0;
|
||||
for (auto i = 0; i < 6; i++) {
|
||||
// We need to use the actual size of the bitmap here since tex_h/w is already
|
||||
// adjusted for the size of the target bitmap. Since we are not resizing here that is not a problem
|
||||
auto mipmap_w = bmap_w;
|
||||
auto mipmap_h = bmap_h;
|
||||
|
||||
// check if it's a compressed cubemap first
|
||||
if (block_size > 0) {
|
||||
for (auto level = 0; level < mipmap_levels + base_level; level++) {
|
||||
// size of data block (4x4)
|
||||
dsize = ((mipmap_h + 3) / 4) * ((mipmap_w + 3) / 4) * block_size;
|
||||
|
||||
glCompressedTexSubImage3D(tSlot->texture_target, i, 0, 0, tSlot->array_index, mipmap_w, mipmap_h, 1, intFormat, dsize, bmp_data + doffset);
|
||||
if (level >= base_level) {
|
||||
// We skipped ahead to the base level so we can start uploading frames now
|
||||
glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, level - base_level, 0, 0,
|
||||
mipmap_w, mipmap_h, intFormat, dsize, bmp_data + doffset);
|
||||
}
|
||||
|
||||
// adjust the data offset for the next block
|
||||
doffset += dsize;
|
||||
@@ -410,233 +531,112 @@ int opengl_texture_set_level(int bitmap_handle,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Int3();
|
||||
return 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case TCACHE_TYPE_AABITMAP: {
|
||||
texmem = (ubyte *) vm_malloc (tex_w*tex_h*byte_mult);
|
||||
texmemp = texmem;
|
||||
|
||||
Assert( texmem != NULL );
|
||||
|
||||
int luminance = 0;
|
||||
for (auto i = 0; i < tex_h; i++) {
|
||||
for (auto j = 0; j < tex_w; j++) {
|
||||
if ( (i < bmap_h) && (j < bmap_w) ) {
|
||||
if ( byte_mult > 1 ) {
|
||||
luminance = 0;
|
||||
|
||||
if ( byte_mult > 3 ) {
|
||||
for (auto k = 0; k < 3; k++) {
|
||||
luminance += bmp_data[(i*bmap_w+j)*byte_mult+k];
|
||||
}
|
||||
|
||||
*texmemp++ = (ubyte)((luminance / 3) * (bmp_data[(i*bmap_w+j)*byte_mult+3]/255.0f));
|
||||
} else {
|
||||
for (auto k = 0; k < byte_mult; k++) {
|
||||
luminance += bmp_data[(i*bmap_w+j)*byte_mult+k];
|
||||
}
|
||||
|
||||
*texmemp++ = (ubyte)(luminance / byte_mult);
|
||||
}
|
||||
} else {
|
||||
*texmemp++ = bmp_data[i*bmap_w+j];
|
||||
}
|
||||
} else {
|
||||
*texmemp++ = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GLenum aa_format = GL_RED;
|
||||
|
||||
glTexSubImage3D (tSlot->texture_target, 0, 0, 0, tSlot->array_index, tex_w, tex_h, 1, aa_format, GL_UNSIGNED_BYTE, texmem);
|
||||
|
||||
if (texmem != NULL) {
|
||||
vm_free(texmem);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case TCACHE_TYPE_INTERFACE: {
|
||||
// if we aren't resizing then we can just use bmp_data directly
|
||||
if (resize) {
|
||||
texmem = (ubyte *) vm_malloc (tex_w*tex_h*byte_mult);
|
||||
texmemp = texmem;
|
||||
|
||||
Assert( texmem != NULL );
|
||||
|
||||
for (auto i = 0; i < tex_h; i++) {
|
||||
for (auto j = 0;j < tex_w; j++) {
|
||||
if ( (i < bmap_h) && (j < bmap_w) ) {
|
||||
for (auto k = 0; k < byte_mult; k++) {
|
||||
*texmemp++ = bmp_data[(i*bmap_w+j)*byte_mult+k];
|
||||
}
|
||||
} else {
|
||||
for (auto k = 0; k < byte_mult; k++) {
|
||||
*texmemp++ = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glTexSubImage3D (tSlot->texture_target, 0, 0, 0, tSlot->array_index, mipmap_w, mipmap_h, 1, glFormat, texFormat, (resize) ? texmem : bmp_data);
|
||||
|
||||
if (texmem != NULL) {
|
||||
vm_free(texmem);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case TCACHE_TYPE_CUBEMAP: {
|
||||
Assert( !resize );
|
||||
Assert( texmem == NULL );
|
||||
|
||||
// we have to load in all 6 faces...
|
||||
doffset = 0;
|
||||
for (auto i = 0; i < 6; i++) {
|
||||
doffset += dsize;
|
||||
|
||||
// check if it's a compressed cubemap first
|
||||
if (block_size > 0) {
|
||||
// size of data block (4x4)
|
||||
dsize = ((mipmap_h + 3) / 4) * ((mipmap_w + 3) / 4) * block_size;
|
||||
|
||||
glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X+i, 0, 0, 0, mipmap_w, mipmap_h, intFormat, dsize, bmp_data + doffset);
|
||||
|
||||
// now that the base image is done handle any mipmap levels
|
||||
for (auto j = 1; j < mipmap_levels; j++) {
|
||||
// adjust the data offset for the next block
|
||||
doffset += dsize;
|
||||
|
||||
// reduce size by half for the next pass
|
||||
mipmap_w >>= 1;
|
||||
mipmap_h >>= 1;
|
||||
|
||||
if (mipmap_w <= 0) {
|
||||
mipmap_w = 1;
|
||||
}
|
||||
|
||||
if (mipmap_h <= 0) {
|
||||
mipmap_h = 1;
|
||||
}
|
||||
|
||||
// size of data block (4x4)
|
||||
dsize = ((mipmap_h + 3) / 4) * ((mipmap_w + 3) / 4) * block_size;
|
||||
|
||||
glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X+i, j, 0, 0, mipmap_w, mipmap_h, intFormat, dsize, bmp_data + doffset);
|
||||
}
|
||||
}
|
||||
// nope, it's uncompressed...
|
||||
else {
|
||||
for (auto level = 0; level < mipmap_levels + base_level; level++) {
|
||||
dsize = mipmap_h * mipmap_w * byte_mult;
|
||||
|
||||
glTexSubImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X+i, 0, 0, 0, mipmap_w, mipmap_h, glFormat, texFormat, bmp_data + doffset);
|
||||
if (level >= base_level) {
|
||||
glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, level - base_level, 0, 0, mipmap_w,
|
||||
mipmap_h, glFormat, texFormat, bmp_data + doffset);
|
||||
}
|
||||
|
||||
// base image is done so now take care of any mipmap levels
|
||||
for (auto j = 1; j < mipmap_levels; j++) {
|
||||
doffset += dsize;
|
||||
mipmap_w >>= 1;
|
||||
mipmap_h >>= 1;
|
||||
doffset += dsize;
|
||||
mipmap_w >>= 1;
|
||||
mipmap_h >>= 1;
|
||||
|
||||
if (mipmap_w <= 0) {
|
||||
mipmap_w = 1;
|
||||
}
|
||||
if (mipmap_w <= 0) {
|
||||
mipmap_w = 1;
|
||||
}
|
||||
|
||||
if (mipmap_h <= 0) {
|
||||
mipmap_h = 1;
|
||||
}
|
||||
|
||||
dsize = mipmap_h * mipmap_w * byte_mult;
|
||||
|
||||
glTexSubImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X+i, j, 0, 0, mipmap_w, mipmap_h, glFormat, texFormat, bmp_data + doffset);
|
||||
if (mipmap_h <= 0) {
|
||||
mipmap_h = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// reset width and height for next face
|
||||
mipmap_w = tex_w;
|
||||
mipmap_h = tex_h;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
// if we aren't resizing then we can just use bmp_data directly
|
||||
if (resize) {
|
||||
texmem = (ubyte *) vm_malloc (tex_w*tex_h*byte_mult);
|
||||
texmemp = texmem;
|
||||
break;
|
||||
}
|
||||
|
||||
Assert( texmem != NULL );
|
||||
default: {
|
||||
// if we aren't resizing then we can just use bmp_data directly
|
||||
if (resize) {
|
||||
texmem = (ubyte*)vm_malloc(tex_w * tex_h * byte_mult);
|
||||
texmemp = texmem;
|
||||
|
||||
fix u, utmp, v, du, dv;
|
||||
Assert(texmem != nullptr);
|
||||
|
||||
u = v = 0;
|
||||
fix u, utmp, v, du, dv;
|
||||
|
||||
du = ( (bmap_w-1)*F1_0 ) / tex_w;
|
||||
dv = ( (bmap_h-1)*F1_0 ) / tex_h;
|
||||
u = v = 0;
|
||||
|
||||
for (auto j=0;j<tex_h;j++)
|
||||
{
|
||||
utmp = u;
|
||||
for (auto i=0;i<tex_w;i++)
|
||||
{
|
||||
for (auto k = 0; k < byte_mult; k++) {
|
||||
*texmemp++ = bmp_data[(f2i(v)*bmap_w+f2i(utmp))*byte_mult+k];
|
||||
}
|
||||
utmp += du;
|
||||
du = ((bmap_w - 1) * F1_0) / tex_w;
|
||||
dv = ((bmap_h - 1) * F1_0) / tex_h;
|
||||
|
||||
for (auto j = 0; j < tex_h; j++) {
|
||||
utmp = u;
|
||||
for (auto i = 0; i < tex_w; i++) {
|
||||
for (auto k = 0; k < byte_mult; k++) {
|
||||
*texmemp++ = bmp_data[(f2i(v) * bmap_w + f2i(utmp)) * byte_mult + k];
|
||||
}
|
||||
v += dv;
|
||||
utmp += du;
|
||||
}
|
||||
v += dv;
|
||||
}
|
||||
|
||||
// should never have mipmap levels if we also have to manually resize
|
||||
if ( (mipmap_levels > 1) && resize ) {
|
||||
Assert( texmem == NULL );
|
||||
}
|
||||
|
||||
for (auto i = 0; i < mipmap_levels; i++) {
|
||||
// size of data block (4x4)
|
||||
dsize = mipmap_h * mipmap_w * byte_mult;
|
||||
|
||||
glTexSubImage3D (tSlot->texture_target, i, 0, 0, tSlot->array_index, mipmap_w, mipmap_h, 1, glFormat, texFormat, (texmem != NULL) ? texmem : bmp_data + doffset);
|
||||
|
||||
// adjust the data offset for the next block
|
||||
doffset += dsize;
|
||||
|
||||
// reduce size by half for the next pass
|
||||
mipmap_w >>= 1;
|
||||
mipmap_h >>= 1;
|
||||
|
||||
if (mipmap_w <= 0) {
|
||||
mipmap_w = 1;
|
||||
}
|
||||
|
||||
if (mipmap_h <= 0) {
|
||||
mipmap_h = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (texmem != NULL) {
|
||||
vm_free(texmem);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}//end switch
|
||||
|
||||
auto mipmap_w = tex_w;
|
||||
auto mipmap_h = tex_h;
|
||||
|
||||
// should never have mipmap levels if we also have to manually resize
|
||||
if ((mipmap_levels > 1) && resize) {
|
||||
Assert(texmem == nullptr);
|
||||
|
||||
// If we have mipmaps then tex_w/h are already adjusted for the base level but that will cause problems with
|
||||
// the code below. Instead we set the values to the actual size of the bitmap here to make sure we can
|
||||
// iterate properly through the mipmap levels.
|
||||
mipmap_w = bmap_w;
|
||||
mipmap_h = bmap_h;
|
||||
}
|
||||
|
||||
for (auto i = 0; i < mipmap_levels + base_level; i++) {
|
||||
// size of data block (4x4)
|
||||
dsize = mipmap_h * mipmap_w * byte_mult;
|
||||
|
||||
if (i >= base_level) {
|
||||
glTexSubImage3D(tSlot->texture_target, i - base_level, 0, 0, tSlot->array_index, mipmap_w, mipmap_h, 1,
|
||||
glFormat, texFormat, (texmem != nullptr) ? texmem : bmp_data + doffset);
|
||||
}
|
||||
|
||||
// adjust the data offset for the next block
|
||||
doffset += dsize;
|
||||
|
||||
// reduce size by half for the next pass
|
||||
mipmap_w >>= 1;
|
||||
mipmap_h >>= 1;
|
||||
|
||||
if (mipmap_w <= 0) {
|
||||
mipmap_w = 1;
|
||||
}
|
||||
|
||||
if (mipmap_h <= 0) {
|
||||
mipmap_h = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (texmem != nullptr) {
|
||||
vm_free(texmem);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
} // end switch
|
||||
|
||||
tSlot->bitmap_handle = bitmap_handle;
|
||||
tSlot->size = (dsize) ? ((doffset + dsize) - skip_size) : (tex_w * tex_h * byte_mult);
|
||||
tSlot->w = (ushort)tex_w;
|
||||
tSlot->h = (ushort)tex_h;
|
||||
tSlot->size = (dsize) ? ((doffset + dsize) - skip_size) : (tex_w * tex_h * byte_mult);
|
||||
tSlot->w = (ushort)tex_w;
|
||||
tSlot->h = (ushort)tex_h;
|
||||
|
||||
GL_textures_in_frame += tSlot->size;
|
||||
|
||||
@@ -780,6 +780,8 @@ void opengl_tex_array_storage(GLenum target, GLint levels, GLenum format, GLint
|
||||
mip_height = std::max(1, (mip_height / 2));
|
||||
}
|
||||
}
|
||||
// Make sure that the image is complete with the right number of mipmap levels
|
||||
glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, levels);
|
||||
}
|
||||
} else {
|
||||
if (GLAD_GL_ARB_texture_storage) {
|
||||
@@ -791,6 +793,8 @@ void opengl_tex_array_storage(GLenum target, GLint levels, GLenum format, GLint
|
||||
width = std::max(1, (width / 2));
|
||||
height = std::max(1, (height / 2));
|
||||
}
|
||||
// Make sure that the image is complete with the right number of mipmap levels
|
||||
glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, levels);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -856,6 +860,10 @@ int opengl_create_texture(int bitmap_handle, int bitmap_type, tcache_slot_opengl
|
||||
}
|
||||
|
||||
Assert( (max_levels - base_level) >= 1 );
|
||||
|
||||
// Adjust the size to match the size of the used base-mipmap
|
||||
width >>= base_level;
|
||||
height >>= base_level;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -897,19 +905,24 @@ int opengl_create_texture(int bitmap_handle, int bitmap_type, tcache_slot_opengl
|
||||
|
||||
GLenum min_filter = GL_LINEAR;
|
||||
|
||||
auto mipmap_levels = (ubyte)(max_levels - base_level);
|
||||
auto mipmap_levels = max_levels - base_level;
|
||||
// Needed in case we need to allocate more mipmaps than are in the texture file
|
||||
auto allocated_mipmap_levels = mipmap_levels;
|
||||
if (mipmap_levels > 1) {
|
||||
min_filter = (GL_mipmap_filter) ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR_MIPMAP_NEAREST;
|
||||
|
||||
if ( GLAD_GL_EXT_texture_filter_anisotropic ) {
|
||||
glTexParameterf(tslot->texture_target, GL_TEXTURE_MAX_ANISOTROPY_EXT, GL_anisotropy);
|
||||
}
|
||||
} else if (mipmap_levels == 1 && bitmap_type == TCACHE_TYPE_CUBEMAP) {
|
||||
Assertion(num_frames == 1, "Cube map arrays are not supported yet!");
|
||||
// For cubemaps without mipmaps, we will generate them later so we need to make sure that enough space is
|
||||
// allocated for the generated mipmaps
|
||||
allocated_mipmap_levels = get_num_mipmap_levels(width, height);
|
||||
|
||||
min_filter = GL_LINEAR_MIPMAP_LINEAR;
|
||||
}
|
||||
|
||||
if (base_level != 0) {
|
||||
glTexParameteri(tslot->texture_target, GL_TEXTURE_BASE_LEVEL, base_level);
|
||||
}
|
||||
glTexParameteri(tslot->texture_target, GL_TEXTURE_MAX_LEVEL, mipmap_levels);
|
||||
glTexParameteri(tslot->texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(tslot->texture_target, GL_TEXTURE_MIN_FILTER, min_filter);
|
||||
glTexParameteri(tslot->texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
@@ -923,7 +936,7 @@ int opengl_create_texture(int bitmap_handle, int bitmap_type, tcache_slot_opengl
|
||||
opengl_determine_bpp_and_flags(animation_begin, bitmap_type, bitmap_flags, bits_per_pixel);
|
||||
|
||||
auto intFormat = opengl_get_internal_format(bitmap_handle, bitmap_type, bits_per_pixel);
|
||||
opengl_tex_array_storage(tslot->texture_target, max_levels, intFormat, width, height, num_frames);
|
||||
opengl_tex_array_storage(tslot->texture_target, allocated_mipmap_levels, intFormat, width, height, num_frames);
|
||||
|
||||
bool frames_loaded = true;
|
||||
for (int frame = animation_begin; frame < animation_begin + num_frames; ++frame) {
|
||||
@@ -961,17 +974,8 @@ int opengl_create_texture(int bitmap_handle, int bitmap_type, tcache_slot_opengl
|
||||
frame_slot->array_index = (uint32_t) (frame - animation_begin);
|
||||
|
||||
// call the helper
|
||||
int ret_val = opengl_texture_set_level(frame,
|
||||
bitmap_type,
|
||||
bmp->w,
|
||||
bmp->h,
|
||||
width,
|
||||
height,
|
||||
(ubyte*) bmp->data,
|
||||
frame_slot,
|
||||
base_level,
|
||||
resize,
|
||||
intFormat);
|
||||
int ret_val = opengl_texture_set_level(frame, bitmap_type, bmp->w, bmp->h, width, height, (ubyte*)bmp->data,
|
||||
frame_slot, base_level, mipmap_levels, resize, intFormat);
|
||||
frames_loaded = frames_loaded && ret_val;
|
||||
|
||||
// unlock the bitmap
|
||||
@@ -980,12 +984,8 @@ int opengl_create_texture(int bitmap_handle, int bitmap_type, tcache_slot_opengl
|
||||
|
||||
if ( tslot->mipmap_levels == 1 && bitmap_type == TCACHE_TYPE_CUBEMAP ) {
|
||||
Assertion(num_frames == 1, "Cube map arrays are not supported yet!");
|
||||
// generate mip maps for cube maps so we can get glossy reflections; necessary for gloss maps and physically-based lighting
|
||||
// OGL_EXT_FRAMEBUFFER_OBJECT required to use glGenerateMipmap()
|
||||
tslot->mipmap_levels = get_num_mipmap_levels(tslot->w, tslot->h);
|
||||
|
||||
glTexParameteri(tslot->texture_target, GL_TEXTURE_MAX_LEVEL, tslot->mipmap_levels - 1);
|
||||
glTexParameteri(tslot->texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
// generate mip maps for cube maps so we can get glossy reflections; necessary for gloss maps and
|
||||
// physically-based lighting OGL_EXT_FRAMEBUFFER_OBJECT required to use glGenerateMipmap()
|
||||
|
||||
glGenerateMipmap(tslot->texture_target);
|
||||
}
|
||||
|
||||
@@ -421,6 +421,8 @@ static bool opengl_init_shadow_framebuffer(int size, GLenum color_format)
|
||||
|
||||
glGenTextures(1, &Shadow_map_depth_texture);
|
||||
|
||||
GL_state.Texture.SetActiveUnit(0);
|
||||
GL_state.Texture.SetTarget(GL_TEXTURE_2D_ARRAY);
|
||||
GL_state.Texture.Enable(Shadow_map_depth_texture);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
||||
@@ -490,8 +490,6 @@ int NanoVGRenderer::createTexture(int type, int w, int h, int imageFlags, const
|
||||
img.width = w;
|
||||
img.height = h;
|
||||
|
||||
bm_get_info(img.bitmap);
|
||||
|
||||
auto id = ++_lastImageId;
|
||||
_textureMap.insert(std::make_pair(id, std::move(img)));
|
||||
|
||||
@@ -509,7 +507,11 @@ int NanoVGRenderer::updateTexture(int image, int /*x*/, int /*y*/, int /*w*/,
|
||||
} else {
|
||||
bpp = 8;
|
||||
}
|
||||
bm_get_info(texture->bitmap);
|
||||
|
||||
// Copy the updated data to our internal buffer so that changes in the hardware texture detail don't discard the
|
||||
// changes NanoVG made to the texture
|
||||
memcpy(texture->data.get(), data, texture->width * texture->height * bpp / 8);
|
||||
|
||||
// TODO: This could probably be done better by only uploading the changed area
|
||||
gr_update_texture(texture->bitmap, bpp, data, texture->width, texture->height);
|
||||
|
||||
|
||||
@@ -422,7 +422,7 @@ void ssm_process()
|
||||
vm_vec_sub(&temp, &moveup->sinfo.target->pos, &moveup->sinfo.start_pos[idx]);
|
||||
vm_vec_normalize(&temp);
|
||||
vm_vector_2_matrix(&orient, &temp, NULL, NULL);
|
||||
moveup->fireballs[idx] = fireball_create(&moveup->sinfo.start_pos[idx], FIREBALL_WARP, FIREBALL_WARP_EFFECT, -1, si->warp_radius, 0, &vmd_zero_vector, si->warp_time, 0, &orient);
|
||||
moveup->fireballs[idx] = fireball_create(&moveup->sinfo.start_pos[idx], FIREBALL_WARP, FIREBALL_WARP_EFFECT, -1, si->warp_radius, false, &vmd_zero_vector, si->warp_time, 0, &orient);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ void hud_init_brackets()
|
||||
{
|
||||
}
|
||||
|
||||
// Called by draw_bounding_brackets.
|
||||
void draw_brackets_square(graphics::line_draw_list* draw_list, int x1, int y1, int x2, int y2, int resize_mode)
|
||||
{
|
||||
int width, height;
|
||||
@@ -140,112 +139,6 @@ void draw_brackets_square_quick(graphics::line_draw_list* draw_list, int x1, int
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define NUM_DASHES 2
|
||||
void draw_brackets_dashed_square_quick(graphics::line_draw_list* draw_list, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int width, height, i;
|
||||
|
||||
width = x2 - x1;
|
||||
height = y2 - y1;
|
||||
|
||||
// make the brackets extend 25% of the way along the width or height
|
||||
float bracket_width = width/4.0f;
|
||||
float bracket_height = height/4.0f;
|
||||
|
||||
int dash_width = (int)std::lround(bracket_width / ( NUM_DASHES*2 - 1 ));
|
||||
|
||||
if ( dash_width < 1 ) {
|
||||
draw_brackets_square_quick(draw_list, x1, y1, x2, y2);
|
||||
return;
|
||||
}
|
||||
|
||||
int dash_height = (int)std::lround(bracket_height / ( NUM_DASHES*2 - 1 ));
|
||||
|
||||
if ( dash_height < 1 ) {
|
||||
draw_brackets_square_quick(draw_list, x1, y1, x2, y2);
|
||||
return;
|
||||
}
|
||||
|
||||
int dash_x1, dash_x2, dash_y1, dash_y2;
|
||||
|
||||
dash_x1 = x1;
|
||||
dash_x2 = x2;
|
||||
dash_y1 = y1;
|
||||
dash_y2 = y2;
|
||||
|
||||
for ( i = 0; i < NUM_DASHES; i++ ) {
|
||||
// top line
|
||||
draw_list->add_line(dash_x1, y1, dash_x1+(dash_width-1), y1);
|
||||
draw_list->add_line(dash_x2, y1, dash_x2-(dash_width-1), y1);
|
||||
|
||||
// bottom line
|
||||
draw_list->add_line(dash_x1, y2, dash_x1+(dash_width-1), y2);
|
||||
draw_list->add_line(dash_x2, y2, dash_x2-(dash_width-1), y2);
|
||||
|
||||
dash_x1 += dash_width*2;
|
||||
dash_x2 -= dash_width*2;
|
||||
|
||||
// left line
|
||||
draw_list->add_line(x1, dash_y1, x1, dash_y1+(dash_height-1));
|
||||
draw_list->add_line(x1, dash_y2, x1, dash_y2-(dash_height-1));
|
||||
|
||||
// right line
|
||||
draw_list->add_line(x2, dash_y1, x2, dash_y1+(dash_height-1));
|
||||
draw_list->add_line(x2, dash_y2, x2, dash_y2-(dash_height-1));
|
||||
|
||||
dash_y1 += dash_height*2;
|
||||
dash_y2 -= dash_height*2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// draw_brackets_diamond()
|
||||
// Called by draw_bounding_brackets.
|
||||
|
||||
void draw_brackets_diamond(graphics::line_draw_list* draw_list, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int width, height, half_width, half_height;
|
||||
int center_x, center_y;
|
||||
int x_delta, y_delta;
|
||||
|
||||
float side_len, bracket_len;
|
||||
|
||||
width = x2 - x1;
|
||||
height = y2 - y1;
|
||||
|
||||
half_width = (int)std::lround( width/2.0f );
|
||||
half_height = (int)std::lround( height/2.0f );
|
||||
|
||||
side_len = (float)_hypot(half_width, half_height);
|
||||
bracket_len = side_len / 8;
|
||||
|
||||
x_delta = (int)std::lround(bracket_len * width / side_len);
|
||||
y_delta = (int)std::lround(bracket_len * height / side_len);
|
||||
|
||||
|
||||
center_x = x1 + half_width;
|
||||
center_y = y1 + half_height;
|
||||
|
||||
// top left line
|
||||
draw_list->add_gradient(center_x - x_delta, y1 + y_delta,center_x, y1);
|
||||
draw_list->add_gradient(x1 + x_delta, center_y - y_delta, x1, center_y);
|
||||
|
||||
// top right line
|
||||
draw_list->add_gradient(center_x + x_delta, y1 + y_delta,center_x, y1);
|
||||
draw_list->add_gradient(x2 - x_delta, center_y - y_delta, x2, center_y);
|
||||
|
||||
// bottom left line
|
||||
draw_list->add_gradient(x1 + x_delta, center_y + y_delta, x1, center_y);
|
||||
draw_list->add_gradient(center_x - x_delta, y2 - y_delta, center_x, y2);
|
||||
|
||||
// bottom right line
|
||||
draw_list->add_gradient(x2 - x_delta, center_y + y_delta, x2, center_y);
|
||||
draw_list->add_gradient(center_x + x_delta, y2 - y_delta, center_x, y2);
|
||||
}
|
||||
|
||||
void draw_brackets_diamond_quick(graphics::line_draw_list* draw_list, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int width, height, half_width, half_height;
|
||||
@@ -290,91 +183,6 @@ void draw_brackets_diamond_quick(graphics::line_draw_list* draw_list, int x1, in
|
||||
draw_list->add_line(center_x-x_delta, center_y+y_delta, center_x+x_delta, center_y-y_delta);
|
||||
}
|
||||
|
||||
// Draw bounding brackets for a subobject.
|
||||
// unused function, candidate for removal
|
||||
#if 0
|
||||
void draw_bounding_brackets_subobject()
|
||||
{
|
||||
if (Player_ai->targeted_subsys_parent == Player_ai->target_objnum)
|
||||
if (Player_ai->targeted_subsys != NULL) {
|
||||
ship_subsys *subsys;
|
||||
int target_objnum;
|
||||
object* targetp;
|
||||
vertex subobj_vertex;
|
||||
vec3d subobj_pos;
|
||||
int x1,x2,y1,y2;
|
||||
|
||||
subsys = Player_ai->targeted_subsys;
|
||||
target_objnum = Player_ai->target_objnum;
|
||||
Assert(target_objnum != -1);
|
||||
targetp = &Objects[target_objnum];
|
||||
Assert( targetp->type == OBJ_SHIP );
|
||||
|
||||
get_subsystem_world_pos(targetp, subsys, &subobj_pos);
|
||||
|
||||
g3_rotate_vertex(&subobj_vertex,&subobj_pos);
|
||||
|
||||
g3_project_vertex(&subobj_vertex);
|
||||
if (subobj_vertex.flags & PF_OVERFLOW) // if overflow, no point in drawing brackets
|
||||
return;
|
||||
|
||||
int subobj_x = fl2i(subobj_vertex.screen.xyw.x + 0.5f);
|
||||
int subobj_y = fl2i(subobj_vertex.screen.xyw.y + 0.5f);
|
||||
int hud_subtarget_w, hud_subtarget_h, bound_rc;
|
||||
|
||||
bound_rc = subobj_find_2d_bound(subsys->system_info->radius, &targetp->orient, &subobj_pos, &x1,&y1,&x2,&y2);
|
||||
if ( bound_rc != 0 )
|
||||
return;
|
||||
|
||||
hud_subtarget_w = x2-x1+1;
|
||||
if ( hud_subtarget_w > gr_screen.clip_width ) {
|
||||
hud_subtarget_w = gr_screen.clip_width;
|
||||
}
|
||||
|
||||
hud_subtarget_h = y2-y1+1;
|
||||
if ( hud_subtarget_h > gr_screen.clip_height ) {
|
||||
hud_subtarget_h = gr_screen.clip_height;
|
||||
}
|
||||
|
||||
if ( hud_subtarget_w > gr_screen.max_w ) {
|
||||
x1 = subobj_x - (gr_screen.max_w>>1);
|
||||
x2 = subobj_x + (gr_screen.max_w>>1);
|
||||
}
|
||||
if ( hud_subtarget_h > gr_screen.max_h ) {
|
||||
y1 = subobj_y - (gr_screen.max_h>>1);
|
||||
y2 = subobj_y + (gr_screen.max_h>>1);
|
||||
}
|
||||
|
||||
// *** these unsize take care of everything below ***
|
||||
gr_unsize_screen_pos( &hud_subtarget_w, &hud_subtarget_h );
|
||||
gr_unsize_screen_pos( &subobj_x, &subobj_y );
|
||||
gr_unsize_screen_pos( &x1, &y1 );
|
||||
gr_unsize_screen_pos( &x2, &y2 );
|
||||
|
||||
// determine if subsystem is on far or near side of the ship
|
||||
Player->subsys_in_view = ship_subsystem_in_sight(targetp, subsys, &View_position, &subobj_pos, 0);
|
||||
|
||||
// AL 29-3-98: If subsystem is destroyed, draw gray brackets
|
||||
// Goober5000: this will now execute for fighterbays if the bay has been given a
|
||||
// percentage subsystem strength in ships.tbl
|
||||
// Goober5000: this will now execute for any subsys that takes damage and will not
|
||||
// execute for any subsys that doesn't take damage
|
||||
if ( (Player_ai->targeted_subsys->current_hits <= 0) && ( ship_subsys_takes_damage(Player_ai->targeted_subsys) ) ) {
|
||||
gr_set_color_fast(iff_get_color(IFF_COLOR_MESSAGE, 1));
|
||||
} else {
|
||||
hud_set_iff_color( targetp, 1 );
|
||||
}
|
||||
|
||||
if ( Player->subsys_in_view ) {
|
||||
draw_brackets_square_quick(x1, y1, x2, y2);
|
||||
} else {
|
||||
draw_brackets_diamond_quick(x1, y1, x2, y2);
|
||||
}
|
||||
// mprintf(("Drawing subobject brackets at %4i, %4i\n", sx, sy));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extern int HUD_drew_selection_bracket_on_target;
|
||||
//Do we want to show the ship & class name?
|
||||
extern int Cmdline_targetinfo;
|
||||
@@ -414,181 +222,6 @@ int Ships_attacking_bitmap = -1;
|
||||
|
||||
int num_ships_attacking(int target_objnum);
|
||||
|
||||
// draw_bounding_brackets() will draw the faded brackets that surround the current target
|
||||
// NOTE: x1, y1, x2 & y2 are assumed to be scaled sizes, w_correction & h_correction are assumed to be unscaled!!
|
||||
// unused function, candidate for removal
|
||||
#if 0
|
||||
void draw_bounding_brackets(int x1, int y1, int x2, int y2, int w_correction, int h_correction, float distance, int target_objnum)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
if ( ( x1 < 0 && x2 < 0 ) || ( y1 < 0 && y2 < 0 ) )
|
||||
return;
|
||||
|
||||
if ( ( x1 > gr_screen.clip_width && x2 > gr_screen.clip_width ) ||
|
||||
( y1 > gr_screen.clip_height && y2 > gr_screen.clip_height ) )
|
||||
return;
|
||||
|
||||
// *** everything below is taken care of with this unsize ***
|
||||
gr_unsize_screen_pos(&x1, &y1);
|
||||
gr_unsize_screen_pos(&x2, &y2);
|
||||
|
||||
width = x2-x1;
|
||||
Assert(width>=0);
|
||||
|
||||
height = y2-y1;
|
||||
Assert(height>=0);
|
||||
|
||||
if ( (width >= (gr_screen.max_w_unscaled)) && (height >= (gr_screen.max_h_unscaled)) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (width < Min_target_box_width[gr_screen.res]) {
|
||||
x1 = x1 - (Min_target_box_width[gr_screen.res]-width)/2;
|
||||
x2 = x2 + (Min_target_box_width[gr_screen.res]-width)/2;
|
||||
}
|
||||
|
||||
if (height < Min_target_box_height[gr_screen.res]) {
|
||||
y1 = y1 - (Min_target_box_height[gr_screen.res]-height)/2;
|
||||
y2 = y2 + (Min_target_box_height[gr_screen.res]-height)/2;
|
||||
}
|
||||
|
||||
draw_brackets_square(x1-w_correction, y1-h_correction, x2+w_correction, y2+h_correction);
|
||||
|
||||
// draw distance to target in lower right corner of box
|
||||
if ( distance > 0 ) {
|
||||
hud_target_show_dist_on_bracket(x2+w_correction,y2+h_correction,distance);
|
||||
}
|
||||
|
||||
// Maybe show + for each additional fighter or bomber attacking target.
|
||||
if ( (target_objnum != -1) && hud_gauge_active(HUD_ATTACKING_TARGET_COUNT) ) {
|
||||
int num_attacking = num_ships_attacking(target_objnum);
|
||||
|
||||
if (Ships_attacking_bitmap == -1){
|
||||
Ships_attacking_bitmap = bm_load(Ships_attack_fname[gr_screen.res]);
|
||||
}
|
||||
|
||||
if (Ships_attacking_bitmap == -1) {
|
||||
Int3();
|
||||
return;
|
||||
}
|
||||
|
||||
// If a ship is attacked by player, show one fewer plus
|
||||
int k=0;
|
||||
if (Objects[target_objnum].type == OBJ_SHIP) {
|
||||
if (iff_x_attacks_y(Player_ship->team, Ships[Objects[target_objnum].instance].team)) {
|
||||
k = 1;
|
||||
}
|
||||
} else {
|
||||
k = 1;
|
||||
}
|
||||
|
||||
if (num_attacking > k) {
|
||||
int i, num_blips;
|
||||
|
||||
num_blips = num_attacking-k;
|
||||
if (num_blips > 4){
|
||||
num_blips = 4;
|
||||
}
|
||||
|
||||
if (Ships_attacking_bitmap >= 0) {
|
||||
if (num_blips > 3)
|
||||
y1 -= 3;
|
||||
|
||||
for (i=0; i<num_blips; i++) {
|
||||
GR_AABITMAP(Ships_attacking_bitmap, x2+3, y1+i*7);
|
||||
}
|
||||
}
|
||||
|
||||
//Increment for the position of ship name/class.
|
||||
//DEPENDANT ON ATTACKER SIZE (X)
|
||||
x2 += 7;
|
||||
}
|
||||
}
|
||||
|
||||
if(Cmdline_targetinfo && (target_objnum != -1))
|
||||
{
|
||||
object* t_objp = &Objects[target_objnum];
|
||||
const char* tinfo_name = NULL;
|
||||
const char* tinfo_class = NULL;
|
||||
char temp_name[NAME_LENGTH*2+3];
|
||||
char temp_class[NAME_LENGTH];
|
||||
SCP_list<CJumpNode>::iterator jnp;
|
||||
|
||||
switch(t_objp->type)
|
||||
{
|
||||
case OBJ_SHIP:
|
||||
hud_stuff_ship_name(temp_name, &Ships[t_objp->instance]);
|
||||
hud_stuff_ship_class(temp_class, &Ships[t_objp->instance]);
|
||||
tinfo_name = temp_name;
|
||||
tinfo_class = temp_class;
|
||||
|
||||
// maybe concatenate the callsign
|
||||
if (*temp_name)
|
||||
{
|
||||
char temp_callsign[NAME_LENGTH];
|
||||
|
||||
hud_stuff_ship_callsign(temp_callsign, &Ships[t_objp->instance]);
|
||||
if (*temp_callsign)
|
||||
sprintf(&temp_name[strlen(temp_name)], " (%s)", temp_callsign);
|
||||
}
|
||||
// maybe substitute the callsign
|
||||
else
|
||||
{
|
||||
hud_stuff_ship_callsign(temp_name, &Ships[t_objp->instance]);
|
||||
}
|
||||
break;
|
||||
|
||||
case OBJ_DEBRIS:
|
||||
tinfo_name = XSTR("Debris", 348);
|
||||
break;
|
||||
case OBJ_WEAPON:
|
||||
strcpy_s(temp_name, Weapon_info[Weapons[t_objp->instance].weapon_info_index].name);
|
||||
end_string_at_first_hash_symbol(temp_name);
|
||||
tinfo_name = temp_name;
|
||||
break;
|
||||
case OBJ_ASTEROID:
|
||||
switch(Asteroids[t_objp->instance].asteroid_type)
|
||||
{
|
||||
case ASTEROID_TYPE_SMALL:
|
||||
case ASTEROID_TYPE_MEDIUM:
|
||||
case ASTEROID_TYPE_LARGE:
|
||||
tinfo_name = NOX("Asteroid");
|
||||
break;
|
||||
default:
|
||||
tinfo_name = XSTR("Debris", 348);
|
||||
}
|
||||
break;
|
||||
case OBJ_JUMP_NODE:
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
if(jnp->GetSCPObject() == t_objp)
|
||||
break;
|
||||
}
|
||||
|
||||
strcpy_s(temp_name, jnp->GetName());
|
||||
end_string_at_first_hash_symbol(temp_name);
|
||||
tinfo_name = temp_name;
|
||||
break;
|
||||
}
|
||||
|
||||
if(tinfo_name)
|
||||
{
|
||||
gr_string(x2+3, y1, tinfo_name);
|
||||
}
|
||||
if(tinfo_class)
|
||||
{
|
||||
gr_string(x2+3, y1+9, tinfo_class);
|
||||
}
|
||||
/*
|
||||
if(tinfo_callsign)
|
||||
{
|
||||
gr_string(x2+3, y1+18, tinfo_callsign);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int draw_subsys_brackets(graphics::line_draw_list* draw_list, ship_subsys* subsys, int min_width, int min_height, bool draw, bool set_color, int* draw_coords)
|
||||
{
|
||||
Assertion(subsys != NULL, "Invalid subsystem pointer passed to draw_subsys_brackets!");
|
||||
|
||||
@@ -16,16 +16,9 @@
|
||||
#include "graphics/line_draw_list.h"
|
||||
|
||||
void hud_init_brackets();
|
||||
// two unused functions, candidates for removal?
|
||||
#if 0
|
||||
void draw_bounding_brackets(int x1, int y1, int x2, int y2, int w_correction, int h_correction, float distance=0.0f, int target_objnum=-1);
|
||||
void draw_bounding_brackets_subobject();
|
||||
#endif
|
||||
void draw_brackets_square(graphics::line_draw_list* draw_list, int x1, int y1, int x2, int y2, int resize_mode = GR_RESIZE_FULL);
|
||||
void draw_brackets_diamond(graphics::line_draw_list* draw_list, int x1, int y1, int x2, int y2);
|
||||
void draw_brackets_square_quick(graphics::line_draw_list* draw_list, int x1, int y1, int x2, int y2, int thick=0);
|
||||
void draw_brackets_diamond_quick(graphics::line_draw_list* draw_list, int x1, int y1, int x2, int y2);
|
||||
void draw_brackets_dashed_square_quick(graphics::line_draw_list* draw_list, int x1, int y1, int x2, int y2);
|
||||
|
||||
int draw_subsys_brackets(graphics::line_draw_list* draw_list, ship_subsys* subsys, int min_width, int min_height, bool draw = true, bool set_color = true, int* draw_coords = NULL);
|
||||
|
||||
@@ -50,7 +43,6 @@ public:
|
||||
void renderNavBrackets(vec3d* nav_pos, vertex* nav_point, color* clr, char* string);
|
||||
void renderBoundingBrackets(int x1, int y1, int x2, int y2, int w_correction, int h_correction, float distance, int target_objnum, int flags);
|
||||
void renderBoundingBracketsSubobject();
|
||||
void renderDistance(int x, int y, float distance);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -554,29 +554,6 @@ UI_XSTR HC_text[GR_NUM_RESOLUTIONS][NUM_HUD_TEXT] = {
|
||||
}
|
||||
};
|
||||
|
||||
void hud_config_set_rgb(int gauge, int r, int g, int b);
|
||||
void hud_config_set_alpha(int gauge, int a);
|
||||
|
||||
/*
|
||||
#define NUM_HC_SPECIAL_BITMAPS 2
|
||||
#define HC_SPECIAL_RETICLE 0
|
||||
#define HC_SPECIAL_TEXT 1
|
||||
typedef struct HC_special_bitmap
|
||||
{
|
||||
char *filename;
|
||||
int x,y;
|
||||
int bitmap;
|
||||
} HC_special_bitmap;
|
||||
|
||||
HC_special_bitmap HC_special_bitmaps[NUM_HC_SPECIAL_BITMAPS] =
|
||||
{
|
||||
//XSTR:OFF
|
||||
{"HG_00a", 272, 146, -1},
|
||||
{"HG_04a", 132, 271, -1},
|
||||
//XSTR:ON
|
||||
};
|
||||
*/
|
||||
|
||||
static int HC_background_bitmap;
|
||||
static int HC_background_bitmap_mask;
|
||||
static UI_WINDOW HC_ui_window;
|
||||
@@ -584,46 +561,6 @@ static UI_WINDOW HC_ui_window;
|
||||
static int HC_gauge_hot; // mouse is over this gauge
|
||||
static int HC_gauge_selected; // gauge is selected
|
||||
|
||||
// slider controls
|
||||
/*
|
||||
#define HC_NUM_SLIDERS 1
|
||||
#define HC_BRIGHTNESS_SLIDER 0
|
||||
struct hc_sliders {
|
||||
// base slider
|
||||
char *filename;
|
||||
int x, y, xt, yt;
|
||||
int hotspot;
|
||||
int dot_w;
|
||||
int dots;
|
||||
|
||||
// left and right buttons
|
||||
char *left_filename;
|
||||
int left_mask, left_x, left_y;
|
||||
char *right_filename;
|
||||
int right_mask, right_x, right_y;
|
||||
|
||||
// slider control
|
||||
UI_DOT_SLIDER_NEW slider; // because we have a class inside this struct, we need the constructor below..
|
||||
|
||||
hc_sliders(char *name, int x1, int y1, int xt1, int yt1, int h, int _dot_w, int _dots, char *_left_filename, int _left_mask, int _left_x, int _left_y, char *_right_filename, int _right_mask, int _right_x, int _right_y) :
|
||||
filename(name), x(x1), y(y1), xt(xt1), yt(yt1), hotspot(h), dot_w(_dot_w), dots(_dots), left_filename(_left_filename), left_mask(_left_mask), left_x(_left_x), left_y(_left_y), right_filename(_right_filename), right_mask(_right_mask), right_x(_right_x), right_y(_right_y) {}
|
||||
};
|
||||
|
||||
hc_sliders HC_sliders[GR_NUM_RESOLUTIONS][HC_NUM_SLIDERS] = {
|
||||
{ // GR_640
|
||||
hc_sliders( "HCB_22", 419, 379, -1, -1, 22, 20, 10,
|
||||
"HCB_23", 23, 611, 379,
|
||||
"HCB_21", 21, 391, 379)
|
||||
},
|
||||
{ // GR_1024
|
||||
hc_sliders( "2_HCB_22", 670, 606, -1, -1, 22, 32, 10,
|
||||
"2_HCB_23", 23, 698, 606,
|
||||
"2_HCB_21", 21, 625, 606),
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
// HUD colors
|
||||
typedef struct hc_col {
|
||||
ubyte r, g, b;
|
||||
|
||||
@@ -73,11 +73,7 @@ void hud_config_restore();
|
||||
void hud_config_backup();
|
||||
void hud_config_as_observer(ship *shipp,ai_info *aif);
|
||||
|
||||
|
||||
void hud_config_as_observer();
|
||||
void hud_config_as_player();
|
||||
void hud_config_display_text(char* gauge_text, int x, int y);
|
||||
void hud_set_display_gauge_cbox();
|
||||
|
||||
// leave hud config without accepting changes
|
||||
void hud_config_cancel();
|
||||
|
||||
@@ -51,95 +51,6 @@ escort_info Escort_ships[MAX_COMPLETE_ESCORT_LIST];
|
||||
int Num_escort_ships;
|
||||
int Max_escort_ships = 3;
|
||||
|
||||
//int Escort_gauge_y[MAX_ESCORT_SHIPS] = { 219, 230, 241 };
|
||||
|
||||
/*
|
||||
int Escort_gauge_text_coords[GR_NUM_RESOLUTIONS][MAX_ESCORT_SHIPS][4][2] =
|
||||
{
|
||||
{ // GR_640
|
||||
{
|
||||
{489,219},
|
||||
{599,212},
|
||||
{604,219},
|
||||
{474,219}
|
||||
},
|
||||
{
|
||||
{489,230},
|
||||
{599,223},
|
||||
{604,230},
|
||||
{474,230}
|
||||
},
|
||||
{
|
||||
{489,241},
|
||||
{599,234},
|
||||
{604,241},
|
||||
{474,241}
|
||||
},
|
||||
},
|
||||
{ // GR_1024
|
||||
{
|
||||
{869,343},
|
||||
{973,338},
|
||||
{981,343},
|
||||
{854,343}
|
||||
},
|
||||
{
|
||||
{869,354},
|
||||
{973,349},
|
||||
{981,354},
|
||||
{854,354}
|
||||
},
|
||||
{
|
||||
{869,365},
|
||||
{973,360},
|
||||
{981,365},
|
||||
{854,365}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
// escort gauge coords
|
||||
int Escort_coords[GR_NUM_RESOLUTIONS][4][2] = {
|
||||
{ // GR_640
|
||||
{486, 206},
|
||||
{486, 219},
|
||||
{486, 230},
|
||||
{486, 241}
|
||||
},
|
||||
{ // GR_1024
|
||||
{865, 330},
|
||||
{865, 343},
|
||||
{865, 354},
|
||||
{865, 365}
|
||||
}
|
||||
};
|
||||
|
||||
// monitoring text coords
|
||||
int Monitoring_coords[GR_NUM_RESOLUTIONS][2] = {
|
||||
{ // GR_640
|
||||
489, 208
|
||||
},
|
||||
{ // GR_1024
|
||||
869, 331
|
||||
}
|
||||
};
|
||||
|
||||
char *Escort_gauge_filenames[GR_NUM_RESOLUTIONS][MAX_ESCORT_SHIPS] =
|
||||
{
|
||||
//XSTR:OFF
|
||||
{ // GR_640
|
||||
"escort1",
|
||||
"escort2",
|
||||
"escort3"
|
||||
},
|
||||
{ // GR_1024
|
||||
"escort1",
|
||||
"escort2",
|
||||
"escort3"
|
||||
}
|
||||
//XSTR:ON
|
||||
};*/
|
||||
|
||||
static int Last_target_index; // index into Escort_gauges for last targeted via 'Next Escort Target' key
|
||||
|
||||
HudGaugeEscort::HudGaugeEscort():
|
||||
|
||||
@@ -24,7 +24,6 @@ class object;
|
||||
void hud_escort_update_list();
|
||||
void hud_escort_init();
|
||||
void hud_setup_escort_list(int level = 1);
|
||||
void hud_escort_view_toggle();
|
||||
void hud_add_remove_ship_escort(int objnum, int supress_feedback = 0);
|
||||
void hud_escort_clear_all(bool clear_flags = false);
|
||||
void hud_escort_ship_hit(object *objp, int quadrant);
|
||||
|
||||
@@ -27,7 +27,6 @@ class object;
|
||||
#define AI_MODIFY_ETS_INTERVAL 500 // time between ets modifications for ai's (in milliseconds)
|
||||
|
||||
#define ZERO_INDEX 0
|
||||
#define ONE_THIRD_INDEX 4
|
||||
#define ONE_HALF_INDEX 6
|
||||
#define ALL_INDEX 12
|
||||
|
||||
|
||||
@@ -15,10 +15,8 @@
|
||||
#include "hud/hud.h"
|
||||
|
||||
void hud_init_missile_lock();
|
||||
void hud_draw_lock_triangles(int center_x, int center_y, float frametime);
|
||||
void hud_calculate_lock_position(float frametime);
|
||||
void hud_calculate_lock_start_pos();
|
||||
void hud_show_lock_indicator(float frametime, vec3d *lock_point_pos);
|
||||
void hud_do_lock_indicator(float frametime);
|
||||
void hud_stop_looped_locking_sounds();
|
||||
void hud_lock_reset(float lock_time_scale=1.0f);
|
||||
|
||||
@@ -551,24 +551,6 @@ void HUD_printf(const char *format, ...)
|
||||
hud_sourced_print(HUD_SOURCE_COMPUTER, tmp);
|
||||
}
|
||||
|
||||
void HUD_ship_sent_printf(int sh, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char tmp[HUD_MSG_LENGTH_MAX];
|
||||
tmp[sizeof(tmp)-1] = '\0';
|
||||
size_t len;
|
||||
|
||||
snprintf(tmp, sizeof(tmp)-1, NOX("%s: "), Ships[sh].get_display_string());
|
||||
len = strlen(tmp);
|
||||
|
||||
va_start(args, format);
|
||||
vsnprintf(tmp + len, sizeof(tmp)-1-len, format, args);
|
||||
va_end(args);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// HUD_sourced_printf()
|
||||
//
|
||||
@@ -1235,26 +1217,6 @@ void HudGaugeTalkingHead::initBitmaps(const char *fname)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new head animation object
|
||||
*/
|
||||
anim_instance* HudGaugeTalkingHead::createAnim(int anim_start_frame, anim* anim_data)
|
||||
{
|
||||
anim_play_struct aps;
|
||||
|
||||
float scale_x = i2fl(Anim_size[0]) / i2fl(anim_data->width);
|
||||
float scale_y = i2fl(Anim_size[1]) / i2fl(anim_data->height);
|
||||
anim_play_init(&aps, anim_data, fl2ir((position[0] + Anim_offsets[0] + HUD_offset_x) / scale_x), fl2ir((position[1] + Anim_offsets[1] + HUD_offset_y) / scale_y), base_w, base_h);
|
||||
aps.start_at = anim_start_frame;
|
||||
|
||||
// aps.color = &HUD_color_defaults[HUD_color_alpha];
|
||||
aps.color = &HUD_config.clr[HUD_TALKING_HEAD];
|
||||
// I'd much rather use gr_init_color and retrieve the colors from this object but no, aps.color just happens to be a pointer.
|
||||
// So, just give it the address from the player's HUD configuration. You win, aps.color. I'll take care of you next time. (Swifty)
|
||||
|
||||
return anim_play(&aps);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders everything for a head animation
|
||||
* Also checks for when new head ani's need to start playing
|
||||
|
||||
@@ -68,7 +68,6 @@ int HUD_source_get_team(int team);
|
||||
void HUD_printf(SCP_FORMAT_STRING const char *format, ...) SCP_FORMAT_STRING_ARGS(1, 2);
|
||||
void hud_sourced_print(int source, const char *msg);
|
||||
void HUD_sourced_printf(int source, SCP_FORMAT_STRING const char *format, ...) SCP_FORMAT_STRING_ARGS(2, 3); // send hud message from specified source
|
||||
void HUD_ship_sent_printf(int sh, SCP_FORMAT_STRING const char *format, ...) SCP_FORMAT_STRING_ARGS(2, 3); // send hud message from a specific ship
|
||||
void HUD_fixed_printf(float duration, color col, SCP_FORMAT_STRING const char *format, ...) SCP_FORMAT_STRING_ARGS(3, 4); // Display a single message for duration seconds.
|
||||
void HUD_init_fixed_text(); // Clear all pending fixed text.
|
||||
|
||||
@@ -140,7 +139,6 @@ public:
|
||||
void render(float frametime) override;
|
||||
void initialize() override;
|
||||
bool canRender() override;
|
||||
anim_instance* createAnim(int anim_start_frame, anim* anim_data);
|
||||
};
|
||||
|
||||
class HudGaugeFixedMessages: public HudGauge
|
||||
|
||||
@@ -58,27 +58,3 @@ void hud_observer_init(ship *shipp, ai_info *aip)
|
||||
void hud_obs_render_player(int /*loc*/,net_player * /*pl*/)
|
||||
{
|
||||
}
|
||||
|
||||
void hud_obs_render_players_all()
|
||||
{
|
||||
int idx,count;
|
||||
|
||||
// render kills and stats information for all players
|
||||
count = 0;
|
||||
for(idx=0;idx<MAX_PLAYERS;idx++){
|
||||
if(MULTI_CONNECTED(Net_players[idx]) && !MULTI_STANDALONE(Net_players[idx]) && !MULTI_PERM_OBSERVER(Net_players[idx]) ){
|
||||
hud_obs_render_player(count,&Net_players[idx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render any specific observer stuff
|
||||
*/
|
||||
void hud_render_observer()
|
||||
{
|
||||
Assert((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_OBSERVER));
|
||||
|
||||
// render individual player text
|
||||
hud_obs_render_players_all();
|
||||
}
|
||||
@@ -22,6 +22,4 @@ extern ai_info Hud_obs_ai;
|
||||
|
||||
void hud_observer_init(ship *shipp,ai_info *aip);
|
||||
|
||||
void hud_render_observer();
|
||||
|
||||
#endif
|
||||
@@ -53,14 +53,12 @@ typedef struct gauge_settings {
|
||||
} gauge_settings;
|
||||
|
||||
//Functions
|
||||
int hud_get_gauge_index(char* name);
|
||||
void hud_positions_init();
|
||||
void set_current_hud();
|
||||
void init_hud();
|
||||
void load_missing_retail_gauges();
|
||||
void check_color(int *colorp);
|
||||
|
||||
#define NUM_HUD_OBJECT_ENTRIES 56 // not used anywhere?
|
||||
int parse_gauge_type();
|
||||
void load_gauge(int gauge, gauge_settings* settings);
|
||||
|
||||
|
||||
@@ -169,11 +169,4 @@ public:
|
||||
void hud_init_reticle();
|
||||
void hud_update_reticle( player *pp );
|
||||
|
||||
void hud_draw_outer_reticle();
|
||||
void hud_draw_center_reticle();
|
||||
void hud_draw_throttle_gauge();
|
||||
void hud_draw_target_throttle_gauge();
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -2483,7 +2483,7 @@ int hud_query_order_issued(char *to, char *order_name, char *target_name, int ti
|
||||
continue;
|
||||
}
|
||||
|
||||
int subsys_index = ship_get_subsys_index(&Ships[target_ship], special_argument, 1);
|
||||
int subsys_index = ship_get_subsys_index(&Ships[target_ship], special_argument);
|
||||
// if the order is for s different subsystem
|
||||
if (Squadmsg_history[i].special_index != subsys_index) {
|
||||
continue;
|
||||
|
||||
@@ -1909,77 +1909,6 @@ void hud_target_live_turret(int next_flag, int auto_advance, int only_player_tar
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// hud_target_closest_locked_missile()
|
||||
//
|
||||
// Target the closest locked missile that is locked on locked_obj
|
||||
//
|
||||
// input: locked_obj => pointer to object that you want to find
|
||||
// closest missile to
|
||||
//
|
||||
void hud_target_closest_locked_missile(object *locked_obj)
|
||||
{
|
||||
object *A, *nearest_obj=NULL;
|
||||
weapon *wp;
|
||||
weapon_info *wip;
|
||||
float nearest_dist, dist;
|
||||
int target_found = FALSE;
|
||||
missile_obj *mo;
|
||||
|
||||
nearest_dist = 10000.0f;
|
||||
|
||||
for ( mo = GET_NEXT(&Missile_obj_list); mo != END_OF_LIST(&Missile_obj_list); mo = GET_NEXT(mo) ) {
|
||||
Assert(mo->objnum >= 0 && mo->objnum < MAX_OBJECTS);
|
||||
A = &Objects[mo->objnum];
|
||||
|
||||
if (A->type != OBJ_WEAPON){
|
||||
continue;
|
||||
}
|
||||
|
||||
Assert((A->instance >= 0) && (A->instance < MAX_WEAPONS));
|
||||
wp = &Weapons[A->instance];
|
||||
wip = &Weapon_info[wp->weapon_info_index];
|
||||
|
||||
if ( wip->subtype != WP_MISSILE ){
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !(wip->is_homing() ) ){
|
||||
continue;
|
||||
}
|
||||
|
||||
if (wp->lssm_stage==3){
|
||||
continue;
|
||||
}
|
||||
|
||||
if(hud_target_invalid_awacs(A)){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (wp->homing_object == locked_obj) {
|
||||
dist = vm_vec_dist_quick(&A->pos, &locked_obj->pos); // Find distance!
|
||||
|
||||
if (dist < nearest_dist) {
|
||||
nearest_obj = A;
|
||||
nearest_dist = dist;
|
||||
}
|
||||
}
|
||||
} // end for
|
||||
|
||||
if (nearest_dist < 10000.0f) {
|
||||
Assert(nearest_obj);
|
||||
set_target_objnum( Player_ai, OBJ_INDEX(nearest_obj) );
|
||||
hud_shield_hit_reset(nearest_obj);
|
||||
target_found = TRUE;
|
||||
}
|
||||
|
||||
if ( !target_found ){
|
||||
snd_play( gamesnd_get_game_sound(GameSounds::TARGET_FAIL), 0.0f );
|
||||
}
|
||||
}
|
||||
|
||||
// select a new target, by auto-targeting
|
||||
void hud_target_auto_target_next()
|
||||
{
|
||||
|
||||
@@ -95,7 +95,6 @@ void hud_target_subsystem_in_reticle();
|
||||
void hud_show_targeting_gauges(float frametime);
|
||||
void hud_target_targets_target();
|
||||
void hud_check_reticle_list();
|
||||
void hud_target_closest_locked_missile(object *A);
|
||||
void hud_target_missile(object *source_obj, int next_flag);
|
||||
void hud_target_next_list(int hostile=1, int next_flag=1, int team_mask = -1, int attacked_objnum = -1, int play_fail_sound = TRUE, int filter = 0, int turret_attacking_target = 0);
|
||||
int hud_target_closest_repair_ship(int goal_objnum=-1);
|
||||
@@ -117,7 +116,6 @@ void hud_target_prev_subobject();
|
||||
void hud_cease_subsystem_targeting(bool print_message = true);
|
||||
void hud_cease_targeting(bool deliberate = false);
|
||||
void hud_restore_subsystem_target(ship* shipp);
|
||||
int subsystem_in_sight(object* objp, ship_subsys* subsys, vec3d *eye, vec3d* subsystem);
|
||||
vec3d* get_subsystem_world_pos(object* parent_obj, ship_subsys* subsys, vec3d* world_pos);
|
||||
void hud_target_change_check();
|
||||
|
||||
|
||||
@@ -148,7 +148,6 @@ public:
|
||||
void initTimeOffsets(int x, int y);
|
||||
void initOrderOffsets(int x, int y);
|
||||
void initOrderMaxWidth(int width);
|
||||
void updateFrame();
|
||||
void render(float frametime) override;
|
||||
void initialize() override;
|
||||
void initDockFlashTimer();
|
||||
@@ -158,7 +157,6 @@ public:
|
||||
void pageIn() override;
|
||||
};
|
||||
|
||||
void hud_targetbox_init();
|
||||
void hud_targetbox_init_flash();
|
||||
void hud_get_target_strength(object *objp, float *shields, float *integrity);
|
||||
|
||||
|
||||
@@ -20,9 +20,7 @@ class p_object;
|
||||
|
||||
void hud_init_wingman_status_gauge();
|
||||
void hud_wingman_status_update();
|
||||
void hud_wingman_status_render();
|
||||
void hud_wingman_status_init_flash();
|
||||
int hud_wingman_status_maybe_flash(int wing_index, int wing_pos);
|
||||
void hud_set_wingman_status_dead(int wing_index, int wing_pos);
|
||||
void hud_set_wingman_status_departed(int wing_index, int wing_pos);
|
||||
void hud_set_wingman_status_alive( int wing_index, int wing_pos);
|
||||
|
||||
@@ -19,14 +19,6 @@ Joystick *currentJoystick = nullptr;
|
||||
|
||||
bool initialized = false;
|
||||
|
||||
/**
|
||||
* @brief Compatibility conversion from HatPosition to array index
|
||||
*/
|
||||
inline
|
||||
int hatEnumToIdx(HatPosition in) {
|
||||
return static_cast<int>(in - JOY_NUM_BUTTONS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Compatibility conversion from Button index to HatPosition
|
||||
*/
|
||||
|
||||
@@ -478,14 +478,6 @@ void joy_ff_mission_init(vec3d v)
|
||||
joy_ff_handling_scaler = (int) ((vm_vec_mag(&v) + 1.3f) * 5.0f);
|
||||
}
|
||||
|
||||
void joy_reacquire_ff()
|
||||
{
|
||||
}
|
||||
|
||||
void joy_unacquire_ff()
|
||||
{
|
||||
}
|
||||
|
||||
void joy_ff_play_vector_effect(vec3d *v, float scaler)
|
||||
{
|
||||
vec3d vf;
|
||||
|
||||
@@ -18,8 +18,6 @@ int joy_ff_init();
|
||||
void joy_ff_shutdown();
|
||||
void joy_ff_stop_effects();
|
||||
void joy_ff_mission_init(vec3d v);
|
||||
void joy_reacquire_ff();
|
||||
void joy_unacquire_ff();
|
||||
void joy_ff_play_vector_effect(vec3d *v, float scaler);
|
||||
void joy_ff_play_dir_effect(float x, float y);
|
||||
void joy_ff_play_primary_shoot(int gain);
|
||||
|
||||
@@ -367,74 +367,6 @@ int key_inkey()
|
||||
return key;
|
||||
}
|
||||
|
||||
// Unget a key. Puts it back in the input queue.
|
||||
void key_outkey(int key)
|
||||
{
|
||||
int bufp;
|
||||
|
||||
if ( !key_inited ) return;
|
||||
|
||||
SDL_LockMutex( key_lock );
|
||||
|
||||
bufp = key_data.keytail+1;
|
||||
|
||||
if (bufp >= KEY_BUFFER_SIZE){
|
||||
bufp = 0;
|
||||
}
|
||||
|
||||
key_data.keybuffer[key_data.keytail] = (unsigned short)key;
|
||||
|
||||
key_data.keytail = bufp;
|
||||
|
||||
SDL_UnlockMutex( key_lock );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Return amount of time last key was held down.
|
||||
// This is currently (July 17, 1996) bogus because our timing is
|
||||
// not accurate.
|
||||
int key_inkey_time(uint * time)
|
||||
{
|
||||
int key = 0;
|
||||
|
||||
if ( !key_inited ) {
|
||||
*time = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_LockMutex( key_lock );
|
||||
|
||||
if (key_data.keytail!=key_data.keyhead) {
|
||||
key = key_data.keybuffer[key_data.keyhead];
|
||||
*time = key_data.time_pressed[key_data.keyhead];
|
||||
key_data.keyhead = add_one(key_data.keyhead);
|
||||
}
|
||||
|
||||
SDL_UnlockMutex( key_lock );
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
// Returns scancode of last key pressed, if any (returns 0 if no key pressed)
|
||||
// but does not update keyhead pointer.
|
||||
int key_peekkey()
|
||||
{
|
||||
int key = 0;
|
||||
|
||||
if ( !key_inited ) return 0;
|
||||
|
||||
SDL_LockMutex( key_lock );
|
||||
|
||||
if (key_data.keytail!=key_data.keyhead) {
|
||||
key = key_data.keybuffer[key_data.keyhead];
|
||||
}
|
||||
SDL_UnlockMutex( key_lock );
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
// If not installed, uses BIOS and returns getch();
|
||||
// Else returns pending key (or waits for one if none waiting).
|
||||
int key_getch()
|
||||
@@ -552,30 +484,6 @@ int key_down_count(int scancode)
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
// Returns number of times key has went from down to up since last call.
|
||||
int key_up_count(int scancode)
|
||||
{
|
||||
int n;
|
||||
|
||||
if ( !key_inited ) return 0;
|
||||
if ((scancode<0)|| (scancode>=NUM_KEYS)) return 0;
|
||||
|
||||
SDL_LockMutex( key_lock );
|
||||
|
||||
n = key_data.NumUps[scancode];
|
||||
key_data.NumUps[scancode] = 0;
|
||||
|
||||
SDL_UnlockMutex( key_lock );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
int key_check(int key)
|
||||
{
|
||||
return key_data.down_check[key];
|
||||
}
|
||||
|
||||
// Add a key up or down code to the key buffer. state=1 -> down, state=0 -> up
|
||||
// latency => time difference in ms between when key was actually pressed and now
|
||||
//void key_mark( uint code, int state )
|
||||
|
||||
@@ -12,12 +12,6 @@
|
||||
#ifndef _KEY_H
|
||||
#define _KEY_H
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
*/
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#define NUM_KEYS 256
|
||||
@@ -34,11 +28,9 @@ void key_lost_focus();
|
||||
void key_got_focus();
|
||||
void key_mark( uint code, int state, uint latency );
|
||||
int key_getch();
|
||||
int key_peekkey();
|
||||
void key_flush();
|
||||
|
||||
// Routines/data you can access:
|
||||
//NOT USED! extern fix key_down_time( uint code );
|
||||
float key_down_timef( uint code );
|
||||
|
||||
int key_to_ascii(int keycode );
|
||||
@@ -49,12 +41,7 @@ int key_inkey();
|
||||
|
||||
uint key_get_shift_status();
|
||||
int key_down_count(int scancode);
|
||||
int key_up_count(int scancode);
|
||||
int key_checkch();
|
||||
int key_check(int key);
|
||||
|
||||
// Put "key" back in the input buffer.
|
||||
void key_outkey(int key);
|
||||
|
||||
extern int Cheats_enabled;
|
||||
extern int Key_normal_game;
|
||||
@@ -185,10 +172,4 @@ extern int Key_normal_game;
|
||||
#define KEY_PAUSE 0x45 //DOS: 0x61
|
||||
#define KEY_BREAK 0xc6
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
#endif
|
||||
+8
-10
@@ -614,8 +614,6 @@ void debug_change_song(int delta)
|
||||
|
||||
extern int Framerate_delay;
|
||||
|
||||
extern void snd_stop_any_sound();
|
||||
|
||||
extern vec3d Eye_position;
|
||||
extern matrix Eye_matrix;
|
||||
extern void g3_set_view_matrix(const vec3d *view_pos, const matrix *view_matrix, float zoom);
|
||||
@@ -2413,9 +2411,9 @@ int button_function(int n)
|
||||
|
||||
control_used(END_MISSION);
|
||||
|
||||
if (collide_predict_large_ship(Player_obj, 200.0f)
|
||||
|| (Ship_info[Ships[Player_obj->instance].ship_info_index].warpout_type == WT_HYPERSPACE
|
||||
&& collide_predict_large_ship(Player_obj, 100000.0f)))
|
||||
if ( collide_predict_large_ship(Player_obj, 200.0f)
|
||||
|| (Warp_params[Ships[Player_obj->instance].warpout_params_index].warp_type == WT_HYPERSPACE
|
||||
&& collide_predict_large_ship(Player_obj, 100000.0f)) )
|
||||
{
|
||||
gamesnd_play_iface(InterfaceSounds::GENERAL_FAIL);
|
||||
HUD_printf("%s", XSTR( "** WARNING ** Collision danger. Subspace drive not activated.", 39));
|
||||
@@ -2425,7 +2423,7 @@ int button_function(int n)
|
||||
} else if (!ship_navigation_ok_to_warp(Player_ship)) {
|
||||
gamesnd_play_iface(InterfaceSounds::GENERAL_FAIL);
|
||||
HUD_printf("%s", XSTR("Navigation failure. Cannot engage subspace drive.", 1572));
|
||||
} else if ( (Player_obj != NULL) && object_get_gliding(Player_obj)) {
|
||||
} else if ((Player_obj != nullptr) && object_get_gliding(Player_obj)) {
|
||||
gamesnd_play_iface(InterfaceSounds::GENERAL_FAIL);
|
||||
HUD_printf("%s", XSTR("Cannot engage subspace drive while gliding.", 1573));
|
||||
} else {
|
||||
@@ -2771,9 +2769,9 @@ int button_function(int n)
|
||||
|
||||
control_used(END_MISSION);
|
||||
|
||||
if (collide_predict_large_ship(Player_obj, 200.0f)
|
||||
|| (Ship_info[Ships[Player_obj->instance].ship_info_index].warpout_type == WT_HYPERSPACE
|
||||
&& collide_predict_large_ship(Player_obj, 100000.0f)))
|
||||
if ( collide_predict_large_ship(Player_obj, 200.0f)
|
||||
|| (Warp_params[Ships[Player_obj->instance].warpout_params_index].warp_type == WT_HYPERSPACE
|
||||
&& collide_predict_large_ship(Player_obj, 100000.0f)) )
|
||||
{
|
||||
gamesnd_play_iface(InterfaceSounds::GENERAL_FAIL);
|
||||
HUD_printf("%s", XSTR( "** WARNING ** Collision danger. Subspace drive not activated.", 39));
|
||||
@@ -2783,7 +2781,7 @@ int button_function(int n)
|
||||
} else if (!ship_navigation_ok_to_warp(Player_ship)) {
|
||||
gamesnd_play_iface(InterfaceSounds::GENERAL_FAIL);
|
||||
HUD_printf("%s", XSTR("Navigation failure. Cannot engage subspace drive.", 1572));
|
||||
} else if (Player_obj != NULL && object_get_gliding(Player_obj)) {
|
||||
} else if ((Player_obj != nullptr) && object_get_gliding(Player_obj)) {
|
||||
gamesnd_play_iface(InterfaceSounds::GENERAL_FAIL);
|
||||
HUD_printf("%s", XSTR("Cannot engage subspace drive while gliding.", 1573));
|
||||
} else {
|
||||
|
||||
@@ -50,10 +50,6 @@ int Mouse_dx = 0;
|
||||
int Mouse_dy = 0;
|
||||
int Mouse_dz = 0;
|
||||
|
||||
int Last_mouse_dx = 0;
|
||||
int Last_mouse_dy = 0;
|
||||
int Last_mouse_dz = 0;
|
||||
|
||||
int Mouse_sensitivity = 4;
|
||||
int Use_mouse_to_fly = 0;
|
||||
|
||||
@@ -112,24 +108,6 @@ void mousewheel_decay(int btn);
|
||||
|
||||
static bool Mouse_in_focus = true;
|
||||
|
||||
void mouse_got_focus()
|
||||
{
|
||||
if ( !mouse_inited ) return;
|
||||
|
||||
Mouse_in_focus = true;
|
||||
|
||||
mouse_flush();
|
||||
}
|
||||
|
||||
void mouse_lost_focus()
|
||||
{
|
||||
if ( !mouse_inited ) return;
|
||||
|
||||
Mouse_in_focus = false;
|
||||
|
||||
mouse_flush();
|
||||
}
|
||||
|
||||
void mouse_close()
|
||||
{
|
||||
if (!mouse_inited)
|
||||
@@ -418,33 +396,6 @@ int mouse_down(int btn)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
// returns the fraction of time btn has been down since last call
|
||||
// (currently returns 1 if buttons is down, 0 otherwise)
|
||||
//
|
||||
float mouse_down_time(int btn)
|
||||
{
|
||||
float tmp;
|
||||
if ( !mouse_inited ) return 0.0f;
|
||||
|
||||
// Bail if not a button or wheel direction
|
||||
if ( (btn < LOWEST_MOUSE_BUTTON) || (btn > HIGHEST_MOUSE_WHEEL)) return 0.0f;
|
||||
|
||||
SDL_LockMutex( mouse_lock );
|
||||
|
||||
if (mouse_flags & btn) {
|
||||
tmp = 1.0f;
|
||||
if ((btn >= LOWEST_MOUSE_WHEEL) && (btn <= HIGHEST_MOUSE_WHEEL)) {
|
||||
mousewheel_decay(btn);
|
||||
}
|
||||
} else {
|
||||
tmp = 0.0f;
|
||||
}
|
||||
|
||||
SDL_UnlockMutex( mouse_lock );
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void mouse_get_delta(int *dx, int *dy, int *dz)
|
||||
{
|
||||
if (dx)
|
||||
@@ -466,10 +417,6 @@ void mouse_force_pos(int x, int y)
|
||||
// Reset deltas so we don't have duplicate mouse deltas
|
||||
void mouse_reset_deltas()
|
||||
{
|
||||
Last_mouse_dx = Mouse_dx;
|
||||
Last_mouse_dy = Mouse_dy;
|
||||
Last_mouse_dz = Mouse_dz;
|
||||
|
||||
Mouse_dx = Mouse_dy = Mouse_dz = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,10 +71,6 @@ int mouse_up_count(int n);
|
||||
void mouse_flush();
|
||||
|
||||
int mouse_down(int btn); // returns 1 if mouse button btn is down, 0 otherwise
|
||||
float mouse_down_time(int btn); // returns the fraction of time btn has been down since last call
|
||||
|
||||
void mouse_lost_focus();
|
||||
void mouse_got_focus();
|
||||
|
||||
void mouse_reset_deltas();
|
||||
void mouse_get_delta(int *dx = NULL, int *dy = NULL, int *dz = NULL);
|
||||
|
||||
+20
-22
@@ -127,13 +127,14 @@ void timestamp_reset()
|
||||
// For debugging & testing, you could set this to
|
||||
// something like 1 minute (6000).
|
||||
const std::uint32_t MAX_TIME = INT_MAX / 2;
|
||||
const std::uint64_t MAX_TICKER = (MAX_TIME - 2) * 1000; // subtract 2 because timestamp_ms() adds 2, and we want MAX_TICKER to correspond to MAX_TIME
|
||||
|
||||
static int timestamp_ms() {
|
||||
if (timestamp_ticker <= 2) {
|
||||
// These are special values, don't adjust them
|
||||
return (int)timestamp_ticker;
|
||||
}
|
||||
return (int)(timestamp_ticker / 1000);
|
||||
return (int)(timestamp_ticker / 1000) + 2; // avoid values below 2
|
||||
}
|
||||
|
||||
void timestamp_inc(fix frametime)
|
||||
@@ -144,8 +145,8 @@ void timestamp_inc(fix frametime)
|
||||
|
||||
timestamp_ticker += delta;
|
||||
|
||||
if ( timestamp_ms() > (int)MAX_TIME ) {
|
||||
timestamp_ticker = 2; // Roll!
|
||||
if ( timestamp_ticker > MAX_TICKER ) {
|
||||
timestamp_ticker -= MAX_TICKER - 2; // Roll!
|
||||
}
|
||||
|
||||
if (timestamp_ticker < 2 ) {
|
||||
@@ -161,8 +162,9 @@ int timestamp(int delta_ms ) {
|
||||
t2 = timestamp_ms() + delta_ms;
|
||||
if ( t2 > (int)MAX_TIME ) {
|
||||
// wrap!!!
|
||||
t2 = delta_ms - (MAX_TIME-timestamp_ms());
|
||||
t2 -= MAX_TIME - 2;
|
||||
}
|
||||
Assertion(t2 >= 2, "Math no longer makes sense; t2 is %d", t2);
|
||||
if (t2 < 2 ) t2 = 2; // hack??
|
||||
return t2;
|
||||
}
|
||||
@@ -170,25 +172,16 @@ int timestamp(int delta_ms ) {
|
||||
// Returns milliseconds until timestamp will elapse.
|
||||
// Negative value gives milliseconds ago that timestamp elapsed.
|
||||
int timestamp_until(int stamp) {
|
||||
// JAS: FIX
|
||||
// HACK!! This doesn't handle rollover!
|
||||
// (Will it ever happen?)
|
||||
int delta;
|
||||
|
||||
return stamp - timestamp_ms();
|
||||
delta = stamp - timestamp_ms();
|
||||
|
||||
/*
|
||||
uint delta;
|
||||
|
||||
delta = stamp - timestamp_ticker;
|
||||
|
||||
|
||||
if (delta > UINT_MAX/2)
|
||||
delta = UINT_MAX - delta + 1;
|
||||
else if (delta < - ( (int) (UINT_MAX/2)))
|
||||
delta = UINT_MAX + delta + 1;
|
||||
if (delta > (int)MAX_TIME/2)
|
||||
delta = delta - MAX_TIME + 1;
|
||||
else if (delta < -(int)MAX_TIME/2)
|
||||
delta = delta + MAX_TIME - 1;
|
||||
|
||||
return delta;
|
||||
*/
|
||||
}
|
||||
|
||||
// alternate timestamp functions. The way these work is you call xtimestamp() to get the
|
||||
@@ -204,17 +197,22 @@ int timestamp_has_time_elapsed(int stamp, int time) {
|
||||
return 1;
|
||||
|
||||
t = stamp + time;
|
||||
if (t <= timestamp_ms())
|
||||
return 1; // if we are unlucky enough to have it wrap on us, this will assume time has elapsed.
|
||||
if (t > (int)MAX_TIME) {
|
||||
t -= MAX_TIME - 2;
|
||||
}
|
||||
if (timestamp_until(t) <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
bool timestamp_elapsed(int stamp) {
|
||||
if (stamp == 0) {
|
||||
return false;
|
||||
} else if (stamp == 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return timestamp_ms() >= stamp;
|
||||
return timestamp_until(stamp) <= 0;
|
||||
}
|
||||
bool timestamp_elapsed_safe(int a, int b) {
|
||||
if (a == 0) {
|
||||
|
||||
+768
-499
File diff suppressed because it is too large.
Load diff
+24
-15
@@ -1893,15 +1893,8 @@ int Tree::DoMouseUp(float /*frametime*/)
|
||||
{
|
||||
OwnerSystem->SetActiveObject(this);
|
||||
|
||||
if (HighlightedItem != NULL) {
|
||||
SelectedItem = HighlightedItem;
|
||||
SelectedItem->ShowChildren = !SelectedItem->ShowChildren;
|
||||
if (NOT_EMPTY(&SelectedItem->Children)) {
|
||||
OnRefreshSize(); //Unfortunately
|
||||
}
|
||||
if (SelectedItem->Function != NULL) {
|
||||
SelectedItem->Function(this);
|
||||
}
|
||||
if (HighlightedItem != nullptr) {
|
||||
SetSelectedItem(HighlightedItem);
|
||||
}
|
||||
|
||||
return OF_TRUE;
|
||||
@@ -1961,6 +1954,17 @@ void Tree::ClearItems()
|
||||
}
|
||||
}
|
||||
|
||||
void Tree::SetSelectedItem(TreeItem *item) {
|
||||
SelectedItem = item;
|
||||
SelectedItem->ShowChildren = !SelectedItem->ShowChildren;
|
||||
if (NOT_EMPTY(&SelectedItem->Children)) {
|
||||
OnRefreshSize(); //Unfortunately
|
||||
}
|
||||
if (SelectedItem->Function != nullptr) {
|
||||
SelectedItem->Function(this);
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************Text*******************************
|
||||
int Text::DoRefreshSize()
|
||||
{
|
||||
@@ -2695,13 +2699,13 @@ float Slider::GetSliderPos(int x)
|
||||
return i2fl(x - BarCoords[0]) / i2fl(BarCoords[2] - BarCoords[0] - SliderWidth);
|
||||
}
|
||||
|
||||
void Slider::UpdateSlider(int x)
|
||||
void Slider::UpdateSlider(float x)
|
||||
{
|
||||
SliderScale = GetSliderPos(x);
|
||||
|
||||
SliderScale = x;
|
||||
|
||||
CLAMP(SliderScale, 0.0, 1.0f);
|
||||
|
||||
if ( function != NULL ) {
|
||||
if ( function != nullptr ) {
|
||||
function(this);
|
||||
}
|
||||
}
|
||||
@@ -2711,6 +2715,11 @@ float Slider::GetSliderValue()
|
||||
return (SliderScale * (Max - Min) + Min);
|
||||
}
|
||||
|
||||
void Slider::SetSliderValue(float raw_val)
|
||||
{
|
||||
UpdateSlider((raw_val - Min) / Max + Min);
|
||||
}
|
||||
|
||||
void Slider::DoMove(int dx, int dy)
|
||||
{
|
||||
BarCoords[0] += dx;
|
||||
@@ -2751,7 +2760,7 @@ int Slider::DoMouseDown(float /*frametime*/)
|
||||
int sliderX = GetSliderOffset();
|
||||
|
||||
if ( SliderGrabbed ) {
|
||||
UpdateSlider(x);
|
||||
UpdateSlider(GetSliderPos(x));
|
||||
} else {
|
||||
// first check if the mouse is within the slider bounds
|
||||
if ( x >= sliderX
|
||||
@@ -2766,7 +2775,7 @@ int Slider::DoMouseDown(float /*frametime*/)
|
||||
&& y <= BarCoords[3]) {
|
||||
// we've clicked on an area of the bar but didn't click the slider
|
||||
// move the slider to the new position
|
||||
UpdateSlider(x);
|
||||
UpdateSlider(GetSliderPos(x));
|
||||
SliderGrabbed = true;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -542,6 +542,7 @@ public:
|
||||
void ClearItems();
|
||||
|
||||
TreeItem* GetSelectedItem(){return SelectedItem;}
|
||||
void SetSelectedItem(TreeItem *item);
|
||||
};
|
||||
|
||||
//*****************************Text*******************************
|
||||
@@ -752,7 +753,7 @@ class Slider : public GUIObject
|
||||
|
||||
int GetSliderOffset();
|
||||
float GetSliderPos(int x);
|
||||
void UpdateSlider(int x);
|
||||
void UpdateSlider(float x);
|
||||
protected:
|
||||
void DoDraw(float frametime) override;
|
||||
void DoMove(int dx, int dy) override;
|
||||
@@ -764,6 +765,7 @@ public:
|
||||
Slider(const SCP_string &in_label, float min, float max, int x_coord, int y_coord, void(*in_function)(Slider *caller) = NULL, int x_width = -1, int y_height = DEFAULT_BUTTON_HEIGHT, int in_style = 0);
|
||||
|
||||
float GetSliderValue();
|
||||
void SetSliderValue(float raw_val);
|
||||
};
|
||||
|
||||
//*****************************GLOBALS*******************************
|
||||
|
||||
@@ -8,6 +8,7 @@ const int MIN_LOG_LEVEL = AV_LOG_WARNING;
|
||||
|
||||
bool initialized = false;
|
||||
|
||||
#ifndef NDEBUG
|
||||
void log_callback_report(void* ptr, int level, const char* fmt, va_list vl) {
|
||||
if (level > MIN_LOG_LEVEL) {
|
||||
return;
|
||||
@@ -19,6 +20,7 @@ void log_callback_report(void* ptr, int level, const char* fmt, va_list vl) {
|
||||
|
||||
mprintf(("FFMPEG Log: %s", buffer)); // no \n, ffmpeg handles that
|
||||
}
|
||||
#endif
|
||||
|
||||
void check_version(const char* libname, uint32_t current, uint32_t compiled)
|
||||
{
|
||||
|
||||
@@ -625,11 +625,6 @@ light_indexing_info scene_lights::bufferLights()
|
||||
return light_info;
|
||||
}
|
||||
|
||||
size_t scene_lights::getNumStaticLights()
|
||||
{
|
||||
return StaticLightIndices.size();
|
||||
}
|
||||
|
||||
void scene_lights::resetLightState()
|
||||
{
|
||||
current_light_index = static_cast<size_t>(-1);
|
||||
|
||||
@@ -82,7 +82,6 @@ public:
|
||||
void setLightFilter(int objnum, const vec3d *pos, float rad);
|
||||
bool setLights(const light_indexing_info *info);
|
||||
void resetLightState();
|
||||
size_t getNumStaticLights();
|
||||
light_indexing_info bufferLights();
|
||||
};
|
||||
|
||||
|
||||
@@ -91,9 +91,6 @@ int lcl_ext_get_text(const SCP_string &xstr, SCP_string &out);
|
||||
int lcl_ext_get_id(const char *xstr, int *out);
|
||||
int lcl_ext_get_id(const SCP_string &xstr, int *out);
|
||||
|
||||
// if the char is a valid char for a signed integer value string
|
||||
int lcl_is_valid_numeric_char(char c);
|
||||
|
||||
// parses the string.tbl and reports back only on the languages it found
|
||||
void parse_stringstbl_quick(const char *filename);
|
||||
|
||||
@@ -173,12 +170,6 @@ void lcl_close() {
|
||||
lcl_xstr_close();
|
||||
}
|
||||
|
||||
// determine what language we're running in, see LCL_* defines above
|
||||
int lcl_get_language()
|
||||
{
|
||||
return Lcl_current_lang;
|
||||
}
|
||||
|
||||
// parses the string.tbl to see which languages are supported. Doesn't read in any strings.
|
||||
void parse_stringstbl_quick(const char *filename)
|
||||
{
|
||||
@@ -526,38 +517,6 @@ ubyte lcl_get_font_index(int font_num)
|
||||
}
|
||||
}
|
||||
|
||||
// maybe add on an appropriate subdirectory when opening a localized file
|
||||
void lcl_add_dir(char *current_path)
|
||||
{
|
||||
char last_char;
|
||||
size_t path_len;
|
||||
|
||||
// if the disk extension is 0 length, don't add enything
|
||||
if (strlen(Lcl_languages[Lcl_current_lang].lang_ext) <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// get the length of the string so far
|
||||
path_len = strlen(current_path);
|
||||
if (path_len <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// get the current last char
|
||||
last_char = current_path[path_len - 1];
|
||||
|
||||
// if the last char is a slash, just copy in the disk extension
|
||||
if (last_char == DIR_SEPARATOR_CHAR) {
|
||||
strcat(current_path, Lcl_languages[Lcl_current_lang].lang_ext);
|
||||
strcat(current_path, DIR_SEPARATOR_STR);
|
||||
}
|
||||
// otherwise add a slash, then copy in the disk extension
|
||||
else {
|
||||
strcat(current_path, DIR_SEPARATOR_STR);
|
||||
strcat(current_path, Lcl_languages[Lcl_current_lang].lang_ext);
|
||||
}
|
||||
}
|
||||
|
||||
// maybe add localized directory to full path with file name when opening a localized file
|
||||
int lcl_add_dir_to_path_with_filename(char *current_path, size_t path_max)
|
||||
{
|
||||
@@ -1131,13 +1090,6 @@ int lcl_ext_get_id(const SCP_string &xstr, int *out)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// if the char is a valid char for a signed integer value
|
||||
int lcl_is_valid_numeric_char(char c)
|
||||
{
|
||||
return ( (c == '-') || (c == '0') || (c == '1') || (c == '2') || (c == '3') || (c == '4') ||
|
||||
(c == '5') || (c == '6') || (c == '7') || (c == '8') || (c == '9') ) ? 1 : 0;
|
||||
}
|
||||
|
||||
void lcl_get_language_name(char *lang_name)
|
||||
{
|
||||
Assert(Lcl_current_lang < (int)Lcl_languages.size());
|
||||
|
||||
@@ -78,9 +78,6 @@ void lcl_xstr_init();
|
||||
// free the xstr table
|
||||
void lcl_xstr_close();
|
||||
|
||||
// determine what language we're running in, see LCL_* defines above
|
||||
int lcl_get_language();
|
||||
|
||||
// returns the current language character string
|
||||
void lcl_get_language_name(char *lang_name);
|
||||
|
||||
@@ -95,9 +92,6 @@ ubyte lcl_get_font_index(int font_num);
|
||||
// functions - ask first :)
|
||||
// externalization of table/mission files (only parse routines ever need to deal with these functions) -----------------------
|
||||
|
||||
// maybe add on an appropriate subdirectory when opening a localized file
|
||||
void lcl_add_dir(char *current_path);
|
||||
|
||||
// maybe add localized directory to full path with file name when opening a localized file
|
||||
int lcl_add_dir_to_path_with_filename(char *current_path, size_t path_max);
|
||||
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ extern matrix vmd_identity_matrix;
|
||||
#define vm_angvec_make(v,_p,_b,_h) (((v)->p=(_p), (v)->b=(_b), (v)->h=(_h)), (v))
|
||||
|
||||
//negate a vector
|
||||
#define vm_vec_negate(v) do {(v)->xyz.x = - (v)->xyz.x; (v)->xyz.y = - (v)->xyz.y; (v)->xyz.z = - (v)->xyz.z;} while (0);
|
||||
#define vm_vec_negate(v) do {(v)->xyz.x = - (v)->xyz.x; (v)->xyz.y = - (v)->xyz.y; (v)->xyz.z = - (v)->xyz.z;} while (false);
|
||||
|
||||
typedef struct plane {
|
||||
float A, B, C, D;
|
||||
|
||||
@@ -257,7 +257,6 @@ SCP_vector<briefing_icon_info> Briefing_icon_info;
|
||||
// --------------------------------------------------------------------------------------
|
||||
void brief_render_elements(vec3d *pos, grid *gridp);
|
||||
void brief_render_icons(int stage_num, float frametime);
|
||||
void brief_grid_read_camera_controls( control_info * ci, float frametime );
|
||||
void brief_maybe_create_new_grid(grid *gridp, vec3d *pos, matrix *orient, int force = 0);
|
||||
grid *brief_create_grid(grid *gridp, vec3d *forward, vec3d *right, vec3d *center, int nrows, int ncols, float square_size);
|
||||
grid *brief_create_default_grid(void);
|
||||
@@ -1819,50 +1818,6 @@ void brief_set_new_stage(vec3d *pos, matrix *orient, int time, int stage_num)
|
||||
Last_new_stage = stage_num;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
// camera_pos_past_target()
|
||||
//
|
||||
//
|
||||
int camera_pos_past_target(vec3d *start, vec3d *current, vec3d *dest)
|
||||
{
|
||||
vec3d num, den;
|
||||
float ratio;
|
||||
|
||||
vm_vec_sub(&num, current, start);
|
||||
vm_vec_sub(&den, start, dest);
|
||||
|
||||
ratio = vm_vec_mag_quick(&num) / vm_vec_mag_quick(&den);
|
||||
if (ratio >= 1.0f)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interpolate between matrices.
|
||||
* elapsed_time/total_time gives percentage of interpolation between cur and goal.
|
||||
*/
|
||||
void interpolate_matrix(matrix *result, matrix *goal, matrix *start, float elapsed_time, float total_time)
|
||||
{
|
||||
vec3d fvec, rvec;
|
||||
float time0, time1;
|
||||
|
||||
if ( !vm_matrix_cmp( goal, start ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
time0 = elapsed_time / total_time;
|
||||
time1 = (total_time - elapsed_time) / total_time;
|
||||
|
||||
vm_vec_copy_scale(&fvec, &start->vec.fvec, time1);
|
||||
vm_vec_scale_add2(&fvec, &goal->vec.fvec, time0);
|
||||
|
||||
vm_vec_copy_scale(&rvec, &start->vec.rvec, time1);
|
||||
vm_vec_scale_add2(&rvec, &goal->vec.rvec, time0);
|
||||
|
||||
vm_vector_2_matrix(result, &fvec, NULL, &rvec);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate how far the camera should have moved
|
||||
*/
|
||||
|
||||
@@ -702,49 +702,6 @@ int mission_campaign_load( char *filename, player *pl, int load_savefile, bool r
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads up a freespace campaign given the filename.
|
||||
* This routine is used to load up campaigns when a pilot file is loaded.
|
||||
* Generally, the filename will probably be the freespace campaign file, but not necessarily.
|
||||
*/
|
||||
int mission_campaign_load_by_name( char *filename )
|
||||
{
|
||||
char name[NAME_LENGTH],test[5];
|
||||
int type,max_players;
|
||||
|
||||
// make sure to tack on .fsc on the end if its not there already
|
||||
if(filename[0] != '\0'){
|
||||
if(strlen(filename) > 4){
|
||||
strcpy_s(test,filename+(strlen(filename)-4));
|
||||
if(strcmp(test, FS_CAMPAIGN_FILE_EXT)!=0){
|
||||
strcat(filename, FS_CAMPAIGN_FILE_EXT);
|
||||
}
|
||||
} else {
|
||||
strcat(filename, FS_CAMPAIGN_FILE_EXT);
|
||||
}
|
||||
} else {
|
||||
Error(LOCATION,"Tried to load campaign file with illegal length/extension!");
|
||||
}
|
||||
|
||||
if (!mission_campaign_get_info(filename, name, &type, &max_players)){
|
||||
return -1;
|
||||
}
|
||||
|
||||
Num_campaigns = 0;
|
||||
Campaign_file_names[Num_campaigns] = vm_strdup(filename);
|
||||
Campaign_names[Num_campaigns] = vm_strdup(name);
|
||||
Num_campaigns++;
|
||||
mission_campaign_load(filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mission_campaign_load_by_name_csfe( char *filename, char *callsign )
|
||||
{
|
||||
Game_mode |= GM_NORMAL;
|
||||
strcpy_s(Player->callsign, callsign);
|
||||
return mission_campaign_load_by_name( filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* initialise Player_loadout with default values
|
||||
*/
|
||||
@@ -811,22 +768,6 @@ void mission_campaign_savefile_generate_root(char *filename, player *pl)
|
||||
sprintf( filename, NOX("%s.%s."), pl->callsign, base );
|
||||
}
|
||||
|
||||
/**
|
||||
* The following function always only ever ever ever called by CSFE!!!!!
|
||||
*/
|
||||
int campaign_savefile_save(char *pname)
|
||||
{
|
||||
if (Campaign.type == CAMPAIGN_TYPE_SINGLE)
|
||||
Game_mode &= ~GM_MULTIPLAYER;
|
||||
else
|
||||
Game_mode |= GM_MULTIPLAYER;
|
||||
|
||||
strcpy_s(Player->callsign, pname);
|
||||
|
||||
return (int)Pilot.save_savefile();
|
||||
}
|
||||
|
||||
|
||||
// the below two functions is internal to this module. It is here so that I can group the save/load
|
||||
// functions together.
|
||||
//
|
||||
@@ -851,12 +792,6 @@ void mission_campaign_savefile_delete( char *cfilename )
|
||||
cf_delete(filename, CF_TYPE_PLAYERS, CF_LOCATION_ROOT_USER | CF_LOCATION_ROOT_GAME | CF_LOCATION_TYPE_ROOT);
|
||||
}
|
||||
|
||||
void campaign_delete_save( char *cfn, char *pname)
|
||||
{
|
||||
strcpy_s(Player->callsign, pname);
|
||||
mission_campaign_savefile_delete(cfn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all the save files for this particular pilot.
|
||||
* Just call cfile function which will delete multiple files
|
||||
|
||||
@@ -141,16 +141,6 @@ extern campaign Campaign;
|
||||
// campaign wasn't ended
|
||||
extern int Campaign_ending_via_supernova;
|
||||
|
||||
// structure for players. Holds the campaign name, number of missions flown in the campaign, and result
|
||||
// of the missions flown. This structure is stored in the player file and thus is persistent across
|
||||
// games
|
||||
typedef struct campaign_info
|
||||
{
|
||||
int num_missions_completed;
|
||||
char filename[NAME_LENGTH];
|
||||
ubyte missions_completed[MAX_CAMPAIGN_MISSIONS];
|
||||
} campaign_info;
|
||||
|
||||
// extern'ed so the mission loading can get a list of campains. Only use this
|
||||
// data after mission_campaign_build_list() is called
|
||||
#define MAX_CAMPAIGNS 128
|
||||
@@ -174,19 +164,11 @@ void player_loadout_init();
|
||||
// called at game startup time to load the default single player campaign
|
||||
void mission_campaign_init( void );
|
||||
|
||||
// called to reload the default campaign
|
||||
int mission_campaign_load_by_name( char *filename );
|
||||
int mission_campaign_load_by_name_csfe( char *filename, char *callsign );
|
||||
|
||||
|
||||
// load up and initialize a new campaign
|
||||
int mission_campaign_load( char *filename, player *pl = NULL, int load_savefile = 1, bool reset_stats = true );
|
||||
|
||||
bool campaign_is_ignored(const char *filename);
|
||||
|
||||
// function to save the state of the campaign between missions or to load a campaign save file
|
||||
extern int mission_campaign_save( void );
|
||||
|
||||
// declaration for local campaign save game load function
|
||||
extern void mission_campaign_savefile_delete( char *cfilename );
|
||||
extern void mission_campaign_delete_all_savefiles( char *pilot_name );
|
||||
@@ -203,9 +185,6 @@ extern void mission_campaign_mission_over( bool do_next_mission = true );
|
||||
// frees all memory at game close time
|
||||
extern void mission_campaign_clear( void );
|
||||
|
||||
// read in a campaign file. Used by Fred.
|
||||
int mission_campaign_load_fred(char *filename, char *name_verify = NULL);
|
||||
|
||||
// used by Fred to get a mission's list of goals.
|
||||
void read_mission_goal_list(int num);
|
||||
|
||||
@@ -223,16 +202,9 @@ extern void mission_campaign_save_persistent( int type, int index );
|
||||
|
||||
void mission_campaign_savefile_generate_root(char *filename, player *pl = NULL);
|
||||
|
||||
int mission_campaign_savefile_save();
|
||||
|
||||
// The following are functions I added to set up the globals and then
|
||||
// execute the corresponding mission_campaign_savefile functions.
|
||||
|
||||
// Saves the campaign camp under the player name pname
|
||||
int campaign_savefile_save(char *pname);
|
||||
// Deletes the campaign save camp under the player name pname
|
||||
void campaign_delete_save( char *cfn, char *pname);
|
||||
|
||||
// get name and type of specified campaign file
|
||||
int mission_campaign_get_info(const char *filename, char *name, int *type, int *max_players, char **desc = NULL);
|
||||
|
||||
|
||||
@@ -139,8 +139,6 @@ void mission_show_goals_init();
|
||||
void mission_show_goals_close();
|
||||
void mission_show_goals_do_frame(float frametime); // displays goals on screen
|
||||
void mission_eval_goals(); // evaluate player goals
|
||||
int mission_ai_goal_achievable( ai_goal *aigp ); // determines if an AI goal is achievable
|
||||
void mission_add_ai_goal( int sexp, ai_info *aip ); // adds a goal onto the given ai_info structure
|
||||
int mission_evaluate_primary_goals(void); // determine if the primary goals for the mission are complete -- returns one of the above defines
|
||||
int mission_goals_met();
|
||||
|
||||
|
||||
@@ -257,44 +257,3 @@ void modify_grid(grid *gridp)
|
||||
create_grid(gridp, &gridp->gmatrix.vec.fvec, &gridp->gmatrix.vec.rvec, &gridp->center,
|
||||
gridp->nrows, gridp->ncols, gridp->square_size);
|
||||
}
|
||||
|
||||
void grid_render_elevation_line(vec3d *pos, grid* gridp)
|
||||
{
|
||||
vec3d gpos; // Location of point on grid.
|
||||
vec3d tpos;
|
||||
float dxz;
|
||||
plane tplane;
|
||||
vec3d *gv;
|
||||
|
||||
tplane.A = gridp->gmatrix.vec.uvec.xyz.x;
|
||||
tplane.B = gridp->gmatrix.vec.uvec.xyz.y;
|
||||
tplane.C = gridp->gmatrix.vec.uvec.xyz.z;
|
||||
tplane.D = gridp->planeD;
|
||||
|
||||
compute_point_on_plane(&gpos, &tplane, pos);
|
||||
|
||||
dxz = vm_vec_dist(pos, &gpos)/8.0f;
|
||||
|
||||
gv = &gridp->gmatrix.vec.uvec;
|
||||
if (gv->xyz.x * pos->xyz.x + gv->xyz.y * pos->xyz.y + gv->xyz.z * pos->xyz.z < -gridp->planeD)
|
||||
gr_set_color(127, 127, 127);
|
||||
else
|
||||
gr_set_color(255, 255, 255); // white
|
||||
|
||||
rpd_line(&gpos, pos); // Line from grid to object center.
|
||||
|
||||
tpos = gpos;
|
||||
|
||||
vm_vec_scale_add2(&gpos, &gridp->gmatrix.vec.rvec, -dxz/2);
|
||||
vm_vec_scale_add2(&gpos, &gridp->gmatrix.vec.fvec, -dxz/2);
|
||||
|
||||
vm_vec_scale_add2(&tpos, &gridp->gmatrix.vec.rvec, dxz/2);
|
||||
vm_vec_scale_add2(&tpos, &gridp->gmatrix.vec.fvec, dxz/2);
|
||||
|
||||
rpd_line(&gpos, &tpos);
|
||||
|
||||
vm_vec_scale_add2(&gpos, &gridp->gmatrix.vec.rvec, dxz);
|
||||
vm_vec_scale_add2(&tpos, &gridp->gmatrix.vec.rvec, -dxz);
|
||||
|
||||
rpd_line(&gpos, &tpos);
|
||||
}
|
||||
Loaded 100 of 250 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user