diff --git a/TODO b/TODO index 974b9d6..3bb9c95 100644 --- a/TODO +++ b/TODO @@ -1,19 +1,23 @@ [DONE] [08/24/01] Finish OpenGL code. [DONE] [08/26/01] Fix sound code. +[DONE] [11/10/01] Save/Load Game support. +[DONE] [11/25/01] CD Audio. * Menus. +* Progress bar. +* Make vidmodes work. * Debug "pure virtual method called" * Proper file loading/saving (ignore case, search certain directories) and config handling (~/.avp/{ge, re, ad, md, pd}/?) * Command line options. -* CD Audio. * Joystick support. -* Save/Load Game support. -* Revisit sound code. +* GL_EXT_secondary_color +* Revisit sound code. (Try AL_PITCH support, etc) * Try to get demos and regular edition to work. * See what FOX/Rebellion has to say (if anything) about redistribution of the demos and if its possible to create an installer for regular/gold edition CDs. * Do something with the ingame movies. Might just leave as-is. +* Disable Mutliplayer in the Main Menu. * Possible Idea: implement demos? * See if the build process can be made easier for those who download the source. @@ -28,5 +32,15 @@ etc.) * Release new version. And fix bugs, and release new version, and so on. ---- +* Command line: + [-h | --help] Display this help message + [-v | --version] Display the game version + [-f | --fullscreen] Run the game fullscreen + [-w | --windowed] Run the game in a window + [-s | --nosound] Do not access the soundcard + [-c | --nocdrom] Do not access the CD-ROM +--debug enable debug mode * Debug, verify, and reimplant the inline functions in mathline.c to inline.h +* Remove unused files. +* Squelch any unnecessary debug output diff --git a/src/aafont.h b/src/aafont.h deleted file mode 100644 index 6e80ff3..0000000 --- a/src/aafont.h +++ /dev/null @@ -1,258 +0,0 @@ -char AAFontWidths[256] = { - 0, /* 0 */ - 0, /* 1 */ - 0, /* 2 */ - 0, /* 3 */ - 0, /* 4 */ - 0, /* 5 */ - 0, /* 6 */ - 0, /* 7 */ - 0, /* 8 */ - 0, /* 9 */ - 0, /* 10 */ - 0, /* 11 */ - 0, /* 12 */ - 0, /* 13 */ - 0, /* 14 */ - 0, /* 15 */ - 0, /* 16 */ - 0, /* 17 */ - 0, /* 18 */ - 0, /* 19 */ - 0, /* 20 */ - 0, /* 21 */ - 0, /* 22 */ - 0, /* 23 */ - 0, /* 24 */ - 0, /* 25 */ - 0, /* 26 */ - 0, /* 27 */ - 0, /* 28 */ - 0, /* 29 */ - 0, /* 30 */ - 0, /* 31 */ - 3, /* 32 */ - 2, /* 33 */ - 5, /* 34 */ - 6, /* 35 */ - 6, /* 36 */ - 9, /* 37 */ - 8, /* 38 */ - 3, /* 39 */ - 4, /* 40 */ - 4, /* 41 */ - 4, /* 42 */ - 6, /* 43 */ - 3, /* 44 */ - 4, /* 45 */ - 3, /* 46 */ - 4, /* 47 */ - 6, /* 48 */ - 5, /* 49 */ - 6, /* 50 */ - 6, /* 51 */ - 6, /* 52 */ - 6, /* 53 */ - 6, /* 54 */ - 6, /* 55 */ - 6, /* 56 */ - 6, /* 57 */ - 2, /* 58 */ - 2, /* 59 */ - 6, /* 60 */ - 6, /* 61 */ - 6, /* 62 */ - 7, /* 63 */ - 11, /* 64 */ - 8, /* 65 */ - 8, /* 66 */ - 8, /* 67 */ - 8, /* 68 */ - 7, /* 69 */ - 7, /* 70 */ - 8, /* 71 */ - 7, /* 72 */ - 3, /* 73 */ - 6, /* 74 */ - 8, /* 75 */ - 7, /* 76 */ - 9, /* 77 */ - 8, /* 78 */ - 8, /* 79 */ - 7, /* 80 */ - 8, /* 81 */ - 8, /* 82 */ - 7, /* 83 */ - 7, /* 84 */ - 8, /* 85 */ - 7, /* 86 */ - 10, /* 87 */ - 7, /* 88 */ - 7, /* 89 */ - 7, /* 90 */ - 4, /* 91 */ - 4, /* 92 */ - 4, /* 93 */ - 6, /* 94 */ - 7, /* 95 */ - 5, /* 96 */ - 6, /* 97 */ - 7, /* 98 */ - 6, /* 99 */ - 7, /* 100 */ - 6, /* 101 */ - 4, /* 102 */ - 7, /* 103 */ - 6, /* 104 */ - 3, /* 105 */ - 4, /* 106 */ - 6, /* 107 */ - 3, /* 108 */ - 9, /* 109 */ - 6, /* 110 */ - 7, /* 111 */ - 7, /* 112 */ - 6, /* 113 */ - 5, /* 114 */ - 6, /* 115 */ - 4, /* 116 */ - 6, /* 117 */ - 6, /* 118 */ - 9, /* 119 */ - 6, /* 120 */ - 6, /* 121 */ - 6, /* 122 */ - 5, /* 123 */ - 2, /* 124 */ - 5, /* 125 */ - 6, /* 126 */ - 2, /* 127 */ - 2, /* 128 */ - 2, /* 129 */ - 2, /* 130 */ - 6, /* 131 */ - 2, /* 132 */ - 2, /* 133 */ - 2, /* 134 */ - 2, /* 135 */ - 6, /* 136 */ - 14, /* 137 */ - 16, /* 138 */ - 13, /* 139 */ - 16, /* 140 */ - 16, /* 141 */ - 15, /* 142 */ - 15, /* 143 */ - 2, /* 144 */ - 2, /* 145 */ - 2, /* 146 */ - 2, /* 147 */ - 2, /* 148 */ - 2, /* 149 */ - 2, /* 150 */ - 16, /* 151 */ - 15, /* 152 */ - 10, /* 153 */ - 14, /* 154 */ - 16, /* 155 */ - 14, /* 156 */ - 15, /* 157 */ - 15, /* 158 */ - 2, /* 159 */ - 2, /* 160 */ - 2, /* 161 */ - 6, /* 162 */ - 6, /* 163 */ - 6, /* 164 */ - 7, /* 165 */ - 2, /* 166 */ - 2, /* 167 */ - 6, /* 168 */ - 8, /* 169 */ - 4, /* 170 */ - 7, /* 171 */ - 2, /* 172 */ - 2, /* 173 */ - 8, /* 174 */ - 2, /* 175 */ - 14, /* 176 */ - 16, /* 177 */ - 14, /* 178 */ - 2, /* 179 */ - 6, /* 180 */ - 2, /* 181 */ - 2, /* 182 */ - 2, /* 183 */ - 2, /* 184 */ - 2, /* 185 */ - 4, /* 186 */ - 7, /* 187 */ - 9, /* 188 */ - 9, /* 189 */ - 2, /* 190 */ - 7, /* 191 */ - 8, /* 192 */ - 8, /* 193 */ - 8, /* 194 */ - 2, /* 195 */ - 8, /* 196 */ - 8, /* 197 */ - 11, /* 198 */ - 8, /* 199 */ - 7, /* 200 */ - 7, /* 201 */ - 7, /* 202 */ - 7, /* 203 */ - 3, /* 204 */ - 3, /* 205 */ - 4, /* 206 */ - 4, /* 207 */ - 8, /* 208 */ - 8, /* 209 */ - 8, /* 210 */ - 8, /* 211 */ - 8, /* 212 */ - 8, /* 213 */ - 8, /* 214 */ - 2, /* 215 */ - 8, /* 216 */ - 8, /* 217 */ - 8, /* 218 */ - 8, /* 219 */ - 8, /* 220 */ - 7, /* 221 */ - 2, /* 222 */ - 6, /* 223 */ - 6, /* 224 */ - 6, /* 225 */ - 6, /* 226 */ - 2, /* 227 */ - 6, /* 228 */ - 6, /* 229 */ - 10, /* 230 */ - 6, /* 231 */ - 6, /* 232 */ - 6, /* 233 */ - 6, /* 234 */ - 6, /* 235 */ - 3, /* 236 */ - 4, /* 237 */ - 4, /* 238 */ - 4, /* 239 */ - 6, /* 240 */ - 6, /* 241 */ - 7, /* 242 */ - 7, /* 243 */ - 7, /* 244 */ - 7, /* 245 */ - 7, /* 246 */ - 2, /* 247 */ - 9, /* 248 */ - 6, /* 249 */ - 6, /* 250 */ - 6, /* 251 */ - 6, /* 252 */ - 6, /* 253 */ - 2, /* 254 */ - 0 /* 255 */ -}; diff --git a/src/avp/bh_agun.c b/src/avp/bh_agun.c index 2926df5..ad66084 100644 --- a/src/avp/bh_agun.c +++ b/src/avp/bh_agun.c @@ -1712,4 +1712,4 @@ void SaveStrategy_Autogun(STRATEGYBLOCK* sbPtr) Save_SoundState(&agunStatusPointer->soundHandle); Save_SoundState(&agunStatusPointer->soundHandle2); -} \ No newline at end of file +} diff --git a/src/avp/bh_ais.c b/src/avp/bh_ais.c index 87ba369..e16bbf8 100644 --- a/src/avp/bh_ais.c +++ b/src/avp/bh_ais.c @@ -3521,7 +3521,6 @@ int New_GetAvoidanceDirection(STRATEGYBLOCK *sbPtr, NPC_AVOIDANCEMANAGER *manage { // What follows is an attempt to make sure we don't jump off any cliffs... VECTORCH test_location; - int test_distance = this_distance / 2; testDirn.vx *= this_distance; testDirn.vy *= this_distance; testDirn.vz *= this_distance; diff --git a/src/avp/bh_alien.h b/src/avp/bh_alien.h index 647c64a..9fed333 100644 --- a/src/avp/bh_alien.h +++ b/src/avp/bh_alien.h @@ -257,4 +257,4 @@ #endif -#endif \ No newline at end of file +#endif diff --git a/src/avp/bh_debri.h b/src/avp/bh_debri.h index 3ea8342..320242b 100644 --- a/src/avp/bh_debri.h +++ b/src/avp/bh_debri.h @@ -45,4 +45,4 @@ extern void MakeFragments (STRATEGYBLOCK *sbptr); #define NO_OF_SPRITES_IN_BIG_EXPLOSION 5 #else #define NO_OF_SPRITES_IN_BIG_EXPLOSION 10 -#endif \ No newline at end of file +#endif diff --git a/src/avp/bh_far.c b/src/avp/bh_far.c index d85f5e6..32a6177 100644 --- a/src/avp/bh_far.c +++ b/src/avp/bh_far.c @@ -1255,4 +1255,4 @@ void FarNpc_FlipAround(STRATEGYBLOCK *sbPtr) dynPtr->OrientEuler.EulerY += (1024 + FastRandom()%1024); dynPtr->OrientEuler.EulerY &= wrap360; -} \ No newline at end of file +} diff --git a/src/avp/bh_far.h b/src/avp/bh_far.h index 622d362..b6bf21d 100644 --- a/src/avp/bh_far.h +++ b/src/avp/bh_far.h @@ -60,4 +60,4 @@ extern void FarNpc_FlipAround(STRATEGYBLOCK *sbPtr); } #endif -#endif \ No newline at end of file +#endif diff --git a/src/avp/bh_fhug.c b/src/avp/bh_fhug.c index c47f44c..87e9f9f 100644 --- a/src/avp/bh_fhug.c +++ b/src/avp/bh_fhug.c @@ -776,8 +776,6 @@ void PlotFaceHugger(STRATEGYBLOCK *sbPtr) { static void Execute_FHNS_Attack(STRATEGYBLOCK *sbPtr) { - extern VIEWDESCRIPTORBLOCK *ActiveVDBList[]; - DYNAMICSBLOCK *dynPtr; FACEHUGGER_STATUS_BLOCK *facehuggerStatusPointer; @@ -1332,4 +1330,4 @@ void SaveStrategy_FaceHugger(STRATEGYBLOCK* sbPtr) Save_SoundState(&huggerStatusPointer->soundHandle); Save_SoundState(&huggerStatusPointer->soundHandle2); -} \ No newline at end of file +} diff --git a/src/avp/bh_fhug.h b/src/avp/bh_fhug.h index b8d3211..e1eaa62 100644 --- a/src/avp/bh_fhug.h +++ b/src/avp/bh_fhug.h @@ -109,4 +109,4 @@ void Wake_Hugger(STRATEGYBLOCK *sbPtr); } #endif -#endif \ No newline at end of file +#endif diff --git a/src/avp/bh_gener.h b/src/avp/bh_gener.h index 0cb48e2..ae7b7f9 100644 --- a/src/avp/bh_gener.h +++ b/src/avp/bh_gener.h @@ -128,4 +128,4 @@ extern void GeneratorBalance_NoteAIDeath(); extern void GeneratorBalance_NotePlayerDeath(); -#endif \ No newline at end of file +#endif diff --git a/src/avp/bh_ldoor.h b/src/avp/bh_ldoor.h index 5a941f6..8785d86 100644 --- a/src/avp/bh_ldoor.h +++ b/src/avp/bh_ldoor.h @@ -41,6 +41,3 @@ typedef struct lift_door_tools_template extern void* LiftDoorBehaveInit(void* bhdata, STRATEGYBLOCK* sbptr); extern void LiftDoorBehaveFun(STRATEGYBLOCK* sbptr); - - - diff --git a/src/avp/bh_lift.c b/src/avp/bh_lift.c index 3a2c6e8..865b819 100644 --- a/src/avp/bh_lift.c +++ b/src/avp/bh_lift.c @@ -815,4 +815,4 @@ static void TeleportFloorSwitches { TeleportContents(dest, src, 0); } -} \ No newline at end of file +} diff --git a/src/avp/bh_light.c b/src/avp/bh_light.c index 497212a..4bc4ac1 100644 --- a/src/avp/bh_light.c +++ b/src/avp/bh_light.c @@ -1149,4 +1149,4 @@ void SaveStrategy_PlacedLight(STRATEGYBLOCK* sbPtr) block->integrity = sbPtr->integrity; block->SBDamageBlock = sbPtr->SBDamageBlock; -} \ No newline at end of file +} diff --git a/src/avp/bh_ltfx.c b/src/avp/bh_ltfx.c index c4af004..617e7c8 100644 --- a/src/avp/bh_ltfx.c +++ b/src/avp/bh_ltfx.c @@ -640,4 +640,4 @@ void SaveStrategy_LightFx(STRATEGYBLOCK* sbPtr) COPYELEMENT_SAVE(timer2) COPYELEMENT_SAVE(time_to_next_flicker_state) } -#endif \ No newline at end of file +#endif diff --git a/src/avp/bh_ltfx.h b/src/avp/bh_ltfx.h index e7f2e6c..ba58343 100644 --- a/src/avp/bh_ltfx.h +++ b/src/avp/bh_ltfx.h @@ -46,4 +46,4 @@ void * LightFXBehaveInit (void * bhdata, STRATEGYBLOCK* sbptr); void LightFXBehaveFun (STRATEGYBLOCK* sbptr); -#endif \ No newline at end of file +#endif diff --git a/src/avp/bh_marin.h b/src/avp/bh_marin.h index 93e749c..26569e9 100644 --- a/src/avp/bh_marin.h +++ b/src/avp/bh_marin.h @@ -409,4 +409,4 @@ #endif -#endif \ No newline at end of file +#endif diff --git a/src/avp/bh_mission.h b/src/avp/bh_mission.h index 02a854d..61d65ae 100644 --- a/src/avp/bh_mission.h +++ b/src/avp/bh_mission.h @@ -47,4 +47,4 @@ typedef struct message_behav_block }MESSAGE_BEHAV_BLOCK; -#endif \ No newline at end of file +#endif diff --git a/src/avp/bh_near.c b/src/avp/bh_near.c index aed2a70..8ae5c72 100644 --- a/src/avp/bh_near.c +++ b/src/avp/bh_near.c @@ -830,7 +830,6 @@ static void AlienNearState_Approach(STRATEGYBLOCK *sbPtr) /* target acquisition ? */ { - extern DISPLAYBLOCK *Player; if(VectorDistance(&(alienStatusPointer->Target->DynPtr->Position),&(dynPtr->Position)) < ALIEN_CURVETOPLAYERDIST) { curveToPlayer = 1; @@ -1327,7 +1326,6 @@ static void AlienNearState_Wander(STRATEGYBLOCK *sbPtr) { ALIEN_STATUS_BLOCK *alienStatusPointer; DYNAMICSBLOCK *dynPtr; - int approachingAirDuct = 0; VECTORCH velocityDirection = {0,0,0}; LOCALASSERT(sbPtr); @@ -1604,7 +1602,6 @@ static void AlienNearState_Retreat(STRATEGYBLOCK *sbPtr) { ALIEN_STATUS_BLOCK *alienStatusPointer; DYNAMICSBLOCK *dynPtr; - int approachingAirDuct = 0; VECTORCH velocityDirection = {0,0,0}; LOCALASSERT(sbPtr); diff --git a/src/avp/bh_paq.h b/src/avp/bh_paq.h index 547e951..b6d8d27 100644 --- a/src/avp/bh_paq.h +++ b/src/avp/bh_paq.h @@ -100,4 +100,4 @@ void PAQIsDamaged(STRATEGYBLOCK *sbPtr, DAMAGE_PROFILE *damage, int multiple); } #endif -#endif \ No newline at end of file +#endif diff --git a/src/avp/bh_plachier.c b/src/avp/bh_plachier.c index e7dd4dc..32a663c 100644 --- a/src/avp/bh_plachier.c +++ b/src/avp/bh_plachier.c @@ -453,4 +453,4 @@ void SaveStrategy_PlacedHierarchy(STRATEGYBLOCK* sbPtr) Save_SoundState(&ph_bhv->sounds[i].activ_no); } -} \ No newline at end of file +} diff --git a/src/avp/bh_pred.h b/src/avp/bh_pred.h index 9095f10..460ffce 100644 --- a/src/avp/bh_pred.h +++ b/src/avp/bh_pred.h @@ -258,4 +258,4 @@ extern void StartPredatorSelfDestructExplosion(STRATEGYBLOCK *sbPtr); #endif -#endif \ No newline at end of file +#endif diff --git a/src/avp/bh_queen.c b/src/avp/bh_queen.c index c3f6ab5..0b8a64b 100644 --- a/src/avp/bh_queen.c +++ b/src/avp/bh_queen.c @@ -4860,7 +4860,6 @@ static BOOL TargetIsFiringFlamethrowerAtQueen(STRATEGYBLOCK *sbPtr) static void MakeNonFragable_Recursion(SECTION_DATA *this_section_data) { SECTION_DATA *sdptr; - int health_increment; sdptr=NULL; @@ -5170,4 +5169,4 @@ void SaveStrategy_Queen(STRATEGYBLOCK* sbPtr) SaveHierarchy(&queenStatusPointer->HModelController); Save_SoundState(&queenStatusPointer->soundHandle); -} \ No newline at end of file +} diff --git a/src/avp/bh_snds.c b/src/avp/bh_snds.c index 30128e6..63aca98 100644 --- a/src/avp/bh_snds.c +++ b/src/avp/bh_snds.c @@ -290,4 +290,4 @@ void SaveStrategy_PlacedSound(STRATEGYBLOCK* sbPtr) Save_SoundState(&sbb->activ_no); -} \ No newline at end of file +} diff --git a/src/avp/bh_snds.h b/src/avp/bh_snds.h index 717c0d3..17c4931 100644 --- a/src/avp/bh_snds.h +++ b/src/avp/bh_snds.h @@ -70,4 +70,4 @@ void StopPlacedSoundPlaying(STRATEGYBLOCK* sbptr); #endif -#endif \ No newline at end of file +#endif diff --git a/src/avp/bh_spcl.h b/src/avp/bh_spcl.h index e57044d..83d0657 100644 --- a/src/avp/bh_spcl.h +++ b/src/avp/bh_spcl.h @@ -74,4 +74,4 @@ typedef struct xeno_morph_room_data } XENO_MORPH_ROOM_DATA; -#endif \ No newline at end of file +#endif diff --git a/src/avp/bh_videoscreen.h b/src/avp/bh_videoscreen.h index 06442da..919b111 100644 --- a/src/avp/bh_videoscreen.h +++ b/src/avp/bh_videoscreen.h @@ -33,4 +33,4 @@ void* InitVideoScreen(void* bhdata,STRATEGYBLOCK *sbPtr); void VideoScreenBehaviour(STRATEGYBLOCK *sbPtr); void VideoScreenIsDamaged(STRATEGYBLOCK *sbPtr, DAMAGE_PROFILE *damage, int multiple); -#endif \ No newline at end of file +#endif diff --git a/src/avp/bh_waypt.c b/src/avp/bh_waypt.c index 1c6af95..3f6b6d7 100644 --- a/src/avp/bh_waypt.c +++ b/src/avp/bh_waypt.c @@ -995,4 +995,4 @@ void GetTargetPositionInWaypoint(WAYPOINT_VOLUME *waypoint,VECTORCH *output) { GLOBALASSERT(WaypointContainsPoint(waypoint,output)); -} \ No newline at end of file +} diff --git a/src/avp/bh_weap.c b/src/avp/bh_weap.c index d530635..107eced 100644 --- a/src/avp/bh_weap.c +++ b/src/avp/bh_weap.c @@ -364,8 +364,6 @@ static STRATEGYBLOCK* InitialiseFrisbeeBehaviour_ForLoad() { DISPLAYBLOCK *dispPtr; DYNAMICSBLOCK *dynPtr; FRISBEE_BEHAV_BLOCK *bblk; - int a; - /* make displayblock with correct shape, etc */ dispPtr = MakeObject(I_BehaviourFrisbee,&zeroVect); @@ -3103,8 +3101,6 @@ static STRATEGYBLOCK* InitialiseDiscBehaviour_ForLoad() { DISPLAYBLOCK *dispPtr; DYNAMICSBLOCK *dynPtr; PC_PRED_DISC_BEHAV_BLOCK *bblk; - int a; - /* make displayblock with correct shape, etc */ dispPtr = MakeObject(I_BehaviourPredatorDisc_SeekTrack,&zeroVect); diff --git a/src/avp/bh_weap.h b/src/avp/bh_weap.h index 3cf575e..5d36349 100644 --- a/src/avp/bh_weap.h +++ b/src/avp/bh_weap.h @@ -193,4 +193,4 @@ typedef struct PredatorDiscBehaviourType { } PRED_DISC_BEHAV_BLOCK; -#endif \ No newline at end of file +#endif diff --git a/src/avp/bh_xeno.c b/src/avp/bh_xeno.c index 29f8b29..c4775d7 100644 --- a/src/avp/bh_xeno.c +++ b/src/avp/bh_xeno.c @@ -1886,7 +1886,6 @@ void Xeno_TurnAndTarget(STRATEGYBLOCK *sbPtr, int *ref_anglex,int *ref_angley) { void Xeno_Limbs_ShootTheRoof(STRATEGYBLOCK *sbPtr) { XENO_STATUS_BLOCK *xenoStatusPointer; - int anglex,angley; LOCALASSERT(sbPtr); xenoStatusPointer = (XENO_STATUS_BLOCK *)(sbPtr->SBdataptr); @@ -5305,4 +5304,4 @@ void SaveStrategy_Xenoborg(STRATEGYBLOCK* sbPtr) Save_SoundState(&xenoStatusPointer->soundHandle1); Save_SoundState(&xenoStatusPointer->soundHandle2); -} \ No newline at end of file +} diff --git a/src/avp/bh_xeno.h b/src/avp/bh_xeno.h index 2e60b63..2e82c10 100644 --- a/src/avp/bh_xeno.h +++ b/src/avp/bh_xeno.h @@ -231,4 +231,4 @@ #endif -#endif \ No newline at end of file +#endif diff --git a/src/avp/bonusabilities.c b/src/avp/bonusabilities.c index 0fa09df..206b78c 100644 --- a/src/avp/bonusabilities.c +++ b/src/avp/bonusabilities.c @@ -445,4 +445,4 @@ void SaveStrategy_Grapple(STRATEGYBLOCK* sbPtr) block->dynamics = *sbPtr->DynPtr; block->dynamics.CollisionReportPtr=0; -} \ No newline at end of file +} diff --git a/src/avp/cheatmodes.c b/src/avp/cheatmodes.c index 526ad63..812c31a 100644 --- a/src/avp/cheatmodes.c +++ b/src/avp/cheatmodes.c @@ -1140,4 +1140,4 @@ extern int AnyCheatModesAllowed(void) } } return 0; -} \ No newline at end of file +} diff --git a/src/avp/comp_map.c b/src/avp/comp_map.c index ec68781..83fcee1 100644 --- a/src/avp/comp_map.c +++ b/src/avp/comp_map.c @@ -18,7 +18,7 @@ extern MAPBLOCK6 Term_Type6; extern MODULEMAPBLOCK AvpCompiledMaps[]; MAPHEADER Map[]={ - + { 0, 0, 0, @@ -26,7 +26,8 @@ MAPHEADER Map[]={ 0, 0, 0, - &Player_and_Camera_Type8[0], + &Player_and_Camera_Type8[0] + } }; @@ -91,8 +92,8 @@ MAPBLOCK6 Empty_Landscape_Type6 = { -1, /* No shape */ - 0,0,0, /* Loc */ - 0,0,0, /* Orient */ + {0,0,0}, /* Loc */ + {0,0,0}, /* Orient */ ObFlag_MultLSrc /*| ObFlag_BFCRO*/ @@ -125,8 +126,8 @@ MAPBLOCK6 Empty_Object_Type6 = { -1, /* No shape */ - 0,0,0, /* Loc */ - 0,0,0, /* Orient */ + {0,0,0}, /* Loc */ + {0,0,0}, /* Orient */ ObFlag_MultLSrc | /*| ObFlag_BFCRO*/ @@ -157,8 +158,8 @@ MAPBLOCK6 Term_Type6 = { MapType_Term, 0, - 0,0,0, - 0,0,0, + {0,0,0}, + {0,0,0}, 0, /* Flags */ #if StandardStrategyAndCollisions @@ -352,8 +353,8 @@ MODULEMAPBLOCK AvpCompiledMaps[] = { { MapType_Term, /* Map Type Function */ 0, /* Shape */ - 0,0,0, /* Loc */ - 0,0,0, /* Orient */ + {0,0,0}, /* Loc */ + {0,0,0}, /* Orient */ 0, /* Flags 1 */ 0, /* Flags 2 */ 0, /* Flags 3 */ @@ -371,12 +372,12 @@ MODULEMAPBLOCK AvpCompiledMaps[] = { 0, /* MapMass */ 0,0,0, /* MapNewtonV */ #endif - 0,0,0, /* MapOrigin */ + {0,0,0}, /* MapOrigin */ 0, /* MapSimShapes */ 0, /* MapViewType */ 0, /* MapMPtr */ 0, /* MapDPtr */ - 0,0,0, /* MapMOffset */ + {0,0,0}, /* MapMOffset */ } }; @@ -388,8 +389,8 @@ MODULE Empty_Module = { "null", /* char m_name[] */ 0, /* int m_index */ 0, /* int m_flags */ - 0,0,0, /* VECTOR m_world */ - "null", /* MREF m_ext */ + {0,0,0}, /* VECTOR m_world */ + {"null"}, /* MREF m_ext */ 0, /* int m_ext_scale */ 0, /* int m_maxx */ 0, /* int m_minx */ @@ -399,22 +400,22 @@ MODULE Empty_Module = { 0, /* int m_minz */ 0, /* MODULEMAPBLOCK *m_mapptr */ 0, /* struct displayblock *m_dptr */ - "null", /* MREF m_vptr */ + {"null"}, /* MREF m_vptr */ 0, /* VMODULE *m_v_ptrs */ 0, /* struct module **m_link_ptrs */ // 0, /* VIEWPORT *m_viewports */ 0, /* MODULETABLEHEADER *m_table */ mfun_null, /* MFUNCTION m_ifvisible */ mfun_null, /* MFUNCTION m_ifvinside */ - "null", /* MREF m_funref */ + {"null"}, /* MREF m_funref */ 0, /* Strategy block * */ 0, /* num lights*/ NULL, /* pointer to light blocks*/ NULL, /* pointer to extraitemdata */ + {0,0,0, 0,0,0, - 0,0,0, - 0,0,0, + 0,0,0}, #if SupportWindows95 0, @@ -437,8 +438,8 @@ MODULEMAPBLOCK Empty_Module_Map = MapType_Default, /* MapType */ -1, /* MapShape */ - 0, 0, 0, /* MapWorld */ - 0, 0, 0, /* MapEuler */ /* Orient */ + {0, 0, 0}, /* MapWorld */ + {0, 0, 0}, /* MapEuler */ /* Orient */ 0 | ObFlag_MultLSrc /* MapFlags */ @@ -461,13 +462,13 @@ MODULEMAPBLOCK Empty_Module_Map = 0, /* Interior Type */ LightType_PerVertex, /* MapLightType */ - 0,0,0, /* MapOrigin */ + {0,0,0}, /* MapOrigin */ 0, /* MapSimShapes */ 0, /* MapViewType */ 0, /* MapMPtr */ 0, /* MapDPtr */ - 0,0,0, /* MapMOffset */ + {0,0,0}, /* MapMOffset */ }; @@ -488,8 +489,8 @@ MODULEMAPBLOCK TempModuleMap = \ MapType_Default, /* MapType */ -1, /* MapShape */ - 0, 0, 0, /* MapWorld */ - 0, 0, 0, /* MapEuler */ /* Orient */ + {0, 0, 0}, /* MapWorld */ + {0, 0, 0}, /* MapEuler */ /* Orient */ 0 /* flags 1*/ | ObFlag_NoInfLSrc @@ -510,12 +511,12 @@ MODULEMAPBLOCK TempModuleMap = \ #else LightType_PerVertex, /* MapLightType */ #endif - 0,0,0, /* MapOrigin */ + {0,0,0}, /* MapOrigin */ 0, /* MapSimShapes */ 0, /* MapViewType */ 0, /* MapMPtr */ 0, /* MapDPtr */ - 0,0,0 /* MapMOffset */ + {0,0,0} /* MapMOffset */ }; diff --git a/src/avp/database.h b/src/avp/database.h index 3a0ea7c..81f82b6 100644 --- a/src/avp/database.h +++ b/src/avp/database.h @@ -69,4 +69,4 @@ extern void DrawDatabaseBackground(void); extern void UpdateDatabaseScreen(void); -extern int DatabaseStateChange(); \ No newline at end of file +extern int DatabaseStateChange(); diff --git a/src/avp/deaths.c b/src/avp/deaths.c index d7e391a..87dee05 100644 --- a/src/avp/deaths.c +++ b/src/avp/deaths.c @@ -1726,7 +1726,9 @@ ATTACK_DATA Alien_Attacks[] = { 0, /* Multiplayer_Code */ 0, /* Unique_Code */ 0, /* wound_flags */ - AMMO_NONE, /* damage_type */ + { + AMMO_NONE /* damage_type */ + }, 0, /* Crouching */ 0, /* Pouncing */ }, @@ -1807,7 +1809,9 @@ ATTACK_DATA Wristblade_Attacks[] = { 0, /* Multiplayer_Code */ 0, /* Unique_Code */ 0, /* wound_flags */ - AMMO_NONE, /* damage_type */ + { + AMMO_NONE /* damage_type */ + }, 0, /* Crouching */ 0, /* Pouncing */ }, @@ -1904,7 +1908,9 @@ ATTACK_DATA PredStaff_Attacks[] = { 0, /* Multiplayer_Code */ 0, /* Unique_Code */ 0, /* wound_flags */ - AMMO_NONE, /* damage_type */ + { + AMMO_NONE /* damage_type */ + }, 0, /* Crouching */ 0, /* Pouncing */ }, diff --git a/src/avp/decal.c b/src/avp/decal.c index 95078ad..07f4678 100644 --- a/src/avp/decal.c +++ b/src/avp/decal.c @@ -1173,4 +1173,4 @@ void Save_Decals() *decal = DecalStorage[i]; } -} \ No newline at end of file +} diff --git a/src/avp/detaillevels.h b/src/avp/detaillevels.h index bd170df..a88afcb 100644 --- a/src/avp/detaillevels.h +++ b/src/avp/detaillevels.h @@ -35,4 +35,4 @@ extern void SetToMinimalDetailLevels(void); extern void SetDetailLevelsFromMenu(void); -#endif \ No newline at end of file +#endif diff --git a/src/avp/equipmnt.c b/src/avp/equipmnt.c index 785a9ba..1e15409 100644 --- a/src/avp/equipmnt.c +++ b/src/avp/equipmnt.c @@ -8235,4 +8235,4 @@ BOOL AreDamageProfilesEqual(DAMAGE_PROFILE* profile1,DAMAGE_PROFILE* profile2) { return FALSE; } -} \ No newline at end of file +} diff --git a/src/avp/gamevars.cpp b/src/avp/gamevars.cpp index 8fcb03a..e3d7e9a 100644 --- a/src/avp/gamevars.cpp +++ b/src/avp/gamevars.cpp @@ -467,4 +467,4 @@ void CreateGameSpecificConsoleVariables(void) } -}; // extern "C" \ No newline at end of file +}; // extern "C" diff --git a/src/avp/hmodel.c b/src/avp/hmodel.c index 26a8b02..efb3721 100644 --- a/src/avp/hmodel.c +++ b/src/avp/hmodel.c @@ -1388,8 +1388,6 @@ void Process_Section(HMODELCONTROLLER *controller,SECTION_DATA *this_section_dat &&(render)) { /* Unreal things don't get plotted, either. */ - extern MATRIXCH IdentityMatrix; - DISPLAYBLOCK dummy_displayblock; SHAPEHEADER *shape_to_use; @@ -2118,8 +2116,6 @@ static void HMTimer_Kernel(HMODELCONTROLLER *controller) { void DoHModel(HMODELCONTROLLER *controller, DISPLAYBLOCK *dptr) { - extern int NormalFrameTime; - GLOBALASSERT(controller); GLOBALASSERT(dptr); @@ -2245,8 +2241,6 @@ void DoHModelTimer_Recursion(HMODELCONTROLLER *controller,SECTION_DATA *this_sec void DoHModelTimer(HMODELCONTROLLER *controller) { - extern int NormalFrameTime; - /* Be VERY careful with this function - it can put the timer and the position computations out of step. Once you've called this, call NO OTHER HMODEL FUNCTIONS on this model until the next frame! */ diff --git a/src/avp/hud.c b/src/avp/hud.c index e395474..238eafa 100644 --- a/src/avp/hud.c +++ b/src/avp/hud.c @@ -2070,7 +2070,6 @@ static void DrawAlienTeeth(void) if (AlienTeethOffset) { - extern int CloakingPhase; int offsetY; DISPLAYBLOCK displayblock; diff --git a/src/avp/huddefs.h b/src/avp/huddefs.h index 16ce4df..bd2b8e0 100644 --- a/src/avp/huddefs.h +++ b/src/avp/huddefs.h @@ -255,4 +255,4 @@ extern void DrawOnScreenMessage(unsigned char *messagePtr); }; /* end of C-Linkage spec */ #endif -#endif /* one-time only guard */ \ No newline at end of file +#endif /* one-time only guard */ diff --git a/src/avp/load_shp.c b/src/avp/load_shp.c index fa2c7c3..503d51b 100644 --- a/src/avp/load_shp.c +++ b/src/avp/load_shp.c @@ -137,4 +137,4 @@ void InitCharacterMSLReferences() int GetMSLPosFromEnum(CHARACTER_SHAPES shape_enum) { return(LoadedShapesInMSL[shape_enum]); -} \ No newline at end of file +} diff --git a/src/avp/ltfx_exp.h b/src/avp/ltfx_exp.h index acf91f4..e679fd9 100644 --- a/src/avp/ltfx_exp.h +++ b/src/avp/ltfx_exp.h @@ -50,4 +50,4 @@ typedef struct #endif -#endif \ No newline at end of file +#endif diff --git a/src/avp/missions.cpp b/src/avp/missions.cpp index afb8a69..c1795cf 100644 --- a/src/avp/missions.cpp +++ b/src/avp/missions.cpp @@ -621,4 +621,4 @@ void MissionObjective :: TestCompleteNext(void) Yes, // OurBool bHidden "LANDING BEACON ACTIVATED. STAND CLEAR AND PREPARE FOR EVAC. ", // ProjChar* pProjCh_TriggeringFeedback, -#endif \ No newline at end of file +#endif diff --git a/src/avp/paintball.c b/src/avp/paintball.c index df2ac75..671f16f 100644 --- a/src/avp/paintball.c +++ b/src/avp/paintball.c @@ -208,4 +208,4 @@ extern void PaintBallMode_Randomise(void) PaintBallMode.CurrentDecalRotation = FastRandom()&4095; -} \ No newline at end of file +} diff --git a/src/avp/paintball.h b/src/avp/paintball.h index 897a9ac..7f90860 100644 --- a/src/avp/paintball.h +++ b/src/avp/paintball.h @@ -31,4 +31,4 @@ extern void PaintBallMode_ChangeSelectedDecalID(int delta); extern void PaintBallMode_ChangeSize(int delta); extern void PaintBallMode_AddDecal(void); -#endif \ No newline at end of file +#endif diff --git a/src/avp/particle.c b/src/avp/particle.c index dc3185b..757b43e 100644 --- a/src/avp/particle.c +++ b/src/avp/particle.c @@ -5290,7 +5290,6 @@ extern void RenderParticlesInMirror(void) while(numOfObjects) { DISPLAYBLOCK *objectPtr = OnScreenBlockList[--numOfObjects]; - STRATEGYBLOCK *sbPtr = objectPtr->ObStrategyBlock; if (!objectPtr->ObShape && objectPtr->SfxPtr) { @@ -5659,4 +5658,4 @@ void Save_PheromoneTrails() *trail = TrailStorage[i]; } -} \ No newline at end of file +} diff --git a/src/avp/pfarlocs.h b/src/avp/pfarlocs.h index 277a5a3..8bf2459 100644 --- a/src/avp/pfarlocs.h +++ b/src/avp/pfarlocs.h @@ -94,4 +94,4 @@ int PointIsInModule(MODULE* thisModule, VECTORCH* thisPoint); } #endif -#endif \ No newline at end of file +#endif diff --git a/src/avp/pheromon.h b/src/avp/pheromon.h index ddbb67f..f79e019 100644 --- a/src/avp/pheromon.h +++ b/src/avp/pheromon.h @@ -28,4 +28,4 @@ int AIModuleAdmitsPheromones(AIMODULE *targetModule); #if SUPER_PHEROMONE_SYSTEM void AddMarinePheromones(AIMODULE *targetModule); void MaintainMarineTargetZone(AIMODULE *targetModule); -#endif \ No newline at end of file +#endif diff --git a/src/avp/pmove.c b/src/avp/pmove.c index bed657a..d5bec6a 100644 --- a/src/avp/pmove.c +++ b/src/avp/pmove.c @@ -1702,7 +1702,6 @@ extern void ThrowAFlare(void) if (NumberOfFlaresActive<4) { - extern VECTORCH CentreOfMuzzleOffset; extern VIEWDESCRIPTORBLOCK *ActiveVDBList[]; VIEWDESCRIPTORBLOCK *VDBPtr = ActiveVDBList[0]; MATRIXCH mat = VDBPtr->VDB_Mat; diff --git a/src/avp/pmove.h b/src/avp/pmove.h index a33ceda..ac4fc00 100644 --- a/src/avp/pmove.h +++ b/src/avp/pmove.h @@ -82,4 +82,4 @@ extern void ExecuteFreeMovement(STRATEGYBLOCK* sbPtr); #endif -#endif \ No newline at end of file +#endif diff --git a/src/avp/pvisible.c b/src/avp/pvisible.c index 5ab434e..a800881 100644 --- a/src/avp/pvisible.c +++ b/src/avp/pvisible.c @@ -73,7 +73,7 @@ MODULEMAPBLOCK VisibilityDefaultObjectMap = { MapType_Default, I_ShapeCube, /* this is a default value */ - 0,0,0, + 0,0,0, 0,0,0, #if StandardStrategyAndCollisions ObFlag_Dynamic|ObFlag_NewtonMovement|ObFlag_MatMul, diff --git a/src/avp/savegame.h b/src/avp/savegame.h index 4a7da5b..3d661c4 100644 --- a/src/avp/savegame.h +++ b/src/avp/savegame.h @@ -96,4 +96,4 @@ extern void SaveGame(); extern void LoadSavedGame(); extern void ResetNumberOfSaves(); -#endif \ No newline at end of file +#endif diff --git a/src/avp/scream.h b/src/avp/scream.h index b6032a8..ea0651e 100644 --- a/src/avp/scream.h +++ b/src/avp/scream.h @@ -74,4 +74,4 @@ void PlayQueenSound(int VoiceType,int SoundCategory,int PitchShift,int* External }; #endif -#endif \ No newline at end of file +#endif diff --git a/src/avp/sfx.c b/src/avp/sfx.c index fdead67..ecccd0f 100644 --- a/src/avp/sfx.c +++ b/src/avp/sfx.c @@ -293,4 +293,4 @@ void HandleObjectOnFire(DISPLAYBLOCK *dispPtr) #endif } -} \ No newline at end of file +} diff --git a/src/avp/sfx.h b/src/avp/sfx.h index 2762901..a238008 100644 --- a/src/avp/sfx.h +++ b/src/avp/sfx.h @@ -48,4 +48,4 @@ extern void DrawSfxObject(struct displayblock *dispPtr); extern void HandleSfxForObject(DISPLAYBLOCK *dispPtr); -#endif \ No newline at end of file +#endif diff --git a/src/avp/stratdef.c b/src/avp/stratdef.c index b7892ff..5cad5fe 100644 --- a/src/avp/stratdef.c +++ b/src/avp/stratdef.c @@ -745,4 +745,4 @@ void GivePlayerCloakAway(void) { playerStatusPtr->cloakPositionGivenAway = 1; playerStatusPtr->cloakPositionGivenAwayTimer = PLAYERCLOAK_POSTIONGIVENAWAYTIME; -} \ No newline at end of file +} diff --git a/src/avp/targeting.c b/src/avp/targeting.c index b01098c..ccced65 100644 --- a/src/avp/targeting.c +++ b/src/avp/targeting.c @@ -1094,4 +1094,4 @@ void GetTargetingPointOfObject(DISPLAYBLOCK *objectPtr, VECTORCH *targetPtr) } } -} \ No newline at end of file +} diff --git a/src/avp/track.c b/src/avp/track.c index 5b1e0b3..e088e06 100644 --- a/src/avp/track.c +++ b/src/avp/track.c @@ -1017,4 +1017,4 @@ void SaveTrackPosition(TRACK_CONTROLLER* tc) if(tc->sound) Save_SoundState(&tc->sound->activ_no); if(tc->end_sound) Save_SoundState(&tc->end_sound->activ_no); -} \ No newline at end of file +} diff --git a/src/avp/track.h b/src/avp/track.h index 25b43b4..6184d7d 100644 --- a/src/avp/track.h +++ b/src/avp/track.h @@ -114,4 +114,4 @@ void SaveTrackPosition(TRACK_CONTROLLER*); } #endif -#endif \ No newline at end of file +#endif diff --git a/src/avp/triggers.c b/src/avp/triggers.c index 86122a4..ff02eaf 100644 --- a/src/avp/triggers.c +++ b/src/avp/triggers.c @@ -189,4 +189,4 @@ BOOL AnythingInMyModule(MODULE* my_mod) } return(0); -} \ No newline at end of file +} diff --git a/src/avp/triggers.h b/src/avp/triggers.h index 783191d..d6b73c6 100644 --- a/src/avp/triggers.h +++ b/src/avp/triggers.h @@ -1,2 +1,2 @@ extern void OperateObjectInLineOfSight(void); -extern BOOL AnythingInMyModule(MODULE* my_mod); \ No newline at end of file +extern BOOL AnythingInMyModule(MODULE* my_mod); diff --git a/src/avp/weapons.c b/src/avp/weapons.c index dadd65f..6ddb8ae 100644 --- a/src/avp/weapons.c +++ b/src/avp/weapons.c @@ -2617,7 +2617,6 @@ void HandleEffectsOfExplosion(STRATEGYBLOCK *objectToIgnorePtr, VECTORCH *centre } /* effect of explosion on object's dynamics */ { - VECTORCH directionOfForce; EULER rotation; int magnitudeOfForce = 5000*damage/dynPtr->Mass; @@ -8503,8 +8502,6 @@ void PlasmaCaster_Recoil(void *playerStatus, PLAYER_WEAPON_DATA *weaponPtr) { #endif if (weaponPtr->StateTimeOutCounter == WEAPONSTATE_INITIALTIMEOUTCOUNT) { - - int multiplyer,a; if (playerStatusPtr->PlasmaCasterChargePlasmaCasterCharge; /* These values computed by hand! */ @@ -11019,7 +11017,6 @@ int PlayerFirePredPistolFlechettes(PLAYER_WEAPON_DATA *weaponPtr) { int PredPistolSecondaryFire(PLAYER_WEAPON_DATA *weaponPtr) { TEMPLATE_WEAPON_DATA *twPtr=&TemplateWeapon[weaponPtr->WeaponIDNumber]; - TEMPLATE_AMMO_DATA *templateAmmoPtr = &TemplateAmmo[twPtr->SecondaryAmmoID]; PLAYER_STATUS *playerStatusPtr= (PLAYER_STATUS *) (Player->ObStrategyBlock->SBdataptr); LOCALASSERT(playerStatusPtr); @@ -11691,9 +11688,6 @@ int FireMarineTwoPistols(PLAYER_WEAPON_DATA *weaponPtr, int secondary) DELTA_CONTROLLER *FireRight; DELTA_CONTROLLER *FireLeft; - EULER judder; - MATRIXCH juddermat; - /* Deduce which pistol can fire, if either? */ FireRight=Get_Delta_Sequence(&PlayersWeaponHModelController,"FireRight"); diff --git a/src/avp/win95/avpreg.hpp b/src/avp/win95/avpreg.hpp index d7f6762..040c7b6 100644 --- a/src/avp/win95/avpreg.hpp +++ b/src/avp/win95/avpreg.hpp @@ -14,4 +14,4 @@ void GetPathFromRegistry(); #ifdef __cplusplus }; #endif -#endif \ No newline at end of file +#endif diff --git a/src/avp/win95/cheat.c b/src/avp/win95/cheat.c index bc427fd..2d1348d 100644 --- a/src/avp/win95/cheat.c +++ b/src/avp/win95/cheat.c @@ -171,4 +171,4 @@ void GiveAllWeaponsCheat(void) } } LoadAllWeapons(playerStatusPtr); -} \ No newline at end of file +} diff --git a/src/avp/win95/chtcodes.cpp b/src/avp/win95/chtcodes.cpp index 28d9b47..d6d22c5 100644 --- a/src/avp/win95/chtcodes.cpp +++ b/src/avp/win95/chtcodes.cpp @@ -359,4 +359,4 @@ void Cheats :: CommitSuicide(void) // Then apply lots of damage: CauseDamageToObject(Player->ObStrategyBlock, &certainDeath, ONE_FIXED,NULL); -} \ No newline at end of file +} diff --git a/src/avp/win95/d3d_render.h b/src/avp/win95/d3d_render.h index 66d89c7..2c6dafb 100644 --- a/src/avp/win95/d3d_render.h +++ b/src/avp/win95/d3d_render.h @@ -29,4 +29,4 @@ extern void D3D_PlayerOnFireOverlay(void); extern void CheckWireFrameMode(int shouldBeOn); extern void InitForceField(void); -#endif \ No newline at end of file +#endif diff --git a/src/avp/win95/dp_func.h b/src/avp/win95/dp_func.h index 259a5f2..8524a86 100644 --- a/src/avp/win95/dp_func.h +++ b/src/avp/win95/dp_func.h @@ -52,4 +52,4 @@ HRESULT DPlaySetPlayerData(DPID pid, LPVOID lpData, DWORD dwSize, DWORD dwFlags) #ifdef __cplusplus } #endif -#endif \ No newline at end of file +#endif diff --git a/src/avp/win95/gadgets/textin.cpp b/src/avp/win95/gadgets/textin.cpp index 4c8eae6..52b29fc 100644 --- a/src/avp/win95/gadgets/textin.cpp +++ b/src/avp/win95/gadgets/textin.cpp @@ -1353,4 +1353,4 @@ ConsoleSymbol* TextInputState :: GetPrvMatchingCompletion(void) const } -#endif \ No newline at end of file +#endif diff --git a/src/avp/win95/gammacontrol.h b/src/avp/win95/gammacontrol.h index e722b72..4acb346 100644 --- a/src/avp/win95/gammacontrol.h +++ b/src/avp/win95/gammacontrol.h @@ -6,4 +6,4 @@ extern void UpdateGammaSettings(void); extern int RequestedGammaSetting; -#endif \ No newline at end of file +#endif diff --git a/src/avp/win95/heap_tem.hpp b/src/avp/win95/heap_tem.hpp index 7bc6701..ca57746 100644 --- a/src/avp/win95/heap_tem.hpp +++ b/src/avp/win95/heap_tem.hpp @@ -552,4 +552,4 @@ public: #define OHIB Ordered_Heap_Iterator_Backward -#endif // !_included_heap_tem_hpp_ \ No newline at end of file +#endif // !_included_heap_tem_hpp_ diff --git a/src/avp/win95/hierplace.cpp b/src/avp/win95/hierplace.cpp index 4131091..06b5490 100644 --- a/src/avp/win95/hierplace.cpp +++ b/src/avp/win95/hierplace.cpp @@ -293,4 +293,3 @@ size_t Placed_Hierarchy_Sequence_Chunk::size_chunk() chunk_size+=4+4*num_extra_data; return chunk_size; } - diff --git a/src/avp/win95/hierplace.hpp b/src/avp/win95/hierplace.hpp index 56eed24..d0d1bed 100644 --- a/src/avp/win95/hierplace.hpp +++ b/src/avp/win95/hierplace.hpp @@ -84,4 +84,4 @@ public: }; -#endif \ No newline at end of file +#endif diff --git a/src/avp/win95/hudgfx.h b/src/avp/win95/hudgfx.h index e5c1229..88f8770 100644 --- a/src/avp/win95/hudgfx.h +++ b/src/avp/win95/hudgfx.h @@ -121,4 +121,4 @@ extern void RestoreAllDDGraphics(void); //extern LPDIRECTDRAW lpDD; //extern LPDIRECTDRAWSURFACE lpDDSBack; -#endif \ No newline at end of file +#endif diff --git a/src/avp/win95/iofocus.cpp b/src/avp/win95/iofocus.cpp index e51aca2..541ac98 100644 --- a/src/avp/win95/iofocus.cpp +++ b/src/avp/win95/iofocus.cpp @@ -73,4 +73,4 @@ void IOFOCUS_Toggle(void) /* Internal function definitions ***********************************/ -}; \ No newline at end of file +}; diff --git a/src/avp/win95/jsndsup.h b/src/avp/win95/jsndsup.h index 73e4a2a..913263e 100644 --- a/src/avp/win95/jsndsup.h +++ b/src/avp/win95/jsndsup.h @@ -33,4 +33,4 @@ LOADED_SOUND const * GetSound (char const * fname); #endif -#endif \ No newline at end of file +#endif diff --git a/src/avp/win95/objsetup.hpp b/src/avp/win95/objsetup.hpp index 3b1e019..e4953cc 100644 --- a/src/avp/win95/objsetup.hpp +++ b/src/avp/win95/objsetup.hpp @@ -19,4 +19,4 @@ void setup_cables (Environment_Data_Chunk * envd); void DealWithExternalObjectStategies (Environment_Data_Chunk * envd); void Create_Xenoborg_Morph_Jobby(Object_Chunk * ob, int AnimationShape, MODULE * mod, MORPHCTRL * mc); void setup_sounds (Environment_Data_Chunk * envd); -#endif \ No newline at end of file +#endif diff --git a/src/avp/win95/pathchnk.hpp b/src/avp/win95/pathchnk.hpp index c3d0164..9c56764 100644 --- a/src/avp/win95/pathchnk.hpp +++ b/src/avp/win95/pathchnk.hpp @@ -39,4 +39,4 @@ class AVP_Path_Chunk : public Chunk }; -#endif \ No newline at end of file +#endif diff --git a/src/avp/win95/progress_bar.cpp b/src/avp/win95/progress_bar.cpp index 7fa447c..68694bb 100644 --- a/src/avp/win95/progress_bar.cpp +++ b/src/avp/win95/progress_bar.cpp @@ -26,6 +26,8 @@ extern void ThisFramesRenderingHasFinished(void); extern int AAFontImageNumber; extern int FadingGameInAfterLoading; extern void RenderBriefingText(int centreY, int brightness); + +extern void InGameFlipBuffers(); }; static int CurrentPosition=0; @@ -179,7 +181,8 @@ void Start_Progress_Bar() #endif ThisFramesRenderingHasFinished(); - FlipBuffers(); +/* FlipBuffers(); */ + InGameFlipBuffers(); } #if 0 /* TODO: disabled for port */ @@ -217,7 +220,8 @@ void Set_Progress_Bar_Position(int pos) #if 0 /* TODO: disabled for port */ if (LoadingBarFull) lpDDSBack->Blt(&LoadingBarFull_DestRect,LoadingBarFull,&LoadingBarFull_SrcRect,DDBLT_WAIT,0); #endif - FlipBuffers(); +/* FlipBuffers(); */ + InGameFlipBuffers(); /* If this is a network game , then check the received network messages from @@ -264,7 +268,7 @@ void Game_Has_Loaded(void) CheckForWindowsMessages(); ReadUserInput(); -// FlipBuffers(); +// InGameFlipBuffers(); ColourFillBackBufferQuad ( @@ -305,7 +309,9 @@ void Game_Has_Loaded(void) ThisFramesRenderingHasFinished(); } - FlipBuffers(); +/* FlipBuffers(); */ + InGameFlipBuffers(); + FrameCounterHandler(); diff --git a/src/avp/win95/progress_bar.h b/src/avp/win95/progress_bar.h index d8c4c82..d17d01d 100644 --- a/src/avp/win95/progress_bar.h +++ b/src/avp/win95/progress_bar.h @@ -25,4 +25,4 @@ void Set_Progress_Bar_Position(int pos); -#endif \ No newline at end of file +#endif diff --git a/src/avp/win95/usr_io.h b/src/avp/win95/usr_io.h index d1d1c85..db25011 100644 --- a/src/avp/win95/usr_io.h +++ b/src/avp/win95/usr_io.h @@ -323,4 +323,4 @@ typedef struct // ...linkage wrapping added by DHM 17/3/98 #endif -#endif \ No newline at end of file +#endif diff --git a/src/frustum.c b/src/frustum.c index a2bc3c1..db60bea 100644 --- a/src/frustum.c +++ b/src/frustum.c @@ -1271,5 +1271,3 @@ int TriangleWithinFrustrum(void) /* yes, we need to draw poly */ return 1; } - - \ No newline at end of file diff --git a/src/kshape.c b/src/kshape.c index 2287b49..124f58a 100644 --- a/src/kshape.c +++ b/src/kshape.c @@ -92,22 +92,14 @@ void SetupShapePipeline(void); void ShapePipeline(SHAPEHEADER *shapePtr); static void GouraudPolygon_Construct(POLYHEADER *polyPtr); -static void GouraudPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr); - -static void TexturedPolygon_Construct(POLYHEADER *polyPtr); -static void TexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr); - static void GouraudTexturedPolygon_Construct(POLYHEADER *polyPtr); static void (*VertexIntensity)(RENDERVERTEX *renderVertexPtr); -static void VertexIntensity_Hierarchical(RENDERVERTEX *renderVertexPtr); -static void VertexIntensity_PreLit(RENDERVERTEX *renderVertexPtr); static void VertexIntensity_Pred_Thermal(RENDERVERTEX *renderVertexPtr); static void VertexIntensity_Pred_SeeAliens(RENDERVERTEX *renderVertexPtr); static void VertexIntensity_Pred_SeePredatorTech(RENDERVERTEX *renderVertexPtr); static void VertexIntensity_ImageIntensifier(RENDERVERTEX *renderVertexPtr); -static void VertexIntensity_Standard(RENDERVERTEX *renderVertexPtr); static void VertexIntensity_Alien_Sense(RENDERVERTEX *renderVertexPtr); static void VertexIntensity_Standard_Opt(RENDERVERTEX *renderVertexPtr); @@ -157,7 +149,7 @@ VECTORCH Global_LightVector={1,}; Global variables and arrays */ -VECTORCH RotatedPts[maxrotpts]={1,}; +VECTORCH RotatedPts[maxrotpts]={{1,}}; int ItemColour=1; @@ -180,9 +172,9 @@ static COLOURINTENSITIES ColourIntensityArray[maxrotpts]; -RENDERPOLYGON RenderPolygon={1,}; -RENDERVERTEX VerticesBuffer[9]={1,}; -static RENDERVERTEX TriangleVerticesBuffer[3]={1,}; +RENDERPOLYGON RenderPolygon; +RENDERVERTEX VerticesBuffer[9]={{1,}}; +static RENDERVERTEX TriangleVerticesBuffer[3]={{1,}}; static int *VertexNumberPtr=(int*)1; @@ -5875,7 +5867,7 @@ void RenderSmokeTest(void) {45300,0+ 1000, 26000+-1000}, }; - extern int CurrentLightAtPlayer; + int i; if (image) a = 255-a; @@ -6501,7 +6493,6 @@ void RenderLightFlare(VECTORCH *positionPtr, unsigned int colour) // int particleSize = particlePtr->Size; z=ONE_FIXED; { - extern int SmartTargetSightX, SmartTargetSightY; extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock; centreX = DIV_FIXED(point.vx,point.vz); centreY = DIV_FIXED(point.vy,point.vz); diff --git a/src/main.c b/src/main.c index 8423794..b2a6d7c 100644 --- a/src/main.c +++ b/src/main.c @@ -1,9 +1,11 @@ #include #include #include +#include #include #include +#include #include "fixer.h" @@ -42,7 +44,29 @@ extern unsigned char KeyboardInput[MAX_NUMBER_OF_INPUT_KEYS]; extern unsigned char GotAnyKey; extern int NormalFrameTime; -static SDL_Surface *surface; +SDL_Surface *surface; + +#if GL_EXT_secondary_color +PFNGLSECONDARYCOLORPOINTEREXTPROC pglSecondaryColorPointerEXT; +#endif + +/* ** */ + +int CheckToken(const char *str, const char *item) +{ + const char *p; + int len = strlen(item); + + p = str; + while ((p = strstr(p, item)) != NULL) { + char x = *(p + len); + if ( (x == 0) || (isspace(x)) ) + return 1; + p += len; + } + + return 0; +} /* ** */ @@ -63,6 +87,7 @@ void ReadJoysticks() unsigned char *GetScreenShot24(int *width, int *height) { unsigned char *buf; +// Uint16 redtable[256], greentable[256], bluetable[256]; if (surface == NULL) { return NULL; @@ -79,7 +104,21 @@ unsigned char *GetScreenShot24(int *width, int *height) *width = surface->w; *height = surface->h; - + +#if 0 + if (SDL_GetGammaRamp(redtable, greentable, bluetable) != -1) { + unsigned char *ptr; + int i; + + ptr = buf; + for (i = 0; i < surface->w*surface->h; i++) { + ptr[i*3+0] = redtable[ptr[i*3+0]]; + ptr[i*3+1] = greentable[ptr[i*3+1]]; + ptr[i*3+2] = bluetable[ptr[i*3+2]]; + ptr += 3; + } + } +#endif return buf; } @@ -109,7 +148,7 @@ int SetSoftVideoMode(int Width, int Height, int Depth) } if ((surface = SDL_SetVideoMode(Width, Height, Depth, SDL_SWSURFACE|SDL_DOUBLEBUF)) == NULL) { - fprintf(stderr, "SDL SetVideoMode failed: %s\n", SDL_GetError()); + fprintf(stderr, "(Software) SDL SetVideoMode failed: %s\n", SDL_GetError()); SDL_Quit(); exit(EXIT_FAILURE); } @@ -149,16 +188,18 @@ int SetSoftVideoMode(int Width, int Height, int Depth) return 0; } + int SetOGLVideoMode(int Width, int Height) { SDL_GrabMode isgrab; int isfull; + char *ext; ScanDrawMode = ScanDrawD3DHardwareRGB; GotMouse = 1; if (surface != NULL) { - isfull = (surface->flags & SDL_FULLSCREEN); + isfull = (surface->flags & SDL_FULLSCREEN) ? 1 : 0; isgrab = SDL_WM_GrabInput(SDL_GRAB_QUERY); SDL_FreeSurface(surface); @@ -166,7 +207,9 @@ int SetOGLVideoMode(int Width, int Height) isfull = 0; isgrab = SDL_GRAB_OFF; } - + +fprintf(stderr, "SDL: isfull = %d, isgrab = %d\n", isfull, isgrab); + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); @@ -174,7 +217,7 @@ int SetOGLVideoMode(int Width, int Height) SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); if ((surface = SDL_SetVideoMode(Width, Height, 0, SDL_OPENGL)) == NULL) { - fprintf(stderr, "SDL SetVideoMode failed: %s\n", SDL_GetError()); + fprintf(stderr, "(OpenGL) SDL SetVideoMode failed: %s\n", SDL_GetError()); SDL_Quit(); exit(EXIT_FAILURE); } @@ -189,13 +232,15 @@ int SetOGLVideoMode(int Width, int Height) // SDL_WM_ToggleFullScreen(surface); // SDL_WM_GrabInput(SDL_GRAB_ON); // SDL_ShowCursor(0); - + +fprintf(stderr, "SDL: before %08X\n", surface->flags); if (isfull && !(surface->flags & SDL_FULLSCREEN)) { +fprintf(stderr, "SDL: doing the fullscreen toggle\n"); SDL_WM_ToggleFullScreen(surface); if (surface->flags & SDL_FULLSCREEN) SDL_ShowCursor(0); } - +fprintf(stderr, "SDL: after %08X\n", surface->flags); if (isgrab == SDL_GRAB_ON) { SDL_WM_GrabInput(SDL_GRAB_ON); } @@ -213,6 +258,7 @@ int SetOGLVideoMode(int Width, int Height) glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); + glDepthMask(GL_TRUE); glDepthRange(0.0, 1.0); glEnable(GL_TEXTURE_2D); @@ -236,6 +282,29 @@ int SetOGLVideoMode(int Width, int Height) ScreenDescriptorBlock.SDB_ClipUp = 0; ScreenDescriptorBlock.SDB_ClipDown = Height; + ext = (char *)glGetString(GL_EXTENSIONS); + + printf("OpenGL Extensions: %s\n", ext); + +#if GL_EXT_secondary_color + pglSecondaryColorPointerEXT = NULL; + + if (CheckToken(ext, "GL_EXT_seconary_color")) { + printf("Found GL_EXT_seconary_color... "); + + pglSecondaryColorPointerEXT = SDL_GL_GetProcAddress("glSecondaryColorPointerEXT"); + if (pglSecondaryColorPointerEXT == NULL) { + printf("but the driver lied...\n"); + } else { + printf("and it's good!\n"); + } + } else { + printf("GL_EXT_seconary_color not found...\n"); + } +#endif + + InitOpenGL(); + return 0; } @@ -631,7 +700,7 @@ void CheckForWindowsMessages() if ((KeyboardInput[KEY_LEFTALT]||KeyboardInput[KEY_RIGHTALT]) && DebouncedKeyboardInput[KEY_CR]) { SDL_GrabMode gm; - +printf("SDL: before %08X (toggle)\n", surface->flags); SDL_WM_ToggleFullScreen(surface); gm = SDL_WM_GrabInput(SDL_GRAB_QUERY); @@ -639,6 +708,7 @@ void CheckForWindowsMessages() SDL_ShowCursor(1); else SDL_ShowCursor(0); +printf("SDL: after %08X (toggle)\n", surface->flags); } if (KeyboardInput[KEY_LEFTCTRL] && DebouncedKeyboardInput[KEY_G]) { @@ -668,7 +738,7 @@ void InGameFlipBuffers() void FlipBuffers() { - SDL_GL_SwapBuffers(); + SDL_Flip(surface); } int ExitWindowsSystem() @@ -715,15 +785,14 @@ int InitSDL() } int main(int argc, char *argv[]) -{ - - +{ InitSDL(); LoadCDTrackList(); SetFastRandom(); +/* WeWantAnIntro(); */ GetPathFromRegistry(); #if 0 { @@ -741,7 +810,8 @@ int main(int argc, char *argv[]) #endif InitGame(); - SetOGLVideoMode(640, 480); + SetSoftVideoMode(640, 480, 16); +// SetOGLVideoMode(640, 480); InitialVideoMode(); @@ -977,7 +1047,8 @@ while(AvP_MainMenus()) ClearMemoryPool(); - SetOGLVideoMode(640, 480); + SetSoftVideoMode(640, 480, 16); +// SetOGLVideoMode(640, 480); } SoundSys_StopAll(); diff --git a/src/menus.c b/src/menus.c index 0be521b..fb588f2 100644 --- a/src/menus.c +++ b/src/menus.c @@ -2,10 +2,14 @@ #include #include +#include + #include "fixer.h" #include "strtab.hpp" +#include "3dc.h" +#include "inline.h" #include "awtexld.h" #include "chnktexi.h" #include "hud_layout.h" @@ -16,21 +20,14 @@ #include "ourasert.h" #include "ffstdio.h" -#include +char AAFontWidths[256]; -/* char AAFontWidths[256]; */ +extern SDL_Surface *surface; +extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock; -extern int AAFontImageNumber; +extern int CloudTable[128][128]; +extern int CloakingPhase; -int PlayMenuBackgroundBink() -{ - fprintf(stderr, "PlayMenuBackgroundBink()\n"); - - glClear(GL_COLOR_BUFFER_BIT); - - return 0; -} - AVPMENUGFX AvPMenuGfxStorage[MAX_NO_OF_AVPMENUGFXS] = { {"Menus\\fractal.rim"}, @@ -94,97 +91,939 @@ AVPMENUGFX AvPMenuGfxStorage[MAX_NO_OF_AVPMENUGFXS] = {"Menus\\bonus.rim"}, // Splash screens - #if MARINE_DEMO +#if MARINE_DEMO {"MarineSplash\\splash00.rim"}, {"MarineSplash\\splash01.rim"}, {"MarineSplash\\splash02.rim"}, {"MarineSplash\\splash03.rim"}, {"MarineSplash\\splash04.rim"}, {"MarineSplash\\splash05.rim"}, - #elif ALIEN_DEMO +#elif ALIEN_DEMO {"AlienSplash\\splash00.rim"}, {"AlienSplash\\splash01.rim"}, {"AlienSplash\\splash02.rim"}, {"AlienSplash\\splash03.rim"}, {"AlienSplash\\splash04.rim"}, {"AlienSplash\\splash05.rim"}, - #else +#else {"PredatorSplash\\splash00.rim"}, {"PredatorSplash\\splash01.rim"}, {"PredatorSplash\\splash02.rim"}, {"PredatorSplash\\splash03.rim"}, {"PredatorSplash\\splash04.rim"}, {"PredatorSplash\\splash05.rim"}, - #endif +#endif }; +int CreateIMGSurface(D3DTexture *tex, unsigned char *buf) +{ + tex->id = 0; + + return 0; +} + +static void DrawAvPMenuGlowyBar(int topleftX, int topleftY, int alpha, int length) +{ + enum AVPMENUGFX_ID menuGfxID = AVPMENUGFX_GLOWY_MIDDLE; + unsigned char *srcPtr; + unsigned short *destPtr; + AVPMENUGFX *gfxPtr; + D3DTexture *image; + + gfxPtr = &AvPMenuGfxStorage[menuGfxID]; + image = gfxPtr->ImagePtr; + srcPtr = image->buf; + + if (ScreenDescriptorBlock.SDB_Width - topleftX < length) { + length = ScreenDescriptorBlock.SDB_Width - topleftX; + } + if (length<0) length = 0; + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + return; /* ... */ + } + } + + if (alpha>ONE_FIXED) { + int x, y; + + for (y=topleftY; yHeight+topleftY; y++) { + destPtr = (unsigned short *)(((unsigned char *)surface->pixels) + y*surface->pitch) + topleftX; + + for (x=0; x>3)<<11) | + ((srcPtr[1]>>2)<<5 ) | + ((srcPtr[2]>>3)); + destPtr++; + } + + srcPtr += image->w * 4; + } + } else { + int x, y; + + for (y=topleftY; yHeight+topleftY; y++) { + destPtr = ((unsigned short *)(((unsigned char *)surface->pixels) + y*surface->pitch)) + topleftX; + + for (x=0; x>8; + destG = (*destPtr & 0x07E0)>>3; + destB = (*destPtr & 0x001F)<<3; + + destR += MUL_FIXED(alpha, srcPtr[0]); + destG += MUL_FIXED(alpha, srcPtr[1]); + destB += MUL_FIXED(alpha, srcPtr[2]); + if (destR > 0x00FF) destR = 0x00FF; + if (destG > 0x00FF) destG = 0x00FF; + if (destB > 0x00FF) destB = 0x00FF; + + *destPtr = ((destR>>3)<<11) | + ((destG>>2)<<5 ) | + ((destB>>3)); + } + + destPtr++; + } + + srcPtr += image->w * 4; + } + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } +} + +static void DrawAvPMenuGlowyBar_Clipped(int topleftX, int topleftY, int alpha, int length, int topY, int bottomY) +{ + enum AVPMENUGFX_ID menuGfxID = AVPMENUGFX_GLOWY_MIDDLE; + unsigned char *srcPtr; + unsigned short *destPtr; + AVPMENUGFX *gfxPtr; + D3DTexture *image; + + gfxPtr = &AvPMenuGfxStorage[menuGfxID]; + image = gfxPtr->ImagePtr; + srcPtr = image->buf; + + if (length<0) length = 0; + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + return; /* ... */ + } + } + + if (alpha>ONE_FIXED) { + int x, y; + + for (y=topleftY; yHeight+topleftY; y++) { + if(y>=topY && y<=bottomY) { + destPtr = (unsigned short *)(((unsigned char *)surface->pixels) + y*surface->pitch) + topleftX; + + for (x=0; x>3)<<11) | + ((srcPtr[1]>>2)<<5 ) | + ((srcPtr[2]>>3)); + destPtr++; + } + } + srcPtr += image->w * 4; + } + } else { + int x, y; + + for (y=topleftY; yHeight+topleftY; y++) { + if(y>=topY && y<=bottomY) { + destPtr = ((unsigned short *)(((unsigned char *)surface->pixels) + y*surface->pitch)) + topleftX; + + for (x=0; x>8; + destG = (*destPtr & 0x07E0)>>3; + destB = (*destPtr & 0x001F)<<3; + + destR += MUL_FIXED(alpha, srcPtr[0]); + destG += MUL_FIXED(alpha, srcPtr[1]); + destB += MUL_FIXED(alpha, srcPtr[2]); + if (destR > 0x00FF) destR = 0x00FF; + if (destG > 0x00FF) destG = 0x00FF; + if (destB > 0x00FF) destB = 0x00FF; + + *destPtr = ((destR>>3)<<11) | + ((destG>>2)<<5 ) | + ((destB>>3)); + } + + destPtr++; + } + } + srcPtr += image->w * 4; + } + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } +} + +typedef struct AVPIndexedFont +{ + AVPMENUGFX info; /* graphic info */ + int swidth; /* width for space */ + int ascii; /* ascii code for initial character */ + int height; /* height per character */ + + int FontWidth[256]; +} AVPIndexedFont; + +AVPIndexedFont IntroFont_Light; + +static void LoadMenuFont() +{ + AVPMENUGFX *gfxPtr; + char buffer[100]; + unsigned int fastFileLength; + void const *pFastFileData; + + IntroFont_Light.height = 33; + IntroFont_Light.swidth = 5; + IntroFont_Light.ascii = 32; + + gfxPtr = &IntroFont_Light.info; + + CL_GetImageFileName(buffer, 100, "Menus\\IntroFont.rim", LIO_RELATIVEPATH); + + pFastFileData = ffreadbuf(buffer, &fastFileLength); + + if (pFastFileData) { + gfxPtr->ImagePtr = AwCreateSurface( + "pxfXY", + pFastFileData, + fastFileLength, + AW_TLF_TRANSP|AW_TLF_CHROMAKEY, + &(gfxPtr->Width), + &(gfxPtr->Height) + ); + } else { + gfxPtr->ImagePtr = AwCreateSurface( + "sfXY", + buffer, + AW_TLF_TRANSP|AW_TLF_CHROMAKEY, + &(gfxPtr->Width), + &(gfxPtr->Height) + ); + } + + GLOBALASSERT(gfxPtr->ImagePtr); + GLOBALASSERT(gfxPtr->Width>0); + GLOBALASSERT(gfxPtr->Height>0); + + gfxPtr->hBackup = 0; + +{ + D3DTexture *image = gfxPtr->ImagePtr; + unsigned char *srcPtr = image->buf; + int c; + + IntroFont_Light.FontWidth[32] = 5; + + for (c=33; c<255; c++) { + int x,y; + int y1 = 1+(c-32)*33; + + IntroFont_Light.FontWidth[c]=31; + + for (x=29; x>0; x--) { + int blank = 1; + + for (y=y1; yw) * 4]; + if (s[2]) { + blank = 0; + break; + } + } + + if (blank) { + IntroFont_Light.FontWidth[c]--; + } else { + break; + } + } + } +} + +} + +static void UnloadMenuFont() +{ + ReleaseDDSurface(IntroFont_Light.info.ImagePtr); + IntroFont_Light.info.ImagePtr = NULL; +} + int LengthOfMenuText(char *textPtr) { - fprintf(stderr, "LengthOfMenuText(%s)\n", textPtr); + int width = 0; - return 0; + while (textPtr && *textPtr) { + width += IntroFont_Light.FontWidth[(unsigned int) *textPtr]; + + textPtr++; + } + return width; } -int RenderMenuText(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format) +int RenderMenuText(char *textPtr, int sx, int sy, int alpha, enum AVPMENUFORMAT_ID format) { - - return Hardware_RenderSmallMenuText(textPtr, x, y, alpha, format); + int width; - fprintf(stderr, "RenderMenuText(%s, %d, %d, %d, %d)\n", textPtr, x, y, alpha, format); + width = LengthOfMenuText(textPtr); + + switch(format) { + default: + GLOBALASSERT("UNKNOWN TEXT FORMAT"==0); + return 0; + case AVPMENUFORMAT_LEFTJUSTIFIED: + break; + case AVPMENUFORMAT_RIGHTJUSTIFIED: + sx -= width; + break; + case AVPMENUFORMAT_CENTREJUSTIFIED: + sx -= width / 2; + break; + } + + LOCALASSERT(x>0); + + if (alpha >BRIGHTNESS_OF_DARKENED_ELEMENT) { + int size = width - 18; + if (size<18) size = 18; + + DrawAvPMenuGfx(AVPMENUGFX_GLOWY_LEFT,sx+18,sy-8,alpha,AVPMENUFORMAT_RIGHTJUSTIFIED); + DrawAvPMenuGlowyBar(sx+18,sy-8,alpha,size-18); + DrawAvPMenuGfx(AVPMENUGFX_GLOWY_RIGHT,sx+size,sy-8,alpha,AVPMENUFORMAT_LEFTJUSTIFIED); + } +{ + unsigned char *srcPtr; + unsigned short *destPtr; + AVPMENUGFX *gfxPtr; + D3DTexture *image; + + gfxPtr = &IntroFont_Light.info; + image = gfxPtr->ImagePtr; + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + return 0; /* ... */ + } + } + + while( *textPtr ) { + char c = *textPtr++; - return 0; + if (c>=' ') { + int topLeftU = 1; + int topLeftV = 1+(c-32)*33; + int x, y; + int width = IntroFont_Light.FontWidth[(unsigned int) c]; + + srcPtr = &image->buf[(topLeftU+topLeftV*image->w)*4]; + + for (y=sy; y<33+sy; y++) { + destPtr = (unsigned short *)(((unsigned char *)surface->pixels)+y*surface->pitch) + sx; + + for (x=width; x>0; x--) { + if (srcPtr[0] || srcPtr[1] || srcPtr[2]) { + unsigned int destR, destG, destB; + + int r = CloudTable[(x+sx+CloakingPhase/64)&127][(y+CloakingPhase/128)&127]; + r = MUL_FIXED(alpha, r); + + destR = (*destPtr & 0xF800)>>8; + destG = (*destPtr & 0x07E0)>>3; + destB = (*destPtr & 0x001F)<<3; + + destR += MUL_FIXED(r, srcPtr[0]); + destG += MUL_FIXED(r, srcPtr[1]); + destB += MUL_FIXED(r, srcPtr[2]); + if (destR > 0x00FF) destR = 0x00FF; + if (destG > 0x00FF) destG = 0x00FF; + if (destB > 0x00FF) destB = 0x00FF; + + *destPtr = ((destR>>3)<<11) | + ((destG>>2)<<5 ) | + ((destB>>3)); + } + srcPtr += 4; + destPtr++; + } + srcPtr += (image->w - width) * 4; + } + sx += width; + } + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } + + return sx; +} + } -int RenderMenuText_Clipped(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int topY, int bottomY) +int RenderMenuText_Clipped(char *textPtr, int sx, int sy, int alpha, enum AVPMENUFORMAT_ID format, int topY, int bottomY) { - return Hardware_RenderSmallMenuText(textPtr, x, y, alpha, format); + int width = LengthOfMenuText(textPtr); - fprintf(stderr, "RenderMenuText_Clipped(%s, %d, %d, %d, %d, %d, %d)\n", textPtr, x, y, alpha, format, topY, bottomY); - - return 0; -} - -int RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format) -{ - - return Hardware_RenderSmallMenuText(textPtr, x, y, alpha, format); - - fprintf(stderr, "RenderSmallMenuText(%s, %d, %d, %d, %d)\n", textPtr, x, y, alpha, format); - - return 0; -} - -int RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue) -{ - - return Hardware_RenderSmallMenuText_Coloured(textPtr, x, y, alpha, format, red, green, blue); - - fprintf(stderr, "RenderSmallMenuText_Coloured(%s, %d, %d, %d, %d, %d, %d, %d)\n", textPtr, x, y, alpha, format, red, green, blue); + switch(format) { + default: + GLOBALASSERT("UNKNOWN TEXT FORMAT"==0); + return 0; + case AVPMENUFORMAT_LEFTJUSTIFIED: + break; + case AVPMENUFORMAT_RIGHTJUSTIFIED: + sx -= width; + break; + case AVPMENUFORMAT_CENTREJUSTIFIED: + sx -= width / 2; + break; + } - return 0; -} - -void RenderKeyConfigRectangle(int alpha) -{ - - void Hardware_RenderKeyConfigRectangle(int alpha); - Hardware_RenderKeyConfigRectangle(alpha); + LOCALASSERT(x>0); - fprintf(stderr, "RenderKeyConfigRectangle(%d)\n", alpha); + if (alpha > BRIGHTNESS_OF_DARKENED_ELEMENT) { + int size = width - 18; + if (size<18) size = 18; + + DrawAvPMenuGfx_Clipped(AVPMENUGFX_GLOWY_LEFT,sx+18,sy-8,alpha,AVPMENUFORMAT_RIGHTJUSTIFIED,topY,bottomY); + DrawAvPMenuGlowyBar_Clipped(sx+18,sy-8,alpha,size-18,topY,bottomY); + DrawAvPMenuGfx_Clipped(AVPMENUGFX_GLOWY_RIGHT,sx+size,sy-8,alpha,AVPMENUFORMAT_LEFTJUSTIFIED,topY,bottomY); + } +{ + unsigned char *srcPtr; + unsigned short *destPtr; + AVPMENUGFX *gfxPtr; + D3DTexture *image; + + gfxPtr = &IntroFont_Light.info; + image = gfxPtr->ImagePtr; + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + return 0; /* ... */ + } + } + + while( *textPtr ) { + char c = *textPtr++; + + if (c>=' ') { + int topLeftU = 1; + int topLeftV = 1+(c-32)*33; + int x, y; + int width = IntroFont_Light.FontWidth[(unsigned int) c]; + + srcPtr = &image->buf[(topLeftU+topLeftV*image->w)*4]; + + for (y=sy; y<33+sy; y++) { + if(y>=topY && y<=bottomY) { + destPtr = (unsigned short *)(((unsigned char *)surface->pixels)+y*surface->pitch) + sx; + + for (x=width; x>0; x--) { + if (srcPtr[0] || srcPtr[1] || srcPtr[2]) { + unsigned int destR, destG, destB; + + int r = CloudTable[(x+sx+CloakingPhase/64)&127][(y+CloakingPhase/128)&127]; + r = MUL_FIXED(alpha, r); + + destR = (*destPtr & 0xF800)>>8; + destG = (*destPtr & 0x07E0)>>3; + destB = (*destPtr & 0x001F)<<3; + + destR += MUL_FIXED(r, srcPtr[0]); + destG += MUL_FIXED(r, srcPtr[1]); + destB += MUL_FIXED(r, srcPtr[2]); + if (destR > 0x00FF) destR = 0x00FF; + if (destG > 0x00FF) destG = 0x00FF; + if (destB > 0x00FF) destB = 0x00FF; + + *destPtr = ((destR>>3)<<11) | + ((destG>>2)<<5 ) | + ((destB>>3)); + } + srcPtr += 4; + destPtr++; + } + srcPtr += (image->w - width) * 4; + } else { + srcPtr += image->w * 4; + } + } + sx += width; + } + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } + + return sx; } -void RenderHighlightRectangle(int x1, int y1, int x2, int y2, int r, int g, int b) +} + +static int RenderSmallFontString(char *textPtr,int sx,int sy,int alpha, int red, int green, int blue) { + unsigned char *srcPtr; + unsigned short *destPtr; + int alphaR = MUL_FIXED(alpha,red); + int alphaG = MUL_FIXED(alpha,green); + int alphaB = MUL_FIXED(alpha,blue); + AVPMENUGFX *gfxPtr; + D3DTexture *image; + + gfxPtr = &AvPMenuGfxStorage[AVPMENUGFX_SMALL_FONT]; + image = gfxPtr->ImagePtr; + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + return 0; /* ... */ + } + } + + while( *textPtr ) { + char c = *textPtr++; - void Hardware_RenderHighlightRectangle(int x1,int y1,int x2,int y2,int r, int g, int b); - Hardware_RenderHighlightRectangle(x1, y1, x2, y2, r, g, b); + if (c>=' ') { + int topLeftU = 1+((c-32)&15)*16; + int topLeftV = 1+((c-32)>>4)*16; + int x, y; + + srcPtr = &image->buf[(topLeftU+topLeftV*image->w)*4]; + + for (y=sy; ypixels)+y*surface->pitch) + sx; + + for (x=0; x>8; + destG = (*destPtr & 0x07E0)>>3; + destB = (*destPtr & 0x001F)<<3; + + destR += MUL_FIXED(alphaR, srcPtr[0]); + destG += MUL_FIXED(alphaG, srcPtr[1]); + destB += MUL_FIXED(alphaB, srcPtr[2]); + if (destR > 0x00FF) destR = 0x00FF; + if (destG > 0x00FF) destG = 0x00FF; + if (destB > 0x00FF) destB = 0x00FF; + + *destPtr = ((destR>>3)<<11) | + ((destG>>2)<<5 ) | + ((destB>>3)); + } + srcPtr += 4; + destPtr++; + } + srcPtr += (image->w - HUD_FONT_WIDTH) * 4; + } + sx += AAFontWidths[(unsigned int) c]; + } + } - fprintf(stderr, "RenderHighlightRectangle(%d, %d, %d, %d, %d, %d, %d)\n", x1, y1, x2, y2, r, g, b); + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } + + return sx; } void RenderSmallFontString_Wrapped(char *textPtr,RECT* area,int alpha,int* output_x,int* output_y) { - fprintf(stderr, "RenderSmallFontString_Wrapped(%s, %p, %d, %p, %p)\n", textPtr, area, alpha, output_x, output_y); + unsigned char *srcPtr; + unsigned short *destPtr; + AVPMENUGFX *gfxPtr; + D3DTexture *image; + int wordWidth; + int sx=area->left; + int sy=area->top; + + gfxPtr = &AvPMenuGfxStorage[AVPMENUGFX_SMALL_FONT]; + image = gfxPtr->ImagePtr; + +/* +Determine area used by text , so we can draw it centrally +*/ +{ + char *textPtr2=textPtr; + while (*textPtr2) { + int widthFromSpaces=0; + int widthFromChars=0; + + while(*textPtr2 && *textPtr2==' ') { + widthFromSpaces+=AAFontWidths[(unsigned int) *textPtr2++]; + } + + while(*textPtr2 && *textPtr2!=' ') { + widthFromChars+=AAFontWidths[(unsigned int) *textPtr2++]; + } + + wordWidth=widthFromSpaces+widthFromChars; + + if(wordWidth> area->right-sx) { + if(wordWidth >area->right-area->left) { + int extraLinesNeeded=0; + + wordWidth-=(area->right-sx); + + sy+=HUD_FONT_HEIGHT; + sx=area->left; + + extraLinesNeeded=wordWidth/(area->right-area->left); + + sy+=HUD_FONT_HEIGHT*extraLinesNeeded; + wordWidth %= (area->right-area->left); + + if(sy+HUD_FONT_HEIGHT> area->bottom) break; + } else { + sy+=HUD_FONT_HEIGHT; + sx=area->left; + + if(sy+HUD_FONT_HEIGHT> area->bottom) break; + + if(wordWidth> area->right-sx) break; + + wordWidth-=widthFromSpaces; + } + } + sx+=wordWidth; + } + + if(sy==area->top) { + sx=area->left+ (area->right-sx)/2; + } else { + sx=area->left; + } + + sy+=HUD_FONT_HEIGHT; + if(sybottom) { + sy=area->top + (area->bottom-sy)/2; + } else { + sy=area->top; + } +} + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + return; /* ... */ + } + } + + while ( *textPtr ) { + char* textPtr2=textPtr; + wordWidth=0; + + while(*textPtr2 && *textPtr2==' ') { + wordWidth+=AAFontWidths[(unsigned int) *textPtr2++]; + } + + while(*textPtr2 && *textPtr2!=' ') { + wordWidth+=AAFontWidths[(unsigned int) *textPtr2++]; + } + + if(wordWidth> area->right-sx) { + if(wordWidth>area->right - area->left) { + /* + word is too long too fit on one line + so we'll just have to allow it to be split + */ + } else { + sy+=HUD_FONT_HEIGHT; + sx=area->left; + + if(sy+HUD_FONT_HEIGHT> area->bottom) break; + + if(wordWidth> area->right-sx) break; + + while(*textPtr && *textPtr==' ') { + *textPtr++; + } + } + } + + while(*textPtr && *textPtr==' ') { + sx+=AAFontWidths[(unsigned int) *textPtr++]; + } + + if(sx>area->right) { + while(sx>area->right) { + sx-=(area->right-area->left); + sy+=HUD_FONT_HEIGHT; + } + + if(sy+HUD_FONT_HEIGHT> area->bottom) break; + } + + while(*textPtr && *textPtr!=' ') { + char c = *textPtr++; + int letterWidth = AAFontWidths[(unsigned int) c]; + + if(sx+letterWidth>area->right) { + sx=area->left; + sy+=HUD_FONT_HEIGHT; + + if(sy+HUD_FONT_HEIGHT> area->bottom) break; + } + + if (c>=' ' || c<='z') { + int topLeftU = 1+((c-32)&15)*16; + int topLeftV = 1+((c-32)>>4)*16; + int x, y; + + srcPtr = &image->buf[(topLeftU+topLeftV*image->w)*4]; + + for (y=sy; ypixels) + y*surface->pitch) + sx; + + for (x=0; x>8; + destG = (*destPtr & 0x07E0)>>3; + destB = (*destPtr & 0x001F)<<3; + + destR += MUL_FIXED(alpha, srcPtr[0]); + destG += MUL_FIXED(alpha, srcPtr[1]); + destB += MUL_FIXED(alpha, srcPtr[2]); + if (destR > 0x00FF) destR = 0x00FF; + if (destG > 0x00FF) destG = 0x00FF; + if (destB > 0x00FF) destB = 0x00FF; + + *destPtr = ((destR>>3)<<11) | + ((destG>>2)<<5 ) | + ((destB>>3)); + } + srcPtr += 4; + destPtr++; + } + srcPtr += (image->w - HUD_FONT_WIDTH) * 4; + } + sx += AAFontWidths[(unsigned int) c]; + } + } + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } + + if(output_x) *output_x=sx; + if(output_y) *output_y=sy; +} + +int RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format) +{ + int length; + char *ptr; + + switch(format) { + default: + GLOBALASSERT("UNKNOWN TEXT FORMAT"==0); + return 0; + case AVPMENUFORMAT_LEFTJUSTIFIED: + break; + case AVPMENUFORMAT_RIGHTJUSTIFIED: + length = 0; + ptr = textPtr; + + while (*ptr) { + length+=AAFontWidths[(unsigned int) *ptr++]; + } + + x -= length; + break; + case AVPMENUFORMAT_CENTREJUSTIFIED: + length = 0; + ptr = textPtr; + + while (*ptr) { + length+=AAFontWidths[(unsigned int) *ptr++]; + } + + x -= length / 2; + break; + } + + LOCALASSERT(x>0); + + return RenderSmallFontString(textPtr,x,y,alpha,ONE_FIXED,ONE_FIXED,ONE_FIXED); +} + +int RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue) +{ + int length; + char *ptr; + + switch(format) { + default: + GLOBALASSERT("UNKNOWN TEXT FORMAT"==0); + return 0; + case AVPMENUFORMAT_LEFTJUSTIFIED: + break; + case AVPMENUFORMAT_RIGHTJUSTIFIED: + length = 0; + ptr = textPtr; + + while (*ptr) { + length+=AAFontWidths[(unsigned int) *ptr++]; + } + + x -= length; + break; + case AVPMENUFORMAT_CENTREJUSTIFIED: + length = 0; + ptr = textPtr; + + while (*ptr) { + length+=AAFontWidths[(unsigned int) *ptr++]; + } + + x -= length / 2; + break; + } + + LOCALASSERT(x>0); + + return RenderSmallFontString(textPtr,x,y,alpha,red,green,blue); +} + +static void CalculateWidthsOfAAFont() +{ + unsigned char *srcPtr; + AVPMENUGFX *gfxPtr; + D3DTexture *image; + int c; + + gfxPtr = &AvPMenuGfxStorage[AVPMENUGFX_SMALL_FONT]; + image = gfxPtr->ImagePtr; + + srcPtr = image->buf; + + AAFontWidths[32]=3; + + for (c=33; c<255; c++) { + int x,y; + int x1 = 1+((c-32)&15)*16; + int y1 = 1+((c-32)>>4)*16; + + AAFontWidths[c]=17; + + for (x=x1+HUD_FONT_WIDTH; x>x1; x--) { + int blank = 1; + + for (y=y1; yw) * 4]; + if (s[2] >= 0x80) { + blank = 0; + break; + } + } + + if (blank) { + AAFontWidths[c]--; + } else { + break; + } + } + } +} + +void RenderKeyConfigRectangle(int alpha) +{ + int x1 = 10; + int x2 = ScreenDescriptorBlock.SDB_Width-10; + int y1 = ScreenDescriptorBlock.SDB_Height/2+25-115; + int y2 = ScreenDescriptorBlock.SDB_Height/2+25-115+250; + int x,y; + unsigned short c, *destPtr; + + c = ((MUL_FIXED(0xFF,alpha)>>3)<<11) | + ((MUL_FIXED(0xFF,alpha)>>2)<<5 ) | + ((MUL_FIXED(0xFF,alpha)>>3)); + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + return; /* ... */ + } + } + + y = y1; + destPtr = (unsigned short *)(((unsigned char *)surface->pixels) + y*surface->pitch) + x1; + for (x=x1; x<=x2; x++) { + *destPtr |= c; + destPtr++; + } + + y = y2; + destPtr = (unsigned short *)(((unsigned char *)surface->pixels) + y*surface->pitch) + x1; + for (x=x1; x<=x2; x++) { + *destPtr |= c; + destPtr++; + } + + for (y=y1+1; ypixels) + y*surface->pitch) + x1; + *destPtr |= c; + } + + for (y=y1+1; ypixels) + y*surface->pitch) + x2; + *destPtr |= c; + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } +} + +void RenderHighlightRectangle(int x1, int y1, int x2, int y2, int r, int g, int b) +{ + int x, y; + unsigned short c; + + c = ((r>>3)<<11) | + ((g>>2)<<5 ) | + ((b>>3)); + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + return; /* ... */ + } + } + + for (y=y1; y<=y2; y++) { + unsigned short *destPtr = (unsigned short *)(((unsigned char *)surface->pixels) + y*surface->pitch) + x1; + + for (x = x1; x <= x2; x++) { + *destPtr |= c; + + destPtr++; + } + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } } void LoadAvPMenuGfx(enum AVPMENUGFX_ID menuGfxID) @@ -198,8 +1037,6 @@ void LoadAvPMenuGfx(enum AVPMENUGFX_ID menuGfxID) gfxPtr = &AvPMenuGfxStorage[menuGfxID]; - /* TODO: make sure this doesn't cause a leak */ - InitialiseTextures(); CL_GetImageFileName(buffer, 100, gfxPtr->FilenamePtr, LIO_RELATIVEPATH); pFastFileData = ffreadbuf(buffer, &fastFileLength); @@ -255,15 +1092,31 @@ void LoadAllAvPMenuGfx() LoadAvPMenuGfx(i); } - AAFontImageNumber = CL_LoadImageOnce("Common\\aa_font.RIM",LIO_D3DTEXTURE|LIO_RELATIVEPATH|LIO_RESTORABLE); + LoadMenuFont(); +{ + unsigned char *srcPtr; + AVPMENUGFX *gfxPtr = &AvPMenuGfxStorage[AVPMENUGFX_CLOUDY]; + D3DTexture *image; - /* - TODO: load Fonts - TODO: Create cloud texture - TODO: Calculate AA font table? - */ + int x, y; - fprintf(stderr, "LoadAllAvPMenuGfx()\n"); + image = gfxPtr->ImagePtr; + srcPtr = image->buf; + + for (y=0; yHeight; y++) { + for (x=0; xWidth; x++) { + + int r = srcPtr[0]; + + r = DIV_FIXED(r, 0xFF); + CloudTable[x][y]=r; + + srcPtr += 4; + } + } +} + + CalculateWidthsOfAAFont(); } void LoadAllSplashScreenGfx() @@ -281,17 +1134,7 @@ void InitialiseMenuGfx() for (i = 0; i < MAX_NO_OF_AVPMENUGFXS; i++) { AvPMenuGfxStorage[i].ImagePtr = NULL; - } - - glEnable(GL_BLEND); -// glBlendFunc(GL_ONE, GL_ONE); - glBlendFunc(GL_SRC_ALPHA, GL_ONE); - - glDisable(GL_DEPTH_TEST); - - glEnable(GL_TEXTURE_2D); - - glClear(GL_COLOR_BUFFER_BIT); + } } void ReleaseAllAvPMenuGfx() @@ -303,31 +1146,357 @@ void ReleaseAllAvPMenuGfx() ReleaseAvPMenuGfx(i); } } - - /* - TODO: Unload fonts - */ - fprintf(stderr, "ReleaseAllAvPMenuGfx()\n"); + + UnloadMenuFont(); } void DrawAvPMenuGfx(enum AVPMENUGFX_ID menuGfxID, int topleftX, int topleftY, int alpha,enum AVPMENUFORMAT_ID format) { - fprintf(stderr, "DrawAvPMenuGfx(%d, %d, %d, %d, %d)\n", menuGfxID, topleftX, topleftY, alpha, format); + AVPMENUGFX *gfxPtr; + D3DTexture *image; + unsigned char *srcPtr; + unsigned short *destPtr; + int length; + + GLOBALASSERT(menuGfxID < MAX_NO_OF_AVPMENUGFXS); + + gfxPtr = &AvPMenuGfxStorage[menuGfxID]; + image = gfxPtr->ImagePtr; + + switch(format) { + default: + GLOBALASSERT("UNKNOWN TEXT FORMAT"==0); + return; + case AVPMENUFORMAT_LEFTJUSTIFIED: + break; + case AVPMENUFORMAT_RIGHTJUSTIFIED: + topleftX -= gfxPtr->Width; + break; + case AVPMENUFORMAT_CENTREJUSTIFIED: + topleftX -= gfxPtr->Width/2; + break; + } + + srcPtr = (unsigned char *)image->buf; + length = gfxPtr->Width; + + if (ScreenDescriptorBlock.SDB_Width - topleftX < length) { + length = ScreenDescriptorBlock.SDB_Width - topleftX; + } + if (length <= 0) return; + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + return; /* ... */ + } + } + + if (alpha > ONE_FIXED) { + int x, y; + + for (y=topleftY; yHeight+topleftY; y++) { + destPtr = ((unsigned short *)(((unsigned char *)surface->pixels) + y*surface->pitch)) + topleftX; + + for (x=0; x>3)<<11) | + ((srcPtr[1]>>2)<<5 ) | + ((srcPtr[2]>>3)); + srcPtr += 4; + destPtr++; + } + + srcPtr += (image->w - length) * 4; + } + } else { + int x, y; + + for (y=topleftY; yHeight+topleftY; y++) { + destPtr = ((unsigned short *)(((unsigned char *)surface->pixels) + y*surface->pitch)) + topleftX; + + for (x=0; x>8; + destG = (*destPtr & 0x07E0)>>3; + destB = (*destPtr & 0x001F)<<3; + + destR += MUL_FIXED(alpha, srcPtr[0]); + destG += MUL_FIXED(alpha, srcPtr[1]); + destB += MUL_FIXED(alpha, srcPtr[2]); + if (destR > 0x00FF) destR = 0x00FF; + if (destG > 0x00FF) destG = 0x00FF; + if (destB > 0x00FF) destB = 0x00FF; + + *destPtr = ((destR>>3)<<11) | + ((destG>>2)<<5 ) | + ((destB>>3)); + } + + srcPtr += 4; + destPtr++; + } + + srcPtr += (image->w - length) * 4; + } + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } } void DrawAvPMenuGfx_CrossFade(enum AVPMENUGFX_ID menuGfxID,enum AVPMENUGFX_ID menuGfxID2,int alpha) { - fprintf(stderr, "DrawAvPMenuGfx_CrossFade(%d, %d, %d)\n", menuGfxID, menuGfxID2, alpha); + AVPMENUGFX *gfxPtr, *gfxPtr2; + D3DTexture *image, *image2; + unsigned char *srcPtr, *srcPtr2; + unsigned short *destPtr; + int length; + + GLOBALASSERT(menuGfxID < MAX_NO_OF_AVPMENUGFXS); + GLOBALASSERT(menuGfxID2 < MAX_NO_OF_AVPMENUGFXS); + + gfxPtr = &AvPMenuGfxStorage[menuGfxID]; + image = gfxPtr->ImagePtr; + gfxPtr2 = &AvPMenuGfxStorage[menuGfxID2]; + image2 = gfxPtr2->ImagePtr; + + srcPtr = image->buf; + srcPtr2 = image2->buf; + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + return; /* ... */ + } + } + + length = 640; + + if (alpha == ONE_FIXED) { + int x, y; + + for (y=0; y<480; y++) { + destPtr = ((unsigned short *)(((unsigned char *)surface->pixels) + y*surface->pitch)); + + for (x=0; x<640; x++) { + *destPtr = ((srcPtr[0]>>3)<<11) | + ((srcPtr[1]>>2)<<5 ) | + ((srcPtr[2]>>3)); + srcPtr += 4; + destPtr++; + } + srcPtr += (image->w - length) * 4; + } + } else { + int x, y; + + for (y=0; y<480; y++) { + destPtr = ((unsigned short *)(((unsigned char *)surface->pixels) + y*surface->pitch)); + + for (x=0; x<640; x++) { + unsigned int srcR1, srcR2; + unsigned int srcG1, srcG2; + unsigned int srcB1, srcB2; + + srcR1 = srcPtr[0]; + srcR2 = srcPtr2[0]; + srcG1 = srcPtr[1]; + srcG2 = srcPtr2[1]; + srcB1 = srcPtr[2]; + srcB2 = srcPtr2[2]; + + srcR2 = MUL_FIXED(ONE_FIXED-alpha,srcR2)+MUL_FIXED(alpha,srcR1); + srcG2 = MUL_FIXED(ONE_FIXED-alpha,srcG2)+MUL_FIXED(alpha,srcG1); + srcB2 = MUL_FIXED(ONE_FIXED-alpha,srcB2)+MUL_FIXED(alpha,srcB1); + + *destPtr = ((srcR2>>3)<<11) | + ((srcG2>>2)<<5 ) | + ((srcB2>>3)); + srcPtr += 4; + srcPtr2 += 4; + destPtr++; + } + } + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } + } void DrawAvPMenuGfx_Faded(enum AVPMENUGFX_ID menuGfxID, int topleftX, int topleftY, int alpha,enum AVPMENUFORMAT_ID format) { - fprintf(stderr, "DrawAvPMenuGfx_Faded(%d, %d, %d, %d, %d)\n", menuGfxID, topleftX, topleftY, alpha, format); + AVPMENUGFX *gfxPtr; + D3DTexture *image; + unsigned char *srcPtr; + unsigned short *destPtr; + int length; + + GLOBALASSERT(menuGfxID < MAX_NO_OF_AVPMENUGFXS); + + gfxPtr = &AvPMenuGfxStorage[menuGfxID]; + image = gfxPtr->ImagePtr; + + switch(format) { + default: + GLOBALASSERT("UNKNOWN TEXT FORMAT"==0); + return; + case AVPMENUFORMAT_LEFTJUSTIFIED: + break; + case AVPMENUFORMAT_RIGHTJUSTIFIED: + topleftX -= gfxPtr->Width; + break; + case AVPMENUFORMAT_CENTREJUSTIFIED: + topleftX -= gfxPtr->Width/2; + break; + } + + srcPtr = (unsigned char *)image->buf; + length = gfxPtr->Width; + + if (ScreenDescriptorBlock.SDB_Width - topleftX < length) { + length = ScreenDescriptorBlock.SDB_Width - topleftX; + } + if (length <= 0) return; + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + return; /* ... */ + } + } + + { + int x, y; + + for (y=topleftY; yHeight+topleftY; y++) { + destPtr = ((unsigned short *)(((unsigned char *)surface->pixels) + y*surface->pitch)) + topleftX; + + for (x=0; x>3)<<11) | + ((srcG>>2)<<5 ) | + ((srcB>>3)); + } + + srcPtr += 4; + destPtr++; + } + + srcPtr += (image->w - length) * 4; + } + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } } void DrawAvPMenuGfx_Clipped(enum AVPMENUGFX_ID menuGfxID, int topleftX, int topleftY, int alpha,enum AVPMENUFORMAT_ID format, int topY, int bottomY) { - fprintf(stderr, "DrawAvPMenuGfx_Clipped(%d, %d, %d, %d, %d, %d, %d)\n", menuGfxID, topleftX, topleftY, alpha, format, topY, bottomY); + AVPMENUGFX *gfxPtr; + D3DTexture *image; + unsigned char *srcPtr; + unsigned short *destPtr; + int length; + + GLOBALASSERT(menuGfxID < MAX_NO_OF_AVPMENUGFXS); + + gfxPtr = &AvPMenuGfxStorage[menuGfxID]; + image = gfxPtr->ImagePtr; + + switch(format) { + default: + GLOBALASSERT("UNKNOWN TEXT FORMAT"==0); + return; + case AVPMENUFORMAT_LEFTJUSTIFIED: + break; + case AVPMENUFORMAT_RIGHTJUSTIFIED: + topleftX -= gfxPtr->Width; + break; + case AVPMENUFORMAT_CENTREJUSTIFIED: + topleftX -= gfxPtr->Width/2; + break; + } + + srcPtr = (unsigned char *)image->buf; + length = gfxPtr->Width; + + if (ScreenDescriptorBlock.SDB_Width - topleftX < length) { + length = ScreenDescriptorBlock.SDB_Width - topleftX; + } + if (length <= 0) return; + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + return; /* ... */ + } + } + + if (alpha > ONE_FIXED) { + int x, y; + + for (y=topleftY; yHeight+topleftY; y++) { + destPtr = ((unsigned short *)(((unsigned char *)surface->pixels) + y*surface->pitch)) + topleftX; + + if(y>=topY && y<=bottomY) { + for (x=0; x>3)<<11) | + ((srcPtr[1]>>2)<<5 ) | + ((srcPtr[2]>>3)); + srcPtr += 4; + destPtr++; + } + srcPtr += (image->w - length) * 4; + } else { + srcPtr += image->w * 4; + } + } + } else { + int x, y; + + for (y=topleftY; yHeight+topleftY; y++) { + destPtr = ((unsigned short *)(((unsigned char *)surface->pixels) + y*surface->pitch)) + topleftX; + + if(y>=topY && y<=bottomY) { + for (x=0; x>8; + destG = (*destPtr & 0x07E0)>>3; + destB = (*destPtr & 0x001F)<<3; + + destR += MUL_FIXED(alpha, srcPtr[0]); + destG += MUL_FIXED(alpha, srcPtr[1]); + destB += MUL_FIXED(alpha, srcPtr[2]); + if (destR > 0x00FF) destR = 0x00FF; + if (destG > 0x00FF) destG = 0x00FF; + if (destB > 0x00FF) destB = 0x00FF; + + *destPtr = ((destR>>3)<<11) | + ((destG>>2)<<5 ) | + ((destB>>3)); + } + srcPtr += 4; + destPtr++; + } + srcPtr += (image->w - length) * 4; + } else { + srcPtr += image->w * 4; + } + } + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } } int HeightOfMenuGfx(enum AVPMENUGFX_ID menuGfxID) @@ -337,12 +1506,60 @@ int HeightOfMenuGfx(enum AVPMENUGFX_ID menuGfxID) void FadedScreen(int alpha) { - fprintf(stderr, "FadedScreen(%d)\n", alpha); + int x, y; + unsigned short *ptr; + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + return; /* ... */ + } + } + + for (y = 60; y < surface->h-60; y++) { + ptr = (unsigned short *)(((unsigned char *)surface->pixels)+y*surface->pitch); + for (x = 0; x < surface->w; x++) { + unsigned int srcR, srcG, srcB; + + srcR = (*ptr & 0xF800) >> 11; + srcG = (*ptr & 0x07E0) >> 5; + srcB = (*ptr & 0x001F); + + srcR = MUL_FIXED(srcR, alpha); + srcG = MUL_FIXED(srcG, alpha); + srcB = MUL_FIXED(srcB, alpha); + *ptr = ((srcR>>3)<<11) | + ((srcG>>2)<<5 ) | + ((srcB>>3)); + ptr++; + } + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } } void ClearScreenToBlack() -{ - fprintf(stderr, "ClearScreenToBlack()\n"); +{ + int x, y; + unsigned short *ptr; + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + return; /* ... */ + } + } + + for (y = 0; y < surface->h; y++) { + ptr = (unsigned short *)(((unsigned char *)surface->pixels)+y*surface->pitch); + for (x = 0; x < surface->w; x++) { + *ptr = 0; + + ptr++; + } + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } } - -#include "aafont.h" diff --git a/src/net.c b/src/net.c index 13809b3..be90dd7 100644 --- a/src/net.c +++ b/src/net.c @@ -21,9 +21,6 @@ int QuickStartMultiplayer=1; DPNAME AVPDPplayerName; int glpDP; /* directplay object */ -static pthread_t NetThread; -static pthread_mutex_t NetMutex; - BOOL DpExtInit(DWORD cGrntdBufs, DWORD cBytesPerBuf, BOOL bErrChcks) { fprintf(stderr, "DpExtInit(%d, %d, %d)\n", cGrntdBufs, cBytesPerBuf, bErrChcks); diff --git a/src/openal.c b/src/openal.c index ee40968..97ca8e2 100644 --- a/src/openal.c +++ b/src/openal.c @@ -381,10 +381,12 @@ int PlatPlaySound(int activeIndex) alSourcei (ActiveSounds[activeIndex].ds3DBufferP, AL_BUFFER, GameSounds[si].dsBufferP); +#if 1 /* PLEASE REMOVE IFDEF! */ if (ActiveSounds[activeIndex].loop) alSourcei (ActiveSounds[activeIndex].ds3DBufferP, AL_LOOPING, AL_TRUE); else alSourcei (ActiveSounds[activeIndex].ds3DBufferP, AL_LOOPING, AL_FALSE); +#endif if (1 || ActiveSounds[activeIndex].pitch != GameSounds[si].pitch) { PlatChangeSoundPitch(activeIndex, ActiveSounds[activeIndex].pitch); @@ -539,12 +541,12 @@ int PlatDo3dSound(int activeIndex) if (ActiveSounds[activeIndex].paused) { if (distance < (ActiveSounds[activeIndex].threedeedata.outer_range + SOUND_DEACTIVATERANGE)) { PlatStopSound (activeIndex); - +#if 1 /* PLEASE REMOVE IFDEF! */ if (ActiveSounds[activeIndex].loop) alSourcei (ActiveSounds[activeIndex].ds3DBufferP, AL_LOOPING, AL_TRUE); else alSourcei (ActiveSounds[activeIndex].ds3DBufferP, AL_LOOPING, AL_FALSE); - +#endif alSourcePlay (ActiveSounds[activeIndex].ds3DBufferP); newVolume = 0; ActiveSounds[activeIndex].paused = 0; @@ -697,8 +699,9 @@ void PlatEndGameSound(SOUNDINDEX index) unsigned int PlatMaxHWSounds() { +/* printf("PlatMaxHWSounds()\n"); - +*/ return 32; } diff --git a/src/opengl.c b/src/opengl.c index f7a1cf7..07626e4 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -54,6 +54,10 @@ static D3DTexture *CurrentlyBoundTexture = NULL; #define TA_MAXVERTICES 2048 #define TA_MAXTRIANGLES 2048 +#if GL_EXT_secondary_color +extern PFNGLSECONDARYCOLORPOINTEREXTPROC pglSecondaryColorPointerEXT; +#endif + typedef struct VertexArray { GLfloat v[4]; @@ -80,8 +84,6 @@ static VertexArray *svarr = &varr[TA_MAXVERTICES], *svarrp = &varr[TA_MAXVERTICE static TriangleArray *starr = &tarr[TA_MAXTRIANGLES], *starrp = &tarr[TA_MAXTRIANGLES]; static int svarrc, starrc; -static int haslocked = 0; - /* Do not call this directly! */ static void SetTranslucencyMode(enum TRANSLUCENCY_TYPE mode) { @@ -90,8 +92,7 @@ static void SetTranslucencyMode(enum TRANSLUCENCY_TYPE mode) if (TRIPTASTIC_CHEATMODE||MOTIONBLUR_CHEATMODE) { glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA); } else { - //glDisable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ZERO); /* this *should* be optimized */ + glBlendFunc(GL_ONE, GL_ZERO); } break; case TRANSLUCENCY_NORMAL: @@ -116,9 +117,6 @@ static void SetTranslucencyMode(enum TRANSLUCENCY_TYPE mode) fprintf(stderr, "RenderPolygon.TranslucencyMode: invalid %d\n", RenderPolygon.TranslucencyMode); return; } - - //if (mode != TRANSLUCENCY_OFF && CurrentTranslucencyMode == TRANSLUCENCY_OFF) - // glEnable(GL_BLEND); } /* @@ -126,25 +124,58 @@ A few things: - Vertices with a specular color are done twice. Might want to try spitting apart the three arrays and using the same vertex array for both passes. +- Fix code for separate color support. */ +void InitOpenGL() +{ + CurrentTranslucencyMode = TRANSLUCENCY_OFF; + glBlendFunc(GL_ONE, GL_ZERO); + + CurrentFilteringMode = FILTERING_BILINEAR_OFF; + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + + CurrentlyBoundTexture = NULL; + glBindTexture(GL_TEXTURE_2D, 0); + + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(4, GL_FLOAT, sizeof(varr[0]), varr[0].v); + + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glTexCoordPointer(2, GL_FLOAT, sizeof(varr[0]), varr[0].t); + + glEnableClientState(GL_COLOR_ARRAY); + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(varr[0]), varr[0].c); + +#if 0 +#if GL_EXT_secondary_color + if (useseparate) { + glEnableClientState(GL_SEPARATE_COLOR_ARRAY_EXT); + pglSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, sizeof(svarr[0]), svarr[0].c); + } else { + glDisableClientState(GL_SEPARATE_COLOR_ARRAY_EXT); + } +#endif +#endif + + tarrc = 0; + tarrp = tarr; + + varrc = 0; + varrp = varr; + + starrc = 0; + starrp = starr; + + svarrc = 0; + svarrp = svarr; +} + static void FlushTriangleBuffers(int backup) { int i; - - if (haslocked == 0) { - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(4, GL_FLOAT, sizeof(varr[0]), varr[0].v); - - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, sizeof(varr[0]), varr[0].t); - - glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(varr[0]), varr[0].c); - - haslocked = 1; - } - + if (tarrc) { #if 1 glBegin(GL_TRIANGLES); @@ -242,6 +273,7 @@ static void CheckBoundTextureIsCorrect(D3DTexture *tex) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); break; default: + break; } tex->filter = CurrentFilteringMode; @@ -267,6 +299,7 @@ static void CheckFilteringModeIsCorrect(enum FILTERING_MODE_ID filter) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); break; default: + break; } CurrentlyBoundTexture->filter = CurrentFilteringMode; @@ -1717,8 +1750,6 @@ if (stringPtr == NULL) return; void RenderString(char *stringPtr, int x, int y, int colour) { -if (stringPtr == NULL) return; - D3D_RenderHUDString(stringPtr,x,y,colour); } @@ -1726,8 +1757,6 @@ void RenderStringCentred(char *stringPtr, int centreX, int y, int colour) { int length = 0; char *ptr = stringPtr; - -if (stringPtr == NULL) return; while(*ptr) { @@ -1741,8 +1770,6 @@ void RenderStringVertically(char *stringPtr, int centreX, int bottomY, int colou struct VertexTag quadVertices[4]; int y = bottomY; -if (stringPtr == NULL) return; - quadVertices[0].X = centreX - (HUD_FONT_HEIGHT/2) - 1; quadVertices[1].X = quadVertices[0].X; quadVertices[2].X = quadVertices[0].X+2+HUD_FONT_HEIGHT*1; @@ -2355,7 +2382,7 @@ void ColourFillBackBuffer(int FillColour) g = ((FillColour >> 8) & 0xFF) / 255.0f; r = ((FillColour >> 16) & 0xFF) / 255.0f; a = ((FillColour >> 24) & 0xFF) / 255.0f; - + glClearColor(r, g, b, a); glClear(GL_COLOR_BUFFER_BIT); diff --git a/src/sphere.h b/src/sphere.h index 0d16717..1475637 100644 --- a/src/sphere.h +++ b/src/sphere.h @@ -37,4 +37,4 @@ typedef struct extern void Generate_Sphere(void); -#endif \ No newline at end of file +#endif diff --git a/src/stubs.c b/src/stubs.c index d1f2097..49f3827 100644 --- a/src/stubs.c +++ b/src/stubs.c @@ -78,14 +78,12 @@ void StartMenuBackgroundBink() fprintf(stderr, "StartMenuBackgroundBink()\n"); } -#if 0 int PlayMenuBackgroundBink() { fprintf(stderr, "PlayMenuBackgroundBink()\n"); return 0; } -#endif void EndMenuBackgroundBink() { @@ -281,7 +279,22 @@ void UnlockSurface() void ReleaseDDSurface(void* DDSurface) { +/* fprintf(stderr, "ReleaseDDSurface(%p)\n", DDSurface); +*/ + D3DTexture *t = (D3DTexture *)DDSurface; + + if (t->id > 0) { + fprintf(stderr, "ReleaseDDSurface(%p) - OpenGL Object (tex = %d, %d, %d)\n", DDSurface, t->id, t->w, t->h); + } else { + if (t->buf) { + free(t->buf); + } else { + fprintf(stderr, "ReleaseDDSurface(%p) - What is This? (tex = %d, %d, %d)\n", DDSurface, t->id, t->w, t->h); + } + } + + free(t); } BOOL ChangeDirectDrawObject() diff --git a/src/win95/animobs.hpp b/src/win95/animobs.hpp index 0cdb9f8..727df47 100644 --- a/src/win95/animobs.hpp +++ b/src/win95/animobs.hpp @@ -283,4 +283,4 @@ public: Object_Animation_Sequence* sequences; }; -#endif \ No newline at end of file +#endif diff --git a/src/win95/aw.h b/src/win95/aw.h index 62c85db..902d9f4 100644 --- a/src/win95/aw.h +++ b/src/win95/aw.h @@ -19,6 +19,8 @@ typedef DIRECTDRAWSURFACE DDSurface; typedef struct DIRECT3DTEXTURE { + unsigned char *buf; + int id; int w; diff --git a/src/win95/awtexld.cpp b/src/win95/awtexld.cpp index 3394374..337e1d0 100644 --- a/src/win95/awtexld.cpp +++ b/src/win95/awtexld.cpp @@ -500,6 +500,7 @@ void AwBackupTexture::ChoosePixelFormat(AwTl::CreateTextureParms const & _parmsR pixelFormat.alphaB = 1; pixelFormat.validB = 1; + pixelFormat.texB = 1; pixelFormat.bitsPerPixel = 32; pixelFormat.redLeftShift = 0; pixelFormat.greenLeftShift = 8; @@ -513,6 +514,7 @@ void AwBackupTexture::ChoosePixelFormat(AwTl::CreateTextureParms const & _parmsR extern "C" { extern int CreateOGLTexture(D3DTexture *, unsigned char *); +extern int CreateIMGSurface(D3DTexture *, unsigned char *); }; AwTl::SurfUnion AwBackupTexture::CreateTexture(AwTl::CreateTextureParms const & _parmsR) @@ -520,8 +522,11 @@ AwTl::SurfUnion AwBackupTexture::CreateTexture(AwTl::CreateTextureParms const & using namespace AwTl; // fprintf(stderr, "AwBackupTexture::CreateTexture(...) This is where we could convert the image to RGB/RGBA, and so on\n"); + + if (_parmsR.originalWidthP) *_parmsR.originalWidthP = m_nWidth; + if (_parmsR.originalHeightP) *_parmsR.originalHeightP = m_nHeight; - D3DTexture *Tex = new D3DTexture; + D3DTexture *Tex = (D3DTexture *)malloc(sizeof(D3DTexture)); unsigned char *buf = (unsigned char *)malloc(m_nWidth * m_nHeight * 4); @@ -571,9 +576,15 @@ AwTl::SurfUnion AwBackupTexture::CreateTexture(AwTl::CreateTextureParms const & /* temp junk */ Tex->w = m_nWidth; Tex->h = m_nHeight; - CreateOGLTexture(Tex, buf); /* this will set the id */ - free(buf); - + if (pixelFormat.texB) { + Tex->buf = NULL; /* not used */ + CreateOGLTexture(Tex, buf); /* this will set the id */ + free(buf); + } else { + Tex->buf = buf; /* hey, I need this! */ + CreateIMGSurface(Tex, buf); + } + return static_cast(Tex); #if 0 @@ -2154,6 +2165,7 @@ DDSurface * AwCreateSurface(char const * _argFormatS, ...) pixelFormat.alphaB = 1; pixelFormat.validB = 1; + pixelFormat.texB = 0; pixelFormat.bitsPerPixel = 32; pixelFormat.redLeftShift = 0; pixelFormat.greenLeftShift = 8; diff --git a/src/win95/awtexld.hpp b/src/win95/awtexld.hpp index 34e287f..e41400c 100644 --- a/src/win95/awtexld.hpp +++ b/src/win95/awtexld.hpp @@ -23,6 +23,7 @@ namespace AwTl { bool palettizedB : 1; bool alphaB : 1; bool validB : 1; + bool texB : 1; unsigned bitsPerPixel; unsigned redLeftShift; diff --git a/src/win95/bmpnames.hpp b/src/win95/bmpnames.hpp index 5616b12..40d7c80 100644 --- a/src/win95/bmpnames.hpp +++ b/src/win95/bmpnames.hpp @@ -724,4 +724,4 @@ private: -#endif \ No newline at end of file +#endif diff --git a/src/win95/chnktype.hpp b/src/win95/chnktype.hpp index 9a3a57d..c35e8d4 100644 --- a/src/win95/chnktype.hpp +++ b/src/win95/chnktype.hpp @@ -393,4 +393,4 @@ struct ChunkAnimSequence int num_verts; ChunkVectorFloat* v_normal_list; }; -#endif \ No newline at end of file +#endif diff --git a/src/win95/cl_init.h b/src/win95/cl_init.h index 79cfba2..a0b35c7 100644 --- a/src/win95/cl_init.h +++ b/src/win95/cl_init.h @@ -20,4 +20,4 @@ void CL_Init_All(void); }; #endif -#endif // !_included_cl_init_h_ \ No newline at end of file +#endif // !_included_cl_init_h_ diff --git a/src/win95/dummyobjectchunk.hpp b/src/win95/dummyobjectchunk.hpp index adb3a93..2655755 100644 --- a/src/win95/dummyobjectchunk.hpp +++ b/src/win95/dummyobjectchunk.hpp @@ -78,4 +78,4 @@ private : }; -#endif \ No newline at end of file +#endif diff --git a/src/win95/enumchnk.hpp b/src/win95/enumchnk.hpp index a29bf16..8b65a05 100644 --- a/src/win95/enumchnk.hpp +++ b/src/win95/enumchnk.hpp @@ -79,4 +79,4 @@ private: -#endif // _included_enumchnk_hpp_ \ No newline at end of file +#endif // _included_enumchnk_hpp_ diff --git a/src/win95/envchunk.hpp b/src/win95/envchunk.hpp index ee4b578..445a700 100644 --- a/src/win95/envchunk.hpp +++ b/src/win95/envchunk.hpp @@ -198,4 +198,4 @@ public : int spare1,spare2; }; -#endif \ No newline at end of file +#endif diff --git a/src/win95/fragchnk.hpp b/src/win95/fragchnk.hpp index 4fc806e..340e054 100644 --- a/src/win95/fragchnk.hpp +++ b/src/win95/fragchnk.hpp @@ -79,4 +79,4 @@ public : -#endif \ No newline at end of file +#endif diff --git a/src/win95/gsprchnk.hpp b/src/win95/gsprchnk.hpp index ede6395..a1ca067 100644 --- a/src/win95/gsprchnk.hpp +++ b/src/win95/gsprchnk.hpp @@ -79,4 +79,4 @@ private: -#endif // _included_gsprchnk_hpp_ \ No newline at end of file +#endif // _included_gsprchnk_hpp_ diff --git a/src/win95/hierchnk.hpp b/src/win95/hierchnk.hpp index 3e2881b..4772196 100644 --- a/src/win95/hierchnk.hpp +++ b/src/win95/hierchnk.hpp @@ -200,4 +200,4 @@ public : ChunkVectorInt min; ChunkVectorInt max; }; -#endif \ No newline at end of file +#endif diff --git a/src/win95/iff.cpp b/src/win95/iff.cpp index a65ffaa..4e176d6 100644 --- a/src/win95/iff.cpp +++ b/src/win95/iff.cpp @@ -821,4 +821,4 @@ namespace IFF { pSub->Release(); } -} // namespace IFF \ No newline at end of file +} // namespace IFF diff --git a/src/win95/ilbm_ext.cpp b/src/win95/ilbm_ext.cpp index 613cdd4..77a2eaa 100644 --- a/src/win95/ilbm_ext.cpp +++ b/src/win95/ilbm_ext.cpp @@ -84,4 +84,4 @@ namespace IFF } } -} \ No newline at end of file +} diff --git a/src/win95/ltchunk.hpp b/src/win95/ltchunk.hpp index 8fee87b..3b7de43 100644 --- a/src/win95/ltchunk.hpp +++ b/src/win95/ltchunk.hpp @@ -270,4 +270,4 @@ public : int spare1,spare2,spare3,spare4; }; -#endif \ No newline at end of file +#endif diff --git a/src/win95/mishchnk.hpp b/src/win95/mishchnk.hpp index 411e49c..237da64 100644 --- a/src/win95/mishchnk.hpp +++ b/src/win95/mishchnk.hpp @@ -248,4 +248,4 @@ private: -#endif \ No newline at end of file +#endif diff --git a/src/win95/obchunk.hpp b/src/win95/obchunk.hpp index b4780b3..29233f8 100644 --- a/src/win95/obchunk.hpp +++ b/src/win95/obchunk.hpp @@ -500,4 +500,4 @@ public : int spare2; }; -#endif \ No newline at end of file +#endif diff --git a/src/win95/oechunk.h b/src/win95/oechunk.h index 40bea19..5dc247c 100644 --- a/src/win95/oechunk.h +++ b/src/win95/oechunk.h @@ -96,4 +96,4 @@ public : //constructor from buffer Strategy_Chunk (Chunk_With_Children * parent,const char* data,size_t); }; -#endif \ No newline at end of file +#endif diff --git a/src/win95/shpchunk.hpp b/src/win95/shpchunk.hpp index accddf7..18f8041 100644 --- a/src/win95/shpchunk.hpp +++ b/src/win95/shpchunk.hpp @@ -1087,4 +1087,4 @@ private: friend class Shape_Sub_Shape_Chunk; }; -#endif \ No newline at end of file +#endif diff --git a/src/win95/sndchunk.cpp b/src/win95/sndchunk.cpp index c0e08d3..7054111 100644 --- a/src/win95/sndchunk.cpp +++ b/src/win95/sndchunk.cpp @@ -348,4 +348,4 @@ size_t Sound_Collection_Chunk::size_chunk() chunk_size=12+12+num_sounds*sizeof(ChunkSoundWeighting); return chunk_size; } -*/ \ No newline at end of file +*/ diff --git a/src/win95/toolchnk.hpp b/src/win95/toolchnk.hpp index f266d72..9dcd789 100644 --- a/src/win95/toolchnk.hpp +++ b/src/win95/toolchnk.hpp @@ -20,4 +20,4 @@ public : }; -#endif \ No newline at end of file +#endif