From aa145934e26867015f3e7ad456a21feb6724fd90 Mon Sep 17 00:00:00 2001 From: turican0 Date: Sun, 28 Jul 2019 20:04:37 +0200 Subject: [PATCH] 190728-01 --- level4.pal | Bin 768 -> 768 bytes remc2/engine/info.x | 58 +++- remc2/engine/sub_main.cpp | 408 +++++++++++++++-------- remc2/portability/port_sdl_vga_mouse.cpp | 2 +- 4 files changed, 318 insertions(+), 150 deletions(-) diff --git a/level4.pal b/level4.pal index 8380e61a1d50f24ba70dd56de74564fb749c5665..0ecbac33f44529d9701eae8c9b262c7da0f50416 100644 GIT binary patch literal 768 QcmZQz7zLvtFmgix00RI30RR91 literal 768 zcmbW#>vGdT42EIJ+O=2OlfCiAb{ykCJ*CicXkeg}`u=Z=%`KpL=KG=FF90AwBqS(6 z-(Zc{6o3YRZ;%lTLXAL(iYi5a!u;~hsC>+_urt!uEHoi8tvBK7h3*v*cNxFm0(e@!Em!i$qjp9cMS*A%k zH)eYp>}j;e#T_qUxVt$m<;i9+dTR99=%vO*;ab$VHh8J=(%=V!o56d79~mD6KUsXV z)n}<5Ej`)lsjSc!Pv1O!b@c4$yQk+!*FZla{VW3giuAjqmyTW&{W;KUPk%GL^|WW& zk9r@}KI(l^`$_M!+Go8lh1ysBmguFWS>delq+!xHsRBlggTjGes4x@e3VXs{LDn!R z8Z>3CdZm)qU4<=TM2LU^3kU!X!9r1rsv0B>B_Z?#E#aZUpcNuk2s`Y)0;z7*X@pg9 cWmpWJ8XRlvHFi|8{m;ueZ`*dgUiW?f2PI=DBme*a diff --git a/remc2/engine/info.x b/remc2/engine/info.x index 97727d2c59..2b118663e9 100644 --- a/remc2/engine/info.x +++ b/remc2/engine/info.x @@ -7327,4 +7327,60 @@ char sub_78730_save_game_dialog(x_WORD *a1)//259730 x_BYTE_17DF11_last_key_status backspace test -type_str_0x6E8E* sub_48930(__int16 a1, __int16 a2, __int16 a3, __int16 a4, char a5)//229930 \ No newline at end of file +type_str_0x6E8E* sub_48930(__int16 a1, __int16 a2, __int16 a3, __int16 a4, char a5)//229930 + +3551a4 - adress +ebx=0xa*18=0xb4 +eax=0x51*14=0x46e +edx=[ebx+2a5c56]=2a7978 +cmp [2a7978+a],0 +78792a00445c2a000b0000000000907e +edx=[2a7978+4] tj 51 + +ebx 3551a4 +push ebx +call eax+6 tj 2a7978+6 tj 200b230001000000 + +*(Bit32u*)&x_DWORD_D4C52ar[4 + 18*10]+81 * 14 + +add +void sub_5B100(int a2, type_str_0x6E8E* a1x)//23c100 +to +pre_sub_4A190 + +x_BYTE_10B4E0_terraintype+0x66 0x06 +versus +2dc4e0+0x66 0x4d + +06060601 +void sub_462A0(unsigned __int16 a1, __int16 a2)//2272a0 + +x_BYTE_10B4E0_terraintype +0x6064 (0x1) +versus +0x2dc4e0 +0x6064 (0x6) + +(Bit8u*)&D41A0_BYTESTR_0+0xa204 0x02 +(Bit8u*)x_D41A0_BYTEARRAY_0+0xa204 0x22 +0x356038+0xa204 + +0x22 +229986 +type_str_0x6E8E* sub_48930(__int16 a1, __int16 a2, __int16 a3, __int16 a4, char a5)//229930 + +(Bit8u*)&D41A0_BYTESTR_0+0xa20a 0x94 +(Bit8u*)x_D41A0_BYTEARRAY_0+0xa20a 0x00 +0x356038+0xa20a +ale je 360242 + +void sub_49090(type_str_2FECE* a1x, type_str_0x30311* a2x)//22a090 + +22a16b - stop + +1c7f* +1a57* +333a* +5126* +8d33* +914f* +7313 +9421 \ No newline at end of file diff --git a/remc2/engine/sub_main.cpp b/remc2/engine/sub_main.cpp index 38c682b563..8fdaf35067 100644 --- a/remc2/engine/sub_main.cpp +++ b/remc2/engine/sub_main.cpp @@ -10,7 +10,7 @@ //#define SET_LEVEL -//#define DEBUG_SEQUENCES +#define DEBUG_SEQUENCES #define FIX_DETECT_SPEED @@ -2164,7 +2164,7 @@ void sub_45AA0_setMax4Tiles(); // char sub_45BE0(char a1, char a2, unsigned __int16 a3); // char sub_45DC0(char a1, char a2, unsigned __int16 a3, unsigned __int8 a4); unsigned __int16 sub_46180(unsigned __int16 a1, char a2); -void sub_462A0(unsigned __int16 a1, __int16 a2); +void sub_462A0(uaxis_2d a1x, uaxis_2d a2x); char sub_46570(unsigned __int16 a1, __int16 a2); void sub_46820_simple_timer(Bit32u user); // int sub_46830_main_loop(signed __int16 *a1, signed int a2, unsigned __int16 a3); @@ -2564,7 +2564,7 @@ int sub_59C80(type_str_0x6E8E* a1); char sub_59DC0(type_str_0x6E8E* a1); void sub_59F60(type_str_0x6E8E* a1); type_str_0x6E8E* sub_5B070(type_str_0x6E8E* a1); -void sub_5B100(int a2,type_str_0x6E8E* a1); +void sub_5B100(/*int a2,*/type_str_0x6E8E* a1); void sub_5B7A0_prepare_textures(); // int /*__fastcall*/ _wcpp_1_unwind_leave__93(x_DWORD, x_DWORD, x_DWORD, x_DWORD, x_DWORD, x_DWORD); weak void sub_5B840_load_pallette_and_help_pallette(); @@ -45864,7 +45864,7 @@ int sub_343F0(type_str_0x6E8E* a1x)//2153f0 { x_BYTE_13B4E0_angle[v1.word] = x_BYTE_13B4E0_angle[v1.word] & 0xF0 | 1; v2--; - sub_462A0(v1.word, v1.word); + sub_462A0(v1, v1); v1.axis_2d.x += v5; v1.axis_2d.y += v4; } @@ -46157,7 +46157,9 @@ int sub_34B00(char a1, char a2, __int16 a3, __int16 a4)//215b00 { x_BYTE_13B4E0_angle[v4] = v5 & 0xF8 | 1; x_BYTE_10B4E0_terraintype[v4] = 1; - sub_462A0(v4, v4); + uaxis_2d temp_v4; + temp_v4.word = v4; + sub_462A0(temp_v4, temp_v4); } HIWORD(v6) = 0; HIBYTE(v4) = a4 + a2; @@ -46166,7 +46168,9 @@ int sub_34B00(char a1, char a2, __int16 a3, __int16 a4)//215b00 if (v7 & 8) { x_BYTE_13B4E0_angle[v6] = v7 & 0xF8 | 1; - sub_462A0(v4, v4); + uaxis_2d temp_v4; + temp_v4.word = v4; + sub_462A0(temp_v4, temp_v4); } } v13 = 0; @@ -46179,7 +46183,9 @@ int sub_34B00(char a1, char a2, __int16 a3, __int16 a4)//215b00 { x_BYTE_13B4E0_angle[v9] = v10 & 0xF8 | 1; x_BYTE_10B4E0_terraintype[v9] = 1; - sub_462A0(v9, v9); + uaxis_2d temp_v9; + temp_v9.word = v9; + sub_462A0(temp_v9, temp_v9); } HIWORD(v11) = 0; LOBYTE(v9) = a3 + v9; @@ -46188,7 +46194,9 @@ int sub_34B00(char a1, char a2, __int16 a3, __int16 a4)//215b00 if (v12 & 8) { x_BYTE_13B4E0_angle[v11] = v12 & 0xF8 | 1; - sub_462A0(v9, v9); + uaxis_2d temp_v9; + temp_v9.word = v9; + sub_462A0(temp_v9, temp_v9); } v13++; } @@ -47618,7 +47626,9 @@ char sub_36FC0(type_str_0x6E8E* a1x)//217fc0 if (!(v8 & 7)) { x_BYTE_13B4E0_angle[v6] = v8 & 0xF8 | 1; - sub_462A0(v6, v6); + uaxis_2d temp_v6; + temp_v6.word = v6; + sub_462A0(temp_v6, temp_v6); } } if (v29) @@ -47807,7 +47817,11 @@ void sub_37240(type_str_0x6E8E* a1x)//218240 while (v4 > v21) { if (v27[0] != 0xffu) - sub_462A0(v49, v49);//218609 + { + uaxis_2d temp_v49; + temp_v49.word = v49; + sub_462A0(temp_v49, temp_v49);//218609 + } v21++; v27 += 2; LOBYTE(v49)++; @@ -47881,7 +47895,10 @@ void sub_37240(type_str_0x6E8E* a1x)//218240 if (!(x_BYTE_13B4E0_angle[v46] & 7)) { x_BYTE_13B4E0_angle[v46] = x_BYTE_13B4E0_angle[v46] & 0xF0 | 1; - sub_462A0(v46, v46); + + uaxis_2d temp_v46; + temp_v46.word = v46; + sub_462A0(temp_v46, temp_v46); } } if (v50) @@ -49349,7 +49366,11 @@ void sub_39040(type_str_0x6E8E* a1x)//21a040 LOBYTE(v24) = v52 + 15; HIBYTE(v23) = BYTE1(v52) - 15; HIBYTE(v24) = BYTE1(v52) + 15; - sub_462A0(v23, v24); + uaxis_2d temp_v23; + temp_v23.word = v23; + uaxis_2d temp_v24; + temp_v24.word = v24; + sub_462A0(temp_v23, temp_v24); } v25 = 0; HIBYTE(v26) = BYTE1(v52) - 1; @@ -49540,7 +49561,12 @@ unsigned __int8 sub_396D0(type_str_0x6E8E* a1x)//21a6d0 LOBYTE(v8) = v39 + 15; HIBYTE(v7) = v38 - 15; HIBYTE(v8) = v38 + 15; - sub_462A0(v7, v8); + + uaxis_2d temp_v7; + temp_v7.word = v7; + uaxis_2d temp_v8; + temp_v8.word = v8; + sub_462A0(temp_v7, temp_v8); sub_6E450(a1x-D41A0_BYTESTR_0.struct_0x6E8E, -1, 64); } else if (resulty > 1u) @@ -57423,7 +57449,7 @@ void sub_43830_generate_level_map(unsigned int a1, type_str_2FECE* a2x)//224830 sub_43D50();//224d50 //change angle of terrain #ifdef DEBUG_SEQUENCES - /*Bit8u origbyte20 = 0; + Bit8u origbyte20 = 0; Bit8u remakebyte20 = 0; int comp20; //if (debugafterload) @@ -57441,7 +57467,7 @@ void sub_43830_generate_level_map(unsigned int a1, type_str_2FECE* a2x)//224830 //comp20 = compare_with_sequence((char*)"00224959-003AA0A4", x_DWORD_180628b_screen_buffer, 0x3aa0a4, debugcounter_224959, 320 * 200, 320 * 200, &origbyte20, &remakebyte20); debugcounter_224959++; - }*/ + } #endif DEBUG_SEQUENCES @@ -59528,7 +59554,9 @@ void sub_45DC0(Bit8u a1, Bit8u a2, unsigned __int16 a3, unsigned __int8 a4)//226 return; } x_BYTE_13B4E0_angle[a3] = a4 | x_BYTE_13B4E0_angle[a3] & 0xF0; - /*LOBYTE(v5) = */sub_462A0(a3, a3); + uaxis_2d temp_a3; + temp_a3.word = a3; + /*LOBYTE(v5) = */sub_462A0(temp_a3, temp_a3); //return v5; } // D41B6: using guessed type char x_BYTE_D41B6; @@ -59612,24 +59640,25 @@ unsigned __int16 sub_46180(unsigned __int16 a1, char a2)//227180 int counter_finding_sub_462A0=0; //----- (000462A0) -------------------------------------------------------- -void sub_462A0(unsigned __int16 a1, __int16 a2)//2272a0 +void sub_462A0(uaxis_2d a1x, uaxis_2d a2x)//2272a0 { - unsigned __int16 v2; // cx + uaxis_2d v2x; // cx //bool v3; // zf - int v4; // eax - unsigned __int16 v5; // cx + uaxis_2d v4x; // eax + Bit8u v4y; + uaxis_2d v5x; // cx int v6; // edx - unsigned __int16 v7; // ax + //unsigned __int16 v7; // ax int v8; // edx int v9; // ebx int v10; // eax int v11index; // edx char v12; // ST10_1 - unsigned __int16 v13; // cx + uaxis_2d v13x; // cx char v14; // dh char j; // dl - unsigned __int16 v16; // ax - unsigned __int16 v17; // bx + uaxis_2d v16x; // ax + uaxis_2d v17x; // bx char v18; // al char v19; // bl unsigned __int8 v20; // bh @@ -59646,46 +59675,63 @@ void sub_462A0(unsigned __int16 a1, __int16 a2)//2272a0 //v29 = 0; // end - LOBYTE(v4) = a2 - a1 + 1; - v2 = a1; - v25 = a2 - a1 + 1; - HIBYTE(v4) = HIBYTE(a2) - HIBYTE(a1) + 1; + //LOBYTE(v4) = a2 - a1 + 1; + v4x.axis_2d.x= a2x.axis_2d.x - a1x.axis_2d.x + 1; + v2x.word = a1x.word; + v25 = a2x.axis_2d.x - a1x.axis_2d.x + 1; + //HIBYTE(v4) = HIBYTE(a2) - HIBYTE(a1) + 1; + v4x.axis_2d.y = a2x.axis_2d.y - a1x.axis_2d.y + 1; //v3 = HIBYTE(v4) == 0; - v23 = HIBYTE(a2) - HIBYTE(a1) + 1; - while (HIBYTE(v4) != 0) - { - LOBYTE(v4) = a2 - a1 + 1; - while ((x_BYTE)v4) - { - if ((Bit8s)x_BYTE_13B4E0_angle[v2] >= 0) - x_BYTE_10B4E0_terraintype[v2] = 1; - LOBYTE(v2)--; - if ((Bit8s)x_BYTE_13B4E0_angle[v2] >= 0) - x_BYTE_10B4E0_terraintype[v2] = 1; - HIBYTE(v2)--; - if ((Bit8s)x_BYTE_13B4E0_angle[v2] >= 0) - x_BYTE_10B4E0_terraintype[v2] = 1; - LOBYTE(v2)++; - if ((Bit8s)x_BYTE_13B4E0_angle[v2] >= 0) - x_BYTE_10B4E0_terraintype[v2] = 1; - HIBYTE(v2)++; - LOBYTE(v4)--; - LOBYTE(v2)++; - } - LOBYTE(v2) = v2 - v25; - HIBYTE(v2)++; - HIBYTE(v4)--; + v23 = a2x.axis_2d.y - a1x.axis_2d.y + 1; + while (v4x.axis_2d.y != 0) + { + //LOBYTE(v4) = a2 - a1 + 1; + v4x.axis_2d.x = a2x.axis_2d.x - a1x.axis_2d.x + 1; + while (v4x.axis_2d.x) + { + if ((Bit8s)x_BYTE_13B4E0_angle[v2x.word] >= 0) + x_BYTE_10B4E0_terraintype[v2x.word] = 1; + //LOBYTE(v2)--; + v2x.axis_2d.x--; + if ((Bit8s)x_BYTE_13B4E0_angle[v2x.word] >= 0) + x_BYTE_10B4E0_terraintype[v2x.word] = 1; + //HIBYTE(v2)--; + v2x.axis_2d.y--; + if ((Bit8s)x_BYTE_13B4E0_angle[v2x.word] >= 0) + x_BYTE_10B4E0_terraintype[v2x.word] = 1; + //LOBYTE(v2)++; + v2x.axis_2d.x++; + if ((Bit8s)x_BYTE_13B4E0_angle[v2x.word] >= 0) + x_BYTE_10B4E0_terraintype[v2x.word] = 1; + //HIBYTE(v2)++; + //LOBYTE(v4)--; + //LOBYTE(v2)++; + v2x.axis_2d.y++; + v4x.axis_2d.x--; + v2x.axis_2d.x++; + } + //LOBYTE(v2) = v2 - v25; + //HIBYTE(v2)++; + //HIBYTE(v4)--; + v2x.axis_2d.x-=v25; + v2x.axis_2d.y++; + v4x.axis_2d.y--; + //v3 = HIBYTE(v4) == 0; } - LOBYTE(a1)--; - HIBYTE(a1)--; + //LOBYTE(a1)--; + //HIBYTE(a1)--; + a1x.axis_2d.x--; + a1x.axis_2d.y--; + v24 = v23 + 1; v28 = v24; - v5 = a1; + v5x.word = a1x.word; v26 = v25 + 1; while (v28) { - LOBYTE(v4) = v26; + //LOBYTE(v4) = v26; + v4x.axis_2d.x=v26; for (i = v26; i; i--) { //debug @@ -59698,42 +59744,50 @@ void sub_462A0(unsigned __int16 a1, __int16 a2)//2272a0 //debug - v4 = v5; - if (x_BYTE_10B4E0_terraintype[v5] == 1) + v4x.word = v5x.word; + if (x_BYTE_10B4E0_terraintype[v5x.word] == 1) { - LOBYTE(v5)++; - v6 = 343 * (x_BYTE_13B4E0_angle[v4] & 7); - v7 = v5; - HIBYTE(v5)++; - v8 = 49 * (x_BYTE_13B4E0_angle[v7] & 7) + v6; - v9 = x_BYTE_13B4E0_angle[v5] & 7; - LOBYTE(v5)--; - v10 = x_BYTE_13B4E0_angle[v5] & 7; - HIBYTE(v5)--; + + v6 = 343 * (x_BYTE_13B4E0_angle[v4x.word] & 7); + //LOBYTE(v5)++; + v5x.axis_2d.x++; + //v7 = v5; + v8 = 49 * (x_BYTE_13B4E0_angle[v5x.word] & 7) + v6; + //HIBYTE(v5)++; + v5x.axis_2d.y++; + v9 = x_BYTE_13B4E0_angle[v5x.word] & 7; + //LOBYTE(v5)--; + v5x.axis_2d.x--; + v10 = x_BYTE_13B4E0_angle[v5x.word] & 7; + //HIBYTE(v5)--; + v5x.axis_2d.y--; v11index = v10 + 7 * v9 + v8; - LOBYTE(v10) = x_BYTE_F2CD0x[v11index][0]; - x_BYTE_10B4E0_terraintype[v5] = v10; - if (LOBYTE(v10) >= 8u) + //LOBYTE(v10) = x_BYTE_F2CD0x[v11index][0]; + x_BYTE_10B4E0_terraintype[v5x.word] = x_BYTE_F2CD0x[v11index][0]; + if (x_BYTE_F2CD0x[v11index][0] >= 8u) { - LOBYTE(v4) = x_BYTE_F2CD0x[v11index][1] + (x_BYTE_13B4E0_angle[v5] & 0x87); + v4y = x_BYTE_F2CD0x[v11index][1] + (x_BYTE_13B4E0_angle[v5x.word] & 0x87); } else { - v12 = x_BYTE_13B4E0_angle[v5] & 0x87; + v12 = x_BYTE_13B4E0_angle[v5x.word] & 0x87; x_WORD_17B4E0 = 9377 * x_WORD_17B4E0 + 9439; - LOBYTE(v4) = v12 + 16 * (x_WORD_17B4E0 % 7u); + v4y = v12 + 16 * (x_WORD_17B4E0 % 7u); } - x_BYTE_13B4E0_angle[v5] = v4; + x_BYTE_13B4E0_angle[v5x.word] = v4y; } - LOBYTE(v5)++; + //LOBYTE(v5)++; + v5x.axis_2d.x++; } - LOBYTE(v5) -= v26; - HIBYTE(v5)++; + //LOBYTE(v5) -= v26; + //HIBYTE(v5)++; + v5x.axis_2d.x-=v26; + v5x.axis_2d.y++; v28--; } v27 = v26 + 1; //v13 = v29;//fixed - v13 = a1;//fixed + v13x.word = a1x.word;//fixed v14 = v24 + 1; if (v24 != -1) { @@ -59741,15 +59795,21 @@ void sub_462A0(unsigned __int16 a1, __int16 a2)//2272a0 { for (j = v27; j; j--) { - LOBYTE(v13)++; - HIBYTE(v13)++; - v16 = v13; - LOBYTE(v13)-=2; - HIBYTE(v13)-=2; - v17 = v13; - LOBYTE(v13)++; - v18 = x_BYTE_11B4E0_height[v17] - x_BYTE_11B4E0_height[v16] + 32; - HIBYTE(v13)++; + //LOBYTE(v13)++; + //HIBYTE(v13)++; + v13x.axis_2d.x++; + v13x.axis_2d.y++; + v16x.word = v13x.word; + //LOBYTE(v13)-=2; + //HIBYTE(v13)-=2; + v13x.axis_2d.x-=2; + v13x.axis_2d.y-=2; + v17x.word = v13x.word; + //LOBYTE(v13)++; + v13x.axis_2d.x++; + v18 = x_BYTE_11B4E0_height[v17x.word] - x_BYTE_11B4E0_height[v16x.word] + 32; + //HIBYTE(v13)++; + v13x.axis_2d.y++; if (v18 >= 28) { if (v18 > 40) @@ -59763,23 +59823,26 @@ void sub_462A0(unsigned __int16 a1, __int16 a2)//2272a0 v19 = 32 - v18 + 32; else v19 = v18; - v4 = v13; - x_BYTE_12B4E0_shading[v13] = v19; - v20 = x_BYTE_11B4E0_height[v13]; - if (x_BYTE_D41B6 && (x_BYTE_14B4E0[v13] <= v20)) + v4x.word = v13x.word; + x_BYTE_12B4E0_shading[v13x.word] = v19; + v20 = x_BYTE_11B4E0_height[v13x.word]; + if (x_BYTE_D41B6 && (x_BYTE_14B4E0[v13x.word] <= v20)) { - x_BYTE_14B4E0[v13] = v20 - 1; - x_BYTE_13B4E0_angle[v13] |= 8u; + x_BYTE_14B4E0[v13x.word] = v20 - 1; + x_BYTE_13B4E0_angle[v13x.word] |= 8u; } else { - x_BYTE_13B4E0_angle[v13] &= 0xF7u; + x_BYTE_13B4E0_angle[v13x.word] &= 0xF7u; } - LOBYTE(v13)++; + //LOBYTE(v13)++; + v13x.axis_2d.x++; } - LOBYTE(v13) -= v27; + //LOBYTE(v13) -= v27; + v13x.axis_2d.x-=v27; v14--; - HIBYTE(v13)++; + //HIBYTE(v13)++; + v13x.axis_2d.y++; } while (v14); } @@ -61915,27 +61978,35 @@ type_str_0x6E8E* sub_48930(__int16 a1, __int16 a2, __int16 a3, __int16 a4, char type_str_0x6E8E* result; // eax __int16 v6; // [esp+0h] [ebp-10h] __int16 v7; // [esp+2h] [ebp-Eh] - __int16 v8; // [esp+8h] [ebp-8h] - __int16 v9; // [esp+Ah] [ebp-6h] - __int16 v10; // [esp+Ch] [ebp-4h] + axis_3d v8x; // [esp+8h] [ebp-8h] + //__int16 v9; // [esp+Ah] [ebp-6h] + //__int16 v10; // [esp+Ch] [ebp-4h] //fixed - v10=0; + //v10=0; + v8x.z = 0;// 0x52b0; //fixed v6 = a1 << 8; v7 = a2 << 8; - v8 = a3 << 8; - v9 = a4 << 8; + v8x.x = a3 << 8; + v8x.y = a4 << 8; + //result = sub_4A190(&v6, 10, 81); int v3; // eax //int resulty; // eax //v3 = *(int*)((char*)&dword_D4C56 + 18 * 10) + 14 * 81; - v3= *(Bit32u*)&(x_DWORD_D4C52ar[(4 + 18*10+81 * 14)]); + v3= (int)&x_DWORD_D4C52ar[*(Bit32u*)&x_DWORD_D4C52ar[4 + 18 * 10] + 81 * 14 - 0x2a5c52]; if (*(_DWORD*)(v3 + 10) && *(signed __int16*)(v3 + 4) == 81) - result = pre_sub_4A190((Bit32u)*(_DWORD*)(v3+6),&a1, 0); //(*(int(__cdecl * *)(int))(v3 + 6))(a1); + { + Bit16s a1x[3]; + a1x[0] = a1; + a1x[1] = a2; + a1x[2] = 0x51d4; + result = pre_sub_4A190((Bit32u) * (_DWORD*)(v3 + 6), a1x, 0); //(*(int(__cdecl * *)(int))(v3 + 6))(a1); + } else result = 0; @@ -61946,9 +62017,11 @@ type_str_0x6E8E* sub_48930(__int16 a1, __int16 a2, __int16 a3, __int16 a4, char if (result) { - *(_DWORD*)(result + 154) = *(_DWORD*)&v8; + /* *(_DWORD*)(result + 154) = *(_DWORD*)&v8; *(_WORD*)(result + 158) = v10; - *(_BYTE*)(result + 70) = a5; + *(_BYTE*)(result + 70) = a5;*/ + result->word_0x9A_154x = v8x; + result->byte_0x46_70 = a5; } return result; } @@ -62498,6 +62571,9 @@ void sub_49090(type_str_2FECE* a1x, type_str_0x30311* a2x)//22a090 //----- (00049270) -------------------------------------------------------- //01 355248 385f06 + +int debugcounter_22a270 = 0; + void sub_49270_generate_level_features(type_str_2FECE* a1x)//22a270 { //debug @@ -62517,19 +62593,25 @@ void sub_49270_generate_level_features(type_str_2FECE* a1x)//22a270 // compsize = compare_with_snapshot((char*)"0160-00256200-2", x_DWORD_180628b_screen_buffer, 0x3aa0a4, 640 * height, &origbyte, &remakebyte);//4c //debug sub_49830(a1x); - //debug - /*Bit8u origbyte20 = 0; + //adress 22A27D +#ifdef DEBUG_SEQUENCES + Bit8u origbyte20 = 0; Bit8u remakebyte20 = 0; - int debugcounter11 = 0; int comp20; - comp20 = compare_with_sequence_D41A0((char*)"0022A27D", (Bit8u*)x_BYTE_10B4E0_terraintype, 0x2dc4e0, debugcounter11, 0x10000, &origbyte20, &remakebyte20); - comp20 = compare_with_sequence_D41A0((char*)"0022A27D", (Bit8u*)x_BYTE_11B4E0_height, 0x2dc4e0, debugcounter11, 0x10000, &origbyte20, &remakebyte20, 0x10000); - comp20 = compare_with_sequence_D41A0((char*)"0022A27D", (Bit8u*)x_BYTE_12B4E0_shading, 0x2dc4e0, debugcounter11, 0x10000, &origbyte20, &remakebyte20, 0x20000); - comp20 = compare_with_sequence_D41A0((char*)"0022A27D", (Bit8u*)x_BYTE_13B4E0_angle, 0x2dc4e0, debugcounter11, 0x10000, &origbyte20, &remakebyte20, 0x30000); - //comp20 = compare_with_sequence_D41A0((char*)"0022A27D", (Bit8u*)x_BYTE_14B4E0, 0x2dc4e0, debugcounter11, 0x10000, &origbyte20, &remakebyte20, 0x40000); - comp20 = compare_with_sequence_D41A0((char*)"0022A27D", (Bit8u*)x_WORD_15B4E0_source, 0x2dc4e0, debugcounter11, 0x20000, &origbyte20, &remakebyte20, 0x50000); - */ - //debug + //if (debugafterload) + { + comp20 = compare_with_sequence((char*)"0022A280-002DC4E0", (Bit8u*)x_BYTE_10B4E0_terraintype, 0x2dc4e0, debugcounter_22a270, 0x70000, 0x10000, &origbyte20, &remakebyte20); + comp20 = compare_with_sequence((char*)"0022A280-002DC4E0", (Bit8u*)x_BYTE_11B4E0_height, 0x2dc4e0, debugcounter_22a270, 0x70000, 0x10000, &origbyte20, &remakebyte20, 0x10000); + comp20 = compare_with_sequence((char*)"0022A280-002DC4E0", (Bit8u*)x_BYTE_12B4E0_shading, 0x2dc4e0, debugcounter_22a270, 0x70000, 0x10000, &origbyte20, &remakebyte20, 0x20000); + comp20 = compare_with_sequence((char*)"0022A280-002DC4E0", (Bit8u*)x_BYTE_13B4E0_angle, 0x2dc4e0, debugcounter_22a270, 0x70000, 0x10000, &origbyte20, &remakebyte20, 0x30000); + comp20 = compare_with_sequence((char*)"0022A280-002DC4E0", (Bit8u*)x_WORD_15B4E0_source, 0x2dc4e0, debugcounter_22a270, 0x70000, 0x20000, &origbyte20, &remakebyte20, 0x50000); + + comp20 = compare_with_sequence_D41A0((char*)"0022A280-00356038", (Bit8u*)& D41A0_BYTESTR_0, 0x356038, debugcounter_22a270, 0x36e16, &origbyte20, &remakebyte20); + + comp20 = compare_with_sequence_array_E2A74((char*)"0022A280-002B3A74", (Bit8u*)&array_E2A74, 0x2b3a74, debugcounter_22a270, 0xc4e, 0xc4e, &origbyte20, &remakebyte20); + debugcounter_22a270++; + } +#endif DEBUG_SEQUENCES sub_49290(a1x, 1); //debug //x_WORD_15B4E0_source 32c4e0 @@ -63034,6 +63116,11 @@ void sub_498A0()//22a8a0 //v8 = 0; // end + Bit8u origbyte20 = 0; + Bit8u remakebyte20 = 0; + int comp20; + + /* Bit8u origbyte20 = 0; Bit8u remakebyte20 = 0; @@ -63076,8 +63163,8 @@ void sub_498A0()//22a8a0 if (*(Bit32u*)(v6 + 10)) v7((int)i); }*/ - v8x = *(Bit32u*)&(x_DWORD_D4C52ar[(v5 + 6 - 0x2a5c52)]); - if (v8x && *(Bit32u*)&(x_DWORD_D4C52ar[(v5 + 10 - 0x2a5c52)])) + v8x = *(Bit32u*)&(x_DWORD_D4C52ar[(v6 + 6 - 0x2a5c52)]); + if (v8x && *(Bit32u*)&(x_DWORD_D4C52ar[(v6 + 10 - 0x2a5c52)])) pre_sub_4A190(v8x, (Bit16s*)&D41A0_BYTESTR_0.struct_0x6E8E[iy],2); } } @@ -63117,17 +63204,20 @@ void sub_498A0()//22a8a0 if (v8x && *(Bit32u*)&(x_DWORD_D4C52ar[(v5 + 10 - 0x2a5c52)])) //v8((int)i, v7); {//adress 22a976 - /*comp20 = compare_with_sequence((char*)"0022A976-002DC4E0", (Bit8u*)x_BYTE_10B4E0_terraintype, 0x2dc4e0, debugcounter22a8a0bb, 0x70000, 0x10000, &origbyte20, &remakebyte20); - comp20 = compare_with_sequence((char*)"0022A976-002DC4E0", (Bit8u*)x_BYTE_11B4E0_height, 0x2dc4e0, debugcounter22a8a0bb, 0x70000, 0x10000, &origbyte20, &remakebyte20, 0x10000); - comp20 = compare_with_sequence((char*)"0022A976-002DC4E0", (Bit8u*)x_BYTE_12B4E0_shading, 0x2dc4e0, debugcounter22a8a0bb, 0x70000, 0x10000, &origbyte20, &remakebyte20, 0x20000); - comp20 = compare_with_sequence((char*)"0022A976-002DC4E0", (Bit8u*)x_BYTE_13B4E0_angle, 0x2dc4e0, debugcounter22a8a0bb, 0x70000, 0x10000, &origbyte20, &remakebyte20, 0x30000); - //comp20 = compare_with_sequence_D41A0((char*)"00237BB0-002DC4E0", (Bit8u*)x_BYTE_14B4E0, 0x2dc4e0, debugcounter11, 0x70000, 0x10000, &origbyte20, &remakebyte20, 0x40000); - comp20 = compare_with_sequence((char*)"0022A976-002DC4E0", (Bit8u*)x_WORD_15B4E0_source, 0x2dc4e0, debugcounter22a8a0bb, 0x70000, 0x20000, &origbyte20, &remakebyte20, 0x50000); - - comp20 = compare_with_sequence_D41A0((char*)"0022A976-00356038", (Bit8u*)& D41A0_BYTESTR_0, 0x356038, debugcounter22a8a0bb, 0x36e16, &origbyte20, &remakebyte20); - - debugcounter22a8a0bb++;*/ + #ifdef DEBUG_SEQUENCES + if (debugcounter22a8a0bb > 0xd28) + { + comp20 = compare_with_sequence((char*)"0022A977-002DC4E0", (Bit8u*)x_BYTE_10B4E0_terraintype, 0x2dc4e0, debugcounter22a8a0bb, 0x70000, 0x10000, &origbyte20, &remakebyte20); + comp20 = compare_with_sequence((char*)"0022A977-002DC4E0", (Bit8u*)x_BYTE_11B4E0_height, 0x2dc4e0, debugcounter22a8a0bb, 0x70000, 0x10000, &origbyte20, &remakebyte20, 0x10000); + comp20 = compare_with_sequence((char*)"0022A977-002DC4E0", (Bit8u*)x_BYTE_12B4E0_shading, 0x2dc4e0, debugcounter22a8a0bb, 0x70000, 0x10000, &origbyte20, &remakebyte20, 0x20000); + comp20 = compare_with_sequence((char*)"0022A977-002DC4E0", (Bit8u*)x_BYTE_13B4E0_angle, 0x2dc4e0, debugcounter22a8a0bb, 0x70000, 0x10000, &origbyte20, &remakebyte20, 0x30000); + //comp20 = compare_with_sequence_D41A0((char*)"00237BB0-002DC4E0", (Bit8u*)x_BYTE_14B4E0, 0x2dc4e0, debugcounter11, 0x70000, 0x10000, &origbyte20, &remakebyte20, 0x40000); + comp20 = compare_with_sequence((char*)"0022A977-002DC4E0", (Bit8u*)x_WORD_15B4E0_source, 0x2dc4e0, debugcounter22a8a0bb, 0x70000, 0x20000, &origbyte20, &remakebyte20, 0x50000); + comp20 = compare_with_sequence_D41A0((char*)"0022A977-00356038", (Bit8u*)& D41A0_BYTESTR_0, 0x356038, debugcounter22a8a0bb, 0x36e16, &origbyte20, &remakebyte20); + } + debugcounter22a8a0bb++; + #endif DEBUG_SEQUENCES pre_sub_4A190(v8x, (Bit16s*)&D41A0_BYTESTR_0.struct_0x6E8E[iy],2); } @@ -66714,6 +66804,19 @@ type_str_0x6E8E* pre_sub_4A190(Bit32u adress, Bit16s* a1,int type)//pre 22b190 break; } + case 0x23c070: { + sub_5B070((type_str_0x6E8E*)a1); + return fix_it_4A190(); + break; + } + case 0x23c100: { + sub_5B100((type_str_0x6E8E*)a1); + return 0; + break; + } + + + @@ -77655,7 +77758,7 @@ void sub_56A30_init_game_level(unsigned int a1)//237a30 //237B05 #ifdef DEBUG_SEQUENCES - /*Bit8u origbyte20 = 0; + Bit8u origbyte20 = 0; Bit8u remakebyte20 = 0; int comp20; //if (debugafterload) @@ -77669,7 +77772,7 @@ void sub_56A30_init_game_level(unsigned int a1)//237a30 comp20 = compare_with_sequence_D41A0((char*)"00237B05-00356038", (Bit8u*)& D41A0_BYTESTR_0, 0x356038, debugcounter_237a30, 0x36e16, &origbyte20, &remakebyte20); comp20 = compare_with_sequence_array_E2A74((char*)"00237B05-002B3A74", (Bit8u*)& array_E2A74, 0x2b3a74, debugcounter_237a30, 0xc4e, 0xc4e, &origbyte20, &remakebyte20); - }*/ + } #endif DEBUG_SEQUENCES sub_70910_print_string((char*)"Generate features\0"); @@ -77681,9 +77784,9 @@ void sub_56A30_init_game_level(unsigned int a1)//237a30 //adress 237B55 #ifdef DEBUG_SEQUENCES - /*origbyte20 = 0; + origbyte20 = 0; remakebyte20 = 0; - //comp20; + //int comp20; //if (debugafterload) { comp20 = compare_with_sequence((char*)"00237B55-002DC4E0", (Bit8u*)x_BYTE_10B4E0_terraintype, 0x2dc4e0, debugcounter_237a30, 0x70000, 0x10000, &origbyte20, &remakebyte20); @@ -77695,7 +77798,7 @@ void sub_56A30_init_game_level(unsigned int a1)//237a30 comp20 = compare_with_sequence_D41A0((char*)"00237B55-00356038", (Bit8u*)&D41A0_BYTESTR_0, 0x356038, debugcounter_237a30, 0x36e16, &origbyte20, &remakebyte20); comp20 = compare_with_sequence_array_E2A74((char*)"00237B55-002B3A74", (Bit8u*)&array_E2A74, 0x2b3a74, debugcounter_237a30, 0xc4e, 0xc4e, &origbyte20, &remakebyte20); - }*/ + } #endif DEBUG_SEQUENCES @@ -77710,9 +77813,9 @@ void sub_56A30_init_game_level(unsigned int a1)//237a30 } //adress 237BB0 #ifdef DEBUG_SEQUENCES - /*origbyte20 = 0; + origbyte20 = 0; remakebyte20 = 0; - //comp20; + //int comp20; //if (debugafterload) { comp20 = compare_with_sequence((char*)"00237BB0-002DC4E0", (Bit8u*)x_BYTE_10B4E0_terraintype, 0x2dc4e0, debugcounter_237a30, 0x70000, 0x10000, &origbyte20, &remakebyte20); @@ -77724,7 +77827,7 @@ void sub_56A30_init_game_level(unsigned int a1)//237a30 comp20 = compare_with_sequence_D41A0((char*)"00237BB0-00356038", (Bit8u*)& D41A0_BYTESTR_0, 0x356038, debugcounter_237a30, 0x36e16, &origbyte20, &remakebyte20); comp20 = compare_with_sequence_array_E2A74((char*)"00237BB0-002B3A74", (Bit8u*)& array_E2A74, 0x2b3a74, debugcounter_237a30, 0xc4e, 0xc4e, &origbyte20, &remakebyte20); - }*/ + } #endif DEBUG_SEQUENCES #ifdef SET_OBJECTIVE @@ -77775,9 +77878,9 @@ void sub_56A30_init_game_level(unsigned int a1)//237a30 sub_60F00(); #ifdef DEBUG_SEQUENCES - /*origbyte20 = 0; + origbyte20 = 0; remakebyte20 = 0; - //comp20; + //int comp20; //if (debugafterload) { comp20 = compare_with_sequence((char*)"00237BF4-002DC4E0", (Bit8u*)x_BYTE_10B4E0_terraintype, 0x2dc4e0, debugcounter_237a30, 0x70000, 0x10000, &origbyte20, &remakebyte20); @@ -77793,7 +77896,7 @@ void sub_56A30_init_game_level(unsigned int a1)//237a30 //comp20 = compare_with_sequence((char*)"00224959-003AA0A4", x_DWORD_180628b_screen_buffer, 0x3aa0a4, debugcounter_224959, 320 * 200, 320 * 200, &origbyte20, &remakebyte20); debugcounter_237a30++; - }*/ + } #endif DEBUG_SEQUENCES //fix @@ -78010,7 +78113,11 @@ char sub_56F10(__int16 a1, __int16 a2, __int16 a3, char a4)//237f10 x_BYTE_13B4E0_angle[v7] = v8; LABEL_28: if (a4) - sub_462A0(v12, v12); + { + uaxis_2d temp_v12; + temp_v12.word = v12; + sub_462A0(temp_v12, temp_v12); + } else sub_46570(v12, v12); return v11; @@ -78083,7 +78190,11 @@ char sub_570F0(__int16 a1, __int16 a2, signed __int16 a3, char a4, char a5, char } } if (a4) - sub_462A0(v9, v9); + { + uaxis_2d temp_v9; + temp_v9.word = v9; + sub_462A0(temp_v9, temp_v9); + } else sub_46570(v9, v9); return v8; @@ -81418,7 +81529,7 @@ type_str_0x6E8E* sub_5B070(type_str_0x6E8E* a1x)//23c070 // EA3E4: using guessed type int x_DWORD_EA3E4[]; //----- (0005B100) -------------------------------------------------------- -void sub_5B100(int a2, type_str_0x6E8E* a1x)//23c100 +void sub_5B100(/*int a2,*/ type_str_0x6E8E* a1x)//23c100 { int v1; // edi char v2; // ST60_1 @@ -81472,6 +81583,7 @@ void sub_5B100(int a2, type_str_0x6E8E* a1x)//23c100 v15__68 = 0; v3x_ebx = 0; v17x__24 = 0; + v1 = 0; //fix @@ -81587,10 +81699,10 @@ void sub_5B100(int a2, type_str_0x6E8E* a1x)//23c100 v16__28 = (unsigned __int8)x_BYTE_14B4E0[v17x__24] - v3x_ebx - 1; if (v5x_edx < 0) v5x_edx = 0; - if (v5x_edx > a2) - v5x_edx = a2; - if (a2 > v16__28) - v16__28 = a2; + if (v5x_edx > v1) + v5x_edx = v1; + if (v1 > v16__28) + v16__28 = v1; if (v16__28 > 254) v16__28 = 254; v20x__10 = 1; diff --git a/remc2/portability/port_sdl_vga_mouse.cpp b/remc2/portability/port_sdl_vga_mouse.cpp index 2818591c88..83b53ad008 100644 --- a/remc2/portability/port_sdl_vga_mouse.cpp +++ b/remc2/portability/port_sdl_vga_mouse.cpp @@ -686,7 +686,7 @@ void VGA_Set_pallette(Uint8* pallettebuffer) { //printf("%01X %02X,%02X,%02X\n", i,colors[i].r, colors[i].g, colors[i].b); } - SavePal(pallettebuffer,(char*)"c:\\prenos\\remc2\\level4.pal"); + //SavePal(pallettebuffer,(char*)"c:\\prenos\\remc2\\level4.pal"); SubSet_pallette(colors); }