Fixed crashes after game over or winning state
This commit is contained in:
parent
28d0951d08
commit
061f255be4
|
@ -33,14 +33,14 @@ gameover_update :: proc(state: ^GameState, delta: f32) {
|
|||
if rl.IsKeyPressed(rl.KeyboardKey.ESCAPE) {
|
||||
gameover.ready_to_go = false
|
||||
rl.StopMusicStream(current_music)
|
||||
tween_to(&Overlay_Opacity, 1.0, 0.5, ease.Ease.Cubic_Out, nil, proc(data: rawptr) {
|
||||
tween_to(&Overlay_Opacity, 1.0, 0.5, ease.Ease.Cubic_Out, state, proc(data: rawptr) {
|
||||
state := transmute(^GameState)data
|
||||
stack_pop()
|
||||
state := transmute(^GameState)stack_top()
|
||||
fmt.println(state.variant)
|
||||
game := transmute(^Game)stack_top()
|
||||
game := transmute(^Game)state.previous
|
||||
game_setup(game)
|
||||
menu := menu_init(game)
|
||||
stack_push(menu)
|
||||
free(state)
|
||||
tween_to(&Overlay_Opacity, 0, 0.5, ease.Ease.Cubic_Out)
|
||||
})
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ gameover_draw :: proc(state: ^GameState) {
|
|||
}
|
||||
|
||||
gameover_free :: proc(state: ^GameState) {
|
||||
free(state)
|
||||
// free(state)
|
||||
}
|
||||
|
||||
gameover_ready :: proc(state: rawptr) {
|
||||
|
|
|
@ -34,13 +34,13 @@ winning_update :: proc(state: ^GameState, delta: f32) {
|
|||
winning.ready_to_go = false
|
||||
rl.StopMusicStream(current_music)
|
||||
tween_to(&Overlay_Opacity, 1.0, 0.5, ease.Ease.Cubic_Out, nil, proc(data: rawptr) {
|
||||
state := transmute(^GameState)data
|
||||
stack_pop()
|
||||
state := transmute(^GameState)stack_top()
|
||||
fmt.println(state.variant)
|
||||
game := transmute(^Game)stack_top()
|
||||
game := transmute(^Game)state.previous
|
||||
game_setup(game)
|
||||
menu := menu_init(game)
|
||||
stack_push(menu)
|
||||
free(state)
|
||||
tween_to(&Overlay_Opacity, 0, 0.5, ease.Ease.Cubic_Out)
|
||||
})
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ winning_draw :: proc(state: ^GameState) {
|
|||
}
|
||||
|
||||
winning_free :: proc(state: ^GameState) {
|
||||
free(state)
|
||||
// free(state)
|
||||
}
|
||||
|
||||
winning_ready :: proc(state: rawptr) {
|
||||
|
|
Loading…
Reference in New Issue