diff --git a/Build/Enhanced-Changes.txt b/Build/Enhanced-Changes.txt index 15dfdc0..883588d 100644 --- a/Build/Enhanced-Changes.txt +++ b/Build/Enhanced-Changes.txt @@ -1,3 +1,12 @@ +Black Shades Enhanced v1.1 +- Fixed a bug where the mouse sometimes clips out of the window in windowed mode. +- Added a new FOV setting. +- Changed the Sniper Rifle's FOV to 22.50 due to the equation used for calculating user-defined FOV. +- Includes the soundtrack! + +Dev stuff: +Fixed all compiler warnings! + Black Shades Enhanced v1 - Increased the FPS limit from 90 to 300. - Allows the user to set the FPS limit in the config.txt diff --git a/Build/Readme b/Build/Readme new file mode 100644 index 0000000..3498a77 --- /dev/null +++ b/Build/Readme @@ -0,0 +1,117 @@ +Black Shades +By David Rosen + +Please do not give a vote unless you are running in OS 9, Black Shades can run under OS X but only under emulation which does not work nearly as well. + +Controls: +WASD = walk +shift = run +mouse = look +control = crouch/zoom +click = fire (while aiming) or smash (while running) or pick up gun (while crouching over a body and not aiming) or disarm (while not aiming) +q = aim or un-aim (important for picking up guns) +r = reload +e = psychic aim +z = toggle soul release +space = dive (while running forwards) + +keys for debug mode: + +tab = 3rdperson toggle +f = Force Pushª :) +shift-x = switch weapons + +Thats it + +Instructions: +Try to keep your VIP (the guy in white) alive as long as possible. The assassins will all try to shoot or stab him to death. You must do all you can to prevent this. Your reputation has preceded you, so the VIP has absolute confidence in your abilities and will completely ignore all the assassins. When an assassin is aiming at your VIP with a gun, you will psychicly see a line of sight extending from him to your VIP. This line will narrow and redden until it disappears and the assassin fires. Depending on the situation it may be best just to shoot the assassin(s), or to dive and tackle the VIP to the ground to avoid the bullet. Unfortunately your psychic powers do not show the line of sight of knife-wielding assassins. + +If you are feeling overwhelmed you can use psychic aiming to temporarily speed up your thought processes and aim your shots better. If there are no visible enemies you may want to release your soul and look for nearby enemies. When your soul is released your VIP pulsates between blue and red, civilians between black and red, and assassins are solid red. + +If you die or your VIP is killed.. the level restarts. If you are are interested in the theory behind this: you are a psychic bodyguard, so you can see small distances into the future. The failure only occured in a possible future which you are now going to try and avoid. + +The scoring system consists of: +150 points for a successful disarm +300 points for destroying a zombie (by blowing its head off) +100+50x points for completing a mission where x is the mission number (i.e. 450 points for completing mission 3) +75 points for incapacitating an assassin + +50 if he had a knife +-300 points for hurting a civilian +-200 points for allowing the VIP to die +The penalty for failing to protect the VIP is halved if you kill the assassin. + +You can edit levels by setting "Custom levels" to 1 in the config and editing the customlevels.txt file in the data folder. + +Weapons: +Bare Hands: Smack people with them. Or if you want to be nice, walk or stand (don't run) near somebody with a gun and take it away. + +Knife: Like bare hands, but deadly and with longer range. Look out for knife-wielding assassins, they are the most dangerous. + +Handgun: One shot with this should be enough to incapacitate any human target, but they may remain conscious for a second (this can be bad if they are about to stab your VIP, aim for the head) + +Magnum: Not as much ammo as the vanilla handgun, but one shot is an instantenous kill + +Assault Rifle: This weapon has quite a kick and is bigger and more unwieldy than the handguns, but it has a large magazine and can fire quickly if necessary + +Sniper Rifle: A bit more powerful than the magnum, with a scope. Very difficult to aim unless you are zoomed in (zoom by holding the control key) + +Shotgun: Aim and shoot. Very powerful but somewhat inaccurate. + +Grenade: Hold down the mouse button to take out the pin, release the button to throw it. Crouch to change your mind and put +the pin back in. You can knock people out if you hit them in the head, or of course you can just blow them to pieces. + +Troubleshooting: +The only known bugs are: +¥It doesn't work too well under classic emulation +¥Occasional collision detection issues +¥Turning virtual memory off can cause speed issues + +History: +11-6 to 11-9 main menu, score, etc. +10-9 to 11-6 better ai, gibbing, added zombies, weather, knife, shotgun, misc. stuff +10-8 shooting delay/ effect +10-6 added rich vip guy +10-5 bug fixes, gibbing, slomo psychicness +10-4 bug fixes, blood toggle, environments, falling damage +10-1 worked on menu, pathfinding +9-27 added black shades, bug fixes, added some IDG sounds, better collision, config.txt +9-22 bug fixes +9-21 mouse smoothing, better aiming, different blood +9-20 fixed street clipping, grenades working, more blood +9-19 fixed grenade faces, fixed some assassin AI, fixed penetration bugs +9-18 started assassin AI, some more assassin AI, some work on grenades +9-17 faster aiming/crouching, VBL sync, slightly improved control sensitivity stuff +9-16 glock added, penetrating sniper rounds, better scope, different zooming +9-15 suicide, improved bashing, npcs can carry guns, reloading, headshot sound, camera positioned better, handgun +9-14 rifle bashing, aim modifications, redder headshots, speed +9-13 everything in one folder, stationary 3rd person cam toggle, visible bullets, some sound stuff +9-12 crouching, duck to snipe, pain animations +9-11 more fluid aiming, different costumes, assault rifle, health system, impact reaction, kill counter +9-10 sniper rifle scope, bullets, sounds +9-9 bug fix +9-8 sniper rifle added (fires blanks, can't zoom), ragdoll system improved, ragdoll sounds +9-7 smooth transition to pointing arms, walking, better running, skeletal 'ragdoll' system + collisions +9-6 fixed sound bug +9-5 Added distance people sprites (very far view distance, faster also) Added limit to # of people per block, more even spacing, added pointing arms (pistol aiming without the pistol) +9-4 Added random civilian placement system (populated entire city instead of a block) +9-3 Too Busy +9-2 Too Busy +9-1 Too Busy +8-31 Started basic civilian AI +8-30 Fog fixed on ground and sky, better skeletal animation, pre-calced rotations for joints +8-29 Real Lifeª intervened, no time +8-28 Air control added, some collision fixed, occluding people, sky plane, ground does not occlude +8-27 looking up/down changes animation, editors updated to CW 8, animation editor tweaks, optimised a bit +8-26 look at previous soul position when going back into body, sound fx added, movement speed tweaks, can't see body while soul is released +8-25 black sunglasses idea(prevent visions) "dark shades" or "black shades" name +psychic vision effect added +better collision added +8-24 working under CW 8 +8-23 collision detection on street (with sidewalk+buildings) +8-22 collision detection models + firstperson view +8-21 psychic bodyguard idea +8-20 basic city engine, skeletal animation from glfighters2 pre-alpha, player+building models, jogger group + +Main menu music is included with permission from musician John Graham, Copyright 2002. +Due to legal difficulties all other music is composed by me at the last minute based on some nice loops made by Carlos Camacho, hence the 'programmer music'. +Also many thanks to my other friends and beta testers, and to artist David Drew for modelling the assault rifle, sniper rifle, handgun, shotgun and grenade. \ No newline at end of file diff --git a/Build/Soundtrack/1 - Black Shades Soundtrack - Main Menu Song.wav b/Build/Soundtrack/1 - Black Shades Soundtrack - Main Menu Song.wav new file mode 100644 index 0000000..6525e46 Binary files /dev/null and b/Build/Soundtrack/1 - Black Shades Soundtrack - Main Menu Song.wav differ diff --git a/Build/Soundtrack/2 - Black Shades Soundtrack - Shoot Song.wav b/Build/Soundtrack/2 - Black Shades Soundtrack - Shoot Song.wav new file mode 100644 index 0000000..f241837 Binary files /dev/null and b/Build/Soundtrack/2 - Black Shades Soundtrack - Shoot Song.wav differ diff --git a/Build/Soundtrack/3 - Black Shades Soundtrack - Knife Song.wav b/Build/Soundtrack/3 - Black Shades Soundtrack - Knife Song.wav new file mode 100644 index 0000000..544dd79 Binary files /dev/null and b/Build/Soundtrack/3 - Black Shades Soundtrack - Knife Song.wav differ diff --git a/Build/Soundtrack/4 - Black Shades Soundtrack - Zombie Song.wav b/Build/Soundtrack/4 - Black Shades Soundtrack - Zombie Song.wav new file mode 100644 index 0000000..89dbca7 Binary files /dev/null and b/Build/Soundtrack/4 - Black Shades Soundtrack - Zombie Song.wav differ diff --git a/Build/Soundtrack/5 - Black Shades Soundtrack - Main Menu Song (Loop).wav b/Build/Soundtrack/5 - Black Shades Soundtrack - Main Menu Song (Loop).wav new file mode 100644 index 0000000..bfff097 Binary files /dev/null and b/Build/Soundtrack/5 - Black Shades Soundtrack - Main Menu Song (Loop).wav differ diff --git a/Build/Soundtrack/6 - Black Shades Soundtrack - Shoot Song (Loop).wav b/Build/Soundtrack/6 - Black Shades Soundtrack - Shoot Song (Loop).wav new file mode 100644 index 0000000..b779370 Binary files /dev/null and b/Build/Soundtrack/6 - Black Shades Soundtrack - Shoot Song (Loop).wav differ diff --git a/Build/Soundtrack/7 - Black Shades Soundtrack - Knife Song (Loop).wav b/Build/Soundtrack/7 - Black Shades Soundtrack - Knife Song (Loop).wav new file mode 100644 index 0000000..afa7213 Binary files /dev/null and b/Build/Soundtrack/7 - Black Shades Soundtrack - Knife Song (Loop).wav differ diff --git a/Build/Soundtrack/8 - Black Shades Soundtrack - Zombie Song (Loop).wav b/Build/Soundtrack/8 - Black Shades Soundtrack - Zombie Song (Loop).wav new file mode 100644 index 0000000..1c50184 Binary files /dev/null and b/Build/Soundtrack/8 - Black Shades Soundtrack - Zombie Song (Loop).wav differ diff --git a/Build/Soundtrack/Cover.jpg b/Build/Soundtrack/Cover.jpg new file mode 100644 index 0000000..7876a99 Binary files /dev/null and b/Build/Soundtrack/Cover.jpg differ diff --git a/Build/blackshades.exe b/Build/blackshades.exe index 0f2eb0f..20badf5 100644 Binary files a/Build/blackshades.exe and b/Build/blackshades.exe differ diff --git a/README.md b/README.md index 4c011a1..e6394ba 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,18 @@ But recently I figured out a way to compile it, and thus the Black Shades Enhanc **What is included?** -As of v1.0.0: +As of v1.1.0: - Increased the FPS limit from 90 to 300. - Allows the user to set the FPS limit in the config.txt - Allows the user to run the game in windowed mode. - Added an icon for use in Windowed Mode. -- Added SQL_Image support +- Added SQL_Image support. +- Added a new FOV setting. +- Changed the Sniper Rifle's FOV to 22.50 due to the equation used for calculating user-defined FOV. +- Fixed all compiler warnings! +- Includes the soundtrack! + +All the new settings can be set in the config.txt the game generates. **Images:** diff --git a/blackshades/Source/Fog.cpp b/blackshades/Source/Fog.cpp index 21ca229..20aa3a9 100644 --- a/blackshades/Source/Fog.cpp +++ b/blackshades/Source/Fog.cpp @@ -16,8 +16,8 @@ void Fog::SetFog(float colorR, float colorG, float colorB, float fStart, float f glFogfv(GL_FOG_COLOR,fogColor); glFogf(GL_FOG_DENSITY,fogDensity); glFogi(GL_FOG_HINT,GL_DONT_CARE); - glFogi(GL_FOG_START,fogStart); - glFogi(GL_FOG_END,fogEnd); + glFogf(GL_FOG_START,fogStart); + glFogf(GL_FOG_END,fogEnd); glEnable(GL_FOG); } @@ -34,8 +34,8 @@ void Fog::TempFog(float colorR, float colorG, float colorB) glFogfv(GL_FOG_COLOR,tempfogColor); glFogf(GL_FOG_DENSITY,fogDensity); glFogi(GL_FOG_HINT,GL_DONT_CARE); - glFogi(GL_FOG_START,fogStart); - glFogi(GL_FOG_END,fogEnd); + glFogf(GL_FOG_START,fogStart); + glFogf(GL_FOG_END,fogEnd); glEnable(GL_FOG); } @@ -46,8 +46,8 @@ void Fog::ResetFog() glFogfv(GL_FOG_COLOR,fogColor); glFogf(GL_FOG_DENSITY,fogDensity); glFogi(GL_FOG_HINT,GL_DONT_CARE); - glFogi(GL_FOG_START,fogStart); - glFogi(GL_FOG_END,fogEnd); + glFogf(GL_FOG_START,fogStart); + glFogf(GL_FOG_END,fogEnd); glEnable(GL_FOG); } diff --git a/blackshades/Source/Frustum.cpp b/blackshades/Source/Frustum.cpp index 331723b..f52813d 100644 --- a/blackshades/Source/Frustum.cpp +++ b/blackshades/Source/Frustum.cpp @@ -78,7 +78,7 @@ void FRUSTUM:: frustum[5][3] = clip[15] + clip[14]; /* normalize the right plane */ - t = sqrt(frustum[0][0]*frustum[0][0] + t = sqrtf(frustum[0][0]*frustum[0][0] + frustum[0][1]*frustum[0][1] + frustum[0][2]*frustum[0][2]); frustum[0][0] /= t; @@ -93,7 +93,7 @@ void FRUSTUM:: frustum[1][3] = clip[15] + clip[12]; /* normalize the left plane */ - t = sqrt(frustum[1][0]*frustum[1][0] + t = sqrtf(frustum[1][0]*frustum[1][0] + frustum[1][1]*frustum[1][1] + frustum[1][2]*frustum[1][2]); frustum[1][0] /= t; @@ -108,7 +108,7 @@ void FRUSTUM:: frustum[2][3] = clip[15] + clip[13]; /* normalize the bottom plane */ - t = sqrt(frustum[2][0]*frustum[2][0] + t = sqrtf(frustum[2][0]*frustum[2][0] + frustum[2][1]*frustum[2][1] + frustum[2][2]*frustum[2][2]); frustum[2][0] /= t; @@ -123,7 +123,7 @@ void FRUSTUM:: frustum[3][3] = clip[15] - clip[13]; /* normalize the top plane */ - t = sqrt(frustum[3][0]*frustum[3][0] + t = sqrtf(frustum[3][0]*frustum[3][0] + frustum[3][1]*frustum[3][1] + frustum[3][2]*frustum[3][2]); frustum[3][0] /= t; @@ -138,7 +138,7 @@ void FRUSTUM:: frustum[4][3] = clip[15] - clip[14]; /* normalize the far plane */ - t = sqrt(frustum[4][0]*frustum[4][0] + t = sqrtf(frustum[4][0]*frustum[4][0] + frustum[4][1]*frustum[4][1] + frustum[4][2]*frustum[4][2]); frustum[4][0] /= t; @@ -153,7 +153,7 @@ void FRUSTUM:: frustum[5][3] = clip[15] + clip[14]; /* normalize the near plane */ - t = sqrt(frustum[5][0]*frustum[5][0] + t = sqrtf(frustum[5][0]*frustum[5][0] + frustum[5][1]*frustum[5][1] + frustum[5][2]*frustum[5][2]); frustum[5][0] /= t; diff --git a/blackshades/Source/Game.h b/blackshades/Source/Game.h index cb58ec8..3357603 100644 --- a/blackshades/Source/Game.h +++ b/blackshades/Source/Game.h @@ -169,10 +169,10 @@ class Game bool debug; bool vblsync; - bool blur; + int blur; bool blurness; - bool paused; + int paused; int mainmenu; @@ -239,6 +239,7 @@ class Game //new stuff int fpslimit; int fullscreen; + int fov; ~Game() { glDeleteTextures( 1, (const GLuint *)personspritetextureptr ); diff --git a/blackshades/Source/GameDraw.cpp b/blackshades/Source/GameDraw.cpp index f3acf03..7d4db94 100644 --- a/blackshades/Source/GameDraw.cpp +++ b/blackshades/Source/GameDraw.cpp @@ -794,9 +794,9 @@ int Game::DrawGLScene(GLvoid) //Change fov if zooming with scope - if(!zoom)ReSizeGLScene(90,.1); + if(!zoom)ReSizeGLScene(fov,.1); - if(zoom)ReSizeGLScene(10,.6); + if(zoom)ReSizeGLScene(fov/4,.6); nocolors=0; diff --git a/blackshades/Source/GameInitDispose.cpp b/blackshades/Source/GameInitDispose.cpp index 8afca17..9606c09 100644 --- a/blackshades/Source/GameInitDispose.cpp +++ b/blackshades/Source/GameInitDispose.cpp @@ -3650,6 +3650,8 @@ int Game::InitGL(GLvoid) fpslimit=300; fullscreen=1; + + fov=90; //If no config, write one @@ -3716,6 +3718,10 @@ int Game::InitGL(GLvoid) opstream << fullscreen; + opstream << "\nFOV (Field of View):\n"; + + opstream << fov; + opstream.close(); } @@ -3806,6 +3812,12 @@ int Game::InitGL(GLvoid) ipstream >> fullscreen; + ipstream.ignore(256,'\n'); + + ipstream.ignore(256,'\n'); + + ipstream >> fov; + ipstream.close(); } diff --git a/blackshades/Source/GameLoop.cpp b/blackshades/Source/GameLoop.cpp index 3543ecb..4776b70 100644 --- a/blackshades/Source/GameLoop.cpp +++ b/blackshades/Source/GameLoop.cpp @@ -1,10 +1,5 @@ #include "Game.h" #include "SoundFX.h" -#ifdef OS9 -#include -#else -#include -#endif extern double multiplier; @@ -348,8 +343,6 @@ static void DoSDLKey(Game *g, SDL_Event *event) void Game::ProcessSDLEvents(void) { SDL_Event event; - - bool checked = 0; if (SDL_PollEvent(&event)) { do { @@ -379,25 +372,6 @@ void Game::ProcessSDLEvents(void) case SDL_KEYUP: DoSDLKey(this, &event); break; - case SDL_MOUSEMOTION: - if (!fullscreen && !mainmenu && gameinprogress) - { - if(checked) - { - int centerX = screenwidth/2; - int centerY = screenheight/2; - if (x != centerX || y != centerY) - { - glutWarpPointer(centerX, centerY); - } - checked = false; - } - else if(!checked) - { - checked = true; - } - } - break; case SDL_QUIT: exit(0); } diff --git a/blackshades/Source/GameTick.cpp b/blackshades/Source/GameTick.cpp index 1a8788f..d58fa0c 100644 --- a/blackshades/Source/GameTick.cpp +++ b/blackshades/Source/GameTick.cpp @@ -71,7 +71,7 @@ void Game::Splat(int k){ person[k].DoAnimations(k); - person[k].skeleton.offset=0; + person[k].skeleton.offsetted=0; person[k].skeleton.free=1; @@ -951,13 +951,13 @@ void Game::Tick(){ if(k!=0){ /* TODO: huh? */ - beginx==person[k].whichblockx; + beginx=person[k].whichblockx; - beginz==person[k].whichblocky; + beginz=person[k].whichblocky; - endx==person[k].whichblockx; + endx=person[k].whichblockx; - endz==person[k].whichblocky; + endz=person[k].whichblocky; } @@ -2467,7 +2467,7 @@ void Game::Tick(){ if(person[i].health<=0){ - person[i].skeleton.offset=0; + person[i].skeleton.offsetted=0; person[i].skeleton.free=1; @@ -3729,7 +3729,7 @@ void Game::Tick(){ if(person[whichhit].health<=0){ - person[whichhit].skeleton.offset=0; + person[whichhit].skeleton.offsetted=0; if(person[whichhit].skeleton.free!=1){ @@ -3781,7 +3781,7 @@ void Game::Tick(){ if(person[whichhit].health>0){ - if(person[whichhit].killtargetvisible==0&&person[whichhit].type!=zombietype&&person[whichhit].currentanimation!=getupfrontanim&person[whichhit].currentanimation!=getupbackanim){ + if(person[whichhit].killtargetvisible==0 && person[whichhit].type!=zombietype && person[whichhit].currentanimation!=getupfrontanim && person[whichhit].currentanimation!=getupbackanim){ if(hitstruct.joint1->modelnum==headmodel)person[whichhit].targetanimation=headpainanim; @@ -3803,7 +3803,7 @@ void Game::Tick(){ } - person[whichhit].skeleton.offset=1; + person[whichhit].skeleton.offsetted=1; for(int j=0;jx - b->x)*(a->x - b->x) + (c->y - b->y)*(a->y - b->y) + (c->z - b->z)*(a->z - b->z); - if (!dot_ta <= 0&&!dot_tb <= 0){ + if (dot_ta <= 0 && dot_tb <= 0){ @@ -4570,7 +4570,7 @@ void Game::Tick(){ if(sprites.size[i]<=1)//alSourcePlay(gSourceID[src_bodywhacksound]); SoundFX::inst()->playFX(gSampleSet[bodywhacksound], gLoc); - person[j].skeleton.offset=1; + person[j].skeleton.offsetted=1; for(int k=0;kplayFX(gSampleSet[bodyhitsound], gLoc, 0.1, 1.0f, true); + SoundFX::inst()->playFX(gSampleSet[bodyhitsound], gLoc, 0.1f, 1.0f, true); //alSourcei(gSourceID[src_bodyhitsound], AL_BUFFER, gSampleSet[bodyhitsound]); //alSourcefv(gSourceID[src_bodyhitsound], AL_POSITION, gLoc); //alSourcePlay(gSourceID[src_bodyhitsound]); @@ -259,7 +259,7 @@ void Person::DoAnimations(int who){ targetanimation=idleanim; } if(currentanimation==thrownanim&&targetframe==0){ - skeleton.offset=0; + skeleton.offsetted=0; skeleton.free=1; longdead=1; for(int j=0;j0&&reloading<=0){ if(whichgun!=grenade){ float gLoc[3]; - ALint tempint; + //ALint tempint; gLoc[0]=playercoords.x/soundscalefactor; gLoc[1]=playercoords.y/soundscalefactor; gLoc[2]=playercoords.z/soundscalefactor; @@ -671,9 +671,9 @@ void Person::DoStuff(int who){ if(who==0&&targetanimation!=diveanim&&targetanimation!=throwanim&&targetanimation!=thrownanim&¤tanimation!=diveanim&¤tanimation!=getupfrontanim){ backwardsanim=0; if(visions==1)speed=40; - if(visions==0&&targetanimation==joganim)speed=2.2; - if(visions==0&&targetanimation!=joganim)speed=1.3; - if(visions==0&&targetanimation==walkanim)speed=2.5; + if(visions==0&&targetanimation==joganim)speed=2.2f; + if(visions==0&&targetanimation!=joganim)speed=1.3f; + if(visions==0&&targetanimation==walkanim)speed=2.5f; unsigned char theKeyMap[16]; GetKeys( ( unsigned long * )theKeyMap ); @@ -808,7 +808,7 @@ void Person::FindRotationGun(XYZ start, XYZ target) extern Model skeletonmodels[10]; extern Costume costume[2]; int Person::DrawSkeleton(int who){ - GLfloat M[16]; + //GLfloat M[16]; //Guns if(whichgun==sniperrifle){ FindRotationGun(skeleton.joints[skeleton.jointlabels[righthand]].position,skeleton.joints[skeleton.jointlabels[lefthand]].position); @@ -833,7 +833,7 @@ int Person::DrawSkeleton(int who){ glRotatef(-gunrotate1+90+1,0,1,0); glRotatef(-gunrotate2+90,0,0,1); glRotatef(-gunrotate3,0,1,0); - glTranslatef(0,-.4,0); + glTranslatef(0,-.4f,0); gunmodels[shotgunmodel].draw(); glPopMatrix(); } @@ -852,8 +852,8 @@ int Person::DrawSkeleton(int who){ } if(whichgun==handgun1){ - if(!thirdperson&&who==0)FindRotationGun(skeleton.joints[skeleton.jointlabels[righthand]].position,(skeleton.joints[skeleton.jointlabels[head]].position*.65+skeleton.joints[skeleton.jointlabels[neck]].position*.35)); - if(thirdperson||who!=0)FindRotationGun(skeleton.joints[skeleton.jointlabels[righthand]].position,(skeleton.joints[skeleton.jointlabels[head]].position*.35+skeleton.joints[skeleton.jointlabels[neck]].position*.65)); + if(!thirdperson&&who==0)FindRotationGun(skeleton.joints[skeleton.jointlabels[righthand]].position,(skeleton.joints[skeleton.jointlabels[head]].position*.65f+skeleton.joints[skeleton.jointlabels[neck]].position*.35f)); + if(thirdperson||who!=0)FindRotationGun(skeleton.joints[skeleton.jointlabels[righthand]].position,(skeleton.joints[skeleton.jointlabels[head]].position*.35f+skeleton.joints[skeleton.jointlabels[neck]].position*.65f)); glPushMatrix(); glTranslatef( skeleton.joints[skeleton.jointlabels[righthand]].position.x, skeleton.joints[skeleton.jointlabels[righthand]].position.y, @@ -861,7 +861,7 @@ int Person::DrawSkeleton(int who){ glRotatef(-gunrotate1+90-1.5,0,1,0); glRotatef(-gunrotate2+90,0,0,1); glRotatef(-gunrotate3,0,1,0); - glTranslatef(0,0,.15); + glTranslatef(0,0,.15f); gunmodels[handgunbasemodel].draw(); glTranslatef(0,-recoil*.3,0); gunmodels[handgunslidemodel].draw(); @@ -869,8 +869,8 @@ int Person::DrawSkeleton(int who){ } if(whichgun==handgun2){ - if(!thirdperson&&who==0)FindRotationGun(skeleton.joints[skeleton.jointlabels[righthand]].position,(skeleton.joints[skeleton.jointlabels[head]].position*.65+skeleton.joints[skeleton.jointlabels[neck]].position*.35)); - if(thirdperson||who!=0)FindRotationGun(skeleton.joints[skeleton.jointlabels[righthand]].position,(skeleton.joints[skeleton.jointlabels[head]].position*.35+skeleton.joints[skeleton.jointlabels[neck]].position*.65)); + if(!thirdperson&&who==0)FindRotationGun(skeleton.joints[skeleton.jointlabels[righthand]].position,(skeleton.joints[skeleton.jointlabels[head]].position*.65f+skeleton.joints[skeleton.jointlabels[neck]].position*.35f)); + if(thirdperson||who!=0)FindRotationGun(skeleton.joints[skeleton.jointlabels[righthand]].position,(skeleton.joints[skeleton.jointlabels[head]].position*.35f+skeleton.joints[skeleton.jointlabels[neck]].position*.65f)); glPushMatrix(); glTranslatef( skeleton.joints[skeleton.jointlabels[righthand]].position.x, skeleton.joints[skeleton.jointlabels[righthand]].position.y, @@ -878,7 +878,7 @@ int Person::DrawSkeleton(int who){ glRotatef(-gunrotate1+90-1.5,0,1,0); glRotatef(-gunrotate2+90,0,0,1); glRotatef(-gunrotate3,0,1,0); - glTranslatef(0,0,.15); + glTranslatef(0,0,.15f); gunmodels[handgun2basemodel].draw(); glTranslatef(0,-recoil*.3,0); gunmodels[handgun2slidemodel].draw(); @@ -891,11 +891,11 @@ int Person::DrawSkeleton(int who){ skeleton.joints[skeleton.jointlabels[righthand]].position.y, skeleton.joints[skeleton.jointlabels[righthand]].position.z); glRotatef(-90,1,0,0); - glTranslatef(0,0,.05); + glTranslatef(0,0,.05f); if(reloading<=0){ gunmodels[grenadebasemodel].draw(); if(grenphase==0)gunmodels[grenadepinmodel].draw(); - glTranslatef(0,0,.005); + glTranslatef(0,0,.005f); gunmodels[grenadespoonmodel].draw(); } glPopMatrix(); @@ -907,7 +907,7 @@ int Person::DrawSkeleton(int who){ skeleton.joints[skeleton.jointlabels[lefthand]].position.y, skeleton.joints[skeleton.jointlabels[lefthand]].position.z); glRotatef(-90,1,0,0); - glTranslatef(0,0,-.15); + glTranslatef(0,0,-.15f); if(reloading<=0){ if(grenphase==1)gunmodels[grenadepinmodel].draw(); } @@ -931,11 +931,11 @@ int Person::DrawSkeleton(int who){ } //Find forward vectors - if(who==0||skeleton.free!=0||skeleton.offset!=0||whichgun!=nogun||currentanimation==lyinganim||((currentanimation==getupfrontanim||currentanimation==getupbackanim)&&targetanimation==idleanim)){ + if(who==0||skeleton.free!=0||skeleton.offsetted!=0||whichgun!=nogun||currentanimation==lyinganim||((currentanimation==getupfrontanim||currentanimation==getupbackanim)&&targetanimation==idleanim)){ if(!(skeleton.free==1&&longdead<=0)){ - if(skeleton.offset&&skeleton.free<1){ + if(skeleton.offsetted&&skeleton.free<1){ XYZ normal; - skeleton.offset=0; + skeleton.offsetted=0; for(int i=0;i0&&health==100&&whichgun!=nogun){ @@ -983,11 +983,11 @@ int Person::DrawSkeleton(int who){ skeleton.specialforward[3]=skeleton.joints[skeleton.jointlabels[righthip]].position+skeleton.joints[skeleton.jointlabels[rightankle]].position; skeleton.specialforward[3]=skeleton.specialforward[3]/2-skeleton.joints[skeleton.jointlabels[rightknee]].position; - skeleton.specialforward[3]+=skeleton.lowforward*.2; + skeleton.specialforward[3]+=skeleton.lowforward*.2f; Normalise(&skeleton.specialforward[3]); skeleton.specialforward[4]=skeleton.joints[skeleton.jointlabels[lefthip]].position+skeleton.joints[skeleton.jointlabels[leftankle]].position; skeleton.specialforward[4]=skeleton.specialforward[4]/2-skeleton.joints[skeleton.jointlabels[leftknee]].position; - skeleton.specialforward[4]+=skeleton.lowforward*.2; + skeleton.specialforward[4]+=skeleton.lowforward*.2f; Normalise(&skeleton.specialforward[4]); //Find joint rotations @@ -1059,11 +1059,11 @@ int Person::DrawSkeleton(int who){ glRotatef(-skeleton.joints[skeleton.jointlabels[righthand]].rotate1+90-1.5,0,1,0); glRotatef(-skeleton.joints[skeleton.jointlabels[righthand]].rotate2+90,0,0,1); glRotatef(-skeleton.joints[skeleton.jointlabels[righthand]].rotate3,0,1,0); - glTranslatef(0,-.2,0); + glTranslatef(0,-.2f,0); gunmodels[knifemodel].draw(); glPopMatrix(); } - if(skeleton.offset&&skeleton.free<1){ + if(skeleton.offsetted && skeleton.free<1){ for(int i=0;i= 1.0) { - fourD = 2.0*fast_sqrt(Tr); - q[3] = fourD/4.0; + fourD = 2.0f*fast_sqrt(Tr); + q[3] = fourD/4.0f; q[0] = (m[2][1] - m[1][2]) / fourD; q[1] = (m[0][2] - m[2][0]) / fourD; q[2] = (m[1][0] - m[0][1]) / fourD; @@ -142,8 +142,8 @@ quaternion To_Quat(Matrix_t m) } j = (i+1)%3; k = (j+1)%3; - fourD = 2.0*fast_sqrt(m[i][i] - m[j][j] - m[k][k] + 1.0); - q[i] = fourD / 4.0; + fourD = 2.0f*fast_sqrt(m[i][i] - m[j][j] - m[k][k] + 1.0f); + q[i] = fourD / 4.0f; q[j] = (m[j][i] + m[i][j]) / fourD; q[k] = (m[k][i] + m[i][k]) / fourD; q[3] = (m[j][k] - m[k][j]) / fourD; @@ -187,10 +187,10 @@ quaternion To_Quat(angle_axis Ang_Ax) // From the Quaternion Powers article on gamedev.net quaternion Quat; - Quat.x = Ang_Ax.x * sin(Ang_Ax.angle / 2); - Quat.y = Ang_Ax.y * sin(Ang_Ax.angle / 2); - Quat.z = Ang_Ax.z * sin(Ang_Ax.angle / 2); - Quat.w = cos(Ang_Ax.angle / 2); + Quat.x = Ang_Ax.x * sinf(Ang_Ax.angle / 2); + Quat.y = Ang_Ax.y * sinf(Ang_Ax.angle / 2); + Quat.z = Ang_Ax.z * sinf(Ang_Ax.angle / 2); + Quat.w = cosf(Ang_Ax.angle / 2); return Quat; } angle_axis Quat_2_AA(quaternion Quat) @@ -203,7 +203,7 @@ angle_axis Quat_2_AA(quaternion Quat) Ang_Ax.y = Quat.y / scale; Ang_Ax.z = Quat.z / scale; - Ang_Ax.angle = 2.0 * acos(Quat.w)/(float)PI*180; + Ang_Ax.angle = 2.0f * acosf(Quat.w)/(float)PI*180; return Ang_Ax; } @@ -301,7 +301,7 @@ float fast_sqrt (register float arg) return result * arg; #else - return sqrt(arg); + return sqrtf(arg); #endif } @@ -393,8 +393,9 @@ bool PointInTriangle(Vector *p, Vector normal, float p11, float p12, float p13, bool LineFacet(Vector p1,Vector p2,Vector pa,Vector pb,Vector pc,Vector *p) { float d; - float a1,a2,a3; - float total,denom,mu; + //float a1,a2,a3; + //float total,denom,mu; + float denom,mu; Vector n,pa1,pa2,pa3; //Calculate the parameters for the plane @@ -406,7 +407,7 @@ bool LineFacet(Vector p1,Vector p2,Vector pa,Vector pb,Vector pc,Vector *p) //Calculate the position on the line that intersects the plane denom = n.x * (p2.x - p1.x) + n.y * (p2.y - p1.y) + n.z * (p2.z - p1.z); - if (abs(denom) < 0.0000001) // Line and plane don't intersect + if (fabs(denom) < 0.0000001f) // Line and plane don't intersect return 0; mu = - (d + n.x * p1.x + n.y * p1.y + n.z * p1.z) / denom; p->x = p1.x + mu * (p2.x - p1.x); @@ -488,9 +489,11 @@ bool PointInTriangle(XYZ *p, XYZ normal, XYZ *p1, XYZ *p2, XYZ *p3) bool LineFacet(XYZ p1,XYZ p2,XYZ pa,XYZ pb,XYZ pc,XYZ *p) { float d; - float a1,a2,a3; - float total,denom,mu; - XYZ n,pa1,pa2,pa3; + //float a1,a2,a3; + //float total,denom,mu; + float denom,mu; + //XYZ n,pa1,pa2,pa3; + XYZ n; //Calculate the parameters for the plane n.x = (pb.y - pa.y)*(pc.z - pa.z) - (pb.z - pa.z)*(pc.y - pa.y); @@ -501,7 +504,7 @@ bool LineFacet(XYZ p1,XYZ p2,XYZ pa,XYZ pb,XYZ pc,XYZ *p) //Calculate the position on the line that intersects the plane denom = n.x * (p2.x - p1.x) + n.y * (p2.y - p1.y) + n.z * (p2.z - p1.z); - if (abs(denom) < 0.0000001) // Line and plane don't intersect + if (fabs(denom) < 0.0000001f) // Line and plane don't intersect return 0; mu = - (d + n.x * p1.x + n.y * p1.y + n.z * p1.z) / denom; p->x = p1.x + mu * (p2.x - p1.x); @@ -532,7 +535,7 @@ float LineFacetd(XYZ p1,XYZ p2,XYZ pa,XYZ pb,XYZ pc,XYZ *p) //Calculate the position on the line that intersects the plane denom = n.x * (p2.x - p1.x) + n.y * (p2.y - p1.y) + n.z * (p2.z - p1.z); - if (abs(denom) < 0.0000001) // Line and plane don't intersect + if (fabs(denom) < 0.0000001f) // Line and plane don't intersect return 0; mu = - (d + n.x * p1.x + n.y * p1.y + n.z * p1.z) / denom; p->x = p1.x + mu * (p2.x - p1.x); @@ -554,7 +557,7 @@ float LineFacetd(XYZ p1,XYZ p2,XYZ pa,XYZ pb,XYZ pc, XYZ n, XYZ *p) //Calculate the position on the line that intersects the plane denom = n.x * (p2.x - p1.x) + n.y * (p2.y - p1.y) + n.z * (p2.z - p1.z); - if (abs(denom) < 0.0000001) // Line and plane don't intersect + if (fabs(denom) < 0.0000001f) // Line and plane don't intersect return 0; mu = - (d + n.x * p1.x + n.y * p1.y + n.z * p1.z) / denom; p->x = p1.x + mu * (p2.x - p1.x); @@ -575,7 +578,7 @@ float LineFacetd(XYZ *p1,XYZ *p2,XYZ *pa,XYZ *pb,XYZ *pc, XYZ *n, XYZ *p) //Calculate the position on the line that intersects the plane denom = n->x * (p2->x - p1->x) + n->y * (p2->y - p1->y) + n->z * (p2->z - p1->z); - if (abs(denom) < 0.0000001) // Line and plane don't intersect + if (fabs(denom) < 0.0000001f) // Line and plane don't intersect return 0; mu = - (d + n->x * p1->x + n->y * p1->y + n->z * p1->z) / denom; p->x = p1->x + mu * (p2->x - p1->x); @@ -634,36 +637,36 @@ float findDistancefast(XYZ point1, XYZ point2){ XYZ DoRotation(XYZ thePoint, float xang, float yang, float zang){ XYZ newpoint; if(xang){ - xang*=6.283185; + xang*=6.283185f; xang/=360; } if(yang){ - yang*=6.283185; + yang*=6.283185f; yang/=360; } if(zang){ - zang*=6.283185; + zang*=6.283185f; zang/=360; } if(yang){ - newpoint.z=thePoint.z*cos(yang)-thePoint.x*sin(yang); - newpoint.x=thePoint.z*sin(yang)+thePoint.x*cos(yang); + newpoint.z=thePoint.z*cosf(yang)-thePoint.x*sinf(yang); + newpoint.x=thePoint.z*sinf(yang)+thePoint.x*cosf(yang); thePoint.z=newpoint.z; thePoint.x=newpoint.x; } if(zang){ - newpoint.x=thePoint.x*cos(zang)-thePoint.y*sin(zang); - newpoint.y=thePoint.y*cos(zang)+thePoint.x*sin(zang); + newpoint.x=thePoint.x*cosf(zang)-thePoint.y*sinf(zang); + newpoint.y=thePoint.y*cosf(zang)+thePoint.x*sinf(zang); thePoint.x=newpoint.x; thePoint.y=newpoint.y; } if(xang){ - newpoint.y=thePoint.y*cos(xang)-thePoint.z*sin(xang); - newpoint.z=thePoint.y*sin(xang)+thePoint.z*cos(xang); + newpoint.y=thePoint.y*cosf(xang)-thePoint.z*sinf(xang); + newpoint.z=thePoint.y*sinf(xang)+thePoint.z*cosf(xang); thePoint.z=newpoint.z; thePoint.y=newpoint.y; } @@ -723,22 +726,22 @@ XYZ DoRotationRadian(XYZ thePoint, float xang, float yang, float zang){ oldpoint=thePoint; if(yang!=0){ - newpoint.z=oldpoint.z*cos(yang)-oldpoint.x*sin(yang); - newpoint.x=oldpoint.z*sin(yang)+oldpoint.x*cos(yang); + newpoint.z=oldpoint.z*cosf(yang)-oldpoint.x*sinf(yang); + newpoint.x=oldpoint.z*sinf(yang)+oldpoint.x*cosf(yang); oldpoint.z=newpoint.z; oldpoint.x=newpoint.x; } if(zang!=0){ - newpoint.x=oldpoint.x*cos(zang)-oldpoint.y*sin(zang); - newpoint.y=oldpoint.y*cos(zang)+oldpoint.x*sin(zang); + newpoint.x=oldpoint.x*cosf(zang)-oldpoint.y*sinf(zang); + newpoint.y=oldpoint.y*cosf(zang)+oldpoint.x*sinf(zang); oldpoint.x=newpoint.x; oldpoint.y=newpoint.y; } if(xang!=0){ - newpoint.y=oldpoint.y*cos(xang)-oldpoint.z*sin(xang); - newpoint.z=oldpoint.y*sin(xang)+oldpoint.z*cos(xang); + newpoint.y=oldpoint.y*cosf(xang)-oldpoint.z*sinf(xang); + newpoint.z=oldpoint.y*sinf(xang)+oldpoint.z*cosf(xang); oldpoint.z=newpoint.z; oldpoint.y=newpoint.y; } diff --git a/blackshades/Source/Skeleton.cpp b/blackshades/Source/Skeleton.cpp index 7adfdb1..2f30158 100644 --- a/blackshades/Source/Skeleton.cpp +++ b/blackshades/Source/Skeleton.cpp @@ -109,7 +109,7 @@ void Skeleton::DoConstraints(Model *collide, XYZ *move, float rotation) numrepeats=2; groundlevel=0; - move->y+=.35; + move->y+=.35f; for(int j=0; jnormals[whichtri].y<=.8){ + offset =.2f; + if(whichtri!=-1&&collide->normals[whichtri].y<=.8f){ normalrotated=DoRotation(collide->normals[whichtri],0,rotation,0); joints[i].position=impact+normalrotated*offset; ReflectVector(&joints[i].velocity,&normalrotated); - joints[i].velocity*=.3; + joints[i].velocity*=.3f; } if(broken<=1){ XYZ avgvelocity; avgvelocity=0; float gLoc[3]; - ALint tempint; + //ALint tempint; for(int k=0; kposition.x,muscles[i].parent2->position.y,muscles[i].parent2->position.z); } } - glColor3f(.6,.6,0); + glColor3f(.6f,.6f,0); if(muscleview==1) for(int i=0; i=0&attach2=0&&attach1!=attach2){ + if(num_muscles=0 && attach2=0 && attach1!=attach2){ muscles[num_muscles].parent1=&joints[attach1]; muscles[num_muscles].parent2=&joints[attach2]; muscles[num_muscles].length=findDistance(muscles[num_muscles].parent1->position,muscles[num_muscles].parent2->position); muscles[num_muscles].targetlength=findDistance(muscles[num_muscles].parent1->position,muscles[num_muscles].parent2->position); - muscles[num_muscles].strength=.7; + muscles[num_muscles].strength=.7f; muscles[num_muscles].type=type; muscles[num_muscles].minlength=minlength; muscles[num_muscles].maxlength=maxlength; @@ -489,7 +489,7 @@ void Skeleton::FindRotationMuscle(int which) temppoint1.y=0; temppoint2.y=0; muscles[which].rotate1=acos((temppoint1.z-temppoint2.z)/findDistance(temppoint1,temppoint2)); - muscles[which].rotate1*=360/6.28; + muscles[which].rotate1*=360/6.28f; if(temppoint1.x>temppoint2.x)muscles[which].rotate1=360-muscles[which].rotate1; if(muscles[which].parent1->label==head)tempforward=specialforward[0]; else if(muscles[which].parent1->label==rightshoulder||muscles[which].parent1->label==rightelbow||muscles[which].parent1->label==rightwrist)tempforward=specialforward[1]; @@ -559,20 +559,20 @@ void Animation::Load(char *fileName) testskeleton.specialforward[1]=testskeleton.joints[testskeleton.jointlabels[rightshoulder]].position+testskeleton.joints[testskeleton.jointlabels[rightwrist]].position; testskeleton.specialforward[1]=testskeleton.joints[testskeleton.jointlabels[rightelbow]].position-testskeleton.specialforward[1]/2; - testskeleton.specialforward[1]+=testskeleton.forward*.2; + testskeleton.specialforward[1]+=testskeleton.forward*.2f; Normalise(&testskeleton.specialforward[1]); testskeleton.specialforward[2]=testskeleton.joints[testskeleton.jointlabels[leftshoulder]].position+testskeleton.joints[testskeleton.jointlabels[leftwrist]].position; testskeleton.specialforward[2]=testskeleton.joints[testskeleton.jointlabels[leftelbow]].position-testskeleton.specialforward[2]/2; - testskeleton.specialforward[2]+=testskeleton.forward*.2; + testskeleton.specialforward[2]+=testskeleton.forward*.2f; Normalise(&testskeleton.specialforward[2]); testskeleton.specialforward[3]=testskeleton.joints[testskeleton.jointlabels[righthip]].position+testskeleton.joints[testskeleton.jointlabels[rightankle]].position; testskeleton.specialforward[3]=testskeleton.specialforward[3]/2-testskeleton.joints[testskeleton.jointlabels[rightknee]].position; - testskeleton.specialforward[3]+=testskeleton.lowforward*.2; + testskeleton.specialforward[3]+=testskeleton.lowforward*.2f; Normalise(&testskeleton.specialforward[3]); testskeleton.specialforward[4]=testskeleton.joints[testskeleton.jointlabels[lefthip]].position+testskeleton.joints[testskeleton.jointlabels[leftankle]].position; testskeleton.specialforward[4]=testskeleton.specialforward[4]/2-testskeleton.joints[testskeleton.jointlabels[leftknee]].position; - testskeleton.specialforward[4]+=testskeleton.lowforward*.2; + testskeleton.specialforward[4]+=testskeleton.lowforward*.2f; Normalise(&testskeleton.specialforward[4]); //Find joint rotations @@ -703,20 +703,20 @@ void Animation::Load(char *fileName, float rotate) testskeleton.specialforward[1]=testskeleton.joints[testskeleton.jointlabels[rightshoulder]].position+testskeleton.joints[testskeleton.jointlabels[rightwrist]].position; testskeleton.specialforward[1]=testskeleton.joints[testskeleton.jointlabels[rightelbow]].position-testskeleton.specialforward[1]/2; - testskeleton.specialforward[1]+=testskeleton.forward*.2; + testskeleton.specialforward[1]+=testskeleton.forward*.2f; Normalise(&testskeleton.specialforward[1]); testskeleton.specialforward[2]=testskeleton.joints[testskeleton.jointlabels[leftshoulder]].position+testskeleton.joints[testskeleton.jointlabels[leftwrist]].position; testskeleton.specialforward[2]=testskeleton.joints[testskeleton.jointlabels[leftelbow]].position-testskeleton.specialforward[2]/2; - testskeleton.specialforward[2]+=testskeleton.forward*.2; + testskeleton.specialforward[2]+=testskeleton.forward*.2f; Normalise(&testskeleton.specialforward[2]); testskeleton.specialforward[3]=testskeleton.joints[testskeleton.jointlabels[righthip]].position+testskeleton.joints[testskeleton.jointlabels[rightankle]].position; testskeleton.specialforward[3]=testskeleton.specialforward[3]/2-testskeleton.joints[testskeleton.jointlabels[rightknee]].position; - testskeleton.specialforward[3]+=testskeleton.lowforward*.2; + testskeleton.specialforward[3]+=testskeleton.lowforward*.2f; Normalise(&testskeleton.specialforward[3]); testskeleton.specialforward[4]=testskeleton.joints[testskeleton.jointlabels[lefthip]].position+testskeleton.joints[testskeleton.jointlabels[leftankle]].position; testskeleton.specialforward[4]=testskeleton.specialforward[4]/2-testskeleton.joints[testskeleton.jointlabels[leftknee]].position; - testskeleton.specialforward[4]+=testskeleton.lowforward*.2; + testskeleton.specialforward[4]+=testskeleton.lowforward*.2f; Normalise(&testskeleton.specialforward[4]); //Find joint rotations diff --git a/blackshades/Source/Skeleton.h b/blackshades/Source/Skeleton.h index 7cac7fe..bfff251 100644 --- a/blackshades/Source/Skeleton.h +++ b/blackshades/Source/Skeleton.h @@ -140,11 +140,11 @@ class Skeleton XYZ lowforward; int broken; - bool offset; + bool offsetted; XYZ specialforward[5]; - bool free; + int free; Files files; diff --git a/blackshades/Source/Sprites.cpp b/blackshades/Source/Sprites.cpp index f0e2588..586a166 100644 --- a/blackshades/Source/Sprites.cpp +++ b/blackshades/Source/Sprites.cpp @@ -351,11 +351,11 @@ void Sprites::draw() { float M[16]; XYZ begProj,endProj,avgProj,persp; - XYZ between; + //XYZ between; float oolen,dx,dy; float bulletsize; XYZ point; - glAlphaFunc(GL_GREATER, 0.01); + glAlphaFunc(GL_GREATER, 0.01f); //glEnable(GL_POLYGON_OFFSET_FILL); @@ -364,7 +364,7 @@ void Sprites::draw() glEnable(GL_TEXTURE_2D); glDisable(GL_LIGHTING); glDepthMask(0); - glAlphaFunc(GL_GREATER, 0.01); + glAlphaFunc(GL_GREATER, 0.01f); for(int i=0;i