News:

Herr Otto Partz says you're all nothing but pipsqueaks!

Main Menu

Cars in Stunts have the wrong position

Started by Matei, May 20, 2025, 11:30:43 PM

Previous topic - Next topic

Matei

The cars in Stunts are too low (incorrectly), see screenshots.

You cannot view this attachment.-> wrong You cannot view this attachment.-> wright

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

https://matei.one/idxscr.html#videos

HerrNove

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.

Matei

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

Matei

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.

HerrNove

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

Matei

#5
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;
}

HerrNove

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.

Duplode

The D0 address is relative to the location of the simd resource. 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.

Matei

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 !  ***


HerrNove

Maybe it needs F355 instead of CARF355?

Duplode

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).

Duplode

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.

Matei

C:\STUNTS\CAREDIT3.EXE
## Assertion failed!
## Declared and actual size of RES file differ.

Ok I give up.

Cas

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.
Earth is my country. Science is my religion.

Matei

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.