Merge branch 'master' of ssh://aliendefender.git.sourceforge.net/gitroot/aliendefender/aliendefender

Conflicts:
	ADeditor/ADeditor.pro.user
	ADeditor/mainwindow.ui
This commit is contained in:
2010-08-28 19:40:26 +04:00
49 changed files with 3087 additions and 2978 deletions

Binary file not shown.

View File

@@ -2,18 +2,28 @@
# Project created by QtCreator 2010-08-22T13:42:02 # Project created by QtCreator 2010-08-22T13:42:02
# ------------------------------------------------- # -------------------------------------------------
QT += xml \ QT += xml \
xmlpatterns xmlpatterns
TARGET = ADeditor TARGET = ADeditor
TEMPLATE = app TEMPLATE = app
SOURCES += main.cpp \ SOURCES += main.cpp \
mainwindow.cpp \ mainwindow.cpp \
../loader.cpp \ ../loader.cpp \
alienmodel.cpp \ alienmodel.cpp \
towermodel.cpp \ towermodel.cpp \
splashmodel.cpp splashmodel.cpp \
../map.cpp \
../game_data.cpp \
triggermodel.cpp
HEADERS += mainwindow.h \ HEADERS += mainwindow.h \
../loader.h \ ../loader.h \
alienmodel.h \ alienmodel.h \
towermodel.h \ towermodel.h \
splashmodel.h splashmodel.h \
../base_types.h \
../map.h \
../game_data.h \
triggermodel.h
FORMS += mainwindow.ui FORMS += mainwindow.ui
TRANSLATIONS += adeditor_ru.ts
RESOURCES += ADeditor.qrc

View File

@@ -1,255 +1,113 @@
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<qtcreator> <qtcreator>
<data> <data>
<variable>RunConfiguration0-BaseEnvironmentBase</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">2</value>
</data>
<data>
<variable>RunConfiguration0-CommandLineArguments</variable>
<valuelist type="QVariantList"/>
</data>
<data>
<variable>RunConfiguration0-ProFile</variable>
<value type="QString">ADeditor.pro</value>
</data>
<data>
<variable>RunConfiguration0-RunConfiguration.name</variable>
<value type="QString">ADeditor</value>
</data>
<data>
<variable>RunConfiguration0-UseDyldImageSuffix</variable>
<value type="bool">false</value>
</data>
<data>
<variable>RunConfiguration0-UseTerminal</variable>
<value type="bool">false</value>
</data>
<data>
<variable>RunConfiguration0-UserEnvironmentChanges</variable>
<valuelist type="QVariantList"/>
</data>
<data>
<variable>RunConfiguration0-UserSetName</variable>
<value type="bool">false</value>
</data>
<data>
<variable>RunConfiguration0-UserSetWorkingDirectory</variable>
<value type="bool">false</value>
</data>
<data>
<variable>RunConfiguration0-UserWorkingDirectory</variable>
<value type="QString"></value>
</data>
<data>
<variable>RunConfiguration0-type</variable>
<value type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
</data>
<data>
<variable>activeRunConfiguration</variable>
<value type="int">0</value> <value type="int">0</value>
</data> </data>
<data> <data>
<variable>activebuildconfiguration</variable> <variable>ProjectExplorer.Project.EditorSettings</variable>
<value type="QString">Debug</value>
</data>
<data>
<variable>buildConfiguration-Debug</variable>
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <value key="EditorConfiguration.Codec" type="QByteArray">System</value>
<value key="QtVersionId" type="int">2</value>
<value key="ToolChain" type="int">0</value>
<value key="addQDumper" type=""></value>
<value key="buildConfiguration" type="int">2</value>
</valuemap> </valuemap>
</data> </data>
<data> <data>
<variable>buildconfiguration-Debug-buildstep0</variable> <variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Настольный компьютер</value>
<valuelist key="abstractProcess.Environment" type="QVariantList"> <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value>
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5VyjD99lFj,guid=cf0067cbadce72e8c9c0f05e4c74f11a</value> <value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value> <value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
<value type="QString">DESKTOP_SESSION=gnome</value> <valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
<value type="QString">DISPLAY=:0.0</value> <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
<value type="QString">GDMSESSION=gnome</value> <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
<value type="QString">GDM_KEYBOARD_LAYOUT=us</value> <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
<value type="QString">GDM_LANG=ru_RU.UTF-8</value> <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value> </valuemap>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-sQCAQN</value> <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
<value type="QString">GTK_MODULES=canberra-gtk-module</value> <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
<value type="QString">HOME=/home/andrey</value> <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value type="QString">LANG=ru_RU.UTF-8</value> <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
<value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator:</value> <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
<value type="QString">LOGNAME=andrey</value> <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
<value type="QString">MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path</value> </valuemap>
<value type="QString">ORBIT_SOCKETDIR=/tmp/orbit-andrey</value> <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value> <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
<value type="QString">PWD=/home/andrey</value> <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
<value type="QString">QTDIR=/usr/share/qt4</value> <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1112,unix/buull-eeePC:/tmp/.ICE-unix/1112</value> <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
<value type="QString">SHELL=/bin/bash</value> <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
<value type="QString">SPEECHD_PORT=6561</value> <value type="QString">clean</value>
<value type="QString">SSH_AGENT_PID=1146</value> </valuelist>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-sQCAQN/ssh</value> <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
<value type="QString">USER=andrey</value> </valuemap>
<value type="QString">USERNAME=andrey</value> <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-QG4tiG/database</value> <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value> <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value> <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Отладка</value>
<value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1282732313.174012-433654821</value> <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
</valuelist> <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
<valuelist key="abstractProcess.arguments" type="QVariantList"> <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">C:/Users/Andrey/Desktop/build-ADeditor</value>
<value type="QString">/home/andrey/AD/aliendefender/ADeditor/ADeditor.pro</value> <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">9</value>
<value type="QString">-spec</value> <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">2</value>
<value type="QString">linux-g++</value> <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
<value type="QString">-r</value> </valuemap>
<value type="QString">CONFIG+=debug</value> <valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
</valuelist> <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
<value key="abstractProcess.command" type="QString">/usr/bin/qmake-qt4</value> <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
<value key="abstractProcess.enabled" type="bool">false</value> <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
<value key="abstractProcess.workingDirectory" type="QString">/home/andrey/AD/aliendefender/ADeditor</value> <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
</valuemap>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
<valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
<valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
<valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
<value type="QString">clean</value>
</valuelist>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Релиз</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">C:/Users/Andrey/Desktop/aliendefender/ADeditor-build-desktop</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">9</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
</valuemap>
<value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
<valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">ADeditor</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
<valuelist key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QVariantList"/>
<value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">ADeditor.pro</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
<valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetName" type="bool">false</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">true</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString">C:\Users\Andrey\Desktop\aliendefender</value>
</valuemap>
<value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
</valuemap> </valuemap>
</data> </data>
<data> <data>
<variable>buildconfiguration-Debug-buildstep1</variable> <variable>ProjectExplorer.Project.TargetCount</variable>
<valuemap type="QVariantMap"> <value type="int">1</value>
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5VyjD99lFj,guid=cf0067cbadce72e8c9c0f05e4c74f11a</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value>
<value type="QString">GDMSESSION=gnome</value>
<value type="QString">GDM_KEYBOARD_LAYOUT=us</value>
<value type="QString">GDM_LANG=ru_RU.UTF-8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-sQCAQN</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/andrey</value>
<value type="QString">LANG=ru_RU.UTF-8</value>
<value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator:</value>
<value type="QString">LOGNAME=andrey</value>
<value type="QString">MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path</value>
<value type="QString">ORBIT_SOCKETDIR=/tmp/orbit-andrey</value>
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/andrey</value>
<value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1112,unix/buull-eeePC:/tmp/.ICE-unix/1112</value>
<value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=6561</value>
<value type="QString">SSH_AGENT_PID=1146</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-sQCAQN/ssh</value>
<value type="QString">USER=andrey</value>
<value type="QString">USERNAME=andrey</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-QG4tiG/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1282732313.174012-433654821</value>
</valuelist>
<value key="abstractProcess.IgnoreReturnValue" type="bool">false</value>
<valuelist key="abstractProcess.arguments" type="QVariantList">
<value type="QString">-w</value>
</valuelist>
<value key="abstractProcess.command" type="QString">/usr/bin/make</value>
<value key="abstractProcess.enabled" type="bool">true</value>
<value key="abstractProcess.workingDirectory" type="QString">/home/andrey/AD/aliendefender/ADeditor</value>
</valuemap>
</data> </data>
<data> <data>
<variable>buildconfiguration-Debug-cleanstep0</variable> <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<valuemap type="QVariantMap"> <value type="int">4</value>
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5VyjD99lFj,guid=cf0067cbadce72e8c9c0f05e4c74f11a</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value>
<value type="QString">GDMSESSION=gnome</value>
<value type="QString">GDM_KEYBOARD_LAYOUT=us</value>
<value type="QString">GDM_LANG=ru_RU.UTF-8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-sQCAQN</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/andrey</value>
<value type="QString">LANG=ru_RU.UTF-8</value>
<value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator:</value>
<value type="QString">LOGNAME=andrey</value>
<value type="QString">MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path</value>
<value type="QString">ORBIT_SOCKETDIR=/tmp/orbit-andrey</value>
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/andrey</value>
<value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1112,unix/buull-eeePC:/tmp/.ICE-unix/1112</value>
<value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=6561</value>
<value type="QString">SSH_AGENT_PID=1146</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-sQCAQN/ssh</value>
<value type="QString">USER=andrey</value>
<value type="QString">USERNAME=andrey</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-QG4tiG/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1282732313.174012-433654821</value>
</valuelist>
<value key="abstractProcess.IgnoreReturnValue" type="bool">true</value>
<valuelist key="abstractProcess.arguments" type="QVariantList">
<value type="QString">clean</value>
<value type="QString">-w</value>
</valuelist>
<value key="abstractProcess.command" type="QString">/usr/bin/make</value>
<value key="abstractProcess.enabled" type="bool">true</value>
<value key="abstractProcess.workingDirectory" type="QString">/home/andrey/AD/aliendefender/ADeditor</value>
<value key="cleanConfig" type="bool">true</value>
<valuelist key="makeargs" type="QVariantList">
<value type="QString">clean</value>
</valuelist>
</valuemap>
</data>
<data>
<variable>buildconfigurations</variable>
<valuelist type="QVariantList">
<value type="QString">Debug</value>
</valuelist>
</data>
<data>
<variable>buildstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value>
<value key="mkspec" type="QString"></value>
</valuemap>
</data>
<data>
<variable>buildstep1</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value>
</valuemap>
</data>
<data>
<variable>buildsteps</variable>
<valuelist type="QVariantList">
<value type="QString">trolltech.qt4projectmanager.qmake</value>
<value type="QString">trolltech.qt4projectmanager.make</value>
</valuelist>
</data>
<data>
<variable>cleanstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value>
<value key="clean" type="bool">true</value>
</valuemap>
</data>
<data>
<variable>cleansteps</variable>
<valuelist type="QVariantList">
<value type="QString">trolltech.qt4projectmanager.make</value>
</valuelist>
</data>
<data>
<variable>defaultFileEncoding</variable>
<value type="QByteArray">System</value>
</data>
<data>
<variable>project</variable>
<valuemap type="QVariantMap"/>
</data> </data>
</qtcreator> </qtcreator>

View File

@@ -56,27 +56,17 @@
<variable>buildConfiguration-Debug</variable> <variable>buildConfiguration-Debug</variable>
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<value key="QtVersionId" type="int">0</value> <value key="QtVersionId" type="int">2</value>
<value key="ToolChain" type="int">0</value> <value key="ToolChain" type="int">0</value>
<value key="addQDumper" type=""></value>
<value key="buildConfiguration" type="int">2</value> <value key="buildConfiguration" type="int">2</value>
</valuemap> </valuemap>
</data> </data>
<data>
<variable>buildConfiguration-Release</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value>
<value key="QtVersionId" type="int">0</value>
<value key="addQDumper" type=""></value>
<value key="buildConfiguration" type="int">0</value>
</valuemap>
</data>
<data> <data>
<variable>buildconfiguration-Debug-buildstep0</variable> <variable>buildconfiguration-Debug-buildstep0</variable>
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList"> <valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5i8Go7nPio,guid=870ffe971971ceac89206f0e4c5facbd</value> <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5VyjD99lFj,guid=cf0067cbadce72e8c9c0f05e4c74f11a</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value> <value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value> <value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value> <value type="QString">DISPLAY=:0.0</value>
@@ -84,7 +74,7 @@
<value type="QString">GDM_KEYBOARD_LAYOUT=us</value> <value type="QString">GDM_KEYBOARD_LAYOUT=us</value>
<value type="QString">GDM_LANG=ru_RU.UTF-8</value> <value type="QString">GDM_LANG=ru_RU.UTF-8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value> <value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-7vXnOW</value> <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-sQCAQN</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value> <value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/andrey</value> <value type="QString">HOME=/home/andrey</value>
<value type="QString">LANG=ru_RU.UTF-8</value> <value type="QString">LANG=ru_RU.UTF-8</value>
@@ -95,17 +85,17 @@
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value> <value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/andrey</value> <value type="QString">PWD=/home/andrey</value>
<value type="QString">QTDIR=/usr/share/qt4</value> <value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1124,unix/buull-eeePC:/tmp/.ICE-unix/1124</value> <value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1112,unix/buull-eeePC:/tmp/.ICE-unix/1112</value>
<value type="QString">SHELL=/bin/bash</value> <value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=6561</value> <value type="QString">SPEECHD_PORT=6561</value>
<value type="QString">SSH_AGENT_PID=1158</value> <value type="QString">SSH_AGENT_PID=1146</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-7vXnOW/ssh</value> <value type="QString">SSH_AUTH_SOCK=/tmp/keyring-sQCAQN/ssh</value>
<value type="QString">USER=andrey</value> <value type="QString">USER=andrey</value>
<value type="QString">USERNAME=andrey</value> <value type="QString">USERNAME=andrey</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-HWCXAG/database</value> <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-QG4tiG/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value> <value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value> <value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1281338556.676663-803309736</value> <value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1282732313.174012-433654821</value>
</valuelist> </valuelist>
<valuelist key="abstractProcess.arguments" type="QVariantList"> <valuelist key="abstractProcess.arguments" type="QVariantList">
<value type="QString">/home/andrey/AD/aliendefender/ADeditor/ADeditor.pro</value> <value type="QString">/home/andrey/AD/aliendefender/ADeditor/ADeditor.pro</value>
@@ -124,7 +114,7 @@
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList"> <valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5i8Go7nPio,guid=870ffe971971ceac89206f0e4c5facbd</value> <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5VyjD99lFj,guid=cf0067cbadce72e8c9c0f05e4c74f11a</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value> <value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value> <value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value> <value type="QString">DISPLAY=:0.0</value>
@@ -132,7 +122,7 @@
<value type="QString">GDM_KEYBOARD_LAYOUT=us</value> <value type="QString">GDM_KEYBOARD_LAYOUT=us</value>
<value type="QString">GDM_LANG=ru_RU.UTF-8</value> <value type="QString">GDM_LANG=ru_RU.UTF-8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value> <value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-7vXnOW</value> <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-sQCAQN</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value> <value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/andrey</value> <value type="QString">HOME=/home/andrey</value>
<value type="QString">LANG=ru_RU.UTF-8</value> <value type="QString">LANG=ru_RU.UTF-8</value>
@@ -143,17 +133,17 @@
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value> <value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/andrey</value> <value type="QString">PWD=/home/andrey</value>
<value type="QString">QTDIR=/usr/share/qt4</value> <value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1124,unix/buull-eeePC:/tmp/.ICE-unix/1124</value> <value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1112,unix/buull-eeePC:/tmp/.ICE-unix/1112</value>
<value type="QString">SHELL=/bin/bash</value> <value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=6561</value> <value type="QString">SPEECHD_PORT=6561</value>
<value type="QString">SSH_AGENT_PID=1158</value> <value type="QString">SSH_AGENT_PID=1146</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-7vXnOW/ssh</value> <value type="QString">SSH_AUTH_SOCK=/tmp/keyring-sQCAQN/ssh</value>
<value type="QString">USER=andrey</value> <value type="QString">USER=andrey</value>
<value type="QString">USERNAME=andrey</value> <value type="QString">USERNAME=andrey</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-HWCXAG/database</value> <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-QG4tiG/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value> <value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value> <value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1281338556.676663-803309736</value> <value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1282732313.174012-433654821</value>
</valuelist> </valuelist>
<value key="abstractProcess.IgnoreReturnValue" type="bool">false</value> <value key="abstractProcess.IgnoreReturnValue" type="bool">false</value>
<valuelist key="abstractProcess.arguments" type="QVariantList"> <valuelist key="abstractProcess.arguments" type="QVariantList">
@@ -169,7 +159,7 @@
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList"> <valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5i8Go7nPio,guid=870ffe971971ceac89206f0e4c5facbd</value> <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5VyjD99lFj,guid=cf0067cbadce72e8c9c0f05e4c74f11a</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value> <value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value> <value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value> <value type="QString">DISPLAY=:0.0</value>
@@ -177,7 +167,7 @@
<value type="QString">GDM_KEYBOARD_LAYOUT=us</value> <value type="QString">GDM_KEYBOARD_LAYOUT=us</value>
<value type="QString">GDM_LANG=ru_RU.UTF-8</value> <value type="QString">GDM_LANG=ru_RU.UTF-8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value> <value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-7vXnOW</value> <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-sQCAQN</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value> <value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/andrey</value> <value type="QString">HOME=/home/andrey</value>
<value type="QString">LANG=ru_RU.UTF-8</value> <value type="QString">LANG=ru_RU.UTF-8</value>
@@ -188,17 +178,17 @@
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value> <value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/andrey</value> <value type="QString">PWD=/home/andrey</value>
<value type="QString">QTDIR=/usr/share/qt4</value> <value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1124,unix/buull-eeePC:/tmp/.ICE-unix/1124</value> <value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1112,unix/buull-eeePC:/tmp/.ICE-unix/1112</value>
<value type="QString">SHELL=/bin/bash</value> <value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=6561</value> <value type="QString">SPEECHD_PORT=6561</value>
<value type="QString">SSH_AGENT_PID=1158</value> <value type="QString">SSH_AGENT_PID=1146</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-7vXnOW/ssh</value> <value type="QString">SSH_AUTH_SOCK=/tmp/keyring-sQCAQN/ssh</value>
<value type="QString">USER=andrey</value> <value type="QString">USER=andrey</value>
<value type="QString">USERNAME=andrey</value> <value type="QString">USERNAME=andrey</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-HWCXAG/database</value> <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-QG4tiG/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value> <value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value> <value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1281338556.676663-803309736</value> <value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1282732313.174012-433654821</value>
</valuelist> </valuelist>
<value key="abstractProcess.IgnoreReturnValue" type="bool">true</value> <value key="abstractProcess.IgnoreReturnValue" type="bool">true</value>
<valuelist key="abstractProcess.arguments" type="QVariantList"> <valuelist key="abstractProcess.arguments" type="QVariantList">
@@ -214,29 +204,10 @@
</valuelist> </valuelist>
</valuemap> </valuemap>
</data> </data>
<data>
<variable>buildconfiguration-Release-buildstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value>
</valuemap>
</data>
<data>
<variable>buildconfiguration-Release-buildstep1</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value>
</valuemap>
</data>
<data>
<variable>buildconfiguration-Release-cleanstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value>
</valuemap>
</data>
<data> <data>
<variable>buildconfigurations</variable> <variable>buildconfigurations</variable>
<valuelist type="QVariantList"> <valuelist type="QVariantList">
<value type="QString">Debug</value> <value type="QString">Debug</value>
<value type="QString">Release</value>
</valuelist> </valuelist>
</data> </data>
<data> <data>

5
ADeditor/ADeditor.qrc Normal file
View File

@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/translates">
<file>adeditor_ru.qm</file>
</qresource>
</RCC>

View File

@@ -1,333 +0,0 @@
#############################################################################
# Makefile for building: ADeditor
# Generated by qmake (2.01a) (Qt 4.6.2) on: ?? ???. 25 23:57:34 2010
# Project: ADeditor.pro
# Template: app
# Command: /usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile ADeditor.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtXmlPatterns -I/usr/include/qt4 -I. -I.
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L/usr/lib -lQtXmlPatterns -lQtXml -lQtGui -lQtCore -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake-qt4
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
STRIP = strip
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = ./
####### Files
SOURCES = main.cpp \
mainwindow.cpp \
../loader.cpp \
alienmodel.cpp \
towermodel.cpp \
splashmodel.cpp moc_mainwindow.cpp \
moc_loader.cpp \
moc_alienmodel.cpp \
moc_towermodel.cpp \
moc_splashmodel.cpp
OBJECTS = main.o \
mainwindow.o \
loader.o \
alienmodel.o \
towermodel.o \
splashmodel.o \
moc_mainwindow.o \
moc_loader.o \
moc_alienmodel.o \
moc_towermodel.o \
moc_splashmodel.o
DIST = /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/debug.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf \
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
ADeditor.pro
QMAKE_TARGET = ADeditor
DESTDIR =
TARGET = ADeditor
first: all
####### Implicit rules
.SUFFIXES: .o .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
####### Build rules
all: Makefile $(TARGET)
$(TARGET): ui_mainwindow.h $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: ADeditor.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/debug.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf \
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
/usr/lib/libQtXmlPatterns.prl \
/usr/lib/libQtXml.prl \
/usr/lib/libQtGui.prl \
/usr/lib/libQtCore.prl
$(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile ADeditor.pro
/usr/share/qt4/mkspecs/common/g++.conf:
/usr/share/qt4/mkspecs/common/unix.conf:
/usr/share/qt4/mkspecs/common/linux.conf:
/usr/share/qt4/mkspecs/qconfig.pri:
/usr/share/qt4/mkspecs/features/qt_functions.prf:
/usr/share/qt4/mkspecs/features/qt_config.prf:
/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
/usr/share/qt4/mkspecs/features/default_pre.prf:
/usr/share/qt4/mkspecs/features/debug.prf:
/usr/share/qt4/mkspecs/features/default_post.prf:
/usr/share/qt4/mkspecs/features/warn_on.prf:
/usr/share/qt4/mkspecs/features/qt.prf:
/usr/share/qt4/mkspecs/features/unix/thread.prf:
/usr/share/qt4/mkspecs/features/moc.prf:
/usr/share/qt4/mkspecs/features/resources.prf:
/usr/share/qt4/mkspecs/features/uic.prf:
/usr/share/qt4/mkspecs/features/yacc.prf:
/usr/share/qt4/mkspecs/features/lex.prf:
/usr/share/qt4/mkspecs/features/include_source_dir.prf:
/usr/lib/libQtXmlPatterns.prl:
/usr/lib/libQtXml.prl:
/usr/lib/libQtGui.prl:
/usr/lib/libQtCore.prl:
qmake: FORCE
@$(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile ADeditor.pro
dist:
@$(CHK_DIR_EXISTS) .tmp/ADeditor1.0.0 || $(MKDIR) .tmp/ADeditor1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/ADeditor1.0.0/ && $(COPY_FILE) --parents mainwindow.h ../loader.h alienmodel.h towermodel.h splashmodel.h .tmp/ADeditor1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp ../loader.cpp alienmodel.cpp towermodel.cpp splashmodel.cpp .tmp/ADeditor1.0.0/ && $(COPY_FILE) --parents mainwindow.ui .tmp/ADeditor1.0.0/ && (cd `dirname .tmp/ADeditor1.0.0` && $(TAR) ADeditor1.0.0.tar ADeditor1.0.0 && $(COMPRESS) ADeditor1.0.0.tar) && $(MOVE) `dirname .tmp/ADeditor1.0.0`/ADeditor1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/ADeditor1.0.0
clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
####### Sub-libraries
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) Makefile
mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
compiler_moc_header_make_all: moc_mainwindow.cpp moc_loader.cpp moc_alienmodel.cpp moc_towermodel.cpp moc_splashmodel.cpp
compiler_moc_header_clean:
-$(DEL_FILE) moc_mainwindow.cpp moc_loader.cpp moc_alienmodel.cpp moc_towermodel.cpp moc_splashmodel.cpp
moc_mainwindow.cpp: alienmodel.h \
../loader.h \
../game_data.h \
../player.h \
../base_types.h \
../map.h \
towermodel.h \
splashmodel.h \
mainwindow.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) mainwindow.h -o moc_mainwindow.cpp
moc_loader.cpp: ../game_data.h \
../player.h \
../base_types.h \
../map.h \
../loader.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) ../loader.h -o moc_loader.cpp
moc_alienmodel.cpp: ../loader.h \
../game_data.h \
../player.h \
../base_types.h \
../map.h \
alienmodel.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) alienmodel.h -o moc_alienmodel.cpp
moc_towermodel.cpp: ../loader.h \
../game_data.h \
../player.h \
../base_types.h \
../map.h \
towermodel.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) towermodel.h -o moc_towermodel.cpp
moc_splashmodel.cpp: ../loader.h \
../game_data.h \
../player.h \
../base_types.h \
../map.h \
splashmodel.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) splashmodel.h -o moc_splashmodel.cpp
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all: ui_mainwindow.h
compiler_uic_clean:
-$(DEL_FILE) ui_mainwindow.h
ui_mainwindow.h: mainwindow.ui
/usr/bin/uic-qt4 mainwindow.ui -o ui_mainwindow.h
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: compiler_moc_header_clean compiler_uic_clean
####### Compile
main.o: main.cpp mainwindow.h \
alienmodel.h \
../loader.h \
../game_data.h \
../player.h \
../base_types.h \
../map.h \
towermodel.h \
splashmodel.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
mainwindow.o: mainwindow.cpp mainwindow.h \
alienmodel.h \
../loader.h \
../game_data.h \
../player.h \
../base_types.h \
../map.h \
towermodel.h \
splashmodel.h \
ui_mainwindow.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp
loader.o: ../loader.cpp ../loader.h \
../game_data.h \
../player.h \
../base_types.h \
../map.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o loader.o ../loader.cpp
alienmodel.o: alienmodel.cpp alienmodel.h \
../loader.h \
../game_data.h \
../player.h \
../base_types.h \
../map.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o alienmodel.o alienmodel.cpp
towermodel.o: towermodel.cpp towermodel.h \
../loader.h \
../game_data.h \
../player.h \
../base_types.h \
../map.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o towermodel.o towermodel.cpp
splashmodel.o: splashmodel.cpp splashmodel.h \
../loader.h \
../game_data.h \
../player.h \
../base_types.h \
../map.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o splashmodel.o splashmodel.cpp
moc_mainwindow.o: moc_mainwindow.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp
moc_loader.o: moc_loader.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_loader.o moc_loader.cpp
moc_alienmodel.o: moc_alienmodel.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_alienmodel.o moc_alienmodel.cpp
moc_towermodel.o: moc_towermodel.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_towermodel.o moc_towermodel.cpp
moc_splashmodel.o: moc_splashmodel.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_splashmodel.o moc_splashmodel.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:

BIN
ADeditor/adeditor_ru.qm Normal file

Binary file not shown.

324
ADeditor/adeditor_ru.ts Normal file
View File

@@ -0,0 +1,324 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="ru_RU">
<context>
<name>Loader</name>
<message>
<location filename="../loader.cpp" line="250"/>
<source>Error Level %1 not found!</source>
<translation>Ошибка уровень %1 не найден!</translation>
</message>
<message>
<location filename="../loader.cpp" line="253"/>
<source>Loading level %1 ...</source>
<translation>Загружается уровень %1 ...</translation>
</message>
<message>
<location filename="../loader.cpp" line="260"/>
<source>Error no waves on level!</source>
<translation>Ошибка в уровне нету волн!</translation>
</message>
<message>
<location filename="../loader.cpp" line="276"/>
<source>Error wave %1 is empty!</source>
<translation>Ошибка волна %1 пустая!</translation>
</message>
<message>
<location filename="../loader.cpp" line="295"/>
<source>load wave #%1 prise=%2 timeout=%3</source>
<translation>загружена волна %1 награда=%2 таймаут=%3</translation>
</message>
<message>
<location filename="../loader.cpp" line="311"/>
<source>Alien %1 #%2 </source>
<translation>Монстр %1 %2</translation>
</message>
<message>
<location filename="../loader.cpp" line="340"/>
<source>Tower %1 trig=%2 splash=%3</source>
<translation>Башня %1 триггер=%2 снаряд=%3</translation>
</message>
<message>
<location filename="../loader.cpp" line="340"/>
<source>chain lenght %1</source>
<translation>длина цепочки %1</translation>
</message>
<message>
<location filename="../loader.cpp" line="454"/>
<source>Found %1 aliens</source>
<translation>Найдено %1 монстров</translation>
</message>
<message>
<location filename="../loader.cpp" line="475"/>
<source>Found %1 waves</source>
<translation>найдено %1 волн</translation>
</message>
<message>
<location filename="../loader.cpp" line="509"/>
<source>Found %1 waveParts</source>
<translation>Найдео %1 составляющих волны</translation>
</message>
<message>
<location filename="../loader.cpp" line="557"/>
<source>Found %1 chains</source>
<translation>Найдено %1 цепочек</translation>
</message>
<message>
<location filename="../loader.cpp" line="590"/>
<source>Found %1 Waves On Level</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../loader.cpp" line="623"/>
<source>Found %1 Towers On Level</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../loader.cpp" line="653"/>
<source>Found %1 levels</source>
<translation>найдено %1 уровней</translation>
</message>
<message>
<location filename="../loader.cpp" line="699"/>
<source>Found %1 triggers</source>
<translation>Найдено %1 триггеров</translation>
</message>
<message>
<location filename="../loader.cpp" line="725"/>
<source>Found %1 splashes</source>
<translation>найдено %1 снарядов</translation>
</message>
<message>
<location filename="../loader.cpp" line="764"/>
<source>Found %1 towers</source>
<translation type="unfinished">Найдено %1 башень</translation>
</message>
<message>
<location filename="../loader.cpp" line="789"/>
<source>Found %1 maps</source>
<translation>Найдено %1 карт</translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
<location filename="mainwindow.ui" line="14"/>
<source>MainWindow</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="34"/>
<source>Aliens</source>
<translation>Монстры</translation>
</message>
<message>
<location filename="mainwindow.ui" line="76"/>
<location filename="mainwindow.ui" line="430"/>
<location filename="mainwindow.ui" line="863"/>
<source>Name</source>
<translation>Имя</translation>
</message>
<message>
<location filename="mainwindow.ui" line="99"/>
<source>Health</source>
<translation>Здоровье</translation>
</message>
<message>
<location filename="mainwindow.ui" line="138"/>
<source>Armor</source>
<translation>Броня</translation>
</message>
<message>
<location filename="mainwindow.ui" line="165"/>
<source>Regeneration</source>
<translation>Регенерация</translation>
</message>
<message>
<location filename="mainwindow.ui" line="198"/>
<location filename="mainwindow.ui" line="886"/>
<source>Speed</source>
<translation>Скорость</translation>
</message>
<message>
<location filename="mainwindow.ui" line="240"/>
<source>Prize</source>
<translation>Награда</translation>
</message>
<message>
<location filename="mainwindow.ui" line="270"/>
<source>Score</source>
<translation>Очки</translation>
</message>
<message>
<location filename="mainwindow.ui" line="303"/>
<source>Is Flying</source>
<translation>Летающий</translation>
</message>
<message>
<location filename="mainwindow.ui" line="320"/>
<location filename="mainwindow.ui" line="712"/>
<location filename="mainwindow.ui" line="991"/>
<source>Image</source>
<translation>Картинка</translation>
</message>
<message>
<location filename="mainwindow.ui" line="345"/>
<location filename="mainwindow.ui" line="766"/>
<location filename="mainwindow.ui" line="1045"/>
<source>...</source>
<translation>...</translation>
</message>
<message>
<location filename="mainwindow.ui" line="381"/>
<location filename="mainwindow.ui" line="789"/>
<location filename="mainwindow.ui" line="1068"/>
<source>Add</source>
<translation>Добавить</translation>
</message>
<message>
<location filename="mainwindow.ui" line="394"/>
<location filename="mainwindow.ui" line="802"/>
<location filename="mainwindow.ui" line="1081"/>
<source>Delete</source>
<translation>Удалить</translation>
</message>
<message>
<location filename="mainwindow.ui" line="404"/>
<source>Towers</source>
<translation>Башни</translation>
</message>
<message>
<location filename="mainwindow.ui" line="453"/>
<source>Build time</source>
<translation>Время постройки</translation>
</message>
<message>
<location filename="mainwindow.ui" line="489"/>
<source>Cost</source>
<translation>Цена</translation>
</message>
<message>
<location filename="mainwindow.ui" line="1106"/>
<source>Cancel</source>
<translation>Отменить изменения</translation>
</message>
<message>
<source>splash</source>
<translation type="obsolete">снаряд</translation>
</message>
<message>
<location filename="mainwindow.ui" line="542"/>
<source>Edit</source>
<translation>Ред.</translation>
</message>
<message>
<location filename="mainwindow.ui" line="559"/>
<source>Reload</source>
<translation>Перезарядка</translation>
</message>
<message>
<location filename="mainwindow.ui" line="589"/>
<source>Radius</source>
<translation>Радиус</translation>
</message>
<message>
<location filename="mainwindow.ui" line="622"/>
<source>ExpbyShot</source>
<translation>Опыт за выстрел</translation>
</message>
<message>
<location filename="mainwindow.ui" line="652"/>
<source>ExpbyDam</source>
<translation>Опыт за урон</translation>
</message>
<message>
<location filename="mainwindow.ui" line="682"/>
<source>ExpbyKill</source>
<translation>Опыт за убийство</translation>
</message>
<message>
<location filename="mainwindow.ui" line="812"/>
<source>Splashes</source>
<translation>Снаряды</translation>
</message>
<message>
<location filename="mainwindow.ui" line="925"/>
<source>LifeTime</source>
<translation>Время жизни</translation>
</message>
<message>
<location filename="mainwindow.ui" line="961"/>
<source>AutoControl</source>
<translation>Самонаведение</translation>
</message>
<message>
<location filename="mainwindow.ui" line="1091"/>
<source>Tab 2</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="1099"/>
<source>Save</source>
<translation>Сохранить</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="117"/>
<source>Save changes?</source>
<translation>Сохранить изменения?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="144"/>
<source>All unsaved changes will be lost</source>
<translation>Все несохранённые изменения будут потеряны</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="145"/>
<location filename="mainwindow.cpp" line="250"/>
<location filename="mainwindow.cpp" line="356"/>
<location filename="mainwindow.cpp" line="437"/>
<source>Are you sure?</source>
<translation>Вы уверены?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="230"/>
<source>Alien</source>
<translation>Монстр</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="249"/>
<source>Delete alien %1 id=%2</source>
<translation>Удалить монстра %1 id=%2</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="335"/>
<source>Tower</source>
<translation>Башня</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="355"/>
<source>Delete tower %1 id=%2</source>
<translation>Удалить башню %1 id=%2</translation>
</message>
<message>
<location filename="mainwindow.ui" line="519"/>
<location filename="mainwindow.cpp" line="407"/>
<source>Splash</source>
<translation>Снаряд</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="429"/>
<source>You can not delete splash %1 id=%2</source>
<translation>Вы не можете удалить снаряд %1 id=%2</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="430"/>
<source>It used by tower %1</source>
<translation>Используется башней %1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="436"/>
<source>Delete splash %1 id=%2</source>
<translation>Удалить снаряд %1 id=%2</translation>
</message>
</context>
</TS>

View File

@@ -15,22 +15,22 @@
<wave prise="220" timeout="20000" id="3"/> <wave prise="220" timeout="20000" id="3"/>
</waves> </waves>
<levels> <levels>
<level map="1" id="1" score="138978384" name="First Level"/> <level map="1" id="1" score="149859760" name="First Level"/>
</levels> </levels>
<waveParts> <waveParts>
<wavePart alien="10" count="10" wave="1"/>
<wavePart alien="12" count="5" wave="1"/>
<wavePart alien="10" count="4" wave="1"/> <wavePart alien="10" count="4" wave="1"/>
<wavePart alien="12" count="5" wave="1"/>
<wavePart alien="10" count="10" wave="1"/>
<wavePart alien="10" count="9" wave="2"/> <wavePart alien="10" count="9" wave="2"/>
<wavePart alien="12" count="4" wave="3"/>
<wavePart alien="12" count="3" wave="3"/>
<wavePart alien="10" count="2" wave="3"/>
<wavePart alien="10" count="1" wave="3"/> <wavePart alien="10" count="1" wave="3"/>
<wavePart alien="10" count="2" wave="3"/>
<wavePart alien="12" count="3" wave="3"/>
<wavePart alien="12" count="4" wave="3"/>
</waveParts> </waveParts>
<wavesOnLevels> <wavesOnLevels>
<waveOnLevel wave="3" level="1"/>
<waveOnLevel wave="2" level="1"/>
<waveOnLevel wave="1" level="1"/> <waveOnLevel wave="1" level="1"/>
<waveOnLevel wave="2" level="1"/>
<waveOnLevel wave="3" level="1"/>
</wavesOnLevels> </wavesOnLevels>
<splashes> <splashes>
<splash speed="0.2" imageType="1" lifetime="9999" id="1" name="rocket"/> <splash speed="0.2" imageType="1" lifetime="9999" id="1" name="rocket"/>
@@ -50,15 +50,15 @@
<trigger childAim="noAim" count="1" type="onTimer" id="4" name="smoke"/> <trigger childAim="noAim" count="1" type="onTimer" id="4" name="smoke"/>
</triggers> </triggers>
<chains> <chains>
<chain tower="1" trigger="4" child="5" parent="1"/>
<chain tower="1" trigger="3" child="4" parent="1"/> <chain tower="1" trigger="3" child="4" parent="1"/>
<chain tower="1" trigger="4" child="5" parent="1"/>
<chain tower="2" trigger="2" parent="3"/> <chain tower="2" trigger="2" parent="3"/>
<chain tower="3" trigger="4" child="5" parent="2"/>
<chain tower="3" trigger="3" child="4" parent="2"/> <chain tower="3" trigger="3" child="4" parent="2"/>
<chain tower="3" trigger="4" child="5" parent="2"/>
</chains> </chains>
<towersOnLevels> <towersOnLevels>
<towerOnLevel tower="3" level="1"/>
<towerOnLevel tower="2" level="1"/>
<towerOnLevel tower="1" level="1"/> <towerOnLevel tower="1" level="1"/>
<towerOnLevel tower="2" level="1"/>
<towerOnLevel tower="3" level="1"/>
</towersOnLevels> </towersOnLevels>
</ADdata> </ADdata>

View File

@@ -1,10 +1,14 @@
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <QTranslator>
#include "mainwindow.h" #include "mainwindow.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
MainWindow w; QTranslator translator;
translator.load(":/translates/" + QString("adeditor_") + QLocale::system().name());
a.installTranslator(&translator);
MainWindow w;
w.show(); w.show();
return a.exec(); return a.exec();
} }

View File

@@ -5,109 +5,130 @@
MainWindow::MainWindow(QWidget *parent) : MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
ui(new Ui::MainWindow) ui(new Ui::MainWindow)
{ {
ui->setupUi(this); ui->setupUi(this);
adloader = new Loader(this); adloader = new Loader(this);
adloader->load("data2.xml"); adloader->load("data2.xml");
alModel = new AlienModel(adloader->aliens.values()); alModel = new AlienModel(adloader->aliens.values());
ui->lvAliens->setModel((QAbstractItemModel * )alModel); ui->lvAliens->setModel((QAbstractItemModel * )alModel);
connect(ui->lvAliens->selectionModel(),SIGNAL(currentChanged(QModelIndex, QModelIndex)),this,SLOT(lvAliens_select(QModelIndex, QModelIndex))); connect(ui->lvAliens->selectionModel(),SIGNAL(currentChanged(QModelIndex, QModelIndex)),this,SLOT(lvAliens_select(QModelIndex, QModelIndex)));
ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(0,0),QItemSelectionModel::ClearAndSelect); ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
splModel = new SplashModel(adloader->splashes.values()); splModel = new SplashModel(adloader->splashes.values());
ui->lvSplashes->setModel((QAbstractItemModel * )splModel); ui->lvSplashes->setModel((QAbstractItemModel * )splModel);
connect(ui->lvSplashes->selectionModel(),SIGNAL(currentChanged(QModelIndex, QModelIndex)),this,SLOT(lvSplashes_select(QModelIndex, QModelIndex))); connect(ui->lvSplashes->selectionModel(),SIGNAL(currentChanged(QModelIndex, QModelIndex)),this,SLOT(lvSplashes_select(QModelIndex, QModelIndex)));
ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(0,0),QItemSelectionModel::ClearAndSelect); ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
twModel = new TowerModel(adloader->towers.values()); twModel = new TowerModel(adloader->towers.values());
ui->lvTowers->setModel((QAbstractItemModel * )twModel); ui->lvTowers->setModel((QAbstractItemModel * )twModel);
connect(ui->lvTowers->selectionModel(),SIGNAL(currentChanged(QModelIndex, QModelIndex)),this,SLOT(lvTowers_select(QModelIndex, QModelIndex))); connect(ui->lvTowers->selectionModel(),SIGNAL(currentChanged(QModelIndex, QModelIndex)),this,SLOT(lvTowers_select(QModelIndex, QModelIndex)));
ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(0,0),QItemSelectionModel::ClearAndSelect); ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
ui->cbTwSplash->setModel((QAbstractItemModel * )splModel); ui->cbTwSplash->setModel((QAbstractItemModel * )splModel);
trigModel = new TriggerModel(adloader->triggers.values());
ui->lvTriggers->setModel((QAbstractItemModel * )trigModel);
connect(ui->lvTriggers->selectionModel(),SIGNAL(currentChanged(QModelIndex, QModelIndex)),this,SLOT(lvTriggers_select(QModelIndex,QModelIndex)));
ui->lvTriggers->selectionModel()->setCurrentIndex(ui->lvTriggers->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
delete ui; delete ui;
} }
void MainWindow::changeEvent(QEvent *e) void MainWindow::changeEvent(QEvent *e)
{ {
QMainWindow::changeEvent(e); QMainWindow::changeEvent(e);
switch (e->type()) { switch (e->type()) {
case QEvent::LanguageChange: case QEvent::LanguageChange:
ui->retranslateUi(this); ui->retranslateUi(this);
break; break;
default: default:
break; break;
} }
} }
void MainWindow::on_cbAlArmor_toggled(bool checked) void MainWindow::on_cbAlArmor_toggled(bool checked)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
ui->sbAlArmor->setEnabled(checked); ui->sbAlArmor->setEnabled(checked);
if (checked) adloader->aliens[id].armor = ui->sbAlArmor->value(); if (checked) adloader->aliens[id].armor = ui->sbAlArmor->value();
else adloader->aliens[id].armor = 0; else adloader->aliens[id].armor = 0;
} }
void MainWindow::on_cbAlRegeneration_toggled(bool checked) void MainWindow::on_cbAlRegeneration_toggled(bool checked)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
ui->sbAlregeneration->setEnabled(checked); ui->sbAlregeneration->setEnabled(checked);
if (checked) adloader->aliens[id].regeneration = ui->sbAlregeneration->value(); if (checked) adloader->aliens[id].regeneration = ui->sbAlregeneration->value();
else adloader->aliens[id].regeneration = 0; else adloader->aliens[id].regeneration = 0;
} }
void MainWindow::lvAliens_select(QModelIndex index, QModelIndex) void MainWindow::lvAliens_select(QModelIndex index, QModelIndex)
{ {
tbAlien al = adloader->aliens.values().at(index.row()); tbAlien al = adloader->aliens.values().at(index.row());
ui->leAlName->setText(al.name); ui->leAlName->setText(al.name);
ui->sbAlHealth->setValue(al.health); ui->sbAlHealth->setValue(al.health);
ui->sbAlArmor->setValue(al.armor); ui->sbAlArmor->setValue(al.armor);
if (al.armor > 0) ui->cbAlArmor->setChecked(true); if (al.armor > 0) ui->cbAlArmor->setChecked(true);
else ui->cbAlArmor->setChecked(false); else ui->cbAlArmor->setChecked(false);
ui->sbAlSpeed->setValue(al.speed); ui->sbAlSpeed->setValue(al.speed);
ui->sbAlPrise->setValue(al.prise); ui->sbAlPrise->setValue(al.prise);
ui->sbAlregeneration->setValue(al.regeneration); ui->sbAlregeneration->setValue(al.regeneration);
if (al.regeneration > 0) ui->cbAlRegeneration->setChecked(true); if (al.regeneration > 0) ui->cbAlRegeneration->setChecked(true);
else ui->cbAlRegeneration->setChecked(false); else ui->cbAlRegeneration->setChecked(false);
ui->sbAlScore->setValue(al.score); ui->sbAlScore->setValue(al.score);
ui->cbAlIsFly->setChecked(al.isFlying); ui->cbAlIsFly->setChecked(al.isFlying);
} }
void MainWindow::lvTowers_select(QModelIndex index, QModelIndex) void MainWindow::lvTowers_select(QModelIndex index, QModelIndex)
{ {
tbTower tw = adloader->towers.values().at(index.row()); tbTower tw = adloader->towers.values().at(index.row());
ui->sbTwBuildTime->setValue(tw.buildTime); ui->sbTwBuildTime->setValue(tw.buildTime);
ui->sbTwCost->setValue(tw.cost); ui->sbTwCost->setValue(tw.cost);
ui->sbTwExpByDam->setValue(tw.expByDamage); ui->sbTwExpByDam->setValue(tw.expByDamage);
ui->sbTwExpByKill->setValue(tw.expByKill); ui->sbTwExpByKill->setValue(tw.expByKill);
ui->sbTwExpByShot->setValue(tw.expByShot); ui->sbTwExpByShot->setValue(tw.expByShot);
ui->leTwName->setText(tw.name); ui->leTwName->setText(tw.name);
ui->sbTwRadius->setValue(tw.radius); ui->sbTwRadius->setValue(tw.radius);
ui->sbTwReload->setValue(tw.reload); ui->sbTwReload->setValue(tw.reload);
ui->cbTwSplash->setCurrentIndex(adloader->splashes.keys().indexOf(tw.splashId)); ui->cbTwSplash->setCurrentIndex(adloader->splashes.keys().indexOf(tw.splashId));
} }
void MainWindow::lvSplashes_select(QModelIndex index, QModelIndex) void MainWindow::lvSplashes_select(QModelIndex index, QModelIndex)
{ {
tbSplash spl = adloader->splashes.values().at(index.row()); tbSplash spl = adloader->splashes.values().at(index.row());
ui->sbSplLifeTime->setValue(spl.lifetime); ui->sbSplLifeTime->setValue(spl.lifetime);
ui->sbSplSpeed->setValue(spl.speed); ui->sbSplSpeed->setValue(spl.speed);
ui->cbSplAutoControl->setChecked(spl.autoControl); ui->cbSplAutoControl->setChecked(spl.autoControl);
ui->leSplName->setText(spl.name); ui->leSplName->setText(spl.name);
}
void MainWindow::lvTriggers_select(QModelIndex index, QModelIndex)
{
tbTrigger trig = adloader->triggers.values().at(index.row());
ui->sbTrigCount->setValue(trig.count);
ui->sbTrigDamage->setValue(trig.damage);
ui->sbTrigDamRadius->setValue(trig.radius);
ui->sbTrigChance->setValue(trig.chance);
if (trig.chance == 100)
ui->cbTrigChance->setChecked(false);
else
ui->cbTrigChance->setChecked(true);
ui->sbTrigRandomRadius->setValue(trig.randomPosRadius);
ui->sbTrigTimer->setValue(trig.timer);
ui->leTrigName->setText(trig.name);
} }
@@ -134,7 +155,9 @@ void MainWindow::closeEvent(QCloseEvent *event)
void MainWindow::on_pbSave_clicked() void MainWindow::on_pbSave_clicked()
{ {
adloader->save("data2.xml"); adloader->save("data2.xml");
adloader->load("data2.xml");
adloader->save("data2.xml");
} }
@@ -164,79 +187,79 @@ void MainWindow::on_pbReload_clicked()
void MainWindow::on_sbAlHealth_valueChanged(double value) void MainWindow::on_sbAlHealth_valueChanged(double value)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
adloader->aliens[id].health = value; adloader->aliens[id].health = value;
} }
void MainWindow::on_sbAlArmor_valueChanged(double value) void MainWindow::on_sbAlArmor_valueChanged(double value)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
adloader->aliens[id].armor = value; adloader->aliens[id].armor = value;
} }
void MainWindow::on_sbAlregeneration_valueChanged(double value) void MainWindow::on_sbAlregeneration_valueChanged(double value)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
adloader->aliens[id].regeneration = value; adloader->aliens[id].regeneration = value;
} }
void MainWindow::on_sbAlSpeed_valueChanged(double value) void MainWindow::on_sbAlSpeed_valueChanged(double value)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
adloader->aliens[id].speed = value; adloader->aliens[id].speed = value;
} }
void MainWindow::on_sbAlPrise_valueChanged(int val) void MainWindow::on_sbAlPrise_valueChanged(int val)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
adloader->aliens[id].prise = val; adloader->aliens[id].prise = val;
} }
void MainWindow::on_sbAlScore_valueChanged(int val) void MainWindow::on_sbAlScore_valueChanged(int val)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
adloader->aliens[id].score = val; adloader->aliens[id].score = val;
} }
void MainWindow::on_cbAlIsFly_clicked(bool checked) void MainWindow::on_cbAlIsFly_clicked(bool checked)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
adloader->aliens[id].isFlying = checked; adloader->aliens[id].isFlying = checked;
} }
void MainWindow::on_leAlName_editingFinished() void MainWindow::on_leAlName_editingFinished()
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
adloader->aliens[id].name = ui->leAlName->text(); adloader->aliens[id].name = ui->leAlName->text();
alModel->refresh(adloader->aliens.values()); alModel->refresh(adloader->aliens.values());
ui->lvAliens->setModel((QAbstractItemModel * )alModel); ui->lvAliens->setModel((QAbstractItemModel * )alModel);
ui->lvAliens->repaint(); ui->lvAliens->repaint();
} }
void MainWindow::on_pbAlAdd_clicked() void MainWindow::on_pbAlAdd_clicked()
{ {
int i = 1; int i = 1;
while (adloader->aliens.contains(i)) i++; while (adloader->aliens.contains(i)) i++;
tbAlien al; tbAlien al;
al.id = i; al.id = i;
al.name = tr("Alien"); al.name = tr("Alien");
al.health = 1; al.health = 1;
al.prise = 0; al.prise = 0;
al.score = 1; al.score = 1;
al.speed = 1; al.speed = 1;
adloader->aliens.insert(al.id,al); adloader->aliens.insert(al.id,al);
int index = adloader->aliens.keys().indexOf(i); int index = adloader->aliens.keys().indexOf(i);
alModel->refresh(adloader->aliens.values()); alModel->refresh(adloader->aliens.values());
ui->lvAliens->setModel((QAbstractItemModel * )alModel); ui->lvAliens->setModel((QAbstractItemModel * )alModel);
ui->lvAliens->reset(); ui->lvAliens->reset();
ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(index,0),QItemSelectionModel::ClearAndSelect); ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(index,0),QItemSelectionModel::ClearAndSelect);
} }
@@ -244,105 +267,105 @@ void MainWindow::on_pbAlAdd_clicked()
void MainWindow::on_pbAlDel_clicked() void MainWindow::on_pbAlDel_clicked()
{ {
if (adloader->aliens.size() < 2) return; if (adloader->aliens.size() < 2) return;
QMessageBox msgBox; QMessageBox msgBox;
int id = adloader->aliens.keys().at(ui->lvAliens->currentIndex().row()); int id = adloader->aliens.keys().at(ui->lvAliens->currentIndex().row());
msgBox.setText(tr("Delete alien %1 id=%2").arg(adloader->aliens.value(id).name).arg(id)); msgBox.setText(tr("Delete alien %1 id=%2").arg(adloader->aliens.value(id).name).arg(id));
msgBox.setInformativeText(tr("Are you sure?")); msgBox.setInformativeText(tr("Are you sure?"));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok);
int ret = msgBox.exec(); int ret = msgBox.exec();
if (ret == QMessageBox::Ok) if (ret == QMessageBox::Ok)
{ {
adloader->aliens.remove(id); adloader->aliens.remove(id);
alModel->refresh(adloader->aliens.values()); alModel->refresh(adloader->aliens.values());
ui->lvAliens->setModel((QAbstractItemModel * )alModel); ui->lvAliens->setModel((QAbstractItemModel * )alModel);
ui->lvAliens->reset(); ui->lvAliens->reset();
ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(0,0),QItemSelectionModel::ClearAndSelect); ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
} }
} }
void MainWindow::on_leTwName_editingFinished() void MainWindow::on_leTwName_editingFinished()
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
adloader->towers[id].name = ui->leTwName->text(); adloader->towers[id].name = ui->leTwName->text();
twModel->refresh(adloader->towers.values()); twModel->refresh(adloader->towers.values());
ui->lvTowers->setModel((QAbstractItemModel * )twModel); ui->lvTowers->setModel((QAbstractItemModel * )twModel);
} }
void MainWindow::on_sbTwBuildTime_valueChanged(int val) void MainWindow::on_sbTwBuildTime_valueChanged(int val)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
adloader->towers[id].buildTime = val; adloader->towers[id].buildTime = val;
} }
void MainWindow::on_sbTwCost_valueChanged(int val) void MainWindow::on_sbTwCost_valueChanged(int val)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
adloader->towers[id].cost = val; adloader->towers[id].cost = val;
} }
void MainWindow::on_cbTwSplash_currentIndexChanged(int index) void MainWindow::on_cbTwSplash_currentIndexChanged(int index)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
adloader->towers[id].splashId = adloader->splashes.values().at(index).id; adloader->towers[id].splashId = adloader->splashes.values().at(index).id;
} }
void MainWindow::on_sbTwReload_valueChanged(int val) void MainWindow::on_sbTwReload_valueChanged(int val)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
adloader->towers[id].reload = val; adloader->towers[id].reload = val;
} }
void MainWindow::on_sbTwRadius_valueChanged(double val) void MainWindow::on_sbTwRadius_valueChanged(double val)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
adloader->towers[id].radius = val; adloader->towers[id].radius = val;
} }
void MainWindow::on_sbTwExpByShot_valueChanged(double val) void MainWindow::on_sbTwExpByShot_valueChanged(double val)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
adloader->towers[id].expByShot = val; adloader->towers[id].expByShot = val;
} }
void MainWindow::on_sbTwExpByDam_valueChanged(double val) void MainWindow::on_sbTwExpByDam_valueChanged(double val)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
adloader->towers[id].expByDamage = val; adloader->towers[id].expByDamage = val;
} }
void MainWindow::on_sbTwExpByKill_valueChanged(double val) void MainWindow::on_sbTwExpByKill_valueChanged(double val)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
adloader->towers[id].expByKill = val; adloader->towers[id].expByKill = val;
} }
void MainWindow::on_pbTwAdd_clicked() void MainWindow::on_pbTwAdd_clicked()
{ {
int i = 1; int i = 1;
while (adloader->towers.contains(i)) i++; while (adloader->towers.contains(i)) i++;
tbTower tw; tbTower tw;
tw.id = i; tw.id = i;
tw.name = tr("Tower"); tw.name = tr("Tower");
tw.splashId = adloader->splashes.keys().at(0); tw.splashId = adloader->splashes.keys().at(0);
tw.buildTime = 1; tw.buildTime = 1;
tw.cost = 1; tw.cost = 1;
tw.radius = 1; tw.radius = 1;
tw.reload = 1; tw.reload = 1;
adloader->towers.insert(tw.id,tw); adloader->towers.insert(tw.id,tw);
int index = adloader->towers.keys().indexOf(i); int index = adloader->towers.keys().indexOf(i);
twModel->refresh(adloader->towers.values()); twModel->refresh(adloader->towers.values());
ui->lvTowers->setModel((QAbstractItemModel * )twModel); ui->lvTowers->setModel((QAbstractItemModel * )twModel);
ui->lvTowers->reset(); ui->lvTowers->reset();
ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(index,0),QItemSelectionModel::ClearAndSelect); ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(index,0),QItemSelectionModel::ClearAndSelect);
} }
@@ -351,77 +374,77 @@ void MainWindow::on_pbTwDel_clicked()
{ {
if (adloader->towers.size() < 2) return; if (adloader->towers.size() < 2) return;
QMessageBox msgBox; QMessageBox msgBox;
int id = adloader->towers.keys().at(ui->lvTowers->currentIndex().row()); int id = adloader->towers.keys().at(ui->lvTowers->currentIndex().row());
msgBox.setText(tr("Delete tower %1 id=%2").arg(adloader->towers.value(id).name).arg(id)); msgBox.setText(tr("Delete tower %1 id=%2").arg(adloader->towers.value(id).name).arg(id));
msgBox.setInformativeText(tr("Are you sure?")); msgBox.setInformativeText(tr("Are you sure?"));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok);
int ret = msgBox.exec(); int ret = msgBox.exec();
if (ret == QMessageBox::Ok) if (ret == QMessageBox::Ok)
{ {
adloader->towers.remove(id); adloader->towers.remove(id);
twModel->refresh(adloader->towers.values()); twModel->refresh(adloader->towers.values());
ui->lvTowers->setModel((QAbstractItemModel * )twModel); ui->lvTowers->setModel((QAbstractItemModel * )twModel);
ui->lvTowers->reset(); ui->lvTowers->reset();
ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(0,0),QItemSelectionModel::ClearAndSelect); ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
} }
} }
void MainWindow::on_leSplName_editingFinished() void MainWindow::on_leSplName_editingFinished()
{ {
int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id;
adloader->splashes[id].name = ui->leSplName->text(); adloader->splashes[id].name = ui->leSplName->text();
splModel->refresh(adloader->splashes.values()); splModel->refresh(adloader->splashes.values());
ui->lvSplashes->setModel((QAbstractItemModel * )splModel); ui->lvSplashes->setModel((QAbstractItemModel * )splModel);
ui->cbTwSplash->setModel((QAbstractItemModel * )splModel); ui->cbTwSplash->setModel((QAbstractItemModel * )splModel);
} }
void MainWindow::on_sbSplSpeed_valueChanged(double val) void MainWindow::on_sbSplSpeed_valueChanged(double val)
{ {
int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id;
adloader->splashes[id].speed = val; adloader->splashes[id].speed = val;
} }
void MainWindow::on_cbSplAutoControl_toggled(bool checked) void MainWindow::on_cbSplAutoControl_toggled(bool checked)
{ {
int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id;
adloader->splashes[id].autoControl = checked; adloader->splashes[id].autoControl = checked;
} }
void MainWindow::on_sbSplLifeTime_valueChanged(int val) void MainWindow::on_sbSplLifeTime_valueChanged(int val)
{ {
int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id;
adloader->splashes[id].lifetime = val; adloader->splashes[id].lifetime = val;
} }
void MainWindow::on_pbSplAdd_clicked() void MainWindow::on_pbSplAdd_clicked()
{ {
int i = 1; int i = 1;
while (adloader->splashes.contains(i)) i++; while (adloader->splashes.contains(i)) i++;
tbSplash spl; tbSplash spl;
spl.id = i; spl.id = i;
spl.name = tr("Splash"); spl.name = tr("Splash");
spl.lifetime = 1; spl.lifetime = 1;
spl.speed = 1; spl.speed = 1;
adloader->splashes.insert(spl.id,spl); adloader->splashes.insert(spl.id,spl);
int index = adloader->splashes.keys().indexOf(i); int index = adloader->splashes.keys().indexOf(i);
splModel->refresh(adloader->splashes.values()); splModel->refresh(adloader->splashes.values());
ui->lvSplashes->setModel((QAbstractItemModel * )splModel); ui->lvSplashes->setModel((QAbstractItemModel * )splModel);
ui->lvSplashes->reset(); ui->lvSplashes->reset();
ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(index,0),QItemSelectionModel::ClearAndSelect); ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(index,0),QItemSelectionModel::ClearAndSelect);
ui->cbTwSplash->setModel((QAbstractItemModel * )splModel); ui->cbTwSplash->setModel((QAbstractItemModel * )splModel);
} }
void MainWindow::on_pbSlpDel_clicked() void MainWindow::on_pbSlpDel_clicked()
{ {
if (adloader->splashes.size() < 2) return; if (adloader->splashes.size() < 2) return;
QMessageBox msgBox; QMessageBox msgBox;
int id = adloader->splashes.keys().at(ui->lvSplashes->currentIndex().row()); int id = adloader->splashes.keys().at(ui->lvSplashes->currentIndex().row());
for (int i=0; i<adloader->towers.size(); i++) for (int i=0; i<adloader->towers.size(); i++)
{ {
if (adloader->towers.values().at(i).splashId == id) if (adloader->towers.values().at(i).splashId == id)
@@ -433,20 +456,20 @@ void MainWindow::on_pbSlpDel_clicked()
return; return;
} }
} }
msgBox.setText(tr("Delete splash %1 id=%2").arg(adloader->splashes.value(id).name).arg(id)); msgBox.setText(tr("Delete splash %1 id=%2").arg(adloader->splashes.value(id).name).arg(id));
msgBox.setInformativeText(tr("Are you sure?")); msgBox.setInformativeText(tr("Are you sure?"));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok);
int ret = msgBox.exec(); int ret = msgBox.exec();
if (ret == QMessageBox::Ok) if (ret == QMessageBox::Ok)
{ {
adloader->splashes.remove(id); adloader->splashes.remove(id);
splModel->refresh(adloader->splashes.values()); splModel->refresh(adloader->splashes.values());
ui->lvSplashes->setModel((QAbstractItemModel * )splModel); ui->lvSplashes->setModel((QAbstractItemModel * )splModel);
ui->lvSplashes->reset(); ui->lvSplashes->reset();
ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(0,0),QItemSelectionModel::ClearAndSelect); ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
ui->cbTwSplash->setModel((QAbstractItemModel * )splModel); ui->cbTwSplash->setModel((QAbstractItemModel * )splModel);
} }
} }
@@ -456,3 +479,12 @@ void MainWindow::on_pushButton_clicked()
ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(splIndex,0),QItemSelectionModel::ClearAndSelect); ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(splIndex,0),QItemSelectionModel::ClearAndSelect);
ui->tabWidget->setCurrentWidget(ui->tabSplashes); ui->tabWidget->setCurrentWidget(ui->tabSplashes);
} }
void MainWindow::on_cbTrigChance_clicked(bool checked)
{
int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id;
ui->sbTrigChance->setEnabled(checked);
if (checked) adloader->triggers[id].chance = ui->sbTrigChance->value();
else adloader->triggers[id].chance = 100;
}

View File

@@ -9,64 +9,68 @@
#include "alienmodel.h" #include "alienmodel.h"
#include "towermodel.h" #include "towermodel.h"
#include "splashmodel.h" #include "splashmodel.h"
#include "triggermodel.h"
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;
} }
class MainWindow : public QMainWindow { class MainWindow : public QMainWindow {
Q_OBJECT Q_OBJECT
public: public:
MainWindow(QWidget *parent = 0); MainWindow(QWidget *parent = 0);
~MainWindow(); ~MainWindow();
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
Loader * adloader; Loader * adloader;
AlienModel * alModel; AlienModel * alModel;
TowerModel * twModel; TowerModel * twModel;
SplashModel * splModel; SplashModel * splModel;
TriggerModel* trigModel;
void closeEvent(QCloseEvent *); void closeEvent(QCloseEvent *);
private slots: private slots:
void on_pbReload_clicked(); void on_cbTrigChance_clicked(bool checked);
void on_pbReload_clicked();
void on_pushButton_clicked(); void on_pushButton_clicked();
void on_pbSlpDel_clicked(); void on_pbSlpDel_clicked();
void on_pbSplAdd_clicked(); void on_pbSplAdd_clicked();
void on_sbSplLifeTime_valueChanged(int ); void on_sbSplLifeTime_valueChanged(int );
void on_cbSplAutoControl_toggled(bool checked); void on_cbSplAutoControl_toggled(bool checked);
void on_sbSplSpeed_valueChanged(double ); void on_sbSplSpeed_valueChanged(double );
void on_leSplName_editingFinished(); void on_leSplName_editingFinished();
void on_pbTwDel_clicked(); void on_pbTwDel_clicked();
void on_sbTwExpByKill_valueChanged(double ); void on_sbTwExpByKill_valueChanged(double );
void on_sbTwExpByDam_valueChanged(double ); void on_sbTwExpByDam_valueChanged(double );
void on_sbTwExpByShot_valueChanged(double ); void on_sbTwExpByShot_valueChanged(double );
void on_sbTwRadius_valueChanged(double ); void on_sbTwRadius_valueChanged(double );
void on_sbTwReload_valueChanged(int ); void on_sbTwReload_valueChanged(int );
void on_cbTwSplash_currentIndexChanged(int index); void on_cbTwSplash_currentIndexChanged(int index);
void on_sbTwCost_valueChanged(int ); void on_sbTwCost_valueChanged(int );
void on_sbTwBuildTime_valueChanged(int ); void on_sbTwBuildTime_valueChanged(int );
void on_pbTwAdd_clicked(); void on_pbTwAdd_clicked();
void on_leTwName_editingFinished(); void on_leTwName_editingFinished();
void on_pbAlDel_clicked(); void on_pbAlDel_clicked();
void on_pbAlAdd_clicked(); void on_pbAlAdd_clicked();
void on_leAlName_editingFinished(); void on_leAlName_editingFinished();
void on_cbAlIsFly_clicked(bool checked); void on_cbAlIsFly_clicked(bool checked);
void on_sbAlScore_valueChanged(int ); void on_sbAlScore_valueChanged(int );
void on_sbAlPrise_valueChanged(int ); void on_sbAlPrise_valueChanged(int );
void on_sbAlSpeed_valueChanged(double ); void on_sbAlSpeed_valueChanged(double );
void on_sbAlregeneration_valueChanged(double ); void on_sbAlregeneration_valueChanged(double );
void on_sbAlArmor_valueChanged(double ); void on_sbAlArmor_valueChanged(double );
void on_sbAlHealth_valueChanged(double ); void on_sbAlHealth_valueChanged(double );
void on_pbSave_clicked(); void on_pbSave_clicked();
void lvAliens_select(QModelIndex, QModelIndex); void lvAliens_select(QModelIndex, QModelIndex);
void lvTowers_select(QModelIndex, QModelIndex); void lvTowers_select(QModelIndex, QModelIndex);
void lvSplashes_select(QModelIndex, QModelIndex); void lvSplashes_select(QModelIndex, QModelIndex);
void on_cbAlRegeneration_toggled(bool checked); void lvTriggers_select(QModelIndex, QModelIndex);
void on_cbAlArmor_toggled(bool checked); void on_cbAlRegeneration_toggled(bool checked);
void on_cbAlArmor_toggled(bool checked);
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View File

@@ -6,13 +6,10 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>582</width> <width>598</width>
<height>519</height> <height>489</height>
</rect> </rect>
</property> </property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>MainWindow</string> <string>MainWindow</string>
</property> </property>
@@ -21,25 +18,14 @@
</property> </property>
<widget class="QWidget" name="centralWidget"> <widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0"> <property name="margin">
<widget class="QPushButton" name="pbSave"> <number>2</number>
<property name="cursor"> </property>
<cursorShape>PointingHandCursor</cursorShape> <property name="spacing">
</property> <number>2</number>
<property name="text"> </property>
<string>Save</string> <item row="3" column="0">
</property> <widget class="QTabWidget" name="tabWidget">
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="pbReload">
<property name="text">
<string>Reload</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QTabWidget" name="tabSplash">
<property name="currentIndex"> <property name="currentIndex">
<number>3</number> <number>3</number>
</property> </property>
@@ -239,7 +225,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Prise</string> <string>Prize</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
@@ -293,7 +279,7 @@
<item> <item>
<widget class="QCheckBox" name="cbAlIsFly"> <widget class="QCheckBox" name="cbAlIsFly">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@@ -306,23 +292,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_9" stretch="10,4,0,1"> <layout class="QHBoxLayout" name="horizontalLayout_9" stretch="10,0,0">
<item> <item>
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="sizePolicy"> <property name="sizePolicy">
@@ -339,35 +312,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QGraphicsView" name="graphicsView">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="QPushButton" name="pushButton_3"> <widget class="QPushButton" name="pushButton_3">
<property name="enabled"> <property name="enabled">
@@ -390,8 +334,34 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@@ -408,9 +378,6 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text"> <property name="text">
<string>Add</string> <string>Add</string>
</property> </property>
@@ -443,9 +410,6 @@
</item> </item>
<item row="0" column="1" rowspan="2"> <item row="0" column="1" rowspan="2">
<widget class="QFrame" name="frame_2"> <widget class="QFrame" name="frame_2">
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
</property> </property>
@@ -553,7 +517,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>splash</string> <string>Splash</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
@@ -648,7 +612,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_31"> <layout class="QHBoxLayout" name="horizontalLayout_31">
<item> <item>
<widget class="QLabel" name="label_24"> <widget class="QCheckBox" name="cbTwExpByShot">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@@ -656,10 +620,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>ExpbyShot</string> <string>ExpByShot</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
@@ -678,7 +639,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_34"> <layout class="QHBoxLayout" name="horizontalLayout_34">
<item> <item>
<widget class="QLabel" name="label_27"> <widget class="QCheckBox" name="cbTwExpByDam">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@@ -686,10 +647,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>ExpbyDam</string> <string>ExpByDam</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
@@ -708,7 +666,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_32"> <layout class="QHBoxLayout" name="horizontalLayout_32">
<item> <item>
<widget class="QLabel" name="label_26"> <widget class="QCheckBox" name="cbTwExpByKill">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@@ -716,10 +674,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>ExpbyKill</string> <string>ExpByKill</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
@@ -799,9 +754,6 @@
<height>32</height> <height>32</height>
</size> </size>
</property> </property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@@ -809,6 +761,19 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@@ -825,9 +790,6 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text"> <property name="text">
<string>Add</string> <string>Add</string>
</property> </property>
@@ -841,9 +803,6 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text"> <property name="text">
<string>Delete</string> <string>Delete</string>
</property> </property>
@@ -876,16 +835,13 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_7" stretch="0,0,0,0,0"> <layout class="QVBoxLayout" name="verticalLayout_7" stretch="0,0,0,0,0,0">
<property name="sizeConstraint"> <property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum> <enum>QLayout::SetDefaultConstraint</enum>
</property> </property>
@@ -1003,9 +959,6 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="layoutDirection"> <property name="layoutDirection">
<enum>Qt::LeftToRight</enum> <enum>Qt::LeftToRight</enum>
</property> </property>
@@ -1093,9 +1046,6 @@
<height>32</height> <height>32</height>
</size> </size>
</property> </property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@@ -1103,6 +1053,19 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@@ -1119,9 +1082,6 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text"> <property name="text">
<string>Add</string> <string>Add</string>
</property> </property>
@@ -1135,8 +1095,334 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="cursor"> <property name="text">
<cursorShape>PointingHandCursor</cursorShape> <string>Delete</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabTriggers">
<attribute name="title">
<string>Triggers</string>
</attribute>
<layout class="QGridLayout" name="gridLayout" columnstretch="1,2">
<item row="0" column="0">
<widget class="QListView" name="lvTriggers"/>
</item>
<item row="0" column="1" rowspan="2">
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_27">
<item>
<widget class="QLabel" name="label_30">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Name</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="leTrigName"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_38">
<item>
<widget class="QLabel" name="label_33">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Count</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="sbTrigCount">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>999999999</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_45">
<item>
<widget class="QCheckBox" name="cbTrigRandRadius">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Random radius</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="sbTrigRandomRadius">
<property name="decimals">
<number>3</number>
</property>
<property name="maximum">
<double>999999999.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item>
<widget class="QCheckBox" name="cbTrigChance">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Chance</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="sbTrigChance">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="cbTrigDelPar">
<property name="text">
<string>Delete parent</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_40">
<item>
<widget class="QLabel" name="label_35">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Child aim</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cbTrigChildAim">
<property name="duplicatesEnabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_39">
<item>
<widget class="QLabel" name="label_34">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Type</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cbTrigType">
<property name="duplicatesEnabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_37">
<item>
<widget class="QLabel" name="lbTrigTimer">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Timer</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="sbTrigTimer">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>999999999</number>
</property>
<property name="singleStep">
<number>50</number>
</property>
<property name="value">
<number>50</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_43">
<item>
<widget class="QCheckBox" name="cbTrigDamage">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Damage</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="sbTrigDamage">
<property name="decimals">
<number>3</number>
</property>
<property name="maximum">
<double>999999999.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_44">
<item>
<widget class="QCheckBox" name="cbTrigDamRad">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Damage radius</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="sbTrigDamRadius">
<property name="decimals">
<number>3</number>
</property>
<property name="maximum">
<double>999999999.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_15" stretch="2,1">
<property name="spacing">
<number>20</number>
</property>
<item>
<widget class="QPushButton" name="pbTrigAdd">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbTrigDel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Delete</string> <string>Delete</string>
@@ -1147,261 +1433,20 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="trigers"> </widget>
<attribute name="title"> </item>
<string>Trigers</string> <item row="5" column="0">
</attribute> <widget class="QPushButton" name="pbSave">
<widget class="QFrame" name="frame_4"> <property name="text">
<property name="geometry"> <string>Save</string>
<rect> </property>
<x>0</x> </widget>
<y>-10</y> </item>
<width>561</width> <item row="4" column="0">
<height>411</height> <widget class="QPushButton" name="pbReload">
</rect> <property name="text">
</property> <string>Cancel</string>
<property name="frameShape"> </property>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_7" rowstretch="2,1">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListView" name="lvTrigers"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_15" stretch="2,1">
<property name="spacing">
<number>20</number>
</property>
<item>
<widget class="QPushButton" name="pbTwAdd_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbTwDel_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_18">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Name</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="leTrigName"/>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_19">
<item>
<widget class="QLabel" name="label_10">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>count</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="sbTrigCount">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>999999999</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_22">
<item>
<widget class="QCheckBox" name="cbTrigChance">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>chance</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="sbTrigChance">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximum">
<double>999999999.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Type</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_20">
<item>
<widget class="QCheckBox" name="cbAlArmor_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>timer</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="sbTrigTimer">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<double>999999999.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_23">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_24">
<item>
<widget class="QCheckBox" name="cbSplAutoControl_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>AlienInRadius</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="cbSplAutoControl_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>OnDestination</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>

35
ADeditor/triggermodel.cpp Normal file
View File

@@ -0,0 +1,35 @@
#include "triggermodel.h"
TriggerModel::TriggerModel(QList<tbTrigger> mtriggers, QObject *parent) :
QAbstractListModel(parent)
{
triggers = mtriggers;
}
void TriggerModel::refresh(QList<tbTrigger> mtriggers)
{
triggers = mtriggers;
}
int TriggerModel::rowCount(const QModelIndex &) const
{
return triggers.count();
}
QVariant TriggerModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if (index.row() >= triggers.size())
return QVariant();
if (role == Qt::DisplayRole)
{
return triggers.at(index.row()).name;
}
return QVariant();
}

22
ADeditor/triggermodel.h Normal file
View File

@@ -0,0 +1,22 @@
#ifndef TRIGGERMODEL_H
#define TRIGGERMODEL_H
#include <QAbstractListModel>
#include "../loader.h"
class TriggerModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit TriggerModel(QList <tbTrigger> triggers, QObject *parent = 0);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const;
void refresh(QList <tbTrigger> triggers);
signals:
public slots:
private:
QList <tbTrigger> triggers;
};
#endif // TRIGGERMODEL_H

View File

@@ -1,7 +0,0 @@
hello
this is the source code of wavetrace(base part of game)
to compilling this code you must have QT4 library and gcc compiller
to make this project you cad do:
$ qmake
$ make
or open the aliendefender.pro file in Qt-Creator and run aplication.

14
CMakeLists.txt Normal file
View File

@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 2.6)
project(Alien_Defender)
find_package(Qt4 REQUIRED)
include_directories(${QT_INCLUDES})
file(GLOB MOCS "./*.h")
file(GLOB CPPS "./*.cpp")
file(GLOB UIS "./*.ui")
file(GLOB RES "./*.qrc")
add_definitions(-Wall -O2 -g3 -ggdb)
qt4_wrap_ui(CUIS ${UIS})
qt4_wrap_cpp(CMOCS ${MOCS})
qt4_add_resources(CRES ${RES})
add_executable(AlienDefender ${CMOCS} ${CUIS} ${CPPS} ${CRES})
target_link_libraries(AlienDefender ${QT_QTGUI_LIBRARY} ${QT_LIBRARIES} ${QT_QTXML_LIBRARY} ${QT_QTXMLPATTERNS_LIBRARY})

394
Makefile
View File

@@ -1,394 +0,0 @@
#############################################################################
# Makefile for building: aliendefender
# Generated by qmake (2.01a) (Qt 4.6.2) on: ?? ???. 23 12:02:15 2010
# Project: aliendefender.pro
# Template: app
# Command: /usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile aliendefender.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtXmlPatterns -I/usr/include/qt4 -I/usr/X11R6/include -I.
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L/usr/lib -L/usr/X11R6/lib -lQtXmlPatterns -lQtXml -lQtOpenGL -lQtGui -lQtNetwork -lQtCore -lGLU -lGL -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake-qt4
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
STRIP = strip
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = ./
####### Files
SOURCES = map.cpp \
game_data.cpp \
aliens.cpp \
towers.cpp \
main.cpp \
splashes.cpp \
adcore.cpp \
player.cpp \
loader.cpp moc_map.cpp \
moc_game_data.cpp \
moc_aliens.cpp \
moc_towers.cpp \
moc_splashes.cpp \
moc_adcore.cpp \
moc_player.cpp \
moc_loader.cpp \
qrc_images.cpp
OBJECTS = map.o \
game_data.o \
aliens.o \
towers.o \
main.o \
splashes.o \
adcore.o \
player.o \
loader.o \
moc_map.o \
moc_game_data.o \
moc_aliens.o \
moc_towers.o \
moc_splashes.o \
moc_adcore.o \
moc_player.o \
moc_loader.o \
qrc_images.o
DIST = /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/debug.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/opengl.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf \
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
aliendefender.pro
QMAKE_TARGET = aliendefender
DESTDIR =
TARGET = aliendefender
first: all
####### Implicit rules
.SUFFIXES: .o .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
####### Build rules
all: Makefile $(TARGET)
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: aliendefender.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/debug.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/opengl.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf \
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
/usr/lib/libQtXmlPatterns.prl \
/usr/lib/libQtXml.prl \
/usr/lib/libQtOpenGL.prl \
/usr/lib/libQtGui.prl \
/usr/lib/libQtNetwork.prl \
/usr/lib/libQtCore.prl
$(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile aliendefender.pro
/usr/share/qt4/mkspecs/common/g++.conf:
/usr/share/qt4/mkspecs/common/unix.conf:
/usr/share/qt4/mkspecs/common/linux.conf:
/usr/share/qt4/mkspecs/qconfig.pri:
/usr/share/qt4/mkspecs/features/qt_functions.prf:
/usr/share/qt4/mkspecs/features/qt_config.prf:
/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
/usr/share/qt4/mkspecs/features/default_pre.prf:
/usr/share/qt4/mkspecs/features/debug.prf:
/usr/share/qt4/mkspecs/features/default_post.prf:
/usr/share/qt4/mkspecs/features/warn_on.prf:
/usr/share/qt4/mkspecs/features/qt.prf:
/usr/share/qt4/mkspecs/features/unix/opengl.prf:
/usr/share/qt4/mkspecs/features/unix/thread.prf:
/usr/share/qt4/mkspecs/features/moc.prf:
/usr/share/qt4/mkspecs/features/resources.prf:
/usr/share/qt4/mkspecs/features/uic.prf:
/usr/share/qt4/mkspecs/features/yacc.prf:
/usr/share/qt4/mkspecs/features/lex.prf:
/usr/share/qt4/mkspecs/features/include_source_dir.prf:
/usr/lib/libQtXmlPatterns.prl:
/usr/lib/libQtXml.prl:
/usr/lib/libQtOpenGL.prl:
/usr/lib/libQtGui.prl:
/usr/lib/libQtNetwork.prl:
/usr/lib/libQtCore.prl:
qmake: FORCE
@$(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile aliendefender.pro
dist:
@$(CHK_DIR_EXISTS) .tmp/aliendefender1.0.0 || $(MKDIR) .tmp/aliendefender1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/aliendefender1.0.0/ && $(COPY_FILE) --parents base_types.h map.h game_data.h aliens.h towers.h splashes.h adcore.h player.h loader.h .tmp/aliendefender1.0.0/ && $(COPY_FILE) --parents images.qrc .tmp/aliendefender1.0.0/ && $(COPY_FILE) --parents map.cpp game_data.cpp aliens.cpp towers.cpp main.cpp splashes.cpp adcore.cpp player.cpp loader.cpp .tmp/aliendefender1.0.0/ && (cd `dirname .tmp/aliendefender1.0.0` && $(TAR) aliendefender1.0.0.tar aliendefender1.0.0 && $(COMPRESS) aliendefender1.0.0.tar) && $(MOVE) `dirname .tmp/aliendefender1.0.0`/aliendefender1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/aliendefender1.0.0
clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
####### Sub-libraries
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) Makefile
mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
compiler_moc_header_make_all: moc_map.cpp moc_game_data.cpp moc_aliens.cpp moc_towers.cpp moc_splashes.cpp moc_adcore.cpp moc_player.cpp moc_loader.cpp
compiler_moc_header_clean:
-$(DEL_FILE) moc_map.cpp moc_game_data.cpp moc_aliens.cpp moc_towers.cpp moc_splashes.cpp moc_adcore.cpp moc_player.cpp moc_loader.cpp
moc_map.cpp: base_types.h \
map.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) map.h -o moc_map.cpp
moc_game_data.cpp: player.h \
base_types.h \
game_data.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) game_data.h -o moc_game_data.cpp
moc_aliens.cpp: game_data.h \
player.h \
base_types.h \
aliens.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) aliens.h -o moc_aliens.cpp
moc_towers.cpp: game_data.h \
player.h \
base_types.h \
towers.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) towers.h -o moc_towers.cpp
moc_splashes.cpp: game_data.h \
player.h \
base_types.h \
splashes.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) splashes.h -o moc_splashes.cpp
moc_adcore.cpp: aliens.h \
game_data.h \
player.h \
base_types.h \
towers.h \
splashes.h \
loader.h \
adcore.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) adcore.h -o moc_adcore.cpp
moc_player.cpp: base_types.h \
player.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) player.h -o moc_player.cpp
moc_loader.cpp: game_data.h \
player.h \
base_types.h \
loader.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) loader.h -o moc_loader.cpp
compiler_rcc_make_all: qrc_images.cpp
compiler_rcc_clean:
-$(DEL_FILE) qrc_images.cpp
qrc_images.cpp: images.qrc \
images/Aliens/Al_00_12.png \
images/Aliens/Al_00_6.png \
images/Aliens/Al_00_2.png \
images/Aliens/Al_00_17.png \
images/Aliens/Al_00_13.png \
images/Aliens/Al_00_7.png \
images/Aliens/Al_00_3.png \
images/Aliens/Al_00_18.png \
images/Aliens/Al_00_10.png \
images/Aliens/Al_00_14.png \
images/Aliens/Al_00_8.png \
images/Aliens/Al_00_4.png \
images/Aliens/Al_00_0.png \
images/Aliens/Al_00_19.png \
images/Aliens/Al_00_11.png \
images/Aliens/Al_00_15.png \
images/Aliens/Al_00_9.png \
images/Aliens/Al_00_5.png \
images/Aliens/Al_00_1.png \
images/Aliens/Al_00_16.png
/usr/bin/rcc -name images images.qrc -o qrc_images.cpp
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all:
compiler_uic_clean:
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: compiler_moc_header_clean compiler_rcc_clean
####### Compile
map.o: map.cpp map.h \
base_types.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o map.o map.cpp
game_data.o: game_data.cpp game_data.h \
player.h \
base_types.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o game_data.o game_data.cpp
aliens.o: aliens.cpp aliens.h \
game_data.h \
player.h \
base_types.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o aliens.o aliens.cpp
towers.o: towers.cpp towers.h \
game_data.h \
player.h \
base_types.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o towers.o towers.cpp
main.o: main.cpp adcore.h \
aliens.h \
game_data.h \
player.h \
base_types.h \
towers.h \
splashes.h \
loader.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
splashes.o: splashes.cpp splashes.h \
game_data.h \
player.h \
base_types.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o splashes.o splashes.cpp
adcore.o: adcore.cpp adcore.h \
aliens.h \
game_data.h \
player.h \
base_types.h \
towers.h \
splashes.h \
loader.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o adcore.o adcore.cpp
player.o: player.cpp player.h \
base_types.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o player.o player.cpp
loader.o: loader.cpp loader.h \
game_data.h \
player.h \
base_types.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o loader.o loader.cpp
moc_map.o: moc_map.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_map.o moc_map.cpp
moc_game_data.o: moc_game_data.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_game_data.o moc_game_data.cpp
moc_aliens.o: moc_aliens.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_aliens.o moc_aliens.cpp
moc_towers.o: moc_towers.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_towers.o moc_towers.cpp
moc_splashes.o: moc_splashes.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_splashes.o moc_splashes.cpp
moc_adcore.o: moc_adcore.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_adcore.o moc_adcore.cpp
moc_player.o: moc_player.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_player.o moc_player.cpp
moc_loader.o: moc_loader.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_loader.o moc_loader.cpp
qrc_images.o: qrc_images.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o qrc_images.o qrc_images.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:

106
ad_graphics.cpp Normal file
View File

@@ -0,0 +1,106 @@
#include "ad_graphics.h"
AD_Graphics::AD_Graphics(AD_Core *adcore, QWidget *parent) : QGraphicsView(parent)
{
loadImages();
data = adcore->addata;
core = adcore;
//scale(cellSize, cellSize);
setAlignment(Qt::AlignLeft | Qt::AlignTop);
scene = new QGraphicsScene();
setScene(scene);
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
//gsw = new QGraphicsWidget();
//scene->addWidget(new QPushButton());
startTimer(25);
show();
}
AD_Graphics::~AD_Graphics()
{
//delete gsw;
delete scene;
}
void AD_Graphics::mouseDoubleClickEvent(QMouseEvent *)
{
core->nextWave();
}
void AD_Graphics::timerEvent(QTimerEvent * )
{
//qDebug() << data->curAliens.size();
draw();
}
void AD_Graphics::drawBackground(QPainter * p, const QRectF & )
{
for (int i=0; i<data->map->cells().size(); i++) {
for (int j=0; j<data->map->cells().at(i).size(); j++) {
QPen pen;
QBrush brush;
pen.setColor(Qt::white);
brush.setColor(Qt::white);
brush.setStyle(Qt::SolidPattern);
int cel = data->map->cells().at(i).at(j);
if (cel == Map::Wall) {
pen.setColor(Qt::black);
brush.setColor(Qt::black);
}
if (cel <= Map::PlayerTower && cel !=Map::Wall) {
pen.setColor(QColor(cel%255,(cel*100)%255,(cel+100)%255));
brush.setColor(QColor(cel%255,(cel*100)%255,(cel+100)%255));
}
// if (cel >= Map::PlayerAlien) {
// pen.setColor(Qt::yellow);
// brush.setColor(Qt::yellow);
// }
if (cel >= Map::Player) {
pen.setColor(QColor(cel%255,(cel*100)%255,(cel+100)%255,50));
brush.setColor(QColor(cel%255,(cel*100)%255,(cel+100)%255,50));
}
p->setPen(pen);
p->setBrush(brush);
p->drawRect(i*cellSize,j*cellSize,cellSize,cellSize);
}
}
for (QHash<int, AlienType>::iterator i = data->curAliens.begin(); i != data->curAliens.end(); ++i) {
//qDebug() << "draw alien";
//p->rotate(-90);
//p->scale(cellSize, cellSize);
//p->translate(rec.width()/2, rec.height()/2);
//p->rotate(-90);
//p->translate(-rec.height()/2, -rec.width()/2);
p->translate((*i).pos * cellSize+QPointF(10,10));
p->rotate((*i).angle);
p->drawImage(QRect(-20,-20,40,40), images[itAliens][0]->at(0));
p->resetTransform();
}
}
void AD_Graphics::draw()
{
scene->update();
//resetCachedContent();
//repaint();
}
void AD_Graphics::loadImages()
{
images.resize(3);
for (int i = 0; i < images.size(); i++) {
switch ((imagesType)i) {
case itAliens:
images[i].push_back(new Animation(":/images/images/Aliens/Al_00_"));
break;
default: break;
}
}
}

38
ad_graphics.h Normal file
View File

@@ -0,0 +1,38 @@
#ifndef AD_GRAPHICS_H
#define AD_GRAPHICS_H
#include <QGraphicsView>
#include <QGraphicsWidget>
#include <QPushButton>
#include <QMouseEvent>
#include "adcore.h"
#include "animation.h"
const float cellSize = 20.f;
class AD_Graphics: public QGraphicsView
{
Q_OBJECT
public:
explicit AD_Graphics(AD_Core * core, QWidget * parent = 0);
~AD_Graphics();
private:
enum imagesType {itAliens, itTowers, itSplashes};
void draw();
void drawBackground(QPainter * p, const QRectF &);
void loadImages();
void mouseDoubleClickEvent(QMouseEvent *);
QGraphicsScene * scene;
Game_Data * data;
AD_Core * core;
QVector<QVector<Animation * > > images;
//QGraphicsWidget * gsw;
protected:
void timerEvent(QTimerEvent * );
};
#endif // AD_GRAPHICS_H

View File

@@ -1,40 +1,82 @@
#include "adcore.h" #include "adcore.h"
adCore::adCore(QObject *parent) : AD_Core::AD_Core(QObject *parent) :
QThread(parent) QThread(parent)
{ {
step = 0; step = 0;
//admap = new Map(1); //admap = new Map(1);
//addata = new Game_Data(admap); //addata = new Game_Data(admap);
adloader = new Loader(); adloader = new Loader();
adloader->load("data2.xml");
//adloader->save("data2.xml");
addata = adloader->loadlevel(1); addata = adloader->loadlevel(1);
if (addata != 0) qDebug("Sucsess"); if (addata != 0) qDebug("Sucsess");
else qDebug("Error"); else qFatal("Error");
//admap->load(); Player * pl1 = new Player(0);
//adload->create();
//adload->readAliens();
// Player * pl1 = new Player(0);
// Player * pl2 = new Player(0); // Player * pl2 = new Player(0);
// addata->players.push_back(pl1); addata->players.push_back(pl1);
// addata->players.push_back(pl2); // addata->players.push_back(pl2);
// adaliens = new Aliens(addata); adaliens = new Aliens(addata);
// adtowers = new Towers(addata); adtowers = new Towers(addata);
// adsplashes = new Splashes(addata); adsplashes = new Splashes(addata);
// connect(admap,SIGNAL(RecreateAlienPath(bool*)),adaliens,SLOT(retrace(bool*))); connect(addata->map,SIGNAL(recreateAlienPath(bool*)),adaliens,SLOT(retrace(bool*)));
// adaliens->AddAlien(0); // adaliens->addAlien(0);
// adaliens->AddAlien(0); // adaliens->AddAlien(0);
// adaliens->AddAlien(0); // adaliens->AddAlien(0);
// for (int i=0; i<qMin(admap->mapsize.width(),admap->mapsize.height()); i++) // for (int i=0; i<qMin(admap->mapsize.width(),admap->mapsize.height()); i++)
// adtowers->AddTower(0,0,QPoint(i,i)); // adtowers->AddTower(0,0,QPoint(i,i));
// for (int i=0; i<admap->mapsize.height();i++) // for (int i=0; i<admap->mapsize.height();i++)
// adtowers->AddTower(1,0,QPoint(admap->mapsize.width()-2,i)); // adtowers->AddTower(1,0,QPoint(admap->mapsize.width()-2,i));
waveInProgress = false;
startTimer(50);
} }
void adCore::next() void AD_Core::next()
{ {
adtowers->update(); adtowers->update();
adsplashes->update(); adsplashes->update();
adaliens->update(); adaliens->update();
waveProcessing();
step++; step++;
} }
void AD_Core::timerEvent(QTimerEvent * )
{
next();
}
void AD_Core::nextWave()
{
if (waveInProgress) return;
if (addata->curWave >= addata->waves.size()) {
qDebug("level finished");
return;
}
//wavetime = addata->waves.at(addata->curWave).timeout;
qDebug() << tr("Next wave %1").arg(addata->curWave+1);
wavetime = 0;
waveInProgress = true;
}
void AD_Core::waveProcessing()
{
if (!waveInProgress) return;
if (wavetime <= 0) {
for (int i=0; i<addata->waves.at(addata->curWave).counts.size(); i++) {
if (addata->waves.at(addata->curWave).counts.at(i) > 0) {
adaliens->addAlien(addata->waves.at(addata->curWave).types.at(i));
addata->waves[addata->curWave].counts[i]--;
wavetime = addata->waves.at(addata->curWave).timeout;
return;
}
}
addata->curWave++;
waveInProgress = false;
} else {
wavetime--;
}
}

View File

@@ -8,22 +8,30 @@
#include "splashes.h" #include "splashes.h"
#include "loader.h" #include "loader.h"
class adCore : public QThread class AD_Core : public QThread
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit adCore(QObject *parent = 0); explicit AD_Core(QObject *parent = 0);
Game_Data * addata; Game_Data * addata;
Aliens * adaliens; Aliens * adaliens;
Towers * adtowers; Towers * adtowers;
Splashes * adsplashes; Splashes * adsplashes;
Loader * adloader; Loader * adloader;
unsigned int step; unsigned int step;
signals:
private:
void timerEvent(QTimerEvent * );
void waveProcessing();
bool waveInProgress;
int wavetime;
public slots: public slots:
void next(); void next();
private: void nextWave();
void addTower(QPoint pos) {adtowers->addTower(0, 0, pos);};
signals:
}; };
#endif // ADCORE_H #endif // ADCORE_H

BIN
adgraphics.odp Normal file

Binary file not shown.

Binary file not shown.

3
aliendefender.kdev4 Normal file
View File

@@ -0,0 +1,3 @@
[Project]
Manager=KDevCMakeManager
Name=aliendefender

View File

@@ -6,7 +6,9 @@ HEADERS += base_types.h \
splashes.h \ splashes.h \
adcore.h \ adcore.h \
player.h \ player.h \
loader.h loader.h \
animation.h \
ad_graphics.h
SOURCES += map.cpp \ SOURCES += map.cpp \
game_data.cpp \ game_data.cpp \
aliens.cpp \ aliens.cpp \
@@ -15,14 +17,14 @@ SOURCES += map.cpp \
splashes.cpp \ splashes.cpp \
adcore.cpp \ adcore.cpp \
player.cpp \ player.cpp \
loader.cpp loader.cpp \
animation.cpp \
ad_graphics.cpp
RESOURCES += images.qrc RESOURCES += images.qrc
OTHER_FILES += map.conf \ OTHER_FILES += \
example16x16.map \
example16x12.map \
data.xml \ data.xml \
schema.xml \ schema.xml \
example16x16_64.map data2.xml
QT += core \ QT += core \
gui \ gui \
network \ network \

View File

@@ -46,8 +46,8 @@
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Отладка</value> <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Отладка</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value> <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value> <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">C:/Users/Andrey/Desktop/aliendefender-build-desktop</value> <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">C:/Users/Andrey/Desktop/build-AD</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">5</value> <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">9</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">2</value> <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value> <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
</valuemap> </valuemap>
@@ -81,7 +81,7 @@
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value> <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value> <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">C:/Users/Andrey/Desktop/aliendefender-build-desktop</value> <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">C:/Users/Andrey/Desktop/aliendefender-build-desktop</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">5</value> <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">9</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">2</value> <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value> <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
</valuemap> </valuemap>
@@ -96,8 +96,8 @@
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value> <value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
<valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/> <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetName" type="bool">false</value> <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetName" type="bool">false</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">false</value> <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">true</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value> <value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString">C:\Users\Andrey\Desktop\aliendefender</value>
</valuemap> </valuemap>
<value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value> <value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
</valuemap> </valuemap>

View File

@@ -0,0 +1,113 @@
<!DOCTYPE QtCreatorProject>
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value key="EditorConfiguration.Codec" type="QByteArray">System</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Настольный компьютер</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value>
<value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value>
<value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
<valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
</valuemap>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
<valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
<valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
<valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
<value type="QString">clean</value>
</valuelist>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Отладка</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">C:/Users/Andrey/Desktop/aliendefender-build-desktop</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">9</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
</valuemap>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
<valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
</valuemap>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
<valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
<valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
<valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
<value type="QString">clean</value>
</valuelist>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Релиз</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">C:/Users/Andrey/Desktop/aliendefender-build-desktop</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">9</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
</valuemap>
<value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
<valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">aliendefender</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
<valuelist key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QVariantList"/>
<value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">aliendefender.pro</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
<valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetName" type="bool">false</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">true</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString">C:\Users\Andrey\Desktop\aliendefender</value>
</valuemap>
<value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">4</value>
</data>
</qtcreator>

View File

@@ -9,7 +9,7 @@ Aliens::Aliens(Game_Data *gd, QObject *parent) :
} }
void Aliens::AddAlien(int srcId) void Aliens::addAlien(int srcId)
{ {
if (srcId < 0 || srcId >= gameData->srcAliens.size()) if (srcId < 0 || srcId >= gameData->srcAliens.size())
{ {
@@ -19,12 +19,13 @@ void Aliens::AddAlien(int srcId)
AlienType al;// = gameData->srcAliens.at(srcId); AlienType al;// = gameData->srcAliens.at(srcId);
al.Id = nextId; al.Id = nextId;
al.src = srcId; al.src = srcId;
al.finish = gameData->map->Finishs().at(qrand()%gameData->map->Finishs().size()); al.finish = gameData->map->finishs().at(qrand()%gameData->map->finishs().size());
al.pos = QPointF(gameData->map->Starts().at(qrand()%gameData->map->Starts().size())); al.pos = QPointF(gameData->map->starts().at(qrand()%gameData->map->starts().size()));
al.path = gameData->map->CreatePath(al.pos.toPoint(),al.finish); al.path = gameData->map->createPath(al.pos.toPoint(),al.finish);
al.pathIndex = 1; al.pathIndex = 1;
al.animIndex = 0.f;
if (al.path.isEmpty()) qFatal("ERROR create path"); if (al.path.isEmpty()) qFatal("ERROR create path");
qDebug() << al.path; //qDebug() << al.path;
al.health = gameData->srcAliens.at(srcId).health; al.health = gameData->srcAliens.at(srcId).health;
al.speed = gameData->srcAliens.at(srcId).speed; al.speed = gameData->srcAliens.at(srcId).speed;
al.imgType = gameData->srcAliens.at(srcId).imgType; al.imgType = gameData->srcAliens.at(srcId).imgType;
@@ -40,14 +41,14 @@ void Aliens::retrace(bool * OK)
gameData->map->removeAliensPath(); gameData->map->removeAliensPath();
for (int i=0; i<gameData->curAliens.size(); i++) for (int i=0; i<gameData->curAliens.size(); i++)
{ {
gameData->curAliens.values()[i].path = gameData->map->CreatePath(gameData->curAliens.values()[i].pos.toPoint(),gameData->curAliens.values()[i].finish); gameData->curAliens.values()[i].path = gameData->map->createPath(gameData->curAliens.values()[i].pos.toPoint(),gameData->curAliens.values()[i].finish);
gameData->curAliens.values()[i].pathIndex = 1; gameData->curAliens.values()[i].pathIndex = 1;
if (gameData->curAliens.values()[i].path.isEmpty()) *OK = false; if (gameData->curAliens.values()[i].path.isEmpty()) *OK = false;
} }
} }
void Aliens::DelAlien(int Id) void Aliens::delAlien(int Id)
{ {
gameData->curAliens.remove(Id); gameData->curAliens.remove(Id);
} }
@@ -69,7 +70,7 @@ void Aliens::update()
al.pathIndex++; al.pathIndex++;
if (al.pathIndex >= al.path.size()) if (al.pathIndex >= al.path.size())
{ {
qDebug("Missing alien!"); qDebug() << tr("Missing aliens = %1!").arg(gameData->missingAliens);
missIndex.push_back(al.Id); missIndex.push_back(al.Id);
break; break;
} }
@@ -102,11 +103,11 @@ void Aliens::update()
-al.speed*std::cos(arctg)); -al.speed*std::cos(arctg));
//return true; //return true;
gameData->curAliens.insert(al.Id,al); gameData->curAliens.insert(al.Id,al);
qDebug() <<"alien"<< i << " path index" << al.pathIndex << " pos" << al.pos; //qDebug() <<"alien"<< i << " path index=" << al.pathIndex << ", pos=" << al.pos;
} }
for (int j=0; j<missIndex.size(); j++) for (int j=0; j<missIndex.size(); j++)
{ {
gameData->missingAliens++; gameData->missingAliens++;
DelAlien(missIndex.at(j)); delAlien(missIndex.at(j));
} }
} }

View File

@@ -9,13 +9,12 @@ class Aliens : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit Aliens(Game_Data * gd, QObject *parent = 0); explicit Aliens(Game_Data * gd, QObject *parent = 0);
void AddAlien(int srcId); void addAlien(int srcId);
void nextWave();
void update(); void update();
signals: signals:
public slots: public slots:
void DelAlien(int Id); void delAlien(int Id);
void retrace(bool * OK); void retrace(bool * OK);
private: private:
Game_Data * gameData; Game_Data * gameData;

23
animation.cpp Normal file
View File

@@ -0,0 +1,23 @@
#include "animation.h"
#include <QFile>
#include <QDebug>
Animation::Animation(const QString & path)
{
int i = 0;
QString s = path + QString::number(i) + ".png";
//qDebug() << "check " << s;
while (QFile::exists(s)) {
images.push_back(new QImage(s));
s = path + QString::number(++i) + ".png";
}
qDebug() << "found " << images.size() << " images";
}
Animation::~Animation()
{
}

19
animation.h Normal file
View File

@@ -0,0 +1,19 @@
#ifndef ANIMATION_H
#define ANIMATION_H
#include <QString>
#include <QImage>
class Animation
{
public:
explicit Animation(const QString & path);
~Animation();
QImage & at(int index) const {return *(images[index]);};
private:
QVector<QImage * > images;
};
#endif // ANIMATION_H

View File

@@ -14,20 +14,6 @@
#include <QRect> #include <QRect>
#include <QRectF> #include <QRectF>
struct AlienType
{
int Id; // uses for QHash
int src;
QPointF pos;
float angle; // -180 .. 180
float speed; // cells per tick (speed=1 is 60cells by 1 sec for 60fps e.g.)
float health;
QPoint finish;
QVector <QPointF> path;
int pathIndex;
int imgType;
};
struct srcAlienType struct srcAlienType
{ {
@@ -43,24 +29,19 @@ struct srcAlienType
}; };
struct TowerType struct AlienType
{ {
int Id; // uses for QHash
int src; int src;
int aim; // aim alien Id QPointF pos;
int oldAim;
int PlayerId; // tower's owner
int imgType;
QPoint pos; // not QPointF because tower fixed on grid
float angle; // -180 .. 180 float angle; // -180 .. 180
unsigned int reload; // time for reload in ticks float speed; // cells per tick (speed=1 is 60cells by 1 sec for 60fps e.g.)
unsigned int build; float health;
}; QPoint finish;
QVector <QPointF> path;
int pathIndex;
struct TriggerType int imgType;
{ float animIndex;
int src;
unsigned int timer;
}; };
@@ -72,7 +53,15 @@ struct srcTriggerType
onTimer, onTimer,
onAlienInRadius onAlienInRadius
}; };
int childId; // =-1 for non birth splash (e.q. only damage)
enum aimType
{
noAim,
parentAim,
allSide,
nearlestAlien
};
int childId; // =-1 for none birth splash (e.q. only damage)
bool delParent; bool delParent;
float damage; float damage;
float radius; float radius;
@@ -83,6 +72,13 @@ struct srcTriggerType
}; };
struct TriggerType
{
int src;
unsigned int timer;
};
struct srcSplashType struct srcSplashType
{ {
QString name; QString name;
@@ -94,6 +90,21 @@ struct srcSplashType
}; };
struct SplashType
{
int Id;
int imgType;
int src;
QPoint TowerId; // parent tower (-1;-1) for null parent
int AlienId; // aim alien (different from tower.AlienId)
QPointF destination;
int life; // in ticks
float angle; // -180 .. 180
QPointF pos;
QList <TriggerType> triggers;
};
struct srcTowerType struct srcTowerType
{ {
QString name; QString name;
@@ -111,18 +122,17 @@ struct srcTowerType
}; };
struct SplashType struct TowerType
{ {
int Id;
int imgType;
int src; int src;
QPoint TowerId; // parent tower (-1;-1) for null parent int aim; // aim alien Id
int AlienId; // aim alien (different from tower.AlienId) int oldAim;
QPointF destination; int PlayerId; // tower's owner
int life; // in ticks int imgType;
QPoint pos; // not QPointF because tower fixed on grid
float angle; // -180 .. 180 float angle; // -180 .. 180
QPointF pos; unsigned int reload; // time for reload in ticks
QList <TriggerType> triggers; unsigned int build;
}; };

92
data2.xml Normal file
View File

@@ -0,0 +1,92 @@
<!DOCTYPE data>
<ADdata>
<aliens>
<alien flying="true" speed="0.3" imageType="31" prise="15" id="2" score="12" name="Monstr" health="150"/>
<alien flying="true" speed="0.15" imageType="-1078580008" prise="1" id="4" score="10" name="test" health="60"/>
<alien speed="0.21" imageType="1" prise="4" id="10" score="99" name="first" health="100"/>
<alien regeneration="3" speed="0.5" imageType="1" prise="10" armor="1.5" id="12" score="99" name="MONSTR" health="100"/>
</aliens>
<maps>
<map width="16" imageType="1" height="16" id="1" data="AAAERHicY2BgEGAA4v///0hQgmFmAGlGcjCxZuCTHzUDuxkMDOr85JrBwKC0A8kMJlwYagYOeYgZ+NXgNwMtPEbNINIMIsynOO8DAG0r1Q0=" name="My Map" maxPlayers="2"/>
</maps>
<waves>
<wave prise="100" timeout="5" id="1"/>
<wave prise="200" timeout="5" id="2"/>
<wave prise="220" timeout="5" id="3"/>
<wave prise="220" timeout="2" id="4"/>
<wave prise="220" timeout="1" id="5"/>
<wave prise="220" timeout="10" id="6"/>
<wave prise="220" timeout="1" id="7"/>
<wave prise="220" timeout="1" id="8"/>
<wave prise="220" timeout="1" id="9"/>
<wave prise="220" timeout="1" id="10"/>
<wave prise="220" timeout="5" id="11"/>
</waves>
<levels>
<level map="1" id="1" score="265630088" name="First Level"/>
</levels>
<waveParts>
<wavePart alien="10" count="4" wave="1"/>
<wavePart alien="12" count="6" wave="1"/>
<wavePart alien="10" count="5" wave="1"/>
<wavePart alien="10" count="9" wave="2"/>
<wavePart alien="12" count="4" wave="3"/>
<wavePart alien="12" count="3" wave="3"/>
<wavePart alien="10" count="2" wave="3"/>
<wavePart alien="10" count="1" wave="3"/>
<wavePart alien="2" count="20" wave="4"/>
<wavePart alien="4" count="6" wave="5"/>
<wavePart alien="10" count="1" wave="6"/>
<wavePart alien="4" count="1" wave="6"/>
<wavePart alien="10" count="1" wave="6"/>
<wavePart alien="4" count="1" wave="6"/>
<wavePart alien="10" count="1" wave="6"/>
<wavePart alien="4" count="1" wave="6"/>
<wavePart alien="10" count="1" wave="6"/>
<wavePart alien="4" count="1" wave="6"/>
<wavePart alien="10" count="1" wave="6"/>
<wavePart alien="4" count="1" wave="6"/>
<wavePart alien="12" count="1" wave="6"/>
<wavePart alien="10" count="1" wave="6"/>
<wavePart alien="4" count="1" wave="6"/>
<wavePart alien="10" count="1" wave="6"/>
<wavePart alien="4" count="1" wave="6"/>
</waveParts>
<wavesOnLevels>
<waveOnLevel wave="6" level="1"/>
<waveOnLevel wave="5" level="1"/>
<waveOnLevel wave="4" level="1"/>
<waveOnLevel wave="3" level="1"/>
<waveOnLevel wave="2" level="1"/>
<waveOnLevel wave="1" level="1"/>
</wavesOnLevels>
<splashes>
<splash speed="0.2" imageType="1" lifetime="9999" id="1" name="rocket"/>
<splash speed="0.2" imageType="1" lifetime="9999" autoControl="true" id="2" name="smart rocket"/>
<splash speed="100" imageType="2" lifetime="100" autoControl="true" id="3" name="bullet"/>
<splash speed="1" imageType="3" lifetime="10" id="4" name="bum"/>
<splash speed="0" imageType="4" lifetime="10" id="5" name="smoke"/>
</splashes>
<towers>
<tower imageType="1" radius="3" expByKill="0.1" expByShot="0.15" buildTime="50" splash="1" reload="20" id="1" name="rocket launcher" cost="30" expByDamage="0.04"/>
<tower imageType="2" radius="1.5" expByKill="0.2" expByShot="0.1" buildTime="25" splash="3" reload="5" id="2" name="gun" cost="10" expByDamage="0.1"/>
<tower imageType="1" radius="3" expByKill="0.1" expByShot="0.15" buildTime="50" splash="2" reload="20" id="3" name="rocket launcher 2" cost="30" expByDamage="0.04"/>
</towers>
<triggers>
<trigger damage="5" childAim="noAim" delParent="true" type="onDestination" id="2" name="shot"/>
<trigger damage="5" childAim="noAim" radius="1.5" delParent="true" count="1" type="onDestination" id="3" name="explosion"/>
<trigger childAim="noAim" count="1" type="onTimer" id="4" name="smoke"/>
</triggers>
<chains>
<chain tower="1" trigger="4" child="5" parent="1"/>
<chain tower="1" trigger="3" child="4" parent="1"/>
<chain tower="2" trigger="2" parent="3"/>
<chain tower="3" trigger="4" child="5" parent="2"/>
<chain tower="3" trigger="3" child="4" parent="2"/>
</chains>
<towersOnLevels>
<towerOnLevel tower="3" level="1"/>
<towerOnLevel tower="2" level="1"/>
<towerOnLevel tower="1" level="1"/>
</towersOnLevels>
</ADdata>

Binary file not shown.

Binary file not shown.

View File

@@ -1 +0,0 @@
AAAERHicY2BgEGAA4v///0hQgmFmAGlGcjCxZuCTHzUDuxkMDOr85JrBwKC0A8kMJlwYagYOeYgZ+NXgNwMtPEbNINIMIsynOO8DAG0r1Q0=

View File

@@ -1,5 +1,5 @@
<RCC> <RCC>
<qresource prefix="/aliens"> <qresource prefix="/images">
<file>images/Aliens/Al_00_0.png</file> <file>images/Aliens/Al_00_0.png</file>
<file>images/Aliens/Al_00_1.png</file> <file>images/Aliens/Al_00_1.png</file>
<file>images/Aliens/Al_00_2.png</file> <file>images/Aliens/Al_00_2.png</file>

View File

@@ -188,13 +188,13 @@ void Loader::save(QString filename)
elem.setAttribute("randomPosRadius",trig.randomPosRadius); elem.setAttribute("randomPosRadius",trig.randomPosRadius);
switch (trig.childAim) switch (trig.childAim)
{ {
case tbTrigger::allSide : case srcTriggerType::allSide :
elem.setAttribute("childAim","allSide"); elem.setAttribute("childAim","allSide");
break; break;
case tbTrigger::nearlestAlien : case srcTriggerType::nearlestAlien :
elem.setAttribute("childAim","nearlestAlien"); elem.setAttribute("childAim","nearlestAlien");
break; break;
case tbTrigger::parentAim : case srcTriggerType::parentAim :
elem.setAttribute("childAim","parentAim"); elem.setAttribute("childAim","parentAim");
break; break;
default: default:
@@ -203,15 +203,15 @@ void Loader::save(QString filename)
} }
switch (trig.type) switch (trig.type)
{ {
case tbTrigger::onTimer : case srcTriggerType::onTimer :
elem.setAttribute("type","onTimer"); elem.setAttribute("type","onTimer");
break; break;
case tbTrigger::onDestination : case srcTriggerType::onDestination :
elem.setAttribute("type","onDestination"); elem.setAttribute("type","onDestination");
break; break;
case tbTrigger::onAlienInRadius : case srcTriggerType::onAlienInRadius :
elem.setAttribute("type","onAlienInRadius"); elem.setAttribute("type","onAlienInRadius");
break; break;
} }
} }
child = data.createElement("chains"); child = data.createElement("chains");
@@ -243,85 +243,152 @@ void Loader::save(QString filename)
} }
//Game_Data * Loader::loadlevel(int id) Game_Data * Loader::loadlevel(int id)
//{ {
// if (!levels.contains(id)) if (!levels.contains(id))
// { {
// qCritical() << tr("Error Level %1 not found!").arg(id); qCritical() << tr("Error Level %1 not found!").arg(id);
// return 0; return 0;
// } }
// qDebug() << tr("Loading level %1 ...").arg(levels.value(id).name); qDebug() << tr("Loading level %1 ...").arg(levels.value(id).name);
// tbMap tbm = maps.value(levels.value(id).mapId); tbMap tbm = maps.value(levels.value(id).mapId);
// Map * map = new Map(tbm.data,tbm.size,tbm.name,tbm.maxPlayers,tbm.imgType); Map * map = new Map(tbm.data,tbm.size,tbm.name,tbm.maxPlayers,tbm.imgType);
// Game_Data * gd = new Game_Data(map); Game_Data * gd = new Game_Data(map);
// QList <tbWaveOnLevel> wollist = levWaves.values(id); QList <tbWaveOnLevel> wollist = levWaves.values(id);
// if (wollist.isEmpty()) if (wollist.isEmpty())
// { {
// qCritical() << tr("Error no waves on level!"); qCritical() << tr("Error no waves on level!");
// return 0; return 0;
// } }
// tbWave tbw; tbWave tbw;
// tbWavePart tbwpt; tbWavePart tbwpt;
// QList <tbWavePart> wplist; QList <tbWavePart> wplist;
// QList <int> alienIds; QList <int> alienIds;
// for (int i=0; i<wollist.size(); i++) for (int i=0; i<wollist.size(); i++)
// { {
// WaveType wt; WaveType wt;
// tbw = waves.value(wollist.at(i).waveId); tbw = waves.value(wollist.at(i).waveId);
// wt.prise = tbw.prise; wt.prise = tbw.prise;
// wt.timeout = tbw.timeout; wt.timeout = tbw.timeout;
// wplist = waveParts.values(tbw.id); wplist = waveParts.values(tbw.id);
// if (wplist.isEmpty()) if (wplist.isEmpty())
// { {
// qCritical() << tr("Error wave %1 is empty!").arg(tbw.id); qCritical() << tr("Error wave %1 is empty!").arg(tbw.id);
// return 0; return 0;
// } }
// for (int j=0; j<wplist.size(); j++) for (int j=0; j<wplist.size(); j++)
// { {
// tbwpt = wplist.at(j); tbwpt = wplist.at(j);
// if (alienIds.contains(tbwpt.alienId)) if (alienIds.contains(tbwpt.alienId))
// { {
// wt.types.prepend(alienIds.indexOf(tbwpt.alienId)); wt.types.prepend(alienIds.indexOf(tbwpt.alienId));
// } else { } else {
// alienIds.append(tbwpt.alienId); alienIds.append(tbwpt.alienId);
// wt.types.prepend(alienIds.size()-1); wt.types.prepend(alienIds.size()-1);
// } }
// wt.counts.prepend(tbwpt.count); wt.counts.prepend(tbwpt.count);
// } }
// gd->waves.prepend(wt); gd->waves.prepend(wt);
// wplist.clear(); wplist.clear();
// } }
// for (int i=0; i<gd->waves.size(); i++) for (int i=0; i<gd->waves.size(); i++)
// qDebug() << tr("load wave #%1 prise=%2 timeout=%3").arg(i+1).arg(gd->waves.at(i).prise).arg(gd->waves.at(i).timeout) << gd->waves.at(i).types << gd->waves.at(i).counts; qDebug() << tr("load wave #%1 prise=%2 timeout=%3").arg(i+1).arg(gd->waves.at(i).prise).arg(gd->waves.at(i).timeout) << gd->waves.at(i).types << gd->waves.at(i).counts;
// wollist.clear(); wollist.clear();
// for (int i=0; i<alienIds.size(); i++) for (int i=0; i<alienIds.size(); i++)
// { {
// srcAlienType salt; srcAlienType salt;
// tbAlien tbal = aliens.value(alienIds.at(i)); tbAlien tbal = aliens.value(alienIds.at(i));
// salt.armor = tbal.armor; salt.armor = tbal.armor;
// salt.health = tbal.health; salt.health = tbal.health;
// salt.imgType = tbal.imgType; salt.imgType = tbal.imgType;
// salt.isFlying = tbal.isFlying; salt.isFlying = tbal.isFlying;
// salt.name = tbal.name; salt.name = tbal.name;
// salt.prise = tbal.prise; salt.prise = tbal.prise;
// salt.regeneration = tbal.regeneration; salt.regeneration = tbal.regeneration;
// salt.score = tbal.score; salt.score = tbal.score;
// salt.speed = tbal.speed; salt.speed = tbal.speed;
// gd->srcAliens.append(salt); gd->srcAliens.append(salt);
// qDebug() << tr("Alien %1 #%2 ").arg(salt.name).arg(i); qDebug() << tr("Alien %1 #%2 ").arg(salt.name).arg(i);
// } }
// QList <tbTowerOnLevel> tollist = levTowers.values(id); QList <tbTowerOnLevel> tollist = levTowers.values(id);
// tbTower tbt; tbTower tbt;
// for (int i=0; i<tollist.size(); i++) for (int i=0; i<tollist.size(); i++)
// { {
// srcTowerType stt; srcTowerType stt;
// tbt = towers.value(tollist.at(i).towerId); tbt = towers.value(tollist.at(i).towerId);
// } stt.buildTime = tbt.buildTime;
// return gd; stt.cost = tbt.cost;
//} stt.expByDamage = tbt.expByDamage;
stt.expByKill = tbt.expByKill;
stt.expByShot = tbt.expByShot;
stt.imgType = tbt.imgType;
stt.name = tbt.name;
stt.radius = tbt.radius;
stt.reload = tbt.reload;
QList <tbChain> chlist = chains.values(tbt.id);
QList <int> trigIds;
tbSplash tbs = splashes.value(tbt.splashId);
srcSplashType sst;
sst.autoControl = tbs.autoControl;
sst.imgType = tbs.imgType;
sst.lifetime = tbs.lifetime;
sst.name = tbs.name;
sst.speed = tbs.speed;
stt.splashes.append(sst);
int recursiveCheck = 1;
fillTowerChains(&chlist,&trigIds,&stt,tbt.splashId,0,&recursiveCheck);
qDebug() << tr("Tower %1 trig=%2 splash=%3").arg(stt.name).arg(stt.triggers.size()).arg(stt.splashes.size()) << tr("chain lenght %1").arg(recursiveCheck);
}
return gd;
}
QString Loader::CreateMapExample() void Loader::fillTowerChains(QList <tbChain> * chlist, QList <int> * trigIds, srcTowerType * stt, int parId, int parIndex, int * recursiveCheck)
{
if (*recursiveCheck > 100)
{
qCritical("circle dependencies detected!");
return;
}
for (int i=0; i<chlist->size(); i++)
{
if (chlist->at(i).parentSplashId == parId)
{
int trigid = chlist->at(i).triggerId;
if (!(trigIds->contains(trigid)))
{
srcTriggerType strigt;
tbTrigger tbtrig = triggers.value(trigid);
strigt.count = tbtrig.count;
strigt.damage = tbtrig.damage;
strigt.delParent = tbtrig.delParent;
strigt.radius = tbtrig.radius;
strigt.randomPosRadius = tbtrig.randomPosRadius;
strigt.timer = tbtrig.timer;
strigt.type = tbtrig.type;
stt->triggers.append(strigt);
trigIds->append(trigid);
}
stt->splashes[parIndex].triggerIndexes.append(trigIds->indexOf(trigid));
if (chlist->at(i).childSplashId > 0 && stt->triggers.at(trigIds->indexOf(trigid)).count > 0)
{
tbSplash tbs = splashes.value(chlist->at(i).childSplashId);
srcSplashType sst;
sst.autoControl = tbs.autoControl;
sst.imgType = tbs.imgType;
sst.lifetime = tbs.lifetime;
sst.name = tbs.name;
sst.speed = tbs.speed;
stt->splashes.append(sst);
stt->triggers[stt->splashes.at(parIndex).triggerIndexes.size()-1].childId = stt->splashes.size() - 1;
*recursiveCheck += 1;
fillTowerChains(chlist,trigIds,stt,chlist->at(i).childSplashId, stt->splashes.size()-1,recursiveCheck);
}
}
}
}
QString Loader::createMapExample()
{ {
QVector < QVector < int > > Cells; QVector < QVector < int > > Cells;
Cells.resize(16); Cells.resize(16);
@@ -381,11 +448,11 @@ void Loader::readAliens()
al.score = nm.namedItem("score").nodeValue().toInt(); al.score = nm.namedItem("score").nodeValue().toInt();
al.isFlying = (nm.namedItem("flying").nodeValue() == "true"); al.isFlying = (nm.namedItem("flying").nodeValue() == "true");
aliens.insert(al.id,al); aliens.insert(al.id,al);
qDebug() << tr("Alien %1 id=%2 health=%3 speed=%4 prise=%5 imgType=%6 armor=%7 regeneration=%8 score=%10").arg(al.name).arg(al.id).arg(al.health).arg(al.speed).arg(al.prise).arg(al.imgType).arg(al.armor).arg(al.regeneration).arg(al.score); //qDebug() << tr("Alien %1 id=%2 health=%3 speed=%4 prise=%5 imgType=%6 armor=%7 regeneration=%8 score=%10").arg(al.name).arg(al.id).arg(al.health).arg(al.speed).arg(al.prise).arg(al.imgType).arg(al.armor).arg(al.regeneration).arg(al.score);
} }
qDebug("================"); //qDebug("================");
qDebug() << tr("Found %1 aliens").arg(aliens.size()); qDebug() << tr("Found %1 aliens").arg(aliens.size());
qDebug("================"); //qDebug("================");
} }
@@ -402,11 +469,11 @@ void Loader::readWaves()
w.prise = nm.namedItem("prise").nodeValue().toInt(); w.prise = nm.namedItem("prise").nodeValue().toInt();
w.timeout = nm.namedItem("timeout").nodeValue().toInt(); w.timeout = nm.namedItem("timeout").nodeValue().toInt();
waves.insert(w.id,w); waves.insert(w.id,w);
qDebug() << tr("Wave %1 prise=%2 timeout=%3").arg(w.id).arg(w.prise).arg(w.timeout); //qDebug() << tr("Wave %1 prise=%2 timeout=%3").arg(w.id).arg(w.prise).arg(w.timeout);
} }
qDebug("================"); //qDebug("================");
qDebug() << tr("Found %1 waves").arg(waves.size()); qDebug() << tr("Found %1 waves").arg(waves.size());
qDebug("================"); //qDebug("================");
} }
@@ -435,12 +502,12 @@ void Loader::readWaveParts()
if (OK) if (OK)
{ {
waveParts.insert(wp.waveId,wp); waveParts.insert(wp.waveId,wp);
qDebug() << tr("Wave=%1 alien=%2 count=%3").arg(wp.waveId).arg(wp.alienId).arg(wp.count); //qDebug() << tr("Wave=%1 alien=%2 count=%3").arg(wp.waveId).arg(wp.alienId).arg(wp.count);
} }
} }
qDebug("================"); //qDebug("================");
qDebug() << tr("Found %1 waveParts").arg(waveParts.size()); qDebug() << tr("Found %1 waveParts").arg(waveParts.size());
qDebug("================"); //qDebug("================");
} }
@@ -483,12 +550,12 @@ void Loader::readChains()
if (OK) if (OK)
{ {
chains.insert(chain.towerId,chain); chains.insert(chain.towerId,chain);
qDebug() << tr("Tower=%1 parent=%2 child=%3 trigger=%4").arg(chain.towerId).arg(chain.parentSplashId).arg(chain.childSplashId).arg(chain.triggerId); //qDebug() << tr("Tower=%1 parent=%2 child=%3 trigger=%4").arg(chain.towerId).arg(chain.parentSplashId).arg(chain.childSplashId).arg(chain.triggerId);
} }
} }
qDebug("================"); //qDebug("================");
qDebug() << tr("Found %1 chains").arg(chains.size()); qDebug() << tr("Found %1 chains").arg(chains.size());
qDebug("================"); //qDebug("================");
} }
@@ -516,12 +583,12 @@ void Loader::readLevWaves()
if (OK) if (OK)
{ {
levWaves.insert(lw.levelId,lw); levWaves.insert(lw.levelId,lw);
qDebug() << tr("level=%1 wave=%2").arg(lw.levelId).arg(lw.waveId); //qDebug() << tr("level=%1 wave=%2").arg(lw.levelId).arg(lw.waveId);
} }
} }
qDebug("================"); //qDebug("================");
qDebug() << tr("Found %1 Waves On Level").arg(levWaves.size()); qDebug() << tr("Found %1 Waves On Level").arg(levWaves.size());
qDebug("================"); //qDebug("================");
} }
@@ -549,12 +616,12 @@ void Loader::readLevTowers()
if (OK) if (OK)
{ {
levTowers.insert(lt.levelId,lt); levTowers.insert(lt.levelId,lt);
qDebug() << tr("level=%1 tower=%2").arg(lt.levelId).arg(lt.towerId); //qDebug() << tr("level=%1 tower=%2").arg(lt.levelId).arg(lt.towerId);
} }
} }
qDebug("================"); //qDebug("================");
qDebug() << tr("Found %1 Towers On Level").arg(levTowers.size()); qDebug() << tr("Found %1 Towers On Level").arg(levTowers.size());
qDebug("================"); //qDebug("================");
} }
@@ -579,12 +646,12 @@ void Loader::readLevels()
if (OK) if (OK)
{ {
levels.insert(l.id,l); levels.insert(l.id,l);
qDebug() << tr("Level %1 id=%2 map=%3 ").arg(l.name).arg(l.id).arg(l.mapId); //qDebug() << tr("Level %1 id=%2 map=%3 ").arg(l.name).arg(l.id).arg(l.mapId);
} }
} }
qDebug("================"); //qDebug("================");
qDebug() << tr("Found %1 levels").arg(levels.size()); qDebug() << tr("Found %1 levels").arg(levels.size());
qDebug("================"); //qDebug("================");
} }
@@ -611,26 +678,26 @@ void Loader::readTriggers()
trig.delParent = (str == "true"); trig.delParent = (str == "true");
str = nm.namedItem("type").nodeValue(); str = nm.namedItem("type").nodeValue();
if (str == "onDestination") if (str == "onDestination")
trig.type = tbTrigger::onDestination; trig.type = srcTriggerType::onDestination;
if (str == "onTimer") if (str == "onTimer")
trig.type = tbTrigger::onTimer; trig.type = srcTriggerType::onTimer;
if (str == "onAlienInRadius") if (str == "onAlienInRadius")
trig.type = tbTrigger::onAlienInRadius; trig.type = srcTriggerType::onAlienInRadius;
str = nm.namedItem("childAim").nodeValue(); str = nm.namedItem("childAim").nodeValue();
trig.childAim = tbTrigger::noAim; trig.childAim = srcTriggerType::noAim;
if (str == "allSide") if (str == "allSide")
trig.childAim = tbTrigger::allSide; trig.childAim = srcTriggerType::allSide;
if (str == "parentAim") if (str == "parentAim")
trig.childAim = tbTrigger::parentAim; trig.childAim = srcTriggerType::parentAim;
if (str == "nearlestAlien") if (str == "nearlestAlien")
trig.childAim = tbTrigger::nearlestAlien; trig.childAim = srcTriggerType::nearlestAlien;
triggers.insert(trig.id,trig); triggers.insert(trig.id,trig);
qDebug() << tr("Trigger %1 id=%2 damage=%3 radius=%4 delParent=%5 timer=%6").arg(trig.name).arg(trig.id).arg(trig.damage).arg(trig.radius).arg(trig.delParent).arg(trig.timer) //qDebug() << tr("Trigger %1 id=%2 damage=%3 radius=%4 delParent=%5 timer=%6").arg(trig.name).arg(trig.id).arg(trig.damage).arg(trig.radius).arg(trig.delParent).arg(trig.timer)
<< tr("count=%1 chance=%2 randomPosRadius=%3 type=%4 childAim=%5").arg(trig.count).arg(trig.chance).arg(trig.randomPosRadius).arg(trig.type).arg(trig.childAim); // << tr("count=%1 chance=%2 randomPosRadius=%3 type=%4 childAim=%5").arg(trig.count).arg(trig.chance).arg(trig.randomPosRadius).arg(trig.type).arg(trig.childAim);
} }
qDebug("================"); //qDebug("================");
qDebug() << tr("Found %1 triggers").arg(triggers.size()); qDebug() << tr("Found %1 triggers").arg(triggers.size());
qDebug("================"); //qDebug("================");
} }
@@ -652,11 +719,11 @@ void Loader::readSplashes()
str = nm.namedItem("autoControl").nodeValue(); str = nm.namedItem("autoControl").nodeValue();
s.autoControl = (str == "true"); s.autoControl = (str == "true");
splashes.insert(s.id,s); splashes.insert(s.id,s);
qDebug() << tr("Splash %1 id=%2 speed=%3 imgType=%4 autoControl=%5 lifetime=%6").arg(s.name).arg(s.id).arg(s.speed).arg(s.imgType).arg(s.autoControl).arg(s.lifetime); //qDebug() << tr("Splash %1 id=%2 speed=%3 imgType=%4 autoControl=%5 lifetime=%6").arg(s.name).arg(s.id).arg(s.speed).arg(s.imgType).arg(s.autoControl).arg(s.lifetime);
} }
qDebug("================"); //qDebug("================");
qDebug() << tr("Found %1 splashes").arg(splashes.size()); qDebug() << tr("Found %1 splashes").arg(splashes.size());
qDebug("================"); //qDebug("================");
} }
@@ -689,13 +756,13 @@ void Loader::readTowers()
if (OK) if (OK)
{ {
towers.insert(tw.id,tw); towers.insert(tw.id,tw);
qDebug() << tr("Tower %1 id=%2 radius=%3 cost=%4 reload=%5 buildTime=%6 splash=%7").arg(tw.name).arg(tw.id).arg(tw.radius).arg(tw.cost).arg(tw.reload).arg(tw.buildTime).arg(tw.splashId) //qDebug() << tr("Tower %1 id=%2 radius=%3 cost=%4 reload=%5 buildTime=%6 splash=%7").arg(tw.name).arg(tw.id).arg(tw.radius).arg(tw.cost).arg(tw.reload).arg(tw.buildTime).arg(tw.splashId)
<< tr("imgType=%1 expByKill=%2 expByShot=%3 expByDamage=%4").arg(tw.imgType).arg(tw.expByKill).arg(tw.expByShot).arg(tw.expByDamage); // << tr("imgType=%1 expByKill=%2 expByShot=%3 expByDamage=%4").arg(tw.imgType).arg(tw.expByKill).arg(tw.expByShot).arg(tw.expByDamage);
} }
} }
qDebug("================"); //qDebug("================");
qDebug() << tr("Found %1 towers").arg(towers.size()); qDebug() << tr("Found %1 towers").arg(towers.size());
qDebug("================"); //qDebug("================");
} }
@@ -716,17 +783,17 @@ void Loader::readMaps()
m.size.setWidth(mn.namedItem("width").nodeValue().toInt()); m.size.setWidth(mn.namedItem("width").nodeValue().toInt());
m.size.setHeight(mn.namedItem("height").nodeValue().toInt()); m.size.setHeight(mn.namedItem("height").nodeValue().toInt());
maps.insert(m.id,m); maps.insert(m.id,m);
qDebug() << tr("Map %1 id=%2 imgType=%3 maxPlayers=%5 data=%6 ").arg(m.name).arg(m.id).arg(m.imgType).arg(m.maxPlayers).arg(QString(m.data)) << m.size; //qDebug() << tr("Map %1 id=%2 imgType=%3 maxPlayers=%5 data=%6 ").arg(m.name).arg(m.id).arg(m.imgType).arg(m.maxPlayers).arg(QString(m.data)) << m.size;
} }
qDebug("================"); //qDebug("================");
qDebug() << tr("Found %1 maps").arg(maps.size()); qDebug() << tr("Found %1 maps").arg(maps.size());
qDebug("================"); //qDebug("================");
} }
void Loader::validate(QString filename) void Loader::validate(QString filename)
{ {
QFile sfile("schema.xml"); QFile sfile("schema.xml");
if (!sfile.open(QIODevice::ReadOnly)) if (!sfile.open(QIODevice::ReadOnly))
qFatal("No file schema.xml found!"); qFatal("No file schema.xml found!");
QXmlSchema schema; QXmlSchema schema;

View File

@@ -10,8 +10,8 @@
struct tbHeader struct tbHeader
{ {
int id; int id;
QString name; QString name;
}; };
struct tbAlien : tbHeader struct tbAlien : tbHeader
@@ -36,26 +36,12 @@ struct tbSplash : tbHeader
struct tbTrigger : tbHeader struct tbTrigger : tbHeader
{ {
enum triggerType
{
onDestination,
onTimer,
onAlienInRadius
};
enum aimType
{
noAim,
parentAim,
allSide,
nearlestAlien
};
float damage; float damage;
float radius; float radius;
int chance; int chance;
bool delParent; bool delParent;
aimType childAim; srcTriggerType::aimType childAim;
triggerType type; srcTriggerType::triggerType type;
unsigned int timer; unsigned int timer;
int count; int count;
float randomPosRadius; float randomPosRadius;
@@ -191,8 +177,9 @@ private:
void readWaveParts(); void readWaveParts();
void readUpgrades(); void readUpgrades();
void fillTowerChains(QList <tbChain> * chlist, QList <int> * trigIds, srcTowerType * stt, int parId, int parIndex, int * recursiveCheck);
void validate(QString filename); void validate(QString filename);
QString CreateMapExample(); QString createMapExample();
}; };
#endif // LOADER_H #endif // LOADER_H

View File

@@ -2,14 +2,17 @@
#include <QTimer> #include <QTimer>
#include "adcore.h" #include "adcore.h"
#include "ad_graphics.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
adCore core;
QApplication a(argc, argv); QApplication a(argc, argv);
AD_Core core;
AD_Graphics graphics(&core);
graphics.resize(800,600);
//QTimer * timer = new QTimer(); //QTimer * timer = new QTimer();
//QObject::connect(timer,SIGNAL(timeout()),&core,SLOT(next())); //QObject::connect(timer,SIGNAL(timeout()),&core,SLOT(next()));
//timer->start(100); //timer->start(100);
//return a.exec(); return a.exec();
} }

View File

@@ -1,3 +0,0 @@
cells path = example16x16.map
max players = 2

65
map.cpp
View File

@@ -27,11 +27,12 @@ Map::Map(QByteArray data, QSize size, QString name, int maxPlayers, int image, Q
} }
for (int j=0; j<Cells[i].size(); j++) for (int j=0; j<Cells[i].size(); j++)
{ {
if (Cells[i][j]==Start) starts.push_back(QPoint(i,j)); if (Cells[i][j]==Start) Starts.push_back(QPoint(i,j));
if (Cells[i][j]==Finish) finishs.push_back(QPoint(i,j)); if (Cells[i][j]==Finish) Finishs.push_back(QPoint(i,j));
} }
} }
if (starts.isEmpty() || finishs.isEmpty()) qFatal("invalid map, not found start/finish"); mapSize.setHeight(chei);
if (Starts.isEmpty() || Finishs.isEmpty()) qFatal("invalid map, not found start/finish");
// TODO: check for maxPlayers // TODO: check for maxPlayers
players = maxPlayers; players = maxPlayers;
imageType = image; imageType = image;
@@ -91,9 +92,9 @@ bool Map::addTowerOnMap(int playerId, QPoint pos)
{ {
Cells[pos.x()][pos.y()]=PlayerTower-playerId; Cells[pos.x()][pos.y()]=PlayerTower-playerId;
bool ok=true; bool ok=true;
for (int i=0; i<starts.size(); i++) for (int i=0; i<Starts.size(); i++)
for (int j=0; j<finishs.size(); j++) for (int j=0; j<Finishs.size(); j++)
if (WaveTrace(starts.at(i),finishs.at(j))<0) ok = false; if (waveTrace(Starts.at(i),Finishs.at(j))<0) ok = false;
qDebug()<<"ok="<<ok; qDebug()<<"ok="<<ok;
if (!ok) if (!ok)
{ {
@@ -105,12 +106,12 @@ bool Map::addTowerOnMap(int playerId, QPoint pos)
pathOK = new bool(); pathOK = new bool();
*pathOK = true; *pathOK = true;
qDebug("emit"); qDebug("emit");
emit RecreateAlienPath(pathOK); emit recreateAlienPath(pathOK);
qDebug() << *pathOK; qDebug() << *pathOK;
if (!pathOK) if (!pathOK)
{ {
Cells[pos.x()][pos.y()]=PlayerAlien+playerId; Cells[pos.x()][pos.y()]=PlayerAlien+playerId;
emit RecreateAlienPath(pathOK); emit recreateAlienPath(pathOK);
return false; return false;
} }
return true; return true;
@@ -166,7 +167,7 @@ bool Map::addTowerOnMap(int playerId, QPoint pos)
//} //}
QVector<QPointF> Map::CreatePath(QPoint start, QPoint finish) QVector<QPointF> Map::createPath(QPoint start, QPoint finish)
{ {
QPointF tp; QPointF tp;
QVector<QPoint> srcPath; QVector<QPoint> srcPath;
@@ -175,7 +176,7 @@ QVector<QPointF> Map::CreatePath(QPoint start, QPoint finish)
//PathIndex = 1; //PathIndex = 1;
if (Cells[start.x()][start.y()] < 0) qDebug("ERROR invalid start"),exit(-1); if (Cells[start.x()][start.y()] < 0) qDebug("ERROR invalid start"),exit(-1);
if (Cells[finish.x()][finish.y()] < 0) qDebug("ERROR invalid finish"),exit(-1); if (Cells[finish.x()][finish.y()] < 0) qDebug("ERROR invalid finish"),exit(-1);
srcPath = InvWaveTrace(finish,WaveTrace(start,finish)); srcPath = invWaveTrace(finish,waveTrace(start,finish));
for (int i=0; i<srcPath.size();i++) for (int i=0; i<srcPath.size();i++)
{ {
int x = Cells.at(srcPath.at(i).x()).at(srcPath.at(i).y()); int x = Cells.at(srcPath.at(i).x()).at(srcPath.at(i).y());
@@ -218,7 +219,7 @@ QVector<QPointF> Map::CreatePath(QPoint start, QPoint finish)
} }
int Map::WaveTrace(QPoint start, QPoint finish) int Map::waveTrace(QPoint start, QPoint finish)
{ {
bool stop = false; bool stop = false;
int step = 2; int step = 2;
@@ -251,29 +252,37 @@ int Map::WaveTrace(QPoint start, QPoint finish)
} }
tp.setX(cp.x() - 1); tp.setX(cp.x() - 1);
tp.setY(cp.y()); tp.setY(cp.y());
if (fr.contains(tp) && TmpCells[tp.x()][tp.y()] == 0) { if (fr.contains(tp)) {
TmpCells[tp.x()][tp.y()] = step; if (TmpCells[tp.x()][tp.y()] == 0) {
curp.push_back(tp); TmpCells[tp.x()][tp.y()] = step;
stop = false; curp.push_back(tp);
stop = false;
}
} }
tp.setX(cp.x() + 1); tp.setX(cp.x() + 1);
if (fr.contains(tp) && TmpCells[tp.x()][tp.y()] == 0) { if (fr.contains(tp)) {
TmpCells[tp.x()][tp.y()] = step; if (TmpCells[tp.x()][tp.y()] == 0) {
curp.push_back(tp); TmpCells[tp.x()][tp.y()] = step;
stop = false; curp.push_back(tp);
stop = false;
}
} }
tp.setX(cp.x()); tp.setX(cp.x());
tp.setY(cp.y() - 1); tp.setY(cp.y() - 1);
if (fr.contains(tp) && TmpCells[tp.x()][tp.y()] == 0) { if (fr.contains(tp)) {
TmpCells[tp.x()][tp.y()] = step; if (TmpCells[tp.x()][tp.y()] == 0) {
curp.push_back(tp); TmpCells[tp.x()][tp.y()] = step;
stop = false; curp.push_back(tp);
stop = false;
}
} }
tp.setY(cp.y() + 1); tp.setY(cp.y() + 1);
if (fr.contains(tp) && TmpCells[tp.x()][tp.y()] == 0) { if (fr.contains(tp)) {
TmpCells[tp.x()][tp.y()] = step; if (TmpCells[tp.x()][tp.y()] == 0) {
curp.push_back(tp); TmpCells[tp.x()][tp.y()] = step;
stop = false; curp.push_back(tp);
stop = false;
}
} }
} }
step++; step++;
@@ -284,7 +293,7 @@ int Map::WaveTrace(QPoint start, QPoint finish)
} }
QVector<QPoint> Map::InvWaveTrace(QPoint finish, int cnt) QVector<QPoint> Map::invWaveTrace(QPoint finish, int cnt)
{ {
QPoint wp, Ppnt; QPoint wp, Ppnt;
QVector<QPoint> alpath; QVector<QPoint> alpath;

21
map.h
View File

@@ -35,14 +35,15 @@ public:
bool isFreePlace(QPoint pos); bool isFreePlace(QPoint pos);
void delTowerOnMap(QPoint pos); void delTowerOnMap(QPoint pos);
void removeAliensPath(); void removeAliensPath();
QVector <QPointF> CreatePath(QPoint start, QPoint finish); QVector <QPointF> createPath(QPoint start, QPoint finish);
QRect Rect() const {return QRect(QPoint(),mapSize);} QRect rect() const {return QRect(QPoint(),mapSize);}
// QString name() const {return mapName;} // QString name() const {return mapName;}
QList <QPoint> Starts() const {return starts;} QList <QPoint> starts() const {return Starts;}
QList <QPoint> Finishs() const {return finishs;} QList <QPoint> finishs() const {return Finishs;}
int Image() const {return imageType;} QVector < QVector <int> > cells() const {return Cells;}
int image() const {return imageType;}
signals: signals:
void RecreateAlienPath(bool * pathOK); void recreateAlienPath(bool * pathOK);
public slots: public slots:
void printMap(); void printMap();
@@ -52,13 +53,13 @@ private:
int players; int players;
int imageType; int imageType;
QVector < QVector <int> > Cells; QVector < QVector <int> > Cells;
QList <QPoint> starts; QList <QPoint> Starts;
QList <QPoint> finishs; QList <QPoint> Finishs;
QVector < QVector <int> > TmpCells; QVector < QVector <int> > TmpCells;
QVector<QPoint> InvWaveTrace(QPoint finish, int cnt); QVector<QPoint> invWaveTrace(QPoint finish, int cnt);
int WaveTrace(QPoint start, QPoint finish); int waveTrace(QPoint start, QPoint finish);
//void CreateMapExample(); //void CreateMapExample();
//void ReadSettings(); //void ReadSettings();
}; };

View File

@@ -110,8 +110,8 @@
<xsd:complexType name="triggerType"> <xsd:complexType name="triggerType">
<xsd:attribute name="name" type="xsd:string" use="required"/> <xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="id" type="xsd:positiveInteger" use="required"/> <xsd:attribute name="id" type="xsd:positiveInteger" use="required"/>
<xsd:attribute name="count" type="xsd:positiveInteger" use="optional"/> <xsd:attribute name="count" type="xsd:nonNegativeInteger" use="optional"/>
<xsd:attribute name="timer" type="xsd:positiveInteger" use="optional"/> <xsd:attribute name="timer" type="xsd:nonNegativeInteger" use="optional"/>
<xsd:attribute name="chance" type="xsd:positiveInteger" use="optional"/> <xsd:attribute name="chance" type="xsd:positiveInteger" use="optional"/>
<xsd:attribute name="randomPosRadius" type="xsd:float" use="optional"/> <xsd:attribute name="randomPosRadius" type="xsd:float" use="optional"/>
<xsd:attribute name="damage" type="xsd:float" use="optional"/> <xsd:attribute name="damage" type="xsd:float" use="optional"/>

View File

@@ -9,7 +9,7 @@ Splashes::Splashes(Game_Data *gd, QObject *parent) :
} }
bool Splashes::AddSplash(int srcId, QPointF pos) bool Splashes::addSplash(int srcId, QPointF pos)
{ {
if (srcId < 0 || srcId >= gameData->srcSplashes.size()) if (srcId < 0 || srcId >= gameData->srcSplashes.size())
{ {
@@ -23,7 +23,7 @@ bool Splashes::AddSplash(int srcId, QPointF pos)
spl.TowerId = QPoint(-1,-1); spl.TowerId = QPoint(-1,-1);
spl.life = 0; spl.life = 0;
spl.imgType = src.imgType; spl.imgType = src.imgType;
if (!gameData->map->Rect().contains(pos.toPoint())) if (!gameData->map->rect().contains(pos.toPoint()))
{ {
qCritical("ERROR splash out of map size"); qCritical("ERROR splash out of map size");
return false; return false;
@@ -33,7 +33,7 @@ bool Splashes::AddSplash(int srcId, QPointF pos)
spl.angle = 0; spl.angle = 0;
spl.destination = pos; spl.destination = pos;
TriggerType trig; TriggerType trig;
for(int i; i<src.triggerIndexes.size(); i++) for(int i=0; i<src.triggerIndexes.size(); i++)
{ {
trig.timer = gameData->srTriggers.at(src.triggerIndexes.at(i)).timer; trig.timer = gameData->srTriggers.at(src.triggerIndexes.at(i)).timer;
trig.src = src.triggerIndexes.at(i); trig.src = src.triggerIndexes.at(i);
@@ -45,7 +45,7 @@ bool Splashes::AddSplash(int srcId, QPointF pos)
} }
void Splashes::AddSplash(srcSplashType src, int index, TowerType tw) void Splashes::addSplash(srcSplashType src, int index, TowerType tw)
{ {
SplashType spl; SplashType spl;
spl.Id = nextId; spl.Id = nextId;
@@ -63,7 +63,7 @@ void Splashes::AddSplash(srcSplashType src, int index, TowerType tw)
spl.life = 0; spl.life = 0;
spl.src = index; spl.src = index;
TriggerType trig; TriggerType trig;
for(int i; i<src.triggerIndexes.size(); i++) for(int i=0; i<src.triggerIndexes.size(); i++)
{ {
trig.timer = gameData->players.at(tw.PlayerId)->srcTowers.at(tw.src).triggers.at(src.triggerIndexes.at(i)).timer; trig.timer = gameData->players.at(tw.PlayerId)->srcTowers.at(tw.src).triggers.at(src.triggerIndexes.at(i)).timer;
trig.src = src.triggerIndexes.at(i); trig.src = src.triggerIndexes.at(i);
@@ -76,13 +76,13 @@ void Splashes::AddSplash(srcSplashType src, int index, TowerType tw)
void Splashes::update() void Splashes::update()
{ {
for (int i; i<gameData->curSplashes.size(); i++) for (int i=0; i<gameData->curSplashes.size(); i++)
{ {
SplashType spl = gameData->curSplashes.values().at(i); SplashType spl = gameData->curSplashes.values().at(i);
bool isTowerSplash = false; bool isTowerSplash = false;
srcSplashType src; srcSplashType src;
TowerType tw; TowerType tw;
if (gameData->map->Rect().contains(spl.TowerId)) if (gameData->map->rect().contains(spl.TowerId))
{ {
if (gameData->curTowers.contains(spl.TowerId)) if (gameData->curTowers.contains(spl.TowerId))
{ {

View File

@@ -8,13 +8,13 @@ class Splashes : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit Splashes(Game_Data * gd, QObject *parent = 0); explicit Splashes(Game_Data * gd, QObject *parent = 0);
bool AddSplash(int srcId, QPointF pos); bool addSplash(int srcId, QPointF pos);
void DelSplash(int Id); void delSplash(int Id);
void update(); void update();
signals: signals:
public slots: public slots:
void AddSplash(srcSplashType src, int index, TowerType tw); void addSplash(srcSplashType src, int index, TowerType tw);
private: private:
Game_Data *gameData; Game_Data *gameData;

View File

@@ -6,7 +6,7 @@ Towers::Towers(Game_Data *gd, QObject *parent) :
gameData = gd; gameData = gd;
} }
bool Towers::AddTower(int playerId, int srcId, QPoint pos) bool Towers::addTower(int playerId, int srcId, QPoint pos)
{ {
//QByteArray ar; //QByteArray ar;
//ar << pos; //ar << pos;
@@ -40,7 +40,7 @@ bool Towers::AddTower(int playerId, int srcId, QPoint pos)
} }
void Towers::DelTower(QPoint pos) void Towers::delTower(QPoint pos)
{ {
gameData->curTowers.remove(pos); gameData->curTowers.remove(pos);
} }
@@ -48,7 +48,7 @@ void Towers::DelTower(QPoint pos)
void Towers::update() void Towers::update()
{ {
for (int i; i<gameData->curTowers.size(); i++) for (int i=0; i<gameData->curTowers.size(); i++)
{ {
TowerType tw = gameData->curTowers.values().at(i); TowerType tw = gameData->curTowers.values().at(i);
srcTowerType stw = gameData->players.at(tw.PlayerId)->srcTowers.at(tw.src); srcTowerType stw = gameData->players.at(tw.PlayerId)->srcTowers.at(tw.src);

View File

@@ -8,8 +8,8 @@ class Towers : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit Towers(Game_Data * gd, QObject *parent = 0); explicit Towers(Game_Data * gd, QObject *parent = 0);
bool AddTower(int playerId, int srcId, QPoint pos); bool addTower(int playerId, int srcId, QPoint pos);
void DelTower(QPoint pos); void delTower(QPoint pos);
void update(); void update();
signals: signals:
void shot(srcSplashType src, int index, TowerType tw); void shot(srcSplashType src, int index, TowerType tw);