New CON command 'clipmovenoslide', doing the same as clipmove but stopping at collisions before sliding calculations. Fixes a problem with Mapster32 where names.h was tried to be read before setting up the search path.

git-svn-id: https://svn.eduke32.com/eduke32@1711 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2010-10-09 22:59:17 +00:00
parent 036a88736c
commit cb321a9d76
7 changed files with 15 additions and 6 deletions

View file

@ -476,6 +476,7 @@ void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col);
int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize);
void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize);
extern int32_t clipmoveboxtracenum;
int32_t clipmove(vec3_t *vect, int16_t *sectnum, int32_t xvect, int32_t yvect, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype);
int32_t clipinsidebox(int32_t x, int32_t y, int16_t wallnum, int32_t walldist);
int32_t clipinsideboxline(int32_t x, int32_t y, int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t walldist);

View file

@ -406,8 +406,6 @@ int32_t app_main(int32_t argc, const char **argv)
}
//Bcanonicalisefilename(boardfilename,0);
loadnames(); // should be before ExtInit() because of auto 'Y' tile group
if ((i = ExtInit()) < 0) return -1;
#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2)
if (i || forcesetup || cmdsetup)
@ -420,6 +418,8 @@ int32_t app_main(int32_t argc, const char **argv)
}
#endif
loadnames();
if (initinput()) return -1;
// if (option[3] != 0) moustat =
initmouse();

View file

@ -1,7 +1,7 @@
// m32 script editor extensions.
// to load, enter "include samples/a" (without quotes) in the console
// or into a file named m32_autoexec.cfg for automatic loading on startup.
// to enable all events, "enableevents all"
// to enable all events, "enableevent all"
////////// USER SETTINGS //////////

View file

@ -8644,7 +8644,7 @@ static int32_t loadtilegroups(const char *fn)
Bmemcpy(&s_TileGroups[i], &blank, sizeof(blank));
}
tile_groups = 0;
#if 0
// ---------- Init hardcoded tile group consisting of all named tiles
s_TileGroups[0].szText = Bstrdup("All named");
s_TileGroups[0].pIds = Bmalloc(MAXTILES * sizeof(s_TileGroups[0].pIds[0]));
@ -8662,7 +8662,7 @@ static int32_t loadtilegroups(const char *fn)
tile_groups++;
}
// --------------------
#endif
parsetilegroups(script);
scriptfile_close(script);

View file

@ -556,6 +556,7 @@ const char *keyw[] =
"lineintersect", // 356
"rayintersect", // 357
"calchypotenuse", // 358
"clipmovenoslide", // 359
"<null>"
};
@ -4473,6 +4474,7 @@ static int32_t C_ParseCommand(void)
break;
case CON_CLIPMOVE:
case CON_CLIPMOVENOSLIDE:
// <retvar>,<x>,<y>,z,<sectnum>, xvect,yvect,walldist,floordist,ceildist,clipmask
C_GetManyVarsType(GAMEVAR_READONLY,3);
C_GetNextVar();

View file

@ -932,6 +932,7 @@ enum ScriptKeywords_t
CON_LINEINTERSECT, // 356
CON_RAYINTERSECT, // 357
CON_CALCHYPOTENUSE, // 358
CON_CLIPMOVENOSLIDE, // 359
CON_END
};
#endif

View file

@ -2544,13 +2544,14 @@ nullquote:
}
case CON_CLIPMOVE:
case CON_CLIPMOVENOSLIDE:
insptr++;
{
vec3_t vect;
int32_t retvar=*insptr++, xvar=*insptr++, yvar=*insptr++, z=Gv_GetVarX(*insptr++), sectnumvar=*insptr++;
int32_t xvect=Gv_GetVarX(*insptr++), yvect=Gv_GetVarX(*insptr++);
int32_t walldist=Gv_GetVarX(*insptr++), floordist=Gv_GetVarX(*insptr++), ceildist=Gv_GetVarX(*insptr++);
int32_t clipmask=Gv_GetVarX(*insptr++);
int32_t clipmask=Gv_GetVarX(*insptr++), oclipmoveboxtracenum=clipmoveboxtracenum;
int16_t sectnum;
vect.x = Gv_GetVarX(xvar);
@ -2565,7 +2566,11 @@ nullquote:
continue;
}
if (tw==CON_CLIPMOVENOSLIDE)
clipmoveboxtracenum = 1;
Gv_SetVarX(retvar, clipmove(&vect, &sectnum, xvect, yvect, walldist, floordist, ceildist, clipmask));
if (tw==CON_CLIPMOVENOSLIDE)
clipmoveboxtracenum = oclipmoveboxtracenum;
Gv_SetVarX(sectnumvar, sectnum);
Gv_SetVarX(xvar, vect.x);
Gv_SetVarX(yvar, vect.y);