fixed some delays

This commit is contained in:
Luxferre
2026-01-11 14:57:44 +02:00
parent e8156e49e5
commit c6a026846a
2 changed files with 24 additions and 18 deletions
+21
View File
@@ -175,5 +175,26 @@ void wait_for_start_rand() {
srand(entropy); srand(entropy);
} }
/* Generic helper methods */
/* Array shuffle method */
void shuffle(s8 *array, u16 n) {
u16 i, j, t;
if(n > 1) {
for(i=n-1;i>0;i--) {
j = (u16) (rand()%(i+1));
t = array[j];
array[j] = array[i];
array[i] = t;
}
}
}
/* Delay by n cycles */
void delay_cycles(u16 n) {
u16 i;
for(i=0;i<n;++i);
}
#endif #endif
+3 -18
View File
@@ -37,17 +37,15 @@ void beep_run() {
play_jingle(660, 880, 440, 660, 220, 440); play_jingle(660, 880, 440, 660, 220, 440);
} }
void beep_win() { void beep_win() {
u16 i;
play_jingle(55, 110, 110, 220, 220, 440); play_jingle(55, 110, 110, 220, 220, 440);
for(i=0;i<4000;++i); delay_cycles(4000);
play_jingle(440, 660, 660, 880, 880, 1760); play_jingle(440, 660, 660, 880, 880, 1760);
for(i=0;i<4000;++i); delay_cycles(4000);
play_jingle(880, 660, 660, 880, 880, 1760); play_jingle(880, 660, 660, 880, 880, 1760);
} }
void beep_lose() { void beep_lose() {
u16 i;
play_jingle(110, 55, 220, 110, 110, 55); play_jingle(110, 55, 220, 110, 110, 55);
for(i=0;i<4000;++i); delay_cycles(4000);
play_jingle(110, 55, 110, 55, 110, 55); play_jingle(110, 55, 110, 55, 110, 55);
} }
void beep_err() { void beep_err() {
@@ -298,19 +296,6 @@ void print_msg(char *s) {
render_main_scene(); render_main_scene();
} }
/* Array shuffle method */
void shuffle(s8 *array, u16 n) {
u16 i, j, t;
if(n > 1) {
for(i=n-1;i>0;i--) {
j = (u16) (rand()%(i+1));
t = array[j];
array[j] = array[i];
array[i] = t;
}
}
}
/* Room item handling methods */ /* Room item handling methods */
s16 handle_monster(s16 val) { s16 handle_monster(s16 val) {