Account* Account::get(int i)
{
- if ((i >= 0) && (i < accounts.size())) {
+ if ((i >= 0) && (i < int(accounts.size()))) {
return accounts[i];
} else
return NULL;
int award_awards(int *awards)
{
- int numawards = 0, i;
+ int numawards = 0;
if (damagetaken == 0 && Person::players[0]->bloodloss == 0) {
awards[numawards] = awardflawless;
numawards++;
}
bool alldead = true;
- for (i = 1; i < Person::players.size(); i++) {
+ for (unsigned i = 1; i < Person::players.size(); i++) {
if (Person::players[i]->dead != 2)
alldead = 0;
}
numawards++;
}
alldead = 1;
- for (i = 1; i < Person::players.size(); i++) {
+ for (unsigned i = 1; i < Person::players.size(); i++) {
if (Person::players[i]->dead != 1)
alldead = 0;
}
awards[numawards] = awardacrobat;
numawards++;
}
- if (numthrowkill == Person::players.size() - 1) {
+ if (numthrowkill == (int(Person::players.size()) - 1)) {
awards[numawards] = awardlongrange;
numawards++;
}
alldead = 1;
- for (i = 1; i < Person::players.size(); i++) {
+ for (unsigned i = 1; i < Person::players.size(); i++) {
if (Person::players[i]->dead != 2)
alldead = 0;
}
float displaytime[15] = {};
float displayblinkdelay = 0;
bool displayblink = 0;
-int displayselected = 0;
+unsigned displayselected = 0;
float consoleblinkdelay = 0;
bool consoleblink = 0;
-int consoleselected = 0;
+unsigned consoleselected = 0;
unsigned short crouchkey = 0, jumpkey = 0, forwardkey = 0, backkey = 0, leftkey = 0, rightkey = 0, drawkey = 0, throwkey = 0, attackkey = 0;
unsigned short consolekey = 0;
emit_sound_at(sound);
}
-void Game::inputText(string& str, int* charselected)
+void Game::inputText(string& str, unsigned* charselected)
{
SDL_Event evenement;
extern float displaytime[15];
extern float displayblinkdelay;
extern bool displayblink;
-extern int displayselected;
+extern unsigned displayselected;
extern float consoleblinkdelay;
extern bool consoleblink;
-extern int consoleselected;
+extern unsigned consoleselected;
extern int oldenvironment;
extern int targetlevel;
void fireSound(int sound = fireendsound);
void setKeySelected();
-void inputText(std::string& str, int* charselected);
+void inputText(std::string& str, unsigned* charselected);
void flash();
}
{
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);
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;
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;
+ int i;
if (!Person::players[k]->occluded == 0)
i = checkcollide(viewer, checkpoint, Person::players[k]->lastoccluded);
if (i == -1 || Person::players[k]->occluded == 0)
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;
+ int i;
if (!Person::players[k]->occluded == 0)
i = checkcollide(viewer, checkpoint, Person::players[k]->lastoccluded);
if (i == -1 || Person::players[k]->occluded == 0)
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);
float closestdist = -1;
float distance = 0;
closest = currenthotspot;
- for (i = 0; i < numhotspots; i++) {
+ 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))) {
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);
}
} else if (hotspottype[closest] >= 20 && dialoguegonethrough[hotspottype[closest] - 20] == 0) {
whichdialogue = hotspottype[closest] - 20;
- for (j = 0; j < numdialogueboxes[whichdialogue]; j++) {
+ for (int 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]];
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++) {
+ for (int 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')
}
tempnum = 0;
- for (i = 0; i < (int)strlen(dialoguetext[whichdialogue][indialogue]) + 1; i++) {
+ for (int i = 0; i < (int)strlen(dialoguetext[whichdialogue][indialogue]) + 1; i++) {
tempname[tempnum] = dialoguetext[whichdialogue][indialogue][i];
if (dialoguetext[whichdialogue][indialogue][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) {
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);
float distcheck;
int numliveplayers = 0;
center = 0;
- for (i = 0; i < Person::players.size(); i++) {
+ for (unsigned i = 0; i < Person::players.size(); i++) {
if (!Person::players[i]->dead)
numliveplayers++;
}
int numadd = 0;
- for (i = 0; i < objects.numobjects; i++) {
+ for (int 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++) {
+ for (unsigned i = 0; i < Person::players.size(); i++) {
if (!Person::players[i]->dead)
center += Person::players[i]->coords;
}
float maxdistance = 0;
float tempdist;
//~ int whichclosest;
- for (i = 0; i < objects.numobjects; i++) {
+ for (int 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++) {
+ for (unsigned i = 0; i < Person::players.size(); i++) {
if (!Person::players[i]->dead) {
tempdist = distsq(¢er, &Person::players[i]->coords);
if (tempdist > maxdistance) {
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();
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);
}
glPopMatrix();
}
if (drawmode == radialzoommode) {
- for (i = 0; i < 3; i++) {
+ for (int i = 0; i < 3; i++) {
//glRotatef((float)i*.1,0,0,1);
glColor4f(1, 1, 1, 1 / ((float)i + 1));
glPushMatrix();
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);
}
}
-void doAI(int i)
+void doAI(unsigned i)
{
static bool connected;
if (Person::players[i]->aitype != playercontrolled && indialogue == -1) {
if (Person::players[i]->ally < 0) {
int closest = -1;
float closestdist = -1;
- for (int k = 0; k < weapons.size(); k++)
+ for (unsigned k = 0; k < weapons.size(); k++)
if (weapons[k].owner == -1) {
float distance = distsq(&Person::players[i]->coords, &weapons[k].position);
if (closestdist == -1 || distance < closestdist) {
}
//go for weapon on the ground
if (Person::players[i]->wentforweapon < 3)
- for (int k = 0; k < weapons.size(); k++)
+ for (unsigned k = 0; k < weapons.size(); k++)
if (Person::players[i]->creature != wolftype)
if (Person::players[i]->num_weapons == 0 &&
weapons[k].owner == -1 &&
static int oldmainmenu = mainmenu;
- char sbuf[256];
-
if (Input::MouseClicked() && (selected >= 0)) { // handling of the left mouse clic in menus
set<pair<int,int>>::iterator newscreenresolution;
switch (mainmenu) {
if (talkdelay <= 0 && indialogue == -1 && animation[Person::players[0]->animTarget].height != highheight)
for (int i = 0; i < numdialogues; i++) {
- int realdialoguetype;
+ unsigned realdialoguetype;
bool special;
+ /* FIXME - Seems like modulo done with ifs */
if (dialoguetype[i] > 49) {
realdialoguetype = dialoguetype[i] - 50;
special = 1;
}
if (dialoguetype[whichdialogue] > 49 && dialoguetype[whichdialogue] < 60) {
hostile = 1;
- for (int i = 1; i < Person::players.size(); i++) {
+ for (unsigned i = 1; i < Person::players.size(); i++) {
Person::players[i]->aitype = attacktypecutoff;
}
}
Person::players[i]->isFlip() ||
Person::players[i]->isFlip() ||
Person::players[i]->aitype != playercontrolled)) {
- for (int j = 0; j < weapons.size(); j++) {
+ for (unsigned j = 0; j < weapons.size(); j++) {
if ((weapons[j].velocity.x == 0 && weapons[j].velocity.y == 0 && weapons[j].velocity.z == 0 ||
Person::players[i]->aitype == playercontrolled) &&
weapons[j].owner == -1 &&
Person::players[i]->aitype == playercontrolled) &&
weapons[j].owner == -1 ||
Person::players[i]->victim &&
- weapons[j].owner == Person::players[i]->victim->id)
+ weapons[j].owner == int(Person::players[i]->victim->id))
if (distsqflat(&Person::players[i]->coords, &weapons[j].position) < 2 && Person::players[i]->weaponactive == -1)
if (distsq(&Person::players[i]->coords, &weapons[j].position) < 1 || Person::players[i]->victim) {
if (weapons[j].getType() != staff)
Person::players[i]->throwtogglekeydown = 1;
Person::players[i]->hasvictim = 0;
- for (int k = 0; k < weapons.size(); k++) {
+ for (unsigned k = 0; k < weapons.size(); k++) {
if (Person::players[i]->weaponactive == -1)
if ((weapons[k].velocity.x == 0 && weapons[k].velocity.y == 0 && weapons[k].velocity.z == 0 ||
Person::players[i]->aitype == playercontrolled) &&
weapons[k].owner == -1 ||
Person::players[i]->victim &&
- weapons[k].owner == Person::players[i]->victim->id)
+ weapons[k].owner == int(Person::players[i]->victim->id))
if (distsqflat(&Person::players[i]->coords, &weapons[k].position) < 3 &&
Person::players[i]->weaponactive == -1) {
if (weapons[k].getType() != staff)
winhotspot = true;
int numalarmed = 0;
- for (int i = 1; i < Person::players.size(); i++)
+ for (unsigned i = 1; i < Person::players.size(); i++)
if (!Person::players[i]->dead && Person::players[i]->aitype == attacktypecutoff && Person::players[i]->surprised <= 0)
numalarmed++;
if (numalarmed > maxalarmed)
targetlevel = whichlevel;
}
alldead = true;
- for (int i = 1; i < Person::players.size(); i++) {
+ for (unsigned i = 1; i < Person::players.size(); i++) {
if (!Person::players[i]->dead && Person::players[i]->howactive < typedead1) {
alldead = false;
break;
void SetUpLight(Light* whichsource, int whichlight)
{
static float qattenuation[] = {0.0002f};
- static float cattenuation[] = {1.5f};
- static float lattenuation[] = {0.5f};
- static float zattenuation[] = {0.0f};
//Initialize lights
if (whichlight == 0) {
static int locateOneElement(char *buf)
{
char *ptr;
- char **rc;
- char **i;
DIR *dirp;
//if (PHYSFS_exists(buf))
glEnable(GL_TEXTURE_2D);
}
break;
+ default:
+ case MenuItem::NONE:
+ break;
}
}
}
int Model::SphereCheckPossible(XYZ *p1, float radius, XYZ *move, float *rotate)
{
- static int i, j;
+ static int j;
static float distance;
static float olddistance;
static int intersecting;
void Objects::Draw()
{
static float distance;
- static int i, j;
+ static int i;
static XYZ moved, terrainlight;
bool hidden;
}
victim->weaponactive = -1;
- for (int j = 0; j < Person::players.size(); j++) {
+ for (unsigned j = 0; j < Person::players.size(); j++) {
Person::players[j]->wentforweapon = 0;
}
}
}
victim->weaponactive = -1;
- for (int j = 0; j < Person::players.size(); j++) {
+ for (unsigned j = 0; j < Person::players.size(); j++) {
Person::players[j]->wentforweapon = 0;
}
}
}
victim->weaponactive = -1;
- for (int j = 0; j < Person::players.size(); j++) {
+ for (unsigned j = 0; j < Person::players.size(); j++) {
Person::players[j]->wentforweapon = 0;
}
}
}
victim->weaponactive = -1;
- for (int j = 0; j < Person::players.size(); j++) {
+ for (unsigned j = 0; j < Person::players.size(); j++) {
Person::players[j]->wentforweapon = 0;
}
}
victim->weaponstuck = 0;
}
victim->weaponactive = -1;
- for (int i = 0; i < Person::players.size(); i++) {
+ for (unsigned i = 0; i < Person::players.size(); i++) {
Person::players[i]->wentforweapon = 0;
}
}
weaponstuck = 0;
}
weaponactive = -1;
- for (int i = 0; i < Person::players.size(); i++) {
+ for (unsigned i = 0; i < Person::players.size(); i++) {
Person::players[i]->wentforweapon = 0;
}
skeleton.specialforward[0] = facing;
//skeleton.specialforward[0]=DoRotation(facing,0,yaw,0);
- static int i;
- for (i = 0; i < skeleton.num_muscles; i++) {
+ for (int i = 0; i < skeleton.num_muscles; i++) {
if (skeleton.muscles[i].visible && (skeleton.muscles[i].parent1->label == head || skeleton.muscles[i].parent2->label == head)) {
skeleton.FindRotationMuscle(i, animTarget);
}
if (!isnormal(tilt)) tilt = 0;
if (!isnormal(tilt2)) tilt2 = 0;
- for (i = 0; i < skeleton.num_joints; i++) {
+ for (int i = 0; i < skeleton.num_joints; i++) {
skeleton.joints[i].delay = 0;
skeleton.joints[i].locked = 0;
skeleton.joints[i].position = DoRotation(DoRotation(DoRotation(skeleton.joints[i].position, 0, 0, tilt), tilt2, 0, 0), 0, yaw, 0);
skeleton.joints[i].realoldposition = skeleton.joints[i].position * scale + coords;
}
- for (i = 0; i < skeleton.num_joints; i++) {
+ for (int i = 0; i < skeleton.num_joints; i++) {
skeleton.joints[i].velocity = 0;
skeleton.joints[i].velchange = 0;
}
speed *= speedmult;
- for (i = 0; i < skeleton.num_joints; i++) {
+ for (int i = 0; i < skeleton.num_joints; i++) {
if ((animation[animCurrent].attack != reversed || animCurrent == swordslashreversedanim) && animCurrent != rabbitkickanim && !isLanding() && !wasLanding() && animation[animCurrent].height == animation[animTarget].height)
skeleton.joints[i].velocity = velocity / scale + facing * 5 + DoRotation(DoRotation(DoRotation((animation[animTarget].position[i][frameTarget] - animation[animCurrent].position[i][frameCurrent]) * speed, 0, 0, tilt), tilt2, 0, 0), 0, yaw, 0);
else
updatedelay = 0;
velocity = 0;
- for (i = 0; i < skeleton.num_joints; i++) {
+ for (int i = 0; i < skeleton.num_joints; i++) {
velocity += skeleton.joints[i].velocity * scale;
}
velocity /= skeleton.num_joints;
weaponstuck = 0;
}
weaponactive = -1;
- for (i = 0; i < Person::players.size(); i++) {
+ for (unsigned i = 0; i < Person::players.size(); i++) {
Person::players[i]->wentforweapon = 0;
}
}
void Person::DoAnimations()
{
if (!skeleton.free) {
- int i = 0;
static float oldtarget;
if (isIdle() && animCurrent != getIdle())
}
if (animation[animTarget].label[frameTarget] == 4 && (weaponactive == -1 || (animTarget != knifeslashstartanim && animTarget != knifethrowanim && animTarget != crouchstabanim && animTarget != swordgroundstabanim && animTarget != knifefollowanim))) {
if (animation[animTarget].attack != neutral) {
- i = abs(Random() % 3);
- if (i == 0)
+ unsigned r = abs(Random() % 3);
+ if (r == 0)
whichsound = lowwhooshsound;
- if (i == 1)
+ if (r == 1)
whichsound = midwhooshsound;
- if (i == 2)
+ if (r == 2)
whichsound = highwhooshsound;
}
if (animation[animTarget].attack == neutral)
int whichsound = -1;
if (animation[animTarget].label[frameTarget] == 4 && aitype != playercontrolled) {
if (animation[animTarget].attack != neutral) {
- i = abs(Random() % 4);
+ unsigned r = abs(Random() % 4);
if (creature == rabbittype) {
- if (i == 0) whichsound = rabbitattacksound;
- if (i == 1) whichsound = rabbitattack2sound;
- if (i == 2) whichsound = rabbitattack3sound;
- if (i == 3) whichsound = rabbitattack4sound;
+ if (r == 0) whichsound = rabbitattacksound;
+ if (r == 1) whichsound = rabbitattack2sound;
+ if (r == 2) whichsound = rabbitattack3sound;
+ if (r == 3) whichsound = rabbitattack4sound;
}
if (creature == wolftype) {
- if (i == 0) whichsound = barksound;
- if (i == 1) whichsound = bark2sound;
- if (i == 2) whichsound = bark3sound;
- if (i == 3) whichsound = barkgrowlsound;
+ if (r == 0) whichsound = barksound;
+ if (r == 1) whichsound = bark2sound;
+ if (r == 2) whichsound = bark3sound;
+ if (r == 3) whichsound = barkgrowlsound;
}
speechdelay = .3;
}
frameTarget++;
if (animTarget == removeknifeanim && animation[animTarget].label[frameCurrent] == 5) {
- for (i = 0; i < weapons.size(); i++) {
+ for (unsigned i = 0; i < weapons.size(); i++) {
if (weapons[i].owner == -1)
if (distsqflat(&coords, &weapons[i].position) < 4 && weaponactive == -1) {
if (distsq(&coords, &weapons[i].position) >= 1) {
}
if (animTarget == crouchremoveknifeanim && animation[animTarget].label[frameCurrent] == 5) {
- for (i = 0; i < weapons.size(); i++) {
+ for (unsigned i = 0; i < weapons.size(); i++) {
bool willwork = true;
if (weapons[i].owner != -1)
if (Person::players[weapons[i].owner]->weaponstuck != -1)
- if (Person::players[weapons[i].owner]->weaponids[Person::players[weapons[i].owner]->weaponstuck] == i)
+ if (Person::players[weapons[i].owner]->weaponids[Person::players[weapons[i].owner]->weaponstuck] == int(i))
if (Person::players[weapons[i].owner]->num_weapons > 1)
willwork = 0;
- if ((weapons[i].owner == -1) || (hasvictim && weapons[i].owner == victim->id && victim->skeleton.free))
+ if ((weapons[i].owner == -1) || (hasvictim && (weapons[i].owner == int(victim->id)) && victim->skeleton.free))
if (willwork && distsqflat(&coords, &weapons[i].position) < 3 && weaponactive == -1) {
if (distsq(&coords, &weapons[i].position) < 1 || hasvictim) {
bool fleshstuck = false;
if (weapons[i].owner != -1)
if (victim->weaponstuck != -1) {
- if (victim->weaponids[victim->weaponstuck] == i) {
+ if (victim->weaponids[victim->weaponstuck] == int(i)) {
fleshstuck = true;
}
}
footvel = 0;
footpoint = weapons[i].position;
if (victim->weaponstuck != -1) {
- if (victim->weaponids[victim->weaponstuck] == i) {
+ if (victim->weaponids[victim->weaponstuck] == int(i)) {
if (bloodtoggle)
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .8, .3);
weapons[i].bloody = 2;
if (victim->num_weapons > 0) {
if (victim->weaponstuck != 0 && victim->weaponstuck != -1)
victim->weaponstuck = 0;
- if (victim->weaponids[0] == i)
+ if (victim->weaponids[0] == int(i))
victim->weaponids[0] = victim->weaponids[victim->num_weapons];
}
targetloc = velocity;
Normalise(&targetloc);
targetloc += coords;
- for (i = 0; i < Person::players.size(); i++) {
+ for (unsigned i = 0; i < Person::players.size(); i++) {
if (i != id)
if (distsq(&targetloc, &Person::players[i]->coords) < closestdist || closestdist == 0) {
closestdist = distsq(&targetloc, &Person::players[i]->coords);
relative.y = 0;
Normalise(&relative);
relative = DoRotation(relative, 0, -90, 0);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
victim->jointVel(head) += relative * damagemult * 200;
relative.y -= 1;
Normalise(&relative);
relative = DoRotation(relative, 0, 90, 0);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 20;
}
victim->jointVel(head) += relative * damagemult * 100;
relative.y = 0;
Normalise(&relative);
relative = DoRotation(relative, 0, -90, 0);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
victim->jointVel(head) += relative * damagemult * 200;
relative.y = 0;
Normalise(&relative);
relative = DoRotation(relative, 0, 90, 0);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
victim->jointVel(head) += relative * damagemult * 200;
relative = victim->coords - coords;
relative.y = 0;
Normalise(&relative);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 30;
}
victim->jointVel(head) += relative * damagemult * 100;
victim->skeleton.broken = 0;
victim->skeleton.spinny = 1;
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velchange = 0;
victim->skeleton.joints[i].delay = 0;
victim->skeleton.joints[i].locked = 0;
relative = 0;
relative.y = 1;
Normalise(&relative);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity.y = relative.y * 10;
victim->skeleton.joints[i].position.y += relative.y * .3;
victim->skeleton.joints[i].oldposition.y += relative.y * .3;
relative = victim->coords - coords;
relative.y = 0;
Normalise(&relative);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 90;
}
victim->Puff(abdomen);
victim->skeleton.broken = 0;
victim->skeleton.spinny = 1;
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velchange = 0;
//victim->skeleton.joints[i].delay=0;
victim->skeleton.joints[i].locked = 0;
Normalise(&relative);
relative.y += .3;
Normalise(&relative);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 20;
}
if (!victim->dead)
victim->skeleton.free = 1;
victim->skeleton.broken = 0;
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velchange = 0;
victim->skeleton.joints[i].locked = 0;
//victim->skeleton.joints[i].velocity=0;
victim->skeleton.free = 1;
victim->skeleton.broken = 0;
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velchange = 0;
victim->skeleton.joints[i].locked = 0;
//victim->skeleton.joints[i].velocity=0;
relative = victim->coords - coords;
relative.y = 0;
Normalise(&relative);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity = relative * 30;
}
victim->jointVel(head) += relative * damagemult * 150;
Normalise(&relative);
relative.y = .3;
Normalise(&relative);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity = relative * 5;
}
victim->jointVel(abdomen) += relative * damagemult * 400;
victim->weaponstuck = 0;
}
victim->weaponactive = -1;
- for (i = 0; i < Person::players.size(); i++) {
+ for (unsigned i = 0; i < Person::players.size(); i++) {
Person::players[i]->wentforweapon = 0;
}
relative = DoRotation(relative, 0, 90, 0);
relative.y -= 1;
Normalise(&relative);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 60;
}
victim->jointVel(head) += relative * damagemult * 230;
relative.y = 0;
Normalise(&relative);
relative = DoRotation(relative, 0, -90, 0);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
victim->jointVel(head) += relative * damagemult * 220;
victim->skeleton.free = 1;
victim->skeleton.broken = 0;
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velchange = 0;
victim->skeleton.joints[i].locked = 0;
//victim->skeleton.joints[i].velocity=0;
relative.y = -1;
Normalise(&relative);
if (!victim->dead) {
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity = relative * damagemult * 40;
}
//FootLand(1,2);
victim->jointVel(abdomen) += relative * damagemult * 40;
}
if (victim->dead) {
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity = relative * damagemult * abs(Random() % 20);
}
//FootLand(1,2);
DoBlood(.2, 250);
}
victim->RagDoll(0);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
victim->jointVel(head) += relative * damagemult * 200;
} else {
if (victim->damage >= victim->damagetolerance)
victim->RagDoll(0);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 10;
}
victim->jointVel(abdomen) += relative * damagemult * 200;
if (animation[victim->animTarget].height == middleheight || animation[victim->animCurrent].height == middleheight || victim->damage >= victim->damagetolerance - 40) {
victim->RagDoll(0);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 15;
}
relative = DoRotation(relative, 0, -90, 0);
relative.y += .1;
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
if (victim->skeleton.joints[i].label == leftfoot || victim->skeleton.joints[i].label == rightfoot || victim->skeleton.joints[i].label == leftankle || victim->skeleton.joints[i].label == rightankle)
victim->skeleton.joints[i].velocity = relative * 80;
}
} else {
if (victim->damage >= victim->damagetolerance)
victim->RagDoll(0);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 10;
}
relative = DoRotation(relative, 0, -90, 0);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
if (victim->skeleton.joints[i].label == leftfoot || victim->skeleton.joints[i].label == rightfoot || victim->skeleton.joints[i].label == leftankle || victim->skeleton.joints[i].label == rightankle)
victim->skeleton.joints[i].velocity += relative * damagemult * 80;
}
relative.y = 0;
Normalise(&relative);
//relative=DoRotation(relative,0,-90,0);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
victim->jointVel(abdomen) += relative * damagemult * 200;
if ((animTarget == swordslashreversalanim || animTarget == knifeslashreversalanim || animTarget == staffhitreversalanim || animTarget == staffspinhitreversalanim) && animation[animTarget].label[frameCurrent] == 5) {
if (victim->weaponactive != -1 && victim->num_weapons > 0) {
- if (weapons[victim->weaponids[victim->weaponactive]].owner == victim->id) {
+ if (weapons[victim->weaponids[victim->weaponactive]].owner == int(victim->id)) {
weapons[victim->weaponids[victim->weaponactive]].owner = id;
weaponactive = 0;
if (num_weapons > 0) {
relative.y = 0;
Normalise(&relative);
//relative=DoRotation(relative,0,-90,0);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 30;
}
victim->jointVel(abdomen) += relative * damagemult * 200;
relative.y = 0;
Normalise(&relative);
//relative=DoRotation(relative,0,-90,0);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 30;
}
victim->jointVel(abdomen) += relative * damagemult * 200;
Normalise(&relative);
//relative*=-1;
relative.y -= .1;
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 70;
}
victim->jointVel(lefthand) *= .1;
Normalise(&relative);
//relative*=-1;
relative.y -= .1;
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 70;
}
victim->jointVel(lefthand) *= .1 - 1;
relative.y = 0;
Normalise(&relative);
relative = DoRotation(relative, 0, -90, 0);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
victim->jointVel(abdomen) += relative * damagemult * 200;
Normalise(&relative);
if (victim->id == 0)
relative /= 30;
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
//victim->DoDamage(1000);
if (hasvictim && (animTarget == knifefollowanim || animTarget == knifesneakattackanim) && animation[animTarget].label[frameCurrent] == 6) {
escapednum = 0;
victim->velocity = 0;
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity = 0;
}
if (animTarget == knifefollowanim) {
victim->RagDoll(0);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity = 0;
}
}
if (hasvictim && animTarget == swordsneakattackanim && animation[animTarget].label[frameCurrent] == 6) {
escapednum = 0;
victim->velocity = 0;
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity = 0;
}
if (weaponactive != -1) {
relative = DoRotation(relative, 0, 90, 0);
relative.y = .5;
Normalise(&relative);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 20;
}
victim->jointVel(head) += relative * damagemult * 200;
relative = DoRotation(relative, 0, 90, 0);
relative.y = .5;
Normalise(&relative);
- for (i = 0; i < victim->skeleton.num_joints; i++) {
+ for (int i = 0; i < victim->skeleton.num_joints; i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 20;
}
victim->jointVel(head) += relative * damagemult * 200;
float closestdist = -1;
float distance;
if (Person::players.size() > 1)
- for (i = 0; i < Person::players.size(); i++) {
+ for (unsigned i = 0; i < Person::players.size(); i++) {
if (id != i && Person::players[i]->coords.y < coords.y && !Person::players[i]->skeleton.free) {
distance = distsq(&Person::players[i]->coords, &coords);
if (closestdist == -1 || distance < closestdist) {
float closestdist = -1;
float distance;
if (Person::players.size() > 1)
- for (i = 0; i < Person::players.size(); i++) {
+ for (unsigned i = 0; i < Person::players.size(); i++) {
if (id != i && Person::players[i]->coords.y < coords.y && !Person::players[i]->skeleton.free) {
distance = distsq(&Person::players[i]->coords, &coords);
if (closestdist == -1 || distance < closestdist) {
}
if (animCurrent != oldanimCurrent || animTarget != oldanimTarget || ((frameCurrent != oldframeCurrent || frameTarget != oldframeTarget) && !calcrot)) {
//Old rotates
- for (i = 0; i < skeleton.num_joints; i++) {
+ for (int i = 0; i < skeleton.num_joints; i++) {
skeleton.joints[i].position = animation[animCurrent].position[i][frameCurrent];
}
skeleton.FindForwards();
- for (i = 0; i < skeleton.num_muscles; i++) {
+ for (int i = 0; i < skeleton.num_muscles; i++) {
if (skeleton.muscles[i].visible) {
skeleton.FindRotationMuscle(i, animTarget);
}
}
- for (i = 0; i < skeleton.num_muscles; i++) {
+ for (int i = 0; i < skeleton.num_muscles; i++) {
if (skeleton.muscles[i].visible) {
if (isnormal((float)((int)(skeleton.muscles[i].rotate1 * 100) % 36000) / 100))
skeleton.muscles[i].oldrotate1 = (float)((int)(skeleton.muscles[i].rotate1 * 100) % 36000) / 100;
}
//New rotates
- for (i = 0; i < skeleton.num_joints; i++) {
+ for (int i = 0; i < skeleton.num_joints; i++) {
skeleton.joints[i].position = animation[animTarget].position[i][frameTarget];
}
skeleton.FindForwards();
- for (i = 0; i < skeleton.num_muscles; i++) {
+ for (int i = 0; i < skeleton.num_muscles; i++) {
if (skeleton.muscles[i].visible) {
skeleton.FindRotationMuscle(i, animTarget);
}
}
- for (i = 0; i < skeleton.num_muscles; i++) {
+ for (int i = 0; i < skeleton.num_muscles; i++) {
if (skeleton.muscles[i].visible) {
if (isnormal((float)((int)(skeleton.muscles[i].rotate1 * 100) % 36000) / 100))
skeleton.muscles[i].newrotate1 = (float)((int)(skeleton.muscles[i].rotate1 * 100) % 36000) / 100;
oldframeTarget = frameTarget;
oldframeCurrent = frameCurrent;
- for (i = 0; i < skeleton.num_joints; i++) {
+ for (int i = 0; i < skeleton.num_joints; i++) {
skeleton.joints[i].velocity = (animation[animCurrent].position[i][frameCurrent] * (1 - target) + animation[animTarget].position[i][frameTarget] * (target) - skeleton.joints[i].position) / multiplier;
skeleton.joints[i].position = animation[animCurrent].position[i][frameCurrent] * (1 - target) + animation[animTarget].position[i][frameTarget] * (target);
}
offset = currentoffset * (1 - target) + targetoffset * target;
- for (i = 0; i < skeleton.num_muscles; i++) {
+ for (int i = 0; i < skeleton.num_muscles; i++) {
if (skeleton.muscles[i].visible) {
skeleton.muscles[i].rotate1 = skeleton.muscles[i].oldrotate1 * (1 - target) + skeleton.muscles[i].newrotate1 * (target);
skeleton.muscles[i].rotate2 = skeleton.muscles[i].oldrotate2 * (1 - target) + skeleton.muscles[i].newrotate2 * (target);
weaponstuck = 0;
}
weaponactive = -1;
- for (i = 0; i < Person::players.size(); i++) {
+ for (unsigned i = 0; i < Person::players.size(); i++) {
Person::players[i]->wentforweapon = 0;
}
}
dead = 2;
if (animTarget == knifefollowedanim && !skeleton.free) {
- for (i = 0; i < skeleton.num_joints; i++) {
+ for (int i = 0; i < skeleton.num_joints; i++) {
skeleton.joints[i].velocity = 0;
skeleton.joints[i].velocity.y = -2;
}
weaponstuck = 0;
}
weaponactive = -1;
- for (i = 0; i < Person::players.size(); i++) {
+ for (unsigned i = 0; i < Person::players.size(); i++) {
Person::players[i]->wentforweapon = 0;
}
}
dead = 0;
skeleton.free = 1;
damage -= 20;
- for (i = 0; i < skeleton.num_joints; i++) {
+ for (int i = 0; i < skeleton.num_joints; i++) {
skeleton.joints[i].velocity = 0;
}
}
weaponstuck = 0;
}
weaponactive = -1;
- for (i = 0; i < Person::players.size(); i++) {
+ for (unsigned i = 0; i < Person::players.size(); i++) {
Person::players[i]->wentforweapon = 0;
}
}
//velocity=jointVel(groin)*scale;
velocity = 0;
- for (i = 0; i < skeleton.num_joints; i++) {
+ for (int i = 0; i < skeleton.num_joints; i++) {
velocity += skeleton.joints[i].velocity * scale;
}
velocity /= skeleton.num_joints;
//if(middle.y>0)targetoffset.y=middle.y+1;
- for (i = 0; i < skeleton.num_joints; i++) {
+ for (int i = 0; i < skeleton.num_joints; i++) {
tempanimation.position[i][0] = skeleton.joints[i].position;
tempanimation.position[i][0] = DoRotation(tempanimation.position[i][0], 0, -yaw, 0);
}
if (middle.y > 0 && animTarget != rollanim)
targetoffset.y = middle.y + 1;
- for (i = 0; i < skeleton.num_joints; i++) {
+ for (int i = 0; i < skeleton.num_joints; i++) {
tempanimation.position[i][0] = skeleton.joints[i].position;
tempanimation.position[i][0] = DoRotation(tempanimation.position[i][0], 0, -yaw, 0);
}
skeleton.drawmodelclothes.vertex[i] = 0;
skeleton.drawmodelclothes.vertex[i].y = 999;
}
- for (i = 0; i < skeleton.num_muscles; i++) {
+ for (int i = 0; i < skeleton.num_muscles; i++) {
// convenience renames
const int p1 = skeleton.muscles[i].parent1->label;
const int p2 = skeleton.muscles[i].parent2->label;
int creature;
- int id;
+ unsigned id;
Skeleton skeleton;
bool LineFacet(Vector p1, Vector p2, Vector pa, Vector pb, Vector pc, Vector *p)
{
static float d;
- static float a1, a2, a3;
- static float total, denom, mu;
+ static float denom, mu;
static Vector n, pa1, pa2, pa3;
//Calculate the parameters for the plane
bool LineFacet(XYZ p1, XYZ p2, XYZ pa, XYZ pb, XYZ pc, XYZ *p)
{
static float d;
- static float a1, a2, a3;
- static float total, denom, mu;
+ static float denom, mu;
static XYZ n, pa1, pa2, pa3;
//Calculate the parameters for the plane
float LineFacetd(XYZ p1, XYZ p2, XYZ pa, XYZ pb, XYZ pc, XYZ *p)
{
static float d;
- static float a1, a2, a3;
- static float total, denom, mu;
+ static float denom, mu;
static XYZ n, pa1, pa2, pa3;
//Calculate the parameters for the plane
float LineFacetd(XYZ p1, XYZ p2, XYZ pa, XYZ pb, XYZ pc, XYZ n, XYZ *p)
{
static float d;
- static float a1, a2, a3;
- static float total, denom, mu;
+ static float denom, mu;
static XYZ pa1, pa2, pa3;
//Calculate the parameters for the plane
float LineFacetd(XYZ *p1, XYZ *p2, XYZ *pa, XYZ *pb, XYZ *pc, XYZ *p)
{
static float d;
- static float a1, a2, a3;
- static float total, denom, mu;
+ static float denom, mu;
static XYZ pa1, pa2, pa3, n;
//Calculate the parameters for the plane
float LineFacetd(XYZ *p1, XYZ *p2, XYZ *pa, XYZ *pb, XYZ *pc, XYZ *n, XYZ *p)
{
static float d;
- static float a1, a2, a3;
- static float total, denom, mu;
+ static float denom, mu;
static XYZ pa1, pa2, pa3;
//Calculate the parameters for the plane
#ifndef _QUATERNIONS_H_
#define _QUATERNIONS_H_
-#ifndef WIN32
-#pragma mark -
-#endif
-
-//#include "Carbon.h"
#include "math.h"
#include "PhysicsMath.h"
#include "gamegl.h"
XYZ bounceness;
const int numrepeats = 3;
float groundlevel = .15;
- int i, j, k, l, m;
+ int i, j, k, m;
XYZ temp;
XYZ terrainnormal;
int whichhit;
int parentID;
FILE *tfile;
float lSize;
- int i, j, tempmuscle;
-
- int newload;
+ int i, j;
int edit;
LOGFUNC;
-
- newload = 0;
-
num_models = 7;
// load various models
}
// read num_muscles
- tempmuscle = num_muscles;
funpackf(tfile, "Bi", &num_muscles);
// allocate memory
delete [] muscles; //dealloc2(muscles);
muscles = (Muscle*)new Muscle[num_muscles]; //malloc(sizeof(Muscle)*num_muscles);
- newload = 1;
-
// for each muscle...
for (i = 0; i < num_muscles; i++) {
// read info
- tempmuscle = muscles[i].numvertices;
funpackf(tfile, "Bf Bf Bf Bf Bf Bi Bi", &muscles[i].length, &muscles[i].targetlength, &muscles[i].minlength, &muscles[i].maxlength, &muscles[i].strength, &muscles[i].type, &muscles[i].numvertices);
// allocate memory for vertices
fseek(tfile, lSize, SEEK_CUR);
// read numverticeslow
- tempmuscle = muscles[i].numverticeslow;
funpackf(tfile, "Bi", &muscles[i].numverticeslow);
if (muscles[i].numverticeslow) {
fseek(tfile, lSize, SEEK_CUR);
// read numverticesclothes
- tempmuscle = muscles[i].numverticesclothes;
funpackf(tfile, "Bi", &muscles[i].numverticesclothes);
// read verticesclothes
//Functions
void Sprite::Draw()
{
- int i, j, k;
+ int k;
static float M[16];
static XYZ point;
static float distancemult;
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(0);
glAlphaFunc(GL_GREATER, 0.0001);
- for (i = 0; i < sprites.size(); i++) {
+ for (unsigned i = 0; i < sprites.size(); i++) {
if (lasttype != sprites[i]->type) {
switch (sprites[i]->type) {
case cloudsprite:
glPopMatrix();
}
tempmult = multiplier;
- for (i = sprites.size() - 1; i >= 0; i--) {
+ for (unsigned i = sprites.size() - 1; i >= 0; i--) {
multiplier = tempmult;
if (sprites[i]->type != snowsprite) {
sprites[i]->position += sprites[i]->velocity * multiplier;
float rotationpoint;
int whichtri;
- for (j = 0; j < Person::players.size(); j++) {
+ for (unsigned j = 0; j < Person::players.size(); j++) {
if (!spritehit && Person::players[j]->dead && sprites[i]->alivetime > .1) {
where = sprites[i]->oldposition;
where -= Person::players[j]->coords;
if (whichpatchx > 0 && whichpatchz > 0 && whichpatchx < subdivision && whichpatchz < subdivision)
if (terrain.patchobjectnum[whichpatchx][whichpatchz]) {
if (!spritehit)
- for (j = 0; j < terrain.patchobjectnum[whichpatchx][whichpatchz]; j++) {
+ for (int j = 0; j < terrain.patchobjectnum[whichpatchx][whichpatchz]; j++) {
k = terrain.patchobjects[whichpatchx][whichpatchz][j];
start = sprites[i]->oldposition;
end = sprites[i]->position;
DeleteSprite(i);
}
if (check)
- for (i = sprites.size() - 1; i >= 0; i--) {
+ for (unsigned i = sprites.size() - 1; i >= 0; i--) {
sprites[i]->oldposition = sprites[i]->position;
}
glAlphaFunc(GL_GREATER, 0.0001);
void InitStereo(StereoMode mode)
{
switch (mode) {
+ default:
case stereoNone:
- glDisable( GL_STENCIL_TEST);
- return;
case stereoAnaglyph:
- glDisable( GL_STENCIL_TEST);
+ glDisable(GL_STENCIL_TEST);
return;
case stereoHorizontalInterlaced:
case stereoVerticalInterlaced:
-
fprintf(stderr, "Screen width is %i, height is %i\n", kContextWidth, kContextHeight);
// Setup stencil buffer
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_TEXTURE_2D);
-
}
}
return "(error)";
break;
}
-}
\ No newline at end of file
+}
static int firstintersecting;
static XYZ point;
static int startx, starty;
- static float slope;
static int endx, endy;
- static int numtris = (size - 1) * (size - 1) * 2;
static float highest, lowest;
firstintersecting = -1;
{
static XYZ vertex;
static int i, j, a, b, c, d, patch_size, stepsize;
- static float distance;
patch_size = size / subdivision;
float Terrain::getHeight(float pointx, float pointz)
{
- static float height1, height2;
static int tilex, tiley;
static XYZ startpoint, endpoint, intersect, triangle[3], average;
float Terrain::getHeightExtrude(float pointx, float pointz, float point2x, float point2z)
{
- static float height1, height2;
static int tilex, tiley;
static XYZ startpoint, endpoint, intersect, triangle[3], average;
void Terrain::drawdecals()
{
if (decals) {
- static int i, j;
+ static int i;
static float distancemult;
static int lasttype;
- static float patch_size = size / subdivision * scale;
static float viewdistsquared;
static bool blend;
void Text::LoadFontTexture(const char *fileName)
{
- GLuint type;
-
LOGFUNC;
LOG(std::string("Loading font texture...") + fileName);
}
if (velocity.x || velocity.y || velocity.z) {
- for (int j = 0; j < Person::players.size(); j++) {
+ for (unsigned j = 0; j < Person::players.size(); j++) {
footvel = 0;
footpoint = DoRotation((Person::players[j]->jointPos(abdomen) + Person::players[j]->jointPos(neck)) / 2, 0, Person::players[j]->yaw, 0) * Person::players[j]->scale + Person::players[j]->coords;
if (owner == -1 && distsqflat(&position, &Person::players[j]->coords) < 1.5 &&
distsq(&position, &Person::players[j]->coords) < 4 && Person::players[j]->weaponstuck == -1 &&
- !Person::players[j]->skeleton.free && j != oldowner) {
+ !Person::players[j]->skeleton.free && (int(j) != oldowner)) {
if ((Person::players[j]->aitype != attacktypecutoff || abs(Random() % 6) == 0 || (Person::players[j]->animTarget != backhandspringanim && Person::players[j]->animTarget != rollanim && Person::players[j]->animTarget != flipanim && Random() % 2 == 0)) && !missed) {
if ( (Person::players[j]->creature == wolftype && Random() % 3 != 0 && Person::players[j]->weaponactive == -1 && (Person::players[j]->isIdle() || Person::players[j]->isRun() || Person::players[j]->animTarget == walkanim)) ||
(Person::players[j]->creature == rabbittype && Random() % 2 == 0 && Person::players[j]->aitype == attacktypecutoff && Person::players[j]->weaponactive == -1)) {