Advertisement
MageKing17

Untitled

Apr 22nd, 2015
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.47 KB | None | 0 0
  1. Index: weapons.cpp
  2. ===================================================================
  3. --- weapons.cpp (revision 11318)
  4. +++ weapons.cpp (working copy)
  5. @@ -1305,10 +1305,22 @@
  6.  
  7.     if(optional_string("@Laser Color:"))
  8.     {
  9. +       // This might be confusing at first glance. If we're a modular table (!first_time),
  10. +       // AND we're providing a new color for the laser (being in this block at all),
  11. +       // AND the RGB values for laser_color_1 and laser_color_2 match...
  12. +       // THEN we conclude that laser_color_2 wasn't explicitly defined before, and the modder would probably prefer
  13. +       // it if the laser didn't suddenly start changing colors from the new to the old over its lifespan. -MageKing17
  14. +       bool reset = (!first_time && (
  15. +           (wip->laser_color_1.red == wip->laser_color_2.red) &&
  16. +           (wip->laser_color_1.green == wip->laser_color_2.green) &&
  17. +           (wip->laser_color_1.blue == wip->laser_color_2.blue));
  18.         stuff_ubyte(&r);
  19.         stuff_ubyte(&g);
  20.         stuff_ubyte(&b);
  21.         gr_init_color( &wip->laser_color_1, r, g, b );
  22. +       if (reset) {
  23. +           gr_init_color( &wip->laser_color_2, wip->laser_color_1.red, wip->laser_color_1.green, wip->laser_color_1.blue );
  24. +       }
  25.     }
  26.  
  27.     // optional string for cycling laser colors
  28. @@ -1317,7 +1329,7 @@
  29.         stuff_ubyte(&g);
  30.         stuff_ubyte(&b);
  31.         gr_init_color( &wip->laser_color_2, r, g, b );
  32. -   } else {
  33. +   } else if (first_time) {
  34.         gr_init_color( &wip->laser_color_2, wip->laser_color_1.red, wip->laser_color_1.green, wip->laser_color_1.blue );
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement