Plugins for LF2 (including one for platforms) - Som1Lse - 05-30-2014
Well plugins may be a little too big of a word for it...
It is simply a modified version of the ddraw.dll AI wrapper, which instead of adding scriptable AI loads DLLs from a directory.
The directory names are "dlls" for the release version, and "dllsd" for the debug version.
Link: https://www.mediafire.com/folder/1be5x960o61v5/LF2DDrawPlugins
Now obviously a lot of people aren't going to like not being able to use the scriptable AI so I recreated it: https://www.mediafire.com/folder/ct4voonhc56cg/LF2AIPlugin
And as an extra little bonus I'll throw in my very buggy platform code: https://www.mediafire.com/folder/v3r36t3c5vev2/LF2Itr14Plugin
I suppose you all know how the AI scripting works, so no need to go into more detail there, but for the platforming to work, you need to create a file named "itr14.dll" in the same directory as LF2, and then add scripting to handle the platforming and stuff. It is the same language and the same API as the AI scripting, so I think you'll figure it out; here is the script I've used so far. It is very buggy and contains a lot of debugging code:
AI-Code:
int x,y,z;
bool x_update,y_update,z_update;
array<int> x_prev(400);
array<int> y_prev(400);
array<int> z_prev(400);
array<bool> e_prev(400,false);
int Num1,Num2;
int frame_next;
bool in_air;
array<string> DataFiles(67);
int sign(int x){
if(x == 0) return 0;
if(x>0) return 1;
return -1;
}
bool IsLastObject(int Num){
for(int i = Num+1;i<400;++i) if(game.exists[i]) return false;
return true;
}
bool ItrHitsBdy(const Object <DVZ_ME#0>,const Object <DVZ_ME#1>,const Bdy <DVZ_ME#2>,const Itr <DVZ_ME#3>){
return ItrHitsBdy(Obj1,Obj2,bdy,itr,Obj1.x,Obj1.y,Obj1.z,Obj2.x,Obj2.y,Obj2.z);
}
bool ItrHitsBdy(const Object <DVZ_ME#0>,const Object <DVZ_ME#1>,const Bdy <DVZ_ME#2>,const Itr <DVZ_ME#3>,int bx,int by,int bz,int ix,int iy,int iz){
Frame <DVZ_ME#4> = Obj1.data.frames[Obj1.frame1];
Frame <DVZ_ME#5> = Obj2.data.frames[Obj2.frame1];
if(Obj1.facing) bx += Frame1.centerx-bdy.x-bdy.w;
else bx -= Frame1.centerx-bdy.x;
if(Obj2.facing) ix += Frame2.centerx-itr.x-itr.w;
else ix -= Frame2.centerx-itr.x;
by -= Frame1.centery-bdy.y;
iy -= Frame2.centery-itr.y;
if(bx <= ix+itr.w && bx+bdy.w>ix &&
by <= iy+itr.h && by+bdy.h>iy &&
abs(bz-iz)<(itr.zwidth>0?itr.zwidth:15)) return true;
return false;
}
bool d = false;
bool b = true;
void init(Object <DVZ_ME#6>,int unkwn1,int Num){
//if(Obj.data.type != 0 && Obj.data.type != 3 && Obj.data.type != 5 && Obj.data.frames[0].centery != 132) Obj.bottle_hp = 500;
frame_next = -1;
if(/*Num == 1 && */Obj.data.frames[Obj.frame1].bdy_count != 0 && Obj.data.frames[Obj.frame1].cpoint.kind != 2){
if(d){
if(b){
b = false;
DataFiles[00] = "data\\template.dat";
DataFiles[01] = "data\\julian.dat";
DataFiles[02] = "data\\firzen.dat";
DataFiles[03] = "data\\louisEX.dat";
DataFiles[04] = "data\\bat.dat";
DataFiles[05] = "data\\justin.dat";
DataFiles[06] = "data\\knight.dat";
DataFiles[07] = "data\\jan.dat";
DataFiles[08] = "data\\monk.dat";
DataFiles[09] = "data\\sorcerer.dat";
DataFiles[10] = "data\\jack.dat";
DataFiles[11] = "data\\mark.dat";
DataFiles[12] = "data\\hunter.dat";
DataFiles[13] = "data\\bandit.dat";
DataFiles[14] = "data\\deep.dat";
DataFiles[15] = "data\\john.dat";
DataFiles[16] = "data\\henry.dat";
DataFiles[17] = "data\\rudolf.dat";
DataFiles[18] = "data\\louis.dat";
DataFiles[19] = "data\\firen.dat";
DataFiles[20] = "data\\freeze.dat";
DataFiles[21] = "data\\dennis.dat";
DataFiles[22] = "data\\woody.dat";
DataFiles[23] = "data\\davis.dat";
DataFiles[24] = "data\\weapon0.dat";
DataFiles[25] = "data\\weapon2.dat";
DataFiles[26] = "data\\weapon4.dat";
DataFiles[27] = "data\\weapon5.dat";
DataFiles[28] = "data\\weapon6.dat";
DataFiles[29] = "data\\weapon1.dat";
DataFiles[30] = "data\\weapon3.dat";
DataFiles[31] = "data\\weapon8.dat";
DataFiles[32] = "data\\weapon9.dat";
DataFiles[33] = "data\\weapon10.dat";
DataFiles[34] = "data\\weapon11.dat";
DataFiles[35] = "data\\criminal.dat";
DataFiles[36] = "data\\datbox.dat";
DataFiles[37] = "data\\john_ball.dat";
DataFiles[38] = "data\\henry_arrow1.dat";
DataFiles[39] = "data\\rudolf_weapon.dat";
DataFiles[40] = "data\\deep_ball.dat";
DataFiles[41] = "data\\henry_wind.dat";
DataFiles[42] = "data\\dennis_ball.dat";
DataFiles[43] = "data\\woody_ball.dat";
DataFiles[44] = "data\\davis_ball.dat";
DataFiles[45] = "data\\henry_arrow2.dat";
DataFiles[46] = "data\\freeze_ball.dat";
DataFiles[47] = "data\\firen_ball.dat";
DataFiles[48] = "data\\firen_flame.dat";
DataFiles[49] = "data\\freeze_column.dat";
DataFiles[50] = "data\\weapon7.dat";
DataFiles[51] = "data\\john_biscuit.dat";
DataFiles[52] = "data\\dennis_chase.dat";
DataFiles[53] = "data\\jack_ball.dat";
DataFiles[54] = "data\\jan_chaseh.dat";
DataFiles[55] = "data\\jan_chase.dat";
DataFiles[56] = "data\\firzen_chasef.dat";
DataFiles[57] = "data\\firzen_chasei.dat";
DataFiles[58] = "data\\firzen_ball.dat";
DataFiles[59] = "data\\bat_ball.dat";
DataFiles[60] = "data\\bat_chase.dat";
DataFiles[61] = "data\\justin_ball.dat";
DataFiles[62] = "data\\julian_ball.dat";
DataFiles[63] = "data\\julian_ball2.dat";
DataFiles[64] = "data\\rudolf_catch.dat";
DataFiles[65] = "data\\etc.dat";
DataFiles[66] = "data\\broken_weapon.dat";
int i = 50;
clr();
if(game.files.datas[i].frames[0].bdy_count == 0) return;
print("file: "+DataFiles[i]+"\n");
PrintPlatData(game.files.datas[i],game.files.datas[i].frames[0].bdys[0]);
}
return;
}
if(Num == 1){
clr();
Object @O = game.objects[53];
Frame @F = O.data.frames[O.frame1];
print("x: "+O.x+"\n"+
"y: "+O.y+"\n"+
"x_vel: "+O.x_velocity+"\n"+
"y_vel: "+O.y_velocity+"\n"+
"frame: "+O.frame1+"\n"+
"held: "+O.weapon_held+"\n"+
"wetype: "+O.weapon_type+"\n"+
"team: "+O.team+"\n"+
"state: "+F.state+"\n\n");
}
Num1 = Num;
if(!e_prev[Num1]){
e_prev[Num1] = true;
x_prev[Num1] = game.objects[Num1].x;
y_prev[Num1] = game.objects[Num1].y;
z_prev[Num1] = game.objects[Num1].z;
}
x = Obj.x;
y = Obj.y;
z = Obj.z;
x_update = false;
y_update = false;
z_update = false;
in_air = Obj.y<0;
for(int i = 0;i<400;++i){
if(i == Num || !game.exists[i]) continue;
Num2 = i;
CheckCollisions(Obj,game.objects[i]);
}
if(x_update){
Obj.x_real = x;
Obj.x = x;
}
if(y_update){
Obj.y_real = y;
Obj.y = y;
}
if(z_update){
Obj.z_real = z;
Obj.z = z;
}
if(in_air){
if(Obj.data.type == 0){
if(Obj.data.frames[Obj.frame1].state == 0 || Obj.data.frames[Obj.frame1].state == 1){
frame_next = 212;
}else if(Obj.data.frames[Obj.frame1].state == 2){
Obj.x_velocity = Obj.data.dash_distance;
Obj.y_velocity = Obj.data.dash_height;
if(Obj.up != Obj.down){
Obj.z_velocity = Obj.data.dash_distancez;
if(Obj.up) Obj.z_velocity = -Obj.z_velocity;
}
if(Obj.facing) Obj.x_velocity = -Obj.x_velocity;
frame_next = 213;
}
if(Obj.weapon_type == 2 && game.exists[Obj.weapon_held]){
Obj.weapon_type = 0;
game.objects[Obj.weapon_held].x_velocity = Obj.x_velocity/2;
game.objects[Obj.weapon_held].y_velocity = Obj.y_velocity/2;
game.objects[Obj.weapon_held].z_velocity = Obj.z_velocity/2;
game.objects[Obj.weapon_held].frame1 = 0;
Obj.weapon_held = -1;
}
}
}
if(frame_next != -1){
Obj.frame1 = frame_next;
Obj.wait_counter = 0;
}
}
if(IsLastObject(Num)){
for(int i = 0;i<400;++i){
if(game.exists[i]){
e_prev[i] = true;
x_prev[i] = game.objects[i].x;
y_prev[i] = game.objects[i].y;
z_prev[i] = game.objects[i].z;
}else e_prev[i] = false;
}
}
}
void CheckCollisions(Object <DVZ_ME#0>,Object <DVZ_ME#1>){
if(!e_prev[Num2]){
e_prev[Num2] = true;
x_prev[Num2] = game.objects[Num2].x;
y_prev[Num2] = game.objects[Num2].y;
z_prev[Num2] = game.objects[Num2].z;
}
Frame <DVZ_ME#4> = Obj1.data.frames[Obj1.frame1];
Frame <DVZ_ME#5> = Obj2.data.frames[Obj2.frame1];
for(int i = 0;i<Frame1.bdy_count;++i){
Bdy <DVZ_ME#2> = Frame1.bdys[i];
for(int j = 0;j<Frame2.itr_count;++j){
Itr <DVZ_ME#3> = Frame2.itrs[j];
if(itr.kind != 14) continue;
if(ItrHitsBdy(Obj1,Obj2,bdy,itr)) DoCollision(Obj1,Obj2,bdy,itr);
else if(ItrHitsBdy(Obj1,Obj2,bdy,itr,Obj1.x,Obj1.y+1,Obj1.z,Obj2.x,Obj2.y,Obj2.z) && Obj1.y_velocity>Obj2.y_velocity && Obj1.y_velocity<Obj2.y_velocity+2) DoPlatforming(Obj1,Obj2,bdy,itr);
}
}
}
void DoCollision(Object <DVZ_ME#0>,Object <DVZ_ME#1>,const Bdy <DVZ_ME#2>,const Itr <DVZ_ME#3>){
Frame <DVZ_ME#4> = Obj1.data.frames[Obj1.frame1];
Frame <DVZ_ME#5> = Obj2.data.frames[Obj2.frame1];
if(Obj1.data.type == 3){
for(int i = 0;i<Frame2.bdy_count;++i){
Bdy <DVZ_ME#2> = Frame2.bdys[i];
for(int j = 0;j<Frame1.itr_count;++j){
Itr <DVZ_ME#3> = Frame1.itrs[j];
if(ItrHitsBdy(Obj2,Obj1,bdy,itr)) return;
}
}
if(frame_next == -1){
frame_next = 20;
Obj1.x_velocity = 0;
Obj1.y_velocity = 0;
Obj1.z_velocity = 0;
}
return;
}
int rel_x = Obj1.x-x_prev[Num1]-Obj2.x+x_prev[Num2],
rel_y = Obj1.y-y_prev[Num1]-Obj2.y+y_prev[Num2],
rel_z = Obj1.z-z_prev[Num1]-Obj2.z+z_prev[Num2];
int bx = Obj1.x,
by = Obj1.y,
bz = Obj1.z,
ix = Obj2.x,
iy = Obj2.y,
iz = Obj2.z,
zw = itr.zwidth == 0?15:itr.zwidth;
if(Obj1.facing) bx += Frame1.centerx-bdy.x-bdy.w;
else bx -= Frame1.centerx-bdy.x;
if(Obj2.facing) ix += Frame2.centerx-itr.x-itr.w;
else ix -= Frame2.centerx-itr.x;
by -= Frame1.centery-bdy.y;
iy -= Frame2.centery-itr.y;
bool FixedCollision = false;
//passive collision
if(!ItrHitsBdy(Obj1,Obj2,bdy,itr,x_prev[Num1],Obj1.y,Obj1.z,x_prev[Num2],Obj2.y,Obj2.z)){
if(rel_x>0){
int x_temp = ix-bx-bdy.w;
if(x_temp<x-Obj1.x || (!x_update && x_temp <= x-Obj1.x)){
x += x_temp;
Obj1.x_velocity = Obj2.x_velocity;
FixedCollision = true;
x_update = true;
}
}else if(rel_x<0){
int x_temp = ix+itr.w-bx+1;
if(x_temp >= x-Obj1.x || (!x_update && x_temp >= x-Obj1.x)){
x += x_temp;
Obj1.x_velocity = Obj2.x_velocity;
FixedCollision = true;
x_update = true;
}
}
}
if(!ItrHitsBdy(Obj1,Obj2,bdy,itr,Obj1.x,Obj1.y,z_prev[Num1],Obj2.x,Obj2.y,z_prev[Num2])){
if(rel_z>0){
int z_temp = iz-bz-zw;
if(z_temp<z-Obj1.z || (!z_update && z_temp <= z-Obj1.z)){
z += z_temp;
Obj1.z_velocity = Obj2.z_velocity;
FixedCollision = true;
z_update = true;
}
}else if(rel_z<0){
int z_temp = iz-bz+zw;
if(z_temp >= z-Obj1.z || (!z_update && z_temp >= z-Obj1.z)){
z += z_temp;
Obj1.z_velocity = Obj2.z_velocity;
FixedCollision = true;
z_update = true;
}
}
}
if(!ItrHitsBdy(Obj1,Obj2,bdy,itr,Obj1.x,y_prev[Num1],Obj1.z,Obj2.x,y_prev[Num2],Obj2.z)){
if(rel_y>0){
int y_temp = iy-by-bdy.h;
if(y_temp<y-Obj1.y || (!y_update && y_temp <= y-Obj1.y)){
if(frame_next == -1){
double y_vel = (Obj1.y_velocity-Obj2.y_velocity)*.7-.25;
y += y_temp;
Obj1.y_velocity = Obj2.y_velocity;
FixedCollision = true;
y_update = true;
in_air = false;
ReactToLanding(Obj1,Obj2,rel_x,rel_y,y_vel);
}
}
}else if(rel_y<0){
int y_temp = iy+itr.h-by+1;
if(y_temp >= y-Obj1.y || (!y_update && y_temp >= y-Obj1.y)){
y += y_temp;
Obj1.y_velocity = Obj2.y_velocity;
FixedCollision = true;
y_update = true;
}
}
}
if(FixedCollision) return;
//aggressive collision
int bx_prev = bx+x_prev[Num1]-Obj1.x,
by_prev = by+y_prev[Num1]-Obj1.y,
bz_prev = bz+z_prev[Num1]-Obj1.z,
ix_prev = ix+x_prev[Num2]-Obj2.x,
iy_prev = iy+y_prev[Num2]-Obj2.y,
iz_prev = iz+z_prev[Num2]-Obj2.z;
int x_temp_prev1 = bx_prev+bdy.w-ix_prev;
int x_temp_prev2 = ix_prev+itr.w-bx_prev+1;
int y_temp_prev1 = by_prev+bdy.h-iy_prev;
int y_temp_prev2 = iy_prev+itr.h-by_prev+1;
int z_temp_prev1 = bz_prev-iz_prev+zw;
int z_temp_prev2 = iz_prev-bz_prev+zw;
int x_temp1 = ix-bx-bdy.w;
int x_temp2 = ix+itr.w-bx+1;
int y_temp1 = iy-by-bdy.y;
int y_temp2 = iy+itr.y-by+1;
int z_temp1 = iz-bz-zw;
int z_temp2 = iz-bz+zw;
/*
int x_temp_prev1 = bx_prev+bdy.w-ix_prev;
int x_temp_prev2 = ix_prev+itr.w-bx_prev+1;
int y_temp_prev1 = by_prev+bdy.h-iy_prev;
int y_temp_prev2 = iy_prev+itr.h-by_prev+1;
int z_temp_prev1 = bz_prev-iz_prev+zw;
int z_temp_prev2 = iz_prev-bz_prev+zw;
int x_temp1 = ix_prev-bx_prev-bdy.w;
int x_temp2 = ix_prev+itr.w-bx_prev+1;
int y_temp1 = iy_prev-by_prev-bdy.y;
int y_temp2 = iy_prev+itr.y-by_prev+1;
int z_temp1 = iz_prev-bz_prev-zw;
int z_temp2 = iz_prev-bz_prev+zw;
*/
if(x+x_temp1<0) x_temp_prev1 = 0x7fffffff;
if(x+x_temp2 >= x_max) x_temp_prev2 = 0x7fffffff;
y_temp_prev1 *= 2;
if(y+y_temp2>0) y_temp_prev2 = 0x7fffffff;
if(z+z_temp1<z_min) z_temp_prev1 = 0x7fffffff;
if(z+z_temp2>z_max) z_temp_prev2 = 0x7fffffff;
if(x_temp_prev1 == 0x7fffffff && x_temp_prev2 == 0x7fffffff && z_temp_prev1 == 0x7fffffff && z_temp_prev2 == 0x7fffffff) return;
if(x_temp_prev1 <= x_temp_prev2 && x_temp_prev1 <= z_temp_prev1 && x_temp_prev1 <= z_temp_prev2 && x_temp_prev1 <= y_temp_prev2 && x_temp_prev1 <= y_temp_prev1){
x += x_temp1;
Obj1.x_velocity = Obj2.x_velocity;
FixedCollision = true;
x_update = true;
}else if(x_temp_prev2<x_temp_prev1 && x_temp_prev2 <= z_temp_prev1 && x_temp_prev2 <= z_temp_prev2 && x_temp_prev2 <= y_temp_prev2 && x_temp_prev2 <= y_temp_prev1){
x += x_temp2;
Obj1.x_velocity = Obj2.x_velocity;
FixedCollision = true;
x_update = true;
}else if(z_temp_prev1<x_temp_prev1 && z_temp_prev1<x_temp_prev2 && z_temp_prev1 <= z_temp_prev2 && z_temp_prev1 <= y_temp_prev2 && z_temp_prev1 <= y_temp_prev1){
z += z_temp1;
Obj1.z_velocity = Obj2.z_velocity;
FixedCollision = true;
z_update = true;
}else if(z_temp_prev2<x_temp_prev1 && z_temp_prev2<x_temp_prev2 && z_temp_prev2<z_temp_prev1 && z_temp_prev2 <= y_temp_prev2 && z_temp_prev2 <= y_temp_prev1){
z += z_temp2;
Obj1.z_velocity = Obj2.z_velocity;
FixedCollision = true;
z_update = true;
}else if(y_temp_prev2<x_temp_prev1 && y_temp_prev2<x_temp_prev2 && y_temp_prev2<z_temp_prev1 && y_temp_prev2<z_temp_prev2 && y_temp_prev2 <= y_temp_prev1){
y += y_temp2;
Obj1.y_velocity = Obj2.y_velocity;
FixedCollision = true;
y_update = true;
}else if(y_temp_prev1<x_temp_prev1 && y_temp_prev1<x_temp_prev2 && y_temp_prev1<z_temp_prev1 && y_temp_prev1<z_temp_prev2 && y_temp_prev1<y_temp_prev2){
double y_vel = (Obj1.y_velocity-Obj2.y_velocity)*.7-.25;
z += y_temp1;
Obj1.z_velocity = Obj2.z_velocity;
FixedCollision = true;
y_update = true;
in_air = false;
ReactToLanding(Obj1,Obj2,rel_x,rel_y,y_vel);
}
}
void ReactToLanding(Object <DVZ_ME#0>,Object <DVZ_ME#1>,int rel_x,int rel_y,double y_vel){
Frame <DVZ_ME#4> = Obj1.data.frames[Obj1.frame1];
if(Obj1.data.type == 0){
if(Frame1.state == 4 || Frame1.state == 6){
frame_next = 215;
Obj1.x_velocity /= 3;
}else if(Frame1.state == 12){
if(rel_y>11 || abs(rel_x) >= 11){
if(Obj1.frame1 <= 186) frame_next = 185;
else frame_next = 191;
if(Obj1.x_velocity>Obj2.x_velocity) Obj1.x_velocity = Obj1.x_velocity>Obj2.x_velocity+7?Obj2.x_velocity+7:Obj1.x_velocity;
if(Obj1.x_velocity<Obj2.x_velocity) Obj1.x_velocity = Obj1.x_velocity<Obj2.x_velocity-7?Obj2.x_velocity-7:Obj1.x_velocity;
Obj1.y_velocity -= 3.5;
}else{
if(frame_next <= 186) frame_next = 230;
else frame_next = 231;
Obj1.x_velocity /= 3;
}
}else{
frame_next = 219;
Obj1.x_velocity /= 3;
}
}else if(Obj1.data.type == 1){
Obj1.x_velocity /= 2;
if(rel_y>10){
Obj1.y_velocity -= 8;
frame_next = 7;
}else{
frame_next = 70;
}
}else if(Obj1.data.type == 2){
Obj1.x_velocity /= 2;
if(rel_y>9){
Obj1.y_velocity -= 5;
frame_next = 0;
}else{
frame_next = 20;
}
}else if(Obj1.data.type == 4 || Obj1.data.type == 6){
if(y_vel>10){
Obj1.y_velocity -= 10;
Obj1.x_velocity *= 0.7;
frame_next = 40;
}else if(y_vel>8.2 || abs(rel_x) >= 11){
Obj1.y_velocity -= y_vel;
Obj1.x_velocity *= 0.7;
frame_next = 0;
}else{
Obj1.x_velocity *= 0.7;
frame_next = 60;
}
print("y_vel: "+Obj1.y_velocity);
print("Y_Vel: "+y_vel);
}
}
void DoPlatforming(Object <DVZ_ME#0>,Object <DVZ_ME#1>,const Bdy <DVZ_ME#2>,const Itr <DVZ_ME#3>){
Frame <DVZ_ME#4> = Obj1.data.frames[Obj1.frame1];
in_air = false;
Obj1.y_velocity = Obj2.y_velocity;
if(Obj1.x_velocity>0){
Obj1.x_velocity -= 1;
if(Obj1.x_velocity <= 0) Obj1.x_velocity = 0;
}
if(Obj1.x_velocity<0){
Obj1.x_velocity += 1;
if(Obj1.x_velocity >= 0) Obj1.x_velocity = 0;
}
if(Obj1.z_velocity>0){
Obj1.z_velocity -= 1;
if(Obj1.z_velocity <= 0) Obj1.z_velocity = 0;
}
if(Obj1.z_velocity<0){
Obj1.z_velocity += 1;
if(Obj1.z_velocity >= 0) Obj1.z_velocity = 0;
}
if((Frame1.state == 0 || Frame1.state == 1)){
bool walking = false;
bool running = false;
if(((Obj1.up != Obj1.down) || (Obj1.left != Obj1.right))){
walking = true;
}
if(Obj1.left != Obj1.right){
if(Obj1.left){
Obj1.facing = true;
if(!Obj1.holding_left){
if(Obj1.run_counter<0){
running = true;
}else{
Obj1.run_counter = -10;
}
}
}else if(Obj1.right){
Obj1.facing = false;
if(!Obj1.holding_right){
if(Obj1.run_counter>0){
running = true;
}else{
Obj1.run_counter = 10;
}
}
}
}
if(running){
if(Obj1.weapon_type == 2) frame_next = 16;
else frame_next = 9;
Obj1.run_counter = 0;
}else if(walking){
Obj1.move_counter = (Obj1.move_counter+1)%(Obj1.data.walking_frame_rate*6);
switch(Obj1.move_counter/Obj1.data.walking_frame_rate){
case 0: {
if(Obj1.weapon_type == 2) frame_next = 12;
else frame_next = 5;
break;
}
case 5:
case 1: {
if(Obj1.weapon_type == 2) frame_next = 13;
else frame_next = 6;
break;
}
case 4:
case 2: {
if(Obj1.weapon_type == 2) frame_next = 14;
else frame_next = 7;
break;
}
case 3: {
if(Obj1.weapon_type == 2) frame_next = 15;
else frame_next = 8;
break;
}
}
if(Obj1.up != Obj1.down){
if(Obj1.weapon_type == 2) Obj1.z_velocity = Obj1.data.heavy_walking_speedz;
else Obj1.z_velocity = Obj1.data.walking_speedz;
if(Obj1.up) Obj1.z_velocity = -Obj1.z_velocity;
}
if(Obj1.left != Obj1.right){
if(Obj1.weapon_type == 2) Obj1.x_velocity = Obj1.data.heavy_walking_speed;
else Obj1.x_velocity = Obj1.data.walking_speed;
if(Obj1.up != Obj1.down){
Obj1.x_velocity /= 1.4;
}
if(Obj1.left) Obj1.x_velocity = -Obj1.x_velocity;
}
}
}
if(Frame1.state == 2){
if(Obj1.up != Obj1.down){
Obj1.z_velocity = Obj1.data.running_speedz;
if(Obj1.up) Obj1.z_velocity = -Obj1.z_velocity;
Obj1.x_velocity /= 1.2;
}
}
}
string cats(const CharArray <DVZ_ME#7>,int start = 0){
string str;
for(int i = start;arr[i] != 0;++i){
str += ' ';
str[i-start] = arr[i];
}
return str;
}
void PrintPlatData(const DataFile <DVZ_ME#8>,const Bdy@DefaultBdy){
for(int i = 0;i<400;++i){
Frame <DVZ_ME#9> = Data.frames[i];
if(!frame.exists) continue;
print("<frame> "+i+" "+cats(frame.fname)+
"\n pic: "+frame.pic+" state: "+frame.state+" wait: "+frame.wait+" next: "+frame.next+" dvx: "+frame.dvx+" dvy: "+frame.dvy+" dvz: "+frame.dvz+" centerx: "+frame.centerx+" centery: "+frame.centery+" hit_a: "+frame.hit_a+" hit_d: "+frame.hit_d+" hit_j: "+frame.hit_j);
if(frame.hit_Fa != 0) print(" hit_Fa: "+frame.hit_Fa);
if(frame.hit_Ua != 0) print(" hit_Ua: "+frame.hit_Ua);
if(frame.hit_Da != 0) print(" hit_Da: "+frame.hit_Da);
if(frame.hit_Fj != 0) print(" hit_Fj: "+frame.hit_Fj);
if(frame.hit_Uj != 0) print(" hit_Uj: "+frame.hit_Uj);
if(frame.hit_Dj != 0) print(" hit_Dj: "+frame.hit_Dj);
if(frame.hit_ja != 0) print(" hit_ja: "+frame.hit_ja);
if(frame.mp != 0) print(" mp: "+frame.mp);
if(frame.sound_ptr != 0) print("\n sound: "+cats(frame.sound)+" ");
if(frame.opoint.kind != 0) print("\n opoint:"
"\n kind: "+frame.opoint.kind+" x: "+frame.opoint.x+" y: "+frame.opoint.y+" action: "+frame.opoint.action+" dvx: "+frame.opoint.dvx+" dvy: "+frame.opoint.dvy+" oid: "+frame.opoint.oid+" facing: "+frame.opoint.facing+
"\n opoint_end:");
if(frame.bpoint.x != 0 || frame.bpoint.y != 0) print("\n bpoint:"
"\n x: "+frame.bpoint.x+" y: "+frame.bpoint.y+
"\n bpoint_end:");
if(frame.cpoint.kind != 0){
print("\n cpoint:"
"\n kind: "+frame.cpoint.kind+" x: "+frame.cpoint.x+" y: "+frame.cpoint.y+
"\n ");
if(frame.cpoint.kind == 1){
if(frame.cpoint.injury != 0) print(" injury: "+frame.cpoint.injury);
if(frame.cpoint.cover != 0) print(" cover: "+frame.cpoint.cover);
print(" vaction: "+frame.cpoint.vaction);
if(frame.cpoint.aaction != 0) print(" aaction: "+frame.cpoint.aaction);
if(frame.cpoint.jaction != 0) print(" jaction: "+frame.cpoint.jaction);
if(frame.cpoint.daction != 0) print(" daction: "+frame.cpoint.daction);
if(frame.cpoint.taction != 0) print(" taction: "+frame.cpoint.taction);
if(frame.cpoint.throwvz != -842150451){
print(" throwvx: "+frame.cpoint.throwvx+" throwvy: "+frame.cpoint.throwvy);
}
print(" throwvz: "+frame.cpoint.throwvz);
if(frame.cpoint.hurtable != 0) print(" hurtable: "+frame.cpoint.hurtable);
print(" throwinjury: "+frame.cpoint.throwinjury);
if(frame.cpoint.decrease != 0) print(" decrease: "+frame.cpoint.decrease);
if(frame.cpoint.dircontrol != 0) print(" dircontrol: "+frame.cpoint.dircontrol);
}else if(frame.cpoint.kind == 2){
if(frame.cpoint.injury != 0) print(" fronthurtact: "+frame.cpoint.injury);
if(frame.cpoint.cover != 0) print(" backhurtact: "+frame.cpoint.cover);
if(frame.cpoint.injury == 0 && frame.cpoint.cover == 0) print(" ");
}
print("\n cpoint_end:");
}
if(frame.wpoint.kind != 0){
print("\n wpoint:"
"\n kind: "+frame.wpoint.kind+" x: "+frame.wpoint.x+" y: "+frame.wpoint.y+" weaponact: "+frame.wpoint.weaponact+" attacking: "+frame.wpoint.attacking+" cover: "+frame.wpoint.cover+" dvx: "+frame.wpoint.dvx+" dvy: "+frame.wpoint.dvy);
if(Data.type != 2) print(" dvz: "+frame.wpoint.dvz);
print("\n wpoint_end:");
}
for(int j = 0;j<frame.itr_count;++j){
Itr <DVZ_ME#3> = frame.itrs[j];
print("\n itr:"+
"\n kind: "+itr.kind+" x: "+itr.x+" y: "+itr.y+" w: "+itr.w+" h: "+itr.h);
if(itr.dvx != 0) print(" dvx: "+itr.dvx);
if(itr.dvy != 0) print(" dvy: "+itr.dvy);
if(itr.fall != 0) print(" fall: "+itr.fall);
if(itr.arest != 0) print(" arest: "+itr.arest);
if(itr.vrest != 0) print(" vrest: "+itr.vrest);
if(itr.bdefend != 0) print(" bdefend: "+itr.bdefend);
if(itr.injury != 0) print(" injury: "+itr.injury);
if(itr.zwidth != 0) print(" zwidth: "+itr.zwidth);
if(itr.kind == 2 || itr.effect != 0 || itr.catchingact1 != 0 || itr.catchingact2 != 0 || itr.caughtact1 != 0 || itr.caughtact2 != 0) print("\n ");
if(itr.effect != 0) print(" effect: "+itr.effect);
if(itr.catchingact1 != 0 || itr.catchingact2 != 0) print(" catchingact: "+itr.catchingact1+" "+itr.catchingact2);
if(itr.caughtact1 != 0 || itr.caughtact2 != 0) print(" caughtact: "+itr.caughtact1+" "+itr.caughtact2);
print("\n itr_end:");
}
for(int j = 0;j<frame.bdy_count;++j){
Bdy <DVZ_ME#2> = frame.bdys[j];
print("\n bdy:"+
"\n kind: "+bdy.kind+" x: "+bdy.x+" y: "+bdy.y+" w: "+bdy.w+" h: "+(bdy.y>1000?(frame.centery-bdy.y+1000):(frame.centery-bdy.y))+
"\n bdy_end:");
}
if(frame.bdy_count == 0){
print("\n bdy: #automated"+
"\n kind: "+DefaultBdy.kind+" x: "+DefaultBdy.x+" y: "+DefaultBdy.y+" w: "+DefaultBdy.w+" h: "+(DefaultBdy.y>1000?(frame.centery-DefaultBdy.y+1000):(frame.centery-DefaultBdy.y))+
"\n bdy_end:");
}
print("\n<frame_end>\n\n");
}
}
|
All of the previous links include the full source as well as CodeBlocks project file, but there are a few things to note:
- The code has been modified so it now compiles using MinGW (GCC).
- The code now no longer uses Microsoft Detours for hooks, but instead uses MHook (which does basically the same thing). You can get MHook here: http://codefromthe70s.org/mhook23.aspx
RE: Plugins for LF2 (including one for platforms) - A-Man - 05-30-2014
Woho! I was just reading about your platform implementation, and I was wondering when you're going to release it. This looks really neat. I see you had to reprogram almost all the logic of itrs and bdys. That's too powerful I got to say! Hopefully, we're going to see some really cool implementations with this.
Keep this up!
Edit: Sorry for such a useless post. I suggest you add a study example along with the dll for lazy people to test.
|