Auto full-combo Koibumi2000 in Taiko no Tatsujin CS5
Dependencies: fll mbed-rtos mbed
taiko.cpp
- Committer:
- amutake
- Date:
- 2015-02-15
- Revision:
- 10:79bb44beb08b
- Child:
- 11:21b3b0494baa
File content as of revision 10:79bb44beb08b:
// Toolkit for Taiko no Tatsujin #include "fll.h" #include "taiko.h" Serial pc(USBTX, USBRX); button_t taiko2button(Taiko t) { switch (t) { case Don: return CIRCLE; case Ka: return R1; } return 0; } TaikoSource::TaikoSource(note** ns, int s, int b) { note_seq = ns; size = s; bpm = b; index = 0; frame_i = 0; } button_t TaikoSource::await() { if (index >= size) { index = 0; // XXX: remove this line (for debugging) return 0; } note* n = note_seq[index]; float len = n->length * (60 / (float)bpm); // note length (sec) float passing = frame_i * FRAME; // passing time since the begining of this note (sec) frame_i++; button_t btn = 0; if (passing < len / 2) { // in the former of this note btn = taiko2button(n->taiko); } else if (passing + FRAME >= len) { // final frame of this note frame_i = 0; index++; } return btn; }