Commit graph

15434 commits

Author SHA1 Message Date
joris
d3c2041d27 COrder_Attack
COrder is now abstract
2012-02-25 12:41:53 +01:00
joris
13d9646a7c Fix Assert in ai_resource. 2012-02-25 12:40:14 +01:00
Pali Rohár
5b057a8ae1 Mingw: Link with dxguid (fix linking) and add -fsigned-char to CMAKE_CXX_FLAGS (fix building RC object) 2012-02-25 10:23:53 +01:00
joris
85e0aac1e9 Remove useless dependency dxguid 2012-02-25 09:17:29 +01:00
joris
2390253b3c Fix offset of burn missile. 2012-02-25 09:07:11 +01:00
joris
c648cb13e9 COrder_Resource (include returnGoods)
Fix COrder_Still::Save
2012-02-25 08:51:34 +01:00
joris
d8f56f96c7 Fix warning on Gcc
use also better argument name
Simplify the code
2012-02-24 17:20:46 +01:00
cybermind
a436edf6c4 [*]Don't include neutral units in attack calculations for faster computing.
[-]Fixed bug with incorrect splash radius
[-]Fixed CorrectSphashDamage behaviour with Ground Attack
2012-02-24 14:49:06 +06:00
joris
c8d9a9f20c Move CUnit::OrderFlush into COrder::Finished
some clean up
2012-02-24 09:42:36 +01:00
joris
77334d3533 COrder_{Move, Follow}
Fix typo with Unload.
2012-02-23 16:12:12 +01:00
joris
1ef5a6d8bc Activate PRINTF_VAARG_ATTRIBUTE for enable gcc to warn about some bad usage wih format. 2012-02-23 16:09:56 +01:00
joris
d52a301924 Add COrder_ {Board, Unload, Repair}
Move CUnit::SubAction into corresponding COrder_
Merge COrder_StandGround into COrder_Still
2012-02-23 13:44:40 +01:00
joris
373616150a Remove Guard stuff for action Still 2012-02-23 10:41:14 +01:00
joris
3b792e8ec2 Some other COrder_ (Build, Train, UpgradeTo, TransformInto) 2012-02-22 16:17:56 +01:00
joris
c3dea78611 Some more COrder_ (Die, Patrol, StandGroung, Still) 2012-02-22 08:45:58 +01:00
joris
58f777c425 Add COrder_Built 2012-02-21 15:39:36 +01:00
joris
0ad3061456 Move Action SpellCast code into COrder_SpellCast
Move Action Research code into COrder_Research
2012-02-20 15:53:35 +01:00
cybermind
280ca0c7b5 [-]Fixed some bugs
-typo in CommandAttackGround
-Preferences.ShowMessages now true by default
-towers now clear their action when unit is out of range
2012-02-20 19:07:04 +06:00
joris
256227dede Remove copy of order (use clone instead
make new method to parse luaState
Now COrder may be derivated :-)
2012-02-20 12:24:22 +01:00
joris
409aa786c4 Clean CViewPort interface :
Use PixelPos or Vec2i instead of x, y
2012-02-20 10:11:29 +01:00
cybermind
22c596f62a Removed CommandSetResource action. In most cases it desynced the replays, and now there is another way to implement needed feature (it was added to make trading between players) through animations. 2012-02-19 22:03:29 +06:00
joris
1d66191f8d Some clean up with Missile :
- use ref
- use PixelPos instead of x, y
2012-02-19 16:46:07 +01:00
joris
006cba3793 [minor] Remove CUnit::OrderCount 2012-02-19 12:43:19 +01:00
joris
bd83c2e638 Fix SavePlayers
typo when I applied the patch
2012-02-19 12:42:33 +01:00
joris
9ef297b3a7 [+]New unit-type flag "NonSolid", which allow the building to be entered by other units. The same behaviour occur if you set the building's health to 0.
Patch from Cybermind
2012-02-19 10:18:17 +01:00
joris
b1365caee7 [+]Added impacts when unit is being hit. Use Impact = {"damagetype1","missiletype1",...} The "general" and "shield" keywords are reserved: the "general" will be used for all hits without damagetype and "shield" will be used to make an impact when unit has ShieldPoints.
Patch from Cybermind.
2012-02-19 10:10:26 +01:00
joris
0cc04664b6 Fix mixed EOL (\n, \r\n)
fix small bugs
2012-02-19 09:59:01 +01:00
joris
f8aff0f96d [+]Integer constants in animations could be given as unit's or player's variables.
Definition of animation variable: 
	v_<unit_variable.tag>, where unit_variable - any variable(you can also use user defined variables) of the current unit, tag - variable's tag(Value,Max,Increase,Enable,Percent).
Example: v_HitPoints.Value
Percent returns the proportion between Value and Max in range 0..100
	t_<unit_variable.tag> - same as previous, but refers to unit's current goal unit(target in attack animation, mine in resource etc.). If goal doesn't exist, returns 0.
	p_<playernum.property[.argument]> - where playernum - player's number(you can use "this" to refer the unit's player), property - player's property(see the GetPlayerData function for more information), optional <argument> - specifies the property's argument(need for resources and unit-types)
Examples: p_1.TotalUnitLimit p_this.Resources.gold
	r_<value> - returns the random value between 0 and <value>
Though if vaiable couldn't be reconized, game will try to convert it into integer constant(0 will be returned if convertation fails).
[+]New actions in animations:
	(modified) "spawn-missile <missile-type> <startx> <starty> <destx> <desty> <flags>" - spawns <missile-type> relative to the current unit adding <startx> and <starty> to position. <destx> and <desty> specify the missile's destination point. Could be used as more configurable replacement to the standard "attack" action. <flags> used to configure the action, you should specify it separated by points:
		"damage" - missile will generate damage, values are taken from the action unit.
		"totarget" - missile will ignore <destx> and <desty> and will fly to unit's current goal.
		"pixel" - missile will use pixel coordinates instead of tile coordinates, useful for more accurate missile placing.
		"reltarget" - the source of missile will be the unit's current target, so all parameters will be calculated depending of target's parameters, not source's(even the "totarget" will shot the missile back to source unit). Through the damage parameters are always taken from the source unit.
		"ranged" - missile will check the current max and min attack ranges from the unit("reltarget" inverses logic)
	"spawn-unit <unit-type> <offx> <offy> <range> <player>" - spawn <unit-type> relative to the current unit adding <offx> and <offy> to position. <range> specifies the maximum distatnce from the source unit.
		Example: "spawn-unit unit-something 2 1 v_AttackRange.Value this"
	"if-var <lvalue> <rvalue> <condition> <state>" - jump animation frame to label <state>, if <lvalue> is <condition> to <rvalue>
		Possible conditions are:
		1 - greater or equal
		2 - greater
		3 - less or equal
		4 - less
		5 - equal
		6 - not equal
		Example: this code will show different animation frames depending of unit's current health:
		 Still = {"if-var v_HitPoints.Percent 50 3 damaged50",
			"frame 0", "wait 1", "frame 0", "wait 1","goto end",
			"label damaged50",
			"frame 1", "wait 1", "frame 1", "wait 1",
			"label end"}

	"set-var <var> <mod> <value>" - sets the current unit's <var> variable. <mod> specifies, how should be <value> applied to <var>:
		1 - <value> will be added to <var>'s current value.
		2 - <value> will be subtracted from <var>'s current value.
		3 - <var>'s current value will be multiplied to <value>.
		4 - <var>'s current value will be divided to <value>.
		5 - <var>'s current value will be divided to <value> and remainder will be taken as value.
			Warning: if <value> = 0 in 4 and 5, the game will bomb out with a error.
	"set-player-var <player> <var> <value> <mod>[ <argument>]" - sets the <player>'s <var>. The <value> and <mod> are used same as in set-var. Optional <argument> - specifies the <var>'s argument(need for resources and unit-types)
	"die[ <deathtype>]" - causes unit to die. If <deathtype> is set, unit will play his extra death animation depending on <deathtype>, if he has one.
[-]Health states in animations are removed, should use "if-var" animation to do this.

Patch frpm Cybermind
2012-02-18 17:21:40 +01:00
joris
d2e61fda55 [+]New parameter in the "spawn-missile" spell, added "use-unit-var" which uses caster's damage parameters and ignores the "damage" field.
[+]New parameter in the "polymorph" spell, added "player-caster" parameter, which converts target unit to caster's side.

Patch from Cybermind
2012-02-18 13:43:16 +01:00
joris
590805e3bf [+]New missile class, "missile-class-tracer", this missile will seek towards the target.
[+]New missile class, "missile-class-clip-to-target", this missile will remains clipped to target unit and will play it's animation once, then target will take the damage.
[+]Added CorrectSphashDamage flag in missiles for splash damages, you can use it to prevent damaging other units, which terrain type didn't match the missile's target's unit's terrain type (e.g. don't damage flyers if missile is targeted to land unit)

Patch from Cybermind
2012-02-18 13:41:14 +01:00
Pali Rohár
8d6293949d Fix compilation with gcc 4.2 - Remove ref in function for_each 2012-02-18 10:16:57 +01:00
Pali Rohár
65d29fdd8e CMake: gcc - make sure that char is signed 2012-02-18 10:16:04 +01:00
joris
55d2e864ee New unit-type flag "Wall", which will treat unit as wall.
This will use the unit's Direction field to show different wall connections.
The unit should be a building and have NumDirections = 16 and Flip = false.
The wall unit didn't count in GetNumOpponents. When it attacked, AI didn't fight back and no warnings are shown.

NOTE: need to modify triggers, so they won't count the wall units when calculating player's remaining units. Not needed for those games which don't use this feature. 

Wall mapping:
 Frame 0 - wall without connections.
 Frame 1 - wall with north connection.
 Frame 2 - wall with west connection.
 Frame 3 - wall with north and west connections.
 Frame 4 - wall with south connection.
 Frame 5 - wall with south and north connections.
 Frame 6 - wall with south and west connections.
 Frame 7 - wall with south, north and west connections.
 Frame 8 - wall with east connection.
 Frame 9 - wall with east and north connections.
 Frame 10 - wall with east and west connections.
 Frame 11 - wall with east, north and west connections.
 Frame 12 - wall with east and south connections.
 Frame 13 - wall with east, south and north connections.
 Frame 14 - wall with east, south and west connections.
 Frame 15 - wall with all connections.

patch from Cybermind.
2012-02-18 09:59:57 +01:00
joris
d1ad94a052 Change action_ressource to search an other mine instead of returning to depot
Patch from Cybermind.
2012-02-18 09:51:58 +01:00
joris
3831e149fc missing file for "Storing" 2012-02-18 09:41:01 +01:00
joris
485c46c4ec Fix pkg to be coherent with src.
Fix typo in AStarDebug code.

Patch from cybermind.
2012-02-17 16:07:07 +01:00
joris
dc044a9c70 Add DefineDefaultResourceMaxAmounts() to define max value per resource.(default value is 0, so change it in lua).
Add "Storing" to UnitType to increase MaxResourceAmount

Patch from cybermind.
2012-02-17 15:57:11 +01:00
joris
5d4ddd2508 Create specific "construtor" for each order. 2012-02-17 09:05:42 +01:00
joris
0e54eae28e Rev.8022 fixed a warning, but broke the behavior of some method.
Here is the fix for these methods.
2012-02-16 14:59:44 +01:00
joris
96dc321b38 fix Assert with AssignWorkerToMine when mine is destroyed. 2012-02-15 12:38:39 +01:00
joris
137e4e58fd Move some code into COrder 2012-02-14 12:08:22 +01:00
joris
a34a1b8828 Fix compilation with MSVC 2012-02-14 12:01:26 +01:00
joris
0b6296d96f NewResetPath is now a method in COrder instead of a Macro 2012-02-13 15:44:20 +01:00
joris
6341a4cafd Clean up :
- use reference,
- remove dead code (class AiTransportRequest)
2012-02-13 15:24:12 +01:00
joris
7b2f40f2f1 Fix warning with gcc 2012-02-13 15:21:29 +01:00
joris
2308356ddb Use delete with new instead of free. 2012-02-13 12:41:37 +01:00
joris
79d5c7c344 move inner class CUnit::Corder to actions.h 2012-02-13 12:28:38 +01:00
joris
a8892060d1 CUnit::SavedOrder is now a pointer. 2012-02-12 11:28:35 +01:00
joris
ec080631d9 Use less memory in AiCollectResources.
use std::sort instead of qsort.
2012-02-11 16:06:33 +01:00
joris
12e8eb6846 Replace some COrder in CUnit by pointer.
Begin to have order and action more linked.
2012-02-07 14:15:16 +01:00