add level speeds + fix fast_1 timing

This commit is contained in:
Lephenixnoir 2022-01-16 15:04:03 +01:00
parent a5b1bc3d7b
commit da61dad100
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
25 changed files with 122 additions and 84 deletions

View File

@ -42,6 +42,11 @@ set(ASSETS
assets-cg/level/level20.txt
assets-cg/level/level21.txt
assets-cg/level/level22.txt
assets-cg/level/level23.txt
assets-cg/level/level24.txt
assets-cg/level/level25.txt
assets-cg/level/level26.txt
assets-cg/level/level27.txt
)
fxconv_declare_converters(converters.py)

View File

@ -1,4 +1,5 @@
#It's good to see you.\n\nStay close to me and\ndon't touch anything.
!0.75
long_vertical middle
@ -11,7 +12,6 @@ right
small left, small right

View File

@ -1,4 +1,5 @@
#You'll need a circular state of mind.
!0.75
left

View File

@ -1,4 +1,5 @@
#This will be easy.\nJust hold left...
!0.75
left

View File

@ -1,4 +1,5 @@
#Never give up.
!0.85
left
left

View File

@ -1,4 +1,5 @@
#There are some things\nworth fighting for.
!0.95
right
middle

View File

@ -1,2 +1,3 @@
#This will be full of\nunexpected twists and turns.
!0.55
middle rotate_right

View File

@ -1,4 +1,5 @@
#Tread carefully.\nDon't take things too far.
!0.85
left
small right

View File

@ -1,8 +1,9 @@
#Change is normal.
!0.85
middle rotate_left
middle rotate_right
middle rotate_left
middle rotate_left

View File

@ -1,9 +1,9 @@
#Anger may make certain\nchoices clearer.
right
middle fast_1
left, middle fast_1
left
left

View File

@ -1,28 +1,28 @@
#Patterns always emerge,\neven in chaos.
right fast_1
left
left, right fast_1
right fast_1
right
left fast_1
right, right fast_1
left
left fast_1
left
left, left fast_1
left fast_1
left
left fast_1
left, left fast_1
left
right fast_1
left, left fast_1
left, left fast_1
right, right fast_1
right

View File

@ -1,32 +1,33 @@
#This need not define you.
!1.05
square left fast_1
square right
square left fast_1, square right
middle fast_1
left
left fast_1
left, middle fast_1
left
square right fast_1
square left
left, left fast_1
left fast_1
right
right fast_1
square left, square right fast_1
right
right fast_1
right
left fast_1, right
right fast_1
right, right fast_1
right, right fast_1
small left, right fast_1
small left

View File

@ -1,31 +1,32 @@
#Let it amplify you.
!1.15
right fast_1
left
left, right fast_1
square left fast_1
square right
middle fast_1
square left fast_1, square right
right
left fast_1
right
right, middle fast_1
square right fast_1
left fast_1, right
square left, square right fast_1
square left
right
small left
middle fast_1
right
right, middle fast_1
square right fast_1
square left, square right fast_1
square left

View File

@ -1,19 +1,20 @@
#Repeating the same action\nbut expecting new results is\na sign of madness.
!1.25
square left
square right
left fast_1
left fast_1, right
right
middle rotate_left
left fast_1
left fast_1, small right
small right
square right
@ -29,9 +30,9 @@ square right
right
square left fast_1
square left fast_1, square right
square right
left
small right

View File

@ -1,4 +1,5 @@
#It's also a sign that you are\nhuman.
!0.85
right rotate
@ -7,4 +8,4 @@ left rotate
right rotate
right rotate

View File

@ -1,4 +1,5 @@
#Once an action is done it\ncannot be undone.
!0.85
right rotate

View File

@ -1,4 +1,5 @@
#You cannot get out of this.
!1.0
right
small left

View File

@ -1,15 +1,16 @@
#Accept the situation and\nmove on.
!1.15
left fast_1
small right
left fast_1, small right
right fast_1
middle
right fast_1
right fast_1, middle
small left, right fast_1
small left
middle rotate_left
@ -18,9 +19,9 @@ middle rotate_left
right rotate
left fast_1
left fast_1, right
right
left
@ -31,4 +32,4 @@ square right
square left
right rotate
right rotate

View File

@ -1,11 +1,12 @@
#To try invites failure.
!1.25
left
left
middle fast_1
middle fast_1, right
right
middle
@ -23,17 +24,17 @@ middle rotate_left
left
small right
square right fast_1
square left, square right fast_1
square left
middle rotate_right
left fast_1
small right
left fast_1, small right
left fast_1
left fast_1, left
left

View File

@ -1,4 +1,5 @@
#Resistance is not an option.
!1.25
right rotate

View File

@ -29,6 +29,6 @@ left fast_2
left
let fast_2
left fast_2
left

View File

@ -1,4 +1,8 @@
import fxconv
import struct
def float_to_bytes(f):
return struct.pack('>f', f)
def convert(input, output, params, target):
if params["custom-type"] == "level":
@ -10,10 +14,18 @@ def convert(input, output, params, target):
def convert_level(input, output, params, target):
with open(input, "r") as fp:
raw = fp.read().split("\n")
lines = [tempo.split(",") for tempo in raw if not tempo.startswith("#")]
lines = [tempo.split(",") for tempo in raw
if not tempo.startswith("#") and not tempo.startswith("!")]
messages = [l[1:].strip() for l in raw if l.startswith("#")]
message = "\n".join(l.replace("\\n", "\n") for l in messages)
speed = 1.0
for line in raw:
if line.startswith("!"):
speed = float(line[1:])
print(speed)
blocks = bytes()
block_count = 0
@ -99,7 +111,7 @@ def convert_level(input, output, params, target):
block_count += 1
o = fxconv.ObjectData()
o += fxconv.u32(0x3f800000) # 1.0 as a float
o += float_to_bytes(speed)
o += fxconv.ref(bytes(message, 'utf-8') + bytes(1), padding=4)
o += fxconv.u32(block_count)
o += fxconv.ref(blocks)

View File

@ -50,7 +50,7 @@ typedef struct {
} rectmeta_t;
typedef struct {
float tempo;
float speed_factor;
const char *message;
int block_count;
rectmeta_t *blocks;

View File

@ -56,9 +56,9 @@ episode_t episodes[] = {
},
{
.name = "guilt",
.level_count = 1,
.level_count = 5,
.levels = (level_t *[]) {
&level22, // TODO
&level23, &level24, &level25, &level26, &level27,
},
},
};
@ -147,9 +147,11 @@ void game_loop(int current_episode, int current_level)
/* Time management */
float time_direction = lv->tempo * time_direction_forward;
float time_direction = time_direction_forward;
if(state == State_Rewind)
time_direction = time_direction_rewind;
if(state == State_Playing)
time_direction *= lv->speed_factor;
if(state == State_Dead) {
game.time_dead += FRAME_DURATION;
@ -167,6 +169,7 @@ void game_loop(int current_episode, int current_level)
if(game.time_transition >= TRANSITION_DURATION) {
game.time_transition = 0;
game.forced_player_rota = 0;
game.player_rota = rpr(game.player_rota);
state = State_Playing;
}
}
@ -175,6 +178,7 @@ void game_loop(int current_episode, int current_level)
game.time_episode_transition += FRAME_DURATION;
if(game.time_episode_transition >= TRANSITION_DURATION) {
game.forced_player_rota = 0;
game.player_rota = rpr(game.player_rota);
}
if(game.time_episode_transition >= EPISODE_TRANSITION_DURATION) {
game.time_episode_transition = 0;
@ -246,6 +250,7 @@ void game_loop(int current_episode, int current_level)
if(state == State_Rewind && game.time <= REWIND_END) {
game.time = REWIND_END;
game.forced_player_rota = 0;
game.player_rota = rpr(game.player_rota);
state = State_Playing;
continue;
}

View File

@ -132,9 +132,9 @@ void rect_physics(rect_t *r, rectmeta_t const *meta, float absolute_time)
r->r = 0.3 - time * vr;
}
else if(meta->action == Action_Speed1) {
/* Double speed between -8 and -6 to skip 2 tempos */
float speeding_period = fminf(2.0, fmaxf(0.0, time + 6.0));
r->x -= RECT_SPEED * speeding_period;
/* Double speed between -6 and -4 to skip 2 tempos */
float speeding_period = fminf(2.0, fmaxf(0.0, time + 4.0));
r->x -= RECT_SPEED * (speeding_period - 2.0);
}
else if(meta->action == Action_FadeOut) {
// TODO
@ -151,8 +151,8 @@ void rect_physics(rect_t *r, rectmeta_t const *meta, float absolute_time)
// TODO
}
else if(meta->action == Action_Speed2) {
/* Double speed permanently */
// TODO
/* Speed x1.6 permanently */
r->x -= RECT_SPEED * time * 0.6;
}
else if(meta->action == Action_Speed3) {
// TODO