Farmer does an odd dance, fix scaling of things, delete more old code

main
Cameron Murphy Reikes 12 months ago
parent 7316b9e974
commit 8c192fc5d1

BIN
art/art.blend (Stored with Git LFS)

Binary file not shown.

@ -124,6 +124,11 @@ CharacterGen characters[] = {
.enum_name = "Player",
.prompt = "There has been an internal error.",
},
{
.name = "Farmer",
.enum_name = "Farmer",
.prompt = "The farmer wakes up, does his chores, and sleeps in the farmhouse all on his lonesome. He's tinkering with something fishy in the barn, but's mighty secretive about it. He used to have a wife, and suddenly she disappeared. The farmer gets MIGHTY angry if you question him about what's in his barn under the tarp, or what happened to his wife and family, but is otherwise a kind hearted soul.",
},
};
typedef struct

@ -645,7 +645,10 @@ Vec2 entity_aabb_size(Entity *e)
}
else if (e->is_npc)
{
assert(false);
if(e->npc_kind == NPC_Farmer)
{
return V2(1,1);
}
return V2(0,0);
}
else if (e->is_prop)
@ -2367,8 +2370,6 @@ void ser_entity(SerState *ser, Entity *e)
SER_BUFF(ser, Vec2, &e->position_history);
ser_CharacterState(ser, &e->state);
ser_EntityRef(ser, &e->talking_to);
ser_bool(ser, &e->is_rolling);
ser_double(ser, &e->time_not_rolling);
ser_AnimKind(ser, &e->cur_animation);
ser_float(ser, &e->anim_change_timer);
@ -2934,7 +2935,15 @@ void do_float_encoding_tests()
}
#endif
Armature armature = {0};
Armature player_armature = {0};
Armature farmer_armature = {0};
// armatureanimations are processed once every visual frame from this list
Armature *armatures[] = {
&player_armature,
&farmer_armature,
};
Mesh mesh_player = {0};
Mesh mesh_simple_worm = {0};
@ -2992,7 +3001,10 @@ void init(void)
mesh_player = load_mesh(persistent_arena, binary_file, MD_S8Lit("ExportedWithAnims.bin"));
binary_file = MD_LoadEntireFile(frame_arena, MD_S8Lit("assets/exported_3d/ArmatureExportedWithAnims.bin"));
armature = load_armature(persistent_arena, binary_file, MD_S8Lit("ArmatureExportedWithAnims.bin"));
player_armature = load_armature(persistent_arena, binary_file, MD_S8Lit("ArmatureExportedWithAnims.bin"));
binary_file = MD_LoadEntireFile(frame_arena, MD_S8Lit("assets/exported_3d/Farmer.bin"));
farmer_armature = load_armature(persistent_arena, binary_file, MD_S8Lit("Farmer.bin"));
@ -4075,7 +4087,7 @@ Overlapping get_overlapping(AABB aabb)
PROFILE_SCOPE("checking the entities")
ENTITIES_ITER(gs.entities)
{
if (!(it->is_character && it->is_rolling) && !it->is_world && overlapping(aabb, entity_aabb(it)))
if (!it->is_world && overlapping(aabb, entity_aabb(it)))
{
BUFF_APPEND(&to_return, it);
}
@ -4161,11 +4173,11 @@ Vec2 move_and_slide(MoveSlideParams p)
}
// add entity boxes
if (!p.dont_collide_with_entities && !(p.from->is_character && p.from->is_rolling))
if (!p.dont_collide_with_entities)
{
ENTITIES_ITER(gs.entities)
{
if (!(it->is_character && it->is_rolling) && it != p.from && !(it->is_npc && it->dead) && !it->is_world && !it->is_item)
if (it != p.from && !(it->is_npc && it->dead) && !it->is_world && !it->is_item)
{
BUFF_APPEND(&to_check, ((CollisionObj){aabb_centered(it->pos, entity_aabb_size(it)), it}));
}
@ -4970,8 +4982,8 @@ void frame(void)
Vec3 player_pos = V3(gs.player->pos.x, 0.0, gs.player->pos.y);
//dbgline(V2(0,0), V2(500, 500));
const float vertical_to_horizontal_ratio = 0.8f;
const float cam_distance = 35.0f;
const float vertical_to_horizontal_ratio = CAM_VERTICAL_TO_HORIZONTAL_RATIO;
const float cam_distance = CAM_DISTANCE;
Vec3 away_from_player;
{
float ratio = vertical_to_horizontal_ratio;
@ -5008,8 +5020,9 @@ void frame(void)
// progress the animation, then blend the two animations if necessary, and finally
// output into anim_blended_poses
ARR_ITER(Armature*, armatures)
{
Armature *cur = &armature;
Armature *cur = *it;
if(cur->go_to_animation.size > 0)
{
@ -5099,7 +5112,12 @@ void frame(void)
Transform draw_with = entity_transform(it);
if(it->npc_kind == NPC_Player)
{
draw_thing((DrawnThing){.armature = &armature, .t = draw_with});
draw_thing((DrawnThing){.armature = &player_armature, .t = draw_with});
}
else if(it->npc_kind == NPC_Farmer)
{
farmer_armature.go_to_animation = MD_S8Lit("Dance");
draw_thing((DrawnThing){.armature = &farmer_armature, .t = draw_with});
}
else
{
@ -6223,18 +6241,16 @@ void frame(void)
if(gs.player->state == CHARACTER_WALKING)
{
armature.go_to_animation = MD_S8Lit("Running");
player_armature.go_to_animation = MD_S8Lit("Running");
}
else
{
armature.go_to_animation = MD_S8Lit("Idle");
player_armature.go_to_animation = MD_S8Lit("Idle");
}
if (gs.player->state == CHARACTER_WALKING)
{
speed = PLAYER_SPEED;
if (gs.player->is_rolling) speed = PLAYER_ROLL_SPEED;
if (LenV2(movement) == 0.0)
{
gs.player->state = CHARACTER_IDLE;

@ -311,8 +311,6 @@ typedef struct Entity
BUFF(Vec2, 8) position_history; // so npcs can follow behind the player
CharacterState state;
EntityRef talking_to;
bool is_rolling; // can only roll in idle or walk states
double time_not_rolling; // for cooldown for roll, so you can't just hold it and be invincible
// so doesn't change animations while time is stopped
AnimKind cur_animation;

@ -3,8 +3,7 @@
#define LEVEL_TILES 150 // width and height of level tiles array
#define LAYERS 3
#define TILE_SIZE 0.5f // in pixels
#define PLAYER_SPEED 0.5f // in meters per second
#define PLAYER_ROLL_SPEED 7.0f
#define PLAYER_SPEED 0.2f // in meters per second
#define PERCEPTION_HEARING_RAGE (TILE_SIZE*4.0f)
#define CHARACTERS_PER_SEC 45.0f
#define PROPAGATE_ACTIONS_RADIUS (TILE_SIZE*4.0f)
@ -12,6 +11,9 @@
#define ARROW_SPEED 200.0f
#define SECONDS_PER_ARROW 1.3f
#define CAM_DISTANCE 15.0f
#define CAM_VERTICAL_TO_HORIZONTAL_RATIO 0.8f
#define ARENA_SIZE (1024*1024*10)
#define BIG_ARENA_SIZE (ARENA_SIZE * 8)

Loading…
Cancel
Save