summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2004-10-08 14:01:51 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2004-10-08 14:01:51 +0000
commit1e1e15dd3ab111383b27f09f70eb590878254e00 (patch)
tree9f47098a3c1758d6d49b40e3b02442e2cae8fe85 /src
parent75da526f11f74b9bffb9580c2daf63108c294ca8 (diff)
downloadmana-client-1e1e15dd3ab111383b27f09f70eb590878254e00.tar.gz
mana-client-1e1e15dd3ab111383b27f09f70eb590878254e00.tar.bz2
mana-client-1e1e15dd3ab111383b27f09f70eb590878254e00.tar.xz
mana-client-1e1e15dd3ab111383b27f09f70eb590878254e00.zip
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp16
-rw-r--r--src/being.h3
-rw-r--r--src/game.cpp119
-rw-r--r--src/graphic/2xsai.cpp (renamed from src/graphic/super_eagle.cpp)294
-rw-r--r--src/graphic/2xsai.h25
-rw-r--r--src/graphic/graphic.cpp108
-rw-r--r--src/graphic/graphic.h3
-rw-r--r--src/graphic/super_eagle.h44
-rw-r--r--src/gui/char_select.cpp6
-rw-r--r--src/gui/char_server.cpp9
-rw-r--r--src/gui/gui.cpp424
-rw-r--r--src/gui/login.cpp6
-rw-r--r--src/gui/shop.cpp11
-rw-r--r--src/gui/skill.cpp109
-rw-r--r--src/gui/skill.h12
-rw-r--r--src/gui/stats.cpp12
-rw-r--r--src/main.cpp16
-rw-r--r--src/main.h2
18 files changed, 820 insertions, 399 deletions
diff --git a/src/being.cpp b/src/being.cpp
index c2e93ca1..0c15918e 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -19,6 +19,8 @@
along with The Mana World; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ By ElvenProgrammer aka Eugenio Favalli (umperio@users.sourceforge.net)
+
*/
#include <stdio.h>
@@ -208,3 +210,17 @@ void sort() {
}
}
}
+
+/** Remove all path nodes from a being */
+void empty_path(NODE *node) {
+ if(node) {
+ PATH_NODE *temp = node->path;
+ PATH_NODE *next;
+ while(temp) {
+ next = temp->next;
+ free(temp);
+ temp = next;
+ }
+ node->path = NULL;
+ }
+}
diff --git a/src/being.h b/src/being.h
index 9903371f..f5187cb6 100644
--- a/src/being.h
+++ b/src/being.h
@@ -19,6 +19,8 @@
along with The Mana World; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ By ElvenProgrammer aka Eugenio Favalli (umperio@users.sourceforge.net)
+
*/
#ifndef _BEING_H
@@ -74,6 +76,7 @@ unsigned int get_id(NODE *node);
unsigned int find_npc(unsigned short x, unsigned short y);
unsigned int find_monster(unsigned short x, unsigned short y);
void sort();
+void empty_path(NODE *node);
extern NODE *player_node;
diff --git a/src/game.cpp b/src/game.cpp
index 44e8a9fc..9379e29b 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -18,6 +18,12 @@
along with The Mana World; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ By ElvenProgrammer aka Eugenio Favalli (umperio@users.upagiro.net)
+
+ kth5 aka Alexander Baldeck
+
+ SimEdw
+
*/
#include "main.h"
@@ -92,17 +98,17 @@ void game() {
while(state!=EXIT) {
status("INPUT");
do_input();
- if(refresh) {
+ //if(refresh) {
status("GRAPHIC");
do_graphic();
- refresh = false;
- }
+ //refresh = false;
+ //}
status("PARSE");
do_parse();
status("FLUSH");
flush();
- if(fps>30)
- rest(15);
+ /*if(fps>30)
+ rest(15);*/
}
exit_graphic();
@@ -114,7 +120,7 @@ void do_init() {
if(!load_map(map_path))error("Could not find map file");
- sound.StartMOD("./data/sound/Mods/somemp.xm", -1);
+ //sound.StartMOD("./data/sound/Mods/somemp.xm", -1);
// Initialize timers
tick_time = 0;
@@ -122,7 +128,7 @@ void do_init() {
LOCK_VARIABLE(tick_time);
LOCK_VARIABLE(refresh);
install_int_ex(refresh_time, MSEC_TO_TIMER(1));
- install_int_ex(refresh_screen, /*MSEC_TO_TIMER(2000)*/BPS_TO_TIMER(75)); // Set max refresh rate to 75 fps
+ install_int_ex(refresh_screen, /*MSEC_TO_TIMER(2000)*/BPS_TO_TIMER(200)); // Set max refresh rate to 75 fps
install_int_ex(second, BPS_TO_TIMER(1));
// Interrupt drawing while in background
@@ -266,6 +272,9 @@ void do_input() {
} else if(key[KEY_I]) {
inventory.toggle();
action_time = false;
+ } else if(key[KEY_K]) {
+ show_skill_list_dialog = true;
+ action_time = false;
}
}
@@ -370,7 +379,7 @@ void do_parse() {
if(walk_status==1)
walk_status = 2;
break;
- // Add new being
+ // Add new being / stop monster
case 0x0078:
if(find_node(RFIFOL(2))==NULL) {
node = create_node();
@@ -378,8 +387,23 @@ void do_parse() {
node->speed = RFIFOW(6);
if(node->speed==0)node->speed = 150; // Else division by 0 when calculating frame
node->job = RFIFOW(14);
+ empty_path(node);
memcpy(node->coordinates, RFIFOP(46), 3);
+ /*char set[30];
+ sprintf(set, "%i %i %i %i",get_x(RFIFOP(46)),get_y(RFIFOP(46)),get_x(player_node->coordinates),get_y(player_node->coordinates));
+ alert("78",set,"","","",0,0);*/
add_node(node);
+ } else {
+ /*char set[30];
+ sprintf(set, "%i %i %i %i %i",RFIFOL(2),get_x(RFIFOP(46)),get_y(RFIFOP(46)),get_x(player_node->coordinates),get_y(player_node->coordinates));
+ alert("78",set,"","","",0,0);*/
+ if(node) {
+ empty_path(node);
+ memcpy(node->coordinates, RFIFOP(46), 3);
+ node->frame = 0;
+ node->tick_time = tick_time;
+ node->action = STAND;
+ }
}
break;
// Remove a being
@@ -406,6 +430,7 @@ void do_parse() {
memcpy(node->coordinates, RFIFOP(46), 3);
add_node(node);
node->tick_time = tick_time;
+ node->frame = 0;
node->speed = RFIFOW(6);
}
break;
@@ -422,6 +447,7 @@ void do_parse() {
node->job = RFIFOW(14);
add_node(node);
}
+ empty_path(node);
node->path = calculate_path(get_src_x(RFIFOP(50)),get_src_y(RFIFOP(50)),get_dest_x(RFIFOP(50)),get_dest_y(RFIFOP(50)));
if(node->path!=NULL) {
direction = 0;
@@ -441,6 +467,7 @@ void do_parse() {
set_coordinates(node->coordinates, node->path->x, node->path->y, direction);
node->action = WALK;
node->tick_time = tick_time;
+ node->frame = 0;
}
break;
// Being moving
@@ -514,13 +541,11 @@ void do_parse() {
// Action failed (ex. sit because you have not reached the right level)
case 0x0110:
CHATSKILL action;
-
action.skill = RFIFOW(2);
action.bskill = RFIFOW(4);
action.unused = RFIFOW(6);
action.success = RFIFOB(8);
action.reason = RFIFOB(9);
-
if(action.success != SKILL_FAILED &&
action.bskill == BSKILL_EMOTE ) {
printf("Action: %d/%d", action.bskill, action.success);
@@ -530,22 +555,32 @@ void do_parse() {
// Update stat values
case 0x00b0:
switch(RFIFOW(2)) {
- case 5:
+ case 0x0000:
+ player_node->speed;
+ break;
+ case 0x0005:
char_info->hp = RFIFOW(4);
break;
- case 6:
+ case 0x0006:
char_info->max_hp = RFIFOW(4);
break;
- case 7:
+ case 0x0007:
char_info->sp = RFIFOW(4);
break;
- case 8:
+ case 0x0008:
char_info->max_sp = RFIFOW(4);
break;
- case 11:
+ case 0x000b:
char_info->lv = RFIFOW(4);
break;
- }
+ case 0x000c:
+ char_info->skill_point = RFIFOW(4);
+ sprintf(skill_points, "Skill points: %i", char_info->skill_point);
+ break;
+ case 0x0037:
+ char_info->job_lv = RFIFOW(4);
+ break;
+ }
update_stats_dialog();
if(char_info->hp==0) {
ok("Message", "You're now dead, press ok to restart");
@@ -555,15 +590,18 @@ void do_parse() {
}
break;
// Stop walking
- /*case 0x0088: // Disabled because giving some problems
+ case 0x0088: // Disabled because giving some problems
if(node = find_node(RFIFOL(2))) {
- if(node->id!=player_node->id) {
+ //if(node->id!=player_node->id) {
+ /*char ids[20];
+ sprintf(ids,"%i",RFIFOL(2));
+ alert(ids,"","","","",0,0);*/
node->action = STAND;
node->frame = 0;
set_coordinates(node->coordinates, RFIFOW(6), RFIFOW(8), get_direction(node->coordinates));
- }
+ //}
}
- break;*/
+ break;
// Damage, sit, stand up
case 0x008a:
switch(RFIFOB(26)) {
@@ -573,7 +611,7 @@ void do_parse() {
if(node->speech!=NULL) {
free(node->speech);
node->speech = NULL;
- node->speech_time = SPEECH_TIME;
+ //node->speech_time = SPEECH_TIME;
}
node->speech = (char *)malloc(5);
memset(node->speech, '\0', 5);
@@ -586,7 +624,7 @@ void do_parse() {
else node->speech_color = makecol(255, 0, 0);
}
node->speech_time = SPEECH_TIME;
- if(RFIFOL(2)!=player_node->id) {
+ if(RFIFOL(2)!=player_node->id) { // buggy
node = find_node(RFIFOL(2));
if(node!=NULL) {
if(node->job<10)
@@ -704,20 +742,47 @@ void do_parse() {
break;
// Remove item to inventory after you sold it
case 0x00af:
- printf("sell %i\n",-RFIFOW(4));
- inventory.increase_quantity(RFIFOW(2),-RFIFOW(4));
+ printf("sell %i\n",-RFIFOW(4));
+ inventory.increase_quantity(RFIFOW(2), -RFIFOW(4));
break;
- //use a item
+ // Use an item
case 0x01c8:
- inventory.change_quantity(RFIFOW(2),RFIFOW(10));
+ inventory.change_quantity(RFIFOW(2), RFIFOW(10));
break;
+ // ??
case 0x0119:
sprintf(pkt_nfo, "%i %i %i %i", RFIFOL(2), RFIFOW(6), RFIFOW(8), RFIFOW(10));
//alert(pkt_nfo,"","","","",0,0);
break;
+ // Skill list
+ case 0x010f:
+ //n_skills = 0;
+ //SKILL *temp_skill = NULL;
+ //n_skills = (len-4)/37;
+ for(int k=0;k<(len-4)/37;k++) {
+ if(RFIFOW(4+k*37+6)!=0 || RFIFOB(4+k*37+36)!=0) {
+ SKILL *temp_skill = is_skill(RFIFOW(4+k*37));
+ if(temp_skill) {
+ temp_skill->lv = RFIFOW(4+k*37+6);
+ temp_skill->sp = RFIFOW(4+k*37+36);
+ if(temp_skill->sp<0)temp_skill->sp = 0;
+ } else {
+ n_skills++;
+ add_skill(RFIFOW(4+k*37), RFIFOW(4+k*37+6), RFIFOW(4+k*37+8));
+ }
+ }
+ }
+ break;
+ // MVP experience
+ case 0x010b:
+ break;
+ // Display MVP payer
+ case 0x010c:
+ chatlog.chat_log("MVP player", BY_SERVER, gui_font);
+ break;
// Manage non implemented packets
default:
- //printf("%x\n",id);
+ //printf("%x\n",id);
//alert(pkt_nfo,"","","","",0,0);
break;
}
diff --git a/src/graphic/super_eagle.cpp b/src/graphic/2xsai.cpp
index e48723d9..59e824b9 100644
--- a/src/graphic/super_eagle.cpp
+++ b/src/graphic/2xsai.cpp
@@ -1,27 +1,8 @@
-/**
+#include "2xsai.h"
- The Mana World
- Copyright 2004 The Mana World Development Team
-
- This file is part of The Mana World.
-
- The Mana World is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- any later version.
-
- The Mana World is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with The Mana World; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*/
-
-#include "super_eagle.h"
+#define uint32 unsigned long
+#define uint16 unsigned short
+#define uint8 unsigned char
static uint32 colorMask = 0xF7DEF7DE;
static uint32 lowPixelMask = 0x08210821;
@@ -32,7 +13,8 @@ static uint32 greenMask = 0x7E0;
static int PixelsPerMask = 2;
static int xsai_depth = 0;
-int Init_SuperEagle(int d) {
+int Init_2xSaI(int d) {
+
int minr = 0, ming = 0, minb = 0;
int i;
@@ -75,8 +57,9 @@ int Init_SuperEagle(int d) {
return 0;
}
-/** unused /- kth5
-static int GetResult1(uint32 A, uint32 B, uint32 C, uint32 D) {
+
+static int GetResult1(uint32 A, uint32 B, uint32 C, uint32 D)
+{
int x = 0;
int y = 0;
int r = 0;
@@ -95,7 +78,8 @@ static int GetResult1(uint32 A, uint32 B, uint32 C, uint32 D) {
return r;
}
-static int GetResult2(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E) {
+static int GetResult2(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E)
+{
int x = 0;
int y = 0;
int r = 0;
@@ -112,7 +96,7 @@ static int GetResult2(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E) {
if (y <= 1)
r += 1;
return r;
-}*/
+}
#define GET_RESULT(A, B, C, D) ((A != C || A != D) - (B != C || B != D))
@@ -192,8 +176,260 @@ static unsigned char *src_line[4];
static unsigned char *dst_line[2];
+void Super2xSaI(BITMAP * src, BITMAP * dest, int s_x, int s_y, int d_x, int d_y, int w, int h)
+{
+ int sbpp, dbpp;
+
+ BITMAP *dst2 = NULL;
+
+ if (!src || !dest)
+ return;
+
+ sbpp = bitmap_color_depth(src);
+ dbpp = bitmap_color_depth(dest);
+
+ if ((sbpp != xsai_depth) || (sbpp != dbpp)) /* Must be same color depth */
+ return;
+
+ BLIT_CLIP2(src, dest, s_x, s_y, d_x, d_y, w, h, 2, 2);
+
+ if (w < 4 || h < 4) { /* Image is too small to be 2xSaI'ed. */
+ stretch_blit(src, dest, s_x, s_y, w, h, d_x, d_y, w * 2, h * 2);
+ return;
+ }
+
+ sbpp = BYTES_PER_PIXEL(sbpp);
+ if (d_x || d_y)
+ dst2 = create_sub_bitmap(dest, d_x, d_y, w * 2, h * 2);
+
+ Super2xSaI_ex(src->line[s_y] + s_x * sbpp, (unsigned int)(src->line[1] - src->line[0]), NULL, dst2 ? dst2 : dest, w, h);
+
+ if (dst2)
+ destroy_bitmap(dst2);
+
+ return;
+}
+
+void Super2xSaI_ex(uint8 *src, uint32 src_pitch, uint8 *unused, BITMAP *dest, uint32 width, uint32 height) {
+
+ int j, v;
+ unsigned int x, y;
+ int sbpp = BYTES_PER_PIXEL(bitmap_color_depth(dest));
+ unsigned long color[16];
+
+ /* Point to the first 3 lines. */
+ src_line[0] = src;
+ src_line[1] = src;
+ src_line[2] = src + src_pitch;
+ src_line[3] = src + src_pitch * 2;
+
+ /* Can we write the results directly? */
+ if (is_video_bitmap(dest) || is_planar_bitmap(dest)) {
+ dst_line[0] = (unsigned char *)malloc(sizeof(char) * sbpp * width);
+ dst_line[1] = (unsigned char *)malloc(sizeof(char) * sbpp * width);
+ v = 1;
+ }
+ else {
+ dst_line[0] = dest->line[0];
+ dst_line[1] = dest->line[1];
+ v = 0;
+ }
+
+ /* Set destination */
+ bmp_select(dest);
+
+ x = 0, y = 0;
+
+ if (PixelsPerMask == 2) {
+ unsigned short *sbp;
+ sbp = (unsigned short*)src_line[0];
+ color[0] = *sbp; color[1] = color[0]; color[2] = color[0]; color[3] = color[0];
+ color[4] = color[0]; color[5] = color[0]; color[6] = *(sbp + 1); color[7] = *(sbp + 2);
+ sbp = (unsigned short*)src_line[2];
+ color[8] = *sbp; color[9] = color[8]; color[10] = *(sbp + 1); color[11] = *(sbp + 2);
+ sbp = (unsigned short*)src_line[3];
+ color[12] = *sbp; color[13] = color[12]; color[14] = *(sbp + 1); color[15] = *(sbp + 2);
+ }
+ else {
+ unsigned long *lbp;
+ lbp = (unsigned long*)src_line[0];
+ color[0] = *lbp; color[1] = color[0]; color[2] = color[0]; color[3] = color[0];
+ color[4] = color[0]; color[5] = color[0]; color[6] = *(lbp + 1); color[7] = *(lbp + 2);
+ lbp = (unsigned long*)src_line[2];
+ color[8] = *lbp; color[9] = color[8]; color[10] = *(lbp + 1); color[11] = *(lbp + 2);
+ lbp = (unsigned long*)src_line[3];
+ color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2);
+ }
+
+ for (y = 0; y < height; y++) {
+
+ /* Todo: x = width - 2, x = width - 1 */
+
+ for (x = 0; x < width; x++) {
+ unsigned long product1a, product1b, product2a, product2b;
+
+//--------------------------------------- B0 B1 B2 B3 0 1 2 3
+// 4 5* 6 S2 -> 4 5* 6 7
+// 1 2 3 S1 8 9 10 11
+// A0 A1 A2 A3 12 13 14 15
+//--------------------------------------
+ if (color[9] == color[6] && color[5] != color[10]) {
+ product2b = color[9];
+ product1b = product2b;
+ }
+ else if (color[5] == color[10] && color[9] != color[6]) {
+ product2b = color[5];
+ product1b = product2b;
+ }
+ else if (color[5] == color[10] && color[9] == color[6]) {
+ int r = 0;
+
+ r += GET_RESULT(color[6], color[5], color[8], color[13]);
+ r += GET_RESULT(color[6], color[5], color[4], color[1]);
+ r += GET_RESULT(color[6], color[5], color[14], color[11]);
+ r += GET_RESULT(color[6], color[5], color[2], color[7]);
+
+ if (r > 0)
+ product1b = color[6];
+ else if (r < 0)
+ product1b = color[5];
+ else
+ product1b = INTERPOLATE(color[5], color[6]);
+
+ product2b = product1b;
+
+ }
+ else {
+ if (color[6] == color[10] && color[10] == color[13] && color[9] != color[14] && color[10] != color[12])
+ product2b = Q_INTERPOLATE(color[10], color[10], color[10], color[9]);
+ else if (color[5] == color[9] && color[9] == color[14] && color[13] != color[10] && color[9] != color[15])
+ product2b = Q_INTERPOLATE(color[9], color[9], color[9], color[10]);
+ else
+ product2b = INTERPOLATE(color[9], color[10]);
+
+ if (color[6] == color[10] && color[6] == color[1] && color[5] != color[2] && color[6] != color[0])
+ product1b = Q_INTERPOLATE(color[6], color[6], color[6], color[5]);
+ else if (color[5] == color[9] && color[5] == color[2] && color[1] != color[6] && color[5] != color[3])
+ product1b = Q_INTERPOLATE(color[6], color[5], color[5], color[5]);
+ else
+ product1b = INTERPOLATE(color[5], color[6]);
+ }
+
+ if (color[5] == color[10] && color[9] != color[6] && color[4] == color[5] && color[5] != color[14])
+ product2a = INTERPOLATE(color[9], color[5]);
+ else if (color[5] == color[8] && color[6] == color[5] && color[4] != color[9] && color[5] != color[12])
+ product2a = INTERPOLATE(color[9], color[5]);
+ else
+ product2a = color[9];
+
+ if (color[9] == color[6] && color[5] != color[10] && color[8] == color[9] && color[9] != color[2])
+ product1a = INTERPOLATE(color[9], color[5]);
+ else if (color[4] == color[9] && color[10] == color[9] && color[8] != color[5] && color[9] != color[0])
+ product1a = INTERPOLATE(color[9], color[5]);
+ else
+ product1a = color[5];
+
+ if (PixelsPerMask == 2) {
+ *((unsigned long *) (&dst_line[0][x * 4])) = product1a | (product1b << 16);
+ *((unsigned long *) (&dst_line[1][x * 4])) = product2a | (product2b << 16);
+ }
+ else {
+ *((unsigned long *) (&dst_line[0][x * 8])) = product1a;
+ *((unsigned long *) (&dst_line[0][x * 8 + 4])) = product1b;
+ *((unsigned long *) (&dst_line[1][x * 8])) = product2a;
+ *((unsigned long *) (&dst_line[1][x * 8 + 4])) = product2b;
+ }
+
+ /* Move color matrix forward */
+ color[0] = color[1]; color[4] = color[5]; color[8] = color[9]; color[12] = color[13];
+ color[1] = color[2]; color[5] = color[6]; color[9] = color[10]; color[13] = color[14];
+ color[2] = color[3]; color[6] = color[7]; color[10] = color[11]; color[14] = color[15];
+
+ if (x < width - 3) {
+ x += 3;
+ if (PixelsPerMask == 2) {
+ color[3] = *(((unsigned short*)src_line[0]) + x);
+ color[7] = *(((unsigned short*)src_line[1]) + x);
+ color[11] = *(((unsigned short*)src_line[2]) + x);
+ color[15] = *(((unsigned short*)src_line[3]) + x);
+ }
+ else {
+ color[3] = *(((unsigned long*)src_line[0]) + x);
+ color[7] = *(((unsigned long*)src_line[1]) + x);
+ color[11] = *(((unsigned long*)src_line[2]) + x);
+ color[15] = *(((unsigned long*)src_line[3]) + x);
+ }
+ x -= 3;
+ }
+ }
+
+ /* We're done with one line, so we shift the source lines up */
+ src_line[0] = src_line[1];
+ src_line[1] = src_line[2];
+ src_line[2] = src_line[3];
+
+ /* Read next line */
+ if (y + 3 >= height)
+ src_line[3] = src_line[2];
+ else
+ src_line[3] = src_line[2] + src_pitch;
+
+ /* Then shift the color matrix up */
+ if (PixelsPerMask == 2) {
+ unsigned short *sbp;
+ sbp = (unsigned short*)src_line[0];
+ color[0] = *sbp; color[1] = color[0]; color[2] = *(sbp + 1); color[3] = *(sbp + 2);
+ sbp = (unsigned short*)src_line[1];
+ color[4] = *sbp; color[5] = color[4]; color[6] = *(sbp + 1); color[7] = *(sbp + 2);
+ sbp = (unsigned short*)src_line[2];
+ color[8] = *sbp; color[9] = color[9]; color[10] = *(sbp + 1); color[11] = *(sbp + 2);
+ sbp = (unsigned short*)src_line[3];
+ color[12] = *sbp; color[13] = color[12]; color[14] = *(sbp + 1); color[15] = *(sbp + 2);
+ }
+ else {
+ unsigned long *lbp;
+ lbp = (unsigned long*)src_line[0];
+ color[0] = *lbp; color[1] = color[0]; color[2] = *(lbp + 1); color[3] = *(lbp + 2);
+ lbp = (unsigned long*)src_line[1];
+ color[4] = *lbp; color[5] = color[4]; color[6] = *(lbp + 1); color[7] = *(lbp + 2);
+ lbp = (unsigned long*)src_line[2];
+ color[8] = *lbp; color[9] = color[9]; color[10] = *(lbp + 1); color[11] = *(lbp + 2);
+ lbp = (unsigned long*)src_line[3];
+ color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2);
+ }
+
+
+ /* Write the 2 lines, if not already done so */
+ if (v) {
+ unsigned long dst_addr;
+
+ dst_addr = bmp_write_line(dest, y * 2);
+ for (j = 0; j < dest->w * sbpp; j += sizeof(long))
+ bmp_write32(dst_addr + j, *((unsigned long *) (dst_line[0] + j)));
+
+ dst_addr = bmp_write_line(dest, y * 2 + 1);
+ for (j = 0; j < dest->w * sbpp; j += sizeof(long))
+ bmp_write32(dst_addr + j, *((unsigned long *) (dst_line[1] + j)));
+ }
+ else {
+ if (y < height - 1) {
+ dst_line[0] = dest->line[y * 2 + 2];
+ dst_line[1] = dest->line[y * 2 + 3];
+ }
+ }
+ }
+ bmp_unwrite_line(dest);
+
+ if (v) {
+ free(dst_line[0]);
+ free(dst_line[1]);
+ }
+}
+
+
-void SuperEagle(BITMAP * src, BITMAP * dest, int s_x, int s_y, int d_x, int d_y, int w, int h) {
+void SuperEagle(BITMAP * src, BITMAP * dest, int s_x, int s_y, int d_x, int d_y, int w, int h)
+{
int sbpp, dbpp;
BITMAP *dst2 = NULL;
diff --git a/src/graphic/2xsai.h b/src/graphic/2xsai.h
new file mode 100644
index 00000000..7a9128bf
--- /dev/null
+++ b/src/graphic/2xsai.h
@@ -0,0 +1,25 @@
+#ifdef WIN32
+#pragma warning(disable:4312)
+#endif
+
+#ifndef _2XSAI_H
+#define _2XSAI_H
+
+#include <allegro.h>
+#include <allegro/internal/aintern.h>
+//#include <string.h>
+
+
+
+#define uint32 unsigned long
+#define uint16 unsigned short
+#define uint8 unsigned char
+
+int Init_2xSaI(int depth);
+void Super2xSaI(BITMAP * src, BITMAP * dest, int s_x, int s_y, int d_x, int d_y, int w, int h);
+void Super2xSaI_ex(uint8 *src, uint32 src_pitch, uint8 *unused, BITMAP *dest, uint32 width, uint32 height);
+
+void SuperEagle(BITMAP * src, BITMAP * dest, int s_x, int s_y, int d_x, int d_y, int w, int h);
+void SuperEagle_ex(uint8 *src, uint32 src_pitch, uint8 *unused, BITMAP *dest, uint32 width, uint32 height);
+
+#endif
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp
index 86aa62d4..3e07e9d0 100644
--- a/src/graphic/graphic.cpp
+++ b/src/graphic/graphic.cpp
@@ -24,6 +24,7 @@
*/
#include "graphic.h"
+#include "2xsai.h"
#define TILESET_W 480
#define TILESET_H 320
@@ -38,14 +39,16 @@ DATAFILE *tileset;
char itemCurrenyQ[10] = "0";
char page_num;
int map_x, map_y, camera_x, camera_y;
-DIALOG_PLAYER *chat_player, *npc_player, *skill_player, *buy_sell_player, *buy_player, *sell_player, *stats_player;
+DIALOG_PLAYER *chat_player, *npc_player, *skill_player, *buy_sell_player, *buy_player, *sell_player, *stats_player, *skill_list_player;
char speech[255] = "";
char npc_text[1000] = "";
char statsString2[255] = "n/a";
+char skill_points[10] = "";
TmwInventory inventory;
Chat chatlog("./docs/chatlog.txt", 20);
int show_npc_dialog = 0;
bool show_skill_dialog = false;
+bool show_skill_list_dialog = false;
DIALOG npc_dialog[] = {
/* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */
@@ -88,6 +91,16 @@ DIALOG sell_dialog[] = {
{ NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }
};
+DIALOG skill_list_dialog[] = {
+ /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */
+ { tmw_dialog_proc, 300, 200, 260, 200, 0, 0, 0, 0, 0, 0, (char *)"Skills", NULL, NULL },
+ { tmw_button_proc, 450, 376, 50, 20, 255, 0, 'u', D_EXIT, 0, 0, (char *)"&Up", NULL, NULL },
+ { tmw_button_proc, 508, 376, 50, 20, 255, 0, 'c', D_EXIT, 0, 0, (char *)"&Close", NULL, NULL },
+ { tmw_list_proc, 304, 224, 252, 100, 0, 0, 0, 0, 0, 0, (char *)skill_list, NULL, NULL },
+ { tmw_text_proc, 304, 326, 40, 20, 0, 0, 0, 0, 0, 0, (char *)skill_points, NULL, NULL },
+ { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }
+};
+
DIALOG chat_dialog[] = {
/* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */
{ tmw_edit_proc, 0, 574, 592, 25, 0, 0, 'c', 0, 90, 0, speech, NULL, NULL },
@@ -149,6 +162,7 @@ void init_graphic() {
buy_sell_player = init_dialog(buy_sell_dialog, -1);
buy_player = init_dialog(buy_dialog, -1);
sell_player = init_dialog(sell_dialog, -1);
+ skill_list_player = init_dialog(skill_list_dialog, -1);
gui_bitmap = double_buffer;
alfont_text_mode(-1);
inventory.create(100, 100);
@@ -210,18 +224,28 @@ void do_graphic(void) {
//node->speed = 10000;
- //set_coordinates(node->coordinates, get_x(node->coordinates), get_y(node->coordinates), direction);*/
+ if(node->frame>=4) {
+ //alert("","","","","",0,0);
+ node->frame = 3;
+ }
+
+ //set_coordinates(node->coordinates, get_x(node->coordinates), get_y(node->coordinates), direction);*/
- node->text_x = (get_x(node->coordinates)-camera_x)*16-20+get_x_offset(node)-offset_x;
+ node->text_x = (get_x(node->coordinates)-camera_x)*16-22+get_x_offset(node)-offset_x;
node->text_y = (get_y(node->coordinates)-camera_y)*16-25+get_y_offset(node)-offset_y;
int r_x = node->text_x-get_x_offset(node);
int r_y = node->text_y-get_y_offset(node);
- if(node->action==MONSTER_DEAD)node->frame = 0;
- masked_blit((BITMAP *)graphic[MOBSET_BMP].dat, buffer, (get_direction(node->coordinates)/2)*60+240*(node->job-1002), 60*(node->frame+node->action), node->text_x, node->text_y, 60, 60);
- //rectfill(buffer, r_x, r_y, r_x+16, r_y+16, makecol(0,0,255));
- //alfont_textprintf(buffer, gui_font, node->text_x, node->text_y, MAKECOL_WHITE, "%i", node->frame);
+ //rectfill(buffer, node->text_x+22, node->text_y+25, node->text_x+16+22, node->text_y+16+25, makecol(0,0,255));
+
+ //if(node->action==MONSTER_DEAD)node->frame = 0;
+ if(node->action==MONSTER_DEAD)
+ masked_blit((BITMAP *)graphic[MOBSET_BMP].dat, buffer, (get_direction(node->coordinates)/2)*60+240*(node->job-1002), 60*MONSTER_DEAD, node->text_x, node->text_y, 60, 60);
+ else
+ masked_blit((BITMAP *)graphic[MOBSET_BMP].dat, buffer, (get_direction(node->coordinates)/2)*60+240*(node->job-1002), 60*(node->frame+node->action), node->text_x, node->text_y, 60, 60);
+
+ //alfont_textprintf(buffer, gui_font, node->text_x, node->text_y, MAKECOL_WHITE, "%i", node->id);
if(node->action!=STAND) {
node->frame = (get_elapsed_time(node->tick_time)*4)/(node->speed);
@@ -232,39 +256,59 @@ void do_graphic(void) {
node->path = node->path->next;
direction = 0;
//if(node->path->next) {
- if(node->path->x>old->x && node->path->y>old->y)direction = SE;
- else if(node->path->x<old->x && node->path->y>old->y)direction = SW;
- else if(node->path->x>old->x && node->path->y<old->y)direction = NE;
- else if(node->path->x<old->x && node->path->y<old->y)direction = NW;
- else if(node->path->x>old->x)direction = EAST;
- else if(node->path->x<old->x)direction = WEST;
- else if(node->path->y>old->y)direction = SOUTH;
- else if(node->path->y<old->y)direction = NORTH;
+ if(node->path->x>old->x && node->path->y>old->y)direction = SE;
+ else if(node->path->x<old->x && node->path->y>old->y)direction = SW;
+ else if(node->path->x>old->x && node->path->y<old->y)direction = NE;
+ else if(node->path->x<old->x && node->path->y<old->y)direction = NW;
+ else if(node->path->x>old->x)direction = EAST;
+ else if(node->path->x<old->x)direction = WEST;
+ else if(node->path->y>old->y)direction = SOUTH;
+ else if(node->path->y<old->y)direction = NORTH;
//}
set_coordinates(node->coordinates, node->path->x, node->path->y, direction);
+
+ //node->tick_time = tick_time;
- if(old!=NULL)
- free(old);
- } else node->action = STAND;
+ /*if(old!=NULL)
+ free(old);*/
+ } else {
+ node->action = STAND;
+ }
if(node->action!=MONSTER_DEAD)node->frame = 0;
node->tick_time = tick_time;
+ //node->frame = 0;
}
}
}
}
- old_node = node;
- node = node->next;
- if(old_node->action==MONSTER_DEAD && old_node->frame>=4)
- remove_node(old_node->id);
+
+ //old_node = node;
+ if(node->action==MONSTER_DEAD && node->frame>=20) {
+ NODE *temp = node;
+ node = node->next;
+ remove_node(temp->id);
+ } else node = node->next;
+ /*if(old_node->action==MONSTER_DEAD && old_node->frame>=4)
+ remove_node(old_node->id);*/
+
+ // nodes are ordered so if the next node y is > then the
+ // last drawed for fringe layer, draw the missing lines
}
+ // complete drawing fringe layer
+
for(int j=0;j<20;j++)
for(int i=0;i<26;i++) {
if(get_tile(i+camera_x, j+camera_y, 2)>0 && get_tile(i+camera_x, j+camera_y, 2)<600)draw_rle_sprite(buffer, (RLE_SPRITE *)tileset[get_tile(i+camera_x, j+camera_y, 2)].dat, i*16-offset_x, j*16-offset_y);
}
- stretch_blit(buffer, double_buffer, 0, 0, 400, 300, 0, 0, 800, 600);
+ if(stretch_mode==0)
+ stretch_blit(buffer, double_buffer, 0, 0, 400, 300, 0, 0, 800, 600);
+ else if(stretch_mode==1)
+ Super2xSaI(buffer, double_buffer, 0, 0, 0, 0, 400, 300);
+ else if(stretch_mode==2)
+ SuperEagle(buffer, double_buffer, 0, 0, 0, 0, 400, 300);
// Draw player speech
node = get_head();
@@ -366,6 +410,24 @@ void do_graphic(void) {
if(gui_update(skill_player)==0)show_skill_dialog = false;
}
+ if(show_skill_list_dialog) {
+ /*if(char_info->skill_point>0)skill_list_dialog[1].flags = 0;
+ else skill_list_dialog[1].flags |= D_DISABLED;*/
+ if(gui_update(skill_list_player)==0) {
+ int ret = shutdown_dialog(skill_list_player);
+ if(ret==1) {
+ if(char_info->skill_point>0) {
+ WFIFOW(0) = net_w_value(0x0112);
+ WFIFOW(2) = net_w_value(get_skill_id(skill_list_dialog[3].d1));
+ WFIFOSET(4);
+ }
+ } else if(ret==2) {
+ show_skill_list_dialog = false;
+ }
+ skill_list_player = init_dialog(skill_list_dialog, -1);
+ }
+ }
+
// character status display
update_stats_dialog();
gui_update(stats_player);
diff --git a/src/graphic/graphic.h b/src/graphic/graphic.h
index 2ba3cc74..bfbb106f 100644
--- a/src/graphic/graphic.h
+++ b/src/graphic/graphic.h
@@ -44,8 +44,9 @@
extern BITMAP *buffer, *double_buffer;
extern char speech[255];
extern char npc_text[1000];
+extern char skill_points[10];
extern Chat chatlog;
-extern bool show_skill_dialog;
+extern bool show_skill_dialog, show_skill_list_dialog;
extern int show_npc_dialog;
extern TmwInventory inventory;
extern int map_x, map_y, camera_x, camera_y;
diff --git a/src/graphic/super_eagle.h b/src/graphic/super_eagle.h
deleted file mode 100644
index 64c763db..00000000
--- a/src/graphic/super_eagle.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
-
- The Mana World
- Copyright 2004 The Mana World Development Team
-
- This file is part of The Mana World.
-
- The Mana World is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- any later version.
-
- The Mana World is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with The Mana World; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*/
-
-#ifdef WIN32
- #pragma warning (disable:4312)
-#endif
-
-#ifndef _SUPER_EAGLE_H
-#define _SUPER_EAGLE_H
-
-#include <string.h>
-#include <allegro.h>
-#include <allegro/internal/aintern.h>
-
-#define uint32 unsigned long
-#define uint16 unsigned short
-#define uint8 unsigned char
-
-void SuperEagle(BITMAP * src, BITMAP * dest, int s_x, int s_y, int d_x, int d_y, int w, int h);
-void SuperEagle_ex(uint8 *src, uint32 src_pitch, uint8 *unused, BITMAP *dest, uint32 width, uint32 height);
-
-int Init_SuperEagle(int d);
-
-#endif
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index d7bc805d..61ba61ab 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -75,8 +75,7 @@ void char_select() {
int gui_exit = 1;
while ((!key[KEY_ESC])&&(gui_exit)&&(!key[KEY_ENTER])) {
clear_bitmap(buffer);
- if(stretch_mode!=0)blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600);
- else blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, -120, -90, 640, 480);
+ blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600);
gui_exit = gui_update(player);
blit(buffer, screen, 0, 0, 0, 0, 800, 600);
}
@@ -163,8 +162,7 @@ void server_char_delete() {
int gui_exit = 1;
while ((!key[KEY_ESC])&&(gui_exit)) {
clear_bitmap(buffer);
- if(stretch_mode!=0)blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600);
- else blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, -120, -90, 640, 480);
+ blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, -120, -90, 640, 480);
gui_exit = gui_update(player);
blit(buffer, screen, 0, 0, 0, 0, 800, 600);
}
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index 63656f78..dd51e0f1 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -19,6 +19,8 @@
along with The Mana World; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ By ElvenProgrammer aka Eugenio Favalli (umperio@users.sourceforge.net)
+
*/
#include "char_server.h"
@@ -55,8 +57,7 @@ void char_server() {
if(n_server==0)char_server_dialog[2].flags |= D_DISABLED;
while ((!key[KEY_ESC])&&(gui_exit)&&(!key[KEY_ENTER])) {
clear_bitmap(buffer);
- if(stretch_mode!=0)blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600);
- else blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, -120, -90, 640, 480);
+ blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600);
gui_exit = gui_update(player);
blit(buffer, screen, 0, 0, 0, 0, 800, 600);
}
@@ -102,8 +103,8 @@ void server_char_server() {
char_info[i].max_hp = RFIFOW(24+106*i+44);
char_info[i].xp = RFIFOL(24+106*i+4);
char_info[i].gp = RFIFOL(24+106*i+8);
- char_info[i].job_xp = RFIFOL(24+106*i+16);
- char_info[i].job_lv = RFIFOL(24+106*i+24);
+ char_info[i].job_xp = RFIFOL(24+106*i+12);
+ char_info[i].job_lv = RFIFOL(24+106*i+16);
char_info[i].sp = RFIFOW(24+106*i+46);
char_info[i].max_sp = RFIFOW(24+106*i+48);
char_info[i].lv = RFIFOW(24+106*i+58);
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index f24266d4..e9227453 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -359,7 +359,7 @@ void loadDialogSkin() {
}
}
-void drawSkinnedRect(BITMAP*dst, LexSkinnedRect *skin, int x, int y,int w, int h) {
+void draw_skinned_rect(BITMAP*dst, LexSkinnedRect *skin, int x, int y,int w, int h) {
BITMAP **grid = skin->grid;
@@ -522,17 +522,17 @@ int tmw_button_proc(int msg, DIALOG *d, int c) {
rectfill(gui_bitmap, d->x, d->y, d->x + d->w, d->y+d->h, makecol(255,255,255));
if (d->flags & D_DISABLED) {
- drawSkinnedRect(gui_bitmap, &gui_skin.button.background[3], d->x, d->y, d->w, d->h);
+ draw_skinned_rect(gui_bitmap, &gui_skin.button.background[3], d->x, d->y, d->w, d->h);
col = gui_skin.button.textcolor[3];
} else if (d->flags & D_SELECTED) {
- drawSkinnedRect(gui_bitmap, &gui_skin.button.background[2], d->x, d->y, d->w, d->h);
+ draw_skinned_rect(gui_bitmap, &gui_skin.button.background[2], d->x, d->y, d->w, d->h);
col = gui_skin.button.textcolor[2];
ofs = 1;
} else if (d->flags & D_GOTMOUSE) {
- drawSkinnedRect(gui_bitmap, &gui_skin.button.background[1], d->x, d->y, d->w, d->h);
+ draw_skinned_rect(gui_bitmap, &gui_skin.button.background[1], d->x, d->y, d->w, d->h);
col = gui_skin.button.textcolor[1];
} else {
- drawSkinnedRect(gui_bitmap, &gui_skin.button.background[0], d->x, d->y, d->w, d->h);
+ draw_skinned_rect(gui_bitmap, &gui_skin.button.background[0], d->x, d->y, d->w, d->h);
col = gui_skin.button.textcolor[0];
}
rtm = alfont_text_mode(-1);
@@ -751,7 +751,7 @@ int tmw_edit_proc(int msg, DIALOG *d, int c) {
if (msg == MSG_DRAW) {
rectfill(gui_bitmap, d->x, d->y, d->x + d->w, d->y+d->h, d->bg);
- drawSkinnedRect(gui_bitmap, &gui_skin.textbox.bg, d->x, d->y, d->w, d->h);
+ draw_skinned_rect(gui_bitmap, &gui_skin.textbox.bg, d->x, d->y, d->w, d->h);
if (d->flags & D_DISABLED) {
col = gui_skin.textbox.textcolor[1];
@@ -822,7 +822,7 @@ int tmw_password_proc(int msg, DIALOG *d, int c) {
if (msg == MSG_DRAW) {
rectfill(gui_bitmap, d->x, d->y, d->x + d->w, d->y+d->h, d->bg);
- drawSkinnedRect(gui_bitmap, &gui_skin.textbox.bg, d->x, d->y, d->w, d->h);
+ draw_skinned_rect(gui_bitmap, &gui_skin.textbox.bg, d->x, d->y, d->w, d->h);
if (d->flags & D_DISABLED) {
col = gui_skin.textbox.textcolor[1];
@@ -884,173 +884,149 @@ int tmw_password_proc(int msg, DIALOG *d, int c) {
}
int tmw_list_proc(int msg, DIALOG *d, int c) {
-// BITMAP *box = NULL;
-
- static int ignoreRedraw = FALSE;
-
- int itemCount = 0;
- int firstItem = d->d2;
- int lastItem = 0;
- int selectedItem = d->d1;
- int x,y,delta;
- int a, col;
- int w, h = 0;
- int rtm = 0;
- int cl, cr, cb, ct;
- int th = alfont_text_height(gui_font);
-
- int vscroll = 0;
- int sliderh = 10;
- int slidery = 0;
-
+ static int ignoreRedraw = FALSE;
+ int itemCount = 0;
+ int firstItem = d->d2;
+ int lastItem = 0;
+ int selectedItem = d->d1;
+ int x,y,delta;
+ int a, col;
+ int w, h = 0;
+ int rtm = 0;
+ int cl, cr, cb, ct;
+ int th = alfont_text_height(gui_font);
+
+ int vscroll = 0;
+ int sliderh = 10;
+ int slidery = 0;
+
+ (*(getfuncptr)d->dp)(-1, &itemCount);
+ w = d->w - gui_skin.listbox.bg.grid[0]->w - gui_skin.listbox.bg.grid[2]->w;
+ h = d->h - gui_skin.listbox.bg.grid[1]->h - gui_skin.listbox.bg.grid[7]->h;
+ lastItem = MIN(itemCount-1, firstItem + h / alfont_text_height(gui_font));
+
+ if (msg == MSG_DRAW) {
+ if (ignoreRedraw) {
+ return D_O_K;
+ }
+ rectfill(gui_bitmap, d->x, d->y, d->x + d->w, d->y+d->h, d->bg);
+ draw_skinned_rect(gui_bitmap, &gui_skin.listbox.bg, d->x, d->y, d->w, d->h);
(*(getfuncptr)d->dp)(-1, &itemCount);
-
- w = d->w - gui_skin.listbox.bg.grid[0]->w - gui_skin.listbox.bg.grid[2]->w;
- h = d->h - gui_skin.listbox.bg.grid[1]->h - gui_skin.listbox.bg.grid[7]->h;
- lastItem = MIN(itemCount-1, firstItem + h / alfont_text_height(gui_font));
-
-
-
- if (msg == MSG_DRAW) {
- if (ignoreRedraw) {
- return D_O_K;
- }
- rectfill(gui_bitmap, d->x, d->y, d->x + d->w, d->y+d->h, d->bg);
- drawSkinnedRect(gui_bitmap, &gui_skin.listbox.bg, d->x, d->y, d->w, d->h);
-
- (*(getfuncptr)d->dp)(-1, &itemCount);
- vscroll = (h/th) < (itemCount-1);
- if (vscroll) {
- w = d->w - 17 - gui_skin.listbox.bg.grid[0]->w;
- drawSkinnedRect(gui_bitmap, &gui_skin.listbox.bg, d->x+d->w-15, d->y+1, 14, d->h-2);
- sliderh = MAX(((d->h-2)* (h / th)) / itemCount, gui_skin.listbox.bg.grid[0]->h*2);
- slidery = ((d->h-2-sliderh) * firstItem) / (itemCount);
- slidery+= d->y+1;
- drawSkinnedRect(gui_bitmap, &gui_skin.listbox.vscroll, d->x+d->w-13, slidery, 11, sliderh);
- }
-
- rtm = alfont_text_mode(-1);
- if (gui_bitmap->clip) {
- cl = gui_bitmap->cl;
- ct = gui_bitmap->ct;
- cr = gui_bitmap->cr;
- cb = gui_bitmap->cb;
- } else {
- cl=ct=0;
- cr=gui_bitmap->w;
- cb=gui_bitmap->h;
- }
- x = d->x + gui_skin.listbox.bg.grid[0]->w;
- y = d->y + gui_skin.listbox.bg.grid[0]->h;
- set_clip_rect(gui_bitmap, x,y, x+w, y+h);
-
-
- if (d->flags & D_DISABLED) {
- col = gui_skin.listbox.textcolor[3];
- for (a=firstItem; a < lastItem; a++) {
- alfont_textout_aa(gui_bitmap, gui_font, (*(getfuncptr)d->dp)(a, 0), x, y, col);
- y += alfont_text_height(gui_font);
- }
- } else {
- for (a=firstItem; a <= lastItem; a++) {
- if (a==d->d1) {
- col = gui_skin.listbox.textcolor[1];
- rectfill(gui_bitmap, x, y, x+w, y+alfont_text_height(gui_font)-1, gui_skin.listbox.textcolor[2]);
- } else {
- col = gui_skin.listbox.textcolor[0];
- }
- alfont_textout_aa(gui_bitmap, gui_font, (*(getfuncptr)d->dp)(a, 0), x, y, col);
- y += alfont_text_height(gui_font);
- }
- }
-
- alfont_text_mode(rtm);
- set_clip_rect(gui_bitmap, cl, ct, cr, cb);
-
- } else if (msg == MSG_CLICK) {
-
- x = d->x + gui_skin.listbox.bg.grid[0]->w;
- y = d->y + gui_skin.listbox.bg.grid[0]->h;
-
- sliderh = MAX(((d->h-2)* (h / th)) / itemCount, gui_skin.listbox.bg.grid[0]->h*2);
- //sliderh = ((d->h-2)* (h / th)) / itemCount;
- slidery = ((d->h-2-sliderh) * firstItem) / (itemCount);
- slidery+= d->y+1;
-
- if (mouse_x > (d->x + d->w - 14) && mouse_x < (d->x+d->w-1)) {
- // Ok, scroll bar
- if (mouse_y >= slidery && mouse_y < slidery + sliderh) {
- delta= mouse_y - slidery;
- while (mouse_b) {
- a = mouse_y - delta - d->y -1;
- a *= itemCount;
- a /= (d->h-2);
- a = MID(0, a, itemCount- h/th);
-
- if (a != d->d2) {
- d->d2 = a;
- scare_mouse();
- object_message(d, MSG_DRAW, 0);
- unscare_mouse();
- }
-
- slidery = ((d->h-2) * firstItem) / (itemCount);
- slidery+= d->y+1;
- }
- } else if (mouse_y < slidery) {
- a = d->d2 - (h/th)+1;
- a = MID(0, a, itemCount- h/th);
-
-
- d->d2 = a;
- scare_mouse();
- object_message(d, MSG_DRAW, 0);
- unscare_mouse();
-
- while (mouse_b) {
- }
- } else if (mouse_y > slidery + sliderh) {
- a = d->d2 + (h/th)-1;
- a = MID(0, a, itemCount- h/th);
- d->d2 = a;
-
- scare_mouse();
- object_message(d, MSG_DRAW, 0);
- unscare_mouse();
-
- while (mouse_b) {
- }
- }
- } else if (mouse_x >= x && mouse_x < x+w && mouse_y >= y && mouse_y < y+h) {
-
- while (mouse_b) {
- a = firstItem + (mouse_y-y) / alfont_text_height(gui_font);
-
- if (a <= lastItem && a != selectedItem) {
- d->d1 = selectedItem = a;
- scare_mouse();
- object_message(d, MSG_DRAW, 0);
- unscare_mouse();
- }
- }
- }
- } else {
- ignoreRedraw = (msg == MSG_GOTFOCUS || msg == MSG_LOSTFOCUS);
- a = d_list_proc(msg, d, c);
-
- if (a == D_USED_CHAR) {
- if (d->d1 < d->d2) {
- if (d->d1 > 0) {
- d->d1 = d->d2;
- }
- } else if (d->d1 > d->d2 + h/th -1) {
- d->d2 = d->d1 - h/th + 1;
- }
- }
-
- return a;
+ vscroll = (h/th) < (itemCount-1);
+ if (vscroll) {
+ w = d->w - 17 - gui_skin.listbox.bg.grid[0]->w;
+ draw_skinned_rect(gui_bitmap, &gui_skin.listbox.bg, d->x+d->w-15, d->y+1, 14, d->h-2);
+ sliderh = MAX(((d->h-2)* (h / th)) / itemCount, gui_skin.listbox.bg.grid[0]->h*2);
+ slidery = ((d->h-2-sliderh) * firstItem) / (itemCount);
+ slidery+= d->y+1;
+ draw_skinned_rect(gui_bitmap, &gui_skin.listbox.vscroll, d->x+d->w-13, slidery, 11, sliderh);
}
- return D_O_K;
+
+ rtm = alfont_text_mode(-1);
+ if (gui_bitmap->clip) {
+ cl = gui_bitmap->cl;
+ ct = gui_bitmap->ct;
+ cr = gui_bitmap->cr;
+ cb = gui_bitmap->cb;
+ } else {
+ cl=ct=0;
+ cr=gui_bitmap->w;
+ cb=gui_bitmap->h;
+ }
+ x = d->x + gui_skin.listbox.bg.grid[0]->w;
+ y = d->y + gui_skin.listbox.bg.grid[0]->h;
+ set_clip_rect(gui_bitmap, x,y, x+w, y+h);
+ if (d->flags & D_DISABLED) {
+ col = gui_skin.listbox.textcolor[3];
+ for (a=firstItem; a < lastItem; a++) {
+ alfont_textout_aa(gui_bitmap, gui_font, (*(getfuncptr)d->dp)(a, 0), x, y, col);
+ y += alfont_text_height(gui_font);
+ }
+ } else {
+ for (a=firstItem; a <= lastItem; a++) {
+ if (a==d->d1) {
+ col = gui_skin.listbox.textcolor[1];
+ rectfill(gui_bitmap, x, y, x+w, y+alfont_text_height(gui_font)-1, gui_skin.listbox.textcolor[2]);
+ } else {
+ col = gui_skin.listbox.textcolor[0];
+ }
+ alfont_textout_aa(gui_bitmap, gui_font, (*(getfuncptr)d->dp)(a, 0), x, y, col);
+ y += alfont_text_height(gui_font);
+ }
+ }
+ alfont_text_mode(rtm);
+ set_clip_rect(gui_bitmap, cl, ct, cr, cb);
+ } else if (msg == MSG_CLICK) {
+ x = d->x + gui_skin.listbox.bg.grid[0]->w;
+ y = d->y + gui_skin.listbox.bg.grid[0]->h;
+ sliderh = MAX(((d->h-2)* (h / th)) / itemCount, gui_skin.listbox.bg.grid[0]->h*2);
+ //sliderh = ((d->h-2)* (h / th)) / itemCount;
+ slidery = ((d->h-2-sliderh) * firstItem) / (itemCount);
+ slidery+= d->y+1;
+ if (mouse_x > (d->x + d->w - 14) && mouse_x < (d->x+d->w-1)) {
+ // Ok, scroll bar
+ if (mouse_y >= slidery && mouse_y < slidery + sliderh) {
+ delta= mouse_y - slidery;
+ while (mouse_b) {
+ a = mouse_y - delta - d->y -1;
+ a *= itemCount;
+ a /= (d->h-2);
+ a = MID(0, a, itemCount- h/th);
+ if (a != d->d2) {
+ d->d2 = a;
+ scare_mouse();
+ object_message(d, MSG_DRAW, 0);
+ unscare_mouse();
+ }
+ slidery = ((d->h-2) * firstItem) / (itemCount);
+ slidery+= d->y+1;
+ }
+ } else if (mouse_y < slidery) {
+ a = d->d2 - (h/th)+1;
+ a = MID(0, a, itemCount- h/th);
+
+ d->d2 = a;
+ scare_mouse();
+ object_message(d, MSG_DRAW, 0);
+ unscare_mouse();
+ while (mouse_b) {
+ }
+ } else if (mouse_y > slidery + sliderh) {
+ a = d->d2 + (h/th)-1;
+ a = MID(0, a, itemCount- h/th);
+ d->d2 = a;
+ scare_mouse();
+ object_message(d, MSG_DRAW, 0);
+ unscare_mouse();
+ while (mouse_b) {
+ }
+ }
+ } else if (mouse_x >= x && mouse_x < x+w && mouse_y >= y && mouse_y < y+h) {
+ while (mouse_b) {
+ a = firstItem + (mouse_y-y) / alfont_text_height(gui_font);
+ if (a <= lastItem && a != selectedItem) {
+ d->d1 = selectedItem = a;
+ scare_mouse();
+ object_message(d, MSG_DRAW, 0);
+ unscare_mouse();
+ }
+ }
+ }
+ } else {
+ ignoreRedraw = (msg == MSG_GOTFOCUS || msg == MSG_LOSTFOCUS);
+ a = d_list_proc(msg, d, c);
+ if (a == D_USED_CHAR) {
+ if (d->d1 < d->d2) {
+ if (d->d1 > 0) {
+ d->d1 = d->d2;
+ }
+ } else if (d->d1 > d->d2 + h/th -1) {
+ d->d2 = d->d1 - h/th + 1;
+ }
+ }
+ return a;
+ }
+ return D_O_K;
}
int tmw_plus_proc(int msg, DIALOG *d, int c)
{
@@ -1105,53 +1081,53 @@ else
return D_O_K;
}
-/**
- dialog box w/ left centered head
-*/
+/* Dialog box with left centered head */
int tmw_dialog_proc(int msg, DIALOG *d, int c) {
- int rtm;
+ int rtm;
int x, y;
- if (msg == MSG_CLICK) {
- if(mouse_y < d->y + gui_skin.dialog.bg.grid[1]->h) {
- //drag = true;
- d->d1 = mouse_x - d->x;
- d->d2 = mouse_y - d->y;
- }
- } else if (msg == MSG_DRAW) {
- if((mouse_b & 1)&&(d->d1>=0)&&(d->d2>=0)) {//(drag==true)) {
- x = mouse_x-d->d1;
- y = mouse_y-d->d2;
- if(x<15) {
- x=0;
- position_mouse(d->d1, mouse_y);
- }
- if(y<15) {
- y=0;
- position_mouse(mouse_x, d->d2);
- }
- if(x+d->w>=785) {
- x=800-d->w;
- position_mouse(x+d->d1, mouse_y);
+ switch(msg) {
+
+ case MSG_CLICK:
+ if(mouse_y<d->y+gui_skin.dialog.bg.grid[1]->h) {
+ d->d1 = mouse_x - d->x;
+ d->d2 = mouse_y - d->y;
}
- if(y+d->h>=585) {
- y=600-d->h;
- position_mouse(mouse_x, y+d->d2);
+ break;
+ case MSG_DRAW:
+ if((mouse_b & 1)&&(d->d1>=0)&&(d->d2>=0)) {
+ x = mouse_x-d->d1;
+ y = mouse_y-d->d2;
+ if(x<15) {
+ x=0;
+ position_mouse(d->d1, mouse_y);
+ }
+ if(y<15) {
+ y=0;
+ position_mouse(mouse_x, d->d2);
+ }
+ if(x+d->w>=SCREEN_W-15) {
+ x=SCREEN_W-d->w;
+ position_mouse(x+d->d1, mouse_y);
+ }
+ if(y+d->h>=SCREEN_H-15) {
+ y=SCREEN_H-d->h;
+ position_mouse(mouse_x, y+d->d2);
+ }
+ position_dialog(d, x, y);
+ } else {
+ d->d1 = -1;
+ d->d2 = -1;
}
- position_dialog(active_dialog, x, y);
- } else {
- //drag = false;
- d->d1 = -1;
- d->d2 = -1;
- }
- drawSkinnedRect(gui_bitmap, &gui_skin.dialog.bg, d->x, d->y, d->w, d->h);
- rtm = alfont_text_mode(-1);
- alfont_textprintf_centre_aa(gui_bitmap, gui_font,
- d->x + d->w/2,
- d->y + (gui_skin.dialog.bg.grid[1]->h - alfont_text_height(gui_font))/2, d->fg, "%s", d->dp);
- alfont_text_mode(rtm);
- }
- return D_O_K;
+ draw_skinned_rect(gui_bitmap, &gui_skin.dialog.bg, d->x, d->y, d->w, d->h);
+ rtm = alfont_text_mode(-1);
+ alfont_textprintf_centre_aa(gui_bitmap, gui_font,
+ d->x + d->w/2,
+ d->y + (gui_skin.dialog.bg.grid[1]->h - alfont_text_height(gui_font))/2, d->fg, "%s", d->dp);
+ alfont_text_mode(rtm);
+ break;
+ }
+ return D_O_K;
}
@@ -1194,7 +1170,7 @@ int tmw_ldialog_proc(int msg, DIALOG *d, int c) {
d->d1 = -1;
d->d2 = -1;
}
- drawSkinnedRect(gui_bitmap, &gui_skin.dialog.bg, d->x, d->y, d->w, d->h);
+ draw_skinned_rect(gui_bitmap, &gui_skin.dialog.bg, d->x, d->y, d->w, d->h);
rtm = alfont_text_mode(-1);
alfont_textprintf_aa(gui_bitmap, gui_font, d->x + 4, d->y + (gui_skin.dialog.bg.grid[1]->h - alfont_text_height(gui_font))/2, d->fg, "%s", d->dp);
alfont_text_mode(rtm);
@@ -1225,9 +1201,9 @@ void _gui_draw_scrollable_frame(DIALOG *d, int listsize, int offset, int height,
len = (((d->h-5) * offset) + listsize/2) / listsize;
} else len = 0;
if (yy+i < d->y+d->h-3) {
- drawSkinnedRect(gui_bitmap, &gui_skin.listbox.vscroll, xx, yy+len, 10, i);
+ draw_skinned_rect(gui_bitmap, &gui_skin.listbox.vscroll, xx, yy+len, 10, i);
} else {
- drawSkinnedRect(gui_bitmap, &gui_skin.listbox.vscroll, xx, yy, 10, d->h-3);
+ draw_skinned_rect(gui_bitmap, &gui_skin.listbox.vscroll, xx, yy, 10, d->h-3);
}
}
@@ -1466,14 +1442,10 @@ int tmw_textbox_proc(int msg, DIALOG *d, int c) {
/* figure out if it's on the text or the scrollbar */
bar = (d->d1 > height);
- if ((!bar) || (gui_mouse_x() < d->x+d->w-13)) {
- /* clicked on the text area */
- ret = D_O_K;
- }
- else {
- /* clicked on the scroll area */
- _handle_scrollable_scroll_click(d, d->d1, &d->d2, height);
- }
+ if ((!bar) || (gui_mouse_x() < d->x+d->w-13)) /* clicked on the text area */
+ ret = D_O_K;
+ else /* clicked on the scroll area */
+ //_handle_scrollable_scroll_click(d, d->d1, &d->d2, height);
break;
case MSG_CHAR:
@@ -1555,7 +1527,7 @@ int tmw_textbox_proc(int msg, DIALOG *d, int c) {
int tmw_bitmap_proc(int msg, DIALOG *d, int c) {
if(msg==MSG_DRAW) {
- drawSkinnedRect(gui_bitmap, &gui_skin.textbox.bg, d->x, d->y, d->w, d->h);
+ draw_skinned_rect(gui_bitmap, &gui_skin.textbox.bg, d->x, d->y, d->w, d->h);
if(d->dp!=NULL)
masked_blit(((BITMAP *)d->dp), gui_bitmap, 0, 0, d->x+(d->w-d->d1)/2, d->y+2, d->d1, d->d2);
}
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index a4fa3592..39a41d27 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -51,10 +51,8 @@ DIALOG login_dialog[] = {
int gui_exit = 1;
while ((!key[KEY_ESC])&&(gui_exit)&&(state!=EXIT)&&(!key[KEY_ENTER])) {
clear_bitmap(buffer);
- if(stretch_mode!=0)blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600);
- else blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, -120, -90, 640, 480);
-
- gui_exit = gui_update(player);
+ blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600);
+ gui_exit = gui_update(player);
blit(buffer, screen, 0, 0, 0, 0, 800, 600);
}
state = EXIT;
diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp
index 70e984d6..e929f434 100644
--- a/src/gui/shop.cpp
+++ b/src/gui/shop.cpp
@@ -120,6 +120,7 @@ int get_item_quantity(int index) {
}
return item_shop->quantity;
}
+
int get_item_index(int index) {
int iterator = 0;
ITEM_SHOP *item_shop = shop;
@@ -129,6 +130,7 @@ int get_item_index(int index) {
}
return item_shop->index;
}
+
int get_item_price(int index) {
int iterator = 0;
ITEM_SHOP *item_shop = shop;
@@ -138,9 +140,8 @@ int get_item_price(int index) {
}
return item_shop->price;
}
-void changeQ(void *dp3, int d2)
-{
-sprintf(itemCurrenyQ,"%i",d2);
-printf("%s\n",itemCurrenyQ);
-}
+void changeQ(void *dp3, int d2) {
+ sprintf(itemCurrenyQ,"%i",d2);
+ printf("%s\n",itemCurrenyQ);
+}
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index f6c7e041..45095902 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -27,6 +27,9 @@
extern PLAYER_INFO *char_info;
+int n_skills = 0;
+SKILL *skill_head = NULL;
+
char str_string[8];
char agi_string[8];
char vit_string[8];
@@ -34,21 +37,46 @@ char int_string[8];
char dex_string[8];
char luk_string[8];
+char *skill_db[] = {
+ // 0-99
+ "", "Basic", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ // 100-199
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "First aid", "Play as dead", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+};
+
DIALOG skill_dialog[] = {
/* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */
{ tmw_dialog_proc, 300, 200, 150, 60, 0, 0, 0, 0, 0, 0, (char *)"Skill", NULL, NULL },
{ tmw_text_proc, 304, 224, 252, 100, 0, 0, 0, 0, 0, 0, str_string, NULL, NULL },
- { tmw_plus_proc, 354, 224, 16, 16, 0, 0, '0', 0, 0, 1, (void*)increaseStatus,NULL, NULL },
+ { tmw_plus_proc, 354, 224, 16, 16, 0, 0, '0', 0, 0, 1, (void*)increaseStatus,NULL, NULL },
{ tmw_text_proc, 304, 234, 252, 100, 0, 0, 0, 0, 0, 0, agi_string, NULL, NULL },
- { tmw_plus_proc, 354, 234, 16, 16, 0, 0, '0', 0, 1, 1, (void*)increaseStatus,NULL, NULL },
+ { tmw_plus_proc, 354, 234, 16, 16, 0, 0, '0', 0, 1, 1, (void*)increaseStatus,NULL, NULL },
{ tmw_text_proc, 304, 244, 252, 100, 0, 0, 0, 0, 0, 0, vit_string, NULL, NULL },
- { tmw_plus_proc, 354, 244, 16, 16, 0, 0, '0', 0, 2, 1, (void*)increaseStatus,NULL, NULL },
+ { tmw_plus_proc, 354, 244, 16, 16, 0, 0, '0', 0, 2, 1, (void*)increaseStatus,NULL, NULL },
{ tmw_text_proc, 374, 224, 252, 100, 0, 0, 0, 0, 0, 0, int_string, NULL, NULL },
- { tmw_plus_proc, 424, 224, 16, 16, 0, 0, '0', 0, 3, 1, (void*)increaseStatus,NULL, NULL },
+ { tmw_plus_proc, 424, 224, 16, 16, 0, 0, '0', 0, 3, 1, (void*)increaseStatus,NULL, NULL },
{ tmw_text_proc, 374, 234, 252, 100, 0, 0, 0, 0, 0, 0, dex_string, NULL, NULL },
- { tmw_plus_proc, 424, 234, 16, 16, 0, 0, '0', 0, 4, 1, (void*)increaseStatus,NULL, NULL },
+ { tmw_plus_proc, 424, 234, 16, 16, 0, 0, '0', 0, 4, 1, (void*)increaseStatus,NULL, NULL },
{ tmw_text_proc, 374, 244, 252, 100, 0, 0, 0, 0, 0, 0, luk_string, NULL, NULL },
- { tmw_plus_proc, 424, 244, 16, 16, 0, 0, '0', 0, 5, 1, (void*)increaseStatus,NULL, NULL },
+ { tmw_plus_proc, 424, 244, 16, 16, 0, 0, '0', 0, 5, 1, (void*)increaseStatus,NULL, NULL },
{ NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }
};
@@ -70,11 +98,62 @@ void update_skill_dialog() {
}
}
-void increaseStatus(void *dp3, int d1)
-{
+void add_skill(short id, short lv, short sp) {
+ SKILL *skill = skill_head;
+ SKILL *temp = (SKILL *)malloc(sizeof(SKILL));
+ temp->id = id;
+ temp->lv = lv;
+ temp->sp = sp;
+ temp->next = NULL;
+ if(!skill_head)
+ skill_head = temp;
+ else {
+ while(skill->next)
+ skill = skill->next;
+ skill->next = temp;
+ }
+}
+
+char *skill_list(int index, int *list_size) {
+ if(index<0) {
+ *list_size = n_skills;
+ return NULL;
+ } else {
+ int iterator = 0;
+ SKILL *temp = skill_head;
+ while(iterator<index) {
+ temp = temp->next;
+ iterator++;
+ }
+ char *name = (char *)malloc(30);
+ sprintf(name, "%s lv:%i %i SP", skill_db[temp->id], temp->lv, temp->sp);
+ return name;
+ // need to clean allocated memory
+ }
+}
+
+int get_skill_id(int index) {
+ int iterator = 0;
+ SKILL *temp = skill_head;
+ while(iterator<index) {
+ temp = temp->next;
+ iterator++;
+ }
+ return temp->id;
+}
+
+SKILL *is_skill(int id) {
+ SKILL *temp = skill_head;
+ while(temp) {
+ if(temp->id==id)return temp;
+ temp = temp->next;
+ }
+ return NULL;
+}
+
+void increaseStatus(void *dp3, int d1) {
WFIFOW(0) = net_w_value(0x00bb);
- switch(d1)
- {
+ switch(d1) {
case 0:
WFIFOW(2) = net_w_value(0x000d);
break;
@@ -83,19 +162,19 @@ void increaseStatus(void *dp3, int d1)
break;
case 2:
WFIFOW(2) = net_w_value(0x000f);
- break;
+ break;
case 3:
WFIFOW(2) = net_w_value(0x0010);
- break;
+ break;
case 4:
WFIFOW(2) = net_w_value(0x0011);
- break;
+ break;
case 5:
WFIFOW(2) = net_w_value(0x0012);
- break;
+ break;
}
WFIFOW(4) = net_b_value(1);
WFIFOSET(5);
while((out_size>0))flush();
skill_dialog[2].d2 = skill_dialog[4].d2 = skill_dialog[6].d2 =skill_dialog[8].d2 =skill_dialog[10].d2 = 0;
-} \ No newline at end of file
+}
diff --git a/src/gui/skill.h b/src/gui/skill.h
index 601f9ef5..6ba70ec1 100644
--- a/src/gui/skill.h
+++ b/src/gui/skill.h
@@ -35,6 +35,18 @@
//DIALOG skill_dialog[];
+extern int n_skills;
+
+struct SKILL {
+ short id, lv, sp;
+ SKILL *next;
+};
+
+
void update_skill_dialog();
+void add_skill(short id, short lv, short sp);
+char *skill_list(int index, int *list_size);
+int get_skill_id(int index);
+SKILL *is_skill(int id);
void increaseStatus(void *dp3, int d1);
#endif
diff --git a/src/gui/stats.cpp b/src/gui/stats.cpp
index a6af4ac5..5e6c91a0 100644
--- a/src/gui/stats.cpp
+++ b/src/gui/stats.cpp
@@ -30,12 +30,12 @@ char stats_gp[24];
DIALOG stats_dialog[] = {
/* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */
- { tmw_ldialog_proc, 493, 0, 300, 55, 0, 0, 0, 0, 0, 0, stats_name, NULL, NULL },
- { tmw_text_proc, 497, 34, 296, 100, 0, 0, 0, 0, 0, 0, stats_hp, NULL, NULL },
- { tmw_bar_proc, 507, 22, 60, 18, 0, 0, '1', 0, 1, 1, NULL, NULL, NULL },
- { tmw_text_proc, 707, 34, 296, 100, 0, 0, 0, 0, 0, 0, stats_gp, NULL, NULL },
- { tmw_text_proc, 607, 34, 296, 100, 0, 0, 0, 0, 0, 0, stats_sp, NULL, NULL },
- { tmw_bar_proc, 617, 22, 60, 18, 0, 0, '1', 0, 1, 1, NULL, NULL, NULL },
+ { tmw_dialog_proc, 493-10, 0+10, 300, 55, 0, 0, 0, 0, 0, 0, stats_name, NULL, NULL },
+ { tmw_text_proc, 497-10, 34+10, 296, 100, 0, 0, 0, 0, 0, 0, stats_hp, NULL, NULL },
+ { tmw_bar_proc, 507-10, 22+10, 60, 18, 0, 0, '1', 0, 1, 1, NULL, NULL, NULL },
+ { tmw_text_proc, 707-10, 34+10, 296, 100, 0, 0, 0, 0, 0, 0, stats_gp, NULL, NULL },
+ { tmw_text_proc, 607-10, 34+10, 296, 100, 0, 0, 0, 0, 0, 0, stats_sp, NULL, NULL },
+ { tmw_bar_proc, 617-10, 22+10, 60, 18, 0, 0, '1', 0, 1, 1, NULL, NULL, NULL },
{ NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }
};
diff --git a/src/main.cpp b/src/main.cpp
index 6d3cfbf3..abc67679 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -24,6 +24,7 @@
#include "main.h"
#include "./sound/sound.h"
#include "./graphic/graphic.h"
+#include "./graphic/2xsai.h"
#include <iostream>
@@ -62,21 +63,16 @@ void init_engine() {
set_config_file("tmw.ini");
#ifdef MACOSX
set_color_depth(32);
- Init_SuperEagle(32);
+ Init_2xSaI(32);
#else
set_color_depth(16);
- Init_SuperEagle(16);
+ Init_2xSaI(16);
#endif
stretch_mode = get_config_int("settings", "stretch", 0);
set_window_title("The Mana World");
- if(stretch_mode==0) {
- if(set_gfx_mode(get_config_int("settings", "screen", 0), 400, 300, 0, 0))
- error(allegro_error);
- } else {
- if(set_gfx_mode(get_config_int("settings", "screen", 0), 800, 600, 0, 0))
- error(allegro_error);
- }
- if(install_keyboard())
+ if(set_gfx_mode(get_config_int("settings", "screen", 0), 800, 600, 0, 0))
+ error(allegro_error);
+ if(install_keyboard())
error("Unable to install keyboard");
if(install_timer())
error("Unable to install timer");
diff --git a/src/main.h b/src/main.h
index 27b31040..86faa736 100644
--- a/src/main.h
+++ b/src/main.h
@@ -64,7 +64,7 @@ typedef struct {
char name[24];
short hp, max_hp, sp, max_sp, lv;
int xp, gp, job_xp, job_lv;
- short statp, skillp;
+ short statp, skill_point;
char STR, AGI, VIT, INT, DEX, LUK;
} PLAYER_INFO;