}
bool alldead = true;
for (i = 1; i < numplayers; i++) {
- if (player[i].dead != 2)alldead = 0;
+ if (player[i].dead != 2)
+ alldead = 0;
}
if (alldead) {
awards[numawards] = awardalldead;
}
alldead = 1;
for (i = 1; i < numplayers; i++) {
- if (player[i].dead != 1)alldead = 0;
+ if (player[i].dead != 1)
+ alldead = 0;
}
if (alldead) {
awards[numawards] = awardnodead;
}
alldead = 1;
for (i = 1; i < numplayers; i++) {
- if (player[i].dead != 2)alldead = 0;
+ if (player[i].dead != 2)
+ alldead = 0;
}
if (numafterkill > 0 && alldead) {
awards[numawards] = awardbrutal;
if (!mainmenu) {
if (editorenabled) {
numboundaries = mapradius * 2;
- if (numboundaries > 360)numboundaries = 360;
+ if (numboundaries > 360)
+ numboundaries = 360;
for (i = 0; i < numboundaries; i++) {
boundary[i] = 0;
boundary[i].z = 1;
if ((freeze || winfreeze) && ismotionblur && !mainmenu)
drawmode = radialzoommode;
- if (winfreeze || mainmenu)drawmode = normalmode;
+ if (winfreeze || mainmenu)
+ drawmode = normalmode;
#if PLATFORM_MACOSX
if (drawmode == glowmode) {
for (l = 0; l < terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz]; l++) {
j = terrain.patchobjects[player[k].whichpatchx][player[k].whichpatchz][l];
if (objects.position[j].y < player[k].coords.y || objects.type[j] == tunneltype || objects.type[j] == weirdtype) {
- if (player[k].skeleton.free)point = DoRotation(player[k].skeleton.joints[i].position * player[k].scale + player[k].coords - objects.position[j], 0, -objects.yaw[j], 0);
- else point = DoRotation(DoRotation(player[k].skeleton.joints[i].position, 0, player[k].yaw, 0) * player[k].scale + player[k].coords - objects.position[j], 0, -objects.yaw[j], 0);
+ if (player[k].skeleton.free)
+ point = DoRotation(player[k].skeleton.joints[i].position * player[k].scale + player[k].coords - objects.position[j], 0, -objects.yaw[j], 0);
+ else
+ point = DoRotation(DoRotation(player[k].skeleton.joints[i].position, 0, player[k].yaw, 0) * player[k].scale + player[k].coords - objects.position[j], 0, -objects.yaw[j], 0);
size = .4f;
opacity = .4f;
if (k != 0 && tutoriallevel == 1) {
if (i != -1) {
player[k].occluded += 1;
player[k].lastoccluded = i;
- } else
+ } else {
player[k].occluded = 0;
+ }
if (player[k].occluded < 25)
player[k].DrawSkeleton();
}
if (i != -1) {
player[k].occluded += 1;
player[k].lastoccluded = i;
- } else
+ } else {
player[k].occluded = 0;
+ }
if (player[k].occluded < 25)
player[k].DrawSkeleton();
}
if (tutoriallevel == 1) {
tutorialopac = tutorialmaxtime - tutorialstagetime;
- if (tutorialopac > 1)tutorialopac = 1;
- if (tutorialopac < 0)tutorialopac = 0;
+ if (tutorialopac > 1)
+ tutorialopac = 1;
+ if (tutorialopac < 0)
+ tutorialopac = 0;
sprintf (string, " ");
sprintf (string2, " ");
sprintf (string3, " ");
}
if (tutorialstage == 15) {
- if (attackkey == MOUSEBUTTON1)sprintf (string, "Click to attack when you are near an enemy.");
- else sprintf (string, "Press %s to attack when you are near an enemy.", Input::keyToChar(attackkey));
+ if (attackkey == MOUSEBUTTON1)
+ sprintf (string, "Click to attack when you are near an enemy.");
+ else
+ sprintf (string, "Press %s to attack when you are near an enemy.", Input::keyToChar(attackkey));
sprintf (string2, "You can punch by standing still near an enemy and attacking.");
sprintf (string3, " ");
}
}
if (tutorialstage == 20) {
sprintf (string, "Your most powerful individual attack is the rabbit kick.");
- if (attackkey == MOUSEBUTTON1)sprintf (string2, "Run at the enemy while holding the mouse button, and press");
- else sprintf (string2, "Run at the enemy while holding %s, and press", Input::keyToChar(attackkey));
+ if (attackkey == MOUSEBUTTON1)
+ sprintf (string2, "Run at the enemy while holding the mouse button, and press");
+ else
+ sprintf (string2, "Run at the enemy while holding %s, and press", Input::keyToChar(attackkey));
sprintf (string3, "the jump key (%s) to attack.", Input::keyToChar(jumpkey));
}
if (tutorialstage == 21) {
sprintf (string, "This attack is devastating if timed correctly.");
sprintf (string2, "Even if timed incorrectly, it will knock the enemy over.");
- if (againbonus)sprintf (string3, "Try rabbit-kicking the imaginary enemy again.");
- else sprintf (string3, "Try rabbit-kicking the imaginary enemy.");
+ if (againbonus)
+ sprintf (string3, "Try rabbit-kicking the imaginary enemy again.");
+ else
+ sprintf (string3, "Try rabbit-kicking the imaginary enemy.");
}
if (tutorialstage == 22) {
sprintf (string, "If you sneak behind an enemy unnoticed, you can kill");
}
if (tutorialstage == 24) {
sprintf (string, "You can tackle enemies by running at them animal-style");
- if (attackkey == MOUSEBUTTON1)sprintf (string2, "and pressing jump (%s) or attack(mouse button).", Input::keyToChar(jumpkey));
- else sprintf (string2, "and pressing jump (%s) or attack(%s).", Input::keyToChar(jumpkey), Input::keyToChar(attackkey));
+ if (attackkey == MOUSEBUTTON1)
+ sprintf (string2, "and pressing jump (%s) or attack(mouse button).", Input::keyToChar(jumpkey));
+ else
+ sprintf (string2, "and pressing jump (%s) or attack(%s).", Input::keyToChar(jumpkey), Input::keyToChar(attackkey));
sprintf (string3, "This is especially useful when they are running away.");
}
if (tutorialstage == 25) {
tutorialstagetime = 0;
tutorialmaxtime = 1;
tutorialopac = tutorialmaxtime - tutorialstagetime;
- if (tutorialopac > 1)tutorialopac = 1;
- if (tutorialopac < 0)tutorialopac = 0;
+ if (tutorialopac > 1)
+ tutorialopac = 1;
+ if (tutorialopac < 0)
+ tutorialopac = 0;
sprintf (string, "%s", hotspottext[closest]);
text->glPrint(screenwidth / 2 - 7.6 * (i - lastline)*screenwidth / 1024, screenheight / 16 + screenheight * 4 / 5 - 20 * screenwidth / 1024 * line, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight, lastline, i);
lastline = i + 1;
line++;
- if (string[i] == '\0')done = 1;
+ if (string[i] == '\0')
+ done = 1;
}
- if (i >= 255)done = 1;
+ if (i >= 255)
+ done = 1;
i++;
}
} else if (hotspottype[closest] >= 20 && dialoguegonethrough[hotspottype[closest] - 20] == 0) {
dialoguegonethrough[whichdialogue]++;
if (dialogueboxsound[whichdialogue][indialogue] != 0) {
int whichsoundplay;
- if (dialogueboxsound[whichdialogue][indialogue] == 1)whichsoundplay = rabbitchitter;
- if (dialogueboxsound[whichdialogue][indialogue] == 2)whichsoundplay = rabbitchitter2;
- if (dialogueboxsound[whichdialogue][indialogue] == 3)whichsoundplay = rabbitpainsound;
- if (dialogueboxsound[whichdialogue][indialogue] == 4)whichsoundplay = rabbitpain1sound;
- if (dialogueboxsound[whichdialogue][indialogue] == 5)whichsoundplay = rabbitattacksound;
- if (dialogueboxsound[whichdialogue][indialogue] == 6)whichsoundplay = rabbitattack2sound;
- if (dialogueboxsound[whichdialogue][indialogue] == 7)whichsoundplay = rabbitattack3sound;
- if (dialogueboxsound[whichdialogue][indialogue] == 8)whichsoundplay = rabbitattack4sound;
- if (dialogueboxsound[whichdialogue][indialogue] == 9)whichsoundplay = growlsound;
- if (dialogueboxsound[whichdialogue][indialogue] == 10)whichsoundplay = growl2sound;
- if (dialogueboxsound[whichdialogue][indialogue] == 11)whichsoundplay = snarlsound;
- if (dialogueboxsound[whichdialogue][indialogue] == 12)whichsoundplay = snarl2sound;
- if (dialogueboxsound[whichdialogue][indialogue] == 13)whichsoundplay = barksound;
- if (dialogueboxsound[whichdialogue][indialogue] == 14)whichsoundplay = bark2sound;
- if (dialogueboxsound[whichdialogue][indialogue] == 15)whichsoundplay = bark3sound;
- if (dialogueboxsound[whichdialogue][indialogue] == 16)whichsoundplay = barkgrowlsound;
- if (dialogueboxsound[whichdialogue][indialogue] == -1)whichsoundplay = fireendsound;
- if (dialogueboxsound[whichdialogue][indialogue] == -2)whichsoundplay = firestartsound;
- if (dialogueboxsound[whichdialogue][indialogue] == -3)whichsoundplay = consolesuccesssound;
- if (dialogueboxsound[whichdialogue][indialogue] == -4)whichsoundplay = consolefailsound;
+ if (dialogueboxsound[whichdialogue][indialogue] == 1) whichsoundplay = rabbitchitter;
+ if (dialogueboxsound[whichdialogue][indialogue] == 2) whichsoundplay = rabbitchitter2;
+ if (dialogueboxsound[whichdialogue][indialogue] == 3) whichsoundplay = rabbitpainsound;
+ if (dialogueboxsound[whichdialogue][indialogue] == 4) whichsoundplay = rabbitpain1sound;
+ if (dialogueboxsound[whichdialogue][indialogue] == 5) whichsoundplay = rabbitattacksound;
+ if (dialogueboxsound[whichdialogue][indialogue] == 6) whichsoundplay = rabbitattack2sound;
+ if (dialogueboxsound[whichdialogue][indialogue] == 7) whichsoundplay = rabbitattack3sound;
+ if (dialogueboxsound[whichdialogue][indialogue] == 8) whichsoundplay = rabbitattack4sound;
+ if (dialogueboxsound[whichdialogue][indialogue] == 9) whichsoundplay = growlsound;
+ if (dialogueboxsound[whichdialogue][indialogue] == 10) whichsoundplay = growl2sound;
+ if (dialogueboxsound[whichdialogue][indialogue] == 11) whichsoundplay = snarlsound;
+ if (dialogueboxsound[whichdialogue][indialogue] == 12) whichsoundplay = snarl2sound;
+ if (dialogueboxsound[whichdialogue][indialogue] == 13) whichsoundplay = barksound;
+ if (dialogueboxsound[whichdialogue][indialogue] == 14) whichsoundplay = bark2sound;
+ if (dialogueboxsound[whichdialogue][indialogue] == 15) whichsoundplay = bark3sound;
+ if (dialogueboxsound[whichdialogue][indialogue] == 16) whichsoundplay = barkgrowlsound;
+ if (dialogueboxsound[whichdialogue][indialogue] == -1) whichsoundplay = fireendsound;
+ if (dialogueboxsound[whichdialogue][indialogue] == -2) whichsoundplay = firestartsound;
+ if (dialogueboxsound[whichdialogue][indialogue] == -3) whichsoundplay = consolesuccesssound;
+ if (dialogueboxsound[whichdialogue][indialogue] == -4) whichsoundplay = consolefailsound;
emit_sound_at(whichsoundplay, player[participantfocus[whichdialogue][indialogue]].coords);
}
}
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glPushMatrix(); // Store The Modelview Matrix
glLoadIdentity(); // Reset The Modelview Matrix
- if (dialogueboxlocation[whichdialogue][indialogue] == 1)glTranslatef(0, screenheight * 3 / 4, 0);
+ if (dialogueboxlocation[whichdialogue][indialogue] == 1)
+ glTranslatef(0, screenheight * 3 / 4, 0);
glScalef(screenwidth, screenheight / 4, 1);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
for (i = 0; i < (int)strlen(dialoguename[whichdialogue][indialogue]); i++) {
tempname[tempnum] = dialoguename[whichdialogue][indialogue][i];
goodchar = 1;
- if (dialoguename[whichdialogue][indialogue][i] == '#' || dialoguename[whichdialogue][indialogue][i] == '\0')goodchar = 0;
+ if (dialoguename[whichdialogue][indialogue][i] == '#' || dialoguename[whichdialogue][indialogue][i] == '\0')
+ goodchar = 0;
if (goodchar)
tempnum++;
else
tempnum = 0;
for (i = 0; i < (int)strlen(dialoguetext[whichdialogue][indialogue]) + 1; i++) {
tempname[tempnum] = dialoguetext[whichdialogue][indialogue][i];
- if (dialoguetext[whichdialogue][indialogue][i] != '#')tempnum++;
+ if (dialoguetext[whichdialogue][indialogue][i] != '#')
+ tempnum++;
}
sprintf (string, "%s", tempname);
}
lastline = i + 1;
line++;
- if (string[i] == '\0')done = 1;
+ if (string[i] == '\0')
+ done = 1;
}
- if (i >= 255)done = 1;
+ if (i >= 255)
+ done = 1;
i++;
}
}
else
sprintf (string, "Score: %d", (int)accountactive->getCampaignScore() + (int)bonustotal);
}
- if (!campaign)sprintf (string, "Score: %d", (int)bonustotal);
+ if (!campaign)
+ sprintf (string, "Score: %d", (int)bonustotal);
glColor4f(0, 0, 0, 1);
text->glPrintOutline(1024 / 40 - 4, 768 / 16 - 4 + 768 * 14 / 16, string, 1, 1.5 * 1.25, 1024, 768);
glColor4f(1, 0, 0, 1);
if (editorenabled) {
sprintf (string, "Object size: %f", editorsize);
text->glPrint(10, 75, string, 0, .8, 1024, 768);
- if (editoryaw >= 0)sprintf (string, "Object yaw: %f", editoryaw);
- else sprintf (string, "Object yaw: Random");
+ if (editoryaw >= 0)
+ sprintf (string, "Object yaw: %f", editoryaw);
+ else
+ sprintf (string, "Object yaw: Random");
text->glPrint(10, 90, string, 0, .8, 1024, 768);
- if (editorpitch >= 0)sprintf (string, "Object pitch: %f", editorpitch);
- else sprintf (string, "Object pitch: Random");
+ if (editorpitch >= 0)
+ sprintf (string, "Object pitch: %f", editorpitch);
+ else
+ sprintf (string, "Object pitch: Random");
text->glPrint(10, 105, string, 0, .8, 1024, 768);
sprintf (string, "Object type: %d", editortype);
text->glPrint(10, 120, string, 0, .8, 1024, 768);
glScalef(screenwidth, screenheight, 1);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
- if (player[0].dead)blackout += multiplier * 3;
- if (player[0].dead == 1)blackout = .4f;
- if (player[0].dead == 2 && blackout > .6)blackout = .6;
+ if (player[0].dead)
+ blackout += multiplier * 3;
+ if (player[0].dead == 1)
+ blackout = .4f;
+ if (player[0].dead == 2 && blackout > .6)
+ blackout = .6;
glColor4f(0, 0, 0, blackout);
if (!player[0].dead) {
if ((player[0].bloodloss / player[0].damagetolerance * (sin(woozy) / 4 + .5))*.3 < .3) {
blackout = player[0].blooddimamount * .3;
}
}
- if (console)glColor4f(.7, 0, 0, .2);
+ if (console)
+ glColor4f(.7, 0, 0, .2);
glBegin(GL_QUADS);
glVertex3f(0, 0, 0.0f);
glVertex3f(256, 0, 0.0f);
}
if (flashamount > 0 && damageeffects) {
- if (flashamount > 1)flashamount = 1;
- if (flashdelay <= 0)flashamount -= multiplier;
+ if (flashamount > 1)
+ flashamount = 1;
+ if (flashdelay <= 0)
+ flashamount -= multiplier;
flashdelay--;
- if (flashamount < 0)flashamount = 0;
+ if (flashamount < 0)
+ flashamount = 0;
glDisable(GL_DEPTH_TEST); // Disables Depth Testing
glDisable(GL_CULL_FACE);
glDisable(GL_LIGHTING);
int numliveplayers = 0;
center = 0;
for (i = 0; i < numplayers; i++) {
- if (!player[i].dead) numliveplayers++;
+ if (!player[i].dead)
+ numliveplayers++;
}
int numadd = 0;
}
}
for (i = 0; i < numplayers; i++) {
- if (!player[i].dead)center += player[i].coords;
+ if (!player[i].dead)
+ center += player[i].coords;
}
center /= numadd + numliveplayers;
if (distcheck < mapviewdist) {
glPushMatrix();
Maparrowtexture.bind();
- if (i == 0)glColor4f(1, 1, 1, opac);
- else if (player[i].dead == 2 || player[i].howactive > typesleeping)glColor4f(0, 0, 0, opac * (1 - distcheck / mapviewdist));
- else if (player[i].dead)glColor4f(.3, .3, .3, opac * (1 - distcheck / mapviewdist));
- else if (player[i].aitype == attacktypecutoff)glColor4f(1, 0, 0, opac * (1 - distcheck / mapviewdist));
- else if (player[i].aitype == passivetype)glColor4f(0, 1, 0, opac * (1 - distcheck / mapviewdist));
- else glColor4f(1, 1, 0, 1);
+ if (i == 0)
+ glColor4f(1, 1, 1, opac);
+ else if (player[i].dead == 2 || player[i].howactive > typesleeping)
+ glColor4f(0, 0, 0, opac * (1 - distcheck / mapviewdist));
+ else if (player[i].dead)
+ glColor4f(.3, .3, .3, opac * (1 - distcheck / mapviewdist));
+ else if (player[i].aitype == attacktypecutoff)
+ glColor4f(1, 0, 0, opac * (1 - distcheck / mapviewdist));
+ else if (player[i].aitype == passivetype)
+ glColor4f(0, 1, 0, opac * (1 - distcheck / mapviewdist));
+ else
+ glColor4f(1, 1, 0, 1);
glTranslatef(player[i].coords.x / terrain.scale / 256 * -2 + 1, player[i].coords.z / terrain.scale / 256 * 2 - 1, 0);
glRotatef(player[i].yaw + 180, 0, 0, 1);
glScalef(.005, .005, .005);
for (i = 0; i < 255; i++)string[i] = '\0';
sprintf (temp, "Time: %d:", (int)(((int)leveltime - (int)(leveltime) % 60) / 60));
strcat(string, temp);
- if ((int)(leveltime) % 60 < 10)strcat(string, "0");
+ if ((int)(leveltime) % 60 < 10)
+ strcat(string, "0");
sprintf (temp, "%d", (int)(leveltime) % 60);
strcat(string, temp);
text->glPrintOutlined(1024 / 30, 768 * 6 / 8 - 40, string, 1, 2, 1024, 768);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
if (drawmode == motionblurmode) {
- if (motionbluramount < .2)motionbluramount = .2;
+ if (motionbluramount < .2)
+ motionbluramount = .2;
//glColor4f(1,1,1,fast_sqrt(multiplier)*2.9*motionbluramount);
glColor4f(1, 1, 1, motionbluramount);
glPushMatrix();
if (drawmode == doublevisionmode) {
static float crosseyedness;
crosseyedness = abs(player[0].damage - player[0].superpermanentdamage - (player[0].damagetolerance - player[0].superpermanentdamage) * 1 / 2) / 30;
- if (crosseyedness > 1)crosseyedness = 1;
- if (crosseyedness < 0)crosseyedness = 0;
+ if (crosseyedness > 1)
+ crosseyedness = 1;
+ if (crosseyedness < 0)
+ crosseyedness = 0;
glColor4f(1, 1, 1, 1);
glDisable(GL_BLEND);
glPushMatrix();
weapons.DoStuff();
- if (drawtoggle == 2)drawtoggle = 0;
+ if (drawtoggle == 2)
+ drawtoggle = 0;
if (freeze || winfreeze || (mainmenu && gameon) || (!gameon && gamestarted)) {
multiplier = tempmult;
//draw screen flash
if (flashamount > 0) {
- if (flashamount > 1)flashamount = 1;
- if (flashdelay <= 0)flashamount -= multiplier;
+ if (flashamount > 1)
+ flashamount = 1;
+ if (flashdelay <= 0)
+ flashamount -= multiplier;
flashdelay--;
- if (flashamount < 0)flashamount = 0;
+ if (flashamount < 0)
+ flashamount = 0;
glDisable(GL_DEPTH_TEST); // Disables Depth Testing
glDisable(GL_CULL_FACE);
glDisable(GL_LIGHTING);
void Game::deleteGame()
{
- if (skybox) delete skybox;
- if (text) delete text;
+ if (skybox)
+ delete skybox;
+ if (text)
+ delete text;
terraintexture.destroy();
terraintexture2.destroy();
cursortexture.destroy();
deltaTime /= 1000.0;
multiplier = deltaTime;
- if (multiplier < .001)multiplier = .001;
- if (multiplier > 10)multiplier = 10;
+ if (multiplier < .001)
+ multiplier = .001;
+ if (multiplier > 10)
+ multiplier = 10;
if (multiplier > .05) {
frametime = currTime; // reset for next time interval
loadtime += multiplier * 4;
loadprogress = loadtime;
- if (loadprogress > 100)loadprogress = 100;
+ if (loadprogress > 100)
+ loadprogress = 100;
//loadprogress=abs(Random()%100);
//Text
if (flashamount > 0) {
- if (flashamount > 1)flashamount = 1;
- if (flashdelay <= 0)flashamount -= multiplier;
+ if (flashamount > 1)
+ flashamount = 1;
+ if (flashdelay <= 0)
+ flashamount -= multiplier;
flashdelay--;
- if (flashamount < 0)flashamount = 0;
+ if (flashamount < 0)
+ flashamount = 0;
glDisable(GL_DEPTH_TEST); // Disables Depth Testing
glDisable(GL_CULL_FACE);
glDisable(GL_LIGHTING);
Maparrowtexture.load(":Data:Textures:MapArrow.png", 0, 1);
temptexdetail = texdetail;
- if (texdetail > 2)texdetail = 2;
+ if (texdetail > 2)
+ texdetail = 2;
Mainmenuitems[0].load(":Data:Textures:Lugaru.png", 0, 0);
Mainmenuitems[1].load(":Data:Textures:Newgame.png", 0, 0);
Mainmenuitems[2].load(":Data:Textures:Options.png", 0, 0);
viewer = 0;
- if (detail)kTextureSize = 1024;
- if (detail == 1)kTextureSize = 512;
- if (detail == 0)kTextureSize = 256;
+ if (detail)
+ kTextureSize = 1024;
+ if (detail == 1)
+ kTextureSize = 512;
+ if (detail == 0)
+ kTextureSize = 256;
//Set up distant light
light.color[0] = .95;
}
inline float stepTowardf(float from, float to, float by)
{
- if (fabs(from - to) < by) return to;
- else if (from > to) return from - by;
- else return from + by;
+ if (fabs(from - to) < by)
+ return to;
+ else if (from > to)
+ return from - by;
+ else
+ return from + by;
}
void playdialogueboxsound()
float alphanum;
//Is it valid?
if (opened) {
- if (tintr > 1)tintr = 1;
- if (tintg > 1)tintg = 1;
- if (tintb > 1)tintb = 1;
+ if (tintr > 1) tintr = 1;
+ if (tintg > 1) tintg = 1;
+ if (tintb > 1) tintb = 1;
- if (tintr < 0)tintr = 0;
- if (tintg < 0)tintg = 0;
- if (tintb < 0)tintb = 0;
+ if (tintr < 0) tintr = 0;
+ if (tintg < 0) tintg = 0;
+ if (tintb < 0) tintb = 0;
int bytesPerPixel = texture.bpp / 8;
int tempnum = 0;
alphanum = 255;
for (int i = 0; i < (int)(texture.sizeY * texture.sizeX * bytesPerPixel); i++) {
- if (bytesPerPixel == 3)alphanum = 255;
- else if ((i + 1) % 4 == 0)alphanum = texture.data[i];
+ if (bytesPerPixel == 3)
+ alphanum = 255;
+ else if ((i + 1) % 4 == 0)
+ alphanum = texture.data[i];
//alphanum/=2;
if ((i + 1) % 4 || bytesPerPixel == 3) {
- if ((i % 4) == 0)texture.data[i] *= tintr;
- if ((i % 4) == 1)texture.data[i] *= tintg;
- if ((i % 4) == 2)texture.data[i] *= tintb;
+ if ((i % 4) == 0)
+ texture.data[i] *= tintr;
+ if ((i % 4) == 1)
+ texture.data[i] *= tintg;
+ if ((i % 4) == 2)
+ texture.data[i] *= tintb;
array[tempnum] = (float)array[tempnum] * (1 - alphanum / 255) + (float)texture.data[i] * (alphanum / 255);
tempnum++;
}
}
- } else return 0;
+ } else
+ return 0;
return 1;
}
ipstream.ignore(256, ' ');
ipstream.getline(dialoguetext[numdialogues][i], 128);
for (int j = 0; j < 128; j++) {
- if (dialoguetext[numdialogues][i][j] == '\\')dialoguetext[numdialogues][i][j] = '\n';
+ if (dialoguetext[numdialogues][i][j] == '\\')
+ dialoguetext[numdialogues][i][j] = '\n';
}
ipstream.ignore(256, ':');
ipstream >> dialogueboxsound[numdialogues][i];
ipstream.ignore(256, ' ');
ipstream.getline(dialoguetext[whichdi][i], 128);
for (int j = 0; j < 128; j++) {
- if (dialoguetext[whichdi][i][j] == '\\')dialoguetext[whichdi][i][j] = '\n';
+ if (dialoguetext[whichdi][i][j] == '\\')
+ dialoguetext[whichdi][i][j] = '\n';
}
ipstream.ignore(256, ':');
ipstream >> dialogueboxsound[whichdi][i];
last = closest;
count++;
}
- if (count < smallestcount)smallestcount = count;
+ if (count < smallestcount)
+ smallestcount = count;
}
return smallestcount;
}
objects.type[i] != firetype) {
colviewer = startpoint;
coltarget = endpoint;
- if (objects.model[i].LineCheck(&colviewer, &coltarget, &colpoint, &objects.position[i], &objects.yaw[i]) != -1)return i;
+ if (objects.model[i].LineCheck(&colviewer, &coltarget, &colpoint, &objects.position[i], &objects.yaw[i]) != -1)
+ return i;
}
}
}
colviewer = startpoint;
coltarget = endpoint;
//FIXME: i/what
- if (objects.model[what].LineCheck(&colviewer, &coltarget, &colpoint, &objects.position[what], &objects.yaw[what]) != -1)return i;
+ if (objects.model[what].LineCheck(&colviewer, &coltarget, &colpoint, &objects.position[what], &objects.yaw[what]) != -1)
+ return i;
}
}
}
- if (what == 1000)if (terrain.lineTerrain(startpoint, endpoint, &colpoint) != -1)return 1000;
+ if (what == 1000)
+ if (terrain.lineTerrain(startpoint, endpoint, &colpoint) != -1)
+ return 1000;
return -1;
}
temptexdetail = texdetail;
- if (texdetail > 1)texdetail = 4;
+ if (texdetail > 1)
+ texdetail = 4;
skybox->load( ":Data:Textures:Skybox(snow):Front.jpg",
":Data:Textures:Skybox(snow):Left.jpg",
":Data:Textures:Skybox(snow):Back.jpg",
temptexdetail = texdetail;
- if (texdetail > 1)texdetail = 4;
+ if (texdetail > 1)
+ texdetail = 4;
skybox->load( ":Data:Textures:Skybox(sand):Front.jpg",
":Data:Textures:Skybox(sand):Left.jpg",
":Data:Textures:Skybox(sand):Back.jpg",
temptexdetail = texdetail;
- if (texdetail > 1)texdetail = 4;
+ if (texdetail > 1)
+ texdetail = 4;
skybox->load( ":Data:Textures:Skybox(grass):Front.jpg",
":Data:Textures:Skybox(grass):Left.jpg",
":Data:Textures:Skybox(grass):Back.jpg",
dialoguetext[k][l][m] = 0;
funpackf(tfile, "Bi", &templength);
- if (templength > 64 || templength <= 0)templength = 64;
+ if (templength > 64 || templength <= 0)
+ templength = 64;
for (m = 0; m < templength; m++) {
funpackf(tfile, "Bb", &dialoguename[k][l][m]);
if (dialoguename[k][l][m] == '\0')
for (int i = 0; i < player[1].skeleton.num_joints; i++) {
if (Random() % 2 == 0) {
- if (!player[1].skeleton.free)temp2 = (player[1].coords - player[1].oldcoords) / multiplier / 2; //velocity/2;
- if (player[1].skeleton.free)temp2 = player[1].skeleton.joints[i].velocity * player[1].scale / 2;
- if (!player[1].skeleton.free)temp = DoRotation(DoRotation(DoRotation(player[1].skeleton.joints[i].position, 0, 0, player[1].tilt), player[1].tilt2, 0, 0), 0, player[1].yaw, 0) * player[1].scale + player[1].coords;
- if (player[1].skeleton.free)temp = player[1].skeleton.joints[i].position * player[1].scale + player[1].coords;
+ if (!player[1].skeleton.free)
+ temp2 = (player[1].coords - player[1].oldcoords) / multiplier / 2; //velocity/2;
+ if (player[1].skeleton.free)
+ temp2 = player[1].skeleton.joints[i].velocity * player[1].scale / 2;
+ if (!player[1].skeleton.free)
+ temp = DoRotation(DoRotation(DoRotation(player[1].skeleton.joints[i].position, 0, 0, player[1].tilt), player[1].tilt2, 0, 0), 0, player[1].yaw, 0) * player[1].scale + player[1].coords;
+ if (player[1].skeleton.free)
+ temp = player[1].skeleton.joints[i].position * player[1].scale + player[1].coords;
Sprite::MakeSprite(breathsprite, temp, temp2, 1, 1, 1, .6 + (float)abs(Random() % 100) / 200 - .25, 1);
}
}
if (bonus == cannon) {
bonus = Slicebonus;
againbonus = 1;
- } else againbonus = 0;
+ } else
+ againbonus = 0;
break;
case 22:
tutorialmaxtime = 500;
for (int i = 0; i < player[1].skeleton.num_joints; i++) {
if (Random() % 2 == 0) {
- if (!player[1].skeleton.free)temp2 = (player[1].coords - player[1].oldcoords) / multiplier / 2; //velocity/2;
- if (player[1].skeleton.free)temp2 = player[1].skeleton.joints[i].velocity * player[1].scale / 2;
- if (!player[1].skeleton.free)temp = DoRotation(DoRotation(DoRotation(player[1].skeleton.joints[i].position, 0, 0, player[1].tilt), player[1].tilt2, 0, 0), 0, player[1].yaw, 0) * player[1].scale + player[1].coords;
- if (player[1].skeleton.free)temp = player[1].skeleton.joints[i].position * player[1].scale + player[1].coords;
+ if (!player[1].skeleton.free)
+ temp2 = (player[1].coords - player[1].oldcoords) / multiplier / 2; //velocity/2;
+ if (player[1].skeleton.free)
+ temp2 = player[1].skeleton.joints[i].velocity * player[1].scale / 2;
+ if (!player[1].skeleton.free)
+ temp = DoRotation(DoRotation(DoRotation(player[1].skeleton.joints[i].position, 0, 0, player[1].tilt), player[1].tilt2, 0, 0), 0, player[1].yaw, 0) * player[1].scale + player[1].coords;
+ if (player[1].skeleton.free)
+ temp = player[1].skeleton.joints[i].position * player[1].scale + player[1].coords;
Sprite::MakeSprite(breathsprite, temp, temp2, 1, 1, 1, .6 + (float)abs(Random() % 100) / 200 - .25, 1);
}
}
default:
break;
}
- if (tutorialstage <= 51)tutorialstagetime = 0;
+ if (tutorialstage <= 51)
+ tutorialstagetime = 0;
}
//Tutorial success
if (tutorialstagetime < tutorialmaxtime - 3) {
switch (tutorialstage) {
case 3:
- if (deltah || deltav)tutorialsuccess += multiplier;
+ if (deltah || deltav)
+ tutorialsuccess += multiplier;
break;
case 4:
- if (player[0].forwardkeydown || player[0].backkeydown || player[0].leftkeydown || player[0].rightkeydown)tutorialsuccess += multiplier;
+ if (player[0].forwardkeydown || player[0].backkeydown || player[0].leftkeydown || player[0].rightkeydown)
+ tutorialsuccess += multiplier;
break;
case 5:
- if (player[0].jumpkeydown)tutorialsuccess = 1;
+ if (player[0].jumpkeydown)
+ tutorialsuccess = 1;
break;
case 6:
- if (player[0].isCrouch())tutorialsuccess = 1;
+ if (player[0].isCrouch())
+ tutorialsuccess = 1;
break;
case 7:
- if (player[0].animTarget == rollanim)tutorialsuccess = 1;
+ if (player[0].animTarget == rollanim)
+ tutorialsuccess = 1;
break;
case 8:
- if (player[0].animTarget == sneakanim)tutorialsuccess += multiplier;
+ if (player[0].animTarget == sneakanim)
+ tutorialsuccess += multiplier;
break;
case 9:
- if (player[0].animTarget == rabbitrunninganim || player[0].animTarget == wolfrunninganim)tutorialsuccess += multiplier;
+ if (player[0].animTarget == rabbitrunninganim || player[0].animTarget == wolfrunninganim)
+ tutorialsuccess += multiplier;
break;
case 11:
- if (player[0].isWallJump())tutorialsuccess = 1;
+ if (player[0].isWallJump())
+ tutorialsuccess = 1;
break;
case 12:
- if (player[0].animTarget == flipanim)tutorialsuccess = 1;
+ if (player[0].animTarget == flipanim)
+ tutorialsuccess = 1;
break;
case 15:
- if (player[0].animTarget == upunchanim || player[0].animTarget == winduppunchanim)tutorialsuccess = 1;
+ if (player[0].animTarget == upunchanim || player[0].animTarget == winduppunchanim)
+ tutorialsuccess = 1;
break;
case 16:
- if (player[0].animTarget == winduppunchanim)tutorialsuccess = 1;
+ if (player[0].animTarget == winduppunchanim)
+ tutorialsuccess = 1;
break;
case 17:
- if (player[0].animTarget == spinkickanim)tutorialsuccess = 1;
+ if (player[0].animTarget == spinkickanim)
+ tutorialsuccess = 1;
break;
case 18:
- if (player[0].animTarget == sweepanim)tutorialsuccess = 1;
+ if (player[0].animTarget == sweepanim)
+ tutorialsuccess = 1;
break;
case 19:
- if (player[0].animTarget == dropkickanim)tutorialsuccess = 1;
+ if (player[0].animTarget == dropkickanim)
+ tutorialsuccess = 1;
break;
case 20:
- if (player[0].animTarget == rabbitkickanim)tutorialsuccess = 1;
+ if (player[0].animTarget == rabbitkickanim)
+ tutorialsuccess = 1;
break;
case 21:
- if (bonus == cannon)tutorialsuccess = 1;
+ if (bonus == cannon)
+ tutorialsuccess = 1;
break;
case 22:
- if (bonus == spinecrusher)tutorialsuccess = 1;
+ if (bonus == spinecrusher)
+ tutorialsuccess = 1;
break;
case 23:
- if (player[0].animTarget == walljumprightkickanim || player[0].animTarget == walljumpleftkickanim)tutorialsuccess = 1;
+ if (player[0].animTarget == walljumprightkickanim || player[0].animTarget == walljumpleftkickanim)
+ tutorialsuccess = 1;
break;
case 24:
- if (player[0].animTarget == rabbittacklinganim)tutorialsuccess = 1;
+ if (player[0].animTarget == rabbittacklinganim)
+ tutorialsuccess = 1;
break;
case 25:
- if (player[0].animTarget == backhandspringanim)tutorialsuccess = 1;
+ if (player[0].animTarget == backhandspringanim)
+ tutorialsuccess = 1;
break;
case 28:
- if (animation[player[0].animTarget].attack == reversed && player[0].feint)tutorialsuccess = 1;
+ if (animation[player[0].animTarget].attack == reversed && player[0].feint)
+ tutorialsuccess = 1;
break;
case 29:
if (player[0].escapednum == 2) {
}
break;
case 33:
- if (animation[player[0].animTarget].attack == reversal)tutorialsuccess = 1;
+ if (animation[player[0].animTarget].attack == reversal)
+ tutorialsuccess = 1;
break;
case 34:
- if (animation[player[0].animTarget].attack == reversal)tutorialsuccess = 1;
+ if (animation[player[0].animTarget].attack == reversal)
+ tutorialsuccess = 1;
break;
case 35:
if (animation[player[0].animTarget].attack == reversal) {
}
break;
case 40:
- if (player[0].num_weapons > 0)tutorialsuccess = 1;
+ if (player[0].num_weapons > 0)
+ tutorialsuccess = 1;
break;
case 41:
- if (player[0].weaponactive == -1 && player[0].num_weapons > 0)tutorialsuccess = 1;
+ if (player[0].weaponactive == -1 && player[0].num_weapons > 0)
+ tutorialsuccess = 1;
break;
case 43:
- if (player[0].animTarget == knifeslashstartanim)tutorialsuccess = 1;
+ if (player[0].animTarget == knifeslashstartanim)
+ tutorialsuccess = 1;
break;
case 44:
- if (animation[player[0].animTarget].attack == reversal)tutorialsuccess = 1;
+ if (animation[player[0].animTarget].attack == reversal)
+ tutorialsuccess = 1;
break;
case 45:
- if (animation[player[0].animTarget].attack == reversal)tutorialsuccess = 1;
+ if (animation[player[0].animTarget].attack == reversal)
+ tutorialsuccess = 1;
break;
case 46:
- if (animation[player[0].animTarget].attack == reversal)tutorialsuccess = 1;
+ if (animation[player[0].animTarget].attack == reversal)
+ tutorialsuccess = 1;
break;
case 49:
- if (player[1].weaponstuck != -1)tutorialsuccess = 1;
+ if (player[1].weaponstuck != -1)
+ tutorialsuccess = 1;
break;
default:
break;
}
- if (tutorialsuccess >= 1)tutorialstagetime = tutorialmaxtime - 3;
+ if (tutorialsuccess >= 1)
+ tutorialstagetime = tutorialmaxtime - 3;
if (tutorialstagetime == tutorialmaxtime - 3) {
emit_sound_at(splattersound, blah);
emit_sound_at(breaksound2, blah, 100.);
- if (player[closest].skeleton.free == 2)player[closest].skeleton.free = 0;
+ if (player[closest].skeleton.free == 2)
+ player[closest].skeleton.free = 0;
player[closest].RagDoll(0);
player[closest].dead = 2;
player[closest].headless = 1;
emit_sound_at(breaksound2, blah);
for (int i = 0; i < player[closest].skeleton.num_joints; i++) {
- if (!player[closest].skeleton.free)flatvelocity2 = player[closest].velocity;
- if (player[closest].skeleton.free)flatvelocity2 = player[closest].skeleton.joints[i].velocity;
- if (!player[closest].skeleton.free)flatfacing2 = DoRotation(DoRotation(DoRotation(player[closest].skeleton.joints[i].position, 0, 0, player[closest].tilt), player[closest].tilt2, 0, 0), 0, player[closest].yaw, 0) * player[closest].scale + player[closest].coords;
- if (player[closest].skeleton.free)flatfacing2 = player[closest].skeleton.joints[i].position * player[closest].scale + player[closest].coords;
+ if (!player[closest].skeleton.free)
+ flatvelocity2 = player[closest].velocity;
+ if (player[closest].skeleton.free)
+ flatvelocity2 = player[closest].skeleton.joints[i].velocity;
+ if (!player[closest].skeleton.free)
+ flatfacing2 = DoRotation(DoRotation(DoRotation(player[closest].skeleton.joints[i].position, 0, 0, player[closest].tilt), player[closest].tilt2, 0, 0), 0, player[closest].yaw, 0) * player[closest].scale + player[closest].coords;
+ if (player[closest].skeleton.free)
+ flatfacing2 = player[closest].skeleton.joints[i].position * player[closest].scale + player[closest].coords;
flatvelocity2.x += (float)(abs(Random() % 100) - 50) / 10;
flatvelocity2.y += (float)(abs(Random() % 100) - 50) / 10;
flatvelocity2.z += (float)(abs(Random() % 100) - 50) / 10;
}
for (int i = 0; i < player[closest].skeleton.num_joints; i++) {
- if (!player[closest].skeleton.free)flatvelocity2 = player[closest].velocity;
- if (player[closest].skeleton.free)flatvelocity2 = player[closest].skeleton.joints[i].velocity;
- if (!player[closest].skeleton.free)flatfacing2 = DoRotation(DoRotation(DoRotation(player[closest].skeleton.joints[i].position, 0, 0, player[closest].tilt), player[closest].tilt2, 0, 0), 0, player[closest].yaw, 0) * player[closest].scale + player[closest].coords;
- if (player[closest].skeleton.free)flatfacing2 = player[closest].skeleton.joints[i].position * player[closest].scale + player[closest].coords;
+ if (!player[closest].skeleton.free)
+ flatvelocity2 = player[closest].velocity;
+ if (player[closest].skeleton.free)
+ flatvelocity2 = player[closest].skeleton.joints[i].velocity;
+ if (!player[closest].skeleton.free)
+ flatfacing2 = DoRotation(DoRotation(DoRotation(player[closest].skeleton.joints[i].position, 0, 0, player[closest].tilt), player[closest].tilt2, 0, 0), 0, player[closest].yaw, 0) * player[closest].scale + player[closest].coords;
+ if (player[closest].skeleton.free)
+ flatfacing2 = player[closest].skeleton.joints[i].position * player[closest].scale + player[closest].coords;
flatvelocity2.x += (float)(abs(Random() % 100) - 50) / 10;
flatvelocity2.y += (float)(abs(Random() % 100) - 50) / 10;
flatvelocity2.z += (float)(abs(Random() % 100) - 50) / 10;
}
for (int i = 0; i < player[closest].skeleton.num_joints; i++) {
- if (!player[closest].skeleton.free)flatvelocity2 = player[closest].velocity;
- if (player[closest].skeleton.free)flatvelocity2 = player[closest].skeleton.joints[i].velocity;
- if (!player[closest].skeleton.free)flatfacing2 = DoRotation(DoRotation(DoRotation(player[closest].skeleton.joints[i].position, 0, 0, player[closest].tilt), player[closest].tilt2, 0, 0), 0, player[closest].yaw, 0) * player[closest].scale + player[closest].coords;
- if (player[closest].skeleton.free)flatfacing2 = player[closest].skeleton.joints[i].position * player[closest].scale + player[closest].coords;
+ if (!player[closest].skeleton.free)
+ flatvelocity2 = player[closest].velocity;
+ if (player[closest].skeleton.free)
+ flatvelocity2 = player[closest].skeleton.joints[i].velocity;
+ if (!player[closest].skeleton.free)
+ flatfacing2 = DoRotation(DoRotation(DoRotation(player[closest].skeleton.joints[i].position, 0, 0, player[closest].tilt), player[closest].tilt2, 0, 0), 0, player[closest].yaw, 0) * player[closest].scale + player[closest].coords;
+ if (player[closest].skeleton.free)
+ flatfacing2 = player[closest].skeleton.joints[i].position * player[closest].scale + player[closest].coords;
flatvelocity2.x += (float)(abs(Random() % 100) - 50) / 10;
flatvelocity2.y += (float)(abs(Random() % 100) - 50) / 10;
flatvelocity2.z += (float)(abs(Random() % 100) - 50) / 10;
}
for (int i = 0; i < player[closest].skeleton.num_joints; i++) {
- if (!player[closest].skeleton.free)flatvelocity2 = player[closest].velocity;
- if (player[closest].skeleton.free)flatvelocity2 = player[closest].skeleton.joints[i].velocity;
- if (!player[closest].skeleton.free)flatfacing2 = DoRotation(DoRotation(DoRotation(player[closest].skeleton.joints[i].position, 0, 0, player[closest].tilt), player[closest].tilt2, 0, 0), 0, player[closest].yaw, 0) * player[closest].scale + player[closest].coords;
- if (player[closest].skeleton.free)flatfacing2 = player[closest].skeleton.joints[i].position * player[closest].scale + player[closest].coords;
+ if (!player[closest].skeleton.free)
+ flatvelocity2 = player[closest].velocity;
+ if (player[closest].skeleton.free)
+ flatvelocity2 = player[closest].skeleton.joints[i].velocity;
+ if (!player[closest].skeleton.free)
+ flatfacing2 = DoRotation(DoRotation(DoRotation(player[closest].skeleton.joints[i].position, 0, 0, player[closest].tilt), player[closest].tilt2, 0, 0), 0, player[closest].yaw, 0) * player[closest].scale + player[closest].coords;
+ if (player[closest].skeleton.free)
+ flatfacing2 = player[closest].skeleton.joints[i].position * player[closest].scale + player[closest].coords;
flatvelocity2.x += (float)(abs(Random() % 100) - 50) / 10;
flatvelocity2.y += (float)(abs(Random() % 100) - 50) / 10;
flatvelocity2.z += (float)(abs(Random() % 100) - 50) / 10;
boxcoords.x = player[0].coords.x;
boxcoords.z = player[0].coords.z;
boxcoords.y = player[0].coords.y - 3;
- if (editortype == bushtype)boxcoords.y = player[0].coords.y - .5;
- if (editortype == firetype)boxcoords.y = player[0].coords.y - .5;
+ if (editortype == bushtype)
+ boxcoords.y = player[0].coords.y - .5;
+ if (editortype == firetype)
+ boxcoords.y = player[0].coords.y - .5;
//objects.MakeObject(abs(Random()%3),boxcoords,Random()%360);
float temprotat, temprotat2;
temprotat = editoryaw;
temprotat2 = editorpitch;
- if (temprotat < 0 || editortype == bushtype)temprotat = Random() % 360;
- if (temprotat2 < 0)temprotat2 = Random() % 360;
+ if (temprotat < 0 || editortype == bushtype)
+ temprotat = Random() % 360;
+ if (temprotat2 < 0)
+ temprotat2 = Random() % 360;
objects.MakeObject(editortype, boxcoords, (int)temprotat - ((int)temprotat) % 30, (int)temprotat2, editorsize);
if (editortype == treetrunktype)
if (distsq(&pathpoint[i], &player[0].coords) < .5 && i != pathpointselected && !connected) {
alreadyconnected = 0;
for (int j = 0; j < numpathpointconnect[pathpointselected]; j++) {
- if (pathpointconnect[pathpointselected][j] == i)alreadyconnected = 1;
+ if (pathpointconnect[pathpointselected][j] == i)
+ alreadyconnected = 1;
}
if (!alreadyconnected) {
numpathpointconnect[pathpointselected]++;
if (Input::isKeyPressed(SDLK_LEFT) && Input::isKeyDown(SDLK_LSHIFT) && !Input::isKeyDown(SDLK_LCTRL)) {
editortype--;
- if (editortype == treeleavestype || editortype == 10)editortype--;
- if (editortype < 0)editortype = firetype;
+ if (editortype == treeleavestype || editortype == 10)
+ editortype--;
+ if (editortype < 0)
+ editortype = firetype;
}
if (Input::isKeyPressed(SDLK_RIGHT) && Input::isKeyDown(SDLK_LSHIFT) && !Input::isKeyDown(SDLK_LCTRL)) {
editortype++;
- if (editortype == treeleavestype || editortype == 10)editortype++;
- if (editortype > firetype)editortype = 0;
+ if (editortype == treeleavestype || editortype == 10)
+ editortype++;
+ if (editortype > firetype)
+ editortype = 0;
}
if (Input::isKeyDown(SDLK_LEFT) && !Input::isKeyDown(SDLK_LSHIFT) && !Input::isKeyDown(SDLK_LCTRL)) {
editoryaw -= multiplier * 100;
- if (editoryaw < -.01)editoryaw = -.01;
+ if (editoryaw < -.01)
+ editoryaw = -.01;
}
if (Input::isKeyDown(SDLK_RIGHT) && !Input::isKeyDown(SDLK_LSHIFT) && !Input::isKeyDown(SDLK_LCTRL)) {
if (Input::isKeyDown(SDLK_DOWN) && !Input::isKeyDown(SDLK_LCTRL)) {
editorsize -= multiplier;
- if (editorsize < .1)editorsize = .1;
+ if (editorsize < .1)
+ editorsize = .1;
}
if (Input::isKeyDown(SDLK_DOWN) && Input::isKeyDown(SDLK_LCTRL)) {
editorpitch -= multiplier * 100;
- if (editorpitch < -.01)editorpitch = -.01;
+ if (editorpitch < -.01)
+ editorpitch = -.01;
}
if (Input::isKeyPressed(SDLK_DELETE) && objects.numobjects && Input::isKeyDown(SDLK_LSHIFT)) {
int closest = findClosestObject();
{
for (int k = 0; k < numplayers; k++)
for (int i = k; i < numplayers; i++) {
- if (i == k)continue;
+ if (i == k)
+ continue;
if ( player[k].skeleton.free == 0 &&
player[i].skeleton.oldfree == 0 &&
(player[i].animTarget == jumpupanim ||
if (whichhit != -1 && fabs(objects.model[i].facenormals[whichhit].y) < .3) {
player[k].setAnimation(walljumprightanim);
emit_sound_at(movewhooshsound, player[k].coords);
- if (k == 0)pause_sound(whooshsound);
+ if (k == 0)
+ pause_sound(whooshsound);
lowpointtarget = DoRotation(objects.model[i].facenormals[whichhit], 0, objects.yaw[i], 0);
player[k].yaw = -asin(0 - lowpointtarget.x) * 180 / M_PI;
- if (lowpointtarget.z < 0)player[k].yaw = 180 - player[k].yaw;
+ if (lowpointtarget.z < 0)
+ player[k].yaw = 180 - player[k].yaw;
player[k].targetyaw = player[k].yaw;
player[k].lowyaw = player[k].yaw;
- if (k == 0)numwallflipped++;
+ if (k == 0)
+ numwallflipped++;
} else {
lowpoint = tempcoords1;
lowpointtarget = lowpoint + player[k].facing * 2;
if (whichhit != -1 && fabs(objects.model[i].facenormals[whichhit].y) < .3) {
player[k].setAnimation(walljumpbackanim);
emit_sound_at(movewhooshsound, player[k].coords);
- if (k == 0)pause_sound(whooshsound);
+ if (k == 0)
+ pause_sound(whooshsound);
lowpointtarget = DoRotation(objects.model[i].facenormals[whichhit], 0, objects.yaw[i], 0);
player[k].yaw = -asin(0 - lowpointtarget.x) * 180 / M_PI;
- if (lowpointtarget.z < 0)player[k].yaw = 180 - player[k].yaw;
+ if (lowpointtarget.z < 0)
+ player[k].yaw = 180 - player[k].yaw;
player[k].targetyaw = player[k].yaw;
player[k].lowyaw = player[k].yaw;
- if (k == 0)numwallflipped++;
+ if (k == 0)
+ numwallflipped++;
} else {
lowpoint = tempcoords1;
lowpointtarget = lowpoint - player[k].facing * 2;
if (whichhit != -1 && fabs(objects.model[i].facenormals[whichhit].y) < .3) {
player[k].setAnimation(walljumpfrontanim);
emit_sound_at(movewhooshsound, player[k].coords);
- if (k == 0)pause_sound(whooshsound);
+ if (k == 0)
+ pause_sound(whooshsound);
lowpointtarget = DoRotation(objects.model[i].facenormals[whichhit], 0, objects.yaw[i], 0);
player[k].yaw = -asin(0 - lowpointtarget.x) * 180 / M_PI;
- if (lowpointtarget.z < 0)player[k].yaw = 180 - player[k].yaw;
+ if (lowpointtarget.z < 0)
+ player[k].yaw = 180 - player[k].yaw;
player[k].yaw += 180;
player[k].targetyaw = player[k].yaw;
player[k].lowyaw = player[k].yaw;
- if (k == 0)numwallflipped++;
+ if (k == 0)
+ numwallflipped++;
}
}
}
}
}
- if (!hostile || indialogue != -1)player[0].attackkeydown = 0;
+ if (!hostile || indialogue != -1)
+ player[0].attackkeydown = 0;
for (int k = 0; k < numplayers; k++) {
- if (indialogue != -1)player[k].attackkeydown = 0;
+ if (indialogue != -1)
+ player[k].attackkeydown = 0;
if (player[k].animTarget != rabbitrunninganim && player[k].animTarget != wolfrunninganim) {
if (player[k].aitype != playercontrolled)
player[k].victim = &player[0];
player[k].jumppower -= 2;
} else {
for (int i = 0; i < numplayers; i++) {
- if (i == k)continue;
+ if (i == k)
+ continue;
if (player[i].animTarget == swordslashanim ||
player[i].animTarget == knifeslashstartanim ||
player[i].animTarget == staffhitanim ||
}
}
if (player[k].animTarget != dodgebackanim) {
- if (k == 0)numflipped++;
+ if (k == 0)
+ numflipped++;
player[k].setAnimation(backhandspringanim);
player[k].targetyaw = -yaw + 180;
if (player[k].leftkeydown)
player[k].hasvictim = 0;
if (numplayers > 1)
for (int i = 0; i < numplayers; i++) {
- if (i == k || !(k == 0 || i == 0))continue;
+ if (i == k || !(k == 0 || i == 0))
+ continue;
if (!player[k].hasvictim)
if (animation[player[k].animTarget].attack != reversal) {
//choose an attack
const bool hasstaff = attackweapon == staff;
if (k == 0 && numplayers > 1)
for (int i = 0; i < numplayers; i++) {
- if (i == k)continue;
+ if (i == k)
+ continue;
if ((playerrealattackkeydown || player[i].dead || !hasstaff) &&
animation[player[k].animTarget].attack == neutral) {
const float distance = distsq(&player[k].coords, &player[i].coords);
if (!player[k].hasvictim) {
//find victim
for (int i = 0; i < numplayers; i++) {
- if (i == k || !(i == 0 || k == 0))continue;
+ if (i == k || !(i == 0 || k == 0))
+ continue;
if (!player[i].skeleton.free) {
if (player[k].hasvictim) {
if (distsq(&player[k].coords, &player[i].coords) <
if (distsq(&player[i].coords, &player[k].coords)
< 3 * sq((player[i].scale + player[k].scale) * 2.5)) {
if (player[i].onfire || player[k].onfire) {
- if (!player[i].onfire)player[i].CatchFire();
- if (!player[k].onfire)player[k].CatchFire();
+ if (!player[i].onfire)
+ player[i].CatchFire();
+ if (!player[k].onfire)
+ player[k].CatchFire();
}
}
player[i].lastpathfindpoint2 = -1;
player[i].lastpathfindpoint3 = -1;
player[i].lastpathfindpoint4 = -1;
- } else player[i].laststanding = j;
+ } else
+ player[i].laststanding = j;
}
}
//check out last seen location
player[i].throwkeydown = 0;
if (player[i].avoidcollided > .8 && !player[i].jumpkeydown && player[i].collided < .8) {
- if (!player[i].avoidsomething)player[i].targetyaw += 90 * (player[i].whichdirection * 2 - 1);
+ if (!player[i].avoidsomething)
+ player[i].targetyaw += 90 * (player[i].whichdirection * 2 - 1);
else {
XYZ leftpos, rightpos;
float leftdist, rightdist;
rightpos = player[i].coords - DoRotation(player[i].facing, 0, 90, 0);
leftdist = distsq(&leftpos, &player[i].avoidwhere);
rightdist = distsq(&rightpos, &player[i].avoidwhere);
- if (leftdist < rightdist)player[i].targetyaw += 90;
- else player[i].targetyaw -= 90;
+ if (leftdist < rightdist)
+ player[i].targetyaw += 90;
+ else
+ player[i].targetyaw -= 90;
}
}
}
strcat(temp, " ");
name += temp;
sprintf (temp, "%d:", (int)(((int)accountactive->getFastTime(i) - (int)(accountactive->getFastTime(i)) % 60) / 60));
- if ((int)(accountactive->getFastTime(i)) % 60 < 10)strcat(temp, "0");
+ if ((int)(accountactive->getFastTime(i)) % 60 < 10)
+ strcat(temp, "0");
name += temp;
sprintf (temp, "%d", (int)(accountactive->getFastTime(i)) % 60);
name += temp;
fireSound();
flash();
mainmenu = 3;
- if (newdetail > 2) newdetail = detail;
- if (newdetail < 0) newdetail = detail;
- if (newscreenwidth > 3000) newscreenwidth = screenwidth;
- if (newscreenwidth < 0) newscreenwidth = screenwidth;
- if (newscreenheight > 3000) newscreenheight = screenheight;
- if (newscreenheight < 0) newscreenheight = screenheight;
+ if (newdetail > 2)
+ newdetail = detail;
+ if (newdetail < 0)
+ newdetail = detail;
+ if (newscreenwidth > 3000)
+ newscreenwidth = screenwidth;
+ if (newscreenwidth < 0)
+ newscreenwidth = screenwidth;
+ if (newscreenheight > 3000)
+ newscreenheight = screenheight;
+ if (newscreenheight < 0)
+ newscreenheight = screenheight;
break;
case 3:
fireSound();
break;
case 1:
newdetail++;
- if (newdetail > 2) newdetail = 0;
+ if (newdetail > 2)
+ newdetail = 0;
break;
case 2:
bloodtoggle++;
- if (bloodtoggle > 2) bloodtoggle = 0;
+ if (bloodtoggle > 2)
+ bloodtoggle = 0;
break;
case 3:
difficulty++;
- if (difficulty > 2) difficulty = 0;
+ if (difficulty > 2)
+ difficulty = 0;
break;
case 4:
ismotionblur = !ismotionblur;
}
if (!mainmenu) {
- if (hostile == 1)hostiletime += multiplier;
- else hostiletime = 0;
- if (!winfreeze)leveltime += multiplier;
+ if (hostile == 1)
+ hostiletime += multiplier;
+ else
+ hostiletime = 0;
+ if (!winfreeze)
+ leveltime += multiplier;
//keys
if (Input::isKeyPressed(SDLK_v) && debugmode) {
Input::isKeyPressed(SDLK_0) ||
Input::isKeyPressed(SDLK_MINUS)) {
int whichend;
- if (Input::isKeyPressed(SDLK_1))whichend = 1;
- if (Input::isKeyPressed(SDLK_2))whichend = 2;
- if (Input::isKeyPressed(SDLK_3))whichend = 3;
- if (Input::isKeyPressed(SDLK_4))whichend = 4;
- if (Input::isKeyPressed(SDLK_5))whichend = 5;
- if (Input::isKeyPressed(SDLK_6))whichend = 6;
- if (Input::isKeyPressed(SDLK_7))whichend = 7;
- if (Input::isKeyPressed(SDLK_8))whichend = 8;
- if (Input::isKeyPressed(SDLK_9))whichend = 9;
- if (Input::isKeyPressed(SDLK_0))whichend = 0;
+ if (Input::isKeyPressed(SDLK_1)) whichend = 1;
+ if (Input::isKeyPressed(SDLK_2)) whichend = 2;
+ if (Input::isKeyPressed(SDLK_3)) whichend = 3;
+ if (Input::isKeyPressed(SDLK_4)) whichend = 4;
+ if (Input::isKeyPressed(SDLK_5)) whichend = 5;
+ if (Input::isKeyPressed(SDLK_6)) whichend = 6;
+ if (Input::isKeyPressed(SDLK_7)) whichend = 7;
+ if (Input::isKeyPressed(SDLK_8)) whichend = 8;
+ if (Input::isKeyPressed(SDLK_9)) whichend = 9;
+ if (Input::isKeyPressed(SDLK_0)) whichend = 0;
if (Input::isKeyPressed(SDLK_MINUS))
whichend = -1;
if (whichend != -1) {
Input::isKeyDown(SDLK_KP9) ||
Input::isKeyDown(SDLK_KP0)) {
int whichend;
- if (Input::isKeyDown(SDLK_KP1))whichend = 1;
- if (Input::isKeyDown(SDLK_KP2))whichend = 2;
- if (Input::isKeyDown(SDLK_KP3))whichend = 3;
- if (Input::isKeyDown(SDLK_KP4))whichend = 4;
- if (Input::isKeyDown(SDLK_KP5))whichend = 5;
- if (Input::isKeyDown(SDLK_KP6))whichend = 6;
- if (Input::isKeyDown(SDLK_KP7))whichend = 7;
- if (Input::isKeyDown(SDLK_KP8))whichend = 8;
- if (Input::isKeyDown(SDLK_KP9))whichend = 9;
- if (Input::isKeyDown(SDLK_KP0))whichend = 0;
+ if (Input::isKeyDown(SDLK_KP1)) whichend = 1;
+ if (Input::isKeyDown(SDLK_KP2)) whichend = 2;
+ if (Input::isKeyDown(SDLK_KP3)) whichend = 3;
+ if (Input::isKeyDown(SDLK_KP4)) whichend = 4;
+ if (Input::isKeyDown(SDLK_KP5)) whichend = 5;
+ if (Input::isKeyDown(SDLK_KP6)) whichend = 6;
+ if (Input::isKeyDown(SDLK_KP7)) whichend = 7;
+ if (Input::isKeyDown(SDLK_KP8)) whichend = 8;
+ if (Input::isKeyDown(SDLK_KP9)) whichend = 9;
+ if (Input::isKeyDown(SDLK_KP0)) whichend = 0;
participantfacing[whichdialogue][indialogue][whichend] = facing;
}
if (indialogue >= numdialogueboxes[whichdialogue]) {
player[i].weaponactive = 0;
if (weapons[k].owner != -1) {
- if (player[i].victim->num_weapons == 1)player[i].victim->num_weapons = 0;
- else player[i].victim->num_weapons = 1;
+ if (player[i].victim->num_weapons == 1)
+ player[i].victim->num_weapons = 0;
+ else
+ player[i].victim->num_weapons = 1;
player[i].victim->skeleton.longdead = 0;
player[i].victim->skeleton.free = 1;
footpoint = weapons[k].position;
if (player[i].victim->weaponstuck != -1) {
if (player[i].victim->weaponids[player[i].victim->weaponstuck] == k) {
- if (bloodtoggle)Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .8, .3);
+ if (bloodtoggle)
+ Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .8, .3);
weapons[k].bloody = 2;
weapons[k].blooddrip = 5;
player[i].victim->weaponstuck = -1;
}
}
if (player[i].victim->num_weapons > 0) {
- if (player[i].victim->weaponstuck != 0 && player[i].victim->weaponstuck != -1)player[i].victim->weaponstuck = 0;
+ if (player[i].victim->weaponstuck != 0 && player[i].victim->weaponstuck != -1)
+ player[i].victim->weaponstuck = 0;
if (player[i].victim->weaponids[0] == k)
player[i].victim->weaponids[0] = player[i].victim->weaponids[player[i].victim->num_weapons];
}
player[i].throwtogglekeydown = 1;
weapons[player[i].weaponids[0]].owner = -1;
weapons[player[i].weaponids[0]].velocity = player[i].velocity * .2;
- if (weapons[player[i].weaponids[0]].velocity.x == 0)weapons[player[i].weaponids[0]].velocity.x = .1;
+ if (weapons[player[i].weaponids[0]].velocity.x == 0)
+ weapons[player[i].weaponids[0]].velocity.x = .1;
weapons[player[i].weaponids[0]].tipvelocity = weapons[player[i].weaponids[0]].velocity;
weapons[player[i].weaponids[0]].missed = 1;
weapons[player[i].weaponids[0]].freetime = 0;
player[i].num_weapons--;
if (player[i].num_weapons) {
player[i].weaponids[0] = player[i].weaponids[player[i].num_weapons];
- if (player[i].weaponstuck == player[i].num_weapons)player[i].weaponstuck = 0;
+ if (player[i].weaponstuck == player[i].num_weapons)
+ player[i].weaponstuck = 0;
}
player[i].weaponactive = -1;
}
if (!player[i].crouchkeydown) {
//Uncrouch
- if (!player[i].isRun() && player[i].animTarget != sneakanim && i == 0)player[i].superruntoggle = 0;
+ if (!player[i].isRun() && player[i].animTarget != sneakanim && i == 0)
+ player[i].superruntoggle = 0;
target = -2;
if (player[i].isCrouch()) {
if (numplayers > 1)
player[i].velocity += DoRotation(absflatfacing * 5 * multiplier, 0, -90, 0);
}
player[i].targetyaw -= 90;
- if (player[i].forwardkeydown)player[i].targetyaw += 45;
- if (player[i].backkeydown)player[i].targetyaw -= 45;
+ if (player[i].forwardkeydown)
+ player[i].targetyaw += 45;
+ if (player[i].backkeydown)
+ player[i].targetyaw -= 45;
movekey = 1;
}
if ( player[i].leftkeydown) {
player[i].velocity -= DoRotation(absflatfacing * 5 * multiplier, 0, -90, 0);
}
player[i].targetyaw += 90;
- if (player[i].forwardkeydown)player[i].targetyaw -= 45;
- if (player[i].backkeydown)player[i].targetyaw += 45;
+ if (player[i].forwardkeydown)
+ player[i].targetyaw -= 45;
+ if (player[i].backkeydown)
+ player[i].targetyaw += 45;
movekey = 1;
}
if (player[i].backkeydown) {
facing.z = -1;
flatfacing = DoRotation(facing, 0, player[i].targetyaw + 180, 0);
- if (movekey)player[i].velocity = flatfacing * player[i].speed * 45 * player[i].scale;
- if (!movekey)player[i].velocity = 0;
+ if (movekey)
+ player[i].velocity = flatfacing * player[i].speed * 45 * player[i].scale;
+ if (!movekey)
+ player[i].velocity = 0;
//Dodge sweep?
target = -2;
if (distsq(&player[j].coords, &player[j].victim->coords) < 3 &&
player[j].victim == &player[i] &&
(player[j].animTarget == sweepanim)) {
- if (target >= 0)target = -1;
- else target = j;
+ if (target >= 0)
+ target = -1;
+ else
+ target = j;
}
}
}
- if (target >= 0)player[i].velocity.y = 1;
- else if (player[i].crouchkeydown || player[i].aitype != playercontrolled) {
+ if (target >= 0)
+ player[i].velocity.y = 1;
+ else
+ if (player[i].crouchkeydown || player[i].aitype != playercontrolled) {
player[i].velocity.y = 7;
player[i].crouchtogglekeydown = 1;
} else player[i].velocity.y = 5;
if (mousejump && i == 0 && debugmode) {
- if (!player[i].isLanding())player[i].tempdeltav = deltav;
- if (player[i].tempdeltav < 0)player[i].velocity.y -= (float)(player[i].tempdeltav) / multiplier / 1000;
+ if (!player[i].isLanding())
+ player[i].tempdeltav = deltav;
+ if (player[i].tempdeltav < 0)
+ player[i].velocity.y -= (float)(player[i].tempdeltav) / multiplier / 1000;
}
player[i].coords.y += .2;
player[i].jumppower = 0;
}
}
- if (((floatjump || editorenabled) && debugmode) && i == 0)player[i].velocity.y += multiplier * 30;
+ if (((floatjump || editorenabled) && debugmode) && i == 0)
+ player[i].velocity.y += multiplier * 30;
}
if (!movekey) {
for (int i = 0; i < player[1].skeleton.num_joints; i++) {
if (Random() % 2 == 0) {
- if (!player[1].skeleton.free)temp2 = (player[1].coords - player[1].oldcoords) / multiplier / 2; //velocity/2;
- if (player[1].skeleton.free)temp2 = player[1].skeleton.joints[i].velocity * player[1].scale / 2;
- if (!player[1].skeleton.free)temp = DoRotation(DoRotation(DoRotation(player[1].skeleton.joints[i].position, 0, 0, player[1].tilt), player[1].tilt2, 0, 0), 0, player[1].yaw, 0) * player[1].scale + player[1].coords;
- if (player[1].skeleton.free)temp = player[1].skeleton.joints[i].position * player[1].scale + player[1].coords;
+ if (!player[1].skeleton.free)
+ temp2 = (player[1].coords - player[1].oldcoords) / multiplier / 2; //velocity/2;
+ if (player[1].skeleton.free)
+ temp2 = player[1].skeleton.joints[i].velocity * player[1].scale / 2;
+ if (!player[1].skeleton.free)
+ temp = DoRotation(DoRotation(DoRotation(player[1].skeleton.joints[i].position, 0, 0, player[1].tilt), player[1].tilt2, 0, 0), 0, player[1].yaw, 0) * player[1].scale + player[1].coords;
+ if (player[1].skeleton.free)
+ temp = player[1].skeleton.joints[i].position * player[1].scale + player[1].coords;
Sprite::MakeSprite(breathsprite, temp, temp2, 1, 1, 1, .6 + (float)abs(Random() % 100) / 200 - .25, 1);
}
}
for (int i = 0; i < player[1].skeleton.num_joints; i++) {
player[1].skeleton.joints[i].velocity = 0;
if (Random() % 2 == 0) {
- if (!player[1].skeleton.free)temp2 = (player[1].coords - player[1].oldcoords) / multiplier / 2; //velocity/2;
- if (player[1].skeleton.free)temp2 = player[1].skeleton.joints[i].velocity * player[1].scale / 2;
- if (!player[1].skeleton.free)temp = DoRotation(DoRotation(DoRotation(player[1].skeleton.joints[i].position, 0, 0, player[1].tilt), player[1].tilt2, 0, 0), 0, player[1].yaw, 0) * player[1].scale + player[1].coords;
- if (player[1].skeleton.free)temp = player[1].skeleton.joints[i].position * player[1].scale + player[1].coords;
+ if (!player[1].skeleton.free)
+ temp2 = (player[1].coords - player[1].oldcoords) / multiplier / 2; //velocity/2;
+ if (player[1].skeleton.free)
+ temp2 = player[1].skeleton.joints[i].velocity * player[1].scale / 2;
+ if (!player[1].skeleton.free)
+ temp = DoRotation(DoRotation(DoRotation(player[1].skeleton.joints[i].position, 0, 0, player[1].tilt), player[1].tilt2, 0, 0), 0, player[1].yaw, 0) * player[1].scale + player[1].coords;
+ if (player[1].skeleton.free)
+ temp = player[1].skeleton.joints[i].position * player[1].scale + player[1].coords;
Sprite::MakeSprite(breathsprite, temp, temp2, 1, 1, 1, .6 + (float)abs(Random() % 100) / 200 - .25, 1);
}
}
if (alldead && !player[0].dead && maptype == mapkilleveryone) {
changedelay = 1;
targetlevel = whichlevel + 1;
- if (targetlevel > numchallengelevels - 1)targetlevel = 0;
+ if (targetlevel > numchallengelevels - 1)
+ targetlevel = 0;
}
if (winhotspot || windialogue) {
changedelay = 0.1;
targetlevel = whichlevel + 1;
- if (targetlevel > numchallengelevels - 1)targetlevel = 0;
+ if (targetlevel > numchallengelevels - 1)
+ targetlevel = 0;
}
if (killhotspot) {
changedelay = 1;
targetlevel = whichlevel + 1;
- if (targetlevel > numchallengelevels - 1)targetlevel = 0;
+ if (targetlevel > numchallengelevels - 1)
+ targetlevel = 0;
}
if (changedelay > 0 && !player[0].dead && !won) {
viewerfacing = facing;
if (!cameramode) {
- if ((animation[player[0].animTarget].attack != 3 && animation[player[0].animCurrent].attack != 3) || player[0].skeleton.free)target = player[0].coords + player[0].currentoffset * (1 - player[0].target) * player[0].scale + player[0].targetoffset * player[0].target * player[0].scale - player[0].facing * .05;
- else target = player[0].oldcoords + player[0].currentoffset * (1 - player[0].target) * player[0].scale + player[0].targetoffset * player[0].target * player[0].scale - player[0].facing * .05;
+ if ((animation[player[0].animTarget].attack != 3 && animation[player[0].animCurrent].attack != 3) || player[0].skeleton.free)
+ target = player[0].coords + player[0].currentoffset * (1 - player[0].target) * player[0].scale + player[0].targetoffset * player[0].target * player[0].scale - player[0].facing * .05;
+ else
+ target = player[0].oldcoords + player[0].currentoffset * (1 - player[0].target) * player[0].scale + player[0].targetoffset * player[0].target * player[0].scale - player[0].facing * .05;
target.y += .1;
if (player[0].skeleton.free) {
for (int i = 0; i < player[0].skeleton.num_joints; i++) {
if (findLengthfast(&player[0].velocity) > 400) {
cameraspeed = 20 + (findLength(&player[0].velocity) - 20) * .96;
}
- if (player[0].skeleton.free == 0 && player[0].animTarget != hanganim && player[0].animTarget != climbanim)target.y += 1.4;
+ if (player[0].skeleton.free == 0 && player[0].animTarget != hanganim && player[0].animTarget != climbanim)
+ target.y += 1.4;
coltarget = target - cameraloc;
- if (findLengthfast(&coltarget) < multiplier * multiplier * 400)cameraloc = target;
+ if (findLengthfast(&coltarget) < multiplier * multiplier * 400)
+ cameraloc = target;
else {
Normalise(&coltarget);
- if (player[0].animTarget != hanganim && player[0].animTarget != climbanim && player[0].animCurrent != climbanim && player[0].currentoffset.x == 0)cameraloc = cameraloc + coltarget * multiplier * cameraspeed;
- else cameraloc = cameraloc + coltarget * multiplier * 8;
+ if (player[0].animTarget != hanganim && player[0].animTarget != climbanim && player[0].animCurrent != climbanim && player[0].currentoffset.x == 0)
+ cameraloc = cameraloc + coltarget * multiplier * cameraspeed;
+ else
+ cameraloc = cameraloc + coltarget * multiplier * 8;
}
- if (editorenabled)cameraloc = target;
+ if (editorenabled)
+ cameraloc = target;
cameradist += multiplier * 5;
- if (cameradist > 2.3)cameradist = 2.3;
+ if (cameradist > 2.3)
+ cameradist = 2.3;
viewer = cameraloc - facing * cameradist;
colviewer = viewer;
coltarget = cameraloc;
int i = terrain.patchobjects[player[0].whichpatchx][player[0].whichpatchz][j];
colviewer = viewer;
coltarget = cameraloc;
- if (objects.model[i].LineCheckPossible(&colviewer, &coltarget, &col, &objects.position[i], &objects.yaw[i]) != -1)viewer = col;
+ if (objects.model[i].LineCheckPossible(&colviewer, &coltarget, &col, &objects.position[i], &objects.yaw[i]) != -1)
+ viewer = col;
}
if (terrain.patchobjectnum[player[0].whichpatchx][player[0].whichpatchz])
for (int j = 0; j < terrain.patchobjectnum[player[0].whichpatchx][player[0].whichpatchz]; j++) {
}
}
*/
- if (camerashake > .8)camerashake = .8;
+ if (camerashake > .8)
+ camerashake = .8;
//if(woozy>10)woozy=10;
//woozy+=multiplier;
woozy += multiplier;
- if (player[0].dead)camerashake = 0;
- if (player[0].dead)woozy = 0;
+ if (player[0].dead)
+ camerashake = 0;
+ if (player[0].dead)
+ woozy = 0;
camerashake -= multiplier * 2;
blackout -= multiplier * 2;
//if(player[0].isCrouch())woozy-=multiplier*8;
- if (camerashake < 0)camerashake = 0;
- if (blackout < 0)blackout = 0;
+ if (camerashake < 0)
+ camerashake = 0;
+ if (blackout < 0)
+ blackout = 0;
//if(woozy<0)woozy=0;
if (camerashake) {
viewer.x += (float)(Random() % 100) * .0005 * camerashake;
*p1 = *p1 - *move;
*p2 = *p2 - *move;
- if (*rotate)*p1 = DoRotation(*p1, 0, -*rotate, 0);
- if (*rotate)*p2 = DoRotation(*p2, 0, -*rotate, 0);
- if (!sphere_line_intersection(p1, p2, &boundingspherecenter,
- &boundingsphereradius))return -1;
+ if (*rotate)
+ *p1 = DoRotation(*p1, 0, -*rotate, 0);
+ if (*rotate)
+ *p2 = DoRotation(*p2, 0, -*rotate, 0);
+ if (!sphere_line_intersection(p1, p2, &boundingspherecenter, &boundingsphereradius))
+ return -1;
firstintersecting = -1;
for (j = 0; j < TriangleNum; j++) {
}
}
- if (*rotate)*p = DoRotation(*p, 0, *rotate, 0);
+ if (*rotate)
+ *p = DoRotation(*p, 0, *rotate, 0);
*p = *p + *move;
return firstintersecting;
}
*p1 = *p1 - *move;
*p2 = *p2 - *move;
- if (!sphere_line_intersection(p1, p2, &boundingspherecenter,
- &boundingsphereradius))return -1;
+ if (!sphere_line_intersection(p1, p2, &boundingspherecenter, &boundingsphereradius))
+ return -1;
firstintersecting = -1;
- if (*rotate)*p1 = DoRotation(*p1, 0, -*rotate, 0);
- if (*rotate)*p2 = DoRotation(*p2, 0, -*rotate, 0);
+ if (*rotate)
+ *p1 = DoRotation(*p1, 0, -*rotate, 0);
+ if (*rotate)
+ *p2 = DoRotation(*p2, 0, -*rotate, 0);
for (j = 0; j < TriangleNum; j++) {
intersecting = LineFacetd(p1, p2, &vertex[Triangles[j].vertex[0]], &vertex[Triangles[j].vertex[1]], &vertex[Triangles[j].vertex[2]], &facenormals[j], &point);
distance = abs((facenormals[firstintersecting].x * p2->x) + (facenormals[firstintersecting].y * p2->y) + (facenormals[firstintersecting].z * p2->z) - ((facenormals[firstintersecting].x * vertex[Triangles[firstintersecting].vertex[0]].x) + (facenormals[firstintersecting].y * vertex[Triangles[firstintersecting].vertex[0]].y) + (facenormals[firstintersecting].z * vertex[Triangles[firstintersecting].vertex[0]].z)));
*p2 -= facenormals[firstintersecting] * distance;
- if (*rotate)*p2 = DoRotation(*p2, 0, *rotate, 0);
+ if (*rotate)
+ *p2 = DoRotation(*p2, 0, *rotate, 0);
*p2 = *p2 + *move;
return firstintersecting;
}
*p1 = *p1 - *move;
*p2 = *p2 - *move;
- if (!sphere_line_intersection(p1, p2, &boundingspherecenter,
- &boundingsphereradius))return -1;
+ if (!sphere_line_intersection(p1, p2, &boundingspherecenter, &boundingsphereradius))
+ return -1;
firstintersecting = -1;
- if (*rotate)*p1 = DoRotation(*p1, 0, -*rotate, 0);
- if (*rotate)*p2 = DoRotation(*p2, 0, -*rotate, 0);
+ if (*rotate)
+ *p1 = DoRotation(*p1, 0, -*rotate, 0);
+ if (*rotate)
+ *p2 = DoRotation(*p2, 0, -*rotate, 0);
if (numpossible > 0 && numpossible < TriangleNum)
for (j = 0; j < numpossible; j++) {
}
}
- if (*rotate)*p = DoRotation(*p, 0, *rotate, 0);
+ if (*rotate)
+ *p = DoRotation(*p, 0, *rotate, 0);
*p = *p + *move;
return firstintersecting;
}
*p1 = *p1 - *move;
*p2 = *p2 - *move;
- if (!sphere_line_intersection(p1, p2, &boundingspherecenter,
- &boundingsphereradius))return -1;
+ if (!sphere_line_intersection(p1, p2, &boundingspherecenter, &boundingsphereradius))
+ return -1;
firstintersecting = -1;
- if (*rotate)*p1 = DoRotation(*p1, 0, -*rotate, 0);
- if (*rotate)*p2 = DoRotation(*p2, 0, -*rotate, 0);
+ if (*rotate)
+ *p1 = DoRotation(*p1, 0, -*rotate, 0);
+ if (*rotate)
+ *p2 = DoRotation(*p2, 0, -*rotate, 0);
if (numpossible)
for (j = 0; j < numpossible; j++) {
*p2 -= facenormals[firstintersecting] * distance;
}
- if (*rotate)*p2 = DoRotation(*p2, 0, *rotate, 0);
+ if (*rotate)
+ *p2 = DoRotation(*p2, 0, *rotate, 0);
*p2 = *p2 + *move;
return firstintersecting;
}
oldp1 = *p1;
*p1 = *p1 - *move;
- if (*rotate)*p1 = DoRotation(*p1, 0, -*rotate, 0);
- if (distsq(p1, &boundingspherecenter) > radius * radius + boundingsphereradius * boundingsphereradius)return -1;
+ if (*rotate)
+ *p1 = DoRotation(*p1, 0, -*rotate, 0);
+ if (distsq(p1, &boundingspherecenter) > radius * radius + boundingsphereradius * boundingsphereradius)
+ return -1;
for (i = 0; i < 4; i++) {
for (j = 0; j < TriangleNum; j++) {
distance = abs((facenormals[j].x * p1->x) + (facenormals[j].y * p1->y) + (facenormals[j].z * p1->z) - ((facenormals[j].x * vertex[Triangles[j].vertex[0]].x) + (facenormals[j].y * vertex[Triangles[j].vertex[0]].y) + (facenormals[j].z * vertex[Triangles[j].vertex[0]].z)));
if (distance < radius) {
point = *p1 - facenormals[j] * distance;
- if (PointInTriangle( &point, facenormals[j], &vertex[Triangles[j].vertex[0]], &vertex[Triangles[j].vertex[1]], &vertex[Triangles[j].vertex[2]]))intersecting = 1;
- if (!intersecting)intersecting = sphere_line_intersection(&vertex[Triangles[j].vertex[0]],
- &vertex[Triangles[j].vertex[1]],
- p1, &radius);
- if (!intersecting)intersecting = sphere_line_intersection(&vertex[Triangles[j].vertex[1]],
- &vertex[Triangles[j].vertex[2]],
- p1, &radius);
- if (!intersecting)intersecting = sphere_line_intersection(&vertex[Triangles[j].vertex[0]],
- &vertex[Triangles[j].vertex[2]],
- p1, &radius);
+ if (PointInTriangle( &point, facenormals[j], &vertex[Triangles[j].vertex[0]], &vertex[Triangles[j].vertex[1]], &vertex[Triangles[j].vertex[2]]))
+ intersecting = 1;
+ if (!intersecting)
+ intersecting = sphere_line_intersection(&vertex[Triangles[j].vertex[0]], &vertex[Triangles[j].vertex[1]], p1, &radius);
+ if (!intersecting)
+ intersecting = sphere_line_intersection(&vertex[Triangles[j].vertex[1]], &vertex[Triangles[j].vertex[2]], p1, &radius);
+ if (!intersecting)
+ intersecting = sphere_line_intersection(&vertex[Triangles[j].vertex[0]], &vertex[Triangles[j].vertex[2]], p1, &radius);
if (intersecting) {
*p1 += facenormals[j] * (distance - radius);
/*start=*p1;
}
}
}
- if (*rotate)*p = DoRotation(*p, 0, *rotate, 0);
+ if (*rotate)
+ *p = DoRotation(*p, 0, *rotate, 0);
*p = *p + *move;
- if (*rotate)*p1 = DoRotation(*p1, 0, *rotate, 0);
+ if (*rotate)
+ *p1 = DoRotation(*p1, 0, *rotate, 0);
*p1 += *move;
return firstintersecting;
}
numpossible = 0;
- if (*rotate)*p1 = DoRotation(*p1, 0, -*rotate, 0);
+ if (*rotate)
+ *p1 = DoRotation(*p1, 0, -*rotate, 0);
if (distsq(p1, &boundingspherecenter) > radius * radius + boundingsphereradius * boundingsphereradius) {
*p1 = oldp1;
return -1;
distance = abs((facenormals[j].x * p1->x) + (facenormals[j].y * p1->y) + (facenormals[j].z * p1->z) - ((facenormals[j].x * vertex[Triangles[j].vertex[0]].x) + (facenormals[j].y * vertex[Triangles[j].vertex[0]].y) + (facenormals[j].z * vertex[Triangles[j].vertex[0]].z)));
if (distance < radius) {
point = *p1 - facenormals[j] * distance;
- if (PointInTriangle( &point, facenormals[j], &vertex[Triangles[j].vertex[0]], &vertex[Triangles[j].vertex[1]], &vertex[Triangles[j].vertex[2]]))intersecting = 1;
- if (!intersecting)intersecting = sphere_line_intersection(&vertex[Triangles[j].vertex[0]],
- &vertex[Triangles[j].vertex[1]],
- p1, &radius);
- if (!intersecting)intersecting = sphere_line_intersection(&vertex[Triangles[j].vertex[1]],
- &vertex[Triangles[j].vertex[2]],
- p1, &radius);
- if (!intersecting)intersecting = sphere_line_intersection(&vertex[Triangles[j].vertex[0]],
- &vertex[Triangles[j].vertex[2]],
- p1, &radius);
+ if (PointInTriangle( &point, facenormals[j], &vertex[Triangles[j].vertex[0]], &vertex[Triangles[j].vertex[1]], &vertex[Triangles[j].vertex[2]]))
+ intersecting = 1;
+ if (!intersecting)
+ intersecting = sphere_line_intersection(&vertex[Triangles[j].vertex[0]], &vertex[Triangles[j].vertex[1]], p1, &radius);
+ if (!intersecting)
+ intersecting = sphere_line_intersection(&vertex[Triangles[j].vertex[1]], &vertex[Triangles[j].vertex[2]], p1, &radius);
+ if (!intersecting)
+ intersecting = sphere_line_intersection(&vertex[Triangles[j].vertex[0]], &vertex[Triangles[j].vertex[2]], p1, &radius);
if (intersecting) {
//if(j>=0&&j<TriangleNum)
possible[numpossible] = j;
firstintersecting = j;
}
}
- if (*rotate)*p1 = DoRotation(*p1, 0, *rotate, 0);
+ if (*rotate)
+ *p1 = DoRotation(*p1, 0, *rotate, 0);
*p1 += *move;
return firstintersecting;
}
void Model::UpdateVertexArray()
{
- if (type != normaltype && type != decalstype)return;
+ if (type != normaltype && type != decalstype)
+ return;
static int i;
static int j;
if (!flat)
void Model::UpdateVertexArrayNoTex()
{
- if (type != normaltype && type != decalstype)return;
+ if (type != normaltype && type != decalstype)
+ return;
static int i;
static int j;
if (!flat)
void Model::UpdateVertexArrayNoTexNoNorm()
{
- if (type != normaltype && type != decalstype)return;
+ if (type != normaltype && type != decalstype)
+ return;
static int i;
static int j;
for (i = 0; i < TriangleNum; i++) {
void Model::ScaleNormals(float xscale, float yscale, float zscale)
{
- if (type != normaltype && type != decalstype)return;
+ if (type != normaltype && type != decalstype)
+ return;
static int i;
for (i = 0; i < vertexNum; i++) {
normals[i].x *= xscale;
if (visibleloading)
Game::LoadingScreen();
static int i;
- if (type != normaltype && type != decalstype)return;
+ if (type != normaltype && type != decalstype)
+ return;
for (i = 0; i < vertexNum; i++) {
normals[i].x = 0;
normals[Triangles[i].vertex[2]].x += facenormals[i].x;
normals[Triangles[i].vertex[2]].y += facenormals[i].y;
normals[Triangles[i].vertex[2]].z += facenormals[i].z;
- if (facenormalise)Normalise(&facenormals[i]);
+ if (facenormalise)
+ Normalise(&facenormals[i]);
}
for (i = 0; i < vertexNum; i++) {
Normalise(&normals[i]);
&&isnormal(vertex[Triangles[i].vertex[2]].x)&&isnormal(vertex[Triangles[i].vertex[2]].y)&&isnormal(vertex[Triangles[i].vertex[2]].z)){
*/
glTexCoord2f(Triangles[i].gx[0], Triangles[i].gy[0]);
- if (color)glColor3f(normals[Triangles[i].vertex[0]].x, normals[Triangles[i].vertex[0]].y, normals[Triangles[i].vertex[0]].z);
- if (!color && !flat)glNormal3f(normals[Triangles[i].vertex[0]].x, normals[Triangles[i].vertex[0]].y, normals[Triangles[i].vertex[0]].z);
- if (!color && flat)glNormal3f(facenormals[i].x, facenormals[i].y, facenormals[i].y);
+ if (color)
+ glColor3f(normals[Triangles[i].vertex[0]].x, normals[Triangles[i].vertex[0]].y, normals[Triangles[i].vertex[0]].z);
+ if (!color && !flat)
+ glNormal3f(normals[Triangles[i].vertex[0]].x, normals[Triangles[i].vertex[0]].y, normals[Triangles[i].vertex[0]].z);
+ if (!color && flat)
+ glNormal3f(facenormals[i].x, facenormals[i].y, facenormals[i].y);
glVertex3f(vertex[Triangles[i].vertex[0]].x, vertex[Triangles[i].vertex[0]].y, vertex[Triangles[i].vertex[0]].z);
glTexCoord2f(Triangles[i].gx[1], Triangles[i].gy[1]);
- if (color)glColor3f(normals[Triangles[i].vertex[1]].x, normals[Triangles[i].vertex[1]].y, normals[Triangles[i].vertex[1]].z);
- if (!color && !flat)glNormal3f(normals[Triangles[i].vertex[1]].x, normals[Triangles[i].vertex[1]].y, normals[Triangles[i].vertex[1]].z);
- if (!color && flat)glNormal3f(facenormals[i].x, facenormals[i].y, facenormals[i].y);
+ if (color)
+ glColor3f(normals[Triangles[i].vertex[1]].x, normals[Triangles[i].vertex[1]].y, normals[Triangles[i].vertex[1]].z);
+ if (!color && !flat)
+ glNormal3f(normals[Triangles[i].vertex[1]].x, normals[Triangles[i].vertex[1]].y, normals[Triangles[i].vertex[1]].z);
+ if (!color && flat)
+ glNormal3f(facenormals[i].x, facenormals[i].y, facenormals[i].y);
glVertex3f(vertex[Triangles[i].vertex[1]].x, vertex[Triangles[i].vertex[1]].y, vertex[Triangles[i].vertex[1]].z);
glTexCoord2f(Triangles[i].gx[2], Triangles[i].gy[2]);
- if (color)glColor3f(normals[Triangles[i].vertex[2]].x, normals[Triangles[i].vertex[2]].y, normals[Triangles[i].vertex[2]].z);
- if (!color && !flat)glNormal3f(normals[Triangles[i].vertex[2]].x, normals[Triangles[i].vertex[2]].y, normals[Triangles[i].vertex[2]].z);
- if (!color && flat)glNormal3f(facenormals[i].x, facenormals[i].y, facenormals[i].y);
+ if (color)
+ glColor3f(normals[Triangles[i].vertex[2]].x, normals[Triangles[i].vertex[2]].y, normals[Triangles[i].vertex[2]].z);
+ if (!color && !flat)
+ glNormal3f(normals[Triangles[i].vertex[2]].x, normals[Triangles[i].vertex[2]].y, normals[Triangles[i].vertex[2]].z);
+ if (!color && flat)
+ glNormal3f(facenormals[i].x, facenormals[i].y, facenormals[i].y);
glVertex3f(vertex[Triangles[i].vertex[2]].x, vertex[Triangles[i].vertex[2]].y, vertex[Triangles[i].vertex[2]].z);
//}
//}
void Model::draw()
{
- if (type != normaltype && type != decalstype)return;
+ if (type != normaltype && type != decalstype)
+ return;
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- if (!color)glInterleavedArrays( GL_T2F_N3F_V3F, 8 * sizeof(GLfloat), &vArray[0]);
- if (color)glInterleavedArrays( GL_T2F_C3F_V3F, 8 * sizeof(GLfloat), &vArray[0]);
+ if (!color)
+ glInterleavedArrays( GL_T2F_N3F_V3F, 8 * sizeof(GLfloat), &vArray[0]);
+ if (color)
+ glInterleavedArrays( GL_T2F_C3F_V3F, 8 * sizeof(GLfloat), &vArray[0]);
textureptr.bind();
#if PLATFORM_MACOSX
#endif
- if (!color)glDisableClientState(GL_NORMAL_ARRAY);
- if (color)glDisableClientState(GL_COLOR_ARRAY);
+ if (!color)
+ glDisableClientState(GL_NORMAL_ARRAY);
+ if (color)
+ glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
//drawimmediate();
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- if (!color)glInterleavedArrays( GL_T2F_N3F_V3F, 8 * sizeof(GLfloat), &vArray[0]);
- if (color)glInterleavedArrays( GL_T2F_C3F_V3F, 8 * sizeof(GLfloat), &vArray[0]);
+ if (!color)
+ glInterleavedArrays( GL_T2F_N3F_V3F, 8 * sizeof(GLfloat), &vArray[0]);
+ if (color)
+ glInterleavedArrays( GL_T2F_C3F_V3F, 8 * sizeof(GLfloat), &vArray[0]);
glBindTexture(GL_TEXTURE_2D, (unsigned long)texture);
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
#endif
- if (!color)glDisableClientState(GL_NORMAL_ARRAY);
- if (color)glDisableClientState(GL_COLOR_ARRAY);
+ if (!color)
+ glDisableClientState(GL_NORMAL_ARRAY);
+ if (color)
+ glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
//drawdiffteximmediate(texture);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- if (!color)glInterleavedArrays( GL_T2F_N3F_V3F, 8 * sizeof(GLfloat), &vArray[0]);
- if (color)glInterleavedArrays( GL_T2F_C3F_V3F, 8 * sizeof(GLfloat), &vArray[0]);
+ if (!color)
+ glInterleavedArrays( GL_T2F_N3F_V3F, 8 * sizeof(GLfloat), &vArray[0]);
+ if (color)
+ glInterleavedArrays( GL_T2F_C3F_V3F, 8 * sizeof(GLfloat), &vArray[0]);
texture.bind();
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
#endif
- if (!color)glDisableClientState(GL_NORMAL_ARRAY);
- if (color)glDisableClientState(GL_COLOR_ARRAY);
+ if (!color)
+ glDisableClientState(GL_NORMAL_ARRAY);
+ if (color)
+ glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
//drawdiffteximmediate(texture);
&&isnormal(vertex[Triangles[i].vertex[1]].x)&&isnormal(vertex[Triangles[i].vertex[1]].y)&&isnormal(vertex[Triangles[i].vertex[1]].z)
&&isnormal(vertex[Triangles[i].vertex[2]].x)&&isnormal(vertex[Triangles[i].vertex[2]].y)&&isnormal(vertex[Triangles[i].vertex[2]].z)){
*/glTexCoord2f(Triangles[i].gx[0], Triangles[i].gy[0]);
- if (color)glColor3f(normals[Triangles[i].vertex[0]].x, normals[Triangles[i].vertex[0]].y, normals[Triangles[i].vertex[0]].z);
- if (!color && !flat)glNormal3f(normals[Triangles[i].vertex[0]].x, normals[Triangles[i].vertex[0]].y, normals[Triangles[i].vertex[0]].z);
- if (!color && flat)glNormal3f(facenormals[i].x, facenormals[i].y, facenormals[i].y);
+ if (color)
+ glColor3f(normals[Triangles[i].vertex[0]].x, normals[Triangles[i].vertex[0]].y, normals[Triangles[i].vertex[0]].z);
+ if (!color && !flat)
+ glNormal3f(normals[Triangles[i].vertex[0]].x, normals[Triangles[i].vertex[0]].y, normals[Triangles[i].vertex[0]].z);
+ if (!color && flat)
+ glNormal3f(facenormals[i].x, facenormals[i].y, facenormals[i].y);
glVertex3f(vertex[Triangles[i].vertex[0]].x, vertex[Triangles[i].vertex[0]].y, vertex[Triangles[i].vertex[0]].z);
glTexCoord2f(Triangles[i].gx[1], Triangles[i].gy[1]);
- if (color)glColor3f(normals[Triangles[i].vertex[1]].x, normals[Triangles[i].vertex[1]].y, normals[Triangles[i].vertex[1]].z);
- if (!color && !flat)glNormal3f(normals[Triangles[i].vertex[1]].x, normals[Triangles[i].vertex[1]].y, normals[Triangles[i].vertex[1]].z);
- if (!color && flat)glNormal3f(facenormals[i].x, facenormals[i].y, facenormals[i].y);
+ if (color)
+ glColor3f(normals[Triangles[i].vertex[1]].x, normals[Triangles[i].vertex[1]].y, normals[Triangles[i].vertex[1]].z);
+ if (!color && !flat)
+ glNormal3f(normals[Triangles[i].vertex[1]].x, normals[Triangles[i].vertex[1]].y, normals[Triangles[i].vertex[1]].z);
+ if (!color && flat)
+ glNormal3f(facenormals[i].x, facenormals[i].y, facenormals[i].y);
glVertex3f(vertex[Triangles[i].vertex[1]].x, vertex[Triangles[i].vertex[1]].y, vertex[Triangles[i].vertex[1]].z);
glTexCoord2f(Triangles[i].gx[2], Triangles[i].gy[2]);
- if (color)glColor3f(normals[Triangles[i].vertex[2]].x, normals[Triangles[i].vertex[2]].y, normals[Triangles[i].vertex[2]].z);
- if (!color && !flat)glNormal3f(normals[Triangles[i].vertex[2]].x, normals[Triangles[i].vertex[2]].y, normals[Triangles[i].vertex[2]].z);
- if (!color && flat)glNormal3f(facenormals[i].x, facenormals[i].y, facenormals[i].y);
+ if (color)
+ glColor3f(normals[Triangles[i].vertex[2]].x, normals[Triangles[i].vertex[2]].y, normals[Triangles[i].vertex[2]].z);
+ if (!color && !flat)
+ glNormal3f(normals[Triangles[i].vertex[2]].x, normals[Triangles[i].vertex[2]].y, normals[Triangles[i].vertex[2]].z);
+ if (!color && flat)
+ glNormal3f(facenormals[i].x, facenormals[i].y, facenormals[i].y);
glVertex3f(vertex[Triangles[i].vertex[2]].x, vertex[Triangles[i].vertex[2]].y, vertex[Triangles[i].vertex[2]].z);
//}
//}
void Model::drawdecals(Texture shadowtexture, Texture bloodtexture, Texture bloodtexture2, Texture breaktexture)
{
if (decals) {
- if (type != decalstype)return;
+ if (type != decalstype)
+ return;
static int i, j;
static float distancemult;
static int lasttype;
glDisable(GL_CULL_FACE);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(0);
- if (numdecals > max_model_decals)numdecals = max_model_decals;
+ if (numdecals > max_model_decals)
+ numdecals = max_model_decals;
for (i = 0; i < numdecals; i++) {
- if (decaltype[i] == blooddecalfast && decalalivetime[i] < 2)decalalivetime[i] = 2;
+ if (decaltype[i] == blooddecalfast && decalalivetime[i] < 2)
+ decalalivetime[i] = 2;
if (decaltype[i] == shadowdecal && decaltype[i] != lasttype) {
shadowtexture.bind();
}
if (decaltype[i] == breakdecal) {
glColor4f(1, 1, 1, decalopacity[i]);
- if (decalalivetime[i] > 58)glColor4f(1, 1, 1, decalopacity[i] * (60 - decalalivetime[i]) / 2);
+ if (decalalivetime[i] > 58)
+ glColor4f(1, 1, 1, decalopacity[i] * (60 - decalalivetime[i]) / 2);
}
if ((decaltype[i] == blooddecal || decaltype[i] == blooddecalfast || decaltype[i] == blooddecalslow)) {
glColor4f(1, 1, 1, decalopacity[i]);
- if (decalalivetime[i] < 4)glColor4f(1, 1, 1, decalopacity[i]*decalalivetime[i]*.25);
- if (decalalivetime[i] > 58)glColor4f(1, 1, 1, decalopacity[i] * (60 - decalalivetime[i]) / 2);
+ if (decalalivetime[i] < 4)
+ glColor4f(1, 1, 1, decalopacity[i]*decalalivetime[i]*.25);
+ if (decalalivetime[i] > 58)
+ glColor4f(1, 1, 1, decalopacity[i] * (60 - decalalivetime[i]) / 2);
}
lasttype = decaltype[i];
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
}
for (i = numdecals - 1; i >= 0; i--) {
decalalivetime[i] += multiplier;
- if (decaltype[i] == blooddecalslow)decalalivetime[i] -= multiplier * 2 / 3;
- if (decaltype[i] == blooddecalfast)decalalivetime[i] += multiplier * 4;
- if (decaltype[i] == shadowdecal)DeleteDecal(i);
- if ((decaltype[i] == blooddecal || decaltype[i] == blooddecalfast || decaltype[i] == blooddecalslow) && decalalivetime[i] >= 60)DeleteDecal(i);
+ if (decaltype[i] == blooddecalslow)
+ decalalivetime[i] -= multiplier * 2 / 3;
+ if (decaltype[i] == blooddecalfast)
+ decalalivetime[i] += multiplier * 4;
+ if (decaltype[i] == shadowdecal)
+ DeleteDecal(i);
+ if ((decaltype[i] == blooddecal || decaltype[i] == blooddecalfast || decaltype[i] == blooddecalslow) && decalalivetime[i] >= 60)
+ DeleteDecal(i);
}
glAlphaFunc(GL_GREATER, 0.0001);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
void Model::DeleteDecal(int which)
{
if (decals) {
- if (type != decalstype)return;
+ if (type != decalstype)
+ return;
decaltype[which] = decaltype[numdecals - 1];
decalposition[which] = decalposition[numdecals - 1];
for (int i = 0; i < 3; i++) {
void Model::MakeDecal(int atype, XYZ *where, float *size, float *opacity, float *rotation)
{
if (decals) {
- if (type != decalstype)return;
+ if (type != decalstype)
+ return;
static float placex, placez;
static XYZ rot;
decaltexcoords[numdecals][j][1] = rot.z + .5;
}
}
- if (numdecals < max_model_decals - 1)numdecals++;
+ if (numdecals < max_model_decals - 1)
+ numdecals++;
}
}
}
void Model::MakeDecal(int atype, XYZ where, float size, float opacity, float rotation)
{
if (decals) {
- if (type != decalstype)return;
+ if (type != decalstype)
+ return;
static float placex, placez;
static XYZ rot;
decaltexcoords[numdecals][j][1] = rot.z + .5;
}
}
- if (numdecals < max_model_decals - 1)numdecals++;
+ if (numdecals < max_model_decals - 1)
+ numdecals++;
}
}
} else if (distance < .02 && abs(facenormals[i].x) > abs(facenormals[i].y) && abs(facenormals[i].x) > abs(facenormals[i].z)) {
decaltexcoords[numdecals][j][1] = rot.z + .5;
}
}
- if (numdecals < max_model_decals - 1)numdecals++;
+ if (numdecals < max_model_decals - 1)
+ numdecals++;
}
}
} else if (distance < .02 && abs(facenormals[i].z) > abs(facenormals[i].y) && abs(facenormals[i].z) > abs(facenormals[i].x)) {
decaltexcoords[numdecals][j][1] = rot.z + .5;
}
}
- if (numdecals < max_model_decals - 1)numdecals++;
+ if (numdecals < max_model_decals - 1)
+ numdecals++;
}
}
}
{
int i = 0, j = 0;
- if (owner)free(owner);
+ if (owner)
+ free(owner);
owner = 0;
- if (possible)free(possible);
+ if (possible)
+ free(possible);
possible = 0;
- if (vertex)free(vertex);
+ if (vertex)
+ free(vertex);
vertex = 0;
- if (normals)free(normals);
+ if (normals)
+ free(normals);
normals = 0;
- if (facenormals)free(facenormals);
+ if (facenormals)
+ free(facenormals);
facenormals = 0;
- if (Triangles)free(Triangles);
+ if (Triangles)
+ free(Triangles);
Triangles = 0;
- if (vArray)free(vArray);
+ if (vArray)
+ free(vArray);
vArray = 0;
if (type[i] != treeleavestype && type[i] != treetrunktype && type[i] != bushtype && type[i] != firetype && i != which) {
colviewer = startpoint;
coltarget = endpoint;
- if (model[i].LineCheck(&colviewer, &coltarget, &colpoint, &position[i], &yaw[i]) != -1)return 1;
+ if (model[i].LineCheck(&colviewer, &coltarget, &colpoint, &position[i], &yaw[i]) != -1)
+ return 1;
}
}
hidden = !(distsqflat(&viewer, &position[i]) > playerdist + 3 || (type[i] != bushtype && type[i] != treeleavestype));
if (!hidden) {
- if (detail == 2 && distance > viewdistance * viewdistance / 4 && environment == desertenvironment)glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, blurness );
- else glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0 );
+ if (detail == 2 && distance > viewdistance * viewdistance / 4 && environment == desertenvironment)
+ glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, blurness );
+ else
+ glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0 );
distance = (viewdistance * viewdistance - (distance - (viewdistance * viewdistance * fadestart)) * (1 / (1 - fadestart))) / viewdistance / viewdistance;
- if (distance > 1)distance = 1;
+ if (distance > 1)
+ distance = 1;
if (distance > 0) {
/*if(checkcollide(viewer,DoRotation(model[i].vertex[model[i].vertexNum],0,yaw[i],0)*scale[i]+position[i],i)){
if (occluded[i] < 6) {
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glPushMatrix();
- if (!model[i].color)glEnable(GL_LIGHTING);
- else glDisable(GL_LIGHTING);
+ if (!model[i].color)
+ glEnable(GL_LIGHTING);
+ else
+ glDisable(GL_LIGHTING);
glDepthMask(1);
glTranslatef(position[i].x, position[i].y, position[i].z);
if (type[i] == bushtype) {
messedwith[i] -= multiplier;
if (rotxvel[i] || rotx[i]) {
- if (rotx[i] > 0)rotxvel[i] -= multiplier * 8 * fabs(rotx[i]);
- if (rotx[i] < 0)rotxvel[i] += multiplier * 8 * fabs(rotx[i]);
- if (rotx[i] > 0)rotxvel[i] -= multiplier * 4;
- if (rotx[i] < 0)rotxvel[i] += multiplier * 4;
- if (rotxvel[i] > 0)rotxvel[i] -= multiplier * 4;
- if (rotxvel[i] < 0)rotxvel[i] += multiplier * 4;
- if (fabs(rotx[i]) < multiplier * 4)rotx[i] = 0;
- if (fabs(rotxvel[i]) < multiplier * 4)rotxvel[i] = 0;
+ if (rotx[i] > 0) rotxvel[i] -= multiplier * 8 * fabs(rotx[i]);
+ if (rotx[i] < 0) rotxvel[i] += multiplier * 8 * fabs(rotx[i]);
+ if (rotx[i] > 0) rotxvel[i] -= multiplier * 4;
+ if (rotx[i] < 0) rotxvel[i] += multiplier * 4;
+ if (rotxvel[i] > 0) rotxvel[i] -= multiplier * 4;
+ if (rotxvel[i] < 0) rotxvel[i] += multiplier * 4;
+ if (fabs(rotx[i]) < multiplier * 4)
+ rotx[i] = 0;
+ if (fabs(rotxvel[i]) < multiplier * 4)
+ rotxvel[i] = 0;
rotx[i] += rotxvel[i] * multiplier * 4;
}
if (rotyvel[i] || roty[i]) {
- if (roty[i] > 0)rotyvel[i] -= multiplier * 8 * fabs(roty[i]);
- if (roty[i] < 0)rotyvel[i] += multiplier * 8 * fabs(roty[i]);
- if (roty[i] > 0)rotyvel[i] -= multiplier * 4;
- if (roty[i] < 0)rotyvel[i] += multiplier * 4;
- if (rotyvel[i] > 0)rotyvel[i] -= multiplier * 4;
- if (rotyvel[i] < 0)rotyvel[i] += multiplier * 4;
- if (fabs(roty[i]) < multiplier * 4)roty[i] = 0;
- if (fabs(rotyvel[i]) < multiplier * 4)rotyvel[i] = 0;
+ if (roty[i] > 0) rotyvel[i] -= multiplier * 8 * fabs(roty[i]);
+ if (roty[i] < 0) rotyvel[i] += multiplier * 8 * fabs(roty[i]);
+ if (roty[i] > 0) rotyvel[i] -= multiplier * 4;
+ if (roty[i] < 0) rotyvel[i] += multiplier * 4;
+ if (rotyvel[i] > 0) rotyvel[i] -= multiplier * 4;
+ if (rotyvel[i] < 0) rotyvel[i] += multiplier * 4;
+ if (fabs(roty[i]) < multiplier * 4)
+ roty[i] = 0;
+ if (fabs(rotyvel[i]) < multiplier * 4)
+ rotyvel[i] = 0;
roty[i] += rotyvel[i] * multiplier * 4;
}
if (rotx[i]) {
glRotatef(-rotx[i], 0, 0, 1);
}
- if (rotx[i] > 10)rotx[i] = 10;
- if (rotx[i] < -10)rotx[i] = -10;
- if (roty[i] > 10)roty[i] = 10;
- if (roty[i] < -10)roty[i] = -10;
+ if (rotx[i] > 10)
+ rotx[i] = 10;
+ if (rotx[i] < -10)
+ rotx[i] = -10;
+ if (roty[i] > 10)
+ roty[i] = 10;
+ if (roty[i] < -10)
+ roty[i] = -10;
}
if (type[i] == treetrunktype || type[i] == treeleavestype) {
if (type[i] == treetrunktype || environment == 2) {
messedwith[i] -= multiplier;
if (rotxvel[i] || rotx[i]) {
- if (rotx[i] > 0)rotxvel[i] -= multiplier * 8 * fabs(rotx[i]);
- if (rotx[i] < 0)rotxvel[i] += multiplier * 8 * fabs(rotx[i]);
- if (rotx[i] > 0)rotxvel[i] -= multiplier * 4;
- if (rotx[i] < 0)rotxvel[i] += multiplier * 4;
- if (rotxvel[i] > 0)rotxvel[i] -= multiplier * 4;
- if (rotxvel[i] < 0)rotxvel[i] += multiplier * 4;
- if (fabs(rotx[i]) < multiplier * 4)rotx[i] = 0;
- if (fabs(rotxvel[i]) < multiplier * 4)rotxvel[i] = 0;
+ if (rotx[i] > 0) rotxvel[i] -= multiplier * 8 * fabs(rotx[i]);
+ if (rotx[i] < 0) rotxvel[i] += multiplier * 8 * fabs(rotx[i]);
+ if (rotx[i] > 0) rotxvel[i] -= multiplier * 4;
+ if (rotx[i] < 0) rotxvel[i] += multiplier * 4;
+ if (rotxvel[i] > 0) rotxvel[i] -= multiplier * 4;
+ if (rotxvel[i] < 0) rotxvel[i] += multiplier * 4;
+ if (fabs(rotx[i]) < multiplier * 4)
+ rotx[i] = 0;
+ if (fabs(rotxvel[i]) < multiplier * 4)
+ rotxvel[i] = 0;
rotx[i] += rotxvel[i] * multiplier * 4;
}
if (rotyvel[i] || roty[i]) {
- if (roty[i] > 0)rotyvel[i] -= multiplier * 8 * fabs(roty[i]);
- if (roty[i] < 0)rotyvel[i] += multiplier * 8 * fabs(roty[i]);
- if (roty[i] > 0)rotyvel[i] -= multiplier * 4;
- if (roty[i] < 0)rotyvel[i] += multiplier * 4;
- if (rotyvel[i] > 0)rotyvel[i] -= multiplier * 4;
- if (rotyvel[i] < 0)rotyvel[i] += multiplier * 4;
- if (fabs(roty[i]) < multiplier * 4)roty[i] = 0;
- if (fabs(rotyvel[i]) < multiplier * 4)rotyvel[i] = 0;
+ if (roty[i] > 0) rotyvel[i] -= multiplier * 8 * fabs(roty[i]);
+ if (roty[i] < 0) rotyvel[i] += multiplier * 8 * fabs(roty[i]);
+ if (roty[i] > 0) rotyvel[i] -= multiplier * 4;
+ if (roty[i] < 0) rotyvel[i] += multiplier * 4;
+ if (rotyvel[i] > 0) rotyvel[i] -= multiplier * 4;
+ if (rotyvel[i] < 0) rotyvel[i] += multiplier * 4;
+ if (fabs(roty[i]) < multiplier * 4)
+ roty[i] = 0;
+ if (fabs(rotyvel[i]) < multiplier * 4)
+ rotyvel[i] = 0;
roty[i] += rotyvel[i] * multiplier * 4;
}
if (rotx[i]) {
glRotatef(-rotx[i] / 6, 0, 0, 1);
}
- if (rotx[i] > 10)rotx[i] = 10;
- if (rotx[i] < -10)rotx[i] = -10;
- if (roty[i] > 10)roty[i] = 10;
- if (roty[i] < -10)roty[i] = -10;
+ if (rotx[i] > 10)
+ rotx[i] = 10;
+ if (rotx[i] < -10)
+ rotx[i] = -10;
+ if (roty[i] > 10)
+ roty[i] = 10;
+ if (roty[i] < -10)
+ roty[i] = -10;
} else {
messedwith[i] -= multiplier;
if (rotxvel[i] || rotx[i]) {
- if (rotx[i] > 0)rotxvel[i] -= multiplier * 8 * fabs(rotx[i]);
- if (rotx[i] < 0)rotxvel[i] += multiplier * 8 * fabs(rotx[i]);
- if (rotx[i] > 0)rotxvel[i] -= multiplier * 4;
- if (rotx[i] < 0)rotxvel[i] += multiplier * 4;
- if (rotxvel[i] > 0)rotxvel[i] -= multiplier * 4;
- if (rotxvel[i] < 0)rotxvel[i] += multiplier * 4;
- if (fabs(rotx[i]) < multiplier * 4)rotx[i] = 0;
- if (fabs(rotxvel[i]) < multiplier * 4)rotxvel[i] = 0;
+ if (rotx[i] > 0) rotxvel[i] -= multiplier * 8 * fabs(rotx[i]);
+ if (rotx[i] < 0) rotxvel[i] += multiplier * 8 * fabs(rotx[i]);
+ if (rotx[i] > 0) rotxvel[i] -= multiplier * 4;
+ if (rotx[i] < 0) rotxvel[i] += multiplier * 4;
+ if (rotxvel[i] > 0) rotxvel[i] -= multiplier * 4;
+ if (rotxvel[i] < 0) rotxvel[i] += multiplier * 4;
+ if (fabs(rotx[i]) < multiplier * 4)
+ rotx[i] = 0;
+ if (fabs(rotxvel[i]) < multiplier * 4)
+ rotxvel[i] = 0;
rotx[i] += rotxvel[i] * multiplier * 4;
}
if (rotyvel[i] || roty[i]) {
- if (roty[i] > 0)rotyvel[i] -= multiplier * 8 * fabs(roty[i]);
- if (roty[i] < 0)rotyvel[i] += multiplier * 8 * fabs(roty[i]);
- if (roty[i] > 0)rotyvel[i] -= multiplier * 4;
- if (roty[i] < 0)rotyvel[i] += multiplier * 4;
- if (rotyvel[i] > 0)rotyvel[i] -= multiplier * 4;
- if (rotyvel[i] < 0)rotyvel[i] += multiplier * 4;
- if (fabs(roty[i]) < multiplier * 4)roty[i] = 0;
- if (fabs(rotyvel[i]) < multiplier * 4)rotyvel[i] = 0;
+ if (roty[i] > 0) rotyvel[i] -= multiplier * 8 * fabs(roty[i]);
+ if (roty[i] < 0) rotyvel[i] += multiplier * 8 * fabs(roty[i]);
+ if (roty[i] > 0) rotyvel[i] -= multiplier * 4;
+ if (roty[i] < 0) rotyvel[i] += multiplier * 4;
+ if (rotyvel[i] > 0) rotyvel[i] -= multiplier * 4;
+ if (rotyvel[i] < 0) rotyvel[i] += multiplier * 4;
+ if (fabs(roty[i]) < multiplier * 4)
+ roty[i] = 0;
+ if (fabs(rotyvel[i]) < multiplier * 4)
+ rotyvel[i] = 0;
roty[i] += rotyvel[i] * multiplier * 4;
}
if (rotx[i]) {
glRotatef(-rotx[i] / 4, 0, 0, 1);
}
- if (rotx[i] > 10)rotx[i] = 10;
- if (rotx[i] < -10)rotx[i] = -10;
- if (roty[i] > 10)roty[i] = 10;
- if (roty[i] < -10)roty[i] = -10;
+ if (rotx[i] > 10)
+ rotx[i] = 10;
+ if (rotx[i] < -10)
+ rotx[i] = -10;
+ if (roty[i] > 10)
+ roty[i] = 10;
+ if (roty[i] < -10)
+ roty[i] = -10;
}
}
}
}
glRotatef(yaw[i], 0, 1, 0);
- if (distance > 1)distance = 1;
+ if (distance > 1)
+ distance = 1;
glColor4f((1 - shadowed[i]) / 2 + .5, (1 - shadowed[i]) / 2 + .5, (1 - shadowed[i]) / 2 + .5, distance);
if (distance >= 1) {
glDisable(GL_BLEND);
terrainlight = terrain.getLighting(position[i].x, position[i].z);
if (!hidden) {
glColor4f(terrainlight.x, terrainlight.y, terrainlight.z, distance);
- if (distance < 1)glAlphaFunc(GL_GREATER, 0.2);
+ if (distance < 1)
+ glAlphaFunc(GL_GREATER, 0.2);
}
if (hidden) {
glDepthMask(0);
terrainlight = terrain.getLighting(position[i].x, position[i].z);
if (!hidden) {
glColor4f(terrainlight.x, terrainlight.y, terrainlight.z, distance);
- if (distance < 1)glAlphaFunc(GL_GREATER, 0.2);
+ if (distance < 1)
+ glAlphaFunc(GL_GREATER, 0.2);
}
if (hidden) {
glDepthMask(0);
if (type[i] == bushtype) {
messedwith[i] -= multiplier;
if (rotxvel[i] || rotx[i]) {
- if (rotx[i] > 0)rotxvel[i] -= multiplier * 8 * fabs(rotx[i]);
- if (rotx[i] < 0)rotxvel[i] += multiplier * 8 * fabs(rotx[i]);
- if (rotx[i] > 0)rotxvel[i] -= multiplier * 4;
- if (rotx[i] < 0)rotxvel[i] += multiplier * 4;
- if (rotxvel[i] > 0)rotxvel[i] -= multiplier * 4;
- if (rotxvel[i] < 0)rotxvel[i] += multiplier * 4;
- if (fabs(rotx[i]) < multiplier * 4)rotx[i] = 0;
- if (fabs(rotxvel[i]) < multiplier * 4)rotxvel[i] = 0;
+ if (rotx[i] > 0) rotxvel[i] -= multiplier * 8 * fabs(rotx[i]);
+ if (rotx[i] < 0) rotxvel[i] += multiplier * 8 * fabs(rotx[i]);
+ if (rotx[i] > 0) rotxvel[i] -= multiplier * 4;
+ if (rotx[i] < 0) rotxvel[i] += multiplier * 4;
+ if (rotxvel[i] > 0) rotxvel[i] -= multiplier * 4;
+ if (rotxvel[i] < 0) rotxvel[i] += multiplier * 4;
+ if (fabs(rotx[i]) < multiplier * 4)
+ rotx[i] = 0;
+ if (fabs(rotxvel[i]) < multiplier * 4)
+ rotxvel[i] = 0;
rotx[i] += rotxvel[i] * multiplier * 4;
}
if (rotyvel[i] || roty[i]) {
- if (roty[i] > 0)rotyvel[i] -= multiplier * 8 * fabs(roty[i]);
- if (roty[i] < 0)rotyvel[i] += multiplier * 8 * fabs(roty[i]);
- if (roty[i] > 0)rotyvel[i] -= multiplier * 4;
- if (roty[i] < 0)rotyvel[i] += multiplier * 4;
- if (rotyvel[i] > 0)rotyvel[i] -= multiplier * 4;
- if (rotyvel[i] < 0)rotyvel[i] += multiplier * 4;
- if (fabs(roty[i]) < multiplier * 4)roty[i] = 0;
- if (fabs(rotyvel[i]) < multiplier * 4)rotyvel[i] = 0;
+ if (roty[i] > 0) rotyvel[i] -= multiplier * 8 * fabs(roty[i]);
+ if (roty[i] < 0) rotyvel[i] += multiplier * 8 * fabs(roty[i]);
+ if (roty[i] > 0) rotyvel[i] -= multiplier * 4;
+ if (roty[i] < 0) rotyvel[i] += multiplier * 4;
+ if (rotyvel[i] > 0) rotyvel[i] -= multiplier * 4;
+ if (rotyvel[i] < 0) rotyvel[i] += multiplier * 4;
+ if (fabs(roty[i]) < multiplier * 4)
+ roty[i] = 0;
+ if (fabs(rotyvel[i]) < multiplier * 4)
+ rotyvel[i] = 0;
roty[i] += rotyvel[i] * multiplier * 4;
}
if (rotx[i]) {
glRotatef(-rotx[i], 0, 0, 1);
}
- if (rotx[i] > 10)rotx[i] = 10;
- if (rotx[i] < -10)rotx[i] = -10;
- if (roty[i] > 10)roty[i] = 10;
- if (roty[i] < -10)roty[i] = -10;
+ if (rotx[i] > 10)
+ rotx[i] = 10;
+ if (rotx[i] < -10)
+ rotx[i] = -10;
+ if (roty[i] > 10)
+ roty[i] = 10;
+ if (roty[i] < -10)
+ roty[i] = -10;
}
if (type[i] == treetrunktype || type[i] == treeleavestype) {
messedwith[i] -= multiplier;
if (rotxvel[i] || rotx[i]) {
- if (rotx[i] > 0)rotxvel[i] -= multiplier * 8 * fabs(rotx[i]);
- if (rotx[i] < 0)rotxvel[i] += multiplier * 8 * fabs(rotx[i]);
- if (rotx[i] > 0)rotxvel[i] -= multiplier * 4;
- if (rotx[i] < 0)rotxvel[i] += multiplier * 4;
- if (rotxvel[i] > 0)rotxvel[i] -= multiplier * 4;
- if (rotxvel[i] < 0)rotxvel[i] += multiplier * 4;
- if (fabs(rotx[i]) < multiplier * 4)rotx[i] = 0;
- if (fabs(rotxvel[i]) < multiplier * 4)rotxvel[i] = 0;
+ if (rotx[i] > 0) rotxvel[i] -= multiplier * 8 * fabs(rotx[i]);
+ if (rotx[i] < 0) rotxvel[i] += multiplier * 8 * fabs(rotx[i]);
+ if (rotx[i] > 0) rotxvel[i] -= multiplier * 4;
+ if (rotx[i] < 0) rotxvel[i] += multiplier * 4;
+ if (rotxvel[i] > 0) rotxvel[i] -= multiplier * 4;
+ if (rotxvel[i] < 0) rotxvel[i] += multiplier * 4;
+ if (fabs(rotx[i]) < multiplier * 4)
+ rotx[i] = 0;
+ if (fabs(rotxvel[i]) < multiplier * 4)
+ rotxvel[i] = 0;
rotx[i] += rotxvel[i] * multiplier * 4;
}
if (rotyvel[i] || roty[i]) {
- if (roty[i] > 0)rotyvel[i] -= multiplier * 8 * fabs(roty[i]);
- if (roty[i] < 0)rotyvel[i] += multiplier * 8 * fabs(roty[i]);
- if (roty[i] > 0)rotyvel[i] -= multiplier * 4;
- if (roty[i] < 0)rotyvel[i] += multiplier * 4;
- if (rotyvel[i] > 0)rotyvel[i] -= multiplier * 4;
- if (rotyvel[i] < 0)rotyvel[i] += multiplier * 4;
- if (fabs(roty[i]) < multiplier * 4)roty[i] = 0;
- if (fabs(rotyvel[i]) < multiplier * 4)rotyvel[i] = 0;
+ if (roty[i] > 0) rotyvel[i] -= multiplier * 8 * fabs(roty[i]);
+ if (roty[i] < 0) rotyvel[i] += multiplier * 8 * fabs(roty[i]);
+ if (roty[i] > 0) rotyvel[i] -= multiplier * 4;
+ if (roty[i] < 0) rotyvel[i] += multiplier * 4;
+ if (rotyvel[i] > 0) rotyvel[i] -= multiplier * 4;
+ if (rotyvel[i] < 0) rotyvel[i] += multiplier * 4;
+ if (fabs(roty[i]) < multiplier * 4)
+ roty[i] = 0;
+ if (fabs(rotyvel[i]) < multiplier * 4)
+ rotyvel[i] = 0;
roty[i] += rotyvel[i] * multiplier * 4;
}
if (rotx[i]) {
glRotatef(-rotx[i] / 2, 0, 0, 1);
}
- if (rotx[i] > 10)rotx[i] = 10;
- if (rotx[i] < -10)rotx[i] = -10;
- if (roty[i] > 10)roty[i] = 10;
- if (roty[i] < -10)roty[i] = -10;
+ if (rotx[i] > 10)
+ rotx[i] = 10;
+ if (rotx[i] < -10)
+ rotx[i] = -10;
+ if (roty[i] > 10)
+ roty[i] = 10;
+ if (roty[i] < -10)
+ roty[i] = -10;
}
if (environment == snowyenvironment) {
if (type[i] == treeleavestype) {
}
}
}
- if (environment == desertenvironment)glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0 );
+ if (environment == desertenvironment)
+ glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0 );
glEnable(GL_ALPHA_TEST);
SetUpLight(&light, 0);
}
{
if ((atype != treeleavestype && atype != bushtype) || foliage == 1) {
scale[numobjects] = ascale;
- if (atype == treeleavestype)scale[numobjects] += fabs((float)(Random() % 100) / 900) * ascale;
+ if (atype == treeleavestype)
+ scale[numobjects] += fabs((float)(Random() % 100) / 900) * ascale;
onfire[numobjects] = 0;
flamedelay[numobjects] = 0;
type[numobjects] = atype;
- if (atype == firetype)onfire[numobjects] = 1;
+ if (atype == firetype)
+ onfire[numobjects] = 1;
position[numobjects] = where;
- if (atype == bushtype)position[numobjects].y = terrain.getHeight(position[numobjects].x, position[numobjects].z) - .3;
+ if (atype == bushtype)
+ position[numobjects].y = terrain.getHeight(position[numobjects].x, position[numobjects].z) - .3;
yaw[numobjects] = ayaw;
rotxvel[numobjects] = 0;
rotx[numobjects] = 0;
roty[numobjects] = 0;
- if (atype == boxtype)model[numobjects].loaddecal((char *)":Data:Models:Box.solid", 0);
- if (atype == cooltype)model[numobjects].loaddecal((char *)":Data:Models:Cool.solid", 0);
- if (atype == walltype)model[numobjects].loaddecal((char *)":Data:Models:Wall.solid", 0);
- if (atype == tunneltype)model[numobjects].loaddecal((char *)":Data:Models:Tunnel.solid", 0);
- if (atype == chimneytype)model[numobjects].loaddecal((char *)":Data:Models:Chimney.solid", 0);
- if (atype == spiketype)model[numobjects].load((char *)":Data:Models:Spike.solid", 0);
- if (atype == weirdtype)model[numobjects].loaddecal((char *)":Data:Models:Weird.solid", 0);
- if (atype == rocktype)model[numobjects].loaddecal((char *)":Data:Models:Rock.solid", 0);
- if (atype == treetrunktype)model[numobjects].load((char *)":Data:Models:Treetrunk.solid", 0);
- if (atype == treeleavestype)model[numobjects].load((char *)":Data:Models:Leaves.solid", 0);
- if (atype == bushtype)model[numobjects].load((char *)":Data:Models:Bush.solid", 0);
-
- if (atype == boxtype)friction[numobjects] = 1.5;
- if (atype == cooltype)friction[numobjects] = 1.5;
- if (atype == walltype)friction[numobjects] = 1.5;
- if (atype == platformtype)friction[numobjects] = 1.5;
- if (atype == tunneltype)friction[numobjects] = 1.5;
- if (atype == chimneytype)friction[numobjects] = 1.5;
- if (atype == rocktype)friction[numobjects] = .5;
- if (atype == rocktype && ascale > .5)friction[numobjects] = 1.5;
- if (atype == weirdtype)friction[numobjects] = 1.5;
- if (atype == spiketype)friction[numobjects] = .4;
- if (atype == treetrunktype)friction[numobjects] = .4;
- if (atype == treeleavestype)friction[numobjects] = 0;
+ if (atype == boxtype) model[numobjects].loaddecal((char *)":Data:Models:Box.solid", 0);
+ if (atype == cooltype) model[numobjects].loaddecal((char *)":Data:Models:Cool.solid", 0);
+ if (atype == walltype) model[numobjects].loaddecal((char *)":Data:Models:Wall.solid", 0);
+ if (atype == tunneltype) model[numobjects].loaddecal((char *)":Data:Models:Tunnel.solid", 0);
+ if (atype == chimneytype) model[numobjects].loaddecal((char *)":Data:Models:Chimney.solid", 0);
+ if (atype == spiketype) model[numobjects].load((char *)":Data:Models:Spike.solid", 0);
+ if (atype == weirdtype) model[numobjects].loaddecal((char *)":Data:Models:Weird.solid", 0);
+ if (atype == rocktype) model[numobjects].loaddecal((char *)":Data:Models:Rock.solid", 0);
+ if (atype == treetrunktype) model[numobjects].load((char *)":Data:Models:Treetrunk.solid", 0);
+ if (atype == treeleavestype) model[numobjects].load((char *)":Data:Models:Leaves.solid", 0);
+ if (atype == bushtype) model[numobjects].load((char *)":Data:Models:Bush.solid", 0);
+
+ if (atype == boxtype) friction[numobjects] = 1.5;
+ if (atype == cooltype) friction[numobjects] = 1.5;
+ if (atype == walltype) friction[numobjects] = 1.5;
+ if (atype == platformtype) friction[numobjects] = 1.5;
+ if (atype == tunneltype) friction[numobjects] = 1.5;
+ if (atype == chimneytype) friction[numobjects] = 1.5;
+ if (atype == rocktype) friction[numobjects] = .5;
+ if (atype == rocktype && ascale>.5) friction[numobjects] = 1.5;
+ if (atype == weirdtype) friction[numobjects] = 1.5;
+ if (atype == spiketype) friction[numobjects] = .4;
+ if (atype == treetrunktype) friction[numobjects] = .4;
+ if (atype == treeleavestype) friction[numobjects] = 0;
if (atype == platformtype) {
model[numobjects].loaddecal((char *)":Data:Models:Platform.solid", 0);
model[numobjects].ScaleNormals(-1, -1, -1);
if (atype == treetrunktype && position[numobjects].y < terrain.getHeight(position[numobjects].x, position[numobjects].z) + 1) {
- if (detail == 2)terrain.MakeDecal(shadowdecalpermanent, position[numobjects], 2, .4, 0);
+ if (detail == 2)
+ terrain.MakeDecal(shadowdecalpermanent, position[numobjects], 2, .4, 0);
}
if (atype == bushtype && position[numobjects].y < terrain.getHeight(position[numobjects].x, position[numobjects].z) + 1) {
- if (detail == 2)terrain.MakeDecal(shadowdecalpermanent, position[numobjects], 1, .4, 0);
+ if (detail == 2)
+ terrain.MakeDecal(shadowdecalpermanent, position[numobjects], 1, .4, 0);
}
if (atype != treeleavestype && atype != bushtype && atype != firetype)
{
if ((atype != treeleavestype && atype != bushtype) || foliage == 1) {
scale[numobjects] = ascale;
- if (atype == treeleavestype)scale[numobjects] += fabs((float)(Random() % 100) / 900) * ascale;
+ if (atype == treeleavestype)
+ scale[numobjects] += fabs((float)(Random() % 100) / 900) * ascale;
onfire[numobjects] = 0;
flamedelay[numobjects] = 0;
type[numobjects] = atype;
- if (atype == firetype)onfire[numobjects] = 1;
+ if (atype == firetype)
+ onfire[numobjects] = 1;
position[numobjects] = where;
- if (atype == bushtype)position[numobjects].y = terrain.getHeight(position[numobjects].x, position[numobjects].z) - .3;
+ if (atype == bushtype)
+ position[numobjects].y = terrain.getHeight(position[numobjects].x, position[numobjects].z) - .3;
/*if(atype==firetype){
if(position[numobjects].y<terrain.getHeight(position[numobjects].x,position[numobjects].z)-.3)
position[numobjects].y=terrain.getHeight(position[numobjects].x,position[numobjects].z)-.3;
rotx[numobjects] = 0;
roty[numobjects] = 0;
- if (atype == boxtype)model[numobjects].loaddecal((char *)":Data:Models:Box.solid", 0);
- if (atype == cooltype)model[numobjects].loaddecal((char *)":Data:Models:Cool.solid", 0);
- if (atype == walltype)model[numobjects].loaddecal((char *)":Data:Models:Wall.solid", 0);
- if (atype == tunneltype)model[numobjects].loaddecal((char *)":Data:Models:Tunnel.solid", 0);
- if (atype == chimneytype)model[numobjects].loaddecal((char *)":Data:Models:Chimney.solid", 0);
- if (atype == spiketype)model[numobjects].load((char *)":Data:Models:Spike.solid", 0);
- if (atype == weirdtype)model[numobjects].loaddecal((char *)":Data:Models:Weird.solid", 0);
- if (atype == rocktype)model[numobjects].loaddecal((char *)":Data:Models:Rock.solid", 0);
- if (atype == treetrunktype)model[numobjects].load((char *)":Data:Models:Treetrunk.solid", 0);
- if (atype == treeleavestype)model[numobjects].load((char *)":Data:Models:Leaves.solid", 0);
- if (atype == bushtype)model[numobjects].load((char *)":Data:Models:Bush.solid", 0);
-
- if (atype == boxtype)friction[numobjects] = 1.5;
- if (atype == cooltype)friction[numobjects] = 1.5;
- if (atype == walltype)friction[numobjects] = 1.5;
- if (atype == platformtype)friction[numobjects] = 1.5;
- if (atype == tunneltype)friction[numobjects] = 1.5;
- if (atype == chimneytype)friction[numobjects] = 1.5;
- if (atype == rocktype)friction[numobjects] = .5;
- if (atype == rocktype && ascale > .5)friction[numobjects] = 1.5;
- if (atype == weirdtype)friction[numobjects] = 1.5;
- if (atype == spiketype)friction[numobjects] = .4;
- if (atype == treetrunktype)friction[numobjects] = .4;
- if (atype == treeleavestype)friction[numobjects] = 0;
-
- if (friction[numobjects] == 1.5 && fabs(apitch) > 5)friction[numobjects] = .5;
+ if (atype == boxtype) model[numobjects].loaddecal((char *)":Data:Models:Box.solid", 0);
+ if (atype == cooltype) model[numobjects].loaddecal((char *)":Data:Models:Cool.solid", 0);
+ if (atype == walltype) model[numobjects].loaddecal((char *)":Data:Models:Wall.solid", 0);
+ if (atype == tunneltype) model[numobjects].loaddecal((char *)":Data:Models:Tunnel.solid", 0);
+ if (atype == chimneytype) model[numobjects].loaddecal((char *)":Data:Models:Chimney.solid", 0);
+ if (atype == spiketype) model[numobjects].load((char *)":Data:Models:Spike.solid", 0);
+ if (atype == weirdtype) model[numobjects].loaddecal((char *)":Data:Models:Weird.solid", 0);
+ if (atype == rocktype) model[numobjects].loaddecal((char *)":Data:Models:Rock.solid", 0);
+ if (atype == treetrunktype) model[numobjects].load((char *)":Data:Models:Treetrunk.solid", 0);
+ if (atype == treeleavestype) model[numobjects].load((char *)":Data:Models:Leaves.solid", 0);
+ if (atype == bushtype) model[numobjects].load((char *)":Data:Models:Bush.solid", 0);
+
+ if (atype == boxtype) friction[numobjects] = 1.5;
+ if (atype == cooltype) friction[numobjects] = 1.5;
+ if (atype == walltype) friction[numobjects] = 1.5;
+ if (atype == platformtype) friction[numobjects] = 1.5;
+ if (atype == tunneltype) friction[numobjects] = 1.5;
+ if (atype == chimneytype) friction[numobjects] = 1.5;
+ if (atype == rocktype) friction[numobjects] = .5;
+ if (atype == rocktype && ascale>.5) friction[numobjects] = 1.5;
+ if (atype == weirdtype) friction[numobjects] = 1.5;
+ if (atype == spiketype) friction[numobjects] = .4;
+ if (atype == treetrunktype) friction[numobjects] = .4;
+ if (atype == treeleavestype) friction[numobjects] = 0;
+
+ if (friction[numobjects] == 1.5 && fabs(apitch) > 5)
+ friction[numobjects] = .5;
if (atype == platformtype) {
model[numobjects].loaddecal((char *)":Data:Models:Platform.solid", 0);
model[numobjects].ScaleNormals(-1, -1, -1);
if (atype == treetrunktype && position[numobjects].y < terrain.getHeight(position[numobjects].x, position[numobjects].z) + 1) {
- if (detail == 2)terrain.MakeDecal(shadowdecalpermanent, position[numobjects], 2, .4, 0);
+ if (detail == 2)
+ terrain.MakeDecal(shadowdecalpermanent, position[numobjects], 2, .4, 0);
}
if (atype == bushtype && position[numobjects].y < terrain.getHeight(position[numobjects].x, position[numobjects].z) + 1) {
- if (detail == 2)terrain.MakeDecal(shadowdecalpermanent, position[numobjects], 1, .4, 0);
+ if (detail == 2)
+ terrain.MakeDecal(shadowdecalpermanent, position[numobjects], 1, .4, 0);
}
if (atype != treeleavestype && atype != bushtype && atype != firetype)
Sprite::MakeSprite(weaponshinesprite, position[i],position[i]*0, 1,1,1, 5, 1);
}*/
- if (type[i] == firetype)onfire[i] = 1;
+ if (type[i] == firetype)
+ onfire[i] = 1;
if (onfire[i]) {
- if (type[i] == bushtype)flamedelay[i] -= multiplier * 3;
- if (type[i] == firetype)flamedelay[i] -= multiplier * 3;
- if (type[i] == treeleavestype)flamedelay[i] -= multiplier * 4;
+ if (type[i] == bushtype)
+ flamedelay[i] -= multiplier * 3;
+ if (type[i] == firetype)
+ flamedelay[i] -= multiplier * 3;
+ if (type[i] == treeleavestype)
+ flamedelay[i] -= multiplier * 4;
while (flamedelay[i] < 0 && onfire[i]) {
flamedelay[i] += .006;
if (type[i] == bushtype || type[i] == firetype) {
int i, j, k, l;
static XYZ testpoint, testpoint2, terrainpoint, lightloc, col;
lightloc = light.location;
- if (!skyboxtexture)lightloc = 0;
+ if (!skyboxtexture)
+ lightloc = 0;
lightloc.y += 10;
Normalise(&lightloc);
int patchx, patchz;
deltaTime /= 1000.0;
multiplier = deltaTime;
- if (multiplier < .001) multiplier = .001;
- if (multiplier > 10) multiplier = 10;
- if (update) frametime = currTime; // reset for next time interval
+ if (multiplier < .001)
+ multiplier = .001;
+ if (multiplier > 10)
+ multiplier = 10;
+ if (update)
+ frametime = currTime; // reset for next time interval
deltaTime = (float) AbsoluteDeltaToDuration (currTime, time);
static float oldmult;
DoFrameRate(1);
- if (multiplier > .6)multiplier = .6;
+ if (multiplier > .6)
+ multiplier = .6;
fps = 1 / multiplier;
count = multiplier * sps;
- if (count < 2)count = 2;
+ if (count < 2)
+ count = 2;
realmultiplier = multiplier;
multiplier *= gamespeed;
- if (difficulty == 1)multiplier *= .9;
- if (difficulty == 0)multiplier *= .8;
-
- if (loading == 4)multiplier *= .00001;
- if (slomo && !mainmenu)multiplier *= slomospeed;
+ if (difficulty == 1)
+ multiplier *= .9;
+ if (difficulty == 0)
+ multiplier *= .8;
+
+ if (loading == 4)
+ multiplier *= .00001;
+ if (slomo && !mainmenu)
+ multiplier *= slomospeed;
oldmult = multiplier;
multiplier /= (float)count;
}
envr = getenv("PATH");
- if (!envr) return NULL;
+ if (!envr)
+ return NULL;
envr = strdup(envr);
- if (!envr) return NULL;
+ if (!envr)
+ return NULL;
retval = findBinaryInPath(argv0, envr);
free(envr);
return(retval);
inline void Vector::Normalize(void)
{
float m = (float) sqrt(x * x + y * y + z * z);
- if (m <= tol) m = 1;
+ if (m <= tol)
+ m = 1;
x /= m;
y /= m;
z /= m;
- if (fabs(x) < tol) x = 0.0f;
- if (fabs(y) < tol) y = 0.0f;
- if (fabs(z) < tol) z = 0.0f;
+ if (fabs(x) < tol)
+ x = 0.0f;
+ if (fabs(y) < tol)
+ y = 0.0f;
+ if (fabs(z) < tol)
+ z = 0.0f;
}
inline void Vector::Reverse(void)
e31 * e12 * e23 -
e31 * e22 * e13;
- if (d == 0) d = 1;
+ if (d == 0)
+ d = 1;
return Matrix3x3( (e22 * e33 - e23 * e32) / d,
-(e12 * e33 - e13 * e32) / d,
inline bool XYZ::operator==(XYZ add)
{
- if (x == add.x && y == add.y && z == add.z)return 1;
+ if (x == add.x && y == add.y && z == add.z)
+ return 1;
return 0;
}
// Can replace with slower return std::sqrt(arg);
register float result;
- if (arg == 0.0) return 0.0;
+ if (arg == 0.0)
+ return 0.0;
asm {
frsqrte result, arg // Calculate Square root
//~ static float x , y , z;
static float a, b, c, /*mu,*/ i ;
- if (x1 > x3 + r && x2 > x3 + r)return(0);
- if (x1 < x3 - r && x2 < x3 - r)return(0);
- if (y1 > y3 + r && y2 > y3 + r)return(0);
- if (y1 < y3 - r && y2 < y3 - r)return(0);
- if (z1 > z3 + r && z2 > z3 + r)return(0);
- if (z1 < z3 - r && z2 < z3 - r)return(0);
+ if (x1 > x3 + r && x2 > x3 + r) return(0);
+ if (x1 < x3 - r && x2 < x3 - r) return(0);
+ if (y1 > y3 + r && y2 > y3 + r) return(0);
+ if (y1 < y3 - r && y2 < y3 - r) return(0);
+ if (z1 > z3 + r && z2 > z3 + r) return(0);
+ if (z1 < z3 - r && z2 < z3 - r) return(0);
a = square(x2 - x1) + square(y2 - y1) + square(z2 - z1);
b = 2 * ( (x2 - x1) * (x1 - x3)
+ (y2 - y1) * (y1 - y3)
//~ static float x , y , z;
static float a, b, c, /*mu,*/ i ;
- if (p1->x > p3->x + *r && p2->x > p3->x + *r)return(0);
- if (p1->x < p3->x - *r && p2->x < p3->x - *r)return(0);
- if (p1->y > p3->y + *r && p2->y > p3->y + *r)return(0);
- if (p1->y < p3->y - *r && p2->y < p3->y - *r)return(0);
- if (p1->z > p3->z + *r && p2->z > p3->z + *r)return(0);
- if (p1->z < p3->z - *r && p2->z < p3->z - *r)return(0);
+ if (p1->x > p3->x + *r && p2->x > p3->x + *r) return(0);
+ if (p1->x < p3->x - *r && p2->x < p3->x - *r) return(0);
+ if (p1->y > p3->y + *r && p2->y > p3->y + *r) return(0);
+ if (p1->y < p3->y - *r && p2->y < p3->y - *r) return(0);
+ if (p1->z > p3->z + *r && p2->z > p3->z + *r) return(0);
+ if (p1->z < p3->z - *r && p2->z < p3->z - *r) return(0);
a = square(p2->x - p1->x) + square(p2->y - p1->y) + square(p2->z - p1->z);
b = 2 * ( (p2->x - p1->x) * (p1->x - p3->x)
+ (p2->y - p1->y) * (p1->y - p3->y)
void SaveSettings()
{
- if (newdetail < 0) newdetail = 0;
- if (newdetail > 2) newdetail = 2;
- if (newscreenwidth > 3000) newscreenwidth = screenwidth;
- if (newscreenwidth < 0) newscreenwidth = screenwidth;
- if (newscreenheight > 3000) newscreenheight = screenheight;
- if (newscreenheight < 0) newscreenheight = screenheight;
+ if (newdetail < 0)
+ newdetail = 0;
+ if (newdetail > 2)
+ newdetail = 2;
+ if (newscreenwidth > 3000)
+ newscreenwidth = screenwidth;
+ if (newscreenwidth < 0)
+ newscreenwidth = screenwidth;
+ if (newscreenheight > 3000)
+ newscreenheight = screenheight;
+ if (newscreenheight < 0)
+ newscreenheight = screenheight;
ofstream opstream(ConvertFileName(":Data:config.txt", "w"));
opstream << "Screenwidth:\n";
opstream << newscreenwidth;
opstream << "\nInvert mouse:\n";
opstream << invertmouse;
opstream << "\nGamespeed:\n";
- if (oldgamespeed == 0)oldgamespeed = 1;
+ if (oldgamespeed == 0)
+ oldgamespeed = 1;
opstream << oldgamespeed;
opstream << "\nDifficulty(0,1,2) higher=harder:\n";
opstream << difficulty;
// skip blank lines
// assume lines starting with spaces are all blank
- if ( strlen(setting) == 0 || setting[0] == ' ' || setting[0] == '\t') continue;
+ if ( strlen(setting) == 0 || setting[0] == ' ' || setting[0] == '\t')
+ continue;
//~ printf("setting : %s\n",setting);
if ( ipstream.eof() || ipstream.fail() ) {
ipstream >> ismotionblur;
} else if ( !strncmp(setting, "Overall Detail", 14) ) {
ipstream >> detail;
- if (detail != 0)kBitsPerPixel = 32;
- else kBitsPerPixel = 16;
+ if (detail != 0)
+ kBitsPerPixel = 32;
+ else
+ kBitsPerPixel = 16;
} else if ( !strncmp(setting, "Floating jump", 13) ) {
ipstream >> floatjump;
} else if ( !strncmp(setting, "Mouse jump", 10) ) {
ipstream.close();
- if (detail > 2)detail = 2;
- if (detail < 0)detail = 0;
- if (screenwidth < 0)screenwidth = 640;
- if (screenheight < 0)screenheight = 480;
+ if (detail > 2)
+ detail = 2;
+ if (detail < 0)
+ detail = 0;
+ if (screenwidth < 0)
+ screenwidth = 640;
+ if (screenheight < 0)
+ screenheight = 480;
return true;
}
M[13] = 0;
M[14] = 0;
glLoadMatrixf(M);
- if (environment == 2)glScalef(1 + blurness / 1000, 1, 1 + blurness / 1000);
- if (environment != 2)glColor3f(.85 * skyboxr, .85 * skyboxg, .95 * skyboxb);
- else glColor3f(1 * skyboxr, .95 * skyboxg, .95 * skyboxb);
+ if (environment == 2)
+ glScalef(1 + blurness / 1000, 1, 1 + blurness / 1000);
+ if (environment != 2)
+ glColor3f(.85 * skyboxr, .85 * skyboxg, .95 * skyboxb);
+ else
+ glColor3f(1 * skyboxr, .95 * skyboxg, .95 * skyboxb);
if (!skyboxtexture) {
glDisable(GL_TEXTURE_2D);
glDisable(GL_CULL_FACE);
glEnable(GL_BLEND);
glDisable(GL_LIGHTING);
- if (skyboxtexture)glEnable(GL_TEXTURE_2D);
+ if (skyboxtexture)
+ glEnable(GL_TEXTURE_2D);
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
front.bind();
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
break;
case splintersprite :
if (lastspecial != sprites[i]->special) {
- if (sprites[i]->special == 0)splintertexture.bind();
- if (sprites[i]->special == 1)leaftexture.bind();
- if (sprites[i]->special == 2)snowflaketexture.bind();
- if (sprites[i]->special == 3)toothtexture.bind();
+ if (sprites[i]->special == 0)
+ splintertexture.bind();
+ if (sprites[i]->special == 1)
+ leaftexture.bind();
+ if (sprites[i]->special == 2)
+ snowflaketexture.bind();
+ if (sprites[i]->special == 3)
+ toothtexture.bind();
if (!blend) {
blend = 1;
glAlphaFunc(GL_GREATER, 0.0001);
else
distancemult = (viewdistsquared - (distsq(&viewer, &sprites[i]->position) - (viewdistsquared * fadestart)) * (1 / (1 - fadestart))) / viewdistsquared;
if (sprites[i]->type == flamesprite) {
- if (distancemult >= 1) glColor4f(sprites[i]->color[0], sprites[i]->color[1], sprites[i]->color[2], sprites[i]->opacity);
- else glColor4f(sprites[i]->color[0], sprites[i]->color[1], sprites[i]->color[2], sprites[i]->opacity * distancemult);
+ if (distancemult >= 1)
+ glColor4f(sprites[i]->color[0], sprites[i]->color[1], sprites[i]->color[2], sprites[i]->opacity);
+ else
+ glColor4f(sprites[i]->color[0], sprites[i]->color[1], sprites[i]->color[2], sprites[i]->opacity * distancemult);
} else {
- if (distancemult >= 1) glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], sprites[i]->opacity);
- else glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], sprites[i]->opacity * distancemult);
+ if (distancemult >= 1)
+ glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], sprites[i]->opacity);
+ else
+ glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], sprites[i]->opacity * distancemult);
}
lasttype = sprites[i]->type;
lastspecial = sprites[i]->special;
glRotatef(sprites[i]->rotation, 0, 0, 1);
if ((sprites[i]->type == flamesprite || sprites[i]->type == weaponflamesprite || sprites[i]->type == weaponshinesprite || sprites[i]->type == bloodflamesprite)) {
- if (sprites[i]->alivetime < .14)glScalef(sprites[i]->alivetime / .14, sprites[i]->alivetime / .14, sprites[i]->alivetime / .14);
+ if (sprites[i]->alivetime < .14)
+ glScalef(sprites[i]->alivetime / .14, sprites[i]->alivetime / .14, sprites[i]->alivetime / .14);
}
if (sprites[i]->type == smoketype || sprites[i]->type == snowsprite || sprites[i]->type == weaponshinesprite || sprites[i]->type == breathsprite) {
if (sprites[i]->alivetime < .3) {
- if (distancemult >= 1)glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], sprites[i]->opacity * sprites[i]->alivetime / .3);
- if (distancemult < 1)glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], sprites[i]->opacity * distancemult * sprites[i]->alivetime / .3);
+ if (distancemult >= 1)
+ glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], sprites[i]->opacity * sprites[i]->alivetime / .3);
+ if (distancemult < 1)
+ glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], sprites[i]->opacity * distancemult * sprites[i]->alivetime / .3);
}
}
if (sprites[i]->type == splintersprite && sprites[i]->special > 0 && sprites[i]->special != 3) {
if (sprites[i]->alivetime < .2) {
- if (distancemult >= 1) glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], sprites[i]->alivetime / .2);
- else glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], distancemult * sprites[i]->alivetime / .2);
+ if (distancemult >= 1)
+ glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], sprites[i]->alivetime / .2);
+ else
+ glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], distancemult * sprites[i]->alivetime / .2);
} else {
- if (distancemult >= 1) glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], 1);
- else glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], 1);
+ if (distancemult >= 1)
+ glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], 1);
+ else
+ glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], 1);
}
}
if (sprites[i]->type == splintersprite && (sprites[i]->special == 0 || sprites[i]->special == 3)) {
- if (distancemult >= 1) glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], 1);
- else glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], 1);
+ if (distancemult >= 1)
+ glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], 1);
+ else
+ glColor4f(sprites[i]->color[0]*lightcolor[0], sprites[i]->color[1]*lightcolor[1], sprites[i]->color[2]*lightcolor[2], 1);
}
glBegin(GL_TRIANGLES);
sprites[i]->position += sprites[i]->velocity * multiplier;
sprites[i]->velocity += windvector * multiplier;
}
- if (sprites[i]->type == flamesprite || sprites[i]->type == smoketype)sprites[i]->position += windvector * multiplier / 2;
+ if (sprites[i]->type == flamesprite || sprites[i]->type == smoketype)
+ sprites[i]->position += windvector * multiplier / 2;
if ((sprites[i]->type == flamesprite || sprites[i]->type == weaponflamesprite || sprites[i]->type == weaponshinesprite || sprites[i]->type == bloodflamesprite))
multiplier *= sprites[i]->speed * .7;
sprites[i]->alivetime += multiplier;
if (sprites[i]->type == breathsprite) {
sprites[i]->opacity -= multiplier / 2;
sprites[i]->size += multiplier / 2;
- if (findLength(&sprites[i]->velocity) <= multiplier)sprites[i]->velocity = 0;
- else {
+ if (findLength(&sprites[i]->velocity) <= multiplier) {
+ sprites[i]->velocity = 0;
+ } else {
XYZ slowdown;
slowdown = sprites[i]->velocity * -1;
Normalise(&slowdown);
sprites[i]->rotation += multiplier * 360;
sprites[i]->position.y -= multiplier;
sprites[i]->position += windvector * multiplier;
- if (sprites[i]->position.y < tempviewer.y - 6)sprites[i]->position.y += 12;
- if (sprites[i]->position.y > tempviewer.y + 6)sprites[i]->position.y -= 12;
- if (sprites[i]->position.z < tempviewer.z - 6)sprites[i]->position.z += 12;
- if (sprites[i]->position.z > tempviewer.z + 6)sprites[i]->position.z -= 12;
- if (sprites[i]->position.x < tempviewer.x - 6)sprites[i]->position.x += 12;
- if (sprites[i]->position.x > tempviewer.x + 6)sprites[i]->position.x -= 12;
+ if (sprites[i]->position.y < tempviewer.y - 6) sprites[i]->position.y += 12;
+ if (sprites[i]->position.y > tempviewer.y + 6) sprites[i]->position.y -= 12;
+ if (sprites[i]->position.z < tempviewer.z - 6) sprites[i]->position.z += 12;
+ if (sprites[i]->position.z > tempviewer.z + 6) sprites[i]->position.z -= 12;
+ if (sprites[i]->position.x < tempviewer.x - 6) sprites[i]->position.x += 12;
+ if (sprites[i]->position.x > tempviewer.x + 6) sprites[i]->position.x -= 12;
}
if (sprites[i]->type == bloodsprite) {
bool spritehit = 0;
if (!spritehit && player[j].dead && sprites[i]->alivetime > .1) {
where = sprites[i]->oldposition;
where -= player[j].coords;
- if (!player[j].skeleton.free)where = DoRotation(where, 0, -player[j].yaw, 0);
+ if (!player[j].skeleton.free)
+ where = DoRotation(where, 0, -player[j].yaw, 0);
startpoint = where;
where = sprites[i]->position;
where -= player[j].coords;
- if (!player[j].skeleton.free)where = DoRotation(where, 0, -player[j].yaw, 0);
+ if (!player[j].skeleton.free)
+ where = DoRotation(where, 0, -player[j].yaw, 0);
endpoint = where;
movepoint = 0;
end = sprites[i]->position;
if (!spritehit)
if (objects.model[k].LineCheck(&start, &end, &colpoint, &objects.position[k], &objects.yaw[k]) != -1) {
- if (detail == 2 || (detail == 1 && abs(Random() % 4) == 0) || (detail == 0 && abs(Random() % 8) == 0))objects.model[k].MakeDecal(blooddecalfast, DoRotation(colpoint - objects.position[k], 0, -objects.yaw[k], 0), sprites[i]->size * 1.6/*+abs((float)(Random()%100))/2400*/, .5, Random() % 360);
+ if (detail == 2 || (detail == 1 && abs(Random() % 4) == 0) || (detail == 0 && abs(Random() % 8) == 0))
+ objects.model[k].MakeDecal(blooddecalfast, DoRotation(colpoint - objects.position[k], 0, -objects.yaw[k], 0), sprites[i]->size * 1.6/*+abs((float)(Random()%100))/2400*/, .5, Random() % 360);
DeleteSprite(i);
spritehit = 1;
}
if (sprites[i]->type == splintersprite) {
sprites[i]->rotation += sprites[i]->rotatespeed * multiplier;
sprites[i]->opacity -= multiplier / 2;
- if (sprites[i]->special == 0 || sprites[i]->special == 2 || sprites[i]->special == 3)sprites[i]->velocity.y += gravity * multiplier;
- if (sprites[i]->special == 1)sprites[i]->velocity.y += gravity * multiplier * .5;
+ if (sprites[i]->special == 0 || sprites[i]->special == 2 || sprites[i]->special == 3)
+ sprites[i]->velocity.y += gravity * multiplier;
+ if (sprites[i]->special == 1)
+ sprites[i]->velocity.y += gravity * multiplier * .5;
}
if (sprites[i]->type == flamesprite || sprites[i]->type == weaponflamesprite || sprites[i]->type == weaponshinesprite || sprites[i]->type == bloodflamesprite) {
sprites[i]->rotation += multiplier * sprites[i]->rotatespeed;
sprites[i]->color[0] -= multiplier;
sprites[i]->color[1] -= multiplier;
sprites[i]->color[2] -= multiplier;
- if (sprites[i]->color[0] < .6)sprites[i]->color[0] = .6;
- if (sprites[i]->color[1] < .6)sprites[i]->color[1] = .6;
- if (sprites[i]->color[2] < .6)sprites[i]->color[2] = .6;
+ if (sprites[i]->color[0] < .6)
+ sprites[i]->color[0] = .6;
+ if (sprites[i]->color[1] < .6)
+ sprites[i]->color[1] = .6;
+ if (sprites[i]->color[2] < .6)
+ sprites[i]->color[2] = .6;
sprites[i]->size += multiplier;
sprites[i]->velocity = 0;
sprites[i]->velocity.y = 1.5;
sprites[i]->rotation += multiplier * sprites[i]->rotatespeed / 5;
}
- if (sprites[i]->opacity <= 0 || sprites[i]->size <= 0)DeleteSprite(i);
+ if (sprites[i]->opacity <= 0 || sprites[i]->size <= 0)
+ DeleteSprite(i);
}
if (check)
for (i = sprites.size() - 1; i >= 0; i--) {
//err = FSMakeFSSpec (0, 0, (const unsigned char*)filePath, &fsspec);
err = FSMakeFSSpec (0, 0, filePath, &fsspec);
//err=FSPathMakeFSSpec((const UInt8*)filePath,&fsspec,&isdir);*/
- if (err)return;
+ if (err)
+ return;
GraphicsImportComponent gi;
err = GetGraphicsImporterForFile(&fsspec, &gi);
- if (err)return;
+ if (err)
+ return;
Rect natbounds;
cr = GraphicsImportGetNaturalBounds(gi, &natbounds);
GWorldPtr gw;
err = QTNewGWorldFromPtr(&gw, k32ARGBPixelFormat, &natbounds, NULL, NULL,
0, texture.data, 4 * natbounds.right);
- if (err)return;
+ if (err)
+ return;
cr = GraphicsImportSetGWorld(gi, gw, NULL);
cr = GraphicsImportDraw(gi);
err = CloseComponent(gi);
- if (err)return;
+ if (err)
+ return;
/*glTexImage2D(textureTarget, 0, GL_RGBA, natbounds.right, natbounds.top, 0,
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, buf);
starty = i;
}
- if (startx < 0)startx = 0;
- if (starty < 0)starty = 0;
- if (endx > size - 1)endx = size - 1;
- if (endy > size - 1)endy = size - 1;
+ if (startx < 0)
+ startx = 0;
+ if (starty < 0)
+ starty = 0;
+ if (endx > size - 1)
+ endx = size - 1;
+ if (endy > size - 1)
+ endy = size - 1;
for (i = startx; i <= endx; i++) {
for (j = starty; j <= endy; j++) {
highest = -1000;
lowest = 1000;
for (k = 0; k < 2; k++) {
- if (heightmap[i + k][j] > highest)highest = heightmap[i + k][j];
- if (heightmap[i + k][j] < lowest)lowest = heightmap[i + k][j];
- if (heightmap[i + k][j + 1] > highest)highest = heightmap[i + k][j + 1];
- if (heightmap[i + k][j + 1] < lowest)lowest = heightmap[i + k][j + 1];
+ if (heightmap[i + k][j] > highest)
+ highest = heightmap[i + k][j];
+ if (heightmap[i + k][j] < lowest)
+ lowest = heightmap[i + k][j];
+ if (heightmap[i + k][j + 1] > highest)
+ highest = heightmap[i + k][j + 1];
+ if (heightmap[i + k][j + 1] < lowest)
+ lowest = heightmap[i + k][j + 1];
}
if ((p1.y <= highest || p2.y <= highest) && (p1.y >= lowest || p2.y >= lowest)) {
triangles[0].x = i;
vertex.z = j * scale;
vertex.y = heightmap[i][j] * scale;
distance = distsq(&viewer, &vertex);
- if (distance > viewdistsquared)distance = viewdistsquared;
+ if (distance > viewdistsquared)
+ distance = viewdistsquared;
colors[i][j][3] = (viewdistsquared - (distance - (viewdistsquared * fadestart)) * (1 / (1 - fadestart))) / viewdistsquared;
}
}
vertex.z = j * scale;
vertex.y = heightmap[i][j] * scale;
distance = distsq(&viewer, &vertex);
- if (distance > viewdistsquared)distance = viewdistsquared;
+ if (distance > viewdistsquared)
+ distance = viewdistsquared;
colors[i][j][3] = (viewdistsquared - (distance - (viewdistsquared * fadestart)) * (1 / (1 - fadestart))) / viewdistsquared;
}
}
minypatch[whichx][whichy] = 10000;
for (a = 0; a < size / subdivision; a++) {
for (b = 0; b < size / subdivision; b++) {
- if (heightmap[(size / subdivision)*whichx + a][(size / subdivision)*whichy + b]*scale > maxypatch[whichx][whichy]) maxypatch[whichx][whichy] = heightmap[(size / subdivision) * whichx + a][(size / subdivision) * whichy + b] * scale;
- if (heightmap[(size / subdivision)*whichx + a][(size / subdivision)*whichy + b]*scale < minypatch[whichx][whichy]) minypatch[whichx][whichy] = heightmap[(size / subdivision) * whichx + a][(size / subdivision) * whichy + b] * scale;
+ if (heightmap[(size / subdivision)*whichx + a][(size / subdivision)*whichy + b]*scale > maxypatch[whichx][whichy])
+ maxypatch[whichx][whichy] = heightmap[(size / subdivision) * whichx + a][(size / subdivision) * whichy + b] * scale;
+ if (heightmap[(size / subdivision)*whichx + a][(size / subdivision)*whichy + b]*scale < minypatch[whichx][whichy])
+ minypatch[whichx][whichy] = heightmap[(size / subdivision) * whichx + a][(size / subdivision) * whichy + b] * scale;
}
}
heightypatch[whichx][whichy] = (maxypatch[whichx][whichy] - minypatch[whichx][whichy]);
- if (heightypatch[whichx][whichy] < size / subdivision * scale)heightypatch[whichx][whichy] = size / subdivision * scale;
+ if (heightypatch[whichx][whichy] < size / subdivision * scale)
+ heightypatch[whichx][whichy] = size / subdivision * scale;
avgypatch[whichx][whichy] = (minypatch[whichx][whichy] + maxypatch[whichx][whichy]) / 2;
for (i = whichx * size / subdivision; i < (whichx + 1)*size / subdivision - 1; i++) {
}
}
texture.bpp = 24;
- if (visibleloading) Game::LoadingScreen();
+ if (visibleloading)
+ Game::LoadingScreen();
texdetail = temptexdetail;
}
}
- if (visibleloading) Game::LoadingScreen();
+ if (visibleloading)
+ Game::LoadingScreen();
float slopeness;
textureness[i][j] = -1;
}
}
- if (visibleloading) Game::LoadingScreen();
+ if (visibleloading)
+ Game::LoadingScreen();
for (i = 0; i < size; i++) {
slopeness = heightmap[i][j] - heightmap[i][j - 1];
}
opacityother[i][j] = slopeness * slopeness * 2;
- if (opacityother[i][j] > 1)opacityother[i][j] = 1;
+ if (opacityother[i][j] > 1)
+ opacityother[i][j] = 1;
opacityother[i][j] -= (float)abs(Random() % 100) / 300;
}
if (environment == desertenvironment) {
slopeness = heightmap[i][j] - heightmap[i][j - 1];
}
opacityother[i][j] = slopeness * slopeness * 2;
- if (opacityother[i][j] > 1)opacityother[i][j] = 1;
+ if (opacityother[i][j] > 1)
+ opacityother[i][j] = 1;
opacityother[i][j] -= (float)abs(Random() % 100) / 300;
}
if (environment == grassyenvironment) {
slopeness = heightmap[i][j] - heightmap[i][j + 1];
}
opacityother[i][j] = slopeness * slopeness * 10;
- if (opacityother[i][j] > 1)opacityother[i][j] = 1;
+ if (opacityother[i][j] > 1)
+ opacityother[i][j] = 1;
opacityother[i][j] -= (float)abs(Random() % 100) / 100;
}
}
}
- if (visibleloading) Game::LoadingScreen();
+ if (visibleloading)
+ Game::LoadingScreen();
for (i = 0; i < size; i++) {
for (j = 0; j < size; j++) {
}
}
}
- if (visibleloading) Game::LoadingScreen();
+ if (visibleloading)
+ Game::LoadingScreen();
/*float total;
int todivide;
for (i = 0; i < size; i++) {
for (j = 0; j < size; j++) {
- if (opacityother[i][j] < .1)opacityother[i][j] = 0;
+ if (opacityother[i][j] < .1)
+ opacityother[i][j] = 0;
if (textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == -1) {
- if (!opacityother[i][j])textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = allfirst;
- if (opacityother[i][j] == 1)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = allsecond;
+ if (!opacityother[i][j])
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = allfirst;
+ if (opacityother[i][j] == 1)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = allsecond;
}
- if (opacityother[i][j] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[i][j] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[i][j] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[i][j] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
x = i;
y = j;
if (i > 0) {
i--;
- if (opacityother[x][y] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[x][y] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[i][j] && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allfirst)textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
- if (opacityother[i][j] != 1 && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allsecond)textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
+ if (opacityother[x][y] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[x][y] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[i][j] && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allfirst)
+ textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
+ if (opacityother[i][j] != 1 && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allsecond)
+ textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
if (j > 0) {
j--;
- if (opacityother[x][y] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[x][y] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[i][j] && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allfirst)textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
- if (opacityother[i][j] != 1 && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allsecond)textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
+ if (opacityother[x][y] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[x][y] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[i][j] && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allfirst)
+ textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
+ if (opacityother[i][j] != 1 && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allsecond)
+ textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
j++;
}
if (j < size - 1) {
j++;
- if (opacityother[x][y] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[x][y] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[i][j] && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allfirst)textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
- if (opacityother[i][j] != 1 && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allsecond)textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
+ if (opacityother[x][y] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[x][y] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[i][j] && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allfirst)
+ textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
+ if (opacityother[i][j] != 1 && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allsecond)
+ textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
j--;
}
i++;
if (i < size - 1) {
i++;
- if (opacityother[x][y] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[x][y] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[i][j] && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allfirst)textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
- if (opacityother[i][j] != 1 && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allsecond)textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
+ if (opacityother[x][y] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[x][y] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[i][j] && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allfirst)
+ textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
+ if (opacityother[i][j] != 1 && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allsecond)
+ textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
if (j > 0) {
j--;
- if (opacityother[x][y] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[x][y] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[i][j] && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allfirst)textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
- if (opacityother[i][j] != 1 && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allsecond)textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
+ if (opacityother[x][y] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[x][y] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[i][j] && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allfirst)
+ textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
+ if (opacityother[i][j] != 1 && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allsecond)
+ textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
j++;
}
if (j < size - 1) {
j++;
- if (opacityother[x][y] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[x][y] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[i][j] && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allfirst)textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
- if (opacityother[i][j] != 1 && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allsecond)textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
+ if (opacityother[x][y] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[x][y] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[i][j] && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allfirst)
+ textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
+ if (opacityother[i][j] != 1 && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allsecond)
+ textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
j--;
}
i--;
if (j > 0) {
j--;
- if (opacityother[x][y] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[x][y] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[i][j] && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allfirst)textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
- if (opacityother[i][j] != 1 && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allsecond)textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
+ if (opacityother[x][y] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[x][y] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[i][j] && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allfirst)
+ textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
+ if (opacityother[i][j] != 1 && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allsecond)
+ textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
j++;
}
if (j < size - 1) {
j++;
- if (opacityother[x][y] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[x][y] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
- if (opacityother[i][j] && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allfirst)textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
- if (opacityother[i][j] != 1 && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allsecond)textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
+ if (opacityother[x][y] && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allfirst)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[x][y] != 1 && textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] == allsecond)
+ textureness[(int)(i * subdivision / size)][(int)(j * subdivision / size)] = mixed;
+ if (opacityother[i][j] && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allfirst)
+ textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
+ if (opacityother[i][j] != 1 && textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] == allsecond)
+ textureness[(int)(x * subdivision / size)][(int)(y * subdivision / size)] = mixed;
j--;
}
}
}
- if (visibleloading) Game::LoadingScreen();
+ if (visibleloading)
+ Game::LoadingScreen();
patch_size = size / subdivision;
patch_elements = (patch_size) * (patch_size) * 54;
void Terrain::drawpatch(int whichx, int whichy, float opacity)
{
- if (opacity >= 1)glDisable(GL_BLEND);
+ if (opacity >= 1)
+ glDisable(GL_BLEND);
if (opacity < 1) {
glEnable(GL_BLEND);
UpdateTransparency(whichx, whichy);
pointx /= scale;
pointz /= scale;
- if (pointx >= size - 1 || pointz >= size - 1 || pointx <= 0 || pointz <= 0)return 0;
+ if (pointx >= size - 1 || pointz >= size - 1 || pointx <= 0 || pointz <= 0)
+ return 0;
startpoint.x = pointx;
startpoint.y = -1000;
point2x /= scale;
point2z /= scale;
- if (pointx >= size - 1 || pointz >= size - 1 || pointx <= 0 || pointz <= 0)return 0;
- if (point2x >= size - 1 || point2z >= size - 1 || point2x <= 0 || point2z <= 0)return 0;
+ if (pointx >= size - 1 || pointz >= size - 1 || pointx <= 0 || pointz <= 0)
+ return 0;
+ if (point2x >= size - 1 || point2z >= size - 1 || point2x <= 0 || point2z <= 0)
+ return 0;
startpoint.x = point2x;
startpoint.y = -1000;
pointx /= scale;
pointz /= scale;
- if (pointx >= size - 1 || pointz >= size - 1 || pointx <= 0 || pointz <= 0)return 0;
+ if (pointx >= size - 1 || pointz >= size - 1 || pointx <= 0 || pointz <= 0)
+ return 0;
tilex = pointx;
tiley = pointz;
pointz /= scale;
height1 = 0;
- if (pointx >= size - 1 || pointz >= size - 1 || pointx <= 0 || pointz <= 0)return height1;
+ if (pointx >= size - 1 || pointz >= size - 1 || pointx <= 0 || pointz <= 0)
+ return height1;
tilex = pointx;
tiley = pointz;
pointz /= scale;
height1 = 0;
- if (pointx >= size - 1 || pointz >= size - 1 || pointx <= 0 || pointz <= 0)return height1;
+ if (pointx >= size - 1 || pointz >= size - 1 || pointx <= 0 || pointz <= 0)
+ return height1;
tilex = pointx;
tiley = pointz;
//Only nearby blocks
beginx = (viewer.x - viewdistance) / (patch_size) - 1;
- if (beginx < 0)beginx = 0;
+ if (beginx < 0)
+ beginx = 0;
beginz = (viewer.z - viewdistance) / (patch_size) - 1;
- if (beginz < 0)beginz = 0;
+ if (beginz < 0)
+ beginz = 0;
endx = (viewer.x + viewdistance) / (patch_size) + 1;
- if (endx > subdivision)endx = subdivision;
+ if (endx > subdivision)
+ endx = subdivision;
endz = (viewer.z + viewdistance) / (patch_size) + 1;
- if (endz > subdivision)endz = subdivision;
+ if (endz > subdivision)
+ endz = subdivision;
if (!layer) {
for (i = beginx; i < endx; i++) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(0);
for (i = 0; i < numdecals; i++) {
- if (decaltype[i] == blooddecalfast && decalalivetime[i] < 2)decalalivetime[i] = 2;
+ if (decaltype[i] == blooddecalfast && decalalivetime[i] < 2)
+ decalalivetime[i] = 2;
if ((decaltype[i] == shadowdecal || decaltype[i] == shadowdecalpermanent) && decaltype[i] != lasttype) {
shadowtexture.bind();
if (!blend) {
}
if (decaltype[i] == shadowdecal || decaltype[i] == shadowdecalpermanent) {
distancemult = (viewdistsquared - (distsq(&viewer, &decalposition[i]) - (viewdistsquared * fadestart)) * (1 / (1 - fadestart))) / viewdistsquared;
- if (distancemult >= 1)glColor4f(1, 1, 1, decalopacity[i]);
- if (distancemult < 1)glColor4f(1, 1, 1, decalopacity[i]*distancemult);
+ if (distancemult >= 1)
+ glColor4f(1, 1, 1, decalopacity[i]);
+ if (distancemult < 1)
+ glColor4f(1, 1, 1, decalopacity[i]*distancemult);
}
if (decaltype[i] == footprintdecal || decaltype[i] == bodyprintdecal) {
distancemult = (viewdistsquared - (distsq(&viewer, &decalposition[i]) - (viewdistsquared * fadestart)) * (1 / (1 - fadestart))) / viewdistsquared;
if (distancemult >= 1) {
glColor4f(1, 1, 1, decalopacity[i]);
- if (decalalivetime[i] > 3)glColor4f(1, 1, 1, decalopacity[i] * (5 - decalalivetime[i]) / 2);
+ if (decalalivetime[i] > 3)
+ glColor4f(1, 1, 1, decalopacity[i] * (5 - decalalivetime[i]) / 2);
}
if (distancemult < 1) {
glColor4f(1, 1, 1, decalopacity[i]*distancemult);
- if (decalalivetime[i] > 3)glColor4f(1, 1, 1, decalopacity[i] * (5 - decalalivetime[i]) / 2 * distancemult);
+ if (decalalivetime[i] > 3)
+ glColor4f(1, 1, 1, decalopacity[i] * (5 - decalalivetime[i]) / 2 * distancemult);
}
}
if ((decaltype[i] == blooddecal || decaltype[i] == blooddecalfast || decaltype[i] == blooddecalslow)) {
distancemult = (viewdistsquared - (distsq(&viewer, &decalposition[i]) - (viewdistsquared * fadestart)) * (1 / (1 - fadestart))) / viewdistsquared;
if (distancemult >= 1) {
glColor4f(decalbrightness[i], decalbrightness[i], decalbrightness[i], decalopacity[i]);
- if (decalalivetime[i] < 4)glColor4f(decalbrightness[i], decalbrightness[i], decalbrightness[i], decalopacity[i]*decalalivetime[i]*.25);
- if (decalalivetime[i] > 58)glColor4f(decalbrightness[i], decalbrightness[i], decalbrightness[i], decalopacity[i] * (60 - decalalivetime[i]) / 2);
+ if (decalalivetime[i] < 4)
+ glColor4f(decalbrightness[i], decalbrightness[i], decalbrightness[i], decalopacity[i]*decalalivetime[i]*.25);
+ if (decalalivetime[i] > 58)
+ glColor4f(decalbrightness[i], decalbrightness[i], decalbrightness[i], decalopacity[i] * (60 - decalalivetime[i]) / 2);
}
if (distancemult < 1) {
glColor4f(decalbrightness[i], decalbrightness[i], decalbrightness[i], decalopacity[i]*distancemult);
- if (decalalivetime[i] < 4)glColor4f(decalbrightness[i], decalbrightness[i], decalbrightness[i], decalopacity[i]*decalalivetime[i]*distancemult * .25);
- if (decalalivetime[i] > 58)glColor4f(decalbrightness[i], decalbrightness[i], decalbrightness[i], decalopacity[i] * (60 - decalalivetime[i]) / 2 * distancemult);
+ if (decalalivetime[i] < 4)
+ glColor4f(decalbrightness[i], decalbrightness[i], decalbrightness[i], decalopacity[i]*decalalivetime[i]*distancemult * .25);
+ if (decalalivetime[i] > 58)
+ glColor4f(decalbrightness[i], decalbrightness[i], decalbrightness[i], decalopacity[i] * (60 - decalalivetime[i]) / 2 * distancemult);
}
}
lasttype = decaltype[i];
}
for (i = numdecals - 1; i >= 0; i--) {
decalalivetime[i] += multiplier;
- if (decaltype[i] == blooddecalslow)decalalivetime[i] -= multiplier * 2 / 3;
- if (decaltype[i] == blooddecalfast)decalalivetime[i] += multiplier * 4;
- if (decaltype[i] == shadowdecal)DeleteDecal(i);
- if (decaltype[i] == footprintdecal && decalalivetime[i] >= 5)DeleteDecal(i);
- if (decaltype[i] == bodyprintdecal && decalalivetime[i] >= 5)DeleteDecal(i);
- if ((decaltype[i] == blooddecal || decaltype[i] == blooddecalfast || decaltype[i] == blooddecalslow) && decalalivetime[i] >= 60)DeleteDecal(i);
+ if (decaltype[i] == blooddecalslow)
+ decalalivetime[i] -= multiplier * 2 / 3;
+ if (decaltype[i] == blooddecalfast)
+ decalalivetime[i] += multiplier * 4;
+ if (decaltype[i] == shadowdecal)
+ DeleteDecal(i);
+ if (decaltype[i] == footprintdecal && decalalivetime[i] >= 5)
+ DeleteDecal(i);
+ if (decaltype[i] == bodyprintdecal && decalalivetime[i] >= 5)
+ DeleteDecal(i);
+ if ((decaltype[i] == blooddecal || decaltype[i] == blooddecalfast || decaltype[i] == blooddecalslow) && decalalivetime[i] >= 60)
+ DeleteDecal(i);
}
glAlphaFunc(GL_GREATER, 0.0001);
}
rot = getLighting(where.x, where.z);
decalbrightness[numdecals] = (rot.x + rot.y + rot.z) / 3;
- if (decalbrightness[numdecals] < .4)decalbrightness[numdecals] = .4;
+ if (decalbrightness[numdecals] < .4)
+ decalbrightness[numdecals] = .4;
if (environment == grassyenvironment) {
decalbrightness[numdecals] *= .6;
}
- if (decalbrightness[numdecals] > 1)decalbrightness[numdecals] = 1;
+ if (decalbrightness[numdecals] > 1)
+ decalbrightness[numdecals] = 1;
decalbright = decalbrightness[numdecals];
decalposition[numdecals] = where;
if (!(decaltexcoords[numdecals][0][1] < 0 && decaltexcoords[numdecals][1][1] < 0 && decaltexcoords[numdecals][2][1] < 0))
if (!(decaltexcoords[numdecals][0][0] > 1 && decaltexcoords[numdecals][1][0] > 1 && decaltexcoords[numdecals][2][0] > 1))
if (!(decaltexcoords[numdecals][0][1] > 1 && decaltexcoords[numdecals][1][1] > 1 && decaltexcoords[numdecals][2][1] > 1))
- if (numdecals < max_decals - 1)numdecals++;
+ if (numdecals < max_decals - 1)
+ numdecals++;
decalbrightness[numdecals] = decalbright;
if (!(decaltexcoords[numdecals][0][1] < 0 && decaltexcoords[numdecals][1][1] < 0 && decaltexcoords[numdecals][2][1] < 0))
if (!(decaltexcoords[numdecals][0][0] > 1 && decaltexcoords[numdecals][1][0] > 1 && decaltexcoords[numdecals][2][0] > 1))
if (!(decaltexcoords[numdecals][0][1] > 1 && decaltexcoords[numdecals][1][1] > 1 && decaltexcoords[numdecals][2][1] > 1))
- if (numdecals < max_decals - 1)numdecals++;
+ if (numdecals < max_decals - 1)
+ numdecals++;
}
}
*/
brightness = dotproduct(&lightloc, &normals[i][j]);
- if (brightness > 1)brightness = 1;
- if (brightness < 0)brightness = 0;
+ if (brightness > 1)
+ brightness = 1;
+ if (brightness < 0)
+ brightness = 0;
colors[i][j][0] = light.color[0] * brightness + light.ambient[0];
colors[i][j][1] = light.color[1] * brightness + light.ambient[1];
colors[i][j][2] = light.color[2] * brightness + light.ambient[2];
- if (colors[i][j][0] > 1)colors[i][j][0] = 1;
- if (colors[i][j][1] > 1)colors[i][j][1] = 1;
- if (colors[i][j][2] > 1)colors[i][j][2] = 1;
- if (colors[i][j][0] < 0)colors[i][j][0] = 0;
- if (colors[i][j][1] < 0)colors[i][j][1] = 0;
- if (colors[i][j][2] < 0)colors[i][j][2] = 0;
+ if (colors[i][j][0] > 1) colors[i][j][0] = 1;
+ if (colors[i][j][1] > 1) colors[i][j][1] = 1;
+ if (colors[i][j][2] > 1) colors[i][j][2] = 1;
+ if (colors[i][j][0] < 0) colors[i][j][0] = 0;
+ if (colors[i][j][1] < 0) colors[i][j][1] = 0;
+ if (colors[i][j][2] < 0) colors[i][j][2] = 0;
}
}
}
}
}
- if (visibleloading) Game::LoadingScreen();
+ if (visibleloading)
+ Game::LoadingScreen();
}
brightness = dotproduct(&lightloc, &normals[i][j]);
- if (shadowed)brightness *= 1 - shadowed;
+ if (shadowed)
+ brightness *= 1 - shadowed;
- if (brightness > 1)brightness = 1;
- if (brightness < 0)brightness = 0;
+ if (brightness > 1)
+ brightness = 1;
+ if (brightness < 0)
+ brightness = 0;
colors[i][j][0] = light.color[0] * brightness + light.ambient[0];
colors[i][j][1] = light.color[1] * brightness + light.ambient[1];
colors[i][j][2] = light.color[2] * brightness + light.ambient[2];
- if (colors[i][j][0] > 1)colors[i][j][0] = 1;
- if (colors[i][j][1] > 1)colors[i][j][1] = 1;
- if (colors[i][j][2] > 1)colors[i][j][2] = 1;
- if (colors[i][j][0] < 0)colors[i][j][0] = 0;
- if (colors[i][j][1] < 0)colors[i][j][1] = 0;
- if (colors[i][j][2] < 0)colors[i][j][2] = 0;
+ if (colors[i][j][0] > 1) colors[i][j][0] = 1;
+ if (colors[i][j][1] > 1) colors[i][j][1] = 1;
+ if (colors[i][j][2] > 1) colors[i][j][2] = 1;
+ if (colors[i][j][0] < 0) colors[i][j][0] = 0;
+ if (colors[i][j][1] < 0) colors[i][j][1] = 0;
+ if (colors[i][j][2] < 0) colors[i][j][2] = 0;
}
}
- if (visibleloading) Game::LoadingScreen();
+ if (visibleloading)
+ Game::LoadingScreen();
//Smooth shadows
for (i = 0; i < size; i++) {
player[j].aitype = attacktypecutoff;
} else {
- if (j != 0) numthrowkill++;
+ if (j != 0)
+ numthrowkill++;
player[j].num_weapons++;
player[j].weaponstuck = player[j].num_weapons - 1;
if (normaldotproduct(player[j].facing, velocity) > 0)
else
award_bonus(0, Bullseyebonus);
}
- } else missed = 1;
+ } else {
+ missed = 1;
+ }
}
}
}
bigtilt = 0;
bigtilt2 = 0;
bigrotation = 0;
- if (temppoint1.x > temppoint2.x) rotation1 = 360 - rotation1;
+ if (temppoint1.x > temppoint2.x)
+ rotation1 = 360 - rotation1;
}
}
bounceness = 0;
frictionness = abs(normaldotproduct(velocity, terrainnormal));
velocity -= bounceness;
- if (1 - friction * frictionness > 0)velocity *= 1 - friction * frictionness;
- else velocity = 0;
+ if (1 - friction * frictionness > 0)
+ velocity *= 1 - friction * frictionness;
+ else
+ velocity = 0;
velocity += bounceness * elasticity;
if (findLengthfast(&bounceness) > 1) {
tippoint += terrainnormal * .002;
bounceness = terrainnormal * findLength(&tipvelocity) * (abs(normaldotproduct(tipvelocity, terrainnormal)));
- if (findLengthfast(&tipvelocity) < findLengthfast(&bounceness))bounceness = 0;
+ if (findLengthfast(&tipvelocity) < findLengthfast(&bounceness))
+ bounceness = 0;
frictionness = abs(normaldotproduct(tipvelocity, terrainnormal));
tipvelocity -= bounceness;
- if (1 - friction * frictionness > 0)tipvelocity *= 1 - friction * frictionness;
- else tipvelocity = 0;
+ if (1 - friction * frictionness > 0)
+ tipvelocity *= 1 - friction * frictionness;
+ else
+ tipvelocity = 0;
tipvelocity += bounceness * elasticity;
if (findLengthfast(&bounceness) > 1) {
ReflectVector(&velocity, &terrainnormal);
bounceness = terrainnormal * findLength(&velocity) * (abs(normaldotproduct(velocity, terrainnormal)));
- if (findLengthfast(&velocity) < findLengthfast(&bounceness))bounceness = 0;
+ if (findLengthfast(&velocity) < findLengthfast(&bounceness))
+ bounceness = 0;
frictionness = abs(normaldotproduct(velocity, terrainnormal));
velocity -= bounceness;
- if (1 - friction * frictionness > 0)velocity *= 1 - friction * frictionness;
- else velocity = 0;
+ if (1 - friction * frictionness > 0)
+ velocity *= 1 - friction * frictionness;
+ else
+ velocity = 0;
velocity += bounceness * elasticity;
if (findLengthfast(&bounceness) > 1) {
ReflectVector(&tipvelocity, &terrainnormal);
bounceness = terrainnormal * findLength(&tipvelocity) * (abs(normaldotproduct(tipvelocity, terrainnormal)));
- if (findLengthfast(&tipvelocity) < findLengthfast(&bounceness))bounceness = 0;
+ if (findLengthfast(&tipvelocity) < findLengthfast(&bounceness))
+ bounceness = 0;
frictionness = abs(normaldotproduct(tipvelocity, terrainnormal));
tipvelocity -= bounceness;
- if (1 - friction * frictionness > 0)tipvelocity *= 1 - friction * frictionness;
- else tipvelocity = 0;
+ if (1 - friction * frictionness > 0)
+ tipvelocity *= 1 - friction * frictionness;
+ else
+ tipvelocity = 0;
tipvelocity += bounceness * elasticity;
if (findLengthfast(&bounceness) > 1) {
ReflectVector(&velocity, &terrainnormal);
position += terrainnormal * .002;
bounceness = terrainnormal * findLength(&velocity) * (abs(normaldotproduct(velocity, terrainnormal)));
- if (findLengthfast(&velocity) < findLengthfast(&bounceness))bounceness = 0;
+ if (findLengthfast(&velocity) < findLengthfast(&bounceness))
+ bounceness = 0;
frictionness = abs(normaldotproduct(velocity, terrainnormal));
velocity -= bounceness;
- if (1 - friction * frictionness > 0)velocity *= 1 - friction * frictionness;
- else velocity = 0;
- if (terrain.getOpacity(position.x, position.z) < .2)velocity += bounceness * elasticity * .3;
- else velocity += bounceness * elasticity;
+ if (1 - friction * frictionness > 0)
+ velocity *= 1 - friction * frictionness;
+ else
+ velocity = 0;
+ if (terrain.getOpacity(position.x, position.z) < .2)
+ velocity += bounceness * elasticity * .3;
+ else
+ velocity += bounceness * elasticity;
if (findLengthfast(&bounceness) > 1) {
int whichsound;
ReflectVector(&tipvelocity, &terrainnormal);
tippoint += terrainnormal * .002;
bounceness = terrainnormal * findLength(&tipvelocity) * (abs(normaldotproduct(tipvelocity, terrainnormal)));
- if (findLengthfast(&tipvelocity) < findLengthfast(&bounceness))bounceness = 0;
+ if (findLengthfast(&tipvelocity) < findLengthfast(&bounceness))
+ bounceness = 0;
frictionness = abs(normaldotproduct(tipvelocity, terrainnormal));
tipvelocity -= bounceness;
- if (1 - friction * frictionness > 0)tipvelocity *= 1 - friction * frictionness;
- else tipvelocity = 0;
- if (terrain.getOpacity(tippoint.x, tippoint.z) < .2)tipvelocity += bounceness * elasticity * .3;
- else tipvelocity += bounceness * elasticity;
+ if (1 - friction * frictionness > 0)
+ tipvelocity *= 1 - friction * frictionness;
+ else
+ tipvelocity = 0;
+ if (terrain.getOpacity(tippoint.x, tippoint.z) < .2)
+ tipvelocity += bounceness * elasticity * .3;
+ else
+ tipvelocity += bounceness * elasticity;
if (findLengthfast(&bounceness) > 1) {
int whichsound;
ReflectVector(&velocity, &terrainnormal);
//mid+=terrainnormal*.002;
bounceness = terrainnormal * findLength(&velocity) * (abs(normaldotproduct(velocity, terrainnormal)));
- if (findLengthfast(&velocity) < findLengthfast(&bounceness))bounceness = 0;
+ if (findLengthfast(&velocity) < findLengthfast(&bounceness))
+ bounceness = 0;
frictionness = abs(normaldotproduct(velocity, terrainnormal));
velocity -= bounceness;
- if (1 - friction * frictionness > 0)velocity *= 1 - friction * frictionness;
- else velocity = 0;
- if (terrain.getOpacity(mid.x, mid.z) < .2)velocity += bounceness * elasticity * .3;
- else velocity += bounceness * elasticity;
+ if (1 - friction * frictionness > 0)
+ velocity *= 1 - friction * frictionness;
+ else
+ velocity = 0;
+ if (terrain.getOpacity(mid.x, mid.z) < .2)
+ velocity += bounceness * elasticity * .3;
+ else
+ velocity += bounceness * elasticity;
if (findLengthfast(&bounceness) > 1) {
int whichsound;
if (terrain.getOpacity(mid.x, mid.z) > .2) {
- if (type == staff)whichsound = footstepsound3 + abs(Random() % 2);
- if (type != staff)whichsound = clank1sound + abs(Random() % 4);
- } else whichsound = footstepsound + abs(Random() % 2);
+ if (type == staff)
+ whichsound = footstepsound3 + abs(Random() % 2);
+ if (type != staff)
+ whichsound = clank1sound + abs(Random() % 4);
+ } else {
+ whichsound = footstepsound + abs(Random() % 2);
+ }
emit_sound_at(whichsound, mid,
findLengthfast(&bounceness)
* (terrain.getOpacity(position.x, position.z) > .2
ReflectVector(&tipvelocity, &terrainnormal);
//mid+=terrainnormal*.002;
bounceness = terrainnormal * findLength(&tipvelocity) * (abs(normaldotproduct(tipvelocity, terrainnormal)));
- if (findLengthfast(&tipvelocity) < findLengthfast(&bounceness))bounceness = 0;
+ if (findLengthfast(&tipvelocity) < findLengthfast(&bounceness))
+ bounceness = 0;
frictionness = abs(normaldotproduct(tipvelocity, terrainnormal));
tipvelocity -= bounceness;
- if (1 - friction * frictionness > 0)tipvelocity *= 1 - friction * frictionness;
- else tipvelocity = 0;
- if (terrain.getOpacity(mid.x, mid.z) < .2)tipvelocity += bounceness * elasticity * .3;
- else tipvelocity += bounceness * elasticity;
+ if (1 - friction * frictionness > 0)
+ tipvelocity *= 1 - friction * frictionness;
+ else
+ tipvelocity = 0;
+ if (terrain.getOpacity(mid.x, mid.z) < .2)
+ tipvelocity += bounceness * elasticity * .3;
+ else
+ tipvelocity += bounceness * elasticity;
if (findLengthfast(&bounceness) > 1) {
int whichsound;
if (terrain.getOpacity(mid.x, mid.z) > .2) {
- if (type == staff)whichsound = footstepsound3 + abs(Random() % 2);
- if (type != staff)whichsound = clank1sound + abs(Random() % 4);
- } else whichsound = footstepsound + abs(Random() % 2);
+ if (type == staff)
+ whichsound = footstepsound3 + abs(Random() % 2);
+ if (type != staff)
+ whichsound = clank1sound + abs(Random() % 4);
+ } else {
+ whichsound = footstepsound + abs(Random() % 2);
+ }
emit_sound_at(whichsound, mid,
findLengthfast(&bounceness)
* (terrain.getOpacity(position.x, position.z) > .2
bigtilt = 0;
bigtilt2 = 0;
bigrotation = 0;
- if (temppoint1.x > temppoint2.x)rotation1 = 360 - rotation1;
+ if (temppoint1.x > temppoint2.x)
+ rotation1 = 360 - rotation1;
//Stop moving
if (findLengthfast(&velocity) < .3 && findLengthfast(&tipvelocity) < .3 && hitsomething) {
if (blooddrip && bloody) {
blooddripdelay -= blooddrip * multiplier / 2;
blooddrip -= multiplier;
- if (blooddrip < 0) blooddrip = 0;
- if (blooddrip > 5) blooddrip = 5;
+ if (blooddrip < 0)
+ blooddrip = 0;
+ if (blooddrip > 5)
+ blooddrip = 5;
if (blooddripdelay < 0 && bloodtoggle) {
blooddripdelay = 1;
XYZ bloodvel;
lastdrawnbigtilt2 = bigtilt2;
lastdrawnsmallrotation = smallrotation;
lastdrawnsmallrotation2 = smallrotation2;
- if (owner != -1)lastdrawnanim = player[owner].animCurrent;
+ if (owner != -1)
+ lastdrawnanim = player[owner].animCurrent;
}
if (owner != -1) {
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
AL_API void OPENAL_3D_Listener_SetAttributes(const float *pos, const float *vel, float fx, float fy, float fz, float tx, float ty, float tz)
{
- if (!initialized) return;
+ if (!initialized)
+ return;
if (pos != NULL) {
alListener3f(AL_POSITION, pos[0], pos[1], -pos[2]);
listener_position[0] = pos[0];
AL_API signed char OPENAL_3D_SetAttributes(int channel, const float *pos, const float *vel)
{
- if (!initialized) return false;
- if ((channel < 0) || (channel >= num_channels)) return false;
+ if (!initialized)
+ return false;
+ if ((channel < 0) || (channel >= num_channels))
+ return false;
if (pos != NULL)
set_channel_position(channel, pos[0], pos[1], -pos[2]);
AL_API signed char OPENAL_3D_SetAttributes_(int channel, const XYZ &pos, const float *vel)
{
- if (!initialized) return false;
- if ((channel < 0) || (channel >= num_channels)) return false;
+ if (!initialized)
+ return false;
+ if ((channel < 0) || (channel >= num_channels))
+ return false;
set_channel_position(channel, pos.x, pos.y, -pos.z);
AL_API signed char OPENAL_Init(int mixrate, int maxsoftwarechannels, unsigned int flags)
{
- if (initialized) return false;
- if (maxsoftwarechannels == 0) return false;
+ if (initialized)
+ return false;
+ if (maxsoftwarechannels == 0)
+ return false;
if (flags != 0) // unsupported.
return false;
AL_API void OPENAL_Close()
{
- if (!initialized) return;
+ if (!initialized)
+ return;
ALCcontext *ctx = alcGetCurrentContext();
if (ctx) {
static OPENAL_SAMPLE *OPENAL_GetCurrentSample(int channel)
{
- if (!initialized) return NULL;
- if ((channel < 0) || (channel >= num_channels)) return NULL;
+ if (!initialized)
+ return NULL;
+ if ((channel < 0) || (channel >= num_channels))
+ return NULL;
return impl_channels[channel].sample;
}
static signed char OPENAL_GetPaused(int channel)
{
- if (!initialized) return false;
- if ((channel < 0) || (channel >= num_channels)) return false;
+ if (!initialized)
+ return false;
+ if ((channel < 0) || (channel >= num_channels))
+ return false;
if (impl_channels[channel].startpaused)
return(true);
static unsigned int OPENAL_GetLoopMode(int channel)
{
- if (!initialized) return 0;
- if ((channel < 0) || (channel >= num_channels)) return 0;
+ if (!initialized)
+ return 0;
+ if ((channel < 0) || (channel >= num_channels))
+ return 0;
ALint loop = 0;
alGetSourceiv(impl_channels[channel].sid, AL_LOOPING, &loop);
if (loop)
static signed char OPENAL_IsPlaying(int channel)
{
- if (!initialized) return false;
- if ((channel < 0) || (channel >= num_channels)) return false;
+ if (!initialized)
+ return false;
+ if ((channel < 0) || (channel >= num_channels))
+ return false;
ALint state = 0;
alGetSourceiv(impl_channels[channel].sid, AL_SOURCE_STATE, &state);
return((state == AL_PLAYING) ? true : false);
static int OPENAL_PlaySoundEx(int channel, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused)
{
- if (!initialized) return -1;
- if (sptr == NULL) return -1;
- if (dsp != NULL) return -1;
+ if (!initialized)
+ return -1;
+ if (sptr == NULL)
+ return -1;
+ if (dsp != NULL)
+ return -1;
if (channel == OPENAL_FREE) {
for (int i = 0; i < num_channels; i++) {
ALint state = 0;
}
}
- if ((channel < 0) || (channel >= num_channels)) return -1;
+ if ((channel < 0) || (channel >= num_channels))
+ return -1;
alSourceStop(impl_channels[channel].sid);
impl_channels[channel].sample = sptr;
alSourcei(impl_channels[channel].sid, AL_BUFFER, sptr->bid);
char *fname = (char *) alloca(strlen(_fname) + 16);
strcpy(fname, _fname);
char *ptr = strchr(fname, '.');
- if (ptr) *ptr = '\0';
+ if (ptr)
+ *ptr = '\0';
strcat(fname, ".ogg");
// just in case...
AL_API OPENAL_SAMPLE *OPENAL_Sample_Load(int index, const char *name_or_data, unsigned int mode, int offset, int length)
{
- if (!initialized) return NULL;
- if (index != OPENAL_FREE) return NULL; // this is all the game does...
- if (offset != 0) return NULL; // this is all the game does...
- if (length != 0) return NULL; // this is all the game does...
- if ((mode != OPENAL_HW3D) && (mode != OPENAL_2D)) return NULL; // this is all the game does...
+ if (!initialized)
+ return NULL;
+ if (index != OPENAL_FREE)
+ return NULL; // this is all the game does...
+ if (offset != 0)
+ return NULL; // this is all the game does...
+ if (length != 0)
+ return NULL; // this is all the game does...
+ if ((mode != OPENAL_HW3D) && (mode != OPENAL_2D))
+ return NULL; // this is all the game does...
OPENAL_SAMPLE *retval = NULL;
ALuint bufferName = 0;
AL_API void OPENAL_Sample_Free(OPENAL_SAMPLE *sptr)
{
- if (!initialized) return;
+ if (!initialized)
+ return;
if (sptr) {
for (int i = 0; i < num_channels; i++) {
if (impl_channels[i].sample == sptr) {
static signed char OPENAL_Sample_SetMode(OPENAL_SAMPLE *sptr, unsigned int mode)
{
- if (!initialized) return false;
- if ((mode != OPENAL_LOOP_NORMAL) && (mode != OPENAL_LOOP_OFF)) return false;
- if (!sptr) return false;
+ if (!initialized)
+ return false;
+ if ((mode != OPENAL_LOOP_NORMAL) && (mode != OPENAL_LOOP_OFF))
+ return false;
+ if (!sptr)
+ return false;
sptr->mode = mode;
return true;
}
AL_API signed char OPENAL_SetFrequency(int channel, int freq)
{
- if (!initialized) return false;
+ if (!initialized)
+ return false;
if (channel == OPENAL_ALL) {
for (int i = 0; i < num_channels; i++)
OPENAL_SetFrequency(i, freq);
return true;
}
- if ((channel < 0) || (channel >= num_channels)) return false;
- if (freq == 8012) // hack
+ if ((channel < 0) || (channel >= num_channels))
+ return false;
+ if (freq == 8012)
+ // hack
alSourcef(impl_channels[channel].sid, AL_PITCH, 8012.0f / 44100.0f);
else
alSourcef(impl_channels[channel].sid, AL_PITCH, 1.0f);
AL_API signed char OPENAL_SetVolume(int channel, int vol)
{
- if (!initialized) return false;
+ if (!initialized)
+ return false;
if (channel == OPENAL_ALL) {
for (int i = 0; i < num_channels; i++)
return true;
}
- if ((channel < 0) || (channel >= num_channels)) return false;
+ if ((channel < 0) || (channel >= num_channels))
+ return false;
- if (vol < 0) vol = 0;
- else if (vol > 255) vol = 255;
+ if (vol < 0)
+ vol = 0;
+ else if (vol > 255)
+ vol = 255;
ALfloat gain = ((ALfloat) vol) / 255.0f;
alSourcef(impl_channels[channel].sid, AL_GAIN, gain);
return true;
AL_API signed char OPENAL_SetPaused(int channel, signed char paused)
{
- if (!initialized) return false;
+ if (!initialized)
+ return false;
if (channel == OPENAL_ALL) {
for (int i = 0; i < num_channels; i++)
return true;
}
- if ((channel < 0) || (channel >= num_channels)) return false;
+ if ((channel < 0) || (channel >= num_channels))
+ return false;
ALint state = 0;
if (impl_channels[channel].startpaused)
AL_API void OPENAL_SetSFXMasterVolume(int volume)
{
- if (!initialized) return;
+ if (!initialized)
+ return;
ALfloat gain = ((ALfloat) volume) / 255.0f;
alListenerf(AL_GAIN, gain);
}
AL_API signed char OPENAL_StopSound(int channel)
{
- if (!initialized) return false;
+ if (!initialized)
+ return false;
if (channel == OPENAL_ALL) {
for (int i = 0; i < num_channels; i++)
return true;
}
- if ((channel < 0) || (channel >= num_channels)) return false;
+ if ((channel < 0) || (channel >= num_channels))
+ return false;
alSourceStop(impl_channels[channel].sid);
impl_channels[channel].startpaused = false;
return true;
static OPENAL_SAMPLE *OPENAL_Stream_GetSample(OPENAL_STREAM *stream)
{
- if (!initialized) return NULL;
+ if (!initialized)
+ return NULL;
return (OPENAL_SAMPLE *) stream;
}
static signed char OPENAL_Stream_Stop(OPENAL_STREAM *stream)
{
- if (!initialized) return false;
+ if (!initialized)
+ return false;
for (int i = 0; i < num_channels; i++) {
if (impl_channels[i].sample == (OPENAL_SAMPLE *) stream) {
alSourceStop(impl_channels[i].sid);
AL_API void OPENAL_Update()
{
- if (!initialized) return;
+ if (!initialized)
+ return;
alcProcessContext(alcGetCurrentContext());
}