BOOL CCalendarCtrl::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) { COleDateTime newDate = m_DateCurrent; if(zDelta < 0){ // SendMessage(WM_VSCROLL,SB_LINEDOWN); newDate += COleDateTimeSpan(7,0,0,0); if((m_BoundUp > newDate) && (newDate > m_BoundDown)) { m_nVscrollPos++; SetScrollPos(SB_VERT, m_nVscrollPos, TRUE); Goto(newDate); return TRUE; } } else if(zDelta > 0){ // SendMessage(WM_VSCROLL,SB_LINEUP); newDate -= COleDateTimeSpan(7,0,0,0); if((m_BoundUp > newDate) && (newDate > m_BoundDown)) { m_nVscrollPos--; SetScrollPos(SB_VERT, m_nVscrollPos, TRUE); Goto(newDate); return TRUE; } } return CWnd::OnMouseWheel(nFlags, zDelta, pt); }
void DoSpecificDisaster(disaster_t disaster, UInt16 x, UInt16 y) { Int16 ce = 0; Int16 i = 0; do { switch (disaster) { case diFireOutbreak: ce = BurnField(x, y, (UInt16)0); break; case diPlantExplosion: ce = 0; break; case diMonster: ce = CreateMonster(x, y); break; case diDragon: ce = CreateDragon(x, y); break; case diMeteor: ce = MeteorDisaster(x, y); break; default: break; } } while (i++ < 400 && ce == 0); if (ce) { UIDisasterNotify(disaster); Goto(x, y, goto_center); MapHasJumped(); } }
Debugger_Disasm::Debugger_Disasm(DebugInterface *_cpu, MainWindow* mainWindow_, QWidget *parent) : QDialog(parent), ui(new Ui::Debugger_Disasm), cpu(_cpu), mainWindow(mainWindow_) { ui->setupUi(this); vfpudlg = new Debugger_VFPU(_cpu, mainWindow, this); ui->DisasmView->setWindowTitle(_cpu->GetName()); QObject::connect(ui->RegListScroll,SIGNAL(actionTriggered(int)), ui->RegList, SLOT(scrollChanged(int))); QObject::connect(ui->RegList,SIGNAL(GotoDisasm(u32)),this,SLOT(Goto(u32))); QObject::connect(this, SIGNAL(updateDisplayList_()), this, SLOT(UpdateDisplayListGUI())); QObject::connect(this, SIGNAL(UpdateBreakpoints_()), this, SLOT(UpdateBreakpointsGUI())); QObject::connect(this, SIGNAL(UpdateThread_()), this, SLOT(UpdateThreadGUI())); CtrlDisAsmView *ptr = ui->DisasmView; ptr->setDebugger(cpu); ptr->setParentWindow(this); ptr->gotoAddr(0x00000000); CtrlRegisterList *rl = ui->RegList; rl->setParentWindow(this); rl->setCPU(cpu); FillFunctions(); }
void DefuseDynamite::Enter() { mTargetPosition = mMapGoal->GetWorldBounds().Center; FINDSTATEIF( FollowPath, GetRootState(), Goto( this, Run ) ); Tracker.InProgress = mMapGoal; }
void TakeCheckPoint::Enter() { mTargetPosition = mMapGoal->GetWorldBounds().Center; FINDSTATEIF( FollowPath, GetRootState(), Goto( this, Run, true ) ); Tracker.InProgress = mMapGoal; }
void ReviveTeammate::Enter() { mGoalState = REVIVING; FINDSTATEIF( FollowPath, GetRootState(), Goto( this, Run ) ); Tracker.InProgress = mMapGoal; }
void BuildConstruction::Enter() { mAdjustedPosition = false; mConstructionPos = mMapGoal->GetWorldBounds().Center; FINDSTATEIF( FollowPath, GetRootState(), Goto( this, Run, true ) ); Tracker.InProgress = mMapGoal; }
PG_Widget* PG_Navigator::GotoFirst() { iterator i = begin(); if(i == end()) { return NULL; } return Goto(*i); }
PG_Widget* PG_Navigator::GotoNext() { iterator i = find(begin(), end(), my_currentWidget); if(i == end()) { return NULL; } i++; return Goto(*i); }
PG_Widget* PG_Navigator::GotoPrev() { iterator i = find(begin(), end(), my_currentWidget); if(i == begin()) { return NULL; } i--; return Goto(*i); }
void GotoEv(wxCommandEvent& ev) { unsigned long l; wxString v = goto_addr->GetValue(); if (v.empty()) return; v.ToULong(&l, 16); Goto(l); }
void PlantMine::Enter() { // generate a random position in the goal radius float fRandDistance = Mathf::IntervalRandom( 0.0f, mMapGoal->GetRadius() ); Quaternionf quat( Vector3f::UNIT_Y, Mathf::DegToRad( Mathf::IntervalRandom( 0.0f, 360.0f ) ) ); mTargetPosition = mMapGoal->GetPosition() + quat.Rotate( Vector3f::UNIT_Y * fRandDistance ); FINDSTATEIF( FollowPath, GetRootState(), Goto( this, Run, true ) ); Tracker.InProgress = mMapGoal; }
//========================================================= bool Parser::DelimitedStatement () { PrintRule rule("DelimitedStatement"); return rule.Accept( Label() || Goto() || Return() || Accept(TokenType::Break) || Accept(TokenType::Continue) || Var() || Expression() ); }
void PlantExplosive::Enter() { // set position to base of construction Box3f obb = mMapGoal->GetWorldBounds(); mExplosivePosition = obb.GetCenterBottom(); mTargetPosition = mExplosivePosition; mAdjustedPosition = false; mGoalState = LAY_EXPLOSIVE; FINDSTATEIF( FollowPath, GetRootState(), Goto( this, Run, true ) ); Tracker.InProgress = mMapGoal; }
PG_Widget* PG_Navigator::GotoLast() { if(size() == 0) { return NULL; } if(size() == 1) { return GotoFirst(); } iterator i = end(); i--; return Goto(*i); }
bool SynscanDriver::GotoAzAlt(double az, double alt) { char cmd[SYN_RES] = {0}, res[SYN_RES] = {0}; if (isSimulation()) return true; if (m_isAltAz == false) { // For EQ Mount, we convert Parking Az/Alt to RA/DE and go to there. struct ln_lnlat_posn observer; ln_hrz_posn horizontalPos; ln_equ_posn equatorialPos; observer.lng = LocationN[LOCATION_LONGITUDE].value; if (observer.lng > 180) observer.lng -= 360; observer.lat = LocationN[LOCATION_LATITUDE].value; horizontalPos.az = az + 180; if (horizontalPos.az > 360) horizontalPos.az -= 360; horizontalPos.alt = alt; ln_get_equ_from_hrz(&horizontalPos, &observer, ln_get_julian_from_sys(), &equatorialPos); return Goto(equatorialPos.ra / 15.0, equatorialPos.dec); } // Az/Alt to encoders uint32_t n1 = az / 360.0 * 0x100000000; uint32_t n2 = alt / 360.0 * 0x100000000; LOGF_DEBUG("Goto - Az: %.2f Alt: %.2f", az, alt); snprintf(cmd, SYN_RES, "b%08X,%08X", n1, n2); if (sendCommand(cmd, res, 18)) { TrackState = SCOPE_SLEWING; HorizontalCoordsNP.s = IPS_BUSY; IDSetNumber(&HorizontalCoordsNP, nullptr); return true; } return false; }
void MountMg42::Enter() { mScanDirection = SCAN_MIDDLE; mNextScanTime = IGame::GetTime() + (int)Mathf::IntervalRandom( 2000.0f, 7000.0f ); mAimPoint = mMapGoal->GetPosition(); mMG42Position = mAimPoint; mScanLeft = Vector3f::ZERO; mScanRight = Vector3f::ZERO; mGotGunProperties = false; FINDSTATEIF( FollowPath, GetRootState(), Goto( this, Run, true ) ); Tracker.InProgress = mMapGoal; mTargetZone.Restart( 256.f ); }
void CDisasm::gotoBreakpointAddress(int itemIndex) { bool isMemory; int index = getBreakpointIndex(itemIndex,isMemory); if (index == -1) return; if (isMemory) { u32 address = displayedMemChecks_[index].start; for (int i=0; i<numCPUs; i++) if (memoryWindow[i]) memoryWindow[i]->Goto(address); } else { u32 address = displayedBreakPoints_[index].addr; Goto(address); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } }
void List<T>::Insert( T* p, int n ) { assert(p); assert(n>=0); // Check input if( !p || (n<0) ) return; // Initialise item p->Next(0); p->Prev(0); // Do insertion if( n >= m_nCount ) Append(p); else { T* pTag = Goto( n ); if( pTag->Prev() == 0 ) { // First m_pList = p; m_pCurrent = p; p->Next( pTag ); pTag->Prev( p ); } else { // Middle m_pCurrent = p; p->Next( pTag ); p->Prev( pTag->Prev() ); pTag->Prev()->Next( p ); pTag->Prev( p ); } m_nCount++; } }
void CCalendarCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { int nInc = 0; switch (nSBCode) { case SB_TOP: case SB_LINEUP: case SB_PAGEUP: nInc = -1; break; case SB_BOTTOM: case SB_LINEDOWN: case SB_PAGEDOWN: nInc = 1; break; case SB_THUMBTRACK: nInc = nPos - m_nVscrollPos; break; case SB_ENDSCROLL: default: nInc = 0; } m_nVscrollPos += nInc; if(nInc) { COleDateTime newDate = m_DateCurrent; if(nInc > 0) newDate += COleDateTimeSpan(abs(7*nInc),0,0,0); else newDate -= COleDateTimeSpan(abs(7*nInc),0,0,0); if((m_BoundUp > newDate) && (newDate > m_BoundDown)) Goto(newDate); else m_nVscrollPos -= nInc; SetScrollPos(SB_VERT, m_nVscrollPos, TRUE); } SetFocus(); CWnd::OnVScroll(nSBCode, nPos, pScrollBar); }
T* List<T>::Remove( int n ) { assert(n>=0); assert(n<m_nCount); T* pTag = 0; if( (n>=0) && m_nCount && (n<m_nCount) ) { pTag = Goto( n ); if( pTag->Prev() == 0 ) { // First m_pList = pTag->Next(); m_pCurrent = pTag->Next(); if( m_pCurrent ) m_pCurrent->Prev( 0 ); } else if( pTag->Next() == 0 ) { // Last m_pCurrent = pTag->Prev(); m_pCurrent->Next( 0 ); m_nIndex--; } else { // Middle m_pCurrent = pTag->Next(); m_pCurrent->Prev( pTag->Prev() ); m_pCurrent->Prev()->Next( m_pCurrent ); } m_nCount--; pTag->Next(0); pTag->Prev(0); } return pTag; }
void CCalendarCtrl::Reset() { COleDateTime today(time(NULL)); COleDateTime dtFirstDay(today.GetYear(), today.GetMonth(), 1,0,0,0); if(dtFirstDay > m_BoundUp) dtFirstDay = m_BoundUp; else if(dtFirstDay < m_BoundDown) dtFirstDay = m_BoundDown; if (dtFirstDay.GetMonth()%2) m_bMonthIsOdd = true; Goto(dtFirstDay); // Reset selection m_SelectionRange[1] = DateToSeconds(COleDateTime(today.GetYear(), today.GetMonth(), today.GetDay(),0,0,0)); m_SelectionRange[0] = m_SelectionRange[1]; // Reset scroll pos m_nVscrollPos = m_nVscrollMax/2; SetScrollPos(SB_VERT, m_nVscrollPos, TRUE); }
void GROUPAI::GroupAI() { if(m_members.empty() || m_pMaster == NULL)return; int memberStates[] = {0, 0, 0}; m_state = GROUP_STATE_IDLE; std::vector<MAPOBJECT*>::iterator i; for(i = m_members.begin();i != m_members.end();) { if((*i) == NULL || (*i)->m_dead) { //Remove dead Group m_members RemoveMember(*i); } else { (*i)->m_pGroup = this; //determine group m_state if(!(*i)->m_isBuilding) { UNIT *unit = (UNIT*)(*i); if(unit->m_state == STATE_ATTACK) memberStates[GROUP_STATE_BATTLE]++; else if(unit->m_moving) memberStates[GROUP_STATE_MOVING]++; else memberStates[GROUP_STATE_IDLE]++; } i++; } } //Set group state if(memberStates[GROUP_STATE_BATTLE] >= m_members.size() * 0.2f) m_state = GROUP_STATE_BATTLE; else if(memberStates[GROUP_STATE_MOVING] >= m_members.size() * 0.4f) m_state = GROUP_STATE_MOVING; else m_state = GROUP_STATE_IDLE; //Group state machine switch(m_state) { case GROUP_STATE_IDLE: { if(m_task == TASK_SCOUT) { AREA *area = m_pMaster->m_pStrategyMap->GetScoutArea(GetCenter()); if(area != NULL)Goto(area->m_mapArea); } else if(m_task == TASK_ATTACK_LOCATION) { AREA *area = m_pMaster->m_pStrategyMap->GetAttackArea(GetCenter()); if(area != NULL)Goto(area->m_mapArea); } else if(m_task == TASK_NONE || m_task == TASK_DEFEND_LOCATION) { Shuffle(); } break; } case GROUP_STATE_MOVING: { Attack(m_visibleEnemies); break; } case GROUP_STATE_BATTLE: { Attack(m_visibleEnemies); if(m_task == TASK_DEFEND_LOCATION) RetreatTo(m_mapArea); break; } } //Report enemies to Master AI m_pMaster->EnemiesSpotted(m_visibleEnemies); m_visibleEnemies.clear(); }
BOOL CCalendarCtrl::PreTranslateMessage(MSG* pMsg) { if( pMsg->message == WM_KEYDOWN ) { COleDateTime newDate = m_DateCurrent; bool bHold = (GetKeyState(VK_SHIFT)>>8 == -1)?true:false; bool bCtrl = (GetKeyState(VK_CONTROL)>>8 == -1)?true:false; if(bHold) bCtrl = false; // allow one combination switch(pMsg->wParam) { case VK_SPACE: { if(bCtrl) { int nRow, nCol; GetLastSelectedGridCell(nRow, nCol); if( (m_dayCells[nRow][nCol].date < m_BoundUp) && (m_dayCells[nRow][nCol].date > m_BoundDown) ) { void*p; time_t t = DateToSeconds(m_dayCells[nRow][nCol].date); if(m_RandomSelection.Lookup((void*)t ,p)) m_RandomSelection.RemoveKey((void*)t); else{ if(m_RandomSelection.GetCount() < m_nMaxSel) m_RandomSelection.SetAt((void*)t, 0); } Invalidate(true); return TRUE; } } break; } case VK_UP: { int nRow, nCol; GetLastSelectedGridCell(nRow, nCol); if( (m_dayCells[nRow][nCol].date < m_BoundUp) && (m_dayCells[nRow][nCol].date > m_BoundDown) ) { if(!bCtrl){ m_RandomSelection.RemoveAll(); m_SelectionRange[2] = 0; } else{ if(m_RandomSelection.GetCount() == 0) m_RandomSelection.SetAt((void*)m_SelectionRange[0], 0); } if(nRow == 0){ newDate -= COleDateTimeSpan(7,0,0,0); if((m_BoundUp > newDate) && (newDate > m_BoundDown)) { m_nVscrollPos--; SetScrollPos(SB_VERT, m_nVscrollPos, TRUE); Goto(newDate); } } else nRow--; if( (m_dayCells[nRow][nCol].date < m_BoundUp) && (m_dayCells[nRow][nCol].date > m_BoundDown) ) { m_SelectionRange[1] = DateToSeconds(m_dayCells[nRow][nCol].date); if(bCtrl) m_SelectionRange[2] = m_SelectionRange[1]; if(!bHold) m_SelectionRange[0] = m_SelectionRange[1]; AdjustSelection(); Invalidate(true); } } return TRUE; } case VK_DOWN: { int nRow, nCol; GetLastSelectedGridCell(nRow, nCol); if( (m_dayCells[nRow][nCol].date < m_BoundUp) && (m_dayCells[nRow][nCol].date > m_BoundDown) ) { if(!bCtrl){ m_RandomSelection.RemoveAll(); m_SelectionRange[2] = 0; } else{ if(m_RandomSelection.GetCount() == 0) m_RandomSelection.SetAt((void*)m_SelectionRange[0], 0); } if(nRow == CALENDAR_ROWS-1){ newDate += COleDateTimeSpan(7,0,0,0); if((m_BoundUp > newDate) && (newDate > m_BoundDown)) { m_nVscrollPos++; SetScrollPos(SB_VERT, m_nVscrollPos, TRUE); Goto(newDate); } } else nRow++; if( (m_dayCells[nRow][nCol].date < m_BoundUp) && (m_dayCells[nRow][nCol].date > m_BoundDown) ) { m_SelectionRange[1] = DateToSeconds(m_dayCells[nRow][nCol].date); if(bCtrl) m_SelectionRange[2] = m_SelectionRange[1]; if(!bHold) m_SelectionRange[0] = m_SelectionRange[1]; AdjustSelection(); Invalidate(true); } } return TRUE; } case VK_LEFT: { int nRow, nCol; GetLastSelectedGridCell(nRow, nCol); if( (m_dayCells[nRow][nCol].date < m_BoundUp) && (m_dayCells[nRow][nCol].date > m_BoundDown) ) { if(!bCtrl){ m_RandomSelection.RemoveAll(); m_SelectionRange[2] = 0; } else{ if(m_RandomSelection.GetCount() == 0) m_RandomSelection.SetAt((void*)m_SelectionRange[0], 0); } if(nCol > 0) nCol--; else { nCol = CALENDAR_COLUMNS-1; if(nRow == 0){ newDate -= COleDateTimeSpan(7,0,0,0); if((m_BoundUp > newDate) && (newDate > m_BoundDown)) { m_nVscrollPos--; SetScrollPos(SB_VERT, m_nVscrollPos, TRUE); Goto(newDate); } else nCol = 0; } else nRow--; } if( (m_dayCells[nRow][nCol].date < m_BoundUp) && (m_dayCells[nRow][nCol].date > m_BoundDown) ) { m_SelectionRange[1] = DateToSeconds(m_dayCells[nRow][nCol].date); if(bCtrl) m_SelectionRange[2] = m_SelectionRange[1]; if(!bHold) m_SelectionRange[0] = m_SelectionRange[1]; AdjustSelection(); Invalidate(true); } } return TRUE; } case VK_RIGHT: { int nRow, nCol; GetLastSelectedGridCell(nRow, nCol); if( (m_dayCells[nRow][nCol].date < m_BoundUp) && (m_dayCells[nRow][nCol].date > m_BoundDown) ) { if(!bCtrl){ m_RandomSelection.RemoveAll(); m_SelectionRange[2] = 0; } else{ if(m_RandomSelection.GetCount() == 0) m_RandomSelection.SetAt((void*)m_SelectionRange[0], 0); } if(nCol < CALENDAR_COLUMNS-1) nCol++; else { nCol = 0; if(nRow == CALENDAR_ROWS-1){ newDate += COleDateTimeSpan(7,0,0,0); if((m_BoundUp > newDate) && (newDate > m_BoundDown)) { m_nVscrollPos++; SetScrollPos(SB_VERT, m_nVscrollPos, TRUE); Goto(newDate); } else nCol = CALENDAR_COLUMNS-1; } else nRow++; } if( (m_dayCells[nRow][nCol].date < m_BoundUp) && (m_dayCells[nRow][nCol].date > m_BoundDown) ) { m_SelectionRange[1] = DateToSeconds(m_dayCells[nRow][nCol].date); if(bCtrl) m_SelectionRange[2] = m_SelectionRange[1]; if(!bHold) m_SelectionRange[0] = m_SelectionRange[1]; AdjustSelection(); Invalidate(true); } } return TRUE; } } }
// generates the canonical Items set for a LR(1) grammar void dParserCompiler::CanonicalItemSets ( dTree<dState*, dCRCTYPE>& stateMap, const dProductionRule& ruleList, const dTree<dTokenInfo, dCRCTYPE>& symbolList, const dOperatorsPrecedence& operatorPrecedence, FILE* const debugFile) { dList<dItem> itemSet; dList<dState*> stateList; // start by building an item set with only the first rule dItem& item = itemSet.Append()->GetInfo(); item.m_indexMarker = 0; item.m_lookAheadSymbolCRC = dCRC64 (DACCEPT_SYMBOL); item.m_lookAheadSymbolName = DACCEPT_SYMBOL; item.m_ruleNode = ruleList.GetFirst(); // build a rule info map dTree<dList<void*>, dCRCTYPE> ruleMap; for (dProductionRule::dListNode* ruleNode = ruleList.GetFirst(); ruleNode; ruleNode = ruleNode->GetNext()) { dRuleInfo& info = ruleNode->GetInfo(); dTree<dList<void*>, dCRCTYPE>::dTreeNode* node = ruleMap.Find(info.m_nameCRC); if (!node) { node = ruleMap.Insert(info.m_nameCRC); } dList<void*>& entry = node->GetInfo(); entry.Append(ruleNode); } // find the closure for the first this item set with only the first rule dState* const state = Closure (itemSet, symbolList, ruleMap); operatorPrecedence.SaveLastOperationSymbol (state); stateMap.Insert(state, state->GetKey()); stateList.Append(state); state->Trace(debugFile); // now for each state found int stateNumber = 1; for (dList<dState*>::dListNode* node = stateList.GetFirst(); node; node = node->GetNext()) { dState* const state = node->GetInfo(); dTree<dTokenInfo, dCRCTYPE>::Iterator iter (symbolList); for (iter.Begin(); iter; iter ++) { dCRCTYPE symbol = iter.GetKey(); dState* const newState = Goto (state, symbol, symbolList, ruleMap); if (newState->GetCount()) { const dTokenInfo& tokenInfo = iter.GetNode()->GetInfo(); dTransition& transition = state->m_transitions.Append()->GetInfo(); transition.m_symbol = symbol; transition.m_name = tokenInfo.m_name; transition.m_type = tokenInfo.m_type; dAssert (transition.m_symbol == dCRC64(transition.m_name.GetStr())); transition.m_targetState = newState; dTree<dState*, dCRCTYPE>::dTreeNode* const targetStateNode = stateMap.Find(newState->GetKey()); if (!targetStateNode) { newState->m_number = stateNumber; stateNumber ++; stateMap.Insert(newState, newState->GetKey()); newState->Trace(debugFile); stateList.Append(newState); operatorPrecedence.SaveLastOperationSymbol (newState); } else { transition.m_targetState = targetStateNode->GetInfo(); delete newState; } } else { delete newState; } } dTrace (("state#:%d items: %d transitions: %d\n", state->m_number, state->GetCount(), state->m_transitions.GetCount())); } }
void isdf08Mission::Execute(void) { /* Here is where you put what happens every frame. */ player = GetPlayerHandle(); char tempstr[128]; if (!start_done) { shab=GetHandle("shabayev"); start_done=true; Handle temp=BuildObject("ibnav",1,"manson_base"); TranslateString2(tempstr, sizeof(tempstr), "Mission0801"); // West Base SetObjectiveName(temp,tempstr); GiveWeapon(player, "igsatc"); first_aud=AudioMessage("mes0801.wav"); // was isdf0801 // I don't know what these are or where they go /* Handle sp=BuildObject("fvtank",2,"spawn1"); SetSkill(sp,3); sp=BuildObject("fvsent",2,"spawn2"); SetSkill(sp,3); sp=BuildObject("fvtank",2,"spawn3"); SetSkill(sp,3); sp=BuildObject("fvsent",2,"spawn4"); SetSkill(sp,4); SetScrap(1,30); */ // These ships circle the ruin you're in at the beginning, then leave pilot1=BuildObject("fvtank",2,"pilot_1"); pilot2=BuildObject("fvtank",2,"pilot_2"); pilot3=BuildObject("fvsent",2,"pilot_3"); // They are dumb SetIndependence(pilot1,0); SetIndependence(pilot2,0); SetIndependence(pilot3,0); // These are the patrol paths for the vehicles Goto(pilot1,"start1"); Goto(pilot2,"start2"); Goto(pilot3,"start3"); // These turrets block the path to the south turret1=BuildObject("fvturr",2,"turret_1"); turret2=BuildObject("fvturr",2,"turret_2"); // These jaks inhabit the swamp just west of the starting point jak1=BuildObject("mcjak01",0,"jak_1"); Patrol(jak1,"jakpatrol1",1); SetIndependence(jak1,1); jak2=BuildObject("mcjak01",0,"jak_2"); Patrol(jak2,"jakpatrol2",1); SetIndependence(jak2,1); jak3=BuildObject("mcjak01",0,"jak_3"); Patrol(jak3,"jakpatrol3",1); SetIndependence(jak3,1); // This spire guards the entrance to the Scion base espir1=BuildObject("fbspir",2,"espir_1"); // SetIndependence(espir1,0); // These 3 ships patrol different areas scout1=BuildObject("fvtank",2,"patrol_1"); Patrol(scout1,"patrol_1",0); scout2=BuildObject("fvtank",2,"patrol_2"); Patrol(scout2,"patrol_2",0); // this should be a bazooka or something BuildObject("aptech",0,"weapon_1"); // pilots around second patrol ship #if 0 // 'sssold' won't save/reload properly - NM 9/28/04 pilot7=BuildObject("sssold",2,"pilot_5"); Patrol(pilot7,"pilotpatrol1",0); pilot8=BuildObject("sssold",2,"pilot_6"); Patrol(pilot8,"pilotpatrol2",0); #endif // jak blocking power ups before ruins jak7=BuildObject("mcjak01",0,"jak_7"); Patrol(jak7,"jakpatrol7",1); // power up in the second nest of puff plants BuildObject("aprepa",0,"health_1"); BuildObject("apammo",0,"ammo_1"); BuildObject("apbazo",0,"weapon1"); // jak creatures hanging around ruins jak4=BuildObject("mcjak01",0,"jak_4"); Patrol(jak4,"jakpatrol4",1); jak5=BuildObject("mcjak01",0,"jak_5"); Patrol(jak5,"jakpatrol5",1); // power ups near ruins BuildObject("aprepa",0,"health_2"); BuildObject("apammo",0,"ammo_2"); SetAnimation(shab,"speak"); fvartl=BuildObject("fvartl",2,"fvartl"); } if ((IsAudioMessageDone(first_aud)) && (!shab_still)) { shab_still=true; SetAnimation(shab,"speak",1); } if ((!IsAround(shab)) && (!reached_base)) { FailMission(GetTime()+5.0f,"genFail.txt"); reached_base=true; } // Gun tower shoots at you if you get within 100 meters if (inside_espir1) { if (GetDistance(espir1,player) > 50.0f) { inside_espir1=false; Stop(espir1); } } else { if (GetDistance(espir1,player) < 50.0f) { inside_espir1 = true; Attack(espir1,player); } } if ((!jak1_attack) && (GetDistance(jak1,player)<50.0f)) { jak1_attack=true; Stop(jak1,player); } if ((!jak2_attack) && (GetDistance(jak2,player)<50.0f)) { jak2_attack=true; Stop(jak2,player); } if ((!jak3_attack) && (GetDistance(jak3,player)<50.0f)) { jak3_attack=true; Stop(jak3,player); } if ((!jak4_attack) && (GetDistance(jak4,player)<50.0f)) { jak4_attack=true; Stop(jak4,player); } if ((!jak5_attack) && (GetDistance(jak5,player)<50.0f)) { jak5_attack=true; Stop(jak5,player); } // If you shoot any of the patrol ships in the beginning, they will attack you if (((GetWhoShotMe(pilot1) == player) || (GetWhoShotMe(pilot2) == player) || (GetWhoShotMe(pilot3) == player)) && (!patrol_attacked)) { Attack(pilot1,player); Attack(pilot2,player); Attack(pilot3,player); patrol_attacked=true; } // Once the patrol from the beginning leaves the ruins, they disappear from the map if ((GetDistance(pilot1,"killpatrol1")<64.0f)) { RemoveObject(pilot1); } if ((GetDistance(pilot2,"killpatrol1")<64.0f)) { RemoveObject(pilot2); } if ((GetDistance(pilot3,"killpatrol1")<64.0f)) { RemoveObject(pilot3); } if (((GetDistance(pilot1,"turret_1")<192.0f) || (GetDistance(pilot2,"turret_1")<192.0f) || (GetDistance(pilot3,"turret_1")<192.0f)) && (!played_0802)) { // message1=AudioMessage("isdf0802.wav"); ClearObjectives(); AddObjective("isdf0801.otf",WHITE,15.0f); played_0802=true; } if ((played_0802) && (IsAudioMessageDone(message1)) && (GetDistance(player,"start_point")<20.0f) && (!played_0803)) { // AudioMessage("isdf0803.wav"); played_0803=true; } if ((!played_0804) && (played_0802) && (GetDistance(player,"play_0804")<80.0f)) { AudioMessage("isdf0804.wav"); played_0804=true; } if ((!played_0805) && (played_0802) && (GetDistance(player,"play_0805")<80.0f)) { AudioMessage("isdf0805.wav"); played_0805=true; } if ((GetDistance(player,turret1)<150.0f) && (!played_0806)) { AudioMessage("isdf0806.wav"); played_0806=true; } if ((!played_0807) && (GetDistance(player,"sees_datatransfer")<100.0f)) { AudioMessage("isdf0807.wav"); played_0807=true; ClearObjectives(); AddObjective("isdf0801.otf",WHITE,10.0f); } // As you exit the ruins, 3 Scion ships spawn in the Scion base and head towards you if (((GetDistance(player,"exitruin_1")<80.0f) || (GetDistance(player,"exitruin_2")<80.0f)) && (!trigger1)) { attack1=BuildObject("fvtank",2,"attack_1"); attack2=BuildObject("fvsent",2,"attack_2"); attack3=BuildObject("fvtank",2,"attack_3"); Attack(attack1,player); Attack(attack2,player); Attack(attack3,player); trigger1=true; } if ((trigger1) && (!played_0808)) { AudioMessage("isdf0808.wav"); played_0808=true; } if (((GetDistance(player,attack1)<300.0f) || (GetDistance(player,attack2)<300.0f) || (GetDistance(player,attack3)<300.0f)) && (!played_0809)) { AudioMessage("isdf0809.wav"); played_0809=true; } #if 0 // isdf0811.wav doesn't exist - NM 11/14/03 if (((GetDistance(player,attack1)<100.0f) || (GetDistance(player,attack2)<100.0f) || (GetDistance(player,attack3)<100.0f)) && (!played_0811)) { AudioMessage("isdf0811.wav"); played_0811=true; } #endif // If you head south, the turrets will kill you // if I am between entering the swamp and // I hide in water (near swampn) then the patrols ignore me if ((played_0804) && (!trigger2)) { if ((GetDistance(player,"swamp1")<50.0f) || (GetDistance(player,"swamp2")<50.0f) || (GetDistance(player,"swamp3")<50.0f) || (GetDistance(player,"swamp4")<50.0f) || (GetDistance(player,"swamp5")<50.0f) || (GetDistance(player,"swamp6")<50.0f) || (GetDistance(player,"swamp7")<50.0f)) { SetPerceivedTeam(player,2); SetIndependence(scout1,0); SetIndependence(scout2,0); } else { SetPerceivedTeam(player,1); SetIndependence(scout1,1); SetIndependence(scout2,1); } if ((!detected) && ((GetWhoShotMe(scout1)==player) ||(GetWhoShotMe(scout2)==player))) { Attack(scout1,player); Attack(scout2,player); detected=true; } } // As you approach the ISDF base, 3 friendly units launch to protect you from the Scion attackers if (((GetDistance(player,"enterbase_1")<100.0f) || (GetDistance(player,"enterbase_2")<100.0f) || (GetDistance(player,"enterbase_3")<100.0f)) && (!trigger2)) { rescue1=BuildObject("ivtank",1,"rescue_1"); rescue2=BuildObject("ivmbike",1,"rescue_2"); rescue3=BuildObject("ivtank",1,"rescue_3"); Attack(rescue1,attack1); Attack(rescue2,attack1); Attack(rescue3,attack1); trigger2=true; } if ((!IsAlive(attack1)) && (!killed_attack1)) { Attack(rescue1,attack2); Attack(rescue2,attack2); Attack(rescue3,attack2); killed_attack1=true; } if ((!IsAlive(attack2)) && (!killed_attack2)) { Attack(rescue1,attack3); Attack(rescue2,attack3); Attack(rescue3,attack3); killed_attack2=true; } if ((GetDistance(player,"edge_warning1")<25.0f) && (GetDistance(player,"edge_warning1")<25.0f) && (!edge_attack)) { edge_attack=true; Attack(fvartl,player); } // If the ISDF ships get close to the Scion attack squadron, the Scions will stop chasing you and fight the ships if ((GetDistance(rescue1,attack1)<50.0f) || (GetDistance(rescue1,attack2)<50.0f) || (GetDistance(rescue1,attack3)<50.0f) || (GetDistance(rescue2,attack1)<50.0f) || (GetDistance(rescue2,attack2)<50.0f) || (GetDistance(rescue2,attack3)<50.0f) || (GetDistance(rescue3,attack1)<50.0f) || (GetDistance(rescue3,attack2)<50.0f) || (GetDistance(rescue3,attack3)<50.0f)) { Attack(attack1,rescue1); Attack(attack2,rescue2); Attack(attack3,rescue3); } // If you've killed all the attack vehicles and entered the base, the mission is a success if (((GetDistance(player,"endmission1")<100.0f) || (GetDistance(player,"endmission2")<100.0f)) && (!IsAlive(attack1)) && (!IsAlive(attack2)) && (!IsAlive(attack3)) && (!reached_base)) { AudioMessage("isdf0514.wav"); SucceedMission(GetTime()+10.0f,"isdf08w1.txt"); reached_base=true; } }
void MobileMg42::Enter() { FINDSTATEIF( FollowPath, GetRootState(), Goto( this, Run ) ); Tracker.InProgress = mMapGoal; }
void isdf20Mission::Execute(void) { /* Here is where you put what happens every frame. */ /* LANDSLIDE INFO - .bzn has file reslida1.odf - Don't forget to delete bin data before you try this - Run animation on reslid01.odf - Replace it with reslidea1.odf */ player = GetPlayerHandle(); char tempstr[128]; Ally(1,3); switch (mission_state) { case 0: // build this stuff at start /* Handle recy=BuildObject("ivrecy",1,"Recycler"); int grp=GetFirstEmptyGroup(); SetGroup(recy,grp); SetScrap(1,30); */ // deleted for Nathan /* mbike_1=BuildObject("ivmbike",3,"mbike1"); mbike_2=BuildObject("ivmbike",3,"mbike2"); mbike_3=BuildObject("ivmbike",3,"mbike3"); */ tank_1=BuildObject("ivatank",1,"tank1"); // was atank SetGroup(tank_1,0); tank_2=BuildObject("ivrckt",1,"tank2"); // was atank SetGroup(tank_2,1); // serv= BuildObject("ivserv",1,"serv"); // Set // scav_1=BuildObject("ivscav",1,"scav1"); // scav_2=BuildObject("ivscav",1,"scav2"); // rckt_1=BuildObject("ivrckt",1,"rckt1"); // rckt_2=BuildObject("ivrckt",1,"rckt2"); SetGroup(rckt_1,1); SetGroup(rckt_2,1); serv_1=BuildObject("ivserv",1,"scav1"); SetGroup(serv_1,2); espir_2=BuildObject("ibgtow",comp_team,"base_here"); esent_1=BuildObject("ivmisl",comp_team,"esentpath1"); esent_2=BuildObject("ivmisl",comp_team,"esentpath1"); espir_1=BuildObject("ibgtow",comp_team,"espir1"); base_1=BuildObject("ibfact",comp_team,"estro1"); base_2=BuildObject("ibpgen",comp_team,"ekiln1"); base_3=BuildObject("ibpgen",comp_team,"power_x"); // was eforg1 base_4=BuildObject("ibcbun",comp_team,"bunker_x"); espir_3=BuildObject("ibgtow",comp_team,"espir3"); esent_3=BuildObject("ivscout",comp_team,"esent3"); esent_4=BuildObject("ivscout",comp_team,"esent4"); ClearObjectives(); AddObjective("isdf20a.otf",WHITE,10.0f); Patrol(esent_1,"esentpath1"); Follow(esent_2,esent_1); after_briefing= GetTime()+20.0f; slide1=GetHandle("unnamed_reslida1"); //Vector temp=GetPosition(slide1); RemoveObject(slide1); nav=BuildObject("ibnav",1,"lung2"); SetObjectiveOn(nav); TranslateString2(tempstr, sizeof(tempstr), "Mission2002"); // Rebel Base SetObjectiveName(nav,tempstr); // SetPosition(slide2?? /* So the mission isn't too slow. */ AddHealth(espir_1,-3000); AddHealth(espir_2,-3000); mission_state++; audio=AudioMessage("isdf2021.wav"); CameraReady(); break; case 1: CameraPath("camera1",200,200,player); // CameraObject(espir_1,30,20,20,espir_1); if (IsAudioMessageDone(audio)) { audio=AudioMessage("isdf2022.wav"); mission_state++; } break; case 2 : CameraPath("camera2",200,200,espir_2); if (IsAudioMessageDone(audio)) { AudioMessage("isdf2001.wav"); CameraFinish(); mission_state++; } break; case 3: //the attack begins // after the opening briefing, AI squadron drives to fight sentry units on their own if (GetTime() > after_briefing) { // Goto(mbike_1,"front_ambush"); // Goto(mbike_2,"front_ambush"); // Goto(mbike_3,"front_ambush"); // Goto(rckt_1,"front_ambush"); // Goto(rckt_2,"front_ambush"); Handle temp=BuildObject("ivscout",comp_team,"lung2"); Attack(temp,player); mission_state++; } break; case 4: // Kill the sentries // AI squadron engages sentry units if ((GetDistance(tank_1,"front_ambush")<200.0f) || (GetDistance(tank_2,"front_ambush")<200.0f) || (GetDistance(rckt_1,"front_ambush")<200.0f) || (GetDistance(rckt_2,"front_ambush")<200.0f) || (GetDistance(player,"front_ambush")<200.0f) ) { /* Attack(mbike_1,esent_1); Attack(mbike_2,esent_2); Attack(mbike_3,esent_1); */ SetObjectiveOn(esent_1); TranslateString2(tempstr, sizeof(tempstr), "Mission2001"); // Rebel SetObjectiveName(esent_1,tempstr); SetObjectiveOn(esent_2); SetObjectiveName(esent_2,tempstr); // Attack(rckt_1,esent_2); // Attack(rckt_2,esent_1); } // once the sentrys are destroyed, AI squadron heads to enemy gun tower and stops if ((!IsAlive(esent_1)) && (!IsAlive(esent_2))) { /* Goto(mbike_1,"front_ambush"); Goto(mbike_2,"front_ambush"); Goto(mbike_3,"front_ambush"); */ // Goto(rckt_1,"front_ambush"); // Goto(rckt_2,"front_ambush"); // temp=BuildObject("ivscout",2,"lung2"); // Attack(temp,serv_1); mission_state++; } break; case 5: // wait till they get to the tower if (( (GetDistance(tank_1,"front_ambush")<75.0f) || (GetDistance(rckt_2,"front_ambush")<75.0f) || (GetDistance(player,"front_ambush")<75.0f))) { Handle temp=BuildObject("ivscout",comp_team,"lung2"); Attack(temp,player); AudioMessage("isdf2002.wav"); // use your assault tanks ClearObjectives(); AddObjective("isdf2002.otf",WHITE,20.0f); SetObjectiveOn(espir_1); TranslateString2(tempstr, sizeof(tempstr), "Mission2003"); // Gun Tower SetObjectiveName(espir_1,tempstr); //temp=BuildObject("ivscout",2,"lung2"); //Attack(temp,player); mission_state++; } break; case 6: // destroy the tower // once you destroy the gun tower, AI squadron heads to next gun tower and stops if (!IsAlive(espir_1)) { Goto(mbike_1,"exit1"); Goto(mbike_2,"exit1"); Goto(mbike_3,"exit1"); // AudioMessage("isdf2003.wav"); // now let's press on to the base // Goto(rckt_1,"exit1"); // Goto(rckt_2,"exit1"); // temp=BuildObject("ivscout",2,"lung2"); // Attack(temp,serv_1); mission_state++; } break; case 7: // now go to the next tower if (((GetDistance(tank_1,"exit1")<50.0f) || (GetDistance(rckt_1,"exit1")<50.0f) || (GetDistance(player,"exit1")<50.0f))) { ClearObjectives(); AddObjective("isdf2003.otf",WHITE,20.0f); AudioMessage("isdf2003.wav"); mission_state++; } break; case 8: // until enemy spire is dead if (!IsAlive(espir_2)) { // Attack(mbike_1,base_1); // Attack(mbike_2,base_1); // Attack(mbike_3,base_1); Attack(rckt_1,base_1,0); Attack(rckt_2,base_1,0); mission_state++; } break; case 9: if (!IsAlive(base_1)) { // Attack(mbike_1,base_2); // Attack(mbike_2,base_2); // Attack(mbike_3,base_2); AudioMessage("isdf2004.wav"); Attack(rckt_1,base_2,0); Attack(rckt_2,base_2,0); mission_state++; } break; case 10: if (!IsAlive(base_2)) { // Attack(mbike_1,base_3); // Attack(mbike_2,base_3); // Attack(mbike_3,base_3); Attack(rckt_1,base_3,0); Attack(rckt_2,base_3,0); mission_state++; } break; case 11:// is the third base dead? if (!IsAlive(base_3)) { /* Goto(mbike_1,"homebase"); Goto(mbike_2,"homebase"); Goto(mbike_3,"homebase"); */ Goto(rckt_1,"homebase",0); Goto(rckt_2,"homebase",0); // keep the player bunched up Follow(tank_1,player,0); Follow(tank_2,player,0); ClearObjectives(); AddObjective("isdf2004.otf",WHITE,20.0f); SetObjectiveOff(nav); nav=BuildObject("ibnav",1,"scav2"); TranslateString2(tempstr, sizeof(tempstr), "Mission2004"); // Rencezvous SetObjectiveName(nav,tempstr); SetObjectiveOn(nav); AudioMessage("isdf2005.wav"); mission_state++; } break; case 12: // first ambush launches as soon as you exit enemy base after destroying it // second ambush comes in from behind if (GetDistance(player,"exit1")<125.0f) { ambush_delay=GetTime()+15.0f; mission_state++; } break; case 13: if (GetTime()>ambush_delay) { eatank_1=BuildObject("ivtank",comp_team,"eatank1"); eatank_2=BuildObject("ivtank",comp_team,"eatank2"); eatank_3=BuildObject("ivmbike",comp_team,"eatank3"); SetSkill(eatank_1,2); SetSkill(eatank_2,2); SetSkill(eatank_3,2); Attack(eatank_1,player); Attack(eatank_2,player); Attack(eatank_3,player); etank_1=BuildObject("ivtank",comp_team,"etank1"); etank_2=BuildObject("ivtank",comp_team,"etank2"); etank_3=BuildObject("ivmbike",comp_team,"etank3"); earch_1=BuildObject("ivtank",comp_team,"earch1"); earch_2=BuildObject("ivtank",comp_team,"earch2"); earch_3=BuildObject("ivmisl",comp_team,"earch3"); manson= BuildObject("ivatank",comp_team,"manson"); Attack(etank_1,player); Attack(etank_2,player); Attack(etank_3,player); Attack(earch_1,player); Attack(earch_2,player); Attack(earch_3,player); Attack(manson,player); uhoh= GetTime()+20.0f; mission_state++; } break; case 14: if (GetTime() > uhoh) { AudioMessage("isdf2006.wav"); AudioMessage("isdf2007.wav"); ClearObjectives(); AddObjective("isdf2005.otf",WHITE,20.0f); Handle temp=BuildObject("ivapc",comp_team,"lung2"); // now you are screwed Attack(temp,player); // temp=BuildObject("ivapc",2,"lung2"); // Attack(temp,player); mission_state++; } break; case 15: // how do you win?? if ((!seen_manson) && (GetDistance(player,manson)<200.0f)) { seen_manson=true; SetObjectiveOn(manson); } if (!IsAlive(manson)) { AudioMessage("isdf2010.wav"); SucceedMission(GetTime()+10.0f,"isdf20w1.txt"); mission_state++; } break; } // switch (mission_state) PeriodicAttack(); // once you destroy the second gun tower, AI squadron enters enemy base and levels it // infinite health and ammo // SetCurAmmo(player, 1200); // SetCurHealth(player, 3000); // tells player to head back to base // if ((!IsAlive(enemybase)) && (!go_home)) // { // AudioMessage("wahoo.wav"); // go_home=true; // } }
void isdf07Mission::Execute(void) { /* The following is needed for editing cineractives. */ if (BeginCin == true) { BeginCin = PlayMove(); } if (BeginSeq == true) { char temp[20] = "***"; BeginSeq = PlayMovie(temp); } if (IFace_GetFloat("script.cin.edit") == 1.0) { // cinToolSetup(); IFace_SetFloat("script.cin.edit", 0.0); } /* The above is needed for editing cineractives. */ player = GetPlayerHandle(); //This section evaluates what has happened. checkWing(shabayev, player); //Did we hurt our friendly instructor. switch (missionState) { case 0: //This will do the setup for the mission. spawn1 = GetHandle("spawn_1"); spawn2 = GetHandle("spawn_2"); spawn3 = GetHandle("spawn_3"); creature1=BuildObject("mcjak01",0,"creature1"); creature2=BuildObject("mcjak01",0,"creature2"); creature3=BuildObject("mcjak01",0,"creature3"); creature4=BuildObject("mcjak01",0,"creature4"); shabayev = BuildObject("ivtank",3,"spawn_shab"); recy = GetHandle("recycler"); ruins = GetHandle("ruins"); SetScrap(1, 40); // playerEnemy1 = BuildObject("fvtank", 2, spawn3); // Attack(playerEnemy1, player, 1); CommandShab(); AudioMessage("isdf0701.wav"); AudioMessage("isdf0740.wav"); AudioMessage("isdf0702.wav"); AudioMessage("isdf0703.wav"); SetSkill(shabayev,3); SendEnemies(0,player); { // brad added int poolHandle = GetHandle(288); SpawnBirds(1, 5, "mcwing01", 0, poolHandle, poolHandle); } missionState++; break; case 1: //Check to see if the player has deployed their recycler. if (!getNewOrder) { ClearObjectives(); AudioMessage("isdf0704.wav"); AddObjective("isdf0701.otf", WHITE); reminderTimer = (GetTime() + 60.0f); if (!IsAlive(animal1)) { animal1 = BuildObject("mcjak01", 2, spawn3); //This will be changed to the animal Goto(animal1, recy); SetIndependence(animal1, 0); } getNewOrder = true; } // recyDeployed = IsDeployed(recy); if (recyDeployed) { AudioMessage("isdf0706.wav"); missionState++; getNewOrder = false; } if ((IsAlive(playerEnemy1)) && (!enemy1deployed) && (GetDistance(recy,playerEnemy1)<100.0f)) { enemy1deployed=true; } if ((!IsAlive(playerEnemy1)) && (!IsAlive(enemy1))) { playerEnemy1 = BuildObject("fvtank", comp_team, spawn3); Attack(playerEnemy1, player, 1); } break; case 2: //Check to see if the player has built a scavenger. if (!getNewOrder) { ClearObjectives(); AddObjective("isdf0702.otf", WHITE); reminderTimer = (GetTime() + 60.0f); AudioMessage("isdf0708.wav"); getNewOrder = true; } if (scavBuilt) { AudioMessage("isdf0707.wav"); reminderTimer = (GetTime() + 30.0f); missionState++; getNewOrder = false; } if ((IsAlive(playerEnemy1)) && (!enemy1deployed) && (GetDistance(recy,playerEnemy1)<100.0f)) { enemy1deployed=true; } if ((!IsAlive(playerEnemy1)) && (!IsAlive(enemy1))) { playerEnemy1 = BuildObject("fvtank", 2, spawn3); Attack(playerEnemy1, player, 1); } break; case 3: //Check to see if the player has built a construction rig. if (!getNewOrder) { ClearObjectives(); AddObjective("isdf0703.otf", WHITE); AudioMessage("isdf0710.wav"); reminderTimer = (GetTime() + 60.0f); getNewOrder = true; } if ((IsAlive(playerEnemy1)) && (!enemy1deployed) && (GetDistance(recy,playerEnemy1)<100.0f)) { enemy1deployed=true; } if (constBuilt) { missionState++; getNewOrder = false; } break; case 4: //Check to see if the player has built a power plant. if (!getNewOrder) { ClearObjectives(); AddObjective("isdf0704.otf", WHITE); AudioMessage("isdf0714.wav"); reminderTimer = (GetTime() + 60.0f); getNewOrder = true; } if (powerBuilt) { missionState++; getNewOrder = false; } if ((!IsAlive(playerEnemy1)) && (!IsAlive(enemy1))) { playerEnemy1 = BuildObject("fvtank", 2, spawn3); Attack(playerEnemy1, player, 1); } break; case 5: // check to see if the player has built a relay bunker if (!getNewOrder) { ClearObjectives(); AddObjective("isdf0705.otf", WHITE); AudioMessage("isdf0716.wav"); reminderTimer = (GetTime() + 60.0f); getNewOrder = true; } if (relayBuilt) { missionState++; getNewOrder = false; } break; case 6: //Check to see if the player has built a gun tower if (!getNewOrder) { ClearObjectives(); AddObjective("isdf0706.otf", WHITE); AudioMessage("isdf0719.wav"); reminderTimer = (GetTime() + 60.0f); getNewOrder = true; } if (gunTowBuilt) { missionState++; artil=BuildObject("fvartl",2,"artil"); Goto(artil,"artillery"); Handle temp=BuildObject("fvscout",2,spawn2); Follow(temp,artil); BuildObject("fvscout",2,spawn3); Follow(temp,artil); artil_counter=0; getNewOrder = false; } break; case 7: // now they will use artillery artil_counter++; if (artil_counter==300) { Attack(artil,gtow); // CameraReady(); } if ((artil_counter>300) & (artil_counter<355)) { // CameraObject(artil,12,8,3,artil); } if (artil_counter==355) { // CameraFinish(); missionState++; } // cheesy code but I am tired break; case 8: if (!IsAlive(artil)) { missionState++; } break; } float currentTime = GetTime(); if ((reminderTimer < currentTime) && (getNewOrder)) { //This checks to see if we should remind the player of his order. getNewOrder = false; } harrass_count++; if (harrass_count%701==0) { SendEnemies(1,player); } CommandShab(); handlePlayerMistakes(); if (shabState<3) { if ((!IsAlive(shabayev) && (!shab_dead))) { AudioMessage("isdf0732.wav"); ClearObjectives(); AddObjective("isdf05l1.otf",RED,15.0f); FailMission(GetTime()+5.0f,"isdf05l1.otf"); shab_dead=true; } } if ((!IsAround(recy)) && (!shab_dead)) { FailMission(GetTime()+5.0f,"isdf05l1.otf"); shab_dead=true; } }
void isdf07Mission::CommandShab() { char tempstr[128]; switch (shabState) { case 0: //setup the first batch of enemies shabEnemy1 = BuildObject("fvsent", comp_team, spawn1); shabEnemy2 = BuildObject("fvsent", comp_team, spawn2); Attack(shabEnemy1, shabayev, 1); Attack(shabEnemy2, shabayev, 1); Attack(shabayev, shabEnemy1, 1); shabState++; break; case 1: //do nothing until the first enemy gets killed if (!IsAlive(shabEnemy1)) { if (IsAlive(shabEnemy2)) { Attack(shabayev, shabEnemy2, 1); shabState++; } else { shabState++; } } if (gunTowBuilt) { //If shab can't kill anybody do it for her Damage(shabEnemy1, 3000); if (IsAlive(shabEnemy2)) { Damage(shabEnemy2, 3000); } ClearObjectives(); AddObjective("isdf0707.otf", WHITE); Goto(shabayev, "tree_point", 1); AudioMessage("isdf0728.wav"); shabState = 3; BugFix=GetTime()+60.0f; } break; case 2: //go NEAR the ruin when all of the enemies are killed if ((missionState>8) && (IsAlive(shabEnemy2))) { //If shab can't kill anybody do it for her Damage(shabEnemy2, 3000); } if ((!IsAlive(shabEnemy1)) && (!IsAlive(shabEnemy2)) && (!gunTowBuilt)) { shabEnemy2 = BuildObject("fvsent", 2, spawn1); Attack(shabayev, shabEnemy2, 1); Attack(shabEnemy2, shabayev, 1); } if ((!IsAlive(shabEnemy1)) && (!IsAlive(shabEnemy2)) && (gunTowBuilt)) { ClearObjectives(); AddObjective("isdf0710.otf", WHITE); AudioMessage("isdf0728.wav"); Goto(shabayev, "tree_point", 1); BugFix=GetTime()+20.0f; shabState++; } break; case 3: //hop out of the vehicle when near the ruin if (GetTime()>BugFix) { Goto(shabayev,"tree_point"); BugFix=GetTime()+10.0f; } if (((GetDistance(shabayev, "tree_point") < 25.0)) && ((!IsAlive(enemy1)) || (!IsAlive(enemy2)))) { ClearObjectives(); AudioMessage("isdf0725.wav"); AddObjective("isdf0707.otf", WHITE); justHoped = true; HopOut(shabayev); // SetObjectiveOn(shabOnFoot); hunter= BuildObject("fvsent",comp_team,"hunter"); // Patrol(temp,"hunter_path"); Attack(hunter,shabayev); // blow up shabs craft CameraReady(); reminderTimer=GetTime()+60.0f; shabState++; } break; case 4: oldPlayer=HoppedOutOf(shabOnFoot); // because shab becomes 0 { Vector pos; pos = GetPosition(oldPlayer); CameraObject(oldPlayer,2,5,-7,oldPlayer); LookAt(shabOnFoot, ruins, 1); RemoveObject(oldPlayer); oldPlayer=BuildObject("petank",1,pos); } shabState++; break; case 5: if (movie_counter<70) { CameraObject(oldPlayer,2,2,-7,oldPlayer); movie_counter++; } else { RemoveObject(oldPlayer); Handle temp=BuildObject("ibnav",1,"tree_point"); TranslateString2(tempstr, sizeof(tempstr), "Mission0701"); // Rescue SetObjectiveName(temp,tempstr); SetObjectiveOn(temp); CameraFinish(); shabState++; } break; case 6: //order the player to get out of his vehicle once he gets close if ((!IsAround(shabayev)) && (!ship_blown_up)) { Patrol(hunter,"hunter_path"); SetIndependence(hunter,0); ship_blown_up=true; } if ((!IsAlive(shabOnFoot) && (!shab_dead))) { AudioMessage("isdf0732.wav"); ClearObjectives(); AddObjective("isdf05l1.otf",RED,15.0f); FailMission(GetTime()+5.0f,"isdf05l1.otf"); shab_dead=true; } if (GetTime()>reminderTimer) { AudioMessage("isdf0725.wav"); reminderTimer=GetTime()+60.0f; } if ((GetDistance(shabOnFoot, player) < 50.0)) { //RemoveObject(shabayev); Attack(shabEnemy1,shabayev); Attack(shabEnemy2,shabayev); ClearObjectives(); AudioMessage("isdf0729.wav"); AddObjective("isdf0708.otf", WHITE); shabState++; } break; case 7: //send shab to get the relic if ((!IsAlive(shabOnFoot) && (!shab_dead))) { AudioMessage("isdf0732.wav"); ClearObjectives(); AddObjective("isdf05l1.otf",RED,15.0f); FailMission(GetTime()+5.0f,"isdf05l1.otf"); shab_dead=true; } if (playerOnFoot) { Attack(shabEnemy1,oldPlayer); Attack(shabEnemy2,oldPlayer); Goto(shabOnFoot, ruins, 1); //we should start the patrols here shabState++; } break; case 8: //get shab hurt if ((!IsAlive(shabOnFoot) && (!shab_dead))) { AudioMessage("isdf0732.wav"); ClearObjectives(); AddObjective("isdf05l1.otf",RED,15.0f); FailMission(GetTime()+5.0f,"isdf05l1.otf"); shab_dead=true; } if ((GetDistance(shabOnFoot, ruins) < 20.0f) || (GetDistance(player,ruins)<10.0f)) { if (winMission == false) { AudioMessage("isdf0731.wav"); // wrong file name SucceedMission(GetTime()+5.0f,"isdf07w1.txt"); winMission = true; } } break; case 9: //hide shab break; case 10: //play closing cineractive // The following is an example of how to play a movie in a script. moviePlaying = PlayMovie("temp"); if (!moviePlaying) { missionState++; moviePlaying = true; //IFace_SetInteger("script.mission.state", 1); } break; } if (GetHealth(shabayev) < 0.7f) { //keep shab alive AddHealth(shabayev, 100); } if ((GetAmmo(shabayev)) < 0.5f) { AddAmmo(shabayev, 500); } if ((justHoped) && (!IsAlive(shabOnFoot))) { int i; i=1; // Houston we have a problem } }