Revision: 6583
http://daimonin.svn.sourceforge.net/daimonin/?rev=6583&view=rev
Author: smacky
Date: 2011-12-23 11:11:28 +0000 (Fri, 23 Dec 2011)
Log Message:
-----------
Rewrite textwin module.
Modified Paths:
--------------
trunk/client/settings/skin.def
trunk/client/src/book.c
trunk/client/src/buddy.c
trunk/client/src/chatfilter.c
trunk/client/src/client_cmd.c
trunk/client/src/commands.c
trunk/client/src/dialog.c
trunk/client/src/event.c
trunk/client/src/ignore.c
trunk/client/src/include/commands.h
trunk/client/src/include/main.h
trunk/client/src/include/skin.h
trunk/client/src/include/textwin.h
trunk/client/src/interface.c
trunk/client/src/item.c
trunk/client/src/kerbholz.c
trunk/client/src/main.c
trunk/client/src/map.c
trunk/client/src/menu.c
trunk/client/src/misc.c
trunk/client/src/player.c
trunk/client/src/skin.c
trunk/client/src/sound.c
trunk/client/src/sprite.c
trunk/client/src/textwin.c
trunk/client/src/widget.c
trunk/client/src/wrapper.c
Added Paths:
-----------
trunk/client/bitmaps/alpha.png
Removed Paths:
-------------
trunk/client/bitmaps/textwin.png
trunk/client/bitmaps/textwin_mask.png
Added: trunk/client/bitmaps/alpha.png
===================================================================
(Binary files differ)
Property changes on: trunk/client/bitmaps/alpha.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Deleted: trunk/client/bitmaps/textwin.png
===================================================================
(Binary files differ)
Deleted: trunk/client/bitmaps/textwin_mask.png
===================================================================
(Binary files differ)
Modified: trunk/client/settings/skin.def
===================================================================
--- trunk/client/settings/skin.def 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/settings/skin.def 2011-12-23 11:11:28 UTC (rev 6583)
@@ -17,6 +17,9 @@
# 'chat_buddy' is for any chat sent by a player on your buddy list.
chat_buddy: 0xcc66ff
+# 'chat_channel' is for channel chat between players.
+chat_channel: 0xddffdd
+
# 'chat_eavesdrop' is for a GM/SA who is listening in on someone elses tells.
chat_eavesdrop: 0xff9999
Modified: trunk/client/src/book.c
===================================================================
--- trunk/client/src/book.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/book.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -287,7 +287,7 @@
if (!book_line)
{
- textwin_showstring(0, NDI_COLR_RED, "~%s~\nERROR in book cmd!", data);
+ textwin_show_string(0, NDI_COLR_RED, "~%s~\nERROR in book cmd!", data);
return NULL;
}
@@ -365,7 +365,7 @@
if (c == '>') /* should never happens */
{
- textwin_showstring(0, NDI_COLR_RED, "~%s~\nERROR in book cmd!", data);
+ textwin_show_string(0, NDI_COLR_RED, "~%s~\nERROR in book cmd!", data);
return NULL;
}
Modified: trunk/client/src/buddy.c
===================================================================
--- trunk/client/src/buddy.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/buddy.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -71,14 +71,14 @@
struct buddy_list *node;
int i=0;
- textwin_showstring(0, NDI_COLR_WHITE, "\nBUDDY LIST");
- textwin_showstring(0, NDI_COLR_WHITE, "--------------------------");
+ textwin_show_string(0, NDI_COLR_WHITE, "\nBUDDY LIST");
+ textwin_show_string(0, NDI_COLR_WHITE, "--------------------------");
for(node = buddy_list_start;node;i++, node = node->next)
{
- textwin_showstring(0, NDI_COLR_WHITE, "%s", node->name);
+ textwin_show_string(0, NDI_COLR_WHITE, "%s", node->name);
}
- textwin_showstring(0, NDI_COLR_WHITE, "\n%d name(s) on your list.", i);
+ textwin_show_string(0, NDI_COLR_WHITE, "\n%d name(s) on your list.", i);
}
/* clear the list, free all memory */
@@ -160,7 +160,7 @@
for(node = buddy_list_start;node;node = node->next)
{
- /*textwin_showstring(0, NDI_COLR_WHITE, "compare >%s< with >%s<", name, node->name);*/
+ /*textwin_show_string(0, NDI_COLR_WHITE, "compare >%s< with >%s<", name, node->name);*/
if(!stricmp(name, node->name))
return 1;
}
@@ -193,12 +193,12 @@
if(buddy_check(cmd) )
{
buddy_entry_remove(cmd);
- textwin_showstring(0, NDI_COLR_WHITE, "removed %s from buddy list.", cmd);
+ textwin_show_string(0, NDI_COLR_WHITE, "removed %s from buddy list.", cmd);
}
else
{
buddy_entry_add(cmd);
- textwin_showstring(0, NDI_COLR_WHITE, "added %s to buddy list.", cmd);
+ textwin_show_string(0, NDI_COLR_WHITE, "added %s to buddy list.", cmd);
}
buddy_list_save();
Modified: trunk/client/src/chatfilter.c
===================================================================
--- trunk/client/src/chatfilter.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/chatfilter.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -78,13 +78,13 @@
struct chatfilter_list *node;
int i=0;
- textwin_showstring(0, NDI_COLR_WHITE, "\nCHATFILTER LIST");
- textwin_showstring(0, NDI_COLR_WHITE, "--------------------------");
+ textwin_show_string(0, NDI_COLR_WHITE, "\nCHATFILTER LIST");
+ textwin_show_string(0, NDI_COLR_WHITE, "--------------------------");
for (node = chatfilter_list_start;node;i++, node = node->next)
{
- textwin_showstring(0, NDI_COLR_WHITE, "%s", node->word);
+ textwin_show_string(0, NDI_COLR_WHITE, "%s", node->word);
}
- textwin_showstring(0, NDI_COLR_WHITE, "\n%d word(s) ignored\nHELP: see '/cfilter ?'",
+ textwin_show_string(0, NDI_COLR_WHITE, "\n%d word(s) ignored\nHELP: see '/cfilter ?'",
i);
}
@@ -227,19 +227,19 @@
chatfilter_list_show();
else if (cmd[0]=='+')
{
- options.chatfilter=1;
- textwin_showstring(0, NDI_COLR_WHITE, "Chatfilter enabled.");
+ options.textwin_use_chatfilter = 1;
+ textwin_show_string(0, NDI_COLR_WHITE, "Chatfilter enabled.");
save_options_dat();
}
else if (cmd[0]=='-')
{
- options.chatfilter=0;
- textwin_showstring(0, NDI_COLR_WHITE, "Chatfilter disabled.");
+ options.textwin_use_chatfilter = 0;
+ textwin_show_string(0, NDI_COLR_WHITE, "Chatfilter disabled.");
save_options_dat();
}
else if (cmd[0]=='?')
{
- textwin_showstring(0, NDI_COLR_WHITE,
+ textwin_show_string(0, NDI_COLR_WHITE,
"HELP:\n"\
"'/cfilter' - shows list of filtered words.\n"\
"'/cfilter <word>' - adds word to list, or if its on list remove it from list.\n"\
@@ -249,7 +249,7 @@
else if ((cmd[0]=='!') && (cmd[1]!=0))
{
replacechar=cmd[1];
- textwin_showstring(0, NDI_COLR_WHITE,"Replacement character changed to '%c'.",replacechar);
+ textwin_show_string(0, NDI_COLR_WHITE,"Replacement character changed to '%c'.",replacechar);
chatfilter_list_save();
}
else
@@ -264,12 +264,12 @@
if (chatfilter_check(cmd))
{
chatfilter_entry_remove(cmd);
- textwin_showstring(0, NDI_COLR_WHITE, "Removed >%s< from chatfilter list.", cmd);
+ textwin_show_string(0, NDI_COLR_WHITE, "Removed >%s< from chatfilter list.", cmd);
}
else
{
chatfilter_entry_add(cmd);
- textwin_showstring(0, NDI_COLR_WHITE, "Added >%s< to chatfilter list.", cmd);
+ textwin_show_string(0, NDI_COLR_WHITE, "Added >%s< to chatfilter list.", cmd);
}
chatfilter_list_save();
}
Modified: trunk/client/src/client_cmd.c
===================================================================
--- trunk/client/src/client_cmd.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/client_cmd.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -377,7 +377,7 @@
*(topic + c) = tolower(*(topic + c));
}
- textwin_showstring(0, NDI_COLR_OLIVE, "Topic: %s", topic);
+ textwin_show_string(0, NDI_COLR_OLIVE, "Topic: %s", topic);
START(&sl, NULL, CLIENT_CMD_GUITALK, SEND_CMD_FLAG_DYNAMIC);
ADDUINT8(&sl, mode);
ADDBUFFER(&sl, topic, len, 0);
@@ -598,15 +598,15 @@
{
// if (*params)
// {
-// textwin_showstring(0, NDI_COLR_OLIVE, "%s %s", cmd, params);
+// textwin_show_string(0, NDI_COLR_OLIVE, "%s %s", cmd, params);
// }
- textwin_showstring(0, NDI_COLR_WHITE, "No %sitem could be found!",
+ textwin_show_string(0, NDI_COLR_WHITE, "No %sitem could be found!",
(*params) ? "such " : "");
}
else
{
- textwin_showstring(0, NDI_COLR_OLIVE, "%s %s", cmd, obj->s_name);
+ textwin_show_string(0, NDI_COLR_OLIVE, "%s %s", cmd, obj->s_name);
client_cmd_apply(tag);
}
@@ -622,12 +622,12 @@
{
// if (!*params)
// {
-// textwin_showstring(0, NDI_COLR_WHITE, "usage: /reply <message>");
+// textwin_show_string(0, NDI_COLR_WHITE, "usage: /reply <message>");
// }
if (!cpl.player_reply[0])
{
- textwin_showstring(0, NDI_COLR_WHITE, "There is no one to whom you can /reply!");
+ textwin_show_string(0, NDI_COLR_WHITE, "There is no one to whom you can /reply!");
return 1;
}
@@ -738,7 +738,7 @@
}
else if (!strcmp(cmd, "/imagestats"))
{
- textwin_showstring(0, NDI_COLR_WHITE,
+ textwin_show_string(0, NDI_COLR_WHITE,
"IMAGE-LOADING-STATISTICS\n"\
"==========================================\n"\
"Sprites in Memory: %d\n"\
@@ -790,7 +790,7 @@
// if (!*params)
// {
-// textwin_showstring(0, NDI_COLR_WHITE, "usage: /ready_spell <spell name>");
+// textwin_show_string(0, NDI_COLR_WHITE, "usage: /ready_spell <spell name>");
// }
for (i = 0; i < SPELL_LIST_MAX; i++)
@@ -809,7 +809,7 @@
fire_mode.mode = FIRE_MODE_SPELL_ID;
sound_play_effect(SOUNDTYPE_CLIENT, SOUND_CLICK, 0,
0, MENU_SOUND_VOL);
- textwin_showstring(0, NDI_COLR_WHITE, "Spell readied");
+ textwin_show_string(0, NDI_COLR_WHITE, "Spell readied");
return 1;
}
@@ -826,7 +826,7 @@
fire_mode.mode = FIRE_MODE_SPELL_ID;
sound_play_effect(SOUNDTYPE_CLIENT, SOUND_CLICK, 0,
0, MENU_SOUND_VOL);
- textwin_showstring(0, NDI_COLR_WHITE, "Prayer readied");
+ textwin_show_string(0, NDI_COLR_WHITE, "Prayer readied");
return 1;
}
@@ -835,46 +835,46 @@
}
}
- textwin_showstring(0, NDI_COLR_WHITE, "Unknown spell.");
+ textwin_show_string(0, NDI_COLR_WHITE, "Unknown spell.");
return 1;
}
/* TODO; check and remove/fix. */
else if (!strcmp(cmd, "/reloadskinnow"))
{
- textwin_showstring(0, NDI_COLR_LIME, "Reloading skin. This function is only for skin creating, and may be removed anytime!");
+ textwin_show_string(0, NDI_COLR_LIME, "Reloading skin. This function is only for skin creating, and may be removed anytime!");
skin_reload();
}
else if (!strcmp(cmd, "/reset"))
{
if (!stricmp(params, "buddy"))
{
- textwin_showstring(0, NDI_COLR_WHITE, "Resetting buddy list!");
+ textwin_show_string(0, NDI_COLR_WHITE, "Resetting buddy list!");
buddy_list_clear();
buddy_list_save();
}
else if (!stricmp(params, "ignore"))
{
- textwin_showstring(0, NDI_COLR_WHITE, "Resetting ignore list!");
+ textwin_show_string(0, NDI_COLR_WHITE, "Resetting ignore list!");
ignore_list_clear();
ignore_list_save();
}
else if (!stricmp(params, "chatfilter") ||
!stricmp(params, "cfilter"))
{
- textwin_showstring(0, NDI_COLR_WHITE, "Resetting chatfilter list!");
+ textwin_show_string(0, NDI_COLR_WHITE, "Resetting chatfilter list!");
chatfilter_list_clear();
chatfilter_list_save();
}
else if (!stricmp(params, "kills"))
{
- textwin_showstring(0, NDI_COLR_WHITE, "Resetting kill list!");
+ textwin_show_string(0, NDI_COLR_WHITE, "Resetting kill list!");
kill_list_clear();
kill_list_save();
}
else if (!stricmp(params, "stats"))
{
- textwin_showstring(0, NDI_COLR_WHITE, "Resetting stat-o-meter!");
+ textwin_show_string(0, NDI_COLR_WHITE, "Resetting stat-o-meter!");
statometer.exp = 0;
statometer.kills = 0;
statometer.starttime = LastTick - 1;
@@ -886,7 +886,7 @@
{
widget_id_t id;
- textwin_showstring(0, NDI_COLR_WHITE, "Resetting widgetstatus!");
+ textwin_show_string(0, NDI_COLR_WHITE, "Resetting widgetstatus!");
for (id = 0; id < WIDGET_NROF; id++)
{
@@ -924,13 +924,13 @@
}
else if (!stricmp(params, "widgets"))
{
- textwin_showstring(0, NDI_COLR_WHITE, "Resetting widgets!");
+ textwin_show_string(0, NDI_COLR_WHITE, "Resetting widgets!");
widget_init();
}
#if 0
else
{
- textwin_showstring(0, NDI_COLR_WHITE, "Usage: "\
+ textwin_show_string(0, NDI_COLR_WHITE, "Usage: "\
"~/reset buddy~ to reset the buddylist,\n"\
"~/reset ignore~ to reset the ignorelist,\n"\
"~/reset chatfilter~ to reset the chatfilter list,\n"\
@@ -951,7 +951,7 @@
for (i = j = PHYSFS_getSearchPath(); *i; i++)
{
- textwin_showstring(0, NDI_COLR_WHITE, "[%s] is in the search path.", *i);
+ textwin_show_string(0, NDI_COLR_WHITE, "[%s] is in the search path.", *i);
}
PHYSFS_freeList(j);
@@ -959,72 +959,17 @@
return 1;
}
#endif
- else if (!strcmp(cmd, "/setwin"))
- {
- int msg,
- chat;
-
- if (!*params ||
- sscanf(params, "%d %d", &msg, &chat) != 2 ||
- msg < 2 ||
- msg + chat > 38)
- {
- textwin_showstring(0, NDI_COLR_WHITE, "Parameters out of bounds.");
-#if 0
- textwin_showstring(0, NDI_COLR_WHITE,
- "Usage: '/setwin <Msg> <Chat>'\n"\
- "Example: /setwin 9 5");
-#endif
- }
-
- textwin_showstring(0, NDI_COLR_WHITE, "Set textwin to %d rows.", msg);
- options.use_TextwinSplit = 0;
- txtwin[TW_MIX].size = msg - 1;
-
- return 1;
- }
- else if (!strcmp(cmd, "/setwinalpha"))
- {
- if (!strnicmp(params, "on", 2))
- {
- int alpha;
-
- if (sscanf(params, "%*s %d", &alpha) == 1)
- {
- options.textwin_alpha = alpha;
- }
-
- options.use_TextwinAlpha = 1;
- textwin_showstring(0, NDI_COLR_WHITE, "Set textwin alpha ~on~ (alpha=%d).",
- options.textwin_alpha);
- }
- else if (!strnicmp(params, "off", 3))
- {
- options.use_TextwinAlpha = 0;
- textwin_showstring(0, NDI_COLR_WHITE, "Set textwin alpha mode ~off~.");
- }
-#if 0
- else
- {
- textwin_showstring(0, NDI_COLR_WHITE,
- "Usage: '/setwinalpha on|off [<alpha>]'\n"\
- "Example: /setwinalpha ON 172\n/setwinalpha OFF");
- }
-#endif
-
- return 1;
- }
else if (!strcmp(cmd, "/shout_off"))
{
options.shoutoff = 1;
- textwin_showstring(0, NDI_COLR_WHITE, "Shout disabled");
+ textwin_show_string(0, NDI_COLR_WHITE, "Shout disabled");
return 1;
}
else if (!strcmp(cmd, "/shout_on"))
{
options.shoutoff = 0;
- textwin_showstring(0, NDI_COLR_WHITE,"Shout enabled");
+ textwin_show_string(0, NDI_COLR_WHITE,"Shout enabled");
return 1;
}
@@ -1041,7 +986,7 @@
min < 0 ||
min > 59)
{
-// textwin_showstring(0, NDI_COLR_WHITE, "Sleeptimer OFF\nUsage: /sleeptimer HH:MM");
+// textwin_show_string(0, NDI_COLR_WHITE, "Sleeptimer OFF\nUsage: /sleeptimer HH:MM");
options.sleepcounter = 0;
}
@@ -1068,7 +1013,7 @@
strftime(tmpbuf, sizeof tmpbuf, "%d-%m-%y %H:%M:%S",
localtime(&sleeptime));
- textwin_showstring(0, NDI_COLR_WHITE, "Sleeptime set to %s", tmpbuf);
+ textwin_show_string(0, NDI_COLR_WHITE, "Sleeptime set to %s", tmpbuf);
}
return 1;
@@ -1133,10 +1078,10 @@
PHYSFS_close(handle);
LOG(LOG_SYSTEM, "OK!\n");
- textwin_showstring(0, NDI_COLR_WHITE, "~Client version~: %u.%u.%u / %u (%s)",
+ textwin_show_string(0, NDI_COLR_WHITE, "~Client version~: %u.%u.%u / %u (%s)",
DAI_VERSION_RELEASE, DAI_VERSION_MAJOR,
DAI_VERSION_MINOR, PROTOCOL_VERSION, buf);
- textwin_showstring(0, NDI_COLR_WHITE, "~Server version~: %u.%u.%u / %u",
+ textwin_show_string(0, NDI_COLR_WHITE, "~Server version~: %u.%u.%u / %u",
options.server_version_release,
options.server_version_major,
options.server_version_minor,
Modified: trunk/client/src/commands.c
===================================================================
--- trunk/client/src/commands.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/commands.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -181,7 +181,7 @@
/* setup the endian syncronization */
if(!setup_endian_sync(buf))
{
- textwin_showstring(0, NDI_COLR_RED, "Corrupt endian template!");
+ textwin_show_string(0, NDI_COLR_RED, "Corrupt endian template!");
LOG(LOG_ERROR, "Corrupt endian template!\n");
SOCKET_CloseSocket(csocket.fd);
GameStatus = GAME_STATUS_START;
@@ -240,7 +240,7 @@
!cp2)
{
sprintf(buf, "The server is broken!\nPlease report it and select a different one!");
- textwin_showstring(0, NDI_COLR_RED, buf);
+ textwin_show_string(0, NDI_COLR_RED, buf);
LOG(LOG_ERROR, "%s\n", buf);
SOCKET_CloseSocket(csocket.fd);
GameStatus = GAME_STATUS_START;
@@ -256,7 +256,7 @@
(rel == DAI_VERSION_RELEASE &&
maj != DAI_VERSION_MAJOR))
{
- textwin_showstring(0, NDI_COLR_RED, "Mismatched x.y versions (server: %u.%u, client: %u.%u)!",
+ textwin_show_string(0, NDI_COLR_RED, "Mismatched x.y versions (server: %u.%u, client: %u.%u)!",
rel, maj, DAI_VERSION_RELEASE,
DAI_VERSION_MAJOR);
@@ -272,7 +272,7 @@
}
LOG(LOG_ERROR, "%s\n", tmpbuf);
- textwin_showstring(0, NDI_COLR_RED, tmpbuf);
+ textwin_show_string(0, NDI_COLR_RED, tmpbuf);
SOCKET_CloseSocket(csocket.fd);
GameStatus = GAME_STATUS_START;
SDL_Delay(3250);
@@ -282,9 +282,9 @@
if (min != DAI_VERSION_MINOR)
{
- textwin_showstring(0, NDI_COLR_ORANGE, "Mismatched z version (server: %u, client: %u)!",
+ textwin_show_string(0, NDI_COLR_ORANGE, "Mismatched z version (server: %u, client: %u)!",
min, DAI_VERSION_MINOR);
- textwin_showstring(0, NDI_COLR_ORANGE, "You can still connect and play but you might encounter minor problems or new features may not work properly.");
+ textwin_show_string(0, NDI_COLR_ORANGE, "You can still connect and play but you might encounter minor problems or new features may not work properly.");
}
}
else if (!strcmp(cmd, "pv"))
@@ -297,7 +297,7 @@
{
char tmpbuf[TINY_BUF];
- textwin_showstring(0, NDI_COLR_RED, "Mismatched protocol versions (server: %u, client: %u)",
+ textwin_show_string(0, NDI_COLR_RED, "Mismatched protocol versions (server: %u, client: %u)",
pv, PROTOCOL_VERSION);
if (pv < PROTOCOL_VERSION)
@@ -306,7 +306,7 @@
sprintf(tmpbuf, "Your client is outdated!\nUpdate your client!");
LOG(LOG_ERROR, "%s\n", tmpbuf);
- textwin_showstring(0, NDI_COLR_RED, tmpbuf);
+ textwin_show_string(0, NDI_COLR_RED, tmpbuf);
SOCKET_CloseSocket(csocket.fd);
GameStatus = GAME_STATUS_START;
SDL_Delay(3250);
@@ -499,7 +499,7 @@
{
LOG(LOG_ERROR, "Got setup for a command we don't understand: %s %s\n", cmd, param);
sprintf(buf, "The server is outdated!\nSelect a different one!");
- textwin_showstring(0, NDI_COLR_RED, buf);
+ textwin_show_string(0, NDI_COLR_RED, buf);
LOG(LOG_ERROR, "%s\n", buf);
SOCKET_CloseSocket(csocket.fd);
GameStatus = GAME_STATUS_START;
@@ -563,31 +563,31 @@
/* something was going wrong when loading the file...
* player should ask a GM/DM for help
*/
- textwin_showstring(0, NDI_COLR_ORANGE, "***PLAYER LOGIN FAILED***");
+ textwin_show_string(0, NDI_COLR_ORANGE, "***PLAYER LOGIN FAILED***");
if(msg == ADDME_MSG_OK || msg == ADDME_MSG_INTERNAL || msg == ADDME_MSG_CORRUPT)
{
sprintf(buf,"Can't load player file %s\n Error Code: %d\nCall a game master for help!\n", cpl.name, msg);
- textwin_showstring(0, NDI_COLR_ORANGE, buf);
+ textwin_show_string(0, NDI_COLR_ORANGE, buf);
}
else if(msg == ADDME_MSG_UNKNOWN)
{
- textwin_showstring(0, NDI_COLR_ORANGE, "Unknown player name!");
+ textwin_show_string(0, NDI_COLR_ORANGE, "Unknown player name!");
}
else if(msg == ADDME_MSG_TAKEN)
{
- textwin_showstring(0, NDI_COLR_ORANGE, "Name is already taken!\nChoose a different one.");
+ textwin_show_string(0, NDI_COLR_ORANGE, "Name is already taken!\nChoose a different one.");
}
else if(msg == ADDME_MSG_ACCOUNT)
{
- textwin_showstring(0, NDI_COLR_ORANGE, "Player owned by different account!");
+ textwin_show_string(0, NDI_COLR_ORANGE, "Player owned by different account!");
}
else if(msg == ADDME_MSG_BANNED)
{
- textwin_showstring(0, NDI_COLR_ORANGE, "Player is BANNED!");
+ textwin_show_string(0, NDI_COLR_ORANGE, "Player is BANNED!");
}
else if (msg == ADDME_MSG_WRONGPWD)
{
- textwin_showstring(0, NDI_COLR_ORANGE, "Player exists but is saved in B4 format!\nNow enter the password to reclaim this name.");
+ textwin_show_string(0, NDI_COLR_ORANGE, "Player exists but is saved in B4 format!\nNow enter the password to reclaim this name.");
if(GameStatus == GAME_STATUS_ACCOUNT_CHAR_CREATE_WAIT)
{
@@ -603,7 +603,7 @@
}
else
{
- textwin_showstring(0, NDI_COLR_ORANGE, "Player loading failed!");
+ textwin_show_string(0, NDI_COLR_ORANGE, "Player loading failed!");
}
SDL_Delay(1250);
if(GameStatus == GAME_STATUS_ACCOUNT_CHAR_CREATE_WAIT)
@@ -726,7 +726,7 @@
buf++;
}
- textwin_showstring(flags, colr, "%s", buf);
+ textwin_show_string(flags, colr, "%s", buf);
}
/* new draw command */
@@ -887,130 +887,7 @@
}
}
- /* we log even before we ignore, or cfilter */
- if (options.msglog > 0)
- {
- if (options.msglog == 2 ||
- (flags & (NDI_FLAG_PLAYER | NDI_FLAG_SAY | NDI_FLAG_SHOUT |
- NDI_FLAG_TELL | NDI_FLAG_GSAY | NDI_FLAG_EMOTE)))
- {
- MSGLOG(buf);
- }
- }
-
- /* we have communication input */
- if (tmp &&
- (flags & (NDI_FLAG_PLAYER | NDI_FLAG_SAY | NDI_FLAG_SHOUT |
- NDI_FLAG_TELL | NDI_FLAG_GSAY | NDI_FLAG_EMOTE)))
- {
- if (!(flags & NDI_FLAG_ADMIN))
- {
- if ((flags & NDI_FLAG_SAY) &&
- ignore_check(data, "say"))
- {
- return;
- }
-
- if ((flags & NDI_FLAG_SHOUT) &&
- ignore_check(data, "shout"))
- {
- return;
- }
-
- if ((flags & NDI_FLAG_TELL) &&
- ignore_check(data, "tell"))
- {
- return;
- }
-
- if ((flags & NDI_FLAG_EMOTE) &&
- ignore_check(data, "emote"))
- {
- return;
- }
- }
-
- /* Filter incoming msg for f*words */
- if (options.chatfilter)
- {
- chatfilter_filter(buf);
- }
-
- /* Pick the skin's colour for the method of chat. */
- /* TODO: In 0.11.0 the server will send the NDI_FLAG_EAVESDROP flag
- * on tells which a GM is listening in on. Currently it colours them
- * flesh (translated to fuschia). */
- /* TODO: Eventually we'll be able to set fg and bg colour independenty.
- * NDI_FLAG_BUDDY and NDI_FLAG_EAVESDROP will set the bg, leaving the
- * fg as set by other flags. */
- if ((flags & NDI_FLAG_SAY))
- {
- colr = skin_prefs.chat_say;
- }
- else if ((flags & NDI_FLAG_SHOUT))
- {
- colr = skin_prefs.chat_shout;
- }
- else if ((flags & NDI_FLAG_TELL))
- {
- if (colr == NDI_COLR_FUSCHIA)
- {
- flags |= NDI_FLAG_EAVESDROP;
- colr = skin_prefs.chat_eavesdrop;
- }
- else
- {
- colr = skin_prefs.chat_tell;
- }
- }
- else if ((flags & NDI_FLAG_GSAY))
- {
- colr = skin_prefs.chat_gsay;
- }
- else if ((flags & NDI_FLAG_EMOTE))
- {
- colr = skin_prefs.chat_emote;
- }
- else if ((flags & NDI_FLAG_ADMIN))
- {
- colr = skin_prefs.chat_admin;
- }
-
- /* Color messages from buddys */
- if (buddy_check(data))
- {
- flags |= NDI_FLAG_BUDDY;
- colr = skin_prefs.chat_buddy;
- }
-
- /* Only see shouts from buddies. */
- if ((flags & NDI_FLAG_SHOUT) &&
- options.shoutoff &&
- (flags & NDI_FLAG_BUDDY))
- {
- return;
- }
-
- /* save last incomming tell player for client sided /reply */
- if ((flags & NDI_FLAG_TELL) &&
- !(flags & NDI_FLAG_EAVESDROP))
- {
- strcpy(cpl.player_reply, data);
- }
-
- /*LOG(LOG_DEBUG,"IGNORE?: player >%s<\n", data);*/
- if ((flags & NDI_FLAG_EMOTE))
- {
- flags &= ~NDI_FLAG_PLAYER;
- }
-
- if (options.smileys)
- {
- smiley_convert(buf);
- }
- }
-
- textwin_showstring(flags, colr, "%s", buf);
+ textwin_show_string(flags, colr, "%s", buf);
}
void TargetObject(char *data, int len)
@@ -1420,7 +1297,6 @@
options.firststart = 0;
GameStatus = GAME_STATUS_PLAY;
- txtwin[TW_MIX].size = txtwin_start_size;
InputStringEndFlag = 0;
tag = GetSINT32_String(data);
i += 4;
@@ -1668,7 +1544,7 @@
{
if (!gui_npc_create(mode, data, len, 0))
{
- textwin_showstring(0, NDI_COLR_RED, "INVALID GUI CMD");
+ textwin_show_string(0, NDI_COLR_RED, "INVALID GUI CMD");
}
}
}
@@ -2255,7 +2131,7 @@
face = atoi(tmp + 1);
face_get(face);
tmp = strchr(tmp + 1, ' '); /* find start of a name */
- textwin_showstring(0, NDI_COLR_WHITE, "You %s control of %s.",
+ textwin_show_string(0, NDI_COLR_WHITE, "You %s control of %s.",
((mode = atoi(data)) == GOLEM_CTR_RELEASE) ? "lose" :
"gain", tmp + 1);
}
@@ -2389,8 +2265,10 @@
*/
/* we have to convert to smileys for correct string width calculation */
- if (options.smileys)
+ if (options.textwin_use_smileys)
+ {
smiley_convert(text);
+ }
/* lets calculate the space used by the prefix */
preflen=0;
@@ -2420,7 +2298,7 @@
break;
}
- /* lets do some codestealing from client's textwin_showstring() :) */
+ /* lets do some codestealing from client's textwin_show_string() :) */
len = 0;
for (a = i = 0; ; i++)
{
@@ -2577,17 +2455,17 @@
if (mode==1)
{
char message2[1024];
- sprintf(prefix,"[%s:%s ",channelname, playername);
+ sprintf(prefix,"[%s#%s ",channelname, playername);
sprintf(message2,"%s%c",message,']');
break_string(message2, prefix, 1, outstring);
}
else
{
- sprintf(prefix,"[%s:%s] ",channelname, playername);
+ sprintf(prefix,"[%s#%s] ",channelname, playername);
break_string(message, prefix, 0, outstring);
}
- textwin_showstring(NDI_FLAG_PLAYER, colr, "%s", outstring);
+ textwin_show_string(NDI_FLAG_PLAYER | NDI_FLAG_CHANNEL, colr, "%s", outstring);
}
#endif
@@ -2602,7 +2480,7 @@
ac_status = GetSINT8_String(data+count++);
if(ac_status) /* something is wrong when not ACCOUNT_STATUS_OK (0) */
{
- textwin_showstring(0, NDI_COLR_RED, "Unknown Account: %s", cpl.acc_name);
+ textwin_show_string(0, NDI_COLR_RED, "Unknown Account: %s", cpl.acc_name);
GameStatus = GAME_STATUS_LOGIN_ACCOUNT;
LoginInputStep = LOGIN_STEP_NAME;
dialog_login_warning_level = DIALOG_LOGIN_WARNING_ACCOUNT_UNKNOWN;
Modified: trunk/client/src/dialog.c
===================================================================
--- trunk/client/src/dialog.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/dialog.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -110,15 +110,18 @@
{
/* Chat & Messages */
{"Channel format:", "How the channels are shown.","~Prefixed~ prefixes each line with [channel:player], and","~Indented~ only prefixes the first line, indenting subsequent ones.", "Prefixed#Indented",SEL_RANGE,0,1,1,0, &options.channelformat,VAL_INT},
- {"Enable smileys:", "Whether to show smileys graphically.","","", "",SEL_CHECKBOX,0,1,1,1, &options.smileys,VAL_BOOL},
+ {"Enable smileys:", "Whether to show smileys graphically.","","", "",SEL_CHECKBOX,0,1,1,1, &options.textwin_use_smileys,VAL_BOOL},
#ifdef DAI_DEVELOPMENT
- {"Log messages:", "Whether/which messages are logged.","~None~ turns off logging, ~Only chat~ logs only the chat textwindow, and","~All~ logs everything in both textwindows.", "None#Only chat#All",SEL_RANGE,0,2,1,2, &options.msglog,VAL_INT},
+ {"Logging:", "Whether the textwindows are logged.","~None~ turns off logging, ~Only chat~, ~Only messages~, or ~Both, separately~ logs either or both textwindows to separate files, and ~Both, together~ logs both textwindows to a single file.","", "None#Only chat#Only messages#Both, separately#Both, together",SEL_RANGE,0,4,1,3, &options.textwin_use_logging,VAL_INT},
#else
- {"Log messages:", "Whether/which messages are logged.","~None~ turns off logging, ~Only chat~ logs only the chat textwindow, and","~All~ logs everything in both textwindows.", "None#Only chat#All",SEL_RANGE,0,2,1,1, &options.msglog,VAL_INT},
+ {"Logging:", "Whether the textwindows are logged.","~None~ turns off logging, ~Only chat~, ~Only messages~, or ~Both, separately~ logs either or both textwindows to separate files, and ~Both, together~ logs both textwindows to a single file.","", "None#Only chat#Only messages#Both, separately#Both, together",SEL_RANGE,0,4,1,1, &options.textwin_use_logging,VAL_INT},
#endif
- {"Textwindows use alpha:", "Whether the textwindows are transparent.","","WARNING: Don't check this if you have a VERY slow computer!", "",SEL_CHECKBOX,0,1,1,1, &options.use_TextwinAlpha,VAL_INT},
- {"Textwindows alpha value:", "Transparency value of textwindows.","A higher value means a darker textwindow.","Only has meaning if 'Textwindows use alpha' is checked.", "",SEL_RANGE,0,255,5,110, &options.textwin_alpha,VAL_INT},
- {"Enable chatfilter:", "Whether to filter incoming messages for 'bad' words.","See '/cfilter ?' for more details on this.","", "",SEL_CHECKBOX,0,1,1,0, &options.chatfilter,VAL_BOOL},
+ {"Alpha value:", "Transparency value of textwindows.","A higher value means a darker textwindow.","", "",SEL_RANGE,0,255,5,110, &options.textwin_alpha,VAL_INT},
+ {"Message font:", "Font to use in the message textwindow.","The font will be resized when you return to the game. Text currently in","the textwindow will not be reformatted.", "Tiny, outlined#Small#Small, outlined#Medium#Medium, outlined#Large, outlined",SEL_RANGE,0,5,1,1, &options.textwin_msg_font,VAL_INT},
+ {"Chat font:", "Font to use in the chat textwindow.","The font will be resized when you return to the game. Text currently in","the textwindow will not be reformatted.", "Tiny, outlined#Small#Small, outlined#Medium#Medium, outlined#Large, outlined",SEL_RANGE,0,5,1,1, &options.textwin_chat_font,VAL_INT},
+ {"Indentation:", "The number of spaces by which to indent multiple line chat.","","", "",SEL_RANGE,0,32,1,0, &options.textwin_indentation,VAL_INT},
+ {"Scrollback:", "The number of lines of scrollback in ~either~ window.","The higher the value, the more memory is used.","NOTE: You need to restart the client for this option to take effect.", "",SEL_RANGE,1000,50000,1000,1000, &options.textwin_scrollback,VAL_INT},
+ {"Enable chatfilter:", "Whether to filter incoming messages for 'bad' words.","See '/cfilter ?' for more details on this.","", "",SEL_CHECKBOX,0,1,1,0, &options.textwin_use_chatfilter,VAL_BOOL},
{"NPC GUI keyword panel:", "Whether/where to show a list of clickable keywords.", "", "", "Off#Left#Right", SEL_RANGE, 0, 2, 1, 1, &options.keyword_panel, VAL_INT},
{"#", "","","", "",0,0,0,0,0, NULL,0},
/* End of Page */
Modified: trunk/client/src/event.c
===================================================================
--- trunk/client/src/event.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/event.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -246,8 +246,9 @@
static void mouse_moveHero()
{
#define MY_POS 8
- int x, y, tx, ty;
- static int delta = 0;
+ int x, y, tx, ty;
+ static int delta = 0;
+ textwin_id_t twid;
if (0)
return; /* disable until we have smooth moving - people think this IS the real mouse moving */
@@ -266,8 +267,15 @@
return;
if (cpl.menustatus != MENU_NO)
return;
- if (textwin_flags & (TW_RESIZE + TW_SCROLL))
- return; /* textwin events */
+
+ for (twid = 0; twid < TEXTWIN_NROF; twid++)
+ {
+ if ((textwin[twid].flags & (TEXTWIN_FLAG_RESIZE | TEXTWIN_FLAG_SCROLL)))
+ {
+ return;
+ }
+ }
+
if (!(SDL_GetMouseState(&x, &y) & SDL_BUTTON(SDL_BUTTON_LEFT)))
{
delta = 0;
@@ -275,7 +283,7 @@
}
/* textwin has high priority, so dont move if playfield is overlapping */
/* widget function handle this... */
-// if ((options.use_TextwinSplit) && x > 538 && y > 560 - (txtwin[TW_MSG].size + txtwin[TW_CHAT].size) * 10)
+// if ((options.use_TextwinSplit) && x > 538 && y > 560 - (txtwin[TEXTWIN_MSG_ID].size + txtwin[TEXTWIN_CHAT_ID].size) * 10)
// return;
if (get_tile_position(x, y, &tx, &ty))
@@ -430,8 +438,8 @@
{
SDL_Event event;
int x, y, done = 0;
+ textwin_id_t twid;
static int active_scrollbar = 0;
-
static Uint32 Ticks = 0;
itemExamined = 0; /* only print text once per dnd */
@@ -443,8 +451,20 @@
{
if (InputStringFlag && cpl.input_mode == INPUT_MODE_NUMBER)
mouse_InputNumber();
- else if (!active_scrollbar && !cursor_type)
+ else if (!active_scrollbar)
mouse_moveHero();
+ else
+ {
+ for (twid = 0; twid < TEXTWIN_NROF; twid++)
+ {
+ if ((textwin[twid].flags & TEXTWIN_FLAG_RESIZE))
+ {
+ continue;
+ }
+
+ mouse_moveHero();
+ }
+ }
}
}
@@ -470,22 +490,23 @@
else
MouseEvent = IDLE;
+ for (twid = 0; twid < TEXTWIN_NROF; twid++)
+ {
+ textwin[twid].resize = TEXTWIN_RESIZING_DIR_NONE;
+ }
+
/* no button is down */
MouseState = IDLE;
-
- cursor_type = 0;
-
-
global_buttons.mx_up = x;
global_buttons.my_up = y;
global_buttons.down = -1;
global_buttons.click = 1;
global_buttons.valid = 0;
+
if (GameStatus < GAME_STATUS_PLAY)
break;
+
mb_clicked = 0;
-
- cursor_type = 0;
active_scrollbar = 0;
if (cpl.menustatus == MENU_BOOK)
@@ -635,8 +656,8 @@
{
char tz[40];
sprintf(tz,"x: %d , y: %d", x, y);
- textwin_showstring(NDI_FLAG_PLAYER, NDI_COLR_BLUE, "%s", tz);
- textwin_showstring(0, NDI_COLR_BLUE, "%s", tz);
+ textwin_show_string(NDI_FLAG_PLAYER, NDI_COLR_BLUE, "%s", tz);
+ textwin_show_string(0, NDI_COLR_BLUE, "%s", tz);
}
*/
@@ -886,7 +907,7 @@
{
case SDLK_ESCAPE:
SOCKET_CloseClientSocket(&csocket);
- textwin_showstring(0, NDI_COLR_RED, "connection closed. select new server.");
+ textwin_show_string(0, NDI_COLR_RED, "connection closed. select new server.");
break;
default:
@@ -985,7 +1006,7 @@
/* record this line in input history only if we are in console mode */
if (cpl.input_mode == INPUT_MODE_CONSOLE)
- textwin_addhistory(InputString);
+ textwin_add_history(InputString);
}
break;
@@ -1068,7 +1089,7 @@
if (HistoryPos == 0)
strncpy(InputHistory[0], InputString, InputCount);
HistoryPos++;
- textwin_putstring(InputHistory[HistoryPos]);
+ textwin_put_string(InputHistory[HistoryPos]);
}
/* If we are in INTERFACE mode, let player scroll back the
@@ -1111,7 +1132,7 @@
if (cpl.input_mode == INPUT_MODE_CONSOLE && HistoryPos > 0)
{
HistoryPos--;
- textwin_putstring(InputHistory[HistoryPos]);
+ textwin_put_string(InputHistory[HistoryPos]);
}
/* If we are in INTERFACE mode, let player scroll forward the
@@ -1356,7 +1377,7 @@
{
if (KeyScanFlag)
{
- textwin_showstring(0, NDI_COLR_RED, "Scancode: %d", key->keysym.sym);
+ textwin_show_string(0, NDI_COLR_RED, "Scancode: %d", key->keysym.sym);
}
if (cpl.menustatus != MENU_NO)
@@ -1376,7 +1397,7 @@
case SDLK_RALT:
client_cmd_generic("/run_stop");
#ifdef DEBUG_TEXT
- textwin_showstring(0, NDI_COLR_OLIVE, "run_stop");
+ textwin_show_string(0, NDI_COLR_OLIVE, "run_stop");
#endif
cpl.run_on = 0;
break;
@@ -1602,7 +1623,7 @@
{
sprintf(buf, "%s", bindkey_list[j].entry[i].text);
#ifdef DEBUG_TEXT
- textwin_showstring(0, NDI_COLR_OLIVE, "%s", buf);
+ textwin_show_string(0, NDI_COLR_OLIVE, "%s", buf);
#endif
client_cmd_generic(buf);
}
@@ -1622,7 +1643,7 @@
if (!strncmp(macro_magic_console, text, magic_len) && (int) strlen(text) > magic_len)
{
process_macro_keys(KEYFUNC_CONSOLE, 0);
- textwin_putstring(&text[magic_len]);
+ textwin_put_string(&text[magic_len]);
return(0);
}
for (i = 0; i < (int)DEFAULT_KEYMAP_MACROS; i++)
@@ -1646,31 +1667,65 @@
switch (id)
{
+// case KEYFUNC_TEXTWIN_LINEUP:
+// if (shiftPressed)
+// {
+// textwin_keypress(SDLK_UP, TEXTWIN_MSG_ID);
+// }
+// else
+// {
+// textwin_keypress(SDLK_UP, TEXTWIN_CHAT_ID);
+// }
+//
+// break;
+//
+// case KEYFUNC_TEXTWIN_LINEDOWN:
+// if (shiftPressed)
+// {
+// textwin_keypress(SDLK_DOWN, TEXTWIN_MSG_ID);
+// }
+// else
+// {
+// textwin_keypress(SDLK_DOWN, TEXTWIN_CHAT_ID);
+// }
+//
+// break;
+//
+// case KEYFUNC_TEXTWIN_PAGEUP:
+// if (shiftPressed)
+// {
+// textwin_keypress(SDLK_PAGEUP, TEXTWIN_MSG_ID);
+// }
+// else
+// {
+// textwin_keypress(SDLK_PAGEUP, TEXTWIN_CHAT_ID);
+// }
+//
+// break;
+//
+// case KEYFUNC_TEXTWIN_PAGEDOWN:
+// if (shiftPressed)
+// {
+// textwin_keypress(SDLK_PAGEDOWN, TEXTWIN_MSG_ID);
+// }
+// else
+// {
+// textwin_keypress(SDLK_PAGEDOWN, TEXTWIN_CHAT_ID);
+// }
+//
+// break;
+
case KEYFUNC_PAGEUP:
- if (options.use_TextwinSplit)
- {
- txtwin[TW_CHAT].scroll++;
- WIDGET_REDRAW(WIDGET_CHATWIN_ID) = 1;
- }
- else
- txtwin[TW_MIX].scroll++;
+ textwin_keypress(SDLK_UP, TEXTWIN_CHAT_ID);
break;
case KEYFUNC_PAGEDOWN:
- if (options.use_TextwinSplit)
- {
- txtwin[TW_CHAT].scroll--;
- WIDGET_REDRAW(WIDGET_CHATWIN_ID) = 1;
- }
- else
- txtwin[TW_MIX].scroll--;
+ textwin_keypress(SDLK_DOWN, TEXTWIN_CHAT_ID);
break;
case KEYFUNC_PAGEUP_TOP:
- txtwin[TW_MSG].scroll++;
- WIDGET_REDRAW(WIDGET_MSGWIN_ID) = 1;
+ textwin_keypress(SDLK_UP, TEXTWIN_MSG_ID);
break;
case KEYFUNC_PAGEDOWN_TOP:
- txtwin[TW_MSG].scroll--;
- WIDGET_REDRAW(WIDGET_MSGWIN_ID) = 1;
+ textwin_keypress(SDLK_DOWN, TEXTWIN_MSG_ID);
break;
case KEYFUNC_TARGET_ENEMY:
@@ -1760,7 +1815,7 @@
if (!(cpl.runkey_on = cpl.runkey_on ? 0 : 1))
client_cmd_generic("/run_stop");
#ifdef DEBUG_TEXT
- textwin_showstring(0, NDI_COLR_OLIVE, "runmode %s",
+ textwin_show_string(0, NDI_COLR_OLIVE, "runmode %s",
(cpl.runkey_on) ? "on" : "off");
#endif
break;
@@ -1804,7 +1859,7 @@
if (tag == -1 || !locate_item(tag))
return 0;
#ifdef DEBUG_TEXT
- textwin_showstring(0, NDI_COLR_OLIVE, "apply %s", locate_item(tag)->s_name);
+ textwin_show_string(0, NDI_COLR_OLIVE, "apply %s", locate_item(tag)->s_name);
#endif
client_cmd_apply(tag);
return 0;
@@ -1818,7 +1873,7 @@
return 0;
client_cmd_examine(tag);
#ifdef DEBUG_TEXT
- textwin_showstring(0, NDI_COLR_OLIVE, "examine %s", locate_item(tag)->s_name);
+ textwin_show_string(0, NDI_COLR_OLIVE, "examine %s", locate_item(tag)->s_name);
#endif
return 0;
break;
@@ -1832,7 +1887,7 @@
send_mark_obj((it = locate_item(tag)));
if (it)
{
- textwin_showstring(0, NDI_COLR_OLIVE, "%s %s",
+ textwin_show_string(0, NDI_COLR_OLIVE, "%s %s",
(cpl.mark_count == (int)it->tag) ? "unmark" :
"mark", it->s_name);
}
@@ -1848,7 +1903,7 @@
toggle_locked((it = locate_item(tag)));
if (!it)
return 0;
- textwin_showstring(0, NDI_COLR_OLIVE, "%s %s",
+ textwin_show_string(0, NDI_COLR_OLIVE, "%s %s",
(it->locked) ? "unlock" : "lock", it->s_name);
return 0;
break;
@@ -1893,13 +1948,13 @@
}
}
if (tag == -1)
- textwin_showstring(0, NDI_COLR_OLIVE, "You already have it.");
+ textwin_show_string(0, NDI_COLR_OLIVE, "You already have it.");
}
}
}
else
{
- textwin_showstring(0, NDI_COLR_OLIVE, "You have no open container to put it in.");
+ textwin_show_string(0, NDI_COLR_OLIVE, "You have no open container to put it in.");
/*
tag = cpl.win_inv_tag;
loc = cpl.ob->tag;
@@ -1936,7 +1991,7 @@
cpl.nrof = nrof;
cpl.nummode = NUM_MODE_GET;
sprintf(buf, "%d", nrof);
- textwin_putstring(buf);
+ textwin_put_string(buf);
strncpy(cpl.num_text, it->s_name, 250);
cpl.num_text[250] = 0;
return 0;
@@ -1944,7 +1999,7 @@
/*collectAll:*/
sound_play_effect(SOUNDTYPE_CLIENT, SOUND_GET, 0, 0, 100);
#ifdef DEBUG_TEXT
- textwin_showstring(0, NDI_COLR_OLIVE, "get %s", it->s_name);
+ textwin_show_string(0, NDI_COLR_OLIVE, "get %s", it->s_name);
#endif
client_cmd_invmove(loc, tag, nrof);
return 0;
@@ -1956,7 +2011,7 @@
debug_layer[0] = 0;
else
debug_layer[0] = 1;
- textwin_showstring(0, NDI_COLR_OLIVE, "debug: map layer 0 %s.",
+ textwin_show_string(0, NDI_COLR_OLIVE, "debug: map layer 0 %s.",
(debug_layer[0]) ? "activated" : "deactivated");
return 0;
break;
@@ -1965,7 +2020,7 @@
debug_layer[1] = 0;
else
debug_layer[1] = 1;
- textwin_showstring(0, NDI_COLR_OLIVE, "debug: map layer 1 %s.",
+ textwin_show_string(0, NDI_COLR_OLIVE, "debug: map layer 1 %s.",
(debug_layer[1]) ? "activated" : "deactivated");
return 0;
break;
@@ -1974,7 +2029,7 @@
debug_layer[2] = 0;
else
debug_layer[2] = 1;
- textwin_showstring(0, NDI_COLR_OLIVE, "debug: map layer 2 %s.",
+ textwin_show_string(0, NDI_COLR_OLIVE, "debug: map layer 2 %s.",
(debug_layer[2]) ? "activated" : "deactivated");
return 0;
break;
@@ -1983,7 +2038,7 @@
debug_layer[3] = 0;
else
debug_layer[3] = 1;
- textwin_showstring(0, NDI_COLR_OLIVE, "debug: map layer 3 %s.",
+ textwin_show_string(0, NDI_COLR_OLIVE, "debug: map layer 3 %s.",
(debug_layer[3]) ? "activated" : "deactivated");
return 0;
break;
@@ -2023,7 +2078,7 @@
}
else
{
- textwin_showstring(0, NDI_COLR_OLIVE, "Select something that can be dropped first!");
+ textwin_show_string(0, NDI_COLR_OLIVE, "Select something that can be dropped first!");
return 0;
}
if (tag == -1 || !locate_item(tag))
@@ -2036,7 +2091,7 @@
if (it->locked)
{
sound_play_effect(SOUNDTYPE_CLIENT, SOUND_CLICKFAIL, 0, 0, 100);
- textwin_showstring(0, NDI_COLR_OLIVE, "Unlock the item first!");
+ textwin_show_string(0, NDI_COLR_OLIVE, "Unlock the item first!");
return 0;
}
@@ -2053,14 +2108,14 @@
cpl.nrof = nrof;
cpl.nummode = NUM_MODE_DROP;
sprintf(buf, "%d", nrof);
- textwin_putstring(buf);
+ textwin_put_string(buf);
strncpy(cpl.num_text, it->s_name, 250);
cpl.num_text[250] = 0;
return 0;
}
sound_play_effect(SOUNDTYPE_NORMAL, SOUND_DROP, 0, 0, 100);
#ifdef DEBUG_TEXT
- textwin_showstring(0, NDI_COLR_OLIVE, "drop %s", it->s_name);
+ textwin_show_string(0, NDI_COLR_OLIVE, "drop %s", it->s_name);
#endif
client_cmd_invmove(loc, tag, nrof);
return 0;
@@ -2170,7 +2225,7 @@
{
quick_slots[slot].shared.is_spell = 0;
quick_slots[slot].shared.tag = -1;
- textwin_showstring(0, NDI_COLR_OLIVE, "unset F%d.", slot + 1);
+ textwin_show_string(0, NDI_COLR_OLIVE, "unset F%d.", slot + 1);
}
else
{
@@ -2178,7 +2233,7 @@
quick_slots[slot].spell.groupNr = spell_list_set.group_nr;
quick_slots[slot].spell.classNr = spell_list_set.class_nr;
quick_slots[slot].shared.tag = spell_list_set.entry_nr;
- textwin_showstring(0, NDI_COLR_OLIVE, "set F%d to %s",
+ textwin_show_string(0, NDI_COLR_OLIVE, "set F%d to %s",
slot + 1,
spell_list[spell_list_set.group_nr].entry[spell_list_set.class_nr][spell_list_set.entry_nr].name);
}
@@ -2200,7 +2255,7 @@
{
quick_slots[slot].shared.tag = tag;
quick_slots[slot].item.invSlot = cpl.win_inv_slot;
- textwin_showstring(0, NDI_COLR_OLIVE, "set F%d to %s",
+ textwin_show_string(0, NDI_COLR_OLIVE, "set F%d to %s",
slot + 1, locate_item(tag)->s_name);
}
}
@@ -2221,7 +2276,7 @@
if (locate_item(quick_slots[slot].shared.tag))
{
#ifdef DEBUG_TEXT
- textwin_showstring(0, NDI_COLR_OLIVE, "F%d quick apply %s",
+ textwin_show_string(0, NDI_COLR_OLIVE, "F%d quick apply %s",
slot + 1,
locate_item(quick_slots[slot].shared.tag)->s_name);
#endif
@@ -2229,7 +2284,7 @@
return;
}
}
- textwin_showstring(0, NDI_COLR_OLIVE, "F%d quick slot is empty", slot + 1);
+ textwin_show_string(0, NDI_COLR_OLIVE, "F%d quick slot is empty", slot + 1);
}
}
@@ -2258,7 +2313,7 @@
!cpl.fire_on)) /* runmode on, or ALT key trigger */
{
#ifdef DEBUG_TEXT
- textwin_showstring(0, NDI_COLR_OLIVE, "run %s", directions_name[num]);
+ textwin_show_string(0, NDI_COLR_OLIVE, "run %s", directions_name[num]);
#endif
client_cmd_generic(directionsrun[num]);
}
@@ -2276,14 +2331,14 @@
if (!weapon)
{
- textwin_showstring(0, NDI_COLR_WHITE, "No weapon selected!");
+ textwin_show_string(0, NDI_COLR_WHITE, "No weapon selected!");
fire_mode.weapon = FIRE_ITEM_NO;
fire_mode.ammo = FIRE_ITEM_NO;
}
else
{
#ifdef DEBUG_TEXT
- textwin_showstring(0, NDI_COLR_OLIVE, "fire %s %s",
+ textwin_show_string(0, NDI_COLR_OLIVE, "fire %s %s",
weapon->s_name, direction_name[num]);
#endif
client_cmd_fire(num, FIRE_MODE_ARCHERY_ID, "");
@@ -2295,12 +2350,12 @@
if (!fire_mode.spell ||
fire_mode.spell->flag == -1)
{
- textwin_showstring(0, NDI_COLR_WHITE, "No spell selected!");
+ textwin_show_string(0, NDI_COLR_WHITE, "No spell selected!");
}
else
{
#ifdef DEBUG_TEXT
- textwin_showstring(0, NDI_COLR_OLIVE, "cast %s %s",
+ textwin_show_string(0, NDI_COLR_OLIVE, "cast %s %s",
fire_mode.spell->name,
directions_name[num]);
#endif
@@ -2314,12 +2369,12 @@
if (!fire_mode.skill ||
fire_mode.skill->flag == -1)
{
- textwin_showstring(0, NDI_COLR_WHITE, "No skill selected!");
+ textwin_show_string(0, NDI_COLR_WHITE, "No skill selected!");
}
else
{
#ifdef DEBUG_TEXT
- textwin_showstring(0, NDI_COLR_OLIVE, "use %s %s",
+ textwin_show_string(0, NDI_COLR_OLIVE, "use %s %s",
fire_mode.skill->name,
directions_name[num]);
#endif
@@ -2336,7 +2391,7 @@
else
{
#ifdef DEBUG_TEXT
- textwin_showstring(0, NDI_COLR_OLIVE, "move %s", directions_name[num]);
+ textwin_show_string(0, NDI_COLR_OLIVE, "move %s", directions_name[num]);
#endif
client_cmd_move(num, 0);
}
@@ -2388,7 +2443,7 @@
sprintf(buf, "%s", bindkey_list[j].entry[i].text);
#ifdef DEBUG_TEXT
- textwin_showstring(0, NDI_COLR_OLIVE, "%s", buf);
+ textwin_show_string(0, NDI_COLR_OLIVE, "%s", buf);
#endif
client_cmd_generic(buf);
}
@@ -2779,6 +2834,10 @@
case SDLK_ESCAPE:
sound_play_effect(SOUNDTYPE_CLIENT, SOUND_CLICK, 0, 0, MENU_SOUND_VOL);
save_options_dat();
+ textwin_set_font(TEXTWIN_MSG_ID);
+ textwin_set_font(TEXTWIN_CHAT_ID);
+ textwin_show_window(TEXTWIN_MSG_ID);
+ textwin_show_window(TEXTWIN_CHAT_ID);
Mix_VolumeMusic(options.music_volume);
if (options.playerdoll)
WIDGET_SHOW(WIDGET_PDOLL_ID) = 1;
@@ -2809,7 +2868,7 @@
if ((ScreenSurface = SDL_SetVideoMode(Screensize.x, Screensize.y, options.used_video_bpp, videoflags)) == NULL)
{
int i;
- textwin_showstring(0, NDI_COLR_RED, "Couldn't set %dx%dx%d video mode: %s\n", Screensize.x, Screensize.y, options.used_video_bpp, SDL_GetError());
+ textwin_show_string(0, NDI_COLR_RED, "Couldn't set %dx%dx%d video mode: %s\n", Screensize.x, Screensize.y, options.used_video_bpp, SDL_GetError());
LOG(LOG_ERROR, "Couldn't set %dx%dx%d video mode: %s\n", Screensize.x, Screensize.y, options.used_video_bpp, SDL_GetError());
Screensize=sz_tmp;
for (i=0;i<16;i++)
@@ -2818,21 +2877,21 @@
options.resolution = i;
break;
}
- textwin_showstring(0, NDI_COLR_RED, "Try to switch back to old setting...");
+ textwin_show_string(0, NDI_COLR_RED, "Try to switch back to old setting...");
LOG(LOG_ERROR, "Try to switch back to old setting...\n");
if ((ScreenSurface = SDL_SetVideoMode(Screensize.x, Screensize.y, options.used_video_bpp, videoflags)) == NULL)
{
- textwin_showstring(0, NDI_COLR_RED, "Couldn't set %dx%dx%d video mode: %s\n", Screensize.x, Screensize.y, options.used_video_bpp, SDL_GetError());
+ textwin_show_string(0, NDI_COLR_RED, "Couldn't set %dx%dx%d video mode: %s\n", Screensize.x, Screensize.y, options.used_video_bpp, SDL_GetError());
LOG(LOG_ERROR, "Couldn't set %dx%dx%d video mode: %s\n", Screensize.x, Screensize.y, options.used_video_bpp, SDL_GetError());
Screensize=Screendefs[0];
options.resolution = 0;
- textwin_showstring(0, NDI_COLR_RED, "Try to switch back to 800x600...");
+ textwin_show_string(0, NDI_COLR_RED, "Try to switch back to 800x600...");
LOG(LOG_ERROR, "Try to switch back to 800x600...\n");
if ((ScreenSurface = SDL_SetVideoMode(Screensize.x, Screensize.y, options.used_video_bpp, videoflags)) == NULL)
{
/* now we have a problem */
- textwin_showstring(0, NDI_COLR_RED, "Couldn't set %dx%dx%d video mode: %s\nFATAL ERROR - exit", Screensize.x, Screensize.y, options.used_video_bpp, SDL_GetError());
+ textwin_show_string(0, NDI_COLR_RED, "Couldn't set %dx%dx%d video mode: %s\nFATAL ERROR - exit", Screensize.x, Screensize.y, options.used_video_bpp, SDL_GetError());
LOG(LOG_FATAL, "Couldn't set %dx%dx%d video mode: %s\nFATAL ERROR - exit", Screensize.x, Screensize.y, options.used_video_bpp, SDL_GetError());
Screensize=sz_tmp;
}
@@ -3108,7 +3167,7 @@
keybind_status = KEYBIND_STATUS_EDIT;
reset_keys();
open_input_mode(240);
- textwin_putstring(bindkey_list[bindkey_list_set.group_nr].entry[bindkey_list_set.entry_nr].text);
+ textwin_put_string(bindkey_list[bindkey_list_set.group_nr].entry[bindkey_list_set.entry_nr].text);
cpl.input_mode = INPUT_MODE_GETKEY;
sound_play_effect(SOUNDTYPE_CLIENT, SOUND_CLICK, 0, 0, MENU_SOUND_VOL);
break;
Modified: trunk/client/src/ignore.c
===================================================================
--- trunk/client/src/ignore.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/ignore.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -76,11 +76,11 @@
struct ignore_list *node;
int i=0;
- textwin_showstring(0, NDI_COLR_WHITE, "\nIGNORE LIST");
- textwin_showstring(0, NDI_COLR_WHITE, "--------------------------");
+ textwin_show_string(0, NDI_COLR_WHITE, "\nIGNORE LIST");
+ textwin_show_string(0, NDI_COLR_WHITE, "--------------------------");
for (node = ignore_list_start;node;i++, node = node->next)
{
- textwin_showstring(0, NDI_COLR_WHITE, "%s.%s", (node->type) ? node->type : "*", node->name);
+ textwin_show_string(0, NDI_COLR_WHITE, "%s.%s", (node->type) ? node->type : "*", node->name);
}
}
@@ -166,7 +166,7 @@
for (node = ignore_list_start;node;node = node->next)
{
-// textwin_showstring(0, NDI_COLR_WHITE, "compare >%s< with >%s< (%s with %s)", name, node->name,type, node->type);
+// textwin_show_string(0, NDI_COLR_WHITE, "compare >%s< with >%s< (%s with %s)", name, node->name,type, node->type);
if (!stricmp(name, node->name) && ((!stricmp(type,node->type)) || (!node->type[0])))
return 1;
}
@@ -201,15 +201,15 @@
*/
if (sscanf(cmd,"%s %s",name, type)==EOF)
{
- textwin_showstring(0, NDI_COLR_WHITE,"Syntax: /ignore <name> <'channel'>");
- textwin_showstring(0, NDI_COLR_WHITE,"Syntax: /ignore <name> * for all 'channels'");
- textwin_showstring(0, NDI_COLR_WHITE,"channel can be somthing like: 'say', 'shout', 'tell', 'emote'");
+ textwin_show_string(0, NDI_COLR_WHITE,"Syntax: /ignore <name> <'channel'>");
+ textwin_show_string(0, NDI_COLR_WHITE,"Syntax: /ignore <name> * for all 'channels'");
+ textwin_show_string(0, NDI_COLR_WHITE,"channel can be somthing like: 'say', 'shout', 'tell', 'emote'");
}
else if ((name[0]=='\0') || (type[0]=='\0'))
{
- textwin_showstring(0, NDI_COLR_WHITE,"Syntax: /ignore <name> <'channel'>");
- textwin_showstring(0, NDI_COLR_WHITE,"Syntax: /ignore <name> * for all 'channels'");
- textwin_showstring(0, NDI_COLR_WHITE,"channel can be somthing like: 'say', 'shout', 'tell', 'emote'");
+ textwin_show_string(0, NDI_COLR_WHITE,"Syntax: /ignore <name> <'channel'>");
+ textwin_show_string(0, NDI_COLR_WHITE,"Syntax: /ignore <name> * for all 'channels'");
+ textwin_show_string(0, NDI_COLR_WHITE,"channel can be somthing like: 'say', 'shout', 'tell', 'emote'");
}
else
@@ -233,12 +233,12 @@
if (ignore_check(name, type) )
{
ignore_entry_remove(name, type);
- textwin_showstring(0, NDI_COLR_WHITE, "removed %s (%s) from ignore list.", name, type);
+ textwin_show_string(0, NDI_COLR_WHITE, "removed %s (%s) from ignore list.", name, type);
}
else
{
ignore_entry_add(name, type);
- textwin_showstring(0, NDI_COLR_WHITE, "added %s (%s) to ignore list.", name, type);
+ textwin_show_string(0, NDI_COLR_WHITE, "added %s (%s) to ignore list.", name, type);
}
ignore_list_save();
Modified: trunk/client/src/include/commands.h
===================================================================
--- trunk/client/src/include/commands.h 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/include/commands.h 2011-12-23 11:11:28 UTC (rev 6583)
@@ -64,6 +64,7 @@
#define NDI_FLAG_ALL (1 << 17) // to all players
#define NDI_FLAG_EAVESDROP (1 << 18) // GM/SA listening in
#define NDI_FLAG_BUDDY (1 << 19) // from buddy
+#define NDI_FLAG_CHANNEL (1 << 20) // channel
extern void DoClient(void);
Modified: trunk/client/src/include/main.h
===================================================================
--- trunk/client/src/include/main.h 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/include/main.h 2011-12-23 11:11:28 UTC (rev 6583)
@@ -135,9 +135,11 @@
/* Visual */
int video_bpp;
int fullscreen;
- int use_TextwinSplit;
- int use_TextwinAlpha;
int textwin_alpha;
+ int textwin_msg_font;
+ int textwin_chat_font;
+ int textwin_indentation;
+ int textwin_scrollback;
int resolution;
int mapstart_x;
int mapstart_y;
@@ -152,16 +154,16 @@
int warning_weight;
int show_tooltips;
int show_d_key_infos; /* key-infos in dialog-wins. */
- int smileys;
+ int textwin_use_smileys;
int channelformat;
int collectAll;
- int chatfilter; /* true: filter chatmessages */
+ int textwin_use_chatfilter; /* true: filter chatmessages */
int hp_bar; /* show hp-bar */
int hp_percent; /* show hp in % */
int hp_color; /* color bar and % */
int iExpDisplay; /* robed's extended exp-display */
int kerbholz; /* use kill stats */
- int msglog; /* log-options */
+ int textwin_use_logging; /* log-options */
int playerdoll;
int statometer;
int statsupdate;
Modified: trunk/client/src/include/skin.h
===================================================================
--- trunk/client/src/include/skin.h 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/include/skin.h 2011-12-23 11:11:28 UTC (rev 6583)
@@ -37,7 +37,6 @@
SKIN_SPRITE_PROGRESS_BACK,
SKIN_SPRITE_BLACKTILE,
SKIN_SPRITE_GRID,
- SKIN_SPRITE_TEXTWIN,
SKIN_SPRITE_LOGIN_INP,
SKIN_SPRITE_HP,
SKIN_SPRITE_SP,
@@ -132,7 +131,7 @@
SKIN_SPRITE_DIALOG_RANGE_R,
SKIN_SPRITE_TARGET_HP,
SKIN_SPRITE_TARGET_HP_B,
- SKIN_SPRITE_TEXTWIN_MASK,
+ SKIN_SPRITE_ALPHA,
SKIN_SPRITE_SLIDER_UP,
SKIN_SPRITE_SLIDER_DOWN,
SKIN_SPRITE_SLIDER,
@@ -199,6 +198,7 @@
{
uint32 chat_admin;
uint32 chat_buddy;
+ uint32 chat_channel;
uint32 chat_eavesdrop;
uint32 chat_emote;
uint32 chat_gsay;
Modified: trunk/client/src/include/textwin.h
===================================================================
--- trunk/client/src/include/textwin.h 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/include/textwin.h 2011-12-23 11:11:28 UTC (rev 6583)
@@ -24,76 +24,106 @@
#ifndef __TEXTWIN_H
#define __TEXTWIN_H
-#define TEXT_WIN_MAX 250
-#define MAX_KEYWORD_LEN 256
+#define TEXTWIN_BUFSIZE 250
-enum
+/* The size of the resizing borders. */
+#define TEXTWIN_ACTIVE_MIN 2
+#define TEXTWIN_ACTIVE_MAX 16
+
+/* Resizing limits. Min values are arbitrary, max must be <= the size of the
+ * bitmaps. */
+#define TEXTWIN_WIDTH_MIN 100
+#define TEXTWIN_HEIGHT_MIN 50
+#define TEXTWIN_WIDTH_MAX 1280
+#define TEXTWIN_HEIGHT_MAX 1280
+
+/* Flags. */
+#define TEXTWIN_FLAG_RESIZE (1 << 1)
+#define TEXTWIN_FLAG_SCROLL (1 << 2)
+
+typedef enum textwin_id_t
{
- TW_MIX,
- TW_MSG,
- TW_CHAT,
- TW_SUM
-}; /* windows */
-enum
+ TEXTWIN_CHAT_ID,
+ TEXTWIN_MSG_ID,
+
+ TEXTWIN_NROF
+}
+textwin_id_t;
+
+typedef enum textwin_event_t
{
TW_CHECK_BUT_DOWN,
TW_CHECK_BUT_UP,
- TW_CHECK_MOVE
-}; /* events */
-enum
+ TW_CHECK_MOVE,
+}
+textwin_event_t;
+
+typedef enum textwin_resizing_dir_t
{
+ TEXTWIN_RESIZING_DIR_NONE,
+ TEXTWIN_RESIZING_DIR_UP,
+ TEXTWIN_RESIZING_DIR_UPRIGHT,
+ TEXTWIN_RESIZING_DIR_RIGHT,
+ TEXTWIN_RESIZING_DIR_DOWNRIGHT,
+ TEXTWIN_RESIZING_DIR_DOWN,
+ TEXTWIN_RESIZING_DIR_DOWNLEFT,
+ TEXTWIN_RESIZING_DIR_LEFT,
+ TEXTWIN_RESIZING_DIR_UPLEFT
+}
+textwin_resizing_dir_t;
+
+typedef enum textwin_highlight_t
+{
TW_HL_NONE,
TW_HL_UP,
TW_ABOVE,
TW_HL_SLIDER,
TW_UNDER,
- TW_HL_DOWN
-};
-enum
-{
- TW_ACTWIN = 0x0f,
- TW_SCROLL = 0x10,
- TW_RESIZE = 0x20
-}; /* flags */
+ TW_HL_DOWN,
+}
+textwin_highlight_t;
-
-typedef struct _text_buf
+typedef struct textwin_text_t
{
- char buf[128]; /* text */
- int channel; /* which channel */
- uint32 flags; /* some flags */
- uint32 colr; /* color of text */
- int key_clipped; /* 1= key begin in row before 2= no key end */
+ char buf[MEDIUM_BUF]; // text
+ int channel; // which channel
+ uint32 flags; // some flags
+ uint32 fg; // color of text
+ uint32 bg; // color of bg
}
-_text_buf;
+textwin_text_t;
-typedef struct _textwin_set
+typedef struct textwin_window_t
{
- int x, y; /* startpos of the window */
- int size; /* number or printed textlines */
- int scroll; /* scroll offset */
- int top_drawLine; /* first printed textline */
- int bot_drawLine; /* last printed textline */
- int act_bufsize; /* 0 ... TEXTWIN_MAX */
- int slider_h; /* height of the scrollbar-slider */
- int slider_y; /* start pos of the scrollbar-slider */
- int highlight; /* which part to highlight */
- _text_buf text[TEXT_WIN_MAX];
+ uint16 x, y; // startpos of the window
+ uint32 flags; // flags
+ widget_id_t widget; // wID assocoiated with this TW
+ uint16 maxstringlen; // max length of string in pixels
+ int slider_h; // height of the scrollbar-slider
+ int slider_y; // start pos of the scrollbar-slider
+ textwin_resizing_dir_t resize;
+ textwin_highlight_t highlight; // which part to highlight
+ uint32 scroll_off; // scroll offset
+ uint32 scroll_size; // max size of scroll buffer
+ uint32 scroll_used; // position in scroll buffer
+ uint32 scroll_pos; // last printed textline
+ uint32 size; // number or printed textlines
+ _font *font; // the font used in this window
+ textwin_text_t *text;
}
-_textwin_set;
+textwin_window_t;
-extern int txtwin_start_size; /* we need a backup of the TW_MIX.size */
-extern _textwin_set txtwin[TW_SUM];
-extern SDL_Surface *txtwinbg;
-extern int textwin_flags;
-extern void textwin_button_event(int actWin, widget_id_t id, SDL_Event *event);
-extern int textwin_move_event(int actWin, widget_id_t id, SDL_Event *event);
-extern void textwin_show(int x, int y);
-extern void textwin_init();
-extern void textwin_showstring(uint32 flags, uint32 colr, char *format, ...);
-extern void textwin_addhistory(char *text);
-extern void textwin_clearhistory();
-extern void textwin_putstring(char *text);
-extern void widget_textwin_show(int x, int y, int actWin);
+extern textwin_window_t textwin[TEXTWIN_NROF];
+extern void textwin_init(textwin_id_t id);
+extern void textwin_set_font(textwin_id_t id);
+extern void textwin_show_string(uint32 flags, uint32 colr, char *format, ...);
+extern void textwin_show_window(textwin_id_t id);
+extern void textwin_event(textwin_event_t e, SDL_Event *event,
+ textwin_id_t id);
+extern void textwin_keypress(SDLKey key, textwin_id_t id);
+extern void textwin_add_history(char *text);
+extern void textwin_clear_history(void);
+extern void textwin_put_string(char *text);
+
#endif /* ifndef __TEXTWIN_H */
Modified: trunk/client/src/interface.c
===================================================================
--- trunk/client/src/interface.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/interface.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -529,7 +529,7 @@
gui_npc->input_flag = 1;
reset_keys();
open_input_mode(240);
- textwin_putstring(gui_npc->textfield->command);
+ textwin_put_string(gui_npc->textfield->command);
cpl.input_mode = INPUT_MODE_NPCDIALOG;
HistoryPos = 0;
}
@@ -552,7 +552,7 @@
static void BadInterfaceString(char *data, uint16 pos)
{
- textwin_showstring(0, NDI_COLR_RED, "ERROR: bad interface string (flag start error)");
+ textwin_show_string(0, NDI_COLR_RED, "ERROR: bad interface string (flag start error)");
LOG(LOG_ERROR, "ERROR: bad command tag: %s\n", data + pos);
gui_npc_reset();
}
@@ -3275,7 +3275,7 @@
if (gui_npc->status != GUI_NPC_STATUS_WAIT)
{
client_cmd_guitalk(interface_mode, buf);
- textwin_addhistory(buf);
+ textwin_add_history(buf);
reset_keys();
reset_input_mode();
cpl.input_mode = INPUT_MODE_NO;
@@ -3778,7 +3778,7 @@
reset_keys();
reset_input_mode();
open_input_mode(240);
- textwin_putstring("");
+ textwin_put_string("");
cpl.input_mode = INPUT_MODE_NPCDIALOG;
gui_npc->input_flag = 1;
HistoryPos = 0;
Modified: trunk/client/src/item.c
===================================================================
--- trunk/client/src/item.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/item.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -784,14 +784,14 @@
if (l == 0)
{
- textwin_showstring(0, NDI_COLR_WHITE, "BB AA %s's inventory (%d): %6.1f kg",
+ textwin_show_string(0, NDI_COLR_WHITE, "BB AA %s's inventory (%d): %6.1f kg",
op->d_name, op->tag, (float)op->weight);
}
l += 2;
for (tmp = op->inv; tmp; tmp = tmp->next)
{
- textwin_showstring(0, NDI_COLR_WHITE, "CC %*s- %d %s%s (%d)",
+ textwin_show_string(0, NDI_COLR_WHITE, "CC %*s- %d %s%s (%d)",
l - 2, "", tmp->nrof, tmp->d_name, tmp->flags,
tmp->tag);
Modified: trunk/client/src/kerbholz.c
===================================================================
--- trunk/client/src/kerbholz.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/kerbholz.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -117,18 +117,18 @@
int i = 0;
/* trim string - remove all white spaces */
- textwin_showstring(0, NDI_COLR_WHITE,
+ textwin_show_string(0, NDI_COLR_WHITE,
"\n KILLS LIST %s\n"\
"------------------------------------------",
(type == 1) ? "SESSION" : "TOTAL");
for (; node; i++, node = node->next)
{
- textwin_showstring(0, NDI_COLR_WHITE, "%4d/%12d ... %s",
+ textwin_show_string(0, NDI_COLR_WHITE, "%4d/%12d ... %s",
node->session, node->kills, node->name);
}
- textwin_showstring(0, NDI_COLR_WHITE, "\n%d different monsters killed.", i);
+ textwin_show_string(0, NDI_COLR_WHITE, "\n%d different monsters killed.", i);
}
/* clear the list, free all memory */
Modified: trunk/client/src/main.c
===================================================================
--- trunk/client/src/main.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/main.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -215,14 +215,9 @@
int i;
memset(&global_buttons,-1, sizeof(button_status));
-
- textwin_init();
- textwin_flags = 0;
first_server_char = NULL;
-
esc_menu_flag = 0;
srand((uint32) time(NULL));
-
memset(animcmd, 0, sizeof(animcmd));
memset(animation, 0, sizeof(animation));
ToggleScreenFlag = 0;
@@ -238,17 +233,15 @@
for (i = 0; i < SKIN_SPRITE_NROF; i++)
skin_sprites[i] = NULL;
+
memset(face_list, 0, sizeof(face_list));
memset(&cpl, 0, sizeof(cpl));
cpl.ob = player_item();
-
init_keys();
init_player_data();
clear_metaserver_data();
reset_input_mode();
-
start_anim = NULL; /* anim queue of current active map */
-
clear_group();
interface_mode = GUI_NPC_MODE_NO;
map_transfer_flag = 0;
@@ -258,11 +251,9 @@
argServerName[0] = 0;
argServerPort = DEFAULT_SERVER_PORT;
SoundSystem = SOUND_SYSTEM_OFF;
-
GameStatus = GAME_STATUS_INIT;
GameStatusSelect = GAME_STATUS_LOGIN_ACCOUNT;
LoginInputStep = LOGIN_STEP_NOTHING;
-
#ifdef DAI_DEVELOPMENT
ShowLocalServer = 1;
#else
@@ -280,26 +271,18 @@
gui_npc = NULL;
gui_interface_book = NULL;
LoginInputStep = LOGIN_STEP_NAME;
-
options.cli_account[0] = '\0';
options.cli_pass[0] = '\0';
options.cli_server = -1;
options.cli_addons[0] = '\0';
-
options.resolution = 0;
options.channelformat=0;
-
options.playerdoll = 0;
options.sleepcounter = 0;
options.zoom=100;
options.speedup = 0;
options.mapstart_x = -10;
options.mapstart_y = 100;
- options.use_TextwinSplit = 1;
- txtwin[TW_MIX].size = 50;
- txtwin[TW_MSG].size = 22;
- txtwin[TW_CHAT].size = 22;
-
// options.statometer=1;
options.statsupdate=5;
options.firststart=1;
@@ -310,17 +293,13 @@
options.no_meta=0;
MALLOC_STRING(options.metaserver, "www.daimonin.org");
options.metaserver_port = DEFAULT_METASERVER_PORT;
- txtwin_start_size = txtwin[TW_MIX].size;
-// txtwin[TW_MIX].size=50;
options.anim_frame_time = 50;
options.anim_check_time = 50;
options.worst_fps = 666;
-
memset(media_file, 0, sizeof(_media_file) * MEDIA_MAX);
media_count = 0; /* buffered media files*/
media_show = MEDIA_SHOW_NO; /* show this media file*/
-
- textwin_clearhistory();
+ textwin_clear_history();
server_level.exp[1]=2500; /* dummy value for startup */
}
@@ -354,9 +333,9 @@
}
/* the %-settings are settings which (should) not shown in options win */
- sprintf(buf, "%%21 %d\n", txtwin[TW_MSG].size);
+ sprintf(buf, "%%21 %d\n", textwin[TEXTWIN_MSG_ID].size);
PHYSFS_writeString(handle, buf);
- sprintf(buf, "%%22 %d\n", txtwin[TW_CHAT].size);
+ sprintf(buf, "%%22 %d\n", textwin[TEXTWIN_CHAT_ID].size);
PHYSFS_writeString(handle, buf);
while (opt_tab[++i])
@@ -468,10 +447,10 @@
switch (line[2])
{
case '1':
- txtwin[TW_MSG].size=atoi(line+4);
+ textwin[TEXTWIN_MSG_ID].size = atoi(line + 4);
break;
case '2':
- txtwin[TW_CHAT].size=atoi(line+4);
+ textwin[TEXTWIN_CHAT_ID].size = atoi(line + 4);
break;
}
continue;
@@ -669,7 +648,7 @@
break;
default:
- textwin_showstring(0, NDI_COLR_RED, "Unknown server! See --help for a list of valid server numbers.");
+ textwin_show_string(0, NDI_COLR_RED, "Unknown server! See --help for a list of valid server numbers.");
}
}
@@ -685,14 +664,14 @@
{
if (!SOCKET_OpenClientSocket(&csocket, ServerName, ServerPort))
{
- textwin_showstring(0, NDI_COLR_SILVER, "Connect to server %s:%d... ~FAILED~!",
+ textwin_show_string(0, NDI_COLR_SILVER, "Connect to server %s:%d... ~FAILED~!",
ServerName, ServerPort);
GameStatus = GAME_STATUS_START;
}
else
{
socket_thread_start();
- textwin_showstring(0, NDI_COLR_SILVER, "Connect to server %s:%d... ~OK~!",
+ textwin_show_string(0, NDI_COLR_SILVER, "Connect to server %s:%d... ~OK~!",
ServerName, ServerPort);
GameStatus = GAME_STATUS_SETUP;
}
@@ -787,7 +766,8 @@
}
else
{
- textwin_clearhistory();
+ textwin_clear_history();
+
if (InputStringEscFlag)
GameStatus = GAME_STATUS_LOGIN_BREAK;
else if (InputStringFlag == 0 && InputStringEndFlag == 1)
@@ -880,7 +860,7 @@
}
else /* that must be LoginInputStep == LOGIN_STEP_PASS1 */
{
- textwin_clearhistory();
+ textwin_clear_history();
/* autologin */
if (options.cli_pass[0])
@@ -1074,7 +1054,7 @@
/* skip if --nometa in command line */
if (!options.metaserver)
{
- textwin_showstring(0, NDI_COLR_OLIVE, "Metaserver ignored.");
+ textwin_show_string(0, NDI_COLR_OLIVE, "Metaserver ignored.");
}
else
{
@@ -1084,12 +1064,12 @@
options.metaserver_port) &&
read_metaserver_data(meta))
{
- textwin_showstring(0, NDI_COLR_SILVER, "Query metaserver (%s:%d)... ~OK~!",
+ textwin_show_string(0, NDI_COLR_SILVER, "Query metaserver (%s:%d)... ~OK~!",
options.metaserver, options.metaserver_port);
}
else
{
- textwin_showstring(0, NDI_COLR_SILVER, "Query metaserver (%s:%d)... ~FAILED~ (using default list)!",
+ textwin_show_string(0, NDI_COLR_SILVER, "Query metaserver (%s:%d)... ~FAILED~ (using default list)!",
options.metaserver, options.metaserver_port);
add_metaserver_data("Main", "daimonin.game-server.cc",
DEFAULT_SERVER_PORT, -1, "UNKNOWN",
@@ -1107,14 +1087,14 @@
metaserver_sel = start_server;
locator_init(330, 248);
- textwin_showstring(0, NDI_COLR_SILVER, "Select a server.");
+ textwin_show_string(0, NDI_COLR_SILVER, "Select a server.");
}
void show_ping_string(_server *node)
{
if (node)
{
- textwin_showstring(0, NDI_COLR_WHITE, "There %s %d player%s online.\n\n%s",
+ textwin_show_string(0, NDI_COLR_WHITE, "There %s %d player%s online.\n\n%s",
(node->player == 1) ? "is" : "are",
MAX(0, node->player),
(node->player == 1) ? "" : "s",
@@ -1514,15 +1494,18 @@
skin_load_bitmaps(SKIN_SPRITE_PROGRESS_BACK);
font_init();
ShowIntro("initialise fonts", 0);
- ShowIntro("load bitmaps", 10);
+ ShowIntro("load skin", 10);
skin_load_bitmaps(SKIN_SPRITE_NROF);
skin_load_prefs();
- ShowIntro("start sound system", 55);
+ ShowIntro("initialise sfx & music", 50);
sound_init();
ShowIntro("load keys", 70);
read_keybind_file();
ShowIntro("load mpart positioning data", 80);
LoadArchdef();
+ ShowIntro("initialise textwindows", 90);
+ textwin_init(TEXTWIN_MSG_ID);
+ textwin_init(TEXTWIN_CHAT_ID);
ShowIntro(NULL, 100);
sound_play_music("orchestral.ogg", options.music_volume, 0, -1, 0, MUSIC_MODE_DIRECT);
sprite_init_system();
@@ -1533,7 +1516,7 @@
}
else
{
- textwin_showstring(0, NDI_COLR_SILVER, "Init network... ~OK~!");
+ textwin_show_string(0, NDI_COLR_SILVER, "Init network... ~OK~!");
QueryMetaserver();
options.no_meta = 1; // don't do it again in GAME_STATUS_META
}
@@ -1686,8 +1669,20 @@
} /* map update */
if (GameStatus < GAME_STATUS_WAITFORPLAY)
- textwin_show(539, 485);
+ {
+ const uint16 x1 = widget_data[WIDGET_MSGWIN_ID].x1,
+ y1 = widget_data[WIDGET_MSGWIN_ID].y1,
+ ht = widget_data[WIDGET_MSGWIN_ID].ht;
+ widget_data[WIDGET_MSGWIN_ID].x1 = 539;
+ widget_data[WIDGET_MSGWIN_ID].y1 = 10;
+ widget_data[WIDGET_MSGWIN_ID].ht = Screensize.y - 10 - 10;
+ textwin_show_window(TEXTWIN_MSG_ID);
+ widget_data[WIDGET_MSGWIN_ID].x1 = x1;
+ widget_data[WIDGET_MSGWIN_ID].y1 = y1;
+ widget_data[WIDGET_MSGWIN_ID].ht = ht;
+ }
+
/* if not connected, walk through connection chain and/or wait for action */
if (GameStatus < GAME_STATUS_WAITFORPLAY)
{
@@ -1771,7 +1766,7 @@
if (GameStatus == GAME_STATUS_PLAY && newplayer == 1)
{
newplayer = 0;
- textwin_showstring(0, NDI_COLR_WHITE,
+ textwin_show_string(0, NDI_COLR_WHITE,
"|Welcome to Daimonin, %s -- WHAT NOW?|\n"\
"As this is your first time playing, you may be asking this question.\n"\
"The character nearby is called ~Fanrir~. His job is to help new players get started in the game. You should talk to him. Do this by pressing the ~T key.\n"\
@@ -2391,7 +2386,7 @@
else
{
string_blt(ScreenSurface, &font_small, "** Press Key **", x+375, y+585, NDI_COLR_WHITE, NULL, NULL);
- textwin_showstring(0, NDI_COLR_SILVER, "Welcome to |Daimonin| ~v%d.%d.%d~",
+ textwin_show_string(0, NDI_COLR_SILVER, "Welcome to |Daimonin| ~v%d.%d.%d~",
DAI_VERSION_RELEASE, DAI_VERSION_MAJOR,
DAI_VERSION_MINOR);
}
Modified: trunk/client/src/map.c
===================================================================
--- trunk/client/src/map.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/map.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -615,7 +615,7 @@
xmpos = xpos - face_mpart_id[mid].part[mnr].xoff;
xl += xmpos;
-// textwin_showstring(0, NDI_COLR_RED, "ID:%d NR:%d yoff:%d yl:%d",
+// textwin_show_string(0, NDI_COLR_RED, "ID:%d NR:%d yoff:%d yl:%d",
// mid, mnr,
// face_mpart_id[mid].part[mnr].yoff,
// yl);
Modified: trunk/client/src/menu.c
===================================================================
--- trunk/client/src/menu.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/menu.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -63,7 +63,7 @@
sound_play_effect(SOUNDTYPE_CLIENT, SOUND_CONSOLE, 0, 0, 100);
if (InputString[0])
{
-// textwin_showstring(0, NDI_COLR_OLIVE, ":%s", InputString);
+// textwin_show_string(0, NDI_COLR_OLIVE, ":%s", InputString);
client_cmd_generic(InputString);
}
@@ -114,7 +114,7 @@
else
sound_play_effect(SOUNDTYPE_NORMAL, SOUND_DROP, 0, 0, 100);
- textwin_showstring(0, skin_prefs.widget_info, "%s %d from %d %s",
+ textwin_show_string(0, skin_prefs.widget_info, "%s %d from %d %s",
(cpl.nummode == NUM_MODE_GET) ? "get" :
"drop", tmp, cpl.nrof, cpl.num_text);
}
@@ -177,7 +177,7 @@
if (InputString[0])
{
client_cmd_guitalk(GUI_NPC_MODE_NPC, InputString);
- textwin_addhistory(InputString);
+ textwin_add_history(InputString);
reset_input_mode();
gui_npc->status = GUI_NPC_STATUS_WAIT;
}
@@ -879,12 +879,12 @@
if (!locate_item_from_inv(cpl.ob->inv, cpl.win_quick_tag))
{
sound_play_effect(SOUNDTYPE_CLIENT, SOUND_CLICKFAIL, 0, 0, 100);
- textwin_showstring(0, skin_prefs.widget_info, "Only items from main inventory allowed in quickbar!");
+ textwin_show_string(0, skin_prefs.widget_info, "Only items from main inventory allowed in quickbar!");
}
else
{
sound_play_effect(SOUNDTYPE_CLIENT, SOUND_GET, 0, 0, 100); /* no bug - we 'get' it in quickslots */
- textwin_showstring(0, skin_prefs.widget_info, "set F%d to %s",
+ textwin_show_string(0, skin_prefs.widget_info, "set F%d to %s",
ind + 1,
locate_item(cpl.win_quick_tag)->s_name);
}
Modified: trunk/client/src/misc.c
===================================================================
--- trunk/client/src/misc.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/misc.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -180,7 +180,7 @@
{
#ifdef DAI_DEVELOPMENT
if ((int)strlen(buf)>maxlen)
- textwin_showstring(0, NDI_COLR_RED,"FixMe: Interface parameter string out of bounds!");
+ textwin_show_string(0, NDI_COLR_RED,"FixMe: Interface parameter string out of bounds!");
#endif
buf[maxlen-1]='\0';
}
@@ -327,7 +327,7 @@
send_mark_obj((it = locate_item(tag)));
if (it)
{
- textwin_showstring(0, NDI_COLR_OLIVE, "%s %s",
+ textwin_show_string(0, NDI_COLR_OLIVE, "%s %s",
(cpl.mark_count == (int)it->tag) ? "unmark" : "mark",
it->s_name);
}
Modified: trunk/client/src/player.c
===================================================================
--- trunk/client/src/player.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/player.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -546,7 +546,7 @@
else if (draggingInvItem(DRAG_GET_STATUS) == DRAG_IWIN_INV)
{
if ((locate_item(cpl.win_inv_tag))->applied)
- textwin_showstring(0, skin_prefs.widget_info, "This is applied already!");
+ textwin_show_string(0, skin_prefs.widget_info, "This is applied already!");
else
process_macro_keys(KEYFUNC_APPLY, 0); /* drop to player-doll */
}
Modified: trunk/client/src/skin.c
===================================================================
--- trunk/client/src/skin.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/skin.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -37,7 +37,6 @@
"progress_back.png",
"black_tile.png",
"grid.png",
- "textwin.png",
"login_inp.png",
"hp.png",
"sp.png",
@@ -132,7 +131,7 @@
"dialog_range_r.png",
"target_hp.png",
"target_hp_b.png",
- "textwin_mask.png",
+ "alpha.png",
"slider_up.png",
"slider_down.png",
"slider.png",
@@ -241,6 +240,7 @@
/* first we fill with default values */
skin_prefs.chat_admin = NDI_COLR_RED;
skin_prefs.chat_buddy = NDI_COLR_SILVER;
+ skin_prefs.chat_channel = NDI_COLR_MAROON;
skin_prefs.chat_eavesdrop = NDI_COLR_FUSCHIA;
skin_prefs.chat_emote = NDI_COLR_TEAL;
skin_prefs.chat_gsay = NDI_COLR_YELLOW;
@@ -318,6 +318,10 @@
{
skin_prefs.chat_buddy = (uint32)strtoul(val, NULL, 16);
}
+ else if (!strcmp(key, "chat_channel"))
+ {
+ skin_prefs.chat_channel = (uint32)strtoul(val, NULL, 16);
+ }
else if (!strcmp(key, "chat_eavesdrop"))
{
skin_prefs.chat_eavesdrop = (uint32)strtoul(val, NULL, 16);
Modified: trunk/client/src/sound.c
===================================================================
--- trunk/client/src/sound.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/sound.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -382,7 +382,7 @@
if (!music.data)
{
#ifdef DAI_DEVELOPMENT
- textwin_showstring(0, NDI_COLR_LIME, "mix_loadmus() failed (%s).", buf);
+ textwin_show_string(0, NDI_COLR_LIME, "mix_loadmus() failed (%s).", buf);
#endif
return;
}
Modified: trunk/client/src/sprite.c
===================================================================
--- trunk/client/src/sprite.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/sprite.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -978,8 +978,8 @@
/* we create the filter surfaces only when needed, and then store them */
if (!darkness_filter[bltfx->dark_level])
{
- SDL_SetAlpha(skin_sprites[SKIN_SPRITE_TEXTWIN_MASK]->bitmap,SDL_SRCALPHA,dark_alpha[bltfx->dark_level]);
- darkness_filter[bltfx->dark_level]=SDL_DisplayFormatAlpha(skin_sprites[SKIN_SPRITE_TEXTWIN_MASK]->bitmap);
+ SDL_SetAlpha(skin_sprites[SKIN_SPRITE_ALPHA]->bitmap,SDL_SRCALPHA,dark_alpha[bltfx->dark_level]);
+ darkness_filter[bltfx->dark_level]=SDL_DisplayFormatAlpha(skin_sprites[SKIN_SPRITE_ALPHA]->bitmap);
}
/* we use now the stretch_cache with lru list */
Modified: trunk/client/src/textwin.c
===================================================================
--- trunk/client/src/textwin.c 2011-12-22 20:50:30 UTC (rev 6582)
+++ trunk/client/src/textwin.c 2011-12-23 11:11:28 UTC (rev 6583)
@@ -20,785 +20,1321 @@
The author can be reached via e-mail to info@...
*/
-#include <include.h>
-/* this depends on the text win png*/
-#define TEXT_WIN_XLEN 265
-#define TEXT_WIN_YLEN 190
+#include "include.h"
-int textwin_flags;
-int txtwin_start_size = 0;
-_textwin_set txtwin[TW_SUM];
-static int old_slider_pos = 0;
-SDL_Surface *txtwinbg = NULL;
-int old_txtwin_alpha = -1;
+static uint16 OldSliderPos = 0;
-/* TODO: All this to be removed, please ignore it. Hypertext (keywords) ONLY
- * available in NPC and book GUIs.
- * -- Smacky 20100711 */
-/******************************************************************
- definition of keyword:
- a keyword is the text between two '^' chars.
- the size can vary between a single word and a complete sentence.
- the max length of a keyword is 1 row (inclusive '^') because only
- one LF within is allowed.
-******************************************************************/
+textwin_window_t textwin[TEXTWIN_NROF];
-/******************************************************************
- returns the startpos of a keyword(-part).
-******************************************************************/
-static char * get_keyword_start(int actWin, int mouseX, int *row)
+static void GrepForStatometer(char *message);
+static void ConvertSmileys(char *message);
+static void AddLine(textwin_window_t *tw, const uint32 flags, const uint32 colr,
+ const uint8 indent, const uint8 strong, const uint8 emphasis,
+ const uint8 intertitle, const char *message);
+static void ShowWindowResizingBorders(textwin_window_t *tw, _BLTFX *bltfx);
+static void ShowWindowText(textwin_window_t *tw, _BLTFX *bltfx);
+static void ShowWindowScrollbar(textwin_window_t *tw, _BLTFX *bltfx);
+static void ShowWindowFrame(textwin_window_t *tw, _BLTFX *bltfx);
+static uint8 ScrollWindow(textwin_window_t *tw, const sint16 dist);
+static void ResizeWindow(textwin_window_t *tw, const sint16 xrel, const sint16 yrel);
+
+void textwin_init(textwin_id_t id)
{
- int pos, pos2 = 538, key_start;
- char *text;
+ textwin_window_t *tw = &textwin[id];
+ textwin_text_t *text;
- if (actWin >= TW_SUM)
- return 0;
-
- pos = (txtwin[actWin].top_drawLine + (*row)) % TEXT_WIN_MAX - txtwin[actWin].scroll;
- if (pos < 0)
- pos += TEXT_WIN_MAX;
- if (mouseX < 0)
- goto row2; /* check only for 2. half of keyword */
- /* check if keyword starts in the row before */
- if (txtwin[actWin].scroll + 1 != txtwin[actWin].act_bufsize - txtwin[actWin].size /* dont check in first row */
- && txtwin[actWin].text[pos].key_clipped)
+ if (id == TEXTWIN_CHAT_ID)
{
- /* was a clipped keyword clicked? */
- int index = -1;
- text = txtwin[actWin].text[pos].buf;
- while (text[++index] && pos2 <= mouseX && text[index] != '^')
- pos2 += font_small.c[(int) text[index]].w + font_small.char_offset;
- if (text[index] != '^')
- {
- /* clipped keyword was clicked, so we must start one row before */
- /* TODO not start one row before if its the first row in buffer ! */
- (*row)--;
- pos = (txtwin[actWin].top_drawLine + (*row)) % TEXT_WIN_MAX - txtwin[actWin].scroll;
- if (pos < 0)
- pos += TEXT_WIN_MAX;
- mouseX = 800; /* detect last keyword in this row */
- }
+ tw->widget = WIDGET_CHATWIN_ID;
}
-
-row2 : text = txtwin[actWin].text[pos].buf;
- /* find the first char of the keyword */
- if (txtwin[actWin].text[pos].key_clipped)
- key_start = 0;
+ else if (id == TEXTWIN_MSG_ID)
+ {
+ tw->widget = WIDGET_MSGWIN_ID;
+ }
else
- key_start = -1;
- pos = 0; pos2 = 538;
- while (text[pos] && pos2 <= mouseX)
{
- if (text[pos++] == '^')
- {
- if (key_start < 0)
- key_start = pos; /* start of a key */
- else
- key_start = -1; /* end of a key */
- continue;
- }
- pos2 += font_small.c[(int) text[pos]].w + font_small.char_offset;
+ return;
}
- if (key_start < 0)
- return NULL; /* no keyword here */
- (*row)++;
- return &text[key_start];
+
+ tw->scroll_pos = 0;
+ tw->scroll_off = 0;
+ tw->maxstringlen = widget_data[tw->widget].wd -
+ (skin_sprites[SKIN_SPRITE_SLIDER]->bitmap->w * 2) -
+ (TEXTWIN_ACTIVE_MIN * 2);
+ tw->scroll_size = options.textwin_scrollback;
+ tw->scroll_used = 0;
+ MALLOC(text, sizeof(textwin_text_t) * tw->scroll_size);
+ tw->text = text;
+ textwin_set_font(id);
}
-/******************************************************************
- check for keyword and send it to server.
-******************************************************************/
-void say_clickedKeyword(int actWin, int mouseX, int mouseY)
+void textwin_set_font(textwin_id_t id)
{
- char cmdBuf[MAX_KEYWORD_LEN + 1] =
- {
- "/say "
- };
- char cmdBuf2[MAX_KEYWORD_LEN + 1] =
- {
- ""
- };
- char *text;
- int clicked_row, pos = 5;
+ textwin_window_t *tw = &textwin[id];
- clicked_row = (mouseY - 588) / 10 + txtwin[actWin].size;
- text = get_keyword_start(actWin, mouseX, &clicked_row);
- if (text == NULL)
- return;
- while (*text && *text != '^')
- cmdBuf[pos++] = *text++;
- if (*text != '^')
+ switch ((id == TEXTWIN_CHAT_ID) ? options.textwin_chat_font :
+ options.textwin_msg_font)
{
- text = get_keyword_start(actWin, -1, &clicked_row);
- if (text != NULL)
- while (*text && *text != '^')
- cmdBuf[pos++] = *text++;
- }
- cmdBuf[pos++] = '\0';
+ case 0:
+ tw->font = &font_tiny_out;
- /* Grunt: fix for clickable keywords that
- * can be commands too. Commands will
- * get executed instead of /say'ed
- */
+ break;
- if (cmdBuf[5] == '/') // get rid of /say
- {
- pos = 5;
- while (cmdBuf[pos] != '\0')
- {
- cmdBuf2[pos - 5] = cmdBuf[pos];
- pos++;
- }
- cmdBuf2[pos - 5] = '\0';
- client_cmd_generic(cmdBuf2);
- }
- else
- client_cmd_generic(cmdBuf);
-}
+ case 2:
+ tw->font = &font_small_out;
-/******************************************************************
- clear the screen of a text-window.
-******************************************************************/
-void textwin_init()
-{
- int i;
+ break;
- for (i = TW_MIX; i < TW_SUM; i++)
- {
- txtwin[i].bot_drawLine = 0;
- txtwin[i].act_bufsize = 0;
- txtwin[i].scroll = 0;
- txtwin[i].size = 9;
+ case 3:
+ tw->font = &font_medium;
+
+ break;
+
+ case 4:
+ tw->font = &font_medium_out;
+
+ break;
+
+ case 5:
+ tw->font = &font_large_out;
+
+ break;
+
+ default:
+ tw->font = &font_small;
}
+
+ WIDGET_REDRAW(tw->widget) = 1;
}
-/******************************************************************
- add string to the text-window (perform auto-clipping).
-******************************************************************/
-void textwin_showstring(uint32 flags, uint32 colr, char *format, ...)
+void textwin_show_string(uint32 flags, uint32 colr, char *format, ...)
{
- va_list ap;
- static int key_start = 0;
- static int key_count = 0;
- int i, len, a;
- int winlen = 244;
- char buf[HUGE_BUF];
- char *text;
- int actWin, z;
- /* Hmm I'm not 100& sure, if this is the best place for that */
- char *buf2;
- char *enemy1;
- char enemy2[MEDIUM_BUF];
- int newkill=0;
- struct kills_list *node=NULL;
- int tempexp;
- int tempexp2;
+ const textwin_id_t id = (!(flags & NDI_FLAG_PLAYER)) ? TEXTWIN_MSG_ID : TEXTWIN_CHAT_ID;
+ va_list ap;
+ char buf[HUGE_BUF],
+ *start,
+ *c,
+ *space = NULL;
+ textwin_window_t *tw = &textwin[id];
+ uint8 strong = 0,
+ emphasis = 0,
+ intertitle = 0,
+ strong2 = 0,
+ emphasis2 = 0,
+ intertitle2 = 0,
+ old_strong = 0,
+ old_emphasis = 0,
+ old_intertitle = 0,
+ indent = 0;
+ uint16 w = 0;
+ /* Copy the formatted string to a working buffer, buf. */
va_start(ap, format);
vsprintf(buf, format, ap);
va_end(ap);
- if (options.statsupdate)
+#ifdef DEVELOPMENT
+ LOG(LOG_MSG, "RAW: >%s<\n", buf);
+#endif
+
+ /* Here we handle chat... */
+ if (id == TEXTWIN_CHAT_ID)
{
- tempexp=0;
- tempexp2=0;
- if (sscanf(buf,"You got %d exp in skill",&tempexp)!=EOF)
+ /* Log before ignores, chatfilters and so on. */
+ if (options.textwin_use_logging == 1 ||
+ options.textwin_use_logging >= 3)
{
- statometer.exp+=tempexp;
+ MSGLOG(buf);
}
- else if (sscanf(buf,"You got %d (+%d) exp in skill",&tempexp, &tempexp2)!=EOF)
+
+ /* Unless this is an admin communicating in an official capacity, we
+ * can ignore it. This is of course easy to work around. Just replace
+ * the following expression with 1 and recompile to ignore admins too.
+ * But officially they must be heard. */
+ if (!(flags & NDI_FLAG_ADMIN))
{
- statometer.exp+=tempexp;
+ if (((flags & NDI_FLAG_SAY) &&
+ ignore_check(buf, "say")) ||
+ ((flags & NDI_FLAG_SHOUT) &&
+ ignore_check(buf, "shout")) ||
+ ((flags & NDI_FLAG_TELL) &&
+ ignore_check(buf, "tell")) ||
+ ((flags & NDI_FLAG_EMOTE) &&
+ ignore_check(buf, "emote")))
+ {
+ return;
+ }
}
+
+ if (options.textwin_use_chatfilter)
+ {
+ chatfilter_filter(buf); /* Filter incoming msg for f*words */
+ }
+
+ if (buddy_check(buf)) /* Color messages from buddys */
+ {
+ flags |= NDI_FLAG_BUDDY;
+ }
+
+ /* save last incoming tell player for client sided /reply */
+ if ((flags & NDI_FLAG_TELL))
+ {
+ strcpy(cpl.player_reply, buf);
+ }
+
+ /* If the smiley option is on, convert all the smileys. */
+ if (options.textwin_use_smileys)
+ {
+ ConvertSmileys(buf);
+ }
}
+ /* ...And here, messages. */
+ else
+ {
+ GrepForStatometer(buf);
- if (options.statsupdate && !strncmp(buf,"You killed ",11))
- statometer.kills++;
+ if (options.textwin_use_logging >= 2)
+ {
+ MSGLOG(buf);
+ }
+ }
- if (options.kerbholz)
+ for (start = c = buf; *c; c++)
{
- if (!strncmp(buf,"You killed ",11))
+ switch (*c)
{
- enemy1=strstr(buf, " with ");
- if (enemy1!=0)
- {
- strncpy(enemy2,buf+11,enemy1-(buf+11));
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|