Changeset 533

Show
Ignore:
Timestamp:
07/03/12 21:18:53 (11 months ago)
Author:
sirlemonhead
Message:

- added LogDebugString() to replace calls to OutputDebugString()

Location:
branches/workbranch/trunk
Files:
21 modified

Legend:

Unmodified
Added
Removed
  • branches/workbranch/trunk/3dc/RimLoader.cpp

    r527 r533  
    5656bool RimLoader::Decode(uint8_t *dest, uint32_t destPitch) 
    5757{ 
    58         if (!dest) 
     58        if (!dest) { 
    5959                return false; 
     60        } 
    6061 
    6162        this->dest = dest; 
     
    261262 
    262263/* 
    263         after parsing and uncompacting if necessary, you will have N planes of pixel data.  Color register used for  
    264         each pixel is specified by looking at each pixel thru the planes.  I.e., if you have 5 planes, and the bit for  
    265         a particular pixel is set in planes  
     264        after parsing and uncompacting if necessary, you will have N planes of pixel data.  Color register used for 
     265        each pixel is specified by looking at each pixel thru the planes.  I.e., if you have 5 planes, and the bit for 
     266        a particular pixel is set in planes 
    266267        0 and 3: 
    267268 
  • branches/workbranch/trunk/3dc/RingBuffer.cpp

    r416 r533  
    106106                // standard logic - buffers have a gap, work out readable space between them 
    107107                readableSpace = writePos - readPos; 
    108                 if (readableSpace < 0) 
     108                if (readableSpace < 0) { 
    109109                        readableSpace += bufferCapacity; 
     110                } 
    110111        } 
    111112 
     
    185186 
    186187        // is first size big enough to hold all our data? 
    187         if (firstSize > srcDataSize) 
     188        if (firstSize > srcDataSize) { 
    188189                firstSize = srcDataSize; 
     190        } 
    189191 
    190192        // first part. from write cursor to end of buffer 
  • branches/workbranch/trunk/3dc/avp/BH_ALIEN.cpp

    r435 r533  
    19481948                        { 
    19491949                                /* More complex.  Affected by alien type and health. */ 
    1950                                 NPC_DATA *NpcData; 
     1950                                NPC_DATA *NpcData = 0; 
    19511951                                int prefactor; 
    19521952 
  • branches/workbranch/trunk/3dc/avp/CDTrackSelection.cpp

    r531 r533  
    8787 
    8888                        // skip to the next non numerical character 
    89                         while (*buffer>='0' && *buffer<='9') { 
     89                        while (*buffer >= '0' && *buffer <= '9') { 
    9090                                buffer++; 
    9191                        } 
  • branches/workbranch/trunk/3dc/avp/Hud.cpp

    r502 r533  
    4747#include "language.h" 
    4848#include "tables.h" 
     49#include "assert.h" 
    4950 
    5051#define DO_PREDATOR_OVERLAY FALSE 
     
    20522053        while (CameraZoomScale<=ZoomLevels[++i]); 
    20532054 
     2055        assert(i < 4); 
     2056 
    20542057        deltaZoom = (ZoomLevels[i-1] - ZoomLevels[i])*(float)NormalFrameTime/32768.0f; 
    20552058//      textprint("deltaZoom %f, zone %d\n",deltaZoom,i); 
  • branches/workbranch/trunk/3dc/avp/win95/Projload.cpp

    r527 r533  
    7878 
    7979// these are to link with chnkimag.cpp 
    80 const char * ToolsTex_Directory = "//Kate/Kate Share/avp/ToolsTex/"; 
    81 const char * GenTex_Directory = "//Kate/Kate Share/avp/GenG-Tex/"; 
    82 const char * SubShps_Directory = "SubShps/All/"; 
     80const char *ToolsTex_Directory = "//Kate/Kate Share/avp/ToolsTex/"; 
     81const char *GenTex_Directory = "//Kate/Kate Share/avp/GenG-Tex/"; 
     82const char *SubShps_Directory = "SubShps/All/"; 
    8383// const char * GenTex_Directory = 0; 
    84 const char * FixTex_Directory = "//Kate/Kate Share/avp/Fix-Tex/"; 
    85 const char * GameTex_Directory = "//Kate/Kate Share/avp/game-tex/"; 
     84const char *FixTex_Directory = "//Kate/Kate Share/avp/Fix-Tex/"; 
     85const char *GameTex_Directory = "//Kate/Kate Share/avp/game-tex/"; 
    8686// new directories for new-style graphics - to be determined properly 
    87 char const * FirstTex_Directory = "Graphics"; // currently relative to cwd 
    88 char const * SecondTex_Directory = 0; // will be the src safe shadow for development builds 
     87char const *FirstTex_Directory = "Graphics"; // currently relative to cwd 
     88char const *SecondTex_Directory = 0; // will be the src safe shadow for development builds 
    8989                                                                //used for cd graphics directory in final version 
    9090 
    91 char* Rif_Sound_Directory = 0;//set for the main level rif 
    92  
    93 static char * light_set_name = "NORMALLT"; 
    94  
    95 static Object_Chunk * * o_chunk_array; 
    96 static int * aimodule_indeces; //array parallel to o_chunk_array 
    97  
    98  
    99 void setup_preplaced_decals(File_Chunk* fc,Environment_Data_Chunk* edc); 
     91char *Rif_Sound_Directory = 0;//set for the main level rif 
     92 
     93static char *light_set_name = "NORMALLT"; 
     94 
     95static Object_Chunk **o_chunk_array; 
     96static int *aimodule_indeces; //array parallel to o_chunk_array 
     97 
     98 
     99void setup_preplaced_decals(File_Chunk *fc, Environment_Data_Chunk *edc); 
    100100///////////////////////////////////////// 
    101101// Functions which operate on RIFFHANDLEs 
     
    104104void setup_start_position(RIFFHANDLE h) 
    105105{ 
    106         Chunk * pChunk = h->envd->lookup_single_child("SPECLOBJ"); 
    107         AVP_Player_Start_Chunk* start_chunk=0; 
     106        Chunk *pChunk = h->envd->lookup_single_child("SPECLOBJ"); 
     107        AVP_Player_Start_Chunk *start_chunk = 0; 
    108108        if (pChunk) 
    109109        { 
     
    276276        } 
    277277        int aimodule_index=aimodule_indeces[module_index]; 
    278  
    279278 
    280279        PATHHEADER* path=&PathArray[path_index]; 
  • branches/workbranch/trunk/3dc/avp/win95/USR_IO.cpp

    r527 r533  
    3535void MaintainZoomingLevel(void); 
    3636 
     37// Extern for global keyboard buffer 
     38extern unsigned char KeyboardInput[]; 
     39extern unsigned char DebouncedKeyboardInput[]; 
     40extern int GotJoystick; 
     41extern bool GotMouse; 
     42extern BOOL GotXPad; 
     43 
     44// XInput value externs 
     45extern int xPadLookX; 
     46extern int xPadLookY; 
     47extern int xPadMoveX; 
     48extern int xPadMoveY; 
     49 
     50extern int CameraZoomLevel; 
     51extern int MouseVelX; 
     52extern int MouseVelY; 
     53extern JOYINFOEX JoystickData; 
     54extern JOYCAPS JoystickCaps; 
     55 
     56extern void save_preplaced_decals(); 
     57 
    3758FIXED_INPUT_CONFIGURATION FixedInputConfig = 
    3859{ 
     
    4869        KEY_0,                          // Weapon10; 
    4970        KEY_ESCAPE,                     // PauseGame; 
    50  
    5171}; 
    5272 
     
    10161036}; 
    10171037 
    1018 /* Extern for global keyboard buffer */ 
    1019 extern unsigned char KeyboardInput[]; 
    1020 extern unsigned char DebouncedKeyboardInput[]; 
    1021 extern int GotJoystick; 
    1022 extern int GotMouse; 
    1023 extern BOOL GotXPad; 
    1024  
    1025 /* XInput value externs */ 
    1026 extern int xPadLookX; 
    1027 extern int xPadLookY; 
    1028 extern int xPadMoveX; 
    1029 extern int xPadMoveY; 
    1030  
    10311038/* initialise the player input structure(s) in the player_status block */ 
    10321039void InitPlayerGameInput(STRATEGYBLOCK* sbPtr) 
     
    10341041        PLAYER_STATUS *playerStatusPtr; 
    10351042 
    1036     /* get the player status block ... */ 
    1037     playerStatusPtr = (PLAYER_STATUS *) (sbPtr->SBdataptr); 
    1038     LOCALASSERT(playerStatusPtr); 
    1039          
     1043        /* get the player status block ... */ 
     1044        playerStatusPtr = (PLAYER_STATUS *) (sbPtr->SBdataptr); 
     1045        LOCALASSERT(playerStatusPtr); 
    10401046 
    10411047        /* analogue type inputs */ 
     
    10531059        /* KJL 14:23:54 8/7/97 - default to run */ 
    10541060        playerStatusPtr->Mvt_InputRequests.Flags.Rqst_Faster = 1; 
    1055  
    10561061} 
    10571062 
     
    10661071        PLAYER_STATUS *playerStatusPtr; 
    10671072 
    1068     /* get the player status block ... */ 
    1069     playerStatusPtr = (PLAYER_STATUS *) (sbPtr->SBdataptr); 
    1070     LOCALASSERT(playerStatusPtr); 
     1073        /* get the player status block ... */ 
     1074        playerStatusPtr = (PLAYER_STATUS *) (sbPtr->SBdataptr); 
     1075        LOCALASSERT(playerStatusPtr); 
    10711076         
    10721077        /* start off by initialising the inputs */ 
     
    10971102        if (IOFOCUS_AcceptControls() && !InGameMenusAreRunning() && (!(IOFOCUS_Get() & IOFOCUS_NEWCONSOLE))) 
    10981103        { 
    1099                 /* now do forward,backward,left,right,up and down  
    1100                    IMPORTANT:  The request flag and the movement  
     1104                /* now do forward,backward,left,right,up and down 
     1105                   IMPORTANT:  The request flag and the movement 
    11011106                   increment must BOTH be set! 
    11021107                */ 
     
    11051110                        playerStatusPtr->Mvt_InputRequests.Flags.Rqst_Forward = 1; 
    11061111                        playerStatusPtr->Mvt_MotionIncrement = ONE_FIXED; 
    1107                 }        
     1112                } 
    11081113                if (KeyboardInput[primaryInput->Backward] || KeyboardInput[secondaryInput->Backward]) 
    11091114                { 
     
    11271132                } 
    11281133                if (KeyboardInput[primaryInput->StrafeRight] || KeyboardInput[secondaryInput->StrafeRight]) 
    1129                 {        
     1134                { 
    11301135                        playerStatusPtr->Mvt_InputRequests.Flags.Rqst_SideStepRight = 1; 
    11311136                        playerStatusPtr->Mvt_SideStepIncrement = ONE_FIXED; 
     
    11331138                if (KeyboardInput[primaryInput->Walk] || KeyboardInput[secondaryInput->Walk]) 
    11341139                        playerStatusPtr->Mvt_InputRequests.Flags.Rqst_Faster = 0; 
    1135                  
     1140 
    11361141                if (KeyboardInput[primaryInput->Strafe] || KeyboardInput[secondaryInput->Strafe]) 
    11371142                        playerStatusPtr->Mvt_InputRequests.Flags.Rqst_Strafe = 1; 
     
    11391144                if (KeyboardInput[primaryInput->Crouch] || KeyboardInput[secondaryInput->Crouch]) 
    11401145                        playerStatusPtr->Mvt_InputRequests.Flags.Rqst_Crouch = 1; 
    1141                  
     1146 
    11421147                if (KeyboardInput[primaryInput->Jump] || KeyboardInput[secondaryInput->Jump]) 
    11431148                        playerStatusPtr->Mvt_InputRequests.Flags.Rqst_Jump = 1; 
     
    11521157                        case I_Marine: 
    11531158                        { 
    1154                                 if(KeyboardInput[primaryInput->ImageIntensifier] 
     1159                                if (KeyboardInput[primaryInput->ImageIntensifier] 
    11551160                                 ||KeyboardInput[secondaryInput->ImageIntensifier]) 
    11561161                                        playerStatusPtr->Mvt_InputRequests.Flags.Rqst_ChangeVision = 1; 
    11571162 
    1158                                 if(DebouncedKeyboardInput[primaryInput->ThrowFlare] 
     1163                                if (DebouncedKeyboardInput[primaryInput->ThrowFlare] 
    11591164                                 ||DebouncedKeyboardInput[secondaryInput->ThrowFlare]) 
    11601165                                        ThrowAFlare(); 
    11611166 
    11621167                                #if !(MARINE_DEMO||DEATHMATCH_DEMO) 
    1163                                 if(KeyboardInput[primaryInput->Jetpack] 
     1168                                if (KeyboardInput[primaryInput->Jetpack] 
    11641169                                 ||KeyboardInput[secondaryInput->Jetpack]) 
    11651170                                        playerStatusPtr->Mvt_InputRequests.Flags.Rqst_Jetpack = 1; 
    11661171                                #endif 
    11671172 
    1168                                 if(KeyboardInput[primaryInput->MarineTaunt] 
     1173                                if (KeyboardInput[primaryInput->MarineTaunt] 
    11691174                                 ||KeyboardInput[secondaryInput->MarineTaunt]) 
    11701175                                        StartPlayerTaunt(); 
    11711176                                 
    1172                                 if(DebouncedKeyboardInput[primaryInput->Marine_MessageHistory] 
     1177                                if (DebouncedKeyboardInput[primaryInput->Marine_MessageHistory] 
    11731178                                 ||DebouncedKeyboardInput[secondaryInput->Marine_MessageHistory]) 
    11741179                                        MessageHistory_DisplayPrevious(); 
    11751180                                         
    1176                                 if(DebouncedKeyboardInput[primaryInput->Marine_Say] 
     1181                                if (DebouncedKeyboardInput[primaryInput->Marine_Say] 
    11771182                                 ||DebouncedKeyboardInput[secondaryInput->Marine_Say]) 
    11781183                                        BringDownConsoleWithSayTypedIn(); 
    11791184 
    1180                                 if(DebouncedKeyboardInput[primaryInput->Marine_SpeciesSay] 
     1185                                if (DebouncedKeyboardInput[primaryInput->Marine_SpeciesSay] 
    11811186                                 ||DebouncedKeyboardInput[secondaryInput->Marine_SpeciesSay]) 
    11821187                                        BringDownConsoleWithSaySpeciesTypedIn(); 
    11831188 
    1184                                 if(KeyboardInput[primaryInput->Marine_ShowScores] 
     1189                                if (KeyboardInput[primaryInput->Marine_ShowScores] 
    11851190                                 ||KeyboardInput[secondaryInput->Marine_ShowScores]) 
    11861191                                        ShowMultiplayerScores(); 
     
    11881193                        } 
    11891194                        case I_Predator: 
    1190                         { 
    1191                                 extern int CameraZoomLevel; 
    1192                                  
    1193                                 if(KeyboardInput[primaryInput->Cloak] 
     1195                        {                                
     1196                                if (KeyboardInput[primaryInput->Cloak] 
    11941197                                 ||KeyboardInput[secondaryInput->Cloak]) 
    11951198                                        playerStatusPtr->Mvt_InputRequests.Flags.Rqst_ChangeVision = 1; 
    11961199                                 
    1197                                 if(DebouncedKeyboardInput[primaryInput->CycleVisionMode] 
     1200                                if (DebouncedKeyboardInput[primaryInput->CycleVisionMode] 
    11981201                                 ||DebouncedKeyboardInput[secondaryInput->CycleVisionMode]) 
    11991202                                        playerStatusPtr->Mvt_InputRequests.Flags.Rqst_CycleVisionMode = 1; 
    12001203 
    12011204                                #if !(PREDATOR_DEMO||DEATHMATCH_DEMO) 
    1202                                 if(DebouncedKeyboardInput[primaryInput->GrapplingHook] 
     1205                                if (DebouncedKeyboardInput[primaryInput->GrapplingHook] 
    12031206                                 ||DebouncedKeyboardInput[secondaryInput->GrapplingHook]) 
    12041207                                        playerStatusPtr->Mvt_InputRequests.Flags.Rqst_GrapplingHook = 1; 
    12051208                                #endif 
    12061209 
    1207                                 if(DebouncedKeyboardInput[primaryInput->ZoomIn] 
     1210                                if (DebouncedKeyboardInput[primaryInput->ZoomIn] 
    12081211                                 ||DebouncedKeyboardInput[secondaryInput->ZoomIn]) 
    12091212                                { 
    12101213                                        if (CameraZoomLevel<3) CameraZoomLevel++; 
    12111214                                } 
    1212                                 if(DebouncedKeyboardInput[primaryInput->ZoomOut] 
     1215                                if (DebouncedKeyboardInput[primaryInput->ZoomOut] 
    12131216                                 ||DebouncedKeyboardInput[secondaryInput->ZoomOut]) 
    12141217                                { 
     
    12181221                                MaintainZoomingLevel(); 
    12191222                                 
    1220                                 if(KeyboardInput[primaryInput->PredatorTaunt] 
     1223                                if (KeyboardInput[primaryInput->PredatorTaunt] 
    12211224                                 ||KeyboardInput[secondaryInput->PredatorTaunt]) 
    12221225                                        StartPlayerTaunt(); 
    12231226 
    1224                                 if(KeyboardInput[primaryInput->RecallDisc] 
     1227                                if (KeyboardInput[primaryInput->RecallDisc] 
    12251228                                 ||KeyboardInput[secondaryInput->RecallDisc]) 
    12261229                                        Recall_Disc(); 
    12271230                                         
    1228                                 if(DebouncedKeyboardInput[primaryInput->Predator_MessageHistory] 
     1231                                if (DebouncedKeyboardInput[primaryInput->Predator_MessageHistory] 
    12291232                                 ||DebouncedKeyboardInput[secondaryInput->Predator_MessageHistory]) 
    12301233                                        MessageHistory_DisplayPrevious(); 
    12311234                                         
    1232                                 if(DebouncedKeyboardInput[primaryInput->Predator_Say] 
     1235                                if (DebouncedKeyboardInput[primaryInput->Predator_Say] 
    12331236                                 ||DebouncedKeyboardInput[secondaryInput->Predator_Say]) 
    12341237                                        BringDownConsoleWithSayTypedIn(); 
    12351238 
    1236                                 if(DebouncedKeyboardInput[primaryInput->Predator_SpeciesSay] 
     1239                                if (DebouncedKeyboardInput[primaryInput->Predator_SpeciesSay] 
    12371240                                 ||DebouncedKeyboardInput[secondaryInput->Predator_SpeciesSay]) 
    12381241                                        BringDownConsoleWithSaySpeciesTypedIn(); 
    12391242 
    1240                                 if(KeyboardInput[primaryInput->Predator_ShowScores] 
     1243                                if (KeyboardInput[primaryInput->Predator_ShowScores] 
    12411244                                 ||KeyboardInput[secondaryInput->Predator_ShowScores]) 
    12421245                                        ShowMultiplayerScores(); 
     
    12541257                                 ||KeyboardInput[secondaryInput->Taunt]) 
    12551258                                        StartPlayerTaunt(); 
    1256          
     1259 
    12571260                                if(DebouncedKeyboardInput[primaryInput->Alien_MessageHistory] 
    12581261                                 ||DebouncedKeyboardInput[secondaryInput->Alien_MessageHistory]) 
     
    14301433                        if(DebouncedKeyboardInput[FixedInputConfig.Weapon10]) 
    14311434                        { 
    1432                                 extern void save_preplaced_decals(); 
    14331435                                save_preplaced_decals(); 
    14341436                        } 
     
    14541456        if (GotMouse) 
    14551457        { 
    1456                 extern int MouseVelX; 
    1457                 extern int MouseVelY; 
    1458  
    14591458                if (ControlMethods.HAxisIsTurning) 
    14601459                { 
     
    15411540        } 
    15421541 
    1543         /* handle xbox controllers seperate from joysticks */ 
     1542        // handle xbox controllers seperate from joysticks 
    15441543        if (GotXPad) 
    15451544        { 
    1546 //              char buf[100]; 
    15471545                #define JOYSTICK_DEAD_ZONE 12000 
    15481546                int yAxis = xPadMoveY * 2; 
     
    16161614        { 
    16171615                #define JOYSTICK_DEAD_ZONE 12000 
    1618                 extern JOYINFOEX JoystickData; 
    1619                 extern JOYCAPS JoystickCaps; 
    16201616 
    16211617                int yAxis = (32768-JoystickData.dwYpos)*2; 
     
    18941890        #endif 
    18951891 
    1896         if (DebouncedKeyboardInput[KEY_GRAVE])  
     1892        if (DebouncedKeyboardInput[KEY_GRAVE]) { 
    18971893                IOFOCUS_Toggle(); 
     1894        } 
    18981895} 
    18991896 
     
    19051902        LoadAKeyConfiguration("avpkey.cfg"); 
    19061903        #endif 
    1907  
    19081904} 
    19091905 
  • branches/workbranch/trunk/3dc/avp/win95/winmain.cpp

    r527 r533  
    212212        } 
    213213 
    214         if (strstr(command_line, "-intro"))      
     214        if (strstr(command_line, "-intro"))     { 
    215215                WeWantAnIntro(); 
     216        } 
    216217 
    217218        if (strstr(command_line, "-qm")) 
     
    298299 
    299300        #if PLAY_INTRO//(MARINE_DEMO||ALIEN_DEMO||PREDATOR_DEMO) 
    300         if (!LobbiedGame) // Edmond 
     301        if (!LobbiedGame) { // Edmond 
    301302                WeWantAnIntro(); 
     303        } 
    302304        #endif 
    303305        GetPathFromRegistry(); 
     
    324326        #if debug && 1//!PREDATOR_DEMO 
    325327 
    326         if (instr = strstr(command_line, "-s")) 
     328        if (instr = strstr(command_line, "-s")) { 
    327329                sscanf(instr, "-s%d", &level_to_load); 
     330        } 
    328331 
    329332        #endif 
     
    467470                                case I_GM_Playing: 
    468471                                { 
    469                                         if ((!menusActive || (AvP.Network!=I_No_Network && !netGameData.skirmishMode)) && !AvP.LevelCompleted) 
     472                                        if ((!menusActive || (AvP.Network != I_No_Network && !netGameData.skirmishMode)) && !AvP.LevelCompleted) 
    470473                                        { 
    471474                                                //#if MainTextPrint             /* debugging stuff */ 
     
    507510                                                // check to see if we're pausing the game; 
    508511                                                // if so kill off any sound effects 
    509                                                 if (InGameMenusAreRunning() && ((AvP.Network != I_No_Network && netGameData.skirmishMode) || (AvP.Network == I_No_Network))) 
     512                                                if (InGameMenusAreRunning() && ((AvP.Network != I_No_Network && netGameData.skirmishMode) || (AvP.Network == I_No_Network))) { 
    510513                                                        SoundSys_StopAll(); 
     514                                                } 
    511515                                        } 
    512516                                        else 
     
    566570                                RestartLevel(); 
    567571                        } 
    568                 }// end of main game loop 
     572                } // end of main game loop 
    569573 
    570574                AvP.LevelCompleted = thisLevelHasBeenCompleted; 
     
    578582                ReleaseAllFMVTextures(); 
    579583 
    580                 /* DHM 8/4/98 */ 
    581584                CONSBIND_WriteKeyBindingsToConfigFile(); 
    582585 
    583                 /* CDF 2/10/97 */ 
    584586                DeInitialisePlayer(); 
    585587 
     
    595597 
    596598                #endif 
    597                 /* Patrick 26/6/97 
    598                 Stop and remove all game sounds here, since we are returning to the menus */ 
    599 //              SoundSys_StopAll(); 
     599 
    600600                ResetEaxEnvironment(); 
    601                 //make sure the volume gets reset for the menus 
     601 
     602                // make sure the volume gets reset for the menus 
    602603                SoundSys_ResetFadeLevel(); 
    603604 
     
    617618 
    618619#if 0 //bjd - FIXME 
    619                 if(LobbiedGame) 
     620                if (LobbiedGame) 
    620621                { 
    621622                        /* 
  • branches/workbranch/trunk/3dc/d3d_render.cpp

    r523 r533  
    355355//      mainList->Sort(); 
    356356 
    357         // Melanikus 18/11/11 - Nvidia 3D Vision fix 
    358         // Setting the projection matrix to  
    359         // the rhw shader so we can have a non 
     357        // Melanikus 18/11/11 - Nvidia 3D Vision fix. Setting the projection matrix to the rhw shader so we can have a non 
    360358        // ortho projection 
    361359        R_MATRIX projection; 
    362         D3DXMatrixPerspectiveFovRH(&projection,D3DXToRadian(90.0f),4.0f/3.0f,0.0f,1.0f); 
     360        D3DXMatrixPerspectiveFovRH(&projection, D3DXToRadian(90.0f), 4.0f/3.0f ,0.0f, 1.0f); 
    363361        d3d.rhwDecl->Set(); 
    364362        d3d.effectSystem->SetActive(d3d.rhwEffect); 
     
    612610{ 
    613611        alpha = (alpha / 256); 
    614         if (alpha > 255) 
     612        if (alpha > 255) { 
    615613                alpha = 255; 
     614        } 
    616615 
    617616        RCOLOR colour = RCOLOR_ARGB(alpha, 255, 255, 255); 
     
    759758        assert(ftPtr); 
    760759 
    761         if (!ftPtr) 
     760        if (!ftPtr) { 
    762761                return; 
    763  
    764         if (!NextFMVTextureFrame(ftPtr)) 
    765         { 
     762        } 
     763 
     764        if (!NextFMVTextureFrame(ftPtr)) { 
    766765                return; 
    767766        } 
     
    801800{ 
    802801        alpha = alpha / 256; 
    803         if (alpha > 255) 
     802        if (alpha > 255) { 
    804803                alpha = 255; 
     804        } 
    805805 
    806806        RCOLOR colour = RCOLOR_ARGB(alpha,0,0,0); 
     
    958958                OutputDebugString("DrawPrimitiveUP failed\n"); 
    959959        } 
    960  
    961960} 
    962961 
     
    10191018 
    10201019        alpha = (alpha / 256); 
    1021         if (alpha > 255) 
     1020        if (alpha > 255) { 
    10221021                alpha = 255; 
     1022        } 
    10231023 
    10241024        DrawQuad(topX, topY, textureWidth, textureHeight, textureID, RCOLOR_ARGB(alpha, 255, 255, 255), TRANSLUCENCY_GLOWING); 
     
    10301030        uint32_t textureHeight = 0; 
    10311031 
    1032         if (alpha > ONE_FIXED) // ONE_FIXED = 65536 
     1032        if (alpha > ONE_FIXED) { // ONE_FIXED = 65536 
    10331033                alpha = ONE_FIXED; 
     1034        } 
    10341035 
    10351036        alpha = (alpha / 256); 
    1036         if (alpha > 255) 
     1037        if (alpha > 255) { 
    10371038                alpha = 255; 
     1039        } 
    10381040 
    10391041        // textures original resolution (if it's a non power of 2, these will be the non power of 2 values) 
     
    12361238void DrawCoronas() 
    12371239{ 
    1238         if (coronaArray.size() == 0) 
     1240        if (coronaArray.size() == 0) { 
    12391241                return; 
     1242        } 
    12401243 
    12411244        uint32_t numVertsBackup = RenderPolygon.NumberOfVertices; 
     
    13651368void DrawParticles() 
    13661369{ 
    1367         if (!particleBucket.size()) 
     1370        if (!particleBucket.size()) { 
    13681371                return; 
     1372        } 
    13691373 
    13701374        // loop particles and add them to vertex buffer 
  • branches/workbranch/trunk/3dc/logString.cpp

    r516 r533  
    104104} 
    105105 
     106void LogDebugString(const std::string &debugString, int LINE, const char* FILE) 
     107{ 
     108        std::string temp = "Debug message: " + debugString + " Line: " + Util::IntToString(LINE) + " File: " + FILE + "\n"; 
     109        WriteToLog("\t" + temp); 
     110} 
     111 
     112void LogDebugString(const std::string &debugString) 
     113{ 
     114        // TODO - can specify a flag on cmd args to print these or not? 
     115        std::string temp = debugString + "\n"; 
     116        WriteToLog(temp); 
     117} 
     118 
    106119void LogString(const std::string &logString) 
    107120{ 
     
    109122        WriteToLog(temp); 
    110123} 
    111  
    112 void LogDebugValue(int value) 
    113 { 
    114         std::ostringstream stream; 
    115         stream << "\n value was: " << value; 
    116         OutputDebugString(stream.str().c_str()); 
    117 } 
  • branches/workbranch/trunk/3dc/logstring.h

    r516 r533  
    3636void LogErrorString(const std::string &errorString, int LINE, const char* FILE); 
    3737void LogErrorString(const std::string &errorString); 
     38void LogDebugString(const std::string &debugString, int LINE, const char* FILE); 
     39void LogDebugString(const std::string &debugString); 
    3840const std::string& GetLastErrorMessage(); 
    3941void LogString(const std::string &logString); 
    40 void LogDebugValue(int value); 
    4142 
    4243#endif // include guard 
  • branches/workbranch/trunk/3dc/utilities.cpp

    r527 r533  
    6666        } 
    6767 
    68         if (c == '\\') 
     68        if (c == '\\') { 
    6969                return '/'; 
     70        } 
    7071 
    7172        return c; 
     
    102103{ 
    103104        // check if we've got the path previously and use it again 
    104         if (*saveFolder) 
     105        if (*saveFolder) { 
    105106                return saveFolder; 
     107        } 
    106108 
    107109#ifdef _XBOX 
  • branches/workbranch/trunk/3dc/win95/CD_player.cpp

    r530 r533  
    77#define UseLocalAssert TRUE 
    88#include "ourasert.h" 
     9#include "ConfigFile.h" 
    910 
    1011/* KJL 12:40:35 07/05/98 - This is code derived from Patrick's original stuff & moved into it's own file. */ 
     
    3940 
    4041extern int SetStreamingMusicVolume(int volume); 
    41 static void PlatGetCDDAVolumeControl(void); 
    42  
    43 void CDDA_Start(void) 
    44 { 
    45         return; // bjd - revert 
    46  
    47         /* function should complete successfully even if no disc in drive */ 
     42static void PlatGetCDDAVolumeControl(); 
     43 
     44bool useCD = true; 
     45 
     46void CDDA_Start() 
     47{ 
     48        return; 
     49        useCD = Config_GetBool("[Music]", "UseCDaudio", true); 
     50 
     51        // function should complete successfully even if no disc in drive 
    4852        CDDAVolume = CDDA_VOLUME_DEFAULT; 
    4953        CDPlayerVolume = CDDAVolume; 
     
    5155        CDDAIsInitialised = false; 
    5256 
    53         if (PlatStartCDDA() != SOUND_PLATFORMERROR) 
     57        if (PlatStartCDDA()) 
    5458        { 
    5559                CDDAIsInitialised = true; 
    5660                CDDA_SwitchOn(); 
    57                 CDDA_ChangeVolume(CDDAVolume); /* init the volume */ 
     61                CDDA_ChangeVolume(CDDAVolume); // init the volume 
    5862                CDDA_CheckNumberOfTracks(); 
    5963        } 
     
    6165} 
    6266 
    63 void CDDA_End(void) 
     67void CDDA_End() 
    6468{ 
    6569        if (!CDDAIsInitialised) { 
     
    7680} 
    7781 
    78 void CDDA_Management(void) 
     82void CDDA_Management() 
    7983{ 
    8084        if (!CDDASwitchedOn) { 
     
    8993{ 
    9094        if (!CDDASwitchedOn) 
    91                 return; /* CDDA is off */ 
     95                return; // CDDA is off 
    9296 
    9397        if (CDDAState == CDOp_Playing) 
    94                 return; /* already playing */ 
    95  
    96         if ((CDDATrack <= 0)||(CDDATrack >= CDTrackMax)) 
    97                 return; /* no such track */ 
    98  
    99         int ok = PlatPlayCDDA((int)CDDATrack); 
    100         if (ok != SOUND_PLATFORMERROR) 
     98                return; // already playing 
     99 
     100        if ((CDDATrack <= 0) || (CDDATrack >= CDTrackMax)) 
     101                return; // no such track 
     102 
     103        if (PlatPlayCDDA(CDDATrack) != SOUND_PLATFORMERROR) 
    101104        { 
    102105                CDDAState = CDOp_Playing; 
     
    118121        } 
    119122 
    120         int ok = PlatPlayCDDA((int)CDDATrack); 
    121         if (ok != SOUND_PLATFORMERROR) 
     123        if (PlatPlayCDDA(CDDATrack) != SOUND_PLATFORMERROR) 
    122124        { 
    123125                CDDAState=CDOp_Playing; 
     
    127129} 
    128130 
    129 extern void CheckCDVolume(void) 
     131extern void CheckCDVolume() 
    130132{ 
    131133        if (CDDAVolume != CDPlayerVolume) { 
     
    139141        if (SetStreamingMusicVolume(volume) == 0) // ok 
    140142        { 
    141                 CDDAVolume=volume; 
     143                CDDAVolume = volume; 
    142144                CDPlayerVolume = volume; 
    143145        } 
     
    162164} 
    163165 
    164 int CDDA_GetCurrentVolumeSetting(void) 
     166int CDDA_GetCurrentVolumeSetting() 
    165167{ 
    166168        return CDDAVolume; 
     
    172174                return; // CDDA is off 
    173175        } 
     176 
    174177        if (CDDAState != CDOp_Playing) { 
    175178                return; // nothing playing 
    176179        } 
    177         int ok = PlatStopCDDA(); 
     180 
     181        PlatStopCDDA(); 
    178182        CDDAState = CDOp_Idle; 
    179183        LastCommandGiven = CDCOMMANDID_Stop; 
     
    193197                return; // CDDA is off already 
    194198        } 
     199 
    195200        if (CDDA_IsPlaying()) { 
    196201                CDDA_Stop(); 
     
    216221int CDDA_CheckNumberOfTracks() 
    217222{ 
    218         int numTracks = 0; 
     223        uint32_t numTracks = 0; 
    219224 
    220225        if (CDDA_IsOn()) 
    221226        { 
    222                 PlatGetNumberOfCDTracks(&numTracks); 
     227                PlatGetNumberOfCDTracks(numTracks); 
    223228 
    224229                // if there is only one track , then it probably can't be used anyway 
     
    229234 
    230235                // store the maximum allowed track number 
    231                 CDTrackMax=numTracks; 
     236                CDTrackMax = numTracks; 
    232237        } 
    233238        return numTracks; 
    234239} 
    235240 
    236  
    237  
    238241// win32 specific 
    239242 
    240 int PlatStartCDDA(void) 
     243bool PlatStartCDDA() 
    241244{ 
    242245        DWORD dwReturn; 
     
    254257        { 
    255258                cdDeviceID = kNoDevice; 
    256                 return SOUND_PLATFORMERROR; 
     259                return false; 
    257260        } 
    258261        cdDeviceID = mciOpenParms.wDeviceID; 
     
    260263        // now try to get the cd volume control, by obtaining the auxiliary device id for the cd-audio player 
    261264        PlatGetCDDAVolumeControl(); 
    262         return 0; 
    263 } 
    264  
    265 static void PlatGetCDDAVolumeControl(void) 
     265        return true; 
     266} 
     267 
     268static void PlatGetCDDAVolumeControl() 
    266269{ 
    267270        uint32_t numDev = mixerGetNumDevs(); 
     
    312315                                                PreGameCDVolume = detailValue.dwValue; 
    313316                                                mixerClose(handle); 
    314  
    315317                                                return; //success 
    316318                                        } 
     
    322324} 
    323325 
    324 void PlatEndCDDA(void) 
     326void PlatEndCDDA() 
    325327{ 
    326328        return; 
     
    345347 
    346348        // check the cdDeviceId 
    347         if (cdDeviceID==kNoDevice) 
    348                 return SOUND_PLATFORMERROR; 
     349        if (cdDeviceID == kNoDevice) { 
     350                return SOUND_PLATFORMERROR; 
     351        } 
    349352 
    350353        // set the time format 
    351354        mciSetParms.dwTimeFormat = MCI_FORMAT_MSF; 
    352355        dwReturn = mciSendCommand(cdDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD_PTR) &mciSetParms); 
    353         if (dwReturn) 
    354         { 
     356        if (dwReturn) { 
    355357//      NewOnScreenMessage("CD ERROR - TIME FORMAT"); 
    356358                return SOUND_PLATFORMERROR; 
     
    361363        mciStatusParms.dwTrack = track; 
    362364        dwReturn = mciSendCommand(cdDeviceID, MCI_STATUS, MCI_STATUS_ITEM|MCI_TRACK, (DWORD_PTR) &mciStatusParms); 
    363         if (dwReturn) 
    364         { 
     365        if (dwReturn) { 
    365366//      NewOnScreenMessage("CD ERROR - GET LENGTH"); 
    366367                return SOUND_PLATFORMERROR; 
     
    370371        mciSetParms.dwTimeFormat = MCI_FORMAT_TMSF; 
    371372        dwReturn = mciSendCommand(cdDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD_PTR) &mciSetParms); 
    372         if (dwReturn) 
    373         { 
     373        if (dwReturn) { 
    374374//      NewOnScreenMessage("CD ERROR - TIME FORMAT"); 
    375375                return SOUND_PLATFORMERROR; 
     
    381381        mciPlayParms.dwCallback = (DWORD_PTR)hWndMain; 
    382382        dwReturn = mciSendCommand(cdDeviceID, MCI_PLAY, MCI_FROM | MCI_TO | MCI_NOTIFY, (DWORD_PTR) &mciPlayParms); 
    383         if (dwReturn) 
    384         { 
     383        if (dwReturn) { 
    385384//      NewOnScreenMessage("CD ERROR - PLAY"); 
    386385                return SOUND_PLATFORMERROR; 
     
    389388} 
    390389 
    391 int PlatGetNumberOfCDTracks(int* numTracks) 
    392 { 
    393         DWORD dwReturn; 
     390int PlatGetNumberOfCDTracks(uint32_t &numTracks) 
     391{ 
    394392        MCI_STATUS_PARMS mciStatusParms = {0,0,0,0}; 
    395393 
    396394        // check the cdDeviceId 
    397         if (cdDeviceID == kNoDevice) 
    398                 return SOUND_PLATFORMERROR; 
    399  
    400         if (!numTracks) 
    401                 return SOUND_PLATFORMERROR; 
     395        if (cdDeviceID == kNoDevice) { 
     396                return SOUND_PLATFORMERROR; 
     397        } 
     398 
     399        if (!numTracks) { 
     400                return SOUND_PLATFORMERROR; 
     401        } 
    402402 
    403403        // find the number tracks 
    404404        mciStatusParms.dwItem = MCI_STATUS_NUMBER_OF_TRACKS ; 
    405         dwReturn = mciSendCommand(cdDeviceID, MCI_STATUS, MCI_STATUS_ITEM , (DWORD_PTR)&mciStatusParms); 
     405        DWORD dwReturn = mciSendCommand(cdDeviceID, MCI_STATUS, MCI_STATUS_ITEM , (DWORD_PTR)&mciStatusParms); 
    406406        if (dwReturn) 
    407407        { 
     
    410410 
    411411        // number of tracks is in the dwReturn member 
    412         *numTracks = (int)mciStatusParms.dwReturn; 
     412        numTracks = (uint32_t)mciStatusParms.dwReturn; 
    413413 
    414414        return 0; 
    415415} 
    416416 
    417 int PlatStopCDDA(void) 
     417int PlatStopCDDA() 
    418418{ 
    419419        // check the cdDeviceId 
    420         if (cdDeviceID == kNoDevice) 
    421         { 
     420        if (cdDeviceID == kNoDevice) { 
    422421                return SOUND_PLATFORMERROR; 
    423422        } 
     
    425424        // stop the cd player 
    426425        DWORD dwReturn = mciSendCommand(cdDeviceID, MCI_STOP, MCI_WAIT, 0); 
    427         if (dwReturn) 
    428         { 
     426        if (dwReturn) { 
    429427                return SOUND_PLATFORMERROR; 
    430428        } 
     
    441439 
    442440        // check the cdDeviceId 
    443         if (cdDeviceID == kNoDevice) 
    444                 return SOUND_PLATFORMERROR; 
     441        if (cdDeviceID == kNoDevice) { 
     442                return SOUND_PLATFORMERROR; 
     443        } 
    445444 
    446445        // go through the mixer devices searching for one that can deal with the cd volume 
     
    469468                                control.cbStruct = sizeof(MIXERCONTROL); 
    470469 
    471                                 //try to get the volume control 
     470                                // try to get the volume control 
    472471                                if (mixerGetLineControls((HMIXEROBJ)handle, &lineControls, MIXER_GETLINECONTROLSF_ONEBYTYPE) == MMSYSERR_NOERROR) 
    473472                                { 
    474  
    475473                                        MIXERCONTROLDETAILS details; 
    476474                                        MIXERCONTROLDETAILS_UNSIGNED detailValue; 
     
    532530                CDDAState = CDOp_Idle; 
    533531                //NewOnScreenMessage("CD COMMAND RETURNED WITH SUCCESSFUL"); 
    534                 /* Play it again, sam */ 
     532                // Play it again, sam 
    535533                if (LastCommandGiven == CDCOMMANDID_PlayLoop) 
    536534                { 
     
    540538        else if (flags & MCI_NOTIFY_FAILURE) 
    541539        { 
    542                 /* error while playing: abnormal termination */ 
     540                // error while playing: abnormal termination 
    543541                //NewOnScreenMessage("CD COMMAND FAILED"); 
    544542                CDDAState = CDOp_Idle; 
     
    550548        else if (flags & MCI_NOTIFY_ABORTED) 
    551549        { 
    552                 /* aborted or superceeded: try and stop the device */ 
     550                // aborted or superceeded: try and stop the device 
    553551                //NewOnScreenMessage("CD COMMAND ABORTED(?)"); 
    554552          //    CDDA_Stop(); 
  • branches/workbranch/trunk/3dc/win95/CD_player.h

    r530 r533  
    3131  FALSE CDDA operations have any effect until the system has been initialised. 
    3232  -----------------------------------------------------------------------------*/ 
    33 extern void CDDA_Start(void); 
    34 extern void CDDA_End(void); 
     33extern void CDDA_Start(); 
     34extern void CDDA_End(); 
    3535/* Patrick 10/6/97 -------------------------------------------------------------- 
    3636 This is provided to allow platform specific polling/management of the CD device 
    3737 whilst playing. It should be called during the main game loop. 
    3838  -----------------------------------------------------------------------------*/ 
    39 extern void CDDA_Management(void); 
     39extern void CDDA_Management(); 
    4040/* Patrick 10/6/97 -------------------------------------------------------------- 
    4141  Play , change volume, and stop are the basic CDDA operations provided. An 
     
    4545extern void CDDA_PlayLoop(int CDDATrack); 
    4646extern void CDDA_ChangeVolume(int volume); 
    47 extern void CDDA_Stop(void); 
    48 extern int CDDA_CheckNumberOfTracks(void); 
     47extern void CDDA_Stop(); 
     48extern int CDDA_CheckNumberOfTracks(); 
    4949/* Patrick 23/6/97 -------------------------------------------------------------- 
    5050  Returns the current CDDA volume setting.  NB if the cd player has not been 
     
    5252  though it may not be changed using CDDA_ChangeVolume(). 
    5353  -----------------------------------------------------------------------------*/ 
    54 extern int CDDA_GetCurrentVolumeSetting(void); 
     54extern int CDDA_GetCurrentVolumeSetting(); 
    5555/* Patrick 10/6/97 -------------------------------------------------------------- 
    5656  Switch on and switch off may be used to stop and start the CDDA system after 
     
    5858  during a game. 
    5959  -----------------------------------------------------------------------------*/ 
    60 extern void CDDA_SwitchOn(void); 
    61 extern void CDDA_SwitchOff(void); 
     60extern void CDDA_SwitchOn(); 
     61extern void CDDA_SwitchOff(); 
    6262/* Patrick 10/6/97 -------------------------------------------------------------- 
    6363  These are provided to interrogate the state of the CDDA system. 
     
    8686  or zero otherwise. 
    8787  ----------------------------------------------------------------------------*/ 
    88 extern int PlatStartCDDA(void); 
    89 extern void PlatEndCDDA(void); 
     88extern bool PlatStartCDDA(); 
     89extern void PlatEndCDDA(); 
    9090/* Patrick 10/6/97 ------------------------------------------------------------- 
    9191  Platform specific play, stop, and change volume functions. NB the volume 
     
    9494  ----------------------------------------------------------------------------*/ 
    9595extern int PlatPlayCDDA(int track); 
    96 extern int PlatStopCDDA(void); 
     96extern int PlatStopCDDA(); 
    9797extern int PlatChangeCDDAVolume(int volume); 
    98 int PlatGetNumberOfCDTracks(int* numTracks); 
     98int PlatGetNumberOfCDTracks(uint32_t &numTracks); 
    9999/* Patrick 10/6/97 ------------------------------------------------------------- 
    100100  Management functions are provided for platform specific detection of changes 
     
    105105extern void PlatCDDAManagementCallBack(WPARAM flags, LONG deviceId); 
    106106extern int CDPlayerVolume; 
    107 extern void CheckCDVolume(void); 
     107extern void CheckCDVolume(); 
    108108 
    109109#endif 
  • branches/workbranch/trunk/3dc/win95/VideoModes.cpp

    r479 r533  
    2020char *GetVideoModeDescription3()  
    2121{ 
     22/* 
    2223        const uint32_t kBufferSize = 32; 
    2324 
     
    3738 
    3839        return buf; 
     40*/ 
     41        return (char*)R_GetVideoModeDescription().c_str(); 
    3942} 
    4043 
  • branches/workbranch/trunk/3dc/win95/chnkload.cpp

    r522 r533  
    3232double local_scale; 
    3333 
    34 File_Chunk * Env_Chunk = 0; 
     34File_Chunk *Env_Chunk = 0; 
    3535 
    3636RIFFHANDLE current_rif_handle; 
    3737 
    38 unsigned char const * PaletteMapTable; 
     38unsigned char const *PaletteMapTable; 
    3939 
    4040////////////////////////////////////////////////////////// 
    41 extern LOADED_SOUND const * GetSoundForMainRif(const char* wav_name); 
    42 extern char * extsounddir ; 
    43 extern char * sounddir ; 
     41extern LOADED_SOUND const *GetSoundForMainRif(const char *wav_name); 
     42extern char *extsounddir; 
     43extern char *sounddir; 
    4444 
    4545struct Shape_Fragment_Type 
  • branches/workbranch/trunk/3dc/win95/huffman.cpp

    r421 r533  
    1616{ 
    1717    union 
    18     {                                   // the FIRST four bytes 
     18    {                               // the FIRST four bytes 
    1919        struct HuffNode *zero;      // points to the "zero" branch or... 
    2020        unsigned int       value;   // holds the value of an end node 
     
    3737typedef struct 
    3838{ 
    39     long wid; 
    40     long bits; 
     39        long wid; 
     40        long bits; 
    4141 
    4242} HuffEncode; 
     
    8282        strncpy(outpackage->Identifier,COMPRESSED_RIF_IDENTIFIER,8); 
    8383        outpackage->CompressedDataSize = HuffEncodeBytes((int*)(outpackage+1), sourcePtr, length, EncodingTable); 
    84     outpackage->UncompressedDataSize = length; 
    85     for (int n = 0; n < MAX_DEPTH; n++)   
    86         { 
    87         outpackage->CodelengthCount[n] = Depths[n + 1]; 
    88         } 
    89     for (int n = 0; n < 256; n++) 
    90         { 
    91                 outpackage->ByteAssignment[n]  = SymbolCensus[n + 1].Symbol; 
     84        outpackage->UncompressedDataSize = length; 
     85 
     86        for (int n = 0; n < MAX_DEPTH; n++) 
     87        { 
     88                outpackage->CodelengthCount[n] = Depths[n + 1]; 
     89        } 
     90        for (int n = 0; n < 256; n++) 
     91        { 
     92                outpackage->ByteAssignment[n] = SymbolCensus[n + 1].Symbol; 
    9293        } 
    9394        return outpackage; 
    9495} 
    95                          
     96 
    9697static void PerformSymbolCensus(unsigned char *sourcePtr, int length) 
    9798{ 
     
    109110        } 
    110111        while (--length); 
    111 }                        
     112} 
    112113 
    113114static int __cdecl HuffItemsSortSub(const void *cmp1, const void *cmp2) 
    114115{ 
    115     if (((HuffItem *)cmp1)->Count > ((HuffItem *)cmp2)->Count) 
     116        if (((HuffItem *)cmp1)->Count > ((HuffItem *)cmp2)->Count) { 
    116117        return  1; 
    117     if (((HuffItem *)cmp1)->Count < ((HuffItem *)cmp2)->Count) 
     118        } 
     119    if (((HuffItem *)cmp1)->Count < ((HuffItem *)cmp2)->Count) { 
    118120        return -1; 
     121        } 
    119122    return 0; 
    120123} 
     
    135138    unsigned int sum; 
    136139 
    137     if (!count) return; 
     140    if (!count) { 
     141                return; 
     142        } 
    138143 
    139144    movdest = base + 1; 
     
    142147    for (n = 0; n < count; n++) 
    143148    { 
    144         temp[n].bits = source[n].Count; 
     149                temp[n].bits = source[n].Count; 
    145150        } 
    146151    while ((upperlim = --count)) 
    147152    { 
    148         if (temp[0].zero) 
     153        if (temp[0].zero) { 
    149154            temp[0].zero->parent = temp[0].one->parent = movdest; 
    150         if (temp[1].zero) 
     155                } 
     156        if (temp[1].zero) { 
    151157            temp[1].zero->parent = temp[1].one->parent = movdest + 1; 
     158                } 
    152159        movdest[0]   = *temp++; 
    153160        movdest[1]   = *temp; 
     
    175182    } 
    176183    base[0] = temp[0]; 
    177     if (base[0].zero) 
     184 
     185    if (base[0].zero) { 
    178186        base[0].zero->parent = base[0].one->parent = base; 
     187        } 
    179188} 
    180189 
     
    184193    HuffNode *back; 
    185194 
    186     for (n = 0; n < maxdepth + 1; n++) 
     195    for (n = 0; n < maxdepth + 1; n++) { 
    187196        dest[n] = 0; 
     197        } 
     198 
    188199    depth = 0; 
     200 
    189201    while (1) 
    190202    { 
     
    195207        } 
    196208         
    197         if (depth > maxdepth) dest[maxdepth]++; 
    198         else dest[depth]++; 
     209        if (depth > maxdepth) { 
     210                        dest[maxdepth]++; 
     211                } 
     212        else {  
     213                        dest[depth]++; 
     214                } 
    199215 
    200216        do 
     
    202218            back   = source; 
    203219            source = source->parent; 
    204             if (!depth--) 
     220            if (!depth--) { 
    205221                return; 
     222                        } 
    206223        } 
    207224        while (back == source->zero); 
    208225 
    209226        source = source->zero; 
    210             depth++; 
     227                depth++; 
    211228    } 
    212229} 
     
    218235 
    219236    goal = 1 << maxdepth; 
     237 
    220238    for (n = 0, sum = 0, items = 0; n <= (unsigned int)maxdepth; n++) 
    221239    { 
     
    223241        sum   += (goal >> n) * depth[n]; 
    224242    } 
    225     if (items > goal) 
     243 
     244    if (items > goal) { 
    226245        return -1;                              // failure 
     246        } 
     247 
    227248    for (n = maxdepth - 1; sum > goal; n--) 
    228249    { 
     
    244265        { 
    245266            gain = hi - (1 << (maxdepth - m)); 
    246             if (excess < gain) 
     267 
     268            if (excess < gain) { 
    247269                break; 
     270                        } 
     271 
    248272            if (depth[m]) 
    249273            { 
     
    256280        } 
    257281    } 
    258     return 0;                           // success 
     282    return 0;    // success 
    259283} 
    260284 
     
    285309            { 
    286310                cur  ^= bt;                     // do an add modulo 1 
    287                 if ((cur & bt) || !bt)          // break if now a 1 
     311                if ((cur & bt) || !bt) {         // break if now a 1 
    288312                    break;                      // or out of bits 
     313                                } 
    289314                bt  >>=  1;                     // do next bit position 
    290315            } 
     
    301326    unsigned char *sourcelim, *sourceend; 
    302327 
    303     if (!count) return 0; 
     328    if (!count) { 
     329                return 0; 
     330        } 
    304331 
    305332        accum = 0; 
     
    330357            
    331358            wid       += available; 
    332             if (wid) accum = (accum >> wid) | (bits << (32 - wid)); 
     359            if (wid) { 
     360                                accum = (accum >> wid) | (bits << (32 - wid)); 
     361                        } 
    333362            *dest++    = accum; 
    334363            wid       -= available; 
     
    357386        { 
    358387            wid       += available; 
    359             if (wid) 
     388            if (wid) { 
    360389                accum  = (accum >> wid) | (bits << (32 - wid)); 
     390                        } 
    361391            *dest++    = accum; 
    362392            wid       -= available; 
     
    368398            accum = (accum >> wid) | (bits << (32 - wid)); 
    369399                } 
    370     }     
     400    } 
    371401    *dest++ = accum >> available; 
    372402    return (int)((dest - start) * 4); 
  • branches/workbranch/trunk/tools/installer/avpx.iss

    r525 r533  
    33 
    44#define MyAppName "AvPx" 
    5 #define MyAppVersion "1.0" 
     5#define MyAppVersion "0.1" 
    66#define MyAppPublisher "SirLemonhead" 
    77#define MyAppURL "http://homepage.eircom.net/~duncandsl/avp/" 
     
    2020AppSupportURL={#MyAppURL} 
    2121AppUpdatesURL={#MyAppURL} 
    22 DefaultDirName={pf}\Fox\Aliens versus Predator 
     22DefaultDirName={pf} 
    2323DefaultGroupName={#MyAppName} 
    2424OutputBaseFilename=setup 
    2525Compression=lzma 
    2626SolidCompression=yes 
     27UsePreviousAppDir=no 
    2728 
    2829[Languages] 
  • branches/workbranch/trunk/win32/Di_func.cpp

    r527 r533  
    5959//extern HWND hWndMain; 
    6060 
    61 int GotMouse; 
     61bool GotMouse; 
    6262int MouseVelX; 
    6363int MouseVelY; 
     
    870870        if (Osk_IsActive()) 
    871871        { 
    872                 if (DebouncedKeyboardInput[KEY_JOYSTICK_BUTTON_15]) 
     872                if (DebouncedKeyboardInput[KEY_JOYSTICK_BUTTON_15]) { 
    873873                        Osk_MoveLeft(); 
    874  
    875                 else if (DebouncedKeyboardInput[KEY_JOYSTICK_BUTTON_16]) 
     874                } 
     875                else if (DebouncedKeyboardInput[KEY_JOYSTICK_BUTTON_16]) { 
    876876                        Osk_MoveRight(); 
    877  
    878                 else if (DebouncedKeyboardInput[KEY_JOYSTICK_BUTTON_13]) 
     877                } 
     878                else if (DebouncedKeyboardInput[KEY_JOYSTICK_BUTTON_13]) { 
    879879                        Osk_MoveUp(); 
    880  
    881                 else if (DebouncedKeyboardInput[KEY_JOYSTICK_BUTTON_14]) 
     880                } 
     881                else if (DebouncedKeyboardInput[KEY_JOYSTICK_BUTTON_14]) { 
    882882                        Osk_MoveDown(); 
    883  
     883                } 
    884884                else if (DebouncedKeyboardInput[KEY_JOYSTICK_BUTTON_2]) 
    885885                { 
     
    10161016        int OldMouseX, OldMouseY; 
    10171017 
    1018         GotMouse = FALSE; 
    1019  
    1020         if (mouseMoved == false)  
     1018        GotMouse = false; 
     1019 
     1020        if (mouseMoved == false) { 
    10211021                return; 
     1022        } 
    10221023 
    10231024        MouseVelX = 0; 
     
    10311032        OldMouseY = MouseY; 
    10321033 
    1033         GotMouse = TRUE; 
     1034        GotMouse = true; 
    10341035 
    10351036        MouseX += xPosRelative * 4; 
     
    10511052        int OldMouseX, OldMouseY, OldMouseZ; 
    10521053 
    1053         GotMouse = FALSE; 
     1054        GotMouse = false; 
    10541055        MouseVelX = 0; 
    10551056        MouseVelY = 0; 
     
    10701071 
    10711072    // Check for any data being picked up 
    1072         GotMouse = TRUE; 
     1073        GotMouse = true; 
    10731074        if (dwElements == 0) return; 
    10741075 
     
    11521153    #if 0 
    11531154        textprint("MouseNormalFrameTime %d\n",MouseNormalFrameTime); 
    1154         textprint("Got Mouse %d\n", GotMouse); 
     1155//      textprint("Got Mouse %d\n", GotMouse); 
    11551156        textprint("Vel X %d\n", MouseVelX); 
    11561157        textprint("Vel Y %d\n", MouseVelY); 
  • branches/workbranch/trunk/win32/VS2010/AvP.vcxproj

    r527 r533  
    375375    <ClCompile Include="..\..\3dc\MSLHAND.cpp" /> 
    376376    <ClCompile Include="..\..\3dc\MurmurHash3.cpp" /> 
     377    <ClCompile Include="..\..\3dc\MusicPlayer.cpp" /> 
    377378    <ClCompile Include="..\..\3dc\networking.cpp" /> 
    378379    <ClCompile Include="..\..\3dc\OBJECT.cpp" /> 
     
    615616    <ClInclude Include="..\..\3dc\MSLHAND.H" /> 
    616617    <ClInclude Include="..\..\3dc\MurmurHash3.h" /> 
     618    <ClInclude Include="..\..\3dc\MusicPlayer.h" /> 
    617619    <ClInclude Include="..\..\3dc\networking.h" /> 
    618620    <ClInclude Include="..\..\3dc\OnScreenKeyboard.h" /> 
  • branches/workbranch/trunk/win32/d3_func.cpp

    r529 r533  
    280280                        if (D3DERR_DEVICENOTRESET == LastError) 
    281281                        { 
    282                                 OutputDebugString("Releasing resources for a device reset..\n"); 
     282                                LogDebugString("Releasing resources for a device reset..."); 
    283283 
    284284                                if (FAILED(d3d.lpD3DDevice->Reset(&d3d.d3dpp))) 
    285285                                { 
    286                                         OutputDebugString("Couldn't reset device\n"); 
     286                                        LogDebugString("Couldn't reset device"); 
    287287                                } 
    288288                                else 
    289289                                { 
    290                                         OutputDebugString("We have reset the device. recreating resources..\n"); 
     290                                        LogDebugString("We have reset the device. recreating resources..."); 
    291291                                        CreateVolatileResources(); 
    292292 
     
    300300                        else if (D3DERR_DEVICELOST == LastError) 
    301301                        { 
    302                                 OutputDebugString("D3D device lost\n"); 
     302                                LogDebugString("D3D device lost"); 
    303303                        } 
    304304                        else if (D3DERR_DRIVERINTERNALERROR == LastError) 
     
    887887        { 
    888888                LogDxError(LastError, __LINE__, __FILE__); 
    889                 OutputDebugString("Couldn't create screenshot surface\n"); 
     889                LogErrorString("Couldn't create screenshot surface"); 
    890890                return; 
    891891        } 
     
    895895        { 
    896896                LogDxError(LastError, __LINE__, __FILE__); 
    897                 OutputDebugString("Couldn't get a copy of the front buffer\n"); 
     897                LogErrorString("Couldn't get a copy of the front buffer"); 
    898898                SAFE_RELEASE(frontBuffer); 
    899899                return; 
     
    904904        { 
    905905                LogDxError(LastError, __LINE__, __FILE__); 
    906                 OutputDebugString("Save Surface to file failed\n"); 
     906                LogErrorString("Save Surface to file failed"); 
    907907        } 
    908908 
     
    12391239        if (FAILED(LastError)) 
    12401240        { 
    1241                 OutputDebugString(DXGetErrorString(LastError)); 
    1242                 OutputDebugString(DXGetErrorDescription(LastError)); 
    1243  
    12441241                LogErrorString("D3DXCompileShaderFromFile failed for '" + actualPath + "'", __LINE__, __FILE__); 
     1242                LogErrorString("DX Error- " + std::string(DXGetErrorString(LastError)) + " " + std::string(DXGetErrorDescription(LastError))); 
    12451243 
    12461244                if (pErrors) 
     
    12481246                        // shader didn't compile for some reason 
    12491247                        LogErrorString("Shader compile errors found for '" + actualPath + "'", __LINE__, __FILE__); 
    1250                         LogErrorString("\n" + std::string((const char*)pErrors->GetBufferPointer())); 
     1248                        LogErrorString(std::string((const char*)pErrors->GetBufferPointer())); 
    12511249 
    12521250                        pErrors->Release(); 
     
    12801278        std::stringstream message; 
    12811279        message << "Processing constants for vertex shader '" << fileName << "' which has " << constantTableDesc.Constants << " constant(s)\n"; 
    1282         OutputDebugString(message.str().c_str()); 
     1280        LogDebugString(message.str()); 
    12831281 
    12841282        D3DXCONSTANT_DESC constantDesc; 
     
    12971295                std::stringstream constantInfo; 
    12981296                constantInfo << "\t Name: " << constantDesc.Name << ", Register Index: " << constantDesc.RegisterIndex << /*", Register Index: " << constantDesc.RegisterIndex <<*/ "\n"; 
    1299                 OutputDebugString(constantInfo.str().c_str()); 
     1297                LogDebugString(constantInfo.str()); 
    13001298        } 
    13011299 
     
    13321330        if (FAILED(LastError)) 
    13331331        { 
    1334                 OutputDebugString(DXGetErrorString(LastError)); 
    1335                 OutputDebugString(DXGetErrorDescription(LastError)); 
    1336  
    13371332                LogErrorString("D3DXCompileShaderFromFile failed for '" + actualPath + "'", __LINE__, __FILE__); 
     1333                LogErrorString("DX Error- " + std::string(DXGetErrorString(LastError)) + " " + std::string(DXGetErrorDescription(LastError))); 
    13381334 
    13391335                if (pErrors) 
    13401336                { 
    13411337                        // shader didn't compile for some reason 
    1342                         OutputDebugString((const char*)pErrors->GetBufferPointer()); 
    1343  
    13441338                        LogErrorString("Shader compile errors found for '" + actualPath + "'", __LINE__, __FILE__); 
    1345                         LogErrorString("\n" + std::string((const char*)pErrors->GetBufferPointer())); 
     1339                        LogErrorString(std::string((const char*)pErrors->GetBufferPointer())); 
    13461340 
    13471341                        pErrors->Release(); 
     
    13751369        std::stringstream message; 
    13761370        message << "Processing constants for pixel shader '" << fileName << "' which has " << constantTableDesc.Constants << " constant(s)\n"; 
    1377         OutputDebugString(message.str().c_str()); 
     1371        LogDebugString(message.str()); 
    13781372 
    13791373        D3DXCONSTANT_DESC constantDesc; 
     
    13921386                std::stringstream constantInfo; 
    13931387                constantInfo << "\t Name: " << constantDesc.Name << ", Register Index: " << constantDesc.RegisterIndex << /*", Register Index: " << constantDesc.RegisterIndex <<*/ "\n"; 
    1394                 OutputDebugString(constantInfo.str().c_str()); 
     1388                LogDebugString(constantInfo.str()); 
    13951389        } 
    13961390 
     
    18841878                Con_PrintError(sstream.str()); 
    18851879 
    1886                 OutputDebugString(DXGetErrorString(LastError)); 
    1887                 OutputDebugString(DXGetErrorDescription(LastError)); 
    1888                 OutputDebugString("\n"); 
    1889  
    18901880                // this'll occur if the resolution width and height passed aren't usable on this device 
    18911881                if (D3DERR_INVALIDCALL == LastError) 
     
    19731963        D3DFORMAT SelectedBackbufferFormat = D3DFMT_X8R8G8B8; // back buffer format 
    19741964 
    1975         if (WindowMode == WindowModeSubWindow) 
     1965        if (WindowMode == WindowModeSubWindow) { 
    19761966                windowed = true; 
     1967        } 
    19771968 
    19781969        // Zero d3d structure 
     
    20812072                                        for (; f < numFomats; f++ ) 
    20822073                                        { 
    2083                                                 if (DisplayMode.Format == d3d.Driver[thisDevice].Formats[f]) 
     2074                                                if (DisplayMode.Format == d3d.Driver[thisDevice].Formats[f]) { 
    20842075                                                        break; 
     2076                                                } 
    20852077                                        } 
    20862078 
    20872079                                        // If the format is new, add it to the list 
    2088                                         if (f == numFomats) 
     2080                                        if (f == numFomats) { 
    20892081                                                d3d.Driver[thisDevice].Formats[numFomats++] = DisplayMode.Format; 
     2082                                        } 
    20902083                                } 
    20912084                        } 
     
    28012794                if (FAILED(LastError)) 
    28022795                { 
    2803                         OutputDebugString("D3DRS_ZWRITEENABLE D3DZB_TRUE failed\n"); 
     2796                        LogDebugString("D3DRS_ZWRITEENABLE D3DZB_TRUE failed\n"); 
    28042797                } 
    28052798        } 
     
    28092802                if (FAILED(LastError)) 
    28102803                { 
    2811                         OutputDebugString("D3DRS_ZWRITEENABLE D3DZB_FALSE failed\n"); 
    2812                         OutputDebugString("DISABLING Z WRITES\n"); 
     2804                        LogDebugString("D3DRS_ZWRITEENABLE D3DZB_FALSE failed\n"); 
     2805                        LogDebugString("DISABLING Z WRITES\n"); 
    28132806                } 
    28142807        } 
     
    28352828                if (FAILED(LastError)) 
    28362829                { 
    2837                         OutputDebugString("D3DSAMP_ADDRESSU Wrap fail\n"); 
     2830                        LogDebugString("D3DSAMP_ADDRESSU Wrap fail\n"); 
    28382831                } 
    28392832 
     
    28412834                if (FAILED(LastError)) 
    28422835                { 
    2843                         OutputDebugString("D3DSAMP_ADDRESSV Wrap fail\n"); 
     2836                        LogDebugString("D3DSAMP_ADDRESSV Wrap fail\n"); 
    28442837                } 
    28452838 
     
    28472840                if (FAILED(LastError)) 
    28482841                { 
    2849                         OutputDebugString("D3DSAMP_ADDRESSW Wrap fail\n"); 
     2842                        LogDebugString("D3DSAMP_ADDRESSW Wrap fail\n"); 
    28502843                } 
    28512844        } 
     
    28562849                if (FAILED(LastError)) 
    28572850                { 
    2858                         OutputDebugString("D3DSAMP_ADDRESSU Clamp fail\n"); 
     2851                        LogDebugString("D3DSAMP_ADDRESSU Clamp fail\n"); 
    28592852                } 
    28602853 
     
    28622855                if (FAILED(LastError)) 
    28632856                { 
    2864                         OutputDebugString("D3DSAMP_ADDRESSV Clamp fail\n"); 
     2857                        LogDebugString("D3DSAMP_ADDRESSV Clamp fail\n"); 
    28652858                } 
    28662859 
     
    28682861                if (FAILED(LastError)) 
    28692862                { 
    2870                         OutputDebugString("D3DSAMP_ADDRESSW Clamp fail\n"); 
     2863                        LogDebugString("D3DSAMP_ADDRESSW Clamp fail\n"); 
    28712864                } 
    28722865        } 
     
    28972890                default: 
    28982891                { 
    2899                         LOCALASSERT("Unrecognized filtering mode"==0); 
    2900                         OutputDebugString("Unrecognized filtering mode\n"); 
     2892                        LogDebugString("Unrecognized filtering mode\n"); 
    29012893                        break; 
    29022894                }