fix PropPtr hw exception

This commit is contained in:
ABelliqueux 2021-04-08 17:23:19 +02:00
parent 9956b67a5c
commit 797b29f8ee
13 changed files with 1542 additions and 1583 deletions

View File

@ -227,7 +227,7 @@ u_short timer = 0;
// Cam stuff
int camMode = 5;
int camMode = 0;
long timeB = 0;
@ -395,10 +395,6 @@ int main() {
VECTOR objAngleToCam = {0, 0, 0, 0};
//~ long objAngleToCam = 0;
int angle = 0; //PSX units = 4096 == 360° = 2Pi
int dist = 0; //PSX units
@ -473,10 +469,13 @@ int main() {
objAngleToCam.vx = patan( posToCam.vx,posToCam.vy );
//~ objAngleToCam.vz = patan( posToCam.vz,posToCam.vy );
//~ objAngleToCam.vx = patan( psqrt(posToCam.vx * posToCam.vx + posToCam.vy * posToCam.vy), posToCam.vy );
//~ meshPlan.rot->vx = -( (objAngleToCam.vx >> 4) - 3076 ) ;
//~ meshPlan.rot->vx = (( (objAngleToCam.vx >> 4) - 3076 ) * ( (objAngleToCam.vz >> 4) - 3076 ) >> 12) * (nsin(posToCam.vz) >> 10 < 0 ? -1 : 1);
//~ meshPlan.rot->vx = ( (objAngleToCam.vx >> 4) - 3076 ) * ( (objAngleToCam.vz >> 4) - 3076 ) >> 12 ;
meshPlan.rot->vy = -( (objAngleToCam.vy >> 4) + 1024 ) ;
@ -791,15 +790,19 @@ int main() {
//~ FntPrint("Cam %d, %d, %d\n", camera.pos.vx, camera.pos.vy, camera.pos.vz);
//~ FntPrint("Pos: %d Cur: %d\nTheta y: %d x: %d\n", camPath.pos, camPath.cursor, theta.vy, theta.vx);
FntPrint("%d %d\n", camAngleToAct.vy, dist);
FntPrint("%d %d %d %d\n", camAngleToAct.vy, camera.pos.vx, camera.rot.vy, dist);
if ( camAngleToAct.vy < -50 ) {
// Ony move cam if position is between first camPath.vx and last camPath.vx
if ( camAngleToAct.vy < -50 && camera.pos.vx > camPath.points[camPath.len - 1].vx ) {
// Clamp camPath position to cameraSpeed
camPath.pos += dist < cameraSpeed ? 0 : cameraSpeed ;
}
if ( camAngleToAct.vy > 50 ) {
if ( camAngleToAct.vy > 50 && camera.pos.vx > camPath.points[camPath.cursor].vx ) {
camPath.pos -= dist < cameraSpeed ? 0 : cameraSpeed;
@ -865,21 +868,25 @@ int main() {
}
// FIXME ! //~ // Moveable prop
// FIXME !
// Moveable prop
//~ if ( !getIntCollision( *propPtr->body , *curNode->siblings->list[msh]->plane->body).vx &&
//~ !getIntCollision( *propPtr->body , *curNode->siblings->list[msh]->plane->body).vz ) {
//~ if ( !getIntCollision( *propPtr->body , *curNode->siblings->list[msh]->plane->body).vx &&
//~ !getIntCollision( *propPtr->body , *curNode->siblings->list[msh]->plane->body).vz ) {
//~ if ( propPtr->node != curNode->siblings->list[ msh ]){
//~ propPtr->node = curNode->siblings->list[ msh ];
//~ }
//~ } else
if ( !getIntCollision( *propPtr->body , *curNode->plane->body).vx &&
!getIntCollision( *propPtr->body , *curNode->plane->body).vz ) {
//~ }
propPtr->node = curNode;
if ( !getIntCollision( *propPtr->body , *curNode->plane->body).vx &&
!getIntCollision( *propPtr->body , *curNode->plane->body).vz ) {
propPtr->node = curNode;
}
@ -906,37 +913,51 @@ int main() {
col_lvl = getIntCollision( *meshes[k]->body , *levelPtr->body );
//~ col_sphere = getIntCollision( *propPtr->body, *propPtr->node->plane->body );
col_sphere = getIntCollision( *propPtr->body, *propPtr->node->plane->body );
// col_sphere = getIntCollision( *propPtr->body, *levelPtr->body );
col_sphere_act = getExtCollision( *actorPtr->body, *propPtr->body );
//~ // If no col with ground, fall off
// If no col with ground, fall off
if ( col_lvl.vy ) {
if (!col_lvl.vx && !col_lvl.vz){actorPtr->body->position.vy = actorPtr->body->min.vy;}
if ( !col_lvl.vx && !col_lvl.vz ) {
actorPtr->body->position.vy = actorPtr->body->min.vy;
}
}
if (col_sphere.vy){
if (!col_sphere.vx && !col_sphere.vz){propPtr->body->position.vy = propPtr->body->min.vy; }
if ( !col_sphere.vx && !col_sphere.vz ) {
propPtr->body->position.vy = propPtr->body->min.vy;
}
}
if (col_sphere_act.vx && col_sphere_act.vz ){
if (col_sphere_act.vx && col_sphere_act.vz ) {
propPtr->body->velocity.vx += actorPtr->body->velocity.vx;// * ONE / propPtr->body->restitution ;
propPtr->body->velocity.vz += actorPtr->body->velocity.vz;// * ONE / propPtr->body->restitution ;
propPtr->body->velocity.vx += actorPtr->body->velocity.vx;
if (propPtr->body->velocity.vx){
propPtr->body->velocity.vz += actorPtr->body->velocity.vz;
if ( propPtr->body->velocity.vx ) {
VECTOR L = angularMom(*propPtr->body);
propPtr->rot->vz -= L.vx;
}
if (propPtr->body->velocity.vz){
if ( propPtr->body->velocity.vz ) {
VECTOR L = angularMom( *propPtr->body );
VECTOR L = angularMom(*propPtr->body);
propPtr->rot->vx -= L.vz;
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

3032
coridor2.c

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
"emulator": {
"8Megs": false,
"AutoVideo": true,
"Bios": "/home/arthus/.epsxe/bios/openbios.bin",
"Bios": "/home/arthus/build/pcsx-redux/src/mips/openbios/openbios.bin",
"BnWMdec": false,
"CDDA": 1,
"Debug": true,
@ -22,7 +22,7 @@
"GdbServer": true,
"GdbServerPort": 3333,
"GdbServerTrace": false,
"IsoPath": "/home/arthus/build/psx-stuff/roms/UNIROM_RELEASE_8.0.D",
"IsoPath": "/home/arthus/Jeux/emul/psx/Vagrant Story (USA)",
"Locale": "",
"Logfile": "",
"Mcd1": "memcard1.mcd",
@ -31,7 +31,7 @@
"Mcd2Inserted": true,
"Overlay": [],
"PpfDir": "",
"PsxExe": "UNIROM_B.EXE;1",
"PsxExe": "SLUS_010.40;1",
"RCntFix": false,
"SioIrq": false,
"SpuIrq": false,
@ -53,5 +53,5 @@
"WindowSizeX": 719,
"WindowSizeY": 542
},
"imgui": "[Window][Debug##Default]\nPos=60,60\nSize=400,400\nCollapsed=0\n\n[Window][Emulation Configuration]\nViewportPos=39,142\nViewportId=0xA515CB4B\nSize=316,619\nCollapsed=0\n\n[Window][Logs]\nViewportPos=-86,644\nViewportId=0x50BD6962\nSize=720,450\nCollapsed=0\n\n[Window][Soft GPU configuration]\nPos=288,182\nSize=300,200\nCollapsed=0\n\n[Window][Main VRAM Viewer]\nViewportPos=1157,-262\nViewportId=0xD2F1ACB4\nSize=1321,900\nCollapsed=0\n\n[Window][Registers]\nViewportPos=1244,-4\nViewportId=0xA4D966FE\nSize=493,512\nCollapsed=0\nDockId=0x00000002,0\n\n[Window][Breakpoints]\nViewportPos=1283,-4\nViewportId=0xA4D966FE\nPos=250,0\nSize=243,512\nCollapsed=0\nDockId=0x00000003,0\n\n[Window][Assembly]\nViewportPos=1077,89\nViewportId=0xE37F8D5D\nSize=623,751\nCollapsed=0\n\n[Window][Output]\nPos=160,48\nSize=810,532\nCollapsed=0\n\n[Window][About]\nPos=199,66\nSize=880,600\nCollapsed=0\n\n[Window][Dear ImGui Demo]\nPos=669,25\nSize=550,680\nCollapsed=0\n\n[Window][SPU configuration]\nPos=69,56\nSize=550,220\nCollapsed=0\n\n[Window][SPU Debug]\nViewportPos=962,725\nViewportId=0xE5F7C643\nSize=1200,430\nCollapsed=0\n\n[Window][Memory Editor #1]\nViewportPos=1139,76\nViewportId=0xE9869392\nSize=584,539\nCollapsed=0\n\n[Window][Source]\nViewportPos=61,86\nViewportId=0x58267A45\nSize=416,536\nCollapsed=0\n\n[Window][Callstack]\nViewportPos=48,90\nViewportId=0xA9FDEE8E\nSize=426,525\nCollapsed=0\n\n[Window][Dwarf]\nPos=60,60\nSize=404,388\nCollapsed=0\n\n[Window][Symbols]\nPos=60,60\nSize=147,62\nCollapsed=0\n\n[Window][Scratch Pad]\nViewportPos=719,-7\nViewportId=0xB7AD35A5\nSize=484,480\nCollapsed=0\n\n[Window][Hardware Registers]\nViewportPos=847,221\nViewportId=0x311B7332\nSize=584,612\nCollapsed=0\n\n[Window][CLUT VRAM selector]\nViewportPos=737,320\nViewportId=0xF0235A86\nPos=0,5\nSize=330,252\nCollapsed=0\n\n[Docking][Data]\nDockNode ID=0x00000001 Pos=1244,-4 Size=493,512 Split=X\n DockNode ID=0x00000002 Parent=0x00000001 SizeRef=105,512 Selected=0x837A6095\n DockNode ID=0x00000003 Parent=0x00000001 SizeRef=103,512 Selected=0x0263173C\n\n"
"imgui": "[Window][Debug##Default]\nPos=60,60\nSize=400,400\nCollapsed=0\n\n[Window][Emulation Configuration]\nViewportPos=882,165\nViewportId=0xA515CB4B\nSize=316,619\nCollapsed=0\n\n[Window][Logs]\nViewportPos=-158,629\nViewportId=0x50BD6962\nSize=720,450\nCollapsed=0\n\n[Window][Soft GPU configuration]\nPos=288,182\nSize=300,200\nCollapsed=0\n\n[Window][Main VRAM Viewer]\nViewportPos=1157,-262\nViewportId=0xD2F1ACB4\nSize=1321,900\nCollapsed=0\n\n[Window][Registers]\nViewportPos=1244,-4\nViewportId=0xA4D966FE\nSize=493,512\nCollapsed=0\nDockId=0x00000002,0\n\n[Window][Breakpoints]\nViewportPos=1244,-4\nViewportId=0xA4D966FE\nSize=639,660\nCollapsed=0\nDockId=0x00000003,0\n\n[Window][Assembly]\nViewportPos=1077,89\nViewportId=0xE37F8D5D\nSize=623,751\nCollapsed=0\n\n[Window][Output]\nPos=160,48\nSize=810,532\nCollapsed=0\n\n[Window][About]\nPos=199,66\nSize=880,600\nCollapsed=0\n\n[Window][Dear ImGui Demo]\nPos=669,25\nSize=550,680\nCollapsed=0\n\n[Window][SPU configuration]\nPos=69,56\nSize=550,220\nCollapsed=0\n\n[Window][SPU Debug]\nViewportPos=962,725\nViewportId=0xE5F7C643\nSize=1200,430\nCollapsed=0\n\n[Window][Memory Editor #1]\nViewportPos=1139,76\nViewportId=0xE9869392\nSize=584,539\nCollapsed=0\n\n[Window][Source]\nViewportPos=61,86\nViewportId=0x58267A45\nSize=416,536\nCollapsed=0\n\n[Window][Callstack]\nViewportPos=48,90\nViewportId=0xA9FDEE8E\nSize=426,525\nCollapsed=0\n\n[Window][Dwarf]\nPos=60,60\nSize=404,388\nCollapsed=0\n\n[Window][Symbols]\nPos=60,60\nSize=147,62\nCollapsed=0\n\n[Window][Scratch Pad]\nViewportPos=719,-7\nViewportId=0xB7AD35A5\nSize=484,480\nCollapsed=0\n\n[Window][Hardware Registers]\nViewportPos=847,221\nViewportId=0x311B7332\nSize=584,612\nCollapsed=0\n\n[Window][CLUT VRAM selector]\nViewportPos=737,320\nViewportId=0xF0235A86\nPos=0,5\nSize=330,252\nCollapsed=0\n\n[Docking][Data]\nDockNode ID=0x00000001 Pos=1244,-4 Size=639,660 Split=X\n DockNode ID=0x00000002 Parent=0x00000001 SizeRef=105,512 Selected=0x837A6095\n DockNode ID=0x00000003 Parent=0x00000001 SizeRef=103,512 Selected=0x0263173C\n\n"
}