/*
Copyright (C) 2003, 2010 - Wolfire Games
+Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
This file is part of Lugaru.
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();
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)
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);
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) {
float closestdist = -1;
float distance = 0;
}
}
}
- 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;
XYZ center;
float radius;
float distcheck;
- int numliveplayers = 0;
- center = 0;
- for (unsigned i = 0; i < Person::players.size(); i++) {
- if (!Person::players[i]->dead)
- numliveplayers++;
- }
-
- int numadd = 0;
-
- for (int i = 0; i < objects.numobjects; i++) {
- if (objects.type[i] == treetrunktype || objects.type[i] == boxtype) {
- center += objects.position[i];
- numadd++;
- }
- }
- for (unsigned 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 (int i = 0; i < objects.numobjects; i++) {
- tempdist = distsq(¢er, &objects.position[i]);
- if (tempdist > maxdistance) {
- //~ whichclosest=i;
- maxdistance = tempdist;
- }
- }
- for (unsigned 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 = 110;
glScalef(.25 / radius * 256 * terrain.scale * .4, .25 / radius * 256 * terrain.scale * .4, 1);
text->glPrint(1024 / 2 - 90, 768 / 2, string, 1, 2, 1024, 768);
}
loading = 2;
- //if(ismotionblur)drawmode=motionblurmode;
drawmode = normalmode;
}
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);
}
if (drawmode == radialzoommode) {
for (int i = 0; i < 3; i++) {
- //glRotatef((float)i*.1,0,0,1);
glColor4f(1, 1, 1, 1 / ((float)i + 1));
glPushMatrix();
glScalef(1 + (float)i * .01, 1 + (float)i * .01, 1);
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);