home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Beyond the 3rd Dimension
/
BEYOND3D.bin
/
ai
/
aiplane4.ait
< prev
next >
Wrap
Text File
|
1997-12-09
|
3KB
|
107 lines
: Flying AI, will take off, fly, and land
: STATE Init // initialization STATE
: RUN SAVEPOS 3 0 // save current posiition to reg 3-5
: RUN SAVEPOS 6 0 // save current posiition to reg 3-5
: RUN SAVEORN 9 0
: RUN SETREG 1 0 // start
: RUN SETREG 4 TIME // used for timer
: RUN ADDREG 4 3000
: RUN RNDREG 0 1000
: RUN SUBREG 0 500
: RUN ADDREG 4 REG0
: RUN SETSTATE Wait1 0
: STATE Land // reg2 should be the last reg7
: RUN SAVEPOS 6 0 // save current posiition to reg 3-5
: IF GT REG4 TIME THEN RETURN 0 0 ENDIF
: IF OPENSPACE POSX POSZ THEN GOTOLABEL landok 0 ENDIF
: RUN SETSTATE FindPlace 0
: RUN RETURN 0 0
* landok
: RUN SETVAL POSY 0
: RUN MOVE 1500 0
: RUN COPYREG 0 9
: RUN SETVAL POSX REG0
: RUN SETVAL POSY 0
: RUN COPYREG 0 11
: RUN SETVAL POSZ REG0 // y is the same
: RUN SETVAL ORNX 0
: RUN SETVAL ORNY 1.0
: RUN SETVAL ORNZ 0
: RUN ORIENT 1000 0 // orient to new driection in 1 sec using ORN+POS
: RUN SETREG 4 TIME
: RUN ADDREG 4 3000
: RUN RNDREG 0 1000
: RUN SUBREG 0 500
: RUN ADDREG 4 REG0
: RUN SETSTATE Wait1 0
: RUN RETURN 0 0
: STATE Wait1 // before taking off
: RUN SAVEPOS 6 0 // save current posiition to reg
: IF GT REG4 TIME THEN RETURN 0 0 ENDIF
: RUN RNDREG 0 3
: RUN ADDREG 0 3
: RUN SETVAL POSY REG0
: RUN MOVE 1000 0
: RUN SETREG 4 TIME
: RUN ADDREG 4 2000
: RUN SETSTATE Wait2 0
: RUN RETURN 0 0
: STATE Wait2
: RUN SAVEPOS 6 0 // save current posiition to reg 3-5
: IF GT REG4 TIME THEN RETURN 0 0 ENDIF
: RUN SETSTATE FindPlace 0
: RUN RETURN 0 0
: STATE FindPlace
: RUN SAVEPOS 6 0
: IF EQ REG1 1 THEN GOTOLABEL useorigin 0 ENDIF
: RUN SETREG 1 1 // set to use origin next time
: RUN RNDREG 0 120
: RUN SUBREG 0 60 // x = -10..10
: RUN ADDREG 0 REG3 // center x
: RUN RNDREG 2 120
: RUN SUBREG 2 60 // x = -10..10
: RUN ADDREG 2 REG5 // center z
: IF OUTRANGE REG0 REG2 THEN GOTOLABEL outrng 0 ENDIF
: IF OPENSPACE REG0 REG2 THEN GOTOLABEL found 0 ENDIF
* outrng
: RUN SETREG 1 0 // no origin
: RUN RETURN 0 0
* useorigin
: RUN SETREG 1 0
: RUN SETREG 0 REG3
: RUN SETREG 2 REG5
* found
: RUN SETVAL POSX REG0
: RUN SETVAL POSZ REG2 // y is the same
: RUN MOVE 5000 0 // use POSX-Z as goal osistion and duration -1
RUN SETVAL POSY REG7
RUN SAVEPOS 6 0 // save current posiition to reg 0-2
RUN SETREG 7 POSY
: RUN SUBREG 0 REG6 // reg6-8 is position now, 7 is not valid
: RUN SUBREG 2 REG8
: RUN SETVAL POSX REG0
: RUN SETVAL POSY 0
: RUN SETVAL POSZ REG2 // y is the same
: RUN SETVAL ORNX 0
: RUN SETVAL ORNY 1.0
: RUN SETVAL ORNZ 0
: RUN ORIENT 1000 0 // orient to new driection in 1 sec using ORN+POS
: RUN SETREG 4 TIME
: RUN ADDREG 4 6000
RUN SETREG 2 REG7 // save reg7 to reg2 for restore in land state
: RUN SETSTATE Land 0
: RUN RETURN 0 0
: END