Import icculus.org release (2014-12-25)
This commit is contained in:
parent
819e239f23
commit
22475d6d94
57 changed files with 3039 additions and 374 deletions
|
@ -16,6 +16,7 @@
|
|||
#include "lighting.h"
|
||||
#include "weapons.h"
|
||||
#include "sfx.h"
|
||||
#include "fmv.h"
|
||||
/* character extents data so you know where the player's eyes are */
|
||||
#include "extents.h"
|
||||
#include "avp_userprofile.h"
|
||||
|
@ -100,7 +101,7 @@ extern int GetSingleColourForPrimary(int Colour);
|
|||
extern void ColourFillBackBuffer(int FillColour);
|
||||
|
||||
static void ModifyHeadOrientation(void);
|
||||
int AVPViewVolumePlaneTest(CLIPPLANEBLOCK *cpb, DISPLAYBLOCK *dblockptr, int or);
|
||||
int AVPViewVolumePlaneTest(CLIPPLANEBLOCK *cpb, DISPLAYBLOCK *dblockptr, int obr);
|
||||
|
||||
|
||||
|
||||
|
@ -875,16 +876,16 @@ void InitialiseRenderer(void)
|
|||
|
||||
int AVPViewVolumeTest(VIEWDESCRIPTORBLOCK *VDB_Ptr, DISPLAYBLOCK *dblockptr)
|
||||
{
|
||||
int or = dblockptr->ObRadius;
|
||||
int obr = dblockptr->ObRadius;
|
||||
|
||||
/* Perform the view volume plane tests */
|
||||
|
||||
if(
|
||||
AVPViewVolumePlaneTest(&VDB_Ptr->VDB_ClipZPlane, dblockptr, or) &&
|
||||
AVPViewVolumePlaneTest(&VDB_Ptr->VDB_ClipLeftPlane, dblockptr, or) &&
|
||||
AVPViewVolumePlaneTest(&VDB_Ptr->VDB_ClipRightPlane, dblockptr, or) &&
|
||||
AVPViewVolumePlaneTest(&VDB_Ptr->VDB_ClipUpPlane, dblockptr, or) &&
|
||||
AVPViewVolumePlaneTest(&VDB_Ptr->VDB_ClipDownPlane, dblockptr, or))
|
||||
AVPViewVolumePlaneTest(&VDB_Ptr->VDB_ClipZPlane, dblockptr, obr) &&
|
||||
AVPViewVolumePlaneTest(&VDB_Ptr->VDB_ClipLeftPlane, dblockptr, obr) &&
|
||||
AVPViewVolumePlaneTest(&VDB_Ptr->VDB_ClipRightPlane, dblockptr, obr) &&
|
||||
AVPViewVolumePlaneTest(&VDB_Ptr->VDB_ClipUpPlane, dblockptr, obr) &&
|
||||
AVPViewVolumePlaneTest(&VDB_Ptr->VDB_ClipDownPlane, dblockptr, obr))
|
||||
return Yes;
|
||||
|
||||
else
|
||||
|
@ -900,13 +901,13 @@ int AVPViewVolumeTest(VIEWDESCRIPTORBLOCK *VDB_Ptr, DISPLAYBLOCK *dblockptr)
|
|||
|
||||
*/
|
||||
|
||||
int AVPViewVolumePlaneTest(CLIPPLANEBLOCK *cpb, DISPLAYBLOCK *dblockptr, int or)
|
||||
int AVPViewVolumePlaneTest(CLIPPLANEBLOCK *cpb, DISPLAYBLOCK *dblockptr, int obr)
|
||||
{
|
||||
VECTORCH POPRelObView;
|
||||
|
||||
MakeVector(&dblockptr->ObView, &cpb->CPB_POP, &POPRelObView);
|
||||
|
||||
if(DotProduct(&POPRelObView, &cpb->CPB_Normal) < or) return Yes;
|
||||
if(DotProduct(&POPRelObView, &cpb->CPB_Normal) < obr) return Yes;
|
||||
else return No;
|
||||
}
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ int NPCGetWaypointDirection(WAYPOINT_HEADER *waypoints, STRATEGYBLOCK *sbPtr, VE
|
|||
|
||||
//Base shift value on strategy block so that the aliens don't keep changing their minds
|
||||
//about which route to take
|
||||
GlobalLinkShift=(((int)sbPtr)&0xffff)>>4;
|
||||
GlobalLinkShift=(((intptr_t)sbPtr)&0xffff)>>4;
|
||||
if (FindBestRoute(¤t_route,waypoints)==0) {
|
||||
/* Yuck! */
|
||||
textprint("Waypoint dropout: no continuous route!\n");
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define UseLocalAssert Yes
|
||||
#include "ourasert.h"
|
||||
|
||||
#include "frontend/avp_menus.h"
|
||||
#include "avp_menus.h"
|
||||
/* Version settings ************************************************/
|
||||
|
||||
/* Constants *******************************************************/
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "psndplat.h"
|
||||
#include "particle.h"
|
||||
#include "sfx.h"
|
||||
#include "fmv.h"
|
||||
#include "version.h"
|
||||
#include "bh_rubberduck.h"
|
||||
#include "bh_marin.h"
|
||||
|
|
|
@ -101,7 +101,7 @@ int predHUDSoundHandle=SOUND_NOACTIVEINDEX;
|
|||
static int HUD_PrimaryRounds;
|
||||
static int HUD_SecondaryRounds;
|
||||
/* numerics buffer - the marine has more digits on his HUD than the other species */
|
||||
char ValueOfHUDDigit[MAX_NO_OF_COMMON_HUD_DIGITS];
|
||||
char ValueOfHUDDigit[MAX_NO_OF_MARINE_HUD_DIGITS];
|
||||
|
||||
|
||||
#define PREDATOR_LOCK_ON_TIME (ONE_FIXED*5/3)
|
||||
|
@ -237,7 +237,7 @@ void InitMarineHUD(void)
|
|||
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<MAX_NO_OF_MARINE_HUD_DIGITS; i++)
|
||||
for (i=0; i<sizeof(ValueOfHUDDigit)/sizeof(ValueOfHUDDigit[0]); i++)
|
||||
ValueOfHUDDigit[i]=0;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,14 +20,31 @@ void* PoolAllocateMem(unsigned int amount)
|
|||
char* retval;
|
||||
|
||||
GLOBALASSERT(amount<=MEMORY_BLOCK_SIZE)
|
||||
if (amount > MEMORY_BLOCK_SIZE)
|
||||
{
|
||||
// fatal error
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// align up
|
||||
amount = (amount + 7) & ~7;
|
||||
|
||||
if(amount>MemoryLeft)
|
||||
{
|
||||
CurrentMemoryBlock++;
|
||||
GLOBALASSERT(CurrentMemoryBlock<MAX_NUM_MEMORY_BLOCK);
|
||||
if (CurrentMemoryBlock >= MAX_NUM_MEMORY_BLOCK)
|
||||
{
|
||||
// fatal error
|
||||
return NULL;
|
||||
}
|
||||
MemoryBlocks[CurrentMemoryBlock]=AllocateMem(MEMORY_BLOCK_SIZE);
|
||||
GLOBALASSERT(MemoryBlocks[CurrentMemoryBlock]);
|
||||
|
||||
GLOBALASSERT(MemoryBlocks[CurrentMemoryBlock]!=NULL);
|
||||
if (MemoryBlocks[CurrentMemoryBlock] == NULL)
|
||||
{
|
||||
// fatal error
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MemoryLeft=MEMORY_BLOCK_SIZE;
|
||||
MemoryPoolPtr=MemoryBlocks[CurrentMemoryBlock];
|
||||
|
|
|
@ -856,7 +856,7 @@ int FindAndLoadWavFile(int soundNum,char* wavFileName)
|
|||
#if LOAD_SOUND_FROM_FAST_FILE
|
||||
//first look in fast file
|
||||
{
|
||||
unsigned nLen;
|
||||
size_t nLen;
|
||||
if(ffreadbuf(sound_name,&nLen))
|
||||
{
|
||||
return LoadWavFromFastFile(soundNum,sound_name);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "game_statistics.h"
|
||||
#include "avp_userprofile.h"
|
||||
#include "huddefs.h"
|
||||
#include "fmv.h"
|
||||
|
||||
#include "savegame.h"
|
||||
#include "huffman.hpp"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "shape.h"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#define UseLocalAssert Yes
|
||||
#include "ourasert.h"
|
||||
#include "frontend/avp_menus.h"
|
||||
#include "avp_menus.h"
|
||||
|
||||
/* Version settings ************************************************/
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ AVP_Generator_Extra_Name_Chunk::AVP_Generator_Extra_Name_Chunk(Chunk_With_Childr
|
|||
|
||||
AVP_Generator_Extra_Name_Chunk::~AVP_Generator_Extra_Name_Chunk()
|
||||
{
|
||||
delete name;
|
||||
delete [] name;
|
||||
}
|
||||
|
||||
void AVP_Generator_Extra_Name_Chunk::fill_data_block(char* data_start)
|
||||
|
@ -292,7 +292,7 @@ AVP_Generator_Extended_Settings_Chunk::AVP_Generator_Extended_Settings_Chunk(Chu
|
|||
AVP_Generator_Extended_Settings_Chunk::AVP_Generator_Extended_Settings_Chunk(Chunk_With_Children* parent)
|
||||
:Chunk(parent,"GENEXSET")
|
||||
{
|
||||
weights=new AVP_Generator_Weighting;
|
||||
weights=(AVP_Generator_Weighting *)new unsigned char[sizeof(AVP_Generator_Weighting)];
|
||||
memset(weights,0,sizeof(AVP_Generator_Weighting));
|
||||
weights->data_size=sizeof(AVP_Generator_Weighting);
|
||||
GenLimit=pad1=pad2=pad3=0;
|
||||
|
@ -303,7 +303,7 @@ AVP_Generator_Extended_Settings_Chunk::AVP_Generator_Extended_Settings_Chunk(Chu
|
|||
|
||||
AVP_Generator_Extended_Settings_Chunk::~AVP_Generator_Extended_Settings_Chunk()
|
||||
{
|
||||
delete weights;
|
||||
delete [] weights;
|
||||
}
|
||||
|
||||
void AVP_Generator_Extended_Settings_Chunk::fill_data_block (char * data)
|
||||
|
@ -580,7 +580,7 @@ AVP_Environment_Settings_Chunk::AVP_Environment_Settings_Chunk(Chunk_With_Childr
|
|||
AVP_Environment_Settings_Chunk::AVP_Environment_Settings_Chunk(Chunk_With_Children* parent)
|
||||
:Chunk(parent,"AVPENVIR")
|
||||
{
|
||||
settings=new AVP_Environment_Settings;
|
||||
settings=(AVP_Environment_Settings*)new unsigned char[sizeof(AVP_Environment_Settings)];
|
||||
settings->data_size=sizeof(AVP_Environment_Settings);
|
||||
settings->sky_colour_red=200;
|
||||
settings->sky_colour_green=200;
|
||||
|
@ -601,7 +601,7 @@ AVP_Environment_Settings_Chunk::AVP_Environment_Settings_Chunk(Chunk_With_Childr
|
|||
|
||||
AVP_Environment_Settings_Chunk::~AVP_Environment_Settings_Chunk()
|
||||
{
|
||||
delete settings;
|
||||
delete [] settings;
|
||||
}
|
||||
|
||||
void AVP_Environment_Settings_Chunk::fill_data_block (char * data_start)
|
||||
|
|
|
@ -114,7 +114,7 @@ FFDataI::FFDataI(char const *_filename, void *_data, size_t _length)
|
|||
|
||||
FFDataI::FFDataI(FFDataI const & ffd, ptrdiff_t offset)
|
||||
: filename(0)
|
||||
, data((void *)((size_t)ffd.data + offset))
|
||||
, data((void *)((intptr_t)ffd.data + offset))
|
||||
, length(ffd.length)
|
||||
{
|
||||
if (ffd.filename)
|
||||
|
@ -212,7 +212,7 @@ FFHeaderI::FFHeaderI(FFHeaderI const & ffh)
|
|||
data = malloc(length);
|
||||
memcpy(data,ffh.data,length);
|
||||
}
|
||||
ptrdiff_t offset = (size_t)data - (size_t)ffh.data;
|
||||
ptrdiff_t offset = (intptr_t)data - (intptr_t)ffh.data;
|
||||
for (int i=0; i<FFHI_HASHTABLESIZE; ++i)
|
||||
{
|
||||
for (CLIF<FFDataI> i_file(&ffh.files[i]); !i_file.done(); i_file.next())
|
||||
|
@ -243,7 +243,7 @@ FFHeaderI & FFHeaderI::operator = (FFHeaderI const & ffh)
|
|||
data = malloc(length);
|
||||
memcpy(data,ffh.data,length);
|
||||
}
|
||||
ptrdiff_t offset = (size_t)data - (size_t)ffh.data;
|
||||
ptrdiff_t offset = (intptr_t)data - (intptr_t)ffh.data;
|
||||
for (int i=0; i<FFHI_HASHTABLESIZE; ++i)
|
||||
{
|
||||
for (CLIF<FFDataI> i_file(&ffh.files[i]); !i_file.done(); i_file.next())
|
||||
|
@ -300,9 +300,10 @@ FFError FFHeaderI::Read(char const *_filename)
|
|||
Clear();
|
||||
|
||||
char magic[4];
|
||||
unsigned long rffl_version;
|
||||
size_t num_files;
|
||||
size_t total_headsize;
|
||||
uint32_t rffl_version;
|
||||
uint32_t num_files;
|
||||
uint32_t total_headsize;
|
||||
uint32_t data_length;
|
||||
|
||||
DWORD bytes_read;
|
||||
|
||||
|
@ -310,8 +311,10 @@ FFError FFHeaderI::Read(char const *_filename)
|
|||
READ_FILE(filename,(void)0,fclose(h),h,&rffl_version,4,bytes_read,0)
|
||||
READ_FILE(filename,(void)0,fclose(h),h,&num_files,4,bytes_read,0)
|
||||
READ_FILE(filename,(void)0,fclose(h),h,&total_headsize,4,bytes_read,0)
|
||||
READ_FILE(filename,(void)0,fclose(h),h,&length,4,bytes_read,0)
|
||||
|
||||
READ_FILE(filename,(void)0,fclose(h),h,&data_length,4,bytes_read,0)
|
||||
|
||||
length = data_length;
|
||||
|
||||
if (strncmp(magic,"RFFL",4))
|
||||
{
|
||||
ReportError(filename,"Incorrect file type");
|
||||
|
@ -341,14 +344,14 @@ FFError FFHeaderI::Read(char const *_filename)
|
|||
|
||||
for (unsigned int i=0; i<num_files; ++i)
|
||||
{
|
||||
char const * fnameP = (char *)((size_t)headerP + 8);
|
||||
size_t leng = *(size_t *)((size_t)headerP + 4);
|
||||
void * dataP = (void *)((size_t)data + *(size_t *)headerP);
|
||||
char const * fnameP = (char *)((intptr_t)headerP + 8);
|
||||
uint32_t leng = *(uint32_t *)((intptr_t)headerP + 4);
|
||||
void * dataP = (void *)((intptr_t)data + *(uint32_t *)headerP);
|
||||
|
||||
files[HashFunction(fnameP)].add_entry(FFDataI(fnameP,dataP,leng));
|
||||
|
||||
// increment pointer
|
||||
headerP = (void *)((size_t)headerP + 8 + strlen(fnameP) +4&~3);
|
||||
headerP = (void *)(((intptr_t)headerP + 8 + strlen(fnameP) +4)&~3);
|
||||
}
|
||||
|
||||
free(header);
|
||||
|
|
|
@ -7,7 +7,7 @@ extern "C"
|
|||
#include "avp_menus.h"
|
||||
#include "avp_intro.h"
|
||||
extern int NormalFrameTime;
|
||||
extern int GotAnyKey;
|
||||
extern unsigned char GotAnyKey;
|
||||
extern int DebouncedGotAnyKey;
|
||||
extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock;
|
||||
extern AVPMENUGFX AvPMenuGfxStorage[];
|
||||
|
|
|
@ -6,6 +6,7 @@ extern "C"
|
|||
{
|
||||
#endif
|
||||
void PlayMenuMusic(void);
|
||||
void EndMenuMusic(void);
|
||||
void PlayIntroSequence(void);
|
||||
void WeWantAnIntro(void);
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -30,10 +30,13 @@
|
|||
#include "game.h"
|
||||
#include "avp_menugfx.hpp"
|
||||
#include "avp_intro.h"
|
||||
#include "fmv.h"
|
||||
|
||||
/* used to get file time */
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
int SelectDirectDrawObject(void *pGUID);
|
||||
|
||||
extern void StartMenuBackgroundBink(void);
|
||||
extern int PlayMenuBackgroundBink(void);
|
||||
|
@ -45,10 +48,15 @@ extern void EndMenuBackgroundBink(void);
|
|||
extern int IDemandSelect(void);
|
||||
|
||||
extern char *GetVideoModeDescription(void);
|
||||
extern char *GetVideoModeDescription2(void);
|
||||
extern char *GetVideoModeDescription3(void);
|
||||
extern void PreviousVideoMode(void);
|
||||
extern void PreviousVideoMode2(void);
|
||||
extern void NextVideoMode(void);
|
||||
extern void NextVideoMode2(void);
|
||||
extern void SaveVideoModeSettings(void);
|
||||
|
||||
extern void LoadDeviceAndVideoModePreferences(void);
|
||||
extern void SaveDeviceAndVideoModePreferences(void);
|
||||
|
||||
extern void MakeSelectSessionMenu(void);
|
||||
|
||||
|
@ -665,11 +673,12 @@ extern void AvP_UpdateMenus(void)
|
|||
{
|
||||
int i;
|
||||
AVP_USER_PROFILE *profilePtr = GetFirstUserProfile();
|
||||
time_t FileTime = profilePtr->FileTime;
|
||||
for (i=0; i<UserProfileNumber; i++)
|
||||
profilePtr = GetNextUserProfile();
|
||||
|
||||
RenderMenuText(profilePtr->Name,MENU_CENTREX,MENU_CENTREY-100,ONE_FIXED,AVPMENUFORMAT_CENTREJUSTIFIED);
|
||||
RenderSmallMenuText(ctime(&profilePtr->FileTime),MENU_CENTREX,MENU_CENTREY-70,ONE_FIXED,AVPMENUFORMAT_CENTREJUSTIFIED);
|
||||
RenderSmallMenuText(ctime(&FileTime),MENU_CENTREX,MENU_CENTREY-70,ONE_FIXED,AVPMENUFORMAT_CENTREJUSTIFIED);
|
||||
|
||||
RenderMenu();
|
||||
RenderHelpString();
|
||||
|
@ -1727,6 +1736,7 @@ static void RenderUserProfileSelectMenu(void)
|
|||
if (y>=-150 && y<=150)
|
||||
{
|
||||
char *textPtr = profilePtr->Name;
|
||||
time_t FileTime = profilePtr->FileTime;
|
||||
int b;
|
||||
int targetBrightness;
|
||||
|
||||
|
@ -1758,7 +1768,7 @@ static void RenderUserProfileSelectMenu(void)
|
|||
b=Brightness[i];
|
||||
RenderMenuText_Clipped(textPtr,MENU_CENTREX,MENU_CENTREY+y-60,b,AVPMENUFORMAT_CENTREJUSTIFIED,MENU_CENTREY-60-100,MENU_CENTREY-30+150);
|
||||
if (i > 0)
|
||||
RenderSmallMenuText(ctime(&profilePtr->FileTime),MENU_CENTREX,MENU_CENTREY+y-30,b,AVPMENUFORMAT_CENTREJUSTIFIED);
|
||||
RenderSmallMenuText(ctime(&FileTime),MENU_CENTREX,MENU_CENTREY+y-30,b,AVPMENUFORMAT_CENTREJUSTIFIED);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,9 +69,10 @@ typedef struct
|
|||
{
|
||||
char Name[MAX_SIZE_OF_USERS_NAME+1];
|
||||
|
||||
time_t FileTime;
|
||||
// SBF: 32-bit time_t
|
||||
uint32_t FileTime;
|
||||
|
||||
// used to be an incomplete SYSTEMTIME struct, TimeLastUpdated
|
||||
// SBF: used to be an incomplete SYSTEMTIME struct, TimeLastUpdated
|
||||
int unused[6];
|
||||
|
||||
/* KJL 15:14:12 10/12/98 - array to hold level completion data
|
||||
|
|
|
@ -292,6 +292,10 @@ TeletypeDaemon :: TeletypeDaemon
|
|||
{
|
||||
GLOBALASSERT( pTeletypeGadg );
|
||||
|
||||
#if SupportTeletypeSound
|
||||
SoundHandle = SOUND_NOACTIVEINDEX;
|
||||
#endif
|
||||
|
||||
pTeletypeGadg_Val = pTeletypeGadg;
|
||||
|
||||
fFinished_Val = No;
|
||||
|
|
|
@ -45,8 +45,8 @@ AVP_Path_Chunk::AVP_Path_Chunk(Chunk_With_Children* parent,const char* data,size
|
|||
|
||||
AVP_Path_Chunk::~AVP_Path_Chunk()
|
||||
{
|
||||
if(PathName) delete PathName;
|
||||
if(Path) delete Path;
|
||||
if(PathName) delete [] PathName;
|
||||
if(Path) delete [] Path;
|
||||
}
|
||||
|
||||
void AVP_Path_Chunk::fill_data_block(char* data_start)
|
||||
|
|
|
@ -360,7 +360,7 @@ Virtual_Object_Properties_Chunk::Virtual_Object_Properties_Chunk(Chunk_With_Chil
|
|||
|
||||
Virtual_Object_Properties_Chunk::~Virtual_Object_Properties_Chunk()
|
||||
{
|
||||
if(name)delete name;
|
||||
if(name)delete [] name;
|
||||
}
|
||||
|
||||
size_t Virtual_Object_Properties_Chunk::size_chunk()
|
||||
|
@ -1046,8 +1046,8 @@ MultiSwitchStrategy::MultiSwitchStrategy(const char* data_start,size_t /*size*/)
|
|||
|
||||
MultiSwitchStrategy::~MultiSwitchStrategy()
|
||||
{
|
||||
if(Targets)delete Targets;
|
||||
if(LinkedSwitches)delete LinkedSwitches;
|
||||
if(Targets)delete [] Targets;
|
||||
if(LinkedSwitches)delete [] LinkedSwitches;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1523,7 +1523,7 @@ TrackStrategy::~TrackStrategy()
|
|||
delete point_effects[i];
|
||||
}
|
||||
if(point_effects)
|
||||
delete point_effects;
|
||||
delete [] point_effects;
|
||||
}
|
||||
|
||||
size_t TrackStrategy::GetStrategySize()
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "huddefs.h"
|
||||
#include "hud.h"
|
||||
//#include "hudgfx.h"
|
||||
#include "fmv.h"
|
||||
#include "font.h"
|
||||
#include "bh_gener.h"
|
||||
#include "pvisible.h"
|
||||
|
|
|
@ -8,14 +8,15 @@
|
|||
#include "win95/cd_player.h"
|
||||
#include "cdplayer.h"
|
||||
|
||||
/* cd_player.cpp */
|
||||
int CDPlayerVolume;
|
||||
|
||||
#if SDL_MAJOR_VERSION < 2
|
||||
static int HaveCDROM = 0;
|
||||
static SDL_CD *cdrom = NULL;
|
||||
|
||||
/* ** */
|
||||
|
||||
/* cd_player.cpp */
|
||||
int CDPlayerVolume;
|
||||
|
||||
void CheckCDVolume()
|
||||
{
|
||||
/*
|
||||
|
@ -155,3 +156,58 @@ void CDDA_SwitchOn()
|
|||
fprintf(stderr, "CDDA_SwitchOn()\n");
|
||||
*/
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// What's a CD?
|
||||
|
||||
void CheckCDVolume()
|
||||
{
|
||||
}
|
||||
|
||||
/* ** */
|
||||
|
||||
void CDDA_Start()
|
||||
{
|
||||
}
|
||||
|
||||
void CDDA_End()
|
||||
{
|
||||
}
|
||||
|
||||
void CDDA_ChangeVolume(int volume)
|
||||
{
|
||||
}
|
||||
|
||||
int CDDA_CheckNumberOfTracks()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CDDA_IsOn()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CDDA_IsPlaying()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CDDA_Play(int CDDATrack)
|
||||
{
|
||||
}
|
||||
|
||||
void CDDA_PlayLoop(int CDDATrack)
|
||||
{
|
||||
}
|
||||
|
||||
void CDDA_Stop()
|
||||
{
|
||||
}
|
||||
|
||||
void CDDA_SwitchOn()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <mbstring.h>
|
||||
#include <inttypes.h>
|
||||
#define Yes 1 // sigh
|
||||
#define No 0 // sigh
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "fmv.h"
|
||||
#include "avp_menus.h"
|
||||
#include "avp_userprofile.h"
|
||||
#include "oglfunc.h"
|
||||
#include "oglfunc.h" // move this into opengl.c
|
||||
|
||||
#define UseLocalAssert 1
|
||||
#include "ourasert.h"
|
||||
|
@ -332,6 +332,7 @@ void UpdateFMVTexture(FMVTEXTURE *ftPtr)
|
|||
dstPtr += 3;
|
||||
} while(--pixels);
|
||||
|
||||
//#warning move this into opengl.c
|
||||
// update the opengl texture
|
||||
pglBindTexture(GL_TEXTURE_2D, ftPtr->ImagePtr->D3DTexture->id);
|
||||
|
||||
|
|
|
@ -39,4 +39,6 @@ void UpdateAllFMVTextures(void);
|
|||
void ScanImagesForFMVs(void);
|
||||
void ReleaseAllFMVTextures(void);
|
||||
|
||||
void PlayBinkedFMV(char *filenamePtr);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -890,7 +890,7 @@ typedef struct txanimframe {
|
|||
int txf_orienty;
|
||||
int txf_numuvs;
|
||||
int *txf_uvdata;
|
||||
int txf_image;
|
||||
intptr_t txf_image; // SBF: 64HACK - needed to match TXANIMFRAME_MVS
|
||||
|
||||
} TXANIMFRAME;
|
||||
|
||||
|
|
|
@ -3015,8 +3015,11 @@ void CreateTxAnimUVArray(int *txa_data, int *uv_array, int *shapeitemptr)
|
|||
|
||||
/* The sequence # will have been copied across by the control block */
|
||||
|
||||
sequence = *txa_data++;
|
||||
|
||||
sequence = *txa_data;
|
||||
|
||||
// SBF: 64HACK - skip over the rest of the int*
|
||||
txa_data = (int *)((intptr_t) txa_data + sizeof(int *));
|
||||
|
||||
#if 0
|
||||
textprint("sequence = %d\n", sequence);
|
||||
#endif
|
||||
|
@ -4027,7 +4030,7 @@ void AddShape(DISPLAYBLOCK *dptr, VIEWDESCRIPTORBLOCK *VDB_Ptr)
|
|||
{
|
||||
if (dptr->ObStrategyBlock->I_SBtype==I_BehaviourInanimateObject)
|
||||
{
|
||||
INANIMATEOBJECT_STATUSBLOCK* objStatPtr = dptr->ObStrategyBlock->SBdataptr;
|
||||
INANIMATEOBJECT_STATUSBLOCK* objStatPtr = (INANIMATEOBJECT_STATUSBLOCK*) dptr->ObStrategyBlock->SBdataptr;
|
||||
if(objStatPtr->typeId==IOT_FieldCharge)
|
||||
{
|
||||
|
||||
|
|
24
src/main.c
24
src/main.c
|
@ -246,12 +246,17 @@ typedef struct VideoModeStruct
|
|||
VideoModeStruct VideoModeList[] = {
|
||||
{ 512, 384, 0 },
|
||||
{ 640, 480, 0 },
|
||||
{ 720, 480, 0 },
|
||||
{ 800, 600, 0 },
|
||||
{ 1024, 768, 0 },
|
||||
{ 1152, 864, 0 },
|
||||
{ 1280, 960, 0, },
|
||||
{ 1280, 720, 0 },
|
||||
{ 1280, 768, 0 },
|
||||
{ 1280, 960, 0 },
|
||||
{ 1280, 1024, 0 },
|
||||
{ 1600, 1200, 0 }
|
||||
{ 1600, 1200, 0 },
|
||||
{ 1920, 1080, 0 },
|
||||
{ 1920, 1200, 0 }
|
||||
};
|
||||
|
||||
int CurrentVideoMode;
|
||||
|
@ -361,7 +366,8 @@ int InitSDL()
|
|||
|
||||
atexit(SDL_Quit);
|
||||
|
||||
SDL_AvailableVideoModes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_OPENGL);
|
||||
// needs to be cleaned up; SDL_VideoModeOK and SDL_ListModes aren't compatible
|
||||
SDL_AvailableVideoModes = (SDL_Rect **)-1; //SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_OPENGL);
|
||||
if (SDL_AvailableVideoModes == NULL)
|
||||
return -1;
|
||||
|
||||
|
@ -544,7 +550,6 @@ int SetOGLVideoMode(int Width, int Height)
|
|||
{
|
||||
SDL_GrabMode isgrab;
|
||||
int flags;
|
||||
char *ext;
|
||||
|
||||
ScanDrawMode = ScanDrawD3DHardwareRGB;
|
||||
GotMouse = 1;
|
||||
|
@ -580,7 +585,12 @@ int SetOGLVideoMode(int Width, int Height)
|
|||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||
|
||||
|
||||
// These should be configurable video options.
|
||||
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
||||
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
||||
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
|
||||
|
||||
if ((surface = SDL_SetVideoMode(Width, Height, 0, flags)) == NULL) {
|
||||
fprintf(stderr, "(OpenGL) SDL SetVideoMode failed: %s\n", SDL_GetError());
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -624,8 +634,6 @@ int SetOGLVideoMode(int Width, int Height)
|
|||
|
||||
pglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
pglHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
||||
|
||||
ScreenDescriptorBlock.SDB_Width = Width;
|
||||
ScreenDescriptorBlock.SDB_Height = Height;
|
||||
ScreenDescriptorBlock.SDB_CentreX = Width/2;
|
||||
|
@ -637,8 +645,6 @@ int SetOGLVideoMode(int Width, int Height)
|
|||
ScreenDescriptorBlock.SDB_ClipUp = 0;
|
||||
ScreenDescriptorBlock.SDB_ClipDown = Height;
|
||||
|
||||
ext = (char *) pglGetString(GL_EXTENSIONS);
|
||||
|
||||
load_ogl_functions(1);
|
||||
|
||||
InitOpenGL();
|
||||
|
|
1561
src/main2.c
Normal file
1561
src/main2.c
Normal file
File diff suppressed because it is too large
Load diff
22
src/maths.c
22
src/maths.c
|
@ -2311,7 +2311,7 @@ dx = 0; /* TODO: uninitialized?? */
|
|||
#define DEG_3 31
|
||||
#define SEP_3 3
|
||||
|
||||
static long table [DEG_3] =
|
||||
static int32_t table [DEG_3] =
|
||||
{
|
||||
-851904987, -43806228, -2029755270, 1390239686, -1912102820,
|
||||
-485608943, 1969813258, -1590463333, -1944053249, 455935928,
|
||||
|
@ -2324,8 +2324,8 @@ static long table [DEG_3] =
|
|||
|
||||
#define TABLE_END (table + sizeof (table) / sizeof (table [0]))
|
||||
|
||||
static long * front_ptr = table + SEP_3;
|
||||
static long * rear_ptr = table;
|
||||
static int32_t * front_ptr = table + SEP_3;
|
||||
static int32_t * rear_ptr = table;
|
||||
|
||||
|
||||
void SetSeededFastRandom(int seed);
|
||||
|
@ -2359,7 +2359,7 @@ int FastRandom(void)
|
|||
|
||||
{
|
||||
|
||||
long i;
|
||||
int32_t i;
|
||||
|
||||
/*
|
||||
|
||||
|
@ -2370,7 +2370,7 @@ int FastRandom(void)
|
|||
*/
|
||||
|
||||
*front_ptr += *rear_ptr;
|
||||
i = (long) ((unsigned long) *front_ptr >> 1);
|
||||
i = (int32_t) ((uint32_t) *front_ptr >> 1);
|
||||
|
||||
/* `front_ptr' and `rear_ptr' can't wrap at the same time. */
|
||||
|
||||
|
@ -2402,12 +2402,12 @@ int FastRandom(void)
|
|||
#define SEEDED_DEG_3 13
|
||||
#define SEEDED_SEP_3 3
|
||||
|
||||
static long seeded_table [SEEDED_DEG_3];
|
||||
static int32_t seeded_table [SEEDED_DEG_3];
|
||||
|
||||
#define SEEDED_TABLE_END (seeded_table + sizeof (seeded_table) / sizeof (seeded_table [0]))
|
||||
|
||||
static long * seeded_front_ptr = seeded_table + SEEDED_SEP_3;
|
||||
static long * seeded_rear_ptr = seeded_table;
|
||||
static int32_t * seeded_front_ptr = seeded_table + SEEDED_SEP_3;
|
||||
static int32_t * seeded_rear_ptr = seeded_table;
|
||||
|
||||
|
||||
|
||||
|
@ -2415,7 +2415,7 @@ int SeededFastRandom(void)
|
|||
|
||||
{
|
||||
|
||||
long i;
|
||||
int32_t i;
|
||||
|
||||
/*
|
||||
|
||||
|
@ -2426,7 +2426,7 @@ int SeededFastRandom(void)
|
|||
*/
|
||||
|
||||
*seeded_front_ptr += *seeded_rear_ptr;
|
||||
i = (long) ((unsigned long) *seeded_front_ptr >> 1);
|
||||
i = (int32_t) ((uint32_t) *seeded_front_ptr >> 1);
|
||||
|
||||
/* `front_ptr' and `rear_ptr' can't wrap at the same time. */
|
||||
|
||||
|
@ -2458,7 +2458,7 @@ void SetSeededFastRandom(int seed)
|
|||
{
|
||||
|
||||
int i;
|
||||
long number = seed;
|
||||
int32_t number = seed;
|
||||
|
||||
|
||||
for(i = 0; i < SEEDED_DEG_3; ++i) {
|
||||
|
|
|
@ -142,7 +142,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx)
|
|||
|
||||
byteSwap(ctx->buf, 4);
|
||||
memcpy(digest, ctx->buf, 16);
|
||||
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
|
||||
memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
|
||||
}
|
||||
|
||||
#ifndef ASM_MD5
|
||||
|
|
|
@ -290,7 +290,7 @@ static void LoadMenuFont()
|
|||
{
|
||||
AVPMENUGFX *gfxPtr;
|
||||
char buffer[100];
|
||||
unsigned int fastFileLength;
|
||||
size_t fastFileLength;
|
||||
void const *pFastFileData;
|
||||
|
||||
IntroFont_Light.height = 33;
|
||||
|
@ -1050,7 +1050,7 @@ void LoadAvPMenuGfx(enum AVPMENUGFX_ID menuGfxID)
|
|||
{
|
||||
AVPMENUGFX *gfxPtr;
|
||||
char buffer[100];
|
||||
unsigned int fastFileLength;
|
||||
size_t fastFileLength;
|
||||
void const *pFastFileData;
|
||||
|
||||
GLOBALASSERT(menuGfxID < MAX_NO_OF_AVPMENUGFXS);
|
||||
|
|
|
@ -643,7 +643,7 @@ int GetModuleVisArrays(void)
|
|||
ModuleArraySize = index + 1;
|
||||
|
||||
|
||||
ModuleCurrVisArray = AllocateMem(ModuleArraySize);
|
||||
ModuleCurrVisArray = (char*) AllocateMem(ModuleArraySize);
|
||||
|
||||
if(ModuleCurrVisArray)
|
||||
{
|
||||
|
|
|
@ -42,6 +42,7 @@ PFNGLGETERRORPROC pglGetError;
|
|||
PFNGLGETFLOATVPROC pglGetFloatv;
|
||||
PFNGLGETINTEGERVPROC pglGetIntegerv;
|
||||
PFNGLGETSTRINGPROC pglGetString;
|
||||
PFNGLGETTEXPARAMETERFVPROC pglGetTexParameterfv;
|
||||
PFNGLHINTPROC pglHint;
|
||||
PFNGLLOADIDENTITYPROC pglLoadIdentity;
|
||||
PFNGLLOADMATRIXFPROC pglLoadMatrixf;
|
||||
|
@ -100,11 +101,15 @@ PFNGLSECONDARYCOLOR3UBEXTPROC pglSecondaryColor3ubEXT;
|
|||
PFNGLSECONDARYCOLOR3UBVEXTPROC pglSecondaryColor3ubvEXT;
|
||||
PFNGLSECONDARYCOLORPOINTEREXTPROC pglSecondaryColorPointerEXT;
|
||||
|
||||
int ogl_have_multisample_filter_hint;
|
||||
int ogl_have_paletted_texture;
|
||||
int ogl_have_secondary_color;
|
||||
int ogl_have_texture_filter_anisotropic;
|
||||
|
||||
int ogl_use_multisample_filter_hint;
|
||||
int ogl_use_paletted_texture;
|
||||
int ogl_use_secondary_color;
|
||||
int ogl_use_texture_filter_anisotropic;
|
||||
|
||||
static void dummyfunc()
|
||||
{
|
||||
|
@ -183,6 +188,7 @@ void load_ogl_functions(int mode)
|
|||
LoadOGLProc(PFNGLGETFLOATVPROC, glGetFloatv);
|
||||
LoadOGLProc(PFNGLGETINTEGERVPROC, glGetIntegerv);
|
||||
LoadOGLProc(PFNGLGETSTRINGPROC, glGetString);
|
||||
LoadOGLProc(PFNGLGETTEXPARAMETERFVPROC, glGetTexParameterfv);
|
||||
LoadOGLProc(PFNGLHINTPROC, glHint);
|
||||
LoadOGLProc(PFNGLLOADIDENTITYPROC, glLoadIdentity);
|
||||
LoadOGLProc(PFNGLLOADMATRIXFPROC, glLoadMatrixf);
|
||||
|
@ -247,8 +253,10 @@ void load_ogl_functions(int mode)
|
|||
|
||||
ext = (const char *) pglGetString(GL_EXTENSIONS);
|
||||
|
||||
ogl_have_multisample_filter_hint = check_token(ext, "GL_NV_multisample_filter_hint");
|
||||
ogl_have_paletted_texture = check_token(ext, "GL_EXT_paletted_texture");
|
||||
ogl_have_secondary_color = check_token(ext, "GL_EXT_secondary_color");
|
||||
ogl_have_texture_filter_anisotropic = check_token(ext, "GL_EXT_texture_filter_anisotropic");
|
||||
|
||||
#ifndef GL_COLOR_TABLE_WIDTH_EXT
|
||||
#define GL_COLOR_TABLE_WIDTH_EXT GL_COLOR_TABLE_WIDTH
|
||||
|
@ -287,11 +295,20 @@ void load_ogl_functions(int mode)
|
|||
ogl_have_secondary_color = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ogl_use_multisample_filter_hint = ogl_have_multisample_filter_hint;
|
||||
ogl_use_paletted_texture = ogl_have_paletted_texture;
|
||||
ogl_use_secondary_color = ogl_have_secondary_color;
|
||||
|
||||
// fprintf(stderr, "RENDER DEBUG: pal:%d sec:%d\n", ogl_use_paletted_texture, ogl_use_secondary_color);
|
||||
ogl_use_texture_filter_anisotropic = ogl_have_texture_filter_anisotropic;
|
||||
|
||||
#if 0
|
||||
fprintf(stderr, "RENDER DEBUG: pal:%d sec:%d mfh:%d tfa:%d\n",
|
||||
ogl_use_paletted_texture,
|
||||
ogl_use_secondary_color,
|
||||
ogl_use_multisample_filter_hint,
|
||||
ogl_use_texture_filter_anisotropic
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
int check_for_errors(const char *file, int line)
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include "SDL_opengl.h"
|
||||
//#include <GL/gl.h>
|
||||
//#include <GL/glext.h>
|
||||
|
||||
typedef void (APIENTRY *PFNGLALPHAFUNCPROC)(GLenum, GLclampf);
|
||||
|
@ -45,6 +46,7 @@ typedef GLenum (APIENTRY *PFNGLGETERRORPROC)(void);
|
|||
typedef void (APIENTRY *PFNGLGETFLOATVPROC)(GLenum, GLfloat *);
|
||||
typedef void (APIENTRY *PFNGLGETINTEGERVPROC)(GLenum, GLint *);
|
||||
typedef const GLubyte* (APIENTRY *PFNGLGETSTRINGPROC)(GLenum);
|
||||
typedef void (APIENTRY *PFNGLGETTEXPARAMETERFVPROC)(GLenum, GLenum, GLfloat*);
|
||||
typedef void (APIENTRY *PFNGLHINTPROC)(GLenum, GLenum);
|
||||
typedef void (APIENTRY *PFNGLLOADIDENTITYPROC)(void);
|
||||
typedef void (APIENTRY *PFNGLLOADMATRIXFPROC)(const GLfloat *);
|
||||
|
@ -119,6 +121,8 @@ typedef void (APIENTRY * PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v);
|
|||
typedef void (APIENTRY * PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
#endif
|
||||
|
||||
typedef void (APIENTRY *PFNGLXSWAPINTERVALSGIPROC)(int interval);
|
||||
|
||||
extern PFNGLALPHAFUNCPROC pglAlphaFunc;
|
||||
extern PFNGLARRAYELEMENTPROC pglArrayElement;
|
||||
extern PFNGLBEGINPROC pglBegin;
|
||||
|
@ -156,6 +160,7 @@ extern PFNGLGETERRORPROC pglGetError;
|
|||
extern PFNGLGETFLOATVPROC pglGetFloatv;
|
||||
extern PFNGLGETINTEGERVPROC pglGetIntegerv;
|
||||
extern PFNGLGETSTRINGPROC pglGetString;
|
||||
extern PFNGLGETTEXPARAMETERFVPROC pglGetTexParameterfv;
|
||||
extern PFNGLHINTPROC pglHint;
|
||||
extern PFNGLLOADIDENTITYPROC pglLoadIdentity;
|
||||
extern PFNGLLOADMATRIXFPROC pglLoadMatrixf;
|
||||
|
@ -214,11 +219,15 @@ extern PFNGLSECONDARYCOLOR3UBEXTPROC pglSecondaryColor3ubEXT;
|
|||
extern PFNGLSECONDARYCOLOR3UBVEXTPROC pglSecondaryColor3ubvEXT;
|
||||
extern PFNGLSECONDARYCOLORPOINTEREXTPROC pglSecondaryColorPointerEXT;
|
||||
|
||||
extern int ogl_have_multisample_filter_hint;
|
||||
extern int ogl_have_paletted_texture;
|
||||
extern int ogl_have_secondary_color;
|
||||
extern int ogl_have_texture_filter_anisotropic;
|
||||
|
||||
extern int ogl_use_multisample_filter_hint;
|
||||
extern int ogl_use_paletted_texture;
|
||||
extern int ogl_use_secondary_color;
|
||||
extern int ogl_use_texture_filter_anisotropic;
|
||||
|
||||
extern void load_ogl_functions(int mode);
|
||||
extern int check_for_errors(const char *file, int line);
|
||||
|
|
15
src/openal.c
15
src/openal.c
|
@ -3,8 +3,8 @@
|
|||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#include "al.h"
|
||||
#include "alc.h"
|
||||
|
||||
#include "fixer.h"
|
||||
|
||||
|
@ -23,6 +23,10 @@
|
|||
#include <AL/eax.h>
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#define OPENAL_DEBUG
|
||||
#endif
|
||||
|
||||
ACTIVESOUNDSAMPLE ActiveSounds[SOUND_MAXACTIVE];
|
||||
ACTIVESOUNDSAMPLE BlankActiveSound = {SID_NOSOUND,ASP_Minimum,0,0,NULL,0,0,0,0,0, { {0,0,0},{0,0,0},0,0 }, 0, 0, { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 }, NULL, NULL, NULL};
|
||||
SOUNDSAMPLEDATA BlankGameSound = {0,0,0,0,0,NULL,0,0,NULL,0};
|
||||
|
@ -563,6 +567,7 @@ int PlatPlaySound(int activeIndex)
|
|||
|
||||
if (ActiveSounds[activeIndex].threedee) {
|
||||
alSourcei(ActiveSounds[activeIndex].ds3DBufferP, AL_SOURCE_RELATIVE, AL_FALSE);
|
||||
alSourcef(ActiveSounds[activeIndex].ds3DBufferP, AL_REFERENCE_DISTANCE, ActiveSounds[activeIndex].threedeedata.inner_range);
|
||||
|
||||
// TODO: min distance ActiveSounds[activeIndex].threedeedata.inner_range?
|
||||
// TODO: max distance DS3D_DEFAULTMAXDISTANCE?
|
||||
|
@ -865,7 +870,9 @@ void PlatUpdatePlayer()
|
|||
or[5] = -(float) ((Global_VDB_Ptr->VDB_Mat.mat32) / 65536.0F);
|
||||
}
|
||||
|
||||
if ((AvP.PlayerType == I_Alien && DopplerShiftIsOn && NormalFrameTime)) {
|
||||
#warning VELOCITY AND/OR OPENAL SETUP IS IN WRONG UNITS
|
||||
static int useVel = 0;
|
||||
if (useVel!=0&&(AvP.PlayerType == I_Alien && DopplerShiftIsOn && NormalFrameTime)) {
|
||||
DYNAMICSBLOCK *dynPtr = Player->ObStrategyBlock->DynPtr;
|
||||
float invFrameTime = 100000.0f/(float)NormalFrameTime;
|
||||
|
||||
|
@ -883,7 +890,7 @@ void PlatUpdatePlayer()
|
|||
pos[2] = Global_VDB_Ptr->VDB_World.vz; // 10000.0;
|
||||
|
||||
#ifdef OPENAL_DEBUG
|
||||
fprintf(stderr, "OPENAL: Player: (%f, %f, %f) (%f, %f, %f %f, %f, %f)\n", pos[0], pos[1], pos[2], or[0], or[1], or[2], or[3], or[4], or[5]);
|
||||
fprintf(stderr, "OPENAL: Player: (%f, %f, %f) (%f, %f, %f %f, %f, %f) (%f, %f, %f)\n", pos[0], pos[1], pos[2], or[0], or[1], or[2], or[3], or[4], or[5], vel[0], vel[1], vel[2]);
|
||||
#endif
|
||||
|
||||
pos[0] = 0.0f;
|
||||
|
|
76
src/opengl.c
76
src/opengl.c
|
@ -54,10 +54,6 @@ static D3DTexture *CurrentlyBoundTexture = NULL;
|
|||
#define TA_MAXVERTICES 2048
|
||||
#define TA_MAXTRIANGLES 2048
|
||||
|
||||
#if GL_EXT_secondary_color
|
||||
extern PFNGLSECONDARYCOLORPOINTEREXTPROC pglSecondaryColorPointerEXT;
|
||||
#endif
|
||||
|
||||
typedef struct VertexArray
|
||||
{
|
||||
GLfloat v[4];
|
||||
|
@ -69,9 +65,9 @@ typedef struct VertexArray
|
|||
|
||||
typedef struct TriangleArray
|
||||
{
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
unsigned short a;
|
||||
unsigned short b;
|
||||
unsigned short c;
|
||||
} TriangleArray;
|
||||
|
||||
static VertexArray varr[TA_MAXVERTICES*2];
|
||||
|
@ -132,6 +128,14 @@ A few things:
|
|||
|
||||
void InitOpenGL()
|
||||
{
|
||||
pglHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
|
||||
pglHint( GL_GENERATE_MIPMAP_HINT, GL_NICEST );
|
||||
|
||||
if ( ogl_use_multisample_filter_hint )
|
||||
{
|
||||
pglHint( GL_MULTISAMPLE_FILTER_HINT_NV, GL_NICEST );
|
||||
}
|
||||
|
||||
CurrentTranslucencyMode = TRANSLUCENCY_OFF;
|
||||
pglBlendFunc(GL_ONE, GL_ZERO);
|
||||
|
||||
|
@ -155,12 +159,12 @@ void InitOpenGL()
|
|||
|
||||
#if 0
|
||||
#if GL_EXT_secondary_color
|
||||
if (useseparate) {
|
||||
pglEnableClientState(GL_SEPARATE_COLOR_ARRAY_EXT);
|
||||
pglSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, sizeof(svarr[0]), svarr[0].c);
|
||||
} else {
|
||||
pglDisableClientState(GL_SEPARATE_COLOR_ARRAY_EXT);
|
||||
}
|
||||
if (ogl_use_secondary_color) {
|
||||
pglEnableClientState(GL_SEPARATE_COLOR_ARRAY_EXT);
|
||||
pglSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, sizeof(svarr[0]), svarr[0].c);
|
||||
} else {
|
||||
pglDisableClientState(GL_SEPARATE_COLOR_ARRAY_EXT);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -179,20 +183,8 @@ void InitOpenGL()
|
|||
|
||||
static void FlushTriangleBuffers(int backup)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (tarrc) {
|
||||
#if 1
|
||||
pglBegin(GL_TRIANGLES);
|
||||
for (i = 0; i < tarrc; i++) {
|
||||
pglArrayElement(tarr[i].a);
|
||||
pglArrayElement(tarr[i].b);
|
||||
pglArrayElement(tarr[i].c);
|
||||
}
|
||||
pglEnd();
|
||||
#else
|
||||
pglDrawElements(GL_TRIANGLES, tarrc*3, GL_UNSIGNED_INT, tarr);
|
||||
#endif
|
||||
pglDrawElements(GL_TRIANGLES, tarrc*3, GL_UNSIGNED_SHORT, tarr);
|
||||
|
||||
tarrc = 0;
|
||||
tarrp = tarr;
|
||||
|
@ -217,17 +209,7 @@ static void FlushTriangleBuffers(int backup)
|
|||
|
||||
pglDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
#if 1
|
||||
pglBegin(GL_TRIANGLES);
|
||||
for (i = 0; i < starrc; i++) {
|
||||
pglArrayElement(starr[i].a);
|
||||
pglArrayElement(starr[i].b);
|
||||
pglArrayElement(starr[i].c);
|
||||
}
|
||||
pglEnd();
|
||||
#else
|
||||
pglDrawElements(GL_TRIANGLES, starrc*3, GL_UNSIGNED_INT, starr);
|
||||
#endif
|
||||
pglDrawElements(GL_TRIANGLES, starrc*3, GL_UNSIGNED_SHORT, starr);
|
||||
|
||||
pglEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
|
@ -339,7 +321,7 @@ static void CheckTriangleBuffer(int rver, int sver, int rtri, int stri, D3DTextu
|
|||
FlushTriangleBuffers(0);
|
||||
}
|
||||
|
||||
if ((int)tex != -1)
|
||||
if ((intptr_t)tex != -1)
|
||||
CheckBoundTextureIsCorrect(tex);
|
||||
if (mode != -1)
|
||||
CheckTranslucencyModeIsCorrect(mode);
|
||||
|
@ -450,17 +432,20 @@ static void SelectPolygonBeginType(int points)
|
|||
GLuint CreateOGLTexture(D3DTexture *tex, unsigned char *buf)
|
||||
{
|
||||
GLuint h;
|
||||
GLfloat max_anisotropy;
|
||||
|
||||
FlushTriangleBuffers(1);
|
||||
|
||||
pglGenTextures(1, &h);
|
||||
|
||||
pglBindTexture(GL_TEXTURE_2D, h);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
|
||||
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
|
||||
pglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex->w, tex->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf);
|
||||
|
||||
|
@ -469,8 +454,17 @@ GLuint CreateOGLTexture(D3DTexture *tex, unsigned char *buf)
|
|||
tex->id = h;
|
||||
tex->filter = FILTERING_BILINEAR_ON;
|
||||
|
||||
if (CurrentlyBoundTexture)
|
||||
pglBindTexture(GL_TEXTURE_2D, CurrentlyBoundTexture->id); /* restore current */
|
||||
if ( ogl_use_texture_filter_anisotropic )
|
||||
{
|
||||
pglGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy);
|
||||
pglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy);
|
||||
}
|
||||
|
||||
if ( CurrentlyBoundTexture != NULL )
|
||||
{
|
||||
/* restore the previously-bound texture */
|
||||
pglBindTexture(GL_TEXTURE_2D, CurrentlyBoundTexture->id);
|
||||
}
|
||||
|
||||
return h;
|
||||
}
|
||||
|
|
16
src/sdl12/SDLMain.h
Normal file
16
src/sdl12/SDLMain.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
|
||||
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
|
||||
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
|
||||
|
||||
Feel free to customize this file to suit your needs
|
||||
*/
|
||||
|
||||
#ifndef _SDLMain_h_
|
||||
#define _SDLMain_h_
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface SDLMain : NSObject
|
||||
@end
|
||||
|
||||
#endif /* _SDLMain_h_ */
|
381
src/sdl12/SDLMain.m
Normal file
381
src/sdl12/SDLMain.m
Normal file
|
@ -0,0 +1,381 @@
|
|||
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
|
||||
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
|
||||
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
|
||||
|
||||
Feel free to customize this file to suit your needs
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDLMain.h"
|
||||
#include <sys/param.h> /* for MAXPATHLEN */
|
||||
#include <unistd.h>
|
||||
|
||||
/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
|
||||
but the method still is there and works. To avoid warnings, we declare
|
||||
it ourselves here. */
|
||||
@interface NSApplication(SDL_Missing_Methods)
|
||||
- (void)setAppleMenu:(NSMenu *)menu;
|
||||
@end
|
||||
|
||||
/* Use this flag to determine whether we use SDLMain.nib or not */
|
||||
#define SDL_USE_NIB_FILE 0
|
||||
|
||||
/* Use this flag to determine whether we use CPS (docking) or not */
|
||||
#define SDL_USE_CPS 1
|
||||
#ifdef SDL_USE_CPS
|
||||
/* Portions of CPS.h */
|
||||
typedef struct CPSProcessSerNum
|
||||
{
|
||||
UInt32 lo;
|
||||
UInt32 hi;
|
||||
} CPSProcessSerNum;
|
||||
|
||||
extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
|
||||
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
|
||||
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
|
||||
|
||||
#endif /* SDL_USE_CPS */
|
||||
|
||||
static int gArgc;
|
||||
static char **gArgv;
|
||||
static BOOL gFinderLaunch;
|
||||
static BOOL gCalledAppMainline = FALSE;
|
||||
|
||||
static NSString *getApplicationName(void)
|
||||
{
|
||||
const NSDictionary *dict;
|
||||
NSString *appName = 0;
|
||||
|
||||
/* Determine the application name */
|
||||
dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
|
||||
if (dict)
|
||||
appName = [dict objectForKey: @"CFBundleName"];
|
||||
|
||||
if (![appName length])
|
||||
appName = [[NSProcessInfo processInfo] processName];
|
||||
|
||||
return appName;
|
||||
}
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
/* A helper category for NSString */
|
||||
@interface NSString (ReplaceSubString)
|
||||
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
|
||||
@end
|
||||
#endif
|
||||
|
||||
@interface NSApplication (SDLApplication)
|
||||
@end
|
||||
|
||||
@implementation NSApplication (SDLApplication)
|
||||
/* Invoked from the Quit menu item */
|
||||
- (void)terminate:(id)sender
|
||||
{
|
||||
/* Post a SDL_QUIT event */
|
||||
SDL_Event event;
|
||||
event.type = SDL_QUIT;
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
@end
|
||||
|
||||
/* The main class of the application, the application's delegate */
|
||||
@implementation SDLMain
|
||||
|
||||
/* Set the working directory to the .app's parent directory */
|
||||
- (void) setupWorkingDirectory:(BOOL)shouldChdir
|
||||
{
|
||||
if (shouldChdir)
|
||||
{
|
||||
char parentdir[MAXPATHLEN];
|
||||
CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||
CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
|
||||
if (CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, MAXPATHLEN)) {
|
||||
chdir(parentdir); /* chdir to the binary app's parent */
|
||||
}
|
||||
CFRelease(url);
|
||||
CFRelease(url2);
|
||||
}
|
||||
}
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
|
||||
/* Fix menu to contain the real app name instead of "SDL App" */
|
||||
- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
|
||||
{
|
||||
NSRange aRange;
|
||||
NSEnumerator *enumerator;
|
||||
NSMenuItem *menuItem;
|
||||
|
||||
aRange = [[aMenu title] rangeOfString:@"SDL App"];
|
||||
if (aRange.length != 0)
|
||||
[aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
|
||||
|
||||
enumerator = [[aMenu itemArray] objectEnumerator];
|
||||
while ((menuItem = [enumerator nextObject]))
|
||||
{
|
||||
aRange = [[menuItem title] rangeOfString:@"SDL App"];
|
||||
if (aRange.length != 0)
|
||||
[menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
|
||||
if ([menuItem hasSubmenu])
|
||||
[self fixMenu:[menuItem submenu] withAppName:appName];
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void setApplicationMenu(void)
|
||||
{
|
||||
/* warning: this code is very odd */
|
||||
NSMenu *appleMenu;
|
||||
NSMenuItem *menuItem;
|
||||
NSString *title;
|
||||
NSString *appName;
|
||||
|
||||
appName = getApplicationName();
|
||||
appleMenu = [[NSMenu alloc] initWithTitle:@""];
|
||||
|
||||
/* Add menu items */
|
||||
title = [@"About " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
|
||||
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
title = [@"Hide " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
|
||||
|
||||
menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
|
||||
[menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
|
||||
|
||||
[appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
|
||||
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
title = [@"Quit " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
|
||||
|
||||
|
||||
/* Put menu into the menubar */
|
||||
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
|
||||
[menuItem setSubmenu:appleMenu];
|
||||
[[NSApp mainMenu] addItem:menuItem];
|
||||
|
||||
/* Tell the application object that this is now the application menu */
|
||||
[NSApp setAppleMenu:appleMenu];
|
||||
|
||||
/* Finally give up our references to the objects */
|
||||
[appleMenu release];
|
||||
[menuItem release];
|
||||
}
|
||||
|
||||
/* Create a window menu */
|
||||
static void setupWindowMenu(void)
|
||||
{
|
||||
NSMenu *windowMenu;
|
||||
NSMenuItem *windowMenuItem;
|
||||
NSMenuItem *menuItem;
|
||||
|
||||
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
|
||||
|
||||
/* "Minimize" item */
|
||||
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
|
||||
[windowMenu addItem:menuItem];
|
||||
[menuItem release];
|
||||
|
||||
/* Put menu into the menubar */
|
||||
windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
|
||||
[windowMenuItem setSubmenu:windowMenu];
|
||||
[[NSApp mainMenu] addItem:windowMenuItem];
|
||||
|
||||
/* Tell the application object that this is now the window menu */
|
||||
[NSApp setWindowsMenu:windowMenu];
|
||||
|
||||
/* Finally give up our references to the objects */
|
||||
[windowMenu release];
|
||||
[windowMenuItem release];
|
||||
}
|
||||
|
||||
/* Replacement for NSApplicationMain */
|
||||
static void CustomApplicationMain (int argc, char **argv)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
SDLMain *sdlMain;
|
||||
|
||||
/* Ensure the application object is initialised */
|
||||
[NSApplication sharedApplication];
|
||||
|
||||
#ifdef SDL_USE_CPS
|
||||
{
|
||||
CPSProcessSerNum PSN;
|
||||
/* Tell the dock about us */
|
||||
if (!CPSGetCurrentProcess(&PSN))
|
||||
if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
|
||||
if (!CPSSetFrontProcess(&PSN))
|
||||
[NSApplication sharedApplication];
|
||||
}
|
||||
#endif /* SDL_USE_CPS */
|
||||
|
||||
/* Set up the menubar */
|
||||
[NSApp setMainMenu:[[NSMenu alloc] init]];
|
||||
setApplicationMenu();
|
||||
setupWindowMenu();
|
||||
|
||||
/* Create SDLMain and make it the app delegate */
|
||||
sdlMain = [[SDLMain alloc] init];
|
||||
[NSApp setDelegate:sdlMain];
|
||||
|
||||
/* Start the main event loop */
|
||||
[NSApp run];
|
||||
|
||||
[sdlMain release];
|
||||
[pool release];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Catch document open requests...this lets us notice files when the app
|
||||
* was launched by double-clicking a document, or when a document was
|
||||
* dragged/dropped on the app's icon. You need to have a
|
||||
* CFBundleDocumentsType section in your Info.plist to get this message,
|
||||
* apparently.
|
||||
*
|
||||
* Files are added to gArgv, so to the app, they'll look like command line
|
||||
* arguments. Previously, apps launched from the finder had nothing but
|
||||
* an argv[0].
|
||||
*
|
||||
* This message may be received multiple times to open several docs on launch.
|
||||
*
|
||||
* This message is ignored once the app's mainline has been called.
|
||||
*/
|
||||
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
|
||||
{
|
||||
const char *temparg;
|
||||
size_t arglen;
|
||||
char *arg;
|
||||
char **newargv;
|
||||
|
||||
if (!gFinderLaunch) /* MacOS is passing command line args. */
|
||||
return FALSE;
|
||||
|
||||
if (gCalledAppMainline) /* app has started, ignore this document. */
|
||||
return FALSE;
|
||||
|
||||
temparg = [filename UTF8String];
|
||||
arglen = SDL_strlen(temparg) + 1;
|
||||
arg = (char *) SDL_malloc(arglen);
|
||||
if (arg == NULL)
|
||||
return FALSE;
|
||||
|
||||
newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
|
||||
if (newargv == NULL)
|
||||
{
|
||||
SDL_free(arg);
|
||||
return FALSE;
|
||||
}
|
||||
gArgv = newargv;
|
||||
|
||||
SDL_strlcpy(arg, temparg, arglen);
|
||||
gArgv[gArgc++] = arg;
|
||||
gArgv[gArgc] = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* Called when the internal event loop has just started running */
|
||||
- (void) applicationDidFinishLaunching: (NSNotification *) note
|
||||
{
|
||||
int status;
|
||||
|
||||
/* Set the working directory to the .app's parent directory */
|
||||
[self setupWorkingDirectory:gFinderLaunch];
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
/* Set the main menu to contain the real app name instead of "SDL App" */
|
||||
[self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
|
||||
#endif
|
||||
|
||||
/* Hand off to main application code */
|
||||
gCalledAppMainline = TRUE;
|
||||
status = SDL_main (gArgc, gArgv);
|
||||
|
||||
/* We're done, thank you for playing */
|
||||
exit(status);
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation NSString (ReplaceSubString)
|
||||
|
||||
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
|
||||
{
|
||||
unsigned int bufferSize;
|
||||
unsigned int selfLen = [self length];
|
||||
unsigned int aStringLen = [aString length];
|
||||
unichar *buffer;
|
||||
NSRange localRange;
|
||||
NSString *result;
|
||||
|
||||
bufferSize = selfLen + aStringLen - aRange.length;
|
||||
buffer = (unichar *)NSAllocateMemoryPages(bufferSize*sizeof(unichar));
|
||||
|
||||
/* Get first part into buffer */
|
||||
localRange.location = 0;
|
||||
localRange.length = aRange.location;
|
||||
[self getCharacters:buffer range:localRange];
|
||||
|
||||
/* Get middle part into buffer */
|
||||
localRange.location = 0;
|
||||
localRange.length = aStringLen;
|
||||
[aString getCharacters:(buffer+aRange.location) range:localRange];
|
||||
|
||||
/* Get last part into buffer */
|
||||
localRange.location = aRange.location + aRange.length;
|
||||
localRange.length = selfLen - localRange.location;
|
||||
[self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
|
||||
|
||||
/* Build output string */
|
||||
result = [NSString stringWithCharacters:buffer length:bufferSize];
|
||||
|
||||
NSDeallocateMemoryPages(buffer, bufferSize);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#ifdef main
|
||||
# undef main
|
||||
#endif
|
||||
|
||||
|
||||
/* Main entry point to executable - should *not* be SDL_main! */
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
/* Copy the arguments into a global variable */
|
||||
/* This is passed if we are launched by double-clicking */
|
||||
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
|
||||
gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
|
||||
gArgv[0] = argv[0];
|
||||
gArgv[1] = NULL;
|
||||
gArgc = 1;
|
||||
gFinderLaunch = YES;
|
||||
} else {
|
||||
int i;
|
||||
gArgc = argc;
|
||||
gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
|
||||
for (i = 0; i <= argc; i++)
|
||||
gArgv[i] = argv[i];
|
||||
gFinderLaunch = NO;
|
||||
}
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
NSApplicationMain (argc, argv);
|
||||
#else
|
||||
CustomApplicationMain (argc, argv);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
39
src/vdb.c
39
src/vdb.c
|
@ -19,7 +19,7 @@ extern int ScanDrawMode;
|
|||
|
||||
*/
|
||||
|
||||
SCENE Global_Scene = 0;
|
||||
SCENE Global_Scene/* = 0*/;
|
||||
|
||||
|
||||
|
||||
|
@ -386,37 +386,11 @@ static void CreateProjectorArray(VIEWDESCRIPTORBLOCK *vdb)
|
|||
|
||||
SetVDB requires a VIEWDESCRIPTORBLOCK
|
||||
|
||||
See the actual function code for what each parameter is
|
||||
|
||||
*/
|
||||
|
||||
void SetVDB(vdb, fl, ty, d, cx,cy, prx,pry, mxp, cl,cr,cu,cd, h1,h2,hc, amb)
|
||||
|
||||
VIEWDESCRIPTORBLOCK *vdb;
|
||||
|
||||
int fl;
|
||||
int ty;
|
||||
|
||||
int d;
|
||||
|
||||
int cx;
|
||||
int cy;
|
||||
|
||||
int prx;
|
||||
int pry;
|
||||
int mxp;
|
||||
|
||||
int cl;
|
||||
int cr;
|
||||
int cu;
|
||||
int cd;
|
||||
|
||||
int h1;
|
||||
int h2;
|
||||
int hc;
|
||||
|
||||
int amb;
|
||||
|
||||
void SetVDB(VIEWDESCRIPTORBLOCK *vdb, int fl, int ty, int d, int cx, int cy,
|
||||
int prx, int pry, int mxp, int cl, int cr, int cu, int cd,
|
||||
int h1, int h2, int hc, int amb)
|
||||
{
|
||||
|
||||
|
||||
|
@ -729,10 +703,7 @@ VIEWDESCRIPTORBLOCK* CreateActiveVDB(void)
|
|||
|
||||
*/
|
||||
|
||||
int DestroyActiveVDB(dblockptr)
|
||||
|
||||
VIEWDESCRIPTORBLOCK *dblockptr;
|
||||
|
||||
int DestroyActiveVDB(VIEWDESCRIPTORBLOCK *dblockptr)
|
||||
{
|
||||
|
||||
int j = -1;
|
||||
|
|
|
@ -218,7 +218,7 @@ FrameList::FrameList(TEXANIM* p,FrameList* fl,int* conv)
|
|||
FrameList::~FrameList()
|
||||
{
|
||||
delete [] Textures;
|
||||
delete UVCoords;
|
||||
delete [] UVCoords;
|
||||
}
|
||||
|
||||
TEXANIM::TEXANIM()
|
||||
|
|
|
@ -153,9 +153,9 @@ void Object_Animation_Sequence_Header_Chunk::fill_data_block (char *data_start)
|
|||
Object_Animation_Sequence_Header_Chunk::~Object_Animation_Sequence_Header_Chunk()
|
||||
{
|
||||
if (sequence_name)
|
||||
delete sequence_name;
|
||||
delete[] sequence_name;
|
||||
if(extra_data)
|
||||
delete extra_data;
|
||||
delete[] extra_data;
|
||||
}
|
||||
|
||||
Object_Animation_Sequence_Header_Chunk::Object_Animation_Sequence_Header_Chunk (Chunk_With_Children * parent,const char * data_start, size_t)
|
||||
|
|
|
@ -246,7 +246,9 @@ struct Object_Animation_Frame
|
|||
{
|
||||
ChunkQuat orientation;
|
||||
ChunkVectorInt transform;
|
||||
signed long at_frame_no; //frame start time (0-65535)
|
||||
|
||||
// SBF: 64HACK - changed long to int32_t as this structure isn't serialized correctly
|
||||
int32_t at_frame_no; //frame start time (0-65535)
|
||||
int flags;
|
||||
|
||||
int get_sound_index(){return ((flags & HierarchyFrame_SoundIndexMask )>>24);}
|
||||
|
|
|
@ -91,7 +91,7 @@ Shape_Fragment_Type::~Shape_Fragment_Type()
|
|||
#endif
|
||||
|
||||
}
|
||||
if(name) delete name;
|
||||
if(name) delete[] name;
|
||||
}
|
||||
|
||||
void Shape_Fragment_Type::AddShape(SHAPEHEADER* shp)
|
||||
|
@ -2403,7 +2403,7 @@ BOOL copy_to_shapeheader (
|
|||
uv_imnums[item_list[i*9+3]>>16]=local_tex_index_nos[texno];
|
||||
item_list[i*9 + 3] += local_tex_index_nos[texno];
|
||||
|
||||
shphd->sh_textures[UVIndex] = (int *) PoolAllocateMem (sizeof(int) * cshp_ptr->uv_list[UVIndex].num_verts * 2);
|
||||
shphd->sh_textures[UVIndex] = (int *) PoolAllocateMem (sizeof(int *) * cshp_ptr->uv_list[UVIndex].num_verts * 2);
|
||||
for (j=0; j<cshp_ptr->uv_list[UVIndex].num_verts; j++) {
|
||||
(shphd->sh_textures[UVIndex])[(j*2)] = ProcessUVCoord(h,UVC_POLY_U,(int)cshp_ptr->uv_list[UVIndex].vert[j].u,uv_imnums[UVIndex]);
|
||||
(shphd->sh_textures[UVIndex])[(j*2)+1] = ProcessUVCoord(h,UVC_POLY_V,(int)cshp_ptr->uv_list[UVIndex].vert[j].v,uv_imnums[UVIndex]);
|
||||
|
@ -3444,7 +3444,7 @@ BOOL copy_to_mainshpl (Shape_Chunk * shp, int list_pos)
|
|||
if (cshp.num_uvs)
|
||||
{
|
||||
for (i=0; i<cshp.num_uvs; i++) {
|
||||
shphd->sh_textures[i] = (int *) AllocateMem (sizeof(int) * cshp.uv_list[i].num_verts * 2);
|
||||
shphd->sh_textures[i] = (int *) AllocateMem (sizeof(int *) * cshp.uv_list[i].num_verts * 2);
|
||||
for (j=0; j<cshp.uv_list[i].num_verts; j++) {
|
||||
(shphd->sh_textures[i])[(j*2)] = (int)cshp.uv_list[i].vert[j].u;
|
||||
(shphd->sh_textures[i])[(j*2)+1] = (int)cshp.uv_list[i].vert[j].v;
|
||||
|
@ -3738,7 +3738,7 @@ BOOL copy_to_mainshpl (Shape_Sub_Shape_Chunk * shp, int list_pos)
|
|||
if (cshp.num_uvs)
|
||||
{
|
||||
for (i=0; i<cshp.num_uvs; i++) {
|
||||
shphd->sh_textures[i] = (int *) AllocateMem (sizeof(int) * cshp.uv_list[i].num_verts * 2);
|
||||
shphd->sh_textures[i] = (int *) AllocateMem (sizeof(int *) * cshp.uv_list[i].num_verts * 2);
|
||||
for (j=0; j<cshp.uv_list[i].num_verts; j++) {
|
||||
(shphd->sh_textures[i])[(j*2)] = (int)cshp.uv_list[i].vert[j].u;
|
||||
(shphd->sh_textures[i])[(j*2)+1] = (int)cshp.uv_list[i].vert[j].v;
|
||||
|
@ -3957,7 +3957,7 @@ BOOL copy_to_mainshpl (Shape_Sub_Shape_Chunk * shp, int list_pos)
|
|||
if (cshp.num_uvs)
|
||||
{
|
||||
for (i=0; i<cshp.num_uvs; i++) {
|
||||
shphd->sh_textures[i] = (int *) AllocateMem (sizeof(int) * cshp.uv_list[i].num_verts * 2);
|
||||
shphd->sh_textures[i] = (int *) AllocateMem (sizeof(int *) * cshp.uv_list[i].num_verts * 2);
|
||||
for (j=0; j<cshp.uv_list[i].num_verts; j++) {
|
||||
(shphd->sh_textures[i])[(j*2)] = (int)cshp.uv_list[i].vert[j].u;
|
||||
(shphd->sh_textures[i])[(j*2)+1] = (int)cshp.uv_list[i].vert[j].v;
|
||||
|
|
|
@ -56,7 +56,7 @@ Fragment_Type_Data_Chunk::Fragment_Type_Data_Chunk(Chunk_With_Children* const pa
|
|||
|
||||
Fragment_Type_Data_Chunk::~Fragment_Type_Data_Chunk()
|
||||
{
|
||||
if(frag_type_name) delete frag_type_name;
|
||||
if(frag_type_name) delete [] frag_type_name;
|
||||
}
|
||||
|
||||
void Fragment_Type_Data_Chunk::fill_data_block(char* data_start)
|
||||
|
@ -124,7 +124,7 @@ Fragment_Type_Shape_Chunk::Fragment_Type_Shape_Chunk(Chunk_With_Children* const
|
|||
|
||||
Fragment_Type_Shape_Chunk::~Fragment_Type_Shape_Chunk()
|
||||
{
|
||||
if(name) delete name;
|
||||
if(name) delete [] name;
|
||||
}
|
||||
|
||||
void Fragment_Type_Shape_Chunk::fill_data_block(char* data_start)
|
||||
|
@ -195,7 +195,7 @@ Fragment_Type_Sound_Chunk::Fragment_Type_Sound_Chunk(Chunk_With_Children* const
|
|||
|
||||
Fragment_Type_Sound_Chunk::~Fragment_Type_Sound_Chunk()
|
||||
{
|
||||
if(wav_name) delete wav_name;
|
||||
if(wav_name) delete [] wav_name;
|
||||
}
|
||||
|
||||
void Fragment_Type_Sound_Chunk::fill_data_block(char* data_start)
|
||||
|
|
|
@ -242,7 +242,7 @@
|
|||
inline unsigned HashFunction(void const * const _vP)
|
||||
{
|
||||
// treat as integer
|
||||
return HashFunction(reinterpret_cast<unsigned>(_vP));
|
||||
return HashFunction(reinterpret_cast<uintptr_t>(_vP));
|
||||
}
|
||||
|
||||
// a hash function for strings
|
||||
|
|
|
@ -323,7 +323,7 @@ Object_Hierarchy_Alternate_Shape_Set_Chunk::Object_Hierarchy_Alternate_Shape_Set
|
|||
|
||||
Object_Hierarchy_Alternate_Shape_Set_Chunk::~Object_Hierarchy_Alternate_Shape_Set_Chunk()
|
||||
{
|
||||
if(Shape_Set_Name) delete Shape_Set_Name;
|
||||
if(Shape_Set_Name) delete[] Shape_Set_Name;
|
||||
|
||||
while(Replaced_Shape_List.size())
|
||||
{
|
||||
|
@ -428,7 +428,7 @@ Hierarchy_Shape_Set_Collection_Chunk::Hierarchy_Shape_Set_Collection_Chunk(Chunk
|
|||
|
||||
Hierarchy_Shape_Set_Collection_Chunk::~Hierarchy_Shape_Set_Collection_Chunk()
|
||||
{
|
||||
if(Set_Collection_Name) delete Set_Collection_Name;
|
||||
if(Set_Collection_Name) delete[] Set_Collection_Name;
|
||||
}
|
||||
|
||||
void Hierarchy_Shape_Set_Collection_Chunk::fill_data_block(char* data_start)
|
||||
|
@ -521,7 +521,7 @@ Hierarchy_Degradation_Distance_Chunk::Hierarchy_Degradation_Distance_Chunk(Chunk
|
|||
|
||||
Hierarchy_Degradation_Distance_Chunk::~Hierarchy_Degradation_Distance_Chunk()
|
||||
{
|
||||
if(distance_array)delete distance_array;
|
||||
if(distance_array)delete[] distance_array;
|
||||
}
|
||||
|
||||
void Hierarchy_Degradation_Distance_Chunk::fill_data_block(char* data_start)
|
||||
|
|
|
@ -101,8 +101,8 @@ struct Replaced_Shape_Details
|
|||
{
|
||||
~Replaced_Shape_Details()
|
||||
{
|
||||
if(old_object_name) delete old_object_name;
|
||||
if(new_object_name) delete new_object_name;
|
||||
if(old_object_name) delete[] old_object_name;
|
||||
if(new_object_name) delete[] new_object_name;
|
||||
}
|
||||
|
||||
//object name of shape to be replaced
|
||||
|
|
|
@ -639,7 +639,7 @@ void File_Chunk::post_input_processing()
|
|||
ol()->assoc_with_shape(shape_array[ol()->get_header()->shape_id_no]);
|
||||
}
|
||||
|
||||
delete shape_array;
|
||||
delete [] shape_array;
|
||||
|
||||
|
||||
Chunk_With_Children::post_input_processing();
|
||||
|
|
|
@ -1012,7 +1012,7 @@ Object_Track_Chunk2::Object_Track_Chunk2(Object_Chunk * parent)
|
|||
|
||||
Object_Track_Chunk2::~Object_Track_Chunk2()
|
||||
{
|
||||
if(sections) delete sections;
|
||||
if(sections) delete [] sections;
|
||||
}
|
||||
|
||||
void Object_Track_Chunk2::fill_data_block (char *data_start)
|
||||
|
@ -1132,7 +1132,7 @@ Object_Track_Sound_Chunk::Object_Track_Sound_Chunk(Chunk_With_Children* const pa
|
|||
|
||||
Object_Track_Sound_Chunk::~Object_Track_Sound_Chunk()
|
||||
{
|
||||
if(wav_name) delete wav_name;
|
||||
if(wav_name) delete [] wav_name;
|
||||
}
|
||||
|
||||
void Object_Track_Sound_Chunk::fill_data_block(char* data_start)
|
||||
|
|
|
@ -1523,7 +1523,7 @@ Shape_Merge_Data_Chunk::Shape_Merge_Data_Chunk (Shape_Sub_Shape_Chunk * parent,
|
|||
|
||||
Shape_Merge_Data_Chunk::~Shape_Merge_Data_Chunk()
|
||||
{
|
||||
if (num_polys) delete merge_data;
|
||||
if (num_polys) delete [] merge_data;
|
||||
}
|
||||
|
||||
void Shape_Merge_Data_Chunk::fill_data_block(char * data_start)
|
||||
|
@ -2575,7 +2575,7 @@ Shape_Fragment_Type_Chunk::Shape_Fragment_Type_Chunk(Chunk_With_Children* const
|
|||
|
||||
Shape_Fragment_Type_Chunk::~Shape_Fragment_Type_Chunk()
|
||||
{
|
||||
if(frag_type_name) delete frag_type_name;
|
||||
if(frag_type_name) delete [] frag_type_name;
|
||||
}
|
||||
|
||||
void Shape_Fragment_Type_Chunk::fill_data_block(char* data_start)
|
||||
|
@ -3337,6 +3337,9 @@ void* Shape_Preprocessed_Data_Chunk::GetMemoryBlock()
|
|||
{
|
||||
void* retval=memory_block;
|
||||
|
||||
// 64HACK
|
||||
#pragma message ("64HACK")
|
||||
#if 0
|
||||
unsigned int* current=(unsigned int*)&first_pointer;
|
||||
unsigned int* next;
|
||||
while((*current>>16)!=0xffff)
|
||||
|
@ -3346,7 +3349,7 @@ void* Shape_Preprocessed_Data_Chunk::GetMemoryBlock()
|
|||
current=next;
|
||||
}
|
||||
*current=(unsigned int)&memory_block[(*current)&0xffff];
|
||||
|
||||
#endif
|
||||
memory_block=0;
|
||||
block_size=0;
|
||||
return retval;
|
||||
|
|
|
@ -678,7 +678,7 @@ static char* GetLocalDirectory(void)
|
|||
|
||||
if( homepath != NULL ) {
|
||||
|
||||
homedir = (unsigned char*)malloc(strlen(homedrive)+strlen(homepath)+1);
|
||||
homedir = (char*)malloc(strlen(homedrive)+strlen(homepath)+1);
|
||||
|
||||
strcpy(homedir, homedrive);
|
||||
strcat(homedir, homepath);
|
||||
|
@ -704,7 +704,7 @@ static char* GetLocalDirectory(void)
|
|||
homedir = _strdup(".");
|
||||
}
|
||||
|
||||
localdir = (unsigned char*)malloc(strlen(homedir) + 10);
|
||||
localdir = (char*)malloc(strlen(homedir) + 10);
|
||||
strcpy(localdir, homedir);
|
||||
strcat(localdir, "\\AvPLinux"); // temp name, maybe
|
||||
|
||||
|
@ -762,11 +762,13 @@ static const char* GetGlobalDirectory(const char* argv0)
|
|||
/*
|
||||
Game-specific initialization
|
||||
*/
|
||||
extern "C" {
|
||||
extern char const *SecondTex_Directory;
|
||||
extern char const *SecondSoundDir;
|
||||
}
|
||||
|
||||
void InitGameDirectories(char *argv0)
|
||||
{
|
||||
extern char *SecondTex_Directory;
|
||||
extern char *SecondSoundDir;
|
||||
|
||||
const char* localdir;
|
||||
const char* globaldir;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue