setmodel(): verify if model exists in PATH and set it to an error one if

it's not present.
This commit is contained in:
Marco Cawthorne 2021-06-01 12:40:53 +02:00
parent 243c875a3f
commit af139751e0
9 changed files with 3285 additions and 10 deletions

View File

@ -40,6 +40,7 @@ find ./$GAME_DIR -name *.pk3dir | xargs -I @ sh -c 'echo `basename "@"`' | while
done;
cp "./$GAME_DIR/progs.dat" "./$BUILD_DIR/$GAME_DIR/progs.dat"
cp "./$GAME_DIR/csprogs.dat" "./$BUILD_DIR/$GAME_DIR/csprogs.dat"
cp "./$GAME_DIR/menu.dat" "./$BUILD_DIR/$GAME_DIR/menu.dat"
if [ "$EXCLUDE_PLATFORM" ]; then
cp ./$GAME_DIR.fmf ./$BUILD_DIR/$GAME_DIR.fmf
@ -77,9 +78,13 @@ else
mkdir -p ./$BUILD_DIR/logos
cp ./logos/README ./$BUILD_DIR/logos/README
cp ./logos/fte.png ./$BUILD_DIR/logos/fte.png
cp ./$GAME_DIR.fmf ./$BUILD_DIR/default.fmf
cp ./default.fmf ./$BUILD_DIR/default.fmf
sed -i "s|base|$GAME_DIR|g" ./$BUILD_DIR/default.fmf
cp ./doc/release-readme ./$BUILD_DIR/README.txt
fi
tree ./$BUILD_DIR
printf "ENTER to continue\n"
read cont
zip -9 -r "$BUILD_DIR".zip "./$BUILD_DIR"
gpg --output "./$BUILD_DIR.sig" --detach-sig "./$BUILD_DIR.zip"

View File

@ -0,0 +1,5 @@
{
{
rgbGen const ( 1 0 0 )
}
}

View File

@ -0,0 +1,3 @@
output error.vvm
materialprefix "models/"
scene error.smd

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -538,6 +538,8 @@ worldspawn(void)
lightstyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
Skill_Init();
precache_model("models/error.vvm");
if (autocvar_sv_levelexec)
readcmd(sprintf("exec maps/%s.cfg\n", mapname));

View File

@ -106,6 +106,17 @@ precache_model(string m)
return prior(m);
}
__wrap void
setmodel(entity ent, string mname)
{
if (mname != "") /* not empty */
if (substring(mname, 0, 1) != "*") /* not a brush */
if not(whichpack(mname)) /* not present on disk */
return prior(ent, "models/error.vvm");
return prior(ent, mname);
}
/* info print */
void
iprint(string m)

View File

@ -33,12 +33,12 @@ void PMove_Categorize(void);
void PMove_CheckWaterJump(void);
int QPMove_IsStuck(entity eTarget, vector vOffset, vector vecMins, vector vecMaxs);
void PMove_AccelToss(float move_time, float premove);
void PMove_AccelMove(float move_time, float premove);
void PMove_Crouch(float move_time, float premove);
void PMove_AccelWater(float move_time, float premove);
void PMove_AccelLadder(float move_time, float premove, vector wish_dir, float wish_speed);
void PMove_AccelFriction(float move_time, float premove, vector wish_dir, float wish_speed);
void PMove_AccelGravity(float move_time, float premove, vector wish_dir, float wish_speed);
void PMove_AccelJump(float move_time, float premove);
void PMove_Jump(float move_time, float premove);
void PMove_Acceleration(float move_time, float premove);
void PMove_DoTouch(entity tother);
float PMove_Fix_Origin(void);

View File

@ -13,7 +13,9 @@
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#define CUSTOMPLAYERPHYSICS
#ifndef PMOVE_STEPHEIGHT
#define PMOVE_STEPHEIGHT 18
#endif
@ -312,7 +314,7 @@ PMove_AccelToss(float move_time, float premove)
}
void
PMove_AccelMove(float move_time, float premove)
PMove_Crouch(float move_time, float premove)
{
int iFixCrouch = FALSE;
if (input_buttons & INPUT_BUTTON8) {
@ -320,7 +322,7 @@ PMove_AccelMove(float move_time, float premove)
} else {
// If we aren't holding down duck anymore and 'attempt' to stand up, prevent it
if (self.flags & FL_CROUCHING) {
if (QPMove_IsStuck(self, '0 0 36', PHY_HULL_MIN, PHY_HULL_MAX) == FALSE) {
if (QPMove_IsStuck(self, [0,0,36], PHY_HULL_MIN, PHY_HULL_MAX) == FALSE) {
self.flags &= ~FL_CROUCHING;
iFixCrouch = TRUE;
}
@ -486,7 +488,7 @@ PMove_AccelGravity(float move_time, float premove, vector wish_dir, float wish_s
}
void
PMove_AccelJump(float move_time, float premove)
PMove_Jump(float move_time, float premove)
{
/* unset jump-key whenever it's not set */
if (!(input_buttons & INPUT_BUTTON2)) {
@ -533,8 +535,6 @@ PMove_Acceleration(float move_time, float premove)
if (self.movetype == MOVETYPE_TOSS) {
PMove_AccelToss(move_time, premove);
return;
} else if (self.movetype == MOVETYPE_WALK) {
PMove_AccelMove(move_time, premove);
}
if (self.waterlevel >= 2) {
@ -577,7 +577,6 @@ PMove_Acceleration(float move_time, float premove)
} else {
PMove_AccelGravity(move_time, premove, wish_dir, wish_speed);
}
PMove_AccelJump(move_time, premove);
}
}
@ -599,6 +598,11 @@ static void
PMove_Rebound(vector normal)
{
self.velocity = self.velocity - normal * (self.velocity * normal);
if (normal[2] > 0.7) {
self.groundentity = trace_ent;
self.flags |= FL_ONGROUND;
}
}
/* brute force unstuck function */
@ -794,6 +798,9 @@ PMove_Run(void)
PMove_SetViewOfs();
PMove_Crouch(input_timelength, TRUE);
PMove_Jump(input_timelength, TRUE);
/* call accelerate before and after the actual move,
* with half the move each time. this reduces framerate dependence.
* and makes controlling jumps slightly easier */
@ -813,7 +820,7 @@ PMove_Run(void)
/* activate any SOLID_TRIGGER entities */
touchtriggers();
#else
PMove_AccelMove(input_timelength, FALSE);
/* fast engine-side player physics */
runstandardplayerphysics(self);
#endif