42 lines
2.5 KiB
C
42 lines
2.5 KiB
C
/* Copied43AA40 with synthetic actor/material, no-op damage callbacks and miss-only
|
|
ray. Tests dispatch/gates only, not damage or fence/ladder successful entry. */
|
|
#define main unused_grappler_main
|
|
#include "grappler_scalar_probe.c"
|
|
#undef main
|
|
typedef struct{float x,y,z,w;}Vec;
|
|
static uintptr_t outer[0x170/4],game[0x390/4];
|
|
static unsigned char polygon[32],material[32],chunk[32],support_shape[32];
|
|
static int damage160,damage164,rays,has_support;
|
|
static void TC hit160(void*self,Vec normal){(void)self;require(normal.x==1&&normal.w==1,"normal passed intact");damage160++;}
|
|
static void TC hit164(void*self){(void)self;damage164++;}
|
|
static Vec*TC root(void*self,Vec*out){(void)self;*out=(Vec){100,50,100,1};return out;}
|
|
static Vec*TC local(void*self,Vec*out,float x,float y,float z){(void)self;*out=(Vec){x,y,z,1};return out;}
|
|
static void*TC support(void*self){(void)self;return has_support?support_shape:NULL;}
|
|
static int ray(void){rays++;return 0;}
|
|
static void fix(void){
|
|
const uint32_t data[]={0x48e5a0,0x48d400,0x4afd40,0x48e5ec};
|
|
for(uint32_t at=0x43aa40;at+4<=0x43afe3;at++){
|
|
uint32_t v;memcpy(&v,AT(at),4);for(unsigned i=0;i<4;i++)if(v==data[i]){v=(uintptr_t)AT(v);memcpy(AT(at),&v,4);at+=3;break;}
|
|
}
|
|
jump(AT(0x47c210),ray);
|
|
}
|
|
static void one(int id,float elapsed,int mode,int missing,int support_on,int controlled){
|
|
memset(object,0,sizeof(object));*(void**)object=outer;unsigned char*g=object+0xc0;*(void**)g=game;
|
|
*(float*)(g+0x774)=elapsed;*(short*)(g+0x704)=mode;*(int*)(chunk+8)=id;
|
|
*(void**)(polygon+4)=missing==2?NULL:material;*(void**)(material+0xc)=missing==3?NULL:chunk;
|
|
*(void**)AT(0x5099e4)=controlled?g:NULL;has_support=support_on;damage160=damage164=rays=0;
|
|
((void(TC*)(void*,Vec,void*))AT(0x43aa40))(g,(Vec){1,0,0,1},missing==1?NULL:polygon);
|
|
printf("CONTACT in=%d,%.9g,%d,%d,%d,%d out=%d,%d,%d\n",id,elapsed,mode,missing,support_on,controlled,damage160,damage164,rays);
|
|
}
|
|
int main(void){
|
|
map_source();fix();outer[0x160/4]=(uintptr_t)hit160;outer[0x164/4]=(uintptr_t)hit164;
|
|
game[0x310/4]=(uintptr_t)root;game[0x338/4]=(uintptr_t)support;game[0x384/4]=(uintptr_t)local;
|
|
const int ids[]={-1,59,60,69,70,109,110,119,120,129,130,179,180,181};
|
|
for(unsigned i=0;i<sizeof(ids)/sizeof(ids[0]);i++)one(ids[i],4,0,0,1,1);
|
|
one(120,3,0,0,1,1);one(120,3.0001f,0,0,1,1);one(120,2,0,0,1,1);
|
|
one(120,4,1,0,1,1);one(110,4,2,0,1,1);one(60,4,1,0,1,1);one(180,4,1,0,1,1);
|
|
one(120,4,0,1,1,1);one(120,4,0,2,1,1);one(120,4,0,3,1,1);
|
|
one(180,4,0,0,0,1);one(120,4,0,0,1,0);one(60,4,0,0,1,0);
|
|
puts("JIMMY_SPECIAL_CONTACT_COMPLETE");return 0;
|
|
}
|