Commit Graph

1528 Commits (a8e813fbbd87c62c344baae14628d28cf44e5924)

Author SHA1 Message Date
Per Inge Mathisen a8e813fbbd Another small cleanup to movement code
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2075 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-13 21:33:12 +00:00
Per Inge Mathisen edf0a59a2e A bit cleanup to movement code, and sprinkle a few asserts to find the moveCalcTurn bug.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2074 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-13 20:58:37 +00:00
Per Inge Mathisen bc383a6997 Fix projectile crash. Iteration became screwed up sometimes when a projectile
object was free()d and its memory was overwritten before we had time to iterate
to the next object in the list. Now we delay free() until after updates are done.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2073 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-13 20:55:50 +00:00
Per Inge Mathisen aa061810a5 Call the reference counting primitives when releasing objects. Ensure
that we take dead structures off the grid map immediately.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2072 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-13 18:46:07 +00:00
Per Inge Mathisen 99cf7adee0 Overwrite, instead of append, debug logfiles.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2071 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-13 18:31:37 +00:00
Per Inge Mathisen f94ff0ce9d New .sta file format in plain text. This should fix problems people have had
with corrupted player name and such when mixing 2.0 and 2.1 versions, or old 
and new versions of 2.1.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2070 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-13 18:14:25 +00:00
Per Inge Mathisen d079d6cf08 Make sure projectiles are not assigned to dead targets. Some cleanup.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2069 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-13 17:36:31 +00:00
Per Inge Mathisen d4cb4d289a Fix targeting of dead objects when structures use commanders and counterbatteries for
targeting. Also fix some indentation.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2067 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-12 22:32:29 +00:00
Per Inge Mathisen 8315dedc2f Use a linked list instead of a hash table to store the list of projectiles in play.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2066 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-12 20:55:41 +00:00
Ari Johnson d39a3ee15f Updated Xcode project file to reflect recent file renamings
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2065 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-12 20:06:58 +00:00
Per Inge Mathisen 757ecb25c8 Missed one include somehow in the commit
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2064 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-12 19:57:09 +00:00
Per Inge Mathisen 2e99433ad0 Rename a few files for consistent naming. base.h -> basedef.h.
bulletdef.h -> projectiledef.h. weapons.h -> weapondef.h.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2063 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-12 19:56:16 +00:00
Ari Johnson 39b863d72d Updated Xcode project file to reflect removal of bullet.h
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2062 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-12 19:52:35 +00:00
Per Inge Mathisen b69de06264 Rename PROJ_OBJECT -> PROJECTILE and OBJ_BULLET -> OBJ_PROJECTILE for consistency
with other objects. To quickly adapt your patches and avoid conflict noise, run this 
on the revision prior to this one:

  sed -i s/OBJ_BULLET/OBJ_PROJECTILE/g src/*.c src/*.h src/*.l src/*.y
  sed -i s/PROJ_OBJECT/PROJECTILE/g src/*.c src/*.h src/*.l src/*.y


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2061 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-12 19:32:26 +00:00
Per Inge Mathisen 6f358cf600 Eliminate bullet.h
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2060 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-12 19:21:16 +00:00
Dennis Schridde e8d00066e0 Fix column description, id->volume. Patch by Martin Koller.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2059 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-12 17:32:33 +00:00
Dennis Schridde e80e0d4ca6 FILE_MAXCHAR -> MAX_PATH
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2058 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-12 17:17:16 +00:00
Dennis Schridde aa9727615c -lz: PhysFS needs this, since sometimes it is not properly linked.
SDL_net.h: Where the SDL headers are not in a standard include path it sometimes seems to have problems with it.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2057 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-12 15:35:40 +00:00
Per Inge Mathisen ace17002a8 Misc cleanups from ref count work
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2056 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-12 15:22:16 +00:00
Dennis Schridde 336130f53d One lib per line.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2055 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-11 23:30:26 +00:00
Dennis Schridde 7c51ddbadc - pie_MAX_POINTS became pie_MAX_VERTICES and was increased to 768 from 512. (Grim's request.)
- pie_MAX_POLYS became pie_MAX_POLYGONS.
- pie_MAX_POLY_VERTS became pie_MAX_VERTICES_PER_POLYGON and was decreased to 6 from 10. This _should_ work everywhere, I didn't see glitches. Grim recommended to even reduce it to 4, but the terrain renderer didn't like that. (When you pitched down the camera too much, the left screen side of the terrain disappeared.)
- iV_IMD_MAX_POINTS, iV_IMD_MAX_POLYS now are defined to the pie_ variants.
- scrPoints was moved into the scope of the only using function, pie_Draw3DShape2.
- aByteScale was never used, so it got removed.
- Some counters were changed from signed to unsigned.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2054 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-11 21:09:40 +00:00
Dennis Schridde 41d3a2a0b0 Fix Umlauts (and other characters) in strings (translation, input, etc).
Previously those displayed images instead of the appropriate letters.
This still doesn't allow for UTF-8 strings (since multi-byte characters are not handled), but it should work with ISO8859-X encodings.
Patch by Martin Koller.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2053 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-11 19:24:54 +00:00
Per Inge Mathisen 2063d578c3 Make sure hash table is re-initialized properly after closed
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2052 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-10 21:23:43 +00:00
Per Inge Mathisen 2de32d08ba Silence a Valgrind warning by not free()ing a NULL pointer
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2051 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-10 20:32:59 +00:00
Per Inge Mathisen e2879a2206 Fix crash on starting cam2 where objects are released but animations that refer
to them are not. Bug looks like it has always been there, but hidden by old memory
management code.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2050 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-10 20:17:27 +00:00
Per Inge Mathisen 3cedbb58f5 Fix bug introduced in struct multiweapon code of r857, which crashes the first
level of cam2 because the non-nullness of an array pointer is checked instead of
the non-nullness of the first pointer in that array.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2048 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-09 19:58:27 +00:00
Giel van Schijndel e8e75c81a2 * Add dec130.h to the automake system
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2047 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-09 09:02:30 +00:00
Ari Johnson dad009776a Update to Xcode project file to include dec130.h
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2046 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-09 05:38:44 +00:00
Giel van Schijndel bd9977cf3d * Move some variables into a more local scope
* Make use of the fact that FUNCTIONALITY is a union and work some casts away
 * Turn some bitshifting with TILE_SHIFT into map_coord and world_coord function calls
 * Merge some duplicated code in function resetFactoryNumFlag

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2045 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-08 22:47:13 +00:00
Giel van Schijndel e531fb31fc * Remove a futile check for error condition (psBuilding->psStructureType->numFuncs == 0) which can never occur unless errors occur while loading a stats file (and if they do, they should be detected by the code loading that file)
* Use calloc instead of malloc followed by memset(0) (calloc both allocates memory; and then sets all of it to zero)
 * Move a lot of duplicated malloc (calloc now) calls out of the switch statement; and in front of it
 * Use map_coord and world_coord instead of bitshifting with TILE_SHIFT
 * Declare and use variables in a more local scope
 * Take advantage of the fact that FUNCTIONALITY now is a struct by not casting anymore
Parts from patch by Freddie Witherden <evilguru> plus changes by me

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2044 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-08 20:45:01 +00:00
Giel van Schijndel b091d350e0 * Don't take guesses on what kind of struct is the largest; use a union instead so that the compiler can deal with that
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2043 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-08 20:04:39 +00:00
Per Inge Mathisen 868b3594c8 Fix crash in campaign when saving a game where a repair structure has been destroyed.
Bug introduced in first reference count commit (r1995).


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2042 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-08 13:20:27 +00:00
Giel van Schijndel a437f1efe2 * Change default of setting "ReopenBuildMenu" to true since this was the behaviour of the original Warzone AFAIK, and as such is probably expected by most people
* Remove commented out line which was an exact duplication of a line just below it

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2041 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-08 11:01:24 +00:00
Giel van Schijndel d1e8dd2c5a * Cast psObj->psDest to DROID, after determining (psObj->psDest->type == DROID) (This should prevent a compiler warning about incompatible pointer types)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2040 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-07 15:28:27 +00:00
Giel van Schijndel f17bcede91 Huge piece of cleanup:
* Make droidDamage and objectDamage accept a parameter `DROID_HIT_SIDE impactSide` instead of `int angle` since it only needs to know the impactSide (which can be extracted from the angle)
 * Make some function calls better readable by splitting them decently out across lines (not just random line breaks)
 * Merge some recursive if-statements (i.e. make if (a) { if (b){} } become if (a && b) instead)
 * Move duplicated code into a function of its own (getHitSide)
 * Merge a large portion of duplicated code (parts that dealt with direct and indirect weapons were almost exactly the same)
 * Remove futile collision check based on checking whether targets where in the same tile as the projectile on impact (some more advanced collision detection was/is being performed anyhow)

Parts from patch #760 by Freddie Witherden <evilguru> plus some minor changes by me

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2039 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-07 15:18:54 +00:00
Giel van Schijndel a12e3630e2 * Split an #ifdef EDIT_OPTIONS section to make sure sButInit's member variables are properly set
Patch by DrZimmerman

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2038 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-07 14:38:32 +00:00
Giel van Schijndel 7b0625d4a7 * Change the adpcm decoder to use a more object oriented approach (rather than global vars which would make decoding multiple streams impossible)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2037 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-07 14:23:48 +00:00
Giel van Schijndel fcf6f02015 * Use an int16_t instead of a short, since this code quite obviously depends on these variables to have an exact size of 16 bits
* Put curly braces on a line of their own
 * Use INT16_MAX and INT16_MIN instead of magic numbers
 * Make some global vars statically linked and const (since they're constants for the adpcm audio codec only)
 * Make some functions in rpl_reader statically linked (they're only used in that file)
 * Add include file dec130.h instead of forward declaring functions in source files

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2036 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-07 13:58:15 +00:00
Giel van Schijndel d531d0a809 Huge piece of cleanup:
* Merge two large sequential if statements where the tested conditions where exactly the same
 * Remove some commented out code
 * Move some code duplicated in the true and false (else) parts of an if-statement out of those code blocks in front of the if-statement
 * Don't use multiple recursive if-branches, instead store some results in variables (EFFECT_TYPE facing, iIMDShape *imd)
 * Use a switch statement to switch on a BASE_OBJECT's type rather than a sequence of if/if-else statements
 * Merge some recursive if-statements (i.e. make if (a) { if (b){} } become if (a && b) instead)
 * Make some function calls better readable by splitting them decently out across lines (not just random line breaks)
 * Add some whitespace for increased readability
Parts from patch #756 by Freddie Witherden <evilguru> plus some changes by me

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2035 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-06 21:47:23 +00:00
Giel van Schijndel bd7d6ae12e * Rename some variables to more descriptive names
* Fix merged indentation of 4 spaces and tabs (even on the same line!!) by using tabs instead
 * Make some function calls better readable by splitting them decently out across lines (not just random line breaks)
Parts from patch #756 by Freddie Witherden <evilguru> plus some changes by me

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2034 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-06 20:29:43 +00:00
Giel van Schijndel d593fd7c17 * Verify a target isn't dead before using it
Patch by Watermelon

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2031 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-06 19:17:44 +00:00
Giel van Schijndel ed62f3da96 * Use 'unsigned int' instead of a fixed-with type to store the width, height and depth of an image
* Change an assert(FALSE) into a more descriptively styled: !"text string"

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2030 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-06 13:47:39 +00:00
Giel van Schijndel b9f58a0e0b * Convert back-slashes in paths to forward-slashes
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2028 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-06 11:32:56 +00:00
Giel van Schijndel 37d7adb0e2 * Add some assertions on unhandled/invalid BASE_OBJECT.type values to aid in debugging
* Add some whitespace to increase readability (empty lines between different case labels in switch statements, and use more consistent indentation in switch statements)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2027 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-05 12:57:24 +00:00
Giel van Schijndel 8947c63baf * Ignore another set of MSVC files
* Remove rather useless file d3dwrap.h
 * Remove DLLEXPORT stuff

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2026 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-04 18:53:52 +00:00
Giel van Schijndel 0a8c53b8a8 * Rename class CFileParser to fileParser (I don't want no freakin MFC naming conventions: prefixing all class-names with a captital 'C')
* Don't use pointers to fileParser for functions where references are lots more appropriate
 * Mark some functions private instead of public (they're only used by class CHeightMap's implementation)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2025 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-04 18:31:36 +00:00
Per Inge Mathisen 073a4793c5 Add died checks to projectile visibility function. Patch by Watermelon.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2024 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-04 18:29:02 +00:00
Per Inge Mathisen bc7dabc521 Fix off-by-one check in CHECK_DROID and CHECK_STRUCTURE macros. Patch by Watermelon.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2023 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-04 18:26:31 +00:00
Giel van Schijndel eb898d0293 * Fix forward declaration of OpenEditorFile
* Remove useless, and (luckily) unused default constructor from CFileParser
 * Move initialisation of m_Flags to initialization list of constructor
 * Don't use (void) as argument list of destructor (this is bad style in C, but especially so in C++, since C++ implies an empty argument list if you give one)
 * Don't check whether new didn't return NULL, since we're using the throwing variant of new anyway
 * Use istream.read instead of istream.readsome since the former will refill the buffer if necessary (which *is* necessary to be able to read something the first time)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2022 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-04 18:11:02 +00:00
Giel van Schijndel f0d6c4d6b6 * Remove yet some more unused/unreferenced variables to reduce warning spam
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2021 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-03 20:51:41 +00:00