summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-21 21:27:59 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-21 21:27:59 +0000
commit58ffdbff028f763451f471639c6aecc530ca4d94 (patch)
treed2a2a3de9eb52ea25e6b4f361dbe64eaba309666 /src
parentf7e4e3acb009dc09dffc98ff7b59b0260e7ecc28 (diff)
downloadmana-58ffdbff028f763451f471639c6aecc530ca4d94.tar.gz
mana-58ffdbff028f763451f471639c6aecc530ca4d94.tar.bz2
mana-58ffdbff028f763451f471639c6aecc530ca4d94.tar.xz
mana-58ffdbff028f763451f471639c6aecc530ca4d94.zip
Some cleanups and button, radiobutton and checkbox now take into account
disabled status.
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp6
-rw-r--r--src/game.h4
-rw-r--r--src/gui/button.cpp2
-rw-r--r--src/gui/checkbox.cpp12
-rw-r--r--src/gui/radiobutton.cpp12
-rw-r--r--src/main.cpp2
-rw-r--r--src/main.h4
-rw-r--r--src/net/protocol.cpp20
8 files changed, 31 insertions, 31 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 660dc502..15c730f1 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -47,9 +47,9 @@ unsigned char keyb_state;
volatile int tick_time;
volatile bool action_time = false;
int server_tick;
-extern unsigned char screen_mode;
int fps = 0, frame = 0, current_npc = 0;
bool displayPathToMouse = false;
+int startX = 0, startY = 0;
OkDialog *deathNotice = NULL;
@@ -140,8 +140,8 @@ void do_init()
// Initialize beings
player_node = new Being();
player_node->id = account_ID;
- player_node->x = x;
- player_node->y = y;
+ player_node->x = startX;
+ player_node->y = startY;
player_node->speed = 150;
player_node->setHairColor(char_info->hair_color);
player_node->setHairStyle(char_info->hair_style);
diff --git a/src/game.h b/src/game.h
index e76f4705..be4853ae 100644
--- a/src/game.h
+++ b/src/game.h
@@ -59,10 +59,10 @@
extern char map_path[480];
extern int fps, frame, current_npc;
extern char walk_status;
-extern unsigned short src_x, src_y, x, y;
extern volatile int tick_time;
extern int server_tick;
extern bool displayPathToMouse;
+extern int startX, startY;
/**
* Main game loop
@@ -92,7 +92,7 @@ void do_exit();
/**
* Calculate packet length
*/
-int get_packet_length(short);
+int get_packet_length(short);
/**
* Returns elapsed time. (Warning: very unsafe function, it supposes the delay
diff --git a/src/gui/button.cpp b/src/gui/button.cpp
index c508afe2..fb1a01ec 100644
--- a/src/gui/button.cpp
+++ b/src/gui/button.cpp
@@ -57,7 +57,7 @@ Button::Button(const std::string& caption):
void Button::draw(gcn::Graphics* graphics) {
int mode;
- if (false /*disabled*/) {
+ if (!isEnabled()) {
mode = 3;
}
else if (isPressed()) {
diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp
index 88b3f975..b231ec64 100644
--- a/src/gui/checkbox.cpp
+++ b/src/gui/checkbox.cpp
@@ -43,15 +43,15 @@ void CheckBox::drawBox(gcn::Graphics* graphics) {
getAbsolutePosition(x, y);
if (mMarked) {
- if (false /*disabled*/) {
- box = checkBoxDisabledChecked;
- } else {
+ if (isEnabled()) {
box = checkBoxChecked;
+ } else {
+ box = checkBoxDisabledChecked;
}
- } else if (false /*disabled*/) {
- box = checkBoxDisabled;
- } else {
+ } else if (isEnabled()) {
box = checkBoxNormal;
+ } else {
+ box = checkBoxDisabled;
}
x += 2;
diff --git a/src/gui/radiobutton.cpp b/src/gui/radiobutton.cpp
index de2d4f68..a7115752 100644
--- a/src/gui/radiobutton.cpp
+++ b/src/gui/radiobutton.cpp
@@ -43,15 +43,15 @@ void RadioButton::drawBox(gcn::Graphics* graphics)
getAbsolutePosition(x, y);
if (mMarked) {
- if (false /*disabled*/) {
- box = radioDisabledChecked;
- } else {
+ if (isEnabled()) {
box = radioChecked;
+ } else {
+ box = radioDisabledChecked;
}
- } else if (false /*disabled*/) {
- box = radioDisabled;
- } else {
+ } else if (isEnabled()) {
box = radioNormal;
+ } else {
+ box = radioDisabled;
}
x += 2;
diff --git a/src/main.cpp b/src/main.cpp
index b24e2c61..ef1d1483 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -63,8 +63,6 @@ int map_address, char_ID;
short map_port;
char map_name[16];
unsigned char state;
-unsigned short x, y;
-unsigned char direction;
unsigned char screen_mode;
char *dir = NULL;
diff --git a/src/main.h b/src/main.h
index 57a4860f..a48a1279 100644
--- a/src/main.h
+++ b/src/main.h
@@ -88,7 +88,7 @@ typedef struct {
extern Image *login_wallpaper;
extern Spriteset *hairset, *playerset;
-extern Graphics* graphics;
+extern Graphics *graphics;
extern char username[25];
extern char password[25];
extern int map_address, char_ID;
@@ -99,8 +99,6 @@ extern char sex, n_server, n_character;
extern SERVER_INFO *server_info;
extern PLAYER_INFO *char_info;
extern unsigned char state;
-extern unsigned short x, y;
-extern unsigned char direction;
extern Configuration config;
extern Sound sound;
extern Map *tiledMap;
diff --git a/src/net/protocol.cpp b/src/net/protocol.cpp
index b59a8c68..ab873576 100644
--- a/src/net/protocol.cpp
+++ b/src/net/protocol.cpp
@@ -23,6 +23,7 @@
#include "../main.h"
#include "../being.h"
+#include "../game.h"
#include "protocol.h"
#include "network.h"
@@ -175,17 +176,20 @@ void map_start()
while (in_size < 2) flush();
- if (RFIFOW(0) == 0x0073) {
+ if (RFIFOW(0) == SMSG_LOGIN_SUCCESS) {
while (in_size < 11) flush();
- x = get_x(RFIFOP(6));
- y = get_y(RFIFOP(6));
- //direction = get_direction(RFIFOP(6));
- log("Protocol: Player position: (%d, %d), Direction: %d",
- x, y, direction);
+ startX = get_x(RFIFOP(6));
+ startY = get_y(RFIFOP(6));
+ int direction = get_direction(RFIFOP(6));
+ log("Protocol: Player start position: (%d, %d), Direction: %d",
+ startX, startY, direction);
RFIFOSKIP(11);
- } else if(0x0081) {
+ } else if (0x0081) {
log("Warning: Map server D/C");
- } else error("Unknown packet: map_start");
+ } else {
+ error("Unknown packet: map_start");
+ }
+
// Send "map loaded"
WFIFOW(0) = net_w_value(0x007d);
WFIFOSET(2);