Import coco-planes 0.1.0 upstream source snapshot
Original author: Pierre Sarrazin. Preserve upstream GPLv3-or-later and file-specific notices. Source: http://sarrazip.com/dev/coco-planes-0.1.0.tar.gz Archive SHA-256: 29191e6ba225965caa637ee726e1189639dc7fcdf2b68310fb93fbffd56c9c52
This commit is contained in:
commit
7939132267
78 files changed
+6990
No files matched your search
@@ -0,0 +1,52 @@
|
||||
#include "Controller.h"
|
||||
|
||||
#include "BiplaneMover.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
// Choose the delay (in frames) before this controller decides to
|
||||
// launch the plane.
|
||||
//
|
||||
static word
|
||||
Controller_chooseNumFramesBeforeLaunch(void)
|
||||
{
|
||||
return rnd(1 * 20, 10 * 20);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Controller_init(Controller *self,
|
||||
byte controlType,
|
||||
BiplaneMover *mover,
|
||||
byte probeBit,
|
||||
byte testBit,
|
||||
byte joyButtonMask)
|
||||
{
|
||||
assert(mover);
|
||||
|
||||
self->controlType = controlType;
|
||||
|
||||
self->mover = mover;
|
||||
|
||||
KeyState_init(&self->fireKeyState, probeBit, testBit);
|
||||
|
||||
self->joyButtonMask = joyButtonMask;
|
||||
|
||||
// Only used with AUTOMATIC_CONTROLLER:
|
||||
self->state = STATE_READY_FOR_TAKE_OFF;
|
||||
self->numFramesBeforeStateChange = Controller_chooseNumFramesBeforeLaunch();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Controller_onBiplaneExplosion(Controller *self)
|
||||
{
|
||||
// The plane has just started exploding.
|
||||
// Put it back to "ready for take off" state.
|
||||
// Choose the wait time before taking off.
|
||||
//
|
||||
self->state = STATE_READY_FOR_TAKE_OFF;
|
||||
self->numFramesBeforeStateChange = Controller_chooseNumFramesBeforeLaunch();
|
||||
}
|
||||
Reference in new issue
Block a user