Hendricks266

Megaton Editon's hack for Pistol reloading, RPG, and Freezer

Mar 27th, 2013
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.93 KB | None | 0 0
  1. // How it actually is in Megaton:
  2.  
  3. static int widescreen_weapon_offset(int offset) {
  4. #if WIDESCREEN_HACK
  5.     extern long widescreen;
  6.     //((ud.screen_size == 8)? 160 : 200)
  7.     float offsetx;
  8.     float ky = ydim/(float)((ud.screen_size == 8) ? 290 : 240);
  9.     float kx = xdim/(float)320;
  10.     float n = kx/ky;
  11.     int screensizex = 320 * n;
  12.    
  13.     if (widescreen) {
  14.         offsetx = (screensizex-320)/2 + offset;
  15.         offset = (int)offsetx;
  16.     }
  17.    
  18. #endif
  19.     return offset;
  20. }
  21.  
  22. // What proper C code should look like:
  23.  
  24. static int widescreen_weapon_offset(int offset) {
  25. #if WIDESCREEN_HACK
  26.     extern long widescreen; // XXX: should be a global or passed as a function parameter
  27.     if (widescreen)
  28.         offset += ((320.0f * ((xdim/320.0f)/(ydim/((ud.screen_size == 8) ? 290.0f : 240.0f))))-320.0f)/2.0f;
  29.  
  30. #endif
  31.     return offset;
  32. }
  33.  
  34. // What a proper implementation should look like:
  35.  
  36. // (See EDuke32.)
Add Comment
Please, Sign In to add comment