More todo, room transition functionality. BUG: animations are frozen for some reason

main
parent 8412534db1
commit 23d391a1a2

@ -2009,7 +2009,7 @@ Entity *new_entity(GameState *gs)
} }
} }
assert(false); assert(false);
return NULL; return 0;
} }
typedef struct ToVisit { typedef struct ToVisit {
@ -2143,25 +2143,24 @@ Vec2 point_plane(Vec3 p)
#define parse_enumstr(arena, enum_str, errors, string_array, enum_kind_name, prefix) parse_enumstr_impl(arena, enum_str, string_array, ARRLEN(string_array), errors, enum_kind_name, prefix) #define parse_enumstr(arena, enum_str, errors, string_array, enum_kind_name, prefix) parse_enumstr_impl(arena, enum_str, string_array, ARRLEN(string_array), errors, enum_kind_name, prefix)
void initialize_gamestate_from_threedee_level(GameState *gs, ThreeDeeLevel *level) ThreeDeeLevel level_threedee = {0};
void transition_to_room(GameState *gs, ThreeDeeLevel *level, MD_String8 new_room_name)
{ {
memset(gs, 0, sizeof(GameState)); Log("Transitioning to %.*s...\n", MD_S8VArg(new_room_name));
rnd_gamerand_seed(&gs->random, RANDOM_SEED); assert(gs);
// the target room will be whichever room has the player bool already_player_in_gamestate = gs->player != 0;
for(Room *cur_room = level->room_list; cur_room; cur_room = cur_room->next) Entity player_entity = {0};
{ if(already_player_in_gamestate)
for(PlacedEntity *cur = cur_room->placed_entity_list; cur; cur = cur->next)
{
if(cur->npc_kind == NPC_Player)
{ {
gs->current_room_name = cur_room->name; player_entity = *(gs->player);
break;
}
}
if(gs->current_room_name.size > 0) break;
} }
gs->current_room_name = new_room_name;
memset(gs->entities, 0, sizeof(gs->entities));
Room *in_room = get_cur_room(gs, level); Room *in_room = get_cur_room(gs, level);
bool found_player = false; bool found_player = false;
for(PlacedEntity *cur = in_room->placed_entity_list; cur; cur = cur->next) for(PlacedEntity *cur = in_room->placed_entity_list; cur; cur = cur->next)
@ -2176,12 +2175,20 @@ void initialize_gamestate_from_threedee_level(GameState *gs, ThreeDeeLevel *leve
gs->player = cur_entity; gs->player = cur_entity;
} }
} }
if(already_player_in_gamestate)
{
assert(!found_player);
gs->player = new_entity(gs);
*(gs->player) = player_entity;
}
else
{
assert(found_player); assert(found_player);
}
gs->world_entity = new_entity(gs); gs->world_entity = new_entity(gs);
gs->world_entity->is_world = true; gs->world_entity->is_world = true;
ENTITIES_ITER(gs->entities) ENTITIES_ITER(gs->entities)
{ {
it->rotation = PI32; it->rotation = PI32;
@ -2378,9 +2385,36 @@ void initialize_gamestate_from_threedee_level(GameState *gs, ThreeDeeLevel *leve
it->perceptions_dirty = false; // nobody should say anything about jester memories it->perceptions_dirty = false; // nobody should say anything about jester memories
} }
} }
}
void initialize_gamestate_from_threedee_level(GameState *gs, ThreeDeeLevel *level)
{
memset(gs, 0, sizeof(GameState));
rnd_gamerand_seed(&gs->random, RANDOM_SEED);
// the target room will be whichever room has the player
MD_String8 target_room_name = {0};
for(Room *cur_room = level->room_list; cur_room; cur_room = cur_room->next)
{
for(PlacedEntity *cur = cur_room->placed_entity_list; cur; cur = cur->next)
{
if(cur->npc_kind == NPC_Player)
{
target_room_name = cur_room->name;
break;
}
}
if(target_room_name.size > 0) break;
}
assert(target_room_name.size > 0);
transition_to_room(gs, &level_threedee, target_room_name);
} }
ThreeDeeLevel level_threedee = {0};
void reset_level() void reset_level()
{ {
@ -3380,7 +3414,7 @@ void init(void)
shifted_farmer_armature = load_armature(persistent_arena, binary_file, MD_S8Lit("Farmer.bin")); shifted_farmer_armature = load_armature(persistent_arena, binary_file, MD_S8Lit("Farmer.bin"));
shifted_farmer_armature.image = image_shifted_farmer; shifted_farmer_armature.image = image_shifted_farmer;
Log("Done.\n"); Log("Done. Used %f of the frame arena, %llu kB\n", (double) frame_arena->pos / (double)frame_arena->cap, (frame_arena->pos/1024));
MD_ArenaClear(frame_arena); MD_ArenaClear(frame_arena);
@ -6096,7 +6130,7 @@ void frame(void)
draw_centered_text((TextParams){false, mission_text, V2(screen_size().x * 0.5f, screen_size().y * 0.25f + vert), blendalpha(WHITE, visible), mission_font_scale, .use_font = &font_for_text_input, .layer = LAYER_ANGEL_SCREEN}); draw_centered_text((TextParams){false, mission_text, V2(screen_size().x * 0.5f, screen_size().y * 0.25f + vert), blendalpha(WHITE, visible), mission_font_scale, .use_font = &font_for_text_input, .layer = LAYER_ANGEL_SCREEN});
if(imbutton(aabb_centered(V2(screen_size().x/2.0f, screen_size().y*0.25f - vert), MulV2F(V2(170.0f, button_height), visible)), visible, MD_S8Lit("Accept"), .layer = LAYER_ANGEL_SCREEN, .font = &font_for_text_input)) if(imbutton(aabb_centered(V2(screen_size().x/2.0f, screen_size().y*0.25f - vert), MulV2F(V2(170.0f, button_height), visible)), visible, MD_S8Lit("Accept"), .layer = LAYER_ANGEL_SCREEN, .font = &font_for_text_input))
{ {
Log("Accepting mission...\n"); transition_to_room(&gs, &level_threedee, MD_S8Lit("Forest"));
} }
} }
else else

@ -1,9 +1,17 @@
Urgent: Urgent:
- White sidebars on angel's speech that recede away. - Remove (MD_) prefix from project
- Mystical particles that float upwards. - Fix camera angle on forest map, probably introduce custom camera angles per map
- Gradient png on the bottom that has more alpha, controlled by same parameter as white sidebars. - In debugtools show number of arenas allocated, and total megabytes allocated in arenas
- Fix everything about the shotgun, put shotgun away. Make them understand they're holding their shotgun more. REALLY look into characters not being able to shoot eachother
- On startup if devtools print the estimated cost per generation request of the worst offending character - Angel dialog improvements:
- White sidebars on angel's speech that recede away.
- Mystical particles that float upwards.
- Gradient png on the bottom that has more alpha, controlled by same parameter as white sidebars.
- Fix everything about the shotgun, test put shotgun away. Make them understand they're holding their shotgun more. REALLY look into characters not being able to shoot eachother
- Cost estimation:
- On startup if devtools print the estimated cost per generation request of the worst offending character
- Show in upper right a $ amount for AI costs so far to user
- simple room transition system for angel/real map interop, angel room - simple room transition system for angel/real map interop, angel room
- angel character that gives you randomized goals such as (kill so and so) or (befriend blank) or (get john to go to other room), and decides itself with gpt when you're done with the game, when you've 'learned your lesson'. - angel character that gives you randomized goals such as (kill so and so) or (befriend blank) or (get john to go to other room), and decides itself with gpt when you're done with the game, when you've 'learned your lesson'.
- can't interact with characters while they're thinking - can't interact with characters while they're thinking

Loading…
Cancel
Save