Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/Extras/AcidSplash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Extras/BackStab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Extras/VampiricBlow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Sounds/FX/suck.wav
Binary file not shown.
1 change: 1 addition & 0 deletions src/mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ load_effects(void)
effects[SLAM] = load_effect("Sounds/FX/slam.wav");
effects[SPLAT] = load_effect("Sounds/FX/splat.wav");
effects[STONES] = load_effect("Sounds/FX/stones.wav");
effects[SUCK] = load_effect("Sounds/FX/suck.wav");
effects[SWING0] = load_effect("Sounds/FX/swing.wav");
effects[SWING1] = load_effect("Sounds/FX/swing2.wav");
effects[SWING2] = load_effect("Sounds/FX/swing3.wav");
Expand Down
1 change: 1 addition & 0 deletions src/mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ typedef enum Fx_t {
SLAM,
SPLAT,
STONES,
SUCK,
SWING0,
SWING1,
SWING2,
Expand Down
27 changes: 17 additions & 10 deletions src/player.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,11 +492,18 @@ use_skill(Player *player, Skill *skill, SkillData *skillData)
if (skill->animation) {
Animation *a = skill->animation;

// Copy the orientation and position of the sword animation for the skill animation
// \see player_turn
a->sprite->pos = player->swordAnimation->sprite->pos;
a->sprite->flip = player->swordAnimation->sprite->flip;
a->sprite->angle = player->swordAnimation->sprite->angle;
if (skill->animation_properties.on_player) {
a->sprite->pos = player->sprite->pos;
} else {
// Copy the orientation and position of the sword animation for the skill animation
// \see player_turn
a->sprite->pos = player->swordAnimation->sprite->pos;
a->sprite->flip = player->swordAnimation->sprite->flip;
a->sprite->angle = player->swordAnimation->sprite->angle;
}

a->sprite->pos.x += skill->animation_properties.offset.x;
a->sprite->pos.y += skill->animation_properties.offset.y;

animation_run(a);
linkedlist_append(&player->skillAnimations, skill->animation);
Expand Down Expand Up @@ -577,11 +584,11 @@ build_sword_animation(Player *p, SDL_Renderer *renderer)
{
animation_load_texture(p->swordAnimation, "Extras/SwordSwing.png", renderer);
animation_set_frames(p->swordAnimation, (AnimationClip[]) {
{ 0, 0, 32, 32, 20 },
{ 32, 0, 32, 32, 20 },
{ 64, 0, 32, 32, 20 },
{ 96, 0, 32, 32, 20 },
{ 128, 0, 32, 32, 20 }
{ 0, 0, 32, 32, 50 },
{ 32, 0, 32, 32, 50 },
{ 64, 0, 32, 32, 50 },
{ 96, 0, 32, 32, 50 },
{ 128, 0, 32, 32, 50 }
});

p->swordAnimation->loop = false;
Expand Down
79 changes: 66 additions & 13 deletions src/skill.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ create_default(const char *s_label, Sprite *s)
skill->levelcap = 1;
skill->tooltip = NULL;
skill->animation = NULL;
skill->animation_properties.offset = POS(0, 0);
skill->animation_properties.on_player = false;
return skill;
}

Expand Down Expand Up @@ -338,9 +340,8 @@ vampiric_blow_skill(Skill *skill, SkillData *data)
return false;
}

animation_run(player->swordAnimation);
Monster *monster = data->matrix->spaces[targetPos.x][targetPos.y].monster;
mixer_play_effect(SWING0);
mixer_play_effect(SUCK);
if (monster) {
gui_log("You attack %s with a vampiric blow", monster->lclabel);
player->stats.advantage = true;
Expand All @@ -350,7 +351,6 @@ vampiric_blow_skill(Skill *skill, SkillData *data)
monster_hit(monster, result.dmg, result.critical);

if (result.dmg) {
mixer_play_effect(SWORD_HIT);
monster_set_bleeding(monster);

unsigned int gain = player->stats.lvl * 3;
Expand Down Expand Up @@ -379,7 +379,7 @@ vampiric_blow_skill(Skill *skill, SkillData *data)
}

static Skill *
create_vampiric_blow(void)
create_vampiric_blow(Camera *cam)
{
Texture *t = texturecache_add("Extras/Skills.png");
Sprite *s = sprite_create();
Expand All @@ -391,6 +391,23 @@ create_vampiric_blow(void)
skill->levelcap = 2;
skill->use = vampiric_blow_skill;
skill->resetTime = 5;
skill->tooltip = tooltip_create(vampiric_blow_tooltip, cam);
skill->animation = animation_create(6);

Animation *a = skill->animation;
animation_load_texture(a, "Extras/VampiricBlow.png", cam->renderer);
animation_set_frames(a, (AnimationClip[]) {
{ 0, 0, 32, 32, 120 },
{ 32, 0, 32, 32, 120 },
{ 64, 0, 32, 32, 120 },
{ 96, 0, 32, 32, 120 },
{ 128, 0, 32, 32, 120 },
{ 160, 0, 32, 32, 120 },
});
a->loop = false;
a->sprite->dim = GAME_DIMENSION;
a->sprite->clip = (SDL_Rect) { 0, 0, 32, 32 };
a->sprite->rotationPoint = (SDL_Point) { 16, 16 };
return skill;
}

Expand Down Expand Up @@ -681,7 +698,6 @@ skill_backstab(Skill *skill, SkillData *data)
player_update_pos(data->player, (uint32_t) data->direction.x * TILE_DIMENSION,
(uint32_t) data->direction.y * TILE_DIMENSION);
player_turn(data->player, &reverseDirection);
animation_run(data->player->swordAnimation);

if (targetSpace->monster) {
Monster *m = targetSpace->monster;
Expand All @@ -705,7 +721,7 @@ skill_backstab(Skill *skill, SkillData *data)
}

static Skill *
create_backstab(void)
create_backstab(Camera *cam)
{
Texture *t = texturecache_add("Extras/Skills.png");
Sprite *s = sprite_create();
Expand All @@ -720,6 +736,26 @@ create_backstab(void)
skill->available = NULL;
skill->use = skill_backstab;
skill->actionRequired = true;
skill->tooltip = tooltip_create(backstab_tooltip, cam);
skill->animation = animation_create(9);

Animation *a = skill->animation;
animation_load_texture(a, "Extras/BackStab.png", cam->renderer);
animation_set_frames(a, (AnimationClip[]) {
{ 0, 0, 32, 32, 100 },
{ 32, 0, 32, 32, 100 },
{ 64, 0, 32, 32, 100 },
{ 96, 0, 32, 32, 100 },
{ 128, 0, 32, 32, 100 },
{ 160, 0, 32, 32, 100 },
{ 192, 0, 32, 32, 100 },
{ 224, 0, 32, 32, 100 },
{ 256, 0, 32, 32, 100 }
});
a->loop = false;
a->sprite->dim = GAME_DIMENSION;
a->sprite->clip = (SDL_Rect) { 0, 0, 32, 32 };
a->sprite->rotationPoint = (SDL_Point) { 16, 16 };
return skill;
}

Expand Down Expand Up @@ -1031,7 +1067,7 @@ skill_erupt(Skill *skill, SkillData *data)
}

static Skill *
create_erupt(void)
create_erupt(Camera *cam)
{
Texture *t = texturecache_add("Extras/Skills.png");
Sprite *s = sprite_create();
Expand All @@ -1044,6 +1080,26 @@ create_erupt(void)
skill->use = skill_erupt;
skill->instantUse = true;
skill->resetTime = 3;
skill->tooltip = tooltip_create(erupt_tooltip, cam);
skill->animation = animation_create(8);

Animation *a = skill->animation;
animation_load_texture(a, "Extras/AcidSplash.png", cam->renderer);
animation_set_frames(a, (AnimationClip[]) {
{ 0, 0, 64, 64, 80 },
{ 64, 0, 64, 64, 80 },
{ 128, 0, 64, 64, 80 },
{ 192, 0, 64, 64, 80 },
{ 256, 0, 64, 64, 80 },
{ 320, 0, 64, 64, 80 },
{ 384, 0, 64, 64, 100 },
{ 448, 0, 64, 64,100 }
});
a->loop = false;
a->sprite->dim = DIM(96, 96);
a->sprite->clip = (SDL_Rect) { 0, 0, 64, 64 };
skill->animation_properties.offset = POS(-32, -32);
skill->animation_properties.on_player = true;
return skill;
}

Expand All @@ -1056,8 +1112,7 @@ skill_create(enum SkillType t, Camera *cam)
skill = create_flurry(cam);
break;
case VAMPIRIC_BLOW:
skill = create_vampiric_blow();
skill->tooltip = tooltip_create(vampiric_blow_tooltip, cam);
skill = create_vampiric_blow(cam);
break;
case SIP_HEALTH:
skill = create_sip_health();
Expand All @@ -1072,8 +1127,7 @@ skill_create(enum SkillType t, Camera *cam)
skill->tooltip = tooltip_create(blink_tooltip, cam);
break;
case ERUPT:
skill = create_erupt();
skill->tooltip = tooltip_create(erupt_tooltip, cam);
skill = create_erupt(cam);
break;
case DAGGER_THROW:
skill = create_throw_dagger();
Expand All @@ -1087,8 +1141,7 @@ skill_create(enum SkillType t, Camera *cam)
skill->tooltip = tooltip_create(trip_tooltip, cam);
break;
case BACKSTAB:
skill = create_backstab();
skill->tooltip = tooltip_create(backstab_tooltip, cam);
skill = create_backstab(cam);
break;
case PHASE:
skill = create_phase();
Expand Down
4 changes: 4 additions & 0 deletions src/skill.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ typedef struct Skill_t {
bool (*use)(struct Skill_t*, SkillData*);
Tooltip *tooltip;
Animation *animation;
struct {
Position offset;
bool on_player; /// Render animation on player, else on target
} animation_properties;
} Skill;

Skill*
Expand Down
Loading