Compare commits

...

3 Commits

Binary file not shown.

@ -1268,12 +1268,12 @@ typedef struct
Room *room_list;
} ThreeDeeLevel;
Room *get_cur_room(ThreeDeeLevel *level)
Room *get_cur_room(GameState *gs, ThreeDeeLevel *level)
{
Room *in_room = 0;
for(Room *cur = level->room_list; cur; cur = cur->next)
{
if(MD_S8Match(cur->name, MD_S8Lit("Forest"), 0))
if(MD_S8Match(cur->name, gs->current_room_name, 0))
{
in_room = cur;
break;
@ -2143,8 +2143,21 @@ void initialize_gamestate_from_threedee_level(GameState *gs, ThreeDeeLevel *leve
memset(gs, 0, sizeof(GameState));
rnd_gamerand_seed(&gs->random, RANDOM_SEED);
Room *in_room = get_cur_room(level);
// the target room will be whichever room has the player
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)
{
gs->current_room_name = cur_room->name;
break;
}
}
if(gs->current_room_name.size > 0) break;
}
Room *in_room = get_cur_room(gs, level);
bool found_player = false;
for(PlacedEntity *cur = in_room->placed_entity_list; cur; cur = cur->next)
{
@ -4589,7 +4602,7 @@ Vec2 move_and_slide(MoveSlideParams p)
BUFF(CollisionObj, 256) to_check = { 0 };
// add world boxes
for(CollisionCylinder *cur = get_cur_room(&level_threedee)->collision_list; cur; cur = cur->next)
for(CollisionCylinder *cur = get_cur_room(&gs, &level_threedee)->collision_list; cur; cur = cur->next)
{
BUFF_APPEND(&to_check, ((CollisionObj){cur->bounds, gs.world_entity}));
}
@ -5704,7 +5717,7 @@ void frame(void)
// @Place(draw 3d things)
for(PlacedMesh *cur = get_cur_room(&level_threedee)->placed_mesh_list; cur; cur = cur->next)
for(PlacedMesh *cur = get_cur_room(&gs, &level_threedee)->placed_mesh_list; cur; cur = cur->next)
{
float seed = (float)((int64_t)cur % 1024);
@ -5759,11 +5772,18 @@ void frame(void)
assert(false);
if (it->killed)
{
to_use->go_to_animation = MD_S8Lit("Die Backwards");
to_use->next_animation_isnt_looping = true;
}
else if (LenV2(it->vel) > 0.5f)
{
to_use->go_to_animation = MD_S8Lit("Running");
}
else
{
to_use->go_to_animation = MD_S8Lit("Idle");
}
draw_thing((DrawnThing){.armature = to_use, .t = draw_with, .outline = gete(gs.player->interacting_with) == it});
@ -6639,6 +6659,7 @@ ISANERROR("Don't know how to do this stuff on this platform.")
//if (it->memories_last->context.author_npc_kind != it->npc_kind)
{
const char *action = 0;
const char *action_argument = "Raphael";
if(gete(it->aiming_shotgun_at))
{
action = "fire_shotgun";
@ -6651,7 +6672,7 @@ ISANERROR("Don't know how to do this stuff on this platform.")
char *next_dialog = rigged_dialog[it->times_talked_to % ARRLEN(rigged_dialog)];
char *target = characters[it->memories_last->context.author_npc_kind].name;
target = characters[NPC_Player].name;
ai_response = FmtWithLint(frame_arena, "{\"target\": \"%s\", \"action\": \"%s\", \"action_argument\": \"The Player\", \"speech\": \"%s\"}", target, action, next_dialog);
ai_response = FmtWithLint(frame_arena, "{\"target\": \"%s\", \"action\": \"%s\", \"action_argument\": \"%s\", \"speech\": \"%s\"}", target, action, action_argument, next_dialog);
it->times_talked_to += 1;
}
else
@ -6991,7 +7012,12 @@ ISANERROR("Don't know how to do this stuff on this platform.")
{
static float visible = 0.0f;
float target = 0.0f;
if(gs.player->killed && (!cur_unread_entity || gs.finished_reading_dying_dialog))
bool anybody_unread = false;
ENTITIES_ITER(gs.entities)
{
if(it->undismissed_action) anybody_unread = true;
}
if(gs.player->killed && (!anybody_unread || gs.finished_reading_dying_dialog))
{
gs.finished_reading_dying_dialog = true;
target = 1.0f;
@ -7379,7 +7405,7 @@ void event(const sapp_event *e)
if(flycam)
{
if (e->type == SAPP_EVENTTYPE_MOUSE_MOVE)
if (e->type == SAPP_EVENTTYPE_MOUSE_MOVE && !mouse_frozen)
{
const float rotation_speed = 0.001f;
flycam_horizontal_rotation -= e->mouse_dx * rotation_speed;

@ -274,6 +274,7 @@ typedef struct GameState {
uint64_t tick;
bool won;
MD_String8 current_room_name; // the string is allocated on the level that is currently loaded
bool finished_reading_dying_dialog;
bool no_angel_screen;

@ -32,7 +32,7 @@
#ifdef DEVTOOLS
#define PROFILING_SAVE_FILENAME "rpgpt.spall"
// server url cannot have trailing slash
//#define MOCK_AI_RESPONSE
#define MOCK_AI_RESPONSE
#define SERVER_DOMAIN "localhost"
#define SERVER_PORT 8090
#define IS_SERVER_SECURE 0

Loading…
Cancel
Save