void mrTradeStuffTest(sdword *a, sdword *b) { sdword i; Ship *ship; vector vect = {0.0f, 0.0f, 1.0f}; vector vect2 = {0.0f, 1.0f, 0.0f}; vector vect3 = {1.0f, 0.0f, 0.0f}; wkTradeInit(); wkTradeFocusedShip(); wkTradeStuffActive = TRUE; return; for(i=0; i<selSelected.numShips; ++i) { ship = selSelected.ShipPtr[i]; switch (selSelected.numShips) { case 1: ship->posinfo.position.x += 200.0f; break; case 2: ship->posinfo.velocity.x += 1000.0f; break; case 3: ship->posinfo.force.x += 1000.0f; break; case 4: ship->rotinfo.rotspeed.x += 1000.0f; break; case 5: ship->rotinfo.torque.x += 100000.0f; break; case 6: matCreateCoordSysFromHeading(&ship->rotinfo.coordsys,&vect); break; case 7: matCreateCoordSysFromHeading(&ship->rotinfo.coordsys,&vect2); break; case 8: matCreateCoordSysFromHeading(&ship->rotinfo.coordsys,&vect3); break; } } }
void ModifyRepairEffect(Effect *effect,Ship *ship,vector *trajectory,real32 distance, SpaceObjRotImpTarg *target) { ShipStaticInfo *shipstatic = (ShipStaticInfo *)ship->staticinfo; RepairNozzleStatic *repnozzlestatic = shipstatic->repairNozzleStatic; vector repairBeamPosition; dbgAssertOrIgnore(effect); matMultiplyMatByVec(&repairBeamPosition,&ship->rotinfo.coordsys,&repnozzlestatic->position); vecAdd(effect->posinfo.position,repairBeamPosition,ship->posinfo.position); matCreateCoordSysFromHeading(&effect->rotinfo.coordsys,trajectory); distance = max(200.0f,distance); if(target->objtype == OBJ_ShipType) { if(((Ship *)target)->shiptype == Mothership) { distance = max(800.0f,distance); } } ((real32 *)effect->variable)[ETG_ResourceLengthParam] = distance; ((real32 *)effect->variable)[ETG_ResourceRadiusParam] = target->staticinfo->staticheader.staticCollInfo.collspheresize; }
void startRepairEffect(Ship *ship,SpaceObjRotImpTarg *target,vector *trajectory,real32 distance) { ShipStaticInfo *shipstatic = (ShipStaticInfo *)ship->staticinfo; RepairNozzleStatic *repnozzlestatic = shipstatic->repairNozzleStatic; //TURN ON EFFECT HERE // //Use ship->rceffect, since ship isn't a resource collector, //the pointer isn't being used etglod *etgLOD = etgSpecialPurposeEffectTable[EGT_REPAIR_BEAM]; etgeffectstatic *stat; sdword LOD; udword intLength; udword intWidth; matrix coordsys; real32 targetRadius = target->staticinfo->staticheader.staticCollInfo.collspheresize; vector repairBeamPosition; matMultiplyMatByVec(&repairBeamPosition,&ship->rotinfo.coordsys,&repnozzlestatic->position); matCreateCoordSysFromHeading(&coordsys,trajectory); intLength = TreatAsUdword(distance); intWidth = TreatAsUdword(targetRadius); vecAddTo(repairBeamPosition,ship->posinfo.position); //create an effect for bullet, if applicable if (etgLOD != NULL) { LOD = ship->currentLOD; if (LOD >= etgLOD->nLevels) { stat = NULL; } else { stat = etgLOD->level[LOD]; } } else { stat = NULL; } #if ETG_DISABLEABLE if (stat != NULL && etgEffectsEnabled && !etgFrequencyExceeded(stat)) #else if (stat != NULL && !etgFrequencyExceeded(stat)) #endif { ship->rceffect = etgEffectCreate(stat, ship, &repairBeamPosition, &ship->posinfo.velocity, &coordsys, 1.0f, EAF_Velocity | EAF_NLips, 2, intLength, intWidth); } else { ship->rceffect = NULL; //play no effect } }
void defensefightertargetbullet(Ship *ship, Bullet *bullettotarget) { DefenseFighterSpec *spec = (DefenseFighterSpec *)ship->ShipSpecifics; DefenseFighterStatics *defensefighterstatics; DefenseStruct *newdefensestruct; Bullet *laser; GunStatic *gunstatic; Gun *gun; ShipStaticInfo *shipstatic; vector positionInWorldCoordSys,tempvec; real32 floatDamage; udword intDamage; udword intVelocity; udword intLength; etgeffectstatic *stat; etglod *etgLOD; sdword LOD; Effect *newEffect; #ifdef HW_BUILD_FOR_DEBUGGING /* dbgMessagef("B: %d %x %x %f %f %f %x %f %x",universe.univUpdateCounter, bullettotarget->flags, bullettotarget->owner, bullettotarget->timelived, bullettotarget->damage, bullettotarget->damageFull, bullettotarget->SpecialEffectFlag, bullettotarget->BulletSpeed, bullettotarget); */ #endif gun = &ship->gunInfo->guns[0]; gunstatic = gun->gunstatic; shipstatic = (ShipStaticInfo *)ship->staticinfo; defensefighterstatics = (DefenseFighterStatics *) ((ShipStaticInfo *)(ship->staticinfo))->custstatinfo; bitSet(bullettotarget->SpecialEffectFlag, 0x0002); //set the flag laser = memAlloc(sizeof(Bullet),"Bullet",0); memset(laser,0,sizeof(Bullet)); // for safety laser->objtype = OBJ_BulletType; laser->flags = 0; laser->staticinfo = NULL; ClearNode(laser->renderlink); laser->currentLOD = ship->currentLOD; laser->cameraDistanceSquared = ship->cameraDistanceSquared; laser->soundType = gunstatic->gunsoundtype; laser->bulletType = BULLET_Laser; laser->owner = ship; laser->gunowner = gun; laser->target = NULL; laser->bulletColor = etgBulletColor[shipstatic->shiprace][laser->soundType]; laser->bulletmass = 0.0f; //gunstatic->bulletmass; laser->lengthmag = 600.0f; laser->damage = frandombetween(defensefighterstatics->DamageReductionLow, defensefighterstatics->DamageReductionHigh); laser->timelived = 0.0f; laser->totallifetime = 100.0f; //laser will only live for a sec anyways... laser->SpecialEffectFlag = 0; laser->traveldist = gunstatic->bulletlength; laser->beamtraveldist = gunstatic->bulletlength; //SET_MOVING_LINEARLY(laser->posinfo.isMoving); //laser->posinfo.haventCalculatedDist = TRUE; laser->DFGFieldEntryTime = 0.0f; matMultiplyMatByVec(&positionInWorldCoordSys,&ship->rotinfo.coordsys,&gunstatic->position); vecAdd(laser->posinfo.position,positionInWorldCoordSys,ship->posinfo.position); vecSub(laser->lengthvec, bullettotarget->posinfo.position, laser->posinfo.position); // heading tempvec = laser->lengthvec; vecNormalize(&tempvec); //matMultiplyMatByVec(&gunheadingInWorldCoordSys, &ship->rotinfo.coordsys, &tempvec); //laser->bulletheading = gunheadingInWorldCoordSys; laser->bulletheading = tempvec; matCreateCoordSysFromHeading(&laser->rotinfo.coordsys,&tempvec); vecZeroVector(laser->posinfo.velocity); //Laser effect... floatDamage = (real32)laser->damage; intDamage = TreatAsUdword(floatDamage); intVelocity = TreatAsUdword(gunstatic->bulletspeed); intLength = TreatAsUdword(gunstatic->bulletlength); //create an effect for bullet, if applicable etgLOD = etgGunEventTable[shipstatic->shiprace][gunstatic->gunsoundtype][EGT_GunBullet];//get pointer to bullet effect //etgLOD = etgGunEventTable[0][gunstatic->gunsoundtype][EGT_GunBullet];//get pointer to bullet effect //in future change back to proper one above... if (etgLOD != NULL) { if (bullettotarget != NULL) { LOD = min(ship->currentLOD, bullettotarget->currentLOD); } else { LOD = ship->currentLOD; } if (LOD >= etgLOD->nLevels) { stat = NULL; } else { stat = etgLOD->level[LOD]; } } else { stat = NULL; } #if ETG_DISABLEABLE if (stat != NULL && etgBulletEffectsEnabled && etgEffectsEnabled && !etgFrequencyExceeded(stat)) #else if (stat != NULL && etgBulletEffectsEnabled && !etgFrequencyExceeded(stat)) #endif { laser->effect = etgEffectCreate(stat, laser, NULL, NULL, NULL, 1.0f, EAF_AllButNLips, 3, intDamage, intVelocity, intLength); // univAddObjToRenderListIf((SpaceObj *)laser->effect,(SpaceObj *)ship); // add to render list if parent ship is in render list //do length calculations :) ((real32 *)laser->effect->variable)[ETG_LengthVariable] = fsqrt(vecMagnitudeSquared(laser->lengthvec)); } else { laser->effect = NULL; //play no effect for this bullet } // laser->effect = NULL; //need for render...add later? laser->hitEffect = etgGunEventTable[shipstatic->shiprace][bullettotarget->gunowner->gunstatic->gunsoundtype][EGT_BulletDestroyed];//get pointer to bullet effect if (ship->soundevent.burstHandle < 0) { soundEventBurstFire(ship, gun); } etgLOD = etgGunEventTable[shipstatic->shiprace][gunstatic->gunsoundtype][EGT_GunFire];//get pointer to bullet effect if (etgLOD != NULL) { LOD = ship->currentLOD; if (LOD >= etgLOD->nLevels) { stat = NULL; } else { stat = etgLOD->level[LOD]; } } else { stat = NULL; } #if ETG_DISABLEABLE if (stat != NULL && etgEffectsEnabled && etgFireEffectsEnabled && !etgFrequencyExceeded(stat)) #else if (stat != NULL && etgFireEffectsEnabled && !etgFrequencyExceeded(stat)) #endif { //if there is a gun fire effect newEffect = etgEffectCreate(stat, laser, NULL, NULL, NULL, 1.0f, EAF_AllButNLips, 1, intDamage); // univAddObjToRenderListIf((SpaceObj *)newEffect,(SpaceObj *)ship); // add to render list if parent ship is in render list } /* //spawn bullet hitting effect etgLOD = etgTractorBeamEffectTable[ship->shiprace]; //etgLOD = etgGunEventTable[shipstatic->shiprace][gunstatic->gunsoundtype][EGT_GunFire];//get pointer to bullet effect if (etgLOD != NULL) { LOD = ship->currentLOD; if (LOD >= etgLOD->nLevels) { stat = NULL; } else { stat = etgLOD->level[LOD]; } } else { stat = NULL; } #if ETG_DISABLEABLE if (stat != NULL && etgEffectsEnabled) #else if (stat != NULL) #endif { //if there is a gun fire effect // size = etgEffectSize(stat->nParticleBlocks);//compute size of effect size = stat->effectSize; newEffect = memAlloc(size, "DefenseFHittingEffect", 0); //allocate the new effect newEffect->objtype = OBJ_EffectType; newEffect->flags = SOF_Rotatable | SOF_AttachVelocity | SOF_AttachPosition | SOF_AttachCoordsys; newEffect->staticinfo = (StaticInfo *)stat; ClearNode(newEffect->renderlink); newEffect->currentLOD = LOD; newEffect->cameraDistanceSquared = ship->cameraDistanceSquared; newEffect->timeElapsed = 0.0f; //brand new heavies floatDamage = 30.0f; intDamage = TreatAsUdword(floatDamage); newEffect->rotinfo.coordsys = bullettotarget->rotinfo.coordsys; newEffect->posinfo.position = bullettotarget->posinfo.position; //start at same spot as bullet newEffect->posinfo.velocity = bullettotarget->posinfo.velocity; //start at same spot as bullet etgEffectCodeStart(stat, newEffect, 1, intDamage);//get the code a-runnin' SET_MOVING_IMMOBILE(newEffect->posinfo.isMoving); newEffect->posinfo.haventCalculatedDist = TRUE; univUpdateObjRotInfo((SpaceObjRot *)newEffect); // newEffect->owner = NULL; // nothing owns this effect newEffect->owner = (Ship *) bullettotarget; listAddNode(&universe.SpaceObjList,&(newEffect->objlink),newEffect); univAddObjToRenderListIf((SpaceObj *)newEffect,(SpaceObj *)ship); // add to render list if parent ship is in render list } */ //Not sure If I need to add... listAddNode(&universe.SpaceObjList,&(laser->objlink),laser); listAddNode(&universe.BulletList,&(laser->bulletlink),laser); univAddObjToRenderListIf((SpaceObj *)laser,(SpaceObj *)ship); // add to render list if parent ship is in render list newdefensestruct = memAlloc(sizeof(DefenseStruct),"DS(DefenseStruct)",Pyrophoric); newdefensestruct->bullet = bullettotarget; newdefensestruct->CoolDown = FALSE; newdefensestruct->CoolDownTime = 0.0f; newdefensestruct->LaserDead = FALSE; listAddNode(&spec->DefenseList,&newdefensestruct->bulletnode,newdefensestruct); newdefensestruct->laser = laser; if(bitTest(ship->flags,SOF_CloakGenField)) { bitSet(ship->flags,SOF_DeCloaking); bitClear(ship->flags,SOF_Cloaked); bitClear(ship->flags,SOF_Cloaking); } }
void defenseFighterAdjustLaser(Bullet *laser) { //calculates laser direction n' such for rendering... DefenseFighterSpec *spec; // DefenseFighterStatics *defensefighterstatics; Node *bulletnode; DefenseStruct *defensestruct; Ship *ship; vector tempvec; GunStatic *gunstatic; Gun *gun; vector positionInWorldCoordSys; if(laser->owner == NULL) return; ship = laser->owner; gun = &ship->gunInfo->guns[0]; gunstatic = gun->gunstatic; spec= (DefenseFighterSpec *)ship->ShipSpecifics; // defensefighterstatics = (DefenseFighterStatics *) ((ShipStaticInfo *)(ship->staticinfo))->custstatinfo; bulletnode = spec->DefenseList.head; while (bulletnode != NULL) { //as long as theres a bullet to deal with defensestruct = (DefenseStruct *)listGetStructOfNode(bulletnode); if(defensestruct->LaserDead == TRUE) { bulletnode = bulletnode->next; continue; } if(laser == defensestruct->laser) { dbgAssertOrIgnore(defensestruct->bullet != NULL); matMultiplyMatByVec(&positionInWorldCoordSys,&ship->rotinfo.coordsys,&gunstatic->position); vecAdd(laser->posinfo.position,positionInWorldCoordSys,ship->posinfo.position); vecSub(laser->lengthvec, defensestruct->bullet->posinfo.position, laser->posinfo.position); // heading tempvec = defensestruct->laser->lengthvec; vecNormalize(&tempvec); //matMultiplyMatByVec(&gunheadingInWorldCoordSys, &ship->rotinfo.coordsys, &tempvec); //laser->bulletheading = gunheadingInWorldCoordSys; defensestruct->laser->bulletheading = tempvec; matCreateCoordSysFromHeading(&defensestruct->laser->rotinfo.coordsys,&tempvec); if(defensestruct->laser->effect != NULL) { //adjust length ((real32 *)defensestruct->laser->effect->variable)[ETG_LengthVariable] = fsqrt(vecMagnitudeSquared(defensestruct->laser->lengthvec)); } return; } bulletnode = bulletnode->next; } //we shouldn't get to this point :) //dbgMessagef("Laser Drawn doesn't exist in defense fighter records."); //on further reflection..if we kill the laster...but it doesn't go bye bye, we might get here... }
void DefenseFighterHouseKeep(Ship *ship) { DefenseFighterSpec *spec = (DefenseFighterSpec *)ship->ShipSpecifics; DefenseFighterStatics *defensefighterstatics; Node *bulletnode; Node *tempnode; DefenseStruct *defensestruct; vector seperationvector; vector tempvec,rot_vector; GunStatic *gunstatic; Gun *gun; vector positionInWorldCoordSys; gun = &ship->gunInfo->guns[0]; gunstatic = gun->gunstatic; defensefighterstatics = (DefenseFighterStatics *) ((ShipStaticInfo *)(ship->staticinfo))->custstatinfo; bulletnode = spec->DefenseList.head; while (bulletnode != NULL) { //as long as theres a bullet to deal with defensestruct = (DefenseStruct *)listGetStructOfNode(bulletnode); /* if (defensestruct->bullet) dbgMessagef("DS: %d %f %d %f %d %d", universe.univUpdateCounter, defensestruct->bullet->collOptimizeDist, defensestruct->laser ? 1:0, defensestruct->CoolDownTime, defensestruct->CoolDown ? 1:0, defensestruct->LaserDead ? 1:0); else dbgMessagef("DS: %d N %d %f %d %d", universe.univUpdateCounter, defensestruct->laser ? 1:0, defensestruct->CoolDownTime, defensestruct->CoolDown ? 1:0, defensestruct->LaserDead ? 1:0);*/ if(!defensestruct->CoolDown) { //laser cannon isn't cooling down, so continue tracking if (defensestruct->bullet == NULL || defensestruct->bullet->damage <= 0) { //bullet is already dead...don't kill it again defensestruct->bullet = NULL; //destroy pointer... if (defensestruct->laser != NULL) { defensestruct->laser->timelived =10000.0f; //kill laser } defensestruct->LaserDead = TRUE; //set killed flag defensestruct->laser=NULL; defensestruct->CoolDown = TRUE; //begin laser cooldown defensestruct->CoolDownTime = 0.0f; //reset to 0 for cooldown count bulletnode=bulletnode->next; continue; } if((universe.univUpdateCounter & defensefighterstatics->DamageRate) == 0) { // Time to do damage... //Do damage to bullet defensestruct->bullet->damage = (defensestruct->bullet->damage - frandombetween(defensefighterstatics->DamageReductionLow,defensefighterstatics->DamageReductionHigh)); if(defensestruct->bullet->damage <= 0) { //bullet is destroyed DefenseFighterDestroyedABullet(ship, defensestruct->bullet, defensestruct->laser); defensestruct->bullet->damage = 0; //cap at 0; defensestruct->bullet = NULL; //destroy pointer... //dbgMessagef("Defense Fighter Destroyed A Bullet."); if (defensestruct->laser != NULL) { defensestruct->laser->timelived =10000.0f; //kill laser } defensestruct->LaserDead = TRUE; //set killed flag if(defensestruct->laser->effect != NULL) { univRemoveObjFromRenderList((SpaceObj *) defensestruct->laser->effect); } defensestruct->laser=NULL; defensestruct->CoolDown = TRUE; //begin laser cooldown defensestruct->CoolDownTime = 0.0f; //reset to 0 for cooldown count } } if(defensestruct->laser != NULL) { //check if bullet is still in range and infront... if((universe.univUpdateCounter & defensefighterstatics->RangeCheckRate) == 0) { //time to check if in front vecSub(seperationvector, ship->posinfo.position, defensestruct->bullet->posinfo.position); if(vecMagnitudeSquared(seperationvector) > ship->staticinfo->bulletRangeSquared[ship->tacticstype]) { //bullet is out of range defensestruct->laser->timelived =10000.0f; //kill laser defensestruct->LaserDead = TRUE; //set killed flag if(defensestruct->laser->effect != NULL) { univRemoveObjFromRenderList((SpaceObj *) defensestruct->laser->effect); } defensestruct->laser=NULL; //dbgMessagef("Bullet out of range."); bitClear(defensestruct->bullet->SpecialEffectFlag,0x0002); defensestruct->CoolDown = TRUE; //begin laser cooldown defensestruct->bullet = NULL; //set target to NULL so it isn't referenced again! defensestruct->CoolDownTime = 0.0f; //reset to 0 for cooldown count } else if(!defensefighterCheckInFront(ship, defensestruct->bullet)) { //if bullet ISN'T in front defensestruct->laser->timelived =10000.0f; //kill laser defensestruct->LaserDead = TRUE; //set killed flag if(defensestruct->laser->effect != NULL) { univRemoveObjFromRenderList((SpaceObj *) defensestruct->laser->effect); } defensestruct->laser=NULL; //dbgMessagef("Bullet Not infront anymore...stop tracking."); if(defensefighterstatics->MultipleTargettingofSingleBullet) { bitClear(defensestruct->bullet->SpecialEffectFlag,0x0002); } defensestruct->CoolDown = TRUE; //begin laser cooldown defensestruct->bullet = NULL; //set target to NULL so it isn't referenced again! defensestruct->CoolDownTime = 0.0f; //reset to 0 for cooldown count } } } //This code is for the sake of the visual effect which STILL won't work //properly!!! So it is temperary only! if(defensestruct->laser != NULL) { //update bullent info...for visual effect dbgAssertOrIgnore(defensestruct->bullet != NULL); matMultiplyMatByVec(&positionInWorldCoordSys,&ship->rotinfo.coordsys,&gunstatic->position); vecAdd(defensestruct->laser->posinfo.position,positionInWorldCoordSys,ship->posinfo.position); vecSub(defensestruct->laser->lengthvec, defensestruct->bullet->posinfo.position, defensestruct->laser->posinfo.position); // heading tempvec = defensestruct->laser->lengthvec; vecNormalize(&tempvec); //matMultiplyMatByVec(&gunheadingInWorldCoordSys, &ship->rotinfo.coordsys, &tempvec); //laser->bulletheading = gunheadingInWorldCoordSys; defensestruct->laser->bulletheading = tempvec; matCreateCoordSysFromHeading(&defensestruct->laser->rotinfo.coordsys,&tempvec); if(defensestruct->laser->effect != NULL) { //adjust length ((real32 *)defensestruct->laser->effect->variable)[ETG_LengthVariable] = fsqrt(vecMagnitudeSquared(defensestruct->laser->lengthvec)); } } } else { //this laser cannon is cooling, so cool it defensestruct->CoolDownTime += universe.phystimeelapsed; if(defensestruct->CoolDownTime > defensefighterstatics->CoolDownTimePerLaser) { //Laser Terminal has cooled down...so free it up tempnode = bulletnode->next; listDeleteNode(bulletnode); //dbgMessagef("Deleting defense node in CoolDown."); bulletnode = tempnode; continue; } } bulletnode = bulletnode->next; } if (spec->DefenseList.num == 0) { soundEventBurstStop(ship, gun); } //do special rotation if neccessary if(bitTest(ship->dontrotateever,1)) { //matGetVectFromMatrixCol3(rot_vector,ship->rotinfo.coordsys); vecSet(rot_vector,100.0f,0.0f,0.0f); vecAddTo(ship->rotinfo.torque, rot_vector); vecCapVectorSloppy(&ship->rotinfo.rotspeed, defensefighterstatics->max_rot_speed ); spec->rotate_time_counter -= universe.phystimeelapsed; if(spec->rotate_time_counter <= 0.0f) { bitClear(ship->dontrotateever,1); spec->DefenseFighterCanNowRotate = FALSE; } } else if (spec->DefenseFighterCanNowRotate == FALSE) { spec->rotate_time_counter += universe.phystimeelapsed; if(spec->rotate_time_counter >= defensefighterstatics->rotate_recover_time) { spec->DefenseFighterCanNowRotate = TRUE; spec->rotate_time_counter = defensefighterstatics->rotate_time; } } }
void wkTradeUpdate(void) { Ship *ship; Resource *resource; wkTradeType *trader; real32 vel; vector vect; //sword index; Node *objnode; objnode = universe.ShipList.head; if (wkTradeControlShip) { wkTradeControl(); trader = wkTradeControlShip; ship = trader->ship; //dbgAssertOrIgnore(ship->objtype == OBJ_ShipType); if (ship->objtype != OBJ_ShipType) { //ship has exploded wkTradeControlShip = NULL; } if (trader->controlthrust) { if (trader->controlthrust > 0) { trader->vx += fcos(trader->ang)*trader->acc; trader->vy += fsin(trader->ang)*trader->acc; } else { trader->vx -= fcos(trader->ang)*trader->revacc; trader->vy -= fsin(trader->ang)*trader->revacc; } } if (trader->controlstrafe) { trader->vx += fsin(trader->ang) *trader->acc*trader->controlstrafe; trader->vy += fcos(trader->ang) *trader->acc*trader->controlstrafe; } if (trader->controlfire) { Ship *ship = trader->ship; ShipStaticInfo *shipstatic = (ShipStaticInfo *)ship->staticinfo; if (shipstatic->custshipheader.CustShipFire != NULL) { shipstatic->custshipheader.CustShipFire(ship,NULL); } } vel = fsqrt(trader->vx*trader->vx + trader->vy*trader->vy); if (vel > trader->maxvel) { trader->vx *= trader->maxvel/vel; trader->vy *= trader->maxvel/vel; } trader->x += trader->vx; trader->y += trader->vy; trader->ang += trader->vang; if (trader->controlrot) { trader->vang += trader->controlrot*trader->vangacc; if (ABS(trader->vang) > trader->vangmax) { if (trader->vang>0) trader->vang = trader->vangmax; else trader->vang = -trader->vangmax; } } else { if (ABS(trader->vang) < trader->vangacc) { trader->vang = 0.0f; } else { if (trader->vang > 0) trader->vang -= trader->vangacc; else trader->vang += trader->vangacc; } } ship->posinfo.position.x = trader->x; ship->posinfo.position.y = trader->y; ship->posinfo.position.z = 0.0f; ship->posinfo.velocity.x = trader->vx*WK_VEL_SCALE; ship->posinfo.velocity.y = trader->vy*WK_VEL_SCALE; vect.x = fcos(trader->ang); vect.y = fsin(trader->ang); vect.z = 0; matCreateCoordSysFromHeading(&ship->rotinfo.coordsys,&vect); } //now update all ships objnode = universe.ShipList.head; while (objnode != NULL) { ship = (Ship *)listGetStructOfNode(objnode); dbgAssertOrIgnore(ship->objtype == OBJ_ShipType); ship->posinfo.position.z = 0.0f; objnode = objnode->next; } //resources objnode = universe.ResourceList.head; while (objnode != NULL) { resource = (Resource *)listGetStructOfNode(objnode); dbgAssertOrIgnore(resource->flags & SOF_Resource); resource->posinfo.position.z = 0.0f; objnode = objnode->next; } }