|
From: <bl...@us...> - 2008-02-27 13:42:45
|
Revision: 430
http://edu2.svn.sourceforge.net/edu2/?rev=430&view=rev
Author: blackhc
Date: 2008-02-27 05:42:40 -0800 (Wed, 27 Feb 2008)
Log Message:
-----------
Fix a bug in the playermodel code that could cause DP to crash.
Save username and password in a menu registry database.
Improve the subgame descriptions a bit.
Modified Paths:
--------------
edu2/edu2/csprogs.dat
edu2/edu2/csprogs.lno
edu2/edu2/menu.dat
edu2/edu2/menu.lno
edu2/id1/qcsrc/cgame/csqc_constants.qh
edu2/id1/qcsrc/common/geckoterminal.qc
edu2/id1/qcsrc/common/util.qc
edu2/id1/qcsrc/menu/edu2/dialog_gamelist.c
edu2/id1/qcsrc/menu/edu2/dialog_login.c
edu2/id1/qcsrc/menu/edu2/dialog_logout.c
edu2/id1/qcsrc/menu/edu2/gamelist.c
edu2/id1/qcsrc/menu/item/gecko.c
edu2/id1/qcsrc/menu/mbuiltin.qh
edu2/id1/qcsrc/menu/menu.qc
edu2/id1/qcsrc/menu/menu.qh
edu2/id1/qcsrc/menu/nexuiz/playermodel.c
Modified: edu2/edu2/csprogs.dat
===================================================================
(Binary files differ)
Modified: edu2/edu2/csprogs.lno
===================================================================
(Binary files differ)
Modified: edu2/edu2/menu.dat
===================================================================
(Binary files differ)
Modified: edu2/edu2/menu.lno
===================================================================
(Binary files differ)
Modified: edu2/id1/qcsrc/cgame/csqc_constants.qh
===================================================================
--- edu2/id1/qcsrc/cgame/csqc_constants.qh 2008-02-27 11:34:36 UTC (rev 429)
+++ edu2/id1/qcsrc/cgame/csqc_constants.qh 2008-02-27 13:42:40 UTC (rev 430)
@@ -275,3 +275,10 @@
float K_MOUSE14 = 527;
float K_MOUSE15 = 528;
float K_MOUSE16 = 529;
+
+///////////////////////////
+// cvar constants
+
+float CVAR_SAVE = 1;
+float CVAR_NOTIFY = 2;
+float CVAR_READONLY = 4;
Modified: edu2/id1/qcsrc/common/geckoterminal.qc
===================================================================
--- edu2/id1/qcsrc/common/geckoterminal.qc 2008-02-27 11:34:36 UTC (rev 429)
+++ edu2/id1/qcsrc/common/geckoterminal.qc 2008-02-27 13:42:40 UTC (rev 430)
@@ -109,7 +109,10 @@
strunzone( self.targetURL );
self.targetURL = strzone( lTemp );
}
- gecko_resize( self.geckoInstanceName, 1024, 512 );
+
+ registercvar( "gecko_terminal_width", "1024", CVAR_SAVE );
+ registercvar( "gecko_terminal_height", "512", CVAR_SAVE );
+ gecko_resize( self.geckoInstanceName, cvar( "gecko_terminal_width" ), cvar( "gecko_terminal_height" ) );
gecko_navigate( self.geckoInstanceName, strcat( "http://www.icculus.org/~black/stuff/terminalbrowser.html?", self.targetURL ) );
self.classname = "gecko_terminal";
Modified: edu2/id1/qcsrc/common/util.qc
===================================================================
--- edu2/id1/qcsrc/common/util.qc 2008-02-27 11:34:36 UTC (rev 429)
+++ edu2/id1/qcsrc/common/util.qc 2008-02-27 13:42:40 UTC (rev 430)
@@ -317,16 +317,25 @@
string db_get(float db, string pKey)
{
+ string lRawKey;
+ lRawKey = strreplace( chr2str( 128 + 92 ), "\\", pKey );
float h;
h = mod(crc16(FALSE, pKey), DB_BUCKETS);
- return infoget(bufstr_get(db, h), pKey);
+ string lRawValue;
+ lRawValue = infoget(bufstr_get(db, h), pKey);
+ return strreplace( "\\", chr2str( 128 + 92 ), lRawValue );
}
void db_put(float db, string pKey, string pValue)
{
+ string lRawKey;
+ lRawKey = strreplace( chr2str( 128 + 92 ), "\\", pKey);
+ string lRawValue;
+ lRawValue = strreplace( chr2str( 128 + 92 ), "\\", pValue );
+
float h;
h = mod(crc16(FALSE, pKey), DB_BUCKETS);
- bufstr_set(db, h, infoadd(bufstr_get(db, h), pKey, pValue));
+ bufstr_set(db, h, infoadd(bufstr_get(db, h), lRawKey, lRawValue));
}
void db_test()
@@ -376,3 +385,32 @@
fputs(fh, strcat(bufstr_get(buf, i), "\n"));
fclose(fh);
}
+
+// dont str-zone the string
+string str_load( string pFilename ) {
+ float fh, i;
+ string l;
+ string lText;
+ fh = fopen(pFilename, FILE_READ);
+ if(fh < 0)
+ return "";
+ i = 0;
+ lText = "";
+ while((l = fgets(fh)))
+ {
+ lText = strcat( lText, l, "\n" );
+ ++i;
+ }
+ fclose(fh);
+ return lText;
+}
+
+void str_save(string lContent, string pFilename)
+{
+ float fh;
+ fh = fopen(pFilename, FILE_WRITE);
+ if(fh < 0)
+ error(strcat("Can't write buf to ", pFilename));
+ fputs(fh, lContent);
+ fclose(fh);
+}
Modified: edu2/id1/qcsrc/menu/edu2/dialog_gamelist.c
===================================================================
--- edu2/id1/qcsrc/menu/edu2/dialog_gamelist.c 2008-02-27 11:34:36 UTC (rev 429)
+++ edu2/id1/qcsrc/menu/edu2/dialog_gamelist.c 2008-02-27 13:42:40 UTC (rev 430)
@@ -5,7 +5,7 @@
ATTRIB(GameListDialog, title, string, _("Fun Zone"))
ATTRIB(GameListDialog, color, vector, SKINCOLOR_DIALOG_SINGLEPLAYER)
ATTRIB(GameListDialog, intendedWidth, float, 0.80)
- ATTRIB(GameListDialog, rows, float, 20)
+ ATTRIB(GameListDialog, rows, float, 21)
ATTRIB(GameListDialog, columns, float, 5)
ATTRIB(GameListDialog, campaignBox, entity, NULL)
ENDCLASS(GameListDialog)
@@ -18,7 +18,7 @@
entity e;
me.TR(me);
- me.TD(me, me.rows, me.columns, me.campaignBox = makeGameList());
+ me.TD(me, me.rows - 1, me.columns, me.campaignBox = makeGameList());
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, e = makeNexuizButton(_("Start!"), '0 0 0'));
Modified: edu2/id1/qcsrc/menu/edu2/dialog_login.c
===================================================================
--- edu2/id1/qcsrc/menu/edu2/dialog_login.c 2008-02-27 11:34:36 UTC (rev 429)
+++ edu2/id1/qcsrc/menu/edu2/dialog_login.c 2008-02-27 13:42:40 UTC (rev 430)
@@ -18,6 +18,7 @@
ATTRIB(LoginDialog, username, entity, NULL)
ATTRIB(LoginDialog, password, entity, NULL)
+ //ATTRIB(LoginDialog, rememberMe, entity, NULL)
ATTRIB(LoginDialog, okButton, entity, NULL)
ATTRIB(LoginDialog, offlineButton, entity, NULL )
ENDCLASS(LoginDialog)
@@ -32,8 +33,13 @@
"\\\"; document.loginform.pass.value=\\\"", me.password.text, "\\\"; login_form_change(); document.loginform.submit();\"\n");
}
+#define REG_EDU2_USERNAME "edu2/login/username"
+#define REG_EDU2_PASSWORD "edu2/login/password"
+
void LoginDialog_onOkClick(entity button, entity me)
{
+ db_put( menu_registry, REG_EDU2_USERNAME, me.username.text );
+ db_put( menu_registry, REG_EDU2_PASSWORD, me.password.text );
Edu2InfoTabsDialog_onLoggedIn();
me.close( me );
}
@@ -49,10 +55,14 @@
me.moveable = true;
me.username = makeChatInputBox( true, false );
+ // load old key from registry
+ me.username.setText( me.username, db_get( menu_registry, REG_EDU2_USERNAME ) );
//me.username.onEnterEntity = me;
//me.username.onEnter = LoginDialog_onEnter;
me.password = makeChatInputBox( false, true );
+ me.password.setText( me.password, db_get( menu_registry, REG_EDU2_PASSWORD ) ),
+
//me.password.onEnterEntity = me;
//me.password.onEnter = LoginDialog_onEnter;
Modified: edu2/id1/qcsrc/menu/edu2/dialog_logout.c
===================================================================
--- edu2/id1/qcsrc/menu/edu2/dialog_logout.c 2008-02-27 11:34:36 UTC (rev 429)
+++ edu2/id1/qcsrc/menu/edu2/dialog_logout.c 2008-02-27 13:42:40 UTC (rev 430)
@@ -7,7 +7,8 @@
ATTRIB(LogoutDialog, intendedWidth, float, 0.5)
ATTRIB(LogoutDialog, rows, float, 3)
ATTRIB(LogoutDialog, columns, float, 2)
- ATTRIB(LoginDialog, name, string, "LogoutDialog")
+ ATTRIB(LogoutDialog, name, string, "LogoutDialog")
+ ATTRIB(LogoutDialog, closable, float, 0)
ENDCLASS(LogoutDialog)
#endif
Modified: edu2/id1/qcsrc/menu/edu2/gamelist.c
===================================================================
--- edu2/id1/qcsrc/menu/edu2/gamelist.c 2008-02-27 11:34:36 UTC (rev 429)
+++ edu2/id1/qcsrc/menu/edu2/gamelist.c 2008-02-27 13:42:40 UTC (rev 430)
@@ -39,7 +39,7 @@
#endif
#ifdef IMPLEMENTATION
-#define GAMELIST_MAX_ENTRIES 64
+#define GAMELIST_MAX_ENTRIES 10
typedef void(entity) GameList_Callback; // void(entity button)
string gamelist_longdesc_wrapped[GAMELIST_MAX_ENTRIES];
string gamelist_longdesc[GAMELIST_MAX_ENTRIES];
@@ -48,7 +48,6 @@
var GameList_Callback gamelist_callback[GAMELIST_MAX_ENTRIES];
float gamelist_entries;
-float gamelist_offset;
void( entity button ) MineSweeper_Start = {
entity lDialog;
@@ -143,8 +142,8 @@
float i;
i = 0;
#define GAMELIST_ENTRY(ax,sx,bx,fx) gamelist_shortname[i] = ax; gamelist_shortdesc[i] = sx; gamelist_longdesc[ i ] = bx; gamelist_callback[i] = fx; i = i + 1
- GAMELIST_ENTRY( "edu1", "Edu 1", "Edu1 Game is awesome bla blub more to write and do!", Edu1_Start );
- GAMELIST_ENTRY( "minesweeper", "MineSweeper (Classic)", "all you ever dreamed about..! \\o/", MineSweeper_Start );
+ GAMELIST_ENTRY( "edu1", "Edu 1", "Play the original and educate yourself while answering questions and having fun with sponges (and you even get Credits for it)!", Edu1_Start );
+ GAMELIST_ENTRY( "minesweeper", "MineSweeper (Classic)", "The classical Windows game that has been ported to oh so many platforms. You can play it here, too, and help time pass when you're bored and, of course, earn useful Credits.", MineSweeper_Start );
GAMELIST_ENTRY( "tabletennis", "Table Tennis 3D", "Play some rounds of tebletennis against your opponents and earn Credits with each score.", DummyGame_Start );
GAMELIST_ENTRY( "yeti", "Yeti Game", "Enjoy this fluffy arcade platformer and help the yeti find his way back into his cave.", DummyGame_Start );
GAMELIST_ENTRY( "moongame", "MoonGame Beat'em Up", "Feeling like beating someone up? Don't take it on your pets and better play this game. It's fun and you get Credits for it - and no jail time!", DummyGame_Start );
@@ -254,7 +253,7 @@
s = gamelist_shortdesc[i]; // fteqcc sucks
else
s = "???";
- s = draw_TextShortenToWidth(strcat(_("Game "), ftos(i + 1), " - ", s), me.columnNameSize / me.realFontSize_x, 0);
+ s = draw_TextShortenToWidth(strcat(/*_("Game "), ftos(i + 1), " - ",*/ s), me.columnNameSize / me.realFontSize_x, 0);
draw_Text(me.realUpperMargin1 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0) * me.realFontSize_x)) * eX, s, me.realFontSize, theColor, theAlpha, 0);
if(i <= me.campaignIndex)
Modified: edu2/id1/qcsrc/menu/item/gecko.c
===================================================================
--- edu2/id1/qcsrc/menu/item/gecko.c 2008-02-27 11:34:36 UTC (rev 429)
+++ edu2/id1/qcsrc/menu/item/gecko.c 2008-02-27 13:42:40 UTC (rev 430)
@@ -28,6 +28,8 @@
gecko_create( me.texturePath );
}
gecko_navigate( me.texturePath, strcat( "http://www.icculus.org/~black/stuff/terminalbrowser.html?", URI ) );
+ //gecko_navigate( me.texturePath, "about:blank" );
+ //gecko_navigate( me.texturePath, "javascript:Darkplaces.query( 123 );" );
}
void drawGecko(entity me)
Modified: edu2/id1/qcsrc/menu/mbuiltin.qh
===================================================================
--- edu2/id1/qcsrc/menu/mbuiltin.qh 2008-02-27 11:34:36 UTC (rev 429)
+++ edu2/id1/qcsrc/menu/mbuiltin.qh 2008-02-27 13:42:40 UTC (rev 430)
@@ -289,6 +289,9 @@
float(float bufhandle, string str, float order) bufstr_add = #448;
void(float bufhandle, float string_index) bufstr_free = #449;
+string(string search, string replace, string subject) strreplace = #484;
+string(string search, string replace, string subject) strireplace = #485;
+
//DP_QC_CRC16
//idea: div0
//darkplaces implementation: div0
Modified: edu2/id1/qcsrc/menu/menu.qc
===================================================================
--- edu2/id1/qcsrc/menu/menu.qc 2008-02-27 11:34:36 UTC (rev 429)
+++ edu2/id1/qcsrc/menu/menu.qc 2008-02-27 13:42:40 UTC (rev 430)
@@ -58,6 +58,7 @@
void() m_init =
{
dprint_load();
+ menu_registry = db_load( MENU_REGISTRY_FILE );
}
void UpdateConWidthHeight()
@@ -412,6 +413,9 @@
void() m_shutdown =
{
m_hide();
+ // save the registry
+ db_save( menu_registry, MENU_REGISTRY_FILE );
+ db_close( menu_registry );
};
void(string itemname) m_goto =
Modified: edu2/id1/qcsrc/menu/menu.qh
===================================================================
--- edu2/id1/qcsrc/menu/menu.qh 2008-02-27 11:34:36 UTC (rev 429)
+++ edu2/id1/qcsrc/menu/menu.qh 2008-02-27 13:42:40 UTC (rev 430)
@@ -59,3 +59,6 @@
float() MessageLog_GetCount;
string( float index ) MessageLog_Get;
+
+float menu_registry;
+const string MENU_REGISTRY_FILE = "menu.registry";
Modified: edu2/id1/qcsrc/menu/nexuiz/playermodel.c
===================================================================
--- edu2/id1/qcsrc/menu/nexuiz/playermodel.c 2008-02-27 11:34:36 UTC (rev 429)
+++ edu2/id1/qcsrc/menu/nexuiz/playermodel.c 2008-02-27 13:42:40 UTC (rev 430)
@@ -215,9 +215,15 @@
me.playerModel.torso.alpha = -1.0;
me.playerModel.head.alpha = -1.0;
}
+ vector lSize;
+ lSize = boxToGlobalSize(me.imgSize, draw_scale);
+ if( lSize_x == 0 || lSize_y == 0 ) {
+ return;
+ }
+
PlayerModel_AnimationThink( me.playerModel );
R_SetView (VF_MIN, boxToGlobal(me.imgOrigin, draw_shift, draw_scale));
- R_SetView (VF_SIZE, boxToGlobalSize(me.imgSize, draw_scale));
+ R_SetView (VF_SIZE, lSize);
R_SetView (VF_FOVX, (me.imgSize_x / me.imgSize_y) * 90);
R_SetView (VF_FOVY, 100);
R_SetView (VF_CLEARSCREEN, 0 );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|