diff --git a/Makefile b/Makefile index 71511b1..0df858e 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ LDLIBS += -L/usr/X11R6/lib -lX11 -lXext `sdl-config --libs` AFLAGS = -g -Iinclude/ -w+macro-params -w+orphan-labels -w+number-overflow -ROOT = main.c math.asm stubs.c stubs2.cpp winapi.c afont.c frustum.c kshape.c map.c maths.c md5.c mem3dc.c mem3dcpp.cpp module.c morph.c mslhand.c object.c shpanim.c sphere.c tables.c vdb.c version.c +ROOT = main.c math.asm stubs.c stubs2.cpp winapi.c afont.c frustum.c kshape.c map.c maths.c md5.c mem3dc.c mem3dcpp.cpp module.c morph.c object.c shpanim.c sphere.c tables.c vdb.c version.c AVP = ai_sight.c avpview.c bh_agun.c bh_ais.c bh_alien.c bh_binsw.c bh_cable.c bh_corpse.c bh_deathvol.c bh_debri.c bh_dummy.c bh_fan.c bh_far.c bh_fhug.c bh_gener.c bh_ldoor.c bh_lift.c bh_light.c bh_lnksw.c bh_ltfx.c bh_marin.c bh_mission.c bh_near.c bh_pargen.c bh_plachier.c bh_plift.c bh_pred.c bh_queen.c bh_rubberduck.c bh_selfdest.c bh_snds.c bh_spcl.c bh_swdor.c bh_track.c bh_types.c bh_videoscreen.c bh_waypt.c bh_weap.c bh_xeno.c bonusabilities.c cconvars.cpp cdtrackselection.cpp cheatmodes.c comp_map.c comp_shp.c consolelog.cpp davehook.cpp deaths.c decal.c detaillevels.c dynamics.c dynblock.c equipmnt.c equiputl.cpp extents.c game.c game_statistics.c gamecmds.cpp gameflow.c gamevars.cpp hmodel.c hud.c inventry.c language.c lighting.c load_shp.c los.c maps.c mempool.c messagehistory.c missions.cpp movement.c paintball.c particle.c pfarlocs.c pheromon.c player.c pmove.c psnd.c psndproj.c pvisible.c savegame.c scream.cpp secstats.c sfx.c stratdef.c targeting.c track.c triggers.c weapons.c SHAPES = cube.c SUPPORT = consbind.cpp consbtch.cpp coordstr.cpp daemon.cpp r2base.cpp r2pos666.cpp reflist.cpp refobj.cpp scstring.cpp strtab.cpp strutil.c trig666.cpp wrapstr.cpp diff --git a/notes.txt b/notes.txt index af4566f..45557e0 100644 --- a/notes.txt +++ b/notes.txt @@ -13,3 +13,5 @@ Env_List can be removed SCREENDESCRIPTORBLOCK.SDB_DiagonalWidth is unused ======== movement.txt and genparam.txt code is unused +======== +there is some unused junk in comp_shp.c diff --git a/source2.txt b/source2.txt index 132ce16..516e0b6 100644 --- a/source2.txt +++ b/source2.txt @@ -8,7 +8,6 @@ mem3dc.c mem3dcpp.cpp module.c morph.c -mslhand.c object.c shpanim.c sphere.c diff --git a/src/avp/bh_agun.c b/src/avp/bh_agun.c index 87c5562..b0471bc 100644 --- a/src/avp/bh_agun.c +++ b/src/avp/bh_agun.c @@ -17,7 +17,6 @@ #include "comp_shp.h" #include "inventry.h" #include "triggers.h" -#include "mslhand.h" #define UseLocalAssert Yes @@ -1375,8 +1374,6 @@ void AGun_MaintainGun(STRATEGYBLOCK *sbPtr) } agunStatusPointer->roundsFired+=multiple; - multiple; - /* End of volley? */ if (agunStatusPointer->volleyFired==(AGUN_VOLLEYSIZE<volleyFired=0; diff --git a/src/avp/bh_dummy.c b/src/avp/bh_dummy.c index 56ebc71..cf363f6 100644 --- a/src/avp/bh_dummy.c +++ b/src/avp/bh_dummy.c @@ -15,7 +15,6 @@ #include "comp_shp.h" #include "inventry.h" #include "triggers.h" -#include "mslhand.h" #define UseLocalAssert Yes diff --git a/src/avp/bh_ldoor.c b/src/avp/bh_ldoor.c index da1d018..9aa8ada 100644 --- a/src/avp/bh_ldoor.c +++ b/src/avp/bh_ldoor.c @@ -10,7 +10,6 @@ #include "comp_shp.h" #include "inventry.h" #include "triggers.h" -#include "mslhand.h" #include "dynblock.h" #include "dynamics.h" diff --git a/src/avp/bh_lift.c b/src/avp/bh_lift.c index 48b2534..3a2c6e8 100644 --- a/src/avp/bh_lift.c +++ b/src/avp/bh_lift.c @@ -9,7 +9,6 @@ #include "comp_shp.h" #include "inventry.h" #include "triggers.h" -#include "mslhand.h" #include "huddefs.h" #include "dynblock.h" diff --git a/src/avp/bh_plift.c b/src/avp/bh_plift.c index 6354f7f..93cb25d 100644 --- a/src/avp/bh_plift.c +++ b/src/avp/bh_plift.c @@ -8,7 +8,6 @@ #include "gamedef.h" #include "bh_types.h" #include "triggers.h" -#include "mslhand.h" #include "dynblock.h" #include "dynamics.h" #include "showcmds.h" diff --git a/src/avp/bh_swdor.c b/src/avp/bh_swdor.c index 92fe54c..56bdc8a 100644 --- a/src/avp/bh_swdor.c +++ b/src/avp/bh_swdor.c @@ -8,7 +8,6 @@ #include "gamedef.h" #include "bh_types.h" #include "triggers.h" -#include "mslhand.h" #include "psnd.h" #define UseLocalAssert Yes diff --git a/src/avp/bh_types.c b/src/avp/bh_types.c index 0d35df0..f0f2d5a 100644 --- a/src/avp/bh_types.c +++ b/src/avp/bh_types.c @@ -12,7 +12,6 @@ #include "comp_shp.h" #include "inventry.h" #include "triggers.h" -#include "mslhand.h" #include "dynblock.h" #include "dynamics.h" diff --git a/src/avp/comp_shp.c b/src/avp/comp_shp.c index 725af81..3ad4cf9 100644 --- a/src/avp/comp_shp.c +++ b/src/avp/comp_shp.c @@ -5,8 +5,6 @@ #include "gamedef.h" #include "comp_shp.h" -#include "mslhand.h" - #define UseLocalAssert Yes #include "ourasert.h" @@ -68,48 +66,6 @@ SHAPEHEADER ** mainshapelist=0; /* compiled in shapes that do not exist as yet*/ - - -#if 0 -SHAPEHEADER PULSE_header; /*Marine Weapons*/ -SHAPEHEADER AASHOTGUN_header; -SHAPEHEADER CANNISTERGUN_header; -SHAPEHEADER FTHROWER_header; -SHAPEHEADER SMARTGUN_header; -SHAPEHEADER PIG_header; -SHAPEHEADER LATW_header; -SHAPEHEADER PARTICLE_header; -SHAPEHEADER ROCKET_header; - -SHAPEHEADER* MarineCompiledShapes[] = { - &BOB_header, - &BOB_header, - &BOB_header, /*MarinePlayer*/ - &BOB_header, /*PredatorPlayer*/ - &BOB_header, /*AlienPlayer*/ - &BOB_header, /* was &ALIEN_header, but the textures are no longer there. The old alien should be fully purged. << keywords: BUG FIXME OPTIMIZEME OPTIMISEME ERROR MISTAKE HACK >> */ - &BOB_header, - &BOB_header, - &BOB_header, - &BOBCROUCH_header, /* player crouch shape */ - &BOBLIE_header, /* player lying down shape */ - &BOB_header, /* Flamethrower shot - frame 1 */ - &BOB_header, /* Flamethrower shot - frame 2 */ - &BOB_header, - &BOB_header, /*Marine Weapons*/ - &AASHOTGUN_header, - &CANNISTERGUN_header, - &FTHROWER_header, - &SMARTGUN_header, - &PIG_header, - &LATW_header, - &PARTICLE_header, - &ROCKET_header, - &BOB_header, /* alien generator */ -}; -#else -// changed by John to get rid of all compiled in shapes - SHAPEHEADER* MarineCompiledShapes[] = { &CUBE_header, &CUBE_header, @@ -135,7 +91,6 @@ SHAPEHEADER* MarineCompiledShapes[] = { &CUBE_header, &CUBE_header, /* alien generator */ }; -#endif #define STARTOF_PRECOMPILEDSHAPES 0 @@ -176,6 +131,4 @@ int load_precompiled_shapes(void) done = 1; return i; -} - - +} diff --git a/src/avp/comp_shp.h b/src/avp/comp_shp.h index af000d3..7b23a18 100644 --- a/src/avp/comp_shp.h +++ b/src/avp/comp_shp.h @@ -1,20 +1,11 @@ +#ifndef __AVP_COMP_SHP_H__ +#define __AVP_COMP_SHP_H__ extern SHAPEHEADER** mainshapelist; extern int start_of_loaded_shapes; extern SHAPEHEADER CUBE_header; -extern SHAPEHEADER PRISM_header; -extern SHAPEHEADER BOB_header; -extern SHAPEHEADER ALIEN_header; -extern SHAPEHEADER BLOODSPLASH_header; -extern SHAPEHEADER BULLETRICOCHET_header; -extern SHAPEHEADER EXPLOSION_header; -extern SHAPEHEADER BOBCROUCH_header; -extern SHAPEHEADER BOBLIE_header; -extern SHAPEHEADER FLAME1_header; -extern SHAPEHEADER FLAME2_header; -extern SHAPEHEADER LGRENADE_header; typedef enum marineshapesenum { @@ -45,5 +36,6 @@ typedef enum marineshapesenum } MARINE_SHAPES_ENUM; - extern int load_precompiled_shapes(void); + +#endif diff --git a/src/avp/dynamics.c b/src/avp/dynamics.c index b05f067..1cbeb18 100644 --- a/src/avp/dynamics.c +++ b/src/avp/dynamics.c @@ -515,7 +515,6 @@ extern void ObjectDynamics(void) DYNAMICSBLOCK *dynPtr = Player->ObStrategyBlock->DynPtr; MODULE *newModule = (ModuleFromPosition(&(dynPtr->Position), playerPherModule)); - extern unsigned char KeyboardInput[]; if (!newModule) { /* hmm, player isn't in a module */ @@ -1305,11 +1304,6 @@ static void VectorHomingForSurfaceAlign(VECTORCH *currentPtr, VECTORCH *targetPt return; } - - - - - extern void DynamicallyRotateObject(DYNAMICSBLOCK *dynPtr) { extern int NormalFrameTime; @@ -1332,6 +1326,8 @@ extern void DynamicallyRotateObject(DYNAMICSBLOCK *dynPtr) MatrixToEuler(&dynPtr->OrientMat, &dynPtr->OrientEuler); } +static int InterferenceAt(int lambda, DYNAMICSBLOCK *dynPtr); + /* Move an object. At this stage, we have a list of the polygons in the environment with which the object the may collide. */ static int MoveObject(STRATEGYBLOCK *sbPtr) @@ -3482,9 +3478,6 @@ static int AxisToIgnore(VECTORCH *normal) } } - - - static void TestForValidMovement(STRATEGYBLOCK *sbPtr) { #if 1 @@ -5765,6 +5758,8 @@ static int RelocatedDueToFallout(DYNAMICSBLOCK *dynPtr) #endif #endif +static signed int DistanceMovedBeforeParticleHitsPolygon(PARTICLE *particlePtr, struct ColPolyTag *polyPtr, int distanceToMove); + #if 1 /*KJL**************** @@ -6388,7 +6383,6 @@ VECTORCH *GetNearestModuleTeleportPoint(MODULE* thisModulePtr, VECTORCH* positio { VECTORCH p = *positionPtr; int d; - char buffer[100]; p.vx -= thisModulePtr->m_aimodule->m_world.vx + epList->position.vx; p.vy -= thisModulePtr->m_aimodule->m_world.vy + epList->position.vy; @@ -6415,30 +6409,3 @@ VECTORCH *GetNearestModuleTeleportPoint(MODULE* thisModulePtr, VECTORCH* positio return &(thisEp->position); } } - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/avp/smovdata.c b/src/avp/smovdata.c deleted file mode 100644 index e36c811..0000000 --- a/src/avp/smovdata.c +++ /dev/null @@ -1,225 +0,0 @@ -/*------------------- Patrick 15/10/95 ---------------------- - Special Move data file: - Data is hard-coded at the moment. - -----------------------------------------------------------*/ -#include "3dc.h" -#include "module.h" - -#include "stratdef.h" -#include "gamedef.h" - -#include "bh_types.h" -#include "pmove.h" - - -/*------------------- Patrick 23/10/95 ---------------------- - Special Move control data - -----------------------------------------------------------*/ - -/* this special move rolls thro 360 degrees to the left, while firing */ -static SMV_CONTROLPOINT SpecialMoveControlData0[] = -{ - { /* control point 0 */ - {-2000,0,0}, - {0,0,0}, - 0, - SMv_Flag_FirePrimaryWeapon|SMv_Flag_HitTheDeck, - }, - { /* control point 1: rotated thro' 360 */ - {0,0,0}, - {0,0,(-4096*2)}, - ONE_FIXED, - SMv_Flag_HitTheDeck, - }, - - -}; - -/* this special move rolls thro 360 degrees to the right, while firing */ -static SMV_CONTROLPOINT SpecialMoveControlData1[] = -{ - { /* control point 0 */ - {2000,0,0}, - {0,0,0}, - 0, - SMv_Flag_FirePrimaryWeapon|SMv_Flag_HitTheDeck, - }, - { /* control point 1: rotated thro' 360 */ - {0,0,0}, - {0,0,(4096*2)}, - ONE_FIXED, - 0, - }, - -}; - -/* this special move does the shoulder roll */ -static SMV_CONTROLPOINT SpecialMoveControlData2[] = -{ - { /* control point 0 */ - {0,0,3000}, - {0,0,0}, - 0, - SMv_Flag_HitTheDeck, - }, - { /* control point 1 : fall forward*/ - {0,0,0}, - {0,-1024,1024}, - ONE_FIXED/3, - SMv_Flag_HitTheDeck, - }, - { /* control point 2 : pause */ - {0,0,0}, - {0,-1024,1024}, - (ONE_FIXED/3 + ONE_FIXED/6), - SMv_Flag_FirePrimaryWeapon, - }, - { /* control point 3 : whip round*/ - {0,0,0}, - {0,-2048,0}, - (ONE_FIXED/3 + ONE_FIXED/6 + ONE_FIXED/3), - 0, - }, - - - -}; - - -/*------------------- Patrick 23/10/95 ---------------------- - Special move headers - -----------------------------------------------------------*/ - -SMV_HEADER SpecialMoveHeader0 = -{ - SMvType_Marine, - 2, - &SpecialMoveControlData0[0], -}; - -SMV_HEADER SpecialMoveHeader1 = -{ - SMvType_Marine, - 2, - &SpecialMoveControlData1[0], - -}; -SMV_HEADER SpecialMoveHeader2 = -{ - SMvType_Marine, - 4, - &SpecialMoveControlData2[0], -}; - - - - -/*------------------- Patrick 30/10/95 ---------------------- - INPUT COMBINATION SEQUENCE DATA - - The first 2 are for roll left + shoulder roll - (which start with same combo). - -----------------------------------------------------------*/ - -static INPUT_SEQUENCE_NODE InSeq_1G = -{ - (INPUT_BITMASK_LEFT|INPUT_BITMASK_FIRE), - &SpecialMoveHeader0, /* roll left */ - 0, - 0, -}; - -static INPUT_SEQUENCE_NODE InSeq_1F = -{ - (INPUT_BITMASK_BACKWARD|INPUT_BITMASK_FIRE), - &SpecialMoveHeader2, /* shoulder roll */ - 0, - 0, -}; - -static INPUT_SEQUENCE_NODE InSeq_1E = -{ - (INPUT_BITMASK_LEFT|INPUT_BITMASK_FORWARD), - 0, - &InSeq_1G, - 0, -}; - -static INPUT_SEQUENCE_NODE InSeq_1D = -{ - (INPUT_BITMASK_BACKWARD|INPUT_BITMASK_LEFT), - 0, - &InSeq_1F, - 0, -}; - -static INPUT_SEQUENCE_NODE InSeq_1C = -{ - (INPUT_BITMASK_LEFT), - 0, - &InSeq_1D, - 0, -}; - -static INPUT_SEQUENCE_NODE InSeq_1B = -{ - (INPUT_BITMASK_FORWARD), - 0, - &InSeq_1E, - 0, -}; - -static INPUT_SEQUENCE_NODE InSeq_1A = -{ - (INPUT_BITMASK_FORWARD|INPUT_BITMASK_LEFT), - 0, - &InSeq_1B, - &InSeq_1C, -}; - -/*------------------- Patrick 30/10/95 ---------------------- - And the next set are for roll right - -----------------------------------------------------------*/ - -static INPUT_SEQUENCE_NODE InSeq_2D = -{ - (INPUT_BITMASK_RIGHT|INPUT_BITMASK_FIRE), - &SpecialMoveHeader1, /* roll right */ - 0, - 0, -}; - -static INPUT_SEQUENCE_NODE InSeq_2C = -{ - (INPUT_BITMASK_FORWARD|INPUT_BITMASK_RIGHT), - 0, - &InSeq_2D, - 0, -}; - -static INPUT_SEQUENCE_NODE InSeq_2B = -{ - (INPUT_BITMASK_FORWARD), - 0, - &InSeq_2C, - 0, -}; - -static INPUT_SEQUENCE_NODE InSeq_2A = -{ - (INPUT_BITMASK_FORWARD|INPUT_BITMASK_RIGHT), - 0, - &InSeq_2B, - 0, -}; - -/*------------------- Patrick 23/10/95 ---------------------- - And the global array of sequence starters - -----------------------------------------------------------*/ - -INPUT_SEQUENCE_NODE *MarineInputSequences[] = -{ - &InSeq_1A, - &InSeq_2A, - 0, /* terminate list */ -}; \ No newline at end of file diff --git a/src/avp/support/expvar.hpp b/src/avp/support/expvar.hpp index 910a930..6f0d408 100644 --- a/src/avp/support/expvar.hpp +++ b/src/avp/support/expvar.hpp @@ -87,8 +87,7 @@ public: SimpleExportVariable ( T& aT - ) : theT(aT), - ExportVariable() + ) : ExportVariable(), theT(aT) { } @@ -115,12 +114,8 @@ public: T& aT, T minVal_New, T maxVal_New - ) : theT(aT), - BoundedExportVariable - ( - minVal_New, - maxVal_New - ) + ) : BoundedExportVariable(minVal_New, maxVal_New), + theT(aT) { } diff --git a/src/avp/support/rebmenus.hpp b/src/avp/support/rebmenus.hpp index 864719d..d969d35 100644 --- a/src/avp/support/rebmenus.hpp +++ b/src/avp/support/rebmenus.hpp @@ -693,9 +693,9 @@ namespace RebMenus enum Direction theD, enum Alignment theAlignment_New ) : Item(theOnOffApp_New), + NumItems(0), theDir(theD), - theAlignment_Val(theAlignment_New), - NumItems(0) + theAlignment_Val(theAlignment_New) { // what value should SelectedItem have when there aren't any items? } diff --git a/src/avp/support/scstring.hpp b/src/avp/support/scstring.hpp index 257cfdc..0b381dd 100644 --- a/src/avp/support/scstring.hpp +++ b/src/avp/support/scstring.hpp @@ -267,5 +267,3 @@ #endif #endif - - diff --git a/src/avp/win95/ffstdio.cpp b/src/avp/win95/ffstdio.cpp index ffda27e..0262568 100644 --- a/src/avp/win95/ffstdio.cpp +++ b/src/avp/win95/ffstdio.cpp @@ -81,9 +81,9 @@ FFileDesc::FFileDesc(char const * infoline, char const * path) } FFileDesc::FFileDesc(FFileDesc const & ffd) -: dir_name(0) -, file_name(0) -, dname_len(ffd.dname_len) +: dname_len(ffd.dname_len) +, dir_name(0) +, file_name(0) { if (ffd.dir_name) { diff --git a/src/avp/win95/gadgets/consvar.cpp b/src/avp/win95/gadgets/consvar.cpp index 4e0ab84..f229c06 100644 --- a/src/avp/win95/gadgets/consvar.cpp +++ b/src/avp/win95/gadgets/consvar.cpp @@ -342,13 +342,13 @@ ConsoleVariable :: ConsoleVariable ( pProjCh_ToUse ), + MinVal(MinVal_New), + MaxVal(MaxVal_New), pSCString_Description ( new SCString( pProjCh_Description_ToUse ) // constructor for the SCString adds the required reference - ), - MinVal(MinVal_New), - MaxVal(MaxVal_New) + ) { /* PRECONDITION */ { @@ -487,15 +487,15 @@ ConsoleVariable_Simple_Int :: ConsoleVariable_Simple_Int int MinVal_New, int MaxVal_New, OurBool Cheat -) : theValue( Value_ToUse ), - ConsoleVariable +) : ConsoleVariable ( pProjCh_ToUse, pProjCh_Description_ToUse, MinVal_New, MaxVal_New, Cheat - ) + ), + theValue( Value_ToUse ) { /* PRECONDITION */ { @@ -610,15 +610,15 @@ ConsoleVariable_Simple_FixP :: ConsoleVariable_Simple_FixP int MinVal_New, int MaxVal_New, OurBool Cheat -) : theValue( Value_ToUse ), - ConsoleVariable +) : ConsoleVariable ( pProjCh_ToUse, pProjCh_Description_ToUse, MinVal_New, MaxVal_New, Cheat - ) + ), + theValue( Value_ToUse ) { /* PRECONDITION */ { diff --git a/src/avp/win95/npcsetup.cpp b/src/avp/win95/npcsetup.cpp index 8d9a75a..e1b8878 100644 --- a/src/avp/win95/npcsetup.cpp +++ b/src/avp/win95/npcsetup.cpp @@ -117,8 +117,8 @@ List loaded_npcs; LoadedNPC::LoadedNPC(RIF_Child_Chunk const * rcc) : rifname(0) , filename(0) -, npc_rif(INVALID_RIFFHANDLE) , img_group(-1) +, npc_rif(INVALID_RIFFHANDLE) { if (rcc->filename && *rcc->filename) { @@ -147,8 +147,8 @@ LoadedNPC::LoadedNPC(RIF_Child_Chunk const * rcc) LoadedNPC::LoadedNPC(char const * name) : rifname(0) , filename(0) -, npc_rif(INVALID_RIFFHANDLE) , img_group(-1) +, npc_rif(INVALID_RIFFHANDLE) { if (name && *name) { @@ -170,16 +170,16 @@ LoadedNPC::LoadedNPC(char const * name) LoadedNPC::LoadedNPC() : rifname(0) , filename(0) -, npc_rif(INVALID_RIFFHANDLE) , img_group(-1) +, npc_rif(INVALID_RIFFHANDLE) { } LoadedNPC::LoadedNPC(LoadedNPC const & npc2) : rifname(npc2.rifname ? new char[strlen(npc2.rifname)+1] : 0) , filename(npc2.filename ? new char[strlen(npc2.filename)+1] : 0) -, npc_rif(npc2.npc_rif) , img_group(npc2.img_group) +, npc_rif(npc2.npc_rif) { if (rifname) strcpy(rifname,npc2.rifname); if (filename) strcpy(filename,npc2.filename); diff --git a/src/kshape.h b/src/kshape.h index dc38e33..3f74956 100644 --- a/src/kshape.h +++ b/src/kshape.h @@ -30,7 +30,6 @@ typedef struct /* fog component */ unsigned char Fog; - } RENDERVERTEX; @@ -87,7 +86,6 @@ enum LIGHTING_MODEL_ID }; - extern void InitialiseLightIntensityStamps(void); extern int FindHeatSourcesInHModel(DISPLAYBLOCK *dispPtr); @@ -100,7 +98,6 @@ extern void TranslatePointIntoViewspace(VECTORCH *pointPtr); extern void CheckRenderStatesForModule(MODULE *modulePtr); - extern void RenderDecal(DECAL *decalPtr); extern void RenderParticle(PARTICLE *particlePtr); @@ -125,4 +122,4 @@ extern int MirroringActive; extern int MirroringAxis; #endif -#endif \ No newline at end of file +#endif diff --git a/src/maths.c b/src/maths.c index da5e23a..32222a1 100644 --- a/src/maths.c +++ b/src/maths.c @@ -3,39 +3,24 @@ #define UseTimsPinp Yes -#define trip_debugger No - -#if trip_debugger -int testa = 0; -int testb = 100; -int testc = 0; -#endif - - /* externs for commonly used global variables and arrays */ - #if platform_pc - extern int sine[]; - extern int cosine[]; - #endif +extern int sine[]; +extern int cosine[]; - extern short ArcCosTable[]; - extern short ArcSineTable[]; - extern short ArcTanTable[]; +extern short ArcCosTable[]; +extern short ArcSineTable[]; +extern short ArcTanTable[]; - extern LONGLONGCH ll_zero; +extern LONGLONGCH ll_zero; - extern int NormalFrameTime; +extern int NormalFrameTime; -#if PSX -extern unsigned long *scratchp; -#endif - /* Globals @@ -60,36 +45,6 @@ extern unsigned long *scratchp; -#if PSX -inline void ch2psx(MATRIXCH *chm, MATRIX *psxm) -{ - psxm->m[0][0] = chm->mat11 >> 4; - psxm->m[0][1] = chm->mat21 >> 4; - psxm->m[0][2] = chm->mat31 >> 4; - psxm->m[1][0] = chm->mat12 >> 4; - psxm->m[1][1] = chm->mat22 >> 4; - psxm->m[1][2] = chm->mat32 >> 4; - psxm->m[2][0] = chm->mat13 >> 4; - psxm->m[2][1] = chm->mat23 >> 4; - psxm->m[2][2] = chm->mat33 >> 4; -} - -inline void psx2ch(MATRIX *psxm, MATRIXCH *chm) -{ - - chm->mat11 = psxm->m[0][0] << 4; - chm->mat21 = psxm->m[0][1] << 4; - chm->mat31 = psxm->m[0][2] << 4; - chm->mat12 = psxm->m[1][0] << 4; - chm->mat22 = psxm->m[1][1] << 4; - chm->mat32 = psxm->m[1][2] << 4; - chm->mat13 = psxm->m[2][0] << 4; - chm->mat23 = psxm->m[2][1] << 4; - chm->mat33 = psxm->m[2][2] << 4; -} - -#endif - /* One over sin functions - CDF 4/2/98 */ extern int oneoversin[4096]; @@ -302,12 +257,6 @@ int FindShift32(int value, int limit) while(value > limit) { - #if trip_debugger - if(shift > 32) { - testa = testb / testc; - } - #endif - shift++; value >>= 1; diff --git a/src/win95/awtexld.cpp b/src/win95/awtexld.cpp index 0d3ab5b..08067b8 100644 --- a/src/win95/awtexld.cpp +++ b/src/win95/awtexld.cpp @@ -99,8 +99,8 @@ namespace AwTl if (!pUnknown) return 0; pUnknown->AddRef(); return static_cast(pUnknown->Release()); +#endif return 0; -#endif } #endif diff --git a/src/win95/awtexld.hpp b/src/win95/awtexld.hpp index d869511..e39ef39 100644 --- a/src/win95/awtexld.hpp +++ b/src/win95/awtexld.hpp @@ -8,25 +8,6 @@ #define DB_COMMA , #endif -// Nasty hack to touch the classes so MSVC++ doesn't discards them. -#ifdef _MSC_VER - extern class AwTlRegisterLoaderClass_AwBmpLoader_187 rlcAwBmpLoader_187; - - extern class AwTlRegisterLoaderClass_AwIffLoader_428 rlcAwIffLoader_428; - extern class AwTlRegisterLoaderClass_AwIffLoader_429 rlcAwIffLoader_429; - extern class AwTlRegisterLoaderClass_AwIffLoader_430 rlcAwIffLoader_430; - - extern class AwTlRegisterLoaderClass_AwPpmLoader_229 rlcAwPpmLoader_229; - extern class AwTlRegisterLoaderClass_AwPgmLoader_230 rlcAwPgmLoader_230; - extern class AwTlRegisterLoaderClass_AwPbmLoader_231 rlcAwPbmLoader_231; - - extern class RegisterChunkClassIlbmBmhdChunk_4 rccIlbmBmhdChunk_4; - extern class RegisterChunkClassIlbmCmapChunk_5 rccIlbmCmapChunk_5; - extern class RegisterChunkClassIlbmBodyChunk_6 rccIlbmBodyChunk_6; - extern class RegisterChunkClassIlbmGrabChunk_7 rccIlbmGrabChunk_7; - -#endif - namespace AwTl { #define CANT_HAPPEN db_msgf1(("AwCreateTexture(): (Line %u) CAN'T HAPPEN!",__LINE__)); @@ -208,11 +189,6 @@ namespace AwTl { static void Do (PtrUnion _dstRowP, unsigned _dstWidth, SRCTYPE const * _srcRowP, unsigned _srcWidth, Colour const * _paletteP = NULL db_code1(DB_COMMA unsigned _paletteSize = 0)); }; -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4701) -#endif - template void GenericConvertRow::Do (PtrUnion _dstRowP, unsigned _dstWidth, SRCTYPE const * _srcRowP, unsigned _srcWidth, Colour const * _paletteP db_code1(DB_COMMA unsigned _paletteSize)) { @@ -300,10 +276,6 @@ namespace AwTl { } } -#ifdef _MSC_VER -#pragma warning(pop) -#endif - // reference counting support class RefCntObj { diff --git a/src/win95/chnkload.hpp b/src/win95/chnkload.hpp index 19325dc..adf2163 100644 --- a/src/win95/chnkload.hpp +++ b/src/win95/chnkload.hpp @@ -95,9 +95,9 @@ struct _RifHandle : Project_RifHandle _RifHandle() : fc(0) , envd(0) + , palparent(0) , max_index(0) , tex_index_nos(0) - , palparent(0) {} }; diff --git a/src/win95/chunkpal.hpp b/src/win95/chunkpal.hpp index 5a51c6d..8bb3c6e 100644 --- a/src/win95/chunkpal.hpp +++ b/src/win95/chunkpal.hpp @@ -105,8 +105,8 @@ public: , reserved1(0) , reserved2(0) , startpos(0) - , pixel_data(0) , name(0) + , pixel_data(0) {} // copy constructor @@ -754,8 +754,8 @@ class RIF_Child_Chunk; class BMP_Flags { public: - BMP_Flags(void) : filename(0), enum_id(0), version_num(0), flags((BMPN_Flags)0){} - BMP_Flags(const char * const fname) : enum_id(0), version_num(0), flags((BMPN_Flags)0), filename(0) + BMP_Flags(void) : filename(0), flags((BMPN_Flags)0), version_num(0), enum_id(0) {} + BMP_Flags(const char * const fname) : filename(0), flags((BMPN_Flags)0), version_num(0), enum_id(0) { if (fname) { diff --git a/src/win95/d3load.c b/src/win95/d3load.c deleted file mode 100644 index 011106b..0000000 --- a/src/win95/d3load.c +++ /dev/null @@ -1,316 +0,0 @@ -/***************************************************************************/ -/* Loading a PPM file into a surface */ -/***************************************************************************/ -/* - * LoadSurface - * Loads a ppm file into a texture map DD surface of the given format. The - * memory flag specifies DDSCAPS_SYSTEMMEMORY or DDSCAPS_VIDEOMEMORY. - */ -LPDIRECTDRAWSURFACE -D3DAppILoadSurface(LPDIRECTDRAW lpDD, LPCSTR lpName, - LPDDSURFACEDESC lpFormat, DWORD memoryflag) -{ - LPDIRECTDRAWSURFACE lpDDS; - DDSURFACEDESC ddsd, format; - D3DCOLOR colors[256]; - D3DCOLOR c; - DWORD dwWidth, dwHeight; - int i, j; - FILE *fp; - char *lpC; - CHAR buf[100]; - LPDIRECTDRAWPALETTE lpDDPal; - PALETTEENTRY ppe[256]; - int psize; - DWORD pcaps; - int color_count; - BOOL bQuant = FALSE; - HRESULT ddrval; - - /* - * Find the image file and open it - */ - fp = D3DAppIFindFile(lpName, "rb"); - if (fp == NULL) { - D3DAppISetErrorString("Cannot find %s.\n", lpName); - return NULL; - } - /* - * Is it a PPM file? - */ - fgets(buf, sizeof buf, fp); - if (lstrcmp(buf, "P6\n")) { - fclose(fp); - D3DAppISetErrorString("%s is not a PPM file.\n", lpName); - return NULL; - } - /* - * Skip any comments - */ - do { - fgets(buf, sizeof buf, fp); - } while (buf[0] == '#'); - /* - * Read the width and height - */ - sscanf(buf, "%d %d\n", &dwWidth, &dwHeight); - fgets(buf, sizeof buf, fp); /* skip next line */ - /* - * Create a surface of the given format using the dimensions of the PPM - * file. - */ - memcpy(&format, lpFormat, sizeof(DDSURFACEDESC)); - if (format.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) { - bQuant = TRUE; - psize = 256; - pcaps = DDPCAPS_8BIT | DDPCAPS_ALLOW256; - } else if (format.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED4) { - bQuant = TRUE; - psize = 16; - pcaps = DDPCAPS_4BIT; - } - memcpy(&ddsd, &format, sizeof(DDSURFACEDESC)); - ddsd.dwSize = sizeof(DDSURFACEDESC); - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | memoryflag; - ddsd.dwHeight = dwHeight; - ddsd.dwWidth = dwWidth; - - ddrval = lpDD->lpVtbl->CreateSurface(lpDD, &ddsd, &lpDDS, NULL); - if (ddrval != DD_OK) { - D3DAppISetErrorString("CreateSurface for texture failed (loadtex).\n%s", - D3DAppErrorToString(ddrval)); - return NULL; - } - /* - * Lock the surface so it can be filled with the PPM file - */ - memset(&ddsd, 0, sizeof(DDSURFACEDESC)); - ddsd.dwSize = sizeof(DDSURFACEDESC); - ddrval = lpDDS->lpVtbl->Lock(lpDDS, NULL, &ddsd, 0, NULL); - if (ddrval != DD_OK) { - lpDDS->lpVtbl->Release(lpDDS); - D3DAppISetErrorString("Lock failed while loading surface (loadtex).\n%s", - D3DAppErrorToString(ddrval)); - return NULL; - } - /* - * The method of loading depends on the pixel format of the dest surface - */ - if (!bQuant) { - /* - * The texture surface is not palettized - */ - unsigned long* lpLP; - unsigned short* lpSP; - unsigned char* lpCP; - unsigned long m; - int s; - int red_shift, red_scale; - int green_shift, green_scale; - int blue_shift, blue_scale; - /* - * Determine the red, green and blue masks' shift and scale. - */ - for (s = 0, m = format.ddpfPixelFormat.dwRBitMask; !(m & 1); - s++, m >>= 1); - red_shift = s; - red_scale = 255 / (format.ddpfPixelFormat.dwRBitMask >> s); - for (s = 0, m = format.ddpfPixelFormat.dwGBitMask; !(m & 1); - s++, m >>= 1); - green_shift = s; - green_scale = 255 / (format.ddpfPixelFormat.dwGBitMask >> s); - for (s = 0, m = format.ddpfPixelFormat.dwBBitMask; !(m & 1); - s++, m >>= 1); - blue_shift = s; - blue_scale = 255 / (format.ddpfPixelFormat.dwBBitMask >> s); - /* - * Each RGB bit count requires different pointers - */ - switch (format.ddpfPixelFormat.dwRGBBitCount) { - case 32 : - for (j = 0; j < (int)dwHeight; j++) { - /* - * Point to next row in texture surface - */ - lpLP = (unsigned long*)(((char*)ddsd.lpSurface) + - ddsd.lPitch * j); - for (i = 0; i < (int)dwWidth; i++) { - int r, g, b; - /* - * Read each value, scale it and shift it into position - */ - r = getc(fp) / red_scale; - g = getc(fp) / green_scale; - b = getc(fp) / blue_scale; - *lpLP = (r << red_shift) | (g << green_shift) | - (b << blue_shift); - lpLP++; - } - } - break; - case 16 : - for (j = 0; j < (int)dwHeight; j++) { - lpSP = (unsigned short*)(((char*)ddsd.lpSurface) + - ddsd.lPitch * j); - for (i = 0; i < (int)dwWidth; i++) { - int r, g, b; - r = getc(fp) / red_scale; - g = getc(fp) / green_scale; - b = getc(fp) / blue_scale; - *lpSP = (r << red_shift) | (g << green_shift) | - (b << blue_shift); - lpSP++; - } - } - break; - case 8: - for (j = 0; j < (int)dwHeight; j++) { - lpCP = (unsigned char*)(((char*)ddsd.lpSurface) + - ddsd.lPitch * j); - for (i = 0; i < (int)dwWidth; i++) { - int r, g, b; - r = getc(fp) / red_scale; - g = getc(fp) / green_scale; - b = getc(fp) / blue_scale; - *lpCP = (r << red_shift) | (g << green_shift) | - (b << blue_shift); - lpCP++; - } - } - break; - default: - /* - * This wasn't a format I recognize - */ - lpDDS->lpVtbl->Unlock(lpDDS, NULL); - fclose(fp); - lpDDS->lpVtbl->Release(lpDDS); - D3DAppISetErrorString("Unknown pixel format (loadtex)."); - return NULL; - } - /* - * Unlock the texture and return the surface pointer - */ - lpDDS->lpVtbl->Unlock(lpDDS, NULL); - fclose(fp); - return (lpDDS); - } - - /* - * We assume the 8-bit palettized case - */ - color_count = 0; /* number of colors in the texture */ - for (j = 0; j < (int)dwHeight; j++) { - /* - * Point to next row in surface - */ - lpC = ((char*)ddsd.lpSurface) + ddsd.lPitch * j; - for (i = 0; i < (int)dwWidth; i++) { - int r, g, b, k; - /* - * Get the next red, green and blue values and turn them into a - * D3DCOLOR - */ - r = getc(fp); - g = getc(fp); - b = getc(fp); - c = RGB_MAKE(r, g, b); - /* - * Search for this color in a table of colors in this texture - */ - for (k = 0; k < color_count; k++) - if (c == colors[k]) break; - if (k == color_count) { - /* - * This is a new color, so add it to the list - */ - color_count++; - /* - * More than 256 and we fail (8-bit) - */ - if (color_count > psize) { - color_count--; - k = color_count - 1; - //goto burst_colors; - } - colors[k] = c; - } - /* - * Set the "pixel" value on the surface to be the index into the - * color table - */ - if (psize == 16) { - if ((i & 1) == 0) - *lpC = k & 0xf; - else { - *lpC |= (k & 0xf) << 4; - lpC++; - } - } else { - *lpC = (char)k; - lpC++; - } - } - } - /* - * Close the file and unlock the surface - */ - fclose(fp); - lpDDS->lpVtbl->Unlock(lpDDS, NULL); - -//burst_colors: - if (color_count > psize) { - /* - * If there are more than 256 colors, we overran our palette - */ - lpDDS->lpVtbl->Unlock(lpDDS, NULL); - lpDDS->lpVtbl->Release(lpDDS); - D3DAppISetErrorString("Palette burst. (loadtex).\n"); - return (NULL); - } - - /* - * Create a palette with the colors in our color table - */ - memset(ppe, 0, sizeof(PALETTEENTRY) * 256); - for (i = 0; i < color_count; i++) { - ppe[i].peRed = (unsigned char)RGB_GETRED(colors[i]); - ppe[i].peGreen = (unsigned char)RGB_GETGREEN(colors[i]); - ppe[i].peBlue = (unsigned char)RGB_GETBLUE(colors[i]); - } - /* - * Set all remaining entry flags to D3DPAL_RESERVED, which are ignored by - * the renderer. - */ - for (; i < 256; i++) - ppe[i].peFlags = D3DPAL_RESERVED; - /* - * Create the palette with the DDPCAPS_ALLOW256 flag because we want to - * have access to all entries. - */ - ddrval = lpDD->lpVtbl->CreatePalette(lpDD, - DDPCAPS_INITIALIZE | pcaps, - ppe, &lpDDPal, NULL); - if (ddrval != DD_OK) { - lpDDS->lpVtbl->Release(lpDDS); - D3DAppISetErrorString("Create palette failed while loading surface (loadtex).\n%s", - D3DAppErrorToString(ddrval)); - return (NULL); - } - /* - * Finally, bind the palette to the surface - */ - ddrval = lpDDS->lpVtbl->SetPalette(lpDDS, lpDDPal); - if (ddrval != DD_OK) { - lpDDS->lpVtbl->Release(lpDDS); - lpDDPal->lpVtbl->Release(lpDDPal); - D3DAppISetErrorString("SetPalette failed while loading surface (loadtex).\n%s", - D3DAppErrorToString(ddrval)); - return (NULL); - } - - lpDDPal->lpVtbl->Release(lpDDPal); - - return lpDDS; -} diff --git a/src/win95/iff.hpp b/src/win95/iff.hpp index 103ddb0..42de667 100644 --- a/src/win95/iff.hpp +++ b/src/win95/iff.hpp @@ -243,7 +243,7 @@ namespace IFF { public: virtual ~SerialData(); - SerialData() : m_pPrev(NULL), m_pData(new DataBlock) {}; + SerialData() : m_pData(new DataBlock), m_pPrev(NULL) {}; void Clear(); diff --git a/src/win95/ltchunk.hpp b/src/win95/ltchunk.hpp index 2ed6b78..8fee87b 100644 --- a/src/win95/ltchunk.hpp +++ b/src/win95/ltchunk.hpp @@ -161,7 +161,7 @@ class Placed_Object_Light_Chunk : public Chunk { public : Placed_Object_Light_Chunk (Chunk_With_Children * parent, Placed_Object_Light_Data & new_light) - : Chunk (parent, "PLOBJLIT"), light (new_light),num_extra_data(0),extra_data(0) {} + : Chunk (parent, "PLOBJLIT"), light(new_light), extra_data(0), num_extra_data(0) {} Placed_Object_Light_Chunk (Chunk_With_Children * parent, const char *, size_t const); diff --git a/src/win95/media.cpp b/src/win95/media.cpp index c039026..8243217 100644 --- a/src/win95/media.cpp +++ b/src/win95/media.cpp @@ -81,7 +81,7 @@ void const * MediaWinFileMedium::GetReadBuffer(unsigned * pSize, unsigned nDesir DWORD nBytesRead = 0; - if (!ReadFile(m_hFile, m_pBuffer, nDesiredSize, &nBytesRead, NULL)) + if (!ReadFile(m_hFile, m_pBuffer, nDesiredSize, &nBytesRead, 0)) m_fError |= MME_IOERROR; else if (!nBytesRead) m_fError |= MME_EOFMET; @@ -102,7 +102,7 @@ void MediaWinFileMedium::CloseWriteBuffer(unsigned nPosOffset) DWORD nBytesWritten = 0; - if (!WriteFile(m_hFile, m_pBuffer, nPosOffset, &nBytesWritten, NULL)) + if (!WriteFile(m_hFile, m_pBuffer, nPosOffset, &nBytesWritten, 0)) m_fError |= MME_IOERROR; else if (nBytesWritten < nPosOffset) m_fError |= MME_EOFMET; @@ -119,7 +119,7 @@ void MediaWinFileMedium::CloseReadBuffer(unsigned nPosOffset) return; } - if (nPosOffset != m_nReadBufLen && 0xffffffff == SetFilePointer(m_hFile,nPosOffset - m_nReadBufLen,NULL,FILE_CURRENT)) + if (nPosOffset != m_nReadBufLen && 0xffffffff == SetFilePointer(m_hFile,nPosOffset - m_nReadBufLen,0,FILE_CURRENT)) m_fError |= MME_UNAVAIL; m_nReadBufLen = 0; @@ -137,7 +137,7 @@ void MediaWinFileMedium::DoWriteBlock(void const * pData, unsigned nSize) DWORD nBytesWritten = 0; - if (!WriteFile(m_hFile, pData, nSize, &nBytesWritten, NULL)) + if (!WriteFile(m_hFile, pData, nSize, &nBytesWritten, 0)) m_fError |= MME_IOERROR; else if (nBytesWritten < nSize) m_fError |= MME_EOFMET; @@ -153,7 +153,7 @@ void MediaWinFileMedium::DoReadBlock(void * pData, unsigned nSize) DWORD nBytesRead = 0; - if (!ReadFile(m_hFile, pData, nSize, &nBytesRead, NULL)) + if (!ReadFile(m_hFile, pData, nSize, &nBytesRead, 0)) m_fError |= MME_IOERROR; else if (nBytesRead < nSize) m_fError |= MME_EOFMET; @@ -161,7 +161,7 @@ void MediaWinFileMedium::DoReadBlock(void * pData, unsigned nSize) unsigned MediaWinFileMedium::DoGetPos() { - unsigned nFilePos = SetFilePointer(m_hFile,0,NULL,FILE_CURRENT); + unsigned nFilePos = SetFilePointer(m_hFile,0,0,FILE_CURRENT); if (0xffffffff == nFilePos) { @@ -174,7 +174,7 @@ unsigned MediaWinFileMedium::DoGetPos() void MediaWinFileMedium::DoSetPos(unsigned nPos) { - if (0xffffffff == SetFilePointer(m_hFile,nPos,NULL,FILE_BEGIN)) + if (0xffffffff == SetFilePointer(m_hFile,nPos,0,FILE_BEGIN)) m_fError |= MME_UNAVAIL; } diff --git a/src/win95/media.hpp b/src/win95/media.hpp index 533a8b3..337c790 100644 --- a/src/win95/media.hpp +++ b/src/win95/media.hpp @@ -37,11 +37,17 @@ class MediaMedium { protected: // standard constructor - MediaMedium() : m_nRefCnt(1), - m_fError(0), m_nDefBufSize(1024), - m_nWriteBufPos(0), m_nReadBufPos(0), - m_nBufLenUsed(0), m_nBufSize(0), - m_pReadBuffer(NULL), m_pWriteBuffer(NULL) {} + MediaMedium() : + m_fError(0), + m_nDefBufSize(1024), + m_pWriteBuffer(NULL), + m_pReadBuffer(NULL), + m_nReadBufPos(0), + m_nWriteBufPos(0), + m_nBufSize(0), + m_nBufLenUsed(0), + m_nRefCnt(1) + {} virtual ~MediaMedium() {} @@ -413,10 +419,10 @@ class MediaWinFileMedium : public MediaMedium pszFileName, dwDesiredAccess, dwShareMode, - NULL, + 0, dwCreationDistribution, FILE_ATTRIBUTE_NORMAL, - NULL + 0 ); if (INVALID_HANDLE_VALUE == m_hFile) m_fError |= MME_OPENFAIL; diff --git a/src/win95/mishchnk.cpp b/src/win95/mishchnk.cpp index b463028..f455f07 100644 --- a/src/win95/mishchnk.cpp +++ b/src/win95/mishchnk.cpp @@ -388,7 +388,7 @@ File_Chunk::File_Chunk(const char * file_name) return; } - file_size = GetFileSize (rif_file, NULL); + file_size = GetFileSize (rif_file, 0); if (!ReadFile(rif_file, id_buffer, 8, &bytes_read, 0)) { @@ -1482,7 +1482,7 @@ void File_Chunk::list_objects(List * pList) if (children) while (child_ptr != NULL) { - if (strncmp ("RBOBJECT", child_ptr->identifier, 8) == NULL) + if (strncmp ("RBOBJECT", child_ptr->identifier, 8) == 0) { assert (!child_ptr->r_u_miscellaneous()); pList->add_entry((Object_Chunk *)child_ptr); @@ -1501,7 +1501,7 @@ void File_Chunk::list_shapes(List * pList) if (children) while (child_ptr != NULL) { - if (strncmp ("REBSHAPE", child_ptr->identifier, 8) == NULL) + if (strncmp ("REBSHAPE", child_ptr->identifier, 8) == 0) { assert (!child_ptr->r_u_miscellaneous()); pList->add_entry((Shape_Chunk *)child_ptr); @@ -1519,7 +1519,7 @@ void File_Chunk::list_dummy_objects(List * pList){ if (children) while (child_ptr != NULL) { - if (strncmp ("DUMMYOBJ", child_ptr->identifier, 8) == NULL) + if (strncmp ("DUMMYOBJ", child_ptr->identifier, 8) == 0) { assert (!child_ptr->r_u_miscellaneous()); pList->add_entry((Dummy_Object_Chunk *)child_ptr); @@ -1536,7 +1536,7 @@ Environment_Data_Chunk * File_Chunk::get_env_data() if (children) while (child_ptr != NULL) { - if (strncmp ("REBENVDT", child_ptr->identifier, 8) == NULL) + if (strncmp ("REBENVDT", child_ptr->identifier, 8) == 0) { assert (!child_ptr->r_u_miscellaneous()); e_list.add_entry((Environment_Data_Chunk *)child_ptr); @@ -1776,7 +1776,7 @@ RIF_File_Chunk::RIF_File_Chunk (Chunk_With_Children * parent, const char * file_ return; } - file_size = GetFileSize (rif_file, NULL); + file_size = GetFileSize (rif_file, 0); if (!ReadFile(rif_file, id_buffer, 8, &bytes_read, 0)) { error_code = CHUNK_FAILED_ON_LOAD; @@ -1943,7 +1943,7 @@ void RIF_File_Chunk::list_objects(List * pList) if (children) while (child_ptr != NULL) { - if (strncmp ("RBOBJECT", child_ptr->identifier, 8) == NULL) + if (strncmp ("RBOBJECT", child_ptr->identifier, 8) == 0) { assert (!child_ptr->r_u_miscellaneous()); pList->add_entry((Object_Chunk *)child_ptr); @@ -1961,7 +1961,7 @@ void RIF_File_Chunk::list_shapes(List * pList) if (children) while (child_ptr != NULL) { - if (strncmp ("REBSHAPE", child_ptr->identifier, 8) == NULL) + if (strncmp ("REBSHAPE", child_ptr->identifier, 8) == 0) { assert (!child_ptr->r_u_miscellaneous()); pList->add_entry((Shape_Chunk *)child_ptr); @@ -1978,7 +1978,7 @@ Environment_Data_Chunk * RIF_File_Chunk::get_env_data() if (children) while (child_ptr != NULL) { - if (strncmp ("REBENVDT", child_ptr->identifier, 8) == NULL) + if (strncmp ("REBENVDT", child_ptr->identifier, 8) == 0) { assert (!child_ptr->r_u_miscellaneous()); e_list.add_entry((Environment_Data_Chunk *)child_ptr); diff --git a/src/win95/mishchnk.hpp b/src/win95/mishchnk.hpp index 957398e..411e49c 100644 --- a/src/win95/mishchnk.hpp +++ b/src/win95/mishchnk.hpp @@ -39,8 +39,9 @@ public: Lockable_Chunk_With_Children (Chunk_With_Children * parent, const char * identifier) : Chunk_With_Children (parent, identifier), - updated (FALSE),updated_outside (FALSE),local_lock (FALSE),external_lock(FALSE), - output_chunk_for_process (FALSE), deleted (FALSE) + output_chunk_for_process(FALSE), + updated(FALSE), updated_outside(FALSE), local_lock(FALSE), + external_lock(FALSE), deleted(FALSE) {} diff --git a/src/win95/shpchunk.hpp b/src/win95/shpchunk.hpp index 1529d19..accddf7 100644 --- a/src/win95/shpchunk.hpp +++ b/src/win95/shpchunk.hpp @@ -9,11 +9,11 @@ // shape flags #define SHAPE_FLAG_PALETTISED 0x0000100 -#define SHAPE_FLAG_USEZSP 0x0000200 -#define SHAPE_FLAG_USEAUGZS 0x0000400 +#define SHAPE_FLAG_USEZSP 0x0000200 +#define SHAPE_FLAG_USEAUGZS 0x0000400 #define SHAPE_FLAG_USEAUGZSL 0x0000800 -#define SHAPE_FLAG_EXTERNALFILE 0x0001000 -#define SHAPE_FLAG_RECENTRED 0x0002000 +#define SHAPE_FLAG_EXTERNALFILE 0x0001000 +#define SHAPE_FLAG_RECENTRED 0x0002000 #define SHAPE_FLAG_UNSTABLEBOUND_ZPOS 0x00004000 @@ -23,7 +23,6 @@ #define SHAPE_FLAG_UNSTABLEBOUND_XPOS 0x00040000 #define SHAPE_FLAG_UNSTABLEBOUND_XNEG 0x00080000 -#define SHAPE_FLAG_PSX_SUBDIVIDE 0x80000000 //flags that need to be removed before being copied into the shapeheaders #define ChunkInternalItemFlags 0x00000000 @@ -34,11 +33,6 @@ class Anim_Shape_Frame_Chunk; class Console_Shape_Chunk; // flags structure -struct shape_flags -{ - unsigned int locked : 1; -// add more flags here as they are needed -}; enum Console_Type { @@ -224,8 +218,8 @@ private: // constructor from data Shape_Sub_Shape_Header_Chunk (Shape_Sub_Shape_Chunk * parent) : Chunk (parent, "SUBSHPHD"), - shape_data (parent->shape_data_store), - flags (0), file_id_num (-1) + shape_data(parent->shape_data_store), + file_id_num(-1), flags(0) {} }; @@ -621,8 +615,8 @@ private: // constructor from data Shape_Header_Chunk (Shape_Chunk * parent) : Chunk (parent, "SHPHEAD1"), - shape_data (parent->shape_data_store), - flags (0), file_id_num (-1), version_no (0) + shape_data(parent->shape_data_store), + flags(0), version_no(0), file_id_num(-1) {} }; @@ -887,8 +881,9 @@ public: // constructor from wherever Shape_Morphing_Frame_Data_Chunk (Shape_Morphing_Data_Chunk * parent) - : Chunk (parent, "FRMMORPH"), frame_store (0), num_frames(0) + : Chunk (parent, "FRMMORPH"), num_frames(0), frame_store(0) {} + // constructor from buffer Shape_Morphing_Frame_Data_Chunk (Shape_Morphing_Data_Chunk * parent,const char *, size_t); @@ -925,7 +920,7 @@ class Shape_Poly_Change_Info_Chunk : public Chunk public: Shape_Poly_Change_Info_Chunk (Shape_Chunk * parent, List & pci, int orig_num_v) - : Chunk (parent, "SHPPCINF"), change_list (pci), original_num_verts (orig_num_v) + : Chunk (parent, "SHPPCINF"), original_num_verts (orig_num_v), change_list (pci) {} int original_num_verts; diff --git a/src/win95/sprchunk.cpp b/src/win95/sprchunk.cpp index 4f718d2..2b78f40 100644 --- a/src/win95/sprchunk.cpp +++ b/src/win95/sprchunk.cpp @@ -204,7 +204,7 @@ Sprite_Header_Chunk::Sprite_Header_Chunk(const char * file_name, Chunk_With_Chil return; } - file_size = GetFileSize (rif_file, NULL); + file_size = GetFileSize (rif_file, 0); if (!ReadFile(rif_file, id_buffer, 8, &bytes_read, 0)) { diff --git a/src/win95/zbuffer.c b/src/win95/zbuffer.c deleted file mode 100644 index b33ea85..0000000 --- a/src/win95/zbuffer.c +++ /dev/null @@ -1,91 +0,0 @@ -/***************************************************************************/ -/* Creation of Z-Buffer */ -/***************************************************************************/ -/* - * D3DAppICreateZBuffer - * Create a Z-Buffer of the appropriate depth and attach it to the back - * buffer. - */ -BOOL -D3DAppICreateZBuffer(int w, int h, int driver) -{ - DDSURFACEDESC ddsd; - DWORD devDepth; - /* - * Release any Z-Buffer that might be around just in case. - */ - RELEASE(d3dappi.lpZBuffer); - - /* - * If this driver does not do z-buffering, don't create a z-buffer - */ - if (!d3dappi.Driver[driver].bDoesZBuffer) - return TRUE; - - memset(&ddsd, 0 ,sizeof(DDSURFACEDESC)); - ddsd.dwSize = sizeof( ddsd ); - ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | - DDSD_ZBUFFERBITDEPTH; - ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; - ddsd.dwHeight = h; - ddsd.dwWidth = w; - /* - * If this is a hardware D3D driver, the Z-Buffer MUST end up in video - * memory. Otherwise, it MUST end up in system memory. - */ - if (d3dappi.Driver[driver].bIsHardware) - ddsd.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY; - else - ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; - /* - * Get the Z buffer bit depth from this driver's D3D device description - */ - devDepth = d3dappi.Driver[driver].Desc.dwDeviceZBufferBitDepth; - if (devDepth & DDBD_32) - ddsd.dwZBufferBitDepth = 32; - else if (devDepth & DDBD_24) - ddsd.dwZBufferBitDepth = 24; - else if (devDepth & DDBD_16) - ddsd.dwZBufferBitDepth = 16; - else if (devDepth & DDBD_8) - ddsd.dwZBufferBitDepth = 8; - else { - D3DAppISetErrorString("Unsupported Z-buffer depth requested by device.\n"); - return FALSE; - } - LastError = d3dappi.lpDD->lpVtbl->CreateSurface(d3dappi.lpDD, &ddsd, - &d3dappi.lpZBuffer, - NULL); - if(LastError != DD_OK) { - D3DAppISetErrorString("CreateSurface for Z-buffer failed.\n%s", - D3DAppErrorToString(LastError)); - goto exit_with_error; - } - /* - * Attach the Z-buffer to the back buffer so D3D will find it - */ - LastError = - d3dappi.lpBackBuffer->lpVtbl->AddAttachedSurface(d3dappi.lpBackBuffer, - d3dappi.lpZBuffer); - if(LastError != DD_OK) { - D3DAppISetErrorString("AddAttachedBuffer failed for Z-Buffer.\n%s", - D3DAppErrorToString(LastError)); - goto exit_with_error; - } - /* - * Find out if it ended up in video memory (FYI). - */ - LastError = D3DAppIGetSurfDesc(&ddsd, d3dappi.lpZBuffer); - if (LastError != DD_OK) { - D3DAppISetErrorString("Failed to get surface description of Z buffer.\n%s", - D3DAppErrorToString(LastError)); - goto exit_with_error; - } - d3dappi.bZBufferInVideo = - (ddsd.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ? TRUE : FALSE; - return TRUE; - -exit_with_error: - RELEASE(d3dappi.lpZBuffer); - return FALSE; -} diff --git a/unused.txt b/unused.txt index e3b4ea0..de94cac 100644 --- a/unused.txt +++ b/unused.txt @@ -1,3 +1,5 @@ +mslhand.c +mslhand.h avp/avpitems.cpp avp/avppages.cpp avp/bh_paq.c @@ -11,11 +13,6 @@ avp/support/rebmenus.cpp avp/win95/menuplat.cpp avp/win95/multmenu.c avp/win95/pcpause.c -include/3dc.h -include/mem3dc.h -include/module.h -include/prototyp.h -include/shape.h win95/chnkimag.cpp win95/chnkimag.hpp win95/cl_init.cpp