git-svn-id: https://svn.eduke32.com/eduke32@1100 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-10-14 08:40:59 +00:00
parent 60a4224533
commit 2a77b42672
10 changed files with 144 additions and 81 deletions

View file

@ -95,6 +95,14 @@ void _printmessage16(const char *fmt, ...);
void getpoint(int searchxe, int searchye, int *x, int *y);
int getpointhighlight(int xplc, int yplc, int point);
#ifdef _WIN32
#define DEFAULT_GAME_EXEC "eduke32.exe"
#define DEFAULT_GAME_LOCAL_EXEC "eduke32.exe"
#else
#define DEFAULT_GAME_EXEC "eduke32"
#define DEFAULT_GAME_LOCAL_EXEC "./eduke32"
#endif
#ifdef __cplusplus
}
#endif

View file

@ -91,6 +91,7 @@ extern int cachesize, artsize;
static short oldmousebstatus = 0;
short brightness = 0;
char game_executable[BMAX_PATH] = DEFAULT_GAME_LOCAL_EXEC;
int zlock = 0x7fffffff, zmode = 0, whitecol, kensplayerheight = 32;
short defaultspritecstat = 0;

View file

@ -56,6 +56,7 @@ static int readconfig(BFILE *fp, const char *key, char *value, unsigned len)
}
extern short brightness;
extern char game_executable[BMAX_PATH];
extern int fullscreen;
extern char option[8];
extern char keys[NUMBUILDKEYS];
@ -165,6 +166,9 @@ int loadsetup(const char *fn)
}
#endif
if (readconfig(fp, "gameexecutable", val, VL) > 0)
Bstrcpy(game_executable, val);
option[0] = 1; // vesa all the way...
option[1] = 1; // sound all the way...
option[4] = 0; // no multiplayer
@ -299,6 +303,9 @@ int writesetup(const char *fn)
"; 15 - highest\n"
"brightness = %d\n"
"\n"
"; Game executable used for map testing\n"
"gameexecutable = %s\n"
"\n"
#if 0
"; Sound sample frequency\n"
"; 0 - 6 KHz\n"
@ -411,7 +418,7 @@ int writesetup(const char *fn)
#ifdef RENDERTYPEWIN
maxrefreshfreq, windowpos, windowx, windowy,
#endif
brightness,
brightness, game_executable,
#if 0
option[7]>>4, option[2],
#endif

View file

@ -693,7 +693,7 @@ int mdloadskin(md2model *m, int number, int pal, int surf)
if ((int)sk->palette == pal && sk->skinnum == number && sk->surfnum == surf)
{
skinfile = sk->fn;
texidx = &sk->texid[(globalnoeffect)?0:hictinting[pal].f ];
texidx = &sk->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK) ];
strcpy(fn,skinfile);
//OSD_Printf("Using exact match skin (pal=%d,skinnum=%d,surfnum=%d) %s\n",pal,number,surf,skinfile);
break;
@ -713,7 +713,7 @@ int mdloadskin(md2model *m, int number, int pal, int surf)
if (skzero)
{
skinfile = skzero->fn;
texidx = &skzero->texid[(globalnoeffect)?0:hictinting[pal].f ];
texidx = &skzero->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK) ];
strcpy(fn,skinfile);
//OSD_Printf("Using def skin 0,0 as fallback, pal=%d\n", pal);
}
@ -721,7 +721,7 @@ int mdloadskin(md2model *m, int number, int pal, int surf)
{
if ((unsigned)number >= (unsigned)m->numskins) number = 0;
skinfile = m->skinfn + number*64;
texidx = &m->texid[ number * (HICEFFECTMASK+1) + (globalnoeffect)?0:hictinting[pal].f ];
texidx = &m->texid[ number * (HICEFFECTMASK+1) + (globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK) ];
strcpy(fn,m->basepath); strcat(fn,skinfile);
//OSD_Printf("Using MD2/MD3 skin (%d) %s, pal=%d\n",number,skinfile,pal);
}
@ -735,10 +735,10 @@ int mdloadskin(md2model *m, int number, int pal, int surf)
if (pal >= (MAXPALOOKUPS - RESERVEDPALS))
for (i=0;i<nextmodelid;i++)
for (skzero = ((md2model *)models[i])->skinmap; skzero; skzero = skzero->next)
if (!Bstrcasecmp(skzero->fn, sk->fn) && skzero->texid[(globalnoeffect)?0:hictinting[pal].f])
if (!Bstrcasecmp(skzero->fn, sk->fn) && skzero->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)])
{
sk->texid[(globalnoeffect)?0:hictinting[pal].f] = skzero->texid[(globalnoeffect)?0:hictinting[pal].f];
return sk->texid[(globalnoeffect)?0:hictinting[pal].f];
sk->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)] = skzero->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)];
return sk->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)];
}
*texidx = 0;
@ -753,7 +753,7 @@ int mdloadskin(md2model *m, int number, int pal, int surf)
picfillen = kfilelength(filh);
kclose(filh); // FIXME: shouldn't have to do this. bug in cache1d.c
cachefil = mdloadskin_trytexcache(fn, picfillen, pal<<8, (globalnoeffect)?0:hictinting[pal].f, &cachead);
cachefil = mdloadskin_trytexcache(fn, picfillen, pal<<8, (globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK), &cachead);
if (cachefil >= 0 && !mdloadskin_cached(cachefil, &cachead, &doalloc, texidx, &xsiz, &ysiz, pal))
{
osizx = cachead.xdim;
@ -770,7 +770,7 @@ int mdloadskin(md2model *m, int number, int pal, int surf)
cachefil = -1; // the compressed version will be saved to disk
if ((filh = kopen4load(fn, 0)) < 0) return -1;
if (daskinloader(filh,&fptr,&bpl,&xsiz,&ysiz,&osizx,&osizy,&hasalpha,pal,(globalnoeffect)?0:hictinting[pal].f,m,number,surf))
if (daskinloader(filh,&fptr,&bpl,&xsiz,&ysiz,&osizx,&osizy,&hasalpha,pal,(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK),m,number,surf))
{
kclose(filh);
OSD_Printf("Failed loading skin file \"%s\"\n", fn);
@ -862,7 +862,7 @@ int mdloadskin(md2model *m, int number, int pal, int surf)
}
cachead.flags = (i!=3) | (hasalpha ? 2 : 0);
OSD_Printf("No cached tex for %s.\n",fn);
writexcache(fn, picfillen, pal<<8, (globalnoeffect)?0:hictinting[pal].f, &cachead);
writexcache(fn, picfillen, pal<<8, (globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK), &cachead);
}
return(*texidx);

View file

@ -155,6 +155,7 @@ static void on_vmode3dcombo_changed(GtkComboBox *combobox, gpointer user_data)
gtk_tree_model_get(data, &iter, 1, &val, -1);
settings.xdim3d = validmode[val].xdim;
settings.ydim3d = validmode[val].ydim;
settings.bpp3d = validmode[val].bpp;
}
static void on_fullscreencheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)

View file

@ -41,6 +41,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shellapi.h>
#endif
#define BUILDDATE " 20081011"
@ -175,6 +176,7 @@ static int infobox=3; // bit0: current window, bit1: mouse pointer, the variable
extern char mskip;
extern short capturecount;
extern int editorgridextent; // in engine.c
extern char game_executable[BMAX_PATH];
static void clearfilenames(void)
{
@ -7353,28 +7355,26 @@ static void addgroup(const char *buffer)
CommandGrps = s;
}
#ifdef _WIN32
#define COPYARG(i) \
Bmemcpy(&testplay_addparam[j], argv[i], lengths[i]); \
j += lengths[i]; \
testplay_addparam[j++] = ' ';
#else
#define COPYARG(i)
#endif
static void checkcommandline(int argc, const char **argv)
{
int i = 1, j, maxlen=0, *lengths;
char *c, *k;
mapster32_fullpath = (char*)argv[0];
if (argc > 1)
{
lengths = Bmalloc(argc*sizeof(int));
for (j=1; j<argc; j++) maxlen += (lengths[j] = Bstrlen(argv[j]));
#ifdef _WIN32
testplay_addparam = Bmalloc(maxlen+argc);
testplay_addparam[0] = 0;
#endif
j = 0;
while (i < argc)
@ -7530,7 +7530,7 @@ static void checkcommandline(int argc, const char **argv)
}
Bfree(lengths);
#ifdef _WIN32
if (j > 0)
{
testplay_addparam[j-1] = 0;
@ -7541,7 +7541,6 @@ static void checkcommandline(int argc, const char **argv)
Bfree(testplay_addparam);
testplay_addparam = NULL;
}
#endif
}
}
#undef COPYARG
@ -7706,7 +7705,6 @@ static int osdcmd_noclip(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
#ifdef _WIN32
static int osdcmd_testplay_addparam(const osdfuncparm_t *parm)
{
int slen;
@ -7743,7 +7741,6 @@ static int osdcmd_testplay_addparam(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
#endif
static int osdcmd_showheightindicators(const osdfuncparm_t *parm)
{
@ -7829,9 +7826,7 @@ static int registerosdcommands(void)
OSD_RegisterFunction("pk_turndecel", "pk_turndecel: sets turning deceleration", osdcmd_vars_pk);
OSD_RegisterFunction("pk_uedaccel", "pk_uedaccel: sets UnrealEd movement speed factor (0-5, exponentially)", osdcmd_vars_pk);
OSD_RegisterFunction("pk_quickmapcycling", "pk_quickmapcycling: allows cycling of maps with (Shift-)Ctrl-X", osdcmd_vars_pk);
#ifdef _WIN32
OSD_RegisterFunction("testplay_addparam", "testplay_addparam \"string\": set additional parameters for test playing", osdcmd_testplay_addparam);
#endif
OSD_RegisterFunction("showheightindicators", "showheightindicators [012]: toggles height indicators in 2D mode", osdcmd_showheightindicators);
return 0;
}
@ -8442,7 +8437,10 @@ int ExtInit(void)
addsearchpath(seekinappcontainer);
#endif
addsearchpath(cwd);
Bstrcpy(program_origcwd, cwd);
}
else
program_origcwd[0] = '\0';
if (CommandPaths)
{
@ -8881,11 +8879,6 @@ void ExtAnalyzeSprites(void)
#define MESSAGEX 3 // (xdimgame>>1)
#define MESSAGEY 3 // ((i/charsperline)<<3)+(ydimgame-(ydimgame>>3))-(((getmessageleng-1)/charsperline)<<3)
#ifdef _WIN32
#include <windows.h>
#include <shellapi.h>
#endif
static void Keys2d3d(void)
{
int i;
@ -8900,7 +8893,10 @@ static void Keys2d3d(void)
if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_A]) // ' a
{
keystatus[KEYSC_A] = 0;
autosave=autosave?0:180; // 3 minutes
if (qsetmode == 200) autosave=autosave?0:getnumber256("Autosave interval, in seconds: ",180,3600,0);
else autosave=autosave?0:getnumber16("Autosave interval, in seconds: ",180,3600,0);
if (autosave) message("Autosave enabled, interval: %d seconds",autosave);
else message("Autosave disabled");
}
@ -8948,11 +8944,8 @@ static void Keys2d3d(void)
if (!f) f = levelname; else f++;
}
#ifdef _WIN32
if (keystatus[KEYSC_P]) // Ctrl-P: Map playtesting
{
static int tp_lastkeypresstime=0;
keystatus[KEYSC_P] = 0;
if (!eitherALT)
@ -8962,24 +8955,56 @@ static void Keys2d3d(void)
if ((!eitherALT && cursectnum >= 0) || (eitherALT && startsectnum >= 0))
{
if (tp_lastkeypresstime+120*4 >= totalclock)
message("Please wait while starting EDuke32...");
else
{
SHELLEXECUTEINFOA sinfo;
char *prog = "eduke32";
char *param = " -map autosave.map -noinstancechecking";
char *fullparam;
int slen;
char current_cwd[BMAX_PATH];
int slen = 0;
BFILE *fp;
tp_lastkeypresstime = totalclock;
if ((program_origcwd[0] == '\0') || !getcwd(current_cwd, BMAX_PATH))
current_cwd[0] = '\0';
else // Before we check if file exists, for the case there's no absolute path.
chdir(program_origcwd);
slen = testplay_addparam ? Bstrlen(testplay_addparam) : 0;
fullparam = Bmalloc(Bstrlen(param)+slen+1);
if (testplay_addparam)
Bstrcpy(fullparam, testplay_addparam);
fp = fopen(game_executable, "rb"); // File exists?
if (fp != NULL)
fclose(fp);
else
fullparam[0]=0;
{
#ifdef _WIN32
fullparam = Bstrrchr(mapster32_fullpath, '\\');
#else
fullparam = Bstrrchr(mapster32_fullpath, '/');
#endif
if (fullparam)
{
slen = fullparam-mapster32_fullpath+1;
Bstrncpy(game_executable, mapster32_fullpath, slen);
// game_executable is now expected to not be NULL-terminated!
Bstrcpy(game_executable+slen, DEFAULT_GAME_EXEC);
}
else
Bstrcpy(game_executable, DEFAULT_GAME_LOCAL_EXEC);
}
if (current_cwd[0] != '\0') // Temporarily changing back,
chdir(current_cwd); // after checking if file exists.
if (testplay_addparam)
slen = Bstrlen(testplay_addparam);
// Considering the NULL character, quatation marks
// and a possible extra space not in testplay_addparam,
// the length should be Bstrlen(game_executable)+Bstrlen(param)+(slen+1)+2+1.
fullparam = Bmalloc(Bstrlen(game_executable)+Bstrlen(param)+slen+4);
Bsprintf(fullparam,"\"%s\"",game_executable);
if (testplay_addparam)
{
Bstrcat(fullparam, " ");
Bstrcat(fullparam, testplay_addparam);
}
Bstrcat(fullparam, param);
fixspritesectors(); //Do this before saving!
@ -8988,26 +9013,41 @@ static void Keys2d3d(void)
saveboard("autosave.map",&startposx,&startposy,&startposz,&startang,&startsectnum);
else
saveboard("autosave.map",&posx,&posy,&posz,&ang,&cursectnum);
message("Board saved to AUTOSAVE.MAP. Starting EDuke32...");
message("Board saved to AUTOSAVE.MAP. Starting the game...");
Bmemset(&sinfo, 0, sizeof(sinfo));
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SEE_MASK_FLAG_NO_UI;
sinfo.lpVerb = "open";
sinfo.lpFile = prog;
sinfo.lpParameters = fullparam;
sinfo.nShow = SW_SHOWNORMAL;
uninitmouse();
#ifdef _WIN32
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
if (!ShellExecuteExA(&sinfo))
message("Error launching EDuke32!");
ZeroMemory(&si,sizeof(si));
ZeroMemory(&pi,sizeof(pi));
si.cb = sizeof(si);
if (!CreateProcess(NULL,fullparam,NULL,NULL,0,0,NULL,NULL,&si,&pi))
message("Error launching the game!");
else WaitForSingleObject(pi.hProcess,INFINITE);
}
#else
if (current_cwd[0] != '\0')
{
chdir(program_origcwd);
system(fullparam);
// message("Error launching the game!");
chdir(current_cwd);
}
else system(fullparam);
#endif
// message("Error launching the game!");
message("Game process exited");
initmouse();
Bfree(fullparam);
}
}
else
message("Must be in valid player space for test playing.");
message("Position must be in valid player space to test map!");
}
#endif
if (keystatus[KEYSC_S]) // S
{
@ -9135,6 +9175,8 @@ static void Keys2d3d(void)
}
}
#undef EDUKE32_EXEC
#undef EDUKE32_LOCALEXEC
void ExtCheckKeys(void)
{

View file

@ -624,6 +624,8 @@ int32 CONFIG_ReadSetup(void)
if (ud.config.scripthandle >= 0)
{
char dummybuf[64];
for (dummy = 0;dummy < 10;dummy++)
{
commmacro[13] = dummy+'0';
@ -632,7 +634,7 @@ int32 CONFIG_ReadSetup(void)
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","PlayerName",&tempbuf[0]);
while (Bstrlen(stripcolorcodes(tempbuf,tempbuf)) > 10)
while (Bstrlen(stripcolorcodes(dummybuf,tempbuf)) > 10)
tempbuf[Bstrlen(tempbuf)-1] = '\0';
Bstrncpy(myname,tempbuf,sizeof(myname)-1);

View file

@ -10466,22 +10466,6 @@ static void Startup(void)
if (numplayers > 1)
initprintf("Multiplayer initialized.\n");
if (CONTROL_Startup(1, &GetTime, TICRATE))
{
uninitengine();
exit(1);
}
SetupGameButtons();
CONFIG_SetupMouse();
CONFIG_SetupJoystick();
CONTROL_JoystickEnabled = (ud.config.UseJoystick && CONTROL_JoyPresent);
CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent);
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
for (i=0;i<joynumaxes;i++)
setjoydeadzone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]);
//initprintf("* Hold Esc to Abort. *\n");
// initprintf("Loading art header...\n");
@ -11249,11 +11233,27 @@ void app_main(int argc,const char **argv)
SoundStartup();
loadtmb();
if (VOLUMEONE)
/* if (VOLUMEONE)
{
if (numplayers > 4 || ud.multimode > 4)
gameexit(" The full version of Duke Nukem 3D supports 5 or more players.");
} */
if (CONTROL_Startup(1, &GetTime, TICRATE))
{
uninitengine();
exit(1);
}
SetupGameButtons();
CONFIG_SetupMouse();
CONFIG_SetupJoystick();
CONTROL_JoystickEnabled = (ud.config.UseJoystick && CONTROL_JoyPresent);
CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent);
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
for (i=0;i<joynumaxes;i++)
setjoydeadzone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]);
setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps->palette[0],0);

View file

@ -218,9 +218,9 @@ extern short localartlookup[MAXTILES], localartlookupnum;
extern int lockclock;
extern void clearkeys(void);
#ifdef _WIN32
static char program_origcwd[BMAX_PATH];
static char *mapster32_fullpath;
static char *testplay_addparam = 0;
#endif
int gs_sprite[3][7];
char gs_spritewhat[3][7];

View file

@ -876,9 +876,11 @@ void menus(void)
}
else
{
// because stripcolorcodes needs a valid target and tempbuf is used in strget()
char dummybuf[64];
x = strget(d-50,37,buf,30,0);
while (Bstrlen(stripcolorcodes(tempbuf,buf)) > 10)
while (Bstrlen(stripcolorcodes(dummybuf,buf)) > 10)
{
buf[Bstrlen(buf)-1] = '\0';
inputloc--;
@ -3742,7 +3744,7 @@ cheat_for_port_credits:
modval(0,1,(int *)&ud.config.SmoothInput,1,probey == (MAXMOUSEBUTTONS-2)*2+2+2+1);
if (probey == (MAXMOUSEBUTTONS-2)*2+2+2+1)
{
mgametext(160,160+9,"THIS OPTION INCURS A MOVEMENT DELAY",0,2+8+16);
// mgametext(160,160+9,"THIS OPTION INCURS A MOVEMENT DELAY",0,2+8+16);
control_smoothmouse = ud.config.SmoothInput;
}