mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 07:28:22 -10:00
Compare commits
236
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f5e30b4dc | ||
|
|
15dec7e508 | ||
|
|
f247330e4b | ||
|
|
6c1dd85738 | ||
|
|
1a5700a0cb | ||
|
|
3584164ec0 | ||
|
|
2679f97dc2 | ||
|
|
0a041aade1 | ||
|
|
9845a1ad46 | ||
|
|
33151e956d | ||
|
|
08e565a855 | ||
|
|
fb61239f85 | ||
|
|
88ffa54ae0 | ||
|
|
5de6635111 | ||
|
|
04dc9f28cc | ||
|
|
55bdad3799 | ||
|
|
63bb60935c | ||
|
|
6d82031115 | ||
|
|
05fbb8d4de | ||
|
|
f4645e3e6c | ||
|
|
8924aa06e9 | ||
|
|
673b8f61eb | ||
|
|
f75f6af43a | ||
|
|
71a61143bf | ||
|
|
cca2a776e1 | ||
|
|
8e21aa6c88 | ||
|
|
6bb1ccc830 | ||
|
|
f6ef7c1cd6 | ||
|
|
a4c1d8f2eb | ||
|
|
20c5a86dcb | ||
|
|
ccc616fec3 | ||
|
|
07284cf221 | ||
|
|
2b4d08e842 | ||
|
|
1e3857e385 | ||
|
|
8635a8b537 | ||
|
|
762691c78f | ||
|
|
f8cb347a62 | ||
|
|
2d2df40efb | ||
|
|
f0518514a3 | ||
|
|
64104c19a8 | ||
|
|
847521b012 | ||
|
|
e6d0f9f72a | ||
|
|
1cd9d3fb04 | ||
|
|
6184ae6db6 | ||
|
|
b270ad1bb9 | ||
|
|
fbc0c79973 | ||
|
|
caf41665f4 | ||
|
|
90a2676f17 | ||
|
|
5032d06964 | ||
|
|
f9f65b0795 | ||
|
|
c9380f0091 | ||
|
|
033ba61588 | ||
|
|
09ce1f1846 | ||
|
|
6184136ffe | ||
|
|
e98fd0bab3 | ||
|
|
a1a8a53a65 | ||
|
|
38b51723e0 | ||
|
|
dc708ccbbb | ||
|
|
5206220f5a | ||
|
|
c049e7335b | ||
|
|
a05d19db6b | ||
|
|
cb65ca8655 | ||
|
|
1adb64e39d | ||
|
|
6c308037e8 | ||
|
|
706b3a7f5e | ||
|
|
4c23cd0d00 | ||
|
|
1fbeccd61e | ||
|
|
564fc9a680 | ||
|
|
688c514352 | ||
|
|
acc57397e5 | ||
|
|
e47884e0fb | ||
|
|
81bd363d6d | ||
|
|
108d60330f | ||
|
|
58575399f5 | ||
|
|
1253575a68 | ||
|
|
a1d46479d7 | ||
|
|
a4043fbf21 | ||
|
|
83b8361dcd | ||
|
|
be677937ae | ||
|
|
aebdc6328b | ||
|
|
801b808764 | ||
|
|
73d12d15a3 | ||
|
|
c9a45c9fbd | ||
|
|
ddd3a7d6fe | ||
|
|
e302f0e456 | ||
|
|
0ed147fb45 | ||
|
|
da812f9433 | ||
|
|
5e623d10b0 | ||
|
|
471c898df5 | ||
|
|
4e9f5dc754 | ||
|
|
df41bbe172 | ||
|
|
617fd6a977 | ||
|
|
54e052bc2f | ||
|
|
17c6b7cd58 | ||
|
|
f12d2395dc | ||
|
|
746fe56b32 | ||
|
|
a87af22357 | ||
|
|
4179d95975 | ||
|
|
fc6bc3a1c6 | ||
|
|
5bcc89be3a | ||
|
|
54b2eddc14 | ||
|
|
7a7abe1b3b | ||
|
|
75c69271a9 | ||
|
|
64c4e4d7b4 | ||
|
|
1159e66168 | ||
|
|
37a98b8cf8 | ||
|
|
a5b705b2c1 | ||
|
|
76b98684cc | ||
|
|
aa0de45ddb | ||
|
|
e6855a4153 | ||
|
|
f61b869c7f | ||
|
|
59d6a44db3 | ||
|
|
8dc4030dbc | ||
|
|
882467cb5a | ||
|
|
5b8410de98 | ||
|
|
79f3f08543 | ||
|
|
1bd7160461 | ||
|
|
8464e1769f | ||
|
|
975e108841 | ||
|
|
6d60bb1511 | ||
|
|
28faa9e588 | ||
|
|
3ccfbb6aac | ||
|
|
78ff02501b | ||
|
|
165124267a | ||
|
|
b9033ab2a2 | ||
|
|
102efb192c | ||
|
|
da7ec6db4d | ||
|
|
e36b5398ef | ||
|
|
335cc4a114 | ||
|
|
4b05468f3c | ||
|
|
26a500bf7c | ||
|
|
81ad6dc1b5 | ||
|
|
025c58c679 | ||
|
|
bb93319871 | ||
|
|
8f224a76a4 | ||
|
|
a640015afc | ||
|
|
82807f2760 | ||
|
|
97924c0628 | ||
|
|
680ac9175f | ||
|
|
e3c4f90287 | ||
|
|
ed2bbc35eb | ||
|
|
23aa8cb18d | ||
|
|
af2725b2b7 | ||
|
|
ca95a3c25d | ||
|
|
a9b4be5928 | ||
|
|
7691c4905e | ||
|
|
9bd4fb3ac7 | ||
|
|
49b5d9a3b7 | ||
|
|
22f14d56ea | ||
|
|
5f4568cc0e | ||
|
|
39842e7115 | ||
|
|
cb90d286e5 | ||
|
|
e4c98e8527 | ||
|
|
5d593f0df0 | ||
|
|
a045e5d266 | ||
|
|
21b8e3bb52 | ||
|
|
3aa671a211 | ||
|
|
d3ce9874a7 | ||
|
|
1cfbc24fb9 | ||
|
|
4a4486c9be | ||
|
|
a1caca08ab | ||
|
|
e32e21bcd0 | ||
|
|
3fd9b8f802 | ||
|
|
890c607ad2 | ||
|
|
e2dac4b7b4 | ||
|
|
3512fcc18e | ||
|
|
f57e346eff | ||
|
|
768e097c73 | ||
|
|
b0115a5f80 | ||
|
|
a23630346b | ||
|
|
d4d805d6ca | ||
|
|
b147ea0a21 | ||
|
|
8a2eec5b4a | ||
|
|
ee64b83aec | ||
|
|
24b58db67f | ||
|
|
2ddee36007 | ||
|
|
7e9a798101 | ||
|
|
542dc68df2 | ||
|
|
b1ac0876d4 | ||
|
|
7badc4dfd9 | ||
|
|
036aae0ee2 | ||
|
|
9cc70790c9 | ||
|
|
7d392bd61c | ||
|
|
1552e02a51 | ||
|
|
175640d60a | ||
|
|
6583066936 | ||
|
|
3c564b3210 | ||
|
|
9b7ebff53a | ||
|
|
1491d4a79a | ||
|
|
d603c463af | ||
|
|
3eb47c1867 | ||
|
|
2db4bc37f2 | ||
|
|
0f0f6377d0 | ||
|
|
8e7ad5f651 | ||
|
|
bade3c58eb | ||
|
|
85a36e6fd8 | ||
|
|
2deffc1156 | ||
|
|
82ae54a6e8 | ||
|
|
0062d2567a | ||
|
|
7972cad563 | ||
|
|
c9cff48b95 | ||
|
|
8d0624b064 | ||
|
|
236857ed37 | ||
|
|
fa57ea358a | ||
|
|
a7bf7c63de | ||
|
|
81676b7d3f | ||
|
|
e1e188a43c | ||
|
|
47286d1af2 | ||
|
|
fa10977e77 | ||
|
|
aaa80dfa6f | ||
|
|
59fa7bd544 | ||
|
|
3c8b47ccfc | ||
|
|
81d8d063c2 | ||
|
|
75471276fc | ||
|
|
89d6031c79 | ||
|
|
551d64192c | ||
|
|
661678f693 | ||
|
|
94ca29735c | ||
|
|
20f84c179a | ||
|
|
5f622094af | ||
|
|
64ad950a80 | ||
|
|
a30937b041 | ||
|
|
764e1772b0 | ||
|
|
ea549ab5a0 | ||
|
|
af22ab34d3 | ||
|
|
c8785dc093 | ||
|
|
870ad9e3ae | ||
|
|
487f769064 | ||
|
|
7604e82f05 | ||
|
|
e0defd287a | ||
|
|
a413255728 | ||
|
|
d8ab39e261 | ||
|
|
66c9e0c136 | ||
|
|
bd1aa5e455 | ||
|
|
256ba6f9f2 | ||
|
|
338d6c9aaf |
No files matched your search
@@ -24,7 +24,6 @@ install-sh
|
||||
missing
|
||||
.svn
|
||||
*.layout
|
||||
projects/Xcode4/Frameworks/
|
||||
projects/Xcode/Frameworks/
|
||||
|
||||
#========
|
||||
|
||||
-10
@@ -9,16 +9,6 @@ SUBDIRS = mongoose code
|
||||
|
||||
EXTRA_DIST = \
|
||||
FS2OpenSCPReadMe.doc \
|
||||
projects/MSVC_2005/Freespace2.sln \
|
||||
projects/MSVC_2005/Freespace2.vcproj \
|
||||
projects/MSVC_2005/code.vcproj \
|
||||
projects/MSVC_6/Fred2.dsp \
|
||||
projects/MSVC_6/Freespace2.dsp \
|
||||
projects/MSVC_6/Freespace2.dsw \
|
||||
projects/MSVC_6/code.dsp \
|
||||
projects/MSVC_6/libjpeg.dsp \
|
||||
projects/MSVC_6/liblua.dsp \
|
||||
projects/MSVC_6/wxFRED2.dsp \
|
||||
projects/Xcode/English.lproj/InfoPlist.strings \
|
||||
projects/Xcode/FS2_Open.icns \
|
||||
projects/Xcode/FS2_Open.xcodeproj/project.pbxproj \
|
||||
|
||||
+3
-3
@@ -5,12 +5,12 @@ environment:
|
||||
- VisualStudioVersion: 10.0
|
||||
PlatformToolset: v100
|
||||
ProjectPath: projects/MSVC_2010/Freespace2.vcxproj
|
||||
- VisualStudioVersion: 11.0
|
||||
PlatformToolset: v110
|
||||
ProjectPath: projects/MSVC_2012/Freespace2.vcxproj
|
||||
- VisualStudioVersion: 12.0
|
||||
PlatformToolset: v120
|
||||
ProjectPath: projects/MSVC_2013/Freespace2.vcxproj
|
||||
- VisualStudioVersion: 14.0
|
||||
PlatformToolset: v140
|
||||
ProjectPath: projects/MSVC_2015/Freespace2.vcxproj
|
||||
build_script:
|
||||
- msbuild "%ProjectPath%" /p:Configuration="Debug SSE2" /m /p:PlatformToolset="%PlatformToolset%" /verbosity:minimal
|
||||
test: off
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
# Nothing to do here
|
||||
:
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
# Due to a bug in gcc the array bounds check isn't working correctly
|
||||
# This can be removed when gcc is updated
|
||||
AUTOGEN_CONFIG="CXXFLAGS=-Wno-array-bounds --enable-fatal-warnings"
|
||||
AUTOGEN_CONFIG="CXXFLAGS=-Wno-array-bounds --enable-fatal-warnings --enable-generic-architecture"
|
||||
|
||||
if [ "$CONFIGURATION" = "Debug" ]; then
|
||||
AUTOGEN_CONFIG="$AUTOGEN_CONFIG --enable-debug"
|
||||
@@ -11,6 +13,6 @@ if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
|
||||
./autogen.sh $AUTOGEN_CONFIG
|
||||
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
cd projects/Xcode4
|
||||
cd projects/Xcode
|
||||
tar -xvzf Frameworks.tgz
|
||||
fi
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
# Nothing to do here
|
||||
:
|
||||
|
||||
+4
-2
@@ -1,8 +1,10 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
make -j 4
|
||||
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
cd projects/Xcode4
|
||||
xcodebuild ARCHS=$MACOSX_ARCH ONLY_ACTIVE_ARCH=NO -configuration "$CONFIGURATION" | xcpretty -c
|
||||
cd projects/Xcode
|
||||
xcodebuild ARCHS=$MACOSX_ARCH ONLY_ACTIVE_ARCH=NO -configuration "$CONFIGURATION" | xcpretty -c && exit ${PIPESTATUS[0]}
|
||||
fi
|
||||
+1
-1
@@ -1239,7 +1239,7 @@ int ai_big_strafe_maybe_retreat(float dist, vec3d *target_pos)
|
||||
float dist_to_target, dist_normal_to_target, time_to_target;
|
||||
dist_to_target = vm_vec_mag_quick(&vec_to_target);
|
||||
if (vm_vec_mag_quick(&aip->big_attack_surface_normal) > 0.9) {
|
||||
dist_normal_to_target = -vm_vec_dotprod(&vec_to_target, &aip->big_attack_surface_normal);
|
||||
dist_normal_to_target = -vm_vec_dot(&vec_to_target, &aip->big_attack_surface_normal);
|
||||
} else {
|
||||
dist_normal_to_target = 0.2f * vm_vec_mag_quick(&vec_to_target);
|
||||
}
|
||||
|
||||
+57
-67
@@ -980,7 +980,7 @@ int ai_is_stealth_visible(object *viewer_objp, object *stealth_objp)
|
||||
if ( !ship_is_visible_by_team(stealth_objp, &Ships[viewer_objp->instance]) ) {
|
||||
vm_vec_sub(&vec_to_stealth, &stealth_objp->pos, &viewer_objp->pos);
|
||||
dist_to_stealth = vm_vec_mag_quick(&vec_to_stealth);
|
||||
dot_to_stealth = vm_vec_dotprod(&viewer_objp->orient.vec.fvec, &vec_to_stealth) / dist_to_stealth;
|
||||
dot_to_stealth = vm_vec_dot(&viewer_objp->orient.vec.fvec, &vec_to_stealth) / dist_to_stealth;
|
||||
|
||||
// get max dist at which stealth is visible
|
||||
max_stealth_dist = get_skill_stealth_dist_scaler() * STEALTH_MAX_VIEW_DIST;
|
||||
@@ -1539,8 +1539,8 @@ float turn_towards_tangent(object *objp, vec3d *point, float radius)
|
||||
vec3d v2g;
|
||||
|
||||
vm_vec_normalized_dir(&vec_to_point, point, &objp->pos);
|
||||
vm_vec_crossprod(&up_vec, &vec_to_point, &objp->orient.vec.fvec);
|
||||
vm_vec_crossprod(&perp_vec, &vec_to_point, &up_vec);
|
||||
vm_vec_cross(&up_vec, &vec_to_point, &objp->orient.vec.fvec);
|
||||
vm_vec_cross(&perp_vec, &vec_to_point, &up_vec);
|
||||
|
||||
vm_vec_scale_add(&perp_point, point, &vec_to_point, -radius);
|
||||
if (vm_vec_dot(&objp->orient.vec.fvec, &perp_vec) > 0.0f) {
|
||||
@@ -1563,7 +1563,7 @@ float turn_toward_tangent_with_axis(object *objp, object *center_objp, float rad
|
||||
|
||||
// find closest z of center objp
|
||||
vm_vec_sub(&sph_r_vec, &objp->pos, ¢er_objp->pos);
|
||||
center_obj_z = vm_vec_dotprod(&sph_r_vec, ¢er_objp->orient.vec.fvec);
|
||||
center_obj_z = vm_vec_dot(&sph_r_vec, ¢er_objp->orient.vec.fvec);
|
||||
|
||||
// find pt on axis with closest z
|
||||
vm_vec_scale_add(¢er_vec, ¢er_objp->pos, ¢er_objp->orient.vec.fvec, center_obj_z);
|
||||
@@ -1571,10 +1571,10 @@ float turn_toward_tangent_with_axis(object *objp, object *center_objp, float rad
|
||||
// get r_vec
|
||||
vm_vec_sub(&r_vec, &objp->pos, ¢er_vec);
|
||||
|
||||
Assert( (vm_vec_dotprod(&r_vec, ¢er_objp->orient.vec.fvec) < 0.0001));
|
||||
Assert( (vm_vec_dot(&r_vec, ¢er_objp->orient.vec.fvec) < 0.0001));
|
||||
|
||||
// get theta vec - perp to r_vec and z_vec
|
||||
vm_vec_crossprod(&theta_vec, ¢er_objp->orient.vec.fvec, &r_vec);
|
||||
vm_vec_cross(&theta_vec, ¢er_objp->orient.vec.fvec, &r_vec);
|
||||
|
||||
#ifndef NDEBUG
|
||||
float mag;
|
||||
@@ -1583,11 +1583,11 @@ float turn_toward_tangent_with_axis(object *objp, object *center_objp, float rad
|
||||
#endif
|
||||
|
||||
vec3d temp;
|
||||
vm_vec_crossprod(&temp, &r_vec, &theta_vec);
|
||||
vm_vec_cross(&temp, &r_vec, &theta_vec);
|
||||
|
||||
#ifndef NDEBUG
|
||||
float dot;
|
||||
dot = vm_vec_dotprod(&temp, ¢er_objp->orient.vec.fvec);
|
||||
dot = vm_vec_dot(&temp, ¢er_objp->orient.vec.fvec);
|
||||
Assert( dot >0.9999 && dot < 1.0001);
|
||||
#endif
|
||||
|
||||
@@ -1613,17 +1613,17 @@ void get_tangent_point(vec3d *goal_point, object *objp, vec3d *point, float radi
|
||||
vec3d up_vec, perp_vec;
|
||||
|
||||
vm_vec_normalized_dir(&vec_to_point, point, &objp->pos);
|
||||
vm_vec_crossprod(&up_vec, &vec_to_point, &objp->orient.vec.fvec);
|
||||
vm_vec_cross(&up_vec, &vec_to_point, &objp->orient.vec.fvec);
|
||||
|
||||
while (IS_VEC_NULL(&up_vec)) {
|
||||
vec3d rnd_vec;
|
||||
|
||||
vm_vec_rand_vec_quick(&rnd_vec);
|
||||
vm_vec_add2(&rnd_vec, &objp->orient.vec.fvec);
|
||||
vm_vec_crossprod(&up_vec, &vec_to_point, &rnd_vec);
|
||||
vm_vec_cross(&up_vec, &vec_to_point, &rnd_vec);
|
||||
}
|
||||
|
||||
vm_vec_crossprod(&perp_vec, &vec_to_point, &up_vec);
|
||||
vm_vec_cross(&perp_vec, &vec_to_point, &up_vec);
|
||||
vm_vec_normalize(&perp_vec);
|
||||
|
||||
vm_vec_scale_add(&perp_point, point, &vec_to_point, -radius);
|
||||
@@ -2621,7 +2621,7 @@ void create_path_to_point(vec3d *curpos, vec3d *goalpos, object *curobjp, object
|
||||
void copy_xlate_model_path_points(object *objp, model_path *mp, int dir, int count, int path_num, pnode *pnp, int randomize_pnt)
|
||||
{
|
||||
polymodel *pm;
|
||||
int i, modelnum;
|
||||
int i, modelnum, model_instance_num;
|
||||
vec3d v1;
|
||||
int pp_index; // index in Path_points at which to store point, if this is a modify-in-place (pnp ! NULL)
|
||||
int start_index, finish_index;
|
||||
@@ -2646,14 +2646,12 @@ void copy_xlate_model_path_points(object *objp, model_path *mp, int dir, int cou
|
||||
|
||||
// Goober5000 - check for rotating submodels
|
||||
modelnum = Ship_info[Ships[objp->instance].ship_info_index].model_num;
|
||||
model_instance_num = Ships[objp->instance].model_instance_num;
|
||||
pm = model_get(modelnum);
|
||||
if ((mp->parent_submodel >= 0) && (pm->submodel[mp->parent_submodel].movement_type >= 0))
|
||||
{
|
||||
rotating_submodel = true;
|
||||
|
||||
// start submodel calculation
|
||||
ship_model_start(objp);
|
||||
|
||||
model_find_submodel_offset(&submodel_offset, modelnum, mp->parent_submodel);
|
||||
}
|
||||
else
|
||||
@@ -2670,7 +2668,7 @@ void copy_xlate_model_path_points(object *objp, model_path *mp, int dir, int cou
|
||||
{
|
||||
// movement... find location of point like with docking code and spark generation
|
||||
vm_vec_sub(&local_vert, &mp->verts[i].pos, &submodel_offset);
|
||||
model_find_world_point(&v1, &local_vert, modelnum, mp->parent_submodel, &objp->orient, &objp->pos);
|
||||
model_instance_find_world_point(&v1, &local_vert, model_instance_num, mp->parent_submodel, &objp->orient, &objp->pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2692,12 +2690,6 @@ void copy_xlate_model_path_points(object *objp, model_path *mp, int dir, int cou
|
||||
add_path_point(&v1, path_num, i, pp_index);
|
||||
offset++;
|
||||
}
|
||||
|
||||
// stop submodel calculation
|
||||
if (!rotating_submodel)
|
||||
{
|
||||
ship_model_stop(objp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2966,8 +2958,8 @@ int maybe_avoid_player(object *objp, vec3d *goal_pos)
|
||||
} else {
|
||||
vec3d tvec1;
|
||||
vm_vec_normalize(&avoid_vec);
|
||||
vm_vec_crossprod(&tvec1, &n_vec_to_goal, &avoid_vec);
|
||||
vm_vec_crossprod(&avoid_vec, &tvec1, &n_vec_to_player);
|
||||
vm_vec_cross(&tvec1, &n_vec_to_goal, &avoid_vec);
|
||||
vm_vec_cross(&avoid_vec, &tvec1, &n_vec_to_player);
|
||||
}
|
||||
|
||||
// Now, avoid_vec is a vector perpendicular to the vector to the player and the direction *objp
|
||||
@@ -6253,10 +6245,9 @@ void render_path_points(object *objp)
|
||||
vec3d dock_point, global_dock_point;
|
||||
vertex v;
|
||||
|
||||
ship_model_start(&Objects[aip->goal_objnum]);
|
||||
if (pm->n_docks) {
|
||||
dock_point = pm->docking_bays[0].pnt[0];
|
||||
model_find_world_point(&global_dock_point, &dock_point, pm->id, 0, &dobjp->orient, &dobjp->pos );
|
||||
model_instance_find_world_point(&global_dock_point, &dock_point, shipp->model_instance_num, 0, &dobjp->orient, &dobjp->pos );
|
||||
g3_rotate_vertex(&v, &global_dock_point);
|
||||
gr_set_color(255, 255, 255);
|
||||
g3_draw_sphere( &v, 1.5f);
|
||||
@@ -6289,8 +6280,6 @@ void render_path_points(object *objp)
|
||||
pp++;
|
||||
}
|
||||
}
|
||||
|
||||
ship_model_stop(&Objects[aip->goal_objnum]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6496,7 +6485,7 @@ void set_predicted_enemy_pos(vec3d *predicted_enemy_pos, object *pobjp, vec3d *e
|
||||
vec3d temp;
|
||||
vm_vec_sub(&temp, enemy_pos, &pobjp->pos);
|
||||
vm_vec_normalize_quick(&temp);
|
||||
float dot = vm_vec_dotprod(&temp, &pobjp->orient.vec.fvec);
|
||||
float dot = vm_vec_dot(&temp, &pobjp->orient.vec.fvec);
|
||||
float st_err = 3.0f * (1.4f - dot) * (1.0f + dist / (get_skill_stealth_dist_scaler() * STEALTH_MAX_VIEW_DIST)) * (1 - aip->ai_accuracy);
|
||||
scale += st_err;
|
||||
}
|
||||
@@ -7056,7 +7045,7 @@ void ai_stealth_find()
|
||||
// if dist is near max and dot is close to 1, accel, afterburn
|
||||
vm_vec_sub(&vec_to_enemy, &new_pos, &Pl_objp->pos);
|
||||
dist_to_enemy = vm_vec_normalize_quick(&vec_to_enemy);
|
||||
dot_to_enemy = vm_vec_dotprod(&vec_to_enemy, &Pl_objp->orient.vec.fvec);
|
||||
dot_to_enemy = vm_vec_dot(&vec_to_enemy, &Pl_objp->orient.vec.fvec);
|
||||
|
||||
// if i think i should see him ahead and i don't, set goal pos and turn around, but only if I haven't seen him for a while
|
||||
if ( (delta_time > 800) && (aip->submode_parm0 == SM_SF_AHEAD) && (dot_to_enemy > .94) && (dist_to_enemy < get_skill_stealth_dist_scaler()*STEALTH_MAX_VIEW_DIST + 50) ) {
|
||||
@@ -7065,7 +7054,7 @@ void ai_stealth_find()
|
||||
aip->submode_parm0 = SM_SF_BEHIND;
|
||||
vm_vec_sub(&vec_to_enemy, &new_pos, &Pl_objp->pos);
|
||||
dist_to_enemy = vm_vec_normalize_quick(&vec_to_enemy);
|
||||
dot_to_enemy = vm_vec_dotprod(&vec_to_enemy, &Pl_objp->orient.vec.fvec);
|
||||
dot_to_enemy = vm_vec_dot(&vec_to_enemy, &Pl_objp->orient.vec.fvec);
|
||||
}
|
||||
|
||||
if ( (dist_to_enemy > get_skill_stealth_dist_scaler()*STEALTH_MAX_VIEW_DIST) && (dot_to_enemy > 0.94f) ) { // 20 degree half angle
|
||||
@@ -7095,7 +7084,7 @@ void ai_stealth_find()
|
||||
ai_turn_towards_vector(&new_pos, Pl_objp, flFrametime, sip->srotation_time, NULL, NULL, 0.0f, 0);
|
||||
}
|
||||
|
||||
dot_from_enemy = -vm_vec_dotprod(&vec_to_enemy, &En_objp->orient.vec.fvec);
|
||||
dot_from_enemy = -vm_vec_dot(&vec_to_enemy, &En_objp->orient.vec.fvec);
|
||||
|
||||
attack_set_accel(aip, sip, dist_to_enemy, dot_to_enemy, dot_from_enemy);
|
||||
}
|
||||
@@ -7144,10 +7133,10 @@ void ai_stealth_sweep()
|
||||
}
|
||||
|
||||
// get "right" vector for box
|
||||
vm_vec_crossprod(&right, &aip->stealth_velocity, &vmd_y_vector);
|
||||
vm_vec_cross(&right, &aip->stealth_velocity, &vmd_y_vector);
|
||||
|
||||
if ( vm_vec_mag_quick(&right) < 0.01 ) {
|
||||
vm_vec_crossprod(&right, &aip->stealth_velocity, &vmd_z_vector);
|
||||
vm_vec_cross(&right, &aip->stealth_velocity, &vmd_z_vector);
|
||||
}
|
||||
|
||||
vm_vec_normalize_quick(&right);
|
||||
@@ -7156,7 +7145,7 @@ void ai_stealth_sweep()
|
||||
vm_vec_copy_normalize_quick(&forward, &aip->stealth_velocity);
|
||||
|
||||
// get "up" for box
|
||||
vm_vec_crossprod(&up, &forward, &right);
|
||||
vm_vec_cross(&up, &forward, &right);
|
||||
|
||||
// lost far away ahead (do box)
|
||||
switch(aip->submode_parm0) {
|
||||
@@ -7226,7 +7215,7 @@ void ai_stealth_sweep()
|
||||
if (dist_to_goal < 100) {
|
||||
vec3d vec_to_goal;
|
||||
vm_vec_normalized_dir(&vec_to_goal, &goal_pt, &Pl_objp->pos);
|
||||
dot = vm_vec_dotprod(&vec_to_goal, &Pl_objp->orient.vec.fvec);
|
||||
dot = vm_vec_dot(&vec_to_goal, &Pl_objp->orient.vec.fvec);
|
||||
}
|
||||
|
||||
accelerate_ship(aip, 0.8f*dot);
|
||||
@@ -7872,7 +7861,7 @@ void ai_chase_big_get_separations(object *attack_objp, object *target_objp, vec3
|
||||
vm_vec_sub(&vec_to_target, &attack_objp->pos, &target_objp->pos);
|
||||
|
||||
// find the distance between centers along forward direction of ships
|
||||
perp_dist = vm_vec_dotprod(&vec_to_target, &target_objp->orient.vec.fvec);
|
||||
perp_dist = vm_vec_dot(&vec_to_target, &target_objp->orient.vec.fvec);
|
||||
|
||||
// subtract off perp component to get "horizontal" separation vector between cylinders [ASSUMING parallel]
|
||||
vm_vec_scale_add(horz_vec_to_target, &vec_to_target, &target_objp->orient.vec.fvec, -perp_dist);
|
||||
@@ -7903,7 +7892,7 @@ void ai_chase_big_parallel_set_goal(vec3d *goal_pos, object *attack_objp, object
|
||||
r_target = MAX(temp, r_target);
|
||||
|
||||
// are we opposing (only when other ship is not moving)
|
||||
opposing = ( vm_vec_dotprod(&attack_objp->orient.vec.fvec, &target_objp->orient.vec.fvec) < 0 );
|
||||
opposing = ( vm_vec_dot(&attack_objp->orient.vec.fvec, &target_objp->orient.vec.fvec) < 0 );
|
||||
|
||||
ai_chase_big_get_separations(attack_objp, target_objp, &horz_vec_to_target, &optimal_separation, &separation);
|
||||
|
||||
@@ -7921,7 +7910,7 @@ void ai_chase_big_parallel_set_goal(vec3d *goal_pos, object *attack_objp, object
|
||||
// find the distance between centers along forward direction of ships
|
||||
vec3d vec_to_target;
|
||||
vm_vec_sub(&vec_to_target, &target_objp->pos, &attack_objp->pos);
|
||||
float perp_dist = vm_vec_dotprod(&vec_to_target, &target_objp->orient.vec.fvec);
|
||||
float perp_dist = vm_vec_dot(&vec_to_target, &target_objp->orient.vec.fvec);
|
||||
|
||||
float match_accel = 0.0f;
|
||||
float length_scale = attack_objp->radius;
|
||||
@@ -8071,7 +8060,7 @@ void ai_cruiser_chase()
|
||||
// moving
|
||||
if (moving) {
|
||||
// if within 90 degrees of en forward, go into parallel, otherwise circle
|
||||
if ( vm_vec_dotprod(&En_objp->orient.vec.fvec, &Pl_objp->orient.vec.fvec) > 0 ) {
|
||||
if ( vm_vec_dot(&En_objp->orient.vec.fvec, &Pl_objp->orient.vec.fvec) > 0 ) {
|
||||
aip->submode = SM_BIG_PARALLEL;
|
||||
aip->submode_start_time = Missiontime;
|
||||
}
|
||||
@@ -8091,9 +8080,9 @@ void ai_cruiser_chase()
|
||||
vec3d temp;
|
||||
float desired_sep, cur_sep;
|
||||
// we're behind the enemy ship
|
||||
if (vm_vec_dotprod(&vec_to_enemy, &En_objp->orient.vec.fvec) > 0) {
|
||||
if (vm_vec_dot(&vec_to_enemy, &En_objp->orient.vec.fvec) > 0) {
|
||||
// and we're turning toward the enemy
|
||||
if (vm_vec_dotprod(&En_objp->orient.vec.fvec, &Pl_objp->orient.vec.fvec) > 0) {
|
||||
if (vm_vec_dot(&En_objp->orient.vec.fvec, &Pl_objp->orient.vec.fvec) > 0) {
|
||||
// get separation
|
||||
ai_chase_big_get_separations(Pl_objp, En_objp, &temp, &desired_sep, &cur_sep);
|
||||
// and the separation is > 0.9 desired
|
||||
@@ -8108,9 +8097,9 @@ void ai_cruiser_chase()
|
||||
vec3d temp;
|
||||
float desired_sep, cur_sep;
|
||||
// we're behind the enemy ship
|
||||
if (vm_vec_dotprod(&vec_to_enemy, &En_objp->orient.vec.fvec) > 0) {
|
||||
if (vm_vec_dot(&vec_to_enemy, &En_objp->orient.vec.fvec) > 0) {
|
||||
// and we're turning toward the enemy
|
||||
if (vm_vec_dotprod(&En_objp->orient.vec.fvec, &Pl_objp->orient.vec.fvec) > 0) {
|
||||
if (vm_vec_dot(&En_objp->orient.vec.fvec, &Pl_objp->orient.vec.fvec) > 0) {
|
||||
// get separation
|
||||
ai_chase_big_get_separations(Pl_objp, En_objp, &temp, &desired_sep, &cur_sep);
|
||||
// and the separation is > 0.9 desired
|
||||
@@ -8123,7 +8112,7 @@ void ai_cruiser_chase()
|
||||
// in front of ship
|
||||
else {
|
||||
// and we're turning toward the enemy
|
||||
if (vm_vec_dotprod(&En_objp->orient.vec.fvec, &Pl_objp->orient.vec.fvec) < 0) {
|
||||
if (vm_vec_dot(&En_objp->orient.vec.fvec, &Pl_objp->orient.vec.fvec) < 0) {
|
||||
// get separation
|
||||
ai_chase_big_get_separations(Pl_objp, En_objp, &temp, &desired_sep, &cur_sep);
|
||||
// and the separation is > 0.9 desired
|
||||
@@ -8138,7 +8127,7 @@ void ai_cruiser_chase()
|
||||
|
||||
case SM_BIG_PARALLEL:
|
||||
// we're opposing
|
||||
if ( vm_vec_dotprod(&Pl_objp->orient.vec.fvec, &En_objp->orient.vec.fvec) < 0 ) {
|
||||
if ( vm_vec_dot(&Pl_objp->orient.vec.fvec, &En_objp->orient.vec.fvec) < 0 ) {
|
||||
// and the other ship is moving
|
||||
if (moving) {
|
||||
// and we no longer overlap
|
||||
@@ -8996,7 +8985,7 @@ void set_goal_dock_orient(matrix *dom, vec3d *docker_p0, vec3d *docker_p1, vec3d
|
||||
|
||||
// Pre-multiply the orientation of the source object (docker_orient) by the transpose
|
||||
// of the docking bay's orientation, ie unrotate the source object's matrix.
|
||||
vm_transpose_matrix(&m2);
|
||||
vm_transpose(&m2);
|
||||
vm_matrix_x_matrix(dom, &m3, &m2);
|
||||
}
|
||||
|
||||
@@ -9040,8 +9029,9 @@ void find_adjusted_dockpoint_info(vec3d *global_p0, vec3d *global_p1, vec3d *glo
|
||||
{
|
||||
vec3d submodel_offset;
|
||||
vec3d local_p0, local_p1;
|
||||
ship *shipp;
|
||||
|
||||
ship_model_start(objp);
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
// calculate the dockpoint locations relative to the unrotated submodel
|
||||
model_find_submodel_offset(&submodel_offset, modelnum, submodel);
|
||||
@@ -9049,13 +9039,11 @@ void find_adjusted_dockpoint_info(vec3d *global_p0, vec3d *global_p1, vec3d *glo
|
||||
vm_vec_sub(&local_p1, &pm->docking_bays[dock_index].pnt[1], &submodel_offset);
|
||||
|
||||
// find the dynamic positions of the dockpoints
|
||||
model_find_world_point(global_p0, &local_p0, modelnum, submodel, &objp->orient, &objp->pos);
|
||||
model_find_world_point(global_p1, &local_p1, modelnum, submodel, &objp->orient, &objp->pos);
|
||||
model_instance_find_world_point(global_p0, &local_p0, shipp->model_instance_num, submodel, &objp->orient, &objp->pos);
|
||||
model_instance_find_world_point(global_p1, &local_p1, shipp->model_instance_num, submodel, &objp->orient, &objp->pos);
|
||||
|
||||
// find the normal of the first dockpoint
|
||||
model_find_world_dir(global_p0_norm, &pm->docking_bays[dock_index].norm[0], modelnum, submodel, &objp->orient, &objp->pos);
|
||||
|
||||
ship_model_stop(objp);
|
||||
model_instance_find_world_dir(global_p0_norm, &pm->docking_bays[dock_index].norm[0], shipp->model_instance_num, submodel, &objp->orient);
|
||||
}
|
||||
// use the static dockpoints
|
||||
else
|
||||
@@ -9137,23 +9125,21 @@ float dock_orient_and_approach(object *docker_objp, int docker_index, object *do
|
||||
vec3d submodel_offset;
|
||||
vec3d dockpoint_temp;
|
||||
|
||||
ship_model_start(dockee_objp);
|
||||
|
||||
// get submodel center
|
||||
model_find_submodel_offset(&submodel_offset, sip1->model_num, dockee_rotating_submodel);
|
||||
vm_vec_add(&submodel_pos, &dockee_objp->pos, &submodel_offset);
|
||||
|
||||
polymodel_instance *pmi1 = model_get_instance(Ships[dockee_objp->instance].model_instance_num);
|
||||
|
||||
// get angular velocity of dockpoint
|
||||
//WMC - hack(?) to fix bug where sii might not exist
|
||||
if(pm1->submodel[dockee_rotating_submodel].sii != NULL) {
|
||||
submodel_omega = pm1->submodel[dockee_rotating_submodel].sii->cur_turn_rate;
|
||||
if ( pmi1->submodel[dockee_rotating_submodel].sii != NULL ) {
|
||||
submodel_omega = pmi1->submodel[dockee_rotating_submodel].sii->cur_turn_rate;
|
||||
}
|
||||
|
||||
// get radius to dockpoint
|
||||
vm_vec_avg(&dockpoint_temp, &dockee_p0, &dockee_p1);
|
||||
submodel_radius = vm_vec_dist(&submodel_pos, &dockpoint_temp);
|
||||
|
||||
ship_model_stop(dockee_objp);
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
@@ -9261,7 +9247,7 @@ float dock_orient_and_approach(object *docker_objp, int docker_index, object *do
|
||||
vec3d origin_docker_point, adjusted_docker_point, v_offset;
|
||||
|
||||
// find out the rotation matrix that will get us from the old to the new rotation
|
||||
vm_copy_transpose_matrix(&temp, &docker_objp->orient);
|
||||
vm_copy_transpose(&temp, &docker_objp->orient);
|
||||
vm_matrix_x_matrix(&m_offset, &temp, &dom);
|
||||
|
||||
// now find out the new docker point after being adjusted for the new orientation
|
||||
@@ -9801,7 +9787,7 @@ float get_cylinder_points(object *other_objp, object *cyl_objp, vec3d *axis_pt,
|
||||
// get point on axis and on cylinder
|
||||
// extended_cylinder_z is along extended cylinder
|
||||
// cylinder_z is capped within cylinder
|
||||
float extended_cylinder_z = vm_vec_dotprod(&r_sph, &cyl_objp->orient.vec.fvec);
|
||||
float extended_cylinder_z = vm_vec_dot(&r_sph, &cyl_objp->orient.vec.fvec);
|
||||
|
||||
// get pt on axis of extended cylinder
|
||||
vm_vec_scale_add(axis_pt, &cyl_objp->pos, &cyl_objp->orient.vec.fvec, extended_cylinder_z);
|
||||
@@ -9837,7 +9823,7 @@ void ai_big_guard()
|
||||
|
||||
// get position relative to cylinder of guard_objp
|
||||
extended_z = get_cylinder_points(Pl_objp, guard_objp, &axis_pt, &r_vec, &radius);
|
||||
vm_vec_crossprod(&theta_vec, &guard_objp->orient.vec.fvec, &r_vec);
|
||||
vm_vec_cross(&theta_vec, &guard_objp->orient.vec.fvec, &r_vec);
|
||||
|
||||
// half ships circle each way
|
||||
if (objval > 0.5f) {
|
||||
@@ -13662,7 +13648,7 @@ int aas_1(object *objp, ai_info *aip, vec3d *safe_pos)
|
||||
vec3d vec_from_exp;
|
||||
float dir = 1.0f;
|
||||
vm_vec_sub(&vec_from_exp, &objp->pos, &expected_pos);
|
||||
float dot = vm_vec_dotprod(&vec_from_exp, &weapon_objp->orient.vec.fvec);
|
||||
float dot = vm_vec_dot(&vec_from_exp, &weapon_objp->orient.vec.fvec);
|
||||
if (dot > -30) {
|
||||
// if we're already on the other side of the explosion, don't try to fly behind it
|
||||
dir = -1.0f;
|
||||
@@ -13826,18 +13812,22 @@ int ai_await_repair_frame(object *objp, ai_info *aip)
|
||||
// Maybe should only do this if they are preventing their wing from re-entering.
|
||||
void ai_maybe_self_destruct(object *objp, ai_info *aip)
|
||||
{
|
||||
Assertion(objp->type == OBJ_SHIP, "ai_maybe_self_destruct() can only be called with objects that are ships!");
|
||||
ship *shipp = &Ships[objp->instance];
|
||||
|
||||
// Some IFFs can be repaired, so no self-destruct.
|
||||
// In multiplayer, just don't self-destruct. I figured there would be a problem. -- MK, 3/19/98.
|
||||
if ((Iff_info[Ships[objp->instance].team].flags & IFFF_SUPPORT_ALLOWED) || (Game_mode & GM_MULTIPLAYER))
|
||||
if ((Iff_info[shipp->team].flags & IFFF_SUPPORT_ALLOWED) || (Game_mode & GM_MULTIPLAYER))
|
||||
return;
|
||||
|
||||
// Small ships in a wing blow themselves up after awhile if engine or weapons system has been destroyed.
|
||||
// Reason: Don't want them to prevent a re-emergence of the wing.
|
||||
// Note: Don't blow up if not in a wing for two reasons: One, won't affect re-emergence of waves and (1) disable the Dragon
|
||||
// mission would be broken.
|
||||
if ((Ship_info[Ships[objp->instance].ship_info_index].flags & SIF_SMALL_SHIP) && (Ships[objp->instance].wingnum != -1)) {
|
||||
if ((ship_get_subsystem_strength(&Ships[objp->instance], SUBSYSTEM_ENGINE) <= 0.0f) ||
|
||||
(ship_get_subsystem_strength(&Ships[objp->instance], SUBSYSTEM_WEAPONS) <= 0.0f)) {
|
||||
// Also, don't blow up the ship if it has a ship flag preventing this - Goober5000
|
||||
if ((Ship_info[shipp->ship_info_index].flags & SIF_SMALL_SHIP) && (shipp->wingnum >= 0) && !(shipp->flags2 & SF2_NO_DISABLED_SELF_DESTRUCT)) {
|
||||
if ((ship_get_subsystem_strength(shipp, SUBSYSTEM_ENGINE) <= 0.0f) ||
|
||||
(ship_get_subsystem_strength(shipp, SUBSYSTEM_WEAPONS) <= 0.0f)) {
|
||||
if (aip->self_destruct_timestamp < 0)
|
||||
aip->self_destruct_timestamp = timestamp(90 * 1000); // seconds until self-destruct
|
||||
} else {
|
||||
|
||||
+55
-5
@@ -1308,6 +1308,8 @@ void ship_get_global_turret_info(object *objp, model_subsystem *tp, vec3d *gpos,
|
||||
vm_vec_unrotate(gvec, &tp->turret_norm, &objp->orient);
|
||||
}
|
||||
|
||||
void turret_ai_update_aim(ai_info *aip, object *En_Objp, ship_subsys *ss);
|
||||
|
||||
/**
|
||||
* Given an object and a turret on that object, return the actual firing point of the gun and its normal.
|
||||
*
|
||||
@@ -1332,11 +1334,59 @@ void ship_get_global_turret_gun_info(object *objp, ship_subsys *ssp, vec3d *gpos
|
||||
gun_pos = &tp->turret_firing_point[ssp->turret_next_fire_pos % tp->turret_num_firing_points];
|
||||
|
||||
//model_find_world_point(gpos, gun_pos, tp->model_num, tp->turret_gun_sobj, &objp->orient, &objp->pos );
|
||||
model_instance_find_world_point(gpos, gun_pos, tp->model_num, Ships[objp->instance].model_instance_num, tp->turret_gun_sobj, &objp->orient, &objp->pos);
|
||||
model_instance_find_world_point(gpos, gun_pos, Ships[objp->instance].model_instance_num, tp->turret_gun_sobj, &objp->orient, &objp->pos);
|
||||
|
||||
if (use_angles)
|
||||
model_instance_find_world_dir(gvec, &tp->turret_norm, tp->model_num, Ships[objp->instance].model_instance_num, tp->turret_gun_sobj, &objp->orient, &objp->pos );
|
||||
else {
|
||||
if (use_angles) {
|
||||
model_instance_find_world_dir(gvec, &tp->turret_norm, Ships[objp->instance].model_instance_num, tp->turret_gun_sobj, &objp->orient);
|
||||
} else if (tp->flags2 & MSS_FLAG2_SHARE_FIRE_DIRECTION) {
|
||||
vec3d avg, tmp_pos, tmp_target, enemy_point, turret_norm;
|
||||
vm_vec_avg_n(&avg, tp->turret_num_firing_points, tp->turret_firing_point);
|
||||
|
||||
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);
|
||||
object *lep = &Objects[ssp->turret_enemy_objnum];
|
||||
|
||||
int best_weapon_tidx = turret_select_best_weapon(ssp, lep);
|
||||
|
||||
//This turret doesn't have any good weapons
|
||||
if (best_weapon_tidx < 0)
|
||||
return;
|
||||
|
||||
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);
|
||||
|
||||
turret_ai_update_aim(&Ai_info[Ships[ssp->parent_objnum].ai_index], &Objects[ssp->turret_enemy_objnum], ssp);
|
||||
|
||||
if ((ssp->targeted_subsys != nullptr) && !(ssp->flags & SSF_NO_SS_TARGETING)) {
|
||||
vm_vec_unrotate(&enemy_point, &ssp->targeted_subsys->system_info->pnt, &Objects[ssp->turret_enemy_objnum].orient);
|
||||
vm_vec_add2(&enemy_point, &ssp->last_aim_enemy_pos);
|
||||
} else {
|
||||
if ((lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) {
|
||||
vm_vec_unrotate(&turret_norm, &tp->turret_norm, &objp->orient);
|
||||
ai_big_pick_attack_point_turret(lep, ssp, &tmp_pos, &turret_norm, &enemy_point, MIN(wip->max_speed * wip->lifetime, wip->weapon_range), tp->turret_fov);
|
||||
}
|
||||
else {
|
||||
enemy_point = ssp->last_aim_enemy_pos;
|
||||
}
|
||||
}
|
||||
|
||||
vec3d target_moving_direction = ssp->last_aim_enemy_vel;
|
||||
|
||||
//Try to guess where the enemy will be, and store that spot in predicted_enemy_pos
|
||||
if (The_mission.ai_profile->flags & AIPF_USE_ADDITIVE_WEAPON_VELOCITY) {
|
||||
vm_vec_scale_sub2(&target_moving_direction, &objp->phys_info.vel, wip->vel_inherit_amount);
|
||||
}
|
||||
|
||||
set_predicted_enemy_pos_turret(&tmp_target, &tmp_pos, objp, &enemy_point, &target_moving_direction, wip->max_speed, ssp->turret_time_enemy_in_range * (weapon_system_strength + 1.0f) / 2.0f);
|
||||
} else {
|
||||
tmp_target = *targetp;
|
||||
}
|
||||
|
||||
vm_vec_normalized_dir(gvec, &tmp_target, &tmp_pos);
|
||||
} else {
|
||||
//vector gun_pos2;
|
||||
//vm_vec_add(&gun_pos2, gpos, gun_pos);
|
||||
vm_vec_normalized_dir(gvec, targetp, gpos);
|
||||
@@ -2579,7 +2629,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
ss->turret_next_fire_pos = ffp_pos;
|
||||
}
|
||||
|
||||
ship_get_global_turret_gun_info(&Objects[parent_objnum], ss, &gpos, &gvec, use_angles, &predicted_enemy_pos);
|
||||
ship_get_global_turret_gun_info(&Objects[parent_objnum], ss, &gpos, &gvec, use_angles, &predicted_enemy_pos);
|
||||
|
||||
// Fire in the direction the turret is facing, not right at the target regardless of turret dir.
|
||||
vm_vec_sub(&v2e, &predicted_enemy_pos, &gpos);
|
||||
|
||||
+16
-11
@@ -329,6 +329,11 @@ object *asteroid_create(asteroid_field *asfieldp, int asteroid_type, int asteroi
|
||||
}
|
||||
|
||||
asp->objnum = objnum;
|
||||
asp->model_instance_num = -1;
|
||||
|
||||
if (model_get(asip->model_num[asteroid_subtype])->flags & PM_FLAG_HAS_INTRINSIC_ROTATE) {
|
||||
asp->model_instance_num = model_create_instance(false, asip->model_num[asteroid_subtype]);
|
||||
}
|
||||
|
||||
// Add to Asteroid_used_list
|
||||
asteroid_obj_list_add(objnum);
|
||||
@@ -828,10 +833,12 @@ void asteroid_delete( object * obj )
|
||||
|
||||
asp = &Asteroids[num];
|
||||
|
||||
Assert( Num_asteroids >= 0 );
|
||||
if (asp->model_instance_num >= 0)
|
||||
model_delete_instance(asp->model_instance_num);
|
||||
|
||||
asp->flags = 0;
|
||||
Num_asteroids--;
|
||||
Assert(Num_asteroids >= 0);
|
||||
|
||||
asteroid_obj_list_remove( obj );
|
||||
}
|
||||
@@ -930,7 +937,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
|
||||
if ( asteroid_hit_info == NULL ) {
|
||||
// asteroid weapon collision
|
||||
Assert( other_obj->type == OBJ_WEAPON );
|
||||
mc.model_instance_num = -1;
|
||||
mc.model_instance_num = Asteroids[num].model_instance_num;
|
||||
mc.model_num = Asteroid_info[Asteroids[num].asteroid_type].model_num[asteroid_subtype]; // Fill in the model to check
|
||||
model_clear_instance( mc.model_num );
|
||||
mc.orient = &pasteroid->orient; // The object's orient
|
||||
@@ -1005,7 +1012,6 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
|
||||
mc.flags = MC_ONLY_SPHERE | MC_CHECK_SPHERELINE;
|
||||
|
||||
SCP_vector<int> submodel_vector;
|
||||
polymodel *pm;
|
||||
polymodel_instance *pmi;
|
||||
|
||||
if (model_collide(&mc)) {
|
||||
@@ -1019,8 +1025,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
|
||||
model_get_rotating_submodel_list(&submodel_vector, heavy_obj);
|
||||
|
||||
// Get polymodel and turn off all rotating submodels, collide against only 1 at a time.
|
||||
pm = model_get(Ship_info[Ships[heavy_obj->instance].ship_info_index].model_num);
|
||||
pmi = model_get_instance(Ships[pship_obj->instance].model_instance_num);
|
||||
pmi = model_get_instance(Ships[heavy_obj->instance].model_instance_num);
|
||||
|
||||
// turn off all rotating submodels and test for collision
|
||||
for (size_t j=0; j<submodel_vector.size(); j++) {
|
||||
@@ -1041,10 +1046,10 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
|
||||
|
||||
// find the start and end positions of the sphere in submodel RF
|
||||
pmi->submodel[submodel_vector[i]].angs = pmi->submodel[submodel_vector[i]].prev_angs;
|
||||
world_find_model_instance_point(&p0, &light_obj->last_pos, pm, pmi, submodel_vector[i], &heavy_obj->last_orient, &heavy_obj->last_pos);
|
||||
world_find_model_instance_point(&p0, &light_obj->last_pos, pmi, submodel_vector[i], &heavy_obj->last_orient, &heavy_obj->last_pos);
|
||||
|
||||
pmi->submodel[submodel_vector[i]].angs = copy_angles;
|
||||
world_find_model_instance_point(&p1, &light_obj->pos, pm, pmi, submodel_vector[i], &heavy_obj->orient, &heavy_obj->pos);
|
||||
world_find_model_instance_point(&p1, &light_obj->pos, pmi, submodel_vector[i], &heavy_obj->orient, &heavy_obj->pos);
|
||||
|
||||
mc.p0 = &p0;
|
||||
mc.p1 = &p1;
|
||||
@@ -1061,14 +1066,14 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
|
||||
|
||||
// set up asteroid_hit_info for rotating submodel
|
||||
if (asteroid_hit_info->edge_hit == 0) {
|
||||
model_instance_find_obj_dir(&asteroid_hit_info->collision_normal, &mc.hit_normal, heavy_obj, mc.hit_submodel);
|
||||
model_instance_find_obj_dir(&asteroid_hit_info->collision_normal, &mc.hit_normal, Ships[heavy_obj->instance].model_instance_num, mc.hit_submodel, &heavy_obj->orient);
|
||||
}
|
||||
|
||||
// find position in submodel RF of light object at collison
|
||||
vec3d int_light_pos, diff;
|
||||
vm_vec_sub(&diff, mc.p1, mc.p0);
|
||||
vm_vec_scale_add(&int_light_pos, mc.p0, &diff, mc.hit_dist);
|
||||
model_instance_find_world_point(&asteroid_hit_info->light_collision_cm_pos, &int_light_pos, mc.model_num, mc.model_instance_num, mc.hit_submodel, &heavy_obj->orient, &zero);
|
||||
model_instance_find_world_point(&asteroid_hit_info->light_collision_cm_pos, &int_light_pos, mc.model_instance_num, mc.hit_submodel, &heavy_obj->orient, &zero);
|
||||
}
|
||||
}
|
||||
// Don't look at this submodel again
|
||||
@@ -1093,7 +1098,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
|
||||
|
||||
// get collision normal if not edge hit
|
||||
if (asteroid_hit_info->edge_hit == 0) {
|
||||
model_instance_find_obj_dir(&asteroid_hit_info->collision_normal, &mc.hit_normal, heavy_obj, mc.hit_submodel);
|
||||
model_instance_find_obj_dir(&asteroid_hit_info->collision_normal, &mc.hit_normal, Ships[heavy_obj->instance].model_instance_num, mc.hit_submodel, &heavy_obj->orient);
|
||||
}
|
||||
|
||||
// find position in submodel RF of light object at collison
|
||||
@@ -1107,7 +1112,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
|
||||
|
||||
} else {
|
||||
// Asteroid is heavier obj
|
||||
mc.model_instance_num = -1;
|
||||
mc.model_instance_num = Asteroids[num].model_instance_num;
|
||||
mc.model_num = Asteroid_info[Asteroids[num].asteroid_type].model_num[asteroid_subtype]; // Fill in the model to check
|
||||
model_clear_instance( mc.model_num );
|
||||
mc.orient = &pasteroid->orient; // The object's orient
|
||||
|
||||
@@ -98,6 +98,7 @@ public:
|
||||
typedef struct asteroid {
|
||||
int flags;
|
||||
int objnum;
|
||||
int model_instance_num;
|
||||
int asteroid_type; // 0..MAX_DEBRIS_TYPES
|
||||
int asteroid_subtype; // Index in asteroid_info for modelnum and modelp
|
||||
int check_for_wrap; // timestamp to check for asteroid wrapping around field
|
||||
|
||||
+323
-9
@@ -38,6 +38,7 @@
|
||||
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <iomanip>
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Private macros.
|
||||
@@ -123,7 +124,7 @@ bitmap_lookup::bitmap_lookup(int bitmap_num):
|
||||
Width = be->bm.w;
|
||||
Height = be->bm.h;
|
||||
|
||||
Bitmap_data = (float*)vm_malloc(Width * Height * Num_channels * sizeof(float));
|
||||
Bitmap_data = (ubyte*)vm_malloc(Width * Height * Num_channels * sizeof(ubyte));
|
||||
|
||||
gr_get_bitmap_from_texture((void*)Bitmap_data, bitmap_num);
|
||||
}
|
||||
@@ -156,7 +157,7 @@ float bitmap_lookup::get_channel_red(float u, float v)
|
||||
int x = fl2i(map_texture_address(u) * (Width-1));
|
||||
int y = fl2i(map_texture_address(v) * (Height-1));
|
||||
|
||||
return Bitmap_data[(y*Width + x)*Num_channels];
|
||||
return i2fl(Bitmap_data[(y*Width + x)*Num_channels]) / 255.0f;
|
||||
}
|
||||
|
||||
float bitmap_lookup::get_channel_green(float u, float v)
|
||||
@@ -169,7 +170,7 @@ float bitmap_lookup::get_channel_green(float u, float v)
|
||||
int x = fl2i(map_texture_address(u) * (Width-1));
|
||||
int y = fl2i(map_texture_address(v) * (Height-1));
|
||||
|
||||
return Bitmap_data[(y*Width + x)*Num_channels + 1];
|
||||
return i2fl(Bitmap_data[(y*Width + x)*Num_channels + 1]) / 255.0f;
|
||||
}
|
||||
|
||||
float bitmap_lookup::get_channel_blue(float u, float v)
|
||||
@@ -179,7 +180,7 @@ float bitmap_lookup::get_channel_blue(float u, float v)
|
||||
int x = fl2i(map_texture_address(u) * (Width-1));
|
||||
int y = fl2i(map_texture_address(v) * (Height-1));
|
||||
|
||||
return Bitmap_data[(y*Width + x)*Num_channels + 2];
|
||||
return i2fl(Bitmap_data[(y*Width + x)*Num_channels + 2]) / 255.0f;
|
||||
}
|
||||
|
||||
float bitmap_lookup::get_channel_alpha(float u, float v)
|
||||
@@ -189,7 +190,7 @@ float bitmap_lookup::get_channel_alpha(float u, float v)
|
||||
int x = fl2i(map_texture_address(u) * (Width-1));
|
||||
int y = fl2i(map_texture_address(v) * (Height-1));
|
||||
|
||||
return Bitmap_data[(y*Width + x)*Num_channels + 3];
|
||||
return i2fl(Bitmap_data[(y*Width + x)*Num_channels + 3]) / 255.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,6 +293,104 @@ DCF(bm_frag, "Shows BmpMan fragmentation") {
|
||||
key_getch();
|
||||
}
|
||||
|
||||
DCF(bm_used, "Shows BmpMan Slot Usage") {
|
||||
if (dc_optional_string_either("help", "--help")) {
|
||||
dc_printf("Displays used bmpman slots usage with a breakdown per filetype\n\n");
|
||||
return;
|
||||
}
|
||||
|
||||
int none = 0, pcx = 0, user = 0, tga = 0, png = 0; int jpg = 0, dds = 0, ani = 0;
|
||||
int eff = 0, eff_dds = 0, eff_tga = 0, eff_png = 0, eff_jpg = 0, eff_pcx = 0;
|
||||
int render_target_dynamic = 0, render_target_static = 0;
|
||||
|
||||
for (int i = 0; i<MAX_BITMAPS; i++) {
|
||||
switch (bm_bitmaps[i].type) {
|
||||
case BM_TYPE_NONE:
|
||||
none++;
|
||||
break;
|
||||
case BM_TYPE_PCX:
|
||||
pcx++;
|
||||
break;
|
||||
case BM_TYPE_USER:
|
||||
user++;
|
||||
break;
|
||||
case BM_TYPE_TGA:
|
||||
tga++;
|
||||
break;
|
||||
case BM_TYPE_PNG:
|
||||
// TODO distinguish png(static) from apng
|
||||
png++;
|
||||
break;
|
||||
case BM_TYPE_JPG:
|
||||
jpg++;
|
||||
break;
|
||||
case BM_TYPE_DDS:
|
||||
dds++;
|
||||
break;
|
||||
case BM_TYPE_ANI:
|
||||
ani++;
|
||||
break;
|
||||
case BM_TYPE_EFF:
|
||||
eff++;
|
||||
switch (bm_bitmaps[i].info.ani.eff.type) {
|
||||
case BM_TYPE_DDS:
|
||||
eff_dds++;
|
||||
break;
|
||||
case BM_TYPE_TGA:
|
||||
eff_tga++;
|
||||
break;
|
||||
case BM_TYPE_PNG:
|
||||
eff_png++;
|
||||
break;
|
||||
case BM_TYPE_JPG:
|
||||
eff_jpg++;
|
||||
break;
|
||||
case BM_TYPE_PCX:
|
||||
eff_pcx++;
|
||||
break;
|
||||
default:
|
||||
Warning(LOCATION, "Unhandled EFF image type (%i), get a coder!", bm_bitmaps[i].info.ani.eff.type);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case BM_TYPE_RENDER_TARGET_STATIC:
|
||||
render_target_static++;
|
||||
break;
|
||||
case BM_TYPE_RENDER_TARGET_DYNAMIC:
|
||||
render_target_dynamic++;
|
||||
break;
|
||||
default:
|
||||
Warning(LOCATION, "Unhandled image type (%i), get a coder!", bm_bitmaps[i].type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SCP_stringstream text;
|
||||
text << "BmpMan Used Slots\n";
|
||||
text << " " << std::dec << std::setw(4) << std::setfill('0') << pcx << ", PCX\n";
|
||||
text << " " << std::dec << std::setw(4) << std::setfill('0') << user << ", User\n";
|
||||
text << " " << std::dec << std::setw(4) << std::setfill('0') << tga << ", TGA\n";
|
||||
text << " " << std::dec << std::setw(4) << std::setfill('0') << png << ", PNG\n";
|
||||
text << " " << std::dec << std::setw(4) << std::setfill('0') << jpg << ", JPG\n";
|
||||
text << " " << std::dec << std::setw(4) << std::setfill('0') << dds << ", DDS\n";
|
||||
text << " " << std::dec << std::setw(4) << std::setfill('0') << ani << ", ANI\n";
|
||||
text << " " << std::dec << std::setw(4) << std::setfill('0') << eff << ", EFF\n";
|
||||
text << " " << std::dec << std::setw(4) << std::setfill('0') << eff_dds << ", EFF/DDS\n";
|
||||
text << " " << std::dec << std::setw(4) << std::setfill('0') << eff_tga << ", EFF/TGA\n";
|
||||
text << " " << std::dec << std::setw(4) << std::setfill('0') << eff_png << ", EFF/PNG\n";
|
||||
text << " " << std::dec << std::setw(4) << std::setfill('0') << eff_jpg << ", EFF/JPG\n";
|
||||
text << " " << std::dec << std::setw(4) << std::setfill('0') << eff_pcx << ", EFF/PCX\n";
|
||||
text << " " << std::dec << std::setw(4) << std::setfill('0') << render_target_static << ", Render/Static\n";
|
||||
text << " " << std::dec << std::setw(4) << std::setfill('0') << render_target_dynamic << ", Render/Dynamic\n";
|
||||
text << " " << std::dec << std::setw(4) << std::setfill('0') << MAX_BITMAPS-none << "/" << MAX_BITMAPS << ", Total\n";
|
||||
text << "\n";
|
||||
|
||||
// TODO consider converting 1's to monospace to make debug console output prettier
|
||||
mprintf(("%s", text.str().c_str())); // log for ease for copying data
|
||||
dc_printf("%s", text.str().c_str()); // instant gratification
|
||||
}
|
||||
|
||||
|
||||
DCF(bmpman, "Shows/changes bitmap caching parameters and usage") {
|
||||
if (dc_optional_string_either("help", "--help")) {
|
||||
dc_printf("Usage: BmpMan [arg]\nWhere arg can be any of the following:\n");
|
||||
@@ -913,6 +1012,110 @@ int bm_is_valid(int handle) {
|
||||
return (bm_bitmaps[handle % MAX_BITMAPS].handle == handle);
|
||||
}
|
||||
|
||||
|
||||
// Load an image and validate it while retrieving information for later use
|
||||
// Input: type = current BM_TYPE_*
|
||||
// n = location in bm_bitmaps[]
|
||||
// filename = name of the current file
|
||||
// img_cfp = already open CFILE handle, if available
|
||||
//
|
||||
// Output: w = bmp width
|
||||
// h = bmp height
|
||||
// bpp = bmp bits per pixel
|
||||
// c_type = output for an updated BM_TYPE_*
|
||||
// mm_lvl = number of mipmap levels for the image
|
||||
// size = size of the data contained in the image
|
||||
static int bm_load_info(BM_TYPE type, int n, const char *filename, CFILE *img_cfp, int *w, int *h, int *bpp, BM_TYPE *c_type, int *mm_lvl, int *size)
|
||||
{
|
||||
int dds_ct;
|
||||
|
||||
if (type == BM_TYPE_DDS) {
|
||||
int dds_error = dds_read_header(filename, img_cfp, w, h, bpp, &dds_ct, mm_lvl, size);
|
||||
|
||||
if (dds_error != DDS_ERROR_NONE) {
|
||||
mprintf(("DDS ERROR: Couldn't open '%s' -- %s\n", filename, dds_error_string(dds_error)));
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (dds_ct) {
|
||||
case DDS_DXT1:
|
||||
*c_type = BM_TYPE_DXT1;
|
||||
break;
|
||||
|
||||
case DDS_DXT3:
|
||||
*c_type = BM_TYPE_DXT3;
|
||||
break;
|
||||
|
||||
case DDS_DXT5:
|
||||
*c_type = BM_TYPE_DXT5;
|
||||
break;
|
||||
|
||||
case DDS_UNCOMPRESSED:
|
||||
*c_type = BM_TYPE_DDS;
|
||||
break;
|
||||
|
||||
case DDS_CUBEMAP_DXT1:
|
||||
*c_type = BM_TYPE_CUBEMAP_DXT1;
|
||||
break;
|
||||
|
||||
case DDS_CUBEMAP_DXT3:
|
||||
*c_type = BM_TYPE_CUBEMAP_DXT3;
|
||||
break;
|
||||
|
||||
case DDS_CUBEMAP_DXT5:
|
||||
*c_type = BM_TYPE_CUBEMAP_DXT5;
|
||||
break;
|
||||
|
||||
case DDS_CUBEMAP_UNCOMPRESSED:
|
||||
*c_type = BM_TYPE_CUBEMAP_DDS;
|
||||
break;
|
||||
|
||||
default:
|
||||
Error(LOCATION, "Bad DDS file compression! Not using DXT1,3,5: %s", filename);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// if its a tga file
|
||||
else if (type == BM_TYPE_TGA) {
|
||||
int tga_error = targa_read_header(filename, img_cfp, w, h, bpp, NULL);
|
||||
if (tga_error != TARGA_ERROR_NONE) {
|
||||
mprintf(("tga: Couldn't open '%s'\n", filename));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// if its a png file
|
||||
else if (type == BM_TYPE_PNG) {
|
||||
int png_error = png_read_header(filename, img_cfp, w, h, bpp, NULL);
|
||||
if (png_error != PNG_ERROR_NONE) {
|
||||
mprintf(("png: Couldn't open '%s'\n", filename));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// if its a jpg file
|
||||
else if (type == BM_TYPE_JPG) {
|
||||
int jpg_error = jpeg_read_header(filename, img_cfp, w, h, bpp, NULL);
|
||||
if (jpg_error != JPEG_ERROR_NONE) {
|
||||
mprintf(("jpg: Couldn't open '%s'\n", filename));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// if its a pcx file
|
||||
else if (type == BM_TYPE_PCX) {
|
||||
int pcx_error = pcx_read_header(filename, img_cfp, w, h, bpp, NULL);
|
||||
if (pcx_error != PCX_ERROR_NONE) {
|
||||
mprintf(("pcx: Couldn't open '%s'\n", filename));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Assertion(false, "Unknown file type specified! This is probably a coding error.");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bm_load(const char *real_filename) {
|
||||
int i, free_slot = -1;
|
||||
int w, h, bpp = 8;
|
||||
@@ -985,7 +1188,7 @@ int bm_load(const char *real_filename) {
|
||||
goto Done;
|
||||
}
|
||||
|
||||
rc = gr_bm_load(type, free_slot, filename, img_cfp, &w, &h, &bpp, &c_type, &mm_lvl, &bm_size);
|
||||
rc = bm_load_info(type, free_slot, filename, img_cfp, &w, &h, &bpp, &c_type, &mm_lvl, &bm_size);
|
||||
|
||||
if (rc != 0)
|
||||
goto Done;
|
||||
@@ -1111,6 +1314,109 @@ bool bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lock an image files data into memory
|
||||
*/
|
||||
static int bm_load_image_data(const char *filename, int handle, int bitmapnum, ubyte bpp, ubyte flags, bool nodebug)
|
||||
{
|
||||
BM_TYPE c_type = BM_TYPE_NONE;
|
||||
ubyte true_bpp;
|
||||
|
||||
bitmap_entry *be = &bm_bitmaps[bitmapnum];
|
||||
bitmap *bmp = &be->bm;
|
||||
|
||||
Assert(!Is_standalone);
|
||||
|
||||
if (bmp->true_bpp > bpp)
|
||||
true_bpp = bmp->true_bpp;
|
||||
else
|
||||
true_bpp = bpp;
|
||||
|
||||
// don't do a bpp check here since it could be different in OGL - taylor
|
||||
if (bmp->data == 0) {
|
||||
Assert(be->ref_count == 1);
|
||||
|
||||
if (be->type != BM_TYPE_USER && !nodebug) {
|
||||
if (bmp->data == 0)
|
||||
nprintf(("BmpMan", "Loading %s for the first time.\n", be->filename));
|
||||
}
|
||||
|
||||
if (!Bm_paging) {
|
||||
if (be->type != BM_TYPE_USER && !nodebug)
|
||||
nprintf(("Paging", "Loading %s (%dx%dx%d)\n", be->filename, bmp->w, bmp->h, true_bpp));
|
||||
}
|
||||
|
||||
// select proper format
|
||||
if (flags & BMP_AABITMAP)
|
||||
BM_SELECT_ALPHA_TEX_FORMAT();
|
||||
else if (flags & BMP_TEX_ANY)
|
||||
BM_SELECT_TEX_FORMAT();
|
||||
else
|
||||
BM_SELECT_SCREEN_FORMAT();
|
||||
|
||||
// make sure we use the real graphic type for EFFs
|
||||
if (be->type == BM_TYPE_EFF) {
|
||||
c_type = be->info.ani.eff.type;
|
||||
}
|
||||
else {
|
||||
c_type = be->type;
|
||||
}
|
||||
|
||||
switch (c_type)
|
||||
{
|
||||
case BM_TYPE_PCX:
|
||||
bm_lock_pcx(handle, bitmapnum, be, bmp, true_bpp, flags);
|
||||
break;
|
||||
|
||||
case BM_TYPE_ANI:
|
||||
bm_lock_ani(handle, bitmapnum, be, bmp, true_bpp, flags);
|
||||
break;
|
||||
|
||||
case BM_TYPE_TGA:
|
||||
bm_lock_tga(handle, bitmapnum, be, bmp, true_bpp, flags);
|
||||
break;
|
||||
|
||||
case BM_TYPE_PNG:
|
||||
//libpng handles compression with zlib
|
||||
bm_lock_png(handle, bitmapnum, be, bmp, true_bpp, flags);
|
||||
break;
|
||||
|
||||
case BM_TYPE_JPG:
|
||||
bm_lock_jpg(handle, bitmapnum, be, bmp, true_bpp, flags);
|
||||
break;
|
||||
|
||||
case BM_TYPE_DDS:
|
||||
case BM_TYPE_DXT1:
|
||||
case BM_TYPE_DXT3:
|
||||
case BM_TYPE_DXT5:
|
||||
case BM_TYPE_CUBEMAP_DDS:
|
||||
case BM_TYPE_CUBEMAP_DXT1:
|
||||
case BM_TYPE_CUBEMAP_DXT3:
|
||||
case BM_TYPE_CUBEMAP_DXT5:
|
||||
bm_lock_dds(handle, bitmapnum, be, bmp, true_bpp, flags);
|
||||
break;
|
||||
|
||||
case BM_TYPE_USER:
|
||||
bm_lock_user(handle, bitmapnum, be, bmp, true_bpp, flags);
|
||||
break;
|
||||
|
||||
default:
|
||||
Warning(LOCATION, "Unsupported type in bm_lock -- %d\n", c_type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// always go back to screen format
|
||||
BM_SELECT_SCREEN_FORMAT();
|
||||
|
||||
// make sure we actually did something
|
||||
if (!(bmp->data))
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *keyframe, int can_drop_frames, int dir_type) {
|
||||
int i, n;
|
||||
anim the_anim;
|
||||
@@ -1278,8 +1584,8 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
|
||||
bm_bitmaps[n + i].info.ani.eff.type = eff_type;
|
||||
sprintf(bm_bitmaps[n + i].info.ani.eff.filename, "%s_%.4d", clean_name, i);
|
||||
|
||||
// gr_bm_load() returns non-0 on failure
|
||||
if (gr_bm_load(eff_type, n + i, bm_bitmaps[n + i].info.ani.eff.filename, NULL, &anim_width, &anim_height, &bpp, &c_type, &mm_lvl, &img_size)) {
|
||||
// bm_load_info() returns non-0 on failure
|
||||
if (bm_load_info(eff_type, n + i, bm_bitmaps[n + i].info.ani.eff.filename, NULL, &anim_width, &anim_height, &bpp, &c_type, &mm_lvl, &img_size)) {
|
||||
// if we didn't get anything then bail out now
|
||||
if (i == 0) {
|
||||
Warning(LOCATION, "EFF: No frame images were found. EFF, %s, is invalid.\n", filename);
|
||||
@@ -1504,13 +1810,21 @@ bitmap * bm_lock(int handle, ubyte bpp, ubyte flags, bool nodebug) {
|
||||
#endif
|
||||
|
||||
// read the file data
|
||||
if (gr_bm_lock(be->filename, handle, bitmapnum, bpp, flags, nodebug) == -1) {
|
||||
if (bm_load_image_data(be->filename, handle, bitmapnum, bpp, flags, nodebug) == -1) {
|
||||
// oops, this isn't good - reset and return NULL
|
||||
bm_unlock( handle );
|
||||
bm_unload( handle );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!gr_bm_data(bitmapnum, bmp)) {
|
||||
// graphics subsystem failed, reset and return NULL
|
||||
bm_unlock( handle );
|
||||
bm_unload( handle );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MONITOR_INC(NumBitmapPage, 1);
|
||||
MONITOR_INC(SizeBitmapPage, bmp->w*bmp->h);
|
||||
|
||||
@@ -175,7 +175,7 @@ void *bm_malloc(int handle, int size);
|
||||
void bm_update_memory_used(int n, int size);
|
||||
|
||||
class bitmap_lookup {
|
||||
float *Bitmap_data;
|
||||
ubyte *Bitmap_data;
|
||||
|
||||
int Width;
|
||||
int Height;
|
||||
|
||||
@@ -330,8 +330,10 @@ void camera::get_info(vec3d *position, matrix *orientation)
|
||||
eyep = get_submodel_eye(pm, object_host_submodel);
|
||||
if(eyep)
|
||||
{
|
||||
Assertion(objp->type == OBJ_SHIP, "This part of the code expects the object to be a ship");
|
||||
|
||||
vec3d c_pos_in;
|
||||
find_submodel_instance_point_normal( &c_pos_in, &host_normal, objp, eyep->parent, &eyep->pnt, &eyep->norm);
|
||||
find_submodel_instance_point_normal(&c_pos_in, &host_normal, Ships[objp->instance].model_instance_num, eyep->parent, &eyep->pnt, &eyep->norm);
|
||||
vm_vec_unrotate(&c_pos, &c_pos_in, &objp->orient);
|
||||
vm_vec_add2(&c_pos, &objp->pos);
|
||||
}
|
||||
|
||||
+220
-192
@@ -92,77 +92,87 @@ cf_pathtype Pathtypes[CF_MAX_PATH_TYPES] = {
|
||||
#define CFILE_STACK_MAX 8
|
||||
|
||||
int cfile_inited = 0;
|
||||
int Cfile_stack_pos = 0;
|
||||
static int Cfile_stack_pos = 0;
|
||||
|
||||
char Cfile_stack[CFILE_STACK_MAX][CFILE_ROOT_DIRECTORY_LEN];
|
||||
static char Cfile_stack[CFILE_STACK_MAX][CFILE_ROOT_DIRECTORY_LEN];
|
||||
|
||||
Cfile_block Cfile_block_list[MAX_CFILE_BLOCKS];
|
||||
CFILE Cfile_list[MAX_CFILE_BLOCKS];
|
||||
static CFILE Cfile_list[MAX_CFILE_BLOCKS];
|
||||
|
||||
const char *Cfile_cdrom_dir = NULL;
|
||||
static const char *Cfile_cdrom_dir = NULL;
|
||||
|
||||
//
|
||||
// Function prototypes for internally-called functions
|
||||
//
|
||||
int cfget_cfile_block();
|
||||
CFILE *cf_open_fill_cfblock(FILE * fp, int type);
|
||||
CFILE *cf_open_packed_cfblock(FILE *fp, int type, int offset, int size);
|
||||
static int cfget_cfile_block();
|
||||
static CFILE *cf_open_fill_cfblock(const char* source, int line, FILE * fp, int type);
|
||||
static CFILE *cf_open_packed_cfblock(const char* source, int line, FILE *fp, int type, int offset, int size);
|
||||
|
||||
#if defined _WIN32
|
||||
CFILE *cf_open_mapped_fill_cfblock(HANDLE hFile, int type);
|
||||
static CFILE *cf_open_mapped_fill_cfblock(const char* source, int line, HANDLE hFile, int type);
|
||||
#elif defined SCP_UNIX
|
||||
CFILE *cf_open_mapped_fill_cfblock(FILE *fp, int type);
|
||||
static CFILE *cf_open_mapped_fill_cfblock(const char* source, int line, FILE *fp, int type);
|
||||
#endif
|
||||
|
||||
void cf_chksum_long_init();
|
||||
static void cf_chksum_long_init();
|
||||
|
||||
void cfile_close()
|
||||
static void dump_opened_files()
|
||||
{
|
||||
for (int i = 0; i < MAX_CFILE_BLOCKS; i++) {
|
||||
auto cb = &Cfile_block_list[i];
|
||||
if (cb->type != CFILE_BLOCK_UNUSED) {
|
||||
mprintf((" %s:%d\n", cb->source_file, cb->line_num));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void cfile_close()
|
||||
{
|
||||
mprintf(("Still opened files:\n"));
|
||||
dump_opened_files();
|
||||
|
||||
cf_free_secondary_filelist();
|
||||
}
|
||||
|
||||
// determine if the given path is in a root directory (c:\ or c:\freespace2.exe or c:\fred2.exe etc)
|
||||
int cfile_in_root_dir(const char *exe_path)
|
||||
{
|
||||
int token_count = 0;
|
||||
char path_copy[CFILE_ROOT_DIRECTORY_LEN] = "";
|
||||
char *tok;
|
||||
|
||||
// bogus
|
||||
if(exe_path == NULL){
|
||||
return 1;
|
||||
}
|
||||
|
||||
// copy the path
|
||||
memset(path_copy, 0, CFILE_ROOT_DIRECTORY_LEN);
|
||||
strncpy(path_copy, exe_path, CFILE_ROOT_DIRECTORY_LEN - 1);
|
||||
|
||||
// count how many slashes there are in the path
|
||||
tok = strtok(path_copy, DIR_SEPARATOR_STR);
|
||||
if(tok == NULL){
|
||||
return 1;
|
||||
}
|
||||
do {
|
||||
token_count++;
|
||||
tok = strtok(NULL, DIR_SEPARATOR_STR);
|
||||
} while(tok != NULL);
|
||||
|
||||
#ifdef SCP_UNIX
|
||||
// /freespace works, / does not
|
||||
if(token_count <= 1) {
|
||||
#define MIN_NUM_PATH_COMPONENTS 2 /* Directory + file */
|
||||
#else
|
||||
// C:/freespace works, C:/ does not
|
||||
if(token_count <= 2){
|
||||
#define MIN_NUM_PATH_COMPONENTS 3 /* Drive + directory + file */
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
// not-root directory
|
||||
return 0;
|
||||
/**
|
||||
* @brief Determine if the given path is in the root directory
|
||||
*
|
||||
* @param exe_path Path to executable
|
||||
*
|
||||
* @return true if root directory, false if not
|
||||
*/
|
||||
static bool cfile_in_root_dir(const char *exe_path)
|
||||
{
|
||||
int new_token;
|
||||
int token_count = 0;
|
||||
const char *p = exe_path;
|
||||
|
||||
Assert(exe_path != NULL);
|
||||
|
||||
do {
|
||||
new_token = 0;
|
||||
while (*p == DIR_SEPARATOR_CHAR) {
|
||||
p++;
|
||||
}
|
||||
|
||||
while ((*p != '\0') && (*p != DIR_SEPARATOR_CHAR)) {
|
||||
new_token = 1;
|
||||
p++;
|
||||
}
|
||||
token_count += new_token;
|
||||
} while (*p != '\0');
|
||||
|
||||
return (token_count < MIN_NUM_PATH_COMPONENTS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the cfile system. Called once at application start.
|
||||
* @brief Initialize the cfile system. Called once at application start.
|
||||
*
|
||||
* @param exe_dir Path to a file (not a directory)
|
||||
* @param cdrom_dir Path to a CD drive mount point (may be NULL)
|
||||
@@ -174,57 +184,61 @@ int cfile_init(const char *exe_dir, const char *cdrom_dir)
|
||||
{
|
||||
int i;
|
||||
|
||||
// initialize encryption
|
||||
encrypt_init();
|
||||
encrypt_init(); /* initialize encryption */
|
||||
|
||||
if ( !cfile_inited ) {
|
||||
char buf[CFILE_ROOT_DIRECTORY_LEN];
|
||||
if (cfile_inited) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
cfile_inited = 1;
|
||||
char buf[CFILE_ROOT_DIRECTORY_LEN];
|
||||
|
||||
memset(buf, 0, CFILE_ROOT_DIRECTORY_LEN);
|
||||
strncpy(buf, exe_dir, CFILE_ROOT_DIRECTORY_LEN - 1);
|
||||
i = strlen(buf);
|
||||
strncpy(buf, exe_dir, CFILE_ROOT_DIRECTORY_LEN - 1);
|
||||
buf[CFILE_ROOT_DIRECTORY_LEN - 1] = '\0';
|
||||
i = strlen(buf);
|
||||
|
||||
// are we in a root directory?
|
||||
if(cfile_in_root_dir(buf)){
|
||||
MessageBox((HWND)NULL, "FreeSpace2/Fred2 cannot be run from a drive root directory!", "Error", MB_OK);
|
||||
return 1;
|
||||
}
|
||||
/* Determine if we in a root directory? */
|
||||
if (cfile_in_root_dir(buf)) {
|
||||
MessageBox((HWND)NULL,
|
||||
"FreeSpace2/Fred2 cannot be run from a drive root directory!",
|
||||
"Error", MB_OK);
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (i--) {
|
||||
if (buf[i] == DIR_SEPARATOR_CHAR){
|
||||
break;
|
||||
}
|
||||
}
|
||||
// This needs to be set here because cf_build_secondary_filelist assumes it to be true
|
||||
cfile_inited = 1;
|
||||
|
||||
if (i >= 2) {
|
||||
buf[i] = 0;
|
||||
cfile_chdir(buf);
|
||||
} else {
|
||||
MessageBox((HWND)NULL, "Error trying to determine executable root directory!", "Error", MB_OK);
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
* Determine the executable's directory. Note that DIR_SEPARATOR_CHAR
|
||||
* is guaranteed to be found in the string else cfile_in_root_dir()
|
||||
* would have failed.
|
||||
*/
|
||||
|
||||
// set root directory
|
||||
strncpy(Cfile_root_dir, buf, CFILE_ROOT_DIRECTORY_LEN-1);
|
||||
char *p;
|
||||
|
||||
p = strrchr(buf, DIR_SEPARATOR_CHAR);
|
||||
*p = '\0';
|
||||
|
||||
cfile_chdir(buf);
|
||||
|
||||
// set root directory
|
||||
strncpy(Cfile_root_dir, buf, CFILE_ROOT_DIRECTORY_LEN - 1);
|
||||
#ifdef SCP_UNIX
|
||||
snprintf(Cfile_user_dir, CFILE_ROOT_DIRECTORY_LEN-1, "%s/%s/", detect_home(), Osreg_user_dir);
|
||||
snprintf(Cfile_user_dir, CFILE_ROOT_DIRECTORY_LEN - 1, "%s/%s/",
|
||||
detect_home(), Osreg_user_dir);
|
||||
#endif
|
||||
|
||||
for ( i = 0; i < MAX_CFILE_BLOCKS; i++ ) {
|
||||
Cfile_block_list[i].type = CFILE_BLOCK_UNUSED;
|
||||
}
|
||||
|
||||
// 32 bit CRC table init
|
||||
cf_chksum_long_init();
|
||||
|
||||
Cfile_cdrom_dir = cdrom_dir;
|
||||
cf_build_secondary_filelist(Cfile_cdrom_dir);
|
||||
|
||||
atexit( cfile_close );
|
||||
for (i = 0; i < MAX_CFILE_BLOCKS; i++) {
|
||||
Cfile_block_list[i].type = CFILE_BLOCK_UNUSED;
|
||||
}
|
||||
|
||||
// 32 bit CRC table init
|
||||
cf_chksum_long_init();
|
||||
|
||||
Cfile_cdrom_dir = cdrom_dir;
|
||||
cf_build_secondary_filelist(Cfile_cdrom_dir);
|
||||
|
||||
atexit(cfile_close);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -238,13 +252,13 @@ void cfile_refresh()
|
||||
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
// Changes to a drive if valid.. 1=A, 2=B, etc
|
||||
// If flag, then changes to it.
|
||||
// Returns 0 if not-valid, 1 if valid.
|
||||
int cfile_chdrive( int DriveNum, int flag )
|
||||
{
|
||||
int Valid = 0;
|
||||
#ifdef _WIN32
|
||||
int n, org;
|
||||
|
||||
org = -1;
|
||||
@@ -260,99 +274,108 @@ int cfile_chdrive( int DriveNum, int flag )
|
||||
|
||||
if ( (!flag) && (n != org) )
|
||||
_chdrive( org );
|
||||
#endif // _WIN32
|
||||
|
||||
return Valid;
|
||||
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
// push current directory on a 'stack' (so we can restore it) and change the directory
|
||||
int cfile_push_chdir(int type)
|
||||
/**
|
||||
* @brief Common code for changing directory
|
||||
*
|
||||
* @param new_dir Directory to which to change
|
||||
* @param cur_dir Current directory (only used on Windows)
|
||||
*
|
||||
* @retval 0 Success
|
||||
* @retval 1 Failed to change to new directory's drive (Windows only)
|
||||
* @retval 2 Failed to change to new directory
|
||||
*/
|
||||
static int _cfile_chdir(const char *new_dir, const char *cur_dir __UNUSED)
|
||||
{
|
||||
int e;
|
||||
char dir[CFILE_ROOT_DIRECTORY_LEN];
|
||||
char OriginalDirectory[CFILE_ROOT_DIRECTORY_LEN];
|
||||
char *Path = NULL;
|
||||
char NoDir[] = "\\.";
|
||||
|
||||
_getcwd(OriginalDirectory, CFILE_ROOT_DIRECTORY_LEN-1);
|
||||
|
||||
Assert(Cfile_stack_pos < CFILE_STACK_MAX);
|
||||
|
||||
if ( Cfile_stack_pos >= CFILE_STACK_MAX )
|
||||
return -1;
|
||||
|
||||
strncpy(Cfile_stack[Cfile_stack_pos++], OriginalDirectory, CFILE_ROOT_DIRECTORY_LEN-1);
|
||||
|
||||
cf_create_default_path_string( dir, sizeof(dir)-1, type, NULL );
|
||||
int status;
|
||||
const char *path = NULL;
|
||||
const char no_dir[] = "\\.";
|
||||
|
||||
#ifdef _WIN32
|
||||
char *colon_pos = strchr(dir, ':');
|
||||
const char *colon = strchr(new_dir, ':');
|
||||
|
||||
if (colon_pos) {
|
||||
if (!cfile_chdrive( tolower(*(colon_pos - 1)) - 'a' + 1, 1))
|
||||
if (colon) {
|
||||
if (!cfile_chdrive(tolower(*(colon - 1)) - 'a' + 1, 1))
|
||||
return 1;
|
||||
|
||||
Path = colon_pos+1;
|
||||
path = colon + 1;
|
||||
} else
|
||||
#endif // _WIN32
|
||||
#endif /* _WIN32 */
|
||||
{
|
||||
Path = dir;
|
||||
path = new_dir;
|
||||
}
|
||||
|
||||
if (!(*Path)) {
|
||||
Path = NoDir;
|
||||
if (*path == '\0') {
|
||||
path = no_dir;
|
||||
}
|
||||
|
||||
// This chdir might get a critical error!
|
||||
e = _chdir( Path );
|
||||
if (e) {
|
||||
/* This chdir might get a critical error! */
|
||||
status = _chdir(path);
|
||||
if (status != 0) {
|
||||
#ifdef _WIN32
|
||||
cfile_chdrive( tolower(OriginalDirectory[0]) - 'a' + 1, 1 );
|
||||
#endif // _WIN32
|
||||
cfile_chdrive(tolower(cur_dir[0]) - 'a' + 1, 1);
|
||||
#endif /* _WIN32 */
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Push current directory onto a 'stack' and change to a new directory
|
||||
*
|
||||
* The current directory is pushed onto a 'stack' so that it can be easily
|
||||
* restored at a later time. The new directory is derived from @a type.
|
||||
*
|
||||
* @param type path type (CF_TYPE_xxx)
|
||||
*
|
||||
* @retval -1 'Stack' is full
|
||||
* @retval 0 Success
|
||||
* @retval 1 Failed to change to new directory's drive (Windows only)
|
||||
* @retval 2 Failed to change to new directory
|
||||
*/
|
||||
int cfile_push_chdir(int type)
|
||||
{
|
||||
char dir[CFILE_ROOT_DIRECTORY_LEN];
|
||||
char OriginalDirectory[CFILE_ROOT_DIRECTORY_LEN];
|
||||
|
||||
_getcwd(OriginalDirectory, CFILE_ROOT_DIRECTORY_LEN - 1);
|
||||
|
||||
Assert(Cfile_stack_pos < CFILE_STACK_MAX);
|
||||
|
||||
if (Cfile_stack_pos >= CFILE_STACK_MAX) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
strncpy(Cfile_stack[Cfile_stack_pos++], OriginalDirectory,
|
||||
CFILE_ROOT_DIRECTORY_LEN - 1);
|
||||
|
||||
cf_create_default_path_string(dir, sizeof(dir) - 1, type, NULL);
|
||||
|
||||
return _cfile_chdir(dir, OriginalDirectory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Change to the specified directory
|
||||
*
|
||||
* @param dir Directory
|
||||
*
|
||||
* @retval 0 Success
|
||||
* @retval 1 Failed to change to new directory's drive (Windows only)
|
||||
* @retval 2 Failed to change to new directory
|
||||
*/
|
||||
int cfile_chdir(const char *dir)
|
||||
{
|
||||
int e;
|
||||
char OriginalDirectory[CFILE_ROOT_DIRECTORY_LEN];
|
||||
const char *Path = NULL;
|
||||
char NoDir[] = "\\.";
|
||||
|
||||
_getcwd(OriginalDirectory, CFILE_ROOT_DIRECTORY_LEN-1);
|
||||
_getcwd(OriginalDirectory, CFILE_ROOT_DIRECTORY_LEN - 1);
|
||||
|
||||
#ifdef _WIN32
|
||||
const char *colon_pos = strchr(dir, ':');
|
||||
if (colon_pos) {
|
||||
if (!cfile_chdrive( tolower(*(colon_pos - 1)) - 'a' + 1, 1))
|
||||
return 1;
|
||||
|
||||
Path = colon_pos+1;
|
||||
} else
|
||||
#endif // _WIN32
|
||||
{
|
||||
Path = dir;
|
||||
}
|
||||
|
||||
if (!(*Path)) {
|
||||
Path = NoDir;
|
||||
}
|
||||
|
||||
// This chdir might get a critical error!
|
||||
e = _chdir( Path );
|
||||
if (e) {
|
||||
#ifdef _WIN32
|
||||
cfile_chdrive( tolower(OriginalDirectory[0]) - 'a' + 1, 1 );
|
||||
#endif // _WIN32
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return _cfile_chdir(dir, OriginalDirectory);
|
||||
}
|
||||
|
||||
int cfile_pop_dir()
|
||||
@@ -405,7 +428,7 @@ int cfile_flush_dir(int dir_type)
|
||||
for (unsigned int i = 0; i < globinfo.gl_pathc; i++) {
|
||||
// Determine if this is a regular file
|
||||
struct stat statbuf;
|
||||
memset(&statbuf, 0, sizeof(statbuf));
|
||||
|
||||
stat(globinfo.gl_pathv[i], &statbuf);
|
||||
if (S_ISREG(statbuf.st_mode)) {
|
||||
// delete the file
|
||||
@@ -449,34 +472,24 @@ char *cf_add_ext(const char *filename, const char *ext)
|
||||
return path;
|
||||
}
|
||||
|
||||
// Deletes a file. Returns 0 if an error occurs, 1 on success
|
||||
int cf_delete(const char *filename, int dir_type)
|
||||
/**
|
||||
* @brief Delete the specified file
|
||||
*
|
||||
* @param filename Name of file to delete
|
||||
* @param path_type Path type (CF_TYPE_xxx)
|
||||
*
|
||||
* @return 0 on failure, 1 on success
|
||||
*/
|
||||
int cf_delete(const char *filename, int path_type)
|
||||
{
|
||||
char longname[MAX_PATH_LEN];
|
||||
|
||||
Assert( CF_TYPE_SPECIFIED(dir_type) );
|
||||
Assert(CF_TYPE_SPECIFIED(path_type));
|
||||
|
||||
cf_create_default_path_string( longname, sizeof(longname)-1, dir_type, filename );
|
||||
cf_create_default_path_string(longname, sizeof(longname) - 1,
|
||||
path_type, filename);
|
||||
|
||||
FILE *fp = fopen(longname, "rb");
|
||||
if (fp) {
|
||||
// delete the file
|
||||
fclose(fp);
|
||||
if(_unlink(longname) == -1)
|
||||
{
|
||||
//ERROR - file is probably read only
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//ERROR - file doesn't exist
|
||||
return 0;
|
||||
}
|
||||
return (_unlink(longname) != -1);
|
||||
}
|
||||
|
||||
|
||||
@@ -631,7 +644,7 @@ extern int game_cd_changed();
|
||||
// error ==> NULL
|
||||
//
|
||||
|
||||
CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, bool localize)
|
||||
CFILE *_cfopen(const char* source, int line, const char *file_path, const char *mode, int type, int dir_type, bool localize)
|
||||
{
|
||||
/* Bobboau, what is this doing here? 31 is way too short... - Goober5000
|
||||
if( strlen(file_path) > 31 )
|
||||
@@ -716,7 +729,7 @@ CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, b
|
||||
|
||||
FILE *fp = fopen(longname, happy_mode);
|
||||
if (fp) {
|
||||
return cf_open_fill_cfblock(fp, dir_type);
|
||||
return cf_open_fill_cfblock(source, line, fp, dir_type);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -745,12 +758,12 @@ CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, b
|
||||
hFile = CreateFile(longname, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if (hFile != INVALID_HANDLE_VALUE) {
|
||||
return cf_open_mapped_fill_cfblock(hFile, dir_type);
|
||||
return cf_open_mapped_fill_cfblock(source, line, hFile, dir_type);
|
||||
}
|
||||
#elif defined SCP_UNIX
|
||||
FILE *fp = fopen( longname, "rb" );
|
||||
if (fp) {
|
||||
return cf_open_mapped_fill_cfblock(fp, dir_type);
|
||||
return cf_open_mapped_fill_cfblock(source, line, fp, dir_type);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -762,10 +775,10 @@ CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, b
|
||||
if ( fp ) {
|
||||
if ( offset ) {
|
||||
// Found it in a pack file
|
||||
return cf_open_packed_cfblock(fp, dir_type, offset, size );
|
||||
return cf_open_packed_cfblock(source, line, fp, dir_type, offset, size );
|
||||
} else {
|
||||
// Found it in a normal file
|
||||
return cf_open_fill_cfblock(fp, dir_type);
|
||||
return cf_open_fill_cfblock(source, line, fp, dir_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -786,7 +799,7 @@ CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, b
|
||||
// returns: success ==> address of CFILE structure
|
||||
// error ==> NULL
|
||||
//
|
||||
CFILE *cfopen_special(const char *file_path, const char *mode, const int size, const int offset, int dir_type)
|
||||
CFILE *_cfopen_special(const char* source, int line, const char *file_path, const char *mode, const int size, const int offset, int dir_type)
|
||||
{
|
||||
if ( !cfile_inited) {
|
||||
Int3();
|
||||
@@ -811,10 +824,10 @@ CFILE *cfopen_special(const char *file_path, const char *mode, const int size, c
|
||||
|
||||
if ( offset ) {
|
||||
// it's in a pack file
|
||||
return cf_open_packed_cfblock(fp, dir_type, offset, size);
|
||||
return cf_open_packed_cfblock(source, line, fp, dir_type, offset, size);
|
||||
} else {
|
||||
// it's a normal file
|
||||
return cf_open_fill_cfblock(fp, dir_type);
|
||||
return cf_open_fill_cfblock(source, line, fp, dir_type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -833,7 +846,7 @@ CFILE *ctmpfile()
|
||||
FILE *fp;
|
||||
fp = tmpfile();
|
||||
if ( fp )
|
||||
return cf_open_fill_cfblock(fp, 0);
|
||||
return cf_open_fill_cfblock(LOCATION, fp, 0);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
@@ -846,7 +859,7 @@ CFILE *ctmpfile()
|
||||
// returns: success ==> index in Cfile_block_list[] array
|
||||
// failure ==> -1
|
||||
//
|
||||
int cfget_cfile_block()
|
||||
static int cfget_cfile_block()
|
||||
{
|
||||
int i;
|
||||
Cfile_block *cb;
|
||||
@@ -863,7 +876,13 @@ int cfget_cfile_block()
|
||||
|
||||
// If we've reached this point, a free Cfile_block could not be found
|
||||
nprintf(("Warning","A free Cfile_block could not be found.\n"));
|
||||
Assert(0); // out of free cfile blocks
|
||||
|
||||
// Dump a list of all opened files
|
||||
mprintf(("Out of cfile blocks! Currently opened files:\n"));
|
||||
dump_opened_files();
|
||||
|
||||
Assertion(false, "There are no more free cfile blocks. This means that there are too many files opened by FSO.\n"
|
||||
"This is probably caused by a programming or scripting error where a file does not get closed."); // out of free cfile blocks
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -941,7 +960,7 @@ int cf_is_valid(CFILE *cfile)
|
||||
// returns: success ==> ptr to CFILE structure.
|
||||
// error ==> NULL
|
||||
//
|
||||
CFILE *cf_open_fill_cfblock(FILE *fp, int type)
|
||||
static CFILE *cf_open_fill_cfblock(const char* source, int line, FILE *fp, int type)
|
||||
{
|
||||
int cfile_block_index;
|
||||
|
||||
@@ -960,6 +979,9 @@ CFILE *cf_open_fill_cfblock(FILE *fp, int type)
|
||||
cfbp->fp = fp;
|
||||
cfbp->dir_type = type;
|
||||
cfbp->max_read_len = 0;
|
||||
|
||||
cfbp->source_file = source;
|
||||
cfbp->line_num = line;
|
||||
|
||||
int pos = ftell(fp);
|
||||
if(pos == -1L)
|
||||
@@ -977,7 +999,7 @@ CFILE *cf_open_fill_cfblock(FILE *fp, int type)
|
||||
// returns: success ==> ptr to CFILE structure.
|
||||
// error ==> NULL
|
||||
//
|
||||
CFILE *cf_open_packed_cfblock(FILE *fp, int type, int offset, int size)
|
||||
static CFILE *cf_open_packed_cfblock(const char* source, int line, FILE *fp, int type, int offset, int size)
|
||||
{
|
||||
// Found it in a pack file
|
||||
int cfile_block_index;
|
||||
@@ -999,6 +1021,9 @@ CFILE *cf_open_packed_cfblock(FILE *fp, int type, int offset, int size)
|
||||
cfbp->dir_type = type;
|
||||
cfbp->max_read_len = 0;
|
||||
|
||||
cfbp->source_file = source;
|
||||
cfbp->line_num = line;
|
||||
|
||||
cf_init_lowlevel_read_code(cfp,offset, size, 0 );
|
||||
|
||||
return cfp;
|
||||
@@ -1014,9 +1039,9 @@ CFILE *cf_open_packed_cfblock(FILE *fp, int type, int offset, int size)
|
||||
// returns: ptr CFILE structure.
|
||||
//
|
||||
#if defined _WIN32
|
||||
CFILE *cf_open_mapped_fill_cfblock(HANDLE hFile, int type)
|
||||
static CFILE *cf_open_mapped_fill_cfblock(const char* source, int line, HANDLE hFile, int type)
|
||||
#elif defined SCP_UNIX
|
||||
CFILE *cf_open_mapped_fill_cfblock(FILE *fp, int type)
|
||||
static CFILE *cf_open_mapped_fill_cfblock(const char* source, int line, FILE *fp, int type)
|
||||
#endif
|
||||
{
|
||||
int cfile_block_index;
|
||||
@@ -1043,6 +1068,9 @@ CFILE *cf_open_mapped_fill_cfblock(FILE *fp, int type)
|
||||
#endif
|
||||
cfbp->dir_type = type;
|
||||
|
||||
cfbp->source_file = source;
|
||||
cfbp->line_num = line;
|
||||
|
||||
cf_init_lowlevel_read_code(cfp, 0, 0, 0 );
|
||||
#if defined _WIN32
|
||||
cfbp->hMapFile = CreateFileMapping(cfbp->hInFile, NULL, PAGE_READONLY, 0, 0, NULL);
|
||||
@@ -1578,7 +1606,7 @@ char *cfgets(char *buf, int n, CFILE *cfile)
|
||||
// CRC code for mission validation. given to us by Kevin Bentley on 7/20/98. Some sort of
|
||||
// checksumming code that he wrote a while ago.
|
||||
#define CRC32_POLYNOMIAL 0xEDB88320
|
||||
uint CRCTable[256];
|
||||
static uint CRCTable[256];
|
||||
|
||||
#define CF_CHKSUM_SAMPLE_SIZE 512
|
||||
|
||||
@@ -1615,7 +1643,7 @@ uint cf_add_chksum_long(uint seed, ubyte *buffer, int size)
|
||||
return crc;
|
||||
}
|
||||
|
||||
void cf_chksum_long_init()
|
||||
static void cf_chksum_long_init()
|
||||
{
|
||||
int i, j;
|
||||
uint crc;
|
||||
@@ -1636,7 +1664,7 @@ void cf_chksum_long_init()
|
||||
|
||||
// single function convenient to use for both short and long checksums
|
||||
// NOTE : only one of chk_short or chk_long must be non-NULL (indicating which checksum to perform)
|
||||
int cf_chksum_do(CFILE *cfile, ushort *chk_short, uint *chk_long, int max_size)
|
||||
static int cf_chksum_do(CFILE *cfile, ushort *chk_short, uint *chk_long, int max_size)
|
||||
{
|
||||
ubyte cf_buffer[CF_CHKSUM_SAMPLE_SIZE];
|
||||
int is_long;
|
||||
|
||||
+6
-2
@@ -129,11 +129,15 @@ int cf_get_dir_type(CFILE *cfile);
|
||||
|
||||
// Opens the file. If no path is given, use the extension to look into the
|
||||
// default path. If mode is NULL, delete the file.
|
||||
CFILE *cfopen(const char *filename, const char *mode, int type = CFILE_NORMAL, int dir_type = CF_TYPE_ANY, bool localize = false);
|
||||
CFILE *_cfopen(const char* source_file, int line, const char *filename, const char *mode,
|
||||
int type = CFILE_NORMAL, int dir_type = CF_TYPE_ANY, bool localize = false);
|
||||
#define cfopen(...) _cfopen(LOCATION, __VA_ARGS__) // Pass source location to the function
|
||||
|
||||
// like cfopen(), but it accepts a fully qualified path only (ie, the result of a cf_find_file_location() call)
|
||||
// NOTE: only supports reading files!!
|
||||
CFILE *cfopen_special(const char *file_path, const char *mode, const int size, const int offset, int dir_type = CF_TYPE_ANY);
|
||||
CFILE *_cfopen_special(const char* source_file, int line, const char *file_path, const char *mode,
|
||||
const int size, const int offset, int dir_type = CF_TYPE_ANY);
|
||||
#define cfopen_special(...) _cfopen_special(LOCATION, __VA_ARGS__) // Pass source location to the function
|
||||
|
||||
// Flush the open file buffer
|
||||
int cflush(CFILE *cfile);
|
||||
|
||||
@@ -39,11 +39,13 @@ typedef struct Cfile_block {
|
||||
int size; // for packed files
|
||||
|
||||
size_t max_read_len; // max read offset, for special error handling
|
||||
|
||||
const char* source_file;
|
||||
int line_num;
|
||||
} Cfile_block;
|
||||
|
||||
#define MAX_CFILE_BLOCKS 64
|
||||
extern Cfile_block Cfile_block_list[MAX_CFILE_BLOCKS];
|
||||
extern CFILE Cfile_list[MAX_CFILE_BLOCKS];
|
||||
|
||||
// Called once to setup the low-level reading code.
|
||||
void cf_init_lowlevel_read_code( CFILE * cfile, int lib_offset, int size, int pos );
|
||||
|
||||
+24
-14
@@ -146,9 +146,7 @@ Flag exe_params[] =
|
||||
{ "-fb_explosions", "Enable Framebuffer Shockwaves", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fb_explosions", },
|
||||
{ "-no_deferred", "Disable Deferred Lighting", true, EASY_DEFAULT_MEM, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_deferred"},
|
||||
{ "-enable_shadows", "Enable Shadows", true, EASY_MEM_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_shadows"},
|
||||
{ "-img2dds", "Compress non-compressed images", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-img2dds", },
|
||||
{ "-no_vsync", "Disable vertical sync", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_vsync", },
|
||||
{ "-no_fps_capping", "Don't limit frames-per-second", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_fps_capping", },
|
||||
{ "-cache_bitmaps", "Cache bitmaps between missions", true, 0, EASY_DEFAULT_MEM, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-cache_bitmaps", },
|
||||
|
||||
{ "-dualscanlines", "Add another pair of scanning lines", true, 0, EASY_DEFAULT, "HUD", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-dualscanlines", },
|
||||
@@ -189,7 +187,6 @@ Flag exe_params[] =
|
||||
{ "-no_glsl", "Disable GLSL (shader) support", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_glsl", },
|
||||
{ "-ati_swap", "Fix colour issues on some ATI cards", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ati_swap", },
|
||||
{ "-no_3d_sound", "Use only 2D/stereo for sound effects", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_3d_sound", },
|
||||
{ "-disable_glsl_model","Don't use shaders for model rendering", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-disable_glsl_model", },
|
||||
{ "-mipmap", "Enable mipmapping", true, 0, EASY_DEFAULT_MEM, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-mipmap", },
|
||||
#ifndef SCP_UNIX
|
||||
{ "-disable_di_mouse", "Don't use DirectInput for mouse control", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-disable_di_mouse", },
|
||||
@@ -200,6 +197,9 @@ Flag exe_params[] =
|
||||
{ "-no_batching", "Disable batched model rendering", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
{ "-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", "", },
|
||||
#ifdef WIN32
|
||||
{ "-fix_registry", "Use a different registry path", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
#endif
|
||||
|
||||
{ "-ingame_join", "Allow in-game joining", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ingame_join", },
|
||||
{ "-voicer", "Enable voice recognition", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-voicer", },
|
||||
@@ -231,6 +231,7 @@ Flag exe_params[] =
|
||||
{ "-profile_frame_time", "Profile engine subsystems", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-profile_frame_timings", },
|
||||
{ "-profile_write_file", "Write profiling information to file", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-profile_write_file", },
|
||||
{ "-no_unfocused_pause","Don't pause if the window isn't focused", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_unfocused_pause", },
|
||||
{ "-benchmark_mode", "Puts the game into benchmark mode", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-benchmark_mode", },
|
||||
};
|
||||
|
||||
// forward declaration
|
||||
@@ -345,12 +346,10 @@ int Cmdline_no_deferred_lighting = 0;
|
||||
|
||||
// Game Speed related
|
||||
cmdline_parm cache_bitmaps_arg("-cache_bitmaps", NULL, AT_NONE); // Cmdline_cache_bitmaps
|
||||
cmdline_parm img2dds_arg("-img2dds", NULL, AT_NONE); // Cmdline_img2dds
|
||||
cmdline_parm no_fpscap("-no_fps_capping", "Don't limit frames-per-second", AT_NONE); // Cmdline_NoFPSCap
|
||||
cmdline_parm no_vsync_arg("-no_vsync", NULL, AT_NONE); // Cmdline_no_vsync
|
||||
|
||||
int Cmdline_cache_bitmaps = 0; // caching of bitmaps between missions (faster loads, can hit swap on reload with <512 Meg RAM though) - taylor
|
||||
int Cmdline_img2dds = 0;
|
||||
int Cmdline_NoFPSCap = 0; // Disable FPS capping - kazan
|
||||
int Cmdline_no_vsync = 0;
|
||||
|
||||
@@ -424,7 +423,6 @@ cmdline_parm noglsl_arg("-no_glsl", NULL, AT_NONE); // Cmdline_noglsl -- disa
|
||||
cmdline_parm mipmap_arg("-mipmap", NULL, AT_NONE); // Cmdline_mipmap
|
||||
cmdline_parm atiswap_arg("-ati_swap", NULL, AT_NONE); // Cmdline_atiswap - Fix ATI color swap issue for screenshots.
|
||||
cmdline_parm no3dsound_arg("-no_3d_sound", NULL, AT_NONE); // Cmdline_no_3d_sound - Disable use of full 3D sounds
|
||||
cmdline_parm no_glsl_models_arg("-disable_glsl_model", NULL, AT_NONE); // Cmdline_no_glsl_model_rendering -- switches model rendering to fixed pipeline
|
||||
cmdline_parm no_di_mouse_arg("-disable_di_mouse", "Disable DirectInput mouse code (Windows only)", AT_NONE); // Cmdline_no_di_mouse -- Disables directinput use for mouse control
|
||||
cmdline_parm no_drawrangeelements("-use_gldrawelements", NULL, AT_NONE); // Cmdline_drawelements -- Uses glDrawElements instead of glDrawRangeElements
|
||||
cmdline_parm keyboard_layout("-keyboard_layout", "Specify keyboard layout (qwertz or azerty)", AT_STRING);
|
||||
@@ -432,6 +430,9 @@ cmdline_parm old_collision_system("-old_collision", NULL, AT_NONE); // Cmdline_o
|
||||
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);
|
||||
#ifdef WIN32
|
||||
cmdline_parm fix_registry("-fix_registry", NULL, AT_NONE);
|
||||
#endif
|
||||
|
||||
int Cmdline_load_all_weapons = 0;
|
||||
int Cmdline_nohtl = 0;
|
||||
@@ -443,13 +444,15 @@ int Cmdline_no_pbo = 0;
|
||||
int Cmdline_noglsl = 0;
|
||||
int Cmdline_ati_color_swap = 0;
|
||||
int Cmdline_no_3d_sound = 0;
|
||||
int Cmdline_no_glsl_model_rendering = 0;
|
||||
int Cmdline_no_di_mouse = 0;
|
||||
int Cmdline_drawelements = 0;
|
||||
char* Cmdline_keyboard_layout = NULL;
|
||||
bool Cmdline_gl_finish = false;
|
||||
bool Cmdline_no_geo_sdr_effects = false;
|
||||
bool Cmdline_set_cpu_affinity = false;
|
||||
#ifdef WIN32
|
||||
bool Cmdline_alternate_registry_path = false;
|
||||
#endif
|
||||
|
||||
// Developer/Testing related
|
||||
cmdline_parm start_mission_arg("-start_mission", "Skip mainhall and run this mission", AT_STRING); // Cmdline_start_mission
|
||||
@@ -479,6 +482,8 @@ cmdline_parm reparse_mainhall_arg("-reparse_mainhall", NULL, AT_NONE); //Cmdline
|
||||
cmdline_parm frame_profile_arg("-profile_frame_time", NULL, AT_NONE); //Cmdline_frame_profile
|
||||
cmdline_parm frame_profile_write_file("-profile_write_file", NULL, AT_NONE); // Cmdline_profile_write_file
|
||||
cmdline_parm no_unfocused_pause_arg("-no_unfocused_pause", NULL, AT_NONE); //Cmdline_no_unfocus_pause
|
||||
cmdline_parm benchmark_mode_arg("-benchmark_mode", NULL, AT_NONE); //Cmdline_benchmark_mode
|
||||
|
||||
|
||||
char *Cmdline_start_mission = NULL;
|
||||
int Cmdline_old_collision_sys = 0;
|
||||
@@ -506,6 +511,7 @@ int Cmdline_reparse_mainhall = 0;
|
||||
bool Cmdline_frame_profile = false;
|
||||
bool Cmdline_profile_write_file = false;
|
||||
bool Cmdline_no_unfocus_pause = false;
|
||||
bool Cmdline_benchmark_mode = false;
|
||||
|
||||
// Other
|
||||
cmdline_parm get_flags_arg("-get_flags", "Output the launcher flags file", AT_NONE);
|
||||
@@ -1539,10 +1545,6 @@ bool SetCmdlineParams()
|
||||
Cmdline_noglsl = 1;
|
||||
}
|
||||
|
||||
if (no_glsl_models_arg.found() ) {
|
||||
Cmdline_no_glsl_model_rendering = 1;
|
||||
}
|
||||
|
||||
if (fxaa_arg.found() ) {
|
||||
Cmdline_fxaa = true;
|
||||
|
||||
@@ -1557,9 +1559,6 @@ bool SetCmdlineParams()
|
||||
Cmdline_no_di_mouse = 1;
|
||||
}
|
||||
|
||||
if ( img2dds_arg.found() )
|
||||
Cmdline_img2dds = 1;
|
||||
|
||||
if ( glow_arg.found() )
|
||||
Cmdline_glow = 0;
|
||||
|
||||
@@ -1627,6 +1626,12 @@ bool SetCmdlineParams()
|
||||
Cmdline_set_cpu_affinity = true;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
if (fix_registry.found()) {
|
||||
Cmdline_alternate_registry_path = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( snd_preload_arg.found() )
|
||||
{
|
||||
Cmdline_snd_preload = 1;
|
||||
@@ -1764,6 +1769,11 @@ bool SetCmdlineParams()
|
||||
{
|
||||
Cmdline_no_unfocus_pause = true;
|
||||
}
|
||||
|
||||
if (benchmark_mode_arg.found())
|
||||
{
|
||||
Cmdline_benchmark_mode = true;
|
||||
}
|
||||
|
||||
//Deprecated flags - CommanderDJ
|
||||
if( deprecated_spec_arg.found() )
|
||||
|
||||
@@ -83,7 +83,6 @@ extern int Cmdline_no_deferred_lighting;
|
||||
|
||||
// Game Speed related
|
||||
extern int Cmdline_cache_bitmaps;
|
||||
extern int Cmdline_img2dds;
|
||||
extern int Cmdline_NoFPSCap;
|
||||
extern int Cmdline_no_vsync;
|
||||
|
||||
@@ -130,13 +129,15 @@ extern int Cmdline_noglsl;
|
||||
extern int Cmdline_mipmap;
|
||||
extern int Cmdline_ati_color_swap;
|
||||
extern int Cmdline_no_3d_sound;
|
||||
extern int Cmdline_no_glsl_model_rendering;
|
||||
extern int Cmdline_no_di_mouse;
|
||||
extern int Cmdline_drawelements;
|
||||
extern char* Cmdline_keyboard_layout;
|
||||
extern bool Cmdline_gl_finish;
|
||||
extern bool Cmdline_no_geo_sdr_effects;
|
||||
extern bool Cmdline_set_cpu_affinity;
|
||||
#ifdef WIN32
|
||||
extern bool Cmdline_alternate_registry_path;
|
||||
#endif
|
||||
|
||||
// Developer/Testing related
|
||||
extern char *Cmdline_start_mission;
|
||||
@@ -161,5 +162,6 @@ extern int Cmdline_reparse_mainhall;
|
||||
extern bool Cmdline_frame_profile;
|
||||
extern bool Cmdline_profile_write_file;
|
||||
extern bool Cmdline_no_unfocus_pause;
|
||||
extern bool Cmdline_benchmark_mode;
|
||||
|
||||
#endif
|
||||
@@ -2257,7 +2257,8 @@ int check_control_used(int id, int key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((Control_config[id].key_id == key) || joy_down_count(Control_config[id].joy_id, 1) || mouse_down_count(1 << Control_config[id].joy_id)) {
|
||||
if ((Control_config[id].key_id == key) || joy_down_count(Control_config[id].joy_id, 1) ||
|
||||
((Control_config[id].joy_id >= 0) && (Control_config[id].joy_id < MOUSE_NUM_BUTTONS) && mouse_down_count(1 << Control_config[id].joy_id))) {
|
||||
//mprintf(("Key used %d", key));
|
||||
control_used(id);
|
||||
return 1;
|
||||
|
||||
@@ -617,7 +617,7 @@ void control_config_common_close()
|
||||
{
|
||||
// only need to worry control presets for now
|
||||
for (auto ii = Control_config_presets.cbegin(); ii != Control_config_presets.cend(); ++ii) {
|
||||
delete * ii;
|
||||
delete[] * ii;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -345,7 +345,7 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
opengl_set_texture_target(GL_TEXTURE_2D);
|
||||
opengl_tcache_get_adjusted_texture_size(g_screenWidth, g_screenHeight, &wp2, &hp2);
|
||||
|
||||
if(!Use_GLSL)
|
||||
if(!is_minimum_GLSL_version())
|
||||
use_shaders = false;
|
||||
|
||||
if(use_shaders) {
|
||||
|
||||
+8
-11
@@ -563,6 +563,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
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;
|
||||
db->fire_timeout = 0; // if not changed, timestamp_elapsed() will return false
|
||||
@@ -703,7 +704,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
// displacement fromt the center of the parent object to the center of the debris piece
|
||||
vec3d world_rotvel, vel_from_rotvel;
|
||||
vm_vec_unrotate ( &world_rotvel, &source_obj->phys_info.rotvel, &source_obj->orient );
|
||||
vm_vec_crossprod ( &vel_from_rotvel, &world_rotvel, &to_center );
|
||||
vm_vec_cross ( &vel_from_rotvel, &world_rotvel, &to_center );
|
||||
vm_vec_scale ( &vel_from_rotvel, DEBRIS_ROTVEL_SCALE);
|
||||
|
||||
vm_vec_add (&obj->phys_info.vel, &radial_vel, &source_obj->phys_info.vel);
|
||||
@@ -897,11 +898,8 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
|
||||
mc.flags = MC_ONLY_SPHERE | MC_CHECK_SPHERELINE;
|
||||
|
||||
SCP_vector<int> submodel_vector;
|
||||
polymodel *pm;
|
||||
polymodel_instance *pmi;
|
||||
|
||||
ship_model_start(pship_obj);
|
||||
|
||||
if (model_collide(&mc)) {
|
||||
|
||||
// Set earliest hit time
|
||||
@@ -915,7 +913,6 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
|
||||
model_get_rotating_submodel_list(&submodel_vector, heavy_obj);
|
||||
|
||||
// Get polymodel and turn off all rotating submodels, collide against only 1 at a time.
|
||||
pm = model_get(Ship_info[Ships[heavy_obj->instance].ship_info_index].model_num);
|
||||
pmi = model_get_instance(Ships[heavy_obj->instance].model_instance_num);
|
||||
|
||||
// turn off all rotating submodels and test for collision
|
||||
@@ -940,10 +937,10 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
|
||||
|
||||
// find the start and end positions of the sphere in submodel RF
|
||||
pmi->submodel[*smv].angs = pmi->submodel[*smv].prev_angs;
|
||||
world_find_model_instance_point(&p0, &light_obj->last_pos, pm, pmi, *smv, &heavy_obj->last_orient, &heavy_obj->last_pos);
|
||||
world_find_model_instance_point(&p0, &light_obj->last_pos, pmi, *smv, &heavy_obj->last_orient, &heavy_obj->last_pos);
|
||||
|
||||
pmi->submodel[*smv].angs = copy_angles;
|
||||
world_find_model_instance_point(&p1, &light_obj->pos, pm, pmi, *smv, &heavy_obj->orient, &heavy_obj->pos);
|
||||
world_find_model_instance_point(&p1, &light_obj->pos, pmi, *smv, &heavy_obj->orient, &heavy_obj->pos);
|
||||
|
||||
mc.p0 = &p0;
|
||||
mc.p1 = &p1;
|
||||
@@ -957,18 +954,18 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
|
||||
|
||||
// set up debris_hit_info common
|
||||
set_hit_struct_info(debris_hit_info, &mc, SUBMODEL_ROT_HIT);
|
||||
model_instance_find_world_point(&debris_hit_info->hit_pos, &mc.hit_point, mc.model_num, mc.model_instance_num, mc.hit_submodel, &heavy_obj->orient, &zero);
|
||||
model_instance_find_world_point(&debris_hit_info->hit_pos, &mc.hit_point, mc.model_instance_num, mc.hit_submodel, &heavy_obj->orient, &zero);
|
||||
|
||||
// set up debris_hit_info for rotating submodel
|
||||
if (debris_hit_info->edge_hit == 0) {
|
||||
model_instance_find_obj_dir(&debris_hit_info->collision_normal, &mc.hit_normal, heavy_obj, mc.hit_submodel);
|
||||
model_instance_find_obj_dir(&debris_hit_info->collision_normal, &mc.hit_normal, mc.model_instance_num, mc.hit_submodel, &heavy_obj->orient);
|
||||
}
|
||||
|
||||
// find position in submodel RF of light object at collison
|
||||
vec3d int_light_pos, diff;
|
||||
vm_vec_sub(&diff, mc.p1, mc.p0);
|
||||
vm_vec_scale_add(&int_light_pos, mc.p0, &diff, mc.hit_dist);
|
||||
model_instance_find_world_point(&debris_hit_info->light_collision_cm_pos, &int_light_pos, mc.model_num, mc.model_instance_num, mc.hit_submodel, &heavy_obj->orient, &zero);
|
||||
model_instance_find_world_point(&debris_hit_info->light_collision_cm_pos, &int_light_pos, mc.model_instance_num, mc.hit_submodel, &heavy_obj->orient, &zero);
|
||||
}
|
||||
}
|
||||
// Don't look at this submodel again
|
||||
@@ -992,7 +989,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
|
||||
|
||||
// get collision normal if not edge hit
|
||||
if (debris_hit_info->edge_hit == 0) {
|
||||
model_instance_find_obj_dir(&debris_hit_info->collision_normal, &mc.hit_normal, heavy_obj, mc.hit_submodel);
|
||||
model_instance_find_obj_dir(&debris_hit_info->collision_normal, &mc.hit_normal, Ships[heavy_obj->instance].model_instance_num, mc.hit_submodel, &heavy_obj->orient);
|
||||
}
|
||||
|
||||
// find position in submodel RF of light object at collison
|
||||
|
||||
@@ -25,6 +25,7 @@ typedef struct debris {
|
||||
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
|
||||
int objnum; // What object this is linked to
|
||||
|
||||
@@ -672,6 +672,10 @@ void event_editor::OnButtonNewEvent()
|
||||
return;
|
||||
}
|
||||
|
||||
// before we do anything, we must check and save off any data from the current event (e.g
|
||||
// the repeat count and interval count)
|
||||
save();
|
||||
|
||||
reset_event(m_num_events++, TVI_LAST);
|
||||
}
|
||||
|
||||
@@ -685,6 +689,11 @@ void event_editor::OnInsert()
|
||||
return;
|
||||
}
|
||||
|
||||
// before we do anything, we must check and save off any data from the current event (e.g
|
||||
// the repeat count and interval count)
|
||||
save();
|
||||
|
||||
|
||||
if(cur_event < 0 || m_num_events == 0)
|
||||
{
|
||||
//There are no events yet, so just create one
|
||||
@@ -750,6 +759,8 @@ void event_editor::reset_event(int num, HTREEITEM after)
|
||||
m_event_tree.item_index = index;
|
||||
m_event_tree.add_operator("do-nothing");
|
||||
|
||||
update_cur_event();
|
||||
|
||||
m_event_tree.SelectItem(h);
|
||||
// GetDlgItem(IDC_CHAIN_DELAY) -> EnableWindow(FALSE);
|
||||
if (num >= MAX_MISSION_EVENTS){
|
||||
|
||||
+94
-96
@@ -18,13 +18,11 @@
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
// English (United States) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -116,7 +114,7 @@ IDB_DATA_95 BITMAP "res\\data95.bmp"
|
||||
// Toolbar
|
||||
//
|
||||
|
||||
IDR_MAINFRAME TOOLBAR 23, 23
|
||||
IDR_MAINFRAME TOOLBAR 23, 23
|
||||
BEGIN
|
||||
BUTTON ID_SELECT
|
||||
BUTTON ID_SELECT_AND_MOVE
|
||||
@@ -152,7 +150,7 @@ END
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDR_MAINMENU MENU
|
||||
IDR_MAINMENU MENU
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
@@ -334,7 +332,7 @@ BEGIN
|
||||
END
|
||||
END
|
||||
|
||||
IDR_MENU_SHIP_POPUP MENU
|
||||
IDR_MENU_SHIP_POPUP MENU
|
||||
BEGIN
|
||||
POPUP "Properties"
|
||||
BEGIN
|
||||
@@ -344,7 +342,7 @@ BEGIN
|
||||
END
|
||||
END
|
||||
|
||||
IDR_MENU_EDIT_POPUP MENU
|
||||
IDR_MENU_EDIT_POPUP MENU
|
||||
BEGIN
|
||||
POPUP "EDIT"
|
||||
BEGIN
|
||||
@@ -369,7 +367,7 @@ BEGIN
|
||||
END
|
||||
END
|
||||
|
||||
IDR_MENU_CAMPAIGN MENU
|
||||
IDR_MENU_CAMPAIGN MENU
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
@@ -391,7 +389,7 @@ BEGIN
|
||||
END
|
||||
END
|
||||
|
||||
IDR_MENU_EDIT_SEXP_TREE MENU
|
||||
IDR_MENU_EDIT_SEXP_TREE MENU
|
||||
BEGIN
|
||||
POPUP "Edit sexp tree"
|
||||
BEGIN
|
||||
@@ -441,7 +439,7 @@ BEGIN
|
||||
END
|
||||
END
|
||||
|
||||
IDR_WING_EDIT_MENU MENU
|
||||
IDR_WING_EDIT_MENU MENU
|
||||
BEGIN
|
||||
POPUP "&Select Wing"
|
||||
BEGIN
|
||||
@@ -449,7 +447,7 @@ BEGIN
|
||||
END
|
||||
END
|
||||
|
||||
IDR_SHIP_EDIT_MENU MENU
|
||||
IDR_SHIP_EDIT_MENU MENU
|
||||
BEGIN
|
||||
POPUP "&Select Ship"
|
||||
BEGIN
|
||||
@@ -457,7 +455,7 @@ BEGIN
|
||||
END
|
||||
END
|
||||
|
||||
IDR_PLAYER_EDIT_MENU MENU
|
||||
IDR_PLAYER_EDIT_MENU MENU
|
||||
BEGIN
|
||||
POPUP "Select Team"
|
||||
BEGIN
|
||||
@@ -470,7 +468,7 @@ BEGIN
|
||||
END
|
||||
END
|
||||
|
||||
IDR_WAYPOINT_PATH_EDIT_MENU MENU
|
||||
IDR_WAYPOINT_PATH_EDIT_MENU MENU
|
||||
BEGIN
|
||||
POPUP "&Select Waypoint Path"
|
||||
BEGIN
|
||||
@@ -478,7 +476,7 @@ BEGIN
|
||||
END
|
||||
END
|
||||
|
||||
IDR_ASTEROID_FIELD_MENU MENU
|
||||
IDR_ASTEROID_FIELD_MENU MENU
|
||||
BEGIN
|
||||
POPUP "Select Field"
|
||||
BEGIN
|
||||
@@ -486,7 +484,7 @@ BEGIN
|
||||
END
|
||||
END
|
||||
|
||||
IDR_CPGN_VIEW_OFF MENU
|
||||
IDR_CPGN_VIEW_OFF MENU
|
||||
BEGIN
|
||||
POPUP "Blah"
|
||||
BEGIN
|
||||
@@ -495,7 +493,7 @@ BEGIN
|
||||
END
|
||||
END
|
||||
|
||||
IDR_CPGN_VIEW_ON MENU
|
||||
IDR_CPGN_VIEW_ON MENU
|
||||
BEGIN
|
||||
POPUP "Blah"
|
||||
BEGIN
|
||||
@@ -511,7 +509,7 @@ END
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
IDR_MAINFRAME ACCELERATORS
|
||||
IDR_MAINFRAME ACCELERATORS
|
||||
BEGIN
|
||||
"1", ID_SPEED1, VIRTKEY, NOINVERT
|
||||
"1", ID_GROUP1, VIRTKEY, CONTROL, NOINVERT
|
||||
@@ -602,7 +600,7 @@ BEGIN
|
||||
"Z", ID_ZOOM_EXTENTS, VIRTKEY, SHIFT, NOINVERT
|
||||
END
|
||||
|
||||
IDR_ACC_CAMPAIGN ACCELERATORS
|
||||
IDR_ACC_CAMPAIGN ACCELERATORS
|
||||
BEGIN
|
||||
"H", ID_ERROR_CHECKER, VIRTKEY, ALT, NOINVERT
|
||||
"N", ID_CPGN_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
|
||||
@@ -617,13 +615,13 @@ END
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUTBOX DIALOG 0, 0, 284, 89
|
||||
IDD_ABOUTBOX DIALOG 0, 0, 284, 89
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About FRED2"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
ICON IDR_MAINFRAME,IDC_STATIC,10,17,20,20,SS_REALSIZEIMAGE
|
||||
LTEXT "FRED2_OPEN - FreeSpace Editor, Version 3.7.3 OpenGL",IDC_STATIC,39,8,184,10,SS_NOPREFIX
|
||||
LTEXT "FRED2_OPEN - FreeSpace Editor, Version 3.7.5 OpenGL",IDC_STATIC,39,8,184,10,SS_NOPREFIX
|
||||
LTEXT "Copyright © 1999 Volition, Inc. All Rights Reserved",IDC_STATIC,39,17,164,8
|
||||
DEFPUSHBUTTON "OK",IDOK,229,7,48,14,WS_GROUP
|
||||
LTEXT """Fred2 is the omega of all giant unwieldy pieces of code. Its big, its horrifying, and it just doesn't care. View it at your own risk."" - Dave Baranec",IDC_STATIC,39,62,238,20
|
||||
@@ -698,7 +696,7 @@ BEGIN
|
||||
GROUPBOX "Message Properties",IDC_STATIC,7,184,184,60
|
||||
END
|
||||
|
||||
IDD_SHIP_GOALS_EDITOR DIALOG 0, 0, 412, 221
|
||||
IDD_SHIP_GOALS_EDITOR DIALOG 0, 0, 412, 221
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Initial Orders"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -882,7 +880,7 @@ BEGIN
|
||||
CONTROL "Mission End to Mainhall",IDC_END_TO_MAINHALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,326,190,142,10
|
||||
END
|
||||
|
||||
IDD_PREFERENCES DIALOG 0, 0, 333, 81
|
||||
IDD_PREFERENCES DIALOG 0, 0, 333, 81
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Preferences"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1017,7 +1015,7 @@ BEGIN
|
||||
LTEXT "Missile bank 4",IDC_STATIC,232,64,46,8
|
||||
END
|
||||
|
||||
IDD_SHIP_MARKINGS DIALOG 0, 0, 252, 140
|
||||
IDD_SHIP_MARKINGS DIALOG 0, 0, 252, 140
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION
|
||||
CAPTION "Ship Markings"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1150,7 +1148,7 @@ BEGIN
|
||||
PUSHBUTTON "Restrict Departure Paths",IDC_RESTRICT_DEPARTURE,160,223,121,14,0,WS_EX_STATICEDGE
|
||||
END
|
||||
|
||||
IDD_OPERATOR_ARGUMENT_TYPES DIALOG 0, 0, 235, 50
|
||||
IDD_OPERATOR_ARGUMENT_TYPES DIALOG 0, 0, 235, 50
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Select Argument Types"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1199,7 +1197,7 @@ BEGIN
|
||||
LTEXT "Set Amount From Variable",IDC_STATIC,179,234,93,10
|
||||
END
|
||||
|
||||
IDD_ORIENT_EDITOR DIALOG 0, 0, 229, 119
|
||||
IDD_ORIENT_EDITOR DIALOG 0, 0, 229, 119
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Object Orientation Editor"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1421,7 +1419,7 @@ BEGIN
|
||||
LTEXT "Delay After Arrival",IDC_STATIC,7,99,57,8
|
||||
END
|
||||
|
||||
IDD_REINFORCEMENT_SELECT DIALOG 0, 0, 156, 132
|
||||
IDD_REINFORCEMENT_SELECT DIALOG 0, 0, 156, 132
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Select Reinforcement Unit"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1431,7 +1429,7 @@ BEGIN
|
||||
PUSHBUTTON "Cancel",IDCANCEL,99,111,50,14
|
||||
END
|
||||
|
||||
IDD_WAYPOINT_PATH_EDITOR DIALOG 0, 0, 145, 29
|
||||
IDD_WAYPOINT_PATH_EDITOR DIALOG 0, 0, 145, 29
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Waypoint Path/Jump Node Editor"
|
||||
MENU IDR_WAYPOINT_PATH_EDIT_MENU
|
||||
@@ -1441,7 +1439,7 @@ BEGIN
|
||||
EDITTEXT IDC_NAME,32,7,106,14,ES_AUTOHSCROLL
|
||||
END
|
||||
|
||||
IDD_WING_CREATE DIALOG 0, 0, 119, 68
|
||||
IDD_WING_CREATE DIALOG 0, 0, 119, 68
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Create Wing"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1492,7 +1490,7 @@ BEGIN
|
||||
LTEXT "Team Color Setting:",IDC_STATIC,16,308,66,8
|
||||
END
|
||||
|
||||
IDD_ASTEROID_EDITOR DIALOG 0, 0, 376, 210
|
||||
IDD_ASTEROID_EDITOR DIALOG 0, 0, 376, 210
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Debris Field Editor"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1590,7 +1588,7 @@ BEGIN
|
||||
LTEXT "Debriefing persona index",IDC_STATIC,148,176,79,8
|
||||
END
|
||||
|
||||
IDD_TEXT_VIEW DIALOG 0, 0, 324, 285
|
||||
IDD_TEXT_VIEW DIALOG 0, 0, 324, 285
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Ship TBL Data"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1655,7 +1653,7 @@ BEGIN
|
||||
CONTROL "Use Cargo Icon",IDC_USE_CARGO_ICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,394,65,10
|
||||
END
|
||||
|
||||
IDD_IGNORE_ORDERS DIALOG 0, 0, 120, 217
|
||||
IDD_IGNORE_ORDERS DIALOG 0, 0, 120, 217
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Ignore Orders"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1705,7 +1703,7 @@ BEGIN
|
||||
COMBOBOX IDC_FAILED_MISSION_TRACK,445,294,80,180,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
IDD_ADJUST_GRID DIALOG 0, 0, 153, 94
|
||||
IDD_ADJUST_GRID DIALOG 0, 0, 153, 94
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Adjust Grid"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1727,7 +1725,7 @@ BEGIN
|
||||
LTEXT "X Level",IDC_STATIC,69,50,25,8
|
||||
END
|
||||
|
||||
IDD_SHIELD_SYS DIALOG 0, 0, 192, 106
|
||||
IDD_SHIELD_SYS DIALOG 0, 0, 192, 106
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Shield System Editor"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1744,7 +1742,7 @@ BEGIN
|
||||
PUSHBUTTON "Cancel",IDCANCEL,134,86,50,14
|
||||
END
|
||||
|
||||
IDD_INITIAL_SHIPS DIALOG 0, 0, 127, 210
|
||||
IDD_INITIAL_SHIPS DIALOG 0, 0, 127, 210
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Initial Ships Allowed"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1834,13 +1832,15 @@ BEGIN
|
||||
CONTROL "Laser Protect Ship",IDC_LASER_PROTECT_SHIP,"Button",BS_3STATE | WS_TABSTOP,12,110,80,8
|
||||
CONTROL "Missile Protect Ship",IDC_MISSILE_PROTECT_SHIP,"Button",BS_3STATE | WS_TABSTOP,12,118,80,8
|
||||
GROUPBOX "Turret Threats",IDC_STATIC,7,83,102,48
|
||||
CONTROL "Does Not Move",IDC_IMMOBILE,"Button",BS_3STATE | WS_TABSTOP,7,274,66,10
|
||||
CONTROL "Cloaked",IDC_CLOAKED,"Button",BS_3STATE | WS_TABSTOP,165,167,42,10
|
||||
CONTROL "Scramble Messages",IDC_SCRAMBLE_MESSAGES,"Button",BS_3STATE | WS_TABSTOP,165,177,79,10
|
||||
CONTROL "No Collisions",IDC_NO_COLLIDE,"Button",BS_3STATE | WS_TABSTOP,165,188,66,10
|
||||
END
|
||||
|
||||
IDD_ADD_VARIABLE DIALOG 0, 0, 422, 102
|
||||
CONTROL "Does Not Move",IDC_IMMOBILE,"Button",BS_3STATE | WS_TABSTOP,7,274,66,10
|
||||
CONTROL "Cloaked",IDC_CLOAKED,"Button",BS_3STATE | WS_TABSTOP,165,167,42,10
|
||||
CONTROL "Scramble Messages",IDC_SCRAMBLE_MESSAGES,"Button",BS_3STATE | WS_TABSTOP,165,177,79,10
|
||||
CONTROL "No Collisions",IDC_NO_COLLIDE,"Button",BS_3STATE | WS_TABSTOP,165,188,66,10
|
||||
CONTROL "No Disabled Self-Destruct",IDC_NO_DISABLED_SELF_DESTRUCT,
|
||||
"Button",BS_3STATE | WS_TABSTOP,165,199,114,10
|
||||
END
|
||||
|
||||
IDD_ADD_VARIABLE DIALOG 0, 0, 422, 102
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Add Variable"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1860,7 +1860,7 @@ BEGIN
|
||||
CONTROL "Network-Variable",IDC_TYPE_NETWORK_VARIABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,137,71,84,11
|
||||
END
|
||||
|
||||
IDD_MODIFY_VARIABLE DIALOG 0, 0, 422, 102
|
||||
IDD_MODIFY_VARIABLE DIALOG 0, 0, 422, 102
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Modify Variable"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1882,7 +1882,7 @@ BEGIN
|
||||
CONTROL "Network-Variable",IDC_TYPE_NETWORK_VARIABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,72,84,11
|
||||
END
|
||||
|
||||
IDD_SPECIAL_DAMAGE DIALOG 0, 0, 234, 129
|
||||
IDD_SPECIAL_DAMAGE DIALOG 0, 0, 234, 129
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Special Explosion"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1908,7 +1908,7 @@ BEGIN
|
||||
LTEXT "Duration (msecs):",IDC_STATIC,30,111,56,8
|
||||
END
|
||||
|
||||
IDD_DUMP_STATS DIALOG 0, 0, 577, 375
|
||||
IDD_DUMP_STATS DIALOG 0, 0, 577, 375
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Mission Stats"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1918,7 +1918,7 @@ BEGIN
|
||||
EDITTEXT IDC_STATS_TEXT,7,7,563,333,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | ES_NUMBER | WS_VSCROLL
|
||||
END
|
||||
|
||||
IDD_SHIP_TEXTURES DIALOG 0, 0, 296, 56
|
||||
IDD_SHIP_TEXTURES DIALOG 0, 0, 296, 56
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Ship Texture Replace"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1928,10 +1928,10 @@ BEGIN
|
||||
PUSHBUTTON "Cancel",IDCANCEL,239,35,50,14
|
||||
LTEXT "Old texture:",IDC_LABEL1,7,7,44,9
|
||||
LTEXT "New texture:",IDC_LABEL2,152,7,44,9
|
||||
COMBOBOX IDC_OLD_TEXTURE_LIST,7,16,137,85,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_OLD_TEXTURE_LIST,7,16,137,85,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
IDD_SPECIAL_HITPOINTS DIALOG 0, 0, 234, 85
|
||||
IDD_SPECIAL_HITPOINTS DIALOG 0, 0, 234, 85
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Special Hitpoints"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1948,7 +1948,7 @@ BEGIN
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,106,10
|
||||
END
|
||||
|
||||
IDD_SET_GLOBAL_SHIP_FLAGS DIALOG 0, 0, 114, 79
|
||||
IDD_SET_GLOBAL_SHIP_FLAGS DIALOG 0, 0, 114, 79
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Set Global Ship Flags"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -1959,7 +1959,7 @@ BEGIN
|
||||
PUSHBUTTON "Global Affected-By-Gravity",IDC_AFFECTED_BY_GRAVITY,7,58,100,14
|
||||
END
|
||||
|
||||
IDD_VOICE_MANAGER DIALOG 0, 0, 407, 218
|
||||
IDD_VOICE_MANAGER DIALOG 0, 0, 407, 218
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Voice Acting Manager"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -2004,7 +2004,7 @@ BEGIN
|
||||
"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,166,159,100,19
|
||||
END
|
||||
|
||||
IDD_BRIEFING_PERSONAS DIALOG 0, 0, 320, 201
|
||||
IDD_BRIEFING_PERSONAS DIALOG 0, 0, 320, 201
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -2013,7 +2013,7 @@ BEGIN
|
||||
PUSHBUTTON "Cancel",IDCANCEL,263,24,50,14
|
||||
END
|
||||
|
||||
IDD_CUSTOM_WING_NAMES DIALOG 0, 0, 390, 54
|
||||
IDD_CUSTOM_WING_NAMES DIALOG 0, 0, 390, 54
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Custom Wing Names"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -2035,7 +2035,7 @@ BEGIN
|
||||
PUSHBUTTON "Cancel",IDCANCEL,333,24,50,14
|
||||
END
|
||||
|
||||
IDD_RESTRICT_PATHS DIALOG 0, 0, 241, 87
|
||||
IDD_RESTRICT_PATHS DIALOG 0, 0, 241, 87
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Restrict Paths"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -2046,7 +2046,7 @@ BEGIN
|
||||
LTEXT "Restrict departure paths to the following:",IDC_RESTRICT_PATHS_LABEL,7,7,127,11
|
||||
END
|
||||
|
||||
IDD_BACKGROUND_CHOOSER DIALOG 0, 0, 152, 45
|
||||
IDD_BACKGROUND_CHOOSER DIALOG 0, 0, 152, 45
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Choose a background"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -2103,8 +2103,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,7,1,000000
|
||||
PRODUCTVERSION 3,7,1,000000
|
||||
FILEVERSION 3,7,1,0
|
||||
PRODUCTVERSION 3,7,1,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -2121,12 +2121,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Volition Inc."
|
||||
VALUE "FileDescription", "Fred 2 Open"
|
||||
VALUE "FileVersion", "3.7.3.000000"
|
||||
VALUE "FileVersion", "3.7.5.000000"
|
||||
VALUE "InternalName", "Fred 2 Open"
|
||||
VALUE "LegalCopyright", "Copyright © 1998"
|
||||
VALUE "OriginalFilename", "fred2.exe"
|
||||
VALUE "ProductName", "Fred 2 Open"
|
||||
VALUE "ProductVersion", "3.7.3"
|
||||
VALUE "ProductVersion", "3.7.5"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
@@ -2142,7 +2142,7 @@ END
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_ABOUTBOX, DIALOG
|
||||
BEGIN
|
||||
@@ -2696,19 +2696,19 @@ IDC_CURSOR2 CURSOR "res\\cursor2.cur"
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDR_MAINFRAME "FRED2_OPEN 3.7.3 - FreeSpace2 Mission Editor\nUntitled\nFRED2\nFreeSpace2 Missions (*.fs2)\n.fs2\nFreeSpace2Mission\nFreeSpace2 Mission"
|
||||
IDR_MAINFRAME "FRED2_OPEN 3.7.5 - FreeSpace2 Mission Editor\nUntitled\nFRED2\nFreeSpace2 Missions (*.fs2)\n.fs2\nFreeSpace2Mission\nFreeSpace2 Mission"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
AFX_IDS_APP_TITLE "FRED2"
|
||||
AFX_IDS_IDLEMESSAGE "For Help, press F1"
|
||||
AFX_IDS_HELPMODEMESSAGE "Select an object on which to get Help"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_FILE_NEW "Create a new campaign\nNew"
|
||||
ID_FILE_OPEN "Open an existing campaign\nOpen"
|
||||
@@ -2721,7 +2721,7 @@ BEGIN
|
||||
ID_FILE_PRINT_PREVIEW "Display full pages\nPrint Preview"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
|
||||
ID_APP_EXIT "Exit the campaign editor\nExit"
|
||||
@@ -2732,7 +2732,7 @@ BEGIN
|
||||
ID_HELP "Display help for current task or command\nHelp"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_FILE_MRU_FILE1 "Open this document"
|
||||
ID_FILE_MRU_FILE2 "Open this document"
|
||||
@@ -2752,18 +2752,18 @@ BEGIN
|
||||
ID_FILE_MRU_FILE16 "Open this document"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
|
||||
ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_EDIT_CLEAR "Erase the selection\nErase"
|
||||
ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
|
||||
@@ -2778,13 +2778,13 @@ BEGIN
|
||||
ID_EDIT_REDO "Redo the previously undone action\nRedo"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
|
||||
ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
AFX_IDS_SCSIZE "Change the window size"
|
||||
AFX_IDS_SCMOVE "Change the window position"
|
||||
@@ -2795,24 +2795,24 @@ BEGIN
|
||||
AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
AFX_IDS_SCRESTORE "Restore the window to normal size"
|
||||
AFX_IDS_SCTASKLIST "Activate Task List"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
AFX_IDS_PREVIEW_CLOSE "Close print preview mode\nCancel Preview"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_FILE_MISSIONNOTES "Displays designer notes and mission properties\nMission Specs"
|
||||
ID_SELECT "Select objects mode\nSelect (S)"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_VIEW_FIGHTERS "Show/Hide Fighter objects"
|
||||
ID_VIEW_CAPITALSHIPS "Show/Hide Capital Ship objects"
|
||||
@@ -2830,7 +2830,7 @@ BEGIN
|
||||
ID_EDITORS_SHIPS "Open ship editor dialog window to edit ship"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_EDITORS_GOALS "Activates Mission Goal Editor\nMission Goal Editor"
|
||||
ID_EDITORS_WAYPOINTS "Activates Waypoint Editor\nWaypoint Editor"
|
||||
@@ -2841,7 +2841,7 @@ BEGIN
|
||||
ID_PROPERTIES_ONE "This is Mike's prompt!"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_INDICATOR_EXT "EXT"
|
||||
ID_INDICATOR_CAPS "CAP"
|
||||
@@ -2855,7 +2855,7 @@ BEGIN
|
||||
ID_INDICATOR_MODIFIED "MODIFIED"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_MISCSTUFF_SHOWSHIPSASICONS "This is the (help?) prompt!"
|
||||
ID_EDIT_POPUP_SHOW_SHIP_MODELS
|
||||
@@ -2864,7 +2864,7 @@ BEGIN
|
||||
"Display ship names and ship types for visible ships"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_ADD_MISSION_TIME "Evaluates to elapsed time into mission in seconds"
|
||||
ID_ADD_EQUALS "Evaluates to true if numbers or objects are the same"
|
||||
@@ -2879,7 +2879,7 @@ BEGIN
|
||||
ID_ADD_FALSE "Evaluates to a boolean value of false"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_EDIT_POPUP_SHOW_COMPASS
|
||||
"Display a 3 dimentional compass in the upper right corner of window"
|
||||
@@ -2893,7 +2893,7 @@ BEGIN
|
||||
ID_ADD_MINUS "Evaluates to difference between first subexpression and remaining subexpressions"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_SHOW_GRID_POSITIONS "Show position on grid for all visible objects"
|
||||
ID_SHOW_COORDINATES "Display the coordinates of objects/waypoints."
|
||||
@@ -2908,7 +2908,7 @@ BEGIN
|
||||
ID_DISSOLVE_WING "Remove selected ships from Wing(s)\nRemove from Wing"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_SELECT_AND_MOVE "Select and Move objects\nSelect and Move (M)"
|
||||
ID_SELECT_AND_ROTATE "Select and Rotate objects\nSelect and Rotate (R)"
|
||||
@@ -2923,7 +2923,7 @@ BEGIN
|
||||
ID_FIND_DISTANCE "Find Distance between two objects\nFind Distance"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_BUTTON32944 "Constrain to YZ axis\nYZ Constraint"
|
||||
ID_BUTTON32945 "Constrain to XY axis\nXY Constraint"
|
||||
@@ -2938,27 +2938,27 @@ BEGIN
|
||||
ID_SHOW_HORIZON "Show the horizon line"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_EDITORS_PLAYER "Edit loadout information for all teams"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_REVERT "Revert changes by reloading mission from last save\nRevert"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_ERROR_CHECKER "Checks campaign for errors"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_LOOKAT_OBJ "Rotate camera around selected object\nRotate around object (Ctrl+V)"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_EDITORS_ADJUST_GRID "Adjust the orientation and level of the grid."
|
||||
ID_EDITORS_SHIELD_SYS "Editor for availability of shield system for ships."
|
||||
@@ -2966,7 +2966,7 @@ BEGIN
|
||||
ID_MARK_WING "Mark entire wing selected object is a member of."
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_CONTROL_OBJ "Movement keys control marked objects instead of camera."
|
||||
ID_CHECKOUT "Checks out the mission from Source Safe"
|
||||
@@ -2974,37 +2974,35 @@ BEGIN
|
||||
ID_AA_GRIDLINES "Toggle Gridlines being drawn anti-aliased or not."
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_FORMAT_FS2_OPEN "Save missions with SCP features"
|
||||
ID_FORMAT_FS2_RETAIL "Save missions compatible with FS2 retail"
|
||||
ID_FORMAT_FS1 "Save missions compatible with FS1 retail"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_FORMAT_FS1_RETAIL "Save missions compatible with FS1 retail"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.K.) resources
|
||||
// English (United Kingdom) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ALT_SHIP_CLASS DIALOG 0, 0, 312, 212
|
||||
IDD_ALT_SHIP_CLASS DIALOG 0, 0, 312, 212
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Alternate Ship Class Editor"
|
||||
FONT 8, "MS Sans Serif"
|
||||
@@ -3031,7 +3029,7 @@ END
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_ALT_SHIP_CLASS, DIALOG
|
||||
BEGIN
|
||||
@@ -3043,7 +3041,7 @@ BEGIN
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.K.) resources
|
||||
#endif // English (United Kingdom) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
+22
-22
@@ -885,12 +885,8 @@ void render_one_model_htl(object *objp)
|
||||
// build flags
|
||||
if ((Show_ship_models || Show_outlines) && ((objp->type == OBJ_SHIP) || (objp->type == OBJ_START))){
|
||||
g3_start_instance_matrix(&Eye_position, &Eye_matrix, 0);
|
||||
|
||||
if (Show_ship_models){
|
||||
j = MR_NORMAL;
|
||||
} else {
|
||||
j = MR_NO_POLYS;
|
||||
}
|
||||
|
||||
j = MR_NORMAL;
|
||||
|
||||
if(Show_dock_points){
|
||||
debug_flags |= MR_DEBUG_BAY_PATHS;
|
||||
@@ -915,17 +911,21 @@ void render_one_model_htl(object *objp)
|
||||
|
||||
model_render_params render_info;
|
||||
|
||||
if (Fred_outline) {
|
||||
render_info.set_color(Fred_outline >> 16, (Fred_outline >> 8) & 0xff, Fred_outline & 0xff);
|
||||
j |= MR_SHOW_OUTLINE_HTL | MR_NO_LIGHTING | MR_NO_POLYS | MR_NO_TEXTURING;
|
||||
}
|
||||
|
||||
render_info.set_flags(j);
|
||||
render_info.set_debug_flags(debug_flags);
|
||||
render_info.set_replacement_textures(Ships[z].ship_replacement_textures);
|
||||
|
||||
if (Fred_outline) {
|
||||
render_info.set_color(Fred_outline >> 16, (Fred_outline >> 8) & 0xff, Fred_outline & 0xff);
|
||||
render_info.set_flags(j | MR_SHOW_OUTLINE_HTL | MR_NO_LIGHTING | MR_NO_POLYS | MR_NO_TEXTURING);
|
||||
model_render_immediate(&render_info, Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos);
|
||||
}
|
||||
|
||||
g3_done_instance(0);
|
||||
model_render_immediate(&render_info, Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos);
|
||||
|
||||
if ( Show_ship_models ) {
|
||||
render_info.set_flags(j);
|
||||
model_render_immediate(&render_info, Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos);
|
||||
}
|
||||
} else {
|
||||
int r = 0, g = 0, b = 0;
|
||||
|
||||
@@ -1140,7 +1140,7 @@ void draw_orient_sphere(object *obj, int r, int g, int b)
|
||||
|
||||
if ((obj->type != OBJ_WAYPOINT) && (obj->type != OBJ_POINT))
|
||||
{
|
||||
flag = (vm_vec_dotprod(&eye_orient.vec.fvec, &obj->orient.vec.fvec) < 0.0f);
|
||||
flag = (vm_vec_dot(&eye_orient.vec.fvec, &obj->orient.vec.fvec) < 0.0f);
|
||||
v1 = v2 = obj->pos;
|
||||
vm_vec_scale_add2(&v1, &obj->orient.vec.fvec, size);
|
||||
vm_vec_scale_add2(&v2, &obj->orient.vec.fvec, size * 1.5f);
|
||||
@@ -1176,7 +1176,7 @@ void draw_orient_sphere2(int col, object *obj, int r, int g, int b)
|
||||
|
||||
if ((obj->type != OBJ_WAYPOINT) && (obj->type != OBJ_POINT))
|
||||
{
|
||||
flag = (vm_vec_dotprod(&eye_orient.vec.fvec, &obj->orient.vec.fvec) < 0.0f);
|
||||
flag = (vm_vec_dot(&eye_orient.vec.fvec, &obj->orient.vec.fvec) < 0.0f);
|
||||
|
||||
v1 = v2 = obj->pos;
|
||||
vm_vec_scale_add2(&v1, &obj->orient.vec.fvec, size);
|
||||
@@ -1373,11 +1373,11 @@ void process_controls(vec3d *pos, matrix *orient, float frametime, int key, int
|
||||
|
||||
vm_angles_2_matrix(&rotmat, &rotangs);
|
||||
if (rotangs.h && Universal_heading)
|
||||
vm_transpose_matrix(orient);
|
||||
vm_transpose(orient);
|
||||
vm_matrix_x_matrix(&newmat, orient, &rotmat);
|
||||
*orient = newmat;
|
||||
if (rotangs.h && Universal_heading)
|
||||
vm_transpose_matrix(orient);
|
||||
vm_transpose(orient);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1659,7 +1659,7 @@ void game_do_frame()
|
||||
leader = &Objects[cur_object_index];
|
||||
leader_old_pos = leader->pos; // save original position
|
||||
leader_orient = leader->orient; // save original orientation
|
||||
vm_copy_transpose_matrix(&leader_transpose, &leader_orient);
|
||||
vm_copy_transpose(&leader_transpose, &leader_orient);
|
||||
|
||||
process_controls(&leader->pos, &leader->orient, f2fl(Frametime), key);
|
||||
vm_vec_sub(&delta_pos, &leader->pos, &leader_old_pos); // get position change
|
||||
@@ -1676,7 +1676,7 @@ void game_do_frame()
|
||||
|
||||
// change rotation matrix to rotate in opposite direction. This rotation
|
||||
// matrix is what the leader ship has rotated by.
|
||||
vm_copy_transpose_matrix(&rot_trans, &view_physics.last_rotmat);
|
||||
vm_copy_transpose(&rot_trans, &view_physics.last_rotmat);
|
||||
|
||||
// get point relative to our point of rotation (make POR the origin). Since
|
||||
// only the leader has been moved yet, and not the objects, we have to use
|
||||
@@ -2027,7 +2027,7 @@ void render_compass(void)
|
||||
|
||||
v.xyz.x = 1.0f;
|
||||
v.xyz.y = v.xyz.z = 0.0f;
|
||||
if (vm_vec_dotprod(&eye, &v) < 0.0f)
|
||||
if (vm_vec_dot(&eye, &v) < 0.0f)
|
||||
gr_set_color(159, 20, 20);
|
||||
else
|
||||
gr_set_color(255, 32, 32);
|
||||
@@ -2035,7 +2035,7 @@ void render_compass(void)
|
||||
|
||||
v.xyz.y = 1.0f;
|
||||
v.xyz.x = v.xyz.z = 0.0f;
|
||||
if (vm_vec_dotprod(&eye, &v) < 0.0f)
|
||||
if (vm_vec_dot(&eye, &v) < 0.0f)
|
||||
gr_set_color(20, 159, 20);
|
||||
else
|
||||
gr_set_color(32, 255, 32);
|
||||
@@ -2043,7 +2043,7 @@ void render_compass(void)
|
||||
|
||||
v.xyz.z = 1.0f;
|
||||
v.xyz.x = v.xyz.y = 0.0f;
|
||||
if (vm_vec_dotprod(&eye, &v) < 0.0f)
|
||||
if (vm_vec_dot(&eye, &v) < 0.0f)
|
||||
gr_set_color(20, 20, 159);
|
||||
else
|
||||
gr_set_color(32, 32, 255);
|
||||
|
||||
@@ -230,7 +230,7 @@ void set_time_compression(float multiplier, float change_time){}
|
||||
fix game_get_overall_frametime() { return 0; }
|
||||
|
||||
//WMC
|
||||
void game_level_init(int seed){}
|
||||
void game_level_init(){}
|
||||
void game_post_level_init(){}
|
||||
camid game_render_frame_setup(){return camid();}
|
||||
void game_render_frame(camid cid){}
|
||||
|
||||
@@ -773,7 +773,7 @@ int drag_rotate_objects()
|
||||
|
||||
leader = &Objects[cur_object_index];
|
||||
leader_orient = leader->orient; // save original orientation
|
||||
vm_copy_transpose_matrix(&leader_transpose, &leader_orient);
|
||||
vm_copy_transpose(&leader_transpose, &leader_orient);
|
||||
|
||||
vm_angles_2_matrix(&rotmat, &a);
|
||||
vm_matrix_x_matrix(&newmat, &leader->orient, &rotmat);
|
||||
@@ -789,7 +789,7 @@ int drag_rotate_objects()
|
||||
|
||||
// change rotation matrix to rotate in opposite direction. This rotation
|
||||
// matrix is what the leader ship has rotated by.
|
||||
vm_copy_transpose_matrix(&rot_trans, &rotmat);
|
||||
vm_copy_transpose(&rot_trans, &rotmat);
|
||||
|
||||
// get point relative to our point of rotation (make POR the origin).
|
||||
vm_vec_sub(&tmpv1, &objp->pos, &leader->pos);
|
||||
|
||||
@@ -135,6 +135,7 @@ int query_ship_name_duplicate(int ship);
|
||||
char *reg_read_string( char *section, char *name, char *default_value );
|
||||
|
||||
extern int Nmodel_num;
|
||||
extern int Nmodel_instance_num;
|
||||
extern matrix Nmodel_orient;
|
||||
extern int Nmodel_bitmap;
|
||||
|
||||
@@ -955,6 +956,7 @@ void clear_mission()
|
||||
|
||||
Nmodel_flags = DEFAULT_NMODEL_FLAGS;
|
||||
Nmodel_num = -1;
|
||||
Nmodel_instance_num = -1;
|
||||
vm_set_identity(&Nmodel_orient);
|
||||
Nmodel_bitmap = -1;
|
||||
|
||||
|
||||
@@ -1724,6 +1724,8 @@ int CFred_mission_save::save_objects()
|
||||
fout(" \"scramble-messages\"");
|
||||
if (!(objp->flags & OF_COLLIDES))
|
||||
fout(" \"no-collide\"");
|
||||
if (shipp->flags2 & SF2_NO_DISABLED_SELF_DESTRUCT)
|
||||
fout(" \"no-disabled-self-destruct\"");
|
||||
fout(" )");
|
||||
}
|
||||
// -----------------------------------------------------------
|
||||
|
||||
@@ -1180,6 +1180,7 @@
|
||||
#define IDC_MISSION_LOG_1ST_TRIGGER 1641
|
||||
#define IDC_MISSION_LOG_LAST_TRIGGER 1642
|
||||
#define IDC_NO_COLLIDE 1643
|
||||
#define IDC_NO_DISABLED_SELF_DESTRUCT 1644
|
||||
#define ID_FILE_MISSIONNOTES 32771
|
||||
#define ID_DUPLICATE 32774
|
||||
#define ID_VIEW_ROTATE 32775
|
||||
|
||||
+48
-18
@@ -74,9 +74,10 @@ void ship_flags_dlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Control(pDX, IDC_HIDE_SHIP_NAME, m_hide_ship_name);
|
||||
DDX_Control(pDX, IDC_DISABLE_ETS, m_disable_ets);
|
||||
DDX_Control(pDX, IDC_CLOAKED, m_cloaked);
|
||||
DDX_Control(pDX, IDC_NO_COLLIDE, m_no_collide);
|
||||
DDX_Control(pDX, IDC_SET_CLASS_DYNAMICALLY, m_set_class_dynamically);
|
||||
DDX_Control(pDX, IDC_SCRAMBLE_MESSAGES, m_scramble_messages);
|
||||
DDX_Control(pDX, IDC_NO_COLLIDE, m_no_collide);
|
||||
DDX_Control(pDX, IDC_NO_DISABLED_SELF_DESTRUCT, m_no_disabled_self_destruct);
|
||||
//}}AFX_DATA_MAP
|
||||
|
||||
if (pDX->m_bSaveAndValidate) { // get dialog control values
|
||||
@@ -142,6 +143,7 @@ BEGIN_MESSAGE_MAP(ship_flags_dlg, CDialog)
|
||||
ON_BN_CLICKED(IDC_CLOAKED, OnCloaked)
|
||||
ON_BN_CLICKED(IDC_SCRAMBLE_MESSAGES, OnScrambleMessages)
|
||||
ON_BN_CLICKED(IDC_NO_COLLIDE, OnNoCollide)
|
||||
ON_BN_CLICKED(IDC_NO_DISABLED_SELF_DESTRUCT, OnNoDisabledSelfDestruct)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
@@ -162,7 +164,7 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
int hidden_from_sensors = 0, primitive_sensors = 0, no_subspace_drive = 0, affected_by_gravity = 0;
|
||||
int toggle_subsystem_scanning = 0, scannable = 0, kamikaze = 0, no_dynamic = 0, red_alert_carry = 0;
|
||||
int special_warpin = 0, disable_messages = 0, guardian = 0, vaporize = 0, stealth = 0, friendly_stealth_invisible = 0;
|
||||
int no_death_scream = 0, always_death_scream = 0, scramble_messages = 0;
|
||||
int no_death_scream = 0, always_death_scream = 0, scramble_messages = 0, no_disabled_self_destruct = 0;
|
||||
int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0, no_collide = 0;
|
||||
|
||||
object *objp;
|
||||
@@ -213,6 +215,7 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
cloaked = (shipp->flags2 & SF2_CLOAKED) ? 1 : 0;
|
||||
scramble_messages = (shipp->flags2 & SF2_SCRAMBLE_MESSAGES) ? 1 : 0;
|
||||
no_collide = (objp->flags & OF_COLLIDES) ? 0 : 1;
|
||||
no_disabled_self_destruct = (shipp->flags2 & SF2_NO_DISABLED_SELF_DESTRUCT) ? 1 : 0;
|
||||
|
||||
destroy_before_mission = (shipp->flags & SF_KILL_BEFORE_MISSION) ? 1 : 0;
|
||||
m_destroy_value.init(shipp->final_death_time);
|
||||
@@ -274,6 +277,7 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
cloaked = tristate_set(shipp->flags2 & SF2_CLOAKED, cloaked);
|
||||
scramble_messages = tristate_set(shipp->flags2 & SF2_SCRAMBLE_MESSAGES, scramble_messages);
|
||||
no_collide = tristate_set(!(objp->flags & OF_COLLIDES), no_collide);
|
||||
no_disabled_self_destruct = tristate_set(shipp->flags2 & SF2_NO_DISABLED_SELF_DESTRUCT, no_disabled_self_destruct);
|
||||
|
||||
// check the final death time and set the internal variable according to whether or not
|
||||
// the final_death_time is set. Also, the value in the edit box must be set if all the
|
||||
@@ -349,6 +353,7 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
m_cloaked.SetCheck(cloaked);
|
||||
m_scramble_messages.SetCheck(scramble_messages);
|
||||
m_no_collide.SetCheck(no_collide);
|
||||
m_no_disabled_self_destruct.SetCheck(no_disabled_self_destruct);
|
||||
|
||||
m_kdamage.setup(IDC_KDAMAGE, this);
|
||||
m_destroy_value.setup(IDC_DESTROY_VALUE, this);
|
||||
@@ -966,22 +971,6 @@ void ship_flags_dlg::update_ship(int shipnum)
|
||||
break;
|
||||
}
|
||||
|
||||
switch (m_no_collide.GetCheck()) {
|
||||
case 1:
|
||||
if ( objp->flags & OF_COLLIDES )
|
||||
set_modified();
|
||||
|
||||
objp->flags &= ~OF_COLLIDES;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
if (!(objp->flags & OF_COLLIDES))
|
||||
set_modified();
|
||||
|
||||
objp->flags |= OF_COLLIDES;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (m_guardian.GetCheck()) {
|
||||
case 1:
|
||||
if ( !(shipp->ship_guardian_threshold) )
|
||||
@@ -1062,6 +1051,38 @@ void ship_flags_dlg::update_ship(int shipnum)
|
||||
break;
|
||||
}
|
||||
|
||||
switch (m_no_collide.GetCheck()) {
|
||||
case 1:
|
||||
if (objp->flags & OF_COLLIDES)
|
||||
set_modified();
|
||||
|
||||
objp->flags &= ~OF_COLLIDES;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
if (!(objp->flags & OF_COLLIDES))
|
||||
set_modified();
|
||||
|
||||
objp->flags |= OF_COLLIDES;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (m_no_disabled_self_destruct.GetCheck()) {
|
||||
case 1:
|
||||
if (!(shipp->flags2 & SF2_NO_DISABLED_SELF_DESTRUCT))
|
||||
set_modified();
|
||||
|
||||
shipp->flags2 |= SF2_NO_DISABLED_SELF_DESTRUCT;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
if (shipp->flags2 & SF2_NO_DISABLED_SELF_DESTRUCT)
|
||||
set_modified();
|
||||
|
||||
shipp->flags2 &= ~SF2_NO_DISABLED_SELF_DESTRUCT;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
shipp->respawn_priority = 0;
|
||||
if(The_mission.game_type & MISSION_TYPE_MULTI) {
|
||||
@@ -1440,3 +1461,12 @@ void ship_flags_dlg::OnNoCollide()
|
||||
m_no_collide.SetCheck(1);
|
||||
}
|
||||
}
|
||||
|
||||
void ship_flags_dlg::OnNoDisabledSelfDestruct()
|
||||
{
|
||||
if (m_no_disabled_self_destruct.GetCheck() == 1) {
|
||||
m_no_disabled_self_destruct.SetCheck(0);
|
||||
} else {
|
||||
m_no_disabled_self_destruct.SetCheck(1);
|
||||
}
|
||||
}
|
||||
@@ -65,9 +65,10 @@ public:
|
||||
CButton m_hide_ship_name;
|
||||
CButton m_disable_ets;
|
||||
CButton m_cloaked;
|
||||
CButton m_no_collide;
|
||||
CButton m_set_class_dynamically;
|
||||
CButton m_scramble_messages;
|
||||
CButton m_no_collide;
|
||||
CButton m_no_disabled_self_destruct;
|
||||
|
||||
CSpinButtonCtrl m_destroy_spin;
|
||||
numeric_edit_control m_kdamage;
|
||||
@@ -128,6 +129,7 @@ protected:
|
||||
afx_msg void OnCloaked();
|
||||
afx_msg void OnScrambleMessages();
|
||||
afx_msg void OnNoCollide();
|
||||
afx_msg void OnNoDisabledSelfDestruct();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
+10
-11
@@ -405,7 +405,7 @@ void wing_editor::initialize_data_safe(int full_update)
|
||||
for (i=0; i<Wings[cur_wing].wave_count; i++)
|
||||
ptr->AddString(Ships[Wings[cur_wing].ship_index[i]].ship_name);
|
||||
|
||||
m_threshold_spin.SetRange(0, (short) Wings[cur_wing].wave_count - 1);
|
||||
m_threshold_spin.SetRange(0, static_cast<short>(calc_max_wave_treshold()));
|
||||
for (i=0; i<Num_reinforcements; i++)
|
||||
if (!stricmp(Reinforcements[i].name, Wings[cur_wing].name))
|
||||
break;
|
||||
@@ -754,16 +754,8 @@ void wing_editor::update_data_safe()
|
||||
if (cur_wing < 0)
|
||||
return;
|
||||
|
||||
if (m_threshold >= Wings[cur_wing].wave_count) {
|
||||
m_threshold = Wings[cur_wing].wave_count - 1;
|
||||
if (!bypass_errors) {
|
||||
sprintf(buf, "Wave threshold is set too high. Value has been lowered to %d", (int) m_threshold);
|
||||
MessageBox(buf);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_threshold + Wings[cur_wing].wave_count > MAX_SHIPS_PER_WING) {
|
||||
m_threshold = MAX_SHIPS_PER_WING - Wings[cur_wing].wave_count;
|
||||
if (m_threshold > calc_max_wave_treshold()) {
|
||||
m_threshold = calc_max_wave_treshold();
|
||||
if (!bypass_errors) {
|
||||
sprintf(buf, "Wave threshold is set too high. Value has been lowered to %d", (int) m_threshold);
|
||||
MessageBox(buf);
|
||||
@@ -1359,4 +1351,11 @@ void wing_editor::OnRestrictDeparture()
|
||||
dlg.m_path_mask = &Wings[cur_wing].departure_path_mask;
|
||||
|
||||
dlg.DoModal();
|
||||
}
|
||||
|
||||
int wing_editor::calc_max_wave_treshold()
|
||||
{
|
||||
const int treshold1 = Wings[cur_wing].wave_count - 1; // At least 1 ship must have died before allowing respawn
|
||||
const int treshold2 = MAX_SHIPS_PER_WING - Wings[cur_wing].wave_count; // Maximum MAX_SHIPS_PER_WING ships can be alive at any given time
|
||||
return min(treshold1, treshold2);
|
||||
}
|
||||
@@ -106,4 +106,7 @@ protected:
|
||||
afx_msg void OnRestrictDeparture();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
// Aux functions
|
||||
int calc_max_wave_treshold();
|
||||
};
|
||||
+18
-125
@@ -311,8 +311,6 @@ int last_single_step=0;
|
||||
int game_zbuffer = 1;
|
||||
static int Game_paused;
|
||||
|
||||
int Game_level_seed;
|
||||
|
||||
#define EXPIRE_BAD_CHECKSUM 1
|
||||
#define EXPIRE_BAD_TIME 2
|
||||
|
||||
@@ -949,28 +947,18 @@ uint load_post_level_init;
|
||||
*
|
||||
* @return 0 on failure, 1 on success
|
||||
*/
|
||||
void game_level_init(int seed)
|
||||
void game_level_init()
|
||||
{
|
||||
game_busy( NOX("** starting game_level_init() **") );
|
||||
load_gl_init = (uint) time(NULL);
|
||||
// seed the random number generator
|
||||
if ( seed == -1 ) {
|
||||
// if no seed was passed, seed the generator either from the time value, or from the
|
||||
// netgame security flags -- ensures that all players in multiplayer game will have the
|
||||
// same randon number sequence (with static rand functions)
|
||||
if ( Game_mode & GM_NORMAL ) {
|
||||
Game_level_seed = (int) time(NULL);
|
||||
} else {
|
||||
Game_level_seed = Netgame.security;
|
||||
}
|
||||
} else {
|
||||
Assert( !(Game_mode & GM_MULTIPLAYER) );
|
||||
Game_level_seed = seed;
|
||||
}
|
||||
srand( Game_level_seed );
|
||||
|
||||
// semirand function needs to get re-initted every time in multiplayer
|
||||
if ( Game_mode & GM_MULTIPLAYER ){
|
||||
// seed the random number generator in multiplayer
|
||||
if ( Game_mode & GM_MULTIPLAYER ) {
|
||||
// seed the generator from the netgame security flags -- ensures that all players in
|
||||
// multiplayer will have the same random number sequence (with static rand functions)
|
||||
srand( Netgame.security );
|
||||
|
||||
// semirand function needs to get re-initted every time in multiplayer
|
||||
init_semirand();
|
||||
}
|
||||
|
||||
@@ -1616,8 +1604,6 @@ DCF(show_cpu,"Toggles showing cpu usage")
|
||||
|
||||
#endif
|
||||
|
||||
int Game_init_seed;
|
||||
|
||||
DCF(use_joy_mouse,"Makes joystick move mouse cursor")
|
||||
{
|
||||
bool process = true;
|
||||
@@ -1754,8 +1740,8 @@ void game_init()
|
||||
// Moved from rand32, if we're gonna break, break immediately.
|
||||
Assert(RAND_MAX == 0x7fff || RAND_MAX >= 0x7ffffffd);
|
||||
// seed the random number generator
|
||||
Game_init_seed = (int) time(NULL);
|
||||
srand( Game_init_seed );
|
||||
int game_init_seed = (int) time(NULL);
|
||||
srand( game_init_seed );
|
||||
|
||||
Framerate_delay = 0;
|
||||
|
||||
@@ -3897,97 +3883,6 @@ void john_debug_stuff(vec3d *eye_pos, matrix *eye_orient)
|
||||
}
|
||||
#endif
|
||||
|
||||
// following function for dumping frames for purposes of building trailers.
|
||||
#ifndef NDEBUG
|
||||
|
||||
// function to toggle state of dumping every frame into PCX when playing the game
|
||||
DCF(dump_frames, "Toggles On/off frame dumping at 15 hz")
|
||||
{
|
||||
if ( Debug_dump_frames == 0 ) {
|
||||
// Turn it on
|
||||
Debug_dump_frames = 15;
|
||||
Debug_dump_trigger = 0;
|
||||
gr_dump_frame_start( Debug_dump_frame_num, DUMP_BUFFER_NUM_FRAMES );
|
||||
dc_printf( "Frame dumping at 15 hz is now ON\n" );
|
||||
} else {
|
||||
// Turn it off
|
||||
Debug_dump_frames = 0;
|
||||
Debug_dump_trigger = 0;
|
||||
gr_dump_frame_stop();
|
||||
dc_printf( "Frame dumping is now OFF\n" );
|
||||
}
|
||||
}
|
||||
|
||||
DCF(dump_frames_trigger, "Starts/stop frame dumping at 15 hz")
|
||||
{
|
||||
if ( Debug_dump_frames == 0 ) {
|
||||
// Turn it on
|
||||
Debug_dump_frames = 15;
|
||||
Debug_dump_trigger = 1;
|
||||
gr_dump_frame_start( Debug_dump_frame_num, DUMP_BUFFER_NUM_FRAMES );
|
||||
dc_printf( "Frame dumping at 15 hz is now ON\n" );
|
||||
} else {
|
||||
// Turn it off
|
||||
Debug_dump_frames = 0;
|
||||
Debug_dump_trigger = 0;
|
||||
gr_dump_frame_stop();
|
||||
dc_printf( "Frame dumping is now OFF\n" );
|
||||
}
|
||||
}
|
||||
|
||||
DCF(dump_frames30, "Starts/stop frame dumping at 30 hz")
|
||||
{
|
||||
if ( Debug_dump_frames == 0 ) {
|
||||
// Turn it on
|
||||
Debug_dump_frames = 30;
|
||||
Debug_dump_trigger = 0;
|
||||
gr_dump_frame_start( Debug_dump_frame_num, DUMP_BUFFER_NUM_FRAMES );
|
||||
dc_printf( "Frame dumping at 30 hz is now ON\n" );
|
||||
} else {
|
||||
// Turn it off
|
||||
Debug_dump_frames = 0;
|
||||
Debug_dump_trigger = 0;
|
||||
gr_dump_frame_stop();
|
||||
dc_printf( "Frame dumping is now OFF\n" );
|
||||
}
|
||||
}
|
||||
|
||||
DCF(dump_frames30_trigger, "Starts/stop frame dumping at 30 hz")
|
||||
{
|
||||
if ( Debug_dump_frames == 0 ) {
|
||||
// Turn it on
|
||||
Debug_dump_frames = 30;
|
||||
Debug_dump_trigger = 1;
|
||||
gr_dump_frame_start( Debug_dump_frame_num, DUMP_BUFFER_NUM_FRAMES );
|
||||
dc_printf( "Triggered frame dumping at 30 hz is now ON\n" );
|
||||
} else {
|
||||
// Turn it off
|
||||
Debug_dump_frames = 0;
|
||||
Debug_dump_trigger = 0;
|
||||
gr_dump_frame_stop();
|
||||
dc_printf( "Triggered frame dumping is now OFF\n" );
|
||||
}
|
||||
}
|
||||
|
||||
void game_maybe_dump_frame()
|
||||
{
|
||||
if ( !Debug_dump_frames ){
|
||||
return;
|
||||
}
|
||||
|
||||
if( Debug_dump_trigger && !keyd_pressed[KEY_Q] ){
|
||||
return;
|
||||
}
|
||||
|
||||
game_stop_time();
|
||||
|
||||
gr_dump_frame();
|
||||
Debug_dump_frame_num++;
|
||||
|
||||
game_start_time();
|
||||
}
|
||||
#endif
|
||||
|
||||
extern int Player_dead_state;
|
||||
|
||||
// Flip the page and time how long it took.
|
||||
@@ -4448,7 +4343,6 @@ void game_frame(bool paused)
|
||||
}
|
||||
#endif
|
||||
// start timing frame
|
||||
timing_frame_start();
|
||||
profile_begin("Main Frame");
|
||||
|
||||
DEBUG_GET_TIME( total_time1 )
|
||||
@@ -4613,11 +4507,7 @@ void game_frame(bool paused)
|
||||
|
||||
// maybe render and process the dead popup
|
||||
game_maybe_do_dead_popup(flFrametime);
|
||||
|
||||
// start timing frame
|
||||
timing_frame_stop();
|
||||
// timing_display(30, 10);
|
||||
|
||||
|
||||
// If a regular popup is active, don't flip (popup code flips)
|
||||
if( !popup_running_state() ){
|
||||
DEBUG_GET_TIME( flip_time1 )
|
||||
@@ -4625,9 +4515,6 @@ void game_frame(bool paused)
|
||||
DEBUG_GET_TIME( flip_time2 )
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
game_maybe_dump_frame(); // used to dump pcx files for building trailers
|
||||
#endif
|
||||
} else {
|
||||
game_show_standalone_framerate();
|
||||
}
|
||||
@@ -4871,7 +4758,9 @@ void game_set_frametime(int state)
|
||||
Last_frame_timestamp = timestamp();
|
||||
|
||||
flFrametime = f2fl(Frametime);
|
||||
timestamp_inc(flFrametime);
|
||||
|
||||
auto frametime_ms = f2i(fixmul(Frametime, F1_0 * TIMESTAMP_FREQUENCY));
|
||||
timestamp_inc(frametime_ms);
|
||||
|
||||
// wrap overall frametime if needed
|
||||
if ( FrametimeOverall > (INT_MAX - F1_0) )
|
||||
@@ -5764,6 +5653,10 @@ void game_leave_state( int old_state, int new_state )
|
||||
snd_aav_init();
|
||||
|
||||
freespace_stop_mission();
|
||||
|
||||
if (Cmdline_benchmark_mode) {
|
||||
gameseq_post_event( GS_EVENT_QUIT_GAME );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ void game_unpause();
|
||||
//WMC - Stuff for scripting, these make the game go
|
||||
extern camid Main_camera;
|
||||
|
||||
extern void game_level_init(int seed = -1);
|
||||
extern void game_level_init();
|
||||
extern void game_post_level_init();
|
||||
extern camid game_render_frame_setup();
|
||||
extern void game_render_frame(camid cid);
|
||||
|
||||
@@ -336,8 +336,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,7,3,000000
|
||||
PRODUCTVERSION 3,7,3,000000
|
||||
FILEVERSION 3,7,5,000000
|
||||
PRODUCTVERSION 3,7,5,000000
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -354,12 +354,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Volition Inc."
|
||||
VALUE "FileDescription", "FreeSpace 2 Open"
|
||||
VALUE "FileVersion", "3.7.3.000000"
|
||||
VALUE "FileVersion", "3.7.5.000000"
|
||||
VALUE "InternalName", "FreeSpace 2 Open"
|
||||
VALUE "LegalCopyright", "Copyright © 1998"
|
||||
VALUE "OriginalFilename", "fs2.exe"
|
||||
VALUE "ProductName", "FreeSpace 2 Open"
|
||||
VALUE "ProductVersion", "3.7.3"
|
||||
VALUE "ProductVersion", "3.7.5"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
//Struct used to hold data about file defaults
|
||||
typedef struct def_file
|
||||
{
|
||||
char* filename;
|
||||
char *contents;
|
||||
const char* filename;
|
||||
const char *contents;
|
||||
} def_file;
|
||||
|
||||
//:PART 1:
|
||||
@@ -100,7 +100,7 @@ def_file Default_files[] =
|
||||
static int Num_default_files = sizeof(Default_files) / sizeof(def_file);
|
||||
//**********
|
||||
|
||||
char *defaults_get_file(char *filename)
|
||||
const char *defaults_get_file(const char *filename)
|
||||
{
|
||||
for(int i = 0; i < Num_default_files; i++)
|
||||
{
|
||||
@@ -1448,7 +1448,7 @@ char* Default_main_vertex_shader =
|
||||
" #endif\n"
|
||||
" #ifdef FLAG_ENV_MAP\n"
|
||||
" // Environment mapping reflection vector.\n"
|
||||
" envReflect = reflect(position.xyz, normal);\n"
|
||||
" envReflect = reflect(normalize(position.xyz), normal);\n"
|
||||
" envReflect = vec3(envMatrix * vec4(envReflect, 0.0));\n"
|
||||
" envReflect = normalize(envReflect);\n"
|
||||
" #endif\n"
|
||||
@@ -1467,7 +1467,7 @@ char* Default_main_vertex_shader =
|
||||
" gl_ClipVertex = (gl_ModelViewMatrix * orient * vertex);\n"
|
||||
"}";
|
||||
|
||||
char *Default_main_fragment_shader =
|
||||
char *Default_main_fragment_shader =
|
||||
"#extension GL_EXT_texture_array : enable\n"
|
||||
"#ifdef FLAG_LIGHT\n"
|
||||
"uniform int n_lights;\n"
|
||||
@@ -1510,6 +1510,7 @@ char *Default_main_fragment_shader =
|
||||
"#ifdef FLAG_TEAMCOLOR\n"
|
||||
"uniform vec3 base_color;\n"
|
||||
"uniform vec3 stripe_color;\n"
|
||||
"uniform bool team_glow_enabled;\n"
|
||||
"vec2 teamMask = vec2(0.0, 0.0);\n"
|
||||
"#endif\n"
|
||||
"#ifdef FLAG_MISC_MAP\n"
|
||||
@@ -1535,7 +1536,7 @@ char *Default_main_fragment_shader =
|
||||
"varying vec4 position;\n"
|
||||
"varying vec3 lNormal;\n"
|
||||
"\n"
|
||||
"#if SHADER_MODEL == 2\n"
|
||||
"#if __VERSION__ == 120\n"
|
||||
" #define MAX_LIGHTS 2\n"
|
||||
"#else\n"
|
||||
" #define MAX_LIGHTS 8\n"
|
||||
@@ -1707,8 +1708,8 @@ char *Default_main_fragment_shader =
|
||||
"\n"
|
||||
"#ifdef FLAG_MISC_MAP\n"
|
||||
" #ifdef FLAG_TEAMCOLOR\n"
|
||||
" vec2 teamMask = vec2(0.0, 0.0);\n"
|
||||
" teamMask = texture2D(sMiscmap, texCoord).rg;\n"
|
||||
" vec4 teamMask = vec4(0.0, 0.0, 0.0, 0.0);\n"
|
||||
" teamMask = texture2D(sMiscmap, texCoord);\n"
|
||||
" vec3 base = base_color - vec3(0.5);\n"
|
||||
" vec3 stripe = stripe_color - vec3(0.5);\n"
|
||||
" baseColor.rgb += (base * teamMask.x) + (stripe * teamMask.y);\n"
|
||||
@@ -1726,7 +1727,7 @@ char *Default_main_fragment_shader =
|
||||
" float dist;\n"
|
||||
" #pragma optionNV unroll all\n"
|
||||
" for (int i = 0; i < MAX_LIGHTS; ++i) {\n"
|
||||
" #if SHADER_MODEL > 2\n"
|
||||
" #if __VERSION__ > 120\n"
|
||||
" if (i > n_lights)\n"
|
||||
" break;\n"
|
||||
" #endif\n"
|
||||
@@ -1736,7 +1737,7 @@ char *Default_main_fragment_shader =
|
||||
" lightDir = normalize(gl_LightSource[i].position.xyz);\n"
|
||||
" float attenuation = 1.0;\n"
|
||||
" #ifndef FLAG_DEFERRED\n"
|
||||
" #if SHADER_MODEL > 2\n"
|
||||
" #if __VERSION__ > 120\n"
|
||||
" if (gl_LightSource[i].position.w == 1.0) {\n"
|
||||
" #else\n"
|
||||
" if (gl_LightSource[i].position.w == 1.0 && i != 0) {\n"
|
||||
@@ -1744,7 +1745,7 @@ char *Default_main_fragment_shader =
|
||||
" // Positional light source\n"
|
||||
" dist = distance(gl_LightSource[i].position.xyz, position.xyz);\n"
|
||||
" lightDir = (gl_LightSource[i].position.xyz - position.xyz);\n"
|
||||
" #if SHADER_MODEL > 2\n"
|
||||
" #if __VERSION__ > 120\n"
|
||||
" if (gl_LightSource[i].spotCutoff < 91.0) { // Tube light\n"
|
||||
" float beamlength = length(gl_LightSource[i].spotDirection);\n"
|
||||
" vec3 beamDir = normalize(gl_LightSource[i].spotDirection);\n"
|
||||
@@ -1789,7 +1790,14 @@ char *Default_main_fragment_shader =
|
||||
"#endif\n"
|
||||
"\n"
|
||||
"#ifdef FLAG_GLOW_MAP\n"
|
||||
" baseColor.rgb += texture2D(sGlowmap, texCoord).rgb * GLOW_MAP_INTENSITY;\n"
|
||||
" vec3 glowColor = texture2D(sGlowmap, texCoord).rgb;\n"
|
||||
" #ifdef FLAG_MISC_MAP\n"
|
||||
" #ifdef FLAG_TEAMCOLOR\n"
|
||||
" float glowColorLuminance = dot(glowColor, vec3(0.299, 0.587, 0.114));\n"
|
||||
" glowColor = team_glow_enabled ? mix((base * teamMask.b) + (stripe * teamMask.a), glowColor, clamp(glowColorLuminance - teamMask.b - teamMask.a, 0.0, 1.0)) : glowColor;\n"
|
||||
" #endif\n"
|
||||
" #endif\n"
|
||||
" baseColor.rgb += glowColor * GLOW_MAP_INTENSITY;\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
"#ifdef FLAG_FOG\n"
|
||||
@@ -1896,14 +1904,6 @@ char* Default_fxaa_fragment_shader =
|
||||
"#extension GL_EXT_gpu_shader4 : enable\n"
|
||||
"#define FXAA_EARLY_EXIT 1\n"
|
||||
"#define FXAA_DISCARD 1\n"
|
||||
"#if SHADER_MODEL == 2\n"
|
||||
" #define FXAA_GLSL_120 1\n"
|
||||
" #define FXAA_GLSL_130 0\n"
|
||||
"#endif\n"
|
||||
"#if SHADER_MODEL > 2\n"
|
||||
" #define FXAA_GLSL_120 0\n"
|
||||
" #define FXAA_GLSL_130 1\n"
|
||||
"#endif\n"
|
||||
"#ifndef FXAA_FAST_PIXEL_OFFSET\n"
|
||||
" #ifdef GL_EXT_gpu_shader4\n"
|
||||
" #define FXAA_FAST_PIXEL_OFFSET 1\n"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#define __DEF_FILES_H_
|
||||
|
||||
//Used to retrieve pointer to file data from def_files.cpp
|
||||
char *defaults_get_file(char *filename);
|
||||
const char *defaults_get_file(const char *filename);
|
||||
|
||||
//WMC -
|
||||
//There are three parts to adding a file
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/version.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace version
|
||||
{
|
||||
bool check_at_least(int major, int minor, int build, int revision)
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#define FS_VERSION_MAJOR 3 // major version
|
||||
#define FS_VERSION_MINOR 7 // increase by 1 for minor revs
|
||||
#define FS_VERSION_BUILD 3 // bugfix release
|
||||
#define FS_VERSION_BUILD 5 // bugfix release
|
||||
#define FS_VERSION_REVIS 000000 // SVN revision
|
||||
//#define FS_VERSION_IDENT NOX("custom") // special build release identifier, must be a string (don't define unless it's supposed to be used!!)
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <queue>
|
||||
#include <deque>
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -849,7 +849,6 @@ static bool gr_init_sub(int mode, int width, int height, int depth, float center
|
||||
gr_screen.bits_per_pixel = depth;
|
||||
gr_screen.bytes_per_pixel= depth / 8;
|
||||
gr_screen.rendering_to_texture = -1;
|
||||
gr_screen.recording_state_block = false;
|
||||
gr_screen.envmap_render_target = -1;
|
||||
gr_screen.mode = mode;
|
||||
gr_screen.res = res;
|
||||
@@ -1740,7 +1739,7 @@ void poly_list::allocate(int _verts)
|
||||
tsb = (tsb_t*)vm_malloc(sizeof(tsb_t) * _verts);
|
||||
}
|
||||
|
||||
if ( Use_GLSL >= 3 ) {
|
||||
if ( GLSL_version >= 130 ) {
|
||||
submodels = (int*)vm_malloc(sizeof(int) * _verts);
|
||||
}
|
||||
|
||||
@@ -1852,15 +1851,15 @@ void poly_list::calculate_tangent()
|
||||
vm_vec_normalize_safe(t2);
|
||||
|
||||
// compute handedness (for all 3 verts)
|
||||
vm_vec_crossprod(&cross, &norm[i], &tangent);
|
||||
vm_vec_cross(&cross, &norm[i], &tangent);
|
||||
scale = vm_vec_dot(&cross, &binormal);
|
||||
tsb[i].scaler = (scale < 0.0f) ? -1.0f : 1.0f;
|
||||
|
||||
vm_vec_crossprod(&cross, &norm[i+1], &tangent);
|
||||
vm_vec_cross(&cross, &norm[i+1], &tangent);
|
||||
scale = vm_vec_dot(&cross, &binormal);
|
||||
tsb[i+1].scaler = (scale < 0.0f) ? -1.0f : 1.0f;
|
||||
|
||||
vm_vec_crossprod(&cross, &norm[i+2], &tangent);
|
||||
vm_vec_cross(&cross, &norm[i+2], &tangent);
|
||||
scale = vm_vec_dot(&cross, &binormal);
|
||||
tsb[i+2].scaler = (scale < 0.0f) ? -1.0f : 1.0f;
|
||||
}
|
||||
@@ -1922,7 +1921,7 @@ void poly_list::make_index_buffer(SCP_vector<int> &vertex_list)
|
||||
buffer_list_internal.tsb[z] = tsb[j];
|
||||
}
|
||||
|
||||
if ( Use_GLSL >= 3 ) {
|
||||
if ( GLSL_version >= 130 ) {
|
||||
buffer_list_internal.submodels[z] = submodels[j];
|
||||
}
|
||||
|
||||
@@ -1952,7 +1951,7 @@ poly_list& poly_list::operator = (poly_list &other_list)
|
||||
memcpy(tsb, other_list.tsb, sizeof(tsb_t) * other_list.n_verts);
|
||||
}
|
||||
|
||||
if ( Use_GLSL >= 3 ) {
|
||||
if ( GLSL_version >= 130 ) {
|
||||
memcpy(submodels, other_list.submodels, sizeof(int) * other_list.n_verts);
|
||||
}
|
||||
|
||||
@@ -2147,7 +2146,7 @@ uint gr_determine_model_shader_flags(
|
||||
) {
|
||||
uint shader_flags = 0;
|
||||
|
||||
if ( Use_GLSL > 1 ) {
|
||||
if ( GLSL_version >= 120 ) {
|
||||
shader_flags |= SDR_FLAG_MODEL_CLIP;
|
||||
}
|
||||
|
||||
|
||||
+4
-50
@@ -405,23 +405,12 @@ typedef struct screen {
|
||||
|
||||
int envmap_render_target;
|
||||
|
||||
bool recording_state_block;
|
||||
int current_state_block;
|
||||
|
||||
void (*gf_start_state_block)();
|
||||
int (*gf_end_state_block)();
|
||||
void (*gf_set_state_block)(int);
|
||||
|
||||
//switch onscreen, offscreen
|
||||
void (*gf_flip)();
|
||||
|
||||
// Sets the current palette
|
||||
void (*gf_set_palette)(const ubyte *new_pal, int restrict_alphacolor);
|
||||
|
||||
// Fade the screen in/out
|
||||
void (*gf_fade_in)(int instantaneous);
|
||||
void (*gf_fade_out)(int instantaneous);
|
||||
|
||||
|
||||
// Flash the screen
|
||||
void (*gf_flash)( int r, int g, int b );
|
||||
void (*gf_flash_alpha)(int r, int g, int b, int a);
|
||||
@@ -511,17 +500,7 @@ typedef struct screen {
|
||||
|
||||
// Frees up a saved screen.
|
||||
void (*gf_free_screen)(int id);
|
||||
|
||||
// CODE FOR DUMPING FRAMES TO A FILE
|
||||
// Begin frame dumping
|
||||
void (*gf_dump_frame_start)( int first_frame_number, int nframes_between_dumps );
|
||||
|
||||
// Dump the current frame to file
|
||||
void (*gf_dump_frame)();
|
||||
|
||||
// Dump the current frame to file
|
||||
void (*gf_dump_frame_stop)();
|
||||
|
||||
|
||||
// Sets the gamma
|
||||
void (*gf_set_gamma)(float gamma);
|
||||
|
||||
@@ -557,10 +536,9 @@ typedef struct screen {
|
||||
// Here be the bitmap functions
|
||||
void (*gf_bm_free_data)(int n, bool release);
|
||||
void (*gf_bm_create)(int n);
|
||||
int(*gf_bm_load)(BM_TYPE type, int n, const char *filename, CFILE *img_cfp, int *w, int *h, int *bpp, BM_TYPE *c_type, int *mm_lvl, int *size);
|
||||
void (*gf_bm_init)(int n);
|
||||
void (*gf_bm_page_in_start)();
|
||||
int (*gf_bm_lock)(const char *filename, int handle, int bitmapnum, ubyte bpp, ubyte flags, bool nodebug);
|
||||
bool (*gf_bm_data)(int n, bitmap* bm);
|
||||
|
||||
int (*gf_bm_make_render_target)(int n, int *width, int *height, ubyte *bpp, int *mm_lvl, int flags );
|
||||
int (*gf_bm_set_render_target)(int n, int face);
|
||||
@@ -584,11 +562,7 @@ typedef struct screen {
|
||||
|
||||
int (*gf_create_stream_buffer)();
|
||||
void (*gf_render_stream_buffer)(int buffer_handle, int offset, int n_verts, int flags);
|
||||
|
||||
int (*gf_make_flat_buffer)(poly_list*);
|
||||
int (*gf_make_line_buffer)(line_list*);
|
||||
|
||||
|
||||
//the projection matrix; fov, aspect ratio, near, far
|
||||
void (*gf_set_proj_matrix)(float, float, float, float);
|
||||
void (*gf_end_proj_matrix)();
|
||||
@@ -635,7 +609,6 @@ typedef struct screen {
|
||||
void (*gf_end_clip_plane)();
|
||||
|
||||
void (*gf_zbias)(int zbias);
|
||||
void (*gf_setup_background_fog)(bool);
|
||||
|
||||
void (*gf_set_fill_mode)(int);
|
||||
void (*gf_set_texture_panning)(float u, float v, bool enable);
|
||||
@@ -837,8 +810,6 @@ __inline void gr_gradient(int x1, int y1, int x2, int y2, int resize_mode = GR_R
|
||||
(*gr_screen.gf_gradient)(x1, y1, x2, y2, resize_mode);
|
||||
}
|
||||
|
||||
#define gr_fade_in GR_CALL(gr_screen.gf_fade_in)
|
||||
#define gr_fade_out GR_CALL(gr_screen.gf_fade_out)
|
||||
#define gr_flash GR_CALL(gr_screen.gf_flash)
|
||||
#define gr_flash_alpha GR_CALL(gr_screen.gf_flash_alpha)
|
||||
|
||||
@@ -855,10 +826,6 @@ __inline void gr_gradient(int x1, int y1, int x2, int y2, int resize_mode = GR_R
|
||||
#define gr_restore_screen GR_CALL(gr_screen.gf_restore_screen)
|
||||
#define gr_free_screen GR_CALL(gr_screen.gf_free_screen)
|
||||
|
||||
#define gr_dump_frame_start GR_CALL(gr_screen.gf_dump_frame_start)
|
||||
#define gr_dump_frame_stop GR_CALL(gr_screen.gf_dump_frame_stop)
|
||||
#define gr_dump_frame GR_CALL(gr_screen.gf_dump_frame)
|
||||
|
||||
#define gr_set_gamma GR_CALL(gr_screen.gf_set_gamma)
|
||||
|
||||
#define gr_get_region GR_CALL(gr_screen.gf_get_region)
|
||||
@@ -891,12 +858,8 @@ __inline int gr_tcache_set(int bitmap_id, int bitmap_type, float *u_scale, float
|
||||
#define gr_bm_free_data GR_CALL(*gr_screen.gf_bm_free_data)
|
||||
#define gr_bm_create GR_CALL(*gr_screen.gf_bm_create)
|
||||
#define gr_bm_init GR_CALL(*gr_screen.gf_bm_init)
|
||||
__inline int gr_bm_load(BM_TYPE type, int n, const char *filename, CFILE *img_cfp = NULL, int *w = 0, int *h = 0, int *bpp = 0, BM_TYPE *c_type = 0, int *mm_lvl = 0, int *size = 0)
|
||||
{
|
||||
return (*gr_screen.gf_bm_load)(type, n, filename, img_cfp, w, h, bpp, c_type, mm_lvl, size);
|
||||
}
|
||||
#define gr_bm_page_in_start GR_CALL(*gr_screen.gf_bm_page_in_start)
|
||||
#define gr_bm_lock GR_CALL(*gr_screen.gf_bm_lock)
|
||||
#define gr_bm_data GR_CALL(*gr_screen.gf_bm_data)
|
||||
|
||||
#define gr_bm_make_render_target GR_CALL(*gr_screen.gf_bm_make_render_target)
|
||||
|
||||
@@ -926,9 +889,6 @@ __inline void gr_render_buffer(int start, const vertex_buffer *bufferp, int texi
|
||||
#define gr_render_stream_buffer_end GR_CALL(*gr_screen.gf_render_stream_buffer_end)
|
||||
|
||||
#define gr_set_buffer GR_CALL(*gr_screen.gf_set_buffer)
|
||||
|
||||
#define gr_make_flat_buffer GR_CALL(*gr_screen.gf_make_flat_buffer)
|
||||
#define gr_make_line_buffer GR_CALL(*gr_screen.gf_make_line_buffer)
|
||||
|
||||
#define gr_set_proj_matrix GR_CALL(*gr_screen.gf_set_proj_matrix)
|
||||
#define gr_end_proj_matrix GR_CALL(*gr_screen.gf_end_proj_matrix)
|
||||
@@ -973,12 +933,6 @@ __inline void gr_render_buffer(int start, const vertex_buffer *bufferp, int texi
|
||||
#define gr_set_fill_mode GR_CALL(*gr_screen.gf_set_fill_mode)
|
||||
#define gr_set_texture_panning GR_CALL(*gr_screen.gf_set_texture_panning)
|
||||
|
||||
#define gr_start_state_block GR_CAL(*gr_screen.gf_start_state_block)
|
||||
#define gr_end_state_block GR_CALL(*gr_screen.gf_end_state_block)
|
||||
#define gr_set_state_block GR_CALL(*gr_screen.gf_set_state_block)
|
||||
|
||||
#define gr_setup_background_fog GR_CALL(*gr_screen.gf_setup_background_fog)
|
||||
|
||||
#define gr_draw_line_list GR_CALL(*gr_screen.gf_draw_line_list)
|
||||
|
||||
#define gr_set_line_width GR_CALL(*gr_screen.gf_set_line_width)
|
||||
|
||||
+14
-14
@@ -173,11 +173,11 @@ void geometry_batcher::draw_bitmap(vertex *pnt, int orient, float rad, float dep
|
||||
uvec = View_matrix.vec.uvec;
|
||||
|
||||
// make a right vector from the f and up vector, this r vec is exactly what we want, so...
|
||||
vm_vec_crossprod(&rvec, &View_matrix.vec.fvec, &uvec);
|
||||
vm_vec_cross(&rvec, &View_matrix.vec.fvec, &uvec);
|
||||
vm_vec_normalize_safe(&rvec);
|
||||
|
||||
// fix the u vec with it
|
||||
vm_vec_crossprod(&uvec, &View_matrix.vec.fvec, &rvec);
|
||||
vm_vec_cross(&uvec, &View_matrix.vec.fvec, &rvec);
|
||||
|
||||
// move the center of the sprite based on the depth parameter
|
||||
if ( depth != 0.0f )
|
||||
@@ -284,9 +284,9 @@ void geometry_batcher::draw_bitmap(vertex *pnt, float rad, float angle, float de
|
||||
|
||||
vm_rot_point_around_line(&uvec, &View_matrix.vec.uvec, angle, &vmd_zero_vector, &View_matrix.vec.fvec);
|
||||
|
||||
vm_vec_crossprod(&rvec, &View_matrix.vec.fvec, &uvec);
|
||||
vm_vec_cross(&rvec, &View_matrix.vec.fvec, &uvec);
|
||||
vm_vec_normalize_safe(&rvec);
|
||||
vm_vec_crossprod(&uvec, &View_matrix.vec.fvec, &rvec);
|
||||
vm_vec_cross(&uvec, &View_matrix.vec.fvec, &rvec);
|
||||
|
||||
vm_vec_scale_add(&PNT, &PNT, &fvec, depth);
|
||||
vm_vec_scale_add(&p[0], &PNT, &rvec, rad);
|
||||
@@ -373,13 +373,13 @@ void geometry_batcher::draw_beam(vec3d *start, vec3d *end, float width, float in
|
||||
vm_vec_sub(&evec, &View_position, start);
|
||||
vm_vec_normalize_safe(&evec);
|
||||
|
||||
vm_vec_crossprod(&uvecs, &fvec, &evec);
|
||||
vm_vec_cross(&uvecs, &fvec, &evec);
|
||||
vm_vec_normalize_safe(&uvecs);
|
||||
|
||||
vm_vec_sub(&evec, &View_position, end);
|
||||
vm_vec_normalize_safe(&evec);
|
||||
|
||||
vm_vec_crossprod(&uvece, &fvec, &evec);
|
||||
vm_vec_cross(&uvece, &fvec, &evec);
|
||||
vm_vec_normalize_safe(&uvece);
|
||||
|
||||
|
||||
@@ -441,13 +441,13 @@ float geometry_batcher::draw_laser(vec3d *p0, float width1, vec3d *p1, float wid
|
||||
vm_vec_normalize(&reye);
|
||||
|
||||
// compute the up vector
|
||||
vm_vec_crossprod(&uvec, &fvec, &reye);
|
||||
vm_vec_cross(&uvec, &fvec, &reye);
|
||||
vm_vec_normalize_safe(&uvec);
|
||||
// ... the forward vector
|
||||
vm_vec_crossprod(&fvec, &uvec, &reye);
|
||||
vm_vec_cross(&fvec, &uvec, &reye);
|
||||
vm_vec_normalize_safe(&fvec);
|
||||
// now recompute right vector, in case it wasn't entirely perpendiclar
|
||||
vm_vec_crossprod(&rvec, &uvec, &fvec);
|
||||
vm_vec_cross(&rvec, &uvec, &fvec);
|
||||
|
||||
// Now have uvec, which is up vector and rvec which is the normal
|
||||
// of the face.
|
||||
@@ -728,12 +728,12 @@ int batch_add_bitmap(int texture, int tmap_flags, vertex *pnt, int orient, float
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( tmap_flags & TMAP_FLAG_SOFT_QUAD && ( !Cmdline_softparticles || Use_GLSL <= 2 ) ) {
|
||||
if ( tmap_flags & TMAP_FLAG_SOFT_QUAD && ( !Cmdline_softparticles || GLSL_version <= 120 ) ) {
|
||||
// don't render this as a soft particle if we don't support soft particles
|
||||
tmap_flags &= ~(TMAP_FLAG_SOFT_QUAD);
|
||||
}
|
||||
|
||||
if ( Use_GLSL > 2 && Cmdline_softparticles && !Cmdline_no_geo_sdr_effects && Is_Extension_Enabled(OGL_EXT_GEOMETRY_SHADER4) && (tmap_flags & TMAP_FLAG_VERTEX_GEN) ) {
|
||||
if ( GLSL_version > 120 && Cmdline_softparticles && !Cmdline_no_geo_sdr_effects && Is_Extension_Enabled(OGL_EXT_GEOMETRY_SHADER4) && (tmap_flags & TMAP_FLAG_VERTEX_GEN) ) {
|
||||
geometry_batch_add_bitmap(texture, tmap_flags, pnt, orient, rad, alpha, depth);
|
||||
return 0;
|
||||
} else if ( tmap_flags & TMAP_FLAG_VERTEX_GEN ) {
|
||||
@@ -797,7 +797,7 @@ int batch_add_bitmap_rotated(int texture, int tmap_flags, vertex *pnt, float ang
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( tmap_flags & TMAP_FLAG_SOFT_QUAD && ( !Cmdline_softparticles || Use_GLSL <= 2 ) ) {
|
||||
if ( tmap_flags & TMAP_FLAG_SOFT_QUAD && ( !Cmdline_softparticles || GLSL_version <= 120 ) ) {
|
||||
// don't render this as a soft particle if we don't support soft particles
|
||||
tmap_flags &= ~(TMAP_FLAG_SOFT_QUAD);
|
||||
}
|
||||
@@ -1179,7 +1179,7 @@ int distortion_add_bitmap_rotated(int texture, int tmap_flags, vertex *pnt, floa
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( Use_GLSL < 2 || !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) ) {
|
||||
if ( GLSL_version < 120 || !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) ) {
|
||||
// don't render distortions if we can't support them.
|
||||
return 0;
|
||||
}
|
||||
@@ -1214,7 +1214,7 @@ int distortion_add_beam(int texture, int tmap_flags, vec3d *start, vec3d *end, f
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( Use_GLSL < 2 || !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) ) {
|
||||
if ( GLSL_version < 120 || !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) ) {
|
||||
// don't render distortions if we can't support them.
|
||||
return 0;
|
||||
}
|
||||
|
||||
+19
-121
@@ -51,7 +51,11 @@ typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);
|
||||
// minimum GL version we can reliably support is 1.2
|
||||
static const int MIN_REQUIRED_GL_VERSION = 12;
|
||||
|
||||
// minimum GLSL version we can reliably support is 110
|
||||
static const int MIN_REQUIRED_GLSL_VERSION = 110;
|
||||
|
||||
int GL_version = 0;
|
||||
int GLSL_version = 0;
|
||||
|
||||
bool GL_initted = 0;
|
||||
|
||||
@@ -71,14 +75,6 @@ static ushort *GL_original_gamma_ramp = NULL;
|
||||
|
||||
int Use_VBOs = 0;
|
||||
int Use_PBOs = 0;
|
||||
int Use_GLSL = 0;
|
||||
|
||||
static int GL_dump_frames = 0;
|
||||
static ubyte *GL_dump_buffer = NULL;
|
||||
static int GL_dump_frame_number = 0;
|
||||
static int GL_dump_frame_count = 0;
|
||||
static int GL_dump_frame_count_max = 0;
|
||||
static int GL_dump_frame_size = 0;
|
||||
|
||||
static ubyte *GL_saved_screen = NULL;
|
||||
static ubyte *GL_saved_mouse_data = NULL;
|
||||
@@ -1150,96 +1146,6 @@ void gr_opengl_free_screen(int bmp_id)
|
||||
GL_saved_screen_id = -1;
|
||||
}
|
||||
|
||||
static void opengl_flush_frame_dump()
|
||||
{
|
||||
char filename[MAX_FILENAME_LEN];
|
||||
|
||||
Assert( GL_dump_buffer != NULL);
|
||||
|
||||
for (int i = 0; i < GL_dump_frame_count; i++) {
|
||||
sprintf(filename, NOX("frm%04d.tga"), GL_dump_frame_number );
|
||||
GL_dump_frame_number++;
|
||||
|
||||
CFILE *f = cfopen(filename, "wb", CFILE_NORMAL, CF_TYPE_DATA);
|
||||
|
||||
// Write the TGA header
|
||||
cfwrite_ubyte( 0, f ); // IDLength;
|
||||
cfwrite_ubyte( 0, f ); // ColorMapType;
|
||||
cfwrite_ubyte( 2, f ); // ImageType; // 2 = 24bpp, uncompressed, 10=24bpp rle compressed
|
||||
cfwrite_ushort( 0, f ); // CMapStart;
|
||||
cfwrite_ushort( 0, f ); // CMapLength;
|
||||
cfwrite_ubyte( 0, f ); // CMapDepth;
|
||||
cfwrite_ushort( 0, f ); // XOffset;
|
||||
cfwrite_ushort( 0, f ); // YOffset;
|
||||
cfwrite_ushort( (ushort)gr_screen.max_w, f ); // Width;
|
||||
cfwrite_ushort( (ushort)gr_screen.max_h, f ); // Height;
|
||||
cfwrite_ubyte( 24, f ); //PixelDepth;
|
||||
cfwrite_ubyte( 0, f ); //ImageDesc;
|
||||
|
||||
glReadBuffer(GL_FRONT);
|
||||
glReadPixels(0, 0, gr_screen.max_w, gr_screen.max_h, GL_BGR_EXT, GL_UNSIGNED_BYTE, GL_dump_buffer);
|
||||
|
||||
// save the data out
|
||||
cfwrite( GL_dump_buffer, GL_dump_frame_size, 1, f );
|
||||
|
||||
cfclose(f);
|
||||
|
||||
}
|
||||
|
||||
GL_dump_frame_count = 0;
|
||||
}
|
||||
|
||||
void gr_opengl_dump_frame_start(int first_frame, int frames_between_dumps)
|
||||
{
|
||||
if ( GL_dump_frames ) {
|
||||
Int3(); // We're already dumping frames. See John.
|
||||
return;
|
||||
}
|
||||
|
||||
GL_dump_frames = 1;
|
||||
GL_dump_frame_number = first_frame;
|
||||
GL_dump_frame_count = 0;
|
||||
GL_dump_frame_count_max = frames_between_dumps; // only works if it's 1
|
||||
GL_dump_frame_size = gr_screen.max_w * gr_screen.max_h * 3;
|
||||
|
||||
if ( !GL_dump_buffer ) {
|
||||
int size = GL_dump_frame_count_max * GL_dump_frame_size;
|
||||
|
||||
GL_dump_buffer = (ubyte *)vm_malloc(size);
|
||||
|
||||
if ( !GL_dump_buffer ) {
|
||||
Error(LOCATION, "Unable to malloc %d bytes for dump buffer", size );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void gr_opengl_dump_frame_stop()
|
||||
{
|
||||
if ( !GL_dump_frames ) {
|
||||
Int3(); // We're not dumping frames. See John.
|
||||
return;
|
||||
}
|
||||
|
||||
// dump any remaining frames
|
||||
opengl_flush_frame_dump();
|
||||
|
||||
GL_dump_frames = 0;
|
||||
|
||||
if ( GL_dump_buffer ) {
|
||||
vm_free(GL_dump_buffer);
|
||||
GL_dump_buffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void gr_opengl_dump_frame()
|
||||
{
|
||||
GL_dump_frame_count++;
|
||||
|
||||
if ( GL_dump_frame_count == GL_dump_frame_count_max ) {
|
||||
opengl_flush_frame_dump();
|
||||
}
|
||||
}
|
||||
|
||||
//fill mode, solid/wire frame
|
||||
void gr_opengl_set_fill_mode(int mode)
|
||||
{
|
||||
@@ -1324,13 +1230,6 @@ void gr_opengl_translate_texture_matrix(int unit, const vec3d *shift)
|
||||
// tex_shift=vmd_zero_vector;
|
||||
}
|
||||
|
||||
void gr_opengl_setup_background_fog(bool set)
|
||||
{
|
||||
if (Cmdline_nohtl) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void gr_opengl_set_line_width(float width)
|
||||
{
|
||||
glLineWidth(width);
|
||||
@@ -1795,8 +1694,6 @@ void opengl_setup_function_pointers()
|
||||
gr_screen.gf_set_palette = gr_opengl_set_palette;
|
||||
gr_screen.gf_print_screen = gr_opengl_print_screen;
|
||||
|
||||
gr_screen.gf_fade_in = gr_opengl_fade_in;
|
||||
gr_screen.gf_fade_out = gr_opengl_fade_out;
|
||||
gr_screen.gf_flash = gr_opengl_flash;
|
||||
gr_screen.gf_flash_alpha = gr_opengl_flash_alpha;
|
||||
|
||||
@@ -1813,10 +1710,6 @@ void opengl_setup_function_pointers()
|
||||
gr_screen.gf_restore_screen = gr_opengl_restore_screen;
|
||||
gr_screen.gf_free_screen = gr_opengl_free_screen;
|
||||
|
||||
gr_screen.gf_dump_frame_start = gr_opengl_dump_frame_start;
|
||||
gr_screen.gf_dump_frame_stop = gr_opengl_dump_frame_stop;
|
||||
gr_screen.gf_dump_frame = gr_opengl_dump_frame;
|
||||
|
||||
gr_screen.gf_set_gamma = gr_opengl_set_gamma;
|
||||
|
||||
gr_screen.gf_fog_set = gr_opengl_fog_set;
|
||||
@@ -1828,9 +1721,8 @@ void opengl_setup_function_pointers()
|
||||
gr_screen.gf_bm_free_data = gr_opengl_bm_free_data;
|
||||
gr_screen.gf_bm_create = gr_opengl_bm_create;
|
||||
gr_screen.gf_bm_init = gr_opengl_bm_init;
|
||||
gr_screen.gf_bm_load = gr_opengl_bm_load;
|
||||
gr_screen.gf_bm_page_in_start = gr_opengl_bm_page_in_start;
|
||||
gr_screen.gf_bm_lock = gr_opengl_bm_lock;
|
||||
gr_screen.gf_bm_data = gr_opengl_bm_data;
|
||||
gr_screen.gf_bm_make_render_target = gr_opengl_bm_make_render_target;
|
||||
gr_screen.gf_bm_set_render_target = gr_opengl_bm_set_render_target;
|
||||
|
||||
@@ -1911,12 +1803,6 @@ void opengl_setup_function_pointers()
|
||||
gr_screen.gf_center_alpha = gr_opengl_center_alpha;
|
||||
gr_screen.gf_set_thrust_scale = gr_opengl_set_thrust_scale;
|
||||
|
||||
gr_screen.gf_setup_background_fog = gr_opengl_setup_background_fog;
|
||||
|
||||
gr_screen.gf_start_state_block = gr_opengl_start_state_block;
|
||||
gr_screen.gf_end_state_block = gr_opengl_end_state_block;
|
||||
gr_screen.gf_set_state_block = gr_opengl_set_state_block;
|
||||
|
||||
gr_screen.gf_draw_line_list = gr_opengl_draw_line_list;
|
||||
|
||||
gr_screen.gf_set_line_width = gr_opengl_set_line_width;
|
||||
@@ -2011,7 +1897,7 @@ bool gr_opengl_init()
|
||||
GLint max_texture_units = GL_supported_texture_units;
|
||||
GLint max_texture_coords = GL_supported_texture_units;
|
||||
|
||||
if (Use_GLSL) {
|
||||
if (is_minimum_GLSL_version()) {
|
||||
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &max_texture_units);
|
||||
}
|
||||
|
||||
@@ -2091,7 +1977,7 @@ bool gr_opengl_init()
|
||||
mprintf(( " Post-processing enabled: %s\n", (Cmdline_postprocess) ? "YES" : "NO"));
|
||||
mprintf(( " Using %s texture filter.\n", (GL_mipmap_filter) ? NOX("trilinear") : NOX("bilinear") ));
|
||||
|
||||
if (Use_GLSL) {
|
||||
if (is_minimum_GLSL_version()) {
|
||||
mprintf(( " OpenGL Shader Version: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION) ));
|
||||
}
|
||||
|
||||
@@ -2166,3 +2052,15 @@ DCF(ogl_anisotropy, "toggles anisotropic filtering")
|
||||
// opengl_set_anisotropy( (float)Dc_arg_float );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to enquire whether minimum GLSL version present.
|
||||
*
|
||||
* Compares global variable set by glGetString(GL_SHADING_LANGUAGE_VERSION)
|
||||
* against compile time MIN_REQUIRED_GLSL_VERSION.
|
||||
*
|
||||
* @return true if GLSL support present is above the minimum version.
|
||||
*/
|
||||
bool is_minimum_GLSL_version() {
|
||||
return GLSL_version >= MIN_REQUIRED_GLSL_VERSION ? true : false;
|
||||
}
|
||||
@@ -655,6 +655,7 @@ const ubyte GL_zero_3ub[3] = { 0, 0, 0 };
|
||||
bool gr_opengl_init();
|
||||
void gr_opengl_cleanup(int minimize=1);
|
||||
int opengl_check_for_errors(char *err_at = NULL);
|
||||
bool is_minimum_GLSL_version();
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define GL_CHECK_FOR_ERRORS(s) opengl_check_for_errors((s))
|
||||
@@ -663,9 +664,9 @@ int opengl_check_for_errors(char *err_at = NULL);
|
||||
#endif
|
||||
|
||||
extern int GL_version;
|
||||
extern int GLSL_version;
|
||||
|
||||
extern int Use_VBOs;
|
||||
extern int Use_PBOs;
|
||||
extern int Use_GLSL;
|
||||
|
||||
#endif
|
||||
@@ -78,108 +78,6 @@ void gr_opengl_bm_create(int n)
|
||||
Assert( (n >= 0) && (n < MAX_BITMAPS) );
|
||||
}
|
||||
|
||||
// Load an image and validate it while retrieving information for later use
|
||||
// Input: type = current BM_TYPE_*
|
||||
// n = location in bm_bitmaps[]
|
||||
// filename = name of the current file
|
||||
// img_cfp = already open CFILE handle, if available
|
||||
//
|
||||
// Output: w = bmp width
|
||||
// h = bmp height
|
||||
// bpp = bmp bits per pixel
|
||||
// c_type = output for an updated BM_TYPE_*
|
||||
// mm_lvl = number of mipmap levels for the image
|
||||
// size = size of the data contained in the image
|
||||
int gr_opengl_bm_load(BM_TYPE type, int n, const char *filename, CFILE *img_cfp, int *w, int *h, int *bpp, BM_TYPE *c_type, int *mm_lvl, int *size)
|
||||
{
|
||||
int dds_ct;
|
||||
|
||||
if (type == BM_TYPE_DDS) {
|
||||
int dds_error = dds_read_header( filename, img_cfp, w, h, bpp, &dds_ct, mm_lvl, size );
|
||||
|
||||
if (dds_error != DDS_ERROR_NONE) {
|
||||
mprintf(("DDS ERROR: Couldn't open '%s' -- %s\n", filename, dds_error_string(dds_error)));
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (dds_ct) {
|
||||
case DDS_DXT1:
|
||||
*c_type = BM_TYPE_DXT1;
|
||||
break;
|
||||
|
||||
case DDS_DXT3:
|
||||
*c_type = BM_TYPE_DXT3;
|
||||
break;
|
||||
|
||||
case DDS_DXT5:
|
||||
*c_type = BM_TYPE_DXT5;
|
||||
break;
|
||||
|
||||
case DDS_UNCOMPRESSED:
|
||||
*c_type = BM_TYPE_DDS;
|
||||
break;
|
||||
|
||||
case DDS_CUBEMAP_DXT1:
|
||||
*c_type = BM_TYPE_CUBEMAP_DXT1;
|
||||
break;
|
||||
|
||||
case DDS_CUBEMAP_DXT3:
|
||||
*c_type = BM_TYPE_CUBEMAP_DXT3;
|
||||
break;
|
||||
|
||||
case DDS_CUBEMAP_DXT5:
|
||||
*c_type = BM_TYPE_CUBEMAP_DXT5;
|
||||
break;
|
||||
|
||||
case DDS_CUBEMAP_UNCOMPRESSED:
|
||||
*c_type = BM_TYPE_CUBEMAP_DDS;
|
||||
break;
|
||||
|
||||
default:
|
||||
Error(LOCATION, "Bad DDS file compression! Not using DXT1,3,5: %s", filename);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// if its a tga file
|
||||
else if (type == BM_TYPE_TGA) {
|
||||
int tga_error = targa_read_header( filename, img_cfp, w, h, bpp, NULL );
|
||||
if ( tga_error != TARGA_ERROR_NONE ) {
|
||||
mprintf(( "tga: Couldn't open '%s'\n", filename ));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// if its a png file
|
||||
else if (type == BM_TYPE_PNG) {
|
||||
int png_error=png_read_header( filename, img_cfp, w, h, bpp, NULL );
|
||||
if ( png_error != PNG_ERROR_NONE ) {
|
||||
mprintf(( "png: Couldn't open '%s'\n", filename ));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// if its a jpg file
|
||||
else if (type == BM_TYPE_JPG) {
|
||||
int jpg_error=jpeg_read_header( filename, img_cfp, w, h, bpp, NULL );
|
||||
if ( jpg_error != JPEG_ERROR_NONE ) {
|
||||
mprintf(( "jpg: Couldn't open '%s'\n", filename ));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// if its a pcx file
|
||||
else if (type == BM_TYPE_PCX) {
|
||||
int pcx_error = pcx_read_header( filename, img_cfp, w, h, bpp, NULL );
|
||||
if ( pcx_error != PCX_ERROR_NONE ) {
|
||||
mprintf(( "pcx: Couldn't open '%s'\n", filename ));
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
Assert( 0 );
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* API specific init instructions
|
||||
*/
|
||||
@@ -197,352 +95,9 @@ void gr_opengl_bm_page_in_start()
|
||||
}
|
||||
|
||||
extern void bm_clean_slot(int n);
|
||||
extern int opengl_compress_image( ubyte **out_data, ubyte *in_data, int width, int height, int alpha = 1, int num_mipmaps = 1 );
|
||||
|
||||
static int opengl_bm_lock_ani_compress( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags )
|
||||
{
|
||||
anim *the_anim;
|
||||
anim_instance *the_anim_instance;
|
||||
bitmap *bm;
|
||||
ubyte *frame_data;
|
||||
int size, i;
|
||||
int first_frame, nframes;
|
||||
ubyte *compressed_data = NULL;
|
||||
int out_size = 0;
|
||||
int alpha = 0;
|
||||
int num_mipmaps = 1;
|
||||
|
||||
first_frame = be->info.ani.first_frame;
|
||||
nframes = bm_bitmaps[first_frame].info.ani.num_frames;
|
||||
|
||||
// bpp can always be 24-bit since we don't do images with alpha here
|
||||
bpp = 24;
|
||||
|
||||
alpha = (bpp == 32);
|
||||
|
||||
if ( (the_anim = anim_load(bm_bitmaps[first_frame].filename, bm_bitmaps[first_frame].dir_type)) == NULL ) {
|
||||
nprintf(("BMPMAN", "Error opening %s in bm_lock\n", be->filename));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( (the_anim_instance = init_anim_instance(the_anim, bpp)) == NULL ) {
|
||||
nprintf(("BMPMAN", "Error opening %s in bm_lock\n", be->filename));
|
||||
anim_free(the_anim);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int can_drop_frames = 0;
|
||||
|
||||
if ( the_anim->total_frames != bm_bitmaps[first_frame].info.ani.num_frames ) {
|
||||
can_drop_frames = 1;
|
||||
}
|
||||
|
||||
bm = &bm_bitmaps[first_frame].bm;
|
||||
size = bm->w * bm->h * (bpp >> 3);
|
||||
|
||||
num_mipmaps = get_num_mipmap_levels( bm->w, bm->h );
|
||||
Assert( num_mipmaps > 0 );
|
||||
|
||||
nprintf(("BMPMAN", "Attempting to compress '%s' with %d frames, original size %.3fM ... ", bm_bitmaps[first_frame].filename, nframes, ((float)(size*nframes)/1024.0f)/1024.0f));
|
||||
|
||||
for ( i=0; i<nframes; i++ ) {
|
||||
be = &bm_bitmaps[first_frame+i];
|
||||
bmp = &bm_bitmaps[first_frame+i].bm;
|
||||
|
||||
// Unload any existing data
|
||||
bm_clean_slot( first_frame+i );
|
||||
|
||||
bmp->flags = 0;
|
||||
|
||||
bmp->bpp = bpp;
|
||||
|
||||
frame_data = anim_get_next_raw_buffer(the_anim_instance, 0, 0, bmp->bpp);
|
||||
|
||||
Assert( frame_data != NULL );
|
||||
|
||||
out_size = opengl_compress_image(&compressed_data, frame_data, bmp->w, bmp->h, alpha, num_mipmaps);
|
||||
|
||||
if (out_size == 0) {
|
||||
if (compressed_data != NULL) {
|
||||
vm_free(compressed_data);
|
||||
compressed_data = NULL;
|
||||
}
|
||||
|
||||
nprintf(("BMPMAN", "compression failed!!\n"));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Assert( compressed_data != NULL );
|
||||
|
||||
bmp->data = (ptr_u)compressed_data;
|
||||
bmp->bpp = (alpha) ? 32 : 24;
|
||||
bmp->palette = NULL;
|
||||
be->comp_type = (alpha) ? BM_TYPE_DXT5 : BM_TYPE_DXT1;
|
||||
be->mem_taken = out_size;
|
||||
be->num_mipmaps = num_mipmaps;
|
||||
|
||||
bm_update_memory_used( first_frame + i, out_size );
|
||||
|
||||
// Skip a frame
|
||||
if ( (i < nframes-1) && can_drop_frames ) {
|
||||
frame_data = anim_get_next_raw_buffer(the_anim_instance, 0, 0, bm->bpp);
|
||||
}
|
||||
|
||||
compressed_data = NULL;
|
||||
}
|
||||
|
||||
if (num_mipmaps > 1) {
|
||||
nprintf(("BMPMAN", "new size is %.3fM with %d mipmap levels.\n", ((float)(out_size*nframes)/1024.0f)/1024.0f, num_mipmaps));
|
||||
} else {
|
||||
nprintf(("BMPMAN", "new size is %.3fM.\n", ((float)(out_size*nframes)/1024.0f)/1024.0f));
|
||||
}
|
||||
|
||||
free_anim_instance(the_anim_instance);
|
||||
anim_free(the_anim);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opengl_bm_lock_compress( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, int bpp, int flags )
|
||||
{
|
||||
ubyte *data = NULL;
|
||||
ubyte *compressed_data = NULL;
|
||||
int error_code = 1;
|
||||
int out_size = 0;
|
||||
int byte_size = 0;
|
||||
int alpha = 1;
|
||||
int num_mipmaps = 1;
|
||||
|
||||
// don't use for EFFs, if they were wanting to be DDS then they should already be that way
|
||||
if ( be->type == BM_TYPE_EFF ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Assert( (be->type == BM_TYPE_PCX) ||
|
||||
(be->type == BM_TYPE_TGA) ||
|
||||
(be->type == BM_TYPE_PNG) ||
|
||||
(be->type == BM_TYPE_JPG) );
|
||||
|
||||
Assert( !(flags & BMP_AABITMAP) );
|
||||
|
||||
// PCX need to be loaded as 32-bit
|
||||
if ( (be->type == BM_TYPE_PCX) && (bpp == 16) )
|
||||
bpp = 32;
|
||||
|
||||
bm_clean_slot( bitmapnum );
|
||||
|
||||
byte_size = (bpp >> 3);
|
||||
Assert( (byte_size == 3) || (byte_size == 4) );
|
||||
alpha = (byte_size != 3);
|
||||
|
||||
data = (ubyte*)vm_malloc(bmp->w * bmp->h * byte_size);
|
||||
|
||||
Assert( data != NULL );
|
||||
|
||||
if ( data == NULL )
|
||||
return 1;
|
||||
|
||||
// read in bitmap data
|
||||
if (be->type == BM_TYPE_PCX) {
|
||||
Assert( bpp == 32 );
|
||||
error_code = pcx_read_bitmap( be->filename, data, NULL, byte_size );
|
||||
} else if (be->type == BM_TYPE_TGA) {
|
||||
error_code = targa_read_bitmap( be->filename, data, NULL, byte_size );
|
||||
} else if (be->type == BM_TYPE_PNG) {
|
||||
error_code = png_read_bitmap( be->filename, data, NULL, byte_size );
|
||||
} else if (be->type == BM_TYPE_JPG) {
|
||||
error_code = jpeg_read_bitmap( be->filename, data, NULL, byte_size );
|
||||
} else {
|
||||
Assert( 0 );
|
||||
}
|
||||
|
||||
nprintf(("BMPMAN", "Attempting to compress '%s', original size %.3fM ... ", be->filename, ((float)(bmp->w * bmp->h * byte_size)/1024.0f)/1024.0f));
|
||||
|
||||
// NOTE: this assumes that the *_ERROR_NONE #define's are going to be 0
|
||||
if (error_code) {
|
||||
if (data != NULL) {
|
||||
vm_free(data);
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
nprintf(("BMPMAN", "initial read failed!!\n"));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
num_mipmaps = get_num_mipmap_levels( bmp->w, bmp->h );
|
||||
Assert( num_mipmaps > 0 );
|
||||
|
||||
// now for the attempt to compress the data
|
||||
out_size = opengl_compress_image(&compressed_data, data, bmp->w, bmp->h, alpha, num_mipmaps);
|
||||
|
||||
if (data != NULL) {
|
||||
vm_free(data);
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
if (out_size == 0) {
|
||||
if (compressed_data != NULL) {
|
||||
vm_free(compressed_data);
|
||||
compressed_data = NULL;
|
||||
}
|
||||
|
||||
nprintf(("BMPMAN", "compression failed!!\n"));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Assert( compressed_data != NULL );
|
||||
|
||||
if (num_mipmaps > 1) {
|
||||
nprintf(("BMPMAN", "new size is %.3fM with %d mipmap levels.\n", ((float)out_size/1024.0f)/1024.0f, num_mipmaps));
|
||||
} else {
|
||||
nprintf(("BMPMAN", "new size is %.3fM.\n", ((float)out_size/1024.0f)/1024.0f));
|
||||
}
|
||||
|
||||
bmp->data = (ptr_u)compressed_data;
|
||||
bmp->bpp = (alpha) ? (ubyte)32 : (ubyte)24;
|
||||
bmp->palette = NULL;
|
||||
be->comp_type = (alpha) ? BM_TYPE_DXT5 : BM_TYPE_DXT1;
|
||||
be->mem_taken = out_size;
|
||||
be->num_mipmaps = num_mipmaps;
|
||||
|
||||
bm_update_memory_used( bitmapnum, out_size );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern bool opengl_texture_slot_valid(int n, int handle);
|
||||
|
||||
/**
|
||||
* Lock an image files data into memory
|
||||
*/
|
||||
int gr_opengl_bm_lock( const char *filename, int handle, int bitmapnum, ubyte bpp, ubyte flags, bool nodebug)
|
||||
{
|
||||
BM_TYPE c_type = BM_TYPE_NONE;
|
||||
ubyte true_bpp;
|
||||
int try_compress = 0;
|
||||
|
||||
bitmap_entry *be = &bm_bitmaps[bitmapnum];
|
||||
bitmap *bmp = &be->bm;
|
||||
|
||||
Assert( !Is_standalone );
|
||||
|
||||
if (bmp->true_bpp > bpp)
|
||||
true_bpp = bmp->true_bpp;
|
||||
else
|
||||
true_bpp = bpp;
|
||||
|
||||
// don't do a bpp check here since it could be different in OGL - taylor
|
||||
if ( (bmp->data == 0) && !opengl_texture_slot_valid(bitmapnum, handle) ) {
|
||||
Assert(be->ref_count == 1);
|
||||
|
||||
if (be->type != BM_TYPE_USER && !nodebug) {
|
||||
if (bmp->data == 0)
|
||||
nprintf (("BmpMan", "Loading %s for the first time.\n", be->filename));
|
||||
}
|
||||
|
||||
if ( !Bm_paging ) {
|
||||
if (be->type != BM_TYPE_USER && !nodebug)
|
||||
nprintf(("Paging", "Loading %s (%dx%dx%d)\n", be->filename, bmp->w, bmp->h, true_bpp));
|
||||
}
|
||||
|
||||
// select proper format
|
||||
if (flags & BMP_AABITMAP)
|
||||
BM_SELECT_ALPHA_TEX_FORMAT();
|
||||
else if (flags & BMP_TEX_ANY)
|
||||
BM_SELECT_TEX_FORMAT();
|
||||
else
|
||||
BM_SELECT_SCREEN_FORMAT();
|
||||
|
||||
// make sure we use the real graphic type for EFFs
|
||||
if ( be->type == BM_TYPE_EFF ) {
|
||||
c_type = be->info.ani.eff.type;
|
||||
} else {
|
||||
c_type = be->type;
|
||||
}
|
||||
|
||||
try_compress = (Cmdline_img2dds && Texture_compression_available && is_power_of_two(bmp->w, bmp->h) && !(flags & BMP_AABITMAP) && !Is_standalone);
|
||||
|
||||
switch ( c_type )
|
||||
{
|
||||
case BM_TYPE_PCX:
|
||||
if (try_compress && (true_bpp >= 16)) {
|
||||
if ( !opengl_bm_lock_compress(handle, bitmapnum, be, bmp, true_bpp, flags) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bm_lock_pcx( handle, bitmapnum, be, bmp, true_bpp, flags );
|
||||
break;
|
||||
|
||||
case BM_TYPE_ANI:
|
||||
if (try_compress && (true_bpp >= 16) && !(flags & BMP_TEX_XPARENT)) {
|
||||
if ( !opengl_bm_lock_ani_compress(handle, bitmapnum, be, bmp, true_bpp, flags) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bm_lock_ani( handle, bitmapnum, be, bmp, true_bpp, flags );
|
||||
break;
|
||||
|
||||
case BM_TYPE_TGA:
|
||||
if (try_compress && (true_bpp >= 24)) {
|
||||
if ( !opengl_bm_lock_compress(handle, bitmapnum, be, bmp, true_bpp, flags) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bm_lock_tga( handle, bitmapnum, be, bmp, true_bpp, flags );
|
||||
break;
|
||||
|
||||
case BM_TYPE_PNG:
|
||||
//libpng handles compression with zlib
|
||||
bm_lock_png( handle, bitmapnum, be, bmp, true_bpp, flags );
|
||||
break;
|
||||
|
||||
case BM_TYPE_JPG:
|
||||
if (try_compress) {
|
||||
if ( !opengl_bm_lock_compress(handle, bitmapnum, be, bmp, true_bpp, flags) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bm_lock_jpg( handle, bitmapnum, be, bmp, true_bpp, flags );
|
||||
break;
|
||||
|
||||
case BM_TYPE_DDS:
|
||||
case BM_TYPE_DXT1:
|
||||
case BM_TYPE_DXT3:
|
||||
case BM_TYPE_DXT5:
|
||||
case BM_TYPE_CUBEMAP_DDS:
|
||||
case BM_TYPE_CUBEMAP_DXT1:
|
||||
case BM_TYPE_CUBEMAP_DXT3:
|
||||
case BM_TYPE_CUBEMAP_DXT5:
|
||||
bm_lock_dds( handle, bitmapnum, be, bmp, true_bpp, flags );
|
||||
break;
|
||||
|
||||
case BM_TYPE_USER:
|
||||
bm_lock_user( handle, bitmapnum, be, bmp, true_bpp, flags );
|
||||
break;
|
||||
|
||||
default:
|
||||
Warning(LOCATION, "Unsupported type in bm_lock -- %d\n", c_type );
|
||||
return -1;
|
||||
}
|
||||
|
||||
// always go back to screen format
|
||||
BM_SELECT_SCREEN_FORMAT();
|
||||
|
||||
// make sure we actually did something
|
||||
if ( !(bmp->data) )
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gr_opengl_bm_save_render_target(int n)
|
||||
{
|
||||
Assert( (n >= 0) && (n < MAX_BITMAPS) );
|
||||
@@ -616,3 +171,9 @@ int gr_opengl_bm_set_render_target(int n, int face)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool gr_opengl_bm_data(int n, bitmap* bm)
|
||||
{
|
||||
// Do nothing here
|
||||
return true;
|
||||
}
|
||||
@@ -22,28 +22,13 @@ void gr_opengl_bm_free_data(int n, bool release);
|
||||
// API specifics for creating a user bitmap
|
||||
void gr_opengl_bm_create(int n);
|
||||
|
||||
// Load an image and validate it while retrieving information for later use
|
||||
// Input: type = current BM_TYPE_*
|
||||
// n = location in bm_bitmaps[]
|
||||
// filename = name of the current file
|
||||
// img_cfp = already open CFILE handle, if available
|
||||
//
|
||||
// Output: w = bmp width
|
||||
// h = bmp height
|
||||
// bpp = bmp bits per pixel
|
||||
// c_type = output for an updated BM_TYPE_*
|
||||
// mm_lvl = number of mipmap levels for the image
|
||||
// size = size of the data contained in the image
|
||||
int gr_opengl_bm_load(BM_TYPE type, int n, const char *filename, CFILE *img_cfp = NULL, int *w = 0, int *h = 0, int *bpp = 0, BM_TYPE *c_type = 0, int *mm_lvl = 0, int *size = 0);
|
||||
|
||||
// API specific init instructions
|
||||
void gr_opengl_bm_init(int n);
|
||||
|
||||
// specific instructions for setting up the start of a page-in session
|
||||
void gr_opengl_bm_page_in_start();
|
||||
|
||||
// Lock an image files data into memory
|
||||
int gr_opengl_bm_lock(const char *filename, int handle, int bitmapnum, ubyte bpp, ubyte flags, bool nodebug);
|
||||
bool gr_opengl_bm_data(int n, bitmap* bm);
|
||||
|
||||
void gr_opengl_bm_save_render_target(int slot);
|
||||
int gr_opengl_bm_make_render_target(int n, int *width, int *height, ubyte *bpp, int *mm_lvl, int flags);
|
||||
|
||||
@@ -2036,17 +2036,6 @@ void gr_opengl_flash_alpha(int r, int g, int b, int a)
|
||||
opengl_draw_coloured_quad((GLint)x1, (GLint)y1, (GLint)x2, (GLint)y2);
|
||||
}
|
||||
|
||||
|
||||
void gr_opengl_fade_in(int instantaneous)
|
||||
{
|
||||
// Empty - DDOI
|
||||
}
|
||||
|
||||
void gr_opengl_fade_out(int instantaneous)
|
||||
{
|
||||
// Empty - DDOI
|
||||
}
|
||||
|
||||
void opengl_bitmap_ex_internal(int x, int y, int w, int h, int sx, int sy, int resize_mode)
|
||||
{
|
||||
if ( (w < 1) || (h < 1) ) {
|
||||
@@ -2546,7 +2535,7 @@ void opengl_setup_scene_textures()
|
||||
{
|
||||
Scene_texture_initialized = 0;
|
||||
|
||||
if ( !Use_GLSL || Cmdline_no_fbo || !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) ) {
|
||||
if ( !is_minimum_GLSL_version() || Cmdline_no_fbo || !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) ) {
|
||||
Cmdline_postprocess = 0;
|
||||
Cmdline_softparticles = 0;
|
||||
Cmdline_fb_explosions = 0;
|
||||
@@ -3067,7 +3056,7 @@ void opengl_clear_deferred_buffers()
|
||||
|
||||
void gr_opengl_deferred_lighting_begin()
|
||||
{
|
||||
if (Use_GLSL < 2 || Cmdline_no_deferred_lighting)
|
||||
if (GLSL_version < 120 || Cmdline_no_deferred_lighting)
|
||||
return;
|
||||
|
||||
Deferred_lighting = true;
|
||||
@@ -3093,7 +3082,7 @@ extern float static_tube_factor;
|
||||
|
||||
void gr_opengl_deferred_lighting_finish()
|
||||
{
|
||||
if ( Use_GLSL < 2 || Cmdline_no_deferred_lighting ) {
|
||||
if ( GLSL_version < 120 || Cmdline_no_deferred_lighting ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,6 @@ void gr_opengl_cross_fade(int bmap1, int bmap2, int x1, int y1, int x2, int y2,
|
||||
void gr_opengl_shade(int x, int y, int w, int h, int resize_mode);
|
||||
void gr_opengl_flash(int r, int g, int b);
|
||||
void gr_opengl_flash_alpha(int r, int g, int b, int a);
|
||||
void gr_opengl_fade_in(int instantaneous);
|
||||
void gr_opengl_fade_out(int instantaneous);
|
||||
void gr_opengl_tmapper(int nverts, vertex **verts, uint flags);
|
||||
void gr_opengl_render(int nverts, vertex *verts, uint flags);
|
||||
void gr_opengl_render_effect(int nverts, vertex *verts, float *radius_list, uint flags);
|
||||
|
||||
@@ -444,27 +444,16 @@ void opengl_extensions_init()
|
||||
sscanf(glsl_ver, "%d.%d", &major, &minor);
|
||||
ver = (major * 100) + minor;
|
||||
|
||||
// SM 4.0 compatible or better
|
||||
if (ver >= 400) {
|
||||
Use_GLSL = 4;
|
||||
}
|
||||
// SM 3.0 compatible
|
||||
else if ( ver >= 130 ) {
|
||||
Use_GLSL = 3;
|
||||
}
|
||||
// SM 2.0 compatible
|
||||
else if (ver >= 120) {
|
||||
Use_GLSL = 2;
|
||||
}
|
||||
// we require GLSL 1.20 or higher
|
||||
else if (ver < 110) {
|
||||
Use_GLSL = 0;
|
||||
GLSL_version = ver;
|
||||
|
||||
// we require a minimum GLSL version
|
||||
if (!is_minimum_GLSL_version()) {
|
||||
mprintf((" OpenGL Shading Language version %s is not sufficient to use GLSL mode in FSO. Defaulting to fixed-function renderer.\n", glGetString(GL_SHADING_LANGUAGE_VERSION) ));
|
||||
}
|
||||
}
|
||||
|
||||
// can't have this stuff without GLSL support
|
||||
if ( !Use_GLSL ) {
|
||||
if ( !is_minimum_GLSL_version() ) {
|
||||
Cmdline_normal = 0;
|
||||
Cmdline_height = 0;
|
||||
Cmdline_postprocess = 0;
|
||||
@@ -472,13 +461,13 @@ void opengl_extensions_init()
|
||||
Cmdline_no_deferred_lighting = 1;
|
||||
}
|
||||
|
||||
if ( Use_GLSL < 2 || !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) || !Is_Extension_Enabled(OGL_ARB_FLOATING_POINT_TEXTURES) ) {
|
||||
if ( GLSL_version < 120 || !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) || !Is_Extension_Enabled(OGL_ARB_FLOATING_POINT_TEXTURES) ) {
|
||||
mprintf((" No hardware support for deferred lighting. Deferred lighting will be disabled. \n"));
|
||||
Cmdline_no_deferred_lighting = 1;
|
||||
Cmdline_no_batching = true;
|
||||
}
|
||||
|
||||
if (Use_GLSL) {
|
||||
if (is_minimum_GLSL_version()) {
|
||||
GLint max_texture_units;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &max_texture_units);
|
||||
|
||||
@@ -493,7 +482,7 @@ void opengl_extensions_init()
|
||||
Cmdline_height = 0;
|
||||
} else if (max_texture_units < 4) {
|
||||
mprintf(( "Not enough texture units found for GLSL support. We need at least 4, we found %d.\n", max_texture_units ));
|
||||
Use_GLSL = 0;
|
||||
GLSL_version = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,7 +118,7 @@ void FSLight2GLLight(light *FSLight, opengl_light *GLLight)
|
||||
GLLight->Position[2] = FSLight->vec2.xyz.z;
|
||||
GLLight->Position[3] = 1.0f;
|
||||
|
||||
if ( Use_GLSL > 1 ) {
|
||||
if ( is_minimum_GLSL_version() ) {
|
||||
// Valathil: When using shaders pass the beam direction (not normalized IMPORTANT for calculation of tube)
|
||||
vec3d a;
|
||||
vm_vec_sub(&a, &FSLight->vec2, &FSLight->vec);
|
||||
@@ -164,7 +164,7 @@ void opengl_set_light(int light_num, opengl_light *ltp)
|
||||
GLfloat diffuse[4];
|
||||
memcpy(diffuse, ltp->Diffuse, sizeof(GLfloat) * 4);
|
||||
|
||||
if ( !Use_GLSL && (ltp->type == LT_DIRECTIONAL) && (GL_light_factor < 1.0f) ) {
|
||||
if ( !is_minimum_GLSL_version() && (ltp->type == LT_DIRECTIONAL) && (GL_light_factor < 1.0f) ) {
|
||||
// if we're not using shaders, manually adjust the diffuse light factor.
|
||||
diffuse[0] *= GL_light_factor;
|
||||
diffuse[1] *= GL_light_factor;
|
||||
|
||||
@@ -678,82 +678,94 @@ static bool opengl_post_init_table()
|
||||
}
|
||||
}
|
||||
|
||||
void opengl_post_load_shader(SCP_string &sflags, shader_type shader_t, int flags)
|
||||
void opengl_post_shader_header(SCP_stringstream &sflags, shader_type shader_t, int flags)
|
||||
{
|
||||
if ( shader_t == SDR_TYPE_POST_PROCESS_MAIN ) {
|
||||
for (size_t idx = 0; idx < Post_effects.size(); idx++) {
|
||||
if (flags & (1 << idx)) {
|
||||
sflags += "#define ";
|
||||
sflags += Post_effects[idx].define_name.c_str();
|
||||
sflags += "\n";
|
||||
sflags << "#define ";
|
||||
sflags << Post_effects[idx].define_name.c_str();
|
||||
sflags << "\n";
|
||||
}
|
||||
}
|
||||
} else if ( shader_t == SDR_TYPE_POST_PROCESS_LIGHTSHAFTS ) {
|
||||
char temp[64];
|
||||
sprintf(temp, "#define SAMPLE_NUM %d\n", ls_samplenum);
|
||||
sflags += temp;
|
||||
sflags << temp;
|
||||
} else if ( shader_t == SDR_TYPE_POST_PROCESS_FXAA ) {
|
||||
/* GLSL version < 120 are guarded against reaching this code
|
||||
path via testing is_minimum_GLSL_version().
|
||||
Accordingly do not test for them again here. */
|
||||
if (GLSL_version == 120) {
|
||||
sflags << "#define FXAA_GLSL_120 1\n";
|
||||
sflags << "#define FXAA_GLSL_130 0\n";
|
||||
}
|
||||
if (GLSL_version > 120) {
|
||||
sflags << "#define FXAA_GLSL_120 0\n";
|
||||
sflags << "#define FXAA_GLSL_130 1\n";
|
||||
}
|
||||
|
||||
switch (Cmdline_fxaa_preset) {
|
||||
case 0:
|
||||
sflags += "#define FXAA_QUALITY_PRESET 10\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/6.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/12.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
sflags << "#define FXAA_QUALITY_PRESET 10\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/6.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/12.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
break;
|
||||
case 1:
|
||||
sflags += "#define FXAA_QUALITY_PRESET 11\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/7.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/14.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
sflags << "#define FXAA_QUALITY_PRESET 11\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/7.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/14.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
break;
|
||||
case 2:
|
||||
sflags += "#define FXAA_QUALITY_PRESET 12\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/8.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/16.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
sflags << "#define FXAA_QUALITY_PRESET 12\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/8.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/16.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
break;
|
||||
case 3:
|
||||
sflags += "#define FXAA_QUALITY_PRESET 13\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/9.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/18.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
sflags << "#define FXAA_QUALITY_PRESET 13\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/9.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/18.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
break;
|
||||
case 4:
|
||||
sflags += "#define FXAA_QUALITY_PRESET 14\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/10.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/20.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
sflags << "#define FXAA_QUALITY_PRESET 14\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/10.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/20.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
break;
|
||||
case 5:
|
||||
sflags += "#define FXAA_QUALITY_PRESET 25\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/11.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/22.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
sflags << "#define FXAA_QUALITY_PRESET 25\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/11.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/22.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
break;
|
||||
case 6:
|
||||
sflags += "#define FXAA_QUALITY_PRESET 26\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/12.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/24.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
sflags << "#define FXAA_QUALITY_PRESET 26\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/12.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/24.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
break;
|
||||
case 7:
|
||||
sflags += "#define FXAA_PC 1\n";
|
||||
sflags += "#define FXAA_QUALITY_PRESET 27\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/13.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/26.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
sflags << "#define FXAA_PC 1\n";
|
||||
sflags << "#define FXAA_QUALITY_PRESET 27\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/13.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/26.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
break;
|
||||
case 8:
|
||||
sflags += "#define FXAA_QUALITY_PRESET 28\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/14.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/28.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
sflags << "#define FXAA_QUALITY_PRESET 28\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/14.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/28.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
break;
|
||||
case 9:
|
||||
sflags += "#define FXAA_QUALITY_PRESET 39\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/15.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/32.0)\n";
|
||||
sflags += "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
sflags << "#define FXAA_QUALITY_PRESET 39\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD (1.0/15.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_EDGE_THRESHOLD_MIN (1.0/32.0)\n";
|
||||
sflags << "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -970,7 +982,7 @@ void opengl_post_process_init()
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !Use_GLSL || Cmdline_no_fbo || !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) ) {
|
||||
if ( !is_minimum_GLSL_version() || Cmdline_no_fbo || !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) ) {
|
||||
Cmdline_postprocess = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ void gr_opengl_post_process_end();
|
||||
void get_post_process_effect_names(SCP_vector<SCP_string> &names);
|
||||
|
||||
void opengl_post_init_uniforms(int flags);
|
||||
void opengl_post_load_shader(SCP_string &sflags, shader_type shader_t, int flags);
|
||||
void opengl_post_shader_header(SCP_stringstream &sflags, shader_type shader_t, int flags);
|
||||
|
||||
#endif // _GROPENGLPOSTPROCESSING_H
|
||||
@@ -125,7 +125,7 @@ static opengl_shader_variant_t GL_shader_variants[] = {
|
||||
"Utility mapping" },
|
||||
|
||||
{ SDR_TYPE_MODEL, false, SDR_FLAG_MODEL_TEAMCOLOR, "FLAG_TEAMCOLOR",
|
||||
2, { "stripe_color", "base_color" }, 0, { NULL },
|
||||
3, { "stripe_color", "base_color", "team_glow_enabled" }, 0, { NULL },
|
||||
"Team Colors" },
|
||||
|
||||
{ SDR_TYPE_MODEL, false, SDR_FLAG_MODEL_DEFERRED, "FLAG_DEFERRED",
|
||||
@@ -169,6 +169,8 @@ static const int GL_num_shader_variants = sizeof(GL_shader_variants) / sizeof(op
|
||||
|
||||
opengl_shader_t *Current_shader = NULL;
|
||||
|
||||
// Forward declarations
|
||||
GLhandleARB opengl_shader_create(const SCP_vector<SCP_string>& vs, const SCP_vector<SCP_string>& fs, const SCP_vector<SCP_string>& gs);
|
||||
void opengl_shader_check_info_log(GLhandleARB shader_object);
|
||||
|
||||
/**
|
||||
@@ -226,7 +228,7 @@ void opengl_shader_set_current(int handle)
|
||||
*/
|
||||
int gr_opengl_maybe_create_shader(shader_type shader_t, unsigned int flags)
|
||||
{
|
||||
if (Use_GLSL < 2)
|
||||
if (!is_minimum_GLSL_version())
|
||||
return -1;
|
||||
|
||||
size_t idx;
|
||||
@@ -268,7 +270,7 @@ void opengl_shader_shutdown()
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if ( !Use_GLSL ) {
|
||||
if ( !is_minimum_GLSL_version() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -291,6 +293,31 @@ void opengl_shader_shutdown()
|
||||
}
|
||||
}
|
||||
|
||||
static SCP_string get_shader_header(shader_type type_id, int flags) {
|
||||
SCP_stringstream sflags;
|
||||
|
||||
#ifdef __APPLE__
|
||||
sflags << "#version 120\n";
|
||||
sflags << "#define APPLE\n";
|
||||
#endif
|
||||
|
||||
if (type_id == SDR_TYPE_POST_PROCESS_MAIN || type_id == SDR_TYPE_POST_PROCESS_LIGHTSHAFTS || type_id == SDR_TYPE_POST_PROCESS_FXAA) {
|
||||
// ignore looking for variants. main post process, lightshafts, and FXAA shaders need special headers to be hacked in
|
||||
opengl_post_shader_header(sflags, type_id, flags);
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < GL_num_shader_variants; ++i) {
|
||||
opengl_shader_variant_t &variant = GL_shader_variants[i];
|
||||
|
||||
if (type_id == variant.type_id && flags & variant.flag) {
|
||||
sflags << "#define " << variant.flag_text << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sflags.str();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a shader file from disc or from the builtin defaults in def_files.cpp if none can be found.
|
||||
* This function will also create a list of preprocessor defines for the GLSL compiler based on the shader flags
|
||||
@@ -301,70 +328,38 @@ void opengl_shader_shutdown()
|
||||
* @param flags integer variable holding a combination of SDR_* flags
|
||||
* @return C-string holding the complete shader source code
|
||||
*/
|
||||
static char *opengl_load_shader(shader_type type_id, char *filename, int flags)
|
||||
static SCP_string opengl_load_shader(const char *filename)
|
||||
{
|
||||
SCP_string sflags;
|
||||
|
||||
#ifdef __APPLE__
|
||||
sflags += "#version 120\n";
|
||||
#endif
|
||||
|
||||
if (Use_GLSL >= 4) {
|
||||
sflags += "#define SHADER_MODEL 4\n";
|
||||
}
|
||||
else if (Use_GLSL == 3) {
|
||||
sflags += "#define SHADER_MODEL 3\n";
|
||||
}
|
||||
else {
|
||||
sflags += "#define SHADER_MODEL 2\n";
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
sflags += "#define APPLE\n";
|
||||
#endif
|
||||
|
||||
if (type_id == SDR_TYPE_POST_PROCESS_MAIN || type_id == SDR_TYPE_POST_PROCESS_LIGHTSHAFTS || type_id == SDR_TYPE_POST_PROCESS_FXAA) {
|
||||
// ignore looking for variants. main post process, lightshafts, and FXAA shaders need special headers to be hacked in
|
||||
opengl_post_load_shader(sflags, type_id, flags);
|
||||
} else {
|
||||
for (int i = 0; i < GL_num_shader_variants; ++i) {
|
||||
opengl_shader_variant_t &variant = GL_shader_variants[i];
|
||||
|
||||
if (type_id == variant.type_id && flags & variant.flag) {
|
||||
sflags += "#define " + variant.flag_text + "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char *shader_flags = sflags.c_str();
|
||||
int flags_len = strlen(shader_flags);
|
||||
|
||||
SCP_string content;
|
||||
if (Enable_external_shaders) {
|
||||
CFILE *cf_shader = cfopen(filename, "rt", CFILE_NORMAL, CF_TYPE_EFFECTS);
|
||||
|
||||
if (cf_shader != NULL) {
|
||||
int len = cfilelength(cf_shader);
|
||||
char *shader_c = (char*)vm_malloc(len + flags_len + 1);
|
||||
content.resize(len);
|
||||
|
||||
strcpy(shader_c, shader_flags);
|
||||
memset(shader_c + flags_len, 0, len + 1);
|
||||
cfread(shader_c + flags_len, len + 1, 1, cf_shader);
|
||||
cfread(&content[0], len + 1, 1, cf_shader);
|
||||
cfclose(cf_shader);
|
||||
|
||||
return shader_c;
|
||||
return content;
|
||||
}
|
||||
}
|
||||
|
||||
//If we're still here, proceed with internals
|
||||
mprintf((" Loading built-in default shader for: %s\n", filename));
|
||||
char* def_shader = defaults_get_file(filename);
|
||||
size_t len = strlen(def_shader);
|
||||
char *shader_c = (char*)vm_malloc(len + flags_len + 1);
|
||||
auto def_shader = defaults_get_file(filename);
|
||||
content.assign(def_shader);
|
||||
|
||||
strcpy(shader_c, shader_flags);
|
||||
strcat(shader_c, def_shader);
|
||||
return content;
|
||||
}
|
||||
|
||||
return shader_c;
|
||||
static SCP_vector<SCP_string> opengl_get_shader_content(shader_type type_id, const char* filename, int flags) {
|
||||
SCP_vector<SCP_string> parts;
|
||||
parts.push_back(get_shader_header(type_id, flags));
|
||||
|
||||
parts.push_back(opengl_load_shader(filename));
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -378,7 +373,6 @@ int opengl_compile_shader(shader_type sdr, uint flags)
|
||||
{
|
||||
int sdr_index = -1;
|
||||
int empty_idx;
|
||||
char *vert = NULL, *frag = NULL, *geom = NULL;
|
||||
opengl_shader_t new_shader;
|
||||
|
||||
Assert(sdr < NUM_SHADER_TYPES);
|
||||
@@ -403,36 +397,25 @@ int opengl_compile_shader(shader_type sdr, uint flags)
|
||||
}
|
||||
}
|
||||
|
||||
// read vertex shader
|
||||
if ((vert = opengl_load_shader(sdr_info->type_id, sdr_info->vert, flags)) == NULL) {
|
||||
goto Done;
|
||||
}
|
||||
|
||||
// read fragment shader
|
||||
if ((frag = opengl_load_shader(sdr_info->type_id, sdr_info->frag, flags)) == NULL) {
|
||||
goto Done;
|
||||
}
|
||||
auto vertex_content = opengl_get_shader_content(sdr_info->type_id, sdr_info->vert, flags);
|
||||
auto fragment_content = opengl_get_shader_content(sdr_info->type_id, sdr_info->frag, flags);
|
||||
SCP_vector<SCP_string> geom_content;
|
||||
|
||||
if ( use_geo_sdr ) {
|
||||
if (!Is_Extension_Enabled(OGL_EXT_GEOMETRY_SHADER4)) {
|
||||
goto Done;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// read geometry shader
|
||||
if ((geom = opengl_load_shader(sdr_info->type_id, sdr_info->geo, flags)) == NULL) {
|
||||
goto Done;
|
||||
}
|
||||
geom_content = opengl_get_shader_content(sdr_info->type_id, sdr_info->geo, flags);
|
||||
|
||||
Current_geo_sdr_params = &sdr_info->geo_sdr_info;
|
||||
}
|
||||
|
||||
Verify(vert != NULL);
|
||||
Verify(frag != NULL);
|
||||
|
||||
new_shader.program_id = opengl_shader_create(vert, frag, geom);
|
||||
new_shader.program_id = opengl_shader_create(vertex_content, fragment_content, geom_content);
|
||||
|
||||
if (!new_shader.program_id) {
|
||||
goto Done;
|
||||
return -1;
|
||||
}
|
||||
|
||||
new_shader.shader = sdr_info->type_id;
|
||||
@@ -494,22 +477,6 @@ int opengl_compile_shader(shader_type sdr, uint flags)
|
||||
GL_shader.push_back(new_shader);
|
||||
}
|
||||
|
||||
Done:
|
||||
if (vert != NULL) {
|
||||
vm_free(vert);
|
||||
vert = NULL;
|
||||
}
|
||||
|
||||
if (frag != NULL) {
|
||||
vm_free(frag);
|
||||
frag = NULL;
|
||||
}
|
||||
|
||||
if (geom != NULL ) {
|
||||
vm_free(geom);
|
||||
geom = NULL;
|
||||
}
|
||||
|
||||
return sdr_index;
|
||||
}
|
||||
|
||||
@@ -519,7 +486,7 @@ Done:
|
||||
*/
|
||||
void opengl_shader_init()
|
||||
{
|
||||
if ( !Use_GLSL ) {
|
||||
if ( !is_minimum_GLSL_version() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -536,10 +503,6 @@ void opengl_shader_init()
|
||||
GLuint pixels[4] = {0,0,0,0};
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, &pixels);
|
||||
|
||||
if (Cmdline_no_glsl_model_rendering) {
|
||||
Use_GLSL = 1;
|
||||
}
|
||||
|
||||
GL_shader.clear();
|
||||
|
||||
// Reserve 32 shader slots. This should cover most use cases in real life.
|
||||
@@ -580,14 +543,20 @@ void opengl_shader_check_info_log(GLhandleARB shader_object)
|
||||
* @param shader_type OpenGL ID for the type of shader being used, like GL_FRAGMENT_SHADER_ARB, GL_VERTEX_SHADER_ARB
|
||||
* @return OpenGL handle for the compiled shader object
|
||||
*/
|
||||
GLhandleARB opengl_shader_compile_object(const GLcharARB *shader_source, GLenum shader_type)
|
||||
GLhandleARB opengl_shader_compile_object(const SCP_vector<SCP_string>& shader_source, GLenum shader_type)
|
||||
{
|
||||
GLhandleARB shader_object = 0;
|
||||
GLint status = 0;
|
||||
|
||||
SCP_vector<const GLcharARB*> sources;
|
||||
sources.reserve(shader_source.size());
|
||||
for (auto it = shader_source.begin(); it != shader_source.end(); ++it) {
|
||||
sources.push_back(it->c_str());
|
||||
}
|
||||
|
||||
shader_object = vglCreateShaderObjectARB(shader_type);
|
||||
|
||||
vglShaderSourceARB(shader_object, 1, &shader_source, NULL);
|
||||
vglShaderSourceARB(shader_object, sources.size(), &sources[0], NULL);
|
||||
vglCompileShaderARB(shader_object);
|
||||
|
||||
// check if the compile was successful
|
||||
@@ -691,15 +660,15 @@ GLhandleARB opengl_shader_link_object(GLhandleARB vertex_object, GLhandleARB fra
|
||||
* @param gs Geometry shader source code
|
||||
* @return Internal ID of compiled and linked shader generated by OpenGL
|
||||
*/
|
||||
GLhandleARB opengl_shader_create(const char *vs, const char *fs, const char *gs)
|
||||
GLhandleARB opengl_shader_create(const SCP_vector<SCP_string>& vs, const SCP_vector<SCP_string>& fs, const SCP_vector<SCP_string>& gs)
|
||||
{
|
||||
GLhandleARB vs_o = 0;
|
||||
GLhandleARB fs_o = 0;
|
||||
GLhandleARB gs_o = 0;
|
||||
GLhandleARB program = 0;
|
||||
|
||||
if (vs) {
|
||||
vs_o = opengl_shader_compile_object( (const GLcharARB*)vs, GL_VERTEX_SHADER_ARB );
|
||||
if (!vs.empty()) {
|
||||
vs_o = opengl_shader_compile_object( vs, GL_VERTEX_SHADER_ARB );
|
||||
|
||||
if ( !vs_o ) {
|
||||
mprintf(("ERROR! Unable to create vertex shader!\n"));
|
||||
@@ -707,8 +676,8 @@ GLhandleARB opengl_shader_create(const char *vs, const char *fs, const char *gs)
|
||||
}
|
||||
}
|
||||
|
||||
if (fs) {
|
||||
fs_o = opengl_shader_compile_object( (const GLcharARB*)fs, GL_FRAGMENT_SHADER_ARB );
|
||||
if (!fs.empty()) {
|
||||
fs_o = opengl_shader_compile_object( fs, GL_FRAGMENT_SHADER_ARB );
|
||||
|
||||
if ( !fs_o ) {
|
||||
mprintf(("ERROR! Unable to create fragment shader!\n"));
|
||||
@@ -716,8 +685,8 @@ GLhandleARB opengl_shader_create(const char *vs, const char *fs, const char *gs)
|
||||
}
|
||||
}
|
||||
|
||||
if (gs) {
|
||||
gs_o = opengl_shader_compile_object( (const GLcharARB*)gs, GL_GEOMETRY_SHADER_EXT );
|
||||
if (!gs.empty()) {
|
||||
gs_o = opengl_shader_compile_object( gs, GL_GEOMETRY_SHADER_EXT );
|
||||
|
||||
if ( !gs_o ) {
|
||||
mprintf(("ERROR! Unable to create fragment shader!\n"));
|
||||
|
||||
@@ -137,7 +137,6 @@ void opengl_shader_init();
|
||||
void opengl_shader_shutdown();
|
||||
|
||||
int opengl_compile_shader(shader_type sdr, uint flags);
|
||||
GLhandleARB opengl_shader_create(const char *vs, const char *fs, const char *gs);
|
||||
|
||||
void opengl_shader_init_attribute(const char *attribute_text);
|
||||
GLint opengl_shader_get_attribute(const char *attribute_text);
|
||||
|
||||
@@ -1198,116 +1198,6 @@ void gr_opengl_set_texture_addressing(int mode)
|
||||
GL_CHECK_FOR_ERRORS("end of set_texture_addressing()");
|
||||
}
|
||||
|
||||
int opengl_compress_image( ubyte **compressed_data, ubyte *in_data, int width, int height, int alpha, int num_mipmaps )
|
||||
{
|
||||
Assert( in_data != NULL );
|
||||
|
||||
if ( !Texture_compression_available ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
GL_CHECK_FOR_ERRORS("start of compress_image()");
|
||||
|
||||
GLuint tex;
|
||||
GLint compressed = GL_FALSE;
|
||||
GLint compressed_size = 0;
|
||||
ubyte *out_data = NULL;
|
||||
GLint testing = 0;
|
||||
GLint intFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
|
||||
GLenum texFormat = GL_UNSIGNED_BYTE;
|
||||
GLenum glFormat = GL_BGR;
|
||||
int i;
|
||||
|
||||
if (alpha) {
|
||||
intFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
texFormat = GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||
glFormat = GL_BGRA;
|
||||
}
|
||||
|
||||
glGenTextures(1, &tex);
|
||||
|
||||
GL_state.Texture.SetActiveUnit(0);
|
||||
GL_state.Texture.SetTarget(GL_TEXTURE_2D);
|
||||
GL_state.Texture.Enable(tex);
|
||||
|
||||
// a quick proxy test. this will tell us if it's possible without wasting a lot of time and resources in the attempt
|
||||
glTexImage2D(GL_PROXY_TEXTURE_2D, 0, intFormat, width, height, 0, glFormat, texFormat, in_data);
|
||||
|
||||
glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_ARB, &compressed);
|
||||
glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &testing);
|
||||
|
||||
if (compressed == GL_TRUE) {
|
||||
glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &compressed);
|
||||
}
|
||||
|
||||
if ( (compressed == GL_FALSE) || (compressed != intFormat) || (testing == 0) ) {
|
||||
GL_state.Texture.Disable();
|
||||
GL_state.Texture.Delete(tex);
|
||||
glDeleteTextures(1, &tex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// if mipmaps are requested then make them with the nicest possible settings
|
||||
if (num_mipmaps > 1) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
|
||||
glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST);
|
||||
}
|
||||
|
||||
// use best compression quality
|
||||
glHint(GL_TEXTURE_COMPRESSION_HINT, GL_NICEST);
|
||||
|
||||
// alright, it should work if we are still here, now do it for real
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, intFormat, width, height, 0, glFormat, texFormat, in_data);
|
||||
|
||||
// if we got this far then it should have worked, but check anyway
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_ARB, &compressed);
|
||||
Assert( compressed != GL_FALSE );
|
||||
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &compressed);
|
||||
Assert( compressed == intFormat );
|
||||
|
||||
// for each mipmap level we generate go ahead and figure up the total memory required
|
||||
for (i = 0; i < num_mipmaps; i++) {
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, &testing);
|
||||
compressed_size += testing;
|
||||
}
|
||||
|
||||
out_data = (ubyte*)vm_malloc(compressed_size * sizeof(ubyte));
|
||||
|
||||
Assert( out_data != NULL );
|
||||
|
||||
memset(out_data, 0, compressed_size * sizeof(ubyte));
|
||||
|
||||
// reset compressed_size and go back through each mipmap level to get both size and the image data itself
|
||||
compressed_size = 0;
|
||||
|
||||
for (i = 0; i < num_mipmaps; i++) {
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, &testing);
|
||||
vglGetCompressedTexImageARB(GL_TEXTURE_2D, i, out_data + compressed_size);
|
||||
compressed_size += testing;
|
||||
}
|
||||
|
||||
// done with everything so reset hints to default values
|
||||
if (num_mipmaps > 1) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_FALSE);
|
||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE);
|
||||
}
|
||||
|
||||
glHint(GL_TEXTURE_COMPRESSION_HINT, GL_DONT_CARE);
|
||||
|
||||
|
||||
GL_state.Texture.Disable();
|
||||
GL_state.Texture.Delete(tex);
|
||||
glDeleteTextures(1, &tex);
|
||||
|
||||
// send the data back out
|
||||
*compressed_data = out_data;
|
||||
|
||||
GL_CHECK_FOR_ERRORS("end of compress_image()");
|
||||
|
||||
return compressed_size;
|
||||
}
|
||||
|
||||
void gr_opengl_get_bitmap_from_texture(void* data_out, int bitmap_num)
|
||||
{
|
||||
float u,v;
|
||||
@@ -1318,12 +1208,12 @@ void gr_opengl_get_bitmap_from_texture(void* data_out, int bitmap_num)
|
||||
tcache_slot_opengl *ts = &Textures[n];
|
||||
|
||||
GLenum pixel_format = GL_RGB;
|
||||
GLenum data_format = GL_FLOAT;
|
||||
int bytes_per_pixel = 3 * sizeof(float);
|
||||
GLenum data_format = GL_UNSIGNED_BYTE;
|
||||
int bytes_per_pixel = 3 * sizeof(ubyte);
|
||||
|
||||
if ( bm_has_alpha_channel(bitmap_num) ) {
|
||||
pixel_format = GL_RGBA;
|
||||
bytes_per_pixel = 4 * sizeof(float);
|
||||
bytes_per_pixel = 4 * sizeof(ubyte);
|
||||
}
|
||||
|
||||
opengl_get_texture(ts->texture_target, pixel_format, data_format, 1, ts->w, ts->h, bytes_per_pixel, data_out, 0);
|
||||
|
||||
@@ -226,7 +226,7 @@ int gr_opengl_create_stream_buffer_object()
|
||||
|
||||
int opengl_create_texture_buffer_object()
|
||||
{
|
||||
if ( Use_GLSL < 3 || !Is_Extension_Enabled(OGL_ARB_TEXTURE_BUFFER) || !Is_Extension_Enabled(OGL_ARB_FLOATING_POINT_TEXTURES) ) {
|
||||
if ( GLSL_version < 130 || !Is_Extension_Enabled(OGL_ARB_TEXTURE_BUFFER) || !Is_Extension_Enabled(OGL_ARB_FLOATING_POINT_TEXTURES) ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ bool gr_opengl_config_buffer(const int buffer_id, vertex_buffer *vb, bool update
|
||||
}
|
||||
|
||||
if (vb->flags & VB_FLAG_MODEL_ID) {
|
||||
Assert( Use_GLSL >= 3 );
|
||||
Assert( GLSL_version >= 130 );
|
||||
|
||||
Verify( update_ibuffer_only || vb->model_list->submodels != NULL );
|
||||
vb->stride += (1 * sizeof(GLfloat));
|
||||
@@ -563,7 +563,7 @@ void gr_opengl_set_buffer(int idx)
|
||||
GL_state.Array.BindElementBuffer(0);
|
||||
}
|
||||
|
||||
if ( (Use_GLSL > 1) && !GLSL_override ) {
|
||||
if ( is_minimum_GLSL_version() && !GLSL_override ) {
|
||||
opengl_shader_set_current();
|
||||
}
|
||||
|
||||
@@ -1342,7 +1342,7 @@ void gr_opengl_render_buffer(int start, const vertex_buffer *bufferp, int texi,
|
||||
|
||||
const buffer_data *datap = &bufferp->tex_buf[texi];
|
||||
|
||||
if ( (Use_GLSL > 1) && !GLSL_override ) {
|
||||
if ( is_minimum_GLSL_version() && !GLSL_override ) {
|
||||
opengl_render_pipeline_program(start, bufferp, datap, flags);
|
||||
} else {
|
||||
opengl_render_pipeline_fixed(start, bufferp, datap, flags);
|
||||
@@ -1837,7 +1837,7 @@ void gr_opengl_end_clip_plane()
|
||||
return;
|
||||
}
|
||||
|
||||
if ( Use_GLSL > 1 ) {
|
||||
if ( is_minimum_GLSL_version() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1850,7 +1850,7 @@ void gr_opengl_start_clip_plane()
|
||||
return;
|
||||
}
|
||||
|
||||
if ( Use_GLSL > 1 ) {
|
||||
if ( is_minimum_GLSL_version() ) {
|
||||
// bail since we're gonna clip in the shader
|
||||
return;
|
||||
}
|
||||
@@ -1871,70 +1871,6 @@ void gr_opengl_start_clip_plane()
|
||||
GL_state.ClipPlane(0, GL_TRUE);
|
||||
}
|
||||
|
||||
//************************************State blocks************************************
|
||||
|
||||
//this is an array of reference counts for state block IDs
|
||||
//static GLuint *state_blocks = NULL;
|
||||
//static uint n_state_blocks = 0;
|
||||
//static GLuint current_state_block;
|
||||
|
||||
//this is used for places in the array that a state block ID no longer exists
|
||||
//#define EMPTY_STATE_BOX_REF_COUNT 0xffffffff
|
||||
|
||||
int opengl_get_new_state_block_internal()
|
||||
{
|
||||
/* uint i;
|
||||
|
||||
if (state_blocks == NULL) {
|
||||
state_blocks = (GLuint*)vm_malloc(sizeof(GLuint));
|
||||
memset(&state_blocks[n_state_blocks], 'f', sizeof(GLuint));
|
||||
n_state_blocks++;
|
||||
}
|
||||
|
||||
for (i = 0; i < n_state_blocks; i++) {
|
||||
if (state_blocks[i] == EMPTY_STATE_BOX_REF_COUNT) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
// "i" should be n_state_blocks since we got here.
|
||||
state_blocks = (GLuint*)vm_realloc(state_blocks, sizeof(GLuint) * i);
|
||||
memset(&state_blocks[i], 'f', sizeof(GLuint));
|
||||
|
||||
n_state_blocks++;
|
||||
|
||||
return n_state_blocks-1;*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
void gr_opengl_start_state_block()
|
||||
{
|
||||
/* gr_screen.recording_state_block = true;
|
||||
current_state_block = opengl_get_new_state_block_internal();
|
||||
glNewList(current_state_block, GL_COMPILE);*/
|
||||
}
|
||||
|
||||
int gr_opengl_end_state_block()
|
||||
{
|
||||
/* //sanity check
|
||||
if(!gr_screen.recording_state_block)
|
||||
return -1;
|
||||
|
||||
//End the display list
|
||||
gr_screen.recording_state_block = false;
|
||||
glEndList();
|
||||
|
||||
//now return
|
||||
return current_state_block;*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
void gr_opengl_set_state_block(int handle)
|
||||
{
|
||||
/* if(handle < 0) return;
|
||||
glCallList(handle);*/
|
||||
}
|
||||
|
||||
extern bool Glowpoint_override;
|
||||
bool Glowpoint_override_save;
|
||||
|
||||
@@ -2081,18 +2017,14 @@ void opengl_tnl_set_material(int flags, uint shader_flags, int tmap_type)
|
||||
// 0 == env with non-alpha specmap, 1 == env with alpha specmap
|
||||
int alpha_spec = bm_has_alpha_channel(SPECMAP) ? 1 : 0;
|
||||
|
||||
matrix4 texture_mat, envMatrix;
|
||||
matrix4 texture_mat;
|
||||
|
||||
for ( int i = 0; i < 16; ++i ) {
|
||||
texture_mat.a1d[i] = GL_env_texture_matrix[i];
|
||||
}
|
||||
|
||||
if (!vm_inverse_matrix4(&texture_mat, &envMatrix)) {
|
||||
Error(LOCATION, "Unable to invert environment mapping matrix.\n");
|
||||
}
|
||||
|
||||
GL_state.Uniform.setUniformi("alpha_spec", alpha_spec);
|
||||
GL_state.Uniform.setUniformMatrix4fv("envMatrix", 1, &envMatrix);
|
||||
GL_state.Uniform.setUniformMatrix4fv("envMatrix", 1, &texture_mat);
|
||||
GL_state.Uniform.setUniformi("sEnvmap", render_pass);
|
||||
|
||||
gr_opengl_tcache_set(ENVMAP, TCACHE_TYPE_CUBEMAP, &u_scale, &v_scale, render_pass);
|
||||
@@ -2187,7 +2119,7 @@ void opengl_tnl_set_material(int flags, uint shader_flags, int tmap_type)
|
||||
// Team colors are passed to the shader here, but the shader needs to handle their application.
|
||||
// By default, this is handled through the r and g channels of the misc map, but this can be changed
|
||||
// in the shader; test versions of this used the normal map r and b channels
|
||||
if ( shader_flags & SDR_FLAG_MODEL_TEAMCOLOR ) {
|
||||
if ( (shader_flags & SDR_FLAG_MODEL_TEAMCOLOR) && (shader_flags & SDR_FLAG_MODEL_MISC_MAP) ) {
|
||||
vec3d stripe_color;
|
||||
vec3d base_color;
|
||||
|
||||
@@ -2201,6 +2133,12 @@ void opengl_tnl_set_material(int flags, uint shader_flags, int tmap_type)
|
||||
|
||||
GL_state.Uniform.setUniform3f("stripe_color", stripe_color);
|
||||
GL_state.Uniform.setUniform3f("base_color", base_color);
|
||||
|
||||
if ( bm_has_alpha_channel(MISCMAP) ) {
|
||||
GL_state.Uniform.setUniformi("team_glow_enabled", 1);
|
||||
} else {
|
||||
GL_state.Uniform.setUniformi("team_glow_enabled", 0);
|
||||
}
|
||||
}
|
||||
|
||||
if ( shader_flags & SDR_FLAG_MODEL_THRUSTER ) {
|
||||
|
||||
@@ -63,10 +63,6 @@ void gr_opengl_set_transform_buffer_offset(int offset);
|
||||
int gr_opengl_create_stream_buffer_object();
|
||||
void gr_opengl_render_stream_buffer(int buffer_handle, int offset, int n_verts, int flags);
|
||||
|
||||
void gr_opengl_start_state_block();
|
||||
int gr_opengl_end_state_block();
|
||||
void gr_opengl_set_state_block(int);
|
||||
|
||||
void gr_opengl_set_thrust_scale(float scale = -1.0f);
|
||||
void gr_opengl_set_team_color(const team_color *colors);
|
||||
|
||||
|
||||
+7
-238
@@ -138,18 +138,6 @@ void gr_stub_destroy_light(int idx)
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_dump_frame()
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_dump_frame_start(int first_frame, int frames_between_dumps)
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_dump_frame_stop()
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_end_clip_plane()
|
||||
{
|
||||
}
|
||||
@@ -166,14 +154,6 @@ void gr_stub_end_view_matrix()
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_fade_in(int instantaneous)
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_fade_out(int instantaneous)
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_flash_alpha(int r, int g, int b, int a)
|
||||
{
|
||||
}
|
||||
@@ -474,24 +454,6 @@ void gr_stub_set_texture_panning(float u, float v, bool enable)
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_setup_background_fog(bool set)
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_start_state_block()
|
||||
{
|
||||
gr_screen.recording_state_block = false;
|
||||
}
|
||||
|
||||
int gr_stub_end_state_block()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
void gr_stub_set_state_block(int handle)
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_set_line_width(float width)
|
||||
{
|
||||
}
|
||||
@@ -521,191 +483,6 @@ void gr_stub_get_bitmap_from_texture(void* data_out, int bitmap_num)
|
||||
|
||||
}
|
||||
|
||||
// bitmap functions
|
||||
int gr_stub_bm_load(BM_TYPE type, int n, const char *filename, CFILE *img_cfp, int *w, int *h, int *bpp, BM_TYPE *c_type, int *mm_lvl, int *size)
|
||||
{
|
||||
int dds_ct;
|
||||
|
||||
if (type == BM_TYPE_DDS) {
|
||||
int dds_error = dds_read_header( filename, img_cfp, w, h, bpp, &dds_ct, mm_lvl, size );
|
||||
if (dds_error != DDS_ERROR_NONE) {
|
||||
mprintf(("DDS ERROR: Couldn't open '%s' -- %s\n", filename, dds_error_string(dds_error)));
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (dds_ct) {
|
||||
case DDS_DXT1:
|
||||
*c_type = BM_TYPE_DXT1;
|
||||
break;
|
||||
|
||||
case DDS_DXT3:
|
||||
*c_type = BM_TYPE_DXT3;
|
||||
break;
|
||||
|
||||
case DDS_DXT5:
|
||||
*c_type = BM_TYPE_DXT5;
|
||||
break;
|
||||
|
||||
case DDS_UNCOMPRESSED:
|
||||
*c_type = BM_TYPE_DDS;
|
||||
break;
|
||||
|
||||
case DDS_CUBEMAP_DXT1:
|
||||
*c_type = BM_TYPE_CUBEMAP_DXT1;
|
||||
break;
|
||||
|
||||
case DDS_CUBEMAP_DXT3:
|
||||
*c_type = BM_TYPE_CUBEMAP_DXT3;
|
||||
break;
|
||||
|
||||
case DDS_CUBEMAP_DXT5:
|
||||
*c_type = BM_TYPE_CUBEMAP_DXT5;
|
||||
break;
|
||||
|
||||
case DDS_CUBEMAP_UNCOMPRESSED:
|
||||
*c_type = BM_TYPE_CUBEMAP_DDS;
|
||||
break;
|
||||
|
||||
default:
|
||||
Error(LOCATION, "bad DDS file compression. Not using DXT1,3,5 %s", filename);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// if its a tga file
|
||||
else if (type == BM_TYPE_TGA) {
|
||||
int tga_error = targa_read_header( filename, img_cfp, w, h, bpp, NULL );
|
||||
if ( tga_error != TARGA_ERROR_NONE ) {
|
||||
mprintf(( "tga: Couldn't open '%s'\n", filename ));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// if its a png file
|
||||
else if (type == BM_TYPE_PNG) {
|
||||
int png_error=png_read_header( filename, img_cfp, w, h, bpp, NULL );
|
||||
if ( png_error != PNG_ERROR_NONE ) {
|
||||
mprintf(( "png: Couldn't open '%s'\n", filename ));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// if its a jpg file
|
||||
else if (type == BM_TYPE_JPG) {
|
||||
int jpg_error=jpeg_read_header( filename, img_cfp, w, h, bpp, NULL );
|
||||
if ( jpg_error != JPEG_ERROR_NONE ) {
|
||||
mprintf(( "jpg: Couldn't open '%s'\n", filename ));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// if its a pcx file
|
||||
else if (type == BM_TYPE_PCX) {
|
||||
int pcx_error = pcx_read_header( filename, img_cfp, w, h, bpp, NULL );
|
||||
if ( pcx_error != PCX_ERROR_NONE ) {
|
||||
mprintf(( "pcx: Couldn't open '%s'\n", filename ));
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
Assert( 0 );
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gr_stub_bm_lock(const char *filename, int handle, int bitmapnum, ubyte bpp, ubyte flags, bool nodebug)
|
||||
{
|
||||
BM_TYPE c_type = BM_TYPE_NONE;
|
||||
ubyte true_bpp;
|
||||
|
||||
bitmap_entry *be = &bm_bitmaps[bitmapnum];
|
||||
bitmap *bmp = &be->bm;
|
||||
|
||||
true_bpp = 8;
|
||||
|
||||
// don't do a bpp check here since it could be different in OGL - taylor
|
||||
if ( bmp->data == 0 ) {
|
||||
Assert(be->ref_count == 1);
|
||||
|
||||
if ( be->type != BM_TYPE_USER ) {
|
||||
if ( bmp->data == 0 ) {
|
||||
nprintf (("BmpMan","Loading %s for the first time.\n", be->filename));
|
||||
}
|
||||
}
|
||||
|
||||
if ( !Bm_paging ) {
|
||||
if ( be->type != BM_TYPE_USER ) {
|
||||
nprintf(( "Paging", "Loading %s (%dx%dx%d)\n", be->filename, bmp->w, bmp->h, true_bpp ));
|
||||
}
|
||||
}
|
||||
|
||||
// select proper format
|
||||
if(flags & BMP_AABITMAP){
|
||||
BM_SELECT_ALPHA_TEX_FORMAT();
|
||||
} else if(flags & BMP_TEX_ANY){
|
||||
BM_SELECT_TEX_FORMAT();
|
||||
} else {
|
||||
BM_SELECT_SCREEN_FORMAT();
|
||||
}
|
||||
|
||||
// make sure we use the real graphic type for EFFs
|
||||
if ( be->type == BM_TYPE_EFF ) {
|
||||
c_type = be->info.ani.eff.type;
|
||||
} else {
|
||||
c_type = be->type;
|
||||
}
|
||||
|
||||
switch ( c_type ) {
|
||||
case BM_TYPE_PCX:
|
||||
bm_lock_pcx( handle, bitmapnum, be, bmp, true_bpp, flags );
|
||||
break;
|
||||
|
||||
case BM_TYPE_ANI:
|
||||
bm_lock_ani( handle, bitmapnum, be, bmp, true_bpp, flags );
|
||||
break;
|
||||
|
||||
case BM_TYPE_TGA:
|
||||
bm_lock_tga( handle, bitmapnum, be, bmp, true_bpp, flags );
|
||||
break;
|
||||
|
||||
case BM_TYPE_PNG:
|
||||
bm_lock_png( handle, bitmapnum, be, bmp, bmp->true_bpp, flags );
|
||||
break;
|
||||
|
||||
case BM_TYPE_JPG:
|
||||
bm_lock_jpg( handle, bitmapnum, be, bmp, bmp->true_bpp, flags );
|
||||
break;
|
||||
|
||||
case BM_TYPE_DDS:
|
||||
case BM_TYPE_DXT1:
|
||||
case BM_TYPE_DXT3:
|
||||
case BM_TYPE_DXT5:
|
||||
case BM_TYPE_CUBEMAP_DDS:
|
||||
case BM_TYPE_CUBEMAP_DXT1:
|
||||
case BM_TYPE_CUBEMAP_DXT3:
|
||||
case BM_TYPE_CUBEMAP_DXT5:
|
||||
bm_lock_dds( handle, bitmapnum, be, bmp, true_bpp, flags );
|
||||
break;
|
||||
|
||||
case BM_TYPE_USER:
|
||||
bm_lock_user( handle, bitmapnum, be, bmp, true_bpp, flags );
|
||||
break;
|
||||
|
||||
default:
|
||||
Warning(LOCATION, "Unsupported type in bm_lock -- %d\n", c_type );
|
||||
return -1;
|
||||
}
|
||||
|
||||
// always go back to screen format
|
||||
BM_SELECT_SCREEN_FORMAT();
|
||||
}
|
||||
|
||||
// make sure we actually did something
|
||||
if ( !(bmp->data) ) {
|
||||
// crap, bail...
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
int gr_stub_bm_make_render_target(int n, int *width, int *height, ubyte *bpp, int *mm_lvl, int flags)
|
||||
{
|
||||
return 0;
|
||||
@@ -732,6 +509,11 @@ void gr_stub_bm_page_in_start()
|
||||
{
|
||||
}
|
||||
|
||||
bool gr_stub_bm_data(int n, bitmap* bm)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int gr_stub_maybe_create_shader(shader_type shader_t, unsigned int flags) {
|
||||
return -1;
|
||||
}
|
||||
@@ -809,8 +591,6 @@ bool gr_stub_init()
|
||||
gr_screen.gf_set_palette = gr_stub_set_palette;
|
||||
gr_screen.gf_print_screen = gr_stub_print_screen;
|
||||
|
||||
gr_screen.gf_fade_in = gr_stub_fade_in;
|
||||
gr_screen.gf_fade_out = gr_stub_fade_out;
|
||||
gr_screen.gf_flash = gr_stub_flash;
|
||||
gr_screen.gf_flash_alpha = gr_stub_flash_alpha;
|
||||
|
||||
@@ -827,10 +607,6 @@ bool gr_stub_init()
|
||||
gr_screen.gf_restore_screen = gr_stub_restore_screen;
|
||||
gr_screen.gf_free_screen = gr_stub_free_screen;
|
||||
|
||||
gr_screen.gf_dump_frame_start = gr_stub_dump_frame_start;
|
||||
gr_screen.gf_dump_frame_stop = gr_stub_dump_frame_stop;
|
||||
gr_screen.gf_dump_frame = gr_stub_dump_frame;
|
||||
|
||||
gr_screen.gf_set_gamma = gr_stub_set_gamma;
|
||||
|
||||
gr_screen.gf_fog_set = gr_stub_fog_set;
|
||||
@@ -842,9 +618,8 @@ bool gr_stub_init()
|
||||
gr_screen.gf_bm_free_data = gr_stub_bm_free_data;
|
||||
gr_screen.gf_bm_create = gr_stub_bm_create;
|
||||
gr_screen.gf_bm_init = gr_stub_bm_init;
|
||||
gr_screen.gf_bm_load = gr_stub_bm_load;
|
||||
gr_screen.gf_bm_page_in_start = gr_stub_bm_page_in_start;
|
||||
gr_screen.gf_bm_lock = gr_stub_bm_lock;
|
||||
gr_screen.gf_bm_data = gr_stub_bm_data;
|
||||
gr_screen.gf_bm_make_render_target = gr_stub_bm_make_render_target;
|
||||
gr_screen.gf_bm_set_render_target = gr_stub_bm_set_render_target;
|
||||
|
||||
@@ -924,13 +699,7 @@ bool gr_stub_init()
|
||||
gr_screen.gf_pop_scale_matrix = gr_stub_pop_scale_matrix;
|
||||
gr_screen.gf_center_alpha = gr_stub_center_alpha;
|
||||
gr_screen.gf_set_thrust_scale = gr_stub_set_thrust_scale;
|
||||
|
||||
gr_screen.gf_setup_background_fog = gr_stub_setup_background_fog;
|
||||
|
||||
gr_screen.gf_start_state_block = gr_stub_start_state_block;
|
||||
gr_screen.gf_end_state_block = gr_stub_end_state_block;
|
||||
gr_screen.gf_set_state_block = gr_stub_set_state_block;
|
||||
|
||||
|
||||
gr_screen.gf_draw_line_list = gr_stub_draw_line_list;
|
||||
|
||||
gr_screen.gf_set_line_width = gr_stub_set_line_width;
|
||||
|
||||
+29
-58
@@ -35,7 +35,6 @@
|
||||
vec3d lock_world_pos;
|
||||
|
||||
static float Lock_start_dist;
|
||||
static int Rotate_time_id = 1; // timer id for controlling how often to rotate triangles around lock indicator
|
||||
|
||||
int Missile_track_loop = -1;
|
||||
int Missile_lock_loop = -1;
|
||||
@@ -68,9 +67,6 @@ int Lock_gauge_half_h[GR_NUM_RESOLUTIONS] = {
|
||||
25
|
||||
};
|
||||
|
||||
int Lock_gauge_loaded = 0;
|
||||
int Lock_gauge_draw = 0;
|
||||
int Lock_gauge_draw_stamp = -1;
|
||||
#define LOCK_GAUGE_BLINK_RATE 5 // blinks/sec
|
||||
|
||||
int Lockspin_half_w[NUM_HUD_RETICLE_STYLES][GR_NUM_RESOLUTIONS] = {
|
||||
@@ -106,43 +102,6 @@ void hud_init_missile_lock()
|
||||
Player_ai->current_target_is_locked = 0;
|
||||
|
||||
Player_ai->last_secondary_index = -1;
|
||||
|
||||
Rotate_time_id = 1;
|
||||
|
||||
// Load in the frames need for the lead indicator
|
||||
//if (!Lock_gauge_loaded) {
|
||||
//Commented out due to changes in HUD loading behaviour. These checks are no longer needed at this point.
|
||||
|
||||
Lock_gauge_loaded = 1;
|
||||
|
||||
Lock_gauge_draw_stamp = -1;
|
||||
Lock_gauge_draw = 0;
|
||||
//}
|
||||
}
|
||||
|
||||
void hud_draw_diamond(int x, int y, int width, int height)
|
||||
{
|
||||
Assert(height>0);
|
||||
Assert(width>0);
|
||||
|
||||
int x1,x2,x3,x4,y1,y2,y3,y4;
|
||||
|
||||
x1=x;
|
||||
y1=y-height/2;
|
||||
|
||||
x2=x+width/2;
|
||||
y2=y;
|
||||
|
||||
x3=x;
|
||||
y3=y+height/2;
|
||||
|
||||
x4=x-width/2;
|
||||
y4=y;
|
||||
|
||||
gr_line(x1,y1,x2,y2);
|
||||
gr_line(x2,y2,x3,y3);
|
||||
gr_line(x3,y3,x4,y4);
|
||||
gr_line(x4,y4,x1,y1);
|
||||
}
|
||||
|
||||
HudGaugeLock::HudGaugeLock():
|
||||
@@ -197,6 +156,10 @@ void HudGaugeLock::initialize()
|
||||
Lock_gauge_draw_stamp = -1;
|
||||
Lock_gauge_draw = 0;
|
||||
Rotate_time_id = 1;
|
||||
Last_lock_status = false;
|
||||
|
||||
Lock_anim.time_elapsed = 0.0f;
|
||||
Lock_gauge.time_elapsed = 0.0f;
|
||||
|
||||
HudGauge::initialize();
|
||||
}
|
||||
@@ -211,6 +174,15 @@ void HudGaugeLock::render(float frametime)
|
||||
object *targetp;
|
||||
vertex lock_point;
|
||||
|
||||
bool locked = Player_ai->current_target_is_locked ? true : false;
|
||||
bool reset_timers = false;
|
||||
|
||||
if ( locked != Last_lock_status ) {
|
||||
// check if player lock status has changed since the last frame.
|
||||
reset_timers = true;
|
||||
Last_lock_status = locked;
|
||||
}
|
||||
|
||||
if (Player_ai->target_objnum == -1) {
|
||||
return;
|
||||
}
|
||||
@@ -264,26 +236,27 @@ void HudGaugeLock::render(float frametime)
|
||||
|
||||
// show the rotating triangles if target is locked
|
||||
renderLockTriangles(sx, sy, frametime);
|
||||
|
||||
if ( reset_timers ) {
|
||||
Lock_gauge.time_elapsed = 0.0f;
|
||||
}
|
||||
} else {
|
||||
const float scaling_factor = (gr_screen.clip_center_x < gr_screen.clip_center_y) ? (gr_screen.clip_center_x / VIRTUAL_FRAME_HALF_WIDTH) : (gr_screen.clip_center_y / VIRTUAL_FRAME_HALF_HEIGHT);
|
||||
sx = fl2i(lock_point.screen.xyw.x) - fl2i(i2fl(Player->current_target_sx - Players[Player_num].lock_indicator_x) * scaling_factor);
|
||||
sy = fl2i(lock_point.screen.xyw.y) - fl2i(i2fl(Player->current_target_sy - Players[Player_num].lock_indicator_y) * scaling_factor);
|
||||
gr_unsize_screen_pos(&sx, &sy);
|
||||
|
||||
if ( reset_timers ) {
|
||||
Lock_gauge_draw_stamp = -1;
|
||||
Lock_gauge_draw = 0;
|
||||
Lock_anim.time_elapsed = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
// show locked indicator
|
||||
/*
|
||||
if ( Lock_gauge.first_frame >= 0 ) {
|
||||
gr_set_bitmap(Lock_gauge.first_frame);
|
||||
gr_aabitmap(sx - Lock_gauge_half_w[gr_screen.res], sy - Lock_gauge_half_h[gr_screen.res]);
|
||||
} else {
|
||||
hud_draw_diamond(sx, sy, Lock_target_box_width[gr_screen.res], Lock_target_box_height[gr_screen.res]);
|
||||
}
|
||||
*/
|
||||
Lock_gauge.sx = sx - Lock_gauge_half_w;
|
||||
Lock_gauge.sy = sy - Lock_gauge_half_h;
|
||||
if(Player_ai->current_target_is_locked){
|
||||
Lock_gauge.time_elapsed = 0.0f;
|
||||
if (Player_ai->current_target_is_locked) {
|
||||
hud_anim_render(&Lock_gauge, 0.0f, 1);
|
||||
} else {
|
||||
hud_anim_render(&Lock_gauge, frametime, 1);
|
||||
@@ -320,12 +293,6 @@ void hud_lock_reset(float lock_time_scale)
|
||||
Player->locking_on_center=0;
|
||||
Player->locking_subsys_parent=-1;
|
||||
hud_stop_looped_locking_sounds();
|
||||
|
||||
Lock_gauge_draw_stamp = -1;
|
||||
Lock_gauge_draw = 0;
|
||||
|
||||
// reset the lock anim time elapsed
|
||||
// Lock_anim.time_elapsed = 0.0f;
|
||||
}
|
||||
|
||||
// Determine if the locking code has a point to track
|
||||
@@ -727,7 +694,11 @@ void HudGaugeLock::renderLockTriangles(int center_x, int center_y, float frameti
|
||||
// maybe draw the anim
|
||||
Lock_gauge.time_elapsed = 0.0f;
|
||||
if(Lock_gauge_draw){
|
||||
hud_anim_render(&Lock_anim, frametime, 1, 0, 1);
|
||||
if ( loop_locked_anim ) {
|
||||
hud_anim_render(&Lock_anim, frametime, 1, 1, 0);
|
||||
} else {
|
||||
hud_anim_render(&Lock_anim, frametime, 1, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,8 @@ protected:
|
||||
int Rotate_time_id;
|
||||
int Lock_gauge_draw_stamp;
|
||||
int Lock_gauge_draw;
|
||||
|
||||
bool Last_lock_status;
|
||||
public:
|
||||
HudGaugeLock();
|
||||
void initBitmaps(char *lock_gauge_fname, char *lock_anim_fname);
|
||||
|
||||
+820
-795
File diff suppressed because it is too large.
Load diff
+88
-57
@@ -20,6 +20,37 @@ extern float Hud_speed_multiplier;
|
||||
#define HUD_RETICLE_STYLE_FS2 1
|
||||
|
||||
extern int Hud_reticle_style;
|
||||
extern bool Scale_retail_gauges;
|
||||
extern int Force_scaling_above_res_global[2];
|
||||
extern int Hud_font;
|
||||
|
||||
typedef struct gauge_settings {
|
||||
int base_res[2];
|
||||
int font_num;
|
||||
bool scale_gauge;
|
||||
int force_scaling_above_res[2];
|
||||
SCP_vector<int>* ship_idx;
|
||||
color *use_clr;
|
||||
float origin[2];
|
||||
int offset[2];
|
||||
bool use_coords;
|
||||
int coords[2];
|
||||
bool set_position;
|
||||
bool set_colour;
|
||||
bool slew;
|
||||
|
||||
gauge_settings() : font_num(Hud_font), scale_gauge(Scale_retail_gauges), ship_idx(nullptr), use_clr(nullptr), use_coords(false), set_position(true), set_colour(true), slew(false) {
|
||||
base_res[0] = -1;
|
||||
base_res[1] = -1;
|
||||
memcpy(force_scaling_above_res, Force_scaling_above_res_global, sizeof(force_scaling_above_res));
|
||||
origin[0] = 0.0f;
|
||||
origin[1] = 0.0f;
|
||||
offset[0] = 0;
|
||||
offset[1] = 0;
|
||||
coords[0] = 0;
|
||||
coords[1] = 0;
|
||||
}
|
||||
} gauge_settings;
|
||||
|
||||
//Functions
|
||||
int hud_get_gauge_index(char* name);
|
||||
@@ -31,174 +62,174 @@ void check_color(int *colorp);
|
||||
|
||||
#define NUM_HUD_OBJECT_ENTRIES 56 // not used anywhere?
|
||||
int parse_gauge_type();
|
||||
void load_gauge(int gauge, int base_w = -1, int base_h = -1, int font = -1, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge(int gauge, gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_CUSTOM 0
|
||||
void load_gauge_custom(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_custom(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_MESSAGES 1
|
||||
void load_gauge_messages(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_messages(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_TRAINING_MESSAGES 2
|
||||
void load_gauge_training_messages(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_training_messages(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_SUPPORT 3
|
||||
void load_gauge_support(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_support(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_DAMAGE 4
|
||||
void load_gauge_damage(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_damage(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_WINGMAN_STATUS 5
|
||||
void load_gauge_wingman_status(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_wingman_status(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_AUTO_SPEED 6
|
||||
void load_gauge_auto_speed(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_auto_speed(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_AUTO_TARGET 7
|
||||
void load_gauge_auto_target(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_auto_target(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_CMEASURES 8
|
||||
void load_gauge_countermeasures(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_countermeasures(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_TALKING_HEAD 9
|
||||
void load_gauge_talking_head(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_talking_head(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_DIRECTIVES 10
|
||||
void load_gauge_directives(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_directives(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_WEAPONS 11
|
||||
void load_gauge_weapons(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_weapons(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_OBJ_NOTIFY 12
|
||||
void load_gauge_objective_notify(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_objective_notify(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_SQUAD_MSG 13
|
||||
void load_gauge_squad_message(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_squad_message(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_LAG 14
|
||||
void load_gauge_lag(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_lag(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_MINI_SHIELD 15
|
||||
void load_gauge_mini_shields(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_mini_shields(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_PLAYER_SHIELD 16
|
||||
void load_gauge_player_shields(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_player_shields(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_TARGET_SHIELD 17
|
||||
void load_gauge_target_shields(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_target_shields(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_ESCORT 18
|
||||
void load_gauge_escort_view(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_escort_view(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_MISSION_TIME 19
|
||||
void load_gauge_mission_time(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_mission_time(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_ETS_WEAPONS 20
|
||||
void load_gauge_ets_weapons(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_ets_weapons(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_ETS_SHIELDS 21
|
||||
void load_gauge_ets_shields(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_ets_shields(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_ETS_ENGINES 22
|
||||
void load_gauge_ets_engines(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_ets_engines(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_TARGET_MONITOR 23
|
||||
void load_gauge_target_monitor(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_target_monitor(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_EXTRA_TARGET_DATA 24
|
||||
void load_gauge_extra_target_data(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_extra_target_data(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_RADAR_STD 25
|
||||
void load_gauge_radar_std(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_radar_std(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_RADAR_ORB 26
|
||||
void load_gauge_radar_orb(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_radar_orb(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_RADAR_BSG 27
|
||||
void load_gauge_radar_dradis(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_radar_dradis(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_AFTERBURNER 28
|
||||
void load_gauge_afterburner(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_afterburner(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_WEAPON_ENERGY 29
|
||||
void load_gauge_weapon_energy(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_weapon_energy(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_TEXT_WARNINGS 30
|
||||
void load_gauge_text_warnings(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_text_warnings(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_CENTER_RETICLE 31
|
||||
void load_gauge_center_reticle(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_center_reticle(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_THROTTLE 32
|
||||
void load_gauge_throttle(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_throttle(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_THREAT 33
|
||||
void load_gauge_threat_indicator(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_threat_indicator(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_LEAD 34
|
||||
void load_gauge_lead(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_lead(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_LEAD_SIGHT 35
|
||||
void load_gauge_lead_sight(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_lead_sight(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_LOCK 36
|
||||
void load_gauge_lock(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_lock(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_WEAPON_LINKING 37
|
||||
void load_gauge_weapon_linking(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_weapon_linking(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_MULTI_MSG 38
|
||||
void load_gauge_multi_msg(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_multi_msg(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_VOICE_STATUS 39
|
||||
void load_gauge_voice_status(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_voice_status(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_PING 40
|
||||
void load_gauge_ping(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_ping(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_SUPERNOVA 41
|
||||
void load_gauge_supernova(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_supernova(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_OFFSCREEN 42
|
||||
void load_gauge_offscreen(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_offscreen(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_BRACKETS 43
|
||||
void load_gauge_brackets(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_brackets(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_ORIENTATION_TEE 44
|
||||
void load_gauge_orientation_tee(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_orientation_tee(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_HOSTILE_TRI 45
|
||||
void load_gauge_hostile_tri(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_hostile_tri(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_TARGET_TRI 46
|
||||
void load_gauge_target_tri(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_target_tri(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_MISSILE_TRI 47
|
||||
void load_gauge_missile_tri(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_missile_tri(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_KILLS 48
|
||||
void load_gauge_kills(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_kills(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_FIXED_MESSAGES 49
|
||||
void load_gauge_fixed_messages(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_fixed_messages(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_ETS_RETAIL 50
|
||||
void load_gauge_ets_retail(int base_w, int base_h, int hud_font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_ets_retail(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_FLIGHT_PATH 51
|
||||
void load_gauge_flight_path(int base_w, int base_h, int font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_flight_path(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_WARHEAD_COUNT 52
|
||||
void load_gauge_warhead_count(int base_w, int base_h, int font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_warhead_count(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_HARDPOINTS 53
|
||||
void load_gauge_hardpoints(int base_w, int base_h, int font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_hardpoints(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_PRIMARY_WEAPONS 54
|
||||
void load_gauge_primary_weapons(int base_w, int base_h, int font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_primary_weapons(gauge_settings* settings);
|
||||
|
||||
#define HUD_OBJECT_SECONDARY_WEAPONS 55
|
||||
void load_gauge_secondary_weapons(int base_w, int base_h, int font, bool scale_gauge = true, SCP_vector<int>* ship_idx = NULL, color *use_clr = NULL);
|
||||
void load_gauge_secondary_weapons(gauge_settings* settings);
|
||||
|
||||
#endif // _HUDPARSE_H
|
||||
@@ -328,7 +328,7 @@ void HudGaugeReticle::getFirepointStatus() {
|
||||
|
||||
matrix eye_orient, player_transpose;
|
||||
|
||||
vm_copy_transpose_matrix(&player_transpose, &Objects[Player->objnum].orient);
|
||||
vm_copy_transpose(&player_transpose, &Objects[Player->objnum].orient);
|
||||
vm_matrix_x_matrix(&eye_orient, &player_transpose, &Eye_matrix);
|
||||
vm_vec_rotate(&fpfromeye, &pm->gun_banks[i].pnt[j], &eye_orient);
|
||||
|
||||
|
||||
@@ -680,7 +680,6 @@ void HudGaugeShield::showShields(object *objp, int mode)
|
||||
}
|
||||
|
||||
//We're ready to show stuff
|
||||
ship_model_start(objp);
|
||||
//if(!digitus_improbus)
|
||||
{
|
||||
model_render_params render_info;
|
||||
@@ -688,6 +687,7 @@ void HudGaugeShield::showShields(object *objp, int mode)
|
||||
render_info.set_flags(MR_NO_LIGHTING | MR_AUTOCENTER | MR_NO_FOGGING);
|
||||
render_info.set_replacement_textures(sp->ship_replacement_textures);
|
||||
render_info.set_detail_level_lock(1);
|
||||
render_info.set_object_number(OBJ_INDEX(objp));
|
||||
|
||||
model_render_immediate( &render_info, sip->model_num, &object_orient, &vmd_zero_vector );
|
||||
}
|
||||
@@ -704,7 +704,6 @@ void HudGaugeShield::showShields(object *objp, int mode)
|
||||
}
|
||||
model_render(fod_model, &object_orient, &vmd_zero_vector, MR_NO_LIGHTING | MR_LOCK_DETAIL | MR_AUTOCENTER | MR_NO_FOGGING, -1, -1);
|
||||
}*/
|
||||
ship_model_stop( objp );
|
||||
|
||||
//We're done
|
||||
if(!Cmdline_nohtl)
|
||||
@@ -743,7 +742,7 @@ void HudGaugeShield::showShields(object *objp, int mode)
|
||||
continue;
|
||||
}
|
||||
|
||||
range = MAX(HUD_COLOR_ALPHA_MAX, HUD_color_alpha + 4);
|
||||
range = MAX(HUD_COLOR_ALPHA_MAX, HUD_color_alpha + objp->n_quadrants);
|
||||
|
||||
if ( !(sip->flags2 & SIF2_MODEL_POINT_SHIELDS) )
|
||||
hud_color_index = fl2i( (objp->shield_quadrant[Quadrant_xlate[i]] / max_shield) * range);
|
||||
|
||||
@@ -1792,7 +1792,7 @@ void hud_target_live_turret(int next_flag, int auto_advance, int only_player_tar
|
||||
|
||||
if (!auto_advance && get_closest_turret && !only_player_target) {
|
||||
// if within 3 degrees and not previous subsys, use subsys in front
|
||||
dot = vm_vec_dotprod(&vec_to_subsys, &Player_obj->orient.vec.fvec);
|
||||
dot = vm_vec_dot(&vec_to_subsys, &Player_obj->orient.vec.fvec);
|
||||
if ((dot > 0.9986) && facing) {
|
||||
use_straight_ahead_turret = TRUE;
|
||||
break;
|
||||
@@ -2760,9 +2760,9 @@ void HudGaugeOrientationTee::renderOrientation(object *from_objp, object *to_obj
|
||||
// 0 - vectors are perpendicular
|
||||
// 1 - vectors are collinear and in the same direction (target is facing player)
|
||||
// -1 - vectors are collinear and in the opposite direction (target is facing away from player)
|
||||
dot_product = vm_vec_dotprod(&from_orientp->vec.fvec, &target_to_obj);
|
||||
dot_product = vm_vec_dot(&from_orientp->vec.fvec, &target_to_obj);
|
||||
|
||||
if (vm_vec_dotprod(&from_orientp->vec.rvec, &target_to_obj) >= 0) {
|
||||
if (vm_vec_dot(&from_orientp->vec.rvec, &target_to_obj) >= 0) {
|
||||
if (dot_product >= 0){
|
||||
dot_product = -PI_2*dot_product + PI;
|
||||
} else {
|
||||
@@ -7146,8 +7146,8 @@ void HudGaugeHardpoints::render(float frametime)
|
||||
render_info.set_color(gauge_color);
|
||||
render_info.set_detail_level_lock(detail_level_lock);
|
||||
render_info.set_flags(MR_NO_LIGHTING | MR_AUTOCENTER | MR_NO_FOGGING | MR_NO_TEXTURING | MR_NO_CULL);
|
||||
render_info.set_object_number(OBJ_INDEX(objp));
|
||||
|
||||
ship_model_start(objp);
|
||||
model_render_immediate( &render_info, sip->model_num, &object_orient, &vmd_zero_vector);
|
||||
|
||||
gr_set_color_buffer(1);
|
||||
@@ -7165,7 +7165,6 @@ void HudGaugeHardpoints::render(float frametime)
|
||||
&object_orient,
|
||||
&vmd_zero_vector
|
||||
);
|
||||
ship_model_stop( objp );
|
||||
|
||||
gr_stencil_set(GR_STENCIL_NONE);
|
||||
gr_zbuffer_set(zbuffer);
|
||||
|
||||
@@ -568,8 +568,8 @@ void HudGaugeTargetBox::renderTargetShip(object *target_objp)
|
||||
// IMPORTANT NOTE! Code handling the case 'missile_view == TRUE' in rendering section of renderTargetWeapon()
|
||||
// is largely copied over from renderTargetShip(). To keep the codes similar please update
|
||||
// both if and when needed
|
||||
ship_model_start( target_objp );
|
||||
model_render_params render_info;
|
||||
render_info.set_object_number(OBJ_INDEX(target_objp));
|
||||
|
||||
switch (Targetbox_wire) {
|
||||
case 0:
|
||||
@@ -643,8 +643,6 @@ void HudGaugeTargetBox::renderTargetShip(object *target_objp)
|
||||
Interp_desaturate = false;
|
||||
Glowpoint_override = false;
|
||||
|
||||
ship_model_stop( target_objp );
|
||||
|
||||
if ( Monitor_mask >= 0 ) {
|
||||
gr_stencil_set(GR_STENCIL_NONE);
|
||||
}
|
||||
@@ -918,7 +916,7 @@ void HudGaugeTargetBox::renderTargetWeapon(object *target_objp)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ship_model_start( viewed_obj );
|
||||
render_info.set_object_number(OBJ_INDEX(viewed_obj));
|
||||
|
||||
switch (Targetbox_wire) {
|
||||
case 0:
|
||||
@@ -1003,8 +1001,6 @@ void HudGaugeTargetBox::renderTargetWeapon(object *target_objp)
|
||||
|
||||
if (missile_view == TRUE) {
|
||||
Glowpoint_override = false;
|
||||
|
||||
ship_model_stop( viewed_obj );
|
||||
}
|
||||
|
||||
if ( Monitor_mask >= 0 ) {
|
||||
|
||||
+2
-223
@@ -27,11 +27,6 @@
|
||||
#include "osapi/osapi.h" // for multi-thread macros
|
||||
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define USE_TIMING
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
static longlong Timer_last_value = 0, Timer_base = 0, Timer_freq = 0;
|
||||
static const int precision = 1;
|
||||
@@ -214,9 +209,9 @@ void timestamp_reset()
|
||||
// something like 1 minute (6000).
|
||||
#define MAX_TIME (INT_MAX/2)
|
||||
|
||||
void timestamp_inc(float frametime)
|
||||
void timestamp_inc(int frametime_ms)
|
||||
{
|
||||
timestamp_ticker += (int)(frametime*TIMESTAMP_FREQUENCY);
|
||||
timestamp_ticker += frametime_ms;
|
||||
|
||||
if ( timestamp_ticker > MAX_TIME ) {
|
||||
timestamp_ticker = 2; // Roll!
|
||||
@@ -288,219 +283,3 @@ int timestamp_has_time_elapsed(int stamp, int time)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// timing functions -------------------------------------------------------------------------------
|
||||
|
||||
#define MAX_TIMING_EVENTS 15
|
||||
|
||||
// timing struct
|
||||
#ifdef USE_TIMING
|
||||
|
||||
typedef struct timing {
|
||||
char name[64];
|
||||
int microseconds_total;
|
||||
int start;
|
||||
int ref_count;
|
||||
} timing;
|
||||
|
||||
timing Timing_frame;
|
||||
timing Timing_events[MAX_TIMING_EVENTS];
|
||||
int Timing_event_count = 0;
|
||||
|
||||
#endif
|
||||
|
||||
// lookup a timing event
|
||||
int timing_event_lookup(char *event_name)
|
||||
{
|
||||
#ifndef USE_TIMING
|
||||
return -1;
|
||||
#else
|
||||
int idx;
|
||||
|
||||
// sanity
|
||||
if(event_name == NULL){
|
||||
return -1;
|
||||
}
|
||||
|
||||
// look through all events
|
||||
for(idx=0; idx<MAX_TIMING_EVENTS; idx++){
|
||||
if(!stricmp(Timing_events[idx].name, event_name)){
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
// start timing frame stuff
|
||||
void timing_frame_start()
|
||||
{
|
||||
#ifndef USE_TIMING
|
||||
return;
|
||||
#else
|
||||
int idx;
|
||||
|
||||
// restart the frame
|
||||
Timing_event_count = 0;
|
||||
Timing_frame.start = timer_get_microseconds();
|
||||
for(idx=0; idx<MAX_TIMING_EVENTS; idx++){
|
||||
Timing_events[idx].microseconds_total = 0;
|
||||
strcpy_s(Timing_events[idx].name, "");
|
||||
Timing_events[idx].ref_count = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// done timing the frame
|
||||
void timing_frame_stop()
|
||||
{
|
||||
#ifndef USE_TIMING
|
||||
return;
|
||||
#else
|
||||
int stop_time;
|
||||
|
||||
// stop time
|
||||
stop_time = timer_get_microseconds();
|
||||
|
||||
// calc times
|
||||
Timing_frame.microseconds_total = stop_time - Timing_frame.start;
|
||||
#endif
|
||||
}
|
||||
|
||||
// get the total frame time in microseconds
|
||||
int timing_frame_total()
|
||||
{
|
||||
#ifndef USE_TIMING
|
||||
return 0;
|
||||
#else
|
||||
return Timing_frame.microseconds_total;
|
||||
#endif
|
||||
}
|
||||
|
||||
// time an individual event
|
||||
void timing_event_start(char *event_name)
|
||||
{
|
||||
#ifndef USE_TIMING
|
||||
return;
|
||||
#else
|
||||
int event;
|
||||
|
||||
// sanity
|
||||
if(event_name == NULL){
|
||||
return;
|
||||
}
|
||||
|
||||
// try and find the event
|
||||
event = timing_event_lookup(event_name);
|
||||
|
||||
// if we already have one
|
||||
if(event != -1){
|
||||
Assert(Timing_events[event].ref_count == 0);
|
||||
Timing_events[event].start = timer_get_microseconds();
|
||||
Timing_events[event].ref_count++;
|
||||
}
|
||||
// if we need to add a new one
|
||||
else {
|
||||
if(Timing_event_count < MAX_TIMING_EVENTS){
|
||||
strcpy_s(Timing_events[Timing_event_count].name, event_name);
|
||||
Timing_events[Timing_event_count].start = timer_get_microseconds();
|
||||
Timing_events[Timing_event_count++].ref_count++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// stop timing an event
|
||||
void timing_event_stop(char *event_name)
|
||||
{
|
||||
#ifndef USE_TIMING
|
||||
return;
|
||||
#else
|
||||
int event;
|
||||
|
||||
// sanity
|
||||
if(event_name == NULL){
|
||||
return;
|
||||
}
|
||||
|
||||
// try and find the event
|
||||
event = timing_event_lookup(event_name);
|
||||
|
||||
// if we already have one
|
||||
if(event != -1){
|
||||
Assert(Timing_events[event].ref_count == 1);
|
||||
Timing_events[event].microseconds_total += timer_get_microseconds() - Timing_events[event].start;
|
||||
Timing_events[event].ref_count--;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// get the total time for an event in microseconds
|
||||
int timing_event_total(char *event_name)
|
||||
{
|
||||
#ifndef USE_TIMING
|
||||
return -1;
|
||||
#else
|
||||
int event;
|
||||
|
||||
// sanity
|
||||
if(event_name == NULL){
|
||||
return -1;
|
||||
}
|
||||
|
||||
// try and find the event
|
||||
event = timing_event_lookup(event_name);
|
||||
if(event == -1){
|
||||
return -1;
|
||||
}
|
||||
|
||||
return Timing_events[event].microseconds_total;
|
||||
#endif
|
||||
}
|
||||
|
||||
// get the percentage of total frametime for the event (0.0 to 1.0)
|
||||
float timing_event_pct(char *event_name)
|
||||
{
|
||||
#ifndef USE_TIMING
|
||||
return 0.0f;
|
||||
#else
|
||||
int event;
|
||||
|
||||
// sanity
|
||||
if(event_name == NULL){
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
// try and find the event
|
||||
event = timing_event_lookup(event_name);
|
||||
if(event == -1){
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
return (float)((double)Timing_events[event].microseconds_total / (double)Timing_frame.microseconds_total);
|
||||
#endif
|
||||
}
|
||||
|
||||
// display timing
|
||||
void timing_display(int x, int y)
|
||||
{
|
||||
#ifndef USE_TIMING
|
||||
return;
|
||||
#else
|
||||
int idx;
|
||||
|
||||
int line_height = gr_get_font_height() + 1;
|
||||
|
||||
gr_set_color_fast(&Color_bright_blue);
|
||||
|
||||
// total time
|
||||
gr_printf_no_resize(x, y, "Total time %f\n", (float)timing_frame_total() / 1000000.0f);
|
||||
y += line_height;
|
||||
|
||||
// each event percentage
|
||||
for(idx=0; idx<Timing_event_count; idx++){
|
||||
gr_printf_no_resize(x, y, "%s: %f\n", Timing_events[idx].name, timing_event_pct(Timing_events[idx].name));
|
||||
y += line_height;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
+1
-33
@@ -28,8 +28,6 @@
|
||||
|
||||
extern void timer_init();
|
||||
extern void timer_close();
|
||||
extern void timer_set_rate(int count_val);
|
||||
extern void timer_set_function( void * function );
|
||||
|
||||
//==========================================================================
|
||||
// These functions return the time since the timer was initialized in
|
||||
@@ -48,10 +46,6 @@ extern uint timer_get_high_res_microseconds();
|
||||
extern int timer_get_seconds(); // seconds since program started... not accurate, but good for long
|
||||
// runtimes with second-based timeouts
|
||||
|
||||
//==========================================================================
|
||||
// Use to access the BIOS ticker... ie... i = TICKER
|
||||
void timer_delay(fix seconds);
|
||||
|
||||
|
||||
//=================================================================
|
||||
//=================================================================
|
||||
@@ -73,7 +67,7 @@ extern int timestamp_ticker;
|
||||
extern void timestamp_reset();
|
||||
|
||||
// Call this once every frame with the frametime.
|
||||
extern void timestamp_inc(float frametime);
|
||||
extern void timestamp_inc(int frametime_ms);
|
||||
|
||||
// To do timing, call this with the interval you
|
||||
// want to check. Then, pass this to timestamp_elapsed
|
||||
@@ -120,30 +114,4 @@ int timestamp_has_time_elapsed(int stamp, int time);
|
||||
#define timestamp_elapsed_safe(_a, _b) ( (_a != 0) ? (((timestamp_ticker >= (_a)) || (timestamp_ticker < (_a - (_b + 100)))) ? 1 : 0) : 1 )
|
||||
|
||||
|
||||
// timing functions -------------------------------------------------------------------------------
|
||||
|
||||
// start timing frame stuff
|
||||
void timing_frame_start();
|
||||
|
||||
// done timing the frame
|
||||
void timing_frame_stop();
|
||||
|
||||
// get the total frame time in microseconds
|
||||
int timing_frame_total();
|
||||
|
||||
// time an individual event
|
||||
void timing_event_start(char *event_name);
|
||||
|
||||
// stop timing an event
|
||||
void timing_event_stop(char *event_name);
|
||||
|
||||
// get the total time for an event in microseconds
|
||||
int timing_event_total(char *event_name);
|
||||
|
||||
// get the percentage of total frametime for the event (0.0 to 1.0)
|
||||
float timing_event_pct(char *event_name);
|
||||
|
||||
// display timing
|
||||
void timing_display(int x, int y);
|
||||
|
||||
#endif
|
||||
+1
-3
@@ -1907,8 +1907,6 @@ void labviewer_close_render_options_window(GUIObject *caller)
|
||||
y += cbp->GetHeight() + 1; \
|
||||
}
|
||||
|
||||
extern int Use_GLSL;
|
||||
|
||||
void labviewer_make_render_options_window(Button *caller)
|
||||
{
|
||||
Checkbox *cbp;
|
||||
@@ -1930,7 +1928,7 @@ void labviewer_make_render_options_window(Button *caller)
|
||||
ADD_RENDER_FLAG("Show Insignia", Lab_viewer_flags, LAB_FLAG_SHOW_INSIGNIA);
|
||||
ADD_RENDER_FLAG("Show Damage Lightning", Lab_viewer_flags, LAB_FLAG_LIGHTNING_ARCS);
|
||||
ADD_RENDER_FLAG("Rotate Subsystems", Lab_viewer_flags, LAB_FLAG_SUBMODEL_ROTATE);
|
||||
if (Use_GLSL) {
|
||||
if (is_minimum_GLSL_version()) {
|
||||
ADD_RENDER_BOOL("Fixed Render Pipeline", GLSL_override);
|
||||
if (Cmdline_postprocess) {
|
||||
ADD_RENDER_BOOL("Hide Post Processing", PostProcessing_override);
|
||||
|
||||
@@ -340,7 +340,6 @@ void light_add_point_unique(const vec3d *pos, float r1, float r2, float intensit
|
||||
}
|
||||
|
||||
// beams affect every ship except the firing ship
|
||||
extern int Use_GLSL;
|
||||
void light_add_tube(const vec3d *p0, const vec3d *p1, float r1, float r2, float intensity, float r, float g, float b, int affected_objnum, float spec_r, float spec_g, float spec_b, bool specular)
|
||||
{
|
||||
Assert(r1 >0);
|
||||
@@ -377,8 +376,8 @@ void light_add_tube(const vec3d *p0, const vec3d *p1, float r1, float r2, float
|
||||
l->radb = r2;
|
||||
l->rada_squared = l->rada*l->rada;
|
||||
l->radb_squared = l->radb*l->radb;
|
||||
l->light_ignore_objnum = Use_GLSL>1 ?affected_objnum : -1;
|
||||
l->affected_objnum = Use_GLSL>1 ? -1 : affected_objnum;
|
||||
l->light_ignore_objnum = is_minimum_GLSL_version() ? affected_objnum : -1;
|
||||
l->affected_objnum = is_minimum_GLSL_version() ? -1 : affected_objnum;
|
||||
l->instance = Num_lights-1;
|
||||
|
||||
Assert( Num_light_levels <= 1 );
|
||||
@@ -475,7 +474,7 @@ int light_filter_push( int objnum, const vec3d *pos, float rad )
|
||||
|
||||
// hmm. this could probably be more optimal
|
||||
case LT_TUBE:
|
||||
if(Use_GLSL > 1) {
|
||||
if(is_minimum_GLSL_version()) {
|
||||
if(l->light_ignore_objnum != objnum){
|
||||
vec3d nearest;
|
||||
float dist_squared, max_dist_squared;
|
||||
@@ -1160,7 +1159,7 @@ void scene_lights::setLightFilter(int objnum, const vec3d *pos, float rad)
|
||||
}
|
||||
break;
|
||||
case LT_TUBE: {
|
||||
if ( Use_GLSL > 1 ) {
|
||||
if ( is_minimum_GLSL_version() ) {
|
||||
if ( l.light_ignore_objnum != objnum ) {
|
||||
vec3d nearest;
|
||||
float dist_squared, max_dist_squared;
|
||||
|
||||
+22
-22
@@ -18,7 +18,7 @@
|
||||
#define UNINITIALIZED_VALUE -1234567.8f
|
||||
#define WARN_DIST 1.0
|
||||
|
||||
static void accurate_square_root( float A, float B, float C, float discriminant, float *root1, float *root2 );
|
||||
static void accurate_square_root( float A, float B, float C, float discriminant, float *root1, float *root2 ) __UNUSED;
|
||||
|
||||
static float matrix_determinant_from_vectors(const vec3d *v1, const vec3d *v2, const vec3d *v3)
|
||||
{
|
||||
@@ -42,7 +42,7 @@ static float matrix_determinant_from_vectors(const vec3d *v1, const vec3d *v2, c
|
||||
void fvi_two_lines_in_3space(const vec3d *p1, const vec3d *v1, const vec3d *p2, const vec3d *v2, float *s, float *t)
|
||||
{
|
||||
vec3d cross,delta;
|
||||
vm_vec_crossprod(&cross, v1, v2);
|
||||
vm_vec_cross(&cross, v1, v2);
|
||||
vm_vec_sub(&delta, p2, p1);
|
||||
|
||||
float denominator = vm_vec_mag_squared(&cross);
|
||||
@@ -520,9 +520,9 @@ int fvi_sphere_plane(vec3d *intersect_point, const vec3d *sphere_center_start, c
|
||||
float t1, t2;
|
||||
|
||||
// find the time and position of the ray-plane intersection
|
||||
D = -vm_vec_dotprod( plane_normal, plane_point );
|
||||
xs0_dot_norm = vm_vec_dotprod( plane_normal, sphere_center_start );
|
||||
vs_dot_norm = vm_vec_dotprod( plane_normal, sphere_velocity);
|
||||
D = -vm_vec_dot( plane_normal, plane_point );
|
||||
xs0_dot_norm = vm_vec_dot( plane_normal, sphere_center_start );
|
||||
vs_dot_norm = vm_vec_dot( plane_normal, sphere_velocity);
|
||||
|
||||
// protect against divide by zero
|
||||
if (fl_abs(vs_dot_norm) > 1e-30) {
|
||||
@@ -589,7 +589,7 @@ int fvi_sphere_perp_edge(vec3d *intersect_point, const vec3d *sphere_center_star
|
||||
|
||||
vm_vec_copy_normalize( &x_hat, &edge_velocity );
|
||||
vm_vec_copy_normalize( &y_hat, sphere_velocity );
|
||||
vm_vec_crossprod( &z_hat, &x_hat, &y_hat );
|
||||
vm_vec_cross( &z_hat, &x_hat, &y_hat );
|
||||
max_edge_parameter = vm_vec_mag( &edge_velocity );
|
||||
|
||||
vec3d temp;
|
||||
@@ -606,9 +606,9 @@ int fvi_sphere_perp_edge(vec3d *intersect_point, const vec3d *sphere_center_star
|
||||
vm_project_point_onto_plane(&Xs_proj, sphere_center_start, &z_hat, &V0);
|
||||
|
||||
vec3d plane_coord;
|
||||
plane_coord.xyz.x = vm_vec_dotprod(&Xs_proj, &x_hat);
|
||||
plane_coord.xyz.y = vm_vec_dotprod(&Xe_proj, &y_hat);
|
||||
plane_coord.xyz.z = vm_vec_dotprod(&Xe_proj, &z_hat);
|
||||
plane_coord.xyz.x = vm_vec_dot(&Xs_proj, &x_hat);
|
||||
plane_coord.xyz.y = vm_vec_dot(&Xe_proj, &y_hat);
|
||||
plane_coord.xyz.z = vm_vec_dot(&Xe_proj, &z_hat);
|
||||
|
||||
// determime the position on the edge line
|
||||
vm_vec_copy_scale( intersect_point, &x_hat, plane_coord.xyz.x );
|
||||
@@ -620,7 +620,7 @@ int fvi_sphere_perp_edge(vec3d *intersect_point, const vec3d *sphere_center_star
|
||||
vec3d temp_vec;
|
||||
|
||||
vm_vec_sub( &temp_vec, intersect_point, &V0 );
|
||||
edge_parameter = vm_vec_dotprod( &temp_vec, &x_hat );
|
||||
edge_parameter = vm_vec_dot( &temp_vec, &x_hat );
|
||||
|
||||
if ( edge_parameter < 0 || edge_parameter > max_edge_parameter ) {
|
||||
return 0;
|
||||
@@ -647,7 +647,7 @@ static int check_sphere_point(const vec3d *point, const vec3d *sphere_start, con
|
||||
vm_vec_sub( &delta_x, sphere_start, point );
|
||||
delta_x_sqr = vm_vec_mag_squared( &delta_x );
|
||||
vs_sqr = vm_vec_mag_squared( sphere_vel );
|
||||
delta_x_dot_vs = vm_vec_dotprod( &delta_x, sphere_vel );
|
||||
delta_x_dot_vs = vm_vec_dot( &delta_x, sphere_vel );
|
||||
|
||||
float discriminant = delta_x_dot_vs*delta_x_dot_vs - vs_sqr*(delta_x_sqr - radius*radius);
|
||||
if (discriminant < 0) {
|
||||
@@ -726,10 +726,10 @@ int fvi_polyedge_sphereline(vec3d *hit_point, const vec3d *xs0, const vec3d *vs,
|
||||
// First find the closest intersection between the edge_line and the sphere_line.
|
||||
vm_vec_sub(&delta_x, xs0, &v0);
|
||||
|
||||
delta_x_dot_ve = vm_vec_dotprod(&delta_x, &ve);
|
||||
delta_x_dot_vs = vm_vec_dotprod(&delta_x, vs);
|
||||
delta_x_dot_ve = vm_vec_dot(&delta_x, &ve);
|
||||
delta_x_dot_vs = vm_vec_dot(&delta_x, vs);
|
||||
delta_x_sqr = vm_vec_mag_squared(&delta_x);
|
||||
ve_dot_vs = vm_vec_dotprod(&ve, vs);
|
||||
ve_dot_vs = vm_vec_dot(&ve, vs);
|
||||
ve_sqr = vm_vec_mag_squared(&ve);
|
||||
|
||||
/*
|
||||
@@ -858,7 +858,7 @@ TryVertex:
|
||||
// try V1
|
||||
vm_vec_sub( &delta_x, xs0, &v1 );
|
||||
delta_x_sqr = vm_vec_mag_squared( &delta_x );
|
||||
delta_x_dot_vs = vm_vec_dotprod( &delta_x, vs );
|
||||
delta_x_dot_vs = vm_vec_dot( &delta_x, vs );
|
||||
int v1_hit;
|
||||
|
||||
B = delta_x_dot_vs;
|
||||
@@ -939,7 +939,7 @@ void fvi_closest_point_on_line_segment(vec3d *closest_point, const vec3d *fixed_
|
||||
|
||||
vm_vec_sub(&line_velocity, line_point2, line_point1);
|
||||
vm_vec_sub(&delta_x, line_point1, fixed_point);
|
||||
t = -vm_vec_dotprod(&delta_x, &line_velocity) / vm_vec_mag_squared(&line_velocity);
|
||||
t = -vm_vec_dot(&delta_x, &line_velocity) / vm_vec_mag_squared(&line_velocity);
|
||||
|
||||
// Constrain t to be in range [0,1]
|
||||
if (t < 0) {
|
||||
@@ -992,7 +992,7 @@ int fvi_check_sphere_sphere(const vec3d *x_p0, const vec3d *x_p1, const vec3d *x
|
||||
vm_vec_add2(&delta_v, x_p0);
|
||||
vm_vec_sub2(&delta_v, x_p1);
|
||||
|
||||
delta_x_dot_delta_v = vm_vec_dotprod(&delta_x, &delta_v);
|
||||
delta_x_dot_delta_v = vm_vec_dot(&delta_x, &delta_v);
|
||||
delta_v_sqr = vm_vec_mag_squared(&delta_v);
|
||||
|
||||
discriminant = delta_x_dot_delta_v*delta_x_dot_delta_v - delta_v_sqr*(delta_x_sqr - separation*separation);
|
||||
@@ -1068,14 +1068,14 @@ void fvi_closest_line_line(const vec3d *x0, const vec3d *vx, const vec3d *y0, co
|
||||
|
||||
vm_vec_sub(&delta_l, y0, x0);
|
||||
|
||||
vm_vec_crossprod(&vx_cross_vy, vx, vy);
|
||||
vm_vec_crossprod(&delta_l_cross_vx, &delta_l, vx);
|
||||
vm_vec_crossprod(&delta_l_cross_vy, &delta_l, vy);
|
||||
vm_vec_cross(&vx_cross_vy, vx, vy);
|
||||
vm_vec_cross(&delta_l_cross_vx, &delta_l, vx);
|
||||
vm_vec_cross(&delta_l_cross_vy, &delta_l, vy);
|
||||
|
||||
denominator = vm_vec_mag_squared(&vx_cross_vy);
|
||||
|
||||
*x_time = vm_vec_dotprod(&delta_l_cross_vy, &vx_cross_vy) / denominator;
|
||||
*y_time = vm_vec_dotprod(&delta_l_cross_vx, &vx_cross_vy) / denominator;
|
||||
*x_time = vm_vec_dot(&delta_l_cross_vy, &vx_cross_vy) / denominator;
|
||||
*y_time = vm_vec_dot(&delta_l_cross_vx, &vx_cross_vy) / denominator;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
+126
-123
@@ -29,6 +29,8 @@ matrix vmd_identity_matrix = IDENTITY_MATRIX;
|
||||
|
||||
#define UNINITIALIZED_VALUE -12345678.9f
|
||||
|
||||
static void rotate_z ( matrix *m, float theta ) __UNUSED;
|
||||
|
||||
bool vm_vec_equal(const vec4 &self, const vec4 &other)
|
||||
{
|
||||
return fl_equal(self.a1d[0], other.a1d[0]) && fl_equal(self.a1d[1], other.a1d[1]) && fl_equal(self.a1d[2], other.a1d[2]) && fl_equal(self.a1d[3], other.a1d[3]);
|
||||
@@ -97,7 +99,7 @@ float vm_vec_projection_parallel(vec3d *component, const vec3d *src, const vec3d
|
||||
float mag;
|
||||
Assert( vm_vec_mag(unit_vec) > 0.999f && vm_vec_mag(unit_vec) < 1.001f );
|
||||
|
||||
mag = vm_vec_dotprod(src, unit_vec);
|
||||
mag = vm_vec_dot(src, unit_vec);
|
||||
vm_vec_copy_scale(component, unit_vec, mag);
|
||||
return mag;
|
||||
}
|
||||
@@ -112,7 +114,7 @@ void vm_vec_projection_onto_plane(vec3d *projection, const vec3d *src, const vec
|
||||
float mag;
|
||||
Assert( vm_vec_mag(unit_normal) > 0.999f && vm_vec_mag(unit_normal) < 1.001f );
|
||||
|
||||
mag = vm_vec_dotprod(src, unit_normal);
|
||||
mag = vm_vec_dot(src, unit_normal);
|
||||
*projection = *src;
|
||||
vm_vec_scale_add2(projection, unit_normal, -mag);
|
||||
}
|
||||
@@ -129,8 +131,8 @@ void vm_project_point_onto_plane(vec3d *new_point, const vec3d *point, const vec
|
||||
float dist;
|
||||
Assert( vm_vec_mag(plane_normal) > 0.999f && vm_vec_mag(plane_normal) < 1.001f );
|
||||
|
||||
D = -vm_vec_dotprod(plane_point, plane_normal);
|
||||
dist = vm_vec_dotprod(point, plane_normal) + D;
|
||||
D = -vm_vec_dot(plane_point, plane_normal);
|
||||
dist = vm_vec_dot(point, plane_normal) + D;
|
||||
|
||||
*new_point = *point;
|
||||
vm_vec_scale_add2(new_point, plane_normal, -dist);
|
||||
@@ -307,7 +309,7 @@ void vm_vec_scale2(vec3d *dest, float n, float d)
|
||||
}
|
||||
|
||||
//returns dot product of 2 vectors
|
||||
float vm_vec_dotprod(const vec3d *v0, const vec3d *v1)
|
||||
float vm_vec_dot(const vec3d *v0, const vec3d *v1)
|
||||
{
|
||||
return (v1->xyz.x*v0->xyz.x)+(v1->xyz.y*v0->xyz.y)+(v1->xyz.z*v0->xyz.z);
|
||||
}
|
||||
@@ -640,7 +642,7 @@ vec3d *vm_vec_normal(vec3d *dest, const vec3d *p0, const vec3d *p1, const vec3d
|
||||
//product of the magnitudes of the two source vectors. This means it is
|
||||
//quite easy for this routine to overflow and underflow. Be careful that
|
||||
//your inputs are ok.
|
||||
vec3d *vm_vec_crossprod(vec3d *dest, const vec3d *src0, const vec3d *src1)
|
||||
vec3d *vm_vec_cross(vec3d *dest, const vec3d *src0, const vec3d *src1)
|
||||
{
|
||||
dest->xyz.x = (src0->xyz.y * src1->xyz.z) - (src0->xyz.z * src1->xyz.y);
|
||||
dest->xyz.y = (src0->xyz.z * src1->xyz.x) - (src0->xyz.x * src1->xyz.z);
|
||||
@@ -673,7 +675,7 @@ vec3d *vm_vec_perp(vec3d *dest, const vec3d *p0, const vec3d *p1,const vec3d *p2
|
||||
vm_vec_sub(&t0,p1,p0);
|
||||
vm_vec_sub(&t1,p2,p1);
|
||||
|
||||
return vm_vec_crossprod(dest,&t0,&t1);
|
||||
return vm_vec_cross(dest,&t0,&t1);
|
||||
}
|
||||
|
||||
|
||||
@@ -710,7 +712,7 @@ float vm_vec_delta_ang_norm(const vec3d *v0, const vec3d *v1, const vec3d *fvec)
|
||||
|
||||
if (fvec) {
|
||||
vm_vec_cross(&t,v0,v1);
|
||||
if ( vm_vec_dotprod(&t,fvec) < 0.0 ) {
|
||||
if ( vm_vec_dot(&t,fvec) < 0.0 ) {
|
||||
a = -a;
|
||||
}
|
||||
}
|
||||
@@ -835,7 +837,7 @@ void vm_vector_2_matrix_gen_vectors(matrix *m)
|
||||
|
||||
vm_vec_normalize(xvec);
|
||||
|
||||
vm_vec_crossprod(yvec,zvec,xvec);
|
||||
vm_vec_cross(yvec,zvec,xvec);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -862,25 +864,25 @@ matrix *vm_vector_2_matrix(matrix *m, const vec3d *fvec, const vec3d *uvec, cons
|
||||
else { //use right vec
|
||||
vm_vec_copy_normalize(xvec,rvec);
|
||||
|
||||
vm_vec_crossprod(yvec,zvec,xvec);
|
||||
vm_vec_cross(yvec,zvec,xvec);
|
||||
|
||||
//normalize new perpendicular vector
|
||||
vm_vec_normalize(yvec);
|
||||
|
||||
//now recompute right vector, in case it wasn't entirely perpendiclar
|
||||
vm_vec_crossprod(xvec,yvec,zvec);
|
||||
vm_vec_cross(xvec,yvec,zvec);
|
||||
}
|
||||
}
|
||||
else { //use up vec
|
||||
vm_vec_copy_normalize(yvec,uvec);
|
||||
|
||||
vm_vec_crossprod(xvec,yvec,zvec);
|
||||
vm_vec_cross(xvec,yvec,zvec);
|
||||
|
||||
//normalize new perpendicular vector
|
||||
vm_vec_normalize(xvec);
|
||||
|
||||
//now recompute up vector, in case it wasn't entirely perpendiclar
|
||||
vm_vec_crossprod(yvec,zvec,xvec);
|
||||
vm_vec_cross(yvec,zvec,xvec);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
@@ -901,23 +903,23 @@ matrix *vm_vector_2_matrix_norm(matrix *m, const vec3d *fvec, const vec3d *uvec,
|
||||
vm_vector_2_matrix_gen_vectors(m);
|
||||
}
|
||||
else { //use right vec
|
||||
vm_vec_crossprod(yvec,zvec,xvec);
|
||||
vm_vec_cross(yvec,zvec,xvec);
|
||||
|
||||
//normalize new perpendicular vector
|
||||
vm_vec_normalize(yvec);
|
||||
|
||||
//now recompute right vector, in case it wasn't entirely perpendiclar
|
||||
vm_vec_crossprod(xvec,yvec,zvec);
|
||||
vm_vec_cross(xvec,yvec,zvec);
|
||||
}
|
||||
}
|
||||
else { //use up vec
|
||||
vm_vec_crossprod(xvec,yvec,zvec);
|
||||
vm_vec_cross(xvec,yvec,zvec);
|
||||
|
||||
//normalize new perpendicular vector
|
||||
vm_vec_normalize(xvec);
|
||||
|
||||
//now recompute up vector, in case it wasn't entirely perpendiclar
|
||||
vm_vec_crossprod(yvec,zvec,xvec);
|
||||
vm_vec_cross(yvec,zvec,xvec);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
@@ -943,7 +945,7 @@ vec3d *vm_vec_rotate(vec3d *dest, const vec3d *src, const matrix *m)
|
||||
//returns ptr to dest vector
|
||||
//dest CANNOT equal source
|
||||
// This is a faster replacement for this common code sequence:
|
||||
// vm_copy_transpose_matrix(&tempm,src_matrix);
|
||||
// vm_copy_transpose(&tempm,src_matrix);
|
||||
// vm_vec_rotate(dst_vec,src_vect,&tempm);
|
||||
// Replace with:
|
||||
// vm_vec_unrotate(dst_vec,src_vect, src_matrix)
|
||||
@@ -966,7 +968,7 @@ vec3d *vm_vec_unrotate(vec3d *dest, const vec3d *src, const matrix *m)
|
||||
}
|
||||
|
||||
//transpose a matrix in place. returns ptr to matrix
|
||||
matrix *vm_transpose_matrix(matrix *m)
|
||||
matrix *vm_transpose(matrix *m)
|
||||
{
|
||||
float t;
|
||||
|
||||
@@ -978,8 +980,8 @@ matrix *vm_transpose_matrix(matrix *m)
|
||||
}
|
||||
|
||||
//copy and transpose a matrix. returns ptr to matrix
|
||||
//dest CANNOT equal source. use vm_transpose_matrix() if this is the case
|
||||
matrix *vm_copy_transpose_matrix(matrix *dest, const matrix *src)
|
||||
//dest CANNOT equal source. use vm_transpose() if this is the case
|
||||
matrix *vm_copy_transpose(matrix *dest, const matrix *src)
|
||||
{
|
||||
Assert(dest != src);
|
||||
|
||||
@@ -1260,7 +1262,7 @@ void vm_orthogonalize_matrix(matrix *m_src)
|
||||
vm_vec_make(&m->vec.uvec, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
} else { // use the right vector to figure up vector
|
||||
vm_vec_crossprod(&m->vec.uvec, &m->vec.fvec, &m_src->vec.rvec);
|
||||
vm_vec_cross(&m->vec.uvec, &m->vec.fvec, &m_src->vec.rvec);
|
||||
vm_vec_normalize(&m->vec.uvec);
|
||||
}
|
||||
|
||||
@@ -1269,13 +1271,13 @@ void vm_orthogonalize_matrix(matrix *m_src)
|
||||
}
|
||||
|
||||
// use forward and up vectors as good vectors to calculate right vector
|
||||
vm_vec_crossprod(&m->vec.rvec, &m->vec.uvec, &m->vec.fvec);
|
||||
vm_vec_cross(&m->vec.rvec, &m->vec.uvec, &m->vec.fvec);
|
||||
|
||||
//normalize new perpendicular vector
|
||||
vm_vec_normalize(&m->vec.rvec);
|
||||
|
||||
//now recompute up vector, in case it wasn't entirely perpendicular
|
||||
vm_vec_crossprod(&m->vec.uvec, &m->vec.fvec, &m->vec.rvec);
|
||||
vm_vec_cross(&m->vec.uvec, &m->vec.fvec, &m->vec.rvec);
|
||||
*m_src = tempm;
|
||||
}
|
||||
|
||||
@@ -1290,7 +1292,7 @@ void vm_fix_matrix(matrix *m)
|
||||
rmag = vm_vec_mag(&m->vec.rvec);
|
||||
if (fmag <= 0.0f) {
|
||||
if ((umag > 0.0f) && (rmag > 0.0f) && !vm_test_parallel(&m->vec.uvec, &m->vec.rvec)) {
|
||||
vm_vec_crossprod(&m->vec.fvec, &m->vec.uvec, &m->vec.rvec);
|
||||
vm_vec_cross(&m->vec.fvec, &m->vec.uvec, &m->vec.rvec);
|
||||
vm_vec_normalize(&m->vec.fvec);
|
||||
|
||||
} else if (umag > 0.0f) {
|
||||
@@ -1313,7 +1315,7 @@ void vm_fix_matrix(matrix *m)
|
||||
vm_vec_make(&m->vec.uvec, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
} else { // use the right vector to figure up vector
|
||||
vm_vec_crossprod(&m->vec.uvec, &m->vec.fvec, &m->vec.rvec);
|
||||
vm_vec_cross(&m->vec.uvec, &m->vec.fvec, &m->vec.rvec);
|
||||
vm_vec_normalize(&m->vec.uvec);
|
||||
}
|
||||
|
||||
@@ -1322,13 +1324,13 @@ void vm_fix_matrix(matrix *m)
|
||||
|
||||
// we now have both valid and normalized forward and up vectors
|
||||
|
||||
vm_vec_crossprod(&m->vec.rvec, &m->vec.uvec, &m->vec.fvec);
|
||||
vm_vec_cross(&m->vec.rvec, &m->vec.uvec, &m->vec.fvec);
|
||||
|
||||
//normalize new perpendicular vector
|
||||
vm_vec_normalize(&m->vec.rvec);
|
||||
|
||||
//now recompute up vector, in case it wasn't entirely perpendiclar
|
||||
vm_vec_crossprod(&m->vec.uvec, &m->vec.fvec, &m->vec.rvec);
|
||||
vm_vec_cross(&m->vec.uvec, &m->vec.fvec, &m->vec.rvec);
|
||||
}
|
||||
|
||||
//Rotates the orient matrix by the angles in tangles and then
|
||||
@@ -1866,7 +1868,7 @@ void vm_matrix_interpolate(const matrix *goal_orient, const matrix *curr_orient,
|
||||
|
||||
// FIND ROTATION NEEDED FOR GOAL
|
||||
// goal_orient = R curr_orient, so R = goal_orient curr_orient^-1
|
||||
vm_copy_transpose_matrix(&Mtemp1, curr_orient); // Mtemp1 = curr ^-1
|
||||
vm_copy_transpose(&Mtemp1, curr_orient); // Mtemp1 = curr ^-1
|
||||
vm_matrix_x_matrix(&rot_matrix, &Mtemp1, goal_orient); // R = goal * Mtemp1
|
||||
vm_orthogonalize_matrix(&rot_matrix);
|
||||
vm_matrix_to_rot_axis_and_angle(&rot_matrix, &theta, &rot_axis); // determines angle and rotation axis from curr to goal
|
||||
@@ -2008,7 +2010,7 @@ void get_camera_limits(const matrix *start_camera, const matrix *end_camera, flo
|
||||
vec3d angle;
|
||||
|
||||
// determine the necessary rotation matrix
|
||||
vm_copy_transpose_matrix(&temp, start_camera);
|
||||
vm_copy_transpose(&temp, start_camera);
|
||||
vm_matrix_x_matrix(&rot_matrix, &temp, end_camera);
|
||||
vm_orthogonalize_matrix(&rot_matrix);
|
||||
|
||||
@@ -2073,13 +2075,13 @@ void vm_forward_interpolate(const vec3d *goal_f, const matrix *orient, const vec
|
||||
// FIND ROTATION NEEDED FOR GOAL
|
||||
// rotation vector is (current fvec) orient->vec.fvec x goal_f
|
||||
// magnitude = asin ( magnitude of crossprod )
|
||||
vm_vec_crossprod( &rot_axis, &orient->vec.fvec, goal_f );
|
||||
vm_vec_cross( &rot_axis, &orient->vec.fvec, goal_f );
|
||||
|
||||
float t = vm_vec_mag(&rot_axis);
|
||||
if (t > 1.0f)
|
||||
t = 1.0f;
|
||||
|
||||
z_dotprod = vm_vec_dotprod( &orient->vec.fvec, goal_f );
|
||||
z_dotprod = vm_vec_dot( &orient->vec.fvec, goal_f );
|
||||
|
||||
if ( t < SMALLER_NUM ) {
|
||||
if ( z_dotprod > 0.0f )
|
||||
@@ -2378,7 +2380,7 @@ void vm_estimate_next_orientation(const matrix *last_orient, const matrix *curre
|
||||
|
||||
matrix Mtemp;
|
||||
matrix Rot_matrix;
|
||||
vm_copy_transpose_matrix(&Mtemp, last_orient); // Mtemp = (L)^-1
|
||||
vm_copy_transpose(&Mtemp, last_orient); // Mtemp = (L)^-1
|
||||
vm_matrix_x_matrix(&Rot_matrix, &Mtemp, current_orient); // R = C Mtemp1
|
||||
vm_matrix_x_matrix(next_orient, current_orient, &Rot_matrix);
|
||||
}
|
||||
@@ -2402,7 +2404,7 @@ void vm_vec_interp_constant(vec3d *out, const vec3d *v0, const vec3d *v1, float
|
||||
float total_ang;
|
||||
|
||||
// get the cross-product of the 2 vectors
|
||||
vm_vec_crossprod(&cross, v0, v1);
|
||||
vm_vec_cross(&cross, v0, v1);
|
||||
vm_vec_normalize(&cross);
|
||||
|
||||
// get the total angle between the 2 vectors
|
||||
@@ -2516,7 +2518,7 @@ int vm_vec_dist_to_line(const vec3d *p, const vec3d *l0, const vec3d *l1, vec3d
|
||||
b_mag = vm_vec_copy_normalize(&c, &b);
|
||||
|
||||
// calculate component
|
||||
comp = vm_vec_dotprod(&a, &b) / b_mag;
|
||||
comp = vm_vec_dot(&a, &b) / b_mag;
|
||||
|
||||
// stuff nearest
|
||||
vm_vec_scale_add(nearest, l0, &c, comp);
|
||||
@@ -2556,7 +2558,7 @@ void vm_vec_dist_squared_to_line(const vec3d *p, const vec3d *l0, const vec3d *l
|
||||
b_mag = vm_vec_copy_normalize(&c, &b);
|
||||
|
||||
// calculate component
|
||||
comp = vm_vec_dotprod(&a, &b) / b_mag;
|
||||
comp = vm_vec_dot(&a, &b) / b_mag;
|
||||
|
||||
// stuff nearest
|
||||
vm_vec_scale_add(nearest, l0, &c, comp);
|
||||
@@ -2574,131 +2576,132 @@ void vm_vec_boxscale(vec2d *vec, float scale)
|
||||
vec->y *= ratio;
|
||||
}
|
||||
|
||||
// TODO Remove this function if we ever move to a math library like glm
|
||||
/**
|
||||
* @brief Attempts to invert a 4x4 matrix
|
||||
* @param[in] m Pointer to the matrix we want to invert
|
||||
* @param[inout] invOut The inverted matrix, or nullptr if inversion is impossible
|
||||
*
|
||||
* @returns Whether or not the matrix is invertible
|
||||
*/
|
||||
* @brief Attempts to invert a 4x4 matrix
|
||||
* @param[in] m Pointer to the matrix we want to invert
|
||||
* @param[inout] invOut The inverted matrix, or nullptr if inversion is impossible
|
||||
*
|
||||
* @returns Whether or not the matrix is invertible
|
||||
*/
|
||||
bool vm_inverse_matrix4(const matrix4 *m, matrix4 *invOut)
|
||||
{
|
||||
matrix4 inv; // create a temp matrix so we can avoid getting a determinant that is 0
|
||||
float det;
|
||||
int i,j;
|
||||
int i, j;
|
||||
|
||||
// Use a2d so it's easier for people to read
|
||||
inv.a2d[0][0] = m->a2d[1][1] * m->a2d[2][2] * m->a2d[3][3] -
|
||||
m->a2d[1][1] * m->a2d[2][3] * m->a2d[3][2] -
|
||||
m->a2d[2][1] * m->a2d[1][2] * m->a2d[3][3] +
|
||||
m->a2d[2][1] * m->a2d[1][3] * m->a2d[3][2] +
|
||||
m->a2d[3][1] * m->a2d[1][2] * m->a2d[2][3] -
|
||||
m->a2d[3][1] * m->a2d[1][3] * m->a2d[2][2];
|
||||
m->a2d[1][1] * m->a2d[2][3] * m->a2d[3][2] -
|
||||
m->a2d[2][1] * m->a2d[1][2] * m->a2d[3][3] +
|
||||
m->a2d[2][1] * m->a2d[1][3] * m->a2d[3][2] +
|
||||
m->a2d[3][1] * m->a2d[1][2] * m->a2d[2][3] -
|
||||
m->a2d[3][1] * m->a2d[1][3] * m->a2d[2][2];
|
||||
|
||||
inv.a2d[1][0] = -m->a2d[1][0] * m->a2d[2][2] * m->a2d[3][3] +
|
||||
m->a2d[1][0] * m->a2d[2][3] * m->a2d[3][2] +
|
||||
m->a2d[2][0] * m->a2d[1][2] * m->a2d[3][3] -
|
||||
m->a2d[2][0] * m->a2d[1][3] * m->a2d[3][2] -
|
||||
m->a2d[3][0] * m->a2d[1][2] * m->a2d[2][3] +
|
||||
m->a2d[3][0] * m->a2d[1][3] * m->a2d[2][2];
|
||||
m->a2d[1][0] * m->a2d[2][3] * m->a2d[3][2] +
|
||||
m->a2d[2][0] * m->a2d[1][2] * m->a2d[3][3] -
|
||||
m->a2d[2][0] * m->a2d[1][3] * m->a2d[3][2] -
|
||||
m->a2d[3][0] * m->a2d[1][2] * m->a2d[2][3] +
|
||||
m->a2d[3][0] * m->a2d[1][3] * m->a2d[2][2];
|
||||
|
||||
inv.a2d[2][0] = m->a2d[1][0] * m->a2d[2][1] * m->a2d[3][3] -
|
||||
m->a2d[1][0] * m->a2d[2][3] * m->a2d[3][1] -
|
||||
m->a2d[2][0] * m->a2d[1][1] * m->a2d[3][3] +
|
||||
m->a2d[2][0] * m->a2d[1][3] * m->a2d[3][1] +
|
||||
m->a2d[3][0] * m->a2d[1][1] * m->a2d[2][3] -
|
||||
m->a2d[3][0] * m->a2d[1][3] * m->a2d[2][1];
|
||||
m->a2d[1][0] * m->a2d[2][3] * m->a2d[3][1] -
|
||||
m->a2d[2][0] * m->a2d[1][1] * m->a2d[3][3] +
|
||||
m->a2d[2][0] * m->a2d[1][3] * m->a2d[3][1] +
|
||||
m->a2d[3][0] * m->a2d[1][1] * m->a2d[2][3] -
|
||||
m->a2d[3][0] * m->a2d[1][3] * m->a2d[2][1];
|
||||
|
||||
inv.a2d[3][0] = -m->a2d[1][0] * m->a2d[2][1] * m->a2d[3][2] +
|
||||
m->a2d[1][0] * m->a2d[2][2] * m->a2d[3][1] +
|
||||
m->a2d[2][0] * m->a2d[1][1] * m->a2d[3][2] -
|
||||
m->a2d[2][0] * m->a2d[1][2] * m->a2d[3][1] -
|
||||
m->a2d[3][0] * m->a2d[1][1] * m->a2d[2][2] +
|
||||
m->a2d[3][0] * m->a2d[1][2] * m->a2d[2][1];
|
||||
m->a2d[1][0] * m->a2d[2][2] * m->a2d[3][1] +
|
||||
m->a2d[2][0] * m->a2d[1][1] * m->a2d[3][2] -
|
||||
m->a2d[2][0] * m->a2d[1][2] * m->a2d[3][1] -
|
||||
m->a2d[3][0] * m->a2d[1][1] * m->a2d[2][2] +
|
||||
m->a2d[3][0] * m->a2d[1][2] * m->a2d[2][1];
|
||||
|
||||
inv.a2d[0][1] = -m->a2d[0][1] * m->a2d[2][2] * m->a2d[3][3] +
|
||||
m->a2d[0][1] * m->a2d[2][3] * m->a2d[3][2] +
|
||||
m->a2d[2][1] * m->a2d[0][2] * m->a2d[3][3] -
|
||||
m->a2d[2][1] * m->a2d[0][3] * m->a2d[3][2] -
|
||||
m->a2d[3][1] * m->a2d[0][2] * m->a2d[2][3] +
|
||||
m->a2d[3][1] * m->a2d[0][3] * m->a2d[2][2];
|
||||
m->a2d[0][1] * m->a2d[2][3] * m->a2d[3][2] +
|
||||
m->a2d[2][1] * m->a2d[0][2] * m->a2d[3][3] -
|
||||
m->a2d[2][1] * m->a2d[0][3] * m->a2d[3][2] -
|
||||
m->a2d[3][1] * m->a2d[0][2] * m->a2d[2][3] +
|
||||
m->a2d[3][1] * m->a2d[0][3] * m->a2d[2][2];
|
||||
|
||||
inv.a2d[1][1] = m->a2d[0][0] * m->a2d[2][2] * m->a2d[3][3] -
|
||||
m->a2d[0][0] * m->a2d[2][3] * m->a2d[3][2] -
|
||||
m->a2d[2][0] * m->a2d[0][2] * m->a2d[3][3] +
|
||||
m->a2d[2][0] * m->a2d[0][3] * m->a2d[3][2] +
|
||||
m->a2d[3][0] * m->a2d[0][2] * m->a2d[2][3] -
|
||||
m->a2d[3][0] * m->a2d[0][3] * m->a2d[2][2];
|
||||
m->a2d[0][0] * m->a2d[2][3] * m->a2d[3][2] -
|
||||
m->a2d[2][0] * m->a2d[0][2] * m->a2d[3][3] +
|
||||
m->a2d[2][0] * m->a2d[0][3] * m->a2d[3][2] +
|
||||
m->a2d[3][0] * m->a2d[0][2] * m->a2d[2][3] -
|
||||
m->a2d[3][0] * m->a2d[0][3] * m->a2d[2][2];
|
||||
|
||||
inv.a2d[2][1] = -m->a2d[0][0] * m->a2d[2][1] * m->a2d[3][3] +
|
||||
m->a2d[0][0] * m->a2d[2][3] * m->a2d[3][1] +
|
||||
m->a2d[2][0] * m->a2d[0][1] * m->a2d[3][3] -
|
||||
m->a2d[2][0] * m->a2d[0][3] * m->a2d[3][1] -
|
||||
m->a2d[3][0] * m->a2d[0][1] * m->a2d[2][3] +
|
||||
m->a2d[3][0] * m->a2d[0][3] * m->a2d[2][1];
|
||||
m->a2d[0][0] * m->a2d[2][3] * m->a2d[3][1] +
|
||||
m->a2d[2][0] * m->a2d[0][1] * m->a2d[3][3] -
|
||||
m->a2d[2][0] * m->a2d[0][3] * m->a2d[3][1] -
|
||||
m->a2d[3][0] * m->a2d[0][1] * m->a2d[2][3] +
|
||||
m->a2d[3][0] * m->a2d[0][3] * m->a2d[2][1];
|
||||
|
||||
inv.a2d[3][1] = m->a2d[0][0] * m->a2d[2][1] * m->a2d[3][2] -
|
||||
m->a2d[0][0] * m->a2d[2][2] * m->a2d[3][1] -
|
||||
m->a2d[2][0] * m->a2d[0][1] * m->a2d[3][2] +
|
||||
m->a2d[2][0] * m->a2d[0][2] * m->a2d[3][1] +
|
||||
m->a2d[3][0] * m->a2d[0][1] * m->a2d[2][2] -
|
||||
m->a2d[3][0] * m->a2d[0][2] * m->a2d[2][1];
|
||||
m->a2d[0][0] * m->a2d[2][2] * m->a2d[3][1] -
|
||||
m->a2d[2][0] * m->a2d[0][1] * m->a2d[3][2] +
|
||||
m->a2d[2][0] * m->a2d[0][2] * m->a2d[3][1] +
|
||||
m->a2d[3][0] * m->a2d[0][1] * m->a2d[2][2] -
|
||||
m->a2d[3][0] * m->a2d[0][2] * m->a2d[2][1];
|
||||
|
||||
inv.a2d[0][2] = m->a2d[0][1] * m->a2d[1][2] * m->a2d[3][3] -
|
||||
m->a2d[0][1] * m->a2d[1][3] * m->a2d[3][2] -
|
||||
m->a2d[1][1] * m->a2d[0][2] * m->a2d[3][3] +
|
||||
m->a2d[1][1] * m->a2d[0][3] * m->a2d[3][2] +
|
||||
m->a2d[3][1] * m->a2d[0][2] * m->a2d[1][3] -
|
||||
m->a2d[3][1] * m->a2d[0][3] * m->a2d[1][2];
|
||||
m->a2d[0][1] * m->a2d[1][3] * m->a2d[3][2] -
|
||||
m->a2d[1][1] * m->a2d[0][2] * m->a2d[3][3] +
|
||||
m->a2d[1][1] * m->a2d[0][3] * m->a2d[3][2] +
|
||||
m->a2d[3][1] * m->a2d[0][2] * m->a2d[1][3] -
|
||||
m->a2d[3][1] * m->a2d[0][3] * m->a2d[1][2];
|
||||
|
||||
inv.a2d[1][2] = -m->a2d[0][0] * m->a2d[1][2] * m->a2d[3][3] +
|
||||
m->a2d[0][0] * m->a2d[1][3] * m->a2d[3][2] +
|
||||
m->a2d[1][0] * m->a2d[0][2] * m->a2d[3][3] -
|
||||
m->a2d[1][0] * m->a2d[0][3] * m->a2d[3][2] -
|
||||
m->a2d[3][0] * m->a2d[0][2] * m->a2d[1][3] +
|
||||
m->a2d[3][0] * m->a2d[0][3] * m->a2d[1][2];
|
||||
m->a2d[0][0] * m->a2d[1][3] * m->a2d[3][2] +
|
||||
m->a2d[1][0] * m->a2d[0][2] * m->a2d[3][3] -
|
||||
m->a2d[1][0] * m->a2d[0][3] * m->a2d[3][2] -
|
||||
m->a2d[3][0] * m->a2d[0][2] * m->a2d[1][3] +
|
||||
m->a2d[3][0] * m->a2d[0][3] * m->a2d[1][2];
|
||||
|
||||
inv.a2d[2][2] = m->a2d[0][0] * m->a2d[1][1] * m->a2d[3][3] -
|
||||
m->a2d[0][0] * m->a2d[1][3] * m->a2d[3][1] -
|
||||
m->a2d[1][0] * m->a2d[0][1] * m->a2d[3][3] +
|
||||
m->a2d[1][0] * m->a2d[0][3] * m->a2d[3][1] +
|
||||
m->a2d[3][0] * m->a2d[0][1] * m->a2d[1][3] -
|
||||
m->a2d[3][0] * m->a2d[0][3] * m->a2d[1][1];
|
||||
m->a2d[0][0] * m->a2d[1][3] * m->a2d[3][1] -
|
||||
m->a2d[1][0] * m->a2d[0][1] * m->a2d[3][3] +
|
||||
m->a2d[1][0] * m->a2d[0][3] * m->a2d[3][1] +
|
||||
m->a2d[3][0] * m->a2d[0][1] * m->a2d[1][3] -
|
||||
m->a2d[3][0] * m->a2d[0][3] * m->a2d[1][1];
|
||||
|
||||
inv.a2d[3][2] = -m->a2d[0][0] * m->a2d[1][1] * m->a2d[3][2] +
|
||||
m->a2d[0][0] * m->a2d[1][2] * m->a2d[3][1] +
|
||||
m->a2d[1][0] * m->a2d[0][1] * m->a2d[3][2] -
|
||||
m->a2d[1][0] * m->a2d[0][2] * m->a2d[3][1] -
|
||||
m->a2d[3][0] * m->a2d[0][1] * m->a2d[1][2] +
|
||||
m->a2d[3][0] * m->a2d[0][2] * m->a2d[1][1];
|
||||
m->a2d[0][0] * m->a2d[1][2] * m->a2d[3][1] +
|
||||
m->a2d[1][0] * m->a2d[0][1] * m->a2d[3][2] -
|
||||
m->a2d[1][0] * m->a2d[0][2] * m->a2d[3][1] -
|
||||
m->a2d[3][0] * m->a2d[0][1] * m->a2d[1][2] +
|
||||
m->a2d[3][0] * m->a2d[0][2] * m->a2d[1][1];
|
||||
|
||||
inv.a2d[0][3] = -m->a2d[0][1] * m->a2d[1][2] * m->a2d[2][3] +
|
||||
m->a2d[0][1] * m->a2d[1][3] * m->a2d[2][2] +
|
||||
m->a2d[1][1] * m->a2d[0][2] * m->a2d[2][3] -
|
||||
m->a2d[1][1] * m->a2d[0][3] * m->a2d[2][2] -
|
||||
m->a2d[2][1] * m->a2d[0][2] * m->a2d[1][3] +
|
||||
m->a2d[2][1] * m->a2d[0][3] * m->a2d[1][2];
|
||||
m->a2d[0][1] * m->a2d[1][3] * m->a2d[2][2] +
|
||||
m->a2d[1][1] * m->a2d[0][2] * m->a2d[2][3] -
|
||||
m->a2d[1][1] * m->a2d[0][3] * m->a2d[2][2] -
|
||||
m->a2d[2][1] * m->a2d[0][2] * m->a2d[1][3] +
|
||||
m->a2d[2][1] * m->a2d[0][3] * m->a2d[1][2];
|
||||
|
||||
inv.a2d[1][3] = m->a2d[0][0] * m->a2d[1][2] * m->a2d[2][3] -
|
||||
m->a2d[0][0] * m->a2d[1][3] * m->a2d[2][2] -
|
||||
m->a2d[1][0] * m->a2d[0][2] * m->a2d[2][3] +
|
||||
m->a2d[1][0] * m->a2d[0][3] * m->a2d[2][2] +
|
||||
m->a2d[2][0] * m->a2d[0][2] * m->a2d[1][3] -
|
||||
m->a2d[2][0] * m->a2d[0][3] * m->a2d[1][2];
|
||||
m->a2d[0][0] * m->a2d[1][3] * m->a2d[2][2] -
|
||||
m->a2d[1][0] * m->a2d[0][2] * m->a2d[2][3] +
|
||||
m->a2d[1][0] * m->a2d[0][3] * m->a2d[2][2] +
|
||||
m->a2d[2][0] * m->a2d[0][2] * m->a2d[1][3] -
|
||||
m->a2d[2][0] * m->a2d[0][3] * m->a2d[1][2];
|
||||
|
||||
inv.a2d[2][3] = -m->a2d[0][0] * m->a2d[1][1] * m->a2d[2][3] +
|
||||
m->a2d[0][0] * m->a2d[1][3] * m->a2d[2][1] +
|
||||
m->a2d[1][0] * m->a2d[0][1] * m->a2d[2][3] -
|
||||
m->a2d[1][0] * m->a2d[0][3] * m->a2d[2][1] -
|
||||
m->a2d[2][0] * m->a2d[0][1] * m->a2d[1][3] +
|
||||
m->a2d[2][0] * m->a2d[0][3] * m->a2d[1][1];
|
||||
m->a2d[0][0] * m->a2d[1][3] * m->a2d[2][1] +
|
||||
m->a2d[1][0] * m->a2d[0][1] * m->a2d[2][3] -
|
||||
m->a2d[1][0] * m->a2d[0][3] * m->a2d[2][1] -
|
||||
m->a2d[2][0] * m->a2d[0][1] * m->a2d[1][3] +
|
||||
m->a2d[2][0] * m->a2d[0][3] * m->a2d[1][1];
|
||||
|
||||
inv.a2d[3][3] = m->a2d[0][0] * m->a2d[1][1] * m->a2d[2][2] -
|
||||
m->a2d[0][0] * m->a2d[1][2] * m->a2d[2][1] -
|
||||
m->a2d[1][0] * m->a2d[0][1] * m->a2d[2][2] +
|
||||
m->a2d[1][0] * m->a2d[0][2] * m->a2d[2][1] +
|
||||
m->a2d[2][0] * m->a2d[0][1] * m->a2d[1][2] -
|
||||
m->a2d[2][0] * m->a2d[0][2] * m->a2d[1][1];
|
||||
m->a2d[0][0] * m->a2d[1][2] * m->a2d[2][1] -
|
||||
m->a2d[1][0] * m->a2d[0][1] * m->a2d[2][2] +
|
||||
m->a2d[1][0] * m->a2d[0][2] * m->a2d[2][1] +
|
||||
m->a2d[2][0] * m->a2d[0][1] * m->a2d[1][2] -
|
||||
m->a2d[2][0] * m->a2d[0][2] * m->a2d[1][1];
|
||||
|
||||
det = m->a2d[0][0] * inv.a2d[0][0] + m->a2d[0][1] * inv.a2d[1][0] + m->a2d[0][2] * inv.a2d[2][0] + m->a2d[0][3] * inv.a2d[3][0];
|
||||
|
||||
|
||||
+6
-10
@@ -193,15 +193,13 @@ float vm_vec_normalized_dir_quick_mag(vec3d *dest, const vec3d *end, const vec3d
|
||||
float vm_vec_normalized_dir_quick(vec3d *dest, const vec3d *end, const vec3d *start);
|
||||
|
||||
////returns dot product of two vectors
|
||||
float vm_vec_dotprod(const vec3d *v0, const vec3d *v1);
|
||||
#define vm_vec_dot vm_vec_dotprod
|
||||
float vm_vec_dot(const vec3d *v0, const vec3d *v1);
|
||||
|
||||
float vm_vec_dot3(float x, float y, float z, vec3d *v);
|
||||
|
||||
//computes cross product of two vectors. returns ptr to dest
|
||||
//dest CANNOT equal either source
|
||||
vec3d *vm_vec_crossprod(vec3d *dest, const vec3d *src0, const vec3d *src1);
|
||||
#define vm_vec_cross vm_vec_crossprod
|
||||
vec3d *vm_vec_cross(vec3d *dest, const vec3d *src0, const vec3d *src1);
|
||||
|
||||
// test if 2 vectors are parallel or not.
|
||||
int vm_test_parallel(const vec3d *src0, const vec3d *src1);
|
||||
@@ -255,7 +253,7 @@ vec3d *vm_vec_rotate(vec3d *dest, const vec3d *src, const matrix *m);
|
||||
//returns ptr to dest vector
|
||||
//dest CANNOT equal source
|
||||
// This is a faster replacement for this common code sequence:
|
||||
// vm_copy_transpose_matrix(&tempm,src_matrix);
|
||||
// vm_copy_transpose(&tempm,src_matrix);
|
||||
// vm_vec_rotate(dst_vec,src_vect,&tempm);
|
||||
// Replace with:
|
||||
// vm_vec_unrotate(dst_vec,src_vect, src_matrix)
|
||||
@@ -266,13 +264,11 @@ vec3d *vm_vec_rotate(vec3d *dest, const vec3d *src, const matrix *m);
|
||||
vec3d *vm_vec_unrotate(vec3d *dest, const vec3d *src, const matrix *m);
|
||||
|
||||
//transpose a matrix in place. returns ptr to matrix
|
||||
matrix *vm_transpose_matrix(matrix *m);
|
||||
#define vm_transpose(m) vm_transpose_matrix(m)
|
||||
matrix *vm_transpose(matrix *m);
|
||||
|
||||
//copy and transpose a matrix. returns ptr to matrix
|
||||
//dest CANNOT equal source. use vm_transpose_matrix() if this is the case
|
||||
matrix *vm_copy_transpose_matrix(matrix *dest, const matrix *src);
|
||||
#define vm_copy_transpose(dest,src) vm_copy_transpose_matrix((dest),(src))
|
||||
//dest CANNOT equal source. use vm_transpose() if this is the case
|
||||
matrix *vm_copy_transpose(matrix *dest, const matrix *src);
|
||||
|
||||
//mulitply 2 matrices, fill in dest. returns ptr to dest
|
||||
//dest CANNOT equal either source
|
||||
|
||||
@@ -1508,8 +1508,13 @@ void barracks_do_frame(float frametime)
|
||||
}
|
||||
|
||||
if (Player_sel_mode == PLAYER_SELECT_MODE_SINGLE) {
|
||||
Cur_pilot->flags |= PLAYER_FLAGS_IS_MULTI;
|
||||
Pilot.save_player(Cur_pilot);
|
||||
barracks_init_player_stuff(PLAYER_SELECT_MODE_MULTI);
|
||||
} else {
|
||||
// make sure we don't carry over the multi flag
|
||||
Cur_pilot->flags &= ~PLAYER_FLAGS_IS_MULTI;
|
||||
Pilot.save_player(Cur_pilot);
|
||||
barracks_init_player_stuff(PLAYER_SELECT_MODE_SINGLE);
|
||||
}
|
||||
|
||||
|
||||
@@ -803,7 +803,7 @@ void credits_do_frame(float frametime)
|
||||
|
||||
Credits_frametime = temp_time - Credits_last_time;
|
||||
Credits_last_time = temp_time;
|
||||
timestamp_inc(Credits_frametime / 1000.0f);
|
||||
timestamp_inc(Credits_frametime);
|
||||
|
||||
float fl_frametime = i2fl(Credits_frametime) / 1000.f;
|
||||
if (keyd_pressed[KEY_LSHIFT]) {
|
||||
|
||||
@@ -319,9 +319,6 @@ void main_hall_do_multi_ready()
|
||||
case NETWORK_ERROR_NO_PROTOCOL:
|
||||
if (Multi_options_g.protocol == NET_TCP) {
|
||||
popup( PF_USE_AFFIRMATIVE_ICON | PF_NO_NETWORKING, 1, POPUP_OK, XSTR( "TCP/IP protocol not found. This protocol is required for multiplayer FreeSpace.", 1602));
|
||||
} else {
|
||||
Assert(Multi_options_g.protocol == NET_IPX);
|
||||
popup( PF_USE_AFFIRMATIVE_ICON | PF_NO_NETWORKING, 1, POPUP_OK, XSTR( "IPX protocol not found. This protocol is required for multiplayer FreeSpace.", 1603));
|
||||
}
|
||||
break;
|
||||
case NETWORK_ERROR_CONNECT_TO_ISP:
|
||||
@@ -346,11 +343,6 @@ void main_hall_do_multi_ready()
|
||||
return;
|
||||
}
|
||||
|
||||
if ((Multi_options_g.protocol == NET_IPX) && !Ipx_active) {
|
||||
popup( PF_USE_AFFIRMATIVE_ICON | PF_NO_NETWORKING, 1, POPUP_OK, XSTR( "You have selected IPX for multiplayer FreeSpace, but the IPX protocol was not detected on your machine.", 1402));
|
||||
return;
|
||||
}
|
||||
|
||||
if (error != NETWORK_ERROR_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -714,10 +714,6 @@ void options_multi_load_protocol_controls()
|
||||
Om_ip_input.hide();
|
||||
Om_ip_input.disable();
|
||||
|
||||
// disable IPX button in demo
|
||||
Om_pro_buttons[gr_screen.res][OM_PRO_IPX].button.disable();
|
||||
Om_pro_buttons[gr_screen.res][OM_PRO_IPX].button.hide();
|
||||
|
||||
// bogus control
|
||||
Om_pro_bogus.base_create(Om_window, UI_KIND_ICON, 0, 0, 0, 0);
|
||||
}
|
||||
@@ -887,11 +883,7 @@ void options_multi_protocol_do(int key)
|
||||
}
|
||||
|
||||
// force draw the proper protocol
|
||||
if (Om_protocol == NET_IPX) {
|
||||
Om_pro_buttons[gr_screen.res][OM_PRO_IPX].button.draw_forced(2);
|
||||
} else {
|
||||
Om_pro_buttons[gr_screen.res][OM_PRO_TCP].button.draw_forced(2);
|
||||
}
|
||||
Om_pro_buttons[gr_screen.res][OM_PRO_TCP].button.draw_forced(2);
|
||||
|
||||
// force draw the proper tab button
|
||||
switch (Om_mode) {
|
||||
@@ -1118,10 +1110,10 @@ void options_multi_protocol_button_pressed(int n)
|
||||
gamesnd_play_iface(SND_USER_SELECT);
|
||||
break;
|
||||
|
||||
// ipx mode
|
||||
// ipx mode, no longer supported
|
||||
case OM_PRO_IPX:
|
||||
Om_protocol = NET_IPX;
|
||||
gamesnd_play_iface(SND_USER_SELECT);
|
||||
gamesnd_play_iface(SND_GENERAL_FAIL);
|
||||
popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, "The old IPX protocol is no longer supported.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,7 +335,8 @@ void player_select_init()
|
||||
player_select_init_player_stuff(PLAYER_SELECT_MODE_SINGLE);
|
||||
}
|
||||
|
||||
if ( (Player_select_num_pilots == 1) && Player_select_input_mode ) {
|
||||
if (Cmdline_benchmark_mode || ((Player_select_num_pilots == 1) && Player_select_input_mode)) {
|
||||
// When benchmarking, just accept automatically
|
||||
Player_select_autoaccept = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,7 +573,7 @@ void techroom_ships_render(float frametime)
|
||||
model_render_immediate(&render_info, Techroom_ship_modelnum, &Techroom_ship_orient, &vmd_zero_vector);
|
||||
shadows_end_render();
|
||||
|
||||
gr_set_clip(Tech_ship_display_coords[gr_screen.res][SHIP_X_COORD], Tech_ship_display_coords[gr_screen.res][SHIP_Y_COORD], Tech_ship_display_coords[gr_screen.res][SHIP_W_COORD], Tech_ship_display_coords[gr_screen.res][SHIP_H_COORD]);
|
||||
gr_set_clip(Tech_ship_display_coords[gr_screen.res][SHIP_X_COORD], Tech_ship_display_coords[gr_screen.res][SHIP_Y_COORD], Tech_ship_display_coords[gr_screen.res][SHIP_W_COORD], Tech_ship_display_coords[gr_screen.res][SHIP_H_COORD], GR_RESIZE_MENU);
|
||||
}
|
||||
|
||||
if (!Cmdline_nohtl) {
|
||||
|
||||
@@ -312,6 +312,7 @@ char *Parse_object_flags_2[MAX_PARSE_OBJECT_FLAGS_2] = {
|
||||
"weapons-locked",
|
||||
"scramble-messages",
|
||||
"no-collide",
|
||||
"no-disabled-self-destruct",
|
||||
};
|
||||
|
||||
char *Mission_event_log_flags[MAX_MISSION_EVENT_LOG_FLAGS] = {
|
||||
@@ -2647,6 +2648,9 @@ void resolve_parse_flags(object *objp, int parse_flags, int parse_flags2)
|
||||
if (parse_flags2 & P2_SF2_SCRAMBLE_MESSAGES)
|
||||
shipp->flags2 |= SF2_SCRAMBLE_MESSAGES;
|
||||
|
||||
if (parse_flags2 & P2_SF2_NO_DISABLED_SELF_DESTRUCT)
|
||||
shipp->flags2 |= SF2_NO_DISABLED_SELF_DESTRUCT;
|
||||
|
||||
// don't remove no-collide if not set in the mission
|
||||
if (parse_flags2 & P2_OF_NO_COLLIDE)
|
||||
obj_set_flags(objp, objp->flags & ~OF_COLLIDES);
|
||||
|
||||
@@ -483,7 +483,7 @@ public:
|
||||
// same caveat: This list of bitfield indicators MUST correspond EXACTLY
|
||||
// (i.e., order and position must be the same) to its counterpart in MissionParse.cpp!!!!
|
||||
|
||||
#define MAX_PARSE_OBJECT_FLAGS_2 24
|
||||
#define MAX_PARSE_OBJECT_FLAGS_2 25
|
||||
|
||||
#define P2_SF2_PRIMITIVE_SENSORS (1<<0)
|
||||
#define P2_SF2_NO_SUBSPACE_DRIVE (1<<1)
|
||||
@@ -509,6 +509,7 @@ public:
|
||||
#define P2_SF2_WEAPONS_LOCKED (1<<21)
|
||||
#define P2_SF2_SCRAMBLE_MESSAGES (1<<22)
|
||||
#define P2_OF_NO_COLLIDE (1<<23) // This actually changes the OF_COLLIDES object flag
|
||||
#define P2_SF2_NO_DISABLED_SELF_DESTRUCT (1<<24)
|
||||
|
||||
// and again: these flags do not appear in the array
|
||||
//#define blah (1<<28)
|
||||
|
||||
@@ -1726,8 +1726,6 @@ void draw_model_rotating(model_render_params *render_info, int model_id, int x1,
|
||||
float size = pm->rad*0.7f;
|
||||
float start_scale = MIN(time,0.5f)*2.5f;
|
||||
float offset = size*0.5f*MIN(MAX(time-3.0f,0.0f),0.6f)*1.66667f;
|
||||
if ( (time < 1.5f) && (time >= 0.5f) ) // Clip the grid if were in phase 1
|
||||
render_info->set_clip_plane(plane_point,wire_normal);
|
||||
|
||||
g3_start_instance_angles(&vmd_zero_vector,&view_angles);
|
||||
|
||||
@@ -1754,6 +1752,10 @@ void draw_model_rotating(model_render_params *render_info, int model_id, int x1,
|
||||
gr_set_color(0,200,0);
|
||||
g3_start_instance_angles(&vmd_zero_vector,&view_angles);
|
||||
|
||||
if (time < 1.5f) {
|
||||
stop.xyz.z = -clip;
|
||||
}
|
||||
|
||||
for (i = -3; i < 4; i++) {
|
||||
start.xyz.x = stop.xyz.x = size*0.333f*i;
|
||||
g3_draw_htl_line(&start,&stop);
|
||||
@@ -1762,8 +1764,10 @@ void draw_model_rotating(model_render_params *render_info, int model_id, int x1,
|
||||
start.xyz.x = size;
|
||||
stop.xyz.x = -size;
|
||||
|
||||
for (i = -3; i < 4; i++) {
|
||||
for (i = 3; i > -4; i--) {
|
||||
start.xyz.z = stop.xyz.z = size*0.333f*i+offset*0.5f;
|
||||
if ((time < 1.5f) && (start.xyz.z <= -clip))
|
||||
break;
|
||||
g3_draw_htl_line(&start,&stop);
|
||||
}
|
||||
|
||||
|
||||
+45
-43
@@ -33,8 +33,9 @@ extern int model_render_flags_size;
|
||||
#define MOVEMENT_TYPE_POS 0
|
||||
#define MOVEMENT_TYPE_ROT 1
|
||||
#define MOVEMENT_TYPE_ROT_SPECIAL 2 // for turrets only
|
||||
#define MOVEMENT_TYPE_TRIGGERED 3 //triggered rotation
|
||||
#define MOVEMENT_TYPE_LOOK_AT 4 // the subobject is always looking at a 'look at' subobject, as best it can - Bobboau
|
||||
#define MOVEMENT_TYPE_TRIGGERED 3 // triggered rotation
|
||||
#define MOVEMENT_TYPE_INTRINSIC_ROTATE 4 // intrinsic (non-subsystem-based) rotation
|
||||
#define MOVEMENT_TYPE_LOOK_AT 5 // the subobject is always looking at a 'look at' subobject, as best it can - Bobboau
|
||||
|
||||
|
||||
// DA 11/13/98 Reordered to account for difference between max and game
|
||||
@@ -90,6 +91,7 @@ typedef struct submodel_instance {
|
||||
matrix mc_orient;
|
||||
bool collision_checked;
|
||||
bool blown_off;
|
||||
submodel_instance_info *sii;
|
||||
} submodel_instance;
|
||||
|
||||
// Data specific to a particular instance of a model.
|
||||
@@ -120,19 +122,18 @@ typedef struct polymodel_instance {
|
||||
#define MSS_FLAG_NO_SS_TARGETING (1 << 16) // toggles the subsystem targeting for the turret
|
||||
#define MSS_FLAG_TURRET_RESET_IDLE (1 << 17) // makes turret reset to their initial position if the target is out of field of view
|
||||
#define MSS_FLAG_TURRET_ALT_MATH (1 << 18) // tells the game to use additional calculations should turret have a defined y fov
|
||||
#define MSS_FLAG_DUM_ROTATES (1 << 19) // Bobboau
|
||||
#define MSS_FLAG_CARRY_SHOCKWAVE (1 << 20) // subsystem - even with 'carry no damage' flag - will carry shockwave damage to the hull
|
||||
#define MSS_FLAG_ALLOW_LANDING (1 << 21) // This subsystem can be landed on
|
||||
#define MSS_FLAG_FOV_EDGE_CHECK (1 << 22) // Tells the game to use better FOV edge checking with this turret
|
||||
#define MSS_FLAG_FOV_REQUIRED (1 << 23) // Tells game not to allow this turret to attempt targeting objects out of FOV
|
||||
#define MSS_FLAG_NO_REPLACE (1 << 24) // set the subsys not to draw replacement ('destroyed') model
|
||||
#define MSS_FLAG_NO_LIVE_DEBRIS (1 << 25) // sets the subsys not to release live debris
|
||||
#define MSS_FLAG_IGNORE_IF_DEAD (1 << 26) // tells homing missiles to ignore the subsys if its dead and home on to hull instead of earlier subsys pos
|
||||
#define MSS_FLAG_ALLOW_VANISHING (1 << 27) // allows subsystem to vanish (prevents explosions & sounds effects from being played)
|
||||
#define MSS_FLAG_DAMAGE_AS_HULL (1 << 28) // applies armor damage to subsystem instead of subsystem damage - FUBAR
|
||||
#define MSS_FLAG_TURRET_LOCKED (1 << 29) // Turret starts locked by default - Sushi
|
||||
#define MSS_FLAG_NO_AGGREGATE (1 << 30) // Don't include with aggregate subsystem types - Goober5000
|
||||
#define MSS_FLAG_TURRET_ANIM_WAIT (1 << 31) // Turret won't fire until animation is complete - Sushi
|
||||
#define MSS_FLAG_CARRY_SHOCKWAVE (1 << 19) // subsystem - even with 'carry no damage' flag - will carry shockwave damage to the hull
|
||||
#define MSS_FLAG_ALLOW_LANDING (1 << 20) // This subsystem can be landed on
|
||||
#define MSS_FLAG_FOV_EDGE_CHECK (1 << 21) // Tells the game to use better FOV edge checking with this turret
|
||||
#define MSS_FLAG_FOV_REQUIRED (1 << 22) // Tells game not to allow this turret to attempt targeting objects out of FOV
|
||||
#define MSS_FLAG_NO_REPLACE (1 << 23) // set the subsys not to draw replacement ('destroyed') model
|
||||
#define MSS_FLAG_NO_LIVE_DEBRIS (1 << 24) // sets the subsys not to release live debris
|
||||
#define MSS_FLAG_IGNORE_IF_DEAD (1 << 25) // tells homing missiles to ignore the subsys if its dead and home on to hull instead of earlier subsys pos
|
||||
#define MSS_FLAG_ALLOW_VANISHING (1 << 26) // allows subsystem to vanish (prevents explosions & sounds effects from being played)
|
||||
#define MSS_FLAG_DAMAGE_AS_HULL (1 << 27) // applies armor damage to subsystem instead of subsystem damage - FUBAR
|
||||
#define MSS_FLAG_TURRET_LOCKED (1 << 28) // Turret starts locked by default - Sushi
|
||||
#define MSS_FLAG_NO_AGGREGATE (1 << 29) // Don't include with aggregate subsystem types - Goober5000
|
||||
#define MSS_FLAG_TURRET_ANIM_WAIT (1 << 30) // Turret won't fire until animation is complete - Sushi
|
||||
|
||||
#define MSS_FLAG2_PLAYER_TURRET_SOUND (1 << 0)
|
||||
#define MSS_FLAG2_TURRET_ONLY_TARGET_IF_CAN_FIRE (1 << 1) // Turrets only target things they're allowed to shoot at (e.g. if check-hull fails, won't keep targeting)
|
||||
@@ -140,6 +141,9 @@ typedef struct polymodel_instance {
|
||||
#define MSS_FLAG2_COLLIDE_SUBMODEL (1 << 3) // subsystem takes damage only from hits which impact the associated submodel
|
||||
#define MSS_FLAG2_DESTROYED_ROTATION (1 << 4) // allows subobjects to continue to rotate even if they have been destroyed
|
||||
#define MSS_FLAG2_TURRET_USE_AMMO (1 << 5) // enables ammo consumption for turrets (DahBlount)
|
||||
#define MSS_FLAG2_AUTOREPAIR_IF_DISABLED (1 << 6) // Allows the subsystem to repair itself even if disabled (MageKing17)
|
||||
#define MSS_FLAG2_NO_AUTOREPAIR_IF_DISABLED (1 << 7) // Inversion of the previous; disallows this particular subsystem if the ship-wide flag is set (MageKing17)
|
||||
#define MSS_FLAG2_SHARE_FIRE_DIRECTION (1 << 8) // (DahBlount) Whenever the turret fires, make all firing points fire in the same direction.
|
||||
|
||||
#define NUM_SUBSYSTEM_FLAGS 33
|
||||
|
||||
@@ -296,7 +300,7 @@ class bsp_info
|
||||
public:
|
||||
bsp_info()
|
||||
: movement_type(-1), movement_axis(0), can_move(false), bsp_data_size(0), bsp_data(NULL), collision_tree_index(-1),
|
||||
rad(0.0f), blown_off(0), my_replacement(-1), i_replace(-1), is_live_debris(0), num_live_debris(0), sii(NULL),
|
||||
rad(0.0f), blown_off(0), my_replacement(-1), i_replace(-1), is_live_debris(0), num_live_debris(0),
|
||||
is_thruster(0), is_damaged(0), parent(-1), num_children(0), first_child(-1), next_sibling(-1), num_details(0),
|
||||
num_arcs(0), outline_buffer(NULL), n_verts_outline(0), render_sphere_radius(0.0f), use_render_box(0), use_render_box_offset(false),
|
||||
use_render_sphere(0), use_render_sphere_offset(false), gun_rotation(false), no_collisions(false),
|
||||
@@ -348,8 +352,6 @@ public:
|
||||
int num_live_debris; // num live debris models assocaiated with a submodel
|
||||
int live_debris[MAX_LIVE_DEBRIS]; // array of live debris submodels for a submodel
|
||||
|
||||
submodel_instance_info *sii; // stuff needed for collision from rotations
|
||||
|
||||
int is_thruster;
|
||||
int is_damaged;
|
||||
|
||||
@@ -615,10 +617,11 @@ typedef struct insignia {
|
||||
vec3d norm[MAX_INS_VECS] ; //normal of the insignia-Bobboau
|
||||
} insignia;
|
||||
|
||||
#define PM_FLAG_ALLOW_TILING (1<<0) // Allow texture tiling
|
||||
#define PM_FLAG_AUTOCEN (1<<1) // contains autocentering info
|
||||
#define PM_FLAG_TRANS_BUFFER (1<<2) // render transparency buffer
|
||||
#define PM_FLAG_BATCHED (1<<3) // this model can be batch rendered
|
||||
#define PM_FLAG_ALLOW_TILING (1<<0) // Allow texture tiling
|
||||
#define PM_FLAG_AUTOCEN (1<<1) // contains autocentering info
|
||||
#define PM_FLAG_TRANS_BUFFER (1<<2) // render transparency buffer
|
||||
#define PM_FLAG_BATCHED (1<<3) // this model can be batch rendered
|
||||
#define PM_FLAG_HAS_INTRINSIC_ROTATE (1<<4) // whether this model has an intrinsic rotation submodel somewhere
|
||||
|
||||
// Goober5000
|
||||
class texture_info
|
||||
@@ -827,7 +830,7 @@ void model_instance_free_all();
|
||||
// Loads a model from disk and returns the model number it loaded into.
|
||||
int model_load(char *filename, int n_subsystems, model_subsystem *subsystems, int ferror = 1, int duplicate = 0);
|
||||
|
||||
int model_create_instance(int model_num, int submodel_num = -1);
|
||||
int model_create_instance(bool is_ship, int model_num);
|
||||
void model_delete_instance(int model_instance_num);
|
||||
|
||||
// Goober5000
|
||||
@@ -994,7 +997,8 @@ extern void model_make_turret_matrix(int model_num, model_subsystem * turret );
|
||||
|
||||
// Rotates the angle of a submodel. Use this so the right unlocked axis
|
||||
// gets stuffed.
|
||||
extern void submodel_rotate(model_subsystem *psub, submodel_instance_info * sii);
|
||||
extern void submodel_rotate(model_subsystem *psub, submodel_instance_info *sii);
|
||||
extern void submodel_rotate(bsp_info *sm, submodel_instance_info *sii);
|
||||
|
||||
// Rotates the angle of a submodel. Use this so the right unlocked axis
|
||||
// gets stuffed. Does this for stepped rotations
|
||||
@@ -1007,20 +1011,19 @@ extern void model_find_submodel_offset(vec3d *outpnt, int model_num, int sub_mod
|
||||
// Given a point (pnt) that is in sub_model_num's frame of
|
||||
// reference, and given the object's orient and position,
|
||||
// return the point in 3-space in outpnt.
|
||||
extern void model_find_world_point(vec3d * outpnt, vec3d *mpnt,int model_num, int sub_model_num, matrix * objorient, vec3d * objpos);
|
||||
void model_instance_find_world_point(vec3d * outpnt, vec3d *mpnt, int model_num, int model_instance_num, int sub_model_num, matrix * objorient, vec3d * objpos );
|
||||
extern void model_find_world_point(vec3d *outpnt, vec3d *mpnt, int model_num, int submodel_num, const matrix *objorient, const vec3d *objpos);
|
||||
extern void model_instance_find_world_point(vec3d *outpnt, vec3d *mpnt, int model_instance_num, int submodel_num, const matrix *objorient, const vec3d *objpos);
|
||||
|
||||
// Given a point in the world RF, find the corresponding point in the model RF.
|
||||
// This is special purpose code, specific for model collision.
|
||||
// NOTE - this code ASSUMES submodel is 1 level down from hull (detail[0])
|
||||
void world_find_model_point(vec3d *out, vec3d *world_pt, polymodel *pm, int submodel_num, matrix *orient, vec3d *pos);
|
||||
void world_find_model_point(vec3d *out, vec3d *world_pt, const polymodel *pm, int submodel_num, const matrix *orient, const vec3d *pos);
|
||||
void world_find_model_instance_point(vec3d *out, vec3d *world_pt, const polymodel_instance *pmi, int submodel_num, const matrix *orient, const vec3d *pos);
|
||||
|
||||
void world_find_model_instance_point(vec3d *out, vec3d *world_pt, polymodel *pm, polymodel_instance *pmi, int submodel_num, matrix *orient, vec3d *pos);
|
||||
|
||||
extern void find_submodel_instance_point(vec3d *outpnt, object *pship_obj, int submodel_num);
|
||||
extern void find_submodel_instance_point_normal(vec3d *outpnt, vec3d *outnorm, object *pship_obj, int submodel_num, vec3d *submodel_pnt, vec3d *submodel_norm);
|
||||
extern void find_submodel_instance_point_orient(vec3d *outpnt, matrix *outorient, object *pship_obj, int submodel_num, vec3d *submodel_pnt, matrix *submodel_orient);
|
||||
extern void find_submodel_instance_world_point(vec3d *outpnt, object *pship_obj, int submodel_num);
|
||||
extern void find_submodel_instance_point(vec3d *outpnt, int model_instance_num, int submodel_num);
|
||||
extern void find_submodel_instance_point_normal(vec3d *outpnt, vec3d *outnorm, int model_instance_num, int submodel_num, const vec3d *submodel_pnt, const vec3d *submodel_norm);
|
||||
extern void find_submodel_instance_point_orient(vec3d *outpnt, matrix *outorient, int model_instance_num, int submodel_num, const vec3d *submodel_pnt, const matrix *submodel_orient);
|
||||
extern void find_submodel_instance_world_point(vec3d *outpnt, int model_instance_num, int submodel_num, const matrix *objorient, const vec3d *objpos);
|
||||
|
||||
// Given a polygon model index, find a list of rotating submodels to be used for collision
|
||||
void model_get_rotating_submodel_list(SCP_vector<int> *submodel_vector, object *objp);
|
||||
@@ -1034,13 +1037,13 @@ void model_init_submodel_axis_pt(submodel_instance_info *sii, int model_num, int
|
||||
// Given a direction (pnt) that is in sub_model_num's frame of
|
||||
// reference, and given the object's orient and position,
|
||||
// return the point in 3-space in outpnt.
|
||||
extern void model_find_world_dir(vec3d * out_dir, vec3d *in_dir,int model_num, int sub_model_num, matrix * objorient, vec3d * objpos);
|
||||
extern void model_instance_find_world_dir(vec3d * out_dir, vec3d *in_dir,int model_num, int model_instance_num, int sub_model_num, matrix * objorient, vec3d * objpos);
|
||||
extern void model_find_world_dir(vec3d *out_dir, vec3d *in_dir, int model_num, int submodel_num, const matrix *objorient);
|
||||
extern void model_instance_find_world_dir(vec3d *out_dir, vec3d *in_dir, int model_instance_num, int submodel_num, const matrix *objorient);
|
||||
|
||||
// Clears all the submodel instances stored in a model to their defaults.
|
||||
extern void model_clear_instance(int model_num);
|
||||
|
||||
void model_clear_submodel_instance( submodel_instance *sm_instance );
|
||||
void model_clear_submodel_instance( submodel_instance *sm_instance, bsp_info *sm );
|
||||
void model_clear_submodel_instances( int model_instance_num );
|
||||
|
||||
// Sets rotating submodel turn info to that stored in model
|
||||
@@ -1050,11 +1053,10 @@ void model_set_instance_info(submodel_instance_info *sii, float turn_rate, float
|
||||
extern void model_clear_instance_info(submodel_instance_info * sii);
|
||||
|
||||
// Sets the submodel instance data in a submodel
|
||||
extern void model_set_instance(int model_num, int sub_model_num, submodel_instance_info * sii, int flags = 0 );
|
||||
extern void model_set_instance_techroom(int model_num, int sub_model_num, float angle_1, float angle_2 );
|
||||
extern void model_set_instance(int model_num, int sub_model_num, submodel_instance_info *sii, int flags = 0);
|
||||
extern void model_set_instance_techroom(int model_num, int sub_model_num, float angle_1, float angle_2);
|
||||
|
||||
void model_update_instance(int model_instance_num, int sub_model_num, submodel_instance_info *sii);
|
||||
void model_instance_dumb_rotation(int model_instance_num);
|
||||
void model_update_instance(int model_instance_num, int sub_model_num, submodel_instance_info *sii, int flags);
|
||||
|
||||
// Adds an electrical arcing effect to a submodel
|
||||
void model_add_arc(int model_num, int sub_model_num, vec3d *v1, vec3d *v2, int arc_type);
|
||||
@@ -1095,8 +1097,8 @@ int submodel_get_num_polys(int model_num, int submodel_num);
|
||||
// Given a vector that is in sub_model_num's frame of
|
||||
// reference, and given the object's orient and position,
|
||||
// return the vector in the model's frame of reference.
|
||||
void model_find_obj_dir(vec3d *w_vec, vec3d *m_vec, object *pship_obj, int sub_model_num);
|
||||
void model_instance_find_obj_dir(vec3d *w_vec, vec3d *m_vec, object *pship_obj, int sub_model_num);
|
||||
void model_find_obj_dir(vec3d *w_vec, vec3d *m_vec, int model_instance_num, int submodel_num, matrix *objorient);
|
||||
void model_instance_find_obj_dir(vec3d *w_vec, vec3d *m_vec, int model_instance_num, int submodel_num, matrix *objorient);
|
||||
|
||||
|
||||
// This is the interface to model_check_collision. Rather than passing all these
|
||||
@@ -1366,7 +1368,7 @@ void model_finish_cloak(int full_cloak);
|
||||
|
||||
void model_do_look_at(int model_num); //Bobboau
|
||||
|
||||
void model_do_dumb_rotation(int modelnum); //Bobboau
|
||||
void model_do_intrinsic_rotations(int model_instance_num = -1);
|
||||
|
||||
int model_should_render_engine_glow(int objnum, int bank_obj);
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ void triggered_rotation::add_queue(queued_animation *the_queue, int dir)
|
||||
if (i != n_queue) {
|
||||
// replace if it's not the last item on the list
|
||||
if ( i < (MAX_TRIGGERED_ANIMATIONS-1) )
|
||||
memcpy( &queue_tmp[i], &queue_tmp[i+1], sizeof(queued_animation) * (MAX_TRIGGERED_ANIMATIONS-(i+1)) );
|
||||
memmove( &queue_tmp[i], &queue_tmp[i+1], sizeof(queued_animation) * (MAX_TRIGGERED_ANIMATIONS-(i+1)) );
|
||||
|
||||
// ok these two animations cancelled each other out, so he doesn't get on the queue
|
||||
n_queue--;
|
||||
|
||||
@@ -277,7 +277,7 @@ static void mc_check_sphereline_face( int nv, vec3d ** verts, vec3d * plane_pnt,
|
||||
//mprintf(("Estimated radius error: Estimate %f, actual %f Mc->radius\n", temp_dist, Mc->radius));
|
||||
}
|
||||
vm_vec_sub( &temp_dir, &hit_point, &temp_sphere );
|
||||
// Assert( vm_vec_dotprod( &temp_dir, &Mc_direction ) > 0 );
|
||||
// Assert( vm_vec_dot( &temp_dir, &Mc_direction ) > 0 );
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -305,7 +305,7 @@ static void mc_check_sphereline_face( int nv, vec3d ** verts, vec3d * plane_pnt,
|
||||
//mprintf(("Estimated radius error: Estimate %f, actual %f Mc->radius\n", temp_dist, Mc->radius));
|
||||
}
|
||||
vm_vec_sub( &temp_dir, &hit_point, &temp_sphere );
|
||||
// Assert( vm_vec_dotprod( &temp_dir, &Mc_direction ) > 0 );
|
||||
// Assert( vm_vec_dot( &temp_dir, &Mc_direction ) > 0 );
|
||||
*/
|
||||
|
||||
if ( (Mc->num_hits==0) || (sphere_time < Mc->hit_dist) ) {
|
||||
@@ -1206,7 +1206,7 @@ NoHit:
|
||||
vm_rotate_matrix_by_angles(&rotation_matrix, &angs);
|
||||
|
||||
matrix inv_orientation;
|
||||
vm_copy_transpose_matrix(&inv_orientation, &csm->orientation);
|
||||
vm_copy_transpose(&inv_orientation, &csm->orientation);
|
||||
|
||||
vm_matrix_x_matrix(&tm, &rotation_matrix, &inv_orientation);
|
||||
}
|
||||
@@ -1338,7 +1338,7 @@ int model_collide(mc_info *mc_info_obj)
|
||||
vm_vec_add2(&Mc->hit_point_world, Mc->pos);
|
||||
} else {
|
||||
if ( Mc_pmi ) {
|
||||
model_instance_find_world_point(&Mc->hit_point_world, &Mc->hit_point, Mc->model_num, Mc->model_instance_num, Mc->hit_submodel, Mc->orient, Mc->pos);
|
||||
model_instance_find_world_point(&Mc->hit_point_world, &Mc->hit_point, Mc->model_instance_num, Mc->hit_submodel, Mc->orient, Mc->pos);
|
||||
} else {
|
||||
model_find_world_point(&Mc->hit_point_world, &Mc->hit_point, Mc->model_num, Mc->hit_submodel, Mc->orient, Mc->pos);
|
||||
}
|
||||
@@ -1376,7 +1376,7 @@ void model_collide_preprocess_subobj(vec3d *pos, matrix *orient, polymodel *pm,
|
||||
vm_rotate_matrix_by_angles(&rotation_matrix, &angs);
|
||||
|
||||
matrix inv_orientation;
|
||||
vm_copy_transpose_matrix(&inv_orientation, &csm->orientation);
|
||||
vm_copy_transpose(&inv_orientation, &csm->orientation);
|
||||
|
||||
vm_matrix_x_matrix(&tm, &rotation_matrix, &inv_orientation);
|
||||
}
|
||||
|
||||
+38
-16
@@ -1628,7 +1628,7 @@ void model_interp_subcall(polymodel * pm, int mn, int detail_level)
|
||||
vm_rotate_matrix_by_angles(&rotation_matrix, &pm->submodel[mn].angs);
|
||||
|
||||
matrix inv_orientation;
|
||||
vm_copy_transpose_matrix(&inv_orientation, &pm->submodel[mn].orientation);
|
||||
vm_copy_transpose(&inv_orientation, &pm->submodel[mn].orientation);
|
||||
|
||||
matrix submodel_matrix;
|
||||
vm_matrix_x_matrix(&submodel_matrix, &rotation_matrix, &inv_orientation);
|
||||
@@ -2011,8 +2011,6 @@ void model_render_DEPRECATED(int model_num, matrix *orient, vec3d * pos, uint fl
|
||||
|
||||
polymodel *pm = model_get(model_num);
|
||||
|
||||
model_do_dumb_rotation(model_num);
|
||||
|
||||
if (flags & MR_FORCE_CLAMP)
|
||||
gr_set_texture_addressing(TMAP_ADDRESS_CLAMP);
|
||||
|
||||
@@ -2239,7 +2237,7 @@ void moldel_calc_facing_pts( vec3d *top, vec3d *bot, vec3d *fvec, vec3d *pos, fl
|
||||
vm_vec_sub( &rvec, Eyeposition, &temp );
|
||||
vm_vec_normalize( &rvec );
|
||||
|
||||
vm_vec_crossprod(&uvec,fvec,&rvec);
|
||||
vm_vec_cross(&uvec,fvec,&rvec);
|
||||
vm_vec_normalize(&uvec);
|
||||
|
||||
vm_vec_scale_add( top, &temp, &uvec, w/2.0f );
|
||||
@@ -2349,7 +2347,7 @@ void model_render_thrusters(polymodel *pm, int objnum, ship *shipp, matrix *orie
|
||||
vm_vec_sub(&loc_offset, &gpt->pnt, &submodel_static_offset);
|
||||
|
||||
tempv = loc_offset;
|
||||
find_submodel_instance_point_normal(&loc_offset, &loc_norm, &Objects[objnum], bank->submodel_num, &tempv, &loc_norm);
|
||||
find_submodel_instance_point_normal(&loc_offset, &loc_norm, shipp->model_instance_num, bank->submodel_num, &tempv, &loc_norm);
|
||||
}
|
||||
|
||||
vm_vec_unrotate(&world_pnt, &loc_offset, orient);
|
||||
@@ -2659,7 +2657,7 @@ void model_render_glow_points_DEPRECATED(polymodel *pm, ship *shipp, matrix *ori
|
||||
vm_vec_sub(&loc_offset, &gpt->pnt, &submodel_static_offset);
|
||||
|
||||
tempv = loc_offset;
|
||||
find_submodel_instance_point_normal(&loc_offset, &loc_norm, &Objects[shipp->objnum], bank->submodel_parent, &tempv, &loc_norm);
|
||||
find_submodel_instance_point_normal(&loc_offset, &loc_norm, shipp->model_instance_num, bank->submodel_parent, &tempv, &loc_norm);
|
||||
}
|
||||
|
||||
vm_vec_unrotate(&world_pnt, &loc_offset, orient);
|
||||
@@ -2817,7 +2815,7 @@ void model_render_glow_points_DEPRECATED(polymodel *pm, ship *shipp, matrix *ori
|
||||
} else {
|
||||
cone_dir_rot = gpo->cone_direction;
|
||||
}
|
||||
find_submodel_instance_point_normal(&unused, &cone_dir_model, &Objects[shipp->objnum], bank->submodel_parent, &unused, &cone_dir_rot);
|
||||
find_submodel_instance_point_normal(&unused, &cone_dir_model, shipp->model_instance_num, bank->submodel_parent, &unused, &cone_dir_rot);
|
||||
vm_vec_unrotate(&cone_dir_world, &cone_dir_model, orient);
|
||||
vm_vec_rotate(&cone_dir_screen, &cone_dir_world, &Eye_matrix);
|
||||
cone_dir_screen.xyz.z = -cone_dir_screen.xyz.z;
|
||||
@@ -3603,8 +3601,21 @@ void submodel_get_two_random_points(int model_num, int submodel_num, vec3d *v1,
|
||||
return;
|
||||
}
|
||||
|
||||
int vn1 = (myrand()>>5) % nv;
|
||||
int vn2 = (myrand()>>5) % nv;
|
||||
#ifndef NDEBUG
|
||||
if (RAND_MAX < nv)
|
||||
{
|
||||
static int submodel_get_two_random_points_warned = false;
|
||||
if (!submodel_get_two_random_points_warned)
|
||||
{
|
||||
polymodel *pm = model_get(model_num);
|
||||
Warning(LOCATION, "RAND_MAX is only %d, but submodel %d for model %s has %d vertices! Explosions will not propagate through the entire model!\n", RAND_MAX, submodel_num, pm->filename, nv);
|
||||
submodel_get_two_random_points_warned = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int vn1 = myrand() % nv;
|
||||
int vn2 = myrand() % nv;
|
||||
|
||||
*v1 = *Interp_verts[vn1];
|
||||
*v2 = *Interp_verts[vn2];
|
||||
@@ -3641,9 +3652,20 @@ void submodel_get_two_random_points_better(int model_num, int submodel_num, vec3
|
||||
return;
|
||||
}
|
||||
|
||||
Assert(nv > 0); // Goober5000 - to avoid div-0 error
|
||||
int vn1 = (myrand()>>5) % nv;
|
||||
int vn2 = (myrand()>>5) % nv;
|
||||
#ifndef NDEBUG
|
||||
if (RAND_MAX < nv)
|
||||
{
|
||||
static int submodel_get_two_random_points_warned = false;
|
||||
if (!submodel_get_two_random_points_warned)
|
||||
{
|
||||
Warning(LOCATION, "RAND_MAX is only %d, but submodel %d for model %s has %d vertices! Explosions will not propagate through the entire model!\n", RAND_MAX, submodel_num, pm->filename, nv);
|
||||
submodel_get_two_random_points_warned = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int vn1 = myrand() % nv;
|
||||
int vn2 = myrand() % nv;
|
||||
|
||||
*v1 = tree->point_list[vn1];
|
||||
*v2 = tree->point_list[vn2];
|
||||
@@ -4336,7 +4358,7 @@ void interp_configure_vertex_buffers(polymodel *pm, int mn)
|
||||
polygon_list[i].n_verts = vert_count;
|
||||
|
||||
// set submodel ID
|
||||
if ( Use_GLSL >= 3 ) {
|
||||
if ( GLSL_version >= 130 ) {
|
||||
for ( j = 0; j < polygon_list[i].n_verts; ++j ) {
|
||||
polygon_list[i].submodels[j] = mn;
|
||||
}
|
||||
@@ -4392,7 +4414,7 @@ void interp_configure_vertex_buffers(polymodel *pm, int mn)
|
||||
memcpy( (model_list->tsb) + model_list->n_verts, polygon_list[i].tsb, sizeof(tsb_t) * polygon_list[i].n_verts );
|
||||
}
|
||||
|
||||
if ( Use_GLSL >= 3 ) {
|
||||
if ( GLSL_version >= 130 ) {
|
||||
memcpy( (model_list->submodels) + model_list->n_verts, polygon_list[i].submodels, sizeof(int) * polygon_list[i].n_verts );
|
||||
}
|
||||
|
||||
@@ -4412,7 +4434,7 @@ void interp_configure_vertex_buffers(polymodel *pm, int mn)
|
||||
}
|
||||
|
||||
if ( model_list->submodels != NULL ) {
|
||||
Assert( Use_GLSL >= 3 );
|
||||
Assert( GLSL_version >= 130 );
|
||||
vertex_flags |= VB_FLAG_MODEL_ID;
|
||||
}
|
||||
|
||||
@@ -4771,7 +4793,7 @@ void model_render_children_buffers_DEPRECATED(polymodel *pm, int mn, int detail_
|
||||
vm_rotate_matrix_by_angles(&rotation_matrix, &ang);
|
||||
|
||||
matrix inv_orientation;
|
||||
vm_copy_transpose_matrix(&inv_orientation, &model->orientation);
|
||||
vm_copy_transpose(&inv_orientation, &model->orientation);
|
||||
|
||||
matrix submodel_matrix;
|
||||
vm_matrix_x_matrix(&submodel_matrix, &rotation_matrix, &inv_orientation);
|
||||
|
||||
+414
-298
File diff suppressed because it is too large.
Load diff
+43
-14
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "asteroid/asteroid.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "gamesequence/gamesequence.h"
|
||||
#include "graphics/gropengldraw.h"
|
||||
@@ -23,6 +24,7 @@
|
||||
#include "render/3dinternal.h"
|
||||
#include "ship/ship.h"
|
||||
#include "ship/shipfx.h"
|
||||
#include "weapon/weapon.h"
|
||||
|
||||
extern int Model_texturing;
|
||||
extern int Model_polys;
|
||||
@@ -1194,7 +1196,7 @@ void model_render_buffers(draw_list* scene, model_render_params* interp, vertex_
|
||||
scale.xyz.x = 1.0f;
|
||||
scale.xyz.y = 1.0f;
|
||||
|
||||
if ( Use_GLSL > 1 ) {
|
||||
if ( is_minimum_GLSL_version() ) {
|
||||
scale.xyz.z = 1.0f;
|
||||
scene->set_thrust_scale(interp->get_thruster_info().length.xyz.z);
|
||||
} else {
|
||||
@@ -1395,7 +1397,7 @@ void model_render_buffers(draw_list* scene, model_render_params* interp, vertex_
|
||||
}
|
||||
}
|
||||
|
||||
void model_render_children_buffers(draw_list* scene, model_render_params* interp, polymodel* pm, int mn, int detail_level, uint tmap_flags, bool trans_buffer)
|
||||
void model_render_children_buffers(draw_list* scene, model_render_params* interp, polymodel* pm, polymodel_instance *pmi, int mn, int detail_level, uint tmap_flags, bool trans_buffer)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1405,9 +1407,19 @@ void model_render_children_buffers(draw_list* scene, model_render_params* interp
|
||||
}
|
||||
|
||||
bsp_info *model = &pm->submodel[mn];
|
||||
submodel_instance *smi = NULL;
|
||||
|
||||
if (model->blown_off)
|
||||
if ( pmi != NULL ) {
|
||||
smi = &pmi->submodel[mn];
|
||||
}
|
||||
|
||||
if ( smi != NULL ) {
|
||||
if ( smi->blown_off ) {
|
||||
return;
|
||||
}
|
||||
} else if ( model->blown_off ) {
|
||||
return;
|
||||
}
|
||||
|
||||
const uint model_flags = interp->get_model_flags();
|
||||
|
||||
@@ -1430,6 +1442,10 @@ void model_render_children_buffers(draw_list* scene, model_render_params* interp
|
||||
// the submodel relative to its parent
|
||||
angles ang = model->angs;
|
||||
|
||||
if ( smi != NULL ) {
|
||||
ang = smi->angs;
|
||||
}
|
||||
|
||||
// Add barrel rotation if needed
|
||||
if ( model->gun_rotation ) {
|
||||
if ( pm->gun_submodel_rotation > PI2 ) {
|
||||
@@ -1450,7 +1466,7 @@ void model_render_children_buffers(draw_list* scene, model_render_params* interp
|
||||
vm_rotate_matrix_by_angles(&rotation_matrix, &ang);
|
||||
|
||||
matrix inv_orientation;
|
||||
vm_copy_transpose_matrix(&inv_orientation, &model->orientation);
|
||||
vm_copy_transpose(&inv_orientation, &model->orientation);
|
||||
|
||||
matrix submodel_matrix;
|
||||
vm_matrix_x_matrix(&submodel_matrix, &rotation_matrix, &inv_orientation);
|
||||
@@ -1477,7 +1493,7 @@ void model_render_children_buffers(draw_list* scene, model_render_params* interp
|
||||
|
||||
while ( i >= 0 ) {
|
||||
if ( !pm->submodel[i].is_thruster ) {
|
||||
model_render_children_buffers( scene, interp, pm, i, detail_level, tmap_flags, trans_buffer );
|
||||
model_render_children_buffers( scene, interp, pm, pmi, i, detail_level, tmap_flags, trans_buffer );
|
||||
}
|
||||
|
||||
i = pm->submodel[i].next_sibling;
|
||||
@@ -1794,7 +1810,7 @@ void model_render_glowpoint(int point_num, vec3d *pos, matrix *orient, glow_poin
|
||||
vm_vec_sub(&loc_offset, &gpt->pnt, &submodel_static_offset);
|
||||
|
||||
tempv = loc_offset;
|
||||
find_submodel_instance_point_normal(&loc_offset, &loc_norm, &Objects[shipp->objnum], bank->submodel_parent, &tempv, &loc_norm);
|
||||
find_submodel_instance_point_normal(&loc_offset, &loc_norm, shipp->model_instance_num, bank->submodel_parent, &tempv, &loc_norm);
|
||||
}
|
||||
|
||||
vm_vec_unrotate(&world_pnt, &loc_offset, orient);
|
||||
@@ -1959,7 +1975,7 @@ void model_render_glowpoint(int point_num, vec3d *pos, matrix *orient, glow_poin
|
||||
cone_dir_rot = gpo->cone_direction;
|
||||
}
|
||||
|
||||
find_submodel_instance_point_normal(&unused, &cone_dir_model, &Objects[shipp->objnum], bank->submodel_parent, &unused, &cone_dir_rot);
|
||||
find_submodel_instance_point_normal(&unused, &cone_dir_model, shipp->model_instance_num, bank->submodel_parent, &unused, &cone_dir_rot);
|
||||
vm_vec_unrotate(&cone_dir_world, &cone_dir_model, orient);
|
||||
vm_vec_rotate(&cone_dir_screen, &cone_dir_world, &Eye_matrix);
|
||||
cone_dir_screen.xyz.z = -cone_dir_screen.xyz.z;
|
||||
@@ -2260,7 +2276,7 @@ void model_queue_render_thrusters(model_render_params *interp, polymodel *pm, in
|
||||
vm_vec_sub(&loc_offset, &gpt->pnt, &submodel_static_offset);
|
||||
|
||||
tempv = loc_offset;
|
||||
find_submodel_instance_point_normal(&loc_offset, &loc_norm, &Objects[objnum], bank->submodel_num, &tempv, &loc_norm);
|
||||
find_submodel_instance_point_normal(&loc_offset, &loc_norm, shipp->model_instance_num, bank->submodel_num, &tempv, &loc_norm);
|
||||
}
|
||||
|
||||
vm_vec_unrotate(&world_pnt, &loc_offset, orient);
|
||||
@@ -2530,7 +2546,7 @@ void model_render_debug_children(polymodel *pm, int mn, int detail_level, uint d
|
||||
vm_rotate_matrix_by_angles(&rotation_matrix, &ang);
|
||||
|
||||
matrix inv_orientation;
|
||||
vm_copy_transpose_matrix(&inv_orientation, &model->orientation);
|
||||
vm_copy_transpose(&inv_orientation, &model->orientation);
|
||||
|
||||
matrix submodel_matrix;
|
||||
vm_matrix_x_matrix(&submodel_matrix, &rotation_matrix, &inv_orientation);
|
||||
@@ -2670,9 +2686,8 @@ void model_render_queue(model_render_params *interp, draw_list *scene, int model
|
||||
const int model_flags = interp->get_model_flags();
|
||||
|
||||
polymodel *pm = model_get(model_num);
|
||||
polymodel_instance *pmi = NULL;
|
||||
|
||||
model_do_dumb_rotation(model_num);
|
||||
|
||||
float light_factor = model_render_determine_light_factor(interp, pos, model_flags);
|
||||
|
||||
if ( light_factor < (1.0f/32.0f) ) {
|
||||
@@ -2714,8 +2729,22 @@ void model_render_queue(model_render_params *interp, draw_list *scene, int model
|
||||
|
||||
if (objp->type == OBJ_SHIP) {
|
||||
shipp = &Ships[objp->instance];
|
||||
pmi = model_get_instance(shipp->model_instance_num);
|
||||
}
|
||||
else if (pm->flags & PM_FLAG_HAS_INTRINSIC_ROTATE) {
|
||||
if (objp->type == OBJ_ASTEROID)
|
||||
pmi = model_get_instance(Asteroids[objp->instance].model_instance_num);
|
||||
else if (objp->type == OBJ_WEAPON)
|
||||
pmi = model_get_instance(Weapons[objp->instance].model_instance_num);
|
||||
else
|
||||
Warning(LOCATION, "Unsupported object type %d for rendering intrinsic-rotate submodels!", objp->type);
|
||||
}
|
||||
}
|
||||
|
||||
// is this a skybox with a rotating submodel?
|
||||
extern int Nmodel_num, Nmodel_instance_num;
|
||||
if (model_num == Nmodel_num && Nmodel_instance_num >= 0)
|
||||
pmi = model_get_instance(Nmodel_instance_num);
|
||||
|
||||
// Set the flags we will pass to the tmapper
|
||||
uint tmap_flags = TMAP_FLAG_GOURAUD | TMAP_FLAG_RGB;
|
||||
@@ -2849,7 +2878,7 @@ void model_render_queue(model_render_params *interp, draw_list *scene, int model
|
||||
|
||||
while( i >= 0 ) {
|
||||
if ( !pm->submodel[i].is_thruster ) {
|
||||
model_render_children_buffers( scene, interp, pm, i, detail_level, tmap_flags, trans_buffer );
|
||||
model_render_children_buffers( scene, interp, pm, pmi, i, detail_level, tmap_flags, trans_buffer );
|
||||
} else {
|
||||
draw_thrusters = true;
|
||||
}
|
||||
@@ -2886,7 +2915,7 @@ void model_render_queue(model_render_params *interp, draw_list *scene, int model
|
||||
|
||||
while( i >= 0 ) {
|
||||
if ( !pm->submodel[i].is_thruster ) {
|
||||
model_render_children_buffers( scene, interp, pm, i, detail_level, tmap_flags, trans_buffer );
|
||||
model_render_children_buffers( scene, interp, pm, pmi, i, detail_level, tmap_flags, trans_buffer );
|
||||
}
|
||||
|
||||
i = pm->submodel[i].next_sibling;
|
||||
@@ -2907,7 +2936,7 @@ void model_render_queue(model_render_params *interp, draw_list *scene, int model
|
||||
|
||||
while( i >= 0 ) {
|
||||
if (pm->submodel[i].is_thruster) {
|
||||
model_render_children_buffers( scene, interp, pm, i, detail_level, tmap_flags, trans_buffer );
|
||||
model_render_children_buffers( scene, interp, pm, pmi, i, detail_level, tmap_flags, trans_buffer );
|
||||
}
|
||||
i = pm->submodel[i].next_sibling;
|
||||
}
|
||||
|
||||
@@ -392,14 +392,10 @@ public:
|
||||
static int sortDrawPair(const void* a, const void* b);
|
||||
};
|
||||
|
||||
//void model_immediate_render(int model_num, matrix *orient, vec3d * pos, uint flags = MR_NORMAL, int objnum = -1, int lighting_skip = -1, int *replacement_textures = NULL);
|
||||
void model_render_immediate(model_render_params *render_info, int model_num, matrix *orient, vec3d * pos, int render = MODEL_RENDER_ALL, bool sort = true);
|
||||
void model_render_queue(model_render_params *render_info, draw_list* scene, int model_num, matrix *orient, vec3d *pos);
|
||||
//void model_queue_render(DrawList* scene, int model_num, int model_instance_num, matrix *orient, vec3d *pos, uint flags, int objnum, int *replacement_textures, const bool is_skybox = false);
|
||||
//void submodel_immediate_render(int model_num, int submodel_num, matrix *orient, vec3d * pos, uint flags = MR_NORMAL, int objnum = -1, int *replacement_textures = NULL);
|
||||
void submodel_render_immediate(model_render_params *render_info, int model_num, int submodel_num, matrix *orient, vec3d * pos);
|
||||
void submodel_render_queue(model_render_params *render_info, draw_list *scene, int model_num, int submodel_num, matrix *orient, vec3d * pos);
|
||||
//void submodel_queue_render(model_render_params *interp, DrawList *scene, int model_num, int submodel_num, matrix *orient, vec3d * pos, uint flags, int objnum = -1);
|
||||
void model_render_buffers(draw_list* scene, model_render_params* interp, vertex_buffer *buffer, polymodel *pm, int mn, int detail_level, uint tmap_flags);
|
||||
void model_render_set_thrust(model_render_params *interp, int model_num, mst_info *mst);
|
||||
void model_render_set_clip_plane(model_render_params *interp, vec3d *pos = NULL, vec3d *normal = NULL);
|
||||
|
||||
@@ -854,7 +854,7 @@ void nebl_calc_facing_pts_smart( vec3d *top, vec3d *bot, vec3d *fvec, vec3d *pos
|
||||
vm_vec_sub( &rvec, &Eye_position, &temp );
|
||||
vm_vec_normalize( &rvec );
|
||||
|
||||
vm_vec_crossprod(&uvec,fvec,&rvec);
|
||||
vm_vec_cross(&uvec,fvec,&rvec);
|
||||
vm_vec_normalize(&uvec);
|
||||
|
||||
vm_vec_scale_add( top, &temp, &uvec, w/2.0f );
|
||||
|
||||
+8
-16
@@ -101,8 +101,8 @@ int Multi_button_info_ok = 0; // flag saying it is ok to apply critical
|
||||
int Multi_button_info_id = 0; // identifier of the stored button info to be applying
|
||||
|
||||
// low level networking vars
|
||||
int ADDRESS_LENGTH; // will be 6 for IPX, 4 for IP
|
||||
int PORT_LENGTH; // will be 2 for IPX, 2 for IP
|
||||
int ADDRESS_LENGTH;
|
||||
int PORT_LENGTH;
|
||||
int HEADER_LENGTH; // 1 byte (packet type)
|
||||
|
||||
// misc data
|
||||
@@ -952,7 +952,6 @@ void multi_process_bigdata(ubyte *data, int len, net_addr *from_addr, int reliab
|
||||
// store fields that were passed along in the message
|
||||
// store header information that was captured from the network-layer header
|
||||
memcpy(header_info.addr, from_addr->addr, 6);
|
||||
memcpy(header_info.net_id, from_addr->net_id, 4);
|
||||
header_info.port = from_addr->port;
|
||||
if(player_num >= 0){
|
||||
header_info.id = Net_players[player_num].player_id;
|
||||
@@ -1439,14 +1438,11 @@ void standalone_main_init()
|
||||
// multi_options_read_config();
|
||||
#ifdef _WIN32
|
||||
// if we failed to startup on our desired protocol, fail
|
||||
if((Multi_options_g.protocol == NET_IPX) && !Ipx_active){
|
||||
MessageBox((HWND)os_get_window(), XSTR( "You have selected IPX for multiplayer FreeSpace, but the IPX protocol was not detected on your machine.", 1402), "Error", MB_OK);
|
||||
exit(1);
|
||||
}
|
||||
if((Multi_options_g.protocol == NET_TCP) && !Tcp_active){
|
||||
if ((Multi_options_g.protocol == NET_TCP) && !Tcp_active){
|
||||
if (Tcp_failure_code == WSAEADDRINUSE) {
|
||||
MessageBox((HWND)os_get_window(), XSTR("You have selected TCP/IP for multiplayer FreeSpace, but the TCP socket is already in use. Check for another instance and/or use the \"-port <port_num>\" command line option to select an available port.", 1620), "Error", MB_OK);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
MessageBox((HWND)os_get_window(), XSTR("You have selected TCP/IP for multiplayer FreeSpace, but the TCP/IP protocol was not detected on your machine.", 362), "Error", MB_OK);
|
||||
}
|
||||
|
||||
@@ -1454,17 +1450,13 @@ void standalone_main_init()
|
||||
}
|
||||
#endif // ifdef _WIN32
|
||||
|
||||
|
||||
// set the protocol
|
||||
psnet_use_protocol(Multi_options_g.protocol);
|
||||
switch (Multi_options_g.protocol) {
|
||||
case NET_IPX:
|
||||
ADDRESS_LENGTH = IPX_ADDRESS_LENGTH;
|
||||
PORT_LENGTH = IPX_PORT_LENGTH;
|
||||
break;
|
||||
|
||||
case NET_TCP:
|
||||
ADDRESS_LENGTH = IP_ADDRESS_LENGTH;
|
||||
PORT_LENGTH = IP_PORT_LENGTH;
|
||||
ADDRESS_LENGTH = IP_ADDRESS_LENGTH;
|
||||
PORT_LENGTH = IP_PORT_LENGTH;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -92,8 +92,6 @@ class player;
|
||||
// low level networking defines
|
||||
#define IP_ADDRESS_LENGTH 4 // length of the address field for an IP address
|
||||
#define IP_PORT_LENGTH 2 // length of the port field for an IP address
|
||||
#define IPX_ADDRESS_LENGTH 6 // length of the address field for an IPX address
|
||||
#define IPX_PORT_LENGTH 2 // length of the port field for an IPX address
|
||||
|
||||
// netgame defines
|
||||
#define MP_SINGLE_MISSION 0 // not playing a campaign - single mission
|
||||
@@ -762,8 +760,8 @@ extern int Multi_button_info_ok; // flag saying it is ok to apply criti
|
||||
extern int Multi_button_info_id; // identifier of the stored button info to be applying
|
||||
|
||||
// low level networking vars
|
||||
extern int ADDRESS_LENGTH; // will be 6 for IPX, 4 for IP
|
||||
extern int PORT_LENGTH; // will be 2 for IPX, 2 for IP
|
||||
extern int ADDRESS_LENGTH; // will be 4 for IP
|
||||
extern int PORT_LENGTH; // will be 2 for IP
|
||||
extern int HEADER_LENGTH; // 1 byte (packet type)
|
||||
|
||||
// misc data
|
||||
|
||||
@@ -181,8 +181,8 @@ bool multi_oo_sort_func(const short &index1, const short &index2)
|
||||
dist1 = vm_vec_copy_normalize(&vn1, &v1);
|
||||
vm_vec_sub(&v2, &OO_player_obj->pos, &obj2->pos);
|
||||
dist2 = vm_vec_copy_normalize(&vn2, &v2);
|
||||
dot1 = vm_vec_dotprod(&OO_player_obj->orient.vec.fvec, &vn1);
|
||||
dot2 = vm_vec_dotprod(&OO_player_obj->orient.vec.fvec, &vn2);
|
||||
dot1 = vm_vec_dot(&OO_player_obj->orient.vec.fvec, &vn1);
|
||||
dot2 = vm_vec_dot(&OO_player_obj->orient.vec.fvec, &vn2);
|
||||
|
||||
// objects in front take precedence
|
||||
if((dot1 < 0.0f) && (dot2 >= 0.0f)){
|
||||
@@ -1984,7 +1984,7 @@ void multi_oo_calc_interp_splines(int ship_index, vec3d *cur_pos, matrix *cur_or
|
||||
if(!IS_VEC_NULL_SQ_SAFE(&v_norm) && !IS_VEC_NULL_SQ_SAFE(&v_dir)){
|
||||
vm_vec_normalize(&v_dir);
|
||||
vm_vec_normalize(&v_norm);
|
||||
if(vm_vec_dotprod(&v_dir, &v_norm) < 0.0f){
|
||||
if(vm_vec_dot(&v_dir, &v_norm) < 0.0f){
|
||||
*new_pos = *cur_pos;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1456,14 +1456,8 @@ int multi_voice_max_chunk_size(int msg_mode)
|
||||
header_size += 2; // targeted player's object net_signature
|
||||
}
|
||||
|
||||
// if we're in IPX mode
|
||||
if(Psnet_my_addr.type == NET_IPX){
|
||||
header_size += 10; // my address (10 bytes in IPX)
|
||||
}
|
||||
// if we're in TCP mode
|
||||
else {
|
||||
header_size += 4; // my address (4 bytes in TCP)
|
||||
}
|
||||
// allocate header space for my address
|
||||
header_size += 4; // my address (4 bytes in TCP)
|
||||
|
||||
// calculate max chunk size
|
||||
return (MAX_PACKET_SIZE - // max freespace packet size
|
||||
|
||||
Loaded 100 of 217 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user