Cleanup & minor rewrites, among other things in premap.c:G_EnterLevel().

git-svn-id: https://svn.eduke32.com/eduke32@2695 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-05-25 18:39:22 +00:00
parent 5af2088c06
commit eebddcd559
4 changed files with 31 additions and 41 deletions

View file

@ -5551,8 +5551,6 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
{
int32_t zchange = 0;
zchange = 0;
j = s->owner;
if (sprite[j].lotag == (int16_t) 65535)
@ -5584,7 +5582,6 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
if (sc->floorz < s->z)
sc->floorz = s->z;
}
else if (sc->floorz < s->z) //z's are touching
{
sc->floorz += 512;
@ -5612,7 +5609,6 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
if (sc->floorz < T4)
sc->floorz = T4;
}
else if (sc->floorz < T4) //z's are touching
{
sc->floorz += 512;
@ -5621,9 +5617,6 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
sc->floorz = T4;
}
}
s->ang += (l*q);
t[2] += (l*q);
}
else
{
@ -5638,10 +5631,11 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
s->xvel = t[3];
s->x = sprite[j].x;
s->y = sprite[j].y;
s->ang += (l*q);
t[2] += (l*q);
}
s->ang += (l*q);
t[2] += (l*q);
if (l && (sc->floorstat&64))
{
for (TRAVERSE_CONNECT(p))

View file

@ -120,7 +120,7 @@ intptr_t *aplWeaponFlags[MAX_WEAPONS]; // Flags for weapon
intptr_t *aplWeaponShoots[MAX_WEAPONS]; // what the weapon shoots
intptr_t *aplWeaponSpawnTime[MAX_WEAPONS]; // the frame at which to spawn an item
intptr_t *aplWeaponSpawn[MAX_WEAPONS]; // the item to spawn
intptr_t *aplWeaponShotsPerBurst[MAX_WEAPONS]; // number of shots per 'burst' (one ammo per 'burst'
intptr_t *aplWeaponShotsPerBurst[MAX_WEAPONS]; // number of shots per 'burst' (one ammo per 'burst')
intptr_t *aplWeaponWorksLike[MAX_WEAPONS]; // What original the weapon works like
intptr_t *aplWeaponInitialSound[MAX_WEAPONS]; // Sound made when weapon starts firing. zero for no sound
intptr_t *aplWeaponFireSound[MAX_WEAPONS]; // Sound made when firing (each time for automatic)
@ -314,7 +314,7 @@ const char *keyw[] =
"defineskillname", // 108
"ifnosounds", // 109
"clipdist", // 110
"ifangdiffl", // 111
"ifangdiffl", // 111 Last Duke3D 1.5 CON command
"gamevar", // 112
"ifvarl", // 113
"ifvarg", // 114
@ -492,7 +492,7 @@ const char *keyw[] =
"setinput", // 286
"getinput", // 287
"save", // 288
"cansee", // 289
"cansee", // 289 Beginning EDuke32 SVN
"canseespr", // 290
"findnearactorz", // 291
"findnearactorzvar", // 292
@ -2411,8 +2411,7 @@ static int32_t C_ParseCommand(int32_t loop)
g_numCompilerWarnings++;
initprintf("%s:%d: warning: duplicate move `%s' ignored.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6));
}
if (i == -1)
else
{
hash_add(&h_labels,label+(g_numLabels<<6),g_numLabels,0);
labeltype[g_numLabels] = LABEL_MOVE;
@ -2548,8 +2547,7 @@ static int32_t C_ParseCommand(int32_t loop)
g_numCompilerWarnings++;
initprintf("%s:%d: warning: duplicate ai `%s' ignored.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6));
}
if (i == -1)
else
{
labeltype[g_numLabels] = LABEL_AI;
hash_add(&h_labels,label+(g_numLabels<<6),g_numLabels,0);
@ -2629,8 +2627,7 @@ static int32_t C_ParseCommand(int32_t loop)
g_numCompilerWarnings++;
initprintf("%s:%d: warning: duplicate action `%s' ignored.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6));
}
if (i == -1)
else
{
labeltype[g_numLabels] = LABEL_ACTION;
labelcode[g_numLabels] = g_scriptPtr-script;

View file

@ -1237,7 +1237,7 @@ skip_check:
{
int32_t moveScriptOfs = vm.g_t[1];
if (vm.g_sp->hitag & jumptoplayer ||
if ((vm.g_sp->hitag & jumptoplayer) ||
(actorscrptr[vm.g_sp->picnum] &&
(unsigned)moveScriptOfs < (unsigned)g_scriptSize - 1 && *(script + moveScriptOfs + 1)
))

View file

@ -1886,7 +1886,7 @@ void G_SetupFilenameBasedMusic(char *levnamebuf, const char *boardfilename, int3
int32_t G_EnterLevel(int32_t g)
{
int32_t i;
int32_t i, mii;
char levname[BMAX_PATH];
// flushpackets();
@ -1933,21 +1933,20 @@ int32_t G_EnterLevel(int32_t g)
}
}
if (MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].name == NULL || MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename == NULL)
mii = (ud.volume_number*MAXLEVELS)+ud.level_number;
if (MapInfo[mii].name == NULL || MapInfo[mii].filename == NULL)
{
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
{
if (MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename == NULL)
MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename = Bcalloc(BMAX_PATH,sizeof(uint8_t));
if (MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].name == NULL)
{
MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].name = Bcalloc(16,sizeof(uint8_t));
Bsprintf(MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].name,"User Map");
}
if (MapInfo[mii].filename == NULL)
MapInfo[mii].filename = Bcalloc(BMAX_PATH, sizeof(uint8_t));
if (MapInfo[mii].name == NULL)
MapInfo[mii].name = Bstrdup("User Map");
}
else
{
OSD_Printf(OSDTEXT_RED "Map E%dL%d not defined!\n",ud.volume_number+1,ud.level_number+1);
OSD_Printf(OSDTEXT_RED "Map E%dL%d not defined!\n", ud.volume_number+1, ud.level_number+1);
return 1;
}
}
@ -1965,7 +1964,7 @@ int32_t G_EnterLevel(int32_t g)
Bstrcpy(levname, boardfilename);
Bsprintf(apptitle,"%s - %s - " APPNAME,levname,g_gameNamePtr);
}
else Bsprintf(apptitle,"%s - %s - " APPNAME,MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].name,g_gameNamePtr);
else Bsprintf(apptitle,"%s - %s - " APPNAME,MapInfo[mii].name,g_gameNamePtr);
Bstrcpy(tempbuf,apptitle);
wm_setapptitle(tempbuf);
@ -1987,24 +1986,24 @@ int32_t G_EnterLevel(int32_t g)
G_SetupFilenameBasedMusic(levname, boardfilename, ud.m_level_number);
}
else if (loadboard(MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename,0,&g_player[0].ps->pos.x,
else if (loadboard(MapInfo[mii].filename,0,&g_player[0].ps->pos.x,
&g_player[0].ps->pos.y, &g_player[0].ps->pos.z, &g_player[0].ps->ang,&g_player[0].ps->cursectnum) < 0)
{
OSD_Printf(OSD_ERROR "Map \"%s\" not found or invalid map version!\n",
MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
MapInfo[mii].filename);
//G_GameExit(tempbuf);
return 1;
}
else
{
G_LoadMapHack(levname, MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
G_LoadMapHack(levname, MapInfo[mii].filename);
}
}
else
{
i = Bstrlen(MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
Bmemcpy(levname, MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename, i);
i = Bstrlen(MapInfo[mii].filename);
Bmemcpy(levname, MapInfo[mii].filename, i);
levname[i] = 255; // leads to flags=1 for kopen4load
levname[i+1] = 0;
@ -2012,7 +2011,7 @@ int32_t G_EnterLevel(int32_t g)
&g_player[0].ps->pos.z, &g_player[0].ps->ang,&g_player[0].ps->cursectnum) < 0)
{
OSD_Printf(OSD_ERROR "Map \"%s\" not found or invalid map version!\n",
MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
MapInfo[mii].filename);
//G_GameExit(tempbuf);
return 1;
@ -2042,9 +2041,9 @@ int32_t G_EnterLevel(int32_t g)
if (ud.recstat != 2)
{
g_musicIndex = (ud.volume_number*MAXLEVELS) + ud.level_number;
g_musicIndex = mii;
if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL)
S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex);
S_PlayMusic(MapInfo[(uint8_t)g_musicIndex].musicfn, g_musicIndex);
}
if (g & (MODE_GAME|MODE_EOL))
@ -2120,10 +2119,10 @@ int32_t G_EnterLevel(int32_t g)
//AddLog(g_szBuf);
// variables are set by pointer...
Bmemcpy(&currentboardfilename[0],&boardfilename[0],BMAX_PATH);
Bmemcpy(currentboardfilename, boardfilename, BMAX_PATH);
VM_OnEvent(EVENT_ENTERLEVEL, -1, -1, -1, 0);
OSD_Printf(OSDTEXT_YELLOW "E%dL%d: %s\n",ud.volume_number+1,ud.level_number+1,
MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].name);
OSD_Printf(OSDTEXT_YELLOW "E%dL%d: %s\n", ud.volume_number+1, ud.level_number+1,
MapInfo[mii].name);
Net_WaitForServer();
return 0;