static long ARX_PORTALS_GetRoomNumForCamera(float * height) { EERIEPOLY * ep; ep = CheckInPoly(ACTIVECAM->orgTrans.pos); if(ep && ep->room > -1) { if(height) *height=ep->center.y; return ep->room; } ep = GetMinPoly(ACTIVECAM->orgTrans.pos); if(ep && ep->room > -1) { if(height) *height=ep->center.y; return ep->room; } float dist=0.f; while(dist<=20.f) { Vec3f tmpPos = ACTIVECAM->orgTrans.pos; tmpPos += angleToVectorXZ_180offset(ACTIVECAM->angle.getPitch()) * dist; ep = CheckInPoly(tmpPos); if(ep && ep->room > -1) { if(height) *height=ep->center.y; return ep->room; } dist += 5.f; } return -1; }
//----------------------------------------------------------------------------- // Updates all currently launched projectiles void ARX_MISSILES_Update() { TextureContainer * tc = TC_fire; unsigned long tim = (unsigned long)(arxtime); for(unsigned long i(0); i < MAX_MISSILES; i++) { if(missiles[i].type == MISSILE_NONE) continue; long framediff = missiles[i].timecreation + missiles[i].tolive - tim; if(framediff < 0) { ARX_MISSILES_Kill(i); continue; } long framediff3 = tim - missiles[i].timecreation; switch(missiles[i].type) { case MISSILE_NONE: break; case MISSILE_FIREBALL: { Vec3f pos; pos = missiles[i].startpos + missiles[i].velocity * Vec3f(framediff3); if(missiles[i].longinfo != -1) { DynLight[missiles[i].longinfo].pos = pos; } Vec3f orgn = missiles[i].lastpos; Vec3f dest = pos; Vec3f tro = Vec3f(70.f); EERIEPOLY *ep = GetMinPoly(dest.x, dest.y, dest.z); EERIEPOLY *epp = GetMaxPoly(dest.x, dest.y, dest.z); if(closerThan(player.pos, pos, 200.f)) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&pos); Add3DBoom(&pos); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } if(ep && ep->center.y < dest.y) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&dest); Add3DBoom(&dest); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } if(epp && epp->center.y > dest.y) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&dest); Add3DBoom(&dest); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } Vec3f hit; EERIEPOLY *tp = NULL; if(EERIELaunchRay3(&orgn, &dest, &hit, tp, 1)) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&hit); Add3DBoom(&hit); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } if(!EECheckInPoly(&dest) || EEIsUnderWater(&dest)) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&dest); Add3DBoom(&dest); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } long ici = IsCollidingAnyInter(dest.x, dest.y, dest.z, &tro); if(ici != -1 && ici != missiles[i].owner) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&dest); Add3DBoom(&dest); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } PARTICLE_DEF * pd = createParticle(); if(pd) { pd->ov = pos; pd->move = missiles[i].velocity; pd->move += Vec3f(3.f - 6.f * rnd(), 4.f - 12.f * rnd(), 3.f - 6.f * rnd()); pd->tolive = Random::get(500, 1000); pd->tc = tc; pd->siz = 12.f * float(missiles[i].tolive - framediff3) * (1.f / 4000); pd->scale = randomVec(15.f, 20.f); pd->special = FIRE_TO_SMOKE; } missiles[i].lastpos = pos; break; } } missiles[i].lastupdate = tim; } }
//----------------------------------------------------------------------------- // Updates all currently launched projectiles void ARX_MISSILES_Update() { long framediff, framediff2, framediff3; EERIE_3D orgn, dest, hit; TextureContainer * tc = TC_fire; EERIEPOLY *tp = NULL; unsigned long tim = ARXTimeUL(); for (unsigned long i(0); i < MAX_MISSILES; i++) { if (missiles[i].type == MISSILE_NONE) continue; framediff = missiles[i].timecreation + missiles[i].tolive - tim; if (framediff < 0) { ARX_MISSILES_Kill(i); continue; } framediff2 = missiles[i].timecreation + missiles[i].tolive - missiles[i].lastupdate; framediff3 = tim - missiles[i].timecreation; switch (missiles[i].type) { case MISSILE_FIREBALL : { EERIE_3D pos; pos.x = missiles[i].startpos.x + missiles[i].velocity.x * framediff3; pos.y = missiles[i].startpos.y + missiles[i].velocity.y * framediff3; pos.z = missiles[i].startpos.z + missiles[i].velocity.z * framediff3; if (missiles[i].longinfo != -1) { DynLight[missiles[i].longinfo].pos.x = pos.x; DynLight[missiles[i].longinfo].pos.y = pos.y; DynLight[missiles[i].longinfo].pos.z = pos.z; } if (USE_COLLISIONS) { orgn.x = missiles[i].lastpos.x; orgn.y = missiles[i].lastpos.y; orgn.z = missiles[i].lastpos.z; dest.x = pos.x; dest.y = pos.y; dest.z = pos.z; EERIEPOLY *ep; EERIEPOLY *epp; EERIE_3D tro; tro.x = 70.0F; tro.y = 70.0F; tro.z = 70.0F; CURRENTINTER = NULL; ep = GetMinPoly(dest.x, dest.y, dest.z); epp = GetMaxPoly(dest.x, dest.y, dest.z); if (Distance3D(player.pos.x, player.pos.y, player.pos.z, pos.x, pos.y, pos.z) < 200.0F) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&pos); Add3DBoom(&pos, NULL); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } if (ep && ep->center.y < dest.y) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&dest); Add3DBoom(&dest, NULL); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } if (epp && epp->center.y > dest.y) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&dest); Add3DBoom(&dest, NULL); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } if (EERIELaunchRay3(&orgn, &dest, &hit, tp, 1)) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&hit); Add3DBoom(&hit, NULL); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } if ( !EECheckInPoly(&dest) || EEIsUnderWaterFast(&dest) ) //ARX: jycorbel (2010-08-20) - rendering issues with bGATI8500: optimize time to render; { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&dest); Add3DBoom(&dest, NULL); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } long ici = IsCollidingAnyInter(dest.x, dest.y, dest.z, &tro); if (ici != -1 && ici != missiles[i].owner) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&dest); Add3DBoom(&dest, NULL); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } } long j = ARX_PARTICLES_GetFree(); if (j != -1 && !ARXPausedTimer) { ParticleCount++; particle[j].exist = TRUE; particle[j].zdec = 0; particle[j].ov.x = pos.x; particle[j].ov.y = pos.y; particle[j].ov.z = pos.z; particle[j].move.x = missiles[i].velocity.x + 3.0f - 6.0F * rnd(); particle[j].move.y = missiles[i].velocity.y + 4.0F - 12.0F * rnd(); particle[j].move.z = missiles[i].velocity.z + 3.0F - 6.0F * rnd(); particle[j].timcreation = tim; particle[j].tolive = 500 + (unsigned long)(rnd() * 500.f); particle[j].tc = tc; particle[j].siz = 12.0F * (float)(missiles[i].tolive - framediff3) * DIV4000; particle[j].scale.x = 15.0F + rnd() * 5.0F; particle[j].scale.y = 15.0F + rnd() * 5.0F; particle[j].scale.z = 15.0F + rnd() * 5.0F; particle[j].special = FIRE_TO_SMOKE; } missiles[i].lastpos.x = pos.x; missiles[i].lastpos.y = pos.y; missiles[i].lastpos.z = pos.z; break; } } missiles[i].lastupdate = tim; } }
static long ARX_PORTALS_GetRoomNumForPosition2(const Vec3f & pos, long flag, float * height) { EERIEPOLY * ep; if(flag & 1) { ep=CheckInPoly(pos + Vec3f(0.f, -150.f, 0.f)); if (!ep) ep=CheckInPoly(pos + Vec3f(0.f, -1.f, 0.f)); } else { ep=CheckInPoly(pos); } if(ep && ep->room>-1) { if(height) *height=ep->center.y; return ep->room; } // Security... ? ep = GetMinPoly(pos); if(ep && ep->room > -1) { if(height) *height=ep->center.y; return ep->room; } else if( !(flag & 1) ) { ep=CheckInPoly(pos); if(ep && ep->room > -1) { if(height) *height=ep->center.y; return ep->room; } } if(flag & 2) { float off=20.f; ep=CheckInPoly(pos + Vec3f(-off, -off, 0.f)); if(ep && ep->room > -1) { if(height) *height=ep->center.y; return ep->room; } ep=CheckInPoly(pos + Vec3f(-off, -20, -off)); if(ep && ep->room > -1) { if(height) *height=ep->center.y; return ep->room; } ep=CheckInPoly(pos + Vec3f(-off, -20, off)); if(ep && ep->room > -1) { if(height) *height=ep->center.y; return ep->room; } ep=CheckInPoly(pos + Vec3f(off, -20, 0.f)); if(ep && ep->room>-1) { if(height) *height=ep->center.y; return ep->room; } ep=CheckInPoly(pos + Vec3f(off, -20, off)); if(ep && ep->room > -1) { if(height) *height=ep->center.y; return ep->room; } ep=CheckInPoly(pos + Vec3f(off, -20, -off)); if(ep && ep->room > -1) { if(height) *height=ep->center.y; return ep->room; } } return -1; }
void AnchorData_Create(EERIE_BACKGROUND * eb) { AnchorData_ClearAll(eb); Vec3f pos; float count = 0; long lastper = -1; long per; float total = static_cast<float>(eb->Zsize * eb->Xsize * 9); for(long j = 0; j < eb->Zsize; j++) for(long i = 0; i < eb->Xsize; i++) { long LASTFOUND = 0; for(long divv = 0; divv < 9; divv++) { long divvx, divvy; switch (divv) { case 0: divvx = 0; divvy = 0; break; case 1: divvx = 1; divvy = 0; break; case 2: divvx = 2; divvy = 0; break; case 3: divvx = 0; divvy = 1; break; case 4: divvx = 1; divvy = 1; break; case 5: divvx = 2; divvy = 1; break; case 6: divvx = 0; divvy = 2; break; case 7: divvx = 1; divvy = 2; break; case 8: divvx = 2; divvy = 2; break; } per = count / total * 100.f; if(per != lastper) { LogInfo << "Anchor Generation: %" << per; lastper = per; } count += 1.f; if(LASTFOUND) break; EERIE_BKG_INFO * eg = &eb->fastdata[i][j]; pos.x = (float)((float)((float)i + 0.33f * (float)divvx) * (float)eb->Xdiv); pos.y = 0.f; pos.z = (float)((float)((float)j + 0.33f * (float)divvy) * (float)eb->Zdiv); EERIEPOLY * ep = GetMinPoly(pos); Cylinder currcyl; currcyl.radius = 20 - (4.f * divv); currcyl.height = -120.f; currcyl.origin = pos; if(ep) { EERIEPOLY * epmax; epmax = GetMaxPoly(pos); float roof = 9999999.f; if(ep) roof = ep->min.y - 300; if(epmax) roof = epmax->min.y - 300; float current_y = ep->max.y; while(current_y > roof) { currcyl.origin.y = current_y; EERIEPOLY * ep2 = ANCHOR_CheckInPolyPrecis(currcyl.origin + Vec3f(0.f, -30.f, 0.f)); if( ep2 && !(ep2->type & POLY_DOUBLESIDED) && (ep2->norm.y > 0.f) ) { ep2 = NULL; } if(ep2 && !(ep2->type & POLY_NOPATH)) { bool bval = ANCHOR_AttemptValidCylinderPos(currcyl, NULL, CFLAG_NO_INTERCOL | CFLAG_EXTRA_PRECISION | CFLAG_RETURN_HEIGHT | CFLAG_ANCHOR_GENERATION); if( bval && currcyl.origin.y - 10.f <= current_y ) { EERIEPOLY * ep2 = ANCHOR_CheckInPolyPrecis(currcyl.origin + Vec3f(0.f, -38.f, 0.f)); if(ep2 && !(ep2->type & POLY_DOUBLESIDED) && (ep2->norm.y > 0.f)) { current_y -= 10.f; } else if ((ep2) && (ep2->type & POLY_NOPATH)) { current_y -= 10.f; } else if (AddAnchor_Original_Method(eb, eg, &currcyl.origin)) { LASTFOUND++; current_y = currcyl.origin.y + currcyl.height; } else { current_y -= 10.f; } } else { current_y -= 10.f; } } else { current_y -= 10.f; } } } } } AnchorData_Create_Phase_II_Original_Method(eb); AnchorData_Create_Links_Original_Method(eb); }
//----------------------------------------------------------------------------- // Updates all currently launched projectiles void ARX_MISSILES_Update() { ARX_PROFILE_FUNC(); TextureContainer * tc = TC_fire; unsigned long tim = (unsigned long)(arxtime); for(unsigned long i(0); i < MAX_MISSILES; i++) { if(missiles[i].type == MISSILE_NONE) continue; long framediff = missiles[i].timecreation + missiles[i].tolive - tim; if(framediff < 0) { ARX_MISSILES_Kill(i); continue; } long framediff3 = tim - missiles[i].timecreation; switch(missiles[i].type) { case MISSILE_NONE: break; case MISSILE_FIREBALL: { Vec3f pos; pos = missiles[i].startpos + missiles[i].velocity * Vec3f(framediff3); if(lightHandleIsValid(missiles[i].longinfo)) { EERIE_LIGHT * light = lightHandleGet(missiles[i].longinfo); light->pos = pos; } Vec3f orgn = missiles[i].lastpos; Vec3f dest = pos; Vec3f tro = Vec3f(70.f); EERIEPOLY *ep = GetMinPoly(dest); EERIEPOLY *epp = GetMaxPoly(dest); if(closerThan(player.pos, pos, 200.f)) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(pos); Add3DBoom(pos); DoSphericDamage(Sphere(dest, 200.0F), 180.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } if(ep && ep->center.y < dest.y) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(dest); Add3DBoom(dest); DoSphericDamage(Sphere(dest, 200.0F), 180.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } if(epp && epp->center.y > dest.y) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(dest); Add3DBoom(dest); DoSphericDamage(Sphere(dest, 200.0F), 180.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } Vec3f hit; if(EERIELaunchRay3(orgn, dest, hit, 1)) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(hit); Add3DBoom(hit); DoSphericDamage(Sphere(dest, 200.0F), 180.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } if(!CheckInPoly(dest) || EEIsUnderWater(dest)) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(dest); Add3DBoom(dest); DoSphericDamage(Sphere(dest, 200.0F), 180.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } EntityHandle ici = IsCollidingAnyInter(dest, tro); if(ici != EntityHandle() && ici != missiles[i].owner) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(dest); Add3DBoom(dest); DoSphericDamage(Sphere(dest, 200.0F), 180.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } PARTICLE_DEF * pd = createParticle(); if(pd) { pd->ov = pos; pd->move = missiles[i].velocity; pd->move += Vec3f(3.f, 4.f, 3.f) + Vec3f(-6.f, -12.f, -6.f) * randomVec3f(); pd->tolive = Random::get(500, 1000); pd->tc = tc; pd->siz = 12.f * float(missiles[i].tolive - framediff3) * (1.f / 4000); pd->scale = randomVec(15.f, 20.f); pd->special = FIRE_TO_SMOKE; } missiles[i].lastpos = pos; break; } } missiles[i].lastupdate = tim; } }
//////////////////////////////////////////////////////////////////////////////////// // ALTERNATIVE METHOD void AnchorData_Create_Alternative_Method_I(EERIE_BACKGROUND * eb) { char text[256]; AnchorData_ClearAll(eb); EERIE_BKG_INFO * eg; EERIEPOLY * ep; EERIE_3D pos; long k; float count = 0; long lastper = -1; long per; float total = ARX_CLEAN_WARN_CAST_FLOAT(eb->Zsize * eb->Xsize * 4); for (long j = 0; j < eb->Zsize; j++) for (long i = 0; i < eb->Xsize; i++) { long LASTFOUND = 0; for (long divv = 0; divv < 4; divv++) { long divvx, divvy; switch (divv) { case 0: divvx = 0; divvy = 0; break; case 1: divvx = 1; divvy = 1; break; case 2: divvx = 0; divvy = 1; break; case 3: divvx = 1; divvy = 0; break; } float current_y = 99999999999.f; F2L((float)count / total * 100.f, &per); if (per != lastper) { sprintf(text, "Anchor Generation: %d%%", per); lastper = per; _ShowText(text); } count += 1.f; danaeApp.WinManageMess(); if (LASTFOUND) break; eg = &eb->Backg[i+j*eb->Xsize]; pos.x = (float)((float)((float)i + 0.5f * (float)divvx) * (float)eb->Xdiv); pos.y = 0.f; pos.z = (float)((float)((float)j + 0.5f * (float)divvy) * (float)eb->Zdiv); ep = GetMinPoly(pos.x, pos.y, pos.z); k = 0; EERIE_CYLINDER currcyl; currcyl.radius = 20 - (4.f * divv); currcyl.height = -120.f; currcyl.origin.x = pos.x; currcyl.origin.y = pos.y; currcyl.origin.z = pos.z; if (ep) { EERIEPOLY * epmax; epmax = GetMaxPoly(pos.x, pos.y, pos.z); float roof = 9999999.f; if (ep) roof = ep->min.y - 300; if (epmax) roof = epmax->min.y - 300; current_y = ep->max.y; while (current_y > roof) { currcyl.origin.y = current_y; EERIEPOLY * ep2 = ANCHOR_CheckInPolyPrecis(currcyl.origin.x, currcyl.origin.y - 30.f, currcyl.origin.z); if (ep2 && !(ep2->type & POLY_DOUBLESIDED) && (ep2->norm.y > 0.f)) ep2 = NULL; if ((ep2) && !(ep2->type & POLY_NOPATH)) { BOOL bval = ANCHOR_AttemptValidCylinderPos(&currcyl, NULL, CFLAG_NO_INTERCOL | CFLAG_EXTRA_PRECISION | CFLAG_RETURN_HEIGHT | CFLAG_ANCHOR_GENERATION); if ((bval) && (currcyl.origin.y - 10.f <= current_y)) { EERIEPOLY * ep2 = ANCHOR_CheckInPolyPrecis(currcyl.origin.x, currcyl.origin.y - 38.f, currcyl.origin.z); if (ep2 && !(ep2->type & POLY_DOUBLESIDED) && (ep2->norm.y > 0.f)) { current_y -= 10.f; } else if ((ep2) && (ep2->type & POLY_NOPATH)) { current_y -= 10.f; } else if (AddAnchor_Original_Method(eb, eg, &currcyl.origin, 0)) { LASTFOUND++; current_y = currcyl.origin.y + currcyl.height; } else current_y -= 10.f; } else current_y -= 10.f; } else current_y -= 10.f; } } } } AnchorData_Create_Phase_II_Original_Method(eb); AnchorData_Create_Links_Original_Method(eb); /* TO KEEP // Parses Anchors to refine anchor creation... long ii,ia,ji,ja; EERIE_3D p1,p2; EERIE_BKG_INFO * eg2; count=0; total=eb->Zsize*eb->Xsize; long usable=0; if (0) for (j=0;j<eb->Zsize;j++) for (long i=0;i<eb->Xsize;i++) { F2L((float)count/(float)total*100.f,&per); if (per!=lastper) { sprintf(text,"Anchor Generation Pass II: %d%% Suitable %d",per,usable); lastper=per; _ShowText(text); } count++; eg=&eb->Backg[i+j*eb->Xsize]; for (long k=0;k<eg->nbianchors;k++) { ii=i-2; ia=i+2; ji=j-2; ja=j+2; FORCERANGE(ii,0,eb->Xsize-1); FORCERANGE(ia,0,eb->Xsize-1); FORCERANGE(ji,0,eb->Zsize-1); FORCERANGE(ja,0,eb->Zsize-1); for (long j2=ji;j2<=ja;j2++) for (long i2=ii;i2<=ia;i2++) { eg2=&eb->Backg[i2+j2*eb->Xsize]; for (long k2=0;k2<eg2->nbianchors;k2++) { // don't treat currently treated anchor if (eg->ianchors[k] == eg2->ianchors[k2]) continue; memcpy(&p1,&eb->anchors[eg->ianchors[k]].pos,sizeof(EERIE_3D)); memcpy(&p2,&eb->anchors[eg2->ianchors[k2]].pos,sizeof(EERIE_3D)); p1.y+=10.f; p2.y+=10.f; float dist=TRUEEEDistance3D(&p1,&p2); if (dist>120.f) continue; if (EEfabs(p1.y-p2.y)>80.f) continue; if ((eb->anchors[eg->ianchors[k]].radius>=40) && (eb->anchors[eg2->ianchors[k2]].radius>=40)) continue; { // found 2 usable anchors EERIE_3D pos; pos.x=(p1.x+p2.x)*DIV2; pos.y=(p1.y+p2.y)*DIV2; pos.z=(p1.z+p2.z)*DIV2; if (AddAnchor(eb,eg,&pos,MUST_BE_BIG)) usable++; } } } } }*/ }
void AnchorData_Create_Original_Method(EERIE_BACKGROUND * eb) { char text[256]; AnchorData_ClearAll(eb); EERIE_BKG_INFO * eg; EERIEPOLY * ep; EERIE_3D pos; #define DECALLL 20.f long k; float count = 0; long lastper = -1; long per; float total = ARX_CLEAN_WARN_CAST_FLOAT(eb->Zsize * eb->Xsize * 9); for (long j = 0; j < eb->Zsize; j++) for (long i = 0; i < eb->Xsize; i++) { long LASTFOUND = 0; for (long divv = 0; divv < 9; divv++) { long divvx, divvy; switch (divv) { case 0: divvx = 0; divvy = 0; break; case 1: divvx = 1; divvy = 0; break; case 2: divvx = 2; divvy = 0; break; case 3: divvx = 0; divvy = 1; break; case 4: divvx = 1; divvy = 1; break; case 5: divvx = 2; divvy = 1; break; case 6: divvx = 0; divvy = 2; break; case 7: divvx = 1; divvy = 2; break; case 8: divvx = 2; divvy = 2; break; } float current_y = 99999999999.f; F2L((float)count / total * 100.f, &per); if (per != lastper) { sprintf(text, "Anchor Generation: %d%%", per); lastper = per; _ShowText(text); } count += 1.f; danaeApp.WinManageMess(); if (LASTFOUND) break; eg = &eb->Backg[i+j*eb->Xsize]; pos.x = (float)((float)((float)i + 0.33f * (float)divvx) * (float)eb->Xdiv); pos.y = 0.f; pos.z = (float)((float)((float)j + 0.33f * (float)divvy) * (float)eb->Zdiv); ep = GetMinPoly(pos.x, pos.y, pos.z); k = 0; EERIE_CYLINDER currcyl; currcyl.radius = 20 - (4.f * divv); currcyl.height = -120.f; currcyl.origin.x = pos.x; currcyl.origin.y = pos.y; currcyl.origin.z = pos.z; if (ep) { EERIEPOLY * epmax; epmax = GetMaxPoly(pos.x, pos.y, pos.z); float roof = 9999999.f; if (ep) roof = ep->min.y - 300; if (epmax) roof = epmax->min.y - 300; current_y = ep->max.y; while (current_y > roof) { currcyl.origin.y = current_y; EERIEPOLY * ep2 = ANCHOR_CheckInPolyPrecis(currcyl.origin.x, currcyl.origin.y - 30.f, currcyl.origin.z); if (ep2 && !(ep2->type & POLY_DOUBLESIDED) && (ep2->norm.y > 0.f)) ep2 = NULL; if ((ep2) && !(ep2->type & POLY_NOPATH)) { BOOL bval = ANCHOR_AttemptValidCylinderPos(&currcyl, NULL, CFLAG_NO_INTERCOL | CFLAG_EXTRA_PRECISION | CFLAG_RETURN_HEIGHT | CFLAG_ANCHOR_GENERATION); if ((bval) && (currcyl.origin.y - 10.f <= current_y)) { EERIEPOLY * ep2 = ANCHOR_CheckInPolyPrecis(currcyl.origin.x, currcyl.origin.y - 38.f, currcyl.origin.z); if (ep2 && !(ep2->type & POLY_DOUBLESIDED) && (ep2->norm.y > 0.f)) { current_y -= 10.f; } else if ((ep2) && (ep2->type & POLY_NOPATH)) { current_y -= 10.f; } else if (AddAnchor_Original_Method(eb, eg, &currcyl.origin, 0)) { LASTFOUND++; current_y = currcyl.origin.y + currcyl.height; } else current_y -= 10.f; } else current_y -= 10.f; } else current_y -= 10.f; } } } } AnchorData_Create_Phase_II_Original_Method(eb); AnchorData_Create_Links_Original_Method(eb); }
//----------------------------------------------------------------------------- // Updates all currently launched projectiles void ARX_MISSILES_Update() { long framediff, framediff3; Vec3f orgn, dest, hit; TextureContainer * tc = TC_fire; EERIEPOLY *tp = NULL; unsigned long tim = ARXTimeUL(); for (unsigned long i(0); i < MAX_MISSILES; i++) { if (missiles[i].type == MISSILE_NONE) continue; framediff = missiles[i].timecreation + missiles[i].tolive - tim; if (framediff < 0) { ARX_MISSILES_Kill(i); continue; } framediff3 = tim - missiles[i].timecreation; switch (missiles[i].type) { case MISSILE_NONE: break; case MISSILE_FIREBALL: { Vec3f pos; pos = missiles[i].startpos + missiles[i].velocity * framediff3; if (missiles[i].longinfo != -1) { DynLight[missiles[i].longinfo].pos = pos; } #ifdef BUILD_EDITOR if (USE_COLLISIONS) #endif { orgn = missiles[i].lastpos; dest = pos; EERIEPOLY *ep; EERIEPOLY *epp; Vec3f tro; tro.x = 70.0F; tro.y = 70.0F; tro.z = 70.0F; CURRENTINTER = NULL; ep = GetMinPoly(dest.x, dest.y, dest.z); epp = GetMaxPoly(dest.x, dest.y, dest.z); if(closerThan(player.pos, pos, 200.f)) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&pos); Add3DBoom(&pos); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } if (ep && ep->center.y < dest.y) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&dest); Add3DBoom(&dest); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } if (epp && epp->center.y > dest.y) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&dest); Add3DBoom(&dest); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } if (EERIELaunchRay3(&orgn, &dest, &hit, tp, 1)) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&hit); Add3DBoom(&hit); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } if ( !EECheckInPoly(&dest) || EEIsUnderWater(&dest) ) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&dest); Add3DBoom(&dest); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } long ici = IsCollidingAnyInter(dest.x, dest.y, dest.z, &tro); if (ici != -1 && ici != missiles[i].owner) { ARX_MISSILES_Kill(i); ARX_BOOMS_Add(&dest); Add3DBoom(&dest); DoSphericDamage(&dest, 180.0F, 200.0F, DAMAGE_AREAHALF, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL); break; } } long j = ARX_PARTICLES_GetFree(); if (j != -1 && !ARXPausedTimer) { ParticleCount++; particle[j].exist = true; particle[j].zdec = 0; particle[j].ov.x = pos.x; particle[j].ov.y = pos.y; particle[j].ov.z = pos.z; particle[j].move.x = missiles[i].velocity.x + 3.0f - 6.0F * rnd(); particle[j].move.y = missiles[i].velocity.y + 4.0F - 12.0F * rnd(); particle[j].move.z = missiles[i].velocity.z + 3.0F - 6.0F * rnd(); particle[j].timcreation = tim; particle[j].tolive = 500 + (unsigned long)(rnd() * 500.f); particle[j].tc = tc; particle[j].siz = 12.0F * (float)(missiles[i].tolive - framediff3) * ( 1.0f / 4000 ); particle[j].scale.x = 15.0F + rnd() * 5.0F; particle[j].scale.y = 15.0F + rnd() * 5.0F; particle[j].scale.z = 15.0F + rnd() * 5.0F; particle[j].special = FIRE_TO_SMOKE; } missiles[i].lastpos.x = pos.x; missiles[i].lastpos.y = pos.y; missiles[i].lastpos.z = pos.z; break; } } missiles[i].lastupdate = tim; } }