/* Updates the camera position/angle along with the object movement */ bool processWarCam( void ) { BASE_OBJECT *foundTarget; bool Status = true; /* Get out if the camera isn't active */ if(trackingCamera.status == CAM_INACTIVE) { return(true); } /* Ensure that the camera only ever flips state within this routine! */ switch(trackingCamera.status) { case CAM_REQUEST: /* See if we can find the target to follow */ foundTarget = camFindTarget(); if(foundTarget && !foundTarget->died) { /* We've got one, so store away info */ camAllignWithTarget(foundTarget); /* We're now into tracking status */ trackingCamera.status = CAM_TRACKING; /* Inform via console */ if(foundTarget->type == OBJ_DROID) { if(getWarCamStatus()) { CONPRINTF(ConsoleString,(ConsoleString,"WZ/CAM - %s",droidGetName((DROID*)foundTarget))); } } } else { /* We've requested a track with no droid selected */ trackingCamera.status = CAM_INACTIVE; } break; case CAM_TRACKING: /* Track the droid unless routine comes back false */ if(!camTrackCamera()) { /* Camera track came back false, either because droid died or is no longer selected, so reset to old values */ foundTarget = camFindTarget(); if(foundTarget && !foundTarget->died) { trackingCamera.status = CAM_REQUEST; } else { trackingCamera.status = CAM_RESET; } } processLeaderSelection(); break; case CAM_RESET: /* Reset camera to pre-droid tracking status */ if( (trackingCamera.target==NULL) ||(trackingCamera.target->type!=OBJ_TARGET)) { camSwitchOff(); } /* Switch to inactive mode */ trackingCamera.status = CAM_INACTIVE; Status = false; break; case CAM_INACTIVE: case CAM_TRACK_OBJECT: case CAM_TRACK_LOCATION: ASSERT(false, "Unexpected status for tracking camera"); break; } return Status; }
/* Updates the camera position/angle along with the object movement */ BOOL processWarCam( void ) { BASE_OBJECT *foundTarget; BOOL Status = true; /* Get out if the camera isn't active */ if(trackingCamera.status == CAM_INACTIVE) { return(true); } /* Ensure that the camera only ever flips state within this routine! */ switch(trackingCamera.status) { case CAM_REQUEST: /* See if we can find the target to follow */ foundTarget = camFindTarget(); if(foundTarget && !foundTarget->died) { /* We've got one, so store away info */ camAllignWithTarget(foundTarget); /* We're now into tracking status */ trackingCamera.status = CAM_TRACKING; /* Inform via console */ if(foundTarget->type == OBJ_DROID) { if(getWarCamStatus()) { CONPRINTF(ConsoleString,(ConsoleString,"WZ/CAM - %s",droidGetName((DROID*)foundTarget))); } } else { // CONPRINTF(ConsoleString,(ConsoleString,"DROID-CAM V0.1 Enabled - Now tracking new location")); } } else { /* We've requested a track with no droid selected */ // addConsoleMessage("Droid-CAM V0.1 ERROR - No targets(s) selected",DEFAULT_JUSTIFY,SYSTEM_MESSAGE); trackingCamera.status = CAM_INACTIVE; } break; case CAM_TRACKING: /* Track the droid unless routine comes back false */ if(!camTrackCamera()) { /* Camera track came back false, either because droid died or is no longer selected, so reset to old values */ foundTarget = camFindTarget(); if(foundTarget && !foundTarget->died) { trackingCamera.status = CAM_REQUEST; } else { trackingCamera.status = CAM_RESET; } } processLeaderSelection(); break; case CAM_RESET: /* Reset camera to pre-droid tracking status */ if( (trackingCamera.target==NULL) ||(trackingCamera.target->type!=OBJ_TARGET)) { camSwitchOff(); } /* Switch to inactive mode */ trackingCamera.status = CAM_INACTIVE; // addConsoleMessage("Droid-CAM V0.1 Disabled",DEFAULT_JUSTIFY,SYSTEM_MESSAGE); Status = false; break; default: debug( LOG_FATAL, "Weirdy status for tracking Camera" ); abort(); break; } return Status; }