#include "openal_wrapper.h"
#include "Settings.h"
#include "Input.h"
+#include "Animation.h"
+#include "Awards.h"
using namespace std;
extern int environment;
extern float texscale;
extern Terrain terrain;
-extern OPENAL_SAMPLE *samp[100];
extern int channels[100];
extern int kTextureSize;
extern float screenwidth,screenheight;
extern float slomodelay;
extern bool floatjump;
extern float volume;
-extern Animation animation[animation_count];
extern Light light;
extern float texdetail;
extern GLubyte bloodText[512*512*3];
extern bool cellophane;
extern bool musictoggle;
extern int difficulty;
-extern Weapons weapons;
-extern Person player[maxplayers];
-extern int numplayers;
extern int bloodtoggle;
extern bool invertmouse;
extern float windvar;
extern bool vblsync;
extern bool immediate;
extern bool velocityblur;
-extern int bonus;
-extern int oldbonus;
-extern float bonusvalue;
-extern float bonustotal;
-extern float bonustime;
-extern float startbonustotal;
extern float tintr,tintg,tintb;
-extern float bonusnum[100];
extern bool skyboxtexture;
extern float skyboxr;
extern float skyboxg;
extern bool canattack;
extern bool cananger;
extern float damagedealt;
-extern float damagetaken;
extern int maptype;
extern int editoractive;
extern int editorpathtype;
extern bool stillloading;
extern bool winfreeze;
-extern int numfalls;
-extern int numflipfail;
-extern int numseen;
-extern int numstaffattack;
-extern int numswordattack;
-extern int numknifeattack;
-extern int numunarmedattack;
-extern int numescaped;
-extern int numflipped;
-extern int numwallflipped;
-extern int numthrowkill;
-extern int numafterkill;
-extern int numreversals;
-extern int numattacks;
-extern int maxalarmed;
-extern int numresponded;
-
extern int numdialogues;
extern int numdialogueboxes[max_dialogues];
extern int dialoguetype[max_dialogues];
return !strncasecmp(str, pfx, strlen(pfx));
}
-extern OPENAL_STREAM * strm[20];
extern "C" void PlaySoundEx(int channel, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
extern "C" void PlayStreamEx(int chan, OPENAL_STREAM *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
windvector.z=3;
if(ambientsound){
//PlaySoundEx( wind, samp[wind], NULL, true);
- PlayStreamEx(stream_wind, strm[stream_wind], 0, true);
+ PlayStreamEx(stream_wind, samp[stream_wind], 0, true);
OPENAL_SetPaused(channels[stream_wind], false);
OPENAL_SetVolume(channels[stream_wind], 256);
}
LoadTexture(":Data:Textures:bouldersnow.jpg",&objects.rocktextureptr,1,0);
LoadTexture(":Data:Textures:snowbox.jpg",&objects.boxtextureptr,1,0);
- OPENAL_Sample_Free(samp[footstepsound]);
- OPENAL_Sample_Free(samp[footstepsound2]);
- OPENAL_Sample_Free(samp[footstepsound3]);
- OPENAL_Sample_Free(samp[footstepsound4]);
- samp[footstepsound] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow1.ogg"), OPENAL_HW3D, 0, 0);
- samp[footstepsound2] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow2.ogg"), OPENAL_HW3D, 0, 0);
- samp[footstepsound3] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone1.ogg"), OPENAL_HW3D, 0, 0);
- samp[footstepsound4] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone2.ogg"), OPENAL_HW3D, 0, 0);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
+ footstepsound = footstepsn1;
+ footstepsound2 = footstepsn2;
+ footstepsound3 = footstepst1;
+ footstepsound4 = footstepst2;
LoadTexture(":Data:Textures:snow.jpg",&terraintexture,1,0);
if(ambientsound){
//PlaySoundEx( desertambient, samp[desertambient], NULL, true);
- PlayStreamEx( stream_desertambient, strm[stream_desertambient], NULL, true);
+ PlayStreamEx( stream_desertambient, samp[stream_desertambient], NULL, true);
OPENAL_SetPaused(channels[stream_desertambient], false);
OPENAL_SetVolume(channels[stream_desertambient], 256);
}
- OPENAL_Sample_Free(samp[footstepsound]);
- OPENAL_Sample_Free(samp[footstepsound2]);
- OPENAL_Sample_Free(samp[footstepsound3]);
- OPENAL_Sample_Free(samp[footstepsound4]);
- samp[footstepsound] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow1.ogg"), OPENAL_HW3D, 0, 0);
- samp[footstepsound2] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow2.ogg"), OPENAL_HW3D, 0, 0);
- samp[footstepsound3] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow1.ogg"), OPENAL_HW3D, 0, 0);
- samp[footstepsound4] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow2.ogg"), OPENAL_HW3D, 0, 0);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
+ footstepsound = footstepsn1;
+ footstepsound2 = footstepsn2;
+ footstepsound3 = footstepsn1;
+ footstepsound4 = footstepsn2;
LoadTexture(":Data:Textures:sand.jpg",&terraintexture,1,0);
LoadTexture(":Data:Textures:grassbox.jpg",&objects.boxtextureptr,1,0);
if(ambientsound){
- PlayStreamEx( stream_wind, strm[stream_wind], NULL, true);
+ PlayStreamEx( stream_wind, samp[stream_wind], NULL, true);
OPENAL_SetPaused(channels[stream_wind], false);
OPENAL_SetVolume(channels[stream_wind], 100);
}
- OPENAL_Sample_Free(samp[footstepsound]);
- OPENAL_Sample_Free(samp[footstepsound2]);
- OPENAL_Sample_Free(samp[footstepsound3]);
- OPENAL_Sample_Free(samp[footstepsound4]);
- samp[footstepsound] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepgrass1.ogg"), OPENAL_HW3D, 0, 0);
- samp[footstepsound2] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepgrass2.ogg"), OPENAL_HW3D, 0, 0);
- samp[footstepsound3] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone1.ogg"), OPENAL_HW3D, 0, 0);
- samp[footstepsound4] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone2.ogg"), OPENAL_HW3D, 0, 0);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
+ footstepsound = footstepgr1;
+ footstepsound2 = footstepgr2;
+ footstepsound3 = footstepst1;
+ footstepsound4 = footstepst2;
LoadTexture(":Data:Textures:grassdirt.jpg",&terraintexture,1,0);
won=0;
//campaign=0;
- animation[bounceidleanim].Load((char *)":Data:Animations:Idle",middleheight,neutral);
+ animation[bounceidleanim].Load((char *)"Idle",middleheight,neutral);
numdialogues=0;
player[i].proportionlegs.z=0;
}
- player[i].tempanimation.Load((char *)":Data:Animations:Tempanim",0,0);
+ player[i].tempanimation.Load((char *)"Tempanim",0,0);
player[i].headmorphness=0;
player[i].targetheadmorphness=1;
{
if(ambientsound)
{
- PlayStreamEx(stream_wind, strm[stream_wind], NULL, true);
+ PlayStreamEx(stream_wind, samp[stream_wind], NULL, true);
OPENAL_SetPaused(channels[stream_wind], false);
OPENAL_SetVolume(channels[stream_wind], 256);
}
//PlaySoundEx(desertambient,
// samp[desertambient], NULL, true);
PlayStreamEx(stream_desertambient,
- strm[stream_desertambient], NULL, true);
+ samp[stream_desertambient], NULL, true);
OPENAL_SetPaused(channels[stream_desertambient], false);
OPENAL_SetVolume(channels[stream_desertambient], 256);
}
if(ambientsound)
{
//PlaySoundEx(wind, samp[wind], NULL, true);
- PlayStreamEx(stream_wind, strm[stream_wind], NULL, true);
+ PlayStreamEx(stream_wind, samp[stream_wind], NULL, true);
OPENAL_SetPaused(channels[stream_wind], false);
OPENAL_SetVolume(channels[stream_wind], 100);
}
if(mainmenu&&musictoggle){
if(mainmenu==1||mainmenu==2||mainmenu==100){
OPENAL_SetFrequency(OPENAL_ALL, 0.001);
- PlayStreamEx( stream_music3, strm[stream_music3], NULL, true);
+ PlayStreamEx( stream_music3, samp[stream_music3], NULL, true);
OPENAL_SetPaused(channels[stream_music3], false);
OPENAL_SetVolume(channels[stream_music3], 256);
OPENAL_SetPaused(channels[music1], true);
}
if(musictoggle){
- PlayStreamEx( stream_music3, strm[stream_music3], NULL, true);
+ PlayStreamEx( stream_music3, samp[stream_music3], NULL, true);
OPENAL_SetPaused(channels[stream_music3], false);
OPENAL_SetVolume(channels[stream_music3], 256);
}
gameon=1;
OPENAL_SetPaused(channels[stream_music3], true);
}
- if(Input::Button()&&!oldbutton&&(selected-7>=accountactive->getCampaignChoicesMade())){//selected>=7&&(selected-7<=campaignnumchoices)){
+ if(Input::Button()&&!oldbutton&&(selected-7>=accountactive->getCampaignChoicesMade())){
fireSound();
flash();
mainmenu=9;
}
}
- if(mainmenu==9){
+ else if(mainmenu==9){
if(Input::Button()&&!oldbutton&&selected<numchallengelevels&&selected>=0&&selected<=accountactive->getProgress()){
fireSound();
player[numplayers].proportionlegs.z=0;
}
- player[numplayers].tempanimation.Load((char *)":Data:Animations:Tempanim",0,0);
+ player[numplayers].tempanimation.Load((char *)"Tempanim",0,0);
player[numplayers].damagetolerance=200;
player[i].RagDoll(0);
if(player[i].damage>player[i].damagetolerance-findLengthfast(&rotatetarget)/4&&!player[i].dead){
- bonus=aimbonus;
- bonustime=0;
- bonusvalue=150;
+ award_bonus(0, aimbonus);
}
player[i].DoDamage(findLengthfast(&rotatetarget)/4);
player[k].RagDoll(0);
if(player[k].damage>player[k].damagetolerance-findLengthfast(&rotatetarget)/4&&!player[k].dead){
- bonus=aimbonus;
- bonustime=0;
- bonusvalue=150;
+ award_bonus(0, aimbonus); // Huh, again?
}
player[k].DoDamage(findLengthfast(&rotatetarget)/4);
player[i].DoDamage(20);
player[i].RagDoll(0);
player[k].lastcollide=1;
- if(k==0){
- bonus=AboveBonus;
- bonustime=0;
- bonusvalue=50;
- }
+ award_bonus(k, AboveBonus);
}
if(i==0&&k!=0&&player[i].targetanimation==jumpdownanim&&!player[k].isCrouch()&&player[k].targetanimation!=rollanim&&!player[i].skeleton.oldfree&&!player[i].skeleton.free&&player[i].lastcollide<=0&&player[i].velocity.y<-10){
player[k].velocity=player[i].velocity;
player[k].DoDamage(20);
player[k].RagDoll(0);
player[i].lastcollide=1;
- if(i==0){
- bonus=AboveBonus;
- bonustime=0;
- bonusvalue=50;
- }
+ award_bonus(i, AboveBonus);
}
}
}
OPENAL_StopSound(OPENAL_ALL); // hack...OpenAL renderer isn't stopping music after tutorial goes to level menu...
OPENAL_SetFrequency(OPENAL_ALL, 0.001);
- PlayStreamEx( stream_music3, strm[stream_music3], NULL, true);
+ PlayStreamEx( stream_music3, samp[stream_music3], NULL, true);
OPENAL_SetPaused(channels[stream_music3], false);
OPENAL_SetVolume(channels[stream_music3], 256);
if(musictoggle){
if(musicvolume[0]>0&&oldmusicvolume[0]<=0){
- PlayStreamEx( music1, strm[music1], NULL, true);
+ PlayStreamEx( music1, samp[music1], NULL, true);
OPENAL_SetPaused(channels[music1], false);
}
if(musicvolume[1]>0&&oldmusicvolume[1]<=0){
- PlayStreamEx( stream_music2, strm[stream_music2], NULL, true);
+ PlayStreamEx( stream_music2, samp[stream_music2], NULL, true);
OPENAL_SetPaused(channels[stream_music2], false);
}
if(musicvolume[2]>0&&oldmusicvolume[2]<=0){
- PlayStreamEx( stream_music3, strm[stream_music3], NULL, true);
+ PlayStreamEx( stream_music3, samp[stream_music3], NULL, true);
OPENAL_SetPaused(channels[stream_music3], false);
}
if(musicvolume[0]<=0&&oldmusicvolume[0]>0){