Skip to content
C++ C Pascal Makefile Shell HTML Other
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.civctp2 special handling for xvfb GL-CI /tmp/.X11-unix by run.sh Jan 31, 2020
Advance-Graph results: Aug 29, 2019
ModTools Add SpriteEdit and TileEdit afterwards Martin the Dane has consented … Oct 14, 2019
Scenarios Import english files for MagnificentSamurai and NuclearDetente scenarios Mar 31, 2020
bin bin/Unix2Dos.exe Oct 1, 2007
ctp2_code Apply the shieldstore penalty for empty build queues to the AI too May 24, 2020
ctp2_data Handle mouse-events in main thread Apr 24, 2020
doc Remove the not used GameWatch libs, and some minor Linux branch synch… Jan 20, 2019
etc bootserv.txt Apr 14, 2010
templates Restored MSVC6 compilability and replaced the old concept database by… Mar 30, 2007
tests Revert "incr. sensitivity for LAUNCH-btn (sikuli apparently "distract… Dec 9, 2019
tools use new images with CM2_, replacing _ by space in labels needs anothe… Aug 29, 2019
.dockerignore Revert "overwrite Scenarios/ with updates", works but better is mount… Mar 28, 2020
.gitattributes included ctp2DF @ master (f60ffe7d04eda): Feb 3, 2019
.gitignore use .gitignore from civctp2 Feb 3, 2019
.gitlab-ci.yml Revert "compile for debugging with gdb:", segfault resolved with efef274 Feb 29, 2020
.travis.yml Use SDL2 to show message-box Apr 30, 2020
Activision CTP2 Source Code_Readme.htm Some cleanings and added some crucial instructions to the Apolyton So… Dec 8, 2007
Activision CTP2 Source Code_Readme.txt Some cleanings and added some crucial instructions to the Apolyton So… Dec 8, 2007
Apolyton CTP2 Source Code_Readme.txt Separated the settle event from the settle in city event Feb 19, 2008
CONTRIBUTING.md Add CONTRIBUTING.md file Jan 22, 2019
Dockerfile Use SDL2 to show message-box Apr 30, 2020
EULA - Source Code for CTP2.rtf - Import of Activision original Oct 28, 2003
GL-CI.md sprite building not part of GL-CI config for civctp2 Feb 25, 2019
GNUmakefile.am Remove ctp2linux.map when cleaning or uninstalling Apr 20, 2020
README.md Update documentation to debug with optimization -O0 in stead of -Og May 21, 2020
autogen.sh added anet to autogen.sh Oct 15, 2018
configure.ac Use SDL2 to show message-box Apr 30, 2020
run.sh mount maps/ folder into DI Mar 28, 2020
screenshot.png Added a screenshot to README Oct 15, 2018

README.md

Build Status

CivCTP2

Original readme files

About

This is the Apolyton version of the Call to Power II source code based on the released source code from Activision, that did not include the patch. The code has been stripped of comments, but is otherwise complete as far as Activision's code goes. It was originally built with Microsoft Visual Studio 6.0. In the mean time the Apolyton code was modified so that it works with later versions. This version builds on Linux (i386 and x86_64), Ubuntu, Pandora, and Pyra.

Note that the game files are not included in this repository, you can get them from the original CD or from the GoG version.

screenshot

The Windows version supports CD audio music, and the Linux version supports ripped CD music files compressed as ogg (like found in the GoG version). The Audio tracks should be named Track02.ogg to Track11.ogg and be in the ctp2_program/ctp/music folder.

As the Linux version does not support direct play from the CD-ROM, you need to rip the music-files from the CD and put them on your disk. The music-files can be ripped with crip (http://bach.dynet.com/crip/) or cdparanoia.

Alternatively, you can download the music-files from YouTube. For that, go in the terminal to the directory ctp2_program/ctp/music and run the following code:

youtube-dl  -x -t -i --audio-format vorbis --audio-quality 0 'https://www.youtube.com/watch?v=DtQBlVirrkU&list=PL5Z8d0ZfZ8SbHNEFnlR3jckHDmuZjBUaT'
mln -s 'Call to Power 2 - * - *' Track{#1+1}.ogg
i=11; files=(Track*.ogg); for ((f=${#files[@]}-1; f>=0; f--)); do track=$(printf "Track%02d.ogg" $i); mv "${files[$f]}" $track; ((i--)); done

You may have to install youtube-dl and mln.

If you want to play the videos in the game, copy them from the directory Setup/data/Max/ctp2_data/default/videos/ on the CD to ctp2_data/default/videos/ of your installation.

You may have to re-encode the videos, however we are not sure about that, because we do not have a CD and a working CD-ROM drive to test it. It might be enough to install the right codec. For re-encoding you can execute the following line from the ctp2_data/default/videos/ directory:

shell> for i in `ls /media/cdrom/Setup/data/Max/ctp2_data/default/videos/`; do mencoder -ovc lavc -lavcopts vcodec=mpeg4  -srate 44100 -af resample=44100 -oac lavc  /media/cdrom/Setup/data/Max/ctp2_data/default/videos/$i -o $i; done 

This will also copy the videos to that directory.

Building on Linux

You will probably need GCC 5.x or later to build. The code doesn't seem to build on GCC 4.8.

You will need SDL 2.0, SDL_Mixer 2.0, SDL_Image 2.0. To be able to play movies you also need ffmpeg libraries (some). You will also need byacc and flex. On Debian and friends, use sudo apt install libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev libtiff-dev libavcodec-dev libavformat-dev libswscale-dev byacc flex to install them all.

The build itself is pretty classing and straight forward:

./autogen.sh
CFLAGS="$CFLAGS -w -O3 -fuse-ld=gold" CXXFLAGS="$CXXFLAGS -fpermissive -w -O3 -fuse-ld=gold" ./configure --enable-silent-rules
make

If you want to build a debug version it is:

./autogen.sh
CFLAGS="$CFLAGS -w -O0 -fno-omit-frame-pointer -fuse-ld=gold" CXXFLAGS="$CXXFLAGS -fpermissive -w -O0 -fno-omit-frame-pointer -fuse-ld=gold" ./configure --enable-silent-rules --enable-debug
make

Most optimizations are completely disabled at -O0 even if individual optimization flags are specified. In case CTP2 becomes to slow to be useful you can use higher levels of optimization such as -O1, or -O2.

You can look at ./configure for options, but there aren't many.

Also, note that make -j4 may fail the first time. Some files are auto-generated and the make dependencies don't catch that.

Finally, you may have to use gold instead of ld for link (add -fuse-ld=gold to your CFLAGS & CXXFLAGS if needed).

Installation on Linux

Since CTP2 was originally a Windows game and CTP2 is not free even if its source code has been released, the installation process is a bit complicated.

Prepare the data

First, you need the original game files of CTP2. If you have the CD version, it's better to install it on a Windows machine / using Wine and copy over the files. You need the folders ctp2_data, ctp2_program and Scenarios.

If you have the GoG version, use innoextract to extract all the required files (you can sudo apt install innoextract if you need) from the setup_call_to_power2_2.0.0.13.exe windows installer. For example innoextract -m -I app setup_call_to_power2_2.0.0.13.exe will extract the appfolder that contains all the game files, which are in the same subfolders as in the CD version: ctp2_data, ctp2_program and Scenarios.

Put those folder in you home path or anywhere else, for example ~/ctp2

Install the Apolyton edition

Once you have the original game files, copy the updated files from this git over them. Simply cp -r ctp2_data/* ~/ctp2/ctp2_data should do that. Note, that this is a Windows game, where file names are case-insensitive. This version of CTP2 handles this, and file names can have any case, but the cp command may not overwrite the files that differ in case. If you find a strange behavior or think the files are not up-to-date, check that you don't have 2 copies of a file in different cases (lowercase everything if needed). With the GoG version, no renaming is needed.

Copy the Linux executable

When the build is over, you need to copy the main CTP2 executable, plus the mapgen libraries to the program folder (wich is ctp2_program/ctp). for the executable, and the command is something like: cp -v ctp2_code/ctp2 ~/ctp2/ctp2_program/ctp/ The mapgen libraries will go to ctp2_program/ctp/dll/map/ . So do something like cp -v ctp2_code/mapgen/.libs/*.so ~/ctp2/ctp2_program/ctp/dll/map/

If you get the message on the terminal: Failed to load module "atk-bridge". Install at-spi with sudo apt install at-spi.

Running

When everything is setup, simply go to the program folder, for example with cd ~/ctp2/ctp2_program/ctp and launch the game with ./ctp2. There are a few command line option like -fullscreen that can be useful.

Converting old Linux save-games to new unified format

The old format of Linux save-games was not compatible with that of windows save-games. The format is now unified such that each OS can open save-games from the other. However, due to this, old Linux save-games need to be converted to the new format if you want to continue with those under the new ctp2 version (after 22dd1804804). A game-converter-version was created for this purpose (see, #77), which can load the old format but saves games to the new format.

You can’t perform that action at this time.