/*
Copyright (C) 2003, 2010 - Wolfire Games
+Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
This file is part of Lugaru.
-Lugaru is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
+Lugaru is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
-This program is distributed in the hope that it will be useful,
+Lugaru is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-See the GNU General Public License for more details.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+along with Lugaru. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Game.h"
#include "Input.h"
#include "Awards.h"
#include "Menu.h"
+#include "Dialog.h"
extern XYZ viewer;
extern int environment;
extern float texscale;
extern Light light;
extern Terrain terrain;
-//extern Sprites sprites;
extern float multiplier;
-extern float sps;
extern float viewdistance;
extern float fadestart;
extern float screenwidth, screenheight;
extern Objects objects;
extern int detail;
extern float usermousesensitivity;
-extern bool osx;
extern float camerashake;
extern int slomo;
extern float slomodelay;
extern float motionbluramount;
extern bool isclient;
extern bool alwaysblur;
-extern int test;
-extern bool tilt2weird;
-extern bool tiltweird;
-extern bool midweird;
-extern bool proportionweird;
-extern bool vertexweird[6];
extern bool velocityblur;
extern bool debugmode;
extern int mainmenu;
extern int bloodtoggle;
extern int difficulty;
extern bool decals;
-// MODIFIED GWC
-//extern int texdetail;
extern float texdetail;
extern bool musictoggle;
extern int tutoriallevel;
extern int hotspottype[40];
extern float hotspotsize[40];
extern char hotspottext[40][256];
-extern int currenthotspot;;
+extern int currenthotspot;
extern bool campaign;
extern bool winfreeze;
-extern float menupulse;
-
extern bool gamestart;
extern bool gamestarted;
realmotionblurmode, doublevisionmode, glowmode,
};
-void Game::flash() // shouldn't be that way, these should be attributes and Person class should not change rendering.
+void Game::flash(float amount, int delay) // shouldn't be that way, these should be attributes and Person class should not change rendering.
{
flashr = 1;
flashg = 0;
flashb = 0;
- flashamount = 1;
- flashdelay = 1;
+ flashamount = amount;
+ flashdelay = delay;
}
void DrawMenu();
{
static float texcoordwidth, texcoordheight;
static float texviewwidth, texviewheight;
- static int i, j, l;
+ static int l;
static XYZ checkpoint;
static float tempmult;
float tutorialopac;
numboundaries = mapradius * 2;
if (numboundaries > 360)
numboundaries = 360;
- for (i = 0; i < numboundaries; i++) {
+ for (int i = 0; i < numboundaries; i++) {
boundary[i] = 0;
boundary[i].z = 1;
boundary[i] = mapcenter + DoRotation(boundary[i] * mapradius, 0, i * (360 / ((float)(numboundaries))), 0);
if (winfreeze || mainmenu)
drawmode = normalmode;
-#if PLATFORM_MACOSX
- if (drawmode == glowmode) {
- RGBColor color2;
- color2.red = 0;
- color2.green = 0;
- color2.blue = 0;
- DSpContext_FadeGamma(NULL, 200, &color2);
- }
-#endif
-
if (drawtoggle != 2)
drawtoggle = 1 - drawtoggle;
glDrawBuffer(GL_BACK);
glReadBuffer(GL_BACK);
- //glFinish();
static XYZ terrainlight;
static float distance;
if (drawmode == normalmode)
for (unsigned k = 0; k < Person::players.size(); k++) {
if (!Person::players[k]->skeleton.free && Person::players[k]->playerdetail && Person::players[k]->howactive < typesleeping)
if (frustum.SphereInFrustum(Person::players[k]->coords.x, Person::players[k]->coords.y + Person::players[k]->scale * 3, Person::players[k]->coords.z, Person::players[k]->scale * 7) && Person::players[k]->occluded < 25)
- for (i = 0; i < Person::players[k]->skeleton.num_joints; i++) {
+ for (int i = 0; i < Person::players[k]->skeleton.num_joints; i++) {
if (Person::players[k]->skeleton.joints[i].label == leftknee || Person::players[k]->skeleton.joints[i].label == rightknee || Person::players[k]->skeleton.joints[i].label == groin) {
point = DoRotation(Person::players[k]->skeleton.joints[i].position, 0, Person::players[k]->yaw, 0) * Person::players[k]->scale + Person::players[k]->coords;
size = .4f;
}
terrain.MakeDecal(shadowdecal, point, size, opacity, rotation);
for (l = 0; l < terrain.patchobjectnum[Person::players[k]->whichpatchx][Person::players[k]->whichpatchz]; l++) {
- j = terrain.patchobjects[Person::players[k]->whichpatchx][Person::players[k]->whichpatchz][l];
+ int j = terrain.patchobjects[Person::players[k]->whichpatchx][Person::players[k]->whichpatchz][l];
if (objects.position[j].y < Person::players[k]->coords.y || objects.type[j] == tunneltype || objects.type[j] == weirdtype) {
point = DoRotation(DoRotation(Person::players[k]->skeleton.joints[i].position, 0, Person::players[k]->yaw, 0) * Person::players[k]->scale + Person::players[k]->coords - objects.position[j], 0, -objects.yaw[j], 0);
size = .4f;
}
if ((Person::players[k]->skeleton.free || Person::players[k]->howactive >= typesleeping) && Person::players[k]->playerdetail)
if (frustum.SphereInFrustum(Person::players[k]->coords.x, Person::players[k]->coords.y, Person::players[k]->coords.z, Person::players[k]->scale * 5) && Person::players[k]->occluded < 25)
- for (i = 0; i < Person::players[k]->skeleton.num_joints; i++) {
+ for (int i = 0; i < Person::players[k]->skeleton.num_joints; i++) {
if (Person::players[k]->skeleton.joints[i].label == leftknee || Person::players[k]->skeleton.joints[i].label == rightknee || Person::players[k]->skeleton.joints[i].label == groin || Person::players[k]->skeleton.joints[i].label == leftelbow || Person::players[k]->skeleton.joints[i].label == rightelbow || Person::players[k]->skeleton.joints[i].label == neck) {
if (Person::players[k]->skeleton.free)
point = Person::players[k]->skeleton.joints[i].position * Person::players[k]->scale + Person::players[k]->coords;
}
terrain.MakeDecal(shadowdecal, point, size, opacity * .7, rotation);
for (l = 0; l < terrain.patchobjectnum[Person::players[k]->whichpatchx][Person::players[k]->whichpatchz]; l++) {
- j = terrain.patchobjects[Person::players[k]->whichpatchx][Person::players[k]->whichpatchz][l];
+ int j = terrain.patchobjects[Person::players[k]->whichpatchx][Person::players[k]->whichpatchz][l];
if (objects.position[j].y < Person::players[k]->coords.y || objects.type[j] == tunneltype || objects.type[j] == weirdtype) {
if (Person::players[k]->skeleton.free)
point = DoRotation(Person::players[k]->skeleton.joints[i].position * Person::players[k]->scale + Person::players[k]->coords - objects.position[j], 0, -objects.yaw[j], 0);
opacity = .4 - (Person::players[k]->coords.y - terrain.getHeight(Person::players[k]->coords.x, Person::players[k]->coords.z)) / 5;
terrain.MakeDecal(shadowdecal, point, size, opacity * .7, rotation);
for (l = 0; l < terrain.patchobjectnum[Person::players[k]->whichpatchx][Person::players[k]->whichpatchz]; l++) {
- j = terrain.patchobjects[Person::players[k]->whichpatchx][Person::players[k]->whichpatchz][l];
+ int j = terrain.patchobjects[Person::players[k]->whichpatchx][Person::players[k]->whichpatchz][l];
point = DoRotation(Person::players[k]->coords - objects.position[j], 0, -objects.yaw[j], 0);
size = .7;
opacity = .4f;
terrain.draw(0);
terraintexture2.bind();
terrain.draw(1);
- //glBindTexture( GL_TEXTURE_2D, terraintexture3);
- //glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- //terrain.draw(2);
terrain.drawdecals();
glEnable(GL_COLOR_MATERIAL);
- test = 2;
- tilt2weird = 0;
- tiltweird = 0;
- midweird = 0;
- proportionweird = 0;
- vertexweird[0] = 0;
- vertexweird[1] = 0;
- vertexweird[2] = 0;
- vertexweird[3] = 0;
- vertexweird[4] = 0;
- vertexweird[5] = 0;
-
if (!cellophane) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_CULL_FACE);
if (distance >= .5) {
checkpoint = DoRotation(Person::players[k]->skeleton.joints[abs(Random() % Person::players[k]->skeleton.num_joints)].position, 0, Person::players[k]->yaw, 0) * Person::players[k]->scale + Person::players[k]->coords;
checkpoint.y += 1;
- if (!Person::players[k]->occluded == 0)
+ int i = -1;
+ if (Person::players[k]->occluded != 0)
i = checkcollide(viewer, checkpoint, Person::players[k]->lastoccluded);
- if (i == -1 || Person::players[k]->occluded == 0)
+ if (i == -1)
i = checkcollide(viewer, checkpoint);
if (i != -1) {
Person::players[k]->occluded += 1;
if (distance >= .5) {
checkpoint = DoRotation(Person::players[k]->skeleton.joints[abs(Random() % Person::players[k]->skeleton.num_joints)].position, 0, Person::players[k]->yaw, 0) * Person::players[k]->scale + Person::players[k]->coords;
checkpoint.y += 1;
- if (!Person::players[k]->occluded == 0)
+ int i = -1;
+ if (Person::players[k]->occluded != 0)
i = checkcollide(viewer, checkpoint, Person::players[k]->lastoccluded);
- if (i == -1 || Person::players[k]->occluded == 0)
+ if (i == -1)
i = checkcollide(viewer, checkpoint);
if (i != -1) {
Person::players[k]->occluded += 1;
for (unsigned k = 0; k < Person::players.size(); k++) {
if (Person::players[k]->numwaypoints > 1) {
glBegin(GL_LINE_LOOP);
- for (i = 0; i < Person::players[k]->numwaypoints; i++) {
+ for (int i = 0; i < Person::players[k]->numwaypoints; i++) {
glVertex3f(Person::players[k]->waypoints[i].x, Person::players[k]->waypoints[i].y + .5, Person::players[k]->waypoints[i].z);
}
glEnd();
glColor4f(0, 1, 0, 1);
for (unsigned k = 0; int(k) < numpathpoints; k++) {
if (numpathpointconnect[k]) {
- for (i = 0; i < numpathpointconnect[k]; i++) {
+ for (int i = 0; i < numpathpointconnect[k]; i++) {
glBegin(GL_LINE_LOOP);
glVertex3f(pathpoint[k].x, pathpoint[k].y + .5, pathpoint[k].z);
glVertex3f(pathpoint[pathpointconnect[k][i]].x, pathpoint[pathpointconnect[k][i]].y + .5, pathpoint[pathpointconnect[k][i]].z);
glColor4f(.5, .5, .5, 1);
if (!console) {
if (!tutoriallevel)
- if (bonus > 0 && bonustime < 1 && !winfreeze && indialogue == -1/*bonustime<4*/) {
+ if (bonus > 0 && bonustime < 1 && !winfreeze && !Dialog::inDialog()) {
const char *bonus_name;
if (bonus < bonus_count)
bonus_name = bonus_names[bonus];
text->glPrint(screenwidth / 2 - 7.6 * strlen(string2)*screenwidth / 1024 * .8, 0 + screenheight * 1 / 10 - 20 * .8 * screenwidth / 1024, string2, 1, 1.5 * screenwidth / 1024 * .8, screenwidth, screenheight);
text->glPrint(screenwidth / 2 - 7.6 * strlen(string3)*screenwidth / 1024 * .8, 0 + screenheight * 1 / 10 - 40 * .8 * screenwidth / 1024, string3, 1, 1.5 * screenwidth / 1024 * .8, screenwidth, screenheight);
}
- //Hot spots
+ //Hot spots
if (numhotspots && (bonustime >= 1 || bonus <= 0 || bonustime < 0) && !tutoriallevel) {
- int closest = -1;
float closestdist = -1;
float distance = 0;
- closest = currenthotspot;
- for (i = 0; i < numhotspots; i++) {
+ int closest = currenthotspot;
+ for (int i = 0; i < numhotspots; i++) {
distance = distsq(&Person::players[0]->coords, &hotspot[i]);
if (closestdist == -1 || distance < closestdist) {
if (distsq(&Person::players[0]->coords, &hotspot[i]) < hotspotsize[i] && ((hotspottype[i] <= 10 && hotspottype[i] >= 0) || (hotspottype[i] <= 40 && hotspottype[i] >= 20))) {
}
}
}
- if (closest != -1)
+ if (closest != -1) {
currenthotspot = closest;
- if (currenthotspot != -1) {
if (hotspottype[closest] <= 10) {
if (distsq(&Person::players[0]->coords, &hotspot[closest]) < hotspotsize[closest])
tutorialstagetime = 0;
int lastline = 0;
int line = 0;
bool done = false;
- i = 0;
+ int i = 0;
while (!done) {
if (string[i] == '\n' || string[i] > 'z' || string[i] < ' ' || string[i] == '\0') {
glColor4f(0, 0, 0, tutorialopac);
done = 1;
i++;
}
- } else if (hotspottype[closest] >= 20 && dialoguegonethrough[hotspottype[closest] - 20] == 0) {
- whichdialogue = hotspottype[closest] - 20;
- for (j = 0; j < numdialogueboxes[whichdialogue]; j++) {
- Person::players[participantfocus[whichdialogue][j]]->coords = participantlocation[whichdialogue][participantfocus[whichdialogue][j]];
- Person::players[participantfocus[whichdialogue][j]]->yaw = participantyaw[whichdialogue][participantfocus[whichdialogue][j]];
- Person::players[participantfocus[whichdialogue][j]]->targetyaw = participantyaw[whichdialogue][participantfocus[whichdialogue][j]];
- Person::players[participantfocus[whichdialogue][j]]->velocity = 0;
- Person::players[participantfocus[whichdialogue][j]]->animTarget = Person::players[participantfocus[whichdialogue][j]]->getIdle();
- Person::players[participantfocus[whichdialogue][j]]->frameTarget = 0;
- }
- directing = 0;
- indialogue = 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;
- emit_sound_at(whichsoundplay, Person::players[participantfocus[whichdialogue][indialogue]]->coords);
- }
+ } else if ((hotspottype[closest] >= 20) && (Dialog::dialogs[hotspottype[closest] - 20].gonethrough == 0)) {
+ Dialog::whichdialogue = hotspottype[closest] - 20;
+ Dialog::currentDialog().play();
+ Dialog::currentDialog().gonethrough++;
}
}
}
- if (indialogue != -1 && !mainmenu) {
+ if (Dialog::inDialog() && !mainmenu) {
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glDisable(GL_LIGHTING);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
- if (dialogueboxlocation[whichdialogue][indialogue] == 1)
+ if (Dialog::currentScene().location == 1)
glTranslatef(0, screenheight * 3 / 4, 0);
glScalef(screenwidth, screenheight / 4, 1);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
- glColor4f(dialogueboxcolor[whichdialogue][indialogue][0], dialogueboxcolor[whichdialogue][indialogue][1], dialogueboxcolor[whichdialogue][indialogue][2], 0.7);
+ glColor4f(Dialog::currentScene().color[0], Dialog::currentScene().color[1], Dialog::currentScene().color[2], 0.7);
glBegin(GL_QUADS);
glVertex3f(0, 0, 0.0f);
glVertex3f(1, 0, 0.0f);
float starty;
startx = screenwidth * 1 / 5;
- if (dialogueboxlocation[whichdialogue][indialogue] == 1)
+ if (Dialog::currentScene().location == 1)
starty = screenheight / 16 + screenheight * 4 / 5;
- if (dialogueboxlocation[whichdialogue][indialogue] == 2)
+ if (Dialog::currentScene().location == 2)
starty = screenheight * 1 / 5 - screenheight / 16;
char tempname[264];
- bool goodchar;
int tempnum = 0;
- for (i = 0; i < 264; i++) {
+ for (int i = 0; i < 264; i++) {
tempname[i] = '\0';
}
- 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 (goodchar)
- tempnum++;
- else
+ for (int i = 0; i < Dialog::currentScene().name.size(); i++) {
+ tempname[tempnum] = Dialog::currentScene().name[i];
+ if (tempname[tempnum] == '#' || tempname[tempnum] == '\0')
tempname[tempnum] = '\0';
+ else
+ tempnum++;
}
sprintf (string, "%s: ", tempname);
- if (dialogueboxcolor[whichdialogue][indialogue][0] + dialogueboxcolor[whichdialogue][indialogue][1] + dialogueboxcolor[whichdialogue][indialogue][2] < 1.5) {
+ if (Dialog::currentScene().color[0] + Dialog::currentScene().color[1] + Dialog::currentScene().color[2] < 1.5) {
glColor4f(0, 0, 0, tutorialopac);
text->glPrintOutline(startx - 2 * 7.6 * strlen(string)*screenwidth / 1024 - 4, starty - 4, string, 1, 1.5 * 1.25 * screenwidth / 1024, screenwidth, screenheight);
glColor4f(0.7, 0.7, 0.7, tutorialopac);
}
tempnum = 0;
- for (i = 0; i < (int)strlen(dialoguetext[whichdialogue][indialogue]) + 1; i++) {
- tempname[tempnum] = dialoguetext[whichdialogue][indialogue][i];
- if (dialoguetext[whichdialogue][indialogue][i] != '#')
+ for (int i = 0; i < Dialog::currentScene().text.size() + 1; i++) {
+ tempname[tempnum] = Dialog::currentScene().text[i];
+ if (Dialog::currentScene().text[i] != '#')
tempnum++;
}
int lastline = 0;
int line = 0;
bool done = false;
- i = 0;
+ int i = 0;
while (!done) {
if (string[i] == '\n' || string[i] > 'z' || string[i] < ' ' || string[i] == '\0') {
- if (dialogueboxcolor[whichdialogue][indialogue][0] + dialogueboxcolor[whichdialogue][indialogue][1] + dialogueboxcolor[whichdialogue][indialogue][2] < 1.5) {
+ if (Dialog::currentScene().color[0] + Dialog::currentScene().color[1] + Dialog::currentScene().color[2] < 1.5) {
glColor4f(0, 0, 0, tutorialopac);
text->glPrintOutline(startx/*-7.6*(i-lastline)*screenwidth/1024*/ - 4, starty - 4 - 20 * screenwidth / 1024 * line, string, 1, 1.5 * 1.25 * screenwidth / 1024, screenwidth, screenheight, lastline, i);
glColor4f(1, 1, 1, tutorialopac);
}
}
- if (!tutoriallevel && !winfreeze && indialogue == -1 && !mainmenu) {
+ if (!tutoriallevel && !winfreeze && !Dialog::inDialog() && !mainmenu) {
if (campaign) {
if (scoreadded)
sprintf (string, "Score: %d", (int)accountactive->getCampaignScore());
displaytime[0] = 0;
glEnable(GL_TEXTURE_2D);
glColor4f(1, 1, 1, 1);
- for (i = 1; i < 15; i++)
+ for (unsigned i = 1; i < 15; i++)
if (displaytime[i] < 4)
- for (j = 0; j < displaytext[i].size(); j++) {
+ for (unsigned j = 0; j < displaytext[i].size(); j++) {
glColor4f(1, 1, 1, 4 - displaytime[i]);
sprintf (string, "%c", displaytext[i][j]);
text->glPrint(30 + j * 10, 30 + i * 20 + (screenheight - 330), string, 0, 1, screenwidth, screenheight);
}
}
- if (difficulty < 2 && indialogue == -1) { // minimap
+ if (difficulty < 2 && !Dialog::inDialog()) { // minimap
float mapviewdist = 20000;
glDisable(GL_DEPTH_TEST);
XYZ center;
float radius;
float distcheck;
- int numliveplayers = 0;
- center = 0;
- for (i = 0; i < Person::players.size(); i++) {
- if (!Person::players[i]->dead)
- numliveplayers++;
- }
-
- int numadd = 0;
-
- for (i = 0; i < objects.numobjects; i++) {
- if (objects.type[i] == treetrunktype || objects.type[i] == boxtype) {
- center += objects.position[i];
- numadd++;
- }
- }
- for (i = 0; i < Person::players.size(); i++) {
- if (!Person::players[i]->dead)
- center += Person::players[i]->coords;
- }
- center /= numadd + numliveplayers;
center = Person::players[0]->coords;
- float maxdistance = 0;
- float tempdist;
- //~ int whichclosest;
- for (i = 0; i < objects.numobjects; i++) {
- tempdist = distsq(¢er, &objects.position[i]);
- if (tempdist > maxdistance) {
- //~ whichclosest=i;
- maxdistance = tempdist;
- }
- }
- for (i = 0; i < Person::players.size(); i++) {
- if (!Person::players[i]->dead) {
- tempdist = distsq(¢er, &Person::players[i]->coords);
- if (tempdist > maxdistance) {
- //~ whichclosest=i;
- maxdistance = tempdist;
- }
- }
- }
- radius = fast_sqrt(maxdistance);
-
radius = 110;
glScalef(.25 / radius * 256 * terrain.scale * .4, .25 / radius * 256 * terrain.scale * .4, 1);
glPopMatrix();
glRotatef(Person::players[0]->lookyaw * -1 + 180, 0, 0, 1);
glTranslatef(-(center.x / terrain.scale / 256 * -2 + 1), (center.z / terrain.scale / 256 * -2 + 1), 0);
- for (i = 0; i < objects.numobjects; i++) {
+ for (int i = 0; i < objects.numobjects; i++) {
if (objects.type[i] == treetrunktype) {
distcheck = distsq(&Person::players[0]->coords, &objects.position[i]);
if (distcheck < mapviewdist) {
}
if (editorenabled) {
Mapcircletexture.bind();
- for (i = 0; i < numboundaries; i++) {
+ for (int i = 0; i < numboundaries; i++) {
glColor4f(0, 0, 0, opac / 3);
glPushMatrix();
glTranslatef(boundary[i].x / terrain.scale / 256 * -2 + 1, boundary[i].z / terrain.scale / 256 * 2 - 1, 0);
glPopMatrix();
}
}
- for (i = 0; i < Person::players.size(); i++) {
+ for (unsigned i = 0; i < Person::players.size(); i++) {
distcheck = distsq(&Person::players[0]->coords, &Person::players[i]->coords);
if (distcheck < mapviewdist) {
glPushMatrix();
text->glPrint(1024 / 2 - 90, 768 / 2, string, 1, 2, 1024, 768);
}
loading = 2;
- //if(ismotionblur)drawmode=motionblurmode;
drawmode = normalmode;
}
char temp[255];
- for (i = 0; i < 255; i++)string[i] = '\0';
+ for (int 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)
int awards[award_count];
int numawards = award_awards(awards);
- for (i = 0; i < numawards && i < 6; i++)
+ for (int i = 0; i < numawards && i < 6; i++)
text->glPrintOutlined(1024 / 30, 768 * 6 / 8 - 90 - 40 * i, award_names[awards[i]], 1, 2, 1024, 768);
}
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
GLfloat subtractColor[4] = { 0.5, 0.5, 0.5, 0.0 };
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, subtractColor);
- //glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_SUBTRACT);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_CONSTANT_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
}
}
- //glFlush();
}
glClear(GL_DEPTH_BUFFER_BIT);
if (drawmode == motionblurmode) {
if (motionbluramount < .2)
motionbluramount = .2;
- //glColor4f(1,1,1,fast_sqrt(multiplier)*2.9*motionbluramount);
glColor4f(1, 1, 1, motionbluramount);
glPushMatrix();
glBegin(GL_QUADS);
glPopMatrix();
}
if (drawmode == radialzoommode) {
- for (i = 0; i < 3; i++) {
- //glRotatef((float)i*.1,0,0,1);
+ for (int i = 0; i < 3; i++) {
glColor4f(1, 1, 1, 1 / ((float)i + 1));
glPushMatrix();
glScalef(1 + (float)i * .01, 1 + (float)i * .01, 1);
sprintf (string, "_");
text->glPrint(30 + (float)(consoleselected) * 10 - offset * 10, 30, string, 0, 1, 1024, 768);
}
- for (i = 0; i < 15; i++)
- for (j = 0; j < consoletext[i].size(); j++) {
+ for (unsigned i = 0; i < 15; i++)
+ for (unsigned j = 0; j < consoletext[i].size(); j++) {
glColor4f(1, 1, 1, 1 - (float)(i) / 16);
sprintf (string, "%c", consoletext[i][j]);
text->glPrint(30 + j * 10 - offset * 10, 30 + i * 20, string, 0, 1, 1024, 768);
multiplier = 0;
}
- //glFlush();
if ( side == stereoRight || side == stereoCenter ) {
if (drawmode != motionblurmode || mainmenu) {
swap_gl_buffers();
}
}
- //myassert(glGetError() == GL_NO_ERROR);
glDrawBuffer(GL_BACK);
glReadBuffer(GL_BACK);
- //glFlush();
weapons.DoStuff();
glColor4f(1, 1, 1, 1);
Game::cursortexture.bind();
glPushMatrix();
- //glScalef(.25,.25,.25);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex3f(-1, -1, 0.0f);