From: Côme Chilliet Date: Wed, 23 Nov 2016 17:12:27 +0000 (+0800) Subject: Removed most of the commented out code X-Git-Url: https://git.jsancho.org/?p=lugaru.git;a=commitdiff_plain;h=6c36b920245ca8b1e3d9aaede5f9d2a6210538a1 Removed most of the commented out code --- diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index af0eb18..213d894 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -262,7 +262,6 @@ int Game::DrawGLScene(StereoSide side) glDrawBuffer(GL_BACK); glReadBuffer(GL_BACK); - //glFinish(); static XYZ terrainlight; static float distance; if (drawmode == normalmode) @@ -416,9 +415,6 @@ int Game::DrawGLScene(StereoSide side) 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(); @@ -1680,7 +1676,6 @@ int Game::DrawGLScene(StereoSide side) text->glPrint(1024 / 2 - 90, 768 / 2, string, 1, 2, 1024, 768); } loading = 2; - //if(ismotionblur)drawmode=motionblurmode; drawmode = normalmode; } @@ -1767,7 +1762,6 @@ int Game::DrawGLScene(StereoSide side) 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); @@ -1795,7 +1789,6 @@ int Game::DrawGLScene(StereoSide side) glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0); } } - //glFlush(); } glClear(GL_DEPTH_BUFFER_BIT); @@ -1832,7 +1825,6 @@ int Game::DrawGLScene(StereoSide side) 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); @@ -1981,7 +1973,6 @@ int Game::DrawGLScene(StereoSide side) } 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); @@ -2043,17 +2034,14 @@ int Game::DrawGLScene(StereoSide side) 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(); @@ -2175,7 +2163,6 @@ void DrawMenu() glColor4f(1, 1, 1, 1); Game::cursortexture.bind(); glPushMatrix(); - //glScalef(.25,.25,.25); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f(-1, -1, 0.0f); diff --git a/Source/GameInitDispose.cpp b/Source/GameInitDispose.cpp index c19db02..b60f34d 100644 --- a/Source/GameInitDispose.cpp +++ b/Source/GameInitDispose.cpp @@ -214,7 +214,6 @@ GLvoid Game::ReSizeGLScene(float fov, float pnear) void Game::LoadingScreen() { static float loadprogress; - //~ static AbsoluteTime time = {0, 0}; static AbsoluteTime frametime = {0, 0}; AbsoluteTime currTime = UpTime (); double deltaTime = (float) AbsoluteDeltaToDuration (currTime, frametime); @@ -244,8 +243,6 @@ void Game::LoadingScreen() if (loadprogress > 100) loadprogress = 100; - //loadprogress=abs(Random()%100); - //Background glEnable(GL_TEXTURE_2D); @@ -269,7 +266,6 @@ void Game::LoadingScreen() glDisable(GL_BLEND); glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, 1); glPushMatrix(); - //glScalef(.25,.25,.25); glBegin(GL_QUADS); glTexCoord2f(.1 - loadprogress / 100, 0 + loadprogress / 100 + .3); glVertex3f(-1, -1, 0.0f); @@ -283,7 +279,6 @@ void Game::LoadingScreen() glPopMatrix(); glEnable(GL_BLEND); glPushMatrix(); - //glScalef(.25,.25,.25); glBegin(GL_QUADS); glTexCoord2f(.4 + loadprogress / 100, 0 + loadprogress / 100); glVertex3f(-1, -1, 0.0f); @@ -322,10 +317,8 @@ void Game::LoadingScreen() glScalef((float)screenwidth / 2 * (1.5 - (loadprogress) / 200), (float)screenheight / 2 * (1.5 - (loadprogress) / 200), 1); glBlendFunc(GL_SRC_ALPHA, GL_ONE); glEnable(GL_BLEND); - //glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1); glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, 1); glPushMatrix(); - //glScalef(.25,.25,.25); glBegin(GL_QUADS); glTexCoord2f(0 + .5, 0 + .5); glVertex3f(-1, -1, 0.0f); @@ -366,7 +359,6 @@ void Game::LoadingScreen() glEnable(GL_BLEND); glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, .4); glPushMatrix(); - //glScalef(.25,.25,.25); glBegin(GL_QUADS); glTexCoord2f(0 + .2, 0 + .8); glVertex3f(-1, -1, 0.0f); @@ -443,13 +435,9 @@ void FadeLoadingScreen(float howmuch) loadprogress = howmuch; - //loadprogress=abs(Random()%100); - //Background - //glEnable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D); - //glBindTexture( GL_TEXTURE_2D, loadscreentexture); glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); glDisable(GL_DEPTH_TEST); @@ -469,7 +457,6 @@ void FadeLoadingScreen(float howmuch) glDisable(GL_BLEND); glColor4f(loadprogress / 100, 0, 0, 1); glPushMatrix(); - //glScalef(.25,.25,.25); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f(-1, -1, 0.0f); diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 8a7a54e..beb1733 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -1428,8 +1428,6 @@ int Game::checkcollide(XYZ startpoint, XYZ endpoint) } } - //if(terrain.lineTerrain(startpoint,endpoint,&colpoint)!=-1)return 1000; - return -1; } @@ -1729,9 +1727,6 @@ void Loadlevel(const char *name) int mapvers; FILE *tfile; - //~ char* buff=getcwd(NULL,0); - //~ cout << buff << " " << FixedFN << endl; - //~ free(buff); tfile = fopen( FixedFN, "rb" ); if (tfile) { pause_sound(stream_firesound); @@ -3222,10 +3217,7 @@ void doDebugKeys() } if (Input::isKeyPressed(SDL_SCANCODE_N) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) { - //if(!Person::players[0]->skeleton.free)Person::players[0]->damage+=500; Person::players[0]->RagDoll(0); - //Person::players[0]->spurt=1; - //Person::players[0]->DoDamage(1000); emit_sound_at(whooshsound, Person::players[0]->coords, 128.); } @@ -3276,8 +3268,6 @@ void doDebugKeys() } if (Input::isKeyPressed(SDL_SCANCODE_M) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) { - //drawmode++; - //if(drawmode>2)drawmode=0; if (objects.numobjects < max_objects - 1) { XYZ boxcoords; boxcoords.x = Person::players[0]->coords.x; @@ -3712,7 +3702,6 @@ void doAerialAcrobatics() Person::players[k]->yaw = stepTowardf(Person::players[k]->yaw, Person::players[k]->targetyaw, multiplier * Person::players[k]->turnspeed * 4); } - /*if(Person::players[k]->aitype!=passivetype||(distsq(&Person::players[k]->coords,&viewer)DoStuff(); if (Person::players[k]->immobile && k != 0) Person::players[k]->coords = Person::players[k]->realoldcoords; @@ -6686,7 +6675,6 @@ void Game::Tick() hotspotvisual[i] -= multiplier / 320; for (int i = 0; i < numhotspots; i++) { - //if(hotspottype[i]<=10) while (hotspotvisual[i] < 0) { hotspotsprite = 0; hotspotsprite.x = float(abs(Random() % 100000)) / 100000 * hotspotsize[i]; @@ -8398,7 +8386,7 @@ void Game::TickOnceAfter() } target.y += .1; } - if (Person::players[0]->skeleton.free != 2/*&&!autocam*/) { + if (Person::players[0]->skeleton.free != 2) { cameraspeed = 20; if (findLengthfast(&Person::players[0]->velocity) > 400) { cameraspeed = 20 + (findLength(&Person::players[0]->velocity) - 20) * .96; @@ -8446,55 +8434,8 @@ void Game::TickOnceAfter() cameraloc.y = terrain.getHeight(cameraloc.x, cameraloc.z); } } - /* - //what did autocam do? - if(Person::players[0]->skeleton.free!=2&&autocam){ - cameraspeed=20; - if(findLengthfast(&Person::players[0]->velocity)>400){ - cameraspeed=20+(findLength(&Person::players[0]->velocity)-20)*.96; - } - if(Person::players[0]->skeleton.free==0&&Person::players[0]->animTarget!=hanganim&&Person::players[0]->animTarget!=climbanim)target.y+=1.4; - cameradist+=multiplier*5; - if(cameradist>3.3)cameradist=3.3; - coltarget=target-cameraloc; - if(findLengthfast(&coltarget)1) - { - Normalise(&coltarget); - if(Person::players[0]->animTarget!=hanganim&&Person::players[0]->animTarget!=climbanim&&Person::players[0]->animCurrent!=climbanim&&Person::players[0]->currentoffset.x==0)cameraloc=cameraloc+coltarget*multiplier*cameraspeed; - else cameraloc=cameraloc+coltarget*multiplier*8; - } - if(editorenabled)cameraloc=target; - viewer=cameraloc; - colviewer=viewer; - coltarget=cameraloc; - objects.SphereCheckPossible(&colviewer, findDistance(&colviewer,&coltarget)); - if(terrain.patchobjectnum[Person::players[0]->whichpatchx][Person::players[0]->whichpatchz]) - for(int j=0;jwhichpatchx][Person::players[0]->whichpatchz];j++){ - int i=terrain.patchobjects[Person::players[0]->whichpatchx][Person::players[0]->whichpatchz][j]; - colviewer=viewer; - coltarget=cameraloc; - if(objects.model[i].LineCheckPossible(&colviewer,&coltarget,&col,&objects.position[i],&objects.yaw[i])!=-1)viewer=col; - } - if(terrain.patchobjectnum[Person::players[0]->whichpatchx][Person::players[0]->whichpatchz]) - for(int j=0;jwhichpatchx][Person::players[0]->whichpatchz];j++){ - int i=terrain.patchobjects[Person::players[0]->whichpatchx][Person::players[0]->whichpatchz][j]; - colviewer=viewer; - if(objects.model[i].SphereCheck(&colviewer,.15,&col,&objects.position[i],&objects.yaw[i])!=-1){ - viewer=colviewer; - } - } - cameradist=findDistance(&viewer,&target); - viewer.y=max((double)viewer.y,terrain.getHeight(viewer.x,viewer.z)+.6); - if(cameraloc.y .8) camerashake = .8; - //if(woozy>10)woozy=10; - //woozy+=multiplier; woozy += multiplier; if (Person::players[0]->dead) camerashake = 0; @@ -8502,12 +8443,10 @@ void Game::TickOnceAfter() woozy = 0; camerashake -= multiplier * 2; blackout -= multiplier * 2; - //if(Person::players[0]->isCrouch())woozy-=multiplier*8; if (camerashake < 0) camerashake = 0; if (blackout < 0) blackout = 0; - //if(woozy<0)woozy=0; if (camerashake) { viewer.x += (float)(Random() % 100) * .0005 * camerashake; viewer.y += (float)(Random() % 100) * .0005 * camerashake; diff --git a/Source/Lights.cpp b/Source/Lights.cpp index f7e9d75..4ff34f2 100644 --- a/Source/Lights.cpp +++ b/Source/Lights.cpp @@ -30,7 +30,6 @@ void SetUpLight(Light* whichsource, int whichlight) GLfloat LightDiffuse[] = { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f }; GLfloat LightPosition[] = { whichsource->location.x, whichsource->location.y, whichsource->location.z, 0.0f }; - //glLightfv(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, qattenuation); glLightfv(GL_LIGHT0, GL_POSITION, LightPosition); glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient); glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse); diff --git a/Source/Models.cpp b/Source/Models.cpp index 0b81053..0203689 100644 --- a/Source/Models.cpp +++ b/Source/Models.cpp @@ -180,12 +180,6 @@ int Model::SphereCheck(XYZ *p1, float radius, XYZ *p, XYZ *move, float *rotate) intersecting = sphere_line_intersection(&vertex[Triangles[j].vertex[0]], &vertex[Triangles[j].vertex[2]], p1, &radius); if (intersecting) { *p1 += facenormals[j] * (distance - radius); - /*start=*p1; - end=*p1; - end.y-=radius; - if(LineFacetd(&start,&end,&vertex[Triangles[j].vertex[0]],&vertex[Triangles[j].vertex[1]],&vertex[Triangles[j].vertex[2]],&facenormals[j],&point)){ - p1->y=point.y+radius; - }*/ } } if ((distance < olddistance || firstintersecting == -1) && intersecting) { @@ -243,7 +237,6 @@ int Model::SphereCheckPossible(XYZ *p1, float radius, XYZ *move, float *rotate) if (!intersecting) intersecting = sphere_line_intersection(&vertex[Triangles[j].vertex[0]], &vertex[Triangles[j].vertex[2]], p1, &radius); if (intersecting) { - //if(j>=0&&j=0&&Triangles[i].vertex[1]>=0&&Triangles[i].vertex[2]>=0){ - if(isnormal(vertex[Triangles[i].vertex[0]].x)&&isnormal(vertex[Triangles[i].vertex[0]].y)&&isnormal(vertex[Triangles[i].vertex[0]].z) - &&isnormal(vertex[Triangles[i].vertex[1]].x)&&isnormal(vertex[Triangles[i].vertex[1]].y)&&isnormal(vertex[Triangles[i].vertex[1]].z) - &&isnormal(vertex[Triangles[i].vertex[2]].x)&&isnormal(vertex[Triangles[i].vertex[2]].y)&&isnormal(vertex[Triangles[i].vertex[2]].z)){ - */ glTexCoord2f(Triangles[i].gx[0], Triangles[i].gy[0]); if (color) glColor3f(normals[Triangles[i].vertex[0]].x, normals[Triangles[i].vertex[0]].y, normals[Triangles[i].vertex[0]].z); @@ -920,8 +903,6 @@ void Model::drawimmediate() if (!color && flat) glNormal3f(facenormals[i].x, facenormals[i].y, facenormals[i].y); glVertex3f(vertex[Triangles[i].vertex[2]].x, vertex[Triangles[i].vertex[2]].y, vertex[Triangles[i].vertex[2]].z); - //} - //} } glEnd(); } @@ -1030,12 +1011,9 @@ void Model::drawdecals(Texture shadowtexture, Texture bloodtexture, Texture bloo if (type != decalstype) return; static int i; - //~ static float distancemult; static int lasttype; - //~ static float viewdistsquared; static bool blend; - //~ viewdistsquared = viewdistance * viewdistance; blend = 1; lasttype = -1; @@ -1154,7 +1132,6 @@ void Model::MakeDecal(int atype, XYZ *where, float *size, float *opacity, float static float placex, placez; static XYZ rot; - //static XYZ point,point1,point2; static float distance; static int i, j; @@ -1233,7 +1210,6 @@ void Model::MakeDecal(int atype, XYZ where, float size, float opacity, float rot static float placex, placez; static XYZ rot; - //static XYZ point,point1,point2; static float distance; static int i, j; diff --git a/Source/Objects.cpp b/Source/Objects.cpp index 2a8474b..d782569 100644 --- a/Source/Objects.cpp +++ b/Source/Objects.cpp @@ -104,10 +104,6 @@ void Objects::Draw() distance = 1; if (distance > 0) { - /*if(checkcollide(viewer,DoRotation(model[i].vertex[model[i].vertexNum],0,yaw[i],0)*scale[i]+position[i],i)){ - occluded[i]+=1; - } - else occluded[i]=0;*/ if (occluded[i] < 6) { glMatrixMode(GL_MODELVIEW); glPushMatrix(); @@ -631,10 +627,6 @@ void Objects::MakeObject(int atype, XYZ where, float ayaw, float apitch, float a position[numobjects] = where; if (atype == bushtype) position[numobjects].y = terrain.getHeight(position[numobjects].x, position[numobjects].z) - .3; - /*if(atype==firetype){ - if(position[numobjects].y=damagetolerance&&howmuch<50)permanentdamage=damagetolerance-1; - //if(damage>=damagetolerance&&howmuch<30&&!dead)damage=damagetolerance-1; } /* EFFECT @@ -1755,7 +1736,6 @@ void Person::DoAnimations() } if (animTarget == rabbittacklinganim && frameTarget == 1) { - //if(victim->aitype==attacktypecutoff&&Random()%2==0&&victim->stunned<=0&&animation[victim->animTarget].attack==neutral&&victim->id!=0)Reverse(); if (victim->aitype == attacktypecutoff && victim->stunned <= 0 && victim->surprised <= 0 && victim->id != 0) Reverse(); if (animTarget == rabbittacklinganim && frameTarget == 1 && !victim->isCrouch() && victim->animTarget != backhandspringanim) { @@ -1889,10 +1869,7 @@ void Person::DoAnimations() } speechdelay = .3; } - //if(animation[animTarget].attack==neutral)whichsound=movewhooshsound; } - //else if(animation[animTarget].label[frameTarget]==4)whichsound=knifeswishsound; - //if(animation[animTarget].label[frameTarget]==8)whichsound=landsound2; if (whichsound != -1) { emit_sound_at(whichsound, coords); @@ -2113,7 +2090,6 @@ void Person::DoAnimations() if (hasvictim) { damagemult /= victim->damagetolerance / 200; } - //if(onfire)damagemult=3; if ((animation[animTarget].attack == normalattack || animTarget == walljumprightkickanim || animTarget == walljumpleftkickanim) && (!feint) && (victim->skeleton.free != 2 || animTarget == killanim || animTarget == dropkickanim || animTarget == crouchstabanim || animTarget == swordgroundstabanim || animTarget == staffgroundsmashanim)) { if (animTarget == spinkickanim && animation[animTarget].label[frameCurrent] == 5) { if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3 && 3 && animation[victim->animTarget].height != lowheight) { @@ -2384,7 +2360,6 @@ void Person::DoAnimations() } if ((animTarget == crouchstabanim || animTarget == swordgroundstabanim) && animation[animTarget].label[frameCurrent] == 5) { - //if(id==0)camerashake+=.4; if (hasvictim) if (!victim->skeleton.free) @@ -2694,9 +2669,6 @@ void Person::DoAnimations() weapons[weaponids[0]].owner = -1; aim = victim->coords + DoRotation(victim->jointPos(abdomen), 0, victim->yaw, 0) * victim->scale + victim->velocity * findDistance(&victim->coords, &coords) / 50 - (coords + DoRotation(jointPos(righthand), 0, yaw, 0) * scale); Normalise(&aim); - /*if(victim->animTarget==jumpupanim||victim->animTarget==jumpdownanim){ - aim=DoRotation(aim,(float)abs(Random()%15)-7,(float)abs(Random()%15)-7,0); - }*/ weapons[weaponids[0]].velocity = aim * 50; weapons[weaponids[0]].tipvelocity = aim * 50; weapons[weaponids[0]].missed = 0; @@ -3153,7 +3125,6 @@ void Person::DoAnimations() victim->num_weapons--; if (victim->num_weapons > 0) { victim->weaponids[victim->weaponactive] = victim->weaponids[victim->num_weapons]; - //if(victim->weaponstuck==victim->num_weapons)victim->weaponstuck=0; } victim->weaponactive = -1; } @@ -3174,12 +3145,10 @@ void Person::DoAnimations() relative = victim->coords - oldcoords; relative.y = 0; Normalise(&relative); - //relative=DoRotation(relative,0,-90,0); for (int i = 0; i < victim->skeleton.num_joints; i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 30; } victim->jointVel(abdomen) += relative * damagemult * 200; - //FootLand(1,2); victim->Puff(head); victim->DoDamage(damagemult * 70 / victim->protectionhigh); } @@ -3205,12 +3174,10 @@ void Person::DoAnimations() relative = victim->coords - oldcoords; relative.y = 0; Normalise(&relative); - //relative=DoRotation(relative,0,-90,0); for (int i = 0; i < victim->skeleton.num_joints; i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 30; } victim->jointVel(abdomen) += relative * damagemult * 200; - //FootLand(1,2); victim->Puff(head); victim->DoDamage(damagemult * 70 / victim->protectionhigh); } @@ -3222,7 +3189,6 @@ void Person::DoAnimations() relative = facing; relative.y = 0; Normalise(&relative); - //relative*=-1; relative.y -= .1; for (int i = 0; i < victim->skeleton.num_joints; i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 70; @@ -3274,7 +3240,6 @@ void Person::DoAnimations() relative = facing; relative.y = 0; Normalise(&relative); - //relative*=-1; relative.y -= .1; for (int i = 0; i < victim->skeleton.num_joints; i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 70; @@ -3312,7 +3277,6 @@ void Person::DoAnimations() victim->skeleton.joints[i].velocity += relative * damagemult * 40; } victim->jointVel(abdomen) += relative * damagemult * 200; - //FootLand(1,2); victim->Puff(abdomen); victim->DoDamage(damagemult * 30 / victim->protectionhigh); @@ -3332,7 +3296,6 @@ void Person::DoAnimations() for (int i = 0; i < victim->skeleton.num_joints; i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 40; } - //victim->DoDamage(1000); victim->damage = victim->damagetolerance; victim->permanentdamage = victim->damagetolerance - 1; bool doslice; @@ -3366,14 +3329,6 @@ void Person::DoAnimations() if (animTarget == knifefollowanim) victim->DoBloodBig(200, 210); if (animTarget == knifesneakattackanim) { - /*victim->DoBloodBig(200,195); - XYZ bloodvel; - bloodvel=0; - bloodvel.z=20; - bloodvel.y=5; - bloodvel=DoRotation(bloodvel,((float)(Random()%100))/4,yaw+((float)(Random()%100))/4,0)*scale; - Sprite::MakeSprite(bloodsprite, DoRotation(jointPos(neck),0,yaw,0)*scale+coords,bloodvel, 1,1,1, .05, 1); - */ XYZ footvel, footpoint; footvel = 0; footpoint = weapons[weaponids[0]].tippoint; @@ -3533,7 +3488,6 @@ void Person::DoAnimations() victim->Puff(neck); XYZ relative; - //relative=victim->coords-oldcoords; relative = facing * -1; relative.y = 0; Normalise(&relative); @@ -3554,7 +3508,6 @@ void Person::DoAnimations() escapednum = 0; victim->RagDoll(0); XYZ relative; - //relative=victim->coords-oldcoords; relative = facing * -1; relative.y = 0; Normalise(&relative); @@ -4112,7 +4065,6 @@ void Person::DoAnimations() transspeed = 15; } } - //skeleton.DoConstraints(); } /* EFFECT @@ -4203,8 +4155,6 @@ void Person::DoStuff() if (onfire) { burnt += multiplier; - /*if(aitype!=playercontrolled)*///deathbleeding=5; - /*if(aitype!=playercontrolled)*/ deathbleeding = 1; if (burnt > .6) burnt = .6; @@ -4314,7 +4264,6 @@ void Person::DoStuff() } bloodloss += deathbleeding * multiplier * 80; deathbleeding -= multiplier * 1.6; - //if(id==0)deathbleeding-=multiplier*.2; if (deathbleeding < 0) deathbleeding = 0; if (bloodloss > damagetolerance && animation[animTarget].attack == neutral) { @@ -4776,16 +4725,13 @@ void Person::DoStuff() damage += 20; } - //if(dead)damage-=multiplier/4; if (!dead) damage -= multiplier * 13; - //if(!dead&&deathbleeding<=0&&id==0)bloodloss-=multiplier*4; if (!dead) permanentdamage -= multiplier * 4; if (isIdle() || isCrouch()) { if (!dead) permanentdamage -= multiplier * 4; - //if(!dead&&deathbleeding<=0&&id==0)bloodloss-=multiplier*4; } if (damage < 0) damage = 0; @@ -5001,7 +4947,6 @@ void Person::DoStuff() yaw = targetyaw; frameTarget = 0; - // frameTarget=2; animTarget = flipanim; crouchtogglekeydown = 1; target = 0; @@ -5011,9 +4956,6 @@ void Person::DoStuff() animCurrent = tempanim; frameCurrent = 0; target = 0; - //tilt2=targettilt2; - - //if(middle.y>0)targetoffset.y=middle.y+1; for (int i = 0; i < skeleton.num_joints; i++) { tempanimation.position[i][0] = skeleton.joints[i].position; @@ -5557,7 +5499,6 @@ void Person::DoStuff() } //Running velocity - //if(!creature==wolftype||animTarget==rabbitkickanim) if (animTarget == rabbittackleanim) { velocity += facing * multiplier * speed * 700 * scale; velspeed = findLength(&velocity); @@ -5624,21 +5565,6 @@ void Person::DoStuff() velocity = flatfacing * velspeed; } - - /*if(animCurrent==rollanim&&(isCrouch()||isIdle())){ - velocity+=facing*multiplier*speed*700*scale; - velspeed=findLength(&velocity); - if(velspeed>speed*25*scale){ - velocity/=velspeed; - velspeed=speed*25*scale; - velocity*=velspeed; - } - velocity.y+=gravity*multiplier*20; - ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z)); - velspeed=findLength(&velocity); - velocity=flatfacing*velspeed; - }*/ - if (animTarget == sneakanim || animTarget == walkanim) { velocity += facing * multiplier * speed * 700 * scale; velspeed = findLength(&velocity); @@ -6099,12 +6025,9 @@ int Person::DrawSkeleton() (v0.y * (1 - morphness) + v1.y * morphness) * proportionhead.y, (v0.z * (1 - morphness) + v1.z * morphness) * proportionhead.z); glGetFloatv(GL_MODELVIEW_MATRIX, M); - //if(!isnormal(M[12])||!isnormal(M[13])||!isnormal(M[14]))test=0; - //if(!isnormal(scale))test=1; skeleton.drawmodel.vertex[skeleton.muscles[i].vertices[j]].x = M[12] * scale; skeleton.drawmodel.vertex[skeleton.muscles[i].vertices[j]].y = M[13] * scale; skeleton.drawmodel.vertex[skeleton.muscles[i].vertices[j]].z = M[14] * scale; - //test=2; glPopMatrix(); } } @@ -6284,7 +6207,6 @@ int Person::DrawSkeleton() glEnable(GL_BLEND); } if (tutoriallevel && id != 0) { - //glDisable(GL_TEXTURE_2D); glColor4f(.7, .7, .7, 0.6); glDepthMask(0); glEnable(GL_LIGHTING); @@ -6595,7 +6517,6 @@ int Person::DrawSkeleton() calcrot = 1; if (animCurrent != animTarget) calcrot = 1; - //if(id==0)calcrot=1; if (skeleton.free == 2) calcrot = 0; diff --git a/Source/Skeleton.cpp b/Source/Skeleton.cpp index fe99c32..562ec8e 100644 --- a/Source/Skeleton.cpp +++ b/Source/Skeleton.cpp @@ -714,23 +714,6 @@ void Animation::Load(const char *filename, int aheight, int aattack) if (tfile) { // read numframes, joints to know how much memory to allocate funpackf(tfile, "Bi Bi", &numframes, &joints); - /* - for(i = 0; i < joints; i++){ - if(position[i])dealloc2(position[i]); - if(twist[i])dealloc2(twist[i]); - if(twist2[i])dealloc2(twist2[i]); - if(onground[i])dealloc2(onground[i]); - }*/ - /* - if(position)dealloc2(position); - if(twist)dealloc2(twist); - if(twist2)dealloc2(twist2); - if(speed)dealloc2(speed); - if(onground)dealloc2(onground); - if(forward)dealloc2(forward); - if(weapontarget)dealloc2(weapontarget); - if(label)dealloc2(label);*/ - // allocate memory for everything @@ -756,15 +739,6 @@ void Animation::Load(const char *filename, int aheight, int aattack) weapontarget = (XYZ*)malloc(sizeof(XYZ) * numframes); label = (int*)malloc(sizeof(int) * numframes); - /*position = new XYZ[joints][numframes]; - twist = new float[joints][numframes]; - twist2 = new float[joints][numframes]; - speed = new float[numframes]; - onground = new bool[joints][numframes]; - forward = new XYZ[numframes]; - label = new int[numframes];*/ - - // read binary data as animation // for each frame... @@ -914,10 +888,9 @@ void Skeleton::Load(const char *filename, const char *lowfilename, const c funpackf(tfile, "Bi", &num_joints); // allocate memory - //joints.resize(num_joints); if (joints) delete [] joints; //dealloc2(joints); - joints = (Joint*)new Joint[num_joints]; //malloc(sizeof(Joint)*num_joints); + joints = (Joint*)new Joint[num_joints]; // read info for each joint for (i = 0; i < num_joints; i++) { @@ -938,7 +911,6 @@ void Skeleton::Load(const char *filename, const char *lowfilename, const c funpackf(tfile, "Bi", &num_muscles); // allocate memory - //muscles.clear(); if (muscles) delete [] muscles; //dealloc2(muscles); muscles = (Muscle*)new Muscle[num_muscles]; //malloc(sizeof(Muscle)*num_muscles); @@ -949,9 +921,6 @@ void Skeleton::Load(const char *filename, const char *lowfilename, const c 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 - //muscles[i].vertices.clear(); - //muscles[i].vertices.resize(muscles[i].numvertices); - //if(muscles[i].vertices)dealloc2(muscles[i].vertices); muscles[i].vertices = (int*)malloc(sizeof(int) * muscles[i].numvertices); // read vertices @@ -1029,8 +998,6 @@ void Skeleton::Load(const char *filename, const char *lowfilename, const c lSize = sizeof(num_joints); fseek(tfile, lSize, SEEK_CUR); - //joints = new Joint[num_joints]; - //jointlabels = new int[num_joints]; for (i = 0; i < num_joints; i++) { // skip joint info lSize = sizeof(XYZ) @@ -1055,7 +1022,6 @@ void Skeleton::Load(const char *filename, const char *lowfilename, const c // read num_muscles funpackf(tfile, "Bi", &num_muscles); - //muscles = new Muscle[num_muscles]; for (i = 0; i < num_muscles; i++) { // skip muscle info @@ -1072,9 +1038,6 @@ void Skeleton::Load(const char *filename, const char *lowfilename, const c if (muscles[i].numverticeslow) { // allocate memory - //muscles[i].verticeslow.clear(); - //muscles[i].verticeslow.resize(muscles[i].numverticeslow); - //if(muscles[i].verticeslow)dealloc2(muscles[i].verticeslow); muscles[i].verticeslow = (int*)malloc(sizeof(int) * muscles[i].numverticeslow); // read verticeslow @@ -1103,14 +1066,6 @@ void Skeleton::Load(const char *filename, const char *lowfilename, const c } } - /*FindForwards(); - for(i=0;iposition + muscles[modellow.owner[i]].parent2->position) / 2; @@ -1139,8 +1094,6 @@ void Skeleton::Load(const char *filename, const char *lowfilename, const c // skip num_joints lSize = sizeof(num_joints); fseek ( tfile, lSize, SEEK_CUR); - //joints = new Joint[num_joints]; - //jointlabels = new int[num_joints]; for (i = 0; i < num_joints; i++) { // skip joint info @@ -1166,7 +1119,6 @@ void Skeleton::Load(const char *filename, const char *lowfilename, const c // read num_muscles funpackf(tfile, "Bi", &num_muscles); - //muscles = new Muscle[num_muscles]; for (i = 0; i < num_muscles; i++) { // skip muscle info @@ -1183,9 +1135,6 @@ void Skeleton::Load(const char *filename, const char *lowfilename, const c // read verticesclothes if (muscles[i].numverticesclothes) { - //muscles[i].verticesclothes.clear(); - //muscles[i].verticesclothes.resize(muscles[i].numverticesclothes); - //if(muscles[i].verticesclothes)dealloc2(muscles[i].verticesclothes); muscles[i].verticesclothes = (int*)malloc(sizeof(int) * muscles[i].numverticesclothes); edit = 0; for (j = 0; j < muscles[i].numverticesclothes - edit; j++) { @@ -1214,14 +1163,6 @@ void Skeleton::Load(const char *filename, const char *lowfilename, const c } } - /*FindForwards(); - for(i=0;iposition + muscles[modelclothes.owner[i]].parent2->position) / 2; @@ -1592,14 +1533,6 @@ void Skeleton::Draw(int muscleview) glVertex3f(joints[i].parent->position.x, joints[i].parent->position.y, joints[i].parent->position.z); } } - /*for(int i=0; iblurred); @@ -1656,13 +1589,7 @@ void Skeleton::AddJoint(float x, float y, float z, int which) joints[num_joints].mass = 1; joints[num_joints].locked = 0; - /*if(which>=num_joints||which<0)*/ joints[num_joints].hasparent = 0; - /*if(which=0){ - joints[num_joints].parent=&joints[which]; - joints[num_joints].hasparent=1; - joints[num_joints].length=findDistance(joints[num_joints].position,joints[num_joints].parent->position); - }*/ num_joints++; if (which < num_joints && which >= 0) AddMuscle(num_joints - 1, which, 0, 10, boneconnect); diff --git a/Source/Sprite.cpp b/Source/Sprite.cpp index 3d9a50c..ebc73d9 100644 --- a/Source/Sprite.cpp +++ b/Source/Sprite.cpp @@ -364,7 +364,7 @@ void Sprite::Draw() if (!spritehit) if (objects.model[k].LineCheck(&start, &end, &colpoint, &objects.position[k], &objects.yaw[k]) != -1) { if (detail == 2 || (detail == 1 && abs(Random() % 4) == 0) || (detail == 0 && abs(Random() % 8) == 0)) - objects.model[k].MakeDecal(blooddecalfast, DoRotation(colpoint - objects.position[k], 0, -objects.yaw[k], 0), sprites[i]->size * 1.6/*+abs((float)(Random()%100))/2400*/, .5, Random() % 360); + objects.model[k].MakeDecal(blooddecalfast, DoRotation(colpoint - objects.position[k], 0, -objects.yaw[k], 0), sprites[i]->size * 1.6, .5, Random() % 360); DeleteSprite(i); spritehit = 1; } @@ -372,7 +372,7 @@ void Sprite::Draw() } if (!spritehit) if (sprites[i]->position.y < terrain.getHeight(sprites[i]->position.x, sprites[i]->position.z)) { - terrain.MakeDecal(blooddecalfast, sprites[i]->position, sprites[i]->size * 1.6/*+abs((float)(Random()%100))/2400*/, .6, Random() % 360); + terrain.MakeDecal(blooddecalfast, sprites[i]->position, sprites[i]->size * 1.6, .6, Random() % 360); DeleteSprite(i); } } diff --git a/Source/TGALoader.cpp b/Source/TGALoader.cpp index a7a1178..748e8e3 100644 --- a/Source/TGALoader.cpp +++ b/Source/TGALoader.cpp @@ -39,17 +39,6 @@ bool upload_image(const unsigned char* filePath, bool hasalpha) // for Windows, just use TGA loader for now char fileName[256]; CopyPascalStringToC( filePath, fileName); - /* - // change extension to .TGA - int len = strlen( fileName); - if (len > 3) - { - fileName[ len - 3] = 't'; - fileName[ len - 2] = 'g'; - fileName[ len - 1] = 'a'; - } - */ -//return (LoadTGA( fileName) != NULL); return (LoadImage(fileName, texture)); #else @@ -57,21 +46,9 @@ bool upload_image(const unsigned char* filePath, bool hasalpha) OSStatus err; ComponentResult cr; - /*FSRef fsref; - Boolean isdir; - err = FSPathMakeRef((const UInt8*)filePath, &fsref, &isdir); - if(err)return; - - FSSpec fsspec; - err = FSGetCatalogInfo(&fsref, kFSCatInfoNone, NULL, NULL, &fsspec, NULL); - if(err)return; - */ - //Boolean isdir; FSSpec fsspec; - //err = FSMakeFSSpec (0, 0, (const unsigned char*)filePath, &fsspec); err = FSMakeFSSpec (0, 0, filePath, &fsspec); - //err=FSPathMakeFSSpec((const UInt8*)filePath,&fsspec,&isdir);*/ if (err) return; @@ -83,13 +60,9 @@ bool upload_image(const unsigned char* filePath, bool hasalpha) Rect natbounds; cr = GraphicsImportGetNaturalBounds(gi, &natbounds); - //~ size_t buffersize = 4 * natbounds.bottom * natbounds.right; - //void* buf = malloc(buffersize); texture.sizeX = natbounds.right; texture.sizeY = natbounds.bottom; - /*if(hasalpha)*/ texture.bpp = 32; - //if(!hasalpha)texture.bpp = 24; GWorldPtr gw; err = QTNewGWorldFromPtr(&gw, k32ARGBPixelFormat, &natbounds, NULL, NULL, @@ -110,11 +83,6 @@ bool upload_image(const unsigned char* filePath, bool hasalpha) if (err) return; - /*glTexImage2D(textureTarget, 0, GL_RGBA, natbounds.right, natbounds.top, 0, - GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, buf); - */ - - //free(buf); DisposeGWorld(gw); // Loop Through The Image Data @@ -123,7 +91,6 @@ bool upload_image(const unsigned char* filePath, bool hasalpha) GLuint bytesPerPixel; // Temporary Variable bytesPerPixel = texture.bpp / 8; imageSize = texture.sizeX * texture.sizeY * bytesPerPixel; - //~ int alltrans=10; for ( GLuint i = 0; i < int( imageSize ); i += 4 ) { // Swaps The 1st And 3rd Bytes ('R'ed and 'B'lue) @@ -134,15 +101,9 @@ bool upload_image(const unsigned char* filePath, bool hasalpha) texture.data[i + 3] = temp; } - //~ int tempplace; - //~ tempplace=0; if (!hasalpha) { for ( GLuint i = 0; i < int( imageSize ); i += 4 ) { texture.data[i + 3] = 255; - /*texture.data[tempplace] = texture.data[i]; // Set The 1st Byte To The Value Of The 3rd Byte - texture.data[tempplace + 1] = texture.data[i + 1]; // Set The 3rd Byte To The Value In 'temp' (1st Byte Value) - texture.data[tempplace + 2] = texture.data[i + 2]; - tempplace+=3;*/ } } diff --git a/Source/Terrain.cpp b/Source/Terrain.cpp index b0aff61..38bf0ae 100644 --- a/Source/Terrain.cpp +++ b/Source/Terrain.cpp @@ -516,28 +516,6 @@ bool Terrain::load(const char *fileName) if (visibleloading) Game::LoadingScreen(); - /*float total; - int todivide; - //Smooth opacityother - for(i=0;i0&&patchy[1]>0) - if(patchx[2]0&&patchy[2]>0) - if(patchx[3]0&&patchy[3]>0) - if(patchx[0]0&&patchy[0]>0){ - */ if ((patchx[0] != patchx[1] || patchy[0] != patchy[1]) && (patchx[0] != patchx[2] || patchy[0] != patchy[2]) && (patchx[0] != patchx[3] || patchy[0] != patchy[3])) { MakeDecalLock(type, where, patchx[0], patchy[0], size, opacity, rotation); } diff --git a/Source/Text.cpp b/Source/Text.cpp index 09a23e1..8d0dc60 100644 --- a/Source/Text.cpp +++ b/Source/Text.cpp @@ -29,34 +29,6 @@ void Text::LoadFontTexture(const char *fileName) LOG(std::string("Loading font texture...") + fileName); FontTexture.load(fileName, false, false); - /* - //Load Image - //LoadTGA( fileName ); - unsigned char fileNamep[256]; - CopyCStringToPascal(fileName,fileNamep); - //Load Image - upload_image( fileNamep ,1); - - //Is it valid? - if(1==1){ - //Alpha channel? - if ( texture.bpp == 24 ) - type = GL_RGB; - else - type = GL_RGBA; - - glPixelStorei( GL_UNPACK_ALIGNMENT, 1 ); - - if(!FontTexture)glGenTextures( 1, &FontTexture ); - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); - - glBindTexture( GL_TEXTURE_2D, FontTexture); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - - gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, type, GL_UNSIGNED_BYTE, texture.data ); - } - */ if (base) { glDeleteLists(base, 512); base = 0; @@ -74,11 +46,8 @@ void Text::BuildFont() // Build Our Font Display List if (base) { glDeleteLists(base, 512); base = 0; - //LOG("Font already created..."); - //return; } -//base=glGenLists(256); // Creating 256 Display Lists base = glGenLists(512); // Creating 256 Display Lists FontTexture.bind(); for (loop = 0; loop < 512; loop++) { // Loop Through All 256 Lists