Documente Academic
Documente Profesional
Documente Cultură
PublicFunctions:RunPlayingGameSM,StartPlayingGameSM
ModuleFunctions:DuringDriveAlongTrail,DuringSearchingForTrail,
DuringCaptureCity,DuringSlingingMud
ModuleVariables:CurrentPlayingGameState
RunPlayingGameSM
LocalVariables:MakeTransition,NextState,EntryEventKind,ReturnEvent
SwitchCurrentPlayingGameState
CaseDriveAlongTrail:
CurrentEventisDuringDriveAlongTrail
IfCurrentEvent.EventTypeisnotES_NO_EVENT
SwitchCurrentEvent.EventType
Case:CITY_ENCOUNTEREDEvent
NextStateisCaptureCity
MakeTransitionisTrue
EntryEventKindisnothistoryentry
EndBlock
Case:LOST_TRAILEvent
NextStateisSearchingForTrail
MakeTransitionisTrue
EntryEventKindisnothistoryentry
EndBlock
Case:ES_TIMEOUTEvent
IfCurrentEvent.EventParamisHALL_EFFECT_DELAY
Enablehalleffectinterrupt
NextStateisDriveAlongTrail
MakeTransitionisFalse
EntryEventKindisnothistoryentry
EndIf
EndBlock
EndSwitch
EndIf
EndBlock
CaseCaptureCity:
CurrentEventisDuringCaptureCity
IfCurrentEvent.EventTypeisnotES_NO_EVENT
SwitchCurrentEvent.EventType
Case:CITY_CAPTUREDEvent
NextStateisDriveAlongTrail
MakeTransitionisTrue
EntryEventKindisnothistoryentry
EndBlock
Case:ES_TIMEOUT
IfCurrentEvent.EventParamisCITY_TIMER
NextStateisSearchingForTrail
MakeTransitionisTrue
EntryEventKindisnothistoryentry
EndIf
EndBlock
Case:ATTACK_CITYEvent
NextStateisSlingingMud
MakeTransitionisTrue
EntryEventKind.EventTypeisnotahistoryentry
EndBlock
EndSwitch
EndIf
EndBlock
CaseSearchingForTrail:
CurrentEventisDuringSearchingForTrail
IfCurrentEvent.EventTypeisnotES_NO_EVENT
SwitchCurrentEvent.EventType
Case:WIRE_DETECTEDEvent
NextStateisDriveAlongTrail
MakeTransitionisTrue
EntryEventKindisnothistoryentry
EndBlock
EndSwitch
EndIf
EndBlock
CaseSlingingMud:
CurrentEventisDuringSlingingMud
IfCurrentEvent.EventTypeisnotES_NO_EVENT
SwitchCurrentEvent.EventType
Case:ATTACK_LAUNCHEDEvent
NextStateisDriveAlongTrail
MakeTransitionisTrue
EntryEventKindisnothistoryentry
EndBlock
Case:ES_TIMEOUTEvent
IfCurrentEvent.EventParamisATTACK_TIMEOUT
NextStateisDriveAlongTrail
MakeTransitionisTrue
EntryEventKindisnothistoryentry
EndIf
EndBlock
EndSwitch
EndIf
EndBlock
EndSwitch
IfMakeTransitionistrue
Executeexitfunctionforcurrentstate
CallRunMasterSMfunctionforCurrentEvent
CurrentStateequalsNextState
Executeentryfunctionforcurrentstate
CallRunMasterSMfunctionforEntryEventKind
EndIf
EndRunPlayingGameSM
StartPlayingGameSM
IfCurrentEventisnotES_ENTRY_HISTORYevent
CurrentPlayingGameStateequalsENTRY_STATE
EndIf
CalltherunfunctionfortheSM
EndStartPlayingGameSM
DuringDriveAlongTrail
DefineReturnEvent
IfES_ENTRYevent
StartDrivingAlongTrailSM
ElseifES_EXITevent
RunDrivingAlongTrailSM
Else
ReturnEventequalsRunDrivingAlongTrailSM
EndIf
ReturnReturnEvent
EndDuringDriveAlongTrail
DuringCaptureCity
DefineReturnEvent
IfES_ENTRYevent
Disablehalleffectinterrupt
InitializeHALL_EFFECT_DEBOUNCEtimer
InitializeCITY_TIMER
StartCaptureCitySM
ElseifES_EXITevent
RunCaptureCitySM
InitializeHALL_EFFECT_DELAYtimer
Else
ReturnEventequalsRunCaptureCitySM
EndIf
ReturnReturnEvent
EndDuringCaptureCity
DuringSearchingForTrail
DefineReturnEvent
IfES_ENTRYevent
StartSearchingForTrailSM
ElseifES_EXITevent
RunSearchingForTrailSM
Else
ReturnEventequalsRunSearchingForTrailSM
EndIf
ReturnReturnEvent
EndDuringSearchingForTrail
DuringSlingingMud
DefineReturnEvent
IfES_ENTRYevent
Disablewiresensinginterrupt
Disablehalleffectinterrupt
EnableIRinterrupt
Stopmotors
InitializeBEACON_TIMER
StartSlingingMudSM
ElseifES_EXITevent
RunSlingingMudSM
Turnoffflywheel
InitializeHALL_EFFECT_DELAYtimer
Else
ReturnEventequalsRunSlingingMudSM
EndIf
ReturnReturnEvent
EndDuringSlingingMud
EndPlayingGameSM