Misc crap

git-svn-id: https://svn.eduke32.com/eduke32@1384 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2009-05-16 04:07:09 +00:00
parent 747a242b80
commit 6285f8b2e2
8 changed files with 79 additions and 83 deletions

View file

@ -219,6 +219,7 @@ void clearfilenames(void);
void loadmhk();
extern int32_t map_revision;
extern int32_t map_undoredo(int32_t dir);
extern void map_undoredo_free(void);
void clearkeys(void) { memset(keystatus,0,sizeof(keystatus)); }
@ -4231,6 +4232,7 @@ CANCEL:
cursectnum = -1;
initspritelists();
Bstrcpy(boardfilename,"newboard.map");
map_undoredo_free();
break;
}
else if (ch == 'N' || ch == 'n' || ch == 13 || ch == ' ')

View file

@ -6739,9 +6739,9 @@ int32_t loadboard(char *filename, char fromwhere, int32_t *daposx, int32_t *dapo
#define MYMAXWALLS (mapversion==7l?MAXWALLSV7:MAXWALLSV8)
#define MYMAXSPRITES (mapversion==7l?MAXSPRITESV7:MAXSPRITESV8)
clearbuf(&show2dsector[0],(int32_t)((MYMAXSECTORS+3)>>5),0L);
clearbuf(&show2dsprite[0],(int32_t)((MYMAXSPRITES+3)>>5),0L);
clearbuf(&show2dwall[0],(int32_t)((MYMAXWALLS+3)>>5),0L);
clearbuf(&show2dsector[0],(int32_t)((MAXSECTORS+3)>>5),0L);
clearbuf(&show2dsprite[0],(int32_t)((MAXSPRITES+3)>>5),0L);
clearbuf(&show2dwall[0],(int32_t)((MAXWALLS+3)>>5),0L);
kread(fil,daposx,4); *daposx = B_LITTLE32(*daposx);
kread(fil,daposy,4); *daposy = B_LITTLE32(*daposy);

View file

@ -1019,7 +1019,7 @@ int32_t initmouse(void)
return 0;
}
SetThreadPriority(mousethread, THREAD_PRIORITY_HIGHEST);
SetThreadPriority(mousethread, THREAD_PRIORITY_ABOVE_NORMAL);
ResumeThread(mousethread);
// initprintf("OK\n");
@ -1627,7 +1627,7 @@ static void AcquireInputDevices(char acquire, int8_t device)
IDirectInputDevice7_Unacquire(*devicedef[i].did);
if (i == MOUSE/* && fullscreen*/) flags = DISCL_FOREGROUND|DISCL_EXCLUSIVE;
if (i == MOUSE /*&& fullscreen*/) flags = DISCL_FOREGROUND|DISCL_EXCLUSIVE;
else flags = DISCL_FOREGROUND|DISCL_NONEXCLUSIVE;
result = IDirectInputDevice7_SetCooperativeLevel(*devicedef[i].did, hWindow, flags);
@ -2176,8 +2176,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
char i,inp[NUM_INPUTS];
int32_t modenum;
if ((fs == fullscreen) && (x == xres) && (y == yres) && (c == bpp) &&
!videomodereset)
if ((fs == fullscreen) && (x == xres) && (y == yres) && (c == bpp) && !videomodereset)
{
OSD_ResizeDisplay(xres,yres);
return 0;
@ -4195,9 +4194,17 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
}
}
#endif
if (backgroundidle)
SetPriorityClass(GetCurrentProcess(),
appactive ? NORMAL_PRIORITY_CLASS : IDLE_PRIORITY_CLASS);
if (appactive)
{
SetForegroundWindow(hWindow);
SetFocus(hWindow);
}
AcquireInputDevices(appactive,-1);
break;
}
case WM_ACTIVATE:
@ -4216,6 +4223,12 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
}
}
if (appactive)
{
SetForegroundWindow(hWindow);
SetFocus(hWindow);
}
AcquireInputDevices(appactive,-1);
break;

View file

@ -5662,7 +5662,10 @@ static void G_MoveEffectors(void) //STATNUM 3
j = headspritesect[s->sectnum];
while (j >= 0)
{
if (sprite[j].statnum != 10 && sector[sprite[j].sectnum].lotag != 2 && sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS)
if (sprite[j].statnum != 10 && sector[sprite[j].sectnum].lotag != 2 &&
(sprite[j].picnum != SECTOREFFECTOR ||
(sprite[j].picnum == SECTOREFFECTOR && (sprite[j].lotag == 49||sprite[j].lotag == 50)) )
&& sprite[j].picnum != LOCATORS)
{
rotatepoint(s->x,s->y,sprite[j].x,sprite[j].y,q,&sprite[j].x,&sprite[j].y);

View file

@ -50,7 +50,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <shellapi.h>
#endif
#define BUILDDATE " 20090430"
#define BUILDDATE " 20090512"
static int32_t floor_over_floor;
@ -82,8 +82,6 @@ static struct strllist
}
*CommandPaths = NULL, *CommandGrps = NULL;
#define MAXHELP2D (int32_t)(sizeof(Help2d)/sizeof(Help2d[0]))
#define eitherALT (keystatus[KEYSC_LALT]| keystatus[KEYSC_RALT])
#define eitherCTRL (keystatus[KEYSC_LCTRL]| keystatus[KEYSC_RCTRL])
#define eitherSHIFT (keystatus[KEYSC_LSHIFT]|keystatus[KEYSC_RSHIFT])
@ -253,6 +251,35 @@ void create_map_snapshot(void)
mapstate = mapstate->next;
}
void map_undoredo_free(void)
{
if (mapstate)
{
if (mapstate->next != NULL)
{
mapundo_t *next = mapstate->next;
while (next->next)
next = next->next;
while (next->prev)
{
next = next->prev;
if (next->next->sectors && next->next->sectors != next->sectors) Bfree(next->next->sectors);
if (next->next->walls && next->next->walls != next->walls) Bfree(next->next->walls);
if (next->next->sprites && next->next->sprites != next->sprites) Bfree(next->next->sprites);
Bfree(next->next);
}
}
Bfree(mapstate);
mapstate = NULL;
}
map_revision = 0;
}
int32_t map_undoredo(int32_t dir)
{
int32_t i;
@ -278,6 +305,10 @@ int32_t map_undoredo(int32_t dir)
initspritelists();
clearbuf(&show2dsector[0],(int32_t)((MAXSECTORS+3)>>5),0L);
clearbuf(&show2dsprite[0],(int32_t)((MAXSPRITES+3)>>5),0L);
clearbuf(&show2dwall[0],(int32_t)((MAXWALLS+3)>>5),0L);
lzf_decompress(&mapstate->sectors[0], mapstate->sectsiz, &sector[0], sizeof(sectortype) * numsectors);
lzf_decompress(&mapstate->walls[0], mapstate->wallsiz, &wall[0], sizeof(walltype) * numwalls);
lzf_decompress(&mapstate->sprites[0], mapstate->spritesiz, &sprite[0], sizeof(spritetype) * numsprites);
@ -299,29 +330,6 @@ int32_t map_undoredo(int32_t dir)
return 0;
}
static char *Help2d[]=
{
" 'A = Autosave toggle",
" 'J = Jump to location",
" 'L = Adjust sprite/wall coords",
" 'S = Sprite size",
" '3 = Caption mode",
" '7 = Swap tags",
" 'F = Special functions",
" X = Horiz. flip selected sects",
" Y = Vert. flip selected sects",
" F5 = Item count",
" F6 = Actor count/SE help",
" F7 = Edit sector",
" F8 = Edit wall/sprite",
" F9 = Sector tag help",
" Ctrl-S = Quick save",
" Alt-F7 = Search sector lotag",
" Alt-F8 = Search wall/sprite tags",
" [ = Search forward",
" ] = Search backward",
};
static char *SpriteMode[]=
{
"NONE",
@ -527,31 +535,7 @@ void ExtLoadMap(const char *mapname)
parallaxtype=0;
Bsprintf(tempbuf, "Mapster32 - %s",mapname);
if (mapstate)
{
if (mapstate->next != NULL)
{
mapundo_t *next = mapstate->next;
while (next->next)
next = next->next;
while (next->prev)
{
next = next->prev;
if (next->next->sectors && next->next->sectors != next->sectors) Bfree(next->next->sectors);
if (next->next->walls && next->next->walls != next->walls) Bfree(next->next->walls);
if (next->next->sprites && next->next->sprites != next->sprites) Bfree(next->next->sprites);
Bfree(next->next);
}
}
Bfree(mapstate);
mapstate = NULL;
}
map_revision = 0;
map_undoredo_free();
wm_setapptitle(tempbuf);
}
@ -2172,7 +2156,7 @@ static void SoundDisplay()
k, snd->ps, snd->pe, snd->pr,
snd->m&1 ? 'R':'-', snd->m&2 ? 'M':'-', snd->m&4 ? 'D':'-',
snd->m&8 ? 'P':'-', snd->m&16 ? 'G':'-', snd->vo);
for (l = Bsnprintf(disptext[i]+5, 20, snd->definedname); l<20; l++)
for (l = Bsnprintf(disptext[i]+5, 20, "%s", snd->definedname); l<20; l++)
disptext[i][5+l] = ' ';
if (snd->filename)
{
@ -2181,7 +2165,7 @@ static void SoundDisplay()
cp = snd->filename;
else
cp = snd->filename + l-15;
for (m = Bsnprintf(disptext[i]+26, 16, cp); m<16; m++)
for (m = Bsnprintf(disptext[i]+26, 16, "%s", cp); m<16; m++)
disptext[i][26+m] = ' ';
if (l>16)
disptext[i][26] = disptext[i][27] = disptext[i][28] = '.';
@ -7573,32 +7557,14 @@ static void Keys2d(void)
if (keystatus[KEYSC_F1] || (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_TILDE])) //F1 or ' ~
{
keystatus[KEYSC_F1]=0;
clearmidstatbar16();
// PK_
if (numhelppages>0) IntegratedHelp();
else
{
begindrawing();
for (i=0; i<MAXHELP2D; i++)
{
k = 0;
j = 0;
if (i > 9)
{
j = 256;
k = 90;
}
printext16(j,ydim16+32+(i*9)-k,editorcolors[11],-1,Help2d[i],0);
}
enddrawing();
}
else printmessage16("m32help.hlp invalid or not found!");
}
if (keystatus[KEYSC_F2])
{
keystatus[KEYSC_F2]=0;
clearmidstatbar16();
if (g_numsounds > 0)
SoundDisplay();
@ -10306,7 +10272,8 @@ static void Keys2d3d(void)
if (keystatus[KEYSC_P]) // Ctrl-P: Map playtesting
{
keystatus[KEYSC_P] = 0;
test_map(eitherALT);
if (qsetmode != 200)
test_map(eitherALT);
}
if (keystatus[KEYSC_S]) // S

View file

@ -4531,7 +4531,7 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
/* Qbix: Changed variables to be aware of the sizeof *insptr
* (wether it is int32_t vs intptr_t), Although it is specificly cast to intptr_t*
* which might be corrected if the code is converted to use offsets */
if (vm.g_t[4])
if (vm.g_t[4] && vm.g_t[4] != 1) // FIXME
{
vm.g_sp->lotag += TICSPERFRAME;

View file

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//-------------------------------------------------------------------------
#include "duke3d.h"
const char *s_buildDate = "20090428";
const char *s_buildDate = "20090512";
char *MusicPtr = NULL;
int32_t g_musicSize;

View file

@ -185,8 +185,19 @@ int32_t MUSIC_Init(int32_t SoundCard, int32_t Address)
}
external_midi = (command != NULL && command[0] != 0);
if (external_midi)
Mix_SetMusicCMD(command);
else
{
FILE *fp = fopen("/etc/timidity.cfg", "r");
if (fp == NULL)
{
initprintf("Error opening /etc/timidity.cfg: %s\n",strerror(errno));
return MUSIC_Error;
}
Bfclose(fp);
}
init_debugging();