extern int kTextureSize;
extern FRUSTUM frustum;
extern Light light;
-extern Objects objects;
extern int detail;
extern float usermousesensitivity;
extern float camerashake;
static XYZ terrainlight;
static float distance;
- if (drawmode == normalmode)
+ if (drawmode == normalmode) {
Game::ReSizeGLScene(90, .1f);
- if (drawmode != normalmode)
+ } else {
glViewport(0, 0, texviewwidth, texviewheight);
+ }
glDepthFunc(GL_LEQUAL);
glDepthMask(1);
glAlphaFunc(GL_GREATER, 0.0001f);
else
blurness -= multiplier * 5;
- if (environment == desertenvironment && detail == 2)
- glTexEnvf( GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, blurness + .4 );
if (environment == desertenvironment) {
+ if (detail == 2) {
+ glTexEnvf( GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, blurness + .4 );
+ }
glRotatef((float)(abs(Random() % 100)) / 1000, 1, 0, 0);
glRotatef((float)(abs(Random() % 100)) / 1000, 0, 1, 0);
}
glTranslatef(-viewer.x, -viewer.y, -viewer.z);
frustum.GetFrustum();
- //make shadow decals on terrain and objects
+ //make shadow decals on terrain and Object::objects
static XYZ point;
static float size, opacity, rotation;
rotation = 0;
terrain.MakeDecal(shadowdecal, point, size, opacity, rotation);
for (l = 0; l < terrain.patchobjectnum[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);
+ if (Object::objects[j]->position.y < Person::players[k]->coords.y || Object::objects[j]->type == tunneltype || Object::objects[j]->type == 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 - Object::objects[j]->position, 0, -Object::objects[j]->yaw, 0);
size = .4f;
opacity = .4f;
if (k != 0 && tutoriallevel == 1) {
opacity = .2 + .2 * sin(smoketex * 6 + i);
}
- objects.model[j].MakeDecal(shadowdecal, &point, &size, &opacity, &rotation);
+ Object::objects[j]->model.MakeDecal(shadowdecal, &point, &size, &opacity, &rotation);
}
}
}
terrain.MakeDecal(shadowdecal, point, size, opacity * .7, rotation);
for (l = 0; l < terrain.patchobjectnum[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 (Object::objects[j]->position.y < Person::players[k]->coords.y || Object::objects[j]->type == tunneltype || Object::objects[j]->type == 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);
+ point = DoRotation(Person::players[k]->skeleton.joints[i].position * Person::players[k]->scale + Person::players[k]->coords - Object::objects[j]->position, 0, -Object::objects[j]->yaw, 0);
else
- 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);
+ point = DoRotation(DoRotation(Person::players[k]->skeleton.joints[i].position, 0, Person::players[k]->yaw, 0) * Person::players[k]->scale + Person::players[k]->coords - Object::objects[j]->position, 0, -Object::objects[j]->yaw, 0);
size = .4f;
opacity = .4f;
if (k != 0 && tutoriallevel == 1) {
opacity = .2 + .2 * sin(smoketex * 6 + i);
}
- objects.model[j].MakeDecal(shadowdecal, &point, &size, &opacity, &rotation);
+ Object::objects[j]->model.MakeDecal(shadowdecal, &point, &size, &opacity, &rotation);
}
}
}
terrain.MakeDecal(shadowdecal, point, size, opacity * .7, rotation);
for (l = 0; l < terrain.patchobjectnum[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);
+ point = DoRotation(Person::players[k]->coords - Object::objects[j]->position, 0, -Object::objects[j]->yaw, 0);
size = .7;
opacity = .4f;
- objects.model[j].MakeDecal(shadowdecal, &point, &size, &opacity, &rotation);
+ Object::objects[j]->model.MakeDecal(shadowdecal, &point, &size, &opacity, &rotation);
}
}
}
checkpoint.y += 1;
int i = -1;
if (Person::players[k]->occluded != 0)
- i = checkcollide(viewer, checkpoint, Person::players[k]->lastoccluded);
+ i = Object::checkcollide(viewer, checkpoint, Person::players[k]->lastoccluded);
if (i == -1)
- i = checkcollide(viewer, checkpoint);
+ i = Object::checkcollide(viewer, checkpoint);
if (i != -1) {
Person::players[k]->occluded += 1;
Person::players[k]->lastoccluded = i;
glPushMatrix();
glCullFace(GL_BACK);
glEnable(GL_TEXTURE_2D);
- objects.Draw();
+ Object::Draw();
glPopMatrix();
//draw hawk
checkpoint = DoRotation(Person::players[k]->skeleton.joints[fabs(Random() % Person::players[k]->skeleton.joints.size())].position, 0, Person::players[k]->yaw, 0) * Person::players[k]->scale + Person::players[k]->coords;
checkpoint.y += 1;
int i = -1;
- if (Person::players[k]->occluded != 0)
- i = checkcollide(viewer, checkpoint, Person::players[k]->lastoccluded);
- if (i == -1)
- i = checkcollide(viewer, checkpoint);
+ if (Person::players[k]->occluded != 0) {
+ i = Object::checkcollide(viewer, checkpoint, Person::players[k]->lastoccluded);
+ }
+ if (i == -1) {
+ i = Object::checkcollide(viewer, checkpoint);
+ }
if (i != -1) {
Person::players[k]->occluded += 1;
Person::players[k]->lastoccluded = i;
} else {
Person::players[k]->occluded = 0;
}
- if (Person::players[k]->occluded < 25)
+ if (Person::players[k]->occluded < 25) {
Person::players[k]->DrawSkeleton();
+ }
}
}
}
else
bonus_name = "Excellent!"; // When does this happen?
- glColor4f(0, 0, 0, 1 - bonustime);
- text->glPrintOutline(1024 / 2 - 10 * strlen(bonus_name) - 4, 768 / 16 - 4 + 768 * 4 / 5, bonus_name, 1, 2.5, 1024, 768);
- glColor4f(1, 0, 0, 1 - bonustime);
- text->glPrint(1024 / 2 - 10 * strlen(bonus_name), 768 / 16 + 768 * 4 / 5, bonus_name, 1, 2, 1024, 768);
+ text->glPrintOutlined(1, 0, 0, 1 - bonustime, 1024 / 2 - 10 * strlen(bonus_name), 768 / 16 + 768 * 4 / 5, bonus_name, 1, 2, 1024, 768);
string = to_string((int)bonusvalue);
- glColor4f(0, 0, 0, 1 - bonustime);
- text->glPrintOutline(1024 / 2 - 10 * string.size() - 4, 768 / 16 - 4 - 20 + 768 * 4 / 5, string, 1, 2.5 * .8, 1024, 768);
- glColor4f(1, 0, 0, 1 - bonustime);
- text->glPrint(1024 / 2 - 10 * string.size(), 768 / 16 - 20 + 768 * 4 / 5, string, 1, 2 * .8, 1024, 768);
+ text->glPrintOutlined(1, 0, 0, 1 - bonustime, 1024 / 2 - 10 * string.size(), 768 / 16 - 20 + 768 * 4 / 5, string, 1, 2 * .8, 1024, 768);
+
glColor4f(.5, .5, .5, 1);
}
string3 = " ";
}
- glColor4f(0, 0, 0, tutorialopac);
- text->glPrintOutline(screenwidth / 2 - 7.6 * string.size()*screenwidth / 1024 - 4, screenheight / 16 - 4 + screenheight * 4 / 5, string, 1, 1.5 * 1.25 * screenwidth / 1024, screenwidth, screenheight);
- text->glPrintOutline(screenwidth / 2 - 7.6 * string2.size()*screenwidth / 1024 - 4, screenheight / 16 - 4 + screenheight * 4 / 5 - 20 * screenwidth / 1024, string2, 1, 1.5 * 1.25 * screenwidth / 1024, screenwidth, screenheight);
- text->glPrintOutline(screenwidth / 2 - 7.6 * string3.size()*screenwidth / 1024 - 4, screenheight / 16 - 4 + screenheight * 4 / 5 - 40 * screenwidth / 1024, string3, 1, 1.5 * 1.25 * screenwidth / 1024, screenwidth, screenheight);
- glColor4f(1, 1, 1, tutorialopac);
- text->glPrint(screenwidth / 2 - 7.6 * string.size()*screenwidth / 1024, screenheight / 16 + screenheight * 4 / 5, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight);
- text->glPrint(screenwidth / 2 - 7.6 * string2.size()*screenwidth / 1024, screenheight / 16 + screenheight * 4 / 5 - 20 * screenwidth / 1024, string2, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight);
- text->glPrint(screenwidth / 2 - 7.6 * string3.size()*screenwidth / 1024, screenheight / 16 + screenheight * 4 / 5 - 40 * screenwidth / 1024, string3, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight);
+ text->glPrintOutlined(1, 1, 1, tutorialopac, screenwidth / 2 - 7.6 * string.size()*screenwidth / 1024, screenheight / 16 + screenheight * 4 / 5, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight);
+ text->glPrintOutlined(1, 1, 1, tutorialopac, screenwidth / 2 - 7.6 * string2.size()*screenwidth / 1024, screenheight / 16 + screenheight * 4 / 5 - 20 * screenwidth / 1024, string2, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight);
+ text->glPrintOutlined(1, 1, 1, tutorialopac, screenwidth / 2 - 7.6 * string3.size()*screenwidth / 1024, screenheight / 16 + screenheight * 4 / 5 - 40 * screenwidth / 1024, string3, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight);
string = "Press 'tab' to skip to the next item.";
string2 = "Press escape at any time to";
string3 = "pause or exit the tutorial.";
- glColor4f(0, 0, 0, 1);
- text->glPrintOutline(screenwidth / 2 - 7.6 * string.size()*screenwidth / 1024 * .8 - 4, 0 - 4 + screenheight * 1 / 10, string, 1, 1.5 * 1.25 * screenwidth / 1024 * .8, screenwidth, screenheight);
- text->glPrintOutline(screenwidth / 2 - 7.6 * string2.size()*screenwidth / 1024 * .8 - 4, 0 - 4 + screenheight * 1 / 10 - 20 * .8 * screenwidth / 1024, string2, 1, 1.5 * 1.25 * screenwidth / 1024 * .8, screenwidth, screenheight);
- text->glPrintOutline(screenwidth / 2 - 7.6 * string3.size()*screenwidth / 1024 * .8 - 4, 0 - 4 + screenheight * 1 / 10 - 40 * .8 * screenwidth / 1024, string3, 1, 1.5 * 1.25 * screenwidth / 1024 * .8, screenwidth, screenheight);
- glColor4f(0.5, 0.5, 0.5, 1);
- text->glPrint(screenwidth / 2 - 7.6 * string.size()*screenwidth / 1024 * .8, 0 + screenheight * 1 / 10, string, 1, 1.5 * screenwidth / 1024 * .8, screenwidth, screenheight);
- text->glPrint(screenwidth / 2 - 7.6 * string2.size()*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 * string3.size()*screenwidth / 1024 * .8, 0 + screenheight * 1 / 10 - 40 * .8 * screenwidth / 1024, string3, 1, 1.5 * screenwidth / 1024 * .8, screenwidth, screenheight);
+ text->glPrintOutlined(0.5, 0.5, 0.5, 1, screenwidth / 2 - 7.6 * string.size()*screenwidth / 1024 * .8, 0 + screenheight * 1 / 10, string, 1, 1.5 * screenwidth / 1024 * .8, screenwidth, screenheight);
+ text->glPrintOutlined(0.5, 0.5, 0.5, 1, screenwidth / 2 - 7.6 * string2.size()*screenwidth / 1024 * .8, 0 + screenheight * 1 / 10 - 20 * .8 * screenwidth / 1024, string2, 1, 1.5 * screenwidth / 1024 * .8, screenwidth, screenheight);
+ text->glPrintOutlined(0.5, 0.5, 0.5, 1, screenwidth / 2 - 7.6 * string3.size()*screenwidth / 1024 * .8, 0 + screenheight * 1 / 10 - 40 * .8 * screenwidth / 1024, string3, 1, 1.5 * screenwidth / 1024 * .8, screenwidth, screenheight);
}
//Hot spots
int i = 0;
while (!done) {
if (string[i] == '\n' || string[i] > 'z' || string[i] < ' ' || string[i] == '\0') {
- glColor4f(0, 0, 0, tutorialopac);
- text->glPrintOutline(screenwidth / 2 - 7.6 * (i - lastline)*screenwidth / 1024 - 4, screenheight / 16 - 4 + screenheight * 4 / 5 - 20 * screenwidth / 1024 * line, string, 1, 1.5 * 1.25 * screenwidth / 1024, screenwidth, screenheight, lastline, i);
- glColor4f(1, 1, 1, tutorialopac);
- 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);
+ text->glPrintOutlined(1, 1, 1, tutorialopac, 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')
string = std::string(tempname) + ": ";
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 * string.size()*screenwidth / 1024 - 4, starty - 4, string, 1, 1.5 * 1.25 * screenwidth / 1024, screenwidth, screenheight);
- glColor4f(0.7, 0.7, 0.7, tutorialopac);
- text->glPrint(startx - 2 * 7.6 * string.size()*screenwidth / 1024, starty, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight);
+ text->glPrintOutlined(0.7, 0.7, 0.7, tutorialopac, startx - 2 * 7.6 * string.size()*screenwidth / 1024, starty, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight);
} else {
glColor4f(0, 0, 0, tutorialopac);
text->glPrintOutline(startx - 2 * 7.6 * string.size()*screenwidth / 1024 - 4, starty - 4, string, 1, 1.5 * 1.25 * screenwidth / 1024, screenwidth, screenheight);
while (!done) {
if (string[i] == '\n' || string[i] > 'z' || string[i] < ' ' || string[i] == '\0') {
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);
- text->glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/, starty - 20 * screenwidth / 1024 * line, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight, lastline, i);
+ text->glPrintOutlined(1, 1, 1, tutorialopac, startx, starty - 20 * screenwidth / 1024 * line, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight, lastline, i);
} else {
glColor4f(0, 0, 0, tutorialopac);
- text->glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/, starty - 20 * screenwidth / 1024 * line, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight, lastline, i);
+ text->glPrint(startx, starty - 20 * screenwidth / 1024 * line, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight, lastline, i);
}
lastline = i + 1;
line++;
} else {
string = "Score: " + to_string(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);
- text->glPrint(1024 / 40, 768 / 16 + 768 * 14 / 16, string, 1, 1.5, 1024, 768);
+ text->glPrintOutlined(1, 0, 0, 1, 1024 / 40, 768 / 16 + 768 * 14 / 16, string, 1, 1.5, 1024, 768);
if (showdamagebar) {
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
// writing the numbers :
string = "Damages : " + to_string(int(Person::players[0]->damage)) + "/" + to_string(int(Person::players[0]->damagetolerance)) + " (" + to_string(int(Person::players[0]->bloodloss)) + ")";
- glColor4f(0, 0, 0, 1);
- text->glPrintOutline(1024 / 40 - 4, 768 / 16 - 4 + 768 * 14 / 16 - 40, string, 1, 1.5 * 1.25, 1024, 768);
- glColor4f(1, 0, 0, 1);
- text->glPrint(1024 / 40, 768 / 16 + 768 * 14 / 16 - 40, string, 1, 1.5, 1024, 768);
+ text->glPrintOutlined(1, 0, 0, 1, 1024 / 40, 768 / 16 + 768 * 14 / 16 - 40, string, 1, 1.5, 1024, 768);
}
}
glDepthMask(1);
}
- if (!console) {
- displaytime[0] = 0;
- glEnable(GL_TEXTURE_2D);
- glColor4f(1, 1, 1, 1);
- for (unsigned i = 1; i < 15; i++)
- if (displaytime[i] < 4)
- for (unsigned j = 0; j < displaytext[i].size(); j++) {
- glColor4f(1, 1, 1, 4 - displaytime[i]);
- string = std::string(1, displaytext[i][j]);
- text->glPrint(30 + j * 10, 30 + i * 20 + (screenheight - 330), string, 0, 1, screenwidth, screenheight);
- }
- }
-
if (difficulty < 2 && !Dialog::inDialog()) { // minimap
float mapviewdist = 20000;
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 (int i = 0; i < objects.numobjects; i++) {
- if (objects.type[i] == treetrunktype) {
- distcheck = distsq(&Person::players[0]->coords, &objects.position[i]);
+ for (int i = 0; i < Object::objects.size(); i++) {
+ if (Object::objects[i]->type == treetrunktype) {
+ distcheck = distsq(&Person::players[0]->coords, &Object::objects[i]->position);
if (distcheck < mapviewdist) {
Mapcircletexture.bind();
glColor4f(0, .3, 0, opac * (1 - distcheck / mapviewdist));
glPushMatrix();
- glTranslatef(objects.position[i].x / terrain.scale / 256 * -2 + 1, objects.position[i].z / terrain.scale / 256 * 2 - 1, 0);
- glRotatef(objects.yaw[i], 0, 0, 1);
+ glTranslatef(Object::objects[i]->position.x / terrain.scale / 256 * -2 + 1, Object::objects[i]->position.z / terrain.scale / 256 * 2 - 1, 0);
+ glRotatef(Object::objects[i]->yaw, 0, 0, 1);
glScalef(.003, .003, .003);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glPopMatrix();
}
}
- if (objects.type[i] == boxtype) {
- distcheck = distsq(&Person::players[0]->coords, &objects.position[i]);
+ if (Object::objects[i]->type == boxtype) {
+ distcheck = distsq(&Person::players[0]->coords, &Object::objects[i]->position);
if (distcheck < mapviewdist) {
Mapboxtexture.bind();
glColor4f(.4, .4, .4, opac * (1 - distcheck / mapviewdist));
glPushMatrix();
- glTranslatef(objects.position[i].x / terrain.scale / 256 * -2 + 1, objects.position[i].z / terrain.scale / 256 * 2 - 1, 0);
- glRotatef(objects.yaw[i], 0, 0, 1);
- glScalef(.01 * objects.scale[i], .01 * objects.scale[i], .01 * objects.scale[i]);
+ glTranslatef(Object::objects[i]->position.x / terrain.scale / 256 * -2 + 1, Object::objects[i]->position.z / terrain.scale / 256 * 2 - 1, 0);
+ glRotatef(Object::objects[i]->yaw, 0, 0, 1);
+ glScalef(.01 * Object::objects[i]->scale, .01 * Object::objects[i]->scale, .01 * Object::objects[i]->scale);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex3f(-1, -1, 0.0f);
if (consoleblink) {
text->glPrint(30 + (float)(consoleselected) * 10 - offset * 10, 30, "_", 0, 1, 1024, 768);
}
- for (unsigned i = 0; i < 15; i++)
- for (unsigned j = 0; j < consoletext[i].size(); j++) {
- glColor4f(1, 1, 1, 1 - (float)(i) / 16);
- text->glPrint(30 + j * 10 - offset * 10, 30 + i * 20, std::string(1, consoletext[i][j]), 0, 1, 1024, 768);
- }
+ for (unsigned i = 0; i < 15; i++) {
+ text->glPrint(30 - offset * 10, 30 + i * 20, consoletext[i], 0, 1, 1024, 768);
+ }
}
}