Stunts Forum

Stunts - the Game => Stunts Chat => Topic started by: Matei on May 20, 2025, 11:30:43 PM

Title: Cars in Stunts have the wrong position
Post by: Matei on May 20, 2025, 11:30:43 PM
The cars in Stunts are too low (incorrectly), see screenshots.

Stunts.jpg-> wrong SimcarStunts.jpg-> wright

I also added a video of my game with Stunts tracks, btw (latest version is above).

https://matei.one/idxscr.html#videos
Title: Re: Cars in Stunts have the wrong position
Post by: HerrNove on May 21, 2025, 12:04:30 PM
Which car is that? The view height is specified in the car model (https://wiki.stunts.hu/wiki/Car_parameters#Apparent_car_height). As kid I loved noticing that the LM002 has a higher driver position, you really feel you are riding a truck.
Title: Re: Cars in Stunts have the wrong position
Post by: Matei on May 21, 2025, 03:27:42 PM
So the cars can be fixed? That's good. All of them are wrong, including the cars in the mod with Ferari.

https://wiki.stunts.hu/wiki/Download
Title: Re: Cars in Stunts have the wrong position
Post by: Matei on May 26, 2025, 07:32:32 AM
Someone (not me) could add a C program which fixes the cars. The program should:

-receive the name of the input file (what is the extension?)
-display the current height of the car
-ask for the desired height
-rewrite the input file

It should be easy.
Title: Re: Cars in Stunts have the wrong position
Post by: HerrNove on May 26, 2025, 04:49:03 PM
If you really care about this you can recompile Restunts to your liking. The line to adjust is this here:

https://github.com/4d-stunts/restunts/blob/master/src/restunts/c/frame.c#L186
Title: Re: Cars in Stunts have the wrong position
Post by: Matei on May 26, 2025, 08:05:43 PM
I only compile C programs. Here it is but it doesn't work, I don't know why. Addresses 208 (d0), 209 (d1) and 247 (f7) store 0:

#include <stdio.h>
#include <stdlib.h>

int main(int argc,char *argv[]){
  int i,sf,*val;
  FILE *fin,*fout;

if(argc<3){printf("Files not declared\r\n"); exit(1);}
if(argc>3){printf("Too many parameters\r\n"); exit(1);}

if(!(val=(int *)malloc(2000*sizeof(int)))){printf("Insufficient memory\r\n"); exit(1);}

if(!(fin=fopen(argv[1],"r"))){printf("Could not open '%s'\r\n",argv[1]); exit(1);}
i=0; val[i]=fgetc(fin);
while(val[i]!=EOF){i++; val[i]=fgetc(fin);}
fclose(fin); sf=i;

printf("simd: %d, %d\r\n",val[208],val[209]);
printf("absolute: %d, %d\r\n",val[246],val[247]);
printf("Replace %d with: ",val[246]);
scanf("%d",&i);
printf("%d -> ",val[246]); val[246]=i;
printf("%d\r\n",val[246]);


if(!(fout=fopen(argv[2],"w"))){printf("Could not open '%s'\r\n",argv[2]); exit(1);}
for(i=0;i<sf;i++){fputc(val[i],fout);}
printf("File size: %d\r\n",sf);
fclose(fout);

free(val);

return 0;
}
Title: Re: Cars in Stunts have the wrong position
Post by: HerrNove on May 26, 2025, 11:03:38 PM
At first glance it looks correct. Maybe you can edit the parameter using a dedicated tool (I guess Car Blaster) and then diff the modified file vs the original to check which byte got changed.
Title: Re: Cars in Stunts have the wrong position
Post by: Duplode on May 26, 2025, 11:43:56 PM
The D0 address is relative to the location of the simd resource (https://wiki.stunts.hu/wiki/Resource_file_format). In the general case, you have to find the offset of simd in the header of the file, and also skip the header. (The "absolute" F6 address assumes simd is the first resource in the file, which is the case for the DSI cars, but not necessarily so for the custom ones.) 

Quote from: HerrNove on May 26, 2025, 11:03:38 PMMaybe you can edit the parameter using a dedicated tool (I guess Car Blaster) and then diff the modified file vs the original to check which byte got changed.

Indeed; all commonly used car editors (Car Blaster, CarEdit 3, CarWorks) support changing the dashboard height.
Title: Re: Cars in Stunts have the wrong position
Post by: Matei on May 27, 2025, 05:48:14 AM
I didn't understand anything. Car Blaster:

         LOADING CAR:



Filename without extension:  CARF355
    Current directory :  C:\STUNTS


*** The file st????.p3s does not exist !  ***
*** The file stda????.pvs does not exist !  ***
*** The file stdb????.pvs does not exist !  ***

Title: Re: Cars in Stunts have the wrong position
Post by: HerrNove on May 27, 2025, 10:18:56 AM
Maybe it needs F355 instead of CARF355?
Title: Re: Cars in Stunts have the wrong position
Post by: Duplode on May 27, 2025, 11:37:14 AM
Car Blaster, being a program from before it was possible to have custom graphics (with unpacked 3SH and VSH files), expects there will be a full set of packed files (P3S and PVS extensions) like in the DSI cars (the workflow in the old days involved editing the RES files and copying the graphics from an existing car). That restriction can be avoided by opening a DSI car and then cycling to the car you want to edit with the shortcuts (F9 and F10, if I remember correctly).
Title: Re: Cars in Stunts have the wrong position
Post by: Duplode on May 27, 2025, 12:29:11 PM
Something I forgot to mention: Also for historical reasons, Car Blaster assumes simd is the first resource in the RES file, which isn't the case for some of the custom cars. To avoid any issues with that, you can use one of the newer editors, like CarEdit3 (https://forum.stunts.hu/index.php?msg=97013).
Title: Re: Cars in Stunts have the wrong position
Post by: Matei on May 27, 2025, 12:55:36 PM
C:\STUNTS\CAREDIT3.EXE
## Assertion failed!
## Declared and actual size of RES file differ.

Ok I give up.
Title: Re: Cars in Stunts have the wrong position
Post by: Cas on May 30, 2025, 12:24:10 AM
I've long been thinking of rewriting CarWorks and one thing I should do then is make sure it can be compiled for DOS. I've done that for Bliss, but was lazy with CarWorks. It also has a number of bugs I never fixed. Hopefully sometime I can work on that. It'd help a lot with matters like these.
Title: Re: Cars in Stunts have the wrong position
Post by: Matei on May 31, 2025, 07:16:10 AM
In my game changing the camera position is easy. The fist line must be edited in the car text file:

camera 0.5 0.0 0.45

For Stunts with a C program it still doesn't work and nobody can fix it.