Skip to content

Commit

Permalink
Separated the settle event from the settle in city event
Browse files Browse the repository at this point in the history
Improved debugging:
modified trunk/ctp2_code/gs/world/WrldCity.cpp

Updated the Apolyton CTP2 source code readme:
modified trunk/Apolyton CTP2 Source Code_Readme.txt

DBGen now build the religion database files in all configurations:
modified trunk/ctp2_code/ctp/civctp.dsp

A newly founded city does not look at first like a sea city anymore:
modified trunk/ctp2_code/gfx/spritesys/UnitActor.cpp
modified trunk/ctp2_code/gfx/spritesys/UnitActor.h
modified trunk/ctp2_code/gs/world/UnseenCell.cpp

Separated the settle event from the settle in city event:
modified trunk/ctp2_code/gs/events/GameEventDescription.h
modified trunk/ctp2_code/gs/gameobj/ArmyData.cpp
modified trunk/ctp2_code/gs/gameobj/ArmyData.h
modified trunk/ctp2_code/gs/gameobj/armyevent.cpp
modified trunk/ctp2_code/gs/gameobj/Order.cpp
modified trunk/ctp2_code/gs/gameobj/Player.cpp
modified trunk/ctp2_code/gs/gameobj/player.h
modified trunk/ctp2_code/gs/gameobj/PlayerEvent.cpp
modified trunk/ctp2_code/gs/gameobj/Unit.cpp
modified trunk/ctp2_code/gs/gameobj/Unit.h
modified trunk/ctp2_code/gs/gameobj/UnitData.cpp
modified trunk/ctp2_code/gs/gameobj/UnitData.h
modified trunk/ctp2_data/default/gamedata/Orders.txt
added trunk/ctp2_data/default/graphics/pictures/upsi48.tga
added trunk/ctp2_data/default/graphics/pictures/upsi48d.tga
modified trunk/ctp2_data/english/gamedata/gl_str.txt
modified trunk/ctp2_data/english/gamedata/info_str.txt
modified trunk/ctp2_data/english/gamedata/ldl_str.txt
modified trunk/ctp2_data/french/gamedata/gl_str.txt
modified trunk/ctp2_data/french/gamedata/Info_str.txt
modified trunk/ctp2_data/french/gamedata/ldl_str.txt
modified trunk/ctp2_data/german/gamedata/gl_str.txt
modified trunk/ctp2_data/german/gamedata/ldl_str.txt
modified trunk/ctp2_data/italian/gamedata/gl_str.txt
modified trunk/ctp2_data/italian/gamedata/info_str.txt
modified trunk/ctp2_data/italian/gamedata/ldl_str.txt
modified trunk/ctp2_data/japanese/gamedata/ldl_str.txt
modified trunk/ctp2_data/spanish/gamedata/gl_str.txt
modified trunk/ctp2_data/spanish/gamedata/info_str.txt
modified trunk/ctp2_data/spanish/gamedata/ldl_str.txt
  • Loading branch information
Martin Gühmann authored and Martin Gühmann committed Feb 19, 2008
1 parent e7a896a commit 2422c53
Show file tree
Hide file tree
Showing 36 changed files with 408 additions and 219 deletions.
22 changes: 12 additions & 10 deletions Apolyton CTP2 Source Code_Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,31 @@ Copyright (C) 2001 by Activision, Inc.
All rights reserved.


Documentation Updated: 07/19/05
Documentation Updated: 02/16/08


Included Files & Directories:
=============================

\bin\ <- .dll's and support .exe's
\ctp2_code\ <- Source Code for CTP2
CTP2 Source Code_Readme.htm <- Readme file in .html format
CTP2 Source Code_Readme.txt <- Readme file in .txt format
Activision CTP2 Source Code_Readme.htm <- Original Readme file in .html format
Activision CTP2 Source Code_Readme.txt <- Original Readme file in .txt format
Apolyton CTP2 Source Code_Readme.txt <- Apolyton updated readme file in .txt format
CTP2_EULA.doc <- End User Licensing Agreement

Information:
============

This is the Apolyton version of Call to Power II source code based on the released source code of Call to Power II, without the patch. It has been stripped of comments, but is otherwise complete as far as Activision code goes. It was originally built using Microsoft Visual Studio 6.0. In the mean time the Apolyton code was modified so that it works with the .NET compiler as well.
This is the Apolyton version of Call to Power II source code based on the released source code of Call to Power II, without the patch. It has been stripped of comments, but is otherwise complete as far as Activision code goes. It was originally built using Microsoft Visual Studio 6.0. In the mean time the Apolyton code was modified so that it works with the .NET compiler as well.

Beware that not everything you need to build the game is here!

In particular, the DirectX SDK is not included. The game was originally built with DirectX 7 and needed the DirectX Media SDK. Since DirectX Media SDK has been integrated into DirectX you do not need to download it separately. Newer versions of the DirectX SDK available from Microsoft at:

http://msdn.microsoft.com/directx/directxdownloads/
http://www.microsoft.com/downloads/Browse.aspx?displaylang=en&categoryid=2

Note that you need the SDK of October 2006 or prior to build the game for a Windows 95/98/ME computer.

Make sure you add the Include and Lib and BaseClasses directories from this SDK to Tools->Options->Directories from Visual Studio, if they are not there already. If you installed them to default locations, that means you need to add e.g. for DirectX 9.0:

Expand All @@ -52,25 +54,25 @@ Note that the project files have been updated to link the code with DirectX 9.0.

If you are using Visual Studio C++ 6.0 you need to add the following line to the list of include directories in front of the Microsoft standart directories, since MSVSC++ 6.0 comes with a defect standart library.

C:\<your CTP2 directory>\ctp2_code\compiler\msvc6\stlfixes (if you use )
C:\<your CTP2 directory>\ctp2_code\compiler\msvc6\stlfixes

In order to build, you need an environment variable named CDKDIR on your computer. In Windows XP/2000, go to Control
Panel->System->Environment Variables, and add it, with it's value set to <your source path>/ctp2/bin, the directory with bison, flex, and other miscellaneous utilities in it.
In Windows 9X/ME add to your autoexec.bat the following line:

SET CDKDIR=<your source path>\CTP2\bin
SET CDKDIR=<your source path>\CTP2\bin

Note that you must not add spaces between the environment variable name and the equals sign. The same holds for the path name and the equals sign.
Note that you must not add spaces between the environment variable name and the equal sign. The same holds for the path name and the equal sign.

You have also to create a tmp directory on the harddrive you have the code, e.g.: C:\tmp

Lastly, YOU NEED THE DATA DIRECTORY FROM THE ORIGINAL SHIPPING GAME. All the graphics, sounds, and other data files needed to actually run the game are not included here. Place the ctp2_data directory from the game install directory at the same directory level as ctp2_code in this archive to run an executable built from DevStudio. For instance if your ctp2_data directory has the path:

C:\<your CTP2 directory>\ctp2_data\

then your ctp2_code directory should has the path:
then your ctp2_code directory should have the path:

C:\<your CTP2 directory>\ctp2_code\


That's the basics. For the most part, you are on your own from here on out. Good luck!
That's the basics. For the most part, you are on your own from here on out. Good luck!
74 changes: 73 additions & 1 deletion ctp2_code/ctp/civctp.dsp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 29 additions & 22 deletions ctp2_code/gfx/spritesys/UnitActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ UnitActor::UnitActor(SpriteState *ss, Unit id, sint32 unitType, const MapPoint &
// uint32 m_shieldFlashOnTime;
// uint32 m_shieldFlashOffTime;
// sint32 m_activeListRef;
// double m_healthPercent;
// double m_healthPercent;
m_tempStackSize (0)
#ifdef _ACTOR_DRAW_OPTIMIZATION
// sint32 m_oldFacing;
Expand All @@ -180,11 +180,12 @@ UnitActor::UnitActor(SpriteState *ss, Unit id, sint32 unitType, const MapPoint &
// BOOL m_oldDrawSelectionBrackets;
// uint16 m_oldFlags;
#endif
{
sint32 spriteID;
GetIDAndType(owner, ss, id, unitType, pos, &spriteID, &m_type);
m_spriteID = (spriteID < 1) ? citySprite : spriteID;
Assert(m_spriteID >= 1);
{
sint32 spriteID = CTPRecord::INDEX_INVALID;
GetIDAndType(owner, ss, id, unitType, pos, &spriteID, &m_type, citySprite);

m_spriteID = (spriteID < 0) ? 0 : spriteID;
Assert(m_spriteID >= 0);

Initialize();
}
Expand Down Expand Up @@ -293,10 +294,11 @@ void UnitActor::Initialize(void)
m_holdingCurAnimSpecialDelayProcess = FALSE;
}

if (m_type == GROUPTYPE_UNIT)
if (m_type == GROUPTYPE_UNIT)
{
m_unitSpriteGroup = (UnitSpriteGroup *)g_unitSpriteGroupList->GetSprite((uint32)m_spriteID, m_type, LOADTYPE_BASIC,(GAME_ACTION)0);
} else
}
else
{
m_unitSpriteGroup = (UnitSpriteGroup *)g_citySpriteGroupList->GetSprite((uint32)m_spriteID, m_type, LOADTYPE_BASIC,(GAME_ACTION)0);
}
Expand Down Expand Up @@ -390,24 +392,29 @@ void UnitActor::PositionActor(MapPoint &pos)

void UnitActor::GetIDAndType
(
sint32 owner,
SpriteState * ss,
Unit id,
sint32 unitType,
MapPoint const & pos,
sint32 * spriteID,
GROUPTYPE * groupType
sint32 owner,
SpriteState * ss,
Unit id,
sint32 unitType,
MapPoint const & pos,
sint32 * spriteID,
GROUPTYPE * groupType,
sint32 citySprite
) const
{
bool isCity = g_theUnitDB->Get(unitType, g_player[owner]->GetGovernmentType())->GetHasPopAndCanBuild();

if (isCity)
{
if (id.IsValid() && id.CD())
if (isCity)
{
if(citySprite >= 0)
{
*spriteID = citySprite;
}
else if(id.IsValid() && id.CD())
{
*spriteID = id.CD()->GetDesiredSpriteIndex();
}
else if (ss)
else if(ss)
{
*spriteID = ss->GetIndex();
}
Expand All @@ -417,9 +424,9 @@ void UnitActor::GetIDAndType
}

*groupType = GROUPTYPE_CITY;
}
else
{
}
else
{
*spriteID = ss->GetIndex();
*groupType = GROUPTYPE_UNIT;
}
Expand Down
17 changes: 9 additions & 8 deletions ctp2_code/gfx/spritesys/UnitActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Project : Call To Power 2
// File type : C++ source
// Description : Unit actor
// Id : $Id:$
// Id : $Id$
//
//----------------------------------------------------------------------------
//
Expand Down Expand Up @@ -79,13 +79,14 @@ class UnitActor : public Actor

void GetIDAndType
(
sint32 owner,
SpriteState * ss,
Unit id,
sint32 unitType,
MapPoint const & pos,
sint32 * spriteID,
GROUPTYPE * groupType
sint32 owner,
SpriteState * ss,
Unit id,
sint32 unitType,
MapPoint const & pos,
sint32 * spriteID,
GROUPTYPE * groupType,
sint32 citySprite = CTPRecord::INDEX_INVALID
) const;

void AddVision(void);
Expand Down
4 changes: 4 additions & 0 deletions ctp2_code/gs/events/GameEventDescription.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
// - Added GobalWarming and OzoneDepletion events. (29-Oct-2007 Martin Gühmann)
// - Added SendEmailAndHotSeatMessage so that this is event driven and can
// be executed after all the other events. (14-Nov-2007 Martin Gühmann)
// - Separated the Settle event drom the Settle in City event. (19-Feb-2008 Martin Gühmann)
//
//----------------------------------------------------------------------------

Expand Down Expand Up @@ -339,6 +340,9 @@ GameEventDescription g_eventDescriptions[] =
EVENT(OzoneDepletion, "The ozone layer depletes so that the sun burns the world.", "")
EVENT(SendEmailAndHotSeatMessage, "Sends message to HotSeat and PBEM players.", "")

EVENT(SettleInCityOrder, "This army settles in a city", "%a")
EVENT(SettleInCity, "Adds a pops to a city with a settler", "%a&i")

EVENT(MAX, "This is not a real event, it marks the end of the list", "")
};

Expand Down
13 changes: 13 additions & 0 deletions ctp2_code/gs/gameobj/ArmyData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
// - Added messages for failed slave raids, one for an alive slave and another
// for a killed slaver. (9-Feb-2008 Martin Gühmann)
// - Expelling costs now move points. (9-Feb-2008 Martin Gühmann)
// - Separated the Settle event drom the Settle in City event. (19-Feb-2008 Martin Gühmann)
//
//----------------------------------------------------------------------------

Expand Down Expand Up @@ -6317,6 +6318,10 @@ bool ArmyData::ExecuteOrders(bool propagate)
completedOrder = false;
keepGoing = false;
break;
case UNIT_ORDER_SETTLE_IN_CITY:
completedOrder = true;
SettleInCity();
break;
default:
Assert(false);
}
Expand Down Expand Up @@ -10530,6 +10535,14 @@ void ArmyData::Settle()
);
}

void ArmyData::SettleInCity()
{
g_gevManager->AddEvent(GEV_INSERT_AfterCurrent,
GEV_SettleInCity,
GEA_Army, m_id,
GEA_End
);
}

bool ArmyData::IsObsolete() const
{
Expand Down
2 changes: 2 additions & 0 deletions ctp2_code/gs/gameobj/ArmyData.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
// - PerformOrderHere move to target order can now be inserted at tail into the
// event queue. (30-Jan-2008 Martin Gühmann)
// - Added check move points option to CanAtLeastOneCargoUnloadAt (8-Feb-2008 Martin Gühmann).
// - Separated the Settle event drom the Settle in City event. (19-Feb-2008 Martin Gühmann)
//
//----------------------------------------------------------------------------

Expand Down Expand Up @@ -470,6 +471,7 @@ class ArmyData : public GameObj,

void Disband();
void Settle();
void SettleInCity();



Expand Down
Loading

0 comments on commit 2422c53

Please sign in to comment.