Skip to content

Commit

Permalink
+ solved bug with bass.dll
Browse files Browse the repository at this point in the history
+ "connection failed" dialog
+ correct menu after connection is displayed
  • Loading branch information
darwin authored and woid committed May 12, 2001
1 parent 018d56d commit 6a311b3
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 29 deletions.
2 changes: 1 addition & 1 deletion bin/PW2-site.url
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[InternetShortcut]
URL=http://pw2.tsx.org
URL=http://pw2.sourceforge.net
26 changes: 13 additions & 13 deletions bin/config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,19 @@ p1_keyn_right right
p1_keyn_left left
p1_keyn_down down
p1_keyn_up up
p1_key_weapon5 53.000000
p1_key_weapon4 52.000000
p1_key_weapon3 51.000000
p1_key_weapon2 50.000000
p1_key_weapon1 49.000000
p1_key_warp 119.000000
p1_key_shield 115.000000
p1_key_fire 305.000000
p1_key_right 275.000000
p1_key_left 276.000000
p1_key_down 274.000000
p1_key_up 273.000000
p1_skin implicit
p1_key_weapon5 53
p1_key_weapon4 52
p1_key_weapon3 51
p1_key_weapon2 50
p1_key_weapon1 49
p1_key_warp 119
p1_key_shield 115
p1_key_fire 305
p1_key_right 275
p1_key_left 276
p1_key_down 274
p1_key_up 273
p1_skin penguin
p1_name unknown1
c_desc PacPerson
c_name noname
Expand Down
2 changes: 1 addition & 1 deletion bin/file_id.diz
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ name: PacWars2
desc: TCP/UDP internet action game
auth: Woid, Raist, Braindead, Dusty, GameOver
OS : Windows 95/98/ME/NT/2000, Linux, BeOS
url : http://pw2.tsx.org
url : http://pw2.sourceforge.net

msg : pac them all !!!
4 changes: 2 additions & 2 deletions bin/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<FONT SIZE="4">
<B><DIV align=center><FONT COLOR="#000000">PACWARS2&nbsp;info</FONT></DIV>
<DIV align=center><FONT size=2><A href="http://pw2.tsx.org">PW2
<DIV align=center><FONT size=2><A href="http://pw2.sourceforge.net">PW2
homepage</A></FONT></DIV></B>
</FONT>

Expand Down Expand Up @@ -98,7 +98,7 @@ <H3>Libraries and code used</H3>


<A
href="http://upx.tsx.org">http://upx.tsx.org</A>
href="http://upx.sourceforge.net">http://upx.sourceforge.net</A>
<P><STRONG>libPNG </STRONG>v1.0.8<BR>LibPNG&nbsp;is the official PNG
reference library. It supports almost all PNG features, is extensible, and
has been extensively tested for over five years. <BR>The home site for
Expand Down
2 changes: 1 addition & 1 deletion pw2.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{name}-%{version}.tar.gz
URL: http://pw2.tsx.org
URL: http://pw2.sourceforge.net
Copyright: GPL
Group: Games
BuildRoot: /var/tmp/%{name}-buildroot
Expand Down
2 changes: 1 addition & 1 deletion src/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const Uint8 VERSION_MINOR = 20;

#define PW_CONFIG_FILE "config.cfg"

#define PW_WEBADDRESS "http://pw2.tsx.org"
#define PW_WEBADDRESS "http://pw2.sourceforge.net"
// dirs
#define STD_SCRIPT_DIR "scripts/"
#define STD_MAP_DIR "maps/"
Expand Down
2 changes: 1 addition & 1 deletion src/gui/gui_ori.h
Original file line number Diff line number Diff line change
Expand Up @@ -2210,7 +2210,7 @@ lLine14(NULL, PG_Rect(CM_G2_PX,CM_G2_PY+315, CM_G2_VX-2,20), "zlib, libpng, libj
lLine16(NULL, PG_Rect(CM_PX+4,CM_PY+235, CM_VX-2,20), "Thanks to SLiK, Mem, Lada, Tessien, Dusty, Farey, Kerim, Garett Banuk, Nula, ...", false),
lLine17(NULL, PG_Rect(CM_PX+4,CM_PY+255, CM_VX-8,20), "See credits.txt for full list.", false),
lLine18(NULL, PG_Rect(CM_PX+4,CM_PY+315, CM_VX-2,25), "visit pacComunity at", false),
lLine19(NULL, PG_Rect(CM_PX+4,CM_PY+345, CM_VX-2,25), "http://pw2.tsx.org", false),
lLine19(NULL, PG_Rect(CM_PX+4,CM_PY+345, CM_VX-2,25), "http://pw2.sourceforge.net", false),
lLine15(NULL, PG_Rect(CM_PX+4,CM_PY+285, CM_VX-4,25), "PacWars2 rulezzz !!!", false),
bOK(NULL, 1, PG_Rect(CM_PX+155,CM_PY+390,150,25), "COOL")
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/guicreditsmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ GUI_CreditsMenu::GUI_CreditsMenu() : GUI_BaseMenu(GUI_CREDITS, PG_Rect(CM_PX,CM_
lLine[15] = new PG_Label(mBack1, PG_Rect(4,235, CM_VX-2,20), "Thanks to SLiK, Mem, Lada, Tessien, Farey, Kerim, Garett Banuk, Nula, ...", "GUI_Label");
lLine[17] = new PG_Label(mBack1, PG_Rect(4,315, CM_VX-2,25), "visit PW2 site at", "GUI_Label");
lLine[16] = new PG_Label(mBack1, PG_Rect(CM_G1_PX,CM_G1_PY+175, CM_G1_VX-2,20), "Iain Syme author of the orignal PacWars", "GUI_LabelL");
lLine[18] = new PG_Label(mBack1, PG_Rect(4,345, CM_VX-2,25), "http://pw2.tsx.org", "GUI_Label");
lLine[18] = new PG_Label(mBack1, PG_Rect(4,345, CM_VX-2,25), PW_WEBADDRESS, "GUI_Label");

Default();

Expand Down
2 changes: 2 additions & 0 deletions src/gui/guijoingamemenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ bool GUI_JoinGameMenu::eventButtonClick(int id, PG_Widget* widget) {

CommandExecuteOut("sc");
CommandExecuteOut("connect %s", eServerAddress->GetText());
waiting_connection_time = SDL_GetTicks();
waiting_connection = true;
ConOutEx(MISC_FONT, "> end of sequence <");
ConOut("");

Expand Down
1 change: 1 addition & 0 deletions src/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#define STD_DROP_TIMEOUT "20000" // 20s
#define STD_PING_TIMEOUT "20000" // 20s

#define WAITING_CONNECTION_TIMEOUT 5000 // 5s

// Messages
// ID,
Expand Down
44 changes: 39 additions & 5 deletions src/pw2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ Uint32 firsttick;
Uint32 ticktime;

bool waiting_connection = false;
Uint32 waiting_connection_time;

bool want_quit = false;
int frames = 0, oldframes = 0;

Expand Down Expand Up @@ -3127,6 +3129,7 @@ int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
if (fname[strlen(fname) - 1] == '/')
fname[strlen(fname) - 1] = 0;
app.SetApplicationPath(fname);
fprintf(stderr, "loading theme %s from %s\n", theme.string, fname);
if (!app.LoadTheme(theme.string, true, fname))
{
fprintf(stderr, "Couldn't load menu theme %s from %s\nCheck config.cfg for \"gui_dir\" and \"theme\"\n", theme.string, gui_dir.string);
Expand Down Expand Up @@ -3250,13 +3253,15 @@ int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
sound_3d_enabled = false;

// Initialize SDL
fprintf(stderr, "initing SDL\n");
if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO|SDL_INIT_NOPARACHUTE) < 0) {
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
exit(1);
}
atexit(SDL_Quit);

// Intialize network
fprintf(stderr, "initing net\n");
if (InitNet() < 0) {
fprintf(stderr, "Couldn't inititalize network: %s\n",
SDL_GetError());
Expand All @@ -3267,6 +3272,7 @@ int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
FileNameConversion(gfx_dir.string, "icon", "bmp", tmptxt);
SDL_WM_SetIcon(SDL_LoadBMP(tmptxt), NULL);
// Set video mode
fprintf(stderr, "setting up viedo mode\n");
if (!app.InitScreen(640, 480, video_bpp, videoflags)) {
fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
video_bpp, SDL_GetError());
Expand All @@ -3283,6 +3289,7 @@ int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
ResetGamma();

#ifdef PW_AUDIO
fprintf(stderr, "initing audio hw\n");
#ifdef PW_BASS
// try initializing the default device, at 44100hz stereo 16 bits
if (sound_hw_enabled) {
Expand Down Expand Up @@ -3330,6 +3337,7 @@ int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
ConOut("");
// Inform about previous initializations
#ifdef PW_AUDIO
fprintf(stderr, "enabling audio\n");
#ifdef PW_BASS
BASS_Start(); // Start digital output
ConOut("BASS sound sytem initialized.");
Expand All @@ -3343,6 +3351,7 @@ int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
ConOut("Network engine initialized.");

#ifdef PW_MUSIC
fprintf(stderr, "playing music\n");
#ifdef PW_BASS
Play_Music(menu_music_file.string);
Volume_Music(music_volume.string);
Expand All @@ -3355,12 +3364,13 @@ int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
#endif

#ifdef PW_SOUND
fprintf(stderr, "loading samples\n");
smLoadSamples();
// Load the requested music file
Volume_Sound(sound_volume.string);
#endif


fprintf(stderr, "loading gfx\n");
FileNameConversion(gfx_dir.string, "mainscr", PNG_EXT, tmptxt);
menu_background = LoadPic(tmptxt);

Expand Down Expand Up @@ -3415,6 +3425,7 @@ int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
UpdateSplash(screen, 10);

// Init the console
fprintf(stderr, "initing console\n");
int tmp_font;
FileNameConversion(gfx_dir.string, "cfont0", PNG_EXT, tmptxt);
if (InitConsole(tmptxt, screen, 100)) {
Expand Down Expand Up @@ -3497,6 +3508,7 @@ int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
UpdateSplash(screen, 45);

// Enable the scripting engine
fprintf(stderr, "enabling scripting\n");
InitScripting();
UpdateSplash(screen, 60);

Expand All @@ -3514,6 +3526,7 @@ int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
UpdateSplash(screen, 65);

// Scan for sprites
fprintf(stderr, "scanning for game files\n");
ConOut("%d sprite(s) found",
SpriteMan.Scan(sprite_dir.string, sprite_ext.string));
UpdateSplash(screen, 70);
Expand All @@ -3530,6 +3543,7 @@ int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
UpdateSplash(screen, 85);

// Init GUI system
fprintf(stderr, "initing gui system\n");
if (!GUI_Init(screen))
return 2;
GUI_OKDialog1 OKDialog1("");
Expand Down Expand Up @@ -3629,6 +3643,8 @@ int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
CommandExecuteOut("ss");
}

fprintf(stderr, "entering main loop\n");
GUI_OpenMenu(GUI_MAINMENU);
inloop = true;
while (MainProgram) {
PollNet();
Expand All @@ -3642,14 +3658,32 @@ int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
if (client_info.active) {
CL_Move(ticktime);
client_info.game.UpdateGamebarSlots();
waiting_connection = false;
} else {
if (net_client_status != NS_VIEWING_RESULTS)
if (!GUI_menu && !waiting_connection) {
/* if (net_client_status != NS_VIEWING_RESULTS)
if (!GUI_menu && waiting_connection) {
// GUI_OpenMenu(GUI_MAINMENU);
// waiting_connection = false;
}*/
}

if (!GUI_menu && waiting_connection) {
if (client_info.active)
{
GUI_OpenMenu(GUI_MAINMENU);
waiting_connection = false;
}
else
{
if (abs(ticktime-waiting_connection_time)>WAITING_CONNECTION_TIMEOUT)
{
waiting_connection = false;
OKD2->Reset("Connection failed", "Unable to connect remote PW2 server.", "Try to check IP address or host name you entered. See console for errors.");
GUI_OpenMenu(GUI_MAINMENU);
GUI_OpenMenu(GUI_JOINGAME);
GUI_OpenMenu(GUI_OKDIALOG2);
}
}
}

// automatic scheduler 1
if (auto_playername[0][0] && (ticktime > time_playername)) {
CommandExecuteOut("cp %s 1", auto_playername[0]);
Expand Down
2 changes: 2 additions & 0 deletions src/pw2.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ extern Uint32 time_chasename;

extern cvar_t sound_volume;
extern bool inloop;
extern bool waiting_connection;
extern Uint32 waiting_connection_time;

extern DECLSPEC int LoadConfig(char* cfgname);
extern DECLSPEC int SaveConfig(char* cfgname);
Expand Down
4 changes: 2 additions & 2 deletions src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1024,14 +1024,14 @@ int SV_SetMap(char* mapname, char* scriptname)
}


int SV_Poll()
int SV_Poll(Uint32 timeout)
{
int count;
int transfered;

if (net_server_status!=NS_UNINITED)
{
SDLNet_CheckSockets(ssocket_set, 0);
SDLNet_CheckSockets(ssocket_set, timeout);
if (SDLNet_SocketReady(msg_ssock)) {

HandleServerMessage();
Expand Down
2 changes: 1 addition & 1 deletion src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ extern DECLSPEC int SV_ChangeGame();

extern DECLSPEC int SV_SetMap(char* mapname, char* scriptname);

extern DECLSPEC int SV_Poll();
extern DECLSPEC int SV_Poll(Uint32 timeout=0);
extern DECLSPEC void SV_Move(Uint32 ticktime);
extern DECLSPEC char SV_ParseReplication(net_msg * msg, TICK_TYPE time);
extern DECLSPEC void SV_CreatePlayer(net_msg * MSG, int owner);
Expand Down

0 comments on commit 6a311b3

Please sign in to comment.