mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-09 04:49:39 -10:00
Compare commits
363
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
044febd692 | ||
|
|
62eae3726f | ||
|
|
8469407a02 | ||
|
|
97509f83aa | ||
|
|
e224889510 | ||
|
|
e227ffcf89 | ||
|
|
d6a490134e | ||
|
|
38d79d6a8f | ||
|
|
af08842474 | ||
|
|
72e6df0185 | ||
|
|
b9839092c3 | ||
|
|
c695230883 | ||
|
|
e2f1229d79 | ||
|
|
bdb1569898 | ||
|
|
4f18bbd624 | ||
|
|
b78f77f0a0 | ||
|
|
3427549f9b | ||
|
|
f711df0fd1 | ||
|
|
5119664e14 | ||
|
|
6e4021888d | ||
|
|
03123b1437 | ||
|
|
47060c5c9b | ||
|
|
0c628834c5 | ||
|
|
b4a20998e1 | ||
|
|
b4d35f6afe | ||
|
|
144a30b20f | ||
|
|
fe5c1f3bad | ||
|
|
763f714864 | ||
|
|
26217893fd | ||
|
|
ce24e12816 | ||
|
|
570755309c | ||
|
|
4f22d45411 | ||
|
|
26db4ff799 | ||
|
|
aa49d10143 | ||
|
|
d5168e3592 | ||
|
|
d8a1a68c16 | ||
|
|
70ecaa5d86 | ||
|
|
bdf9f7008b | ||
|
|
1637424c35 | ||
|
|
26b7f17c41 | ||
|
|
fff260ae8e | ||
|
|
5dcf9f7880 | ||
|
|
bf6391e4c2 | ||
|
|
87774d9ce8 | ||
|
|
b4abe9f24d | ||
|
|
3f1880d22c | ||
|
|
9e61bb1df9 | ||
|
|
26dfa5f47f | ||
|
|
e302a90a1e | ||
|
|
bec2409fba | ||
|
|
812e480bb3 | ||
|
|
d704a450cb | ||
|
|
4ea1424e64 | ||
|
|
0272c785dd | ||
|
|
8e83b3f502 | ||
|
|
2d495a3c15 | ||
|
|
e57d4ff5f2 | ||
|
|
6e0200d27e | ||
|
|
38eff95a7f | ||
|
|
d6f28ceb97 | ||
|
|
b8375fa785 | ||
|
|
d5f2b68044 | ||
|
|
afd60862ab | ||
|
|
deaad91241 | ||
|
|
6842f9d910 | ||
|
|
eb862504f4 | ||
|
|
ec427000eb | ||
|
|
87dd770d93 | ||
|
|
39efcaf386 | ||
|
|
a58ae3d02e | ||
|
|
2f0c86dd01 | ||
|
|
98e1d6b56f | ||
|
|
6d8ca2c14b | ||
|
|
d448ff3632 | ||
|
|
978f5f363f | ||
|
|
51a6901dae | ||
|
|
da0dbe84b3 | ||
|
|
6fc6267fca | ||
|
|
f5f0713345 | ||
|
|
054d745ece | ||
|
|
53492408c9 | ||
|
|
506ee1f517 | ||
|
|
58b171ce76 | ||
|
|
673f10485b | ||
|
|
1323b85c9d | ||
|
|
f80572c172 | ||
|
|
25c6d6340c | ||
|
|
33034e581b | ||
|
|
88f71ef237 | ||
|
|
69b0a7a250 | ||
|
|
cd7ce4e88b | ||
|
|
c37055ea42 | ||
|
|
b7a51a86b5 | ||
|
|
af9eea721c | ||
|
|
6ba6544036 | ||
|
|
2835c6950b | ||
|
|
0562982e02 | ||
|
|
3dd6ce5bb7 | ||
|
|
04f77b4e7c | ||
|
|
be97108d6c | ||
|
|
adbb60d8bc | ||
|
|
28a408deee | ||
|
|
6208959b49 | ||
|
|
ee75c69ab9 | ||
|
|
548faf84bc | ||
|
|
90ea4099fb | ||
|
|
e1416453a8 | ||
|
|
d18a78ef05 | ||
|
|
8406bfada6 | ||
|
|
23742e8261 | ||
|
|
f75be11102 | ||
|
|
1d453b80f2 | ||
|
|
b290f5281a | ||
|
|
89a7c1e0f4 | ||
|
|
6f32344d45 | ||
|
|
fb37f654f0 | ||
|
|
9c0dbb7acb | ||
|
|
5c12c0ef48 | ||
|
|
e55577111e | ||
|
|
61891ed5ec | ||
|
|
84e6b6eabe | ||
|
|
1f5444b850 | ||
|
|
d12f0c7ae9 | ||
|
|
3736999bdc | ||
|
|
93bb980ff3 | ||
|
|
4862747454 | ||
|
|
42b5befef0 | ||
|
|
78cda09d2c | ||
|
|
b06a4a5349 | ||
|
|
21d258925d | ||
|
|
d6399427ff | ||
|
|
4bf6b83e93 | ||
|
|
07d6f2bff9 | ||
|
|
1bc83969ac | ||
|
|
aa7fc2d713 | ||
|
|
4a4268e77d | ||
|
|
66019a11ca | ||
|
|
219c7541f8 | ||
|
|
09d116f667 | ||
|
|
8c521c771b | ||
|
|
cfa7e2d7c8 | ||
|
|
6d13cce780 | ||
|
|
d1f6caaaaa | ||
|
|
871b316add | ||
|
|
9eb55188d5 | ||
|
|
9b7fff7e99 | ||
|
|
53143dee9c | ||
|
|
a6bae2c557 | ||
|
|
55aea5cf13 | ||
|
|
643a1aa230 | ||
|
|
fe03b667cd | ||
|
|
570e4cb1e6 | ||
|
|
2c45dbbb5f | ||
|
|
307106f983 | ||
|
|
68c51f242a | ||
|
|
ad1c5055d4 | ||
|
|
3abccfa76c | ||
|
|
42683318f7 | ||
|
|
f4ba5d0bb2 | ||
|
|
8d70f8c15f | ||
|
|
73f924163c | ||
|
|
83a57be996 | ||
|
|
50cc1331ae | ||
|
|
1b5f722967 | ||
|
|
33ab6d34ef | ||
|
|
d7fd6b4454 | ||
|
|
028bfecc70 | ||
|
|
e6b801595b | ||
|
|
d3f38e26bc | ||
|
|
d4305fbd85 | ||
|
|
70059a94d6 | ||
|
|
262c3178e9 | ||
|
|
91dd16167b | ||
|
|
862d6f43db | ||
|
|
966ec358e9 | ||
|
|
6ed6ecbfb8 | ||
|
|
1062040fbf | ||
|
|
0f01a1bd4c | ||
|
|
0b1ea9a58d | ||
|
|
19c1520dba | ||
|
|
3032a0f5d9 | ||
|
|
fbe14f5a5e | ||
|
|
c4b763680c | ||
|
|
60fca98974 | ||
|
|
15dbb9e8b4 | ||
|
|
9bce69ef79 | ||
|
|
fdcaebfad3 | ||
|
|
ef0c0e994b | ||
|
|
249b8496e3 | ||
|
|
7c944ed2a3 | ||
|
|
aab688222c | ||
|
|
acc7fa2b16 | ||
|
|
1ccfa433d6 | ||
|
|
a832c11585 | ||
|
|
10340678cb | ||
|
|
a82b7862d8 | ||
|
|
2ccbedd071 | ||
|
|
280b979d09 | ||
|
|
8a2af2b13b | ||
|
|
400e950190 | ||
|
|
36ac0cb908 | ||
|
|
ae062bcc0b | ||
|
|
4d0f978e1c | ||
|
|
4f7744cf36 | ||
|
|
acf1aa60ac | ||
|
|
e44de24957 | ||
|
|
6e42152761 | ||
|
|
251f52796c | ||
|
|
c5f9ba424c | ||
|
|
d23e80bdef | ||
|
|
ddd6ce2cf6 | ||
|
|
f2e2297e9f | ||
|
|
0253d298e9 | ||
|
|
f6d26f915a | ||
|
|
941faf9ab9 | ||
|
|
d0af5c2169 | ||
|
|
05769b3ffe | ||
|
|
6a3cf80be0 | ||
|
|
55c8720e90 | ||
|
|
e461625622 | ||
|
|
f598aafeb0 | ||
|
|
71e948278b | ||
|
|
ee57fa59ca | ||
|
|
dbe8e071bb | ||
|
|
27f2f168dc | ||
|
|
beafe688bb | ||
|
|
01c783e27d | ||
|
|
c7b8cd7021 | ||
|
|
6ca5bdcffa | ||
|
|
18b2922455 | ||
|
|
de28613166 | ||
|
|
9a3a1b051e | ||
|
|
8650ee98bd | ||
|
|
a4889e49e9 | ||
|
|
fcb28b51f1 | ||
|
|
7938c36df2 | ||
|
|
ceea88037c | ||
|
|
d17ea1d102 | ||
|
|
db5767b18a | ||
|
|
04fc426d90 | ||
|
|
4524583f06 | ||
|
|
f445aedaf1 | ||
|
|
666cbd4bc5 | ||
|
|
99446022fc | ||
|
|
d37828e00a | ||
|
|
818b6a40ac | ||
|
|
3bc9a692af | ||
|
|
9ef6d889d3 | ||
|
|
a0344aefae | ||
|
|
f0e53971f6 | ||
|
|
8340ed5943 | ||
|
|
89d3b62524 | ||
|
|
fdd2daebad | ||
|
|
d3509e1aba | ||
|
|
52c04fdf18 | ||
|
|
42b5c942f5 | ||
|
|
b2f21047da | ||
|
|
c3e32613d7 | ||
|
|
146d3cdd8f | ||
|
|
16a3ed9f4b | ||
|
|
b5cc4e46fb | ||
|
|
485a98ac3e | ||
|
|
4e872096b1 | ||
|
|
0248c6988a | ||
|
|
3189278d43 | ||
|
|
9278f421ad | ||
|
|
0f13bcee06 | ||
|
|
f78749be88 | ||
|
|
b784bb6cff | ||
|
|
0ae4939981 | ||
|
|
2c34c391d2 | ||
|
|
14c478376b | ||
|
|
8bf826793a | ||
|
|
58fc12fc57 | ||
|
|
61ef271683 | ||
|
|
81811ff842 | ||
|
|
455180fa4a | ||
|
|
25b56bfac6 | ||
|
|
7e047b5c98 | ||
|
|
ac4fb52604 | ||
|
|
57fbb21c62 | ||
|
|
21aa72ae2f | ||
|
|
04e4095b36 | ||
|
|
38abe31509 | ||
|
|
3b6e62805f | ||
|
|
4bff232cad | ||
|
|
ddf75fc7e0 | ||
|
|
b4b2f7d54f | ||
|
|
e71d060984 | ||
|
|
c9e3d746d4 | ||
|
|
9d4bad1c7f | ||
|
|
74a6636bc6 | ||
|
|
19ed659d6b | ||
|
|
48d8f030b3 | ||
|
|
7ef7959d77 | ||
|
|
6c7ccad82f | ||
|
|
36e44e7f2b | ||
|
|
6cfab94ef0 | ||
|
|
9764ce9ea8 | ||
|
|
d0808e2bf0 | ||
|
|
d2e4d0d6ee | ||
|
|
699ac0f2bd | ||
|
|
39d623c7c2 | ||
|
|
5404b776aa | ||
|
|
5a72f40f62 | ||
|
|
525e45db77 | ||
|
|
3f02f79b3d | ||
|
|
9360d3b580 | ||
|
|
f51a8cf3c0 | ||
|
|
743c9eb82d | ||
|
|
752bff94cc | ||
|
|
fd7cbf5750 | ||
|
|
13eb0e77e4 | ||
|
|
896b61f2fe | ||
|
|
1859ae688e | ||
|
|
943ee9b8a2 | ||
|
|
81a851e33a | ||
|
|
97951efa9d | ||
|
|
672e34c166 | ||
|
|
4ea2ca2b64 | ||
|
|
61dbdc24b3 | ||
|
|
2d79e4eee4 | ||
|
|
1a3e5f28af | ||
|
|
69b61ceaa4 | ||
|
|
ca0df1f2b0 | ||
|
|
3f48553935 | ||
|
|
cb6dbe5214 | ||
|
|
52829ea14e | ||
|
|
4e1fdc6c8b | ||
|
|
f419106805 | ||
|
|
bfe417ff2f | ||
|
|
3a54776c6b | ||
|
|
6de7ba0deb | ||
|
|
da6fa5a429 | ||
|
|
a70c5ffb1d | ||
|
|
bcdc1c1589 | ||
|
|
9a28c24f70 | ||
|
|
4374fcd1ce | ||
|
|
90e30ee37e | ||
|
|
bf23eb17c8 | ||
|
|
e10379ad18 | ||
|
|
d094476101 | ||
|
|
0a9903f48d | ||
|
|
a05b1ef11f | ||
|
|
b3d7dba2a4 | ||
|
|
a360a8e606 | ||
|
|
e44f2c1911 | ||
|
|
5b05ce6028 | ||
|
|
952c057ff9 | ||
|
|
e1044c578d | ||
|
|
bba43b5a79 | ||
|
|
f2f6bef1fa | ||
|
|
9231692e48 | ||
|
|
6e3aa4a33a | ||
|
|
663ff9d0b1 | ||
|
|
a9c8558507 | ||
|
|
d5e1312e19 | ||
|
|
2494bd0291 | ||
|
|
6c255cf1c9 | ||
|
|
16f8087433 | ||
|
|
14c7b2c4c8 | ||
|
|
9d5d21c39d | ||
|
|
466d3a2811 |
No files matched your search
@@ -306,10 +306,16 @@ FS2_SOURCES = \
|
||||
graphics/gropengl.h \
|
||||
graphics/gropenglbmpman.cpp \
|
||||
graphics/gropenglbmpman.h \
|
||||
graphics/gropengldraw.cpp \
|
||||
graphics/gropengldraw.h \
|
||||
graphics/gropenglextension.cpp \
|
||||
graphics/gropenglextension.h \
|
||||
graphics/gropengllight.cpp \
|
||||
graphics/gropengllight.h \
|
||||
graphics/gropenglshader.cpp \
|
||||
graphics/gropenglshader.h \
|
||||
graphics/gropenglstate.cpp \
|
||||
graphics/gropenglstate.h \
|
||||
graphics/gropengltexture.cpp \
|
||||
graphics/gropengltexture.h \
|
||||
graphics/gropengltnl.cpp \
|
||||
|
||||
+1
-1
@@ -858,7 +858,7 @@ void set_predicted_enemy_pos_turret(vec3d *predicted_enemy_pos, vec3d *gun_pos,
|
||||
extern void ai_set_rearm_status( int team, int new_status );
|
||||
extern void ai_good_secondary_time( int team, int weapon_index, int num_weapons, char *shipname );
|
||||
|
||||
extern void ai_do_objects_docked_stuff(object *docker, int docker_point, object *dockee, int dockee_point);
|
||||
extern void ai_do_objects_docked_stuff(object *docker, int docker_point, object *dockee, int dockee_point, bool update_clients = true);
|
||||
extern void ai_do_objects_undocked_stuff( object *docker, object *dockee );
|
||||
extern void ai_do_objects_repairing_stuff( object *repaired_obj, object *repair_obj, int how );
|
||||
|
||||
|
||||
+30
-1
@@ -149,7 +149,7 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
if (filename == NULL)
|
||||
read_file_text_from_array(defaults_get_file("ai_profiles.tbl"));
|
||||
else
|
||||
read_file_text(filename);
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
|
||||
reset_parse();
|
||||
|
||||
@@ -301,6 +301,12 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
if (optional_string("$Hostile AI Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_delay_scale_hostile, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Friendly AI Secondary Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_secondary_delay_scale_friendly, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Hostile AI Secondary Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_secondary_delay_scale_hostile, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Subsys Damage Factor:") || optional_string("$AI Damage Reduction to Player Subsys:"))
|
||||
parse_float_list(profile->subsys_damage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
@@ -322,6 +328,9 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
if (optional_string("$Percentage Required For Assist Scale:"))
|
||||
parse_float_list(profile->assist_percentage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Percentage Awarded For Capship Assist:"))
|
||||
parse_float_list(profile->assist_award_percentage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
set_flag(profile, "$big ships can attack beam turrets on untargeted ships:", AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS);
|
||||
|
||||
set_flag(profile, "$smart primary weapon selection:", AIPF_SMART_PRIMARY_WEAPON_SELECTION);
|
||||
@@ -330,6 +339,8 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
|
||||
set_flag(profile, "$smart shield management:", AIPF_SMART_SHIELD_MANAGEMENT);
|
||||
|
||||
set_flag(profile, "$smart afterburner management:", AIPF_SMART_AFTERBURNER_MANAGEMENT);
|
||||
|
||||
set_flag(profile, "$allow rapid secondary dumbfire:", AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE);
|
||||
|
||||
set_flag(profile, "$huge turret weapons ignore bombs:", AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS);
|
||||
@@ -354,6 +365,24 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
|
||||
set_flag(profile, "$include beams for kills and assists:", AIPF_INCLUDE_BEAMS_IN_STAT_CALCS);
|
||||
|
||||
set_flag(profile, "$score kills based on damage caused:", AIPF_KILL_SCORING_SCALES_WITH_DAMAGE);
|
||||
|
||||
set_flag(profile, "$score assists based on damage caused:", AIPF_ASSIST_SCORING_SCALES_WITH_DAMAGE);
|
||||
|
||||
set_flag(profile, "$allow event and goal scoring in multiplayer:", AIPF_ALLOW_MULTI_EVENT_SCORING);
|
||||
|
||||
set_flag(profile, "$fix linked primary weapon decision bug:", AIPF_FIX_LINKED_PRIMARY_BUG);
|
||||
|
||||
set_flag(profile, "$prevent turrets targeting too distant bombs:", AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE);
|
||||
|
||||
set_flag(profile, "$smart subsystem targeting for turrets:", AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS);
|
||||
|
||||
set_flag(profile, "$fix heat seekers homing on stealth ships bug:", AIPF_FIX_HEAT_SEEKER_STEALTH_BUG);
|
||||
|
||||
set_flag(profile, "$multi allow empty primaries:", AIPF_MULTI_ALLOW_EMPTY_PRIMARIES);
|
||||
|
||||
set_flag(profile, "$multi allow empty secondaries:", AIPF_MULTI_ALLOW_EMPTY_SECONDARIES);
|
||||
|
||||
// if we've been through once already and are at the same place, force a move
|
||||
if ( saved_Mp && (saved_Mp == Mp) )
|
||||
Mp++;
|
||||
|
||||
@@ -74,6 +74,16 @@
|
||||
#define AIPF_USE_ADDITIVE_WEAPON_VELOCITY (1 << 13)
|
||||
#define AIPF_USE_NEWTONIAN_DAMPENING (1 << 14)
|
||||
#define AIPF_INCLUDE_BEAMS_IN_STAT_CALCS (1 << 15)
|
||||
#define AIPF_KILL_SCORING_SCALES_WITH_DAMAGE (1 << 16)
|
||||
#define AIPF_ASSIST_SCORING_SCALES_WITH_DAMAGE (1 << 17)
|
||||
#define AIPF_ALLOW_MULTI_EVENT_SCORING (1 << 18)
|
||||
#define AIPF_SMART_AFTERBURNER_MANAGEMENT (1 << 19)
|
||||
#define AIPF_FIX_LINKED_PRIMARY_BUG (1 << 20)
|
||||
#define AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE (1 << 21)
|
||||
#define AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS (1 << 22)
|
||||
#define AIPF_FIX_HEAT_SEEKER_STEALTH_BUG (1 << 23)
|
||||
#define AIPF_MULTI_ALLOW_EMPTY_PRIMARIES (1 << 24)
|
||||
#define AIPF_MULTI_ALLOW_EMPTY_SECONDARIES (1 << 25)
|
||||
|
||||
|
||||
#define MAX_AI_PROFILES 5
|
||||
@@ -116,6 +126,10 @@ typedef struct ai_profile_t {
|
||||
float ship_fire_delay_scale_hostile[NUM_SKILL_LEVELS];
|
||||
float ship_fire_delay_scale_friendly[NUM_SKILL_LEVELS];
|
||||
|
||||
// Multiplicative secondary delay factors for increasing skill levels.
|
||||
float ship_fire_secondary_delay_scale_hostile[NUM_SKILL_LEVELS];
|
||||
float ship_fire_secondary_delay_scale_friendly[NUM_SKILL_LEVELS];
|
||||
|
||||
// Maximum turrets of one ship allowed to shoot the same target
|
||||
int max_turret_ownage_target[NUM_SKILL_LEVELS];
|
||||
int max_turret_ownage_player[NUM_SKILL_LEVELS];
|
||||
@@ -124,6 +138,9 @@ typedef struct ai_profile_t {
|
||||
float kill_percentage_scale[NUM_SKILL_LEVELS];
|
||||
float assist_percentage_scale[NUM_SKILL_LEVELS];
|
||||
|
||||
// percentage of the capships score given to other team mates on a kill
|
||||
float assist_award_percentage_scale[NUM_SKILL_LEVELS];
|
||||
|
||||
} ai_profile_t;
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1038,7 +1038,7 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float d
|
||||
}
|
||||
}
|
||||
|
||||
// use dist normal to enemy here (dont break 50 barrier)
|
||||
// use dist normal to enemy here (don't break 50 barrier)
|
||||
if (dist_to_enemy < ATTACK_STOP_DISTANCE) {
|
||||
// accelerate_ship(aip, accel * 0.5f);
|
||||
accelerate_ship(aip, -1.0f);
|
||||
|
||||
+114
-52
@@ -858,7 +858,7 @@
|
||||
*
|
||||
* 81 8/13/99 10:49a Andsager
|
||||
* Knossos and HUGE ship warp out. HUGE ship warp in. Stealth search
|
||||
* modes dont collide big ships.
|
||||
* modes don't collide big ships.
|
||||
*
|
||||
* 80 8/10/99 5:02p Andsager
|
||||
* Fix bug where AI gets stuck in SM_EVADE_WEAPON with no target.
|
||||
@@ -1717,7 +1717,7 @@ void parse_aitbl()
|
||||
// open localization
|
||||
lcl_ext_open();
|
||||
|
||||
read_file_text("ai.tbl");
|
||||
read_file_text("ai.tbl", CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
//Just in case parse_aitbl is called twice
|
||||
@@ -4020,7 +4020,7 @@ void ai_stay_still(object *still_objp, vec3d *view_pos)
|
||||
// when two objects have completed docking. used because we can dock object initially at misison load
|
||||
// time (meaning that ai_dock() might never get called). docker has docked with dockee (i.e. docker
|
||||
// would be a freighter and dockee would be a cargo).
|
||||
void ai_do_objects_docked_stuff(object *docker, int docker_point, object *dockee, int dockee_point)
|
||||
void ai_do_objects_docked_stuff(object *docker, int docker_point, object *dockee, int dockee_point, bool update_clients)
|
||||
{
|
||||
Assert((docker != NULL) && (dockee != NULL));
|
||||
|
||||
@@ -4077,7 +4077,7 @@ void ai_do_objects_docked_stuff(object *docker, int docker_point, object *dockee
|
||||
|
||||
// add multiplayer hook here to deal with docked objects. We need to only send information
|
||||
// about the object that is docking. Both flags will get updated.
|
||||
if ( MULTIPLAYER_MASTER )
|
||||
if ( MULTIPLAYER_MASTER && update_clients)
|
||||
send_ai_info_update_packet( docker, AI_UPDATE_DOCK );
|
||||
}
|
||||
|
||||
@@ -4192,7 +4192,7 @@ void ai_dock_with_object(object *docker, int docker_index, object *dockee, int d
|
||||
if (dock_type == AIDO_DOCK_NOW)
|
||||
{
|
||||
dock_orient_and_approach(docker, docker_index, dockee, dockee_index, DOA_DOCK_STAY);
|
||||
ai_do_objects_docked_stuff( docker, docker_index, dockee, dockee_index );
|
||||
ai_do_objects_docked_stuff( docker, docker_index, dockee, dockee_index, false );
|
||||
}
|
||||
// pick a path to use to start docking
|
||||
else
|
||||
@@ -5485,6 +5485,8 @@ void ai_waypoints()
|
||||
vm_vec_sub(&perp, Navs[CurrentNav].GetPosition(), &Player_obj->pos);
|
||||
vm_vector_2_matrix(&Pl_objp->orient, &perp, NULL, NULL);
|
||||
} else {
|
||||
if ( !wing_leader )
|
||||
wing_leader = Pl_objp;
|
||||
vm_vec_scale_add(&perp, &Pl_objp->pos, &wing_leader->phys_info.vel, 1000.0f);
|
||||
ai_turn_towards_vector(&perp, Pl_objp, flFrametime, sip->srotation_time*3.0f*scale, slop_vec, NULL, 0.0f, 0);
|
||||
}
|
||||
@@ -6033,7 +6035,12 @@ void evade_ship()
|
||||
float percent_left = 100.0f * shipp->afterburner_fuel / sip->afterburner_fuel_capacity;
|
||||
if (percent_left > 30.0f + ((Pl_objp-Objects) & 0x0f)) {
|
||||
afterburners_start(Pl_objp);
|
||||
aip->afterburner_stop_time = Missiontime + F1_0 + static_rand(Pl_objp-Objects)/4;
|
||||
|
||||
if (The_mission.ai_profile->flags & AIPF_SMART_AFTERBURNER_MANAGEMENT) {
|
||||
aip->afterburner_stop_time = (fix) (Missiontime + F1_0 + static_randf(Pl_objp-Objects) * F1_0 / 4);
|
||||
} else {
|
||||
aip->afterburner_stop_time = Missiontime + F1_0 + static_rand(Pl_objp-Objects)/4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6548,12 +6555,21 @@ void set_primary_weapon_linkage(object *objp)
|
||||
return;
|
||||
}
|
||||
|
||||
// regular lasers
|
||||
if (shipp->weapon_energy > The_mission.ai_profile->link_energy_levels_always[Game_skill_level]) {
|
||||
// get energy level
|
||||
float energy;
|
||||
if (The_mission.ai_profile->flags & AIPF_FIX_LINKED_PRIMARY_BUG) {
|
||||
energy = shipp->weapon_energy / sip->max_weapon_reserve * 100.0f;
|
||||
} else {
|
||||
energy = shipp->weapon_energy;
|
||||
}
|
||||
|
||||
// make linking decision based on weapon energy
|
||||
if (energy > The_mission.ai_profile->link_energy_levels_always[Game_skill_level]) {
|
||||
shipp->flags |= SF_PRIMARY_LINKED;
|
||||
} else if (shipp->weapon_energy > The_mission.ai_profile->link_energy_levels_maybe[Game_skill_level]) {
|
||||
if (objp->hull_strength < shipp->ship_max_hull_strength/3.0f)
|
||||
} else if (energy > The_mission.ai_profile->link_energy_levels_maybe[Game_skill_level]) {
|
||||
if (objp->hull_strength < shipp->ship_max_hull_strength/3.0f) {
|
||||
shipp->flags |= SF_PRIMARY_LINKED;
|
||||
}
|
||||
}
|
||||
|
||||
// also check ballistics - Goober5000
|
||||
@@ -6772,19 +6788,25 @@ void ai_select_secondary_weapon(object *objp, ship_weapon *swp, int priority1 =
|
||||
int num_weapon_types;
|
||||
int weapon_id_list[MAX_WEAPON_TYPES], weapon_bank_list[MAX_WEAPON_TYPES];
|
||||
int i;
|
||||
int ignore_mask;
|
||||
int ignore_mask, ignore_mask_without_huge;
|
||||
int initial_bank;
|
||||
|
||||
initial_bank = swp->current_secondary_bank;
|
||||
|
||||
// Ignore bombs unless one of the priorities asks for them to be selected.
|
||||
if (WIF_HUGE & (priority1 | priority2))
|
||||
ignore_mask = 0;
|
||||
else
|
||||
ignore_mask = WIF_HUGE;
|
||||
// set up ignore masks
|
||||
ignore_mask = 0;
|
||||
ignore_mask_without_huge = 0;
|
||||
|
||||
if (!(WIF_BOMBER_PLUS & (priority1 | priority2)))
|
||||
// Ignore bombs unless one of the priorities asks for them to be selected.
|
||||
if (!(WIF_HUGE & (priority1 | priority2))) {
|
||||
ignore_mask |= WIF_HUGE;
|
||||
}
|
||||
|
||||
// Ignore bomber+ unless one of the priorities asks for them to be selected
|
||||
if (!(WIF_BOMBER_PLUS & (priority1 | priority2))) {
|
||||
ignore_mask |= WIF_BOMBER_PLUS;
|
||||
ignore_mask_without_huge |= WIF_BOMBER_PLUS;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
for (i=0; i<MAX_WEAPON_TYPES; i++) {
|
||||
@@ -6793,19 +6815,22 @@ void ai_select_secondary_weapon(object *objp, ship_weapon *swp, int priority1 =
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((The_mission.ai_profile->flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (priority1 == 0))
|
||||
ignore_mask |= WIF_HOMING;
|
||||
|
||||
// Stuff weapon_bank_list with bank index of available weapons.
|
||||
num_weapon_types = get_available_secondary_weapons(objp, weapon_id_list, weapon_bank_list);
|
||||
|
||||
// Ignore homing weapons if we didn't specify a flag - for priority 1
|
||||
if ((The_mission.ai_profile->flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (priority1 == 0)) {
|
||||
ignore_mask |= WIF_HOMING;
|
||||
ignore_mask_without_huge |= WIF_HOMING;
|
||||
}
|
||||
|
||||
int priority2_index = -1;
|
||||
|
||||
for (i=0; i<num_weapon_types; i++) {
|
||||
int wi_flags;
|
||||
int wi_flags = Weapon_info[swp->secondary_bank_weapons[weapon_bank_list[i]]].wi_flags;
|
||||
int ignore_mask_to_use = ((The_mission.ai_profile->flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (wi_flags & WIF_BOMBER_PLUS)) ? ignore_mask_without_huge : ignore_mask;
|
||||
|
||||
wi_flags = Weapon_info[swp->secondary_bank_weapons[weapon_bank_list[i]]].wi_flags;
|
||||
if (!(wi_flags & ignore_mask)) { // Maybe bombs are illegal.
|
||||
if (!(wi_flags & ignore_mask_to_use)) { // Maybe bombs are illegal.
|
||||
if (wi_flags & priority1) {
|
||||
swp->current_secondary_bank = weapon_bank_list[i]; // Found first priority, return it.
|
||||
break;
|
||||
@@ -6814,18 +6839,21 @@ void ai_select_secondary_weapon(object *objp, ship_weapon *swp, int priority1 =
|
||||
}
|
||||
}
|
||||
|
||||
if ((The_mission.ai_profile->flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (priority2 == 0))
|
||||
// Ignore homing weapons if we didn't specify a flag - for priority 2
|
||||
if ((The_mission.ai_profile->flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (priority2 == 0)) {
|
||||
ignore_mask |= WIF_HOMING;
|
||||
ignore_mask_without_huge |= WIF_HOMING;
|
||||
}
|
||||
|
||||
// If didn't find anything above, then pick any secondary weapon.
|
||||
if (i == num_weapon_types) {
|
||||
swp->current_secondary_bank = priority2_index; // Assume we won't find anything.
|
||||
if (priority2_index == -1) {
|
||||
for (i=0; i<num_weapon_types; i++) {
|
||||
int wi_flags;
|
||||
int wi_flags = Weapon_info[swp->secondary_bank_weapons[weapon_bank_list[i]]].wi_flags;
|
||||
int ignore_mask_to_use = ((The_mission.ai_profile->flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (wi_flags & WIF_BOMBER_PLUS)) ? ignore_mask_without_huge : ignore_mask;
|
||||
|
||||
wi_flags = Weapon_info[swp->secondary_bank_weapons[weapon_bank_list[i]]].wi_flags;
|
||||
if (!(wi_flags & ignore_mask)) { // Maybe bombs are illegal.
|
||||
if (!(wi_flags & ignore_mask_to_use)) { // Maybe bombs are illegal.
|
||||
if (swp->secondary_bank_ammo[i] > 0) {
|
||||
swp->current_secondary_bank = i;
|
||||
break;
|
||||
@@ -7356,9 +7384,15 @@ void set_predicted_enemy_pos(vec3d *predicted_enemy_pos, object *pobjp, object *
|
||||
{
|
||||
float weapon_speed, range_time;
|
||||
ship *shipp = &Ships[pobjp->instance];
|
||||
vec3d target_moving_direction;
|
||||
|
||||
Assert( eobjp != NULL );
|
||||
|
||||
target_moving_direction = eobjp->phys_info.vel;
|
||||
|
||||
if (The_mission.ai_profile->flags & AIPF_USE_ADDITIVE_WEAPON_VELOCITY)
|
||||
vm_vec_sub2(&target_moving_direction, &pobjp->phys_info.vel);
|
||||
|
||||
weapon_speed = ai_get_weapon_speed(&shipp->weapons);
|
||||
weapon_speed = MAX(weapon_speed, 1.0f); // set not less than 1
|
||||
|
||||
@@ -7377,7 +7411,7 @@ void set_predicted_enemy_pos(vec3d *predicted_enemy_pos, object *pobjp, object *
|
||||
float dist;
|
||||
|
||||
dist = vm_vec_dist_quick(&pobjp->pos, &eobjp->pos);
|
||||
vm_vec_scale_add(predicted_enemy_pos, &eobjp->pos, &eobjp->phys_info.vel, aip->time_enemy_in_range * dist/weapon_speed);
|
||||
vm_vec_scale_add(predicted_enemy_pos, &eobjp->pos, &target_moving_direction, aip->time_enemy_in_range * dist/weapon_speed);
|
||||
} else {
|
||||
float collision_time;
|
||||
vec3d gun_pos, pnt;
|
||||
@@ -7392,13 +7426,13 @@ void set_predicted_enemy_pos(vec3d *predicted_enemy_pos, object *pobjp, object *
|
||||
vm_vec_unrotate(&gun_pos, &pnt, &pobjp->orient);
|
||||
vm_vec_add2(&gun_pos, &pobjp->pos);
|
||||
|
||||
collision_time = compute_collision_time(&eobjp->pos, &eobjp->phys_info.vel, &gun_pos, weapon_speed);
|
||||
collision_time = compute_collision_time(&eobjp->pos, &target_moving_direction, &gun_pos, weapon_speed);
|
||||
|
||||
if (collision_time == 0.0f) {
|
||||
collision_time = 100.0f;
|
||||
}
|
||||
|
||||
vm_vec_scale_add(predicted_enemy_pos, &eobjp->pos, &eobjp->phys_info.vel, collision_time);
|
||||
vm_vec_scale_add(predicted_enemy_pos, &eobjp->pos, &target_moving_direction, collision_time);
|
||||
|
||||
// set globals
|
||||
G_collision_time = collision_time;
|
||||
@@ -7584,8 +7618,30 @@ void attack_set_accel(ai_info *aip, float dist_to_enemy, float dot_to_enemy, flo
|
||||
if (sip->afterburner_fuel_capacity > 0.0f) {
|
||||
percent_left = 100.0f * shipp->afterburner_fuel / sip->afterburner_fuel_capacity;
|
||||
if (percent_left > 30.0f + ((Pl_objp-Objects) & 0x0f)) {
|
||||
afterburners_start(Pl_objp);
|
||||
aip->afterburner_stop_time = Missiontime + F1_0 + static_rand(Pl_objp-Objects)/4;
|
||||
afterburners_start(Pl_objp);
|
||||
if (The_mission.ai_profile->flags & AIPF_SMART_AFTERBURNER_MANAGEMENT) {
|
||||
float max_ab_vel;
|
||||
float time_to_exhaust_25pct_fuel;
|
||||
float time_to_fly_75pct_of_distance;
|
||||
float ab_time;
|
||||
|
||||
// Max afterburner speed - make sure we don't devide by 0 later
|
||||
max_ab_vel = sip->afterburner_max_vel.xyz.z > 0.0f ? sip->afterburner_max_vel.xyz.z : sip->max_vel.xyz.z;
|
||||
max_ab_vel = max_ab_vel > 0.0f ? max_ab_vel : 0.0001f;
|
||||
|
||||
// Time to exhaust 25% of the remaining fuel
|
||||
time_to_exhaust_25pct_fuel = shipp->afterburner_fuel * 0.25f / sip->afterburner_burn_rate;
|
||||
|
||||
// Time to fly 75% of the distance to the target
|
||||
time_to_fly_75pct_of_distance = dist_to_enemy * 0.75f / max_ab_vel;
|
||||
|
||||
// Get minimum
|
||||
ab_time = MIN(time_to_exhaust_25pct_fuel, time_to_fly_75pct_of_distance);
|
||||
|
||||
aip->afterburner_stop_time = (fix) (Missiontime + F1_0 * ab_time);
|
||||
} else {
|
||||
aip->afterburner_stop_time = Missiontime + F1_0 + static_rand(Pl_objp-Objects)/4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8641,10 +8697,9 @@ float set_secondary_fire_delay(ai_info *aip, ship *shipp, weapon_info *swip)
|
||||
{
|
||||
float t = swip->fire_wait; // Base delay for this weapon.
|
||||
if (shipp->team == Player_ship->team) {
|
||||
// On player's team, _lower_ skill level = faster firing
|
||||
t = t * (Game_skill_level+2) / (NUM_SKILL_LEVELS);
|
||||
} else { // Not on player's team, higher skill level = faster firing
|
||||
t = t * (NUM_SKILL_LEVELS - Game_skill_level+2) / (NUM_SKILL_LEVELS);
|
||||
t *= The_mission.ai_profile->ship_fire_secondary_delay_scale_friendly[Game_skill_level];
|
||||
} else {
|
||||
t *= The_mission.ai_profile->ship_fire_secondary_delay_scale_hostile[Game_skill_level];
|
||||
}
|
||||
|
||||
t += (Num_ai_classes - aip->ai_class + 1) * 0.5f;
|
||||
@@ -10270,7 +10325,7 @@ void guard_object_was_hit(object *guard_objp, object *hitter_objp)
|
||||
return;
|
||||
}
|
||||
|
||||
// dont attack if you can't see him
|
||||
// don't attack if you can't see him
|
||||
if ( awacs_get_level(hitter_objp, &Ships[aip->shipnum], 1) < 1 ) {
|
||||
// if he's a stealth and visible, but not targetable, ok to attack.
|
||||
if ( is_object_stealth_ship(hitter_objp) ) {
|
||||
@@ -10923,7 +10978,13 @@ void ai_guard()
|
||||
void ai_do_objects_repairing_stuff( object *repaired_objp, object *repair_objp, int how )
|
||||
{
|
||||
ai_info *aip, *repair_aip;
|
||||
int stamp = -1;
|
||||
int stamp = -1;
|
||||
|
||||
int p_index;
|
||||
int p_team;
|
||||
|
||||
p_index = -1;
|
||||
p_team = -1;
|
||||
|
||||
// repaired_objp should not be null, but repair_objp will be null when a support ship is just warping in
|
||||
Assert(repaired_objp != NULL);
|
||||
@@ -10931,12 +10992,9 @@ void ai_do_objects_repairing_stuff( object *repaired_objp, object *repair_objp,
|
||||
Assert( repaired_objp->type == OBJ_SHIP);
|
||||
aip = &Ai_info[Ships[repaired_objp->instance].ai_index];
|
||||
|
||||
// multiplayer
|
||||
int p_index;
|
||||
p_index = -1;
|
||||
|
||||
if(Game_mode & GM_MULTIPLAYER){
|
||||
p_index = multi_find_player_by_object(repaired_objp);
|
||||
p_index = multi_find_player_by_object(repaired_objp);
|
||||
p_team = Net_players[p_index].p_info.team;
|
||||
} else {
|
||||
if(repaired_objp == Player_obj){
|
||||
p_index = Player_num;
|
||||
@@ -11016,12 +11074,14 @@ void ai_do_objects_repairing_stuff( object *repaired_objp, object *repair_objp,
|
||||
if ( p_index >= 0 ) {
|
||||
hud_support_view_abort();
|
||||
|
||||
// send appropriate message to player here
|
||||
if ( how == REPAIR_INFO_KILLED ){
|
||||
message_send_builtin_to_player( MESSAGE_SUPPORT_KILLED, NULL, MESSAGE_PRIORITY_HIGH, MESSAGE_TIME_SOON, 0, 0, p_index, -1 );
|
||||
} else {
|
||||
if ( repair_objp ){
|
||||
message_send_builtin_to_player( MESSAGE_REPAIR_ABORTED, &Ships[repair_objp->instance], MESSAGE_PRIORITY_NORMAL, MESSAGE_TIME_SOON, 0, 0, p_index, -1 );
|
||||
// send appropriate messages here
|
||||
if (MULTIPLAYER_MASTER) {
|
||||
if ( how == REPAIR_INFO_KILLED ){
|
||||
message_send_builtin_to_player( MESSAGE_SUPPORT_KILLED, NULL, MESSAGE_PRIORITY_HIGH, MESSAGE_TIME_SOON, 0, 0, p_index, p_team );
|
||||
} else {
|
||||
if ( repair_objp ){
|
||||
message_send_builtin_to_player( MESSAGE_REPAIR_ABORTED, &Ships[repair_objp->instance], MESSAGE_PRIORITY_NORMAL, MESSAGE_TIME_SOON, 0, 0, p_index, p_team );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11040,8 +11100,10 @@ void ai_do_objects_repairing_stuff( object *repaired_objp, object *repair_objp,
|
||||
Assert( repair_objp );
|
||||
|
||||
hud_support_view_stop();
|
||||
|
||||
message_send_builtin_to_player(MESSAGE_REPAIR_DONE, &Ships[repair_objp->instance], MESSAGE_PRIORITY_LOW, MESSAGE_TIME_SOON, 0, 0, p_index, -1);
|
||||
|
||||
if (MULTIPLAYER_MASTER) {
|
||||
message_send_builtin_to_player(MESSAGE_REPAIR_DONE, &Ships[repair_objp->instance], MESSAGE_PRIORITY_LOW, MESSAGE_TIME_SOON, 0, 0, p_index, p_team);
|
||||
}
|
||||
}
|
||||
stamp = timestamp((int) ((30 + 10*frand()) * 1000));
|
||||
break;
|
||||
@@ -13736,7 +13798,7 @@ void ai_bay_depart()
|
||||
}
|
||||
|
||||
// make ship disappear
|
||||
ship_actually_depart(Pl_objp->instance);
|
||||
ship_actually_depart(Pl_objp->instance, SHIP_DEPARTED_BAY);
|
||||
|
||||
// clean up path stuff
|
||||
aip->path_start = -1;
|
||||
|
||||
+12
-4
@@ -962,7 +962,7 @@ void ai_clear_ship_goals( ai_info *aip )
|
||||
aip->active_goal = AI_GOAL_NONE; // for good measure
|
||||
|
||||
// next line moved here on 8/5/97 by MWA
|
||||
// Dont reset player ai (and hence target)
|
||||
// Don't reset player ai (and hence target)
|
||||
// Goober5000 - account for player ai
|
||||
//if ( !((Player_ship != NULL) && (&Ships[aip->shipnum] == Player_ship)) || Player_use_ai ) {
|
||||
if ( (Player_ship == NULL) || (&Ships[aip->shipnum] != Player_ship) || Player_use_ai )
|
||||
@@ -1349,6 +1349,10 @@ void ai_add_goal_sub_player(int type, int mode, int submode, char *shipname, ai_
|
||||
if ( (mode == AI_GOAL_STAY_NEAR_SHIP) || (mode == AI_GOAL_KEEP_SAFE_DISTANCE) )
|
||||
aigp->priority = PLAYER_PRIORITY_SUPPORT_LOW;
|
||||
|
||||
// Goober5000 - same with form-on-wing, since it's a type of staying near
|
||||
else if ( mode == AI_GOAL_FORM_ON_WING )
|
||||
aigp->priority = PLAYER_PRIORITY_SUPPORT_LOW;
|
||||
|
||||
else if ( aigp->type == AIG_TYPE_PLAYER_WING )
|
||||
aigp->priority = PLAYER_PRIORITY_WING; // player wing goals not as high as ship goals
|
||||
else
|
||||
@@ -1838,11 +1842,15 @@ void ai_copy_mission_wing_goal( ai_goal *aigp, ai_info *aip )
|
||||
int j;
|
||||
|
||||
for ( j = 0; j < MAX_AI_GOALS; j++ ) {
|
||||
if ( aip->goals[j].ai_mode == AI_GOAL_NONE )
|
||||
if ( aip->goals[j].ai_mode == AI_GOAL_NONE ) {
|
||||
aip->goals[j] = *aigp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (j >= MAX_AI_GOALS) {
|
||||
mprintf(("Unable to assign wing goal to ship %s; the ship goals are already filled to capacity", Ships[aip->shipnum].ship_name));
|
||||
}
|
||||
Assert ( j < MAX_AI_GOALS );
|
||||
aip->goals[j] = *aigp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+43
-8
@@ -600,7 +600,13 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
|
||||
|
||||
// check if object is a bomb attacking the turret parent
|
||||
// check if bomb is homing on the turret parent ship
|
||||
if (objp->type == OBJ_WEAPON) {
|
||||
bool check_weapon = true;
|
||||
|
||||
if ((The_mission.ai_profile->flags & AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE) && (dist > eeo->weapon_travel_dist)) {
|
||||
check_weapon = false;
|
||||
}
|
||||
|
||||
if ((objp->type == OBJ_WEAPON) && check_weapon) {
|
||||
if ( Weapons[objp->instance].homing_object == &Objects[eeo->turret_parent_objnum] ) {
|
||||
if ( dist < eeo->nearest_homing_bomb_dist ) {
|
||||
if ( (eeo->current_enemy == -1) || object_in_turret_fov(objp, tp, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
|
||||
@@ -836,15 +842,18 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
|
||||
objp = &Objects[ao->objnum];
|
||||
evaluate_obj_as_target(objp, &eeo);
|
||||
}
|
||||
|
||||
if (eeo.nearest_objnum != -1) {
|
||||
return eeo.nearest_objnum;
|
||||
}
|
||||
}
|
||||
return eeo.nearest_objnum; // lowest priority is the closest enemy objnum
|
||||
break;
|
||||
|
||||
default:
|
||||
Int3(); //Means invalid number passed.
|
||||
}
|
||||
}
|
||||
|
||||
//prevent warning of all control paths not returning a value
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -994,7 +1003,7 @@ int aifft_rotate_turret(ship *shipp, int parent_objnum, ship_subsys *ss, object
|
||||
|
||||
if (ss->turret_enemy_objnum != -1) {
|
||||
model_subsystem *tp = ss->system_info;
|
||||
vec3d gun_pos, gun_vec;
|
||||
vec3d gun_pos, gun_vec, target_moving_direction;
|
||||
//float weapon_speed;
|
||||
float weapon_system_strength;
|
||||
//HACK HACK HACK -WMC
|
||||
@@ -1029,8 +1038,14 @@ int aifft_rotate_turret(ship *shipp, int parent_objnum, ship_subsys *ss, object
|
||||
}
|
||||
}
|
||||
|
||||
target_moving_direction = lep->phys_info.vel;
|
||||
|
||||
//Try to guess where the enemy will be, and store that spot in predicted_enemy_pos
|
||||
set_predicted_enemy_pos_turret(predicted_enemy_pos, &gun_pos, objp, &enemy_point, &lep->phys_info.vel, wip->max_speed, ss->turret_time_enemy_in_range * (weapon_system_strength + 1.0f)/2.0f);
|
||||
if (The_mission.ai_profile->flags & AIPF_USE_ADDITIVE_WEAPON_VELOCITY) {
|
||||
vm_vec_sub2(&target_moving_direction, &objp->phys_info.vel);
|
||||
}
|
||||
|
||||
set_predicted_enemy_pos_turret(predicted_enemy_pos, &gun_pos, objp, &enemy_point, &target_moving_direction, wip->max_speed, ss->turret_time_enemy_in_range * (weapon_system_strength + 1.0f)/2.0f);
|
||||
|
||||
//Mess with the turret's accuracy if the weapon system is damaged.
|
||||
if (weapon_system_strength < 0.7f) {
|
||||
@@ -1081,7 +1096,20 @@ float aifft_compute_turret_dot(object *objp, object *enemy_objp, vec3d *abs_gunp
|
||||
vec3d turret_norm;
|
||||
|
||||
vm_vec_rotate(&turret_norm, &turret_subsysp->system_info->turret_norm, &objp->orient);
|
||||
return vm_vec_dot(&turret_norm, &vector_out);
|
||||
float dot_return = vm_vec_dot(&turret_norm, &vector_out);
|
||||
|
||||
if (The_mission.ai_profile->flags & AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS) {
|
||||
if (dot_return > turret_subsysp->system_info->turret_fov) {
|
||||
// target is in sight and in fov
|
||||
return dot_return;
|
||||
} else {
|
||||
// target is in sight but is not in turret's fov
|
||||
return -1.0f;
|
||||
}
|
||||
} else {
|
||||
// target is in sight and we don't care if its in turret's fov or not
|
||||
return dot_return;
|
||||
}
|
||||
} else
|
||||
return -1.0f;
|
||||
|
||||
@@ -1188,11 +1216,18 @@ ship_subsys *aifft_find_turret_subsys(object *objp, ship_subsys *ssp, object *en
|
||||
}
|
||||
int offset = (int)frand_range(0.0f, (float)(aifft_list_size % stride));
|
||||
int idx;
|
||||
float dot_fov_modifier = 0.0f;
|
||||
|
||||
if (The_mission.ai_profile->flags & AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS) {
|
||||
if (ssp->system_info->turret_fov < 0)
|
||||
dot_fov_modifier = ssp->system_info->turret_fov;
|
||||
}
|
||||
|
||||
for(idx=offset; idx<aifft_list_size; idx+=stride){
|
||||
dot = aifft_compute_turret_dot(objp, enemy_objp, &abs_gun_pos, ssp, aifft_list[idx]);
|
||||
|
||||
if (dot* aifft_rank[idx] > best_dot) {
|
||||
best_dot = dot*aifft_rank[idx];
|
||||
if ((dot - dot_fov_modifier)* aifft_rank[idx] > best_dot) {
|
||||
best_dot = (dot - dot_fov_modifier)*aifft_rank[idx];
|
||||
best_subsysp = aifft_list[idx];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.7 2004/02/16 11:47:31 randomtiger
|
||||
* Removed a lot of files that we dont need anymore.
|
||||
* Removed a lot of files that we don't need anymore.
|
||||
* Changed htl to be on by default, command now -nohtl
|
||||
* Changed D3D to use a 2D vertex for 2D operations which should cut down on redundant data having to go though the system.
|
||||
* Added small change to all -start_mission flag to take you to any mission by filename, very useful for testing.
|
||||
@@ -84,7 +84,7 @@
|
||||
* Put dithering back in for tgas and jpgs
|
||||
*
|
||||
* Revision 2.4 2003/11/29 10:52:08 randomtiger
|
||||
* Turned off D3D file mapping, its using too much memory which may be hurting older systems and doesnt seem to be providing much of a speed benifit.
|
||||
* Turned off D3D file mapping, it's using too much memory which may be hurting older systems and doesn't seem to be providing much of a speed benifit.
|
||||
* Added stats command for ingame stats on memory usage.
|
||||
* Trys to play intro.mve and intro.avi, just to be safe since its not set by table.
|
||||
* Added fix for fonts wrapping round in non standard hi res modes.
|
||||
@@ -102,7 +102,7 @@
|
||||
* Revision 2.1.2.3 2002/11/04 21:24:59 randomtiger
|
||||
*
|
||||
* When running in D3D all ani's are memory mapped for speed, this takes up more memory but stops gametime locking of textures which D3D8 hates.
|
||||
* Added new command line tag Cmdline_d3dlowmem for people who dont want to make use of this because they have no memory.
|
||||
* Added new command line tag Cmdline_d3dlowmem for people who don't want to make use of this because they have no memory.
|
||||
* Cleaned up some more texture stuff enabled console debug for D3D.
|
||||
*
|
||||
* Revision 2.1.2.2 2002/09/28 22:13:42 randomtiger
|
||||
|
||||
@@ -2164,7 +2164,7 @@ void asteroid_parse_tbl()
|
||||
return;
|
||||
}
|
||||
|
||||
read_file_text("asteroid.tbl");
|
||||
read_file_text("asteroid.tbl", CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
required_string("#Asteroid Types");
|
||||
@@ -2454,7 +2454,7 @@ void asteroid_page_in()
|
||||
|
||||
// Page in textures
|
||||
for (j=0; j<asip->modelp[k]->n_textures; j++ ) {
|
||||
asip->modelp[k]->maps[j].base_map.PageIn();
|
||||
asip->modelp[k]->maps[j].PageIn();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1004,8 +1004,7 @@ void EndAutoPilot()
|
||||
{
|
||||
Cutscene_bar_flags &= ~CUB_CUTSCENE;
|
||||
}
|
||||
Viewer_mode &= ~VM_FREECAMERA;
|
||||
hud_set_draw(1);
|
||||
cam_reset_camera();
|
||||
CinematicStarted = false;
|
||||
}
|
||||
|
||||
@@ -1102,13 +1101,17 @@ void EndAutoPilot()
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
void camera_face(vec3d &loc)
|
||||
camera* nav_get_set_camera()
|
||||
{
|
||||
vec3d destvec;
|
||||
matrix cam_orient;
|
||||
vm_vec_sub(&destvec, &loc, Free_camera->get_position());
|
||||
vm_vector_2_matrix(&cam_orient, &destvec, &Player_obj->orient.vec.uvec, &Player_obj->orient.vec.rvec);
|
||||
Free_camera->set_rotation(&cam_orient, 0.0f, 0.0f);
|
||||
static camid nav_camera;
|
||||
if(!nav_camera.isValid())
|
||||
{
|
||||
nav_camera = cam_create("Nav camera");
|
||||
}
|
||||
|
||||
cam_set_camera(nav_camera);
|
||||
|
||||
return nav_camera.getCamera();
|
||||
}
|
||||
|
||||
void nav_warp(bool prewarp=false)
|
||||
@@ -1163,11 +1166,13 @@ void NavSystem_Do()
|
||||
{
|
||||
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
|
||||
{
|
||||
camera *cam = nav_get_set_camera();
|
||||
if (CinematicStarted)
|
||||
{
|
||||
// update our cinematic and possibly perform warp
|
||||
//if (!CameraMoving)
|
||||
camera_face(Player_obj->pos);
|
||||
if(cam != NULL)
|
||||
cam->set_rotation_facing(&Player_obj->pos);
|
||||
|
||||
if (timestamp() >= MoveCamera && !CameraMoving && vm_vec_mag(&cameraTarget) > 0.0f)
|
||||
{
|
||||
@@ -1191,12 +1196,14 @@ void NavSystem_Do()
|
||||
Cutscene_bar_flags |= CUB_CUTSCENE;
|
||||
Cutscene_bar_flags &= ~CUB_GRADUAL;
|
||||
}
|
||||
Viewer_mode |= VM_FREECAMERA;
|
||||
hud_set_draw(0);
|
||||
nav_warp(true);
|
||||
|
||||
Free_camera->set_position(&cameraPos);
|
||||
camera_face(Player_obj->pos);
|
||||
if(cam != NULL)
|
||||
{
|
||||
cam->set_position(&cameraPos);
|
||||
cam->set_rotation_facing(&Player_obj->pos);
|
||||
}
|
||||
|
||||
CinematicStarted = true;
|
||||
}
|
||||
}
|
||||
@@ -1370,7 +1377,7 @@ void parse_autopilot_table(char *filename)
|
||||
if (filename == NULL)
|
||||
read_file_text_from_array(defaults_get_file("autopilot.tbl"));
|
||||
else
|
||||
read_file_text(filename);
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
|
||||
reset_parse();
|
||||
|
||||
|
||||
+27
-9
@@ -957,7 +957,8 @@ extern int Cmdline_cache_bitmaps;
|
||||
int GLOWMAP = -1;
|
||||
int SPECMAP = -1;
|
||||
int ENVMAP = -1;
|
||||
int BUMPMAP = -1;
|
||||
int NORMMAP = -1;
|
||||
int HEIGHTMAP = -1;
|
||||
|
||||
bitmap_entry bm_bitmaps[MAX_BITMAPS];
|
||||
|
||||
@@ -1382,10 +1383,6 @@ int bm_load( char *real_filename )
|
||||
if ( !bm_inited )
|
||||
bm_init();
|
||||
|
||||
// nice little trick for keeping standalone memory usage way low - always return a bogus bitmap
|
||||
if (Game_mode & GM_STANDALONE_SERVER)
|
||||
strcpy(filename,"test128");
|
||||
|
||||
// if no file was passed then get out now
|
||||
if ( (real_filename == NULL) || (strlen(real_filename) <= 0) )
|
||||
return -1;
|
||||
@@ -1400,6 +1397,13 @@ int bm_load( char *real_filename )
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
// If we are standalone server keep replacing the 'right_bracket' (right side help bracket) as the filename
|
||||
// should keep the game happy while loading only single pcx file which the needs to be present in any case
|
||||
if (Is_standalone) {
|
||||
char standalone_filename[MAX_FILENAME_LEN] = "right_bracket";
|
||||
strcpy(filename,standalone_filename);
|
||||
}
|
||||
|
||||
// safety catch for strcat...
|
||||
// MAX_FILENAME_LEN-5 == '.' plus 3 letter ext plus NULL terminator
|
||||
if (strlen(filename) > MAX_FILENAME_LEN-5) {
|
||||
@@ -1684,6 +1688,13 @@ int bm_load_animation( char *real_filename, int *nframes, int *fps, int can_drop
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
// If we are standalone server keep replacing the 'cursorweb' (mouse cursor) as the filename
|
||||
// should keep the game happy while loading only single ani file which the needs to be present in any case
|
||||
if (Is_standalone) {
|
||||
char standalone_filename[MAX_FILENAME_LEN] = "cursorweb";
|
||||
strcpy(filename,standalone_filename);
|
||||
}
|
||||
|
||||
// safety catch for strcat...
|
||||
// MAX_FILENAME_LEN-5 == '.' plus 3 letter ext plus NULL terminator
|
||||
if (strlen(filename) > MAX_FILENAME_LEN-5) {
|
||||
@@ -3033,9 +3044,6 @@ void bm_page_in_stop()
|
||||
if ( !gr_preload(bm_bitmaps[i].handle, (bm_bitmaps[i].preloaded==2)) ) {
|
||||
mprintf(( "Out of VRAM. Done preloading.\n" ));
|
||||
bm_preloading = 0;
|
||||
} else {
|
||||
// it's loaded into API memory now so dump the system version of the data
|
||||
bm_free_data_fast(i);
|
||||
}
|
||||
} else {
|
||||
bm_lock( bm_bitmaps[i].handle, (bm_bitmaps[i].used_flags == BMP_AABITMAP) ? 8 : 16, bm_bitmaps[i].used_flags );
|
||||
@@ -3302,6 +3310,7 @@ int bm_is_compressed(int num)
|
||||
|
||||
switch (type) {
|
||||
case BM_TYPE_NONE:
|
||||
case BM_TYPE_DDS:
|
||||
return 0;
|
||||
|
||||
case BM_TYPE_DXT1:
|
||||
@@ -3568,7 +3577,11 @@ int bm_is_render_target(int bitmap_id)
|
||||
|
||||
Assert(bitmap_id == bm_bitmaps[n].handle);
|
||||
|
||||
return ( (bm_bitmaps[n].type == BM_TYPE_RENDER_TARGET_STATIC) || (bm_bitmaps[n].type == BM_TYPE_RENDER_TARGET_DYNAMIC) );
|
||||
if ( !((bm_bitmaps[n].type == BM_TYPE_RENDER_TARGET_STATIC) || (bm_bitmaps[n].type == BM_TYPE_RENDER_TARGET_DYNAMIC)) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return bm_bitmaps[n].type;
|
||||
}
|
||||
|
||||
int bm_set_render_target(int handle, int face)
|
||||
@@ -3605,6 +3618,11 @@ int bm_set_render_target(int handle, int face)
|
||||
|
||||
gr_reset_clip();
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
extern void opengl_setup_viewport();
|
||||
opengl_setup_viewport();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@
|
||||
* Revision 2.0.2.10 2002/11/04 21:24:59 randomtiger
|
||||
*
|
||||
* When running in D3D all ani's are memory mapped for speed, this takes up more memory but stops gametime locking of textures which D3D8 hates.
|
||||
* Added new command line tag Cmdline_d3dlowmem for people who dont want to make use of this because they have no memory.
|
||||
* Added new command line tag Cmdline_d3dlowmem for people who don't want to make use of this because they have no memory.
|
||||
* Cleaned up some more texture stuff enabled console debug for D3D.
|
||||
*
|
||||
* Revision 2.0.2.9 2002/11/04 16:04:20 randomtiger
|
||||
@@ -694,7 +694,8 @@ void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
extern int GLOWMAP; //this holds a reference to a map that is a fully lit version of its index -Bobboau
|
||||
extern int SPECMAP; //this holds a reference to a map that is for specular mapping -Bobboau
|
||||
extern int ENVMAP; //this holds a reference to a map that is for environment mapping -Bobboau
|
||||
extern int BUMPMAP; //blah blah bumpmapping
|
||||
extern int NORMMAP; // normal mapping
|
||||
extern int HEIGHTMAP; // height map for normal mapping
|
||||
|
||||
int bm_is_compressed(int num);
|
||||
int bm_get_tcache_type(int num);
|
||||
|
||||
+714
-237
File diff suppressed because it is too large.
Load diff
+107
-30
@@ -5,50 +5,121 @@
|
||||
#include "graphics/2d.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/globals.h"
|
||||
#include "physics/physics.h" //for avd
|
||||
#include "object/object.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#define CAM_STATIONARY_FOV (1<<0)
|
||||
#define CAM_STATIONARY_ORI (1<<1)
|
||||
#define CAM_STATIONARY_POS (1<<2)
|
||||
#define CAM_DEFAULT_FLAGS 0
|
||||
|
||||
class camera
|
||||
{
|
||||
private:
|
||||
friend class avd_camera;
|
||||
protected:
|
||||
char name[NAME_LENGTH];
|
||||
int sig;
|
||||
int flags;
|
||||
|
||||
vec3d position;
|
||||
vec3d *desired_position; //NULL unless we're trying to move somewhere
|
||||
vec3d translation_velocity;
|
||||
vec3d translation_vel_limit;
|
||||
vec3d translation_acc_limit;
|
||||
object_h object_host;
|
||||
int object_host_submodel;
|
||||
|
||||
matrix orientation;
|
||||
matrix *desired_orientation; //NULL unless we're trying to point somewhere
|
||||
vec3d rotation_rate;
|
||||
vec3d rotation_vel_limit;
|
||||
vec3d rotation_acc_limit;
|
||||
object_h object_target;
|
||||
int object_target_submodel;
|
||||
|
||||
void (*func_custom_position)(camera *cam, vec3d *pos);
|
||||
void (*func_custom_orientation)(camera *cam, matrix *ori);
|
||||
|
||||
avd_movement fov;
|
||||
|
||||
avd_movement pos_x;
|
||||
avd_movement pos_y;
|
||||
avd_movement pos_z;
|
||||
|
||||
//avd_movement ori_p;
|
||||
//avd_movement ori_b;
|
||||
//avd_movement ori_h;
|
||||
//avd_movement ori_progress;
|
||||
//matrix ori_initial;
|
||||
//matrix ori_final;
|
||||
avd_movement ori[9];
|
||||
|
||||
//Cache stuff
|
||||
float c_fov;
|
||||
vec3d c_pos;
|
||||
matrix c_ori;
|
||||
public:
|
||||
camera(char *in_name=NULL);
|
||||
camera(char *in_name=NULL, int in_signature=-1);
|
||||
~camera();
|
||||
void clear();
|
||||
void reset();
|
||||
|
||||
//Set'
|
||||
//Set
|
||||
void set_name(char *in_name);
|
||||
void set_position(vec3d *in_position = NULL, float in_translation_time = 0.0f, float in_translation_acceleration_time = 0.0f);
|
||||
void set_translation_velocity(vec3d *in_velocity);
|
||||
void set_rotation(matrix *in_orientation = NULL, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f);
|
||||
void set_rotation(angles *in_angles, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f);
|
||||
void set_rotation_facing(vec3d *in_target, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f);
|
||||
void set_rotation_velocity(vec3d *in_rotation_rate);
|
||||
|
||||
void set_object_host(object *objp, int n_object_host_submodel = -1);
|
||||
void set_object_target(object *objp, int n_object_target_submodel = -1);
|
||||
|
||||
void set_custom_position_function(void (*n_func_custom_position)(camera *cam, vec3d *pos));
|
||||
void set_custom_orientation_function(void (*n_func_custom_orientation)(camera *cam, matrix *ori));
|
||||
|
||||
void set_fov(float in_fov, float in_fov_time = 0.0f, float in_fov_acceleration_time = 0.0f, float in_deceleration_time = 0.0f);
|
||||
|
||||
void set_position(vec3d *in_position = NULL, float in_translation_time = 0.0f, float in_translation_acceleration_time = 0.0f, float in_translation_deceleration_time = 0.0f, float in_end_velocity = 0.0f);
|
||||
void set_translation_velocity(vec3d *in_velocity, float in_acceleration_time = 0.0f);
|
||||
|
||||
void set_rotation(matrix *in_orientation = NULL, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f, float in_rotation_deceleration_time = 0.0f);
|
||||
void set_rotation(angles *in_angles, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f, float in_rotation_deceleration_time = 0.0f);
|
||||
void set_rotation_facing(vec3d *in_target, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f, float in_rotation_deceleration_time = 0.0f);
|
||||
void set_rotation_velocity(angles *in_rotation_rate, float in_acceleration_time = 0.0f);
|
||||
|
||||
//Get
|
||||
//These return values should never ever be changed, I do this in the interest of speed.
|
||||
char *get_name() {return name;}
|
||||
vec3d *get_position() {return &position;}
|
||||
matrix *get_orientation() {return &orientation;}
|
||||
int get_signature() {return sig;}
|
||||
object *get_object_host();
|
||||
int get_object_host_submodel();
|
||||
object *get_object_target();
|
||||
int get_object_target_submodel();
|
||||
float get_fov();
|
||||
void get_info(vec3d *position, matrix *orientation);
|
||||
|
||||
//Is
|
||||
bool is_empty(){return sig < 0;}
|
||||
|
||||
//Do
|
||||
void do_frame(float in_frametime);
|
||||
};
|
||||
|
||||
class warp_camera
|
||||
{
|
||||
private:
|
||||
float c_time;
|
||||
float c_damping;
|
||||
|
||||
vec3d c_vel;
|
||||
vec3d c_desired_vel;
|
||||
|
||||
vec3d c_pos;
|
||||
matrix c_ori;
|
||||
public:
|
||||
warp_camera();
|
||||
warp_camera(object *objp);
|
||||
void reset();
|
||||
|
||||
void set_position(vec3d *in_pos);
|
||||
void set_rotation(matrix *in_ori);
|
||||
void set_velocity(vec3d *in_vel, bool instantaneous);
|
||||
|
||||
void do_frame(float in_frametime);
|
||||
|
||||
void get_info(vec3d *position, matrix *orientation);
|
||||
};
|
||||
|
||||
extern warp_camera Warp_camera;
|
||||
|
||||
class subtitle
|
||||
{
|
||||
private:
|
||||
@@ -84,16 +155,22 @@ public:
|
||||
|
||||
//Some global stuff
|
||||
extern std::vector<subtitle> Subtitles;
|
||||
extern std::vector<camera> Cameras;
|
||||
//Preset cameras
|
||||
extern camera* Free_camera;
|
||||
extern camera* Current_camera;
|
||||
extern float VIEWER_ZOOM_DEFAULT;
|
||||
extern float Sexp_fov;
|
||||
|
||||
//Helpful functions
|
||||
void cameras_init();
|
||||
void cameras_close();
|
||||
void cameras_do_frame(float frametime);
|
||||
int cameras_lookup(char *name);
|
||||
void cam_init();
|
||||
void cam_close();
|
||||
void cam_do_frame(float frametime);
|
||||
camid cam_create(char *n_name=NULL, vec3d *n_pos=NULL, matrix *n_ori=NULL, object *n_object=NULL, int n_submodel_parent=-1);
|
||||
camid cam_create(char *n_name, vec3d *n_pos, vec3d *n_norm, object *n_object=NULL, int n_submodel_parent=-1);
|
||||
void cam_delete(camid cid);
|
||||
bool cam_set_camera(camid cid);
|
||||
void cam_reset_camera();
|
||||
camid cam_lookup(char *name);
|
||||
camid cam_get_camera(uint index);
|
||||
camid cam_get_current();
|
||||
uint cam_get_num();
|
||||
|
||||
void subtitles_init();
|
||||
void subtitles_close();
|
||||
|
||||
+19
-19
@@ -168,10 +168,10 @@
|
||||
* -DTP reworked mod support,
|
||||
*
|
||||
* Revision 2.6 2002/11/04 08:32:38 DTP
|
||||
* Made sure, that VP and Plain files dont get added twice to the search order. Side-effect of Mod support.
|
||||
* Made sure that VP and Plain files don't get added twice to the search order. Side-effect of Mod support.
|
||||
*
|
||||
* Revision 2.5 2002/10/30 06:31:05 DTP
|
||||
* doh!, used upper case in include, dont know how much it matters for *nix systems, but here it is
|
||||
* doh!, used upper case in include, don't know how much it matters for *nix systems, but here it is
|
||||
*
|
||||
* Revision 2.4 2002/10/27 23:59:28 DTP
|
||||
* DTP; started basic implementation of mod-support
|
||||
@@ -417,16 +417,16 @@ cf_pathtype Pathtypes[CF_MAX_PATH_TYPES] = {
|
||||
{ CF_TYPE_VOICE_TRAINING, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "training", ".wav .ogg", CF_TYPE_VOICE },
|
||||
{ CF_TYPE_MUSIC, "data" DIR_SEPARATOR_STR "music", ".wav .ogg", CF_TYPE_DATA },
|
||||
{ CF_TYPE_MOVIES, "data" DIR_SEPARATOR_STR "movies", ".mve .msb .ogg", CF_TYPE_DATA },
|
||||
{ CF_TYPE_INTERFACE, "data" DIR_SEPARATOR_STR "interface", ".pcx .ani .dds .tga .eff", CF_TYPE_DATA },
|
||||
{ CF_TYPE_INTERFACE, "data" DIR_SEPARATOR_STR "interface", ".pcx .ani .dds .tga .eff .jpg", CF_TYPE_DATA },
|
||||
{ CF_TYPE_FONT, "data" DIR_SEPARATOR_STR "fonts", ".vf .ttf", CF_TYPE_DATA },
|
||||
{ CF_TYPE_EFFECTS, "data" DIR_SEPARATOR_STR "effects", ".ani .eff .pcx .neb .tga .jpg .dds", CF_TYPE_DATA },
|
||||
{ CF_TYPE_EFFECTS, "data" DIR_SEPARATOR_STR "effects", ".ani .eff .pcx .neb .tga .jpg .dds .sdr", CF_TYPE_DATA },
|
||||
{ CF_TYPE_HUD, "data" DIR_SEPARATOR_STR "hud", ".ani .pcx .tga .dds", CF_TYPE_DATA },
|
||||
{ CF_TYPE_PLAYERS, "data" DIR_SEPARATOR_STR "players", ".hcf", CF_TYPE_DATA },
|
||||
{ CF_TYPE_PLAYER_IMAGES, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "images", ".pcx .dds", CF_TYPE_PLAYERS },
|
||||
{ CF_TYPE_SQUAD_IMAGES, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "squads", ".pcx .dds", CF_TYPE_PLAYERS },
|
||||
{ CF_TYPE_SINGLE_PLAYERS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "single", ".pl2 .cs2 .plr .csg .css", CF_TYPE_PLAYERS },
|
||||
{ CF_TYPE_MULTI_PLAYERS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "multi", ".plr", CF_TYPE_PLAYERS },
|
||||
{ CF_TYPE_CACHE, "data" DIR_SEPARATOR_STR "cache", ".clr .tmp .ibx", CF_TYPE_DATA }, //clr=cached color
|
||||
{ CF_TYPE_CACHE, "data" DIR_SEPARATOR_STR "cache", ".clr .tmp .ibx .tsb", CF_TYPE_DATA }, //clr=cached color
|
||||
{ CF_TYPE_MULTI_CACHE, "data" DIR_SEPARATOR_STR "multidata", ".pcx .dds .fs2 .txt", CF_TYPE_DATA },
|
||||
{ CF_TYPE_MISSIONS, "data" DIR_SEPARATOR_STR "missions", ".fs2 .fc2 .ntl .ssv", CF_TYPE_DATA },
|
||||
{ CF_TYPE_CONFIG, "data" DIR_SEPARATOR_STR "config", ".cfg", CF_TYPE_DATA },
|
||||
@@ -627,15 +627,13 @@ int cfile_push_chdir(int type)
|
||||
cf_create_default_path_string( dir, sizeof(dir)-1, type, NULL );
|
||||
|
||||
#ifdef _WIN32
|
||||
_strlwr(dir);
|
||||
char *colon_pos = strchr(dir, ':');
|
||||
|
||||
char *Drive = strchr(dir, ':');
|
||||
|
||||
if (Drive) {
|
||||
if (!cfile_chdrive( *(Drive - 1) - 'a' + 1, 1))
|
||||
if (colon_pos) {
|
||||
if (!cfile_chdrive( tolower(*(colon_pos - 1)) - 'a' + 1, 1))
|
||||
return 1;
|
||||
|
||||
Path = Drive+1;
|
||||
Path = colon_pos+1;
|
||||
} else
|
||||
#endif // _WIN32
|
||||
{
|
||||
@@ -649,7 +647,9 @@ int cfile_push_chdir(int type)
|
||||
// This chdir might get a critical error!
|
||||
e = _chdir( Path );
|
||||
if (e) {
|
||||
cfile_chdrive( OriginalDirectory[0] - 'a' + 1, 1 );
|
||||
#ifdef _WIN32
|
||||
cfile_chdrive( tolower(OriginalDirectory[0]) - 'a' + 1, 1 );
|
||||
#endif // _WIN32
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -667,14 +667,12 @@ int cfile_chdir(char *dir)
|
||||
_getcwd(OriginalDirectory, CFILE_ROOT_DIRECTORY_LEN-1);
|
||||
|
||||
#ifdef _WIN32
|
||||
_strlwr(dir);
|
||||
|
||||
char *Drive = strchr(dir, ':');
|
||||
if (Drive) {
|
||||
if (!cfile_chdrive( *(Drive - 1) - 'a' + 1, 1))
|
||||
char *colon_pos = strchr(dir, ':');
|
||||
if (colon_pos) {
|
||||
if (!cfile_chdrive( tolower(*(colon_pos - 1)) - 'a' + 1, 1))
|
||||
return 1;
|
||||
|
||||
Path = Drive+1;
|
||||
Path = colon_pos+1;
|
||||
} else
|
||||
#endif // _WIN32
|
||||
{
|
||||
@@ -688,7 +686,9 @@ int cfile_chdir(char *dir)
|
||||
// This chdir might get a critical error!
|
||||
e = _chdir( Path );
|
||||
if (e) {
|
||||
cfile_chdrive( OriginalDirectory[0] - 'a' + 1, 1 );
|
||||
#ifdef _WIN32
|
||||
cfile_chdrive( tolower(OriginalDirectory[0]) - 'a' + 1, 1 );
|
||||
#endif // _WIN32
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
* -DTP reworked mod support,
|
||||
*
|
||||
* Revision 2.5 2002/10/30 06:29:45 DTP
|
||||
* doh!, used upper case in include, dont know how much it matters for *nix systems, but here it is
|
||||
* doh!, used upper case in include, don't know how much it matters for *nix systems, but here it is
|
||||
*
|
||||
* Revision 2.4 2002/10/30 06:26:11 DTP
|
||||
* DTP Implemented basic VP files handling. mission and campaign files inside VP files found in mod dir still not supported, cheking / creating directories not implented either
|
||||
@@ -1662,6 +1662,9 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
|
||||
if (num_files >= max)
|
||||
break;
|
||||
|
||||
if (strcmp(strstr(filter, "."), strstr(find.name,".")) != 0)
|
||||
continue;
|
||||
|
||||
if ( strlen(find.name) >= MAX_FILENAME_LEN )
|
||||
continue;
|
||||
|
||||
@@ -1866,6 +1869,9 @@ int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char *
|
||||
break;
|
||||
|
||||
if (!(find.attrib & _A_SUBDIR)) {
|
||||
|
||||
if (strcmp(strstr(filter, "."), strstr(find.name,".")) != 0)
|
||||
continue;
|
||||
|
||||
if ( strlen(find.name) >= MAX_FILENAME_LEN )
|
||||
continue;
|
||||
@@ -2048,7 +2054,7 @@ int cf_create_default_path_string( char *path, uint path_max, int pathtype, char
|
||||
|
||||
#ifdef INF_BUILD
|
||||
// keep pilot files separated for an Inferno build since they aren't compatible
|
||||
if ( pathtype == CF_TYPE_SINGLE_PLAYERS ) {
|
||||
if ( pathtype == CF_TYPE_SINGLE_PLAYERS || pathtype == CF_TYPE_MULTI_PLAYERS ) {
|
||||
SAFE_STRCAT(path, "inferno", path_max);
|
||||
SAFE_STRCAT(path, DIR_SEPARATOR_STR, path_max);
|
||||
}
|
||||
|
||||
@@ -127,7 +127,13 @@ int write_index(char *hf, char *df)
|
||||
d = fopen(df, "a+b");
|
||||
|
||||
if ( (h == NULL) || (d == NULL) )
|
||||
{
|
||||
if ( h )
|
||||
fclose( h );
|
||||
if ( d )
|
||||
fclose( d );
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < Num_files; i++) {
|
||||
fread(tmp_data, 32+4+4+4, 1, h);
|
||||
|
||||
+71
-42
@@ -431,7 +431,7 @@
|
||||
* Fixed setup of center_alpha in OGL which was causing crash.
|
||||
*
|
||||
* Revision 2.54 2004/02/16 11:47:31 randomtiger
|
||||
* Removed a lot of files that we dont need anymore.
|
||||
* Removed a lot of files that we don't need anymore.
|
||||
* Changed htl to be on by default, command now -nohtl
|
||||
* Changed D3D to use a 2D vertex for 2D operations which should cut down on redundant data having to go though the system.
|
||||
* Added small change to all -start_mission flag to take you to any mission by filename, very useful for testing.
|
||||
@@ -471,7 +471,7 @@
|
||||
* Changed target view not to use lower res texture, hi res one is already chached so might as well use it
|
||||
*
|
||||
* Revision 2.47 2003/11/29 10:52:09 randomtiger
|
||||
* Turned off D3D file mapping, its using too much memory which may be hurting older systems and doesnt seem to be providing much of a speed benifit.
|
||||
* Turned off D3D file mapping, it's using too much memory which may be hurting older systems and doesn't seem to be providing much of a speed benifit.
|
||||
* Added stats command for ingame stats on memory usage.
|
||||
* Trys to play intro.mve and intro.avi, just to be safe since its not set by table.
|
||||
* Added fix for fonts wrapping round in non standard hi res modes.
|
||||
@@ -511,12 +511,12 @@
|
||||
*
|
||||
* Revision 2.40 2003/11/08 22:25:47 Kazan
|
||||
* Timerbar was enabled in both release and debug - so i made it a command line option "-timerbar"
|
||||
* DONT MESS WITH OTHER PEOPLES INCLUDE PATHS
|
||||
* DONT MESS WITH EXEC NAMES (leave it fs2_open_r and fs2_open_d) or paths!
|
||||
* DON'T MESS WITH OTHER PEOPLES INCLUDE PATHS
|
||||
* DON'T MESS WITH EXEC NAMES (leave it fs2_open_r and fs2_open_d) or paths!
|
||||
*
|
||||
* Revision 2.39 2003/11/03 18:07:26 randomtiger
|
||||
* Added -d3d_no_vsync command to make turning off vsync optional.
|
||||
* Removed 32bit command, it doesnt do anything.
|
||||
* Removed 32bit command, it doesn't do anything.
|
||||
* Made aa multisample reg check safe.
|
||||
*
|
||||
* Revision 2.38 2003/10/27 23:04:20 randomtiger
|
||||
@@ -543,7 +543,7 @@
|
||||
*
|
||||
* Revision 2.34 2003/10/14 17:39:12 randomtiger
|
||||
* Implemented hardware fog for the HT&L code path.
|
||||
* It doesnt use the backgrounds anymore but its still an improvement.
|
||||
* It doesn't use the backgrounds anymore but it's still an improvement.
|
||||
* Currently it fogs to a brighter colour than it should because of Bob specular code.
|
||||
* I will fix this after discussing it with Bob.
|
||||
*
|
||||
@@ -624,7 +624,7 @@
|
||||
* Added "-dshowvid" command-line option, which must be set in order for movies to play.
|
||||
*
|
||||
* Revision 2.16 2002/12/21 13:39:25 DTP
|
||||
* did bit more house keeping. modfied Phreaks fps cmdline a bit, so that we dont have to specific build code.libs for fred, but can use the same code.lib for both fs2_open.exe and fred2_open.exe
|
||||
* did bit more house keeping. modfied Phreak's fps cmdline a bit, so that we don't have to specific build code.libs for fred, but can use the same code.lib for both fs2_open.exe and fred2_open.exe
|
||||
*
|
||||
* Revision 2.15 2002/12/17 03:08:18 DTP
|
||||
* fix to Show_framerate. seems it will call an unresolved external error during fred builds. modified my ifndefs a bit, dsw modified to include preprocessor tag FRED.
|
||||
@@ -675,7 +675,7 @@
|
||||
* Revision 2.4.2.2 2002/11/04 21:24:59 randomtiger
|
||||
*
|
||||
* When running in D3D all ani's are memory mapped for speed, this takes up more memory but stops gametime locking of textures which D3D8 hates.
|
||||
* Added new command line tag Cmdline_d3dlowmem for people who dont want to make use of this because they have no memory.
|
||||
* Added new command line tag Cmdline_d3dlowmem for people who don't want to make use of this because they have no memory.
|
||||
* Cleaned up some more texture stuff enabled console debug for D3D.
|
||||
*
|
||||
* Revision 2.4.2.1 2002/08/27 13:19:02 penguin
|
||||
@@ -881,6 +881,7 @@
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
#include "camera/camera.h" //VIEWER_ZOOM_DEFAULT
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
@@ -928,9 +929,6 @@ public:
|
||||
static cmdline_parm Parm_list(NULL, NULL);
|
||||
static int Parm_list_inited = 0;
|
||||
|
||||
|
||||
extern float VIEWER_ZOOM_DEFAULT;
|
||||
extern float Viewer_zoom;
|
||||
extern int Show_framerate; // from freespace.cpp
|
||||
|
||||
|
||||
@@ -990,9 +988,10 @@ Flag exe_params[] =
|
||||
{ "-env", "Enable environment maps", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-env", },
|
||||
{ "-mipmap", "Enable mipmapping", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-mipmap", },
|
||||
{ "-nomotiondebris", "Disable motion debris", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomotiondebris",},
|
||||
{ "-2d_poof", "Stops fog intersect hull", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-2d_poof", },
|
||||
{ "-noscalevid", "Disable scale-to-window for movies", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noscalevid", },
|
||||
{ "-missile_lighting", "Apply Lighting to Missiles" , true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-missile_lighting", },
|
||||
{ "-normal", "Enable normal maps", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-normal" },
|
||||
{ "-3dshockwave", "Enable 3D shockwaves", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-3dshockwave" },
|
||||
|
||||
{ "-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", },
|
||||
@@ -1005,6 +1004,7 @@ Flag exe_params[] =
|
||||
{ "-ballistic_gauge", "Enable the analog ballistic ammo gauge", true, 0, EASY_DEFAULT, "HUD", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ballistic_gauge", },
|
||||
|
||||
{ "-ship_choice_3d", "Use models for ship selection", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ship_choice_3d", },
|
||||
{ "-weapon_choice_3d", "Use models for weapon selection", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-weapon_choice_3d", },
|
||||
{ "-3dwarp", "Enable 3d warp", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-3dwarp", },
|
||||
{ "-warp_flash", "Enable flash upon warp", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-warp_flash", },
|
||||
{ "-no_ap_interrupt", "Disable interrupting autopilot", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_ap_interrupt", },
|
||||
@@ -1035,8 +1035,9 @@ Flag exe_params[] =
|
||||
{ "-noibx", "Don't use cached index buffers (IBX)", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noibx", },
|
||||
{ "-loadallweps", "Load all weapons, even those not used", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-loadallweps", },
|
||||
{ "-disable_fbo", "Disable OpenGL RenderTargets", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
{ "-no_glsl", "Disable GLSL (shader) support", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
{ "-ati_swap", "Fix Color issues on some ATI cards", true, 0, EASY_DEFAULT, "Troubleshoot", "http://scp.indiegames.us/mantis/view.php?id=1669", },
|
||||
|
||||
{ "-alpha_env", "Use specular alpha for env mapping", true, 0, EASY_DEFAULT_MEM, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-alpha_env", },
|
||||
{ "-ingame_join", "Allows ingame joining", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ingame_join", },
|
||||
{ "-voicer", "Voice recognition", true, 0, EASY_DEFAULT, "Experimental", "", },
|
||||
|
||||
@@ -1057,6 +1058,7 @@ Flag exe_params[] =
|
||||
{ "-output_scripting", "Outputs scripting to scripting.html", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-output_scripting", },
|
||||
{ "-save_render_target", "Save render targets to file", true, 0, EASY_DEFAULT, "Dev Tool", "", },
|
||||
{ "-debug_window", "Display debug window", true, 0, EASY_DEFAULT, "Dev Tool", "", },
|
||||
{ "-verify_vps", "Spew VP crcs to vp_crcs.txt", true, 0, EASY_DEFAULT, "Dev Tool", "", },
|
||||
#ifdef SCP_UNIX
|
||||
{ "-nograb", "Don't grab mouse/keyboard in a window", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nograb", },
|
||||
#endif
|
||||
@@ -1118,36 +1120,38 @@ cmdline_parm ogl_spec_arg("-ogl_spec", NULL); // Cmdline_ogl_spec
|
||||
cmdline_parm spec_static_arg("-spec_static", NULL);
|
||||
cmdline_parm spec_point_arg("-spec_point", NULL);
|
||||
cmdline_parm spec_tube_arg("-spec_tube", NULL);
|
||||
cmdline_parm poof_2d_arg("-2d_poof", NULL); // Cmdline_2d_poof
|
||||
cmdline_parm alpha_env("-alpha_env", NULL); // Cmdline_alpha_env
|
||||
cmdline_parm ambient_factor_arg("-ambient_factor", NULL); // Cmdline_ambient_factor
|
||||
cmdline_parm cell_arg("-cell", NULL); // Cmdline_cell
|
||||
cmdline_parm decals("-decals", NULL); // Cmdline_decals
|
||||
cmdline_parm env("-env", NULL); // Cmdline_env
|
||||
cmdline_parm mipmap_arg("-mipmap", NULL); // Cmdline_mipmap
|
||||
cmdline_parm missile_lighting_arg("-missile_lighting", NULL); // Cmdline_missile_lighting
|
||||
cmdline_parm glow_arg("-glow", NULL); // Cmdline_noglow -- use Bobs glow code
|
||||
cmdline_parm glow_arg("-glow", NULL); // Cmdline_glow -- use Bobs glow code
|
||||
cmdline_parm nomotiondebris_arg("-nomotiondebris", NULL); // Cmdline_nomotiondebris -- Removes those ugly floating rocks -C
|
||||
cmdline_parm noscalevid_arg("-noscalevid", NULL); // Cmdline_noscalevid -- disable video scaling that fits to window
|
||||
cmdline_parm spec_arg("-spec", NULL); // Cmdline_nospec -- use specular highlighting -Sticks
|
||||
cmdline_parm spec_arg("-spec", NULL); // Cmdline_spec -- use specular highlighting -Sticks
|
||||
cmdline_parm noemissive_arg("-no_emissive_light", NULL); // Cmdline_no_emissive -- don't use emissive light in OGL
|
||||
cmdline_parm normal_arg("-normal", NULL); // Cmdline_normal -- enable normal mapping
|
||||
cmdline_parm height_arg("-height", NULL); // Cmdline_height -- enable support for parallax mapping
|
||||
cmdline_parm enable_3d_shockwave_arg("-3dshockwave", NULL);
|
||||
|
||||
float Cmdline_clip_dist = Default_min_draw_distance;
|
||||
float Cmdline_fov = 0.75f;
|
||||
float Cmdline_ogl_spec = 80.0f;
|
||||
int Cmdline_2d_poof = 0;
|
||||
int Cmdline_alpha_env = 0;
|
||||
int Cmdline_ambient_factor = 128;
|
||||
int Cmdline_cell = 0;
|
||||
int Cmdline_decals = 0;
|
||||
int Cmdline_env = 0;
|
||||
int Cmdline_mipmap = 0;
|
||||
int Cmdline_missile_lighting = 0;
|
||||
int Cmdline_noglow = 1;
|
||||
int Cmdline_glow = 0;
|
||||
int Cmdline_nomotiondebris = 0;
|
||||
int Cmdline_noscalevid = 0;
|
||||
int Cmdline_nospec = 1;
|
||||
int Cmdline_spec = 0;
|
||||
int Cmdline_no_emissive = 0;
|
||||
int Cmdline_normal = 0;
|
||||
int Cmdline_height = 0;
|
||||
int Cmdline_enable_3d_shockwave = 0;
|
||||
|
||||
// Game Speed related
|
||||
cmdline_parm cache_bitmaps_arg("-cache_bitmaps", NULL); // Cmdline_cache_bitmaps
|
||||
@@ -1176,11 +1180,13 @@ int Cmdline_targetinfo = 0;
|
||||
// Gameplay related
|
||||
cmdline_parm use_3dwarp("-3dwarp", NULL); // Cmdline_3dwarp
|
||||
cmdline_parm ship_choice_3d_arg("-ship_choice_3d", NULL); // Cmdline_ship_choice_3d
|
||||
cmdline_parm weapon_choice_3d_arg("-weapon_choice_3d", NULL); // Cmdline_weapon_choice_3d
|
||||
cmdline_parm use_warp_flash("-warp_flash", NULL); // Cmdline_warp_flash
|
||||
cmdline_parm allow_autpilot_interrupt("-no_ap_interrupt", NULL); // Cmdline_warp_flash
|
||||
|
||||
int Cmdline_3dwarp = 0;
|
||||
int Cmdline_ship_choice_3d = 0;
|
||||
int Cmdline_weapon_choice_3d = 0;
|
||||
int Cmdline_warp_flash = 0;
|
||||
int Cmdline_autopilot_interruptable = 1;
|
||||
|
||||
@@ -1219,7 +1225,6 @@ int Cmdline_objupd = 3; // client object updates on LAN by default
|
||||
|
||||
// Troubleshooting
|
||||
cmdline_parm d3d_lesstmem_arg("-d3d_bad_tsys", NULL); // Cmdline_d3d_lesstmem
|
||||
//cmdline_parm fred2_htl_arg("-fredhtl", NULL); // Cmdline_FRED2_htl
|
||||
cmdline_parm loadallweapons_arg("-loadallweps", NULL); // Cmdline_load_all_weapons
|
||||
cmdline_parm htl_arg("-nohtl", NULL); // Cmdline_nohtl -- don't use HT&L
|
||||
cmdline_parm noibx_arg("-noibx", NULL); // Cmdline_noibx
|
||||
@@ -1228,10 +1233,10 @@ cmdline_parm no_set_gamma_arg("-no_set_gamma", NULL); // Cmdline_no_set_gamma
|
||||
cmdline_parm no_vbo_arg("-novbo", NULL); // Cmdline_novbo
|
||||
cmdline_parm safeloading_arg("-safeloading", NULL); // Cmdline_safeloading -- Uses old loading method -C
|
||||
cmdline_parm no_fbo_arg("-disable_fbo", NULL); // Cmdline_no_fbo
|
||||
cmdline_parm verify_vps_arg("-verify_vps", NULL); // Cmdline_verify_vps
|
||||
cmdline_parm noglsl_arg("-no_glsl", NULL); // Cmdline_noglsl -- disable GLSL support in OpenGL
|
||||
cmdline_parm atiswap_arg("-ati_swap", NULL); // Cmdline_atiswap - Fix ATI color swap issue for screenshots.
|
||||
|
||||
int Cmdline_d3d_lesstmem = 0;
|
||||
//int Cmdline_FRED2_htl = 0; // turn HTL on in fred - Kazan
|
||||
int Cmdline_load_all_weapons = 0;
|
||||
int Cmdline_nohtl = 0;
|
||||
int Cmdline_noibx = 0;
|
||||
@@ -1240,7 +1245,8 @@ int Cmdline_no_set_gamma = 0;
|
||||
int Cmdline_novbo = 0; // turn off OGL VBO support, troubleshooting
|
||||
int Cmdline_safeloading = 0;
|
||||
int Cmdline_no_fbo = 0;
|
||||
int Cmdline_verify_vps = 0;
|
||||
int Cmdline_noglsl = 0;
|
||||
int Cmdline_ati_color_swap = 0;
|
||||
|
||||
// Developer/Testing related
|
||||
cmdline_parm start_mission_arg("-start_mission", NULL); // Cmdline_start_mission
|
||||
@@ -1257,6 +1263,7 @@ cmdline_parm save_render_targets_arg("-save_render_target", NULL); // Cmdline_sa
|
||||
cmdline_parm debug_window_arg("-debug_window", NULL); // Cmdline_debug_window
|
||||
cmdline_parm window_arg("-window", NULL); // Cmdline_window
|
||||
cmdline_parm res_arg("-res", NULL); // Cmdline_lores
|
||||
cmdline_parm verify_vps_arg("-verify_vps", NULL); // Cmdline_verify_vps -- spew VP crcs to vp_crcs.txt
|
||||
#ifdef SCP_UNIX
|
||||
cmdline_parm no_grab("-nograb", NULL); // Cmdline_no_grab
|
||||
#endif
|
||||
@@ -1274,6 +1281,7 @@ int Cmdline_save_render_targets = 0;
|
||||
int Cmdline_debug_window = 0;
|
||||
int Cmdline_window = 0;
|
||||
char *Cmdline_res = 0;
|
||||
int Cmdline_verify_vps = 0;
|
||||
#ifdef SCP_UNIX
|
||||
int Cmdline_no_grab = 0;
|
||||
#endif
|
||||
@@ -1719,11 +1727,6 @@ bool SetCmdlineParams()
|
||||
Cmdline_load_all_weapons = 1;
|
||||
}
|
||||
|
||||
if(poof_2d_arg.found())
|
||||
{
|
||||
Cmdline_2d_poof = 1;
|
||||
}
|
||||
|
||||
if(voice_recognition_arg.found())
|
||||
{
|
||||
Cmdline_voice_recognition = 1;
|
||||
@@ -1976,7 +1979,7 @@ bool SetCmdlineParams()
|
||||
}
|
||||
|
||||
if ( fov_arg.found() ) {
|
||||
Viewer_zoom = VIEWER_ZOOM_DEFAULT = Cmdline_fov = fov_arg.get_float();
|
||||
VIEWER_ZOOM_DEFAULT = Cmdline_fov = fov_arg.get_float();
|
||||
}
|
||||
|
||||
if( clip_dist_arg.found() ) {
|
||||
@@ -1988,11 +1991,15 @@ bool SetCmdlineParams()
|
||||
Cmdline_orb_radar = 1;
|
||||
}
|
||||
|
||||
// TBP warp effects -Et1
|
||||
if( tbp.found() )
|
||||
{
|
||||
Cmdline_tbp = 1;
|
||||
}
|
||||
// TBP warp effects -Et1
|
||||
// Chief1983 - Add 3d shockwave, ship choice 3d and weapon choice 3d if TBP is checked
|
||||
if( tbp.found() )
|
||||
{
|
||||
Cmdline_tbp = 1;
|
||||
Cmdline_enable_3d_shockwave = 1;
|
||||
Cmdline_ship_choice_3d = 1;
|
||||
Cmdline_weapon_choice_3d = 1;
|
||||
}
|
||||
|
||||
if ( use_3dwarp.found() ) {
|
||||
Cmdline_3dwarp = 1;
|
||||
@@ -2028,7 +2035,7 @@ bool SetCmdlineParams()
|
||||
|
||||
if ( spec_arg.found() )
|
||||
{
|
||||
Cmdline_nospec = 0;
|
||||
Cmdline_spec = 1;
|
||||
}
|
||||
|
||||
if ( htl_arg.found() )
|
||||
@@ -2053,11 +2060,24 @@ bool SetCmdlineParams()
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( normal_arg.found() ) {
|
||||
Cmdline_normal = 1;
|
||||
|
||||
// height maps are only used if normal maps are
|
||||
if ( height_arg.found() ) {
|
||||
Cmdline_height = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( noglsl_arg.found() ) {
|
||||
Cmdline_noglsl = 1;
|
||||
}
|
||||
|
||||
if ( img2dds_arg.found() )
|
||||
Cmdline_img2dds = 1;
|
||||
|
||||
if ( glow_arg.found() )
|
||||
Cmdline_noglow = 0;
|
||||
Cmdline_glow = 1;
|
||||
|
||||
if ( query_speech_arg.found() )
|
||||
Cmdline_query_speech = 1;
|
||||
@@ -2065,6 +2085,9 @@ bool SetCmdlineParams()
|
||||
if ( ship_choice_3d_arg.found() )
|
||||
Cmdline_ship_choice_3d = 1;
|
||||
|
||||
if ( weapon_choice_3d_arg.found() )
|
||||
Cmdline_weapon_choice_3d = 1;
|
||||
|
||||
if ( show_mem_usage_arg.found() )
|
||||
Cmdline_show_mem_usage = 1;
|
||||
|
||||
@@ -2143,10 +2166,6 @@ bool SetCmdlineParams()
|
||||
Cmdline_snd_preload = 1;
|
||||
}
|
||||
|
||||
if ( alpha_env.found() ) {
|
||||
Cmdline_alpha_env = 1;
|
||||
}
|
||||
|
||||
if ( env.found() ) {
|
||||
Cmdline_env = 1;
|
||||
}
|
||||
@@ -2214,6 +2233,16 @@ bool SetCmdlineParams()
|
||||
if ( verify_vps_arg.found() )
|
||||
Cmdline_verify_vps = 1;
|
||||
|
||||
if ( atiswap_arg.found() )
|
||||
{
|
||||
Cmdline_ati_color_swap = 1;
|
||||
}
|
||||
|
||||
if ( enable_3d_shockwave_arg.found() )
|
||||
{
|
||||
Cmdline_enable_3d_shockwave = 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+16
-13
@@ -235,7 +235,7 @@
|
||||
* and other stuff
|
||||
*
|
||||
* Revision 2.46 2004/02/16 11:47:31 randomtiger
|
||||
* Removed a lot of files that we dont need anymore.
|
||||
* Removed a lot of files that we don't need anymore.
|
||||
* Changed htl to be on by default, command now -nohtl
|
||||
* Changed D3D to use a 2D vertex for 2D operations which should cut down on redundant data having to go though the system.
|
||||
* Added small change to all -start_mission flag to take you to any mission by filename, very useful for testing.
|
||||
@@ -271,7 +271,7 @@
|
||||
* Changed target view not to use lower res texture, hi res one is already chached so might as well use it
|
||||
*
|
||||
* Revision 2.40 2003/11/29 10:52:09 randomtiger
|
||||
* Turned off D3D file mapping, its using too much memory which may be hurting older systems and doesnt seem to be providing much of a speed benifit.
|
||||
* Turned off D3D file mapping, it's using too much memory which may be hurting older systems and doesn't seem to be providing much of a speed benifit.
|
||||
* Added stats command for ingame stats on memory usage.
|
||||
* Trys to play intro.mve and intro.avi, just to be safe since its not set by table.
|
||||
* Added fix for fonts wrapping round in non standard hi res modes.
|
||||
@@ -308,12 +308,12 @@
|
||||
*
|
||||
* Revision 2.35 2003/11/08 22:25:47 Kazan
|
||||
* Timerbar was enabled in both release and debug - so i made it a command line option "-timerbar"
|
||||
* DONT MESS WITH OTHER PEOPLES INCLUDE PATHS
|
||||
* DONT MESS WITH EXEC NAMES (leave it fs2_open_r and fs2_open_d) or paths!
|
||||
* DON'T MESS WITH OTHER PEOPLES INCLUDE PATHS
|
||||
* DON'T MESS WITH EXEC NAMES (leave it fs2_open_r and fs2_open_d) or paths!
|
||||
*
|
||||
* Revision 2.34 2003/11/03 18:07:26 randomtiger
|
||||
* Added -d3d_no_vsync command to make turning off vsync optional.
|
||||
* Removed 32bit command, it doesnt do anything.
|
||||
* Removed 32bit command, it doesn't do anything.
|
||||
* Made aa multisample reg check safe.
|
||||
*
|
||||
* Revision 2.33 2003/10/27 23:04:20 randomtiger
|
||||
@@ -394,7 +394,7 @@
|
||||
* Added "-dshowvid" command-line option, which must be set in order for movies to play.
|
||||
*
|
||||
* Revision 2.16 2002/12/21 13:39:25 DTP
|
||||
* did bit more house keeping. modfied Phreaks fps cmdline a bit, so that we dont have to specific build code.libs for fred, but can use the same code.lib for both fs2_open.exe and fred2_open.exe
|
||||
* did bit more house keeping. modfied Phreak's fps cmdline a bit, so that we don't have to specific build code.libs for fred, but can use the same code.lib for both fs2_open.exe and fred2_open.exe
|
||||
*
|
||||
* Revision 2.15 2002/12/17 03:08:18 DTP
|
||||
* fix to Show_framerate. seems it will call an unresolved external error during fred builds. modified my ifndefs a bit, dsw modified to include preprocessor tag FRED.
|
||||
@@ -440,7 +440,7 @@
|
||||
* Revision 2.3.2.2 2002/11/04 21:24:59 randomtiger
|
||||
*
|
||||
* When running in D3D all ani's are memory mapped for speed, this takes up more memory but stops gametime locking of textures which D3D8 hates.
|
||||
* Added new command line tag Cmdline_d3dlowmem for people who dont want to make use of this because they have no memory.
|
||||
* Added new command line tag Cmdline_d3dlowmem for people who don't want to make use of this because they have no memory.
|
||||
* Cleaned up some more texture stuff enabled console debug for D3D.
|
||||
*
|
||||
* Revision 2.3.2.1 2002/08/27 13:19:02 penguin
|
||||
@@ -650,18 +650,19 @@ extern float Cmdline_ogl_spec;
|
||||
extern float static_light_factor;
|
||||
extern float static_point_factor;
|
||||
extern float static_tube_factor;
|
||||
extern int Cmdline_2d_poof;
|
||||
extern int Cmdline_alpha_env;
|
||||
extern int Cmdline_ambient_factor;
|
||||
extern int Cmdline_cell;
|
||||
extern int Cmdline_decals;
|
||||
extern int Cmdline_env;
|
||||
extern int Cmdline_mipmap;
|
||||
extern int Cmdline_missile_lighting;
|
||||
extern int Cmdline_noglow;
|
||||
extern int Cmdline_glow;
|
||||
extern int Cmdline_nomotiondebris;
|
||||
extern int Cmdline_noscalevid; // disables fit-to-window for movies - taylor
|
||||
extern int Cmdline_nospec;
|
||||
extern int Cmdline_spec;
|
||||
extern int Cmdline_normal;
|
||||
extern int Cmdline_height;
|
||||
extern int Cmdline_enable_3d_shockwave;
|
||||
|
||||
// Game Speed related
|
||||
extern int Cmdline_cache_bitmaps;
|
||||
@@ -679,6 +680,7 @@ extern int Cmdline_targetinfo;
|
||||
// Gameplay related
|
||||
extern int Cmdline_3dwarp;
|
||||
extern int Cmdline_ship_choice_3d;
|
||||
extern int Cmdline_weapon_choice_3d;
|
||||
extern int Cmdline_warp_flash;
|
||||
extern int Cmdline_autopilot_interruptable;
|
||||
|
||||
@@ -702,7 +704,6 @@ extern int Cmdline_objupd;
|
||||
|
||||
// Troubleshooting
|
||||
extern int Cmdline_d3d_lesstmem;
|
||||
extern int Cmdline_FRED2_htl;
|
||||
extern int Cmdline_load_all_weapons;
|
||||
extern int Cmdline_nohtl;
|
||||
extern int Cmdline_noibx;
|
||||
@@ -711,7 +712,8 @@ extern int Cmdline_no_set_gamma;
|
||||
extern int Cmdline_novbo;
|
||||
extern int Cmdline_safeloading;
|
||||
extern int Cmdline_no_fbo;
|
||||
extern int Cmdline_verify_vps;
|
||||
extern int Cmdline_noglsl;
|
||||
extern int Cmdline_ati_color_swap;
|
||||
|
||||
// Developer/Testing related
|
||||
extern char *Cmdline_start_mission;
|
||||
@@ -725,6 +727,7 @@ extern int Cmdline_show_stats;
|
||||
extern int Cmdline_timerbar;
|
||||
extern int Cmdline_save_render_targets;
|
||||
extern int Cmdline_debug_window;
|
||||
extern int Cmdline_verify_vps;
|
||||
#ifdef SCP_UNIX
|
||||
extern int Cmdline_no_grab;
|
||||
#endif
|
||||
|
||||
@@ -887,8 +887,10 @@ char *textify_scancode(int code)
|
||||
if (code < 0)
|
||||
return "None";
|
||||
|
||||
int keycode = code & KEY_MASK;
|
||||
|
||||
*text = 0;
|
||||
if (code & KEY_ALTED) {
|
||||
if (code & KEY_ALTED && !(keycode == KEY_LALT || keycode == KEY_RALT)) {
|
||||
if(Lcl_gr){
|
||||
strcat(text, "Alt-");
|
||||
} else if(Lcl_fr){
|
||||
@@ -898,7 +900,7 @@ char *textify_scancode(int code)
|
||||
}
|
||||
}
|
||||
|
||||
if (code & KEY_SHIFTED) {
|
||||
if (code & KEY_SHIFTED && !(keycode == KEY_LSHIFT || keycode == KEY_RSHIFT)) {
|
||||
if(Lcl_gr){
|
||||
strcat(text, "Shift-");
|
||||
} else if(Lcl_fr){
|
||||
@@ -908,7 +910,7 @@ char *textify_scancode(int code)
|
||||
}
|
||||
}
|
||||
|
||||
strcat(text, Scan_code_text[code & KEY_MASK]);
|
||||
strcat(text, Scan_code_text[keycode]);
|
||||
return text;
|
||||
}
|
||||
//XSTR:ON
|
||||
|
||||
+43
-23
@@ -65,7 +65,7 @@
|
||||
*
|
||||
* Revision 2.8 2004/01/24 15:52:25 randomtiger
|
||||
* I have submitted the new movie playing code despite the fact in D3D it sometimes plays behind the main window.
|
||||
* In OGL it works perfectly and in both API's it doesnt switch to the desktop anymore so hopefully people will not experience the crashes etc that the old system used to suffer from.
|
||||
* In OGL it works perfectly and in both APIs it doesn't switch to the desktop anymore so hopefully people will not experience the crashes etc that the old system used to suffer from.
|
||||
*
|
||||
* Revision 2.7 2003/08/21 20:54:38 randomtiger
|
||||
* Fixed switching - RT
|
||||
@@ -267,15 +267,23 @@ char *Cutscene_mask_name[GR_NUM_RESOLUTIONS] = {
|
||||
"2_ViewFootage-m"
|
||||
};
|
||||
|
||||
int Num_cutscenes;
|
||||
using std::vector;
|
||||
|
||||
size_t Num_cutscenes;
|
||||
int Cutscenes_viewable;
|
||||
int Description_index;
|
||||
cutscene_info Cutscenes[MAX_CUTSCENES];
|
||||
vector<cutscene_info> Cutscenes;
|
||||
|
||||
//extern int All_movies_enabled; // If set, all movies may be viewed. Keyed off cheat code.
|
||||
void cutscene_close(){
|
||||
for(int i = 0; i<MAX_CUTSCENES; i++)
|
||||
if(Cutscenes[i].description)vm_free(Cutscenes[i].description);
|
||||
void cutscene_close()
|
||||
{
|
||||
for(size_t i = 0; i < Num_cutscenes; i++)
|
||||
{
|
||||
if(Cutscenes[i].description)
|
||||
{
|
||||
vm_free(Cutscenes[i].description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// initialization stuff for cutscenes
|
||||
@@ -284,6 +292,7 @@ void cutscene_init()
|
||||
atexit(cutscene_close);
|
||||
char buf[MULTITEXT_LENGTH];
|
||||
int rval;
|
||||
cutscene_info cutinfo;
|
||||
|
||||
// open localization
|
||||
lcl_ext_open();
|
||||
@@ -294,28 +303,35 @@ void cutscene_init()
|
||||
return;
|
||||
}
|
||||
|
||||
read_file_text("cutscenes.tbl");
|
||||
read_file_text("cutscenes.tbl", CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
// parse in all the cutscenes
|
||||
Num_cutscenes = 0;
|
||||
skip_to_string("#Cutscenes");
|
||||
ignore_white_space();
|
||||
while ( required_string_either("#End", "$Filename:") ) {
|
||||
Assert ( Num_cutscenes < MAX_CUTSCENES );
|
||||
|
||||
while ( required_string_either("#End", "$Filename:") )
|
||||
{
|
||||
memset(&cutinfo, 0, sizeof(cutscene_info));
|
||||
|
||||
required_string("$Filename:");
|
||||
stuff_string( Cutscenes[Num_cutscenes].filename, F_PATHNAME, MAX_FILENAME_LEN );
|
||||
stuff_string( cutinfo.filename, F_PATHNAME, MAX_FILENAME_LEN );
|
||||
|
||||
required_string("$Name:");
|
||||
stuff_string( Cutscenes[Num_cutscenes].name, F_NAME, NAME_LENGTH );
|
||||
stuff_string( cutinfo.name, F_NAME, NAME_LENGTH );
|
||||
|
||||
required_string("$Description:");
|
||||
stuff_string(buf, F_MULTITEXT, sizeof(buf));
|
||||
drop_white_space(buf);
|
||||
compact_multitext_string(buf);
|
||||
Cutscenes[Num_cutscenes].description = vm_strdup(buf);
|
||||
required_string("$cd:");
|
||||
stuff_int( &Cutscenes[Num_cutscenes].cd );
|
||||
cutinfo.description = vm_strdup(buf);
|
||||
|
||||
Num_cutscenes++;
|
||||
required_string("$cd:");
|
||||
stuff_int( &cutinfo.cd );
|
||||
|
||||
Cutscenes.push_back(cutinfo);
|
||||
Num_cutscenes++;
|
||||
}
|
||||
|
||||
required_string("#End");
|
||||
@@ -333,7 +349,7 @@ int cutscenes_get_cd_num( char *filename )
|
||||
#if defined(OEM_BUILD)
|
||||
return 0; // only 1 cd for OEM
|
||||
#else
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < Num_cutscenes; i++ ) {
|
||||
if ( !stricmp(Cutscenes[i].filename, filename) ) {
|
||||
@@ -348,7 +364,7 @@ int cutscenes_get_cd_num( char *filename )
|
||||
// marks a cutscene as viewable
|
||||
void cutscene_mark_viewable(char *filename)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
char cut_file[MAX_FILENAME_LEN];
|
||||
char file[MAX_FILENAME_LEN];
|
||||
|
||||
@@ -390,7 +406,7 @@ void cutscene_mark_viewable(char *filename)
|
||||
#define EXIT_BUTTON 7
|
||||
|
||||
static int Num_files;
|
||||
static int Cutscene_list[MAX_CUTSCENES];
|
||||
static vector<int> Cutscene_list;
|
||||
//static int Stats_scroll_offset; // not used - taylor
|
||||
static int Selected_line = 0; // line that is currently selected for binding
|
||||
static int Scroll_offset;
|
||||
@@ -686,6 +702,7 @@ int cutscenes_screen_button_pressed(int n)
|
||||
void cutscenes_screen_init()
|
||||
{
|
||||
int i;
|
||||
size_t j;
|
||||
ui_button_info *b;
|
||||
|
||||
Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
|
||||
@@ -730,9 +747,10 @@ void cutscenes_screen_init()
|
||||
// Cutscenes_viewable = 0xffffffff; // Cheat code enables all movies.
|
||||
|
||||
Num_files = 0;
|
||||
for ( i = 0; i < Num_cutscenes; i++ ) {
|
||||
if ( Cutscenes_viewable & (1<<i) ) {
|
||||
Cutscene_list[Num_files] = i;
|
||||
Cutscene_list.clear();
|
||||
for ( j = 0; j < Num_cutscenes; j++ ) {
|
||||
if ( Cutscenes_viewable & (1<<j) ) {
|
||||
Cutscene_list.push_back((int)j);
|
||||
Num_files++;
|
||||
}
|
||||
}
|
||||
@@ -749,6 +767,7 @@ void cutscenes_screen_close()
|
||||
void cutscenes_screen_do_frame()
|
||||
{
|
||||
int i, k, y, z;
|
||||
size_t t;
|
||||
int font_height = gr_get_font_height();
|
||||
int select_tease_line = -1;
|
||||
|
||||
@@ -792,8 +811,9 @@ void cutscenes_screen_do_frame()
|
||||
case KEY_CTRLED | KEY_SHIFTED | KEY_S:
|
||||
{
|
||||
Num_files = 0;
|
||||
for (i = 0; i < Num_cutscenes; i++) {
|
||||
Cutscene_list[Num_files] = i;
|
||||
Cutscene_list.clear();
|
||||
for (t = 0; t < Num_cutscenes; t++) {
|
||||
Cutscene_list.push_back((int)t);
|
||||
Num_files++;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,8 +65,7 @@
|
||||
|
||||
#include "globalincs/globals.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#define MAX_CUTSCENES 10
|
||||
#include <vector>
|
||||
|
||||
// this cutscene is always available.
|
||||
#define INTRO_CUTSCENE_FLAG (1<<0)
|
||||
@@ -79,8 +78,8 @@ typedef struct cutscene_info
|
||||
int cd;
|
||||
} cutscene_info;
|
||||
|
||||
extern cutscene_info Cutscenes[MAX_CUTSCENES];
|
||||
extern int Num_cutscenes;
|
||||
extern std::vector<cutscene_info> Cutscenes;
|
||||
extern size_t Num_cutscenes;
|
||||
extern int Cutscenes_viewable;
|
||||
|
||||
// initializa table data
|
||||
|
||||
+20
-34
@@ -42,6 +42,7 @@
|
||||
#include "graphics/gropengl.h"
|
||||
#include "graphics/gropengltexture.h"
|
||||
#include "graphics/gropenglextension.h"
|
||||
#include "graphics/gropenglstate.h"
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cutscene/mvelib.h"
|
||||
@@ -529,13 +530,8 @@ int mve_video_createbuf(ubyte minor, ubyte *data)
|
||||
gl_screenYH = g_screenY + g_height;
|
||||
gl_screenXW = g_screenX + g_width;
|
||||
|
||||
if (GL_texture_target == GL_TEXTURE_RECTANGLE_ARB) {
|
||||
gl_screenU = (GLfloat)g_width;
|
||||
gl_screenV = (GLfloat)g_height;
|
||||
} else {
|
||||
gl_screenU = i2fl(g_width) / i2fl(wp2);
|
||||
gl_screenV = i2fl(g_height) / i2fl(hp2);
|
||||
}
|
||||
gl_screenU = i2fl(g_width) / i2fl(wp2);
|
||||
gl_screenV = i2fl(g_height) / i2fl(hp2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -620,9 +616,7 @@ void mve_video_display()
|
||||
}
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
glBindTexture(GL_texture_target, GLtex);
|
||||
|
||||
glTexSubImage2D(GL_texture_target, 0, 0, 0, g_width, g_height, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, pixelbuf);
|
||||
glTexSubImage2D(GL_state.Texture.GetTarget(), 0, 0, 0, g_width, g_height, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, pixelbuf);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
@@ -693,10 +687,7 @@ int mve_video_init(ubyte *data)
|
||||
memset(pixelbuf, 0, g_screenWidth * g_screenHeight * 2);
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
// set the appropriate texture target
|
||||
if ( Is_Extension_Enabled(OGL_ARB_TEXTURE_RECTANGLE) && !Is_Extension_Enabled(OGL_ARB_TEXTURE_NON_POWER_OF_TWO) )
|
||||
opengl_set_texture_target( GL_TEXTURE_RECTANGLE_ARB );
|
||||
|
||||
opengl_set_texture_target(GL_TEXTURE_2D);
|
||||
opengl_tcache_get_adjusted_texture_size(g_screenWidth, g_screenHeight, &wp2, &hp2);
|
||||
|
||||
glGenTextures(1, &GLtex);
|
||||
@@ -709,25 +700,22 @@ int mve_video_init(ubyte *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// disable everything but what we need
|
||||
opengl_switch_arb(-1, 0);
|
||||
opengl_switch_arb(0, 1);
|
||||
|
||||
gr_set_lighting(false, false);
|
||||
|
||||
glBindTexture(GL_texture_target, GLtex);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDepthFunc(GL_ALWAYS);
|
||||
glDepthMask(GL_FALSE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
GL_state.Texture.DisableAll();
|
||||
|
||||
GL_state.Texture.SetActiveUnit(0);
|
||||
GL_state.Texture.SetTarget(GL_texture_target);
|
||||
GL_state.Texture.Enable(GLtex);
|
||||
|
||||
GL_state.SetTextureSource(TEXTURE_SOURCE_DECAL);
|
||||
GL_state.SetAlphaBlendMode(ALPHA_BLEND_NONE);
|
||||
GL_state.SetZbufferType(ZBUFFER_TYPE_NONE);
|
||||
|
||||
GL_state.Texture.SetWrapS(GL_CLAMP_TO_EDGE);
|
||||
GL_state.Texture.SetWrapT(GL_CLAMP_TO_EDGE);
|
||||
|
||||
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
|
||||
glTexImage2D(GL_texture_target, 0, GL_RGB5_A1, wp2, hp2, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
|
||||
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_RGB5_A1, wp2, hp2, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
|
||||
|
||||
// set our color so that we can make sure that it's correct
|
||||
glColor3f(1.0f, 1.0f, 1.0f);
|
||||
@@ -836,12 +824,10 @@ void mve_shutdown()
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
glBindTexture(GL_texture_target, 0);
|
||||
GL_state.Texture.Disable();
|
||||
GL_state.Texture.Delete(GLtex);
|
||||
glDeleteTextures(1, &GLtex);
|
||||
GLtex = 0;
|
||||
|
||||
opengl_switch_arb(-1, 0);
|
||||
opengl_set_texture_target();
|
||||
}
|
||||
|
||||
if (pixelbuf != NULL) {
|
||||
|
||||
+40
-55
@@ -41,6 +41,8 @@
|
||||
#include "graphics/gropengl.h"
|
||||
#include "graphics/gropengltexture.h"
|
||||
#include "graphics/gropenglextension.h"
|
||||
#include "graphics/gropenglshader.h"
|
||||
#include "graphics/gropenglstate.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "io/key.h"
|
||||
#include "osapi/osapi.h"
|
||||
@@ -360,21 +362,8 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
g_screenHeight = tinfo->frame_height;
|
||||
|
||||
|
||||
pixelbuf = (ubyte *) vm_malloc_q(g_screenWidth * g_screenHeight * 3);
|
||||
|
||||
if (pixelbuf == NULL) {
|
||||
nprintf(("MOVIE", "ERROR: Can't allocate memory for pixelbuf"));
|
||||
video_inited = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
memset( pixelbuf, 0, g_screenWidth * g_screenHeight * 3 );
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
// set the appropriate texture target
|
||||
if ( Is_Extension_Enabled(OGL_ARB_TEXTURE_RECTANGLE) && !Is_Extension_Enabled(OGL_ARB_TEXTURE_NON_POWER_OF_TWO) )
|
||||
opengl_set_texture_target( GL_TEXTURE_RECTANGLE_ARB );
|
||||
|
||||
opengl_set_texture_target(GL_TEXTURE_2D);
|
||||
opengl_tcache_get_adjusted_texture_size(g_screenWidth, g_screenHeight, &wp2, &hp2);
|
||||
|
||||
glGenTextures(1, &GLtex);
|
||||
@@ -387,22 +376,22 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
return;
|
||||
}
|
||||
|
||||
// disable everything but what we need
|
||||
opengl_switch_arb(-1, 0);
|
||||
opengl_switch_arb(0, 1);
|
||||
|
||||
gr_set_lighting(false, false);
|
||||
|
||||
glBindTexture(GL_texture_target, GLtex);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDepthFunc(GL_ALWAYS);
|
||||
glDepthMask(GL_FALSE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
GL_state.Texture.DisableAll();
|
||||
|
||||
GL_state.Texture.SetActiveUnit(0);
|
||||
GL_state.Texture.SetTarget(GL_texture_target);
|
||||
GL_state.Texture.Enable(GLtex);
|
||||
|
||||
GL_state.SetTextureSource(TEXTURE_SOURCE_DECAL);
|
||||
GL_state.SetAlphaBlendMode(ALPHA_BLEND_NONE);
|
||||
GL_state.SetZbufferType(ZBUFFER_TYPE_NONE);
|
||||
|
||||
GL_state.Texture.SetWrapS(GL_CLAMP_TO_EDGE);
|
||||
GL_state.Texture.SetWrapT(GL_CLAMP_TO_EDGE);
|
||||
|
||||
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
|
||||
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_RGB8, wp2, hp2, 0, GL_BGR, GL_UNSIGNED_BYTE, NULL);
|
||||
|
||||
float screen_ratio = (float)gr_screen.max_w / (float)gr_screen.max_h;
|
||||
float movie_ratio = (float)g_screenWidth / (float)g_screenHeight;
|
||||
@@ -422,17 +411,19 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
scale_video = 1;
|
||||
}
|
||||
|
||||
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
|
||||
glTexImage2D(GL_texture_target, 0, GL_RGB8, wp2, hp2, 0, GL_BGR, GL_UNSIGNED_BYTE, NULL);
|
||||
|
||||
// set our color so that we can make sure that it's correct
|
||||
glColor3f(1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
#ifndef NO_DIRECT3D
|
||||
else if (gr_screen.mode == GR_DIRECT3D) {
|
||||
// TODO: is there a fast way to do frames in D3D too?
|
||||
|
||||
pixelbuf = (ubyte *) vm_malloc_q(g_screenWidth * g_screenHeight * 3);
|
||||
|
||||
if (pixelbuf == NULL) {
|
||||
nprintf(("MOVIE", "ERROR: Can't allocate memory for pixelbuf"));
|
||||
video_inited = 1;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
memset( pixelbuf, 0, g_screenWidth * g_screenHeight * 3 );
|
||||
|
||||
if (scale_video) {
|
||||
g_screenX = ((fl2i(gr_screen.max_w / scale_by + 0.5f) - g_screenWidth) / 2);
|
||||
@@ -448,13 +439,8 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
gl_screenYH = g_screenY + g_screenHeight;
|
||||
gl_screenXW = g_screenX + g_screenWidth;
|
||||
|
||||
if (GL_texture_target == GL_TEXTURE_RECTANGLE_ARB) {
|
||||
gl_screenU = (GLfloat)wp2;
|
||||
gl_screenV = (GLfloat)hp2;
|
||||
} else {
|
||||
gl_screenU = i2fl(g_screenWidth) / i2fl(wp2);
|
||||
gl_screenV = i2fl(g_screenHeight) / i2fl(hp2);
|
||||
}
|
||||
gl_screenU = i2fl(g_screenWidth) / i2fl(wp2);
|
||||
gl_screenV = i2fl(g_screenHeight) / i2fl(hp2);
|
||||
}
|
||||
|
||||
video_inited = 1;
|
||||
@@ -462,8 +448,9 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
|
||||
static void OGG_video_close()
|
||||
{
|
||||
if (!video_inited)
|
||||
if ( !video_inited ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
if (scale_video) {
|
||||
@@ -471,15 +458,13 @@ static void OGG_video_close()
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
opengl_switch_arb(-1, 0);
|
||||
|
||||
glBindTexture(GL_texture_target, 0);
|
||||
GL_state.Texture.Disable();
|
||||
GL_state.Texture.Delete(GLtex);
|
||||
glDeleteTextures(1, &GLtex);
|
||||
GLtex = 0;
|
||||
|
||||
opengl_set_texture_target();
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
GLtex = 0;
|
||||
}
|
||||
|
||||
if (pixelbuf != NULL) {
|
||||
@@ -578,9 +563,7 @@ static void OGG_video_draw(theora_state *tstate)
|
||||
convert_YUV_to_RGB(&yuv);
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
glBindTexture(GL_texture_target, GLtex);
|
||||
|
||||
glTexSubImage2D(GL_texture_target, 0, 0, 0, g_screenWidth, g_screenHeight, GL_BGR, GL_UNSIGNED_BYTE, pixelbuf);
|
||||
glTexSubImage2D(GL_state.Texture.GetTarget(), 0, 0, 0, g_screenWidth, g_screenHeight, GL_BGR, GL_UNSIGNED_BYTE, pixelbuf);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
@@ -595,8 +578,6 @@ static void OGG_video_draw(theora_state *tstate)
|
||||
glTexCoord2f(gl_screenU, 0);
|
||||
glVertex2i(gl_screenXW, g_screenY);
|
||||
glEnd();
|
||||
} else {
|
||||
// TODO: FIXME!!!
|
||||
}
|
||||
|
||||
gr_flip();
|
||||
@@ -801,7 +782,7 @@ THEORAFILE *theora_open(char *filename)
|
||||
if ( ogg_sync_pageout(&movie->osyncstate, &movie->opage) > 0 ) {
|
||||
OGG_queue_page(movie); // demux into the appropriate stream
|
||||
} else {
|
||||
int ret = OGG_buffer_data(movie); // someone needs more data
|
||||
ret = OGG_buffer_data(movie); // someone needs more data
|
||||
|
||||
if ( ret == 0 ) {
|
||||
mprintf(("Theora ERROR: End of file while searching for codec headers in '%s'!\n", lower_name));
|
||||
@@ -851,6 +832,10 @@ void theora_play(THEORAFILE *movie)
|
||||
if ( (movie == NULL) || !movie->theora_p )
|
||||
return;
|
||||
|
||||
// only OGL is supported
|
||||
if (gr_screen.mode != GR_OPENGL)
|
||||
return;
|
||||
|
||||
// open audio
|
||||
if (movie->vorbis_p)
|
||||
OGG_audio_init(&movie->vinfo);
|
||||
|
||||
+68
-61
@@ -346,6 +346,7 @@
|
||||
#include "io/timer.h"
|
||||
#include "species_defs/species_defs.h"
|
||||
#include "ship/ship.h"
|
||||
#include "ship/shipfx.h"
|
||||
#include "radar/radarsetup.h"
|
||||
#include "network/multi.h"
|
||||
#include "network/multimsgs.h"
|
||||
@@ -493,14 +494,18 @@ void debris_render(object * obj)
|
||||
|
||||
Assert(db->flags & DEBRIS_USED);
|
||||
|
||||
texture_info *tbase = NULL;
|
||||
|
||||
// Swap in a different texture depending on the species
|
||||
if (db->species >= 0)
|
||||
{
|
||||
pm = model_get( db->model_num );
|
||||
|
||||
if ( pm && (pm->n_textures == 1) ) {
|
||||
swapped = pm->maps[0].base_map.GetTexture();
|
||||
pm->maps[0].base_map.SetTexture(Species_info[db->species].debris_texture.bitmap_id);
|
||||
//WMC - Someday, we should have glowing debris.
|
||||
if ( pm != NULL && (pm->n_textures == 1) ) {
|
||||
tbase = &pm->maps[0].textures[TM_BASE_TYPE];
|
||||
swapped = tbase->GetTexture();
|
||||
tbase->SetTexture(Species_info[db->species].debris_texture.bitmap_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -523,8 +528,8 @@ void debris_render(object * obj)
|
||||
submodel_render( db->model_num, db->submodel_num, &obj->orient, &obj->pos, MR_NO_LIGHTING );
|
||||
}
|
||||
|
||||
if ((swapped!=-1) && pm) {
|
||||
pm->maps[0].base_map.SetTexture(swapped);
|
||||
if (tbase != NULL && (swapped!=-1) && pm) {
|
||||
tbase->SetTexture(swapped);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,7 +578,7 @@ void maybe_delete_debris(debris *db)
|
||||
{
|
||||
object *objp;
|
||||
|
||||
if (timestamp_elapsed(db->next_distance_check)) {
|
||||
if (timestamp_elapsed(db->next_distance_check) && timestamp_elapsed(db->must_survive_until)) {
|
||||
if (!(Game_mode & GM_MULTIPLAYER)) { // In single player game, just check against player.
|
||||
if (vm_vec_dist_quick(&Player_obj->pos, &Objects[db->objnum].pos) > MAX_DEBRIS_DIST)
|
||||
db->lifeleft = 0.1f;
|
||||
@@ -790,12 +795,15 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
debris *db;
|
||||
polymodel *pm;
|
||||
int vaporize;
|
||||
physics_info *pi = NULL;
|
||||
ship_info *sip = NULL;
|
||||
|
||||
parent_objnum = OBJ_INDEX(source_obj);
|
||||
|
||||
Assert( (source_obj->type == OBJ_SHIP ) || (source_obj->type == OBJ_GHOST));
|
||||
Assert( source_obj->instance >= 0 && source_obj->instance < MAX_SHIPS );
|
||||
shipp = &Ships[source_obj->instance];
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
vaporize = (shipp->flags &SF_VAPORIZE);
|
||||
|
||||
if ( !hull_flag ) {
|
||||
@@ -835,14 +843,45 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
|
||||
db = &Debris[n];
|
||||
|
||||
// Create Debris piece n!
|
||||
if ( hull_flag ) {
|
||||
if (rand() < RAND_MAX/6) // Make some pieces blow up shortly after explosion.
|
||||
db->lifeleft = 2.0f * ((float) myrand()/(float) RAND_MAX) + 0.5f;
|
||||
else
|
||||
db->lifeleft = -1.0f; // large hull pieces stay around forever
|
||||
} else {
|
||||
db->lifeleft = (i2fl(myrand())/i2fl(RAND_MAX))*2.0f+0.1f;
|
||||
//WMC - We must survive until now, at least.
|
||||
db->must_survive_until = timestamp();
|
||||
|
||||
if(hull_flag && sip->debris_min_lifetime >= 0.0f && sip->debris_max_lifetime >= 0.0f)
|
||||
{
|
||||
db->lifeleft = (( sip->debris_max_lifetime - sip->debris_min_lifetime ) * frand()) + sip->debris_min_lifetime;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create Debris piece n!
|
||||
if ( hull_flag ) {
|
||||
if (rand() < RAND_MAX/6) // Make some pieces blow up shortly after explosion.
|
||||
db->lifeleft = 2.0f * ((float) myrand()/(float) RAND_MAX) + 0.5f;
|
||||
else
|
||||
db->lifeleft = -1.0f; // large hull pieces stay around forever
|
||||
} else {
|
||||
db->lifeleft = (i2fl(myrand())/i2fl(RAND_MAX))*2.0f+0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
//WMC - Oh noes, we may need to change lifeleft
|
||||
if(hull_flag)
|
||||
{
|
||||
if(sip->debris_min_lifetime >= 0.0f && sip->debris_max_lifetime >= 0.0f)
|
||||
{
|
||||
db->must_survive_until = timestamp(fl2i(sip->debris_min_lifetime * 1000.0f));
|
||||
db->lifeleft = (( sip->debris_max_lifetime - sip->debris_min_lifetime ) * frand()) + sip->debris_min_lifetime;
|
||||
}
|
||||
else if(sip->debris_min_lifetime >= 0.0f)
|
||||
{
|
||||
db->must_survive_until = timestamp(fl2i(sip->debris_min_lifetime * 1000.0f));
|
||||
if(db->lifeleft < sip->debris_min_lifetime)
|
||||
db->lifeleft = sip->debris_min_lifetime;
|
||||
}
|
||||
else if(sip->debris_max_lifetime >= 0.0f)
|
||||
{
|
||||
if(db->lifeleft > sip->debris_max_lifetime)
|
||||
db->lifeleft = sip->debris_max_lifetime;
|
||||
}
|
||||
}
|
||||
|
||||
// increase lifetime for vaporized debris
|
||||
@@ -907,6 +946,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
db->objnum = objnum;
|
||||
|
||||
obj = &Objects[objnum];
|
||||
pi = &obj->phys_info;
|
||||
|
||||
// assign the network signature. The signature will be 0 for non-hull pieces, but since that
|
||||
// is our invalid signature, it should be okay.
|
||||
@@ -988,44 +1028,6 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
vm_vec_add (&obj->phys_info.vel, &radial_vel, &source_obj->phys_info.vel);
|
||||
vm_vec_add2(&obj->phys_info.vel, &vel_from_rotvel);
|
||||
|
||||
#ifdef DEBRIS_SPEED_DEBUG
|
||||
// check that debris is not created with too high a velocity
|
||||
if (hull_flag)
|
||||
{
|
||||
int ship_type = Ship_info[Ships[source_obj->instance].ship_info_index].class_type;
|
||||
if(ship_type > -1)
|
||||
{
|
||||
if(vm_vec_mag_squared(&obj->phys_info.vel) > Ship_types[ship_type].debris_max_speed) {
|
||||
float scale = Ship_types[ship_type].debris_max_speed / vm_vec_mag(&obj->phys_info.vel);
|
||||
vm_vec_scale(&obj->phys_info.vel, scale);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (ship_info_flag & (SIF_SMALL_SHIP | SIF_NOT_FLYABLE | SIF_HARMLESS))
|
||||
{
|
||||
if (vm_vec_mag_squared(&obj->phys_info.vel) > MAX_SPEED_SMALL_DEBRIS*MAX_SPEED_SMALL_DEBRIS) {
|
||||
float scale = MAX_SPEED_SMALL_DEBRIS / vm_vec_mag(&obj->phys_info.vel);
|
||||
vm_vec_scale(&obj->phys_info.vel, scale);
|
||||
}
|
||||
} else if (ship_info_flag & SIF_BIG_SHIP) {
|
||||
if (vm_vec_mag_squared(&obj->phys_info.vel) > MAX_SPEED_BIG_DEBRIS*MAX_SPEED_BIG_DEBRIS) {
|
||||
float scale = MAX_SPEED_BIG_DEBRIS / vm_vec_mag(&obj->phys_info.vel);
|
||||
vm_vec_scale(&obj->phys_info.vel, scale);
|
||||
}
|
||||
} else if (ship_info_flag & SIF_HUGE_SHIP) {
|
||||
if (vm_vec_mag_squared(&obj->phys_info.vel) > MAX_SPEED_CAPITAL_DEBRIS*MAX_SPEED_CAPITAL_DEBRIS) {
|
||||
float scale = MAX_SPEED_CAPITAL_DEBRIS / vm_vec_mag(&obj->phys_info.vel);
|
||||
vm_vec_scale(&obj->phys_info.vel, scale);
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
Warning(LOCATION, "Ship does not have a type!");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// vm_vec_scale_add(&obj->phys_info.vel, &radial_vel, &source_obj->phys_info.vel, frand()/2.0f + 0.5f);
|
||||
// nprintf(("Andsager","object vel from rotvel: %0.2f, %0.2f, %0.2f\n",vel_from_rotvel.x, vel_from_rotvel.y, vel_from_rotvel.z));
|
||||
|
||||
@@ -1039,26 +1041,31 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
vm_vec_rand_vec_quick(&rotvel);
|
||||
vm_vec_scale(&rotvel, scale);
|
||||
|
||||
obj->phys_info.flags |= PF_DEAD_DAMP;
|
||||
obj->phys_info.rotvel = rotvel;
|
||||
pi->flags |= PF_DEAD_DAMP;
|
||||
pi->rotvel = rotvel;
|
||||
check_rotvel_limit( &obj->phys_info );
|
||||
|
||||
// check that debris is not created with too high a velocity
|
||||
if (hull_flag)
|
||||
{
|
||||
shipfx_debris_limit_speed(db, shipp);
|
||||
}
|
||||
|
||||
// blow out his reverse thrusters. Or drag, same thing.
|
||||
obj->phys_info.rotdamp = 10000.0f;
|
||||
obj->phys_info.side_slip_time_const = 10000.0f;
|
||||
obj->phys_info.flags |= (PF_REDUCED_DAMP | PF_DEAD_DAMP); // set damping equal for all axis and not changable
|
||||
pi->rotdamp = 10000.0f;
|
||||
pi->side_slip_time_const = 10000.0f;
|
||||
pi->flags |= (PF_REDUCED_DAMP | PF_DEAD_DAMP); // set damping equal for all axis and not changable
|
||||
|
||||
vm_vec_zero(&obj->phys_info.max_vel); // make so he can't turn on his own VOLITION anymore.
|
||||
vm_vec_zero(&obj->phys_info.max_rotvel); // make so he can't change speed on his own VOLITION anymore.
|
||||
vm_vec_zero(&pi->max_vel); // make so he can't turn on his own VOLITION anymore.
|
||||
vm_vec_zero(&pi->max_rotvel); // make so he can't change speed on his own VOLITION anymore.
|
||||
|
||||
|
||||
// ensure vel is valid
|
||||
Assert( !vm_is_vec_nan(&obj->phys_info.vel) );
|
||||
|
||||
// if ( hull_flag ) {
|
||||
// vm_vec_zero(&obj->phys_info.vel);
|
||||
// vm_vec_zero(&obj->phys_info.rotvel);
|
||||
// vm_vec_zero(&pi->vel);
|
||||
// vm_vec_zero(&pi->rotvel);
|
||||
// }
|
||||
|
||||
return obj;
|
||||
|
||||
@@ -173,6 +173,7 @@ typedef struct debris {
|
||||
int team; // Team of the ship where the debris came from
|
||||
int objnum; // What object this is linked to
|
||||
float lifeleft; // When 0 or less object dies
|
||||
int must_survive_until; //WMC - timestamp of earliest point that it can be murthered.
|
||||
int model_num; // What model this uses
|
||||
int submodel_num; // What submodel this uses
|
||||
int next_fireball; // When to start a fireball
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 1.8 2004/02/16 11:47:31 randomtiger
|
||||
* Removed a lot of files that we dont need anymore.
|
||||
* Removed a lot of files that we don't need anymore.
|
||||
* Changed htl to be on by default, command now -nohtl
|
||||
* Changed D3D to use a 2D vertex for 2D operations which should cut down on redundant data having to go though the system.
|
||||
* Added small change to all -start_mission flag to take you to any mission by filename, very useful for testing.
|
||||
@@ -50,8 +50,8 @@
|
||||
*
|
||||
* Revision 1.4 2003/11/08 22:25:47 Kazan
|
||||
* Timerbar was enabled in both release and debug - so i made it a command line option "-timerbar"
|
||||
* DONT MESS WITH OTHER PEOPLES INCLUDE PATHS
|
||||
* DONT MESS WITH EXEC NAMES (leave it fs2_open_r and fs2_open_d) or paths!
|
||||
* DON'T MESS WITH OTHER PEOPLES INCLUDE PATHS
|
||||
* DON'T MESS WITH EXEC NAMES (leave it fs2_open_r and fs2_open_d) or paths!
|
||||
*
|
||||
*
|
||||
* $NoKeywords: $
|
||||
|
||||
+19
-14
@@ -542,7 +542,9 @@ void fireball_play_warphole_open_sound(int ship_class, fireball *fb)
|
||||
|
||||
sound_index = SND_WARP_IN;
|
||||
|
||||
if((ship_class >= 0) && (ship_class < Num_ship_classes)){
|
||||
if(fb->warp_open_sound_index > -1) {
|
||||
sound_index = fb->warp_open_sound_index;
|
||||
} else if((ship_class >= 0) && (ship_class < Num_ship_classes)){
|
||||
if ( Ship_info[ship_class].flags & SIF_HUGE_SHIP ) {
|
||||
sound_index = SND_CAPITAL_WARP_IN;
|
||||
fb->flags |= FBF_WARP_CAPITAL_SIZE;
|
||||
@@ -551,10 +553,6 @@ void fireball_play_warphole_open_sound(int ship_class, fireball *fb)
|
||||
fb->flags |= FBF_WARP_CRUISER_SIZE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sound_index = fb->warp_open_sound_index;
|
||||
}
|
||||
|
||||
snd_play_3d(&Snds[sound_index], &fireball_objp->pos, &Eye_position, fireball_objp->radius, NULL, 0, 1.0f, SND_PRIORITY_DOUBLE_INSTANCE, NULL, range_multiplier); // play warp sound effect
|
||||
}
|
||||
@@ -570,10 +568,10 @@ void fireball_play_warphole_close_sound(fireball *fb)
|
||||
|
||||
sound_index = SND_WARP_OUT;
|
||||
|
||||
if ( fb->flags & FBF_WARP_CAPITAL_SIZE ) {
|
||||
sound_index = SND_CAPITAL_WARP_OUT;
|
||||
} else if ( fb->flags & FBF_WARP_VIA_SEXP ) {
|
||||
if ( fb->warp_close_sound_index > -1 ) {
|
||||
sound_index = fb->warp_close_sound_index;
|
||||
} else if ( fb->flags & FBF_WARP_CAPITAL_SIZE ) {
|
||||
sound_index = SND_CAPITAL_WARP_OUT;
|
||||
} else {
|
||||
// AL 27-3-98: Decided that warphole closing is only required for capital ship sized warp effects.
|
||||
return;
|
||||
@@ -635,7 +633,7 @@ void parse_fireball_tbl(char *filename)
|
||||
return;
|
||||
}
|
||||
|
||||
read_file_text(filename);
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
required_string("#Start");
|
||||
@@ -1192,14 +1190,13 @@ int fireball_get_lod(vec3d *pos, fireball_info *fd, float size)
|
||||
}
|
||||
|
||||
// start the frame
|
||||
extern float Viewer_zoom;
|
||||
extern int G3_count;
|
||||
|
||||
if(!G3_count){
|
||||
g3_start_frame(1);
|
||||
must_stop = 1;
|
||||
}
|
||||
g3_set_view_matrix(&Eye_position, &Eye_matrix, Viewer_zoom);
|
||||
g3_set_view_matrix(&Eye_position, &Eye_matrix, Eye_fov);
|
||||
|
||||
// get extents of the rotated bitmap
|
||||
g3_rotate_vertex(&v, pos);
|
||||
@@ -1497,13 +1494,21 @@ void fireball_get_color(int idx, float *red, float *green, float *blue)
|
||||
|
||||
int fireball_ship_explosion_type(ship_info *sip)
|
||||
{
|
||||
Assert( sip != NULL );
|
||||
|
||||
int index = -1;
|
||||
int ship_fireballs = sip->explosion_bitmap_anims.size();
|
||||
int objecttype_fireballs = Ship_types[sip->class_type].explosion_bitmap_anims.size();
|
||||
int ship_fireballs = (int)sip->explosion_bitmap_anims.size();
|
||||
int objecttype_fireballs = -1;
|
||||
|
||||
if (sip->class_type >= 0) {
|
||||
objecttype_fireballs = (int)Ship_types[sip->class_type].explosion_bitmap_anims.size();
|
||||
}
|
||||
|
||||
if(ship_fireballs > 0){
|
||||
index = sip->explosion_bitmap_anims[rand()%ship_fireballs];
|
||||
} else if(objecttype_fireballs > 0){
|
||||
index = Ship_types[sip->class_type].explosion_bitmap_anims[rand()%objecttype_fireballs];
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
}
|
||||
@@ -289,7 +289,7 @@ void fireball_process_post(object * obj, float frame_time);
|
||||
// reversed is for warp_in/out effects
|
||||
// Velocity: If not NULL, the fireball will move at a constant velocity.
|
||||
// warp_lifetime: If warp_lifetime > 0.0f then makes the explosion loop so it lasts this long. Only works for warp effect
|
||||
int fireball_create(vec3d *pos, int fireball_type, int render_type, int parent_obj, float size, int reversed=0, vec3d *velocity=NULL, float warp_lifetime=0.0f, int ship_class=-1, matrix *orient=NULL, int low_res=0, int extra_flags=0, int warp_open_sound=0, int warp_close_sound=0);
|
||||
int fireball_create(vec3d *pos, int fireball_type, int render_type, int parent_obj, float size, int reversed=0, vec3d *velocity=NULL, float warp_lifetime=0.0f, int ship_class=-1, matrix *orient=NULL, int low_res=0, int extra_flags=0, int warp_open_sound=-1, int warp_close_sound=-1);
|
||||
void fireball_render_plane(int plane);
|
||||
void fireball_close();
|
||||
void fireball_level_close();
|
||||
|
||||
@@ -318,7 +318,7 @@ void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_n
|
||||
|
||||
if (Warp_glow_bitmap >= 0) {
|
||||
float r = radius;
|
||||
bool render_it = (Cmdline_warp_flash == 1);
|
||||
bool render_it = true;
|
||||
|
||||
#define OUT_PERCENT1 0.80f
|
||||
#define OUT_PERCENT2 0.90f
|
||||
@@ -326,12 +326,15 @@ void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_n
|
||||
#define IN_PERCENT1 0.10f
|
||||
#define IN_PERCENT2 0.20f
|
||||
|
||||
if ( (life_percent >= IN_PERCENT1) && (life_percent < IN_PERCENT2) ) {
|
||||
r *= (life_percent - IN_PERCENT1) / (IN_PERCENT2 - IN_PERCENT1);
|
||||
render_it = true;
|
||||
} else if ( (life_percent >= OUT_PERCENT1) && (life_percent < OUT_PERCENT2) ) {
|
||||
r *= (OUT_PERCENT2 - life_percent) / (OUT_PERCENT2 - OUT_PERCENT1);
|
||||
render_it = true;
|
||||
if (Cmdline_warp_flash)
|
||||
{
|
||||
if ( (life_percent >= IN_PERCENT1) && (life_percent < IN_PERCENT2) ) {
|
||||
r *= (life_percent - IN_PERCENT1) / (IN_PERCENT2 - IN_PERCENT1);
|
||||
//render_it = true;
|
||||
} else if ( (life_percent >= OUT_PERCENT1) && (life_percent < OUT_PERCENT2) ) {
|
||||
r *= (OUT_PERCENT2 - life_percent) / (OUT_PERCENT2 - OUT_PERCENT1);
|
||||
//render_it = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (render_it) {
|
||||
@@ -423,7 +426,7 @@ void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_n
|
||||
gr_set_cull(cull);
|
||||
}
|
||||
|
||||
if (Warp_ball_bitmap > -1) {
|
||||
if (Warp_ball_bitmap > -1 && Cmdline_warp_flash == 1) {
|
||||
flash_ball warp_ball(20, .1f,.25f, &vmd_z_vector, &vmd_zero_vector, 4.0f, 0.5f);
|
||||
float adg = (2.0f * life_percent) - 1.0f;
|
||||
float pct = (powf(adg, 4.0f) - powf(adg, 128.0f)) * 4.0f;
|
||||
|
||||
@@ -564,6 +564,18 @@ void briefing_editor_dlg::update_data(int update)
|
||||
break;
|
||||
}
|
||||
|
||||
//WMC - Safeguard against broken lines
|
||||
i = ptr->num_lines;
|
||||
while(i--)
|
||||
{
|
||||
if(ptr->lines[i].start_icon < 0 || ptr->lines[i].end_icon < 0 || ptr->lines[i].start_icon >= ptr->num_icons || ptr->lines[i].end_icon >= ptr->num_icons)
|
||||
{
|
||||
ptr->num_lines--;
|
||||
for(l = i; l < ptr->num_lines; l++)
|
||||
ptr->lines[l] = ptr->lines[l+1];
|
||||
}
|
||||
}
|
||||
|
||||
if (m_last_icon >= 0) {
|
||||
valid = (m_id != ptr->icons[m_last_icon].id);
|
||||
if (m_id >= 0) {
|
||||
@@ -1579,4 +1591,4 @@ void briefing_editor_dlg::OnFlipIcon()
|
||||
// Briefing->stages[m_cur_stage].icons[m_cur_icon].flags &= ~BI_MIRROR_ICON;
|
||||
update_data(1);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -48,13 +48,14 @@ void campaign_filelist_box::initialize()
|
||||
{
|
||||
int i, z, num_files;
|
||||
char *mission_filenames[2000];
|
||||
char mission_filenames_arr[2000][MAX_FILENAME_LEN];
|
||||
mission a_mission;
|
||||
|
||||
ResetContent();
|
||||
|
||||
extern int Skip_packfile_search;
|
||||
Skip_packfile_search = 1;
|
||||
num_files = cf_get_file_list(2000, mission_filenames, CF_TYPE_MISSIONS, "*.fs2");
|
||||
num_files = cf_get_file_list_preallocated(2000, mission_filenames_arr, mission_filenames, CF_TYPE_MISSIONS, "*.fs2");
|
||||
Skip_packfile_search = 0;
|
||||
|
||||
i=0;
|
||||
|
||||
@@ -561,7 +561,7 @@ int campaign_tree_wnd::fred_check_sexp(int sexp, int type, char *msg, ...)
|
||||
if (!z)
|
||||
return 0;
|
||||
|
||||
convert_sexp_to_string(sexp, buf2, SEXP_ERROR_CHECK_MODE);
|
||||
convert_sexp_to_string(sexp, buf2, SEXP_ERROR_CHECK_MODE, 2048);
|
||||
sprintf(buf3, "Error in %s: %s\n\nIn sexpression: %s\n\n(Error appears to be: %s)",
|
||||
buf, sexp_error_message(z), buf2, Sexp_nodes[faulty_node].text);
|
||||
|
||||
|
||||
@@ -311,7 +311,6 @@ int Update_window = 1;
|
||||
HCURSOR h_cursor_move, h_cursor_rotate;
|
||||
|
||||
// Goober5000 - needed to restore compatibility with the changes in fs2_open
|
||||
float VIEWER_ZOOM_DEFAULT = 0.75f;
|
||||
int Show_cpu = 0;
|
||||
|
||||
CWnd *Prev_window;
|
||||
|
||||
+820
-1344
File diff suppressed because it is too large.
Load diff
+20
-10
@@ -83,7 +83,7 @@
|
||||
* taylor and I fixed fred2 by making code.lib and fred2's defines match up
|
||||
*
|
||||
* Revision 1.8 2004/05/02 18:03:19 randomtiger
|
||||
* Fred doesnt need subspace palette any more
|
||||
* Fred doesn't need subspace palette any more
|
||||
*
|
||||
* Revision 1.7 2004/04/03 18:06:35 Kazan
|
||||
* Fixes:
|
||||
@@ -656,6 +656,7 @@ int CFREDDoc::autoload()
|
||||
|
||||
cf_create_default_path_string(name, sizeof(name) - 1, CF_TYPE_MISSIONS);
|
||||
SAFE_STRCAT(name, MISSION_BACKUP_NAME, (sizeof(name) - 1));
|
||||
strcpy(backup_name, name);
|
||||
SAFE_STRCAT(name, ".002", (sizeof(name) - 1));
|
||||
fp = fopen(name, "r");
|
||||
if (!fp)
|
||||
@@ -669,7 +670,6 @@ int CFREDDoc::autoload()
|
||||
r = load_mission(name);
|
||||
Update_window = 1;
|
||||
|
||||
strcpy(backup_name, MISSION_BACKUP_NAME);
|
||||
len = strlen(backup_name);
|
||||
strcat(backup_name, ".001");
|
||||
cf_delete(backup_name, CF_TYPE_MISSIONS);
|
||||
@@ -771,6 +771,7 @@ int CFREDDoc::load_mission(char *pathname, int flags)
|
||||
if (stricmp(name, old_name)) { // need to fix name
|
||||
update_sexp_references(old_name, name);
|
||||
ai_update_goal_references(REF_TYPE_SHIP, old_name, name);
|
||||
update_texture_replacements(old_name, name);
|
||||
for (k=0; k<Num_reinforcements; k++)
|
||||
if (!stricmp(old_name, Reinforcements[k].name)) {
|
||||
Assert(strlen(name) < NAME_LENGTH);
|
||||
@@ -795,7 +796,7 @@ int CFREDDoc::load_mission(char *pathname, int flags)
|
||||
Assert(Mission_palette >= 0);
|
||||
Assert(Mission_palette <= 98);
|
||||
|
||||
// RT, dont need this anymore
|
||||
// RT, don't need this anymore
|
||||
#if 0
|
||||
|
||||
if (The_mission.flags & MISSION_FLAG_SUBSPACE) {
|
||||
@@ -808,15 +809,24 @@ int CFREDDoc::load_mission(char *pathname, int flags)
|
||||
palette_load_table(name);
|
||||
#endif
|
||||
|
||||
// go through all ships and translate their alternate name indices
|
||||
// go through all ships and translate their callsign and alternate name indices
|
||||
objp = GET_FIRST(&obj_used_list);
|
||||
while (objp != END_OF_LIST(&obj_used_list)) {
|
||||
// if this is a ship, check it, and mark its possible alternate name down in the auxiliary array
|
||||
if(((objp->type == OBJ_SHIP) || (objp->type == OBJ_START)) && (objp->instance >= 0) && (Ships[objp->instance].alt_type_index >= 0)){
|
||||
mission_parse_lookup_alt_index(Ships[objp->instance].alt_type_index, Fred_alt_names[objp->instance]);
|
||||
if (((objp->type == OBJ_SHIP) || (objp->type == OBJ_START)) && (objp->instance >= 0)) {
|
||||
if (Ships[objp->instance].alt_type_index >= 0) {
|
||||
mission_parse_lookup_alt_index(Ships[objp->instance].alt_type_index, Fred_alt_names[objp->instance]);
|
||||
|
||||
// also zero it
|
||||
Ships[objp->instance].alt_type_index = -1;
|
||||
// also zero it
|
||||
Ships[objp->instance].alt_type_index = -1;
|
||||
}
|
||||
|
||||
if (Ships[objp->instance].callsign_index >= 0) {
|
||||
mission_parse_lookup_callsign_index(Ships[objp->instance].callsign_index, Fred_callsigns[objp->instance]);
|
||||
|
||||
// also zero it
|
||||
Ships[objp->instance].callsign_index = -1;
|
||||
}
|
||||
}
|
||||
|
||||
objp = GET_NEXT(objp);
|
||||
@@ -1206,7 +1216,7 @@ void CFREDDoc::OnFileImportFSM()
|
||||
*ch = '\0';
|
||||
|
||||
// estimate the mission path for FS1
|
||||
if ((ch = stristr(fs1_mission_path, "FreeSpace2")) >= 0)
|
||||
if ((ch = stristr(fs1_mission_path, "FreeSpace2")) != NULL)
|
||||
{
|
||||
strcpy(ch, "FreeSpace\\Data\\Missions");
|
||||
}
|
||||
@@ -1362,7 +1372,7 @@ void CFREDDoc::OnFileImportWeapons()
|
||||
|
||||
// set initial path
|
||||
strcpy(temp, Fred_exe_dir);
|
||||
if ((ch = stristr(temp, "FreeSpace2")) >= 0)
|
||||
if ((ch = stristr(temp, "FreeSpace2")) != NULL)
|
||||
{
|
||||
strcpy(ch, "FreeSpace\\Data\\Tables");
|
||||
dlg.m_ofn.lpstrInitialDir = temp;
|
||||
|
||||
@@ -1075,9 +1075,9 @@ void render_one_model_nohtl(object *objp)
|
||||
{
|
||||
if (Fred_outline) {
|
||||
model_set_outline_color(Fred_outline >> 16, (Fred_outline >> 8) & 0xff, Fred_outline & 0xff);
|
||||
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j | MR_SHOW_OUTLINE, -1, -1, Ships[z].replacement_textures);
|
||||
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j | MR_SHOW_OUTLINE, -1, -1, Ships[z].ship_replacement_textures);
|
||||
} else {
|
||||
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j, -1, -1, Ships[z].replacement_textures);
|
||||
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j, -1, -1, Ships[z].ship_replacement_textures);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1216,7 +1216,7 @@ void render_one_model_htl(object *objp)
|
||||
}
|
||||
|
||||
g3_done_instance(0);
|
||||
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j, -1, -1, Ships[z].replacement_textures);
|
||||
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j, -1, -1, Ships[z].ship_replacement_textures);
|
||||
} else {
|
||||
int r = 0, g = 0, b = 0;
|
||||
|
||||
@@ -2342,16 +2342,23 @@ void inc_mission_time()
|
||||
fix thistime;
|
||||
|
||||
thistime = timer_get_fixed_seconds();
|
||||
if (!lasttime)
|
||||
if ( !lasttime ) {
|
||||
Frametime = F1_0 / 30;
|
||||
else
|
||||
} else {
|
||||
Frametime = thistime - lasttime;
|
||||
}
|
||||
|
||||
if (Frametime > MAX_FRAMETIME)
|
||||
if (Frametime > MAX_FRAMETIME) {
|
||||
Frametime = MAX_FRAMETIME;
|
||||
} else if (Frametime < MIN_FRAMETIME) {
|
||||
if ( !Cmdline_NoFPSCap ) {
|
||||
thistime = MIN_FRAMETIME - Frametime;
|
||||
Sleep( DWORD(f2fl(thistime) * 1000.0f) );
|
||||
thistime = timer_get_fixed_seconds();
|
||||
}
|
||||
|
||||
if (Frametime < MIN_FRAMETIME)
|
||||
Frametime = MIN_FRAMETIME;
|
||||
}
|
||||
|
||||
Missiontime += Frametime;
|
||||
lasttime = thistime;
|
||||
|
||||
@@ -502,10 +502,10 @@ float flFrametime;
|
||||
int game_zbuffer = 1;
|
||||
int Current_mission = 0xdeadbeef;
|
||||
char **Builtin_mission_names;
|
||||
char *Game_current_mission_filename;
|
||||
char Game_current_mission_filename[MAX_FILENAME_LEN];
|
||||
CFILE *Working_demo;
|
||||
struct beam_info;
|
||||
bool cube_map_drawen=false;
|
||||
bool Env_cubemap_drawn = false;
|
||||
int Multi_ping_timestamp = -1;
|
||||
int Sun_drew = 0;
|
||||
int Networking_disabled = 0;
|
||||
@@ -651,11 +651,9 @@ int game_cd_changed(void) {return 0;}
|
||||
|
||||
int Interface_framerate;
|
||||
void game_set_view_clip(){}
|
||||
float Viewer_zoom;
|
||||
|
||||
int Warpout_forced = 0;
|
||||
float Warpout_time;
|
||||
vec3d Camera_pos;
|
||||
vec3d Dead_player_last_vel;
|
||||
int game_start_mission(){return 0;}
|
||||
int Game_weapons_tbl_valid;
|
||||
@@ -716,8 +714,8 @@ fix game_get_overall_frametime() { return 0; }
|
||||
//WMC
|
||||
void game_level_init(int seed){}
|
||||
void game_post_level_init(){}
|
||||
void game_render_frame_setup(vec3d *eye_pos, matrix *eye_orient){}
|
||||
void game_render_frame(vec3d *eye_pos, matrix *eye_orient){}
|
||||
camid game_render_frame_setup(){return camid();}
|
||||
void game_render_frame(camid cid){}
|
||||
void game_simulation_frame(){}
|
||||
void game_update_missiontime(){}
|
||||
void game_render_post_frame(){}
|
||||
+44
-15
@@ -928,6 +928,8 @@ BEGIN_MESSAGE_MAP(CFREDView, CView)
|
||||
ON_UPDATE_COMMAND_UI(ID_SHOW_DOCK_POINTS, OnUpdateShowDockPoints)
|
||||
ON_COMMAND(ID_FORMAT_FS2_OPEN, OnFormatFs2Open)
|
||||
ON_UPDATE_COMMAND_UI(ID_FORMAT_FS2_OPEN, OnUpdateFormatFs2Open)
|
||||
ON_COMMAND(ID_FORMAT_FS2_OPEN_COMP, OnFormatFs2OpenComp)
|
||||
ON_UPDATE_COMMAND_UI(ID_FORMAT_FS2_OPEN_COMP, OnUpdateFormatFs2OpenComp)
|
||||
ON_COMMAND(ID_FORMAT_FS2_RETAIL, OnFormatFs2Retail)
|
||||
ON_UPDATE_COMMAND_UI(ID_FORMAT_FS2_RETAIL, OnUpdateFormatFs2Retail)
|
||||
ON_COMMAND(ID_FORMAT_FS1_RETAIL, OnFormatFs1Retail)
|
||||
@@ -1828,17 +1830,8 @@ void CFREDView::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
CView::OnSize(nType, cx, cy);
|
||||
|
||||
if(cy > 0)
|
||||
{
|
||||
gr_init_res(GR_640,GR_OPENGL, cx,cy);
|
||||
|
||||
glViewport(0, 0, cx, cy);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, gr_screen.max_w, gr_screen.max_h,0, 0.0, 1.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
if (cy > 0) {
|
||||
gr_screen_resize(cx, cy);
|
||||
RedrawWindow();
|
||||
}
|
||||
}
|
||||
@@ -3527,7 +3520,7 @@ int CFREDView::global_error_check()
|
||||
if ( j == 0 ) {
|
||||
default_orders = orders;
|
||||
} else if ( default_orders != orders ) {
|
||||
if (error("Wing %s has ships with different player orders which\nare ignored. They must all be the same", Wings[i].name ) ){
|
||||
if (error("%s and %s will accept different orders. All ships in a wing must accept the same Player Orders.", Ships[Wings[i].ship_index[j]].ship_name, Ships[Wings[i].ship_index[0]].ship_name ) ){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -3884,7 +3877,7 @@ int CFREDView::fred_check_sexp(int sexp, int type, char *msg, ...)
|
||||
if (!z)
|
||||
return 0;
|
||||
|
||||
convert_sexp_to_string(sexp, buf2, SEXP_ERROR_CHECK_MODE);
|
||||
convert_sexp_to_string(sexp, buf2, SEXP_ERROR_CHECK_MODE, 2048);
|
||||
sprintf(buf3, "Error in %s: %s\n\nIn sexpression: %s\n(Error appears to be: %s)",
|
||||
buf, sexp_error_message(z), buf2, Sexp_nodes[faulty_node].text);
|
||||
|
||||
@@ -4328,6 +4321,27 @@ void CFREDView::OnRunFreeSpace()
|
||||
si.cbReserved2 = 0;
|
||||
si.lpReserved2 = NULL;
|
||||
|
||||
// get the filename of the app and replace FRED2_Open with FS2_Open
|
||||
std::string processed_name(AfxGetApp()->m_pszExeName);
|
||||
std::string::size_type fred_index = processed_name.find("fred2_open", 0);
|
||||
// capitalisation!
|
||||
if (fred_index == std::string::npos) {
|
||||
fred_index = processed_name.find("Fred2_Open", 0);
|
||||
}
|
||||
|
||||
if (fred_index != std::string::npos) {
|
||||
// delete the fred2_open and add FS2_Open in its place
|
||||
processed_name.erase(fred_index, 10);
|
||||
processed_name.insert(fred_index, "FS2_Open");
|
||||
processed_name.append(".exe");
|
||||
|
||||
//try to start FS2_open
|
||||
r = CreateProcess(processed_name.c_str(), NULL, NULL, NULL, FALSE, 0, NULL, "./", &si, &pi);
|
||||
if (r) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
r = CreateProcess("start_fs2.bat", NULL, NULL, NULL, FALSE, 0, NULL, "./", &si, &pi);
|
||||
|
||||
if (!r) {
|
||||
@@ -5083,7 +5097,7 @@ void CFREDView::OnDumpStats()
|
||||
|
||||
void CFREDView::OnFormatFs2Open()
|
||||
{
|
||||
Format_fs2_open = 1;
|
||||
Format_fs2_open = FSO_FORMAT_STANDARD;
|
||||
Format_fs2_retail = 0;
|
||||
Format_fs1_retail = 0;
|
||||
|
||||
@@ -5093,7 +5107,22 @@ void CFREDView::OnFormatFs2Open()
|
||||
|
||||
void CFREDView::OnUpdateFormatFs2Open(CCmdUI* pCmdUI)
|
||||
{
|
||||
pCmdUI->SetCheck(Format_fs2_open);
|
||||
pCmdUI->SetCheck(Format_fs2_open == FSO_FORMAT_STANDARD);
|
||||
}
|
||||
|
||||
void CFREDView::OnFormatFs2OpenComp()
|
||||
{
|
||||
Format_fs2_open = FSO_FORMAT_COMPATIBILITY_MODE;
|
||||
Format_fs2_retail = 0;
|
||||
Format_fs1_retail = 0;
|
||||
|
||||
theApp.write_ini_file();
|
||||
Update_window = 1;
|
||||
}
|
||||
|
||||
void CFREDView::OnUpdateFormatFs2OpenComp(CCmdUI* pCmdUI)
|
||||
{
|
||||
pCmdUI->SetCheck(Format_fs2_open == FSO_FORMAT_COMPATIBILITY_MODE);
|
||||
}
|
||||
|
||||
void CFREDView::OnFormatFs2Retail()
|
||||
|
||||
@@ -546,6 +546,8 @@ protected:
|
||||
afx_msg void OnUpdateShowDockPoints(CCmdUI* pCmdUI);
|
||||
afx_msg void OnFormatFs2Open();
|
||||
afx_msg void OnUpdateFormatFs2Open(CCmdUI* pCmdUI);
|
||||
afx_msg void OnFormatFs2OpenComp();
|
||||
afx_msg void OnUpdateFormatFs2OpenComp(CCmdUI* pCmdUI);
|
||||
afx_msg void OnFormatFs2Retail();
|
||||
afx_msg void OnUpdateFormatFs2Retail(CCmdUI* pCmdUI);
|
||||
afx_msg void OnFormatFs1Retail();
|
||||
@@ -612,6 +614,9 @@ extern int Hide_ship_cues, Hide_wing_cues;
|
||||
extern Marking_box marking_box;
|
||||
extern object_orient_pos rotation_backup[MAX_OBJECTS];
|
||||
|
||||
#define FSO_FORMAT_STANDARD 1
|
||||
#define FSO_FORMAT_COMPATIBILITY_MODE 2
|
||||
|
||||
// Goober5000 (currently, FS1 retail not implemented)
|
||||
extern int Format_fs2_open;
|
||||
extern int Format_fs2_retail;
|
||||
|
||||
@@ -609,6 +609,7 @@ char Fred_exe_dir[512] = "";
|
||||
char Fred_base_dir[512] = "";
|
||||
|
||||
char Fred_alt_names[MAX_SHIPS][NAME_LENGTH+1];
|
||||
char Fred_callsigns[MAX_SHIPS][NAME_LENGTH+1];
|
||||
|
||||
// object numbers for ships in a wing.
|
||||
int wing_objects[MAX_WINGS][MAX_SHIPS_PER_WING];
|
||||
@@ -804,7 +805,7 @@ void parse_medal_tbl()
|
||||
void fred_close()
|
||||
{
|
||||
if (Fred_texture_replacements != NULL) {
|
||||
vm_free(Fred_texture_replacements);
|
||||
delete[] Fred_texture_replacements;
|
||||
Fred_texture_replacements = NULL;
|
||||
}
|
||||
}
|
||||
@@ -907,7 +908,7 @@ bool fred_init()
|
||||
Cmdline_window = 1;
|
||||
DBUGFILE_OUTPUT_0("About to gr_init");
|
||||
|
||||
gr_init(GR_640, GR_OPENGL, 32, 640, 480);
|
||||
gr_init(GR_OPENGL, 640, 480, 32);
|
||||
|
||||
Mouse_hidden = 1;
|
||||
|
||||
@@ -927,7 +928,8 @@ bool fred_init()
|
||||
species_init(); // Kazan
|
||||
|
||||
// for fred specific replacement texture stuff
|
||||
Fred_texture_replacements = (texture_replace*) vm_malloc( sizeof(texture_replace) * MAX_SHIPS * MAX_MODEL_TEXTURES );
|
||||
//Fred_texture_replacements = (texture_replace*) vm_malloc( sizeof(texture_replace) * MAX_SHIPS * MAX_REPLACEMENT_TEXTURES );
|
||||
Fred_texture_replacements = new texture_replace[MAX_SHIPS*MAX_REPLACEMENT_TEXTURES];
|
||||
atexit(fred_close);
|
||||
|
||||
// Goober5000
|
||||
@@ -1500,9 +1502,10 @@ void clear_mission()
|
||||
Player_starts = 0;
|
||||
Num_teams = 1;
|
||||
|
||||
// reset alternate name stuff
|
||||
// reset alternate name & callsign stuff
|
||||
for(i=0; i<MAX_SHIPS; i++){
|
||||
strcpy(Fred_alt_names[i], "");
|
||||
strcpy(Fred_callsigns[i], "");
|
||||
}
|
||||
|
||||
// set up the default ship types for all teams. For now, this is the same class
|
||||
@@ -1546,6 +1549,7 @@ void clear_mission()
|
||||
debrief_reset();
|
||||
ship_init();
|
||||
event_music_reset_choices();
|
||||
clear_texture_replacements();
|
||||
|
||||
// alternate ship type names
|
||||
mission_parse_reset_alt();
|
||||
@@ -2435,6 +2439,7 @@ int rename_ship(int ship, char *name)
|
||||
|
||||
update_sexp_references(Ships[ship].ship_name, name);
|
||||
ai_update_goal_references(REF_TYPE_SHIP, Ships[ship].ship_name, name);
|
||||
update_texture_replacements(Ships[ship].ship_name, name);
|
||||
for (i=0; i<Num_reinforcements; i++)
|
||||
if (!stricmp(Ships[ship].ship_name, Reinforcements[i].name)) {
|
||||
strcpy(Reinforcements[i].name, name);
|
||||
@@ -2455,6 +2460,7 @@ int invalidate_references(char *name, int type)
|
||||
sprintf(new_name, "<%s>", name);
|
||||
update_sexp_references(name, new_name);
|
||||
ai_update_goal_references(type, name, new_name);
|
||||
update_texture_replacements(name, new_name);
|
||||
for (i=0; i<Num_reinforcements; i++)
|
||||
if (!stricmp(name, Reinforcements[i].name)) {
|
||||
strcpy(Reinforcements[i].name, new_name);
|
||||
@@ -3211,3 +3217,15 @@ void stuff_special_arrival_anchor_name(char *buf, int anchor_num, int retail_for
|
||||
// get name
|
||||
stuff_special_arrival_anchor_name(buf, iff_index, restrict_to_players, retail_format);
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
void update_texture_replacements(char *old_name, char *new_name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < Fred_num_texture_replacements; i++)
|
||||
{
|
||||
if (!stricmp(Fred_texture_replacements[i].ship_name, old_name))
|
||||
strcpy(Fred_texture_replacements[i].ship_name, new_name);
|
||||
}
|
||||
}
|
||||
@@ -324,8 +324,9 @@ extern int Fred_font;
|
||||
extern ai_goal_list Ai_goal_list[];
|
||||
extern int Ai_goal_list_size;
|
||||
|
||||
// alternate ship name stuff
|
||||
// alternate ship name and callsign stuff
|
||||
extern char Fred_alt_names[MAX_SHIPS][NAME_LENGTH+1];
|
||||
extern char Fred_callsigns[MAX_SHIPS][NAME_LENGTH+1];
|
||||
|
||||
extern int wing_objects[MAX_WINGS][MAX_SHIPS_PER_WING];
|
||||
|
||||
@@ -423,5 +424,6 @@ extern int wing_is_player_wing(int wing);
|
||||
extern void update_custom_wing_indexes();
|
||||
extern void stuff_special_arrival_anchor_name(char *buf, int iff_index, int restrict_to_players, int retail_format);
|
||||
extern void stuff_special_arrival_anchor_name(char *buf, int anchor_num, int retail_format);
|
||||
extern void update_texture_replacements(char *old_name, char *new_name);
|
||||
|
||||
#endif
|
||||
@@ -838,8 +838,12 @@ void CMissionNotesDlg::set_types()
|
||||
|
||||
void CMissionNotesDlg::OnSquadLogo()
|
||||
{
|
||||
CString pcx_filename;
|
||||
int z;
|
||||
char *Logo_ext = "Image Files (*.dds, *.pcx)|*.dds;*.pcx|"
|
||||
"DDS Files (*.dds)|*.dds|"
|
||||
"PCX Files (*.pcx)|*.pcx|"
|
||||
"All Files (*.*)|*.*|"
|
||||
"|";
|
||||
|
||||
//phreak 05/05/2003
|
||||
//this needs to be here or else the data in the mission notes dialog will revert
|
||||
@@ -848,7 +852,7 @@ void CMissionNotesDlg::OnSquadLogo()
|
||||
|
||||
// get list of squad images
|
||||
z = cfile_push_chdir(CF_TYPE_SQUAD_IMAGES);
|
||||
CFileDialog dlg(TRUE, "pcx", pcx_filename, OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR, "Pcx Files (*.pcx)|*.pcx");
|
||||
CFileDialog dlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR, Logo_ext);
|
||||
|
||||
// if we have a result
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
@@ -864,24 +868,23 @@ void CMissionNotesDlg::OnSquadLogo()
|
||||
}
|
||||
}
|
||||
|
||||
char *Load_screen_ext = "Image Files (*.dds, *.pcx, *.jpg, *.tga)|*.dds;*.pcx;*.jpg;*.tga|"
|
||||
char *Load_screen_ext = "Image Files (*.dds, *.pcx, *.jpg, *.jpeg, *.tga)|*.dds;*.pcx;*.jpg;*.jpeg;*.tga|"
|
||||
"DDS Files (*.dds)|*.dds|"
|
||||
"PCX Files (*.pcx)|*.pcx|"
|
||||
"JPG Files (*.jpg)|*.jpg|"
|
||||
"JPG Files (*.jpg; *.jpeg)|*.jpg;*.jpeg|"
|
||||
"TGA Files (*.tga)|*.tga|"
|
||||
"All Files (*.*)|*.*|"
|
||||
"|";
|
||||
|
||||
void CMissionNotesDlg::OnLoad1024()
|
||||
{
|
||||
CString filename;
|
||||
int z;
|
||||
|
||||
UpdateData(TRUE);
|
||||
|
||||
// get list of
|
||||
z = cfile_push_chdir(CF_TYPE_DATA);
|
||||
CFileDialog dlg(TRUE, NULL, filename, OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR, Load_screen_ext);
|
||||
CFileDialog dlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR, Load_screen_ext);
|
||||
|
||||
// if we have a result
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
@@ -899,14 +902,13 @@ void CMissionNotesDlg::OnLoad1024()
|
||||
|
||||
void CMissionNotesDlg::OnLoad640()
|
||||
{
|
||||
CString filename;
|
||||
int z;
|
||||
|
||||
UpdateData(TRUE);
|
||||
|
||||
// get list of
|
||||
z = cfile_push_chdir(CF_TYPE_DATA);
|
||||
CFileDialog dlg(TRUE, NULL, filename, OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR, Load_screen_ext);
|
||||
CFileDialog dlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR, Load_screen_ext);
|
||||
|
||||
// if we have a result
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
|
||||
+209
-170
File diff suppressed because it is too large.
Load diff
@@ -277,7 +277,7 @@ BOOL CModifyVariableDlg::OnInitDialog()
|
||||
|
||||
// initialize list -- Box is set to *not* sort
|
||||
for (i=0; i<MAX_SEXP_VARIABLES; i++) {
|
||||
if (Sexp_variables[i].type & SEXP_VARIABLE_SET) {
|
||||
if ((Sexp_variables[i].type & SEXP_VARIABLE_SET) && !(Sexp_variables[i].type & SEXP_VARIABLE_BLOCK)){
|
||||
box_index = cbox->AddString(Sexp_variables[i].variable_name);
|
||||
|
||||
// check no error
|
||||
@@ -365,7 +365,7 @@ void CModifyVariableDlg::OnOK()
|
||||
// validate data
|
||||
validate_data(temp_data, RESET_FOCUS);
|
||||
if (m_data_validated) {
|
||||
// Dont get OnKillfocusModifyDefaultValue when ok
|
||||
// Don't get OnKillfocusModifyDefaultValue when ok
|
||||
if (!m_modified_value) {
|
||||
if ( strcmp(Sexp_variables[get_sexp_var_index()].text, temp_data) ) {
|
||||
m_modified_value = true;
|
||||
|
||||
@@ -633,6 +633,7 @@
|
||||
#define IDC_OBJECT3 1246
|
||||
#define IDC_MISSILE1 1246
|
||||
#define IDC_MESSAGE_TEAM 1246
|
||||
#define IDC_SHIP_CALLSIGN 1246
|
||||
#define IDC_COMBO6 1247
|
||||
#define IDC_BEHAVIOR3 1247
|
||||
#define IDC_MISSILE2 1247
|
||||
@@ -769,6 +770,7 @@
|
||||
#define IDC_LOADING_SCREEN1024 1344
|
||||
#define IDC_ABBREV_CAMPAIGN 1344
|
||||
#define IDC_TVT_WING_NAME_1 1344
|
||||
#define IDC_ASSIST_SCORE 1344
|
||||
#define IDC_EDIT4 1345
|
||||
#define IDC_AMMO4 1345
|
||||
#define IDC_VOICE 1345
|
||||
@@ -1360,6 +1362,8 @@
|
||||
#define ID_SHOW_IFF_7 33088
|
||||
#define ID_SHOW_IFF_8 33089
|
||||
#define ID_VIEW_FULL_DETAIL 33090
|
||||
#define ID_SAVEFORMAT_FS2OPEN 33091
|
||||
#define ID_FORMAT_FS2_OPEN_COMP 33092
|
||||
#define ID_INDICATOR_MODE 59142
|
||||
#define ID_INDICATOR_LEFT 59143
|
||||
#define ID_INDICATOR_RIGHT 59144
|
||||
@@ -1370,8 +1374,8 @@
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 316
|
||||
#define _APS_NEXT_COMMAND_VALUE 33091
|
||||
#define _APS_NEXT_RESOURCE_VALUE 317
|
||||
#define _APS_NEXT_COMMAND_VALUE 33093
|
||||
#define _APS_NEXT_CONTROL_VALUE 1595
|
||||
#define _APS_NEXT_SYMED_VALUE 105
|
||||
#endif
|
||||
|
||||
+128
-22
@@ -1524,7 +1524,7 @@ void sexp_tree::right_clicked(int mode)
|
||||
|
||||
int op_type = query_operator_argument_type(op, Replace_count); // check argument type at this position
|
||||
|
||||
// special case dont allow replace data for variable names
|
||||
// special case don't allow replace data for variable names
|
||||
// Goober5000 - why? the only place this happens is when replacing the ambiguous argument in
|
||||
// modify-variable with a variable, which seems legal enough.
|
||||
//if (op_type != OPF_AMBIGUOUS) {
|
||||
@@ -1543,6 +1543,11 @@ void sexp_tree::right_clicked(int mode)
|
||||
|
||||
for (int idx=0; idx<max_sexp_vars; idx++) {
|
||||
if (Sexp_variables[idx].type & SEXP_VARIABLE_SET) {
|
||||
// skip block variables
|
||||
if (Sexp_variables[idx].type & SEXP_VARIABLE_BLOCK) {
|
||||
continue;
|
||||
}
|
||||
|
||||
UINT flag = MF_STRING | MF_GRAYED;
|
||||
// maybe gray flag MF_GRAYED
|
||||
|
||||
@@ -1582,7 +1587,7 @@ void sexp_tree::right_clicked(int mode)
|
||||
}
|
||||
}
|
||||
|
||||
// cant modify if no variables
|
||||
// can't modify if no variables
|
||||
if (sexp_variable_count() == 0) {
|
||||
menu.EnableMenuItem(ID_SEXP_TREE_MODIFY_VARIABLE, MF_GRAYED);
|
||||
}
|
||||
@@ -1830,7 +1835,7 @@ void sexp_tree::right_clicked(int mode)
|
||||
|
||||
list = get_listing_opf(type, parent, Replace_count);
|
||||
|
||||
// special case dont allow replace data for variable names
|
||||
// special case don't allow replace data for variable names
|
||||
if ( (type != OPF_VARIABLE_NAME) && list) {
|
||||
sexp_list_item *ptr;
|
||||
|
||||
@@ -2211,7 +2216,7 @@ char *sexp_tree::match_closest_operator(char *str, int node)
|
||||
return str;
|
||||
|
||||
// determine which argument we are of the parent
|
||||
arg_num = find_argument_number(z, tree_nodes[z].child);
|
||||
arg_num = find_argument_number(z, node);
|
||||
|
||||
opf = query_operator_argument_type(op, arg_num); // check argument type at this position
|
||||
opr = query_operator_return_type(op);
|
||||
@@ -2389,7 +2394,7 @@ BOOL sexp_tree::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
int type = get_type(item_handle);
|
||||
Assert( (type & SEXPT_NUMBER) || (type & SEXPT_STRING) );
|
||||
|
||||
// dont do type check for modify-variable
|
||||
// don't do type check for modify-variable
|
||||
if (Modify_variable) {
|
||||
if (Sexp_variables[var_idx].type & SEXP_VARIABLE_NUMBER) {
|
||||
type = SEXPT_NUMBER;
|
||||
@@ -2399,8 +2404,7 @@ BOOL sexp_tree::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
Int3(); // unknown type
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
} else {
|
||||
// verify type in tree is same as type in Sexp_variables array
|
||||
if (type & SEXPT_NUMBER) {
|
||||
Assert(Sexp_variables[var_idx].type & SEXP_VARIABLE_NUMBER);
|
||||
@@ -3073,6 +3077,14 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
|
||||
sprintf(str, "%d", temp);
|
||||
item->set_data_dup(str, (SEXPT_NUMBER | SEXPT_VALID));
|
||||
}
|
||||
else if ((Operators[op].value == OP_MODIFY_VARIABLE)) {
|
||||
if (get_modify_variable_type(index) == OPF_NUMBER) {
|
||||
item->set_data("0", (SEXPT_NUMBER | SEXPT_VALID));
|
||||
}
|
||||
else {
|
||||
item->set_data("<any data>", (SEXPT_STRING | SEXPT_VALID));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item->set_data("0", (SEXPT_NUMBER | SEXPT_VALID));
|
||||
@@ -3120,8 +3132,13 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
|
||||
str = "<name of ship here>";
|
||||
break;
|
||||
|
||||
case OPF_ORDER_RECIPIENT:
|
||||
str = "<all fighters>";
|
||||
break;
|
||||
|
||||
case OPF_SHIP_OR_NONE:
|
||||
case OPF_SUBSYSTEM_OR_NONE:
|
||||
case OPF_SHIP_WING_POINT_OR_NONE:
|
||||
str = SEXP_NONE_STRING;
|
||||
break;
|
||||
|
||||
@@ -3265,6 +3282,7 @@ int sexp_tree::query_default_argument_available(int op, int i)
|
||||
case OPF_SKYBOX_MODEL_NAME:
|
||||
case OPF_SHIP_OR_NONE:
|
||||
case OPF_SUBSYSTEM_OR_NONE:
|
||||
case OPF_SHIP_WING_POINT_OR_NONE:
|
||||
case OPF_SUBSYS_OR_GENERIC:
|
||||
case OPF_BACKGROUND_BITMAP:
|
||||
case OPF_SUN_BITMAP:
|
||||
@@ -3274,10 +3292,21 @@ int sexp_tree::query_default_argument_available(int op, int i)
|
||||
return 1;
|
||||
|
||||
case OPF_SHIP:
|
||||
case OPF_SHIP_NOT_PLAYER:
|
||||
case OPF_SHIP_WING:
|
||||
case OPF_SHIP_POINT:
|
||||
case OPF_SHIP_WING_POINT:
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if (ptr->type == OBJ_SHIP || ptr->type == OBJ_START)
|
||||
return 1;
|
||||
|
||||
ptr = GET_NEXT(ptr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
case OPF_SHIP_NOT_PLAYER:
|
||||
case OPF_ORDER_RECIPIENT:
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if (ptr->type == OBJ_SHIP)
|
||||
@@ -3828,16 +3857,45 @@ void sexp_tree::verify_and_fix_arguments(int node)
|
||||
char *text_ptr;
|
||||
char default_variable_text[TOKEN_LENGTH];
|
||||
if (tree_nodes[item_index].type & SEXPT_VARIABLE) {
|
||||
// special case for modify-variable
|
||||
if ( !stricmp(Operators[op].text, "modify-variable") ||
|
||||
!stricmp(Operators[op].text, "add-background-bitmap") ||
|
||||
!stricmp(Operators[op].text, "add-sun-bitmap")) {
|
||||
// special case for SEXPs which can modify a variable
|
||||
if ( (!stricmp(Operators[op].text, "modify-variable")) ||
|
||||
((!stricmp(Operators[op].text, "add-background-bitmap")) && (arg_num == 8)) ||
|
||||
((!stricmp(Operators[op].text, "add-sun-bitmap")) && (arg_num == 5)) ){
|
||||
// make text_ptr to start - before '('
|
||||
get_variable_name_from_sexp_tree_node_text(tree_nodes[item_index].text, default_variable_text);
|
||||
text_ptr = default_variable_text;
|
||||
} else {
|
||||
get_variable_default_text_from_variable_text(tree_nodes[item_index].text, default_variable_text);
|
||||
text_ptr = default_variable_text;
|
||||
// only the type needs checking for variables. It's up the to the FREDder to ensure the value is valid
|
||||
get_variable_name_from_sexp_tree_node_text(tree_nodes[item_index].text, default_variable_text);
|
||||
int sexp_var_index = get_index_sexp_variable_name(default_variable_text);
|
||||
bool types_match = false;
|
||||
Assert(sexp_var_index != -1);
|
||||
|
||||
switch (type) {
|
||||
case OPF_NUMBER:
|
||||
case OPF_POSITIVE:
|
||||
if (Sexp_variables[sexp_var_index].type & SEXP_VARIABLE_NUMBER) {
|
||||
types_match = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (Sexp_variables[sexp_var_index].type & SEXP_VARIABLE_STRING) {
|
||||
types_match = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (types_match) {
|
||||
// on to the next argument
|
||||
item_index = tree_nodes[item_index].next;
|
||||
arg_num++;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
// shouldn't really be getting here unless someone has been hacking the mission in a text editor
|
||||
get_variable_default_text_from_variable_text(tree_nodes[item_index].text, default_variable_text);
|
||||
text_ptr = default_variable_text;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
text_ptr = tree_nodes[item_index].text;
|
||||
@@ -4770,6 +4828,14 @@ sexp_list_item *sexp_tree::get_listing_opf(int opf, int parent_node, int arg_ind
|
||||
list = get_listing_opf_ship_wing_point();
|
||||
break;
|
||||
|
||||
case OPF_SHIP_WING_POINT_OR_NONE:
|
||||
list = get_listing_opf_ship_wing_point_or_none();
|
||||
break;
|
||||
|
||||
case OPF_ORDER_RECIPIENT:
|
||||
list = get_listing_opf_order_recipient();
|
||||
break;
|
||||
|
||||
case OPF_SHIP_TYPE:
|
||||
list = get_listing_opf_ship_type();
|
||||
break;
|
||||
@@ -4901,11 +4967,15 @@ sexp_list_item *sexp_tree::get_listing_opf(int opf, int parent_node, int arg_ind
|
||||
return list;
|
||||
}
|
||||
|
||||
// add special item
|
||||
head.add_data(SEXP_ARGUMENT_STRING);
|
||||
|
||||
// append other list
|
||||
head.add_list(list);
|
||||
// the special item is a string and should not be added for numeric lists
|
||||
if (opf != OPF_NUMBER && opf != OPF_POSITIVE) {
|
||||
head.add_data(SEXP_ARGUMENT_STRING);
|
||||
}
|
||||
|
||||
if (list != NULL) {
|
||||
// append other list
|
||||
head.add_list(list);
|
||||
}
|
||||
|
||||
// return listing
|
||||
return head.next;
|
||||
@@ -5252,6 +5322,15 @@ sexp_list_item *sexp_tree::get_listing_opf_subsystem(int parent_node, int arg_in
|
||||
child = tree_nodes[child].next;
|
||||
break;
|
||||
|
||||
// this sexp checks the subsystem of the *fourth entry* on the list
|
||||
case OP_QUERY_ORDERS:
|
||||
child = tree_nodes[child].next;
|
||||
Assert(child >= 0);
|
||||
child = tree_nodes[child].next;
|
||||
Assert(child >= 0);
|
||||
child = tree_nodes[child].next;
|
||||
break;
|
||||
|
||||
// this sexp checks the subsystem of the *ninth entry* on the list
|
||||
case OP_WEAPON_CREATE:
|
||||
// iterate to the next field eight times
|
||||
@@ -5509,7 +5588,13 @@ sexp_list_item *sexp_tree::get_listing_opf_ai_goal(int parent_node)
|
||||
head.add_op(i);
|
||||
}
|
||||
}
|
||||
|
||||
// when dealing with the special argument add them all. It's up to the FREDder to ensure invalid orders aren't given
|
||||
} else if (!strcmp(tree_nodes[child].text, SEXP_ARGUMENT_STRING)) {
|
||||
for (i=0; i<Num_operators; i++) {
|
||||
if (query_operator_return_type(i) == OPR_AI_GOAL) {
|
||||
head.add_op(i);
|
||||
}
|
||||
}
|
||||
} else
|
||||
return NULL; // no valid ship or wing to check against, make nothing available
|
||||
}
|
||||
@@ -5667,6 +5752,16 @@ sexp_list_item *sexp_tree::get_listing_opf_ship_wing_point()
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_ship_wing_point_or_none()
|
||||
{
|
||||
sexp_list_item head;
|
||||
|
||||
head.add_data(SEXP_NONE_STRING);
|
||||
head.add_list(get_listing_opf_ship_wing_point());
|
||||
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_mission_name()
|
||||
{
|
||||
int i;
|
||||
@@ -5724,6 +5819,17 @@ sexp_list_item *sexp_tree::get_listing_opf_ship_wing()
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_order_recipient()
|
||||
{
|
||||
sexp_list_item head;
|
||||
|
||||
head.add_data("<all fighters>");
|
||||
|
||||
head.add_list(get_listing_opf_ship());
|
||||
head.add_list(get_listing_opf_wing());
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_ship_type()
|
||||
{
|
||||
unsigned int i;
|
||||
@@ -5987,7 +6093,7 @@ sexp_list_item *sexp_tree::get_listing_opf_background_bitmap()
|
||||
sexp_list_item head;
|
||||
int i;
|
||||
|
||||
for (i=0; i < stars_get_num_bitmaps(); i++)
|
||||
for (i=0; i < stars_get_num_entries(false, true); i++)
|
||||
{
|
||||
head.add_data( (char*)stars_get_name_FRED(i, false) );
|
||||
}
|
||||
@@ -6000,7 +6106,7 @@ sexp_list_item *sexp_tree::get_listing_opf_sun_bitmap()
|
||||
sexp_list_item head;
|
||||
int i;
|
||||
|
||||
for (i=0; i < stars_get_num_suns(); i++)
|
||||
for (i=0; i < stars_get_num_entries(true, true); i++)
|
||||
{
|
||||
head.add_data( (char*)stars_get_name_FRED(i, true) );
|
||||
}
|
||||
|
||||
@@ -209,9 +209,11 @@ public:
|
||||
sexp_list_item *get_listing_opf_waypoint_path();
|
||||
sexp_list_item *get_listing_opf_ship_point();
|
||||
sexp_list_item *get_listing_opf_ship_wing_point();
|
||||
sexp_list_item *get_listing_opf_ship_wing_point_or_none();
|
||||
sexp_list_item *get_listing_opf_mission_name();
|
||||
sexp_list_item *get_listing_opf_goal_name(int parent_node);
|
||||
sexp_list_item *get_listing_opf_ship_wing();
|
||||
sexp_list_item *get_listing_opf_order_recipient();
|
||||
sexp_list_item *get_listing_opf_ship_type();
|
||||
sexp_list_item *get_listing_opf_keypress();
|
||||
sexp_list_item *get_listing_opf_event_name(int parent_node);
|
||||
|
||||
@@ -519,6 +519,9 @@ void CShipEditorDlg::DoDataExchange(CDataExchange* pDX)
|
||||
|
||||
GetDlgItem(IDC_SCORE)->GetWindowText(str);
|
||||
m_score.init(atoi(str));
|
||||
|
||||
GetDlgItem(IDC_ASSIST_SCORE)->GetWindowText(str);
|
||||
m_assist_score.init(atoi(str));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -632,6 +635,7 @@ BOOL CShipEditorDlg::Create()
|
||||
}
|
||||
|
||||
m_score.setup(IDC_SCORE, this);
|
||||
m_assist_score.setup(IDC_ASSIST_SCORE, this);
|
||||
m_arrival_dist.setup(IDC_ARRIVAL_DISTANCE, this);
|
||||
m_arrival_delay.setup(IDC_ARRIVAL_DELAY, this);
|
||||
m_departure_delay.setup(IDC_DEPARTURE_DELAY, this);
|
||||
@@ -906,6 +910,7 @@ void CShipEditorDlg::initialize_data(int full_update)
|
||||
m_cargo1 = Cargo_names[cargo];
|
||||
m_hotkey = Ships[i].hotkey + 1;
|
||||
m_score.init(Ships[i].score);
|
||||
m_assist_score.init((int)(Ships[i].assist_score_pct*100));
|
||||
|
||||
m_persona = Ships[i].persona_index + 1;
|
||||
|
||||
@@ -939,6 +944,7 @@ void CShipEditorDlg::initialize_data(int full_update)
|
||||
}
|
||||
|
||||
m_score.set(Ships[i].score);
|
||||
m_assist_score.set((int)(Ships[i].assist_score_pct*100));
|
||||
|
||||
if (Ships[i].hotkey != m_hotkey - 1){
|
||||
m_hotkey = -1;
|
||||
@@ -1043,6 +1049,7 @@ void CShipEditorDlg::initialize_data(int full_update)
|
||||
m_cargo1 = _T("");
|
||||
m_hotkey = 0;
|
||||
m_score.blank(); // cause control to be blank
|
||||
m_assist_score.blank();
|
||||
m_arrival_location = -1;
|
||||
m_departure_location = -1;
|
||||
m_arrival_delay.blank();
|
||||
@@ -1127,6 +1134,7 @@ void CShipEditorDlg::initialize_data(int full_update)
|
||||
}
|
||||
|
||||
m_score.display();
|
||||
m_assist_score.display();
|
||||
m_arrival_dist.display();
|
||||
m_arrival_delay.display();
|
||||
m_departure_delay.display();
|
||||
@@ -1250,6 +1258,7 @@ void CShipEditorDlg::initialize_data(int full_update)
|
||||
GetDlgItem(IDC_DELETE_SHIP)->EnableWindow(enable);
|
||||
GetDlgItem(IDC_SHIP_RESET)->EnableWindow(enable);
|
||||
GetDlgItem(IDC_SCORE)->EnableWindow(enable);
|
||||
GetDlgItem(IDC_ASSIST_SCORE)->EnableWindow(enable);
|
||||
|
||||
//#ifndef NDEBUG
|
||||
GetDlgItem(IDC_SHIP_TBL)->EnableWindow(m_ship_class >= 0);
|
||||
@@ -1292,11 +1301,13 @@ void CShipEditorDlg::initialize_data(int full_update)
|
||||
SetWindowText("Edit Ship");
|
||||
}
|
||||
|
||||
// setup alternate name stuff
|
||||
// setup alternate name and callsign stuff
|
||||
if(player_ship >= 0){
|
||||
ship_alt_name_init(player_ship);
|
||||
ship_callsign_init(player_ship);
|
||||
} else {
|
||||
ship_alt_name_init(single_ship);
|
||||
ship_callsign_init(single_ship);
|
||||
}
|
||||
|
||||
modified = 0;
|
||||
@@ -1443,6 +1454,7 @@ int CShipEditorDlg::update_data(int redraw)
|
||||
if (stricmp(old_name, str)) {
|
||||
update_sexp_references(old_name, str);
|
||||
ai_update_goal_references(REF_TYPE_SHIP, old_name, str);
|
||||
update_texture_replacements(old_name, str);
|
||||
for (i=0; i<Num_reinforcements; i++)
|
||||
if (!stricmp(old_name, Reinforcements[i].name)) {
|
||||
Assert(strlen(str) < NAME_LENGTH);
|
||||
@@ -1488,6 +1500,7 @@ int CShipEditorDlg::update_ship(int ship)
|
||||
// THIS DIALOG IS THE SOME OF THE WORST CODE I HAVE EVER SEEN IN MY ENTIRE LIFE.
|
||||
// IT TOOK A RIDICULOUSLY LONG AMOUNT OF TIME TO ADD 2 FUNCTIONS. OMG
|
||||
ship_alt_name_close(ship);
|
||||
ship_callsign_close(ship);
|
||||
|
||||
if ((Ships[ship].ship_info_index != m_ship_class) && (m_ship_class != -1)) {
|
||||
change_ship_type(ship, m_ship_class);
|
||||
@@ -1518,6 +1531,20 @@ int CShipEditorDlg::update_ship(int ship)
|
||||
}
|
||||
|
||||
m_score.save(&Ships[ship].score);
|
||||
int temp_assist;
|
||||
m_assist_score.save(&temp_assist);
|
||||
Ships[ship].assist_score_pct = ((float)temp_assist)/100;
|
||||
// value must be a percentage
|
||||
if (Ships[ship].assist_score_pct < 0) {
|
||||
Ships[ship].assist_score_pct = 0;
|
||||
MessageBox("Assist Percentage too low. Set to 0. No score will be granted for an assist");
|
||||
}
|
||||
else if (Ships[ship].assist_score_pct > 1) {
|
||||
Ships[ship].assist_score_pct = 1;
|
||||
MessageBox("Assist Percentage too high. Set to 1. Assists well score as many points as a kill");
|
||||
|
||||
}
|
||||
|
||||
if (m_arrival_location != -1)
|
||||
MODIFY(Ships[ship].arrival_location, m_arrival_location);
|
||||
if (m_departure_location != -1)
|
||||
@@ -2321,7 +2348,6 @@ void CShipEditorDlg::ship_alt_name_close(int base_ship)
|
||||
if(cstr == CString("<none>")){
|
||||
// zero the entry
|
||||
strcpy(Fred_alt_names[base_ship], "");
|
||||
|
||||
return;
|
||||
}
|
||||
p = cstr.GetBuffer(0);
|
||||
@@ -2333,14 +2359,12 @@ void CShipEditorDlg::ship_alt_name_close(int base_ship)
|
||||
// otherwise see if it already exists
|
||||
if(mission_parse_lookup_alt(str) >= 0){
|
||||
strcpy(Fred_alt_names[base_ship], str);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// otherwise try and add it
|
||||
if(mission_parse_add_alt(str) >= 0){
|
||||
strcpy(Fred_alt_names[base_ship], str);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2349,6 +2373,90 @@ void CShipEditorDlg::ship_alt_name_close(int base_ship)
|
||||
MessageBox("Couldn't add new alternate type name. Already using too many!");
|
||||
}
|
||||
|
||||
// callsign stuff
|
||||
void CShipEditorDlg::ship_callsign_init(int base_ship)
|
||||
{
|
||||
int idx;
|
||||
CComboBox *ptr = (CComboBox*)GetDlgItem(IDC_SHIP_CALLSIGN);
|
||||
if(ptr == NULL){
|
||||
Int3();
|
||||
return;
|
||||
}
|
||||
|
||||
// multi-edit. bah
|
||||
if(multi_edit){
|
||||
GetDlgItem(IDC_SHIP_CALLSIGN)->EnableWindow(FALSE);
|
||||
return;
|
||||
}
|
||||
GetDlgItem(IDC_SHIP_CALLSIGN)->EnableWindow(TRUE);
|
||||
|
||||
// reset the combobox and add all relevant strings
|
||||
ptr->ResetContent();
|
||||
ptr->AddString("<none>");
|
||||
for(idx=0; idx<Mission_callsign_count; idx++){
|
||||
ptr->AddString(Mission_callsigns[idx]);
|
||||
}
|
||||
|
||||
// "none"
|
||||
if(base_ship < 0){
|
||||
ptr->SetCurSel(0);
|
||||
}
|
||||
|
||||
// otherwise look his stuff up
|
||||
if(strlen(Fred_callsigns[base_ship])){
|
||||
ptr->SelectString(0, Fred_callsigns[base_ship]);
|
||||
} else {
|
||||
ptr->SetCurSel(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CShipEditorDlg::ship_callsign_close(int base_ship)
|
||||
{
|
||||
CString cstr;
|
||||
char str[NAME_LENGTH+2] = "";
|
||||
char *p;
|
||||
CComboBox *ptr = (CComboBox*)GetDlgItem(IDC_SHIP_CALLSIGN);
|
||||
|
||||
if(multi_edit){
|
||||
return;
|
||||
}
|
||||
|
||||
if(ptr == NULL){
|
||||
Int3();
|
||||
return;
|
||||
}
|
||||
|
||||
// see if we have something besides "none" selected
|
||||
ptr->GetWindowText(cstr);
|
||||
if(cstr == CString("<none>")){
|
||||
// zero the entry
|
||||
strcpy(Fred_callsigns[base_ship], "");
|
||||
return;
|
||||
}
|
||||
p = cstr.GetBuffer(0);
|
||||
if(p == NULL){
|
||||
return;
|
||||
}
|
||||
strcpy(str, p);
|
||||
|
||||
// otherwise see if it already exists
|
||||
if(mission_parse_lookup_callsign(str) >= 0){
|
||||
strcpy(Fred_callsigns[base_ship], str);
|
||||
return;
|
||||
}
|
||||
|
||||
// otherwise try and add it
|
||||
if(mission_parse_add_callsign(str) >= 0){
|
||||
strcpy(Fred_callsigns[base_ship], str);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// bad - couldn't add
|
||||
strcpy(Fred_callsigns[base_ship], "");
|
||||
MessageBox("Couldn't add new callsign. Already using too many!");
|
||||
}
|
||||
|
||||
void CShipEditorDlg::OnTextures()
|
||||
{
|
||||
CShipTexturesDlg dlg_textures;
|
||||
|
||||
@@ -211,6 +211,10 @@ public:
|
||||
void ship_alt_name_init(int base_ship);
|
||||
void ship_alt_name_close(int base_ship);
|
||||
|
||||
// callsign stuff
|
||||
void ship_callsign_init(int base_ship);
|
||||
void ship_callsign_close(int base_ship);
|
||||
|
||||
BOOL Create();
|
||||
|
||||
// Dialog Data
|
||||
@@ -238,6 +242,7 @@ public:
|
||||
BOOL m_update_departure;
|
||||
numeric_edit_control m_destroy_value;
|
||||
numeric_edit_control m_score;
|
||||
numeric_edit_control m_assist_score;
|
||||
numeric_edit_control m_arrival_dist;
|
||||
numeric_edit_control m_kdamage;
|
||||
int m_arrival_target;
|
||||
|
||||
@@ -68,7 +68,6 @@ void ship_flags_dlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Control(pDX, IDC_FRIENDLY_STEALTH_INVISIBLE, m_friendly_stealth_invisible);
|
||||
DDX_Control(pDX, IDC_NAV_CARRY, m_nav_carry);
|
||||
DDX_Control(pDX, IDC_NAV_NEEDSLINK, m_nav_needslink);
|
||||
DDX_Control(pDX, IDC_ALT_AS_CALLSIGN, m_alt_as_callsign);
|
||||
DDX_Control(pDX, IDC_HIDE_SHIP_NAME, m_hide_ship_name);
|
||||
//}}AFX_DATA_MAP
|
||||
|
||||
@@ -125,7 +124,6 @@ BEGIN_MESSAGE_MAP(ship_flags_dlg, CDialog)
|
||||
ON_BN_CLICKED(IDC_FRIENDLY_STEALTH_INVISIBLE, OnFriendlyStealthInvisible)
|
||||
ON_BN_CLICKED(IDC_NAV_CARRY, OnNavCarry)
|
||||
ON_BN_CLICKED(IDC_NAV_NEEDSLINK, OnNavNeedslink)
|
||||
ON_BN_CLICKED(IDC_ALT_AS_CALLSIGN, OnAltAsCallsign)
|
||||
ON_BN_CLICKED(IDC_HIDE_SHIP_NAME, OnHideShipName)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
@@ -147,7 +145,7 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
int toggle_subsystem_scanning = 0, scannable = 0, kamikaze = 0, no_dynamic = 0, red_alert_carry = 0;
|
||||
int special_warp = 0, disable_messages = 0, guardian = 0, vaporize = 0, stealth = 0, friendly_stealth_invisible = 0;
|
||||
int no_death_scream = 0, always_death_scream = 0;
|
||||
int nav_carry = 0, nav_needslink = 0, alt_as_callsign = 0, hide_ship_name = 0;
|
||||
int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0;
|
||||
object *objp;
|
||||
ship *shipp;
|
||||
bool ship_in_wing = false;
|
||||
@@ -186,7 +184,6 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
friendly_stealth_invisible = (shipp->flags2 & SF2_FRIENDLY_STEALTH_INVIS) ? 1 : 0;
|
||||
nav_carry = (shipp->flags2 & SF2_NAVPOINT_CARRY) ? 1 : 0;
|
||||
nav_needslink = (shipp->flags2 & SF2_NAVPOINT_NEEDSLINK) ? 1 : 0;
|
||||
alt_as_callsign = (shipp->flags2 & SF2_USE_ALT_NAME_AS_CALLSIGN) ? 1 : 0;
|
||||
hide_ship_name = (shipp->flags2 & SF2_HIDE_SHIP_NAME) ? 1 : 0;
|
||||
|
||||
destroy_before_mission = (shipp->flags & SF_KILL_BEFORE_MISSION) ? 1 : 0;
|
||||
@@ -239,7 +236,6 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
friendly_stealth_invisible = tristate_set(shipp->flags2 & SF2_FRIENDLY_STEALTH_INVIS, friendly_stealth_invisible);
|
||||
nav_carry = tristate_set(shipp->flags2 & SF2_NAVPOINT_CARRY, nav_carry);
|
||||
nav_needslink = tristate_set(shipp->flags2 & SF2_NAVPOINT_NEEDSLINK, nav_needslink);
|
||||
alt_as_callsign = tristate_set(shipp->flags2 & SF2_USE_ALT_NAME_AS_CALLSIGN, alt_as_callsign);
|
||||
hide_ship_name = tristate_set(shipp->flags2 & SF2_HIDE_SHIP_NAME, hide_ship_name);
|
||||
|
||||
// check the final death time and set the internal variable according to whether or not
|
||||
@@ -306,7 +302,6 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
m_friendly_stealth_invisible.SetCheck(friendly_stealth_invisible);
|
||||
m_nav_carry.SetCheck(nav_carry);
|
||||
m_nav_needslink.SetCheck(nav_needslink);
|
||||
m_alt_as_callsign.SetCheck(alt_as_callsign);
|
||||
m_hide_ship_name.SetCheck(hide_ship_name);
|
||||
|
||||
m_kdamage.setup(IDC_KDAMAGE, this);
|
||||
@@ -784,22 +779,6 @@ void ship_flags_dlg::update_ship(int shipnum)
|
||||
break;
|
||||
}
|
||||
|
||||
switch (m_alt_as_callsign.GetCheck()) {
|
||||
case 1:
|
||||
if ( !(shipp->flags2 & SF2_USE_ALT_NAME_AS_CALLSIGN) )
|
||||
set_modified();
|
||||
|
||||
shipp->flags2 |= SF2_USE_ALT_NAME_AS_CALLSIGN;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
if ( shipp->flags2 & SF2_USE_ALT_NAME_AS_CALLSIGN )
|
||||
set_modified();
|
||||
|
||||
shipp->flags2 &= ~SF2_USE_ALT_NAME_AS_CALLSIGN;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (m_hide_ship_name.GetCheck()) {
|
||||
case 1:
|
||||
if ( !(shipp->flags2 & SF2_HIDE_SHIP_NAME) )
|
||||
@@ -1169,15 +1148,6 @@ void ship_flags_dlg::OnNavNeedslink()
|
||||
}
|
||||
}
|
||||
|
||||
void ship_flags_dlg::OnAltAsCallsign()
|
||||
{
|
||||
if (m_alt_as_callsign.GetCheck() == 1) {
|
||||
m_alt_as_callsign.SetCheck(0);
|
||||
} else {
|
||||
m_alt_as_callsign.SetCheck(1);
|
||||
}
|
||||
}
|
||||
|
||||
void ship_flags_dlg::OnHideShipName()
|
||||
{
|
||||
if (m_hide_ship_name.GetCheck() == 1) {
|
||||
|
||||
@@ -58,7 +58,6 @@ public:
|
||||
CButton m_friendly_stealth_invisible;
|
||||
CButton m_nav_carry;
|
||||
CButton m_nav_needslink;
|
||||
CButton m_alt_as_callsign;
|
||||
CButton m_hide_ship_name;
|
||||
CSpinButtonCtrl m_destroy_spin;
|
||||
numeric_edit_control m_kdamage;
|
||||
|
||||
@@ -464,7 +464,7 @@ BOOL ShipGoalsDlg::OnInitDialog()
|
||||
} else { // editing orders for all marked ships
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if ((ptr->type == OBJ_SHIP) && (ptr->flags & OF_MARKED)){
|
||||
if (((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) && (ptr->flags & OF_MARKED)){
|
||||
for (i=0; i<Ai_goal_list_size; i++){
|
||||
if (!ai_query_goal_valid(ptr->instance, Ai_goal_list[i].def)){
|
||||
valid[i] = 0;
|
||||
@@ -568,7 +568,7 @@ void ShipGoalsDlg::initialize_multi()
|
||||
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if ((ptr->type == OBJ_SHIP) && (ptr->flags & OF_MARKED)) {
|
||||
if (((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) && (ptr->flags & OF_MARKED)) {
|
||||
initialize(Ai_info[Ships[ptr->instance].ai_index].goals, ptr->instance);
|
||||
if (!flag) {
|
||||
flag = 1;
|
||||
@@ -862,7 +862,7 @@ void ShipGoalsDlg::set_item(int item, int init)
|
||||
case AI_GOAL_STAY_STILL:
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if (ptr->type == OBJ_SHIP || ptr->type == OBJ_START) {
|
||||
if ((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) {
|
||||
inst = ptr->instance;
|
||||
if (ptr->type == OBJ_SHIP)
|
||||
t = TYPE_SHIP;
|
||||
@@ -1044,7 +1044,7 @@ void ShipGoalsDlg::update()
|
||||
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if ((ptr->type == OBJ_SHIP) && (ptr->flags & OF_MARKED)) {
|
||||
if (((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) && (ptr->flags & OF_MARKED)) {
|
||||
goalp = Ai_info[Ships[ptr->instance].ai_index].goals;
|
||||
for (i=0; i<ED_MAX_GOALS; i++)
|
||||
update_item(i, 1);
|
||||
@@ -1055,7 +1055,7 @@ void ShipGoalsDlg::update()
|
||||
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if ((ptr->type == OBJ_SHIP) && (ptr->flags & OF_MARKED)) {
|
||||
if (((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) && (ptr->flags & OF_MARKED)) {
|
||||
self_ship = ptr->instance;
|
||||
goalp = Ai_info[Ships[self_ship].ai_index].goals;
|
||||
verify_orders(self_ship);
|
||||
|
||||
@@ -119,8 +119,13 @@ void CShipTexturesDlg::OnOK()
|
||||
// overwrite old stuff
|
||||
k = 0;
|
||||
write_index = 0;
|
||||
while (k<(MAX_SHIPS * MAX_MODEL_TEXTURES))
|
||||
while (k<(MAX_SHIPS * MAX_REPLACEMENT_TEXTURES))
|
||||
{
|
||||
//WMC - This loop will go on for a REALLY LONG TIME
|
||||
//I don't think we need to copy empty entries.
|
||||
if(!strlen(Fred_texture_replacements[k].ship_name))
|
||||
break;
|
||||
|
||||
if (stricmp(Fred_texture_replacements[k].ship_name, Ships[self_ship].ship_name))
|
||||
{
|
||||
// move up, but when copying, src and dest can't be the same
|
||||
@@ -167,7 +172,7 @@ BOOL CShipTexturesDlg::OnInitDialog()
|
||||
|
||||
// empty old and new fields
|
||||
texture_count = 0;
|
||||
for (i=0; i<MAX_MODEL_TEXTURES; i++)
|
||||
for (i=0; i<MAX_REPLACEMENT_TEXTURES; i++)
|
||||
{
|
||||
*old_texture_name[i] = 0;
|
||||
*new_texture_name[i] = 0;
|
||||
@@ -180,49 +185,52 @@ BOOL CShipTexturesDlg::OnInitDialog()
|
||||
// look for textures to populate the combo box
|
||||
for (i=0; i<pm->n_textures; i++)
|
||||
{
|
||||
// get texture file name
|
||||
bm_get_filename(pm->maps[i].base_map.GetOriginalTexture(), texture_file);
|
||||
|
||||
// skip blank textures
|
||||
if (!strlen(texture_file))
|
||||
continue;
|
||||
|
||||
// get rid of file extension
|
||||
p = strchr( texture_file, '.' );
|
||||
if ( p )
|
||||
for(j = 0; j < TM_NUM_TYPES; j++)
|
||||
{
|
||||
mprintf(( "ignoring extension on file '%s'\n", texture_file ));
|
||||
*p = 0;
|
||||
}
|
||||
// get texture file name
|
||||
bm_get_filename(pm->maps[i].textures[j].GetOriginalTexture(), texture_file);
|
||||
|
||||
// check for duplicate textures in list
|
||||
duplicate = -1;
|
||||
for (j=0; j<texture_count; j++)
|
||||
{
|
||||
if (!stricmp(old_texture_name[j], texture_file))
|
||||
// skip blank textures
|
||||
if (!strlen(texture_file))
|
||||
continue;
|
||||
|
||||
// get rid of file extension
|
||||
p = strchr( texture_file, '.' );
|
||||
if ( p )
|
||||
{
|
||||
duplicate = j;
|
||||
break;
|
||||
//mprintf(( "ignoring extension on file '%s'\n", texture_file ));
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
// check for duplicate textures in list
|
||||
duplicate = -1;
|
||||
for (int k=0; k<texture_count; k++)
|
||||
{
|
||||
if (!stricmp(old_texture_name[k], texture_file))
|
||||
{
|
||||
duplicate = k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (duplicate >= 0)
|
||||
continue;
|
||||
|
||||
// make old texture lowercase
|
||||
strlwr(texture_file);
|
||||
|
||||
// now add it to the box
|
||||
z = box->AddString(texture_file);
|
||||
|
||||
// and add it to the field as well
|
||||
strcpy(old_texture_name[texture_count], texture_file);
|
||||
|
||||
// increment
|
||||
texture_count++;
|
||||
|
||||
// sort
|
||||
sort_textures();
|
||||
}
|
||||
|
||||
if (duplicate >= 0)
|
||||
continue;
|
||||
|
||||
// make old texture lowercase
|
||||
strlwr(texture_file);
|
||||
|
||||
// now add it to the box
|
||||
z = box->AddString(texture_file);
|
||||
|
||||
// and add it to the field as well
|
||||
strcpy(old_texture_name[texture_count], texture_file);
|
||||
|
||||
// increment
|
||||
texture_count++;
|
||||
|
||||
// sort
|
||||
sort_textures();
|
||||
}
|
||||
|
||||
// now look for new textures
|
||||
|
||||
@@ -54,8 +54,8 @@ protected:
|
||||
|
||||
private:
|
||||
int num_model_textures;
|
||||
char old_texture_name[MAX_MODEL_TEXTURES][MAX_FILENAME_LEN];
|
||||
char new_texture_name[MAX_MODEL_TEXTURES][MAX_FILENAME_LEN];
|
||||
char old_texture_name[MAX_REPLACEMENT_TEXTURES][MAX_FILENAME_LEN];
|
||||
char new_texture_name[MAX_REPLACEMENT_TEXTURES][MAX_FILENAME_LEN];
|
||||
int query_modified();
|
||||
void sort_textures(int test = SORT_OLD);
|
||||
void swap_strings(char *str1, char *str2);
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
#include "missionui/missioncmdbrief.h"
|
||||
#include "mission/missionbriefcommon.h"
|
||||
#include "mission/missionmessage.h"
|
||||
#include "hud/hudtarget.h"
|
||||
#include "parse/sexp.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include <math.h>
|
||||
|
||||
#ifdef _DEBUG
|
||||
@@ -405,14 +407,49 @@ void VoiceActingManager::OnGenerateScript()
|
||||
entry.Replace("\r\n", "\n");
|
||||
|
||||
MMessage *message = &Messages[i + Num_builtin_messages];
|
||||
|
||||
// replace file name
|
||||
entry.Replace("$filename", message->wave_info.name);
|
||||
|
||||
// determine and replace persona
|
||||
entry.Replace("$message", message->message);
|
||||
if (message->persona_index >= 0)
|
||||
entry.Replace("$persona", Personas[message->persona_index].name);
|
||||
else
|
||||
entry.Replace("$persona", "<none>");
|
||||
entry.Replace("$sender", get_message_sender(message->name));
|
||||
|
||||
|
||||
// determine sender
|
||||
char sender[NAME_LENGTH+1];
|
||||
strcpy(sender, get_message_sender(message->name));
|
||||
int shipnum = ship_name_lookup(sender);
|
||||
|
||||
if (shipnum >= 0)
|
||||
{
|
||||
ship *shipp = &Ships[shipnum];
|
||||
|
||||
// we may have to use the callsign
|
||||
if (*Fred_callsigns[shipnum])
|
||||
{
|
||||
hud_stuff_ship_callsign(sender, shipp);
|
||||
}
|
||||
// account for hidden ship names
|
||||
else if ( ((Iff_info[shipp->team].flags & IFFF_WING_NAME_HIDDEN) && (shipp->wingnum != -1)) || (shipp->flags2 & SF2_HIDE_SHIP_NAME) )
|
||||
{
|
||||
hud_stuff_ship_class(sender, shipp);
|
||||
}
|
||||
// use the regular sender text
|
||||
else
|
||||
{
|
||||
end_string_at_first_hash_symbol(sender);
|
||||
}
|
||||
}
|
||||
|
||||
// replace sender (but print #Command as Command)
|
||||
if (*sender == '#')
|
||||
entry.Replace("$sender", &sender[1]);
|
||||
else
|
||||
entry.Replace("$sender", sender);
|
||||
|
||||
fout("%s\n\n\n", (char *) (LPCTSTR) entry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,6 +326,7 @@ int waypoint_path_dlg::update_data(int redraw)
|
||||
if (stricmp(old_name, str)) {
|
||||
update_sexp_references(old_name, str);
|
||||
ai_update_goal_references(REF_TYPE_WAYPOINT, old_name, str);
|
||||
update_texture_replacements(old_name, str);
|
||||
}
|
||||
|
||||
} else if (Objects[cur_object_index].type == OBJ_JUMP_NODE) {
|
||||
|
||||
+14
-2
@@ -337,12 +337,17 @@ void remove_wing(int wing_num)
|
||||
for (i=0; i<total; i++) {
|
||||
ptr = &Objects[wing_objects[wing_num][i]];
|
||||
if (ptr->type == OBJ_SHIP)
|
||||
remove_ship_from_wing(ptr->instance);
|
||||
remove_ship_from_wing(ptr->instance, 0);
|
||||
else if (ptr->type == OBJ_START)
|
||||
remove_player_from_wing(ptr->instance);
|
||||
remove_player_from_wing(ptr->instance, 0);
|
||||
}
|
||||
|
||||
Assert(!Wings[wing_num].wave_count);
|
||||
|
||||
Wings[wing_num].wave_count = 0;
|
||||
Wings[wing_num].wing_squad_filename[0] = '\0';
|
||||
Wings[wing_num].wing_insignia_texture = -1;
|
||||
|
||||
Ship_editor_dialog.initialize_data(1);
|
||||
Ship_editor_dialog.bypass_errors = Wing_editor_dialog.bypass_errors = 0;
|
||||
|
||||
@@ -350,6 +355,13 @@ void remove_wing(int wing_num)
|
||||
set_cur_wing(cur_wing = -1); // yes, one '=' is correct.
|
||||
}
|
||||
|
||||
free_sexp2(Wings[wing_num].arrival_cue);
|
||||
free_sexp2(Wings[wing_num].departure_cue);
|
||||
|
||||
Num_wings--;
|
||||
|
||||
update_custom_wing_indexes();
|
||||
|
||||
set_modified();
|
||||
}
|
||||
|
||||
|
||||
+24
-16
@@ -957,6 +957,7 @@ int wing_editor::update_data(int redraw)
|
||||
if (stricmp(old_name, str)) {
|
||||
update_sexp_references(old_name, str);
|
||||
ai_update_goal_references(REF_TYPE_WING, old_name, str);
|
||||
update_texture_replacements(old_name, str);
|
||||
for (i=0; i<Num_reinforcements; i++)
|
||||
if (!stricmp(old_name, Reinforcements[i].name)) {
|
||||
Assert(strlen(str) < NAME_LENGTH);
|
||||
@@ -1007,26 +1008,26 @@ void wing_editor::update_data_safe()
|
||||
|
||||
if (m_threshold >= Wings[cur_wing].wave_count) {
|
||||
m_threshold = Wings[cur_wing].wave_count - 1;
|
||||
if (!bypass_errors)
|
||||
if (!bypass_errors) {
|
||||
sprintf(buf, "Wave threshold is set too high. Value has been lowered to %d", (int) m_threshold);
|
||||
|
||||
MessageBox(buf);
|
||||
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 (!bypass_errors)
|
||||
if (!bypass_errors) {
|
||||
sprintf(buf, "Wave threshold is set too high. Value has been lowered to %d", (int) m_threshold);
|
||||
|
||||
MessageBox(buf);
|
||||
MessageBox(buf);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_waves < 1) {
|
||||
m_waves = 1;
|
||||
if (!bypass_errors)
|
||||
if (!bypass_errors) {
|
||||
sprintf(buf, "Number of waves illegal. Has been set to 1.", (int) m_waves);
|
||||
|
||||
MessageBox(buf);
|
||||
MessageBox(buf);
|
||||
}
|
||||
}
|
||||
|
||||
MODIFY(Wings[cur_wing].special_ship, m_special_ship);
|
||||
@@ -1036,10 +1037,11 @@ void wing_editor::update_data_safe()
|
||||
MODIFY(Wings[cur_wing].departure_location, m_departure_location);
|
||||
MODIFY(Wings[cur_wing].arrival_delay, m_arrival_delay);
|
||||
if (m_arrival_delay_min > m_arrival_delay_max) {
|
||||
if (!bypass_errors)
|
||||
if (!bypass_errors) {
|
||||
sprintf(buf, "Arrival delay minimum greater than maximum. Value lowered to %d", m_arrival_delay_max);
|
||||
MessageBox(buf);
|
||||
}
|
||||
|
||||
MessageBox(buf);
|
||||
m_arrival_delay_min = m_arrival_delay_max;
|
||||
}
|
||||
|
||||
@@ -1054,12 +1056,14 @@ void wing_editor::update_data_safe()
|
||||
if (((m_arrival_location != ARRIVE_AT_LOCATION) && (m_arrival_location != ARRIVE_FROM_DOCK_BAY)) && (i >= 0) && !(i & SPECIAL_ARRIVAL_ANCHOR_FLAG)) {
|
||||
d = int(min(500, 2.0f * Objects[Ships[i].objnum].radius));
|
||||
if ((Wings[cur_wing].arrival_distance < d) && (Wings[cur_wing].arrival_distance > -d)) {
|
||||
if (!bypass_errors)
|
||||
if (!bypass_errors) {
|
||||
sprintf(buf, "Ship must arrive at least %d meters away from target.\n"
|
||||
"Value has been reset to this. Use with caution!\r\n"
|
||||
"Reccomended distance is %d meters.\r\n", d, (int)(2.0f * Objects[Ships[i].objnum].radius) );
|
||||
|
||||
MessageBox(buf);
|
||||
MessageBox(buf);
|
||||
}
|
||||
|
||||
if (Wings[cur_wing].arrival_distance < 0)
|
||||
Wings[cur_wing].arrival_distance = -d;
|
||||
else
|
||||
@@ -1508,17 +1512,21 @@ void wing_editor::OnSelchangeHotkey()
|
||||
|
||||
void wing_editor::OnSquadLogo()
|
||||
{
|
||||
CString pcx_filename;
|
||||
int z;
|
||||
char *Logo_ext = "Image Files (*.dds, *.pcx)|*.dds;*.pcx|"
|
||||
"DDS Files (*.dds)|*.dds|"
|
||||
"PCX Files (*.pcx)|*.pcx|"
|
||||
"All Files (*.*)|*.*|"
|
||||
"|";
|
||||
|
||||
//phreak 05/05/2003
|
||||
//this needs to be here or else the data in the dialog will revert
|
||||
//this needs to be here or else the data in the wing editor dialog will revert
|
||||
//to what it was before it was opened.
|
||||
UpdateData(TRUE);
|
||||
|
||||
// get list of squad images
|
||||
z = cfile_push_chdir(CF_TYPE_SQUAD_IMAGES);
|
||||
CFileDialog dlg(TRUE, "pcx", pcx_filename, OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR, "Pcx Files (*.pcx)|*.pcx");
|
||||
CFileDialog dlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR, Logo_ext);
|
||||
|
||||
// if we have a result
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 34 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
+453
-413
File diff suppressed because it is too large.
Load diff
@@ -199,6 +199,7 @@
|
||||
#define _FREESPACE_H
|
||||
#ifndef STAMPER_PROGRAM // because of all the dependancies, I have to do this...yuck!!! MWA 7/21/97
|
||||
|
||||
#include "camera/camera.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
#include "graphics/2d.h"
|
||||
@@ -425,10 +426,12 @@ void game_pause();
|
||||
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_post_level_init();
|
||||
extern void game_render_frame_setup(vec3d *eye_pos, matrix *eye_orient);
|
||||
extern void game_render_frame(vec3d *eye_pos, matrix *eye_orient);
|
||||
extern camid game_render_frame_setup();
|
||||
extern void game_render_frame(camid cid);
|
||||
extern void game_simulation_frame();
|
||||
extern void game_update_missiontime();
|
||||
extern void game_render_post_frame();
|
||||
|
||||
+429
-412
@@ -1,412 +1,429 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "FreeSpaceResource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include <windows.h>
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"FreeSpaceResource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include <windows.h>\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
DEBUG_MENU DIALOG DISCARDABLE 0, 0, 185, 159
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Debug Menu"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LISTBOX IDC_LIST_DEBUG,7,7,171,121,LBS_OWNERDRAWFIXED |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Ok",IDOK,7,137,171,14
|
||||
END
|
||||
|
||||
FIND_DIALOG DIALOG DISCARDABLE 0, 0, 119, 47
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Find Text"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
EDITTEXT IDC_TEXT,7,7,105,14,ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "Find",IDOK,7,26,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,62,26,50,14
|
||||
END
|
||||
|
||||
IDD_CONNECT DIALOG DISCARDABLE 0, 0, 215, 253
|
||||
STYLE DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Server"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "# Connections :",IDC_CON_COUNT,7,54,148,10
|
||||
LISTBOX IDC_CONPING,7,79,148,167,WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Address and Ping",IDC_STATIC,7,66,143,10
|
||||
PUSHBUTTON "Reset All",IDC_RESET_MULTI,162,174,46,72
|
||||
PUSHBUTTON "Kick",IDC_KICK_BUTTON,161,80,47,19
|
||||
CONTROL "",IDC_STATIC,"Static",SS_GRAYRECT,7,48,201,1
|
||||
EDITTEXT IDC_STD_NAME,64,14,144,14,ES_AUTOHSCROLL
|
||||
LTEXT "Server Name",IDC_STATIC,7,17,42,8
|
||||
EDITTEXT IDC_STD_HOST_PASSWD,64,32,144,14,ES_AUTOHSCROLL
|
||||
LTEXT "Host Password",IDC_STATIC,7,33,48,8
|
||||
PUSHBUTTON "Refresh Missions",IDC_PXO_REFRESH,161,116,47,36,
|
||||
BS_MULTILINE
|
||||
END
|
||||
|
||||
IDD_MULTI DIALOG DISCARDABLE 0, 0, 215, 253
|
||||
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
CAPTION "Multi-Player"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "Frame Cap :",10,7,28,43,8
|
||||
LTEXT "",IDC_FRAMECAP_STATIC,53,29,46,10,SS_SUNKEN
|
||||
LTEXT "Realized FPS :",IDC_STATIC_A,119,30,49,12
|
||||
LTEXT "",IDC_STANDALONE_FPS,172,29,34,11,SS_SUNKEN
|
||||
LTEXT "Mission Time :",IDC_STATIC_A2,13,91,49,12
|
||||
LTEXT "",IDC_STANDALONE_MTIME,71,90,125,11,SS_SUNKEN
|
||||
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_SUNKEN,7,43,199,
|
||||
1
|
||||
LTEXT "Mission Name :",IDC_STATIC,13,80,52,11
|
||||
LTEXT "",IDC_MISSION_NAME,71,78,125,11,SS_SUNKEN
|
||||
LTEXT "Mission Goals",IDC_STATIC,7,140,74,8
|
||||
LTEXT "Netgame Information",IDC_STATIC,133,140,66,8
|
||||
LTEXT "Max Players",IDC_STATIC,117,158,42,8
|
||||
LTEXT "Max Observers",IDC_STATIC,117,184,48,8
|
||||
LTEXT "Security",IDC_STATIC,117,210,26,8
|
||||
LTEXT "Respawns",IDC_STATIC,117,236,34,8
|
||||
LTEXT "",IDC_NG_MAXPLAYERS,178,158,28,8
|
||||
LTEXT "",IDC_NG_MAXOBSERVERS,178,184,28,8
|
||||
LTEXT "",IDC_NG_SECURITY,178,210,28,8
|
||||
LTEXT "",IDC_NG_RESPAWNS,178,236,28,8
|
||||
END
|
||||
|
||||
IDD_PLAYER_DIALOG DIALOG DISCARDABLE 0, 0, 215, 253
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Player Info"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
COMBOBOX IDC_PLAYER_LIST,77,6,112,169,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Ship Type",IDC_STATIC,7,24,38,10
|
||||
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_NOTIFY |
|
||||
SS_SUNKEN,104,24,1,54
|
||||
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_NOTIFY |
|
||||
SS_SUNKEN,7,77,201,1
|
||||
LTEXT "",IDC_PSHIP_TYPE,53,24,49,10,SS_SUNKEN
|
||||
LTEXT "Mission Stats",IDC_STATIC,133,79,44,10
|
||||
LTEXT "Primary Shots",IDC_STATIC,7,89,45,9
|
||||
LTEXT "Primary Hits",IDC_STATIC,7,100,40,9
|
||||
LTEXT "Primary BH Hits",IDC_STATIC,7,112,50,9
|
||||
LTEXT "Primary Hit %",IDC_STATIC,7,123,43,9
|
||||
LTEXT "Primary BH Hit %",IDC_STATIC,7,134,55,9
|
||||
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_NOTIFY |
|
||||
SS_SUNKEN,104,78,1,168
|
||||
LTEXT "All Time Stats",IDC_STATIC,33,79,44,10
|
||||
LTEXT "Primary Shots",IDC_STATIC,107,88,45,9
|
||||
LTEXT "Primary Hits",IDC_STATIC,107,99,40,9
|
||||
LTEXT "Primary BH Hits",IDC_STATIC,107,111,50,9
|
||||
LTEXT "Primary Hit %",IDC_STATIC,107,122,43,9
|
||||
LTEXT "Primary BH Hit %",IDC_STATIC,107,133,55,9
|
||||
LTEXT "Secondary Shots",IDC_STATIC,7,145,56,9
|
||||
LTEXT "Secondary Hits",IDC_STATIC,7,156,49,9
|
||||
LTEXT "Secondary BH Hits",IDC_STATIC,7,167,63,9
|
||||
LTEXT "Secondary Hit %",IDC_STATIC,7,177,55,9
|
||||
LTEXT "Secondary BH Hit %",IDC_STATIC,7,189,65,9
|
||||
LTEXT "Secondary Shots",IDC_STATIC,107,144,56,9
|
||||
LTEXT "Secondary Hits",IDC_STATIC,107,155,49,9
|
||||
LTEXT "Secondary BH Hits",IDC_STATIC,107,166,63,9
|
||||
LTEXT "Secondary Hit %",IDC_STATIC,107,176,55,9
|
||||
LTEXT "Secondary BH Hit %",IDC_STATIC,107,187,65,9
|
||||
LTEXT "",IDC_PSHOTS,75,90,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_PHITS,75,101,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_PBHHITS,75,112,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_PPCT,75,123,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_PBHPCT,75,134,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_SSHOTS,75,145,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_SECHITS,75,156,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_SBHHITS,75,166,28,9,SS_SUNKEN
|
||||
LTEXT "",IDC_SPCT,75,178,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_SBHPCT,75,190,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MPSHOTS,180,89,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MPHITS,180,100,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MPBHHITS,180,111,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MPPCT,180,122,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MPBHPCT,180,134,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MSSHOTS,180,145,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MSECHITS,180,156,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MSBHHITS,180,167,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MSPCT,180,178,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MSBHPCT,180,189,28,8,SS_SUNKEN
|
||||
CONTROL "",IDC_PINFO_PING,"Static",SS_WHITERECT | SS_NOTIFY |
|
||||
SS_SUNKEN,7,215,201,1
|
||||
LTEXT "Player",IDC_STATIC,44,6,20,8
|
||||
LTEXT "",IDC_PING_TIME,53,38,49,10,SS_SUNKEN
|
||||
LTEXT "Avg Ping",IDC_STATIC,7,38,32,9
|
||||
LTEXT "Assists",IDC_STATIC,7,200,54,10
|
||||
LTEXT "Assists",IDC_STATIC,107,200,54,10
|
||||
LTEXT "",IDC_ASSISTS,75,201,28,9,SS_SUNKEN
|
||||
LTEXT "",IDC_MASSISTS,180,200,28,9,SS_SUNKEN
|
||||
END
|
||||
|
||||
IDD_GODSTUFF DIALOG DISCARDABLE 0, 0, 215, 253
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "God Stuff"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
COMBOBOX IDC_PLAYER_GOD_LIST,39,7,101,211,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "",IDC_GODSTUFF_FPS,177,7,31,8,SS_SUNKEN
|
||||
LTEXT "FPS",IDC_STATIC,154,7,16,8
|
||||
LTEXT "Player ",IDC_STATIC,7,7,20,12
|
||||
EDITTEXT IDC_GODSTUFF_BROADCAST,7,47,201,12,ES_MULTILINE
|
||||
LTEXT "Server Message",IDC_STATIC,7,39,54,8
|
||||
PUSHBUTTON "Send",IDC_GODSTUFF_SENDMESS,7,59,70,13
|
||||
LISTBOX IDC_GOD_CHAT,7,84,201,162,LBS_NOINTEGRALHEIGHT |
|
||||
LBS_NOSEL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
IDD_DEBUG_DIALOG DIALOG DISCARDABLE 0, 0, 215, 253
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Debug"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "Standalone State :",IDC_STATIC,7,7,61,11
|
||||
LTEXT "",IDC_STANDALONE_STATE,71,7,125,11,SS_SUNKEN
|
||||
END
|
||||
|
||||
IDD_GEN DIALOG DISCARDABLE 0, 0, 186, 95
|
||||
STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_VISIBLE |
|
||||
WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CTEXT "",IDC_FIELD1,27,11,136,8
|
||||
CTEXT "",IDC_FIELD2,28,30,130,8
|
||||
CTEXT "",IDC_FIELD3,27,49,138,8
|
||||
END
|
||||
|
||||
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 95
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
"DEBUG_MENU", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 178
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 152
|
||||
END
|
||||
|
||||
"FIND_DIALOG", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 112
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 40
|
||||
END
|
||||
|
||||
IDD_CONNECT, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 208
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 246
|
||||
END
|
||||
|
||||
IDD_MULTI, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 206
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 246
|
||||
END
|
||||
|
||||
IDD_PLAYER_DIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 208
|
||||
TOPMARGIN, 6
|
||||
BOTTOMMARGIN, 246
|
||||
END
|
||||
|
||||
IDD_GODSTUFF, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 208
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 246
|
||||
END
|
||||
|
||||
IDD_DEBUG_DIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 208
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 246
|
||||
END
|
||||
|
||||
IDD_GEN, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 179
|
||||
TOPMARGIN, 5
|
||||
BOTTOMMARGIN, 88
|
||||
END
|
||||
|
||||
IDD_DIALOG1, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 179
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 88
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,1
|
||||
PRODUCTVERSION 1,0,0,1
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Volition Inc.\0"
|
||||
VALUE "FileDescription", "FreeSpace\0"
|
||||
VALUE "FileVersion", "1.03.01\0"
|
||||
VALUE "InternalName", "FreeSpace\0"
|
||||
VALUE "LegalCopyright", "Copyright © 1998\0"
|
||||
VALUE "OriginalFilename", "fs.exe\0"
|
||||
VALUE "ProductName", "FreeSpace\0"
|
||||
VALUE "ProductVersion", "1.03.01\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // !_MAC
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDB_GOAL_INC BITMAP DISCARDABLE "goal_inc.bmp"
|
||||
IDB_GOAL_COMP BITMAP DISCARDABLE "goal_com.bmp"
|
||||
IDB_GOAL_ORD BITMAP DISCARDABLE "goal_ord.bmp"
|
||||
IDB_GOAL_NONE BITMAP DISCARDABLE "goal_none.bmp"
|
||||
IDB_GOAL_FAIL BITMAP DISCARDABLE "goal_fail.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_APP_ICON ICON DISCARDABLE "app_icon.ico"
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.K.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#endif // English (U.K.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SRGRAMMAR
|
||||
//
|
||||
|
||||
IDR_CMD_CFG SRGRAMMAR DISCARDABLE "..\..\code\sound\phrases.cfg"
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "freespaceresource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include <windows.h>
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"freespaceresource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include <windows.h>\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
DEBUG_MENU DIALOG DISCARDABLE 0, 0, 185, 159
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Debug Menu"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LISTBOX IDC_LIST_DEBUG,7,7,171,121,LBS_OWNERDRAWFIXED |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Ok",IDOK,7,137,171,14
|
||||
END
|
||||
|
||||
FIND_DIALOG DIALOG DISCARDABLE 0, 0, 119, 47
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Find Text"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
EDITTEXT IDC_TEXT,7,7,105,14,ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "Find",IDOK,7,26,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,62,26,50,14
|
||||
END
|
||||
|
||||
IDD_CONNECT DIALOG DISCARDABLE 0, 0, 215, 253
|
||||
STYLE DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Server"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "# Connections :",IDC_CON_COUNT,7,54,148,10
|
||||
LISTBOX IDC_CONPING,7,79,148,167,WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Address and Ping",IDC_STATIC,7,66,143,10
|
||||
PUSHBUTTON "Reset All",IDC_RESET_MULTI,162,174,46,72
|
||||
PUSHBUTTON "Kick",IDC_KICK_BUTTON,161,80,47,19
|
||||
CONTROL "",IDC_STATIC,"Static",SS_GRAYRECT,7,48,201,1
|
||||
EDITTEXT IDC_STD_NAME,64,14,144,14,ES_AUTOHSCROLL
|
||||
LTEXT "Server Name",IDC_STATIC,7,17,42,8
|
||||
EDITTEXT IDC_STD_HOST_PASSWD,64,32,144,14,ES_AUTOHSCROLL
|
||||
LTEXT "Host Password",IDC_STATIC,7,33,48,8
|
||||
PUSHBUTTON "Refresh Missions",IDC_PXO_REFRESH,161,116,47,36,
|
||||
BS_MULTILINE
|
||||
END
|
||||
|
||||
IDD_MULTI DIALOG DISCARDABLE 0, 0, 215, 253
|
||||
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
CAPTION "Multi-Player"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "Frame Cap :",10,7,28,43,8
|
||||
LTEXT "",IDC_FRAMECAP_STATIC,53,29,46,10,SS_SUNKEN
|
||||
LTEXT "Realized FPS :",IDC_STATIC_A,119,30,49,12
|
||||
LTEXT "",IDC_STANDALONE_FPS,172,29,34,11,SS_SUNKEN
|
||||
LTEXT "Mission Time :",IDC_STATIC_A2,13,91,49,12
|
||||
LTEXT "",IDC_STANDALONE_MTIME,71,90,125,11,SS_SUNKEN
|
||||
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_SUNKEN,7,43,199,
|
||||
1
|
||||
LTEXT "Mission Name :",IDC_STATIC,13,80,52,11
|
||||
LTEXT "",IDC_MISSION_NAME,71,78,125,11,SS_SUNKEN
|
||||
LTEXT "Mission Goals",IDC_STATIC,7,140,74,8
|
||||
LTEXT "Netgame Information",IDC_STATIC,133,140,66,8
|
||||
LTEXT "Max Players",IDC_STATIC,117,158,42,8
|
||||
LTEXT "Max Observers",IDC_STATIC,117,184,48,8
|
||||
LTEXT "Security",IDC_STATIC,117,210,26,8
|
||||
LTEXT "Respawns",IDC_STATIC,117,236,34,8
|
||||
LTEXT "",IDC_NG_MAXPLAYERS,178,158,28,8
|
||||
LTEXT "",IDC_NG_MAXOBSERVERS,178,184,28,8
|
||||
LTEXT "",IDC_NG_SECURITY,178,210,28,8
|
||||
LTEXT "",IDC_NG_RESPAWNS,178,236,28,8
|
||||
END
|
||||
|
||||
IDD_PLAYER_DIALOG DIALOG DISCARDABLE 0, 0, 215, 253
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Player Info"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
COMBOBOX IDC_PLAYER_LIST,77,6,112,169,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Ship Type",IDC_STATIC,7,24,38,10
|
||||
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_NOTIFY |
|
||||
SS_SUNKEN,7,55,201,1
|
||||
LTEXT "",IDC_PSHIP_TYPE,53,24,49,10,SS_SUNKEN
|
||||
LTEXT "Mission Stats",IDC_STATIC,133,59,44,10
|
||||
LTEXT "Primary Shots",IDC_STATIC,7,118,45,9
|
||||
LTEXT "Primary Hits",IDC_STATIC,7,129,40,9
|
||||
LTEXT "Primary BH Hits",IDC_STATIC,7,140,50,9
|
||||
LTEXT "Primary Hit %",IDC_STATIC,7,151,43,9
|
||||
LTEXT "Primary BH Hit %",IDC_STATIC,7,162,55,9
|
||||
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT | SS_NOTIFY |
|
||||
SS_SUNKEN,106,24,1,222
|
||||
LTEXT "All Time Stats",IDC_STATIC,33,59,44,10
|
||||
LTEXT "Primary Shots",IDC_STATIC,109,118,45,9
|
||||
LTEXT "Primary Hits",IDC_STATIC,109,129,40,9
|
||||
LTEXT "Primary BH Hits",IDC_STATIC,109,140,50,9
|
||||
LTEXT "Primary Hit %",IDC_STATIC,109,151,43,9
|
||||
LTEXT "Primary BH Hit %",IDC_STATIC,109,162,55,9
|
||||
LTEXT "Secondary Shots",IDC_STATIC,7,173,56,9
|
||||
LTEXT "Secondary Hits",IDC_STATIC,7,184,49,9
|
||||
LTEXT "Secondary BH Hits",IDC_STATIC,7,195,63,9
|
||||
LTEXT "Secondary Hit %",IDC_STATIC,7,206,55,9
|
||||
LTEXT "Secondary BH Hit %",IDC_STATIC,7,217,65,9
|
||||
LTEXT "Secondary Shots",IDC_STATIC,109,173,56,9
|
||||
LTEXT "Secondary Hits",IDC_STATIC,109,184,49,9
|
||||
LTEXT "Secondary BH Hits",IDC_STATIC,109,195,63,9
|
||||
LTEXT "Secondary Hit %",IDC_STATIC,109,206,55,9
|
||||
LTEXT "Secondary BH Hit %",IDC_STATIC,109,217,65,9
|
||||
LTEXT "",IDC_PSHOTS,75,118,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_PHITS,75,129,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_PBHHITS,75,140,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_PPCT,75,151,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_PBHPCT,75,162,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_SSHOTS,75,173,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_SECHITS,75,184,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_SBHHITS,75,195,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_SPCT,75,206,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_SBHPCT,75,217,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MPSHOTS,180,118,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MPHITS,180,129,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MPBHHITS,180,140,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MPPCT,180,151,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MPBHPCT,180,162,28,9,SS_SUNKEN
|
||||
LTEXT "",IDC_MSSHOTS,180,173,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MSECHITS,180,184,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MSBHHITS,180,195,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MSPCT,180,206,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MSBHPCT,180,217,28,8,SS_SUNKEN
|
||||
CONTROL "",IDC_PINFO_PING,"Static",SS_WHITERECT | SS_NOTIFY |
|
||||
SS_SUNKEN,7,235,201,1
|
||||
LTEXT "Player",IDC_STATIC,44,6,20,8
|
||||
LTEXT "",IDC_PING_TIME,53,38,49,10,SS_SUNKEN
|
||||
LTEXT "Avg Ping",IDC_STATIC,7,38,32,9
|
||||
LTEXT "Assists",IDC_STATIC,7,107,54,10
|
||||
LTEXT "Assists",IDC_STATIC,109,107,54,10
|
||||
LTEXT "",IDC_ASSISTS,75,107,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MASSISTS,180,107,28,8,SS_SUNKEN
|
||||
LTEXT "Score",IDC_STATIC,7,73,20,8
|
||||
LTEXT "Score",IDC_STATIC,109,73,20,8
|
||||
LTEXT "Kills",IDC_STATIC,7,84,13,8
|
||||
LTEXT "Kills",IDC_STATIC,109,84,13,8
|
||||
LTEXT "Friendly Kills",IDC_STATIC,109,96,39,8
|
||||
LTEXT "Friendly Kills",IDC_STATIC,7,96,39,8
|
||||
LTEXT "",IDC_SCORE,75,74,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_KILL_COUNT,75,85,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_KILL_COUNT_BH,75,96,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MSCORE,180,74,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MKILL_COUNT,180,85,28,8,SS_SUNKEN
|
||||
LTEXT "",IDC_MKILL_COUNT_BH,180,96,28,8,SS_SUNKEN
|
||||
END
|
||||
|
||||
IDD_GODSTUFF DIALOG DISCARDABLE 0, 0, 215, 253
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "God Stuff"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
COMBOBOX IDC_PLAYER_GOD_LIST,39,7,101,211,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "",IDC_GODSTUFF_FPS,177,7,31,8,SS_SUNKEN
|
||||
LTEXT "FPS",IDC_STATIC,154,7,16,8
|
||||
LTEXT "Player ",IDC_STATIC,7,7,20,12
|
||||
EDITTEXT IDC_GODSTUFF_BROADCAST,7,47,201,12,ES_MULTILINE
|
||||
LTEXT "Server Message",IDC_STATIC,7,39,54,8
|
||||
PUSHBUTTON "Send",IDC_GODSTUFF_SENDMESS,7,59,70,13
|
||||
LISTBOX IDC_GOD_CHAT,7,84,201,162,LBS_NOINTEGRALHEIGHT |
|
||||
LBS_NOSEL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
IDD_DEBUG_DIALOG DIALOG DISCARDABLE 0, 0, 215, 253
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Debug"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "Standalone State :",IDC_STATIC,7,7,61,11
|
||||
LTEXT "",IDC_STANDALONE_STATE,71,7,125,11,SS_SUNKEN
|
||||
LTEXT "Multi log:",IDC_STATIC,8,26,29,8
|
||||
LISTBOX IDC_MULTILOG,7,37,201,209,NOT LBS_NOTIFY |
|
||||
LBS_NOINTEGRALHEIGHT | LBS_NOSEL | WS_VSCROLL |
|
||||
WS_HSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
IDD_GEN DIALOG DISCARDABLE 0, 0, 186, 95
|
||||
STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_VISIBLE |
|
||||
WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CTEXT "",IDC_FIELD1,27,11,136,8
|
||||
CTEXT "",IDC_FIELD2,28,30,130,8
|
||||
CTEXT "",IDC_FIELD3,27,49,138,8
|
||||
END
|
||||
|
||||
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 95
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
"DEBUG_MENU", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 178
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 152
|
||||
END
|
||||
|
||||
"FIND_DIALOG", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 112
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 40
|
||||
END
|
||||
|
||||
IDD_CONNECT, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 208
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 246
|
||||
END
|
||||
|
||||
IDD_MULTI, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 206
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 246
|
||||
END
|
||||
|
||||
IDD_PLAYER_DIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 208
|
||||
TOPMARGIN, 6
|
||||
BOTTOMMARGIN, 246
|
||||
END
|
||||
|
||||
IDD_GODSTUFF, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 208
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 246
|
||||
END
|
||||
|
||||
IDD_DEBUG_DIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 208
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 246
|
||||
END
|
||||
|
||||
IDD_GEN, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 179
|
||||
TOPMARGIN, 5
|
||||
BOTTOMMARGIN, 88
|
||||
END
|
||||
|
||||
IDD_DIALOG1, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 179
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 88
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,1
|
||||
PRODUCTVERSION 1,0,0,1
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Volition Inc.\0"
|
||||
VALUE "FileDescription", "FreeSpace\0"
|
||||
VALUE "FileVersion", "1.03.01\0"
|
||||
VALUE "InternalName", "FreeSpace\0"
|
||||
VALUE "LegalCopyright", "Copyright © 1998\0"
|
||||
VALUE "OriginalFilename", "fs.exe\0"
|
||||
VALUE "ProductName", "FreeSpace\0"
|
||||
VALUE "ProductVersion", "1.03.01\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // !_MAC
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDB_GOAL_INC BITMAP DISCARDABLE "goal_inc.bmp"
|
||||
IDB_GOAL_COMP BITMAP DISCARDABLE "goal_com.bmp"
|
||||
IDB_GOAL_ORD BITMAP DISCARDABLE "goal_ord.bmp"
|
||||
IDB_GOAL_NONE BITMAP DISCARDABLE "goal_none.bmp"
|
||||
IDB_GOAL_FAIL BITMAP DISCARDABLE "goal_fail.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_APP_ICON ICON DISCARDABLE "app_icon.ico"
|
||||
IDI_APP_ICON_GLOW ICON DISCARDABLE "app_icon_glow.ico"
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.K.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#endif // English (U.K.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SRGRAMMAR
|
||||
//
|
||||
|
||||
#ifdef FS2_VOICER
|
||||
IDR_CMD_CFG SRGRAMMAR DISCARDABLE "..\..\code\sound\phrases.cfg"
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by FreeSpace.rc
|
||||
// Used by freespace.rc
|
||||
//
|
||||
#define IDD_DEBUG_MENU 101
|
||||
#define IDD_CONNECT 108
|
||||
@@ -16,6 +16,7 @@
|
||||
#define IDB_GOAL_NONE 121
|
||||
#define IDB_GOAL_FAIL 122
|
||||
#define IDI_APP_ICON 124
|
||||
#define IDI_APP_ICON_GLOW 125
|
||||
#define IDD_GEN 127
|
||||
#define IDD_RT_VSELECT 128
|
||||
#define IDD_DIALOG1 129
|
||||
@@ -81,6 +82,13 @@
|
||||
#define IDC_COMBO_AATYPE 1071
|
||||
#define ID_CANCEL 1072
|
||||
#define ID_OK 1073
|
||||
#define IDC_SCORE 1074
|
||||
#define IDC_KILL_COUNT 1075
|
||||
#define IDC_KILL_COUNT_BH 1076
|
||||
#define IDC_MSCORE 1077
|
||||
#define IDC_MKILL_COUNT 1078
|
||||
#define IDC_MKILL_COUNT_BH 1079
|
||||
#define IDC_MULTILOG 1084
|
||||
#define IDC_CON_COUNT 2000
|
||||
#define IDC_FRAMECAP_STATIC 2001
|
||||
#define IDC_GODSTUFF_FPS 2002
|
||||
@@ -95,7 +103,7 @@
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 133
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1074
|
||||
#define _APS_NEXT_CONTROL_VALUE 1085
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
+713
-587
File diff suppressed because it is too large.
Load diff
@@ -23,6 +23,8 @@
|
||||
#ifndef _FS2NETD_CLIENT_H
|
||||
#define _FS2NETD_CLIENT_H
|
||||
|
||||
#include "network/multi.h"
|
||||
|
||||
struct net_addr;
|
||||
struct player;
|
||||
|
||||
@@ -32,6 +34,30 @@ extern char Multi_fs_tracker_channel[];
|
||||
// channel to use when polling the tracker for games
|
||||
extern char Multi_fs_tracker_filter[];
|
||||
|
||||
typedef struct tracker_game_data {
|
||||
char name[MAX_GAMENAME_LEN+1];
|
||||
char mission_name[MAX_GAMENAME_LEN+1];
|
||||
char title[NAME_LENGTH+1];
|
||||
char campaign_name[NAME_LENGTH+1];
|
||||
char chat_channel[MAX_PATH+1];
|
||||
|
||||
ubyte campaign_mode;
|
||||
int flags;
|
||||
int type_flags;
|
||||
short players;
|
||||
short max_players;
|
||||
ubyte mode;
|
||||
ubyte rank_base;
|
||||
ubyte game_state;
|
||||
ubyte speed;
|
||||
} tracker_game_data;
|
||||
|
||||
extern tracker_game_data Multi_tracker_game_data;
|
||||
|
||||
|
||||
bool fs2netd_is_online();
|
||||
|
||||
void fs2netd_reset_connection();
|
||||
|
||||
void fs2netd_close();
|
||||
|
||||
@@ -41,12 +67,13 @@ void fs2netd_maybe_init();
|
||||
|
||||
void fs2netd_do_frame();
|
||||
|
||||
void fs2netd_server_send_heartbeat(bool force = false);
|
||||
void fs2netd_server_disconnect();
|
||||
void fs2netd_gameserver_start();
|
||||
void fs2netd_gameserver_update(bool force = false);
|
||||
void fs2netd_gameserver_disconnect();
|
||||
|
||||
int fs2netd_load_servers();
|
||||
void fs2netd_send_game_request();
|
||||
|
||||
void fs2netd_debrief_init();
|
||||
void fs2netd_store_stats();
|
||||
|
||||
bool fs2netd_player_banned(net_addr *addr);
|
||||
|
||||
@@ -62,7 +89,6 @@ void fs2netd_options_config_init();
|
||||
|
||||
void fs2netd_add_table_validation(char *tblname);
|
||||
|
||||
void fs2netd_update_chat_channel();
|
||||
void fs2netd_update_game_count(char *chan_name);
|
||||
|
||||
#endif // _FS2NETD_CLIENT_H
|
||||
+16
-230
@@ -73,6 +73,8 @@
|
||||
|
||||
|
||||
// Packet IDs
|
||||
#define PCKT_ID_FIRST 0x00
|
||||
|
||||
#define PCKT_SLIST_REQUEST 0x01
|
||||
#define PCKT_SLIST_REPLY 0x02
|
||||
#define PCKT_SLIST_HB 0x03
|
||||
@@ -100,12 +102,21 @@
|
||||
#define PCKT_CHAT_CHAN_COUNT_RQST 0x18
|
||||
#define PCKT_CHAT_CHAN_COUNT_REPLY 0x19
|
||||
#define PCKT_SLIST_HB_2 0x1a
|
||||
#define PCKT_SLIST_DISCONNECT 0x1b
|
||||
#define PCKT_SERVER_DISCONNECT 0x1b
|
||||
#define PCKT_DUP_LOGIN_RQST 0x1c
|
||||
#define PCKT_DUP_LOGIN_REPLY 0x1d
|
||||
#define PCKT_SLIST_REQUEST_FILTER 0x1e
|
||||
#define PCKT_SERVER_START 0x1f
|
||||
|
||||
#define PCKT_SERVER_UPDATE 0x20
|
||||
|
||||
#define PCKT_ID_LAST 0x21
|
||||
|
||||
#define PCKT_INVALID 0xff
|
||||
|
||||
#define VALID_PACKET_ID(p) (((p) > PCKT_ID_FIRST) && ((p) < PCKT_ID_LAST))
|
||||
|
||||
|
||||
//***********************************************************************************************************************
|
||||
// Packet Structures
|
||||
//***********************************************************************************************************************
|
||||
|
||||
struct crc_valid_status {
|
||||
char name[NAME_LENGTH];
|
||||
@@ -113,242 +124,17 @@ struct crc_valid_status {
|
||||
ubyte valid;
|
||||
};
|
||||
|
||||
/* ----- Server List -----
|
||||
|
||||
//this one is sent Client->Server and when the Server receives it sends back the server list to the sender of this packet
|
||||
struct serverlist_request_packet
|
||||
{
|
||||
int type; // so you can request only servers of a certain time
|
||||
int status; // so you can request only servers of a certain status
|
||||
};
|
||||
|
||||
//a server sends this UDP packet to the server every 60 seconds has a "Heartbeat" telling the server it's here -
|
||||
// if one isn't received for 120 seconds the server is dropped from the list
|
||||
struct serverlist_hb_packet
|
||||
{
|
||||
char name[65];
|
||||
char mission_name[65];
|
||||
char title[65];
|
||||
short players;
|
||||
int flags;
|
||||
ushort port;
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
//the server list will be sent one server at a time - each server being on UDP packet containing this
|
||||
// a terminator will be sent with the following values
|
||||
// servername = "TERM"
|
||||
// netspeed = status = players = type = 0
|
||||
|
||||
typedef struct serverlist_reply_packet
|
||||
{
|
||||
// char name[65];
|
||||
// char mission_name[65];
|
||||
// char title[65];
|
||||
// short players;
|
||||
int flags;
|
||||
|
||||
char ip[16]; // "255.255.255.255"
|
||||
ushort port;
|
||||
} net_server;
|
||||
|
||||
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
|
||||
/* ----- Logins -----
|
||||
|
||||
//login request
|
||||
struct fs2open_pxo_login
|
||||
{
|
||||
char username[65];
|
||||
char password[65];
|
||||
};
|
||||
|
||||
//and the reply
|
||||
struct fs2open_pxo_lreply
|
||||
{
|
||||
ubyte login_status; // true if successful, false if failed
|
||||
int sid; // if (login_status) sid = session id, ip associated and expires after 1 hour
|
||||
short pilots; // if (login_status) pilots = number of pilots for this account
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
|
||||
/* ----- Missions & Tables -----
|
||||
|
||||
struct fs2open_file_check_single
|
||||
{
|
||||
char name[60];
|
||||
unsigned int crc32;
|
||||
};
|
||||
|
||||
struct fs2open_fcheck_reply
|
||||
{
|
||||
ubyte status; // 1 = valid, 0 = invalid
|
||||
};
|
||||
|
||||
//request
|
||||
|
||||
struct fs2open_file_check
|
||||
{
|
||||
ubyte pid; // 0x5 for missions 0x7 for tables ( PCKT_MISSIONS_RQST / PCKT_TABLES_RQST )
|
||||
};
|
||||
|
||||
//reply
|
||||
struct fs2open_pxo_missreply
|
||||
{
|
||||
ubyte pid;
|
||||
int num_files;
|
||||
file_record *files;
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
struct file_record
|
||||
{
|
||||
char name[60];
|
||||
char name[33];
|
||||
uint crc32;
|
||||
};
|
||||
|
||||
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
|
||||
|
||||
/* ----- Pilot Management -----
|
||||
|
||||
struct fs2open_get_pilot
|
||||
{
|
||||
ubyte pid; // 0x9 ( PCKT_PILOT_GET )
|
||||
int sid; // session id returned upon login
|
||||
char pilotname[65];
|
||||
ubyte create; // create pilot
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
struct fs2open_ship_typekill
|
||||
{
|
||||
char name[NAME_LENGTH];
|
||||
ushort kills;
|
||||
};
|
||||
|
||||
/*
|
||||
struct fs2open_pilot_reply
|
||||
{
|
||||
ubyte pid; // 0x0A (PCKT_PILOT_REPLY)
|
||||
int replytype; // 0 = pilot retrieved, 1 = pilot created, 2 = invalid pilot, 3 = invalid (expired?) sid, 4 = pilot already exists
|
||||
|
||||
// if and only if (replytype == 0) then the rest of this data
|
||||
|
||||
uint points;
|
||||
uint missions;
|
||||
uint flighttime;
|
||||
uint LastFlight;
|
||||
uint Kills;
|
||||
uint Assists;
|
||||
uint NonFriendlyKills;
|
||||
uint PriShots;
|
||||
uint PriHits;
|
||||
uint PriFHits;
|
||||
uint SecShots;
|
||||
uint SecHits;
|
||||
uint SecFHits;
|
||||
|
||||
int rank;
|
||||
|
||||
int num_medals;
|
||||
|
||||
//fs2open_ship_typekill *type_kills;
|
||||
//uint ship_types;
|
||||
//int *medals;
|
||||
};
|
||||
|
||||
struct fs2open_pilot_update
|
||||
{
|
||||
ubyte pid; // 0x0B (PCKT_PILOT_UPDATE)
|
||||
int sid; // session id
|
||||
|
||||
char name[65];
|
||||
char user[65];
|
||||
|
||||
int points;
|
||||
uint missions;
|
||||
uint flighttime;
|
||||
int LastFlight;
|
||||
int Kills;
|
||||
int Assists;
|
||||
int NonFriendlyKills;
|
||||
uint PriShots;
|
||||
uint PriHits;
|
||||
uint PriFHits;
|
||||
uint SecShots;
|
||||
uint SecHits;
|
||||
uint SecFHits;
|
||||
int rank;
|
||||
|
||||
int num_medals;
|
||||
|
||||
//fs2open_ship_typekill *type_kills;
|
||||
//uint ship_types;
|
||||
//int *medals;
|
||||
};
|
||||
|
||||
struct fs2open_pilot_updatereply
|
||||
{
|
||||
ubyte pid; // 0x0C (PCKT_PILOT_UREPLY)
|
||||
ubyte replytype; // 0 = pilot updated, 1 = invalid pilot, 2 = invalid (expired?) sid
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
/* ---------------- Generic Ping -----------------
|
||||
|
||||
// ping time is in ticks returned by clock()
|
||||
struct fs2open_ping
|
||||
{
|
||||
int time;
|
||||
};
|
||||
|
||||
struct fs2open_pingreply
|
||||
{
|
||||
int time;
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
/* ---------------- Banlist Packets -----------------
|
||||
|
||||
struct fs2open_banlist_request
|
||||
{
|
||||
ubyte pid; // 0x11 (PCKT_BANLIST_RQST)
|
||||
int reserved;
|
||||
};
|
||||
|
||||
struct fs2open_banlist_reply
|
||||
{
|
||||
ubyte pid; // 0x12 (PCKT_BANLIST_RPLY)
|
||||
int num_ban_masks;
|
||||
fs2open_banmask* masks;
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
struct fs2open_banmask
|
||||
{
|
||||
char ip_mask[16]; // up to 15 chars (123.123.123.123) and a NULL
|
||||
};
|
||||
|
||||
// ---------------- Global Message Packet -----------------
|
||||
|
||||
|
||||
struct fs2open_network_wall
|
||||
{
|
||||
ubyte pid; // 0x13 (PCKT_NETOWRK_WALL)
|
||||
char message[252];
|
||||
};
|
||||
|
||||
#endif
|
||||
+474
-521
File diff suppressed because it is too large.
Load diff
+28
-22
@@ -83,35 +83,41 @@
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
//#pragma warning(disable:4018) // signed/unsigned mismatch
|
||||
//#pragma warning(disable:4245) // signed/unsigned mismatch in conversion of const value
|
||||
|
||||
|
||||
#define MAX_SERVERS 150
|
||||
#include "fs2netd/protocol.h"
|
||||
#include "fs2netd/tcp_socket.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
struct player;
|
||||
struct netgame_info;
|
||||
|
||||
int FS2NetD_SendPlayerData(int SID, const char* player_name, const char* user, player *pl, int timeout = 15);
|
||||
int FS2NetD_GetPlayerData(int SID, const char* player_name, player *pl, bool CanCreate = false, int timeout = 15);
|
||||
int FS2NetD_CheckSingleMission(const char *m_name, uint crc32, int timeout = 15);
|
||||
int FS2NetD_CheckValidSID(int SID);
|
||||
int FS2NetD_GetServerList(int timeout = 15);
|
||||
void FS2NetD_Ping();
|
||||
void FS2NetD_SendHeartBeat();
|
||||
void FS2NetD_SendServerDisconnect(ushort port);
|
||||
int FS2NetD_Login(const char *username, const char *password, int timeout = 15);
|
||||
void FS2NetD_Pong(int tstamp);
|
||||
int FS2NetD_ValidateTableList(int timeout = 30);
|
||||
void FS2NetD_ChatChannelUpdate(char *chan_name);
|
||||
void FS2NetD_GameCountUpdate(char *chan_name);
|
||||
fs2open_banmask *FS2NetD_GetBanList(int *numBanMasks, int timeout = 15);
|
||||
|
||||
// longer timeouts - mySQL operations
|
||||
//file_record *FS2NetD_GetTablesList(int *numTables, int timeout = 30);
|
||||
file_record *FS2NetD_GetMissionsList(int *numMissions, int timeout = 30);
|
||||
int FS2NetD_CheckSingleMission(const char *m_name, uint crc32, bool do_send);
|
||||
|
||||
int FS2NetD_SendPlayerData(const char *player_name, player *pl, bool do_send);
|
||||
int FS2NetD_GetPlayerData(const char *player_name, player *pl, bool can_create, bool do_send);
|
||||
|
||||
int FS2NetD_GetBanList(std::vector<std::string> &mask_list, bool do_send);
|
||||
|
||||
int FS2NetD_GetMissionsList(std::vector<file_record> &m_list, bool do_send);
|
||||
|
||||
int FS2NetD_ValidateTableList(bool do_send);
|
||||
|
||||
int FS2NetD_Login(const char *username, const char *password, bool do_send);
|
||||
int FS2NetD_CheckValidID();
|
||||
void FS2NetD_CheckDuplicateLogin();
|
||||
|
||||
void FS2NetD_SendServerStart();
|
||||
void FS2NetD_SendServerUpdate();
|
||||
void FS2NetD_SendServerDisconnect();
|
||||
|
||||
void FS2NetD_RequestServerList();
|
||||
|
||||
void FS2NetD_GameCountUpdate(char *chan_name);
|
||||
|
||||
void FS2NetD_Ping();
|
||||
void FS2NetD_Pong(int tstamp);
|
||||
|
||||
|
||||
|
||||
|
||||
+42
-60
@@ -125,31 +125,27 @@
|
||||
typedef int socklen_t;
|
||||
#endif
|
||||
|
||||
#if !defined(CLOSEFUNC)
|
||||
#define CLOSEFUNC closesocket
|
||||
#endif
|
||||
|
||||
#if !defined(STYPE)
|
||||
#define STYPE SOCKET
|
||||
#endif
|
||||
|
||||
|
||||
static bool Connecting = false;
|
||||
static bool Connected = false;
|
||||
static STYPE mySocket;
|
||||
static SOCKET mySocket = INVALID_SOCKET;
|
||||
|
||||
static sockaddr_in PXO_addr;
|
||||
static sockaddr_in FS2NetD_addr;
|
||||
|
||||
|
||||
void FS2NetD_Disconnect()
|
||||
{
|
||||
CLOSEFUNC(mySocket);
|
||||
if (mySocket != INVALID_SOCKET) {
|
||||
shutdown(mySocket, 2);
|
||||
closesocket(mySocket);
|
||||
mySocket = INVALID_SOCKET;
|
||||
}
|
||||
|
||||
Connected = false;
|
||||
Connecting = false;
|
||||
}
|
||||
|
||||
int FS2NetD_ConnectToServer(char *host, ushort port)
|
||||
int FS2NetD_ConnectToServer(const char *host, const char *port)
|
||||
{
|
||||
struct hostent *my_host = NULL;
|
||||
char host_str[5];
|
||||
@@ -167,10 +163,10 @@ int FS2NetD_ConnectToServer(char *host, ushort port)
|
||||
}
|
||||
#endif
|
||||
|
||||
memset(&PXO_addr, 0, sizeof(sockaddr_in));
|
||||
PXO_addr.sin_family = AF_INET;
|
||||
PXO_addr.sin_addr.s_addr = INADDR_ANY;
|
||||
PXO_addr.sin_port = 0;
|
||||
memset(&FS2NetD_addr, 0, sizeof(sockaddr_in));
|
||||
FS2NetD_addr.sin_family = AF_INET;
|
||||
FS2NetD_addr.sin_addr.s_addr = INADDR_ANY;
|
||||
FS2NetD_addr.sin_port = 0;
|
||||
|
||||
mySocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
|
||||
@@ -184,7 +180,7 @@ int FS2NetD_ConnectToServer(char *host, ushort port)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( bind(mySocket, (sockaddr *)&PXO_addr, sizeof(sockaddr)) == SOCKET_ERROR ) {
|
||||
if ( bind(mySocket, (sockaddr *)&FS2NetD_addr, sizeof(sockaddr)) == SOCKET_ERROR ) {
|
||||
#ifdef SCP_UNIX
|
||||
my_error = errno;
|
||||
ml_printf("FS2NetD ERROR: Couldn't bind socket (\"%s\")!", strerror(my_error));
|
||||
@@ -222,32 +218,33 @@ int FS2NetD_ConnectToServer(char *host, ushort port)
|
||||
return -1;
|
||||
}
|
||||
|
||||
PXO_addr.sin_addr.s_addr = ((in_addr *)(my_host->h_addr_list[0]))->s_addr;
|
||||
FS2NetD_addr.sin_addr.s_addr = ((in_addr *)(my_host->h_addr_list[0]))->s_addr;
|
||||
}
|
||||
// we might be in dotted format so try using it as such
|
||||
else {
|
||||
PXO_addr.sin_addr.s_addr = inet_addr( host );
|
||||
FS2NetD_addr.sin_addr.s_addr = inet_addr( host );
|
||||
}
|
||||
|
||||
if (PXO_addr.sin_addr.s_addr == INADDR_ANY) {
|
||||
if (FS2NetD_addr.sin_addr.s_addr == INADDR_ANY) {
|
||||
ml_printf("No valid server address to connect with!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// we need to set the correct port before moving on
|
||||
PXO_addr.sin_port = htons(port);
|
||||
long m_port = strtol(port, (char**)NULL, 10);
|
||||
FS2NetD_addr.sin_port = htons( (ushort)m_port );
|
||||
|
||||
|
||||
if ( connect(mySocket, (sockaddr *)&PXO_addr, sizeof(sockaddr)) == SOCKET_ERROR ) {
|
||||
if ( connect(mySocket, (sockaddr *)&FS2NetD_addr, sizeof(sockaddr)) == SOCKET_ERROR ) {
|
||||
if ( WSAGetLastError() == WSAEWOULDBLOCK ) {
|
||||
Connecting = true;
|
||||
return 0;
|
||||
} else {
|
||||
#ifdef SCP_UNIX
|
||||
int errv = errno;
|
||||
ml_printf("FS2NetD ERROR: Couldn't connect to remote system at %s (\"%s\")!", inet_ntoa(PXO_addr.sin_addr), strerror(errv));
|
||||
ml_printf("FS2NetD ERROR: Couldn't connect to remote system at %s (\"%s\")!", inet_ntoa(FS2NetD_addr.sin_addr), strerror(errv));
|
||||
#else
|
||||
ml_printf("FS2NetD ERROR: Couldn't connect to remote system at %s!", inet_ntoa(PXO_addr.sin_addr));
|
||||
ml_printf("FS2NetD ERROR: Couldn't connect to remote system at %s!", inet_ntoa(FS2NetD_addr.sin_addr));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -311,20 +308,32 @@ int FS2NetD_ConnectToServer(char *host, ushort port)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int FS2NetD_GetData(char *buffer, int blen, bool OOB)
|
||||
int FS2NetD_GetData(char *buffer, int blen)
|
||||
{
|
||||
int flags = 0;
|
||||
int status = SOCKET_ERROR;
|
||||
|
||||
if (OOB)
|
||||
flags = flags | MSG_OOB;
|
||||
|
||||
// clear the buffer
|
||||
memset(buffer, 0, blen);
|
||||
|
||||
socklen_t from_len = sizeof(sockaddr);
|
||||
|
||||
return recvfrom(mySocket, buffer, blen, flags, (sockaddr*)&FS2NetD_addr, &from_len);
|
||||
}
|
||||
|
||||
int FS2NetD_SendData(char *buffer, int blen)
|
||||
{
|
||||
int flags = 0;
|
||||
|
||||
socklen_t to_len = sizeof(sockaddr);
|
||||
|
||||
return sendto(mySocket, buffer, blen, flags, (sockaddr*)&FS2NetD_addr, to_len);
|
||||
}
|
||||
|
||||
bool FS2NetD_DataReady()
|
||||
{
|
||||
timeval wait;
|
||||
wait.tv_sec = 0;
|
||||
wait.tv_usec = 0;
|
||||
wait.tv_usec = 1;
|
||||
|
||||
fd_set recvs;
|
||||
|
||||
@@ -332,37 +341,10 @@ int FS2NetD_GetData(char *buffer, int blen, bool OOB)
|
||||
FD_SET(mySocket, &recvs);
|
||||
|
||||
#ifndef SCP_UNIX
|
||||
status = select(1, &recvs, NULL, NULL, &wait);
|
||||
int status = select(1, &recvs, NULL, NULL, &wait);
|
||||
#else
|
||||
status = select(mySocket+1, &recvs, NULL, NULL, &wait);
|
||||
int status = select(mySocket+1, &recvs, NULL, NULL, &wait);
|
||||
#endif
|
||||
|
||||
if ( (status == SOCKET_ERROR) || !(FD_ISSET(mySocket, &recvs)) )
|
||||
return -1;
|
||||
|
||||
socklen_t from_len = sizeof(sockaddr);
|
||||
|
||||
return recvfrom(mySocket, buffer, blen, flags, (sockaddr*)&PXO_addr, &from_len);
|
||||
}
|
||||
|
||||
int FS2NetD_SendData(char *buffer, int msg_len, bool OOB)
|
||||
{
|
||||
int flags = 0;
|
||||
|
||||
if (OOB)
|
||||
flags = flags | MSG_OOB;
|
||||
|
||||
socklen_t to_len = sizeof(sockaddr);
|
||||
|
||||
return sendto(mySocket, buffer, msg_len, flags, (sockaddr*)&PXO_addr, to_len);
|
||||
}
|
||||
|
||||
void FS2NetD_IgnorePackets()
|
||||
{
|
||||
// let's say most that is going to be backed up is 32K
|
||||
char *bitbox = new char[1024*32];
|
||||
|
||||
FS2NetD_GetData(bitbox, 1024*32);
|
||||
|
||||
delete[] bitbox;
|
||||
return ( (status != 0) && (status != -1) && FD_ISSET(mySocket, &recvs) );
|
||||
}
|
||||
@@ -71,12 +71,12 @@
|
||||
#include "globalincs/pstypes.h" // make sure _cdecl is defined correctly on *nix
|
||||
|
||||
|
||||
int FS2NetD_ConnectToServer(char *host, ushort port);
|
||||
int FS2NetD_ConnectToServer(const char *host, const char *port);
|
||||
void FS2NetD_Disconnect();
|
||||
|
||||
int FS2NetD_GetData(char *buffer, int blen, bool OOB = false);
|
||||
int FS2NetD_SendData(char *buffer, int msg_len, bool OOB = false);
|
||||
void FS2NetD_IgnorePackets();
|
||||
int FS2NetD_GetData(char *buffer, int blen);
|
||||
int FS2NetD_SendData(char *buffer, int blen);
|
||||
bool FS2NetD_DataReady();
|
||||
|
||||
|
||||
#endif // __TCP_SOCKET_H_
|
||||
@@ -545,7 +545,7 @@ void parse_helptbl()
|
||||
return;
|
||||
}
|
||||
|
||||
read_file_text(HELP_OVERLAY_FILENAME);
|
||||
read_file_text(HELP_OVERLAY_FILENAME, CF_TYPE_TABLES);
|
||||
|
||||
// for each overlay...
|
||||
for (overlay_id=0; overlay_id<MAX_HELP_OVERLAYS; overlay_id++) {
|
||||
|
||||
@@ -1178,7 +1178,10 @@ int event_music_friendly_arrival()
|
||||
return 0;
|
||||
|
||||
// Goober5000 - to avoid array out-of-bounds
|
||||
Assert(Current_pattern >= 0 && Current_pattern < MAX_PATTERNS);
|
||||
//Assert(Current_pattern >= 0 && Current_pattern < MAX_PATTERNS);
|
||||
|
||||
if(Current_pattern < 0 || Current_pattern > MAX_PATTERNS)
|
||||
return 0;
|
||||
|
||||
if ( Patterns[Current_pattern].next_pattern != Patterns[Current_pattern].default_next_pattern )
|
||||
return 0; // don't squash a pending pattern
|
||||
@@ -1664,7 +1667,7 @@ void event_music_parse_musictbl(char *filename)
|
||||
// open localization
|
||||
lcl_ext_open();
|
||||
|
||||
read_file_text(filename);
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
// Loop through all the sound-tracks
|
||||
|
||||
@@ -531,7 +531,7 @@ void gamesnd_parse_soundstbl()
|
||||
return;
|
||||
}
|
||||
|
||||
read_file_text("sounds.tbl");
|
||||
read_file_text("sounds.tbl", CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
// Parse the gameplay sounds section
|
||||
|
||||
@@ -320,7 +320,7 @@ $Fog: \n\
|
||||
$AI: \n\
|
||||
+Valid goals: ( \"fly to ship\" \"dock\" \"undock\" \"waypoints\" \"waypoints once\" \"stay near ship\" \"keep safe dist\" \"stay still\" \"play dead\" ) \n\
|
||||
+Accept Player Orders: YES \n\
|
||||
+Player orders: ( \"rearm me\" \"abort rearm\" \"stay near me\" \"stay near ship\" \"keep safe dist\" \"depart\" ) \n\
|
||||
+Player orders: ( \"rearm me\" \"abort rearm\" \"depart\" ) \n\
|
||||
+Auto attacks: YES \n\
|
||||
+Actively Pursues: ( \"navbuoy\" \"sentry gun\" \"escape pod\" \"cargo\" \"support\" \"stealth\" \"fighter\" \"bomber\" \"fighter/bomber\" \"transport\" \"freighter\" \"awacs\" \"gas miner\" \"cruiser\" \"corvette\" \"capital\" \"super cap\" \"drydock\" \"knossos device\" ) \n\
|
||||
+Guards attack this: YES \n\
|
||||
@@ -762,6 +762,12 @@ $Friendly AI Fire Delay Scale: 2, 1.4, 1.25, 1.1, 1 \n\
|
||||
;; factor applied to 'fire wait' for hostile ships \n\
|
||||
$Hostile AI Fire Delay Scale: 4, 2.5, 1.75, 1.25, 1 \n\
|
||||
\n\
|
||||
;; factor applied to 'fire wait' for secondaries of friendly ships \n\
|
||||
$Friendly AI Secondary Fire Delay Scale: 0.4, 0.6, 0.8, 1.0, 1.2 \n\
|
||||
\n\
|
||||
;; factor applied to 'fire wait' for secondaries of hostile ships \n\
|
||||
$Hostile AI Secondary Fire Delay Scale: 1.4, 1.2, 1.0, 0.8, 0.6 \n\
|
||||
\n\
|
||||
;; factor applied to time it takes for enemy ships to turn \n\
|
||||
$AI Turn Time Scale: 3, 2.2, 1.6, 1.3, 1 \n\
|
||||
\n\
|
||||
@@ -787,6 +793,11 @@ $Percentage Required For Kill Scale: 0.30, 0.30, 0.30, 0.30, 0.30 \n\
|
||||
;; must inflict in order to be awarded an assist \n\
|
||||
$Percentage Required For Assist Scale: 0.15, 0.15, 0.15, 0.15, 0.15 \n\
|
||||
\n\
|
||||
;; in TvT and Coop missions all teammates will be granted this \n\
|
||||
;; percentage of the capships score when someone scores a kill \n\
|
||||
$Percentage Awarded For Capship Assist: 0.5, 0.5, 0.5, 0.5, 0.5 \n\
|
||||
\n\
|
||||
\n\
|
||||
;; General AI-related flags. These were previously all lumped together \n\
|
||||
;; under the New AI mission flag. \n\
|
||||
\n\
|
||||
@@ -802,10 +813,15 @@ $smart primary weapon selection: NO \n\
|
||||
;; proper use of bomber+ missiles) \n\
|
||||
$smart secondary weapon selection: NO \n\
|
||||
\n\
|
||||
;; if set, enables smart shield management (previously was \n\
|
||||
;; -smart_shields on the command line) \n\
|
||||
;; if set, shields will devote all their charging energy to the weakest \n\
|
||||
;; quadrant(s) and not waste energy on fully-charged quadrants \n\
|
||||
;; (previously was -smart_shields on the command line) \n\
|
||||
$smart shield management: NO \n\
|
||||
\n""\
|
||||
;; if set, the AI will properly use brief pulses of afterburner power \n\
|
||||
;; instead of afterburning until fuel is exhausted \n\
|
||||
$smart afterburner management: NO \n\
|
||||
\n\
|
||||
;; if set, allows an AI ship to switch to rapid fire for dumbfire \n\
|
||||
;; missiles \n\
|
||||
$allow rapid secondary dumbfire: NO \n\
|
||||
@@ -831,7 +847,7 @@ $shockwaves damage small ship subsystems: NO \n\
|
||||
;; navigation subsystem is damaged or destroyed \n\
|
||||
$navigation subsystem governs warpout capability: NO \n\
|
||||
\n\
|
||||
;; if set, will not use a minimum speed limit for docked ships \n\
|
||||
;; if set, will not use a minimum speed limit for docked ships \n""\
|
||||
;; (like in FS1) \n\
|
||||
$ignore lower bound for minimum speed of docked ship: NO \n\
|
||||
\n\
|
||||
@@ -845,9 +861,48 @@ $disable weapon damage scaling: NO \n\
|
||||
;; if set, will add the weapon velocity to the firing ship's velocity \n\
|
||||
$use additive weapon velocity: NO \n\
|
||||
\n\
|
||||
;; if set, will dampening closer to real newtonian physics \n\
|
||||
$use newtonian dampening: NO \n\
|
||||
\n\
|
||||
;; if set, beam damage is counted when calculating kills and assists \n\
|
||||
$include beams for kills and assists: NO \n\
|
||||
\n\
|
||||
;; if set, kills gain score based on the percentage damage the killer \n\
|
||||
;; inflicted on the dead ship \n\
|
||||
$score kills based on damage caused: NO \n\
|
||||
\n\
|
||||
;; if set, kills gain score based on the percentage damage the player \n\
|
||||
;; gaining the assist inflicted on the dead ship \n\
|
||||
$score assists based on damage caused: NO \n\
|
||||
\n\
|
||||
;; if set, players (rather than just their team) can gain score from \n\
|
||||
;; events in multiplayer \n\
|
||||
$allow event and goal scoring in multiplayer: NO \n\
|
||||
\n\
|
||||
;; if set, the AI will properly link primaries according to \n\
|
||||
;; specified percentages of energy levels instead of retail behavior \n\
|
||||
;; where it mistakenly linked according to absolute energy levels \n\
|
||||
$fix linked primary weapon decision bug: NO \n\
|
||||
\n\
|
||||
;; if set, prevents turrets from targeting bombs beyond maximum \n\
|
||||
;; range of the weapons of the turret \n\
|
||||
$prevent turrets targeting too distant bombs: NO \n\
|
||||
\n""\
|
||||
;; if set, prevents turrets from trying to target subsystems beyond \n\
|
||||
;; their fov limits, also keeps the turret subsystem targeting \n\
|
||||
;; preference order intact regardless of the angle to the target \n\
|
||||
$smart subsystem targeting for turrets: NO \n\
|
||||
\n\
|
||||
;; if set, heat-seeking missiles will not home in on stealth ships \n\
|
||||
;; (this mirrors the established behavior where heat-seeking missiles \n\
|
||||
;; do not home in on ships that are hidden from sensors) \n\
|
||||
$fix heat seekers homing on stealth ships bug: NO \n\
|
||||
\n\
|
||||
;; allow a player to commit into a multiplayer game without primaries \n\
|
||||
$multi allow empty primaries: NO \n\
|
||||
\n\
|
||||
;; allow a player to commit into a multiplayer game without secondaries \n\
|
||||
$multi allow empty secondaries: NO \n\
|
||||
\n\
|
||||
#End \n\
|
||||
";
|
||||
@@ -604,6 +604,9 @@ extern void LuaError(struct lua_State *L, char *format=NULL, ...);
|
||||
extern void _cdecl Error( char * filename, int line, const char * format, ... );
|
||||
extern void _cdecl Warning( char * filename, int line, const char * format, ... );
|
||||
|
||||
extern int Global_warning_count;
|
||||
extern int Global_error_count;
|
||||
|
||||
#include "osapi/outwnd.h"
|
||||
|
||||
// To debug printf do this:
|
||||
@@ -634,7 +637,7 @@ extern void _cdecl Warning( char * filename, int line, const char * format, ...
|
||||
#define Assert(x) do {} while (0)
|
||||
#else
|
||||
void gr_activate(int);
|
||||
#define Assert(x) do { if (!(x)){ gr_activate(0); WinAssert(#x,__FILE__,__LINE__); gr_activate(1); } } while (0)
|
||||
#define Assert(x) do { if (!(x)){ WinAssert(#x,__FILE__,__LINE__); } } while (0)
|
||||
#endif
|
||||
/*******************NEVER UNCOMMENT Assert ************************************************/
|
||||
|
||||
@@ -880,6 +883,7 @@ inline float SWAPFLOAT(float *x)
|
||||
#define FALSE 0
|
||||
|
||||
int myrand();
|
||||
int rand32(); // returns a random number between 0 and 0x7fffffff
|
||||
|
||||
|
||||
// lod checker for (modular) table parsing
|
||||
@@ -1092,5 +1096,19 @@ typedef struct script_hook
|
||||
bool IsValid(){return (h_index > -1);}
|
||||
}script_hook;
|
||||
|
||||
class camid
|
||||
{
|
||||
private:
|
||||
int sig;
|
||||
uint idx;
|
||||
public:
|
||||
camid();
|
||||
camid(int n_idx, int n_sig);
|
||||
|
||||
class camera *getCamera();
|
||||
uint getIndex();
|
||||
int getSignature();
|
||||
bool isValid();
|
||||
};
|
||||
|
||||
#endif // PS_TYPES_H
|
||||
@@ -290,11 +290,14 @@ int Interface_last_tick = -1; // last timer tick on flip
|
||||
char Processing_filename[MAX_PATH_LEN];
|
||||
#endif
|
||||
|
||||
// If true, then we are using Direct3D hardware. This is used for game type stuff
|
||||
// that changes when you're using hardware.
|
||||
int D3D_enabled = 0;
|
||||
// for OGL
|
||||
int OGL_enabled = 0;
|
||||
// override states to skip rendering of certain elements, but without disabling them completely
|
||||
bool Basemap_override = false;
|
||||
bool Envmap_override = false;
|
||||
bool Specmap_override = false;
|
||||
bool Normalmap_override = false;
|
||||
bool Heightmap_override = false;
|
||||
bool Glowpoint_override = false;
|
||||
bool GLSL_override = false;
|
||||
|
||||
// Values used for noise for thruster animations
|
||||
float Noise[NOISE_NUM_FRAMES] = {
|
||||
@@ -325,6 +328,24 @@ int myrand()
|
||||
return rval;
|
||||
}
|
||||
|
||||
// returns a random number between 0 and 0x7fffffff
|
||||
int rand32()
|
||||
{
|
||||
if (RAND_MAX == 0x7fff) {
|
||||
int random32;
|
||||
// this gets two random 16 bit numbers and stuffs them into a 32 bit number
|
||||
random32 = (rand() << 16) | rand();
|
||||
//since rand() returns between 0 and 0x7fff, there needs to be a thing to randomly generate the 16th bit
|
||||
random32 |= ((rand() & 1) << 15);
|
||||
|
||||
return random32;
|
||||
}
|
||||
else {
|
||||
// karajorma - can't imagine what RAND_MAX could be if it's not 0x7fffffff but let's be careful
|
||||
Assert(RAND_MAX == 0x7fffffff);
|
||||
return rand();
|
||||
}
|
||||
}
|
||||
|
||||
// Variables for the loading callback hooks
|
||||
static int cf_timestamp = -1;
|
||||
|
||||
@@ -367,11 +367,14 @@ extern int Interface_last_tick; // last timer tick on flip
|
||||
extern float Noise[NOISE_NUM_FRAMES];
|
||||
|
||||
|
||||
// If true, then we are using Direct3D hardware. This is used for game type stuff
|
||||
// that changes when you're using hardware.
|
||||
extern int D3D_enabled;
|
||||
// for OGL
|
||||
extern int OGL_enabled;
|
||||
// override states to skip rendering of certain elements, but without disabling them completely
|
||||
extern bool Basemap_override;
|
||||
extern bool Envmap_override;
|
||||
extern bool Specmap_override;
|
||||
extern bool Normalmap_override;
|
||||
extern bool Heightmap_override;
|
||||
extern bool Glowpoint_override;
|
||||
extern bool GLSL_override;
|
||||
|
||||
// game skill levels
|
||||
#define NUM_SKILL_LEVELS 5
|
||||
|
||||
@@ -284,6 +284,9 @@ extern void gr_activate(int active);
|
||||
|
||||
bool Messagebox_active = false;
|
||||
|
||||
int Global_warning_count = 0;
|
||||
int Global_error_count = 0;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <crtdbg.h>
|
||||
|
||||
@@ -306,6 +309,8 @@ bool Messagebox_active = false;
|
||||
|
||||
#ifdef SHOW_CALL_STACK
|
||||
|
||||
static bool Dump_to_log = true;
|
||||
|
||||
class DumpBuffer
|
||||
{
|
||||
public :
|
||||
@@ -473,8 +478,12 @@ void PE_Debug :: DumpLineNumber( DumpBuffer& dumpBuffer, DWORD relativeAddress )
|
||||
}
|
||||
line++ ;
|
||||
}
|
||||
if( lineNum != none )
|
||||
if( lineNum != none ) {
|
||||
dumpBuffer.Printf( " line %d\r\n", lineNum ) ;
|
||||
if (Dump_to_log) {
|
||||
mprintf(( " line %d\r\n", lineNum )) ;
|
||||
}
|
||||
}
|
||||
// else
|
||||
// dumpBuffer.Printf( " line <unknown>\r\n" ) ;
|
||||
}
|
||||
@@ -725,8 +734,14 @@ void PE_Debug::DumpSymbolInfo( DumpBuffer& dumpBuffer, DWORD relativeAddress )
|
||||
char tmp_name[1024];
|
||||
unmangle(tmp_name, GetSymbolName( fnSymbol ) );
|
||||
dumpBuffer.Printf( " %s()", tmp_name ) ;
|
||||
if (Dump_to_log) {
|
||||
mprintf((" %s()", tmp_name )) ;
|
||||
}
|
||||
} else {
|
||||
dumpBuffer.Printf( " <unknown>" ) ;
|
||||
if (Dump_to_log) {
|
||||
mprintf((" <unknown>" )) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -888,6 +903,9 @@ int PE_Debug::DumpDebugInfo( DumpBuffer& dumpBuffer, const BYTE* caller, HINSTAN
|
||||
//dumpBuffer.Printf( "Call stack is unavailable, because there is\r\nno COFF debugging info in this module.\r\n" ) ;
|
||||
//JAS dumpBuffer.Printf( " no debug information\r\n" ) ;
|
||||
dumpBuffer.Printf( " %s %08x()\r\n", pretty_module, caller ) ;
|
||||
if (Dump_to_log) {
|
||||
mprintf((" %s %08x()\r\n", pretty_module, caller )) ;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} catch( ... ) {
|
||||
@@ -896,6 +914,9 @@ int PE_Debug::DumpDebugInfo( DumpBuffer& dumpBuffer, const BYTE* caller, HINSTAN
|
||||
}
|
||||
} else {
|
||||
dumpBuffer.Printf( " %s %08x()\r\n", pretty_module, caller ) ;
|
||||
if (Dump_to_log) {
|
||||
mprintf(( " %s %08x()\r\n", pretty_module, caller )) ;
|
||||
}
|
||||
//JAS dumpBuffer.Printf( " module not accessible\r\n" ) ;
|
||||
//JAS dumpBuffer.Printf( " address: %8X\r\n", caller ) ;
|
||||
return 0;
|
||||
@@ -1018,11 +1039,14 @@ void dump_text_to_clipboard(char *text)
|
||||
|
||||
void _cdecl WinAssert(char * text, char * filename, int linenum )
|
||||
{
|
||||
int val;
|
||||
|
||||
// this stuff migt be really useful for solving bug reports and user errors. We should output it!
|
||||
mprintf(("ASSERTION: \"%s\" at %s:%d\n", text, strrchr(filename, '\\')+1, linenum ));
|
||||
|
||||
if (Cmdline_nowarn)
|
||||
return;
|
||||
|
||||
int val;
|
||||
|
||||
Messagebox_active = true;
|
||||
|
||||
gr_activate(0);
|
||||
@@ -1030,7 +1054,7 @@ void _cdecl WinAssert(char * text, char * filename, int linenum )
|
||||
filename = strrchr(filename, '\\')+1;
|
||||
sprintf( AssertText1, "Assert: %s\r\nFile: %s\r\nLine: %d\r\n", text, filename, linenum );
|
||||
|
||||
#ifdef SHOW_CALL_STACK
|
||||
#ifdef SHOW_CALL_STACK
|
||||
dumpBuffer.Clear();
|
||||
dumpBuffer.Printf( AssertText1 );
|
||||
dumpBuffer.Printf( "\r\n" );
|
||||
@@ -1167,6 +1191,8 @@ void LuaError(struct lua_State *L, char *format, ...)
|
||||
|
||||
void _cdecl Error( char * filename, int line, const char * format, ... )
|
||||
{
|
||||
Global_error_count++;
|
||||
|
||||
int val;
|
||||
va_list args;
|
||||
|
||||
@@ -1176,6 +1202,7 @@ void _cdecl Error( char * filename, int line, const char * format, ... )
|
||||
|
||||
filename = strrchr(filename, '\\')+1;
|
||||
sprintf(AssertText2, "Error: %s\r\nFile: %s\r\nLine: %d\r\n", AssertText1, filename, line);
|
||||
mprintf(("ERROR: %s\r\nFile: %s\r\nLine: %d\r\n", AssertText1, filename, line));
|
||||
|
||||
Messagebox_active = true;
|
||||
|
||||
@@ -1219,6 +1246,8 @@ void _cdecl Error( char * filename, int line, const char * format, ... )
|
||||
|
||||
void _cdecl Warning( char *filename, int line, const char *format, ... )
|
||||
{
|
||||
Global_warning_count++;
|
||||
|
||||
#ifndef NDEBUG
|
||||
va_list args;
|
||||
int result;
|
||||
@@ -1269,6 +1298,9 @@ void _cdecl Warning( char *filename, int line, const char *format, ... )
|
||||
gr_activate(0);
|
||||
|
||||
#ifdef SHOW_CALL_STACK
|
||||
//we don't want to dump the call stack for every single warning
|
||||
Dump_to_log = false;
|
||||
|
||||
dumpBuffer.Clear();
|
||||
dumpBuffer.Printf( AssertText2 );
|
||||
dumpBuffer.Printf( "\r\n" );
|
||||
@@ -1279,6 +1311,9 @@ void _cdecl Warning( char *filename, int line, const char *format, ... )
|
||||
dumpBuffer.Printf("\r\n\r\nUse Yes to break into Debugger, No to continue.\r\nand Cancel to Quit");
|
||||
|
||||
result = MessageBox((HWND)os_get_window(), dumpBuffer.buffer, "Warning!", MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_ICONWARNING | flags );
|
||||
|
||||
Dump_to_log = true;
|
||||
|
||||
#else
|
||||
strcat(AssertText2,"\r\n\r\nUse Yes to break into Debugger, No to continue.\r\nand Cancel to Quit");
|
||||
result = MessageBox((HWND)os_get_window(), AssertText2, "Warning!", MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_ICONWARNING | flags );
|
||||
|
||||
+439
-402
File diff suppressed because it is too large.
Load diff
+72
-91
@@ -797,19 +797,26 @@ typedef struct color {
|
||||
} color;
|
||||
|
||||
|
||||
typedef struct tsb_t {
|
||||
vec3d tangent;
|
||||
float scaler;
|
||||
} tsb_t;
|
||||
|
||||
// this should be basicly just like it is in the VB
|
||||
// a list of triangles and their associated normals
|
||||
struct poly_list {
|
||||
poly_list(): n_prim(0), n_verts(0), vert(NULL), norm(NULL), currently_allocated(0) {}
|
||||
poly_list(): n_prim(0), n_verts(0), vert(NULL), norm(NULL), tsb(NULL), currently_allocated(0) {}
|
||||
~poly_list();
|
||||
poly_list& operator = (poly_list&);
|
||||
|
||||
void allocate(int size);
|
||||
void make_index_buffer();
|
||||
void calculate_tangent();
|
||||
int n_prim;
|
||||
int n_verts;
|
||||
vertex *vert;
|
||||
vec3d *norm;
|
||||
tsb_t *tsb;
|
||||
|
||||
private:
|
||||
int currently_allocated;
|
||||
@@ -865,6 +872,8 @@ typedef struct screen {
|
||||
int offset_x_unscaled, offset_y_unscaled; // Offsets into the screen, in 1024x768 or 640x480 dimensions
|
||||
int clip_width, clip_height;
|
||||
int clip_width_unscaled, clip_height_unscaled; // Height and width of clip aread, in 1024x768 or 640x480 dimensions
|
||||
// center of clip area
|
||||
float clip_center_x, clip_center_y;
|
||||
|
||||
float fog_near, fog_far;
|
||||
|
||||
@@ -874,8 +883,6 @@ typedef struct screen {
|
||||
int clip_left, clip_right, clip_top, clip_bottom;
|
||||
// same as above except in 1024x768 or 640x480 dimensions
|
||||
int clip_left_unscaled, clip_right_unscaled, clip_top_unscaled, clip_bottom_unscaled;
|
||||
// center of clip area
|
||||
float clip_center_x, clip_center_y;
|
||||
|
||||
int current_alphablend_mode; // See GR_ALPHABLEND defines above
|
||||
int current_bitblt_mode; // See GR_BITBLT_MODE defines above
|
||||
@@ -889,12 +896,11 @@ typedef struct screen {
|
||||
// void *offscreen_buffer; // NEVER ACCESS! This+rowsize*y = screen offset
|
||||
// void *offscreen_buffer_base; // Pointer to lowest address of offscreen buffer
|
||||
|
||||
int custom_size;
|
||||
bool custom_size;
|
||||
int rendering_to_texture; //wich texture we are rendering to, -1 if the back buffer
|
||||
int rendering_to_face; //wich face of the texture we are rendering to, -1 if the back buffer
|
||||
|
||||
int static_environment_map;
|
||||
int dynamic_environment_map;
|
||||
int envmap_render_target;
|
||||
|
||||
bool recording_state_block;
|
||||
int current_state_block;
|
||||
@@ -905,7 +911,6 @@ typedef struct screen {
|
||||
|
||||
//switch onscreen, offscreen
|
||||
void (*gf_flip)();
|
||||
void (*gf_flip_window)(uint _hdc, int x, int y, int w, int h );
|
||||
|
||||
// Sets the current palette
|
||||
void (*gf_set_palette)(ubyte * new_pal, int restrict_alphacolor);
|
||||
@@ -933,9 +938,6 @@ typedef struct screen {
|
||||
|
||||
//void (*gf_set_font)(int fontnum);
|
||||
|
||||
// Sets the current bitmap
|
||||
void (*gf_set_bitmap)( int bitmap_num, int alphablend, int bitbltmode, float alpha);
|
||||
|
||||
// Call this to create a shader.
|
||||
// This function takes a while, so don't call it once a frame!
|
||||
// r,g,b, and c should be between -1.0 and 1.0f
|
||||
@@ -1045,20 +1047,14 @@ typedef struct screen {
|
||||
// set fog attributes
|
||||
void (*gf_fog_set)(int fog_mode, int r, int g, int b, float fog_near, float fog_far);
|
||||
|
||||
// get the current pixel color in the framebuffer
|
||||
void (*gf_get_pixel)(int x, int y, int *r, int *g, int *b);
|
||||
|
||||
// poly culling
|
||||
int (*gf_set_cull)(int cull);
|
||||
|
||||
// cross fade
|
||||
void (*gf_cross_fade)(int bmap1, int bmap2, int x1, int y1, int x2, int y2, float pct);
|
||||
|
||||
// filtering
|
||||
void (*gf_filter_set)(int filter);
|
||||
|
||||
// set a texture into cache. for sectioned bitmaps, pass in sx and sy to set that particular section of the bitmap
|
||||
int (*gf_tcache_set)(int bitmap_id, int bitmap_type, float *u_scale, float *v_scale, int fail_on_full, int force, int stage);
|
||||
int (*gf_tcache_set)(int bitmap_id, int bitmap_type, float *u_scale, float *v_scale, int stage);
|
||||
|
||||
// preload a bitmap into texture memory
|
||||
int (*gf_preload)(int bitmap_num, int is_aabitmap);
|
||||
@@ -1126,9 +1122,10 @@ typedef struct screen {
|
||||
|
||||
void (*gf_draw_line_list)(colored_vector*lines, int num);
|
||||
|
||||
void (*gf_set_line_width)(float width);
|
||||
void (*gf_draw_htl_line)(vec3d *start, vec3d* end);
|
||||
void (*gf_draw_htl_sphere)(float rad);
|
||||
void (*gf_set_line_width)(float width);
|
||||
|
||||
void (*gf_line_htl)(vec3d *start, vec3d* end);
|
||||
void (*gf_sphere_htl)(float rad);
|
||||
|
||||
// void (*gf_set_environment_mapping)(int i);
|
||||
|
||||
@@ -1139,12 +1136,6 @@ typedef struct screen {
|
||||
*/
|
||||
} screen;
|
||||
|
||||
// cpu types
|
||||
//extern int Gr_amd3d;
|
||||
//extern int Gr_katmai;
|
||||
//extern int Gr_cpu;
|
||||
//extern int Gr_mmx;
|
||||
|
||||
// handy macro
|
||||
#define GR_MAYBE_CLEAR_RES(bmap) do { int bmw = -1; int bmh = -1; if(bmap != -1){ bm_get_info( bmap, &bmw, &bmh, NULL, NULL, NULL); if((bmw != gr_screen.max_w) || (bmh != gr_screen.max_h)){gr_clear();} } else {gr_clear();} } while(0);
|
||||
|
||||
@@ -1153,6 +1144,7 @@ typedef struct screen {
|
||||
// Call this at application startup
|
||||
|
||||
// # Software Re-added by Kazan --- THIS HAS TO STAY -- It is used by standalone!
|
||||
#define GR_DEFAULT (-1) // set to use default settings
|
||||
#define GR_STUB (100)
|
||||
#define GR_DIRECT3D (102) // Use Direct3d hardware renderer
|
||||
#define GR_OPENGL (104) // Use OpenGl hardware renderer
|
||||
@@ -1162,7 +1154,8 @@ typedef struct screen {
|
||||
#define GR_640 0 // 640 x 480
|
||||
#define GR_1024 1 // 1024 x 768
|
||||
|
||||
extern bool gr_init(int res, int mode, int depth = 16, int fred_x = -1, int fred_y = -1 );
|
||||
extern bool gr_init(int d_mode = GR_DEFAULT, int d_width = GR_DEFAULT, int d_height = GR_DEFAULT, int d_depth = GR_DEFAULT);
|
||||
extern void gr_screen_resize(int width, int height);
|
||||
|
||||
// Call this when your app ends.
|
||||
extern void gr_close();
|
||||
@@ -1220,9 +1213,6 @@ extern int Web_cursor_bitmap;
|
||||
// Called by OS when application gets/looses focus
|
||||
extern void gr_activate(int active);
|
||||
|
||||
// Sets up resolution
|
||||
void gr_init_res(int res, int mode, int fredx = -1, int fredy = -1);
|
||||
|
||||
#define GR_CALL(x) (*x)
|
||||
|
||||
// These macros make the function indirection look like the
|
||||
@@ -1232,7 +1222,6 @@ void gr_init_res(int res, int mode, int fredx = -1, int fredy = -1);
|
||||
|
||||
//#define gr_flip GR_CALL(gr_screen.gf_flip)
|
||||
void gr_flip();
|
||||
#define gr_flip_window GR_CALL(gr_screen.gf_flip_window)
|
||||
|
||||
//#define gr_set_clip GR_CALL(gr_screen.gf_set_clip)
|
||||
__inline void gr_set_clip(int x, int y, int w, int h, bool resize=true)
|
||||
@@ -1254,10 +1243,7 @@ __inline void gr_set_clip(int x, int y, int w, int h, bool resize=true)
|
||||
//#define gr_set_color_fast GR_CALL(gr_screen.gf_set_color_fast)
|
||||
|
||||
//#define gr_set_bitmap GR_CALL(gr_screen.gf_set_bitmap)
|
||||
__inline void gr_set_bitmap( int bitmap_num, int alphablend=GR_ALPHABLEND_NONE, int bitbltmode=GR_BITBLT_MODE_NORMAL, float alpha=1.0f )
|
||||
{
|
||||
(*gr_screen.gf_set_bitmap)(bitmap_num, alphablend, bitbltmode, alpha);
|
||||
}
|
||||
void gr_set_bitmap(int bitmap_num, int alphablend = GR_ALPHABLEND_NONE, int bitbltmode = GR_BITBLT_MODE_NORMAL, float alpha = 1.0f);
|
||||
|
||||
//#define gr_create_shader GR_CALL(gr_screen.gf_create_shader)
|
||||
//#define gr_set_shader GR_CALL(gr_screen.gf_set_shader)
|
||||
@@ -1338,9 +1324,6 @@ __inline void gr_gradient(int x1, int y1, int x2, int y2, bool resize = true)
|
||||
|
||||
#define gr_set_gamma GR_CALL(gr_screen.gf_set_gamma)
|
||||
|
||||
#define gr_lock GR_CALL(gr_screen.gf_lock)
|
||||
#define gr_unlock GR_CALL(gr_screen.gf_unlock)
|
||||
|
||||
#define gr_get_region GR_CALL(gr_screen.gf_get_region)
|
||||
|
||||
//#define gr_fog_set GR_CALL(gr_screen.gf_fog_set)
|
||||
@@ -1353,12 +1336,10 @@ __inline void gr_fog_set(int fog_mode, int r, int g, int b, float fog_near = -1.
|
||||
|
||||
#define gr_cross_fade GR_CALL(gr_screen.gf_cross_fade)
|
||||
|
||||
#define gr_filter_set GR_CALL(gr_screen.gf_filter_set)
|
||||
|
||||
//#define gr_tcache_set GR_CALL(gr_screen.gf_tcache_set)
|
||||
__inline int gr_tcache_set(int bitmap_id, int bitmap_type, float *u_scale, float *v_scale, int fail_on_full = 0, int force = 0, int stage = 0)
|
||||
__inline int gr_tcache_set(int bitmap_id, int bitmap_type, float *u_scale, float *v_scale, int stage = 0)
|
||||
{
|
||||
return (*gr_screen.gf_tcache_set)(bitmap_id, bitmap_type, u_scale, v_scale, fail_on_full, force, stage);
|
||||
return (*gr_screen.gf_tcache_set)(bitmap_id, bitmap_type, u_scale, v_scale, stage);
|
||||
}
|
||||
|
||||
#define gr_preload GR_CALL(gr_screen.gf_preload)
|
||||
@@ -1390,64 +1371,65 @@ __inline int gr_bm_set_render_target(int n, int face = -1)
|
||||
|
||||
#define gr_set_texture_addressing GR_CALL(*gr_screen.gf_set_texture_addressing)
|
||||
|
||||
#define gr_make_buffer GR_CALL(*gr_screen.gf_make_buffer)
|
||||
#define gr_make_buffer GR_CALL(*gr_screen.gf_make_buffer)
|
||||
#define gr_destroy_buffer GR_CALL(*gr_screen.gf_destroy_buffer)
|
||||
__inline void gr_render_buffer(int start, int n_prim, ushort *sbuffer, uint *ibuffer = NULL, int flags = TMAP_FLAG_TEXTURED)
|
||||
{
|
||||
(*gr_screen.gf_render_buffer)(start, n_prim, sbuffer, ibuffer, flags);
|
||||
}
|
||||
|
||||
#define gr_set_buffer GR_CALL(*gr_screen.gf_set_buffer)
|
||||
#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_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)
|
||||
#define gr_set_view_matrix GR_CALL(*gr_screen.gf_set_view_matrix)
|
||||
#define gr_end_view_matrix GR_CALL(*gr_screen.gf_end_view_matrix)
|
||||
#define gr_push_scale_matrix GR_CALL(*gr_screen.gf_push_scale_matrix)
|
||||
#define gr_pop_scale_matrix GR_CALL(*gr_screen.gf_pop_scale_matrix)
|
||||
#define gr_start_instance_matrix GR_CALL(*gr_screen.gf_start_instance_matrix)
|
||||
#define gr_start_angles_instance_matrix GR_CALL(*gr_screen.gf_start_angles_instance_matrix)
|
||||
#define gr_end_instance_matrix GR_CALL(*gr_screen.gf_end_instance_matrix)
|
||||
#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)
|
||||
#define gr_set_view_matrix GR_CALL(*gr_screen.gf_set_view_matrix)
|
||||
#define gr_end_view_matrix GR_CALL(*gr_screen.gf_end_view_matrix)
|
||||
#define gr_push_scale_matrix GR_CALL(*gr_screen.gf_push_scale_matrix)
|
||||
#define gr_pop_scale_matrix GR_CALL(*gr_screen.gf_pop_scale_matrix)
|
||||
#define gr_start_instance_matrix GR_CALL(*gr_screen.gf_start_instance_matrix)
|
||||
#define gr_start_angles_instance_matrix GR_CALL(*gr_screen.gf_start_angles_instance_matrix)
|
||||
#define gr_end_instance_matrix GR_CALL(*gr_screen.gf_end_instance_matrix)
|
||||
|
||||
#define gr_make_light GR_CALL (*gr_screen.gf_make_light)
|
||||
#define gr_modify_light GR_CALL (*gr_screen.gf_modify_light)
|
||||
#define gr_destroy_light GR_CALL (*gr_screen.gf_destroy_light)
|
||||
#define gr_set_light GR_CALL (*gr_screen.gf_set_light)
|
||||
#define gr_reset_lighting GR_CALL (*gr_screen.gf_reset_lighting)
|
||||
#define gr_make_light GR_CALL(*gr_screen.gf_make_light)
|
||||
#define gr_modify_light GR_CALL(*gr_screen.gf_modify_light)
|
||||
#define gr_destroy_light GR_CALL(*gr_screen.gf_destroy_light)
|
||||
#define gr_set_light GR_CALL(*gr_screen.gf_set_light)
|
||||
#define gr_reset_lighting GR_CALL(*gr_screen.gf_reset_lighting)
|
||||
#define gr_set_ambient_light GR_CALL(*gr_screen.gf_set_ambient_light)
|
||||
|
||||
#define gr_set_lighting GR_CALL (*gr_screen.gf_lighting)
|
||||
#define gr_center_alpha GR_CALL (*gr_screen.gf_center_alpha)
|
||||
#define gr_set_lighting GR_CALL(*gr_screen.gf_lighting)
|
||||
#define gr_center_alpha GR_CALL(*gr_screen.gf_center_alpha)
|
||||
|
||||
#define gr_start_clip GR_CALL (*gr_screen.gf_start_clip_plane)
|
||||
#define gr_end_clip GR_CALL (*gr_screen.gf_end_clip_plane)
|
||||
#define gr_start_clip GR_CALL(*gr_screen.gf_start_clip_plane)
|
||||
#define gr_end_clip GR_CALL(*gr_screen.gf_end_clip_plane)
|
||||
|
||||
#define gr_zbias GR_CALL (*gr_screen.gf_zbias)
|
||||
#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_zbias GR_CALL(*gr_screen.gf_zbias)
|
||||
#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_CALL (*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_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_set_environment_mapping GR_CALL (*gr_screen.gf_set_environment_mapping)
|
||||
//#define gr_set_environment_mapping GR_CALL(*gr_screen.gf_set_environment_mapping)
|
||||
|
||||
#define gr_setup_background_fog GR_CALL (*gr_screen.gf_setup_background_fog)
|
||||
#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_draw_line_list GR_CALL(*gr_screen.gf_draw_line_list)
|
||||
|
||||
#define gr_set_line_width GR_CALL(*gr_screen.gf_set_line_width)
|
||||
#define gr_draw_htl_line GR_CALL(*gr_screen.gf_draw_htl_line)
|
||||
#define gr_draw_htl_sphere GR_CALL(*gr_screen.gf_draw_htl_sphere)
|
||||
#define gr_set_line_width GR_CALL(*gr_screen.gf_set_line_width)
|
||||
|
||||
#define gr_line_htl GR_CALL(*gr_screen.gf_line_htl)
|
||||
#define gr_sphere_htl GR_CALL(*gr_screen.gf_sphere_htl)
|
||||
|
||||
/*
|
||||
#define gr_begin_sprites GR_CALL (*gr_screen.gf_begin_sprites)
|
||||
#define gr_draw_sprites GR_CALL (*gr_screen.gf_draw_sprites)
|
||||
#define gr_end sprites GR_CALL (*gr_screen.gf_end_sprites)
|
||||
#define gr_display_sprites GR_CALL (*gr_screen.gf_display_sprites)
|
||||
#define gr_begin_sprites GR_CALL(*gr_screen.gf_begin_sprites)
|
||||
#define gr_draw_sprites GR_CALL(*gr_screen.gf_draw_sprites)
|
||||
#define gr_end sprites GR_CALL(*gr_screen.gf_end_sprites)
|
||||
#define gr_display_sprites GR_CALL(*gr_screen.gf_display_sprites)
|
||||
*/
|
||||
|
||||
// color functions
|
||||
@@ -1471,16 +1453,15 @@ void gr_bitmap_list(bitmap_rect_list* list, int n_bm, bool allow_scaling);
|
||||
// Moreover, it is _really_ intended for use with 45 degree angles.
|
||||
void gr_pline_special(vec3d **pts, int num_pts, int thickness,bool resize=true);
|
||||
|
||||
#define VERTEX_FLAG_POSITION (1<<0)
|
||||
#define VERTEX_FLAG_RHW (1<<1) //incompatable with the next normal
|
||||
#define VERTEX_FLAG_NORMAL (1<<2)
|
||||
#define VERTEX_FLAG_DIFUSE (1<<3)
|
||||
#define VERTEX_FLAG_SPECULAR (1<<4)
|
||||
#define VERTEX_FLAG_UV1 (1<<5) //how many UV coords, only use one of these
|
||||
#define VERTEX_FLAG_UV2 (1<<6)
|
||||
#define VERTEX_FLAG_UV3 (1<<7)
|
||||
#define VERTEX_FLAG_UV4 (1<<8)
|
||||
|
||||
void poly_tsb_calc(vertex *v0, vertex *v1, vertex *v2, vec3d *o_norm, vec3d *o_stan, vec3d *o_ttan);
|
||||
#define VERTEX_FLAG_POSITION (1<<0)
|
||||
#define VERTEX_FLAG_RHW (1<<1) //incompatable with the next normal
|
||||
#define VERTEX_FLAG_NORMAL (1<<2)
|
||||
#define VERTEX_FLAG_DIFUSE (1<<3)
|
||||
#define VERTEX_FLAG_SPECULAR (1<<4)
|
||||
#define VERTEX_FLAG_UV1 (1<<5) //how many UV coords, only use one of these
|
||||
#define VERTEX_FLAG_UV2 (1<<6)
|
||||
#define VERTEX_FLAG_UV3 (1<<7)
|
||||
#define VERTEX_FLAG_UV4 (1<<8)
|
||||
#define VERTEX_FLAG_TANGENT (1<<9)
|
||||
|
||||
#endif
|
||||
+1869
-920
File diff suppressed because it is too large.
Load diff
@@ -199,7 +199,7 @@
|
||||
* fixing lighting bug I accedently introduced
|
||||
*
|
||||
* Revision 2.54 2004/02/16 11:47:33 randomtiger
|
||||
* Removed a lot of files that we dont need anymore.
|
||||
* Removed a lot of files that we don't need anymore.
|
||||
* Changed htl to be on by default, command now -nohtl
|
||||
* Changed D3D to use a 2D vertex for 2D operations which should cut down on redundant data having to go though the system.
|
||||
* Added small change to all -start_mission flag to take you to any mission by filename, very useful for testing.
|
||||
@@ -245,7 +245,7 @@
|
||||
* Put dithering back in for tgas and jpgs
|
||||
*
|
||||
* Revision 2.46 2003/11/29 10:52:09 randomtiger
|
||||
* Turned off D3D file mapping, its using too much memory which may be hurting older systems and doesnt seem to be providing much of a speed benifit.
|
||||
* Turned off D3D file mapping, it's using too much memory which may be hurting older systems and doesn't seem to be providing much of a speed benifit.
|
||||
* Added stats command for ingame stats on memory usage.
|
||||
* Trys to play intro.mve and intro.avi, just to be safe since its not set by table.
|
||||
* Added fix for fonts wrapping round in non standard hi res modes.
|
||||
@@ -345,7 +345,7 @@
|
||||
*
|
||||
* Revision 2.26 2003/10/14 17:39:13 randomtiger
|
||||
* Implemented hardware fog for the HT&L code path.
|
||||
* It doesnt use the backgrounds anymore but its still an improvement.
|
||||
* It doesn't use the backgrounds anymore but it's still an improvement.
|
||||
* Currently it fogs to a brighter colour than it should because of Bob specular code.
|
||||
* I will fix this after discussing it with Bob.
|
||||
*
|
||||
@@ -442,12 +442,12 @@
|
||||
*
|
||||
* I have also taken the opertunity to fix a few bugs in the launcher and add a new feature to make selecting mods a bit easier.
|
||||
*
|
||||
* The launcher now uses some files in the freespace project so it should be put into CVS with the rest of the code inside the 'code' directory (still in its 'Launcher' dir of course). Currently the launcher wont compile since speech.cpp and speech.h arent in cvs yet. But once Roee has checked in that will be sorted.
|
||||
* The launcher now uses some files in the freespace project so it should be put into CVS with the rest of the code inside the 'code' directory (still in its 'Launcher' dir of course). Currently the launcher won't compile since speech.cpp and speech.h arent in cvs yet. But once Roee has checked in that will be sorted.
|
||||
*
|
||||
* I have also removed the internal launcher from the D3D8 module.
|
||||
* Please contact me if you have any problems.
|
||||
*
|
||||
* When trying to run the exe after updating I get an error parsing 'rank.tbl' but im fairly sure thats nothing to do with me so I'll just have to leave it for now because I'm still using a 56K modem and cant afford to find out.
|
||||
* When trying to run the exe after updating I get an error parsing 'rank.tbl' but im fairly sure thats nothing to do with me so I'll just have to leave it for now because I'm still using a 56K modem and can't afford to find out.
|
||||
*
|
||||
* Revision 2.12 2003/07/04 02:27:48 phreak
|
||||
* added support for cloaking.
|
||||
@@ -523,7 +523,7 @@
|
||||
* Revision 2.2.2.22 2002/11/04 21:24:59 randomtiger
|
||||
*
|
||||
* When running in D3D all ani's are memory mapped for speed, this takes up more memory but stops gametime locking of textures which D3D8 hates.
|
||||
* Added new command line tag Cmdline_d3dlowmem for people who dont want to make use of this because they have no memory.
|
||||
* Added new command line tag Cmdline_d3dlowmem for people who don't want to make use of this because they have no memory.
|
||||
* Cleaned up some more texture stuff enabled console debug for D3D.
|
||||
*
|
||||
* Revision 2.2.2.21 2002/11/04 16:04:20 randomtiger
|
||||
@@ -568,7 +568,7 @@
|
||||
*
|
||||
* Revision 2.2.2.14 2002/10/20 22:21:48 randomtiger
|
||||
* Some incomplete code to handle background drawing when message boxes are drawn.
|
||||
* It doesnt work but its a good base for someone to start from. - RT
|
||||
* It doesn't work but it's a good base for someone to start from. - RT
|
||||
*
|
||||
* Revision 2.2.2.13 2002/10/19 23:56:40 randomtiger
|
||||
* Changed generic bitmap code to allow maximum dimensions to be determined by 3D's engines maximum texture size query.
|
||||
@@ -600,7 +600,7 @@
|
||||
* Revision 2.2.2.8 2002/10/04 00:48:42 randomtiger
|
||||
* Fixed video memory leaks
|
||||
* Added code to cope with lost device, not tested
|
||||
* Got rid of some DX5 stuff we definately dont need
|
||||
* Got rid of some DX5 stuff we definately don't need
|
||||
* Moved some enum's into internal,h because gr_d3d_set_state should be able to be called from any dx file
|
||||
* Cleaned up some stuff - RT
|
||||
*
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
* Fixed setup of center_alpha in OGL which was causing crash.
|
||||
*
|
||||
* Revision 2.22 2004/02/16 11:47:33 randomtiger
|
||||
* Removed a lot of files that we dont need anymore.
|
||||
* Removed a lot of files that we don't need anymore.
|
||||
* Changed htl to be on by default, command now -nohtl
|
||||
* Changed D3D to use a 2D vertex for 2D operations which should cut down on redundant data having to go though the system.
|
||||
* Added small change to all -start_mission flag to take you to any mission by filename, very useful for testing.
|
||||
@@ -206,7 +206,7 @@
|
||||
* Changed all builds (demo, OEM) to use retail reg path, this means launcher can set all them up successfully.
|
||||
*
|
||||
* Revision 2.16 2003/11/29 10:52:09 randomtiger
|
||||
* Turned off D3D file mapping, its using too much memory which may be hurting older systems and doesnt seem to be providing much of a speed benifit.
|
||||
* Turned off D3D file mapping, it's using too much memory which may be hurting older systems and doesn't seem to be providing much of a speed benifit.
|
||||
* Added stats command for ingame stats on memory usage.
|
||||
* Trys to play intro.mve and intro.avi, just to be safe since its not set by table.
|
||||
* Added fix for fonts wrapping round in non standard hi res modes.
|
||||
@@ -258,7 +258,7 @@
|
||||
*
|
||||
* Revision 2.8 2003/10/14 17:39:13 randomtiger
|
||||
* Implemented hardware fog for the HT&L code path.
|
||||
* It doesnt use the backgrounds anymore but its still an improvement.
|
||||
* It doesn't use the backgrounds anymore but it's still an improvement.
|
||||
* Currently it fogs to a brighter colour than it should because of Bob specular code.
|
||||
* I will fix this after discussing it with Bob.
|
||||
*
|
||||
@@ -310,7 +310,7 @@
|
||||
* Revision 2.1.2.8 2002/11/04 21:24:59 randomtiger
|
||||
*
|
||||
* When running in D3D all ani's are memory mapped for speed, this takes up more memory but stops gametime locking of textures which D3D8 hates.
|
||||
* Added new command line tag Cmdline_d3dlowmem for people who dont want to make use of this because they have no memory.
|
||||
* Added new command line tag Cmdline_d3dlowmem for people who don't want to make use of this because they have no memory.
|
||||
* Cleaned up some more texture stuff enabled console debug for D3D.
|
||||
*
|
||||
* Revision 2.1.2.7 2002/10/30 22:57:21 randomtiger
|
||||
@@ -329,7 +329,7 @@
|
||||
* Revision 2.1.2.4 2002/10/04 00:48:42 randomtiger
|
||||
* Fixed video memory leaks
|
||||
* Added code to cope with lost device, not tested
|
||||
* Got rid of some DX5 stuff we definately dont need
|
||||
* Got rid of some DX5 stuff we definately don't need
|
||||
* Moved some enum's into internal,h because gr_d3d_set_state should be able to be called from any dx file
|
||||
* Cleaned up some stuff - RT
|
||||
*
|
||||
|
||||
@@ -223,7 +223,7 @@
|
||||
* Fixed setup of center_alpha in OGL which was causing crash.
|
||||
*
|
||||
* Revision 2.42 2004/02/16 11:47:33 randomtiger
|
||||
* Removed a lot of files that we dont need anymore.
|
||||
* Removed a lot of files that we don't need anymore.
|
||||
* Changed htl to be on by default, command now -nohtl
|
||||
* Changed D3D to use a 2D vertex for 2D operations which should cut down on redundant data having to go though the system.
|
||||
* Added small change to all -start_mission flag to take you to any mission by filename, very useful for testing.
|
||||
@@ -249,7 +249,7 @@
|
||||
* Undid my node fix, it introduced a lot of bugs, update again if you have that version.
|
||||
*
|
||||
* Revision 2.38 2003/11/29 10:52:09 randomtiger
|
||||
* Turned off D3D file mapping, its using too much memory which may be hurting older systems and doesnt seem to be providing much of a speed benifit.
|
||||
* Turned off D3D file mapping, it's using too much memory which may be hurting older systems and doesn't seem to be providing much of a speed benifit.
|
||||
* Added stats command for ingame stats on memory usage.
|
||||
* Trys to play intro.mve and intro.avi, just to be safe since its not set by table.
|
||||
* Added fix for fonts wrapping round in non standard hi res modes.
|
||||
@@ -335,7 +335,7 @@
|
||||
*
|
||||
* Revision 2.23 2003/10/14 17:39:13 randomtiger
|
||||
* Implemented hardware fog for the HT&L code path.
|
||||
* It doesnt use the backgrounds anymore but its still an improvement.
|
||||
* It doesn't use the backgrounds anymore but it's still an improvement.
|
||||
* Currently it fogs to a brighter colour than it should because of Bob specular code.
|
||||
* I will fix this after discussing it with Bob.
|
||||
*
|
||||
@@ -489,7 +489,7 @@
|
||||
*
|
||||
* Revision 2.3.2.13 2002/10/20 22:21:48 randomtiger
|
||||
* Some incomplete code to handle background drawing when message boxes are drawn.
|
||||
* It doesnt work but its a good base for someone to start from. - RT
|
||||
* It doesn't work but it's a good base for someone to start from. - RT
|
||||
*
|
||||
* Revision 2.3.2.12 2002/10/16 00:41:38 randomtiger
|
||||
* Fixed small bug that was stopping unactive text from displaying greyed out
|
||||
@@ -517,7 +517,7 @@
|
||||
* Revision 2.3.2.8 2002/10/04 00:48:42 randomtiger
|
||||
* Fixed video memory leaks
|
||||
* Added code to cope with lost device, not tested
|
||||
* Got rid of some DX5 stuff we definately dont need
|
||||
* Got rid of some DX5 stuff we definately don't need
|
||||
* Moved some enum's into internal,h because gr_d3d_set_state should be able to be called from any dx file
|
||||
* Cleaned up some stuff - RT
|
||||
*
|
||||
|
||||
@@ -1187,7 +1187,7 @@ bool d3d_init_device()
|
||||
D3DCREATE_SOFTWARE_VERTEXPROCESSING};
|
||||
|
||||
// Use a pure device if we can, it really speeds things up
|
||||
// However it means we cant use Get* functions (aside from GetFrontBuffer, GetCaps, etc)
|
||||
// However it means we can't use Get* functions (aside from GetFrontBuffer, GetCaps, etc)
|
||||
if(got_caps && GlobalD3DVars::d3d_caps.DevCaps & D3DDEVCAPS_PUREDEVICE) {
|
||||
vptypes[0] |= D3DCREATE_PUREDEVICE;
|
||||
mprintf((" Using PURE D3D Device\n"));
|
||||
@@ -1237,7 +1237,7 @@ bool d3d_init_device()
|
||||
|
||||
sprintf(Device_init_error, "Failed to get init mode");
|
||||
|
||||
// Lets draw attension to this bug which we dont yet understand
|
||||
// Let's draw attension to this bug which we don't yet understand
|
||||
if(got_caps == false)
|
||||
{
|
||||
sprintf(Device_init_error,
|
||||
@@ -1382,7 +1382,7 @@ bool d3d_inspect_caps()
|
||||
|
||||
if ( not_good ) {
|
||||
strcpy(Device_init_error, missing_features);
|
||||
// return false; I dont think it should fail on this - RT
|
||||
// return false; I don't think it should fail on this - RT
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1561,7 +1561,6 @@ bool gr_d3d_init()
|
||||
d3d_setup_color();
|
||||
|
||||
// Tell FreeSpace code that we're using Direct3D.
|
||||
D3D_enabled = 1;
|
||||
GlobalD3DVars::D3D_inited = true;
|
||||
|
||||
d3d_generate_state_blocks();
|
||||
@@ -1612,7 +1611,7 @@ void gr_d3d_cleanup()
|
||||
|
||||
d3d_tcache_cleanup();
|
||||
|
||||
// Ensures gamma options dont return to the desktop
|
||||
// Ensures gamma options don't return to the desktop
|
||||
gr_d3d_set_gamma(1.0);
|
||||
|
||||
// release surfaces
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
* and posably fixed Turnsky's shinemap bug
|
||||
*
|
||||
* Revision 2.30 2004/02/16 11:47:33 randomtiger
|
||||
* Removed a lot of files that we dont need anymore.
|
||||
* Removed a lot of files that we don't need anymore.
|
||||
* Changed htl to be on by default, command now -nohtl
|
||||
* Changed D3D to use a 2D vertex for 2D operations which should cut down on redundant data having to go though the system.
|
||||
* Added small change to all -start_mission flag to take you to any mission by filename, very useful for testing.
|
||||
@@ -345,7 +345,7 @@
|
||||
* Revision 2.1.2.20 2002/11/04 21:24:59 randomtiger
|
||||
*
|
||||
* When running in D3D all ani's are memory mapped for speed, this takes up more memory but stops gametime locking of textures which D3D8 hates.
|
||||
* Added new command line tag Cmdline_d3dlowmem for people who dont want to make use of this because they have no memory.
|
||||
* Added new command line tag Cmdline_d3dlowmem for people who don't want to make use of this because they have no memory.
|
||||
* Cleaned up some more texture stuff enabled console debug for D3D.
|
||||
*
|
||||
* Revision 2.1.2.19 2002/11/04 03:02:29 randomtiger
|
||||
@@ -411,7 +411,7 @@
|
||||
* Revision 2.1.2.8 2002/10/04 00:48:42 randomtiger
|
||||
* Fixed video memory leaks
|
||||
* Added code to cope with lost device, not tested
|
||||
* Got rid of some DX5 stuff we definately dont need
|
||||
* Got rid of some DX5 stuff we definately don't need
|
||||
* Moved some enum's into internal,h because gr_d3d_set_state should be able to be called from any dx file
|
||||
* Cleaned up some stuff - RT
|
||||
*
|
||||
@@ -803,7 +803,7 @@ void d3d_tcache_get_adjusted_texture_size(int w_in, int h_in, int *w_out, int *h
|
||||
|
||||
void *d3d_vimage_to_texture(int bitmap_type, int bpp, void *thandle, ushort *data, int src_w, int src_h, int *tex_w, int *tex_h, float *u_scale, float *v_scale, int reload)
|
||||
{
|
||||
// Dont prepare
|
||||
// Don't prepare
|
||||
bool use_mipmapping = (bitmap_type != TCACHE_TYPE_INTERFACE);
|
||||
|
||||
if(Cmdline_mipmap == 0) {
|
||||
@@ -1247,7 +1247,7 @@ void d3d_tcache_init()
|
||||
D3D_pow2_textures = (GlobalD3DVars::d3d_caps.TextureCaps & D3DPTEXTURECAPS_POW2) ? 1 : 0;
|
||||
|
||||
|
||||
// RT I dont think wide surfaces are supported in D3D8 so we need this code
|
||||
// RT I don't think wide surfaces are supported in D3D8 so we need this code
|
||||
if(0)
|
||||
{
|
||||
if ( D3D_max_texture_width > gr_screen.max_w ) {
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.3 2004/02/16 11:47:33 randomtiger
|
||||
* Removed a lot of files that we dont need anymore.
|
||||
* Removed a lot of files that we don't need anymore.
|
||||
* Changed htl to be on by default, command now -nohtl
|
||||
* Changed D3D to use a 2D vertex for 2D operations which should cut down on redundant data having to go though the system.
|
||||
* Added small change to all -start_mission flag to take you to any mission by filename, very useful for testing.
|
||||
@@ -251,6 +251,7 @@
|
||||
#include "globalincs/globals.h" // just in case pstypes.h messed up
|
||||
|
||||
extern int Gr_cursor;
|
||||
extern int Gr_cursor_size;
|
||||
|
||||
//#define GR_SCREEN_PTR(type,x,y) ((type *)(ptr_u(gr_screen.offscreen_buffer) + ptr_u(((x)+gr_screen.offset_x)*sizeof(type)) + ptr_u(((y)+gr_screen.offset_y)*gr_screen.rowsize)))
|
||||
//#define GR_SCREEN_PTR_SIZE(bpp,x,y) ((ptr_u)(ptr_u(gr_screen.offscreen_buffer) + ptr_u(((x)+gr_screen.offset_x)*(bpp)) + ptr_u(((y)+gr_screen.offset_y)*gr_screen.rowsize)))
|
||||
|
||||
+329
-2103
File diff suppressed because it is too large.
Load diff
+457
-16
@@ -184,8 +184,10 @@
|
||||
#define STUB_FUNCTION 0
|
||||
#elif defined(SCP_UNIX)
|
||||
#ifdef __APPLE__
|
||||
#define GL_GLEXT_LEGACY // I'd like to punch the idiot that made this needed
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#define GL_GLEXT_FUNCTION_POINTERS // we need the ptr versions of the functions
|
||||
#include <OpenGL/glext.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
@@ -198,6 +200,14 @@
|
||||
#include "graphics/grinternal.h"
|
||||
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRYP
|
||||
#define APIENTRYP APIENTRY *
|
||||
#endif
|
||||
|
||||
// in case it's missing from the GL headers
|
||||
#ifndef GL_ARB_pixel_buffer_object
|
||||
#define GL_ARB_pixel_buffer_object 1
|
||||
@@ -273,6 +283,49 @@
|
||||
#define GL_COORD_REPLACE_ARB 0x8862
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_vertex_buffer_object
|
||||
#define GL_ARB_vertex_buffer_object 1
|
||||
#ifdef __APPLE__
|
||||
typedef long GLintptrARB;
|
||||
typedef long GLsizeiptrARB;
|
||||
|
||||
typedef void (* glBindBufferARBProcPtr) (GLenum target, GLuint buffer);
|
||||
typedef void (* glDeleteBuffersARBProcPtr) (GLsizei n, const GLuint *buffers);
|
||||
typedef void (* glGenBuffersARBProcPtr) (GLsizei n, GLuint *buffers);
|
||||
typedef GLboolean (* glIsBufferARBProcPtr) (GLuint buffer);
|
||||
typedef void (* glBufferDataARBProcPtr) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);
|
||||
typedef void (* glBufferSubDataARBProcPtr) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data);
|
||||
typedef void (* glGetBufferSubDataARBProcPtr) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data);
|
||||
typedef GLvoid *(* glMapBufferARBProcPtr) (GLenum target, GLenum access);
|
||||
typedef GLboolean (* glUnmapBufferARBProcPtr) (GLenum target);
|
||||
typedef void (* glGetBufferParameterivARBProcPtr) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (* glGetBufferPointervARBProcPtr) (GLenum target, GLenum pname, GLvoid **params);
|
||||
#else
|
||||
typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
|
||||
typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
|
||||
typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
|
||||
typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer);
|
||||
typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);
|
||||
typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data);
|
||||
typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access);
|
||||
typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target);
|
||||
typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params);
|
||||
#endif // __APPLE__
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_compiled_vertex_array
|
||||
#define GL_EXT_compiled_vertex_array 1
|
||||
#ifdef __APPLE__
|
||||
typedef void (* glLockArraysEXTProcPtr) (GLint, GLsizei);
|
||||
typedef void (* glUnlockArraysEXTProcPtr) (void);
|
||||
#else
|
||||
typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);
|
||||
typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void);
|
||||
#endif // __APPLE__
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_framebuffer_object
|
||||
#define GL_EXT_framebuffer_object 1
|
||||
#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
|
||||
@@ -328,10 +381,25 @@
|
||||
#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
|
||||
#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
|
||||
|
||||
#ifndef APIENTRYP
|
||||
#define APIENTRYP APIENTRY *
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
typedef GLboolean (* glIsRenderbufferEXTProcPtr) (GLuint renderbuffer);
|
||||
typedef void (* glBindRenderbufferEXTProcPtr) (GLenum target, GLuint renderbuffer);
|
||||
typedef void (* glDeleteRenderbuffersEXTProcPtr) (GLsizei n, const GLuint *renderbuffers);
|
||||
typedef void (* glGenRenderbuffersEXTProcPtr) (GLsizei n, GLuint *renderbuffers);
|
||||
typedef void (* glRenderbufferStorageEXTProcPtr) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (* glGetRenderbufferParameterivEXTProcPtr) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef GLboolean (* glIsFramebufferEXTProcPtr) (GLuint framebuffer);
|
||||
typedef void (* glBindFramebufferEXTProcPtr) (GLenum target, GLuint framebuffer);
|
||||
typedef void (* glDeleteFramebuffersEXTProcPtr) (GLsizei n, const GLuint *framebuffers);
|
||||
typedef void (* glGenFramebuffersEXTProcPtr) (GLsizei n, GLuint *framebuffers);
|
||||
typedef GLenum (* glCheckFramebufferStatusEXTProcPtr) (GLenum target);
|
||||
typedef void (* glFramebufferTexture1DEXTProcPtr) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (* glFramebufferTexture2DEXTProcPtr) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (* glFramebufferTexture3DEXTProcPtr) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
|
||||
typedef void (* glFramebufferRenderbufferEXTProcPtr) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef void (* glGetFramebufferAttachmentParameterivEXTProcPtr) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
typedef void (* glGenerateMipmapEXTProcPtr) (GLenum target);
|
||||
#else
|
||||
typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);
|
||||
typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);
|
||||
typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers);
|
||||
@@ -349,24 +417,397 @@ typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum
|
||||
typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target);
|
||||
#endif // __APPLE__
|
||||
#endif // GL_EXT_framebuffer_object
|
||||
|
||||
#ifndef GL_ARB_shader_objects
|
||||
#define GL_ARB_shader_objects 1
|
||||
#define GL_PROGRAM_OBJECT_ARB 0x8B40
|
||||
#define GL_SHADER_OBJECT_ARB 0x8B48
|
||||
#define GL_OBJECT_TYPE_ARB 0x8B4E
|
||||
#define GL_OBJECT_SUBTYPE_ARB 0x8B4F
|
||||
#define GL_FLOAT_VEC2_ARB 0x8B50
|
||||
#define GL_FLOAT_VEC3_ARB 0x8B51
|
||||
#define GL_FLOAT_VEC4_ARB 0x8B52
|
||||
#define GL_INT_VEC2_ARB 0x8B53
|
||||
#define GL_INT_VEC3_ARB 0x8B54
|
||||
#define GL_INT_VEC4_ARB 0x8B55
|
||||
#define GL_BOOL_ARB 0x8B56
|
||||
#define GL_BOOL_VEC2_ARB 0x8B57
|
||||
#define GL_BOOL_VEC3_ARB 0x8B58
|
||||
#define GL_BOOL_VEC4_ARB 0x8B59
|
||||
#define GL_FLOAT_MAT2_ARB 0x8B5A
|
||||
#define GL_FLOAT_MAT3_ARB 0x8B5B
|
||||
#define GL_FLOAT_MAT4_ARB 0x8B5C
|
||||
#define GL_SAMPLER_1D_ARB 0x8B5D
|
||||
#define GL_SAMPLER_2D_ARB 0x8B5E
|
||||
#define GL_SAMPLER_3D_ARB 0x8B5F
|
||||
#define GL_SAMPLER_CUBE_ARB 0x8B60
|
||||
#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61
|
||||
#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62
|
||||
#define GL_SAMPLER_2D_RECT_ARB 0x8B63
|
||||
#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64
|
||||
#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80
|
||||
#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81
|
||||
#define GL_OBJECT_LINK_STATUS_ARB 0x8B82
|
||||
#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83
|
||||
#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84
|
||||
#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85
|
||||
#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86
|
||||
#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87
|
||||
#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88
|
||||
|
||||
typedef char GLcharARB; /* native character */
|
||||
typedef unsigned int GLhandleARB; /* shader object handle */
|
||||
|
||||
#ifdef __APPLE__
|
||||
typedef void (* glDeleteObjectARBProcPtr) (GLhandleARB obj);
|
||||
typedef GLhandleARB (* glGetHandleARBProcPtr) (GLenum pname);
|
||||
typedef void (* glDetachObjectARBProcPtr) (GLhandleARB containerObj, GLhandleARB attachedObj);
|
||||
typedef GLhandleARB (* glCreateShaderObjectARBProcPtr) (GLenum shaderType);
|
||||
typedef void (* glShaderSourceARBProcPtr) (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length);
|
||||
typedef void (* glCompileShaderARBProcPtr) (GLhandleARB shaderObj);
|
||||
typedef GLhandleARB (* glCreateProgramObjectARBProcPtr) (void);
|
||||
typedef void (* glAttachObjectARBProcPtr) (GLhandleARB containerObj, GLhandleARB obj);
|
||||
typedef void (* glLinkProgramARBProcPtr) (GLhandleARB programObj);
|
||||
typedef void (* glUseProgramObjectARBProcPtr) (GLhandleARB programObj);
|
||||
typedef void (* glValidateProgramARBProcPtr) (GLhandleARB programObj);
|
||||
typedef void (* glUniform1fARBProcPtr) (GLint location, GLfloat v0);
|
||||
typedef void (* glUniform2fARBProcPtr) (GLint location, GLfloat v0, GLfloat v1);
|
||||
typedef void (* glUniform3fARBProcPtr) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
typedef void (* glUniform4fARBProcPtr) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
typedef void (* glUniform1iARBProcPtr) (GLint location, GLint v0);
|
||||
typedef void (* glUniform2iARBProcPtr) (GLint location, GLint v0, GLint v1);
|
||||
typedef void (* glUniform3iARBProcPtr) (GLint location, GLint v0, GLint v1, GLint v2);
|
||||
typedef void (* glUniform4iARBProcPtr) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
typedef void (* glUniform1fvARBProcPtr) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (* glUniform2fvARBProcPtr) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (* glUniform3fvARBProcPtr) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (* glUniform4fvARBProcPtr) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (* glUniform1ivARBProcPtr) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (* glUniform2ivARBProcPtr) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (* glUniform3ivARBProcPtr) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (* glUniform4ivARBProcPtr) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (* glUniformMatrix2fvARBProcPtr) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (* glUniformMatrix3fvARBProcPtr) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (* glUniformMatrix4fvARBProcPtr) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (* glGetObjectParameterfvARBProcPtr) (GLhandleARB obj, GLenum pname, GLfloat *params);
|
||||
typedef void (* glGetObjectParameterivARBProcPtr) (GLhandleARB obj, GLenum pname, GLint *params);
|
||||
typedef void (* glGetInfoLogARBProcPtr) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);
|
||||
typedef void (* glGetAttachedObjectsARBProcPtr) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);
|
||||
typedef GLint (* glGetUniformLocationARBProcPtr) (GLhandleARB programObj, const GLcharARB *name);
|
||||
typedef void (* glGetActiveUniformARBProcPtr) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
|
||||
typedef void (* glGetUniformfvARBProcPtr) (GLhandleARB programObj, GLint location, GLfloat *params);
|
||||
typedef void (* glGetUniformivARBProcPtr) (GLhandleARB programObj, GLint location, GLint *params);
|
||||
typedef void (* glGetShaderSourceARBProcPtr) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
|
||||
#else
|
||||
typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj);
|
||||
typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname);
|
||||
typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj);
|
||||
typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType);
|
||||
typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length);
|
||||
typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj);
|
||||
typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void);
|
||||
typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj);
|
||||
typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj);
|
||||
typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj);
|
||||
typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);
|
||||
typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);
|
||||
typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);
|
||||
typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
|
||||
typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
|
||||
#endif // __APPLE__
|
||||
#endif // GL_ARB_shader_objects
|
||||
|
||||
#ifndef GL_ARB_vertex_shader
|
||||
#define GL_ARB_vertex_shader 1
|
||||
#define GL_VERTEX_SHADER_ARB 0x8B31
|
||||
#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A
|
||||
#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B
|
||||
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C
|
||||
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D
|
||||
#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89
|
||||
#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A
|
||||
|
||||
#ifdef __APPLE__
|
||||
typedef void (* glBindAttribLocationARBProcPtr) (GLhandleARB programObj, GLuint index, const GLcharARB *name);
|
||||
typedef void (* glGetActiveAttribARBProcPtr) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
|
||||
typedef GLint (* glGetAttribLocationARBProcPtr) (GLhandleARB programObj, const GLcharARB *name);
|
||||
#else
|
||||
typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name);
|
||||
typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
|
||||
typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);
|
||||
#endif // __APPLE__
|
||||
#endif // GL_ARB_vertex_shader
|
||||
|
||||
#ifndef GL_ARB_fragment_shader
|
||||
#define GL_ARB_fragment_shader 1
|
||||
#define GL_FRAGMENT_SHADER_ARB 0x8B30
|
||||
#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49
|
||||
#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B
|
||||
#endif // GL_ARB_fragment_shader
|
||||
|
||||
#ifndef GL_ARB_shading_language_100
|
||||
#define GL_ARB_shading_language_100 1
|
||||
#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
|
||||
#endif // GL_ARB_shading_language_100
|
||||
|
||||
// as usual, OS X headers completely suck
|
||||
#ifndef GL_SHADING_LANGUAGE_VERSION_ARB
|
||||
#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
|
||||
#endif
|
||||
|
||||
// most of following is probably useless, but some of it is required by GL_ARB_*_shader
|
||||
#ifndef GL_ARB_vertex_program
|
||||
#define GL_ARB_vertex_program 1
|
||||
#define GL_COLOR_SUM_ARB 0x8458
|
||||
#define GL_VERTEX_PROGRAM_ARB 0x8620
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625
|
||||
#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626
|
||||
#define GL_PROGRAM_LENGTH_ARB 0x8627
|
||||
#define GL_PROGRAM_STRING_ARB 0x8628
|
||||
#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E
|
||||
#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F
|
||||
#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640
|
||||
#define GL_CURRENT_MATRIX_ARB 0x8641
|
||||
#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642
|
||||
#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645
|
||||
#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B
|
||||
#define GL_PROGRAM_BINDING_ARB 0x8677
|
||||
#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A
|
||||
#define GL_PROGRAM_ERROR_STRING_ARB 0x8874
|
||||
#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875
|
||||
#define GL_PROGRAM_FORMAT_ARB 0x8876
|
||||
#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0
|
||||
#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1
|
||||
#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2
|
||||
#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3
|
||||
#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4
|
||||
#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5
|
||||
#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6
|
||||
#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7
|
||||
#define GL_PROGRAM_PARAMETERS_ARB 0x88A8
|
||||
#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9
|
||||
#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA
|
||||
#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB
|
||||
#define GL_PROGRAM_ATTRIBS_ARB 0x88AC
|
||||
#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD
|
||||
#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE
|
||||
#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF
|
||||
#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0
|
||||
#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1
|
||||
#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2
|
||||
#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3
|
||||
#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4
|
||||
#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5
|
||||
#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6
|
||||
#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7
|
||||
#define GL_MATRIX0_ARB 0x88C0
|
||||
#define GL_MATRIX1_ARB 0x88C1
|
||||
#define GL_MATRIX2_ARB 0x88C2
|
||||
#define GL_MATRIX3_ARB 0x88C3
|
||||
#define GL_MATRIX4_ARB 0x88C4
|
||||
#define GL_MATRIX5_ARB 0x88C5
|
||||
#define GL_MATRIX6_ARB 0x88C6
|
||||
#define GL_MATRIX7_ARB 0x88C7
|
||||
#define GL_MATRIX8_ARB 0x88C8
|
||||
#define GL_MATRIX9_ARB 0x88C9
|
||||
#define GL_MATRIX10_ARB 0x88CA
|
||||
#define GL_MATRIX11_ARB 0x88CB
|
||||
#define GL_MATRIX12_ARB 0x88CC
|
||||
#define GL_MATRIX13_ARB 0x88CD
|
||||
#define GL_MATRIX14_ARB 0x88CE
|
||||
#define GL_MATRIX15_ARB 0x88CF
|
||||
#define GL_MATRIX16_ARB 0x88D0
|
||||
#define GL_MATRIX17_ARB 0x88D1
|
||||
#define GL_MATRIX18_ARB 0x88D2
|
||||
#define GL_MATRIX19_ARB 0x88D3
|
||||
#define GL_MATRIX20_ARB 0x88D4
|
||||
#define GL_MATRIX21_ARB 0x88D5
|
||||
#define GL_MATRIX22_ARB 0x88D6
|
||||
#define GL_MATRIX23_ARB 0x88D7
|
||||
#define GL_MATRIX24_ARB 0x88D8
|
||||
#define GL_MATRIX25_ARB 0x88D9
|
||||
#define GL_MATRIX26_ARB 0x88DA
|
||||
#define GL_MATRIX27_ARB 0x88DB
|
||||
#define GL_MATRIX28_ARB 0x88DC
|
||||
#define GL_MATRIX29_ARB 0x88DD
|
||||
#define GL_MATRIX30_ARB 0x88DE
|
||||
#define GL_MATRIX31_ARB 0x88DF
|
||||
|
||||
#ifdef __APPLE__
|
||||
typedef void (* glVertexAttrib1dARBProcPtr) (GLuint index, GLdouble x);
|
||||
typedef void (* glVertexAttrib1dvARBProcPtr) (GLuint index, const GLdouble *v);
|
||||
typedef void (* glVertexAttrib1fARBProcPtr) (GLuint index, GLfloat x);
|
||||
typedef void (* glVertexAttrib1fvARBProcPtr) (GLuint index, const GLfloat *v);
|
||||
typedef void (* glVertexAttrib1sARBProcPtr) (GLuint index, GLshort x);
|
||||
typedef void (* glVertexAttrib1svARBProcPtr) (GLuint index, const GLshort *v);
|
||||
typedef void (* glVertexAttrib2dARBProcPtr) (GLuint index, GLdouble x, GLdouble y);
|
||||
typedef void (* glVertexAttrib2dvARBProcPtr) (GLuint index, const GLdouble *v);
|
||||
typedef void (* glVertexAttrib2fARBProcPtr) (GLuint index, GLfloat x, GLfloat y);
|
||||
typedef void (* glVertexAttrib2fvARBProcPtr) (GLuint index, const GLfloat *v);
|
||||
typedef void (* glVertexAttrib2sARBProcPtr) (GLuint index, GLshort x, GLshort y);
|
||||
typedef void (* glVertexAttrib2svARBProcPtr) (GLuint index, const GLshort *v);
|
||||
typedef void (* glVertexAttrib3dARBProcPtr) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
|
||||
typedef void (* glVertexAttrib3dvARBProcPtr) (GLuint index, const GLdouble *v);
|
||||
typedef void (* glVertexAttrib3fARBProcPtr) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
|
||||
typedef void (* glVertexAttrib3fvARBProcPtr) (GLuint index, const GLfloat *v);
|
||||
typedef void (* glVertexAttrib3sARBProcPtr) (GLuint index, GLshort x, GLshort y, GLshort z);
|
||||
typedef void (* glVertexAttrib3svARBProcPtr) (GLuint index, const GLshort *v);
|
||||
typedef void (* glVertexAttrib4NbvARBProcPtr) (GLuint index, const GLbyte *v);
|
||||
typedef void (* glVertexAttrib4NivARBProcPtr) (GLuint index, const GLint *v);
|
||||
typedef void (* glVertexAttrib4NsvARBProcPtr) (GLuint index, const GLshort *v);
|
||||
typedef void (* glVertexAttrib4NubARBProcPtr) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
|
||||
typedef void (* glVertexAttrib4NubvARBProcPtr) (GLuint index, const GLubyte *v);
|
||||
typedef void (* glVertexAttrib4NuivARBProcPtr) (GLuint index, const GLuint *v);
|
||||
typedef void (* glVertexAttrib4NusvARBProcPtr) (GLuint index, const GLushort *v);
|
||||
typedef void (* glVertexAttrib4bvARBProcPtr) (GLuint index, const GLbyte *v);
|
||||
typedef void (* glVertexAttrib4dARBProcPtr) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef void (* glVertexAttrib4dvARBProcPtr) (GLuint index, const GLdouble *v);
|
||||
typedef void (* glVertexAttrib4fARBProcPtr) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (* glVertexAttrib4fvARBProcPtr) (GLuint index, const GLfloat *v);
|
||||
typedef void (* glVertexAttrib4ivARBProcPtr) (GLuint index, const GLint *v);
|
||||
typedef void (* glVertexAttrib4sARBProcPtr) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
|
||||
typedef void (* glVertexAttrib4svARBProcPtr) (GLuint index, const GLshort *v);
|
||||
typedef void (* glVertexAttrib4ubvARBProcPtr) (GLuint index, const GLubyte *v);
|
||||
typedef void (* glVertexAttrib4uivARBProcPtr) (GLuint index, const GLuint *v);
|
||||
typedef void (* glVertexAttrib4usvARBProcPtr) (GLuint index, const GLushort *v);
|
||||
typedef void (* glVertexAttribPointerARBProcPtr) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
|
||||
typedef void (* glDisableVertexAttribArrayARBProcPtr) (GLuint index);
|
||||
typedef void (* glEnableVertexAttribArrayARBProcPtr) (GLuint index);
|
||||
typedef void (* glGetVertexAttribPointervARBProcPtr) (GLuint index, GLenum pname, GLvoid **pointer);
|
||||
typedef void (* glGetVertexAttribdvARBProcPtr) (GLuint index, GLenum pname, GLdouble *params);
|
||||
typedef void (* glGetVertexAttribfvARBProcPtr) (GLuint index, GLenum pname, GLfloat *params);
|
||||
typedef void (* glGetVertexAttribivARBProcPtr) (GLuint index, GLenum pname, GLint *params);
|
||||
typedef void (* glBindProgramARBProcPtr) (GLenum target, GLuint program);
|
||||
typedef void (* glDeleteProgramsARBProcPtr) (GLsizei n, const GLuint *programs);
|
||||
typedef void (* glGenProgramsARBProcPtr) (GLsizei n, GLuint *programs);
|
||||
typedef GLboolean (* glIsProgramARBProcPtr) (GLuint program);
|
||||
typedef void (* glProgramEnvParameter4dARBProcPtr) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef void (* glProgramEnvParameter4dvARBProcPtr) (GLenum target, GLuint index, const GLdouble *params);
|
||||
typedef void (* glProgramEnvParameter4fARBProcPtr) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (* glProgramEnvParameter4fvARBProcPtr) (GLenum target, GLuint index, const GLfloat *params);
|
||||
typedef void (* glProgramLocalParameter4dARBProcPtr) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef void (* glProgramLocalParameter4dvARBProcPtr) (GLenum target, GLuint index, const GLdouble *params);
|
||||
typedef void (* glProgramLocalParameter4fARBProcPtr) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (* glProgramLocalParameter4fvARBProcPtr) (GLenum target, GLuint index, const GLfloat *params);
|
||||
typedef void (* glGetProgramEnvParameterdvARBProcPtr) (GLenum target, GLuint index, GLdouble *params);
|
||||
typedef void (* glGetProgramEnvParameterfvARBProcPtr) (GLenum target, GLuint index, GLfloat *params);
|
||||
typedef void (* glGetProgramLocalParameterdvARBProcPtr) (GLenum target, GLuint index, GLdouble *params);
|
||||
typedef void (* glGetProgramLocalParameterfvARBProcPtr) (GLenum target, GLuint index, GLfloat *params);
|
||||
typedef void (* glProgramStringARBProcPtr) (GLenum target, GLenum format, GLsizei len, const GLvoid *string);
|
||||
typedef void (* glGetProgramStringARBProcPtr) (GLenum target, GLenum pname, GLvoid *string);
|
||||
typedef void (* glGetProgramivARBProcPtr) (GLenum target, GLenum pname, GLint *params);
|
||||
#else
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
|
||||
typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
|
||||
typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string);
|
||||
typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program);
|
||||
typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs);
|
||||
typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params);
|
||||
typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params);
|
||||
typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string);
|
||||
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params);
|
||||
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer);
|
||||
typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program);
|
||||
#endif // __APPLE__
|
||||
#endif // GL_ARB_vertex_program
|
||||
|
||||
|
||||
const ubyte GL_zero_3ub[3] = { 0, 0, 0 };
|
||||
|
||||
void gr_opengl_init(int reinit=0);
|
||||
bool gr_opengl_init();
|
||||
void gr_opengl_cleanup(int minimize=1);
|
||||
void opengl_setup_render_states(int &r,int &g,int &b,int &alpha, int &tmap_type, int flags, int is_scaler = 0);
|
||||
void opengl_set_state(gr_texture_source ts, gr_alpha_blend ab, gr_zbuffer_type zt);
|
||||
//void gr_opengl_bitmap(int x, int y);
|
||||
void gr_opengl_bitmap_ex(int x, int y, int w, int h, int sx, int sy, bool resize);
|
||||
void opengl_set_spec_mapping(int tmap_type, float *u_scale, float *v_scale, int stage = 0 );
|
||||
void opengl_reset_spec_mapping();
|
||||
int opengl_check_for_errors();
|
||||
int opengl_check_for_errors(char *err_at = NULL);
|
||||
|
||||
extern int VBO_ENABLED;
|
||||
#ifndef NDEBUG
|
||||
#define GL_CHECK_FOR_ERRORS(s) opengl_check_for_errors((s))
|
||||
#else
|
||||
#define GL_CHECK_FOR_ERRORS(s)
|
||||
#endif
|
||||
|
||||
extern gr_texture_source GL_current_tex_src;
|
||||
extern gr_alpha_blend GL_current_alpha_blend;
|
||||
extern gr_zbuffer_type GL_current_ztype;
|
||||
extern int Use_VBOs;
|
||||
extern int Use_PBOs;
|
||||
extern int Use_GLSL;
|
||||
|
||||
#endif
|
||||
@@ -218,6 +218,7 @@ int gr_opengl_bm_load(ubyte type, int n, char *filename, CFILE *img_cfp, int *w,
|
||||
|
||||
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;
|
||||
@@ -302,7 +303,7 @@ 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()
|
||||
{
|
||||
gr_opengl_preload_init();
|
||||
opengl_preload_init();
|
||||
}
|
||||
|
||||
extern void bm_clean_slot(int n);
|
||||
@@ -645,8 +646,9 @@ void gr_opengl_bm_save_render_target(int n)
|
||||
{
|
||||
Assert( (n >= 0) && (n < MAX_BITMAPS) );
|
||||
|
||||
if ( !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) || Cmdline_no_fbo )
|
||||
if ( !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) || Cmdline_no_fbo ) {
|
||||
return;
|
||||
}
|
||||
|
||||
bitmap_entry *be = &bm_bitmaps[n];
|
||||
bitmap *bmp = &be->bm;
|
||||
@@ -667,11 +669,13 @@ int gr_opengl_bm_make_render_target(int n, int *width, int *height, ubyte *bpp,
|
||||
{
|
||||
Assert( (n >= 0) && (n < MAX_BITMAPS) );
|
||||
|
||||
if ( !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) || Cmdline_no_fbo )
|
||||
if ( !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) || Cmdline_no_fbo ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( (flags & BMP_FLAG_CUBEMAP) && !Is_Extension_Enabled(OGL_ARB_TEXTURE_CUBE_MAP) )
|
||||
if ( (flags & BMP_FLAG_CUBEMAP) && !Is_Extension_Enabled(OGL_ARB_TEXTURE_CUBE_MAP) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( (flags & BMP_FLAG_CUBEMAP) && (*width != *height) ) {
|
||||
MIN(*width, *height) = MAX(*width, *height);
|
||||
@@ -679,16 +683,18 @@ int gr_opengl_bm_make_render_target(int n, int *width, int *height, ubyte *bpp,
|
||||
|
||||
Assert( is_power_of_two(*width, *height) );
|
||||
|
||||
if ( opengl_make_render_target(bm_bitmaps[n].handle, n, width, height, bpp, mm_lvl, flags) )
|
||||
if ( opengl_make_render_target(bm_bitmaps[n].handle, n, width, height, bpp, mm_lvl, flags) ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gr_opengl_bm_set_render_target(int n, int face)
|
||||
{
|
||||
if ( !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) || Cmdline_no_fbo )
|
||||
if ( !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) || Cmdline_no_fbo ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (n == -1) {
|
||||
opengl_set_render_target(-1);
|
||||
@@ -699,8 +705,9 @@ int gr_opengl_bm_set_render_target(int n, int face)
|
||||
|
||||
int is_static = (bm_bitmaps[n].type == BM_TYPE_RENDER_TARGET_STATIC);
|
||||
|
||||
if ( opengl_set_render_target(n, face, is_static) )
|
||||
if ( opengl_set_render_target(n, face, is_static) ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) Volition, Inc. 1999. All rights reserved.
|
||||
*
|
||||
* All source code herein is the property of Volition, Inc. You may not sell
|
||||
* or otherwise commercially exploit the source or things you created based on the
|
||||
* source.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GR_OPENGLDRAW_H
|
||||
#define GR_OPENGLDRAW_H
|
||||
|
||||
|
||||
typedef struct glvertexc {
|
||||
float x, y, z;
|
||||
float u, v;
|
||||
ubyte r, g, b, a;
|
||||
} glvertexc;
|
||||
|
||||
extern glvertexc *GLVertex_c;
|
||||
|
||||
|
||||
|
||||
void gr_opengl_aabitmap_ex(int x, int y, int w, int h, int sx, int sy, bool resize, bool mirror);
|
||||
void gr_opengl_aabitmap(int x, int y, bool resize, bool mirror);
|
||||
void gr_opengl_string(int sx, int sy, char *s, bool resize = true);
|
||||
void gr_opengl_string(float sx, float sy, char *s, bool resize = true);
|
||||
void gr_opengl_line(int x1,int y1,int x2,int y2, bool resize);
|
||||
void gr_opengl_aaline(vertex *v1, vertex *v2);
|
||||
void gr_opengl_pixel(int x, int y, bool resize);
|
||||
void gr_opengl_gradient(int x1, int y1, int x2, int y2, bool resize);
|
||||
void gr_opengl_circle(int xc, int yc, int d, bool resize);
|
||||
void gr_opengl_curve(int xc, int yc, int r, int direction);
|
||||
void gr_opengl_scaler(vertex *va, vertex *vb);
|
||||
void gr_opengl_cross_fade(int bmap1, int bmap2, int x1, int y1, int x2, int y2, float pct);
|
||||
void gr_opengl_shade(int x, int y, int w, int h, bool resize);
|
||||
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_bitmap_ex(int x, int y, int w, int h, int sx, int sy, bool resize);
|
||||
|
||||
void opengl_render_timer_bar(int colour, float x, float y, float w, float h);
|
||||
void opengl_set_spec_mapping(int tmap_type, float *u_scale, float *v_scale, int stage = 0);
|
||||
void opengl_reset_spec_mapping();
|
||||
|
||||
void gr_opengl_line_htl(vec3d *start, vec3d *end);
|
||||
void gr_opengl_sphere_htl(float rad);
|
||||
|
||||
void gr_opengl_draw_line_list(colored_vector *lines, int num);
|
||||
|
||||
#endif // !GR_OPENGLDRAW_H
|
||||
@@ -119,6 +119,9 @@
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "graphics/gropengl.h"
|
||||
#include "graphics/gropenglextension.h"
|
||||
#include "graphics/gropengltexture.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "ddsutils/ddsutils.h"
|
||||
|
||||
#include "osapi/outwnd.h"
|
||||
|
||||
@@ -132,7 +135,7 @@ char *OGL_extension_string = NULL;
|
||||
// - number of extensions to check for
|
||||
// - extension name(s) (max is 3 variants)
|
||||
// - number of functions that extension needs/wants
|
||||
// - function names that extension needs (max is 15)
|
||||
// - function names that extension needs (max is 20)
|
||||
|
||||
// OpenGL extensions that we will want to use
|
||||
ogl_extension GL_Extensions[NUM_OGL_EXTENSIONS] =
|
||||
@@ -193,9 +196,9 @@ ogl_extension GL_Extensions[NUM_OGL_EXTENSIONS] =
|
||||
"glMapBufferARB", "glUnmapBufferARB" } },
|
||||
|
||||
// allows pixel data to use buffer objects
|
||||
{ false, false, 2, { "GL_ARB_pixel_buffer_object", "GL_EXT_pixel_buffer_object" }, 6, {
|
||||
{ false, false, 2, { "GL_ARB_pixel_buffer_object", "GL_EXT_pixel_buffer_object" }, 7, {
|
||||
"glBindBufferARB", "glDeleteBuffersARB", "glGenBuffersARB", "glBufferDataARB",
|
||||
"glMapBufferARB", "glUnmapBufferARB" } },
|
||||
"glBufferSubDataARB", "glMapBufferARB", "glUnmapBufferARB" } },
|
||||
|
||||
// Mac-only extension that allows use of system copy of texture to avoid an additional API copy
|
||||
// { false, 0, 1, { "GL_APPLE_client_storage" }, 0, { NULL } },
|
||||
@@ -225,7 +228,28 @@ ogl_extension GL_Extensions[NUM_OGL_EXTENSIONS] =
|
||||
{ false, false, 1, { "GL_EXT_texture_lod_bias" }, 0, { NULL } },
|
||||
|
||||
// point sprites (for particles)
|
||||
{ false, false, 2, { "GL_ARB_point_sprite", "NV_point_sprite" }, 0, { NULL } }
|
||||
{ false, false, 2, { "GL_ARB_point_sprite", "NV_point_sprite" }, 0, { NULL } },
|
||||
|
||||
// OpenGL Shading Language support. If this is present, then GL_ARB_shader_objects, GL_ARB_fragment_shader
|
||||
// and GL_ARB_vertex_shader should also be available.
|
||||
{ false, false, 1, { "GL_ARB_shading_language_100" }, 0, { NULL } },
|
||||
|
||||
// shader objects and program object management
|
||||
{ false, false, 1, { "GL_ARB_shader_objects" }, 17, { "glDeleteObjectARB", "glCreateShaderObjectARB", "glShaderSourceARB",
|
||||
"glCompileShaderARB", "glGetObjectParameterivARB", "glGetInfoLogARB", "glCreateProgramObjectARB",
|
||||
"glAttachObjectARB", "glLinkProgramARB", "glUseProgramObjectARB", "glValidateProgramARB", "glGetUniformLocationARB",
|
||||
"glGetUniformivARB", "glUniform1fARB", "glUniform3fARB", "glUniform1iARB", "glUniformMatrix4fvARB" } },
|
||||
|
||||
// programmable vertex level processing
|
||||
// some of functions are provided by GL_ARB_vertex_program
|
||||
{ false, false, 1, { "GL_ARB_vertex_shader" }, 4, { "glEnableVertexAttribArrayARB", "glDisableVertexAttribArrayARB",
|
||||
"glGetAttribLocationARB", "glVertexAttribPointerARB" } },
|
||||
|
||||
// programmable fragment level processing
|
||||
{ false, false, 1, { "GL_ARB_fragment_shader" }, 0, { NULL } },
|
||||
|
||||
// shader version 3.0 detection extensions (if any of these extensions exist then we should have a SM3.0 compatible card, hopefully)
|
||||
{ false, false, 3, { "GL_ARB_shader_texture_lod", "GL_NV_vertex_program3", "GL_ATI_shader_texture_lod" }, 0, { NULL } }
|
||||
};
|
||||
|
||||
// ogl_funcion is:
|
||||
@@ -254,6 +278,7 @@ ogl_function GL_Functions[NUM_OGL_FUNCTIONS] =
|
||||
{ "glDeleteBuffersARB", 0 },
|
||||
{ "glGenBuffersARB", 0 },
|
||||
{ "glBufferDataARB", 0 },
|
||||
{ "glBufferSubDataARB", 0 },
|
||||
{ "glMapBufferARB", 0 },
|
||||
{ "glUnmapBufferARB", 0 },
|
||||
{ "glIsRenderbufferEXT", 0 },
|
||||
@@ -270,7 +295,30 @@ ogl_function GL_Functions[NUM_OGL_FUNCTIONS] =
|
||||
{ "glFramebufferTexture2DEXT", 0 },
|
||||
{ "glFramebufferRenderbufferEXT", 0 },
|
||||
{ "glGetFramebufferAttachmentParameterivEXT", 0 },
|
||||
{ "glGenerateMipmapEXT", 0 }
|
||||
{ "glGenerateMipmapEXT", 0 },
|
||||
{ "glDeleteObjectARB", 0 },
|
||||
{ "glCreateShaderObjectARB", 0 },
|
||||
{ "glShaderSourceARB", 0 },
|
||||
{ "glCompileShaderARB", 0 },
|
||||
{ "glGetObjectParameterivARB", 0 },
|
||||
{ "glGetInfoLogARB", 0 },
|
||||
{ "glCreateProgramObjectARB", 0 },
|
||||
{ "glAttachObjectARB", 0 },
|
||||
{ "glLinkProgramARB", 0 },
|
||||
{ "glUseProgramObjectARB", 0 },
|
||||
{ "glValidateProgramARB", 0 },
|
||||
{ "glEnableVertexAttribArrayARB", 0 },
|
||||
{ "glDisableVertexAttribArrayARB", 0 },
|
||||
{ "glGetAttribLocationARB", 0 },
|
||||
{ "glVertexAttribPointerARB", 0 },
|
||||
{ "glGetUniformLocationARB", 0 },
|
||||
{ "glGetUniformivARB", 0 },
|
||||
{ "glUniform1fARB", 0 },
|
||||
{ "glUniform3fARB", 0 },
|
||||
{ "glUniform3fvARB", 0 },
|
||||
{ "glUniform4fvARB", 0 },
|
||||
{ "glUniform1iARB", 0 },
|
||||
{ "glUniformMatrix4fvARB", 0 }
|
||||
};
|
||||
|
||||
// special extensions (only special functions are supported at the moment)
|
||||
@@ -402,3 +450,71 @@ Next:
|
||||
|
||||
return num_found;
|
||||
}
|
||||
|
||||
|
||||
extern int OGL_fogmode;
|
||||
|
||||
void opengl_extensions_init()
|
||||
{
|
||||
opengl_get_extensions();
|
||||
|
||||
// if S3TC compression is found, then "GL_ARB_texture_compression" must be an extension
|
||||
Use_compressed_textures = Is_Extension_Enabled(OGL_EXT_TEXTURE_COMPRESSION_S3TC);
|
||||
Texture_compression_available = Is_Extension_Enabled(OGL_ARB_TEXTURE_COMPRESSION);
|
||||
|
||||
//allow VBOs to be used
|
||||
if ( !Cmdline_nohtl && !Cmdline_novbo && Is_Extension_Enabled(OGL_ARB_VERTEX_BUFFER_OBJECT) ) {
|
||||
Use_VBOs = 1;
|
||||
}
|
||||
|
||||
// if ( Is_Extension_Enabled(OGL_ARB_PIXEL_BUFFER_OBJECT) ) {
|
||||
// Use_PBOs = 1;
|
||||
// }
|
||||
|
||||
if ( !Cmdline_noglsl && Is_Extension_Enabled(OGL_ARB_SHADER_OBJECTS) && Is_Extension_Enabled(OGL_ARB_FRAGMENT_SHADER)
|
||||
&& Is_Extension_Enabled(OGL_ARB_VERTEX_SHADER) && Is_Extension_Enabled(OGL_SM30) )
|
||||
{
|
||||
Use_GLSL = 1;
|
||||
}
|
||||
|
||||
// setup the best fog function found
|
||||
if ( !Fred_running ) {
|
||||
if ( Is_Extension_Enabled(OGL_EXT_FOG_COORD) ) {
|
||||
OGL_fogmode = 2;
|
||||
} else {
|
||||
OGL_fogmode = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// if we can't do cubemaps then turn off Cmdline_env
|
||||
if ( !(Is_Extension_Enabled(OGL_ARB_TEXTURE_CUBE_MAP) && Is_Extension_Enabled(OGL_ARB_TEXTURE_ENV_COMBINE)) ) {
|
||||
Cmdline_env = 0;
|
||||
}
|
||||
|
||||
// can't have this stuff without GLSL support
|
||||
if ( !Use_GLSL ) {
|
||||
Cmdline_normal = 0;
|
||||
Cmdline_height = 0;
|
||||
}
|
||||
|
||||
if (Use_GLSL) {
|
||||
GLint max_texture_units;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &max_texture_units);
|
||||
|
||||
// we need enough texture slots for this stuff to work
|
||||
|
||||
if (max_texture_units < 4) {
|
||||
Int3();
|
||||
Use_GLSL = 0;
|
||||
}
|
||||
|
||||
if (max_texture_units < 5) {
|
||||
Cmdline_normal = 0;
|
||||
Cmdline_height = 0;
|
||||
}
|
||||
|
||||
if (max_texture_units < 6) {
|
||||
Cmdline_height = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,6 +127,7 @@
|
||||
#define _GROPENGLEXT_H
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "graphics/gropengl.h"
|
||||
|
||||
//EXTENSIONS!!!!
|
||||
//be sure to check for this at startup and handle not finding it gracefully
|
||||
@@ -144,7 +145,7 @@ typedef struct ogl_extension {
|
||||
int num_extensions;
|
||||
const char *extension_name[3];
|
||||
int num_functions;
|
||||
const char *function_names[15];
|
||||
const char *function_names[20];
|
||||
} ogl_extension;
|
||||
|
||||
typedef struct ogl_function {
|
||||
@@ -182,8 +183,13 @@ extern ogl_function GL_EXT_Special[];
|
||||
#define OGL_ARB_TEXTURE_CUBE_MAP 17
|
||||
#define OGL_EXT_TEXTURE_LOD_BIAS 18
|
||||
#define OGL_ARB_POINT_SPRITE 19
|
||||
#define OGL_ARB_SHADING_LANGUAGE_100 20
|
||||
#define OGL_ARB_SHADER_OBJECTS 21
|
||||
#define OGL_ARB_VERTEX_SHADER 22
|
||||
#define OGL_ARB_FRAGMENT_SHADER 23
|
||||
#define OGL_SM30 24
|
||||
|
||||
#define NUM_OGL_EXTENSIONS 20
|
||||
#define NUM_OGL_EXTENSIONS 25
|
||||
|
||||
|
||||
// Functions
|
||||
@@ -206,25 +212,49 @@ extern ogl_function GL_EXT_Special[];
|
||||
#define OGL_DELETE_BUFFERS 12
|
||||
#define OGL_GEN_BUFFERS 13
|
||||
#define OGL_BUFFER_DATA 14
|
||||
#define OGL_MAP_BUFFER 15
|
||||
#define OGL_UNMAP_BUFFER 16
|
||||
#define OGL_IS_RENDERBUFFER 17
|
||||
#define OGL_BIND_RENDERBUFFER 18
|
||||
#define OGL_DELETE_RENDERBUFFERS 19
|
||||
#define OGL_GEN_RENDERBUFFERS 20
|
||||
#define OGL_RENDERBUFFER_STORAGE 21
|
||||
#define OGL_GET_RENDERBUFFER_PARAMETER_IV 22
|
||||
#define OGL_IS_FRAMEBUFFER 23
|
||||
#define OGL_BIND_FRAMEBUFFER 24
|
||||
#define OGL_DELETE_FRAMEBUFFERS 25
|
||||
#define OGL_GEN_FRAMEBUFFERS 26
|
||||
#define OGL_CHECK_FRAMEBUFFER_STATUS 27
|
||||
#define OGL_FRAMEBUFFER_TEXTURE_2D 28
|
||||
#define OGL_FRAMEBUFFER_RENDERBUFFER 29
|
||||
#define OGL_GET_FRAMEBUFFER_ATTACHMENT_PARAMETER_IV 30
|
||||
#define OGL_GENERATE_MIPMAP 31
|
||||
#define OGL_BUFFER_SUB_DATA 15
|
||||
#define OGL_MAP_BUFFER 16
|
||||
#define OGL_UNMAP_BUFFER 17
|
||||
#define OGL_IS_RENDERBUFFER 18
|
||||
#define OGL_BIND_RENDERBUFFER 19
|
||||
#define OGL_DELETE_RENDERBUFFERS 20
|
||||
#define OGL_GEN_RENDERBUFFERS 21
|
||||
#define OGL_RENDERBUFFER_STORAGE 22
|
||||
#define OGL_GET_RENDERBUFFER_PARAMETER_IV 23
|
||||
#define OGL_IS_FRAMEBUFFER 24
|
||||
#define OGL_BIND_FRAMEBUFFER 25
|
||||
#define OGL_DELETE_FRAMEBUFFERS 26
|
||||
#define OGL_GEN_FRAMEBUFFERS 27
|
||||
#define OGL_CHECK_FRAMEBUFFER_STATUS 28
|
||||
#define OGL_FRAMEBUFFER_TEXTURE_2D 29
|
||||
#define OGL_FRAMEBUFFER_RENDERBUFFER 30
|
||||
#define OGL_GET_FRAMEBUFFER_ATTACHMENT_PARAMETER_IV 31
|
||||
#define OGL_GENERATE_MIPMAP 32
|
||||
#define OGL_DELETE_OBJECT 33
|
||||
#define OGL_CREATE_SHADER_OBJECT 34
|
||||
#define OGL_SHADER_SOURCE 35
|
||||
#define OGL_COMPILE_SHADER 36
|
||||
#define OGL_GET_OBJECT_PARAMETERIV 37
|
||||
#define OGL_GET_INFO_LOG 38
|
||||
#define OGL_CREATE_PROGRAM_OBJECT 39
|
||||
#define OGL_ATTACH_OBJECT 40
|
||||
#define OGL_LINK_PROGRAM 41
|
||||
#define OGL_USE_PROGRAM_OBJECT 42
|
||||
#define OGL_VALIDATE_PROGRAM 43
|
||||
#define OGL_ENABLE_VERTEX_ATTRIB_ARRAY 44
|
||||
#define OGL_DISABLE_VERTEX_ATTRIB_ARRAY 45
|
||||
#define OGL_GET_ATTRIB_LOCATION 46
|
||||
#define OGL_VERTEX_ATTRIB_POINTER 47
|
||||
#define OGL_GET_UNIFORM_LOCATION 48
|
||||
#define OGL_GET_UNIFORMIV 49
|
||||
#define OGL_UNIFORM1F 50
|
||||
#define OGL_UNIFORM3F 51
|
||||
#define OGL_UNIFORM3FV 52
|
||||
#define OGL_UNIFORM4FV 53
|
||||
#define OGL_UNIFORM1I 54
|
||||
#define OGL_UNIFORM_MATRIX4FV 55
|
||||
|
||||
#define NUM_OGL_FUNCTIONS 32
|
||||
#define NUM_OGL_FUNCTIONS 56
|
||||
|
||||
|
||||
// special extensions/functions (OS specific, non-GL stuff)
|
||||
@@ -236,62 +266,86 @@ extern ogl_function GL_EXT_Special[];
|
||||
|
||||
#define Is_Extension_Enabled(x) GL_Extensions[x].enabled
|
||||
|
||||
int opengl_get_extensions();
|
||||
void opengl_print_extensions();
|
||||
void opengl_extensions_init();
|
||||
|
||||
|
||||
#define GLEXT_CALL(i,x) if (GL_Functions[i].function_ptr)\
|
||||
#define GLEXT_CALL(i, x) if (GL_Functions[i].function_ptr) \
|
||||
((x)GL_Functions[i].function_ptr)
|
||||
|
||||
// the same as GLEXT_CALL() except that it can be used with a cast or in an if statement
|
||||
// this doesn't do NULL ptr checking so you have to be careful with it!
|
||||
#define GLEXT_CALL2(i,x) ((x)GL_Functions[i].function_ptr)
|
||||
#define GLEXT_CALL2(i, x) ((x)GL_Functions[i].function_ptr)
|
||||
|
||||
#define GLEXT_SPC_CALL(i,x) if (GL_EXT_Special[i].function_ptr) \
|
||||
#define GLEXT_SPC_CALL(i, x) if (GL_EXT_Special[i].function_ptr) \
|
||||
((x)GL_EXT_Special[i].function_ptr)
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
// OS X doesn't have the PFN* names so we have to use the real OSX functions, so until
|
||||
// we move to true runtime loading this will have to suffice...
|
||||
#define vglFogCoordfEXT glFogCoordfEXT
|
||||
#define vglFogCoordPointerEXT glFogCoordPointerEXT
|
||||
#define vglMultiTexCoord2fARB glMultiTexCoord2fARB
|
||||
#define vglActiveTextureARB glActiveTextureARB
|
||||
#define vglClientActiveTextureARB glClientActiveTextureARB
|
||||
#define vglCompressedTexImage2D glCompressedTexImage2D
|
||||
#define vglCompressedTexSubImage2D glCompressedTexSubImage2D
|
||||
#define vglGetCompressedTexImageARB glGetCompressedTexImageARB
|
||||
//#define vglSecondaryColor3fvEXT glSecondaryColor3fvEXT
|
||||
//#define vglSecondaryColor3ubvEXT glSecondaryColor3ubvEXT
|
||||
#define vglLockArraysEXT glLockArraysEXT
|
||||
#define vglUnlockArraysEXT glUnlockArraysEXT
|
||||
//#define vglLoadTransposeMatrixfARB glLoadTransposeMatrixfARB
|
||||
//#define vglMultTransposeMatrixfARB glMultTransposeMatrixfARB
|
||||
#define vglDrawRangeElements glDrawRangeElements
|
||||
#define vglBindBufferARB glBindBufferARB
|
||||
#define vglDeleteBuffersARB glDeleteBuffersARB
|
||||
#define vglGenBuffersARB glGenBuffersARB
|
||||
#define vglBufferDataARB glBufferDataARB
|
||||
#define vglMapBufferARB glMapBufferARB
|
||||
#define vglUnmapBufferARB glUnmapBufferARB
|
||||
#define vglIsRenderbufferEXT glIsRenderbufferEXT
|
||||
#define vglBindRenderbufferEXT glBindRenderbufferEXT
|
||||
#define vglDeleteRenderbuffersEXT glDeleteRenderbuffersEXT
|
||||
#define vglGenRenderbuffersEXT glGenRenderbuffersEXT
|
||||
#define vglRenderbufferStorageEXT glRenderbufferStorageEXT
|
||||
#define vglGetRenderbufferParameterivEXT glGetRenderbufferParameterivEXT
|
||||
#define vglIsFramebufferEXT glIsFramebufferEXT
|
||||
#define vglBindFramebufferEXT glBindFramebufferEXT
|
||||
#define vglDeleteFramebuffersEXT glDeleteFramebuffersEXT
|
||||
#define vglGenFramebuffersEXT glGenFramebuffersEXT
|
||||
#define vglCheckFramebufferStatusEXT glCheckFramebufferStatusEXT
|
||||
#define vglFramebufferTexture2DEXT glFramebufferTexture2DEXT
|
||||
#define vglFramebufferRenderbufferEXT glFramebufferRenderbufferEXT
|
||||
#define vglGetFramebufferAttachmentParameterivEXT glGetFramebufferAttachmentParameterivEXT
|
||||
#define vglGenerateMipmapEXT glGenerateMipmapEXT
|
||||
// special one, since it's a core feature
|
||||
typedef void (* glDrawRangeElementsProcPtr) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
|
||||
|
||||
#else
|
||||
// OS X doesn't have the PFN* names so we have to use the real OSX function ptrs
|
||||
#define PFNGLFOGCOORDFEXTPROC glFogCoordfEXTProcPtr
|
||||
#define PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXTProcPtr
|
||||
#define PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARBProcPtr
|
||||
#define PFNGLACTIVETEXTUREARBPROC glActiveTextureARBProcPtr
|
||||
#define PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARBProcPtr
|
||||
#define PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2DARBProcPtr
|
||||
#define PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glCompressedTexSubImage2DARBProcPtr
|
||||
#define PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARBProcPtr
|
||||
//#define PFNGLSECONDARYCOLOR3FVEXTPROC glSecondaryColor3fvEXTProcPtr
|
||||
//#define PFNGLSECONDARYCOLOR3UBVEXTPROC glSecondaryColor3ubvEXTProcPtr
|
||||
#define PFNGLLOCKARRAYSEXTPROC glLockArraysEXTProcPtr
|
||||
#define PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXTProcPtr
|
||||
//#define PFNGLLOADTRANSPOSEMATRIXFARBPROC glLoadTransposeMatrixfARBProcPtr
|
||||
//#define PFNGLMULTTRANSPOSEMATRIXFARBPROC glMultTransposeMatrixfARBProcPtr
|
||||
#define PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElementsProcPtr
|
||||
#define PFNGLBINDBUFFERARBPROC glBindBufferARBProcPtr
|
||||
#define PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARBProcPtr
|
||||
#define PFNGLGENBUFFERSARBPROC glGenBuffersARBProcPtr
|
||||
#define PFNGLBUFFERDATAARBPROC glBufferDataARBProcPtr
|
||||
#define PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARBProcPtr
|
||||
#define PFNGLMAPBUFFERARBPROC glMapBufferARBProcPtr
|
||||
#define PFNGLUNMAPBUFFERARBPROC glUnmapBufferARBProcPtr
|
||||
#define PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXTProcPtr
|
||||
#define PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXTProcPtr
|
||||
#define PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXTProcPtr
|
||||
#define PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXTProcPtr
|
||||
#define PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXTProcPtr
|
||||
#define PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXTProcPtr
|
||||
#define PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXTProcPtr
|
||||
#define PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXTProcPtr
|
||||
#define PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXTProcPtr
|
||||
#define PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXTProcPtr
|
||||
#define PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXTProcPtr
|
||||
#define PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXTProcPtr
|
||||
#define PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXTProcPtr
|
||||
#define PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXTProcPtr
|
||||
#define PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXTProcPtr
|
||||
#define PFNGLDELETEOBJECTARBPROC glDeleteObjectARBProcPtr
|
||||
#define PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARBProcPtr
|
||||
#define PFNGLSHADERSOURCEARBPROC glShaderSourceARBProcPtr
|
||||
#define PFNGLCOMPILESHADERARBPROC glCompileShaderARBProcPtr
|
||||
#define PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARBProcPtr
|
||||
#define PFNGLGETINFOLOGARBPROC glGetInfoLogARBProcPtr
|
||||
#define PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARBProcPtr
|
||||
#define PFNGLATTACHOBJECTARBPROC glAttachObjectARBProcPtr
|
||||
#define PFNGLLINKPROGRAMARBPROC glLinkProgramARBProcPtr
|
||||
#define PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARBProcPtr
|
||||
#define PFNGLVALIDATEPROGRAMARBPROC glValidateProgramARBProcPtr
|
||||
#define PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARBProcPtr
|
||||
#define PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARBProcPtr
|
||||
#define PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARBProcPtr
|
||||
#define PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARBProcPtr
|
||||
#define PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARBProcPtr
|
||||
#define PFNGLGETUNIFORMIVARBPROC glGetUniformivARBProcPtr
|
||||
#define PFNGLUNIFORM1FARBPROC glUniform1fARBProcPtr
|
||||
#define PFNGLUNIFORM3FARBPROC glUniform3fARBProcPtr
|
||||
#define PFNGLUNIFORM3FVARBPROC glUniform3fvARBProcPtr
|
||||
#define PFNGLUNIFORM4FVARBPROC glUnifrom4fvARBProcPtr
|
||||
#define PFNGLUNIFORM1IARBPROC glUniform1iARBProcPtr
|
||||
#define PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARBProcPtr
|
||||
#endif // __APPLE__
|
||||
|
||||
#define vglFogCoordfEXT GLEXT_CALL( OGL_FOG_COORDF, PFNGLFOGCOORDFEXTPROC )
|
||||
#define vglFogCoordPointerEXT GLEXT_CALL( OGL_FOG_COORD_POINTER, PFNGLFOGCOORDPOINTEREXTPROC )
|
||||
@@ -312,6 +366,7 @@ void opengl_print_extensions();
|
||||
#define vglDeleteBuffersARB GLEXT_CALL( OGL_DELETE_BUFFERS, PFNGLDELETEBUFFERSARBPROC )
|
||||
#define vglGenBuffersARB GLEXT_CALL( OGL_GEN_BUFFERS, PFNGLGENBUFFERSARBPROC )
|
||||
#define vglBufferDataARB GLEXT_CALL( OGL_BUFFER_DATA, PFNGLBUFFERDATAARBPROC )
|
||||
#define vglBufferSubDataARB GLEXT_CALL( OGL_BUFFER_SUB_DATA, PFNGLBUFFERSUBDATAARBPROC )
|
||||
#define vglMapBufferARB GLEXT_CALL2( OGL_MAP_BUFFER, PFNGLMAPBUFFERARBPROC )
|
||||
#define vglUnmapBufferARB GLEXT_CALL( OGL_UNMAP_BUFFER, PFNGLUNMAPBUFFERARBPROC )
|
||||
#define vglIsRenderbufferEXT GLEXT_CALL2( OGL_IS_RENDERBUFFER, PFNGLISRENDERBUFFEREXTPROC )
|
||||
@@ -329,8 +384,30 @@ void opengl_print_extensions();
|
||||
#define vglFramebufferRenderbufferEXT GLEXT_CALL( OGL_FRAMEBUFFER_RENDERBUFFER, PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC )
|
||||
#define vglGetFramebufferAttachmentParameterivEXT GLEXT_CALL( OGL_GET_FRAMEBUFFER_ATTACHMENT_PARAMETER_IV, PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC )
|
||||
#define vglGenerateMipmapEXT GLEXT_CALL( OGL_GENERATE_MIPMAP, PFNGLGENERATEMIPMAPEXTPROC )
|
||||
#define vglDeleteObjectARB GLEXT_CALL( OGL_DELETE_OBJECT, PFNGLDELETEOBJECTARBPROC )
|
||||
#define vglCreateShaderObjectARB GLEXT_CALL2( OGL_CREATE_SHADER_OBJECT, PFNGLCREATESHADEROBJECTARBPROC )
|
||||
#define vglShaderSourceARB GLEXT_CALL( OGL_SHADER_SOURCE, PFNGLSHADERSOURCEARBPROC )
|
||||
#define vglCompileShaderARB GLEXT_CALL( OGL_COMPILE_SHADER, PFNGLCOMPILESHADERARBPROC )
|
||||
#define vglGetObjectParameterivARB GLEXT_CALL( OGL_GET_OBJECT_PARAMETERIV, PFNGLGETOBJECTPARAMETERIVARBPROC )
|
||||
#define vglGetInfoLogARB GLEXT_CALL( OGL_GET_INFO_LOG, PFNGLGETINFOLOGARBPROC )
|
||||
#define vglCreateProgramObjectARB GLEXT_CALL2( OGL_CREATE_PROGRAM_OBJECT, PFNGLCREATEPROGRAMOBJECTARBPROC )
|
||||
#define vglAttachObjectARB GLEXT_CALL( OGL_ATTACH_OBJECT, PFNGLATTACHOBJECTARBPROC )
|
||||
#define vglLinkProgramARB GLEXT_CALL( OGL_LINK_PROGRAM, PFNGLLINKPROGRAMARBPROC )
|
||||
#define vglUseProgramObjectARB GLEXT_CALL( OGL_USE_PROGRAM_OBJECT, PFNGLUSEPROGRAMOBJECTARBPROC )
|
||||
#define vglValidateProgramARB GLEXT_CALL( OGL_VALIDATE_PROGRAM, PFNGLVALIDATEPROGRAMARBPROC )
|
||||
#define vglEnableVertexAttribArrayARB GLEXT_CALL( OGL_ENABLE_VERTEX_ATTRIB_ARRAY, PFNGLENABLEVERTEXATTRIBARRAYARBPROC )
|
||||
#define vglDisableVertexAttribArrayARB GLEXT_CALL( OGL_DISABLE_VERTEX_ATTRIB_ARRAY, PFNGLDISABLEVERTEXATTRIBARRAYARBPROC )
|
||||
#define vglGetAttribLocationARB GLEXT_CALL2( OGL_GET_ATTRIB_LOCATION, PFNGLGETATTRIBLOCATIONARBPROC )
|
||||
#define vglVertexAttribPointerARB GLEXT_CALL( OGL_VERTEX_ATTRIB_POINTER, PFNGLVERTEXATTRIBPOINTERARBPROC )
|
||||
#define vglGetUniformLocationARB GLEXT_CALL2( OGL_GET_UNIFORM_LOCATION, PFNGLGETUNIFORMLOCATIONARBPROC )
|
||||
#define vglGetUniformivARB GLEXT_CALL( OGL_GET_UNIFORMIV, PFNGLGETUNIFORMIVARBPROC )
|
||||
#define vglUniform1fARB GLEXT_CALL( OGL_UNIFORM1F, PFNGLUNIFORM1FARBPROC )
|
||||
#define vglUniform3fARB GLEXT_CALL( OGL_UNIFORM3F, PFNGLUNIFORM3FARBPROC )
|
||||
#define vglUniform3fvARB GLEXT_CALL( OGL_UNIFORM3FV, PFNGLUNIFORM3FVARBPROC )
|
||||
#define vglUniform4fvARB GLEXT_CALL( OGL_UNIFORM3FV, PFNGLUNIFORM4FVARBPROC )
|
||||
#define vglUniform1iARB GLEXT_CALL( OGL_UNIFORM1I, PFNGLUNIFORM1IARBPROC )
|
||||
#define vglUniformMatrix4fvARB GLEXT_CALL( OGL_UNIFORM_MATRIX4FV, PFNGLUNIFORMMATRIX4FVARBPROC )
|
||||
|
||||
#endif // __APPLE__
|
||||
|
||||
// special extensions
|
||||
#define vwglSwapIntervalEXT GLEXT_SPC_CALL( OGL_SPC_WGL_SWAP_INTERVAL, PFNWGLSWAPINTERVALEXTPROC )
|
||||
|
||||
+132
-130
@@ -199,6 +199,7 @@
|
||||
#include "graphics/gropengl.h"
|
||||
#include "graphics/gropenglextension.h"
|
||||
#include "graphics/gropengllight.h"
|
||||
#include "graphics/gropenglstate.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "render/3d.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
@@ -208,7 +209,6 @@
|
||||
|
||||
// Variables
|
||||
opengl_light *opengl_lights = NULL;
|
||||
bool *currently_enabled_lights = NULL;
|
||||
bool lighting_is_enabled = true;
|
||||
int Num_active_gl_lights = 0;
|
||||
int GL_center_alpha = 0;
|
||||
@@ -232,81 +232,85 @@ static float GL_light_ambient[4] = { 0.47f, 0.47f, 0.47f, 1.0f };
|
||||
|
||||
void FSLight2GLLight(light *FSLight, opengl_light *GLLight)
|
||||
{
|
||||
GLLight->Ambient.r = 0.0f;
|
||||
GLLight->Ambient.g = 0.0f;
|
||||
GLLight->Ambient.b = 0.0f;
|
||||
GLLight->Ambient.a = 1.0f;
|
||||
GLLight->Ambient[0] = 0.0f;
|
||||
GLLight->Ambient[1] = 0.0f;
|
||||
GLLight->Ambient[2] = 0.0f;
|
||||
GLLight->Ambient[3] = 1.0f;
|
||||
|
||||
GLLight->Diffuse.r = FSLight->r * FSLight->intensity;
|
||||
GLLight->Diffuse.g = FSLight->g * FSLight->intensity;
|
||||
GLLight->Diffuse.b = FSLight->b * FSLight->intensity;
|
||||
GLLight->Diffuse.a = 1.0f;
|
||||
GLLight->Diffuse[0] = FSLight->r * FSLight->intensity;
|
||||
GLLight->Diffuse[1] = FSLight->g * FSLight->intensity;
|
||||
GLLight->Diffuse[2] = FSLight->b * FSLight->intensity;
|
||||
GLLight->Diffuse[3] = 1.0f;
|
||||
|
||||
GLLight->Specular.r = FSLight->spec_r * FSLight->intensity;
|
||||
GLLight->Specular.g = FSLight->spec_g * FSLight->intensity;
|
||||
GLLight->Specular.b = FSLight->spec_b * FSLight->intensity;
|
||||
GLLight->Specular.a = 1.0f;
|
||||
GLLight->Specular[0] = FSLight->spec_r * FSLight->intensity;
|
||||
GLLight->Specular[1] = FSLight->spec_g * FSLight->intensity;
|
||||
GLLight->Specular[2] = FSLight->spec_b * FSLight->intensity;
|
||||
GLLight->Specular[3] = 1.0f;
|
||||
|
||||
GLLight->type = FSLight->type;
|
||||
|
||||
// GL default values...
|
||||
// spot direction
|
||||
GLLight->SpotDir.x = 0.0f;
|
||||
GLLight->SpotDir.y = 0.0f;
|
||||
GLLight->SpotDir.z = -1.0f;
|
||||
GLLight->SpotDir[0] = 0.0f;
|
||||
GLLight->SpotDir[1] = 0.0f;
|
||||
GLLight->SpotDir[2] = -1.0f;
|
||||
// spot exponent
|
||||
GLLight->SpotExp = Cmdline_ogl_spec / 2.0f;
|
||||
GLLight->SpotExp = Cmdline_ogl_spec * 0.5f;
|
||||
// spot cutoff
|
||||
GLLight->SpotCutOff = 180.0f; // special value, light in all directions
|
||||
// defaults to disable attenuation
|
||||
GLLight->ConstantAtten = 1.0f;
|
||||
GLLight->LinearAtten = 0.0f;
|
||||
GLLight->QuadraticAtten = 0.0f;
|
||||
// position
|
||||
GLLight->Position[0] = FSLight->vec.xyz.x;
|
||||
GLLight->Position[1] = FSLight->vec.xyz.y;
|
||||
GLLight->Position[2] = FSLight->vec.xyz.z; // flipped axis for FS2
|
||||
GLLight->Position[3] = 1.0f;
|
||||
|
||||
|
||||
//If the light is a directional light
|
||||
if (FSLight->type == LT_DIRECTIONAL) {
|
||||
GLLight->Position.x = -FSLight->vec.xyz.x;
|
||||
GLLight->Position.y = -FSLight->vec.xyz.y;
|
||||
GLLight->Position.z = -FSLight->vec.xyz.z;
|
||||
GLLight->Position.w = 0.0f; // Directional lights in OpenGL have w set to 0 and the direction vector in the position field
|
||||
switch (FSLight->type) {
|
||||
case LT_POINT: {
|
||||
// this crap still needs work...
|
||||
GLLight->ConstantAtten = 0.0f;
|
||||
GLLight->LinearAtten = (1.0f / MAX(FSLight->rada, FSLight->radb)) * 1.25f;
|
||||
|
||||
GLLight->Specular.r *= static_light_factor;
|
||||
GLLight->Specular.g *= static_light_factor;
|
||||
GLLight->Specular.b *= static_light_factor;
|
||||
}
|
||||
GLLight->Specular[0] *= static_point_factor;
|
||||
GLLight->Specular[1] *= static_point_factor;
|
||||
GLLight->Specular[2] *= static_point_factor;
|
||||
|
||||
//If the light is a point or tube type
|
||||
if ( (FSLight->type == LT_POINT) || (FSLight->type == LT_TUBE) ) {
|
||||
// this crap still needs work...
|
||||
GLLight->ConstantAtten = 0.0f;
|
||||
GLLight->LinearAtten = (1.0f / MAX(FSLight->rada, FSLight->radb));
|
||||
|
||||
if (FSLight->type == LT_POINT) {
|
||||
GLLight->Specular.r *= static_point_factor;
|
||||
GLLight->Specular.g *= static_point_factor;
|
||||
GLLight->Specular.b *= static_point_factor;
|
||||
GLLight->Ambient.r = (GLLight->Diffuse.r / 2.0f);
|
||||
GLLight->Ambient.g = (GLLight->Diffuse.r / 2.0f);
|
||||
GLLight->Ambient.b = (GLLight->Diffuse.r / 2.0f);
|
||||
GLLight->LinearAtten *= 1.25f;
|
||||
} else {
|
||||
GLLight->Specular.r *= static_tube_factor;
|
||||
GLLight->Specular.g *= static_tube_factor;
|
||||
GLLight->Specular.b *= static_tube_factor;
|
||||
break;
|
||||
}
|
||||
|
||||
GLLight->Position.x = FSLight->vec.xyz.x;
|
||||
GLLight->Position.y = FSLight->vec.xyz.y;
|
||||
GLLight->Position.z = FSLight->vec.xyz.z; // flipped axis for FS2
|
||||
GLLight->Position.w = 1.0f;
|
||||
case LT_TUBE: {
|
||||
GLLight->Specular[0] *= static_tube_factor;
|
||||
GLLight->Specular[1] *= static_tube_factor;
|
||||
GLLight->Specular[2] *= static_tube_factor;
|
||||
|
||||
if (FSLight->type == LT_TUBE) {
|
||||
GLLight->SpotDir.x = FSLight->vec2.xyz.x;
|
||||
GLLight->SpotDir.y = FSLight->vec2.xyz.y;
|
||||
GLLight->SpotDir.z = FSLight->vec2.xyz.z;
|
||||
GLLight->SpotDir[0] = FSLight->vec2.xyz.x * 1.5f;
|
||||
GLLight->SpotDir[1] = FSLight->vec2.xyz.y * 1.5f;
|
||||
GLLight->SpotDir[2] = FSLight->vec2.xyz.z * 1.5f;
|
||||
GLLight->SpotCutOff = 90.0f;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case LT_DIRECTIONAL: {
|
||||
GLLight->Position[0] = -FSLight->vec.xyz.x;
|
||||
GLLight->Position[1] = -FSLight->vec.xyz.y;
|
||||
GLLight->Position[2] = -FSLight->vec.xyz.z;
|
||||
GLLight->Position[3] = 0.0f; // Directional lights in OpenGL have w set to 0
|
||||
|
||||
GLLight->Specular[0] *= static_light_factor;
|
||||
GLLight->Specular[1] *= static_light_factor;
|
||||
GLLight->Specular[2] *= static_light_factor;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
Int3();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,19 +319,20 @@ void opengl_set_light(int light_num, opengl_light *ltp)
|
||||
{
|
||||
Assert(light_num < GL_max_lights);
|
||||
|
||||
ogl_light_color diffuse = ltp->Diffuse;
|
||||
GLfloat diffuse[4];
|
||||
memcpy(diffuse, ltp->Diffuse, sizeof(GLfloat) * 4);
|
||||
|
||||
if ( (ltp->type == LT_DIRECTIONAL) && (Interp_light < 1.0f) ) {
|
||||
diffuse.r *= Interp_light;
|
||||
diffuse.g *= Interp_light;
|
||||
diffuse.b *= Interp_light;
|
||||
diffuse[0] *= Interp_light;
|
||||
diffuse[1] *= Interp_light;
|
||||
diffuse[2] *= Interp_light;
|
||||
}
|
||||
|
||||
glLightfv(GL_LIGHT0+light_num, GL_POSITION, <p->Position.x);
|
||||
glLightfv(GL_LIGHT0+light_num, GL_AMBIENT, <p->Ambient.r);
|
||||
glLightfv(GL_LIGHT0+light_num, GL_DIFFUSE, &diffuse.r);
|
||||
glLightfv(GL_LIGHT0+light_num, GL_SPECULAR, <p->Specular.r);
|
||||
glLightfv(GL_LIGHT0+light_num, GL_SPOT_DIRECTION, <p->SpotDir.x);
|
||||
glLightfv(GL_LIGHT0+light_num, GL_POSITION, ltp->Position);
|
||||
glLightfv(GL_LIGHT0+light_num, GL_AMBIENT, ltp->Ambient);
|
||||
glLightfv(GL_LIGHT0+light_num, GL_DIFFUSE, diffuse);
|
||||
glLightfv(GL_LIGHT0+light_num, GL_SPECULAR, ltp->Specular);
|
||||
glLightfv(GL_LIGHT0+light_num, GL_SPOT_DIRECTION, ltp->SpotDir);
|
||||
glLightf(GL_LIGHT0+light_num, GL_CONSTANT_ATTENUATION, ltp->ConstantAtten);
|
||||
glLightf(GL_LIGHT0+light_num, GL_LINEAR_ATTENUATION, ltp->LinearAtten);
|
||||
glLightf(GL_LIGHT0+light_num, GL_QUADRATIC_ATTENUATION, ltp->QuadraticAtten);
|
||||
@@ -364,8 +369,8 @@ int opengl_sort_active_lights(const void *a, const void *b)
|
||||
|
||||
// as one extra check, if we're still here, go with overall brightness of light
|
||||
|
||||
float la_value = la->Diffuse.r + la->Diffuse.g + la->Diffuse.b;
|
||||
float lb_value = lb->Diffuse.r + lb->Diffuse.g + lb->Diffuse.b;
|
||||
float la_value = la->Diffuse[0] + la->Diffuse[1] + la->Diffuse[2];
|
||||
float lb_value = lb->Diffuse[0] + lb->Diffuse[1] + lb->Diffuse[2];
|
||||
|
||||
if ( la_value < lb_value )
|
||||
return 1;
|
||||
@@ -376,16 +381,8 @@ int opengl_sort_active_lights(const void *a, const void *b)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// finds the first unoccupied light
|
||||
void opengl_pre_render_init_lights()
|
||||
{
|
||||
for (int i = 0; i < GL_max_lights; i++) {
|
||||
if (currently_enabled_lights[i]) {
|
||||
glDisable(GL_LIGHT0+i);
|
||||
currently_enabled_lights[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
// sort the lights to try and get the most visible lights on the first pass
|
||||
qsort(opengl_lights, Num_active_gl_lights, sizeof(opengl_light), opengl_sort_active_lights);
|
||||
}
|
||||
@@ -398,13 +395,17 @@ static matrix last_view_orient;
|
||||
|
||||
static bool use_last_view = false;
|
||||
|
||||
void opengl_change_active_lights(int pos)
|
||||
void opengl_change_active_lights(int pos, int d_offset)
|
||||
{
|
||||
if ( !lighting_is_enabled )
|
||||
return;
|
||||
int i, offset;
|
||||
|
||||
int i;
|
||||
int offset = pos * GL_max_lights;
|
||||
if ( !lighting_is_enabled ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Assert( d_offset < GL_max_lights );
|
||||
|
||||
offset = (pos * GL_max_lights) + d_offset;
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
@@ -475,22 +476,22 @@ void opengl_change_active_lights(int pos)
|
||||
|
||||
|
||||
for (i = 0; i < GL_max_lights; i++) {
|
||||
if (currently_enabled_lights[i]) {
|
||||
glDisable(GL_LIGHT0+i);
|
||||
currently_enabled_lights[i] = false;
|
||||
if ( (offset + i) >= Num_active_gl_lights ) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ( (offset + i) >= Num_active_gl_lights )
|
||||
continue;
|
||||
|
||||
if (opengl_lights[offset+i].occupied) {
|
||||
opengl_set_light(i, &opengl_lights[offset+i]);
|
||||
|
||||
glEnable(GL_LIGHT0+i);
|
||||
currently_enabled_lights[i] = true;
|
||||
GL_state.Light(i, GL_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
// make sure that we turn off any lights that we aren't using right now
|
||||
for ( ; i < GL_max_lights; i++) {
|
||||
GL_state.Light(i, GL_FALSE);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -515,6 +516,9 @@ void gr_opengl_set_light(light *fs_light)
|
||||
if (Num_active_gl_lights >= MAX_LIGHTS)
|
||||
return;
|
||||
|
||||
//if (fs_light->type == LT_POINT)
|
||||
// return;
|
||||
|
||||
// init the light
|
||||
FSLight2GLLight(fs_light, &opengl_lights[Num_active_gl_lights]);
|
||||
opengl_lights[Num_active_gl_lights++].occupied = true;
|
||||
@@ -545,33 +549,33 @@ void gr_opengl_set_center_alpha(int type)
|
||||
vm_vec_normalize(&dir);
|
||||
|
||||
if (type == 1) {
|
||||
glight.Diffuse.r = 0.0f;
|
||||
glight.Diffuse.g = 0.0f;
|
||||
glight.Diffuse.b = 0.0f;
|
||||
glight.Ambient.r = gr_screen.current_alpha;
|
||||
glight.Ambient.g = gr_screen.current_alpha;
|
||||
glight.Ambient.b = gr_screen.current_alpha;
|
||||
glight.Diffuse[0] = 0.0f;
|
||||
glight.Diffuse[1] = 0.0f;
|
||||
glight.Diffuse[2] = 0.0f;
|
||||
glight.Ambient[0] = gr_screen.current_alpha;
|
||||
glight.Ambient[1] = gr_screen.current_alpha;
|
||||
glight.Ambient[2] = gr_screen.current_alpha;
|
||||
} else {
|
||||
glight.Diffuse.r = gr_screen.current_alpha;
|
||||
glight.Diffuse.g = gr_screen.current_alpha;
|
||||
glight.Diffuse.b = gr_screen.current_alpha;
|
||||
glight.Ambient.r = 0.0f;
|
||||
glight.Ambient.g = 0.0f;
|
||||
glight.Ambient.b = 0.0f;
|
||||
glight.Diffuse[0] = gr_screen.current_alpha;
|
||||
glight.Diffuse[1] = gr_screen.current_alpha;
|
||||
glight.Diffuse[2] = gr_screen.current_alpha;
|
||||
glight.Ambient[0] = 0.0f;
|
||||
glight.Ambient[1] = 0.0f;
|
||||
glight.Ambient[2] = 0.0f;
|
||||
}
|
||||
|
||||
glight.Specular.r = 0.0f;
|
||||
glight.Specular.g = 0.0f;
|
||||
glight.Specular.b = 0.0f;
|
||||
glight.Specular.a = 0.0f;
|
||||
glight.Specular[0] = 0.0f;
|
||||
glight.Specular[1] = 0.0f;
|
||||
glight.Specular[2] = 0.0f;
|
||||
glight.Specular[3] = 0.0f;
|
||||
|
||||
glight.Ambient.a = 1.0f;
|
||||
glight.Diffuse.a = 1.0f;
|
||||
glight.Ambient[3] = 1.0f;
|
||||
glight.Diffuse[3] = 1.0f;
|
||||
|
||||
glight.Position.x = -dir.xyz.x;
|
||||
glight.Position.y = -dir.xyz.y;
|
||||
glight.Position.z = -dir.xyz.z;
|
||||
glight.Position.w = 0.0f;
|
||||
glight.Position[0] = -dir.xyz.x;
|
||||
glight.Position[1] = -dir.xyz.y;
|
||||
glight.Position[2] = -dir.xyz.z;
|
||||
glight.Position[3] = 0.0f;
|
||||
|
||||
// defaults
|
||||
glight.ConstantAtten = 1.0f;
|
||||
@@ -583,12 +587,12 @@ void gr_opengl_set_center_alpha(int type)
|
||||
opengl_lights[Num_active_gl_lights++].occupied = true;
|
||||
|
||||
// second light
|
||||
glight.Position.x = dir.xyz.x;
|
||||
glight.Position.y = dir.xyz.y;
|
||||
glight.Position.z = dir.xyz.z;
|
||||
glight.Position[0] = dir.xyz.x;
|
||||
glight.Position[1] = dir.xyz.y;
|
||||
glight.Position[2] = dir.xyz.z;
|
||||
|
||||
memcpy( &opengl_lights[Num_active_gl_lights], &glight, sizeof(opengl_light) );
|
||||
opengl_lights[Num_active_gl_lights].occupied = true;
|
||||
opengl_lights[Num_active_gl_lights++].occupied = true;
|
||||
|
||||
// reset center alpha
|
||||
GL_center_alpha = 0;
|
||||
@@ -604,7 +608,7 @@ void gr_opengl_reset_lighting()
|
||||
memset( opengl_lights, 0, sizeof(opengl_light) * MAX_LIGHTS );
|
||||
|
||||
for (i = 0; i < GL_max_lights; i++) {
|
||||
glDisable(GL_LIGHT0+i);
|
||||
GL_state.Light(i, GL_FALSE);
|
||||
}
|
||||
|
||||
Num_active_gl_lights = 0;
|
||||
@@ -633,7 +637,15 @@ void opengl_calculate_ambient_factor()
|
||||
GL_light_ambient[3] = 1.0f;
|
||||
}
|
||||
|
||||
void opengl_init_light()
|
||||
void opengl_light_shutdown()
|
||||
{
|
||||
if (opengl_lights != NULL) {
|
||||
vm_free(opengl_lights);
|
||||
opengl_lights = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void opengl_light_init()
|
||||
{
|
||||
opengl_calculate_ambient_factor();
|
||||
|
||||
@@ -642,28 +654,24 @@ void opengl_init_light()
|
||||
glMaterialf(GL_FRONT, GL_SHININESS, Cmdline_ogl_spec /*80.0f*/ );
|
||||
|
||||
// more realistic lighting model
|
||||
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
|
||||
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
|
||||
|
||||
glGetIntegerv(GL_MAX_LIGHTS, &GL_max_lights); // Get the max number of lights supported
|
||||
|
||||
// allocate memory for enabled lights
|
||||
Verify(GL_max_lights > 0);
|
||||
|
||||
if ( currently_enabled_lights == NULL )
|
||||
currently_enabled_lights = (bool *) vm_malloc_q(GL_max_lights * sizeof(bool));
|
||||
|
||||
if ( opengl_lights == NULL )
|
||||
opengl_lights = (opengl_light *) vm_malloc_q(MAX_LIGHTS * sizeof(opengl_light));
|
||||
|
||||
if ( (currently_enabled_lights == NULL) || (opengl_lights == NULL) )
|
||||
if (opengl_lights == NULL)
|
||||
Error( LOCATION, "Unable to allocate memory for lights!\n");
|
||||
|
||||
memset( currently_enabled_lights, 0, GL_max_lights * sizeof(bool) );
|
||||
memset( opengl_lights, 0, MAX_LIGHTS * sizeof(opengl_light) );
|
||||
}
|
||||
|
||||
extern int Cmdline_no_emissive;
|
||||
void opengl_default_light_settings(int ambient = 1, int emission = 1, int specular = 1)
|
||||
void opengl_default_light_settings(int ambient, int emission, int specular)
|
||||
{
|
||||
if (!lighting_is_enabled)
|
||||
return;
|
||||
@@ -695,8 +703,9 @@ void opengl_default_light_settings(int ambient = 1, int emission = 1, int specul
|
||||
|
||||
void gr_opengl_set_lighting(bool set, bool state)
|
||||
{
|
||||
if (Cmdline_nohtl)
|
||||
if (Cmdline_nohtl) {
|
||||
return;
|
||||
}
|
||||
|
||||
lighting_is_enabled = set;
|
||||
|
||||
@@ -710,17 +719,10 @@ void gr_opengl_set_lighting(bool set, bool state)
|
||||
}
|
||||
|
||||
for (int i = 0; i < GL_max_lights; i++) {
|
||||
if (currently_enabled_lights[i])
|
||||
glDisable(GL_LIGHT0+i);
|
||||
GL_state.Light(i, GL_FALSE);
|
||||
}
|
||||
|
||||
memset( currently_enabled_lights, 0, GL_max_lights * sizeof(bool) );
|
||||
|
||||
if (state) {
|
||||
glEnable(GL_LIGHTING);
|
||||
} else {
|
||||
glDisable(GL_LIGHTING);
|
||||
}
|
||||
GL_state.Lighting( (state) ? GL_TRUE : GL_FALSE );
|
||||
}
|
||||
|
||||
void gr_opengl_set_ambient_light(int red, int green, int blue)
|
||||
|
||||
@@ -88,17 +88,13 @@ struct ogl_light_color {
|
||||
// Structures
|
||||
struct opengl_light
|
||||
{
|
||||
ogl_light_color Diffuse, Specular, Ambient;
|
||||
GLfloat Ambient[4], Diffuse[4], Specular[4];
|
||||
|
||||
// light position
|
||||
struct {
|
||||
float x, y, z, w;
|
||||
} Position;
|
||||
GLfloat Position[4];
|
||||
|
||||
// spotlight direction (for tube lights)
|
||||
struct {
|
||||
float x, y, z;
|
||||
} SpotDir;
|
||||
GLfloat SpotDir[3];
|
||||
|
||||
float SpotExp, SpotCutOff;
|
||||
float ConstantAtten, LinearAtten, QuadraticAtten;
|
||||
@@ -113,26 +109,25 @@ struct opengl_light
|
||||
struct light_data;
|
||||
|
||||
//Variables
|
||||
extern opengl_light *opengl_lights;
|
||||
extern bool *currently_enabled_lights;
|
||||
extern bool lighting_is_enabled;
|
||||
extern GLint GL_max_lights;
|
||||
extern int Num_active_gl_lights;
|
||||
extern int GL_center_alpha;
|
||||
|
||||
//Functions
|
||||
void FSLight2GLLight(light *FSLight, opengl_light *GLLight);
|
||||
int gr_opengl_make_light(light *fs_light, int idx, int priority); //unused -- stub function
|
||||
void gr_opengl_modify_light(light *fs_light, int idx, int priority); //unused -- stub function
|
||||
void gr_opengl_destroy_light(int idx); //unused -- stub function
|
||||
void gr_opengl_set_light(light *fs_light);
|
||||
void gr_opengl_reset_lighting();
|
||||
void gr_opengl_set_lighting(bool set, bool state);
|
||||
void opengl_pre_render_init_lights();
|
||||
void opengl_change_active_lights(int);
|
||||
void opengl_init_light();
|
||||
void gr_opengl_center_alpha(int type);
|
||||
void gr_opengl_set_center_alpha(int type);
|
||||
void gr_opengl_set_ambient_light(int red, int green, int blue);
|
||||
|
||||
void opengl_change_active_lights(int pos, int d_offset = 0);
|
||||
void opengl_light_init();
|
||||
void opengl_light_shutdown();
|
||||
void opengl_default_light_settings(int amb = 1, int emi = 1, int spec = 1);
|
||||
|
||||
#endif //_GROPENGLLIGHT_H
|
||||
@@ -0,0 +1,650 @@
|
||||
/*
|
||||
* Copyright (C) Volition, Inc. 1999. All rights reserved.
|
||||
*
|
||||
* All source code herein is the property of Volition, Inc. You may not sell
|
||||
* or otherwise commercially exploit the source or things you created based on the
|
||||
* source.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/def_files.h"
|
||||
|
||||
#include "graphics/2d.h"
|
||||
#include "lighting/lighting.h"
|
||||
#include "graphics/grinternal.h"
|
||||
#include "graphics/gropengl.h"
|
||||
#include "graphics/gropenglextension.h"
|
||||
#include "graphics/gropengltexture.h"
|
||||
#include "graphics/gropengllight.h"
|
||||
#include "graphics/gropengltnl.h"
|
||||
#include "graphics/gropengldraw.h"
|
||||
#include "graphics/gropenglshader.h"
|
||||
|
||||
#include "math/vecmat.h"
|
||||
#include "render/3d.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
|
||||
|
||||
std::vector<opengl_shader_t> GL_shader;
|
||||
|
||||
static char *GLshader_info_log = NULL;
|
||||
static const int GLshader_info_log_size = 8192;
|
||||
|
||||
#define MAX_SHADER_UNIFORMS 15
|
||||
|
||||
struct opengl_shader_file_t {
|
||||
char *vert;
|
||||
char *frag;
|
||||
|
||||
int flags;
|
||||
|
||||
int num_uniforms;
|
||||
char *uniforms[MAX_SHADER_UNIFORMS];
|
||||
};
|
||||
|
||||
static opengl_shader_file_t GL_shader_file[] = {
|
||||
{ "null-v.sdr", "null-f.sdr", (0), 0, { NULL }, },
|
||||
|
||||
{ "b-v.sdr", "b-f.sdr", (SDR_FLAG_DIFFUSE_MAP),
|
||||
1, { "sBasemap" } },
|
||||
|
||||
{ "b-v.sdr", "bg-f.sdr", (SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP),
|
||||
2, { "sBasemap", "sGlowmap" } },
|
||||
|
||||
{ "l-v.sdr", "lb-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP),
|
||||
2, { "sBasemap", "n_lights" } },
|
||||
|
||||
{ "l-v.sdr", "lbg-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP),
|
||||
3, { "sBasemap", "sGlowmap", "n_lights" } },
|
||||
|
||||
{ "l-v.sdr", "lbgs-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP),
|
||||
4, { "sBasemap", "sGlowmap", "sSpecmap", "n_lights" } },
|
||||
|
||||
{ "l-v.sdr", "lbs-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP),
|
||||
3, { "sBasemap", "sSpecmap", "n_lights" } },
|
||||
|
||||
{ "le-v.sdr", "lbgse-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ENV_MAP),
|
||||
7, { "sBasemap", "sGlowmap", "sSpecmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "le-v.sdr", "lbse-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ENV_MAP),
|
||||
6, { "sBasemap", "sSpecmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "ln-v.sdr", "lbgn-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP| SDR_FLAG_NORMAL_MAP),
|
||||
4, { "sBasemap", "sGlowmap", "sNormalmap", "n_lights" } },
|
||||
|
||||
{ "ln-v.sdr", "lbgsn-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP),
|
||||
5, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "n_lights" } },
|
||||
|
||||
{ "ln-v.sdr", "lbn-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_NORMAL_MAP),
|
||||
3, { "sBasemap", "sNormalmap", "n_lights" } },
|
||||
|
||||
{ "ln-v.sdr", "lbsn-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP),
|
||||
4, { "sBasemap", "sSpecmap", "sNormalmap", "n_lights" } },
|
||||
|
||||
{ "ln-v.sdr", "lbgnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP| SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
|
||||
5, { "sBasemap", "sGlowmap", "sNormalmap", "sHeightmap", "n_lights" } },
|
||||
|
||||
{ "ln-v.sdr", "lbgsnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
|
||||
6, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" } },
|
||||
|
||||
{ "ln-v.sdr", "lbnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
|
||||
4, { "sBasemap", "sNormalmap", "sHeightmap", "n_lights" } },
|
||||
|
||||
{ "ln-v.sdr", "lbsnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
|
||||
5, { "sBasemap", "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" } },
|
||||
|
||||
{ "lne-v.sdr", "lbgsne-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP),
|
||||
8, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "lne-v.sdr", "lbsne-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP),
|
||||
7, { "sBasemap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "lne-v.sdr", "lbgsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
|
||||
9, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "lne-v.sdr", "lbsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
|
||||
8, { "sBasemap", "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "lf-v.sdr", "lfb-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP),
|
||||
2, { "sBasemap", "n_lights" } },
|
||||
|
||||
{ "lf-v.sdr", "lfbg-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP),
|
||||
3, { "sBasemap", "sGlowmap", "n_lights" } },
|
||||
|
||||
{ "lf-v.sdr", "lfbgs-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP),
|
||||
4, { "sBasemap", "sGlowmap", "sSpecmap", "n_lights" } },
|
||||
|
||||
{ "lf-v.sdr", "lfbs-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP),
|
||||
3, { "sBasemap", "sSpecmap", "n_lights" } },
|
||||
|
||||
{ "lfe-v.sdr", "lfbgse-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ENV_MAP),
|
||||
7, { "sBasemap", "sGlowmap", "sSpecmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "lfe-v.sdr", "lfbse-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ENV_MAP),
|
||||
6, { "sBasemap", "sSpecmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "lfn-v.sdr", "lfbgn-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP| SDR_FLAG_NORMAL_MAP),
|
||||
4, { "sBasemap", "sGlowmap", "sNormalmap", "n_lights" } },
|
||||
|
||||
{ "lfn-v.sdr", "lfbgsn-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP),
|
||||
5, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "n_lights" } },
|
||||
|
||||
{ "lfn-v.sdr", "lfbn-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_NORMAL_MAP),
|
||||
3, { "sBasemap", "sNormalmap", "n_lights" } },
|
||||
|
||||
{ "lfn-v.sdr", "lfbsn-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP),
|
||||
4, { "sBasemap", "sSpecmap", "sNormalmap", "n_lights" } },
|
||||
|
||||
{ "lfn-v.sdr", "lfbgnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP| SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
|
||||
5, { "sBasemap", "sGlowmap", "sNormalmap", "sHeightmap", "n_lights" } },
|
||||
|
||||
{ "lfn-v.sdr", "lfbgsnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
|
||||
6, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" } },
|
||||
|
||||
{ "lfn-v.sdr", "lfbnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
|
||||
4, { "sBasemap", "sNormalmap", "sHeightmap", "n_lights" } },
|
||||
|
||||
{ "lfn-v.sdr", "lfbsnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
|
||||
5, { "sBasemap", "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" } },
|
||||
|
||||
{ "lfne-v.sdr", "lfbgsne-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP),
|
||||
8, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "lfne-v.sdr", "lfbsne-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP),
|
||||
7, { "sBasemap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "lfne-v.sdr", "lfbgsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
|
||||
9, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "lfne-v.sdr", "lfbsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
|
||||
8, { "sBasemap", "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "l-v.sdr", "null-f.sdr", (SDR_FLAG_LIGHT), 0, { NULL } },
|
||||
|
||||
{ "l-v.sdr", "lg-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_GLOW_MAP),
|
||||
2, { "sGlowmap", "n_lights" } },
|
||||
|
||||
{ "l-v.sdr", "lgs-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP),
|
||||
3, { "sGlowmap", "sSpecmap", "n_lights" } },
|
||||
|
||||
{ "l-v.sdr", "ls-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_SPEC_MAP),
|
||||
2, { "sSpecmap", "n_lights" } },
|
||||
|
||||
{ "le-v.sdr", "lgse-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ENV_MAP),
|
||||
6, { "sGlowmap", "sSpecmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "le-v.sdr", "lse-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_SPEC_MAP | SDR_FLAG_ENV_MAP),
|
||||
5, { "sSpecmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "ln-v.sdr", "lgn-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_GLOW_MAP | SDR_FLAG_NORMAL_MAP),
|
||||
3, { "sGlowmap", "sNormalmap", "n_lights" } },
|
||||
|
||||
{ "ln-v.sdr", "lgsn-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP),
|
||||
4, { "sGlowmap", "sSpecmap", "sNormalmap", "n_lights" } },
|
||||
|
||||
{ "ln-v.sdr", "ln-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_NORMAL_MAP),
|
||||
2, { "sNormalmap", "n_lights" } },
|
||||
|
||||
{ "ln-v.sdr", "lsn-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP),
|
||||
3, { "sSpecmap", "sNormalmap", "n_lights" } },
|
||||
|
||||
{ "ln-v.sdr", "lgnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_GLOW_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
|
||||
4, { "sGlowmap", "sNormalmap", "sHeightmap", "n_lights" } },
|
||||
|
||||
{ "ln-v.sdr", "lgsnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
|
||||
5, { "sGlowmap", "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" } },
|
||||
|
||||
{ "ln-v.sdr", "lnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
|
||||
3, { "sNormalmap", "sHeightmap", "n_lights" } },
|
||||
|
||||
{ "ln-v.sdr", "lsnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
|
||||
4, { "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" } },
|
||||
|
||||
{ "lne-v.sdr", "lgsne-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP),
|
||||
7, { "sGlowmap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "lne-v.sdr", "lsne-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP),
|
||||
6, { "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "lne-v.sdr", "lgsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
|
||||
8, { "sGlowmap", "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
|
||||
|
||||
{ "lne-v.sdr", "lsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
|
||||
7, { "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } }
|
||||
};
|
||||
|
||||
static const int Num_shader_files = sizeof(GL_shader_file) / sizeof(opengl_shader_file_t);
|
||||
|
||||
opengl_shader_t *Current_shader = NULL;
|
||||
|
||||
|
||||
void opengl_shader_check_info_log(GLhandleARB shader_object);
|
||||
|
||||
|
||||
void opengl_shader_set_current(opengl_shader_t *shader_obj)
|
||||
{
|
||||
Current_shader = shader_obj;
|
||||
|
||||
if (Current_shader != NULL) {
|
||||
vglUseProgramObjectARB(Current_shader->program_id);
|
||||
|
||||
#ifndef NDEBUG
|
||||
if ( opengl_check_for_errors("shader_set_current()") ) {
|
||||
vglValidateProgramARB(Current_shader->program_id);
|
||||
|
||||
GLint obj_status = 0;
|
||||
vglGetObjectParameterivARB(Current_shader->program_id, GL_OBJECT_VALIDATE_STATUS_ARB, &obj_status);
|
||||
|
||||
if ( !obj_status ) {
|
||||
opengl_shader_check_info_log(Current_shader->program_id);
|
||||
|
||||
mprintf(("VALIDATE INFO-LOG:\n"));
|
||||
|
||||
if (strlen(GLshader_info_log) > 5) {
|
||||
mprintf(("%s\n", GLshader_info_log));
|
||||
} else {
|
||||
mprintf(("<EMPTY>\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
vglUseProgramObjectARB(0);
|
||||
}
|
||||
}
|
||||
|
||||
int opengl_shader_get_index(int flags)
|
||||
{
|
||||
uint idx;
|
||||
|
||||
for (idx = 0; idx < GL_shader.size(); idx++) {
|
||||
if (GL_shader[idx].flags == flags) {
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void opengl_shader_shutdown()
|
||||
{
|
||||
uint i;
|
||||
|
||||
if ( !Use_GLSL ) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < GL_shader.size(); i++) {
|
||||
if (GL_shader[i].program_id) {
|
||||
vglDeleteObjectARB(GL_shader[i].program_id);
|
||||
GL_shader[i].program_id = 0;
|
||||
}
|
||||
|
||||
GL_shader[i].uniforms.clear();
|
||||
}
|
||||
|
||||
GL_shader.clear();
|
||||
|
||||
if (GLshader_info_log != NULL) {
|
||||
vm_free(GLshader_info_log);
|
||||
GLshader_info_log = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void opengl_shader_init()
|
||||
{
|
||||
char *vert = NULL, *frag = NULL;
|
||||
CFILE *cf_vert = NULL, *cf_frag = NULL;
|
||||
int i, idx, len;
|
||||
|
||||
if ( !Use_GLSL ) {
|
||||
return;
|
||||
}
|
||||
|
||||
GL_shader.reserve(Num_shader_files);
|
||||
|
||||
for (idx = 0; idx < Num_shader_files; idx++) {
|
||||
bool in_error = false;
|
||||
opengl_shader_t new_shader;
|
||||
opengl_shader_file_t *shader_file = &GL_shader_file[idx];
|
||||
|
||||
|
||||
if ( !Cmdline_glow && (shader_file->flags & SDR_FLAG_GLOW_MAP) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !Cmdline_spec && (shader_file->flags & SDR_FLAG_SPEC_MAP) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !Cmdline_env && (shader_file->flags & SDR_FLAG_ENV_MAP) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !Cmdline_normal && (shader_file->flags & SDR_FLAG_NORMAL_MAP) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !Cmdline_height && (shader_file->flags & SDR_FLAG_HEIGHT_MAP) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
mprintf((" Compiling shader -> %s / %s ... \n", shader_file->vert, shader_file->frag));
|
||||
|
||||
// read vertex shader
|
||||
cf_vert = cfopen(shader_file->vert, "rt", CFILE_NORMAL, CF_TYPE_EFFECTS);
|
||||
|
||||
if (cf_vert != NULL) {
|
||||
len = cfilelength(cf_vert);
|
||||
vert = (char*) vm_malloc(len+1);
|
||||
memset( vert, 0, len+1 );
|
||||
cfread(vert, len+1, 1, cf_vert);
|
||||
cfclose(cf_vert);
|
||||
cf_vert = NULL;
|
||||
} else {
|
||||
in_error = true;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
// read fragment shader
|
||||
cf_frag = cfopen(shader_file->frag, "rt", CFILE_NORMAL, CF_TYPE_EFFECTS);
|
||||
|
||||
if (cf_frag != NULL) {
|
||||
len = cfilelength(cf_frag);
|
||||
frag = (char*) vm_malloc(len+1);
|
||||
memset( frag, 0, len+1 );
|
||||
cfread(frag, len+1, 1, cf_frag);
|
||||
cfclose(cf_frag);
|
||||
cf_frag = NULL;
|
||||
} else {
|
||||
in_error = true;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
Verify( vert != NULL );
|
||||
Verify( frag != NULL );
|
||||
|
||||
new_shader.program_id = opengl_shader_create(vert, frag);
|
||||
|
||||
if ( !new_shader.program_id ) {
|
||||
in_error = true;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
new_shader.flags = shader_file->flags;
|
||||
|
||||
opengl_shader_set_current( &new_shader );
|
||||
|
||||
new_shader.uniforms.reserve(shader_file->num_uniforms);
|
||||
|
||||
for (i = 0; i < shader_file->num_uniforms; i++) {
|
||||
opengl_shader_init_uniform( shader_file->uniforms[i] );
|
||||
}
|
||||
|
||||
opengl_shader_set_current();
|
||||
|
||||
// add it to our list of embedded shaders
|
||||
GL_shader.push_back( new_shader );
|
||||
|
||||
Done:
|
||||
if (cf_vert != NULL) {
|
||||
cfclose(cf_vert);
|
||||
cf_vert = NULL;
|
||||
}
|
||||
|
||||
if (cf_frag != NULL) {
|
||||
cfclose(cf_frag);
|
||||
cf_frag = NULL;
|
||||
}
|
||||
|
||||
if (vert != NULL) {
|
||||
vm_free(vert);
|
||||
vert = NULL;
|
||||
}
|
||||
|
||||
if (frag != NULL) {
|
||||
vm_free(frag);
|
||||
frag = NULL;
|
||||
}
|
||||
|
||||
if (in_error) {
|
||||
// shut off relevant usage things ...
|
||||
|
||||
if (shader_file->flags & SDR_FLAG_HEIGHT_MAP) {
|
||||
mprintf((" Shader in_error! Disabling height maps!\n"));
|
||||
Cmdline_height = 0;
|
||||
}
|
||||
|
||||
if (shader_file->flags & SDR_FLAG_NORMAL_MAP) {
|
||||
mprintf((" Shader in_error! Disabling normal maps and height maps!\n"));
|
||||
Cmdline_height = 0;
|
||||
Cmdline_normal = 0;
|
||||
}
|
||||
|
||||
if (idx == 0) {
|
||||
mprintf((" Shader in_error! Disabling GLSL!\n"));
|
||||
|
||||
Use_GLSL = 0;
|
||||
Cmdline_height = 0;
|
||||
Cmdline_normal = 0;
|
||||
|
||||
GL_shader.clear();
|
||||
break;;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mprintf(("\n"));
|
||||
}
|
||||
|
||||
void opengl_shader_check_info_log(GLhandleARB shader_object)
|
||||
{
|
||||
if (GLshader_info_log == NULL) {
|
||||
GLshader_info_log = (char *) vm_malloc(GLshader_info_log_size);
|
||||
}
|
||||
|
||||
memset(GLshader_info_log, 0, GLshader_info_log_size);
|
||||
|
||||
vglGetInfoLogARB(shader_object, GLshader_info_log_size-1, 0, GLshader_info_log);
|
||||
}
|
||||
|
||||
GLhandleARB opengl_shader_compile_object(const GLcharARB *shader_source, GLenum shader_type)
|
||||
{
|
||||
GLhandleARB shader_object = 0;
|
||||
GLint status = 0;
|
||||
|
||||
shader_object = vglCreateShaderObjectARB(shader_type);
|
||||
|
||||
vglShaderSourceARB(shader_object, 1, &shader_source, NULL);
|
||||
vglCompileShaderARB(shader_object);
|
||||
|
||||
// check if the compile was successful
|
||||
vglGetObjectParameterivARB(shader_object, GL_OBJECT_COMPILE_STATUS_ARB, &status);
|
||||
|
||||
opengl_shader_check_info_log(shader_object);
|
||||
|
||||
// we failed, bail out now...
|
||||
if (status == 0) {
|
||||
// basic error check
|
||||
mprintf(("%s shader failed to compile:\n%s\n", (shader_type == GL_VERTEX_SHADER_ARB) ? "Vertex" : "Fragment", GLshader_info_log));
|
||||
|
||||
// this really shouldn't exist, but just in case
|
||||
if (shader_object) {
|
||||
vglDeleteObjectARB(shader_object);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// we succeeded, maybe output warnings too
|
||||
if (strlen(GLshader_info_log) > 5) {
|
||||
nprintf(("SHADER-DEBUG", "%s shader compiled with warnings:\n%s\n", (shader_type == GL_VERTEX_SHADER_ARB) ? "Vertex" : "Fragment", GLshader_info_log));
|
||||
}
|
||||
|
||||
return shader_object;
|
||||
}
|
||||
|
||||
GLhandleARB opengl_shader_link_object(GLhandleARB vertex_object, GLhandleARB fragment_object)
|
||||
{
|
||||
GLhandleARB shader_object = 0;
|
||||
GLint status = 0;
|
||||
|
||||
shader_object = vglCreateProgramObjectARB();
|
||||
|
||||
if (vertex_object) {
|
||||
vglAttachObjectARB(shader_object, vertex_object);
|
||||
}
|
||||
|
||||
if (fragment_object) {
|
||||
vglAttachObjectARB(shader_object, fragment_object);
|
||||
}
|
||||
|
||||
vglLinkProgramARB(shader_object);
|
||||
|
||||
// check if the link was successful
|
||||
vglGetObjectParameterivARB(shader_object, GL_OBJECT_LINK_STATUS_ARB, &status);
|
||||
|
||||
opengl_shader_check_info_log(shader_object);
|
||||
|
||||
// we failed, bail out now...
|
||||
if (status == 0) {
|
||||
mprintf(("Shader failed to link:\n%s\n", GLshader_info_log));
|
||||
|
||||
if (shader_object) {
|
||||
vglDeleteObjectARB(shader_object);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// we succeeded, maybe output warnings too
|
||||
if (strlen(GLshader_info_log) > 5) {
|
||||
nprintf(("SHADER-DEBUG", "Shader linked with warnings:\n%s\n", GLshader_info_log));
|
||||
}
|
||||
|
||||
return shader_object;
|
||||
}
|
||||
|
||||
/*GLhandleARB opengl_shader_create(const char *vs, const char *fs)
|
||||
{
|
||||
GLhandleARB vs_o = 0;
|
||||
GLhandleARB fs_o = 0;
|
||||
GLhandleARB program = 0;
|
||||
|
||||
if (vs) {
|
||||
vs_o = opengl_shader_compile_object( (const GLcharARB*)vs, GL_VERTEX_SHADER_ARB );
|
||||
|
||||
if ( !vs_o ) {
|
||||
mprintf(("ERROR! Unable to create vertex shader!\n"));
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
|
||||
if (fs) {
|
||||
fs_o = opengl_shader_compile_object( (const GLcharARB*)fs, GL_FRAGMENT_SHADER_ARB );
|
||||
|
||||
if ( !fs_o ) {
|
||||
mprintf(("ERROR! Unable to create fragment shader!\n"));
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
|
||||
program = opengl_shader_link_object(vs_o, fs_o);
|
||||
|
||||
if ( !program ) {
|
||||
mprintf(("ERROR! Unable to create shader program!\n"));
|
||||
}
|
||||
|
||||
Done:
|
||||
if (vs_o) {
|
||||
vglDeleteObjectARB(vs_o);
|
||||
}
|
||||
|
||||
if (fs_o) {
|
||||
vglDeleteObjectARB(fs_o);
|
||||
}
|
||||
|
||||
return program;
|
||||
}*/
|
||||
|
||||
GLhandleARB opengl_shader_create(const char *vs, const char *fs)
|
||||
{
|
||||
GLhandleARB vs_o = 0;
|
||||
GLhandleARB fs_o = 0;
|
||||
GLhandleARB program = 0;
|
||||
|
||||
if (vs) {
|
||||
vs_o = opengl_shader_compile_object( (const GLcharARB*)vs, GL_VERTEX_SHADER_ARB );
|
||||
|
||||
if ( !vs_o ) {
|
||||
mprintf(("ERROR! Unable to create vertex shader!\n"));
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
|
||||
if (fs) {
|
||||
fs_o = opengl_shader_compile_object( (const GLcharARB*)fs, GL_FRAGMENT_SHADER_ARB );
|
||||
|
||||
if ( !fs_o ) {
|
||||
mprintf(("ERROR! Unable to create fragment shader!\n"));
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
|
||||
program = opengl_shader_link_object(vs_o, fs_o);
|
||||
|
||||
if ( !program ) {
|
||||
mprintf(("ERROR! Unable to create shader program!\n"));
|
||||
}
|
||||
|
||||
Done:
|
||||
if (vs_o) {
|
||||
vglDeleteObjectARB(vs_o);
|
||||
}
|
||||
|
||||
if (fs_o) {
|
||||
vglDeleteObjectARB(fs_o);
|
||||
}
|
||||
|
||||
return program;
|
||||
}
|
||||
|
||||
void opengl_shader_init_uniform(char *uniform_text)
|
||||
{
|
||||
opengl_shader_uniform_t new_uniform;
|
||||
|
||||
if ( (Current_shader == NULL) || (uniform_text == NULL) ) {
|
||||
Int3();
|
||||
return;
|
||||
}
|
||||
|
||||
new_uniform.text_id = uniform_text;
|
||||
new_uniform.location = vglGetUniformLocationARB(Current_shader->program_id, uniform_text);
|
||||
|
||||
if (new_uniform.location < 0) {
|
||||
mprintf(("WARNING: Unable to get shader uniform location for \"%s\"!\n", uniform_text));
|
||||
return;
|
||||
}
|
||||
|
||||
Current_shader->uniforms.push_back( new_uniform );
|
||||
}
|
||||
|
||||
GLint opengl_shader_get_uniform(char *uniform_text)
|
||||
{
|
||||
if ( (Current_shader == NULL) || (uniform_text == NULL) ) {
|
||||
Int3();
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::vector<opengl_shader_uniform_t>::iterator uniform;
|
||||
|
||||
for (uniform = Current_shader->uniforms.begin(); uniform != Current_shader->uniforms.end(); ++uniform) {
|
||||
if ( !uniform->text_id.compare(uniform_text) ) {
|
||||
return uniform->location;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
Loaded 100 of 293 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user