sobinist

fn_vEngine pseudocode

Aug 10th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.64 KB | None | 0 0
  1. void engine() {
  2.    
  3.     activeCamera = CAM_fn_hGetActiveCamera(0);
  4.     targetedSuperObject = CAM_fn_hCineInfoGetSuperObjectTargeted(*(*(*(activeCamera + 4))));
  5.    
  6.     treatDynamicHierarchyOfPlatforms(gp_stDynamicWorld);
  7.     treatDynamicHierarchy(gp_stDynamicWorld, targetedSuperObject, targetedSuperObject.matrix.position);
  8. }
  9.  
  10. void treatDynamicHierarchyOfPlatforms(superobject * spo) {
  11.    
  12.     targeted = null;
  13.     activeCam = CAM_fn_hGetActiveCamera(0);
  14.     if (activeCam) {
  15.         targeted = CAM_fn_hCineInfoGetSuperObjectTargeted(*(*(*(activeCam + 4) + 16) + 4));
  16.     }
  17.    
  18.     pushMatrix(spo);
  19.    
  20.     foreach(child in spo.children) {
  21.        
  22.         if (child.type == perso) {
  23.            
  24.             stdGame = child.pero.stdGame;
  25.             // field_0x29 bit ? set AND (engine not frozen OR bit 0 of field_0x20 set)
  26.             if ( (*(stdGame + 41) & 4) == 4 && (!engineIsFrozen || *(stdGame + 32) == 0x100000) ) {
  27.                
  28.                 if (!stdGame.isPlatform) {
  29.                     popMatrix();
  30.                     return;
  31.                 }
  32.                
  33.                 if (stdGame.field_0x14 != someEngineDWord) {
  34.                     if (child == targeted) {
  35.                         stdGame.field_0x29 &= 0x7FU; // unset bit 0 of field_0x29;
  36.                     } else if ((&loc_4BFFFC + 4) & *(stdGame + 32)) { // too far or something
  37.                     updateTooFarFlag()
  38.                 }
  39.                
  40.                 pushMatrix(child);
  41.                 treatCharactersInSector(child);
  42.                 popMatrix();
  43.                
  44.             }
  45.            
  46.         }
  47.     }
  48.    
  49.     popMatrix(spo);
  50. }
  51.  
  52. void treatDynamicHierarchy(superobject * spo, superobject * targetedSpo, Vector3 * vector) {
  53.    
  54.     // Sector
  55.     if (spo.type != perso) {
  56.         pushMatrix(spo);
  57.        
  58.             foreach(child in spo.children) {
  59.                 if (child.type == perso && !child.isCamera)
  60.                 treatDynamicHierarchy(child);
  61.             }
  62.            
  63.         popmatrix();
  64.     } else {
  65.    
  66.         perso = spo.data;
  67.         stdGame = perso.stdGame; // field_0x28
  68.        
  69.         if (!stdGame) {
  70.             return;
  71.         }
  72.        
  73.         if (!stdGame.isPlatform) {
  74.            
  75.             pushMatrix(spo);
  76.            
  77.             // engine not frozen OR bit 0 of field_0x20 set
  78.             if (!engineIsFrozen || stdGame.field_0x20 & 0x100000) {
  79.                
  80.                 if (perso == targetedSpo) {
  81.                     stdGame.field_0x29 &= 0x7FU; // unset bit 0 of field_0x29
  82.                 } else if ((&loc_4BFFFC + 4) & *(stdGame + 32)) { // too far or something
  83.                     updateTooFarFlag()
  84.                 }
  85.                
  86.                 treatCharactersInSector(spo);
  87.             }
  88.            
  89.             // IF RAYMAN 3
  90.             popMatrix()
  91.             pushMatrix(spo);
  92.            
  93.             if (spo == mainCharacter) {
  94.                
  95.                 foreach(child in spo.children) {
  96.                     if (child.type == perso && !child.isCameraamera)
  97.                     treatDynamicHierarchy(child);
  98.                 }
  99.                
  100.             }
  101.            
  102.             // ENDIF RAYMAN 3
  103.            
  104.             popMatrix();
  105.         } else {
  106.            
  107.             pushMatrix(spo);
  108.            
  109.             foreach(child in spo.children) {
  110.                 if (child.type == perso && !child.isCamera)
  111.                 treatDynamicHierarchy(child);
  112.             }
  113.            
  114.             popMatrix();
  115.         }
  116.     }
  117. }
Add Comment
Please, Sign In to add comment