Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // How it actually is in Megaton:
- static int widescreen_weapon_offset(int offset) {
- #if WIDESCREEN_HACK
- extern long widescreen;
- //((ud.screen_size == 8)? 160 : 200)
- float offsetx;
- float ky = ydim/(float)((ud.screen_size == 8) ? 290 : 240);
- float kx = xdim/(float)320;
- float n = kx/ky;
- int screensizex = 320 * n;
- if (widescreen) {
- offsetx = (screensizex-320)/2 + offset;
- offset = (int)offsetx;
- }
- #endif
- return offset;
- }
- // What proper C code should look like:
- static int widescreen_weapon_offset(int offset) {
- #if WIDESCREEN_HACK
- extern long widescreen; // XXX: should be a global or passed as a function parameter
- if (widescreen)
- offset += ((320.0f * ((xdim/320.0f)/(ydim/((ud.screen_size == 8) ? 290.0f : 240.0f))))-320.0f)/2.0f;
- #endif
- return offset;
- }
- // What a proper implementation should look like:
- // (See EDuke32.)
Add Comment
Please, Sign In to add comment