summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being.cpp2
-rw-r--r--src/being.h1
-rw-r--r--src/engine.cpp27
-rw-r--r--src/game.cpp19
4 files changed, 31 insertions, 18 deletions
diff --git a/src/being.cpp b/src/being.cpp
index d2bf85d5..3411d5c7 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -121,7 +121,7 @@ void sort() {
}
Being::Being():
- speech_time(0),
+ speech_time(0), aspd(350),
damage(""), damage_time(0),
id(0), job(0),
x(0), y(0), destX(0), destY(0), direction(0),
diff --git a/src/being.h b/src/being.h
index 6748732e..173b1d3c 100644
--- a/src/being.h
+++ b/src/being.h
@@ -64,6 +64,7 @@ class Being {
unsigned int speech_time;
unsigned int damage_time;
bool showSpeech, showDamage;
+ unsigned short aspd; // attack speed
/**
* Constructor.
diff --git a/src/engine.cpp b/src/engine.cpp
index 940bac79..2dca09e2 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -265,14 +265,23 @@ void Engine::logic()
Being *being = (*beingIterator);
if (being->job < 10) { // A player
- if (being->action != STAND && being->action != SIT
- && being->action != DEAD) {
- being->frame =
- (get_elapsed_time(being->walk_time) * 4) / (being->speed);
-
- if (being->frame >= 4) {
- being->nextStep();
- }
+ switch (being->action) {
+ case WALK:
+ being->frame = (get_elapsed_time(being->walk_time) * 4) /
+ (being->speed);
+ if (being->frame >= 4) {
+ being->nextStep();
+ }
+ break;
+ case ATTACK:
+ being->frame = (get_elapsed_time(being->walk_time) * 4) /
+ (being->aspd);
+ if (being->frame >= 4) {
+ being->nextStep();
+ }
+ break;
+ default:
+ break;
}
}
@@ -493,7 +502,7 @@ void Engine::draw()
std::stringstream debugStream;
debugStream << "[" << fps << " fps] " <<
(mouseX / 32 + camera_x) << ", " << (mouseY / 32 + camera_y) << " "
- << (int)player_node->frame;
+ << player_node->aspd;
debugInfo->setCaption(debugStream.str());
debugInfo->adjustSize();
}
diff --git a/src/game.cpp b/src/game.cpp
index fdd8899e..30eb5f29 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -224,12 +224,8 @@ void do_input()
}
else if ((keysym.sym == SDLK_F7))
{
- /*SOUND_SID id = sound.loadItem("data/sfx/fist-swish.ogg");
- sound.startItem(id, 120);*/
- ResourceManager *resman = ResourceManager::getInstance();
- SoundEffect *sample = resman->getSoundEffect(
- "sfx/fist-swish.ogg");
- sample->play(0, 120);
+ SOUND_SID id = sound.loadItem("data/sfx/fist-swish.ogg");
+ sound.startItem(id, 120);
}
// Emotions, Skill dialog
@@ -365,7 +361,7 @@ void do_input()
}
else {
// Search for player character to trade with
- /*
+
id = find_pc(mx, my);
if (id != 0) {
// Begin a trade
@@ -373,7 +369,6 @@ void do_input()
WFIFOL(2) = net_l_value(id);
WFIFOSET(6);
}
- */
}
@@ -537,6 +532,11 @@ void do_input()
player_node->y,
player_node->direction);
player_node->walk_time = tick_time;
+
+ ResourceManager *resman = ResourceManager::getInstance();
+ SoundEffect *sample = resman->getSoundEffect(
+ "sfx/fist-swish.ogg");
+ sample->play(0, 120);
}
}
@@ -1017,6 +1017,9 @@ void do_parse() {
sprintf(points, "b0 0x0009 %i", RFIFOL(4));
chatWindow->chat_log(points, BY_SERVER);*/
break;
+ case 0x0035:
+ player_node->aspd = RFIFOW(4);
+ break;
default:
/*char unknown[20];
sprintf(unknown, "b0 %x %i", RFIFOW(2),RFIFOL(4));