Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 11.59 KB | None | 0 0
  1. void PrintGameSprites(CBlocks *this,map_info *piece,int OtPos,int ScrX,int ScrY,int R,int G,int B,int OtPos2)
  2. {
  3.     byte bFlags;
  4.     char cVar1;
  5.     char cVar2;
  6.     ushort uVar3;
  7.     byte bVar4;
  8.     char cVar5;
  9.     undefined2 uVar6;
  10.     int bObject;
  11.     uint uVar7;
  12.     int local_v0_676;
  13.     undefined4 uVar8;
  14.     int iVar9;
  15.     uint *puVar10;
  16.     short sVar11;
  17.     undefined4 uVar12;
  18.     int iVar13;
  19.     uint *puVar14;
  20.     byte bVar15;
  21.     int nMonster;
  22.     uint bDead;
  23.     TextDat *pTVar16;
  24.     int local_s1_96;
  25.     int iVar17;
  26.     uint uVar18;
  27.     int iVar19;
  28.     int bItem;
  29.     uint uVar20;
  30.     undefined4 local_90;
  31.    
  32.     bFlags = piece->dFlags;
  33.     nMonster = (int)piece->dMonster;
  34.     bItem = (int)piece->dItem;
  35.     bObject = (int)piece->dObject;
  36.     bDead = SEXT14(piece->dDead);
  37.     local_s1_96 = 0;
  38.     if ((bObject != 0) && (iVar17 = bObject + -1, 0 < bObject)) {
  39.         if (*(short *)(&DAT_80126832 +
  40.                                     (int)(char)(&DAT_800dca31)[(int)(char)(&DAT_800dd22e)[iVar17 * 0x2c] * 0x12] * 4)
  41.                 == 0) {
  42.             bObject = this->ObjTexId;
  43.         }
  44.         else {
  45.             bObject = this->BgTexId;
  46.         }
  47.         if (bObject == this->ObjTexId) {
  48.             pTVar16 = this->ObjTexDat;
  49.         }
  50.         else {
  51.             pTVar16 = (TextDat *)0x0;
  52.             if (bObject == this->BgTexId) {
  53.                 pTVar16 = this->BgTexDat;
  54.             }
  55.         }
  56.         if (pTVar16 == (TextDat *)0x0) {
  57.             FUN_8001e940(0,s_psxsrc_BLOCK_CPP_80120298,0x537);
  58.         }
  59.         local_s1_96 = (*(code *)(&PTR_FUN_800e857c)[(char)(&DAT_800dd22e)[iVar17 * 0x2c]])
  60.                                                         (&DAT_800dd210 + iVar17 * 0x16,ScrX,ScrY,pTVar16,OtPos);
  61.         if (local_s1_96 != 0) {
  62.             *(byte *)(local_s1_96 + 7) = *(byte *)(local_s1_96 + 7) & 0xfe;
  63.             *(undefined *)(local_s1_96 + 4) = (char)DAT_8012bff0;
  64.             *(undefined *)(local_s1_96 + 5) = (char)DAT_8012bff4;
  65.             *(undefined *)(local_s1_96 + 6) = (char)DAT_8012bff8;
  66.             uVar7 = FUN_8008b75c(iVar17,&DAT_8012b26c,(uint)DAT_8012a93a | 0x8000,
  67.                                                      (uint)DAT_8012a93c | 0x8000,(uint)DAT_8012a93e | 0x8000);
  68.             if (uVar7 != 0xffffffff) {
  69.                 uVar6 = FUN_80090908((uint)*(ushort *)(local_s1_96 + 0xe),uVar7 & 0xffff,0x10);
  70.                 *(undefined2 *)(local_s1_96 + 0xe) = uVar6;
  71.                 *(byte *)(local_s1_96 + 7) = *(byte *)(local_s1_96 + 7) | 2;
  72.             }
  73.         }
  74.     }
  75.     if (bItem != 0) {
  76.         if (this->ItemTexDat == (TextDat *)0x0) {
  77.             FUN_8001e940(0,s_psxsrc_BLOCK_CPP_80120298,0x550);
  78.         }
  79.         if (0x7f < bItem) {
  80.             FUN_8001e940(0,s_psxsrc_BLOCK_CPP_80120298,0x552);
  81.         }
  82.         if (item[bItem]._iAnimFlag == '\0') {
  83.             local_s1_96 = FUN_8007f5f4(this->ItemTexDat,(uint)item[bItem].ItemFrame,ScrX,ScrY,0,OtPos,0);
  84.             uVar7 = FUN_8008b75c(bItem + -1,&_pcursitem,(uint)DAT_8012a940 | 0x8000,
  85.                                                      (uint)DAT_8012a942 | 0x8000,(uint)DAT_8012a944 | 0x8000);
  86.             if (uVar7 == 0xffffffff) {
  87.                 *(byte *)(local_s1_96 + 7) = *(byte *)(local_s1_96 + 7) & 0xfd;
  88.             }
  89.             else {
  90.                 uVar6 = FUN_80090908((uint)*(ushort *)(local_s1_96 + 0xe),uVar7 & 0xffff,0x10);
  91.                 *(undefined2 *)(local_s1_96 + 0xe) = uVar6;
  92.                 *(byte *)(local_s1_96 + 7) = *(byte *)(local_s1_96 + 7) | 2;
  93.             }
  94.         }
  95.         else {
  96.             local_s1_96 = FUN_8007f5f4(this->ItemTexDat,(uint)item[bItem].ItemFrame,ScrX,ScrY,0,OtPos,0);
  97.             local_v0_676 = FUN_8008bbc0(this->ItemTexDat,(uint)item[bItem].ItemFrame);
  98.             uVar18 = *(uint *)(local_v0_676 + 8) & 0x1ff;
  99.             uVar7 = (uint)*(ushort *)(local_v0_676 + 6) & 0x1ff;
  100.             if ((*(uint *)(local_v0_676 + 8) & 0x200) == 0) {
  101.                 *(char *)(local_s1_96 + 0x1d) = *(char *)(local_s1_96 + 0x1d) + -1;
  102.                 *(char *)(local_s1_96 + 0x25) = *(char *)(local_s1_96 + 0x25) + -1;
  103.             }
  104.             else {
  105.                 *(char *)(local_s1_96 + 0xd) = *(char *)(local_s1_96 + 0xd) + -1;
  106.                 *(char *)(local_s1_96 + 0x1d) = *(char *)(local_s1_96 + 0x1d) + -1;
  107.             }
  108.             uVar20 = (uint)(byte)item[bItem]._isin;
  109.             if (item[bItem]._isin == 0) {
  110.                 FUN_8003a57c(0x15,(int)item[bItem]._ix,(int)item[bItem]._iy);
  111.             }
  112.             FUN_8001001c(local_s1_96,(int)*(short *)(local_s1_96 + 8) + ((int)uVar7 >> 1),
  113.                                      (int)*(short *)(local_s1_96 + 10) + ((int)uVar18 >> 1),uVar20 << 8);
  114.             bObject = (int)*(short *)(&DAT_801202c0 + (uVar20 & 0x1f) * 2) >> 2;
  115.             if (bObject < 0) {
  116.                 FUN_8003a57c(*(undefined4 *)
  117.                                             (PTR_DAT_8012b368 + (uint)(byte)(&DAT_800c1204)[item[bItem]._iCurs] * 4),
  118.                                          (int)item[bItem]._ix,(int)item[bItem]._iy);
  119.                 bObject = 0;
  120.                 cVar5 = item[bItem + 1]._iAnimLen;
  121.                 item[bItem]._iAnimFlag = '\0';
  122.                 item[bItem]._iSelFlag = '\x01';
  123.                 item[bItem]._iAnimFrame = cVar5;
  124.             }
  125.             sVar11 = (short)bObject;
  126.             if (0 < bObject << 0x10) {
  127.                 sVar11 = -sVar11;
  128.             }
  129.             *(short *)(local_s1_96 + 10) = *(short *)(local_s1_96 + 10) + sVar11;
  130.             *(short *)(local_s1_96 + 0x12) = *(short *)(local_s1_96 + 0x12) + sVar11;
  131.             *(short *)(local_s1_96 + 0x1a) = *(short *)(local_s1_96 + 0x1a) + sVar11;
  132.             *(short *)(local_s1_96 + 0x22) = *(short *)(local_s1_96 + 0x22) + sVar11;
  133.             cVar5 = item[bItem]._isin + '\x01';
  134.             bObject = (int)cVar5;
  135.             item[bItem]._isin = cVar5;
  136.             if (bObject < 0) {
  137.                 bObject = bObject + 0x1f;
  138.             }
  139.             item[bItem]._isin = cVar5 + (char)(bObject >> 5) * -0x20;
  140.             if (item[bItem].IDidx == 0) {
  141.                 uVar12 = 0x80;
  142.                 local_90 = 0x20;
  143.                 uVar8 = 0x30;
  144.             }
  145.             else {
  146.                 uVar12 = 0x60;
  147.                 local_90 = 0x60;
  148.                 uVar8 = 0x10;
  149.             }
  150.             FUN_8009ab1c(ScrX + ((int)uVar7 >> 2) + (int)*(char *)(local_v0_676 + 4),
  151.                                      ScrY + ((int)uVar18 >> 2) + (int)*(char *)(local_v0_676 + 5) + (int)sVar11,uVar12
  152.                                      ,0x60,local_90,uVar8,(int)sVar11 * -2,uVar20 * -4,0,OtPos + 1,1);
  153.         }
  154.         *(undefined *)(local_s1_96 + 4) = (char)DAT_8012bff0;
  155.         *(undefined *)(local_s1_96 + 5) = (char)DAT_8012bff4;
  156.         uVar8 = DAT_8012bff8;
  157.         *(byte *)(local_s1_96 + 7) = *(byte *)(local_s1_96 + 7) & 0xfe;
  158.         *(undefined *)(local_s1_96 + 6) = (char)uVar8;
  159.     }
  160.     bVar15 = bFlags;
  161.     bVar4 = 0;
  162.     if (DAT_8012bffc != 0) {
  163.         bVar15 = bFlags | 0x40;
  164.         bVar4 = bFlags;
  165.     }
  166.     if ((bVar15 & 0x40) == 0) {
  167.         return;
  168.     }
  169.     if (((bVar15 & 1) != 0) && ((int)piece->dMissile != -1)) {
  170.         bObject = ((int)piece->dMissile + -1) * 0x50;
  171.         (**(code **)(&DAT_80111f74 + bObject))
  172.                             (bObject + -0x7feee0d8,ScrX + ((int)(char)(&DAT_80111f5d)[bObject] * 0x271) / 1000,
  173.                              ScrY + ((int)(char)(&DAT_80111f5e)[bObject] * 0x271) / 1000,OtPos);
  174.     }
  175.     if (nMonster < 1) goto LAB_8008a8b8;
  176.     bObject = FUN_80093a28(nMonster,DAT_8012bff0,DAT_8012bff4,DAT_8012bff8,OtPos,ScrX,ScrY);
  177.     if (bObject != 1) {
  178.         nMonster = nMonster + -1;
  179.         bObject = nMonster * 0x70;
  180.         if (((&DAT_80114808)[nMonster * 0x38] & 1) == 0) {
  181.             if ((&DAT_80114840)[nMonster * 0x1c] == 0) {
  182.                 FUN_8001e940(0,s_psxsrc_BLOCK_CPP_80120298,0x5dd);
  183.             }
  184.             if (this->MonstTexDat == (TextDat *)0x0) {
  185.                 FUN_8001e940(0,s_psxsrc_BLOCK_CPP_80120298,0x5df);
  186.             }
  187.             pTVar16 = this->MonstTexDat;
  188.             bItem = FUN_80087a10(this,(uint)**(ushort **)(&DAT_80114844 + bObject));
  189.             if (bItem == -1) {
  190.                 return;
  191.             }
  192.             cVar5 = (&DAT_80114816)[bObject];
  193.             iVar19 = (int)(char)(&DAT_80114839)[bObject];
  194.             cVar1 = (&DAT_80114818)[bObject];
  195.             cVar2 = (&DAT_8011481d)[bObject];
  196.             iVar17 = (int)(char)(&DAT_80114817)[bObject] * 0x271 >> 0x1f;
  197.             iVar13 = ((int)(char)(&DAT_80114817)[bObject] * 0x271) / 1000 + iVar17;
  198.             iVar9 = FUN_8008bad4(pTVar16,bItem,iVar19,iVar13);
  199.             if (iVar9 <= (int)cVar2 + -1) {
  200.                 return;
  201.             }
  202.             uVar8 = FUN_800800c0(pTVar16,bItem,iVar19,(int)cVar1,(int)cVar2 + -1);
  203.             uVar12 = FUN_80080114(pTVar16,bItem,iVar19,(int)cVar1);
  204.             local_s1_96 = FUN_8007e884(pTVar16,uVar8,ScrX + ((int)cVar5 * 0x271) / 1000,
  205.                                                                  ScrY + (iVar13 - iVar17),uVar12,OtPos);
  206.             if ((int)*(char *)(*(int *)(&DAT_80114844 + bObject) + 7) != 0) {
  207.                 uVar8 = FUN_8008bbc0(this->ObjTexDat,
  208.                                                          *(undefined4 *)
  209.                                                             (&DAT_8011a538 +
  210.                                                             ((((int)*(char *)(*(int *)(&DAT_80114844 + bObject) + 7) << 0x19) >>
  211.                                                              0x18) + (uint)(iVar19 == 4)) * 4));
  212.                 FUN_8007fff8(this->ObjTexDat,uVar8,local_s1_96);
  213.             }
  214.             if ((&DAT_8011480f)[bObject] == '\x0f') {
  215.                 bItem = *(int *)(&DAT_8011a43c + (uint)**(ushort **)(&DAT_80114844 + bObject) * 8);
  216.                 if ((iVar19 == 4) &&
  217.                      ((&DAT_8011a438)[(uint)**(ushort **)(&DAT_80114844 + bObject) * 8] == '\x02')) {
  218.                     bItem = bItem + 1;
  219.                 }
  220.                 if (**(short **)(&DAT_80114844 + bObject) == 0x1d) {
  221.                     bItem = bItem + iVar19;
  222.                 }
  223.                 uVar8 = FUN_8008bbc0(this->ObjTexDat,bItem);
  224.                 FUN_8007fff8(this->ObjTexDat,uVar8,local_s1_96);
  225.             }
  226.             *(undefined *)(local_s1_96 + 4) = (char)DAT_8012bff0;
  227.             *(undefined *)(local_s1_96 + 5) = (char)DAT_8012bff4;
  228.             uVar8 = DAT_8012bff8;
  229.             *(byte *)(local_s1_96 + 7) = *(byte *)(local_s1_96 + 7) & 0xfe;
  230.             *(undefined *)(local_s1_96 + 6) = (char)uVar8;
  231.             puVar10 = (uint *)FUN_8008b720(local_s1_96);
  232.             FUN_8008b5b4(puVar10);
  233.             uVar3 = **(ushort **)(&DAT_80114844 + bObject);
  234.             if (uVar3 == 10) {
  235. LAB_8008a72c:
  236.                 if (iVar19 == 5) {
  237.                     *(byte *)(local_s1_96 + 7) = *(byte *)(local_s1_96 + 7) & 0xfe | 2;
  238.                 }
  239.             }
  240.             else {
  241.                 if (uVar3 < 0xb) {
  242.                     if (uVar3 == 1) {
  243.                         *(short *)((int)puVar10 + 10) = *(short *)((int)puVar10 + 10) + 0x14;
  244.                         *(short *)((int)puVar10 + 0x12) = *(short *)((int)puVar10 + 0x12) + 0x14;
  245.                         *(short *)((int)puVar10 + 0x1a) = *(short *)((int)puVar10 + 0x1a) + 0x14;
  246.                         *(short *)((int)puVar10 + 0x22) = *(short *)((int)puVar10 + 0x22) + 0x14;
  247.                     }
  248.                 }
  249.                 else {
  250.                     if (uVar3 == 0x15) goto LAB_8008a72c;
  251.                 }
  252.             }
  253.             uVar18 = (uint)DAT_8012a946;
  254.             uVar20 = (uint)DAT_8012a948;
  255.             puVar14 = (uint *)(OtPos * 4 + DAT_8012a714);
  256.             *puVar10 = *puVar10 & 0xff000000 | *puVar14 & 0xffffff;
  257.             uVar7 = (uint)DAT_8012a94a;
  258.             *puVar14 = *puVar14 & 0xff000000 | (uint)puVar10 & 0xffffff;
  259.             uVar7 = FUN_8008b6d8(nMonster,&DAT_8012b264,uVar18 | 0x8000,uVar20 | 0x8000,uVar7 | 0x8000);
  260.             if (uVar7 != 0xffffffff) {
  261.                 uVar6 = FUN_80090908((uint)*(ushort *)(local_s1_96 + 0xe),uVar7 & 0xffff,0x10);
  262.                 *(undefined2 *)(local_s1_96 + 0xe) = uVar6;
  263.                 *(byte *)(local_s1_96 + 7) = *(byte *)(local_s1_96 + 7) | 2;
  264.             }
  265.         }
  266.     }
  267.     if ((DAT_8012bffc != 0) && ((bVar4 & 0x40) == 0)) {
  268.         if (DAT_8012b2b0 == '\0') {
  269.             uVar7 = FUN_8001e7a0();
  270.             *(undefined *)(local_s1_96 + 5) = 0;
  271.             *(undefined *)(local_s1_96 + 6) = 0;
  272.             *(char *)(local_s1_96 + 4) = (char)uVar7 + (char)(uVar7 / 0x30) * -0x30 + -0x70;
  273.         }
  274.         else {
  275.             *(undefined *)(local_s1_96 + 4) = 0x90;
  276.             *(undefined *)(local_s1_96 + 5) = 0;
  277.             *(undefined *)(local_s1_96 + 6) = 0;
  278.         }
  279.         *(byte *)(local_s1_96 + 7) = *(byte *)(local_s1_96 + 7) & 0xfe | 2;
  280.     }
  281. LAB_8008a8b8:
  282.     if (bDead != 0) {
  283.         if (this->MonstTexDat == (TextDat *)0x0) {
  284.             FUN_8001e940(0,s_psxsrc_BLOCK_CPP_80120298,0x651);
  285.         }
  286.         nMonster = *(int *)(&DAT_800bea18 + (bDead & 0x1f) * 0xc);
  287.         bItem = (int)(bDead & 0xe0) >> 5;
  288.         bObject = FUN_80087a10(this,(uint)*(ushort *)(&DAT_8011a278)[nMonster * 7]);
  289.         if (bObject != -1) {
  290.             iVar17 = FUN_8008bad4(this->MonstTexDat,bObject,4);
  291.             uVar8 = FUN_800800c0(this->MonstTexDat,bObject,4,bItem,iVar17 + -1);
  292.             uVar12 = FUN_80080114(this->MonstTexDat,bObject,4,bItem);
  293.             bObject = FUN_8007e884(this->MonstTexDat,uVar8,ScrX,ScrY,uVar12,OtPos);
  294.             nMonster = (int)*(char *)((int)(&DAT_8011a278)[nMonster * 7] + 7);
  295.             if (nMonster != 0) {
  296.                 uVar8 = FUN_8008bbc0(this->ObjTexDat,
  297.                                                          *(undefined4 *)(&DAT_8011a53c + ((nMonster << 0x19) >> 0x16)));
  298.                 FUN_8007fff8(this->ObjTexDat,uVar8,bObject);
  299.             }
  300.             *(undefined *)(bObject + 4) = (char)DAT_8012bff0;
  301.             *(undefined *)(bObject + 5) = (char)DAT_8012bff4;
  302.             uVar8 = DAT_8012bff8;
  303.             *(byte *)(bObject + 7) = *(byte *)(bObject + 7) & 0xfe;
  304.             *(undefined *)(bObject + 6) = (char)uVar8;
  305.             puVar10 = (uint *)FUN_8008b720();
  306.             FUN_8008b5b4(puVar10);
  307.             puVar14 = (uint *)(OtPos * 4 + DAT_8012a714);
  308.             *puVar10 = *puVar10 & 0xff000000 | *puVar14 & 0xffffff;
  309.             *puVar14 = *puVar14 & 0xff000000 | (uint)puVar10 & 0xffffff;
  310.         }
  311.     }
  312.     return;
  313. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement