Commit Graph

61 Commits

Author SHA1 Message Date
Guus Sliepen 4c5eed148f chdir() to the data directory before loading data.
This is necessary for starfighter to find the data files if it is not
using a .pak file.
2012-02-27 15:33:58 +01:00
Guus Sliepen 78459e9fdb Update copyright notices, bump version to 1.2. 2012-02-26 22:25:57 +01:00
Guus Sliepen 66ce3f2b4e Make sure error messages are shown. 2012-02-26 22:23:34 +01:00
Guus Sliepen 230620a1f1 Do not complain about missing music files in the PAK file. 2012-02-26 22:22:27 +01:00
Guus Sliepen fdd63c14cc Don't play music in first Kline battle when music is disabled. 2011-09-18 00:54:44 +02:00
Guus Sliepen 1d25dd0379 Fix status display of plasma output boosters during game. 2011-09-17 11:24:56 +02:00
Guus Sliepen 96996ce167 Redo the whole plasma system.
- We now have both minPlasma* and maxPlasma* variables.
- *PlasmaRate now goes from 1 to 5 just like Damage and Output.
- Internally, plasma now goes into the primary weapon, there is no
  temporary weapon anymore.
- When upgrading the primary weapon, the new minimum amount of Damage,
  Output and Rate immediately goes into effect when starting the next
  msision.
- Super Charge now works exactly the same again as in the original.
- But shows blinkenlights in the bottom status bar when it is in use.
2011-09-11 21:57:57 +02:00
Guus Sliepen 2c64485272 Toggle fullscreen mode with F11 or Alt+Enter. 2011-09-05 22:13:11 +02:00
Guus Sliepen 7a59631189 Simplify bullet code even more. 2011-09-05 21:55:23 +02:00
Guus Sliepen 350aabfa23 Pause the game when the window loses input focus. 2011-09-05 11:41:03 +02:00
Guus Sliepen f8c4a72170 Display "PAUSED" when paused. 2011-09-05 11:40:35 +02:00
Guus Sliepen e7f5c3825b Simplify spread bullet code.
There were three flags, WF_STRAIGHT, WF_THIN_SPREAD and WF_WIDE_SPREAD,
when only one flag, WF_SPREAD suffices. This makes the code simpler and
gets rid of some duplication.
2011-09-04 18:24:54 +02:00
Guus Sliepen 8bbe48b4bd Use bitwise operations for flags. 2011-09-04 14:43:17 +02:00
Guus Sliepen 4779481f30 Smoother appearance of aliens on left hand side of title screen. 2011-08-29 17:28:06 +02:00
Guus Sliepen 4e1316054a Don't display target arrow if engine.targetIndex is invalid. 2011-08-29 13:08:55 +02:00
Guus Sliepen 7607bc4142 Fix write past end of array.
Found by cppcheck.
2011-08-29 10:58:17 +02:00
Guus Sliepen ac71e3d3ec Explicit limits for the maximum amount of rockets.
Put the maximum amount of rockets that can be caried in the description, and
also adjust the amount of rocket pods one has when buying a secondary weapon.
The laser and charge beam will remove all rocket capacity. To soften the blow,
you get at least capacity for 5 rockets when buying homing missile systems,
or 10 when buying normal missile system.
2011-08-29 09:31:16 +02:00
Guus Sliepen 744f1977e1 Reset charge cannon charge and laser heat after each mission.
This prevents these variables from turning into a huge amount of missiles when
buying a missile launcher in the shop.

This fixes Debian bug #286933.
2011-08-29 09:10:50 +02:00
Guus Sliepen 12d4fcaeab Don't use .wav anymore, use .ogg for all sound effects. 2011-08-28 13:32:34 +02:00
Guus Sliepen 81905236cc Fix two spelling errors. 2011-08-28 12:28:05 +02:00
Guus Sliepen 6bfba4064b Make wrap() functions really wrap.
Before, if a value was over one of the limits, it would be set to the
other limit. For most usecases, that was fine, however for the starfield
this would cause stars to become aligned to each other after a while.
2011-08-27 23:30:44 +02:00
Guus Sliepen bf39080d6f Make cargo pods appear again.
Cargo items were always set inactive after the conversion of variables
from signed char to bool.
2011-08-27 22:08:08 +02:00
Guus Sliepen 7768b4cc6d Add Makefile option to select whether or not to use a .pak file. 2011-08-27 21:29:08 +02:00
Guus Sliepen 44fa119ab7 Fix two spelling errors. 2011-08-27 21:21:43 +02:00
Guus Sliepen 4d78603139 Converted one signed char to bool too many.
This prevented new aliens from being generated throughout the mission,
making certain missions impossible to complete.
2011-08-27 17:17:54 +02:00
Guus Sliepen d6c17d176f Don't use .bmp and .gif anymore, use .png for all lossless graphics. 2011-08-27 16:18:29 +02:00
Guus Sliepen c13267d63d Use whole screen for credits, and allow arrow keys to be used. 2011-08-27 00:29:23 +02:00
Guus Sliepen 5629a2ad73 Move isOnScreen() to explosions.cpp.
It is only used there, and can then be turned into a static function.
2011-08-27 00:29:01 +02:00
Guus Sliepen d7d6dc37bc Flatten Graphics object.
All functions and variables are now defined in graphics.cpp.
Before, the functions would be compiled again and again for every source
file, now it is compiled only once, halving the size of the stripped
starfighter binary.
2011-08-26 23:53:46 +02:00
Guus Sliepen 878e559b6a Flatten objects which only contain static functions.
There is no reason to have objects which contain only static functions
and no variables. These functions have been moved to the global
namespace and are now defined in .cpp files. The math functions are very
small and have been put in math.h and made static inline.
2011-08-26 23:27:16 +02:00
Guus Sliepen 931d110692 Fix "random" behaviour of sound, music and fullscreen options.
The state of these options was not only stored in the global config
file, but also in each saved game. When loading a game or clicking on
"continue game" from the title screen, the state of these options would
also be loaded from the save game file. If this changed the state of
sound and music, this would only take effect when starting a mission or
going back to the title screen. If it changed the state of the
fullscreen option, it would never toggle the state, but would
desynchronise the actual state of the window and the fullscreen option.

This is now fixed by moving these options from the currentGame variable
to the engine variable, where they are not in danger of being
overwritten.
2011-08-26 22:48:52 +02:00
Guus Sliepen 6ea4744832 Bring sanity to the header files.
Most .h files were not used to declare the externally visible variables
and functions of the .cpp files, but only to #include things and declare
things that were needed by that .cpp file itself. This resulted in a lot
of duplication.

Now the .h files only declare what is externally visible from the
corresponding .cpp files. Starfighter.h includes all the other .h files,
and all .cpp files only #include "Starfighter.h". Functions and
variables that were not used outside the .cpp file that contained them
were marked static. Variables defined in .h files were moved to the
appropriate .cpp files.
2011-08-26 21:29:04 +02:00
Guus Sliepen 8b34e90bcf More bools. 2011-08-26 16:55:46 +02:00
Guus Sliepen 277d34dabd Turn signed chars into bools where appropriate. 2011-08-26 16:14:58 +02:00
Guus Sliepen c710b8df7c Recalculate shop prices before giving money back on sold items.
This fixes a bug where one could get more than half the item price back. In
particularly, a level 2 Plasma Cooling Booster would sell for more than you
bought it for.

This fixes Debian bug #253380.
2011-08-26 15:35:03 +02:00
Guus Sliepen 48e8e12b07 Remove 1 second delays. 2011-08-26 14:41:34 +02:00
Guus Sliepen c42ee44271 Don't blit unnecessarily.
During the game, a lot of images were blitted outside the visible area. Also,
addBuffer() was called even when the destination surface was not the screen,
resulting in unnecessary blits in unBuffer().
2011-08-25 15:34:47 +02:00
Guus Sliepen 70d0b13ea2 Use textSurfaces instead of calling drawString() in doInfo().
This increases efficiency significantly. Before, callgrind estimated that 58%
of the CPU time was spent in doInfo(), taking roughly 1.6 kcycles on average
per call. After, only 0.13 kcycles on average per call are used (12x speedup),
and only 14% of the CPU time is spent in doInfo().
2011-08-25 14:00:27 +02:00
Guus Sliepen 9e4ae7e3bd Don't render a textSurface again if nothing has changed. 2011-08-25 13:48:02 +02:00
Guus Sliepen 39ca89d91c Initialise all members of the Graphics class.
Found by cppcheck.
2011-08-24 23:49:59 +02:00
Guus Sliepen 73c92917e2 Slightly increase intro text scrolling speed.
Scrolling 1/4 pixel per frame results in jerky motion, mostly because 4
times 16 2/3 milliseconds is not a round number. Scrolling 1/3 pixel per
frame results in much smoother scrolling.
2011-08-24 23:32:00 +02:00
Guus Sliepen 5be6a5ec7d Randomize explosion thinktime.
This gives engine trails and explosions a more natural look.
2011-08-24 23:08:48 +02:00
Guus Sliepen 9e32c230be Use float functions on float variables. 2011-08-24 22:43:54 +02:00
Guus Sliepen c14a9e7956 Remove a busy loop when showing an error message. 2011-08-24 22:32:30 +02:00
Guus Sliepen 1f7db8a9d8 Remove code that was commented out. 2011-08-24 22:31:11 +02:00
Guus Sliepen 93e6c1064c Remove unused parameters. 2011-08-24 22:22:26 +02:00
Guus Sliepen d87a0fcc31 Make sure SetVideoMode() calls are same as in init.cpp. 2011-08-24 21:40:30 +02:00
Guus Sliepen 212b03fa68 Use SDL_DOUBLEBUF in all SDL_SetVideoMode() calls, and don't force 16 bits.
By forcing 16 bits for full screen mode, performs drops dramatically on
displays where SDL has to do conversion.
2011-08-24 20:34:26 +02:00
Guus Sliepen f46bbcef69 Remove more busyloops. 2011-08-24 20:10:21 +02:00
Guus Sliepen bb9ba4da28 Remove unused FPS display code. 2011-08-24 20:04:15 +02:00