diff --git a/ADeditor/ADeditor b/ADeditor/ADeditor deleted file mode 100755 index 89a9835..0000000 Binary files a/ADeditor/ADeditor and /dev/null differ diff --git a/ADeditor/ADeditor.pro b/ADeditor/ADeditor.pro index 60e532a..c4aae1a 100644 --- a/ADeditor/ADeditor.pro +++ b/ADeditor/ADeditor.pro @@ -2,18 +2,28 @@ # Project created by QtCreator 2010-08-22T13:42:02 # ------------------------------------------------- QT += xml \ - xmlpatterns + xmlpatterns TARGET = ADeditor TEMPLATE = app SOURCES += main.cpp \ - mainwindow.cpp \ - ../loader.cpp \ - alienmodel.cpp \ - towermodel.cpp \ - splashmodel.cpp + mainwindow.cpp \ + ../loader.cpp \ + alienmodel.cpp \ + towermodel.cpp \ + splashmodel.cpp \ + ../map.cpp \ + ../game_data.cpp \ + triggermodel.cpp HEADERS += mainwindow.h \ - ../loader.h \ - alienmodel.h \ - towermodel.h \ - splashmodel.h + ../loader.h \ + alienmodel.h \ + towermodel.h \ + splashmodel.h \ + ../base_types.h \ + ../map.h \ + ../game_data.h \ + triggermodel.h FORMS += mainwindow.ui +TRANSLATIONS += adeditor_ru.ts + +RESOURCES += ADeditor.qrc diff --git a/ADeditor/ADeditor.pro.user b/ADeditor/ADeditor.pro.user index 707ac5b..ed2d659 100644 --- a/ADeditor/ADeditor.pro.user +++ b/ADeditor/ADeditor.pro.user @@ -1,255 +1,113 @@ - RunConfiguration0-BaseEnvironmentBase - 2 - - - RunConfiguration0-CommandLineArguments - - - - RunConfiguration0-ProFile - ADeditor.pro - - - RunConfiguration0-RunConfiguration.name - ADeditor - - - RunConfiguration0-UseDyldImageSuffix - false - - - RunConfiguration0-UseTerminal - false - - - RunConfiguration0-UserEnvironmentChanges - - - - RunConfiguration0-UserSetName - false - - - RunConfiguration0-UserSetWorkingDirectory - false - - - RunConfiguration0-UserWorkingDirectory - - - - RunConfiguration0-type - Qt4ProjectManager.Qt4RunConfiguration - - - activeRunConfiguration + ProjectExplorer.Project.ActiveTarget 0 - activebuildconfiguration - Debug - - - buildConfiguration-Debug + ProjectExplorer.Project.EditorSettings - Debug - 2 - 0 - - 2 + System - buildconfiguration-Debug-buildstep0 + ProjectExplorer.Project.Target.0 - Debug - - DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5VyjD99lFj,guid=cf0067cbadce72e8c9c0f05e4c74f11a - DEFAULTS_PATH=/usr/share/gconf/gnome.default.path - DESKTOP_SESSION=gnome - DISPLAY=:0.0 - GDMSESSION=gnome - GDM_KEYBOARD_LAYOUT=us - GDM_LANG=ru_RU.UTF-8 - GNOME_DESKTOP_SESSION_ID=this-is-deprecated - GNOME_KEYRING_CONTROL=/tmp/keyring-sQCAQN - GTK_MODULES=canberra-gtk-module - HOME=/home/andrey - LANG=ru_RU.UTF-8 - LD_LIBRARY_PATH=/usr/lib/qtcreator: - LOGNAME=andrey - MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path - ORBIT_SOCKETDIR=/tmp/orbit-andrey - PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games - PWD=/home/andrey - QTDIR=/usr/share/qt4 - SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1112,unix/buull-eeePC:/tmp/.ICE-unix/1112 - SHELL=/bin/bash - SPEECHD_PORT=6561 - SSH_AGENT_PID=1146 - SSH_AUTH_SOCK=/tmp/keyring-sQCAQN/ssh - USER=andrey - USERNAME=andrey - XAUTHORITY=/var/run/gdm/auth-for-andrey-QG4tiG/database - XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg - XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/ - XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1282732313.174012-433654821 - - - /home/andrey/AD/aliendefender/ADeditor/ADeditor.pro - -spec - linux-g++ - -r - CONFIG+=debug - - /usr/bin/qmake-qt4 - false - /home/andrey/AD/aliendefender/ADeditor + Настольный компьютер + Qt4ProjectManager.Target.DesktopTarget + 0 + 0 + + + qmake + QtProjectManager.QMakeBuildStep + + + + Сборка + Qt4ProjectManager.MakeStep + false + + + + 2 + + Сборка + Qt4ProjectManager.MakeStep + true + + clean + + + + 1 + false + + Отладка + Qt4ProjectManager.Qt4BuildConfiguration + 2 + C:/Users/Andrey/Desktop/build-ADeditor + 9 + 2 + true + + + + qmake + QtProjectManager.QMakeBuildStep + + + + Сборка + Qt4ProjectManager.MakeStep + false + + + + 2 + + Сборка + Qt4ProjectManager.MakeStep + true + + clean + + + + 1 + false + + Релиз + Qt4ProjectManager.Qt4BuildConfiguration + 0 + C:/Users/Andrey/Desktop/aliendefender/ADeditor-build-desktop + 9 + 2 + true + + 2 + + ADeditor + Qt4ProjectManager.Qt4RunConfiguration + 2 + + ADeditor.pro + false + false + + false + true + C:\Users\Andrey\Desktop\aliendefender + + 1 - buildconfiguration-Debug-buildstep1 - - Debug - - DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5VyjD99lFj,guid=cf0067cbadce72e8c9c0f05e4c74f11a - DEFAULTS_PATH=/usr/share/gconf/gnome.default.path - DESKTOP_SESSION=gnome - DISPLAY=:0.0 - GDMSESSION=gnome - GDM_KEYBOARD_LAYOUT=us - GDM_LANG=ru_RU.UTF-8 - GNOME_DESKTOP_SESSION_ID=this-is-deprecated - GNOME_KEYRING_CONTROL=/tmp/keyring-sQCAQN - GTK_MODULES=canberra-gtk-module - HOME=/home/andrey - LANG=ru_RU.UTF-8 - LD_LIBRARY_PATH=/usr/lib/qtcreator: - LOGNAME=andrey - MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path - ORBIT_SOCKETDIR=/tmp/orbit-andrey - PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games - PWD=/home/andrey - QTDIR=/usr/share/qt4 - SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1112,unix/buull-eeePC:/tmp/.ICE-unix/1112 - SHELL=/bin/bash - SPEECHD_PORT=6561 - SSH_AGENT_PID=1146 - SSH_AUTH_SOCK=/tmp/keyring-sQCAQN/ssh - USER=andrey - USERNAME=andrey - XAUTHORITY=/var/run/gdm/auth-for-andrey-QG4tiG/database - XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg - XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/ - XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1282732313.174012-433654821 - - false - - -w - - /usr/bin/make - true - /home/andrey/AD/aliendefender/ADeditor - + ProjectExplorer.Project.TargetCount + 1 - buildconfiguration-Debug-cleanstep0 - - Debug - - DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5VyjD99lFj,guid=cf0067cbadce72e8c9c0f05e4c74f11a - DEFAULTS_PATH=/usr/share/gconf/gnome.default.path - DESKTOP_SESSION=gnome - DISPLAY=:0.0 - GDMSESSION=gnome - GDM_KEYBOARD_LAYOUT=us - GDM_LANG=ru_RU.UTF-8 - GNOME_DESKTOP_SESSION_ID=this-is-deprecated - GNOME_KEYRING_CONTROL=/tmp/keyring-sQCAQN - GTK_MODULES=canberra-gtk-module - HOME=/home/andrey - LANG=ru_RU.UTF-8 - LD_LIBRARY_PATH=/usr/lib/qtcreator: - LOGNAME=andrey - MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path - ORBIT_SOCKETDIR=/tmp/orbit-andrey - PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games - PWD=/home/andrey - QTDIR=/usr/share/qt4 - SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1112,unix/buull-eeePC:/tmp/.ICE-unix/1112 - SHELL=/bin/bash - SPEECHD_PORT=6561 - SSH_AGENT_PID=1146 - SSH_AUTH_SOCK=/tmp/keyring-sQCAQN/ssh - USER=andrey - USERNAME=andrey - XAUTHORITY=/var/run/gdm/auth-for-andrey-QG4tiG/database - XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg - XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/ - XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1282732313.174012-433654821 - - true - - clean - -w - - /usr/bin/make - true - /home/andrey/AD/aliendefender/ADeditor - true - - clean - - - - - buildconfigurations - - Debug - - - - buildstep0 - - - - - - - buildstep1 - - - - - - buildsteps - - trolltech.qt4projectmanager.qmake - trolltech.qt4projectmanager.make - - - - cleanstep0 - - - true - - - - cleansteps - - trolltech.qt4projectmanager.make - - - - defaultFileEncoding - System - - - project - + ProjectExplorer.Project.Updater.FileVersion + 4 diff --git a/ADeditor/ADeditor.pro.user.1.3 b/ADeditor/ADeditor.pro.user.1.3 index 833beb4..0d3bdbf 100644 --- a/ADeditor/ADeditor.pro.user.1.3 +++ b/ADeditor/ADeditor.pro.user.1.3 @@ -56,27 +56,17 @@ buildConfiguration-Debug Debug - 0 + 2 0 - 2 - - buildConfiguration-Release - - Release - 0 - - 0 - - buildconfiguration-Debug-buildstep0 Debug - DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5i8Go7nPio,guid=870ffe971971ceac89206f0e4c5facbd + DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5VyjD99lFj,guid=cf0067cbadce72e8c9c0f05e4c74f11a DEFAULTS_PATH=/usr/share/gconf/gnome.default.path DESKTOP_SESSION=gnome DISPLAY=:0.0 @@ -84,7 +74,7 @@ GDM_KEYBOARD_LAYOUT=us GDM_LANG=ru_RU.UTF-8 GNOME_DESKTOP_SESSION_ID=this-is-deprecated - GNOME_KEYRING_CONTROL=/tmp/keyring-7vXnOW + GNOME_KEYRING_CONTROL=/tmp/keyring-sQCAQN GTK_MODULES=canberra-gtk-module HOME=/home/andrey LANG=ru_RU.UTF-8 @@ -95,17 +85,17 @@ PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games PWD=/home/andrey QTDIR=/usr/share/qt4 - SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1124,unix/buull-eeePC:/tmp/.ICE-unix/1124 + SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1112,unix/buull-eeePC:/tmp/.ICE-unix/1112 SHELL=/bin/bash SPEECHD_PORT=6561 - SSH_AGENT_PID=1158 - SSH_AUTH_SOCK=/tmp/keyring-7vXnOW/ssh + SSH_AGENT_PID=1146 + SSH_AUTH_SOCK=/tmp/keyring-sQCAQN/ssh USER=andrey USERNAME=andrey - XAUTHORITY=/var/run/gdm/auth-for-andrey-HWCXAG/database + XAUTHORITY=/var/run/gdm/auth-for-andrey-QG4tiG/database XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/ - XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1281338556.676663-803309736 + XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1282732313.174012-433654821 /home/andrey/AD/aliendefender/ADeditor/ADeditor.pro @@ -124,7 +114,7 @@ Debug - DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5i8Go7nPio,guid=870ffe971971ceac89206f0e4c5facbd + DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5VyjD99lFj,guid=cf0067cbadce72e8c9c0f05e4c74f11a DEFAULTS_PATH=/usr/share/gconf/gnome.default.path DESKTOP_SESSION=gnome DISPLAY=:0.0 @@ -132,7 +122,7 @@ GDM_KEYBOARD_LAYOUT=us GDM_LANG=ru_RU.UTF-8 GNOME_DESKTOP_SESSION_ID=this-is-deprecated - GNOME_KEYRING_CONTROL=/tmp/keyring-7vXnOW + GNOME_KEYRING_CONTROL=/tmp/keyring-sQCAQN GTK_MODULES=canberra-gtk-module HOME=/home/andrey LANG=ru_RU.UTF-8 @@ -143,17 +133,17 @@ PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games PWD=/home/andrey QTDIR=/usr/share/qt4 - SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1124,unix/buull-eeePC:/tmp/.ICE-unix/1124 + SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1112,unix/buull-eeePC:/tmp/.ICE-unix/1112 SHELL=/bin/bash SPEECHD_PORT=6561 - SSH_AGENT_PID=1158 - SSH_AUTH_SOCK=/tmp/keyring-7vXnOW/ssh + SSH_AGENT_PID=1146 + SSH_AUTH_SOCK=/tmp/keyring-sQCAQN/ssh USER=andrey USERNAME=andrey - XAUTHORITY=/var/run/gdm/auth-for-andrey-HWCXAG/database + XAUTHORITY=/var/run/gdm/auth-for-andrey-QG4tiG/database XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/ - XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1281338556.676663-803309736 + XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1282732313.174012-433654821 false @@ -169,7 +159,7 @@ Debug - DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5i8Go7nPio,guid=870ffe971971ceac89206f0e4c5facbd + DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5VyjD99lFj,guid=cf0067cbadce72e8c9c0f05e4c74f11a DEFAULTS_PATH=/usr/share/gconf/gnome.default.path DESKTOP_SESSION=gnome DISPLAY=:0.0 @@ -177,7 +167,7 @@ GDM_KEYBOARD_LAYOUT=us GDM_LANG=ru_RU.UTF-8 GNOME_DESKTOP_SESSION_ID=this-is-deprecated - GNOME_KEYRING_CONTROL=/tmp/keyring-7vXnOW + GNOME_KEYRING_CONTROL=/tmp/keyring-sQCAQN GTK_MODULES=canberra-gtk-module HOME=/home/andrey LANG=ru_RU.UTF-8 @@ -188,17 +178,17 @@ PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games PWD=/home/andrey QTDIR=/usr/share/qt4 - SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1124,unix/buull-eeePC:/tmp/.ICE-unix/1124 + SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1112,unix/buull-eeePC:/tmp/.ICE-unix/1112 SHELL=/bin/bash SPEECHD_PORT=6561 - SSH_AGENT_PID=1158 - SSH_AUTH_SOCK=/tmp/keyring-7vXnOW/ssh + SSH_AGENT_PID=1146 + SSH_AUTH_SOCK=/tmp/keyring-sQCAQN/ssh USER=andrey USERNAME=andrey - XAUTHORITY=/var/run/gdm/auth-for-andrey-HWCXAG/database + XAUTHORITY=/var/run/gdm/auth-for-andrey-QG4tiG/database XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/ - XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1281338556.676663-803309736 + XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1282732313.174012-433654821 true @@ -214,29 +204,10 @@ - - buildconfiguration-Release-buildstep0 - - Release - - - - buildconfiguration-Release-buildstep1 - - Release - - - - buildconfiguration-Release-cleanstep0 - - Release - - buildconfigurations Debug - Release diff --git a/ADeditor/ADeditor.qrc b/ADeditor/ADeditor.qrc new file mode 100644 index 0000000..36b0f98 --- /dev/null +++ b/ADeditor/ADeditor.qrc @@ -0,0 +1,5 @@ + + + adeditor_ru.qm + + diff --git a/ADeditor/Makefile b/ADeditor/Makefile deleted file mode 100644 index 3803c83..0000000 --- a/ADeditor/Makefile +++ /dev/null @@ -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: - diff --git a/ADeditor/adeditor_ru.qm b/ADeditor/adeditor_ru.qm new file mode 100644 index 0000000..d681aae Binary files /dev/null and b/ADeditor/adeditor_ru.qm differ diff --git a/ADeditor/adeditor_ru.ts b/ADeditor/adeditor_ru.ts new file mode 100644 index 0000000..df1686e --- /dev/null +++ b/ADeditor/adeditor_ru.ts @@ -0,0 +1,324 @@ + + + + + Loader + + + Error Level %1 not found! + Ошибка уровень %1 не найден! + + + + Loading level %1 ... + Загружается уровень %1 ... + + + + Error no waves on level! + Ошибка в уровне нету волн! + + + + Error wave %1 is empty! + Ошибка волна %1 пустая! + + + + load wave #%1 prise=%2 timeout=%3 + загружена волна №%1 награда=%2 таймаут=%3 + + + + Alien %1 #%2 + Монстр %1 №%2 + + + + Tower %1 trig=%2 splash=%3 + Башня %1 триггер=%2 снаряд=%3 + + + + chain lenght %1 + длина цепочки %1 + + + + Found %1 aliens + Найдено %1 монстров + + + + Found %1 waves + найдено %1 волн + + + + Found %1 waveParts + Найдео %1 составляющих волны + + + + Found %1 chains + Найдено %1 цепочек + + + + Found %1 Waves On Level + + + + + Found %1 Towers On Level + + + + + Found %1 levels + найдено %1 уровней + + + + Found %1 triggers + Найдено %1 триггеров + + + + Found %1 splashes + найдено %1 снарядов + + + + Found %1 towers + Найдено %1 башень + + + + Found %1 maps + Найдено %1 карт + + + + MainWindow + + + MainWindow + + + + + Aliens + Монстры + + + + + + Name + Имя + + + + Health + Здоровье + + + + Armor + Броня + + + + Regeneration + Регенерация + + + + + Speed + Скорость + + + + Prize + Награда + + + + Score + Очки + + + + Is Flying + Летающий + + + + + + Image + Картинка + + + + + + ... + ... + + + + + + Add + Добавить + + + + + + Delete + Удалить + + + + Towers + Башни + + + + Build time + Время постройки + + + + Cost + Цена + + + + Cancel + Отменить изменения + + + splash + снаряд + + + + Edit + Ред. + + + + Reload + Перезарядка + + + + Radius + Радиус + + + + ExpbyShot + Опыт за выстрел + + + + ExpbyDam + Опыт за урон + + + + ExpbyKill + Опыт за убийство + + + + Splashes + Снаряды + + + + LifeTime + Время жизни + + + + AutoControl + Самонаведение + + + + Tab 2 + + + + + Save + Сохранить + + + + Save changes? + Сохранить изменения? + + + + All unsaved changes will be lost + Все несохранённые изменения будут потеряны + + + + + + + Are you sure? + Вы уверены? + + + + Alien + Монстр + + + + Delete alien %1 id=%2 + Удалить монстра %1 id=%2 + + + + Tower + Башня + + + + Delete tower %1 id=%2 + Удалить башню %1 id=%2 + + + + + Splash + Снаряд + + + + You can not delete splash %1 id=%2 + Вы не можете удалить снаряд %1 id=%2 + + + + It used by tower %1 + Используется башней %1 + + + + Delete splash %1 id=%2 + Удалить снаряд %1 id=%2 + + + diff --git a/ADeditor/data2.xml b/ADeditor/data2.xml index 5fef992..038e3a3 100644 --- a/ADeditor/data2.xml +++ b/ADeditor/data2.xml @@ -15,22 +15,22 @@ - + - - + + - - - + + + - - + + @@ -50,15 +50,15 @@ - + - + - - + + diff --git a/ADeditor/main.cpp b/ADeditor/main.cpp index 6e7efd9..be7bb6a 100644 --- a/ADeditor/main.cpp +++ b/ADeditor/main.cpp @@ -1,10 +1,14 @@ #include +#include #include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); - MainWindow w; + QTranslator translator; + translator.load(":/translates/" + QString("adeditor_") + QLocale::system().name()); + a.installTranslator(&translator); + MainWindow w; w.show(); return a.exec(); } diff --git a/ADeditor/mainwindow.cpp b/ADeditor/mainwindow.cpp index dbe1cb6..716fdc7 100644 --- a/ADeditor/mainwindow.cpp +++ b/ADeditor/mainwindow.cpp @@ -5,109 +5,130 @@ MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::MainWindow) + QMainWindow(parent), + ui(new Ui::MainWindow) { - ui->setupUi(this); - adloader = new Loader(this); - adloader->load("data2.xml"); + ui->setupUi(this); + adloader = new Loader(this); + adloader->load("data2.xml"); - alModel = new AlienModel(adloader->aliens.values()); - ui->lvAliens->setModel((QAbstractItemModel * )alModel); - connect(ui->lvAliens->selectionModel(),SIGNAL(currentChanged(QModelIndex, QModelIndex)),this,SLOT(lvAliens_select(QModelIndex, QModelIndex))); + alModel = new AlienModel(adloader->aliens.values()); + ui->lvAliens->setModel((QAbstractItemModel * )alModel); + 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); - splModel = new SplashModel(adloader->splashes.values()); - ui->lvSplashes->setModel((QAbstractItemModel * )splModel); - connect(ui->lvSplashes->selectionModel(),SIGNAL(currentChanged(QModelIndex, QModelIndex)),this,SLOT(lvSplashes_select(QModelIndex, QModelIndex))); + splModel = new SplashModel(adloader->splashes.values()); + ui->lvSplashes->setModel((QAbstractItemModel * )splModel); + 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); - twModel = new TowerModel(adloader->towers.values()); - ui->lvTowers->setModel((QAbstractItemModel * )twModel); - connect(ui->lvTowers->selectionModel(),SIGNAL(currentChanged(QModelIndex, QModelIndex)),this,SLOT(lvTowers_select(QModelIndex, QModelIndex))); + twModel = new TowerModel(adloader->towers.values()); + ui->lvTowers->setModel((QAbstractItemModel * )twModel); + 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->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() { - delete ui; + delete ui; } void MainWindow::changeEvent(QEvent *e) { - QMainWindow::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } + QMainWindow::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } } void MainWindow::on_cbAlArmor_toggled(bool checked) { - int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; - ui->sbAlArmor->setEnabled(checked); - if (checked) adloader->aliens[id].armor = ui->sbAlArmor->value(); - else adloader->aliens[id].armor = 0; + int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; + ui->sbAlArmor->setEnabled(checked); + if (checked) adloader->aliens[id].armor = ui->sbAlArmor->value(); + else adloader->aliens[id].armor = 0; } void MainWindow::on_cbAlRegeneration_toggled(bool checked) { - int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; - ui->sbAlregeneration->setEnabled(checked); - if (checked) adloader->aliens[id].regeneration = ui->sbAlregeneration->value(); - else adloader->aliens[id].regeneration = 0; + int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; + ui->sbAlregeneration->setEnabled(checked); + if (checked) adloader->aliens[id].regeneration = ui->sbAlregeneration->value(); + else adloader->aliens[id].regeneration = 0; } void MainWindow::lvAliens_select(QModelIndex index, QModelIndex) { - tbAlien al = adloader->aliens.values().at(index.row()); - ui->leAlName->setText(al.name); - ui->sbAlHealth->setValue(al.health); - ui->sbAlArmor->setValue(al.armor); - if (al.armor > 0) ui->cbAlArmor->setChecked(true); - else ui->cbAlArmor->setChecked(false); - ui->sbAlSpeed->setValue(al.speed); - ui->sbAlPrise->setValue(al.prise); - ui->sbAlregeneration->setValue(al.regeneration); - if (al.regeneration > 0) ui->cbAlRegeneration->setChecked(true); - else ui->cbAlRegeneration->setChecked(false); - ui->sbAlScore->setValue(al.score); - ui->cbAlIsFly->setChecked(al.isFlying); + tbAlien al = adloader->aliens.values().at(index.row()); + ui->leAlName->setText(al.name); + ui->sbAlHealth->setValue(al.health); + ui->sbAlArmor->setValue(al.armor); + if (al.armor > 0) ui->cbAlArmor->setChecked(true); + else ui->cbAlArmor->setChecked(false); + ui->sbAlSpeed->setValue(al.speed); + ui->sbAlPrise->setValue(al.prise); + ui->sbAlregeneration->setValue(al.regeneration); + if (al.regeneration > 0) ui->cbAlRegeneration->setChecked(true); + else ui->cbAlRegeneration->setChecked(false); + ui->sbAlScore->setValue(al.score); + ui->cbAlIsFly->setChecked(al.isFlying); } void MainWindow::lvTowers_select(QModelIndex index, QModelIndex) { - tbTower tw = adloader->towers.values().at(index.row()); - ui->sbTwBuildTime->setValue(tw.buildTime); - ui->sbTwCost->setValue(tw.cost); - ui->sbTwExpByDam->setValue(tw.expByDamage); - ui->sbTwExpByKill->setValue(tw.expByKill); - ui->sbTwExpByShot->setValue(tw.expByShot); - ui->leTwName->setText(tw.name); - ui->sbTwRadius->setValue(tw.radius); - ui->sbTwReload->setValue(tw.reload); - ui->cbTwSplash->setCurrentIndex(adloader->splashes.keys().indexOf(tw.splashId)); + tbTower tw = adloader->towers.values().at(index.row()); + ui->sbTwBuildTime->setValue(tw.buildTime); + ui->sbTwCost->setValue(tw.cost); + ui->sbTwExpByDam->setValue(tw.expByDamage); + ui->sbTwExpByKill->setValue(tw.expByKill); + ui->sbTwExpByShot->setValue(tw.expByShot); + ui->leTwName->setText(tw.name); + ui->sbTwRadius->setValue(tw.radius); + ui->sbTwReload->setValue(tw.reload); + ui->cbTwSplash->setCurrentIndex(adloader->splashes.keys().indexOf(tw.splashId)); } void MainWindow::lvSplashes_select(QModelIndex index, QModelIndex) { - tbSplash spl = adloader->splashes.values().at(index.row()); - ui->sbSplLifeTime->setValue(spl.lifetime); - ui->sbSplSpeed->setValue(spl.speed); - ui->cbSplAutoControl->setChecked(spl.autoControl); - ui->leSplName->setText(spl.name); + tbSplash spl = adloader->splashes.values().at(index.row()); + ui->sbSplLifeTime->setValue(spl.lifetime); + ui->sbSplSpeed->setValue(spl.speed); + ui->cbSplAutoControl->setChecked(spl.autoControl); + 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() { - 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) { - int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; - adloader->aliens[id].health = value; + int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; + adloader->aliens[id].health = value; } void MainWindow::on_sbAlArmor_valueChanged(double value) { - int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; - adloader->aliens[id].armor = value; + int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; + adloader->aliens[id].armor = value; } void MainWindow::on_sbAlregeneration_valueChanged(double value) { - int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; - adloader->aliens[id].regeneration = value; + int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; + adloader->aliens[id].regeneration = value; } void MainWindow::on_sbAlSpeed_valueChanged(double value) { - int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; - adloader->aliens[id].speed = value; + int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; + adloader->aliens[id].speed = value; } void MainWindow::on_sbAlPrise_valueChanged(int val) { - int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; - adloader->aliens[id].prise = val; + int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; + adloader->aliens[id].prise = val; } void MainWindow::on_sbAlScore_valueChanged(int val) { - int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; - adloader->aliens[id].score = val; + int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; + adloader->aliens[id].score = val; } void MainWindow::on_cbAlIsFly_clicked(bool checked) { - int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; - adloader->aliens[id].isFlying = checked; + int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; + adloader->aliens[id].isFlying = checked; } void MainWindow::on_leAlName_editingFinished() { - int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; - adloader->aliens[id].name = ui->leAlName->text(); - alModel->refresh(adloader->aliens.values()); - ui->lvAliens->setModel((QAbstractItemModel * )alModel); + int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; + adloader->aliens[id].name = ui->leAlName->text(); + alModel->refresh(adloader->aliens.values()); + ui->lvAliens->setModel((QAbstractItemModel * )alModel); ui->lvAliens->repaint(); } void MainWindow::on_pbAlAdd_clicked() { - int i = 1; - while (adloader->aliens.contains(i)) i++; - tbAlien al; - al.id = i; - al.name = tr("Alien"); + int i = 1; + while (adloader->aliens.contains(i)) i++; + tbAlien al; + al.id = i; + al.name = tr("Alien"); al.health = 1; al.prise = 0; al.score = 1; al.speed = 1; - adloader->aliens.insert(al.id,al); - int index = adloader->aliens.keys().indexOf(i); - alModel->refresh(adloader->aliens.values()); - ui->lvAliens->setModel((QAbstractItemModel * )alModel); - ui->lvAliens->reset(); + adloader->aliens.insert(al.id,al); + int index = adloader->aliens.keys().indexOf(i); + alModel->refresh(adloader->aliens.values()); + ui->lvAliens->setModel((QAbstractItemModel * )alModel); + ui->lvAliens->reset(); 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() { if (adloader->aliens.size() < 2) return; - QMessageBox msgBox; - 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.setInformativeText(tr("Are you sure?")); - msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); - msgBox.setDefaultButton(QMessageBox::Ok); - int ret = msgBox.exec(); - if (ret == QMessageBox::Ok) - { - adloader->aliens.remove(id); - alModel->refresh(adloader->aliens.values()); - ui->lvAliens->setModel((QAbstractItemModel * )alModel); - ui->lvAliens->reset(); + QMessageBox msgBox; + 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.setInformativeText(tr("Are you sure?")); + msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); + msgBox.setDefaultButton(QMessageBox::Ok); + int ret = msgBox.exec(); + if (ret == QMessageBox::Ok) + { + adloader->aliens.remove(id); + alModel->refresh(adloader->aliens.values()); + ui->lvAliens->setModel((QAbstractItemModel * )alModel); + ui->lvAliens->reset(); ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(0,0),QItemSelectionModel::ClearAndSelect); - } + } } void MainWindow::on_leTwName_editingFinished() { - int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; - adloader->towers[id].name = ui->leTwName->text(); - twModel->refresh(adloader->towers.values()); - ui->lvTowers->setModel((QAbstractItemModel * )twModel); + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].name = ui->leTwName->text(); + twModel->refresh(adloader->towers.values()); + ui->lvTowers->setModel((QAbstractItemModel * )twModel); } void MainWindow::on_sbTwBuildTime_valueChanged(int val) { - int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; - adloader->towers[id].buildTime = val; + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].buildTime = val; } void MainWindow::on_sbTwCost_valueChanged(int val) { - int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; - adloader->towers[id].cost = val; + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].cost = val; } void MainWindow::on_cbTwSplash_currentIndexChanged(int index) { - int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; - adloader->towers[id].splashId = adloader->splashes.values().at(index).id; + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].splashId = adloader->splashes.values().at(index).id; } void MainWindow::on_sbTwReload_valueChanged(int val) { - int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; - adloader->towers[id].reload = val; + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].reload = val; } void MainWindow::on_sbTwRadius_valueChanged(double val) { - int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; - adloader->towers[id].radius = val; + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].radius = val; } void MainWindow::on_sbTwExpByShot_valueChanged(double val) { - int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; - adloader->towers[id].expByShot = val; + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].expByShot = val; } void MainWindow::on_sbTwExpByDam_valueChanged(double val) { - int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; - adloader->towers[id].expByDamage = val; + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].expByDamage = val; } void MainWindow::on_sbTwExpByKill_valueChanged(double val) { - int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; - adloader->towers[id].expByKill = val; + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].expByKill = val; } void MainWindow::on_pbTwAdd_clicked() { - int i = 1; - while (adloader->towers.contains(i)) i++; - tbTower tw; - tw.id = i; - tw.name = tr("Tower"); + int i = 1; + while (adloader->towers.contains(i)) i++; + tbTower tw; + tw.id = i; + tw.name = tr("Tower"); tw.splashId = adloader->splashes.keys().at(0); tw.buildTime = 1; tw.cost = 1; tw.radius = 1; tw.reload = 1; - adloader->towers.insert(tw.id,tw); - int index = adloader->towers.keys().indexOf(i); - twModel->refresh(adloader->towers.values()); - ui->lvTowers->setModel((QAbstractItemModel * )twModel); - ui->lvTowers->reset(); + adloader->towers.insert(tw.id,tw); + int index = adloader->towers.keys().indexOf(i); + twModel->refresh(adloader->towers.values()); + ui->lvTowers->setModel((QAbstractItemModel * )twModel); + ui->lvTowers->reset(); 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; QMessageBox msgBox; - 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.setInformativeText(tr("Are you sure?")); - msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); - msgBox.setDefaultButton(QMessageBox::Ok); - int ret = msgBox.exec(); - if (ret == QMessageBox::Ok) - { - adloader->towers.remove(id); - twModel->refresh(adloader->towers.values()); - ui->lvTowers->setModel((QAbstractItemModel * )twModel); - ui->lvTowers->reset(); + 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.setInformativeText(tr("Are you sure?")); + msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); + msgBox.setDefaultButton(QMessageBox::Ok); + int ret = msgBox.exec(); + if (ret == QMessageBox::Ok) + { + adloader->towers.remove(id); + twModel->refresh(adloader->towers.values()); + ui->lvTowers->setModel((QAbstractItemModel * )twModel); + ui->lvTowers->reset(); ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(0,0),QItemSelectionModel::ClearAndSelect); - } + } } void MainWindow::on_leSplName_editingFinished() { - int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; - adloader->splashes[id].name = ui->leSplName->text(); - splModel->refresh(adloader->splashes.values()); - ui->lvSplashes->setModel((QAbstractItemModel * )splModel); - ui->cbTwSplash->setModel((QAbstractItemModel * )splModel); + int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; + adloader->splashes[id].name = ui->leSplName->text(); + splModel->refresh(adloader->splashes.values()); + ui->lvSplashes->setModel((QAbstractItemModel * )splModel); + ui->cbTwSplash->setModel((QAbstractItemModel * )splModel); } void MainWindow::on_sbSplSpeed_valueChanged(double val) { - int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; - adloader->splashes[id].speed = val; + int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; + adloader->splashes[id].speed = val; } void MainWindow::on_cbSplAutoControl_toggled(bool checked) { - int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; - adloader->splashes[id].autoControl = checked; + int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; + adloader->splashes[id].autoControl = checked; } void MainWindow::on_sbSplLifeTime_valueChanged(int val) { - int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; - adloader->splashes[id].lifetime = val; + int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; + adloader->splashes[id].lifetime = val; } void MainWindow::on_pbSplAdd_clicked() { - int i = 1; - while (adloader->splashes.contains(i)) i++; - tbSplash spl; - spl.id = i; - spl.name = tr("Splash"); + int i = 1; + while (adloader->splashes.contains(i)) i++; + tbSplash spl; + spl.id = i; + spl.name = tr("Splash"); spl.lifetime = 1; spl.speed = 1; - adloader->splashes.insert(spl.id,spl); - int index = adloader->splashes.keys().indexOf(i); - splModel->refresh(adloader->splashes.values()); - ui->lvSplashes->setModel((QAbstractItemModel * )splModel); - ui->lvSplashes->reset(); + adloader->splashes.insert(spl.id,spl); + int index = adloader->splashes.keys().indexOf(i); + splModel->refresh(adloader->splashes.values()); + ui->lvSplashes->setModel((QAbstractItemModel * )splModel); + ui->lvSplashes->reset(); 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() { if (adloader->splashes.size() < 2) return; - QMessageBox msgBox; - int id = adloader->splashes.keys().at(ui->lvSplashes->currentIndex().row()); + QMessageBox msgBox; + int id = adloader->splashes.keys().at(ui->lvSplashes->currentIndex().row()); for (int i=0; itowers.size(); i++) { if (adloader->towers.values().at(i).splashId == id) @@ -433,20 +456,20 @@ void MainWindow::on_pbSlpDel_clicked() return; } } - msgBox.setText(tr("Delete splash %1 id=%2").arg(adloader->splashes.value(id).name).arg(id)); - msgBox.setInformativeText(tr("Are you sure?")); - msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); - msgBox.setDefaultButton(QMessageBox::Ok); - int ret = msgBox.exec(); - if (ret == QMessageBox::Ok) - { - adloader->splashes.remove(id); - splModel->refresh(adloader->splashes.values()); - ui->lvSplashes->setModel((QAbstractItemModel * )splModel); - ui->lvSplashes->reset(); + msgBox.setText(tr("Delete splash %1 id=%2").arg(adloader->splashes.value(id).name).arg(id)); + msgBox.setInformativeText(tr("Are you sure?")); + msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); + msgBox.setDefaultButton(QMessageBox::Ok); + int ret = msgBox.exec(); + if (ret == QMessageBox::Ok) + { + adloader->splashes.remove(id); + splModel->refresh(adloader->splashes.values()); + ui->lvSplashes->setModel((QAbstractItemModel * )splModel); + ui->lvSplashes->reset(); 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->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; +} diff --git a/ADeditor/mainwindow.h b/ADeditor/mainwindow.h index 23328f4..f1644bb 100644 --- a/ADeditor/mainwindow.h +++ b/ADeditor/mainwindow.h @@ -9,64 +9,68 @@ #include "alienmodel.h" #include "towermodel.h" #include "splashmodel.h" +#include "triggermodel.h" namespace Ui { - class MainWindow; + class MainWindow; } class MainWindow : public QMainWindow { - Q_OBJECT + Q_OBJECT public: - MainWindow(QWidget *parent = 0); - ~MainWindow(); + MainWindow(QWidget *parent = 0); + ~MainWindow(); protected: - void changeEvent(QEvent *e); + void changeEvent(QEvent *e); private: - Ui::MainWindow *ui; - Loader * adloader; - AlienModel * alModel; - TowerModel * twModel; - SplashModel * splModel; + Ui::MainWindow *ui; + Loader * adloader; + AlienModel * alModel; + TowerModel * twModel; + SplashModel * splModel; + TriggerModel* trigModel; void closeEvent(QCloseEvent *); private slots: - void on_pbReload_clicked(); + void on_cbTrigChance_clicked(bool checked); + void on_pbReload_clicked(); void on_pushButton_clicked(); void on_pbSlpDel_clicked(); - void on_pbSplAdd_clicked(); - void on_sbSplLifeTime_valueChanged(int ); - void on_cbSplAutoControl_toggled(bool checked); - void on_sbSplSpeed_valueChanged(double ); - void on_leSplName_editingFinished(); - void on_pbTwDel_clicked(); - void on_sbTwExpByKill_valueChanged(double ); - void on_sbTwExpByDam_valueChanged(double ); - void on_sbTwExpByShot_valueChanged(double ); - void on_sbTwRadius_valueChanged(double ); - void on_sbTwReload_valueChanged(int ); - void on_cbTwSplash_currentIndexChanged(int index); - void on_sbTwCost_valueChanged(int ); - void on_sbTwBuildTime_valueChanged(int ); - void on_pbTwAdd_clicked(); - void on_leTwName_editingFinished(); - void on_pbAlDel_clicked(); - void on_pbAlAdd_clicked(); - void on_leAlName_editingFinished(); - void on_cbAlIsFly_clicked(bool checked); - void on_sbAlScore_valueChanged(int ); - void on_sbAlPrise_valueChanged(int ); - void on_sbAlSpeed_valueChanged(double ); - void on_sbAlregeneration_valueChanged(double ); - void on_sbAlArmor_valueChanged(double ); - void on_sbAlHealth_valueChanged(double ); - void on_pbSave_clicked(); - void lvAliens_select(QModelIndex, QModelIndex); - void lvTowers_select(QModelIndex, QModelIndex); - void lvSplashes_select(QModelIndex, QModelIndex); - void on_cbAlRegeneration_toggled(bool checked); - void on_cbAlArmor_toggled(bool checked); + void on_pbSplAdd_clicked(); + void on_sbSplLifeTime_valueChanged(int ); + void on_cbSplAutoControl_toggled(bool checked); + void on_sbSplSpeed_valueChanged(double ); + void on_leSplName_editingFinished(); + void on_pbTwDel_clicked(); + void on_sbTwExpByKill_valueChanged(double ); + void on_sbTwExpByDam_valueChanged(double ); + void on_sbTwExpByShot_valueChanged(double ); + void on_sbTwRadius_valueChanged(double ); + void on_sbTwReload_valueChanged(int ); + void on_cbTwSplash_currentIndexChanged(int index); + void on_sbTwCost_valueChanged(int ); + void on_sbTwBuildTime_valueChanged(int ); + void on_pbTwAdd_clicked(); + void on_leTwName_editingFinished(); + void on_pbAlDel_clicked(); + void on_pbAlAdd_clicked(); + void on_leAlName_editingFinished(); + void on_cbAlIsFly_clicked(bool checked); + void on_sbAlScore_valueChanged(int ); + void on_sbAlPrise_valueChanged(int ); + void on_sbAlSpeed_valueChanged(double ); + void on_sbAlregeneration_valueChanged(double ); + void on_sbAlArmor_valueChanged(double ); + void on_sbAlHealth_valueChanged(double ); + void on_pbSave_clicked(); + void lvAliens_select(QModelIndex, QModelIndex); + void lvTowers_select(QModelIndex, QModelIndex); + void lvSplashes_select(QModelIndex, QModelIndex); + void lvTriggers_select(QModelIndex, QModelIndex); + void on_cbAlRegeneration_toggled(bool checked); + void on_cbAlArmor_toggled(bool checked); }; #endif // MAINWINDOW_H diff --git a/ADeditor/mainwindow.ui b/ADeditor/mainwindow.ui index be80e57..8dffcaf 100644 --- a/ADeditor/mainwindow.ui +++ b/ADeditor/mainwindow.ui @@ -1,1413 +1,1458 @@ - - - MainWindow - - - - 0 - 0 - 582 - 519 - - - - PointingHandCursor - - - MainWindow - - - QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks|QMainWindow::ForceTabbedDocks - - - - - - - PointingHandCursor - - - Save - - - - - - - Reload - - - - - - - 3 - - - - Aliens - - - - - - QAbstractItemView::AllEditTriggers - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - 0 - 0 - - - - Name - - - Qt::AlignCenter - - - - - - - - - - - - - - - 0 - 0 - - - - Health - - - Qt::AlignCenter - - - - - - - 1 - - - 0.000000000000000 - - - 999999999.000000000000000 - - - 10.000000000000000 - - - 99.000000000000000 - - - - - - - - - - - - 0 - 0 - - - - Armor - - - - - - - false - - - 999999999.000000000000000 - - - - - - - - - - - - 0 - 0 - - - - Regeneration - - - - - - - false - - - 1 - - - 999999999.000000000000000 - - - 5.000000000000000 - - - - - - - - - - - - 0 - 0 - - - - Speed - - - Qt::AlignCenter - - - - - - - - - - 5 - - - 0.000010000000000 - - - 99.000000000000000 - - - 0.010000000000000 - - - 0.010000000000000 - - - - - - - - - - - - 0 - 0 - - - - Prise - - - Qt::AlignCenter - - - - - - - 0 - - - 999999999 - - - - - - - - - - - - 0 - 0 - - - - Score - - - Qt::AlignCenter - - - - - - - 1 - - - 999999999 - - - - - - - - - - - - 0 - 0 - - - - Qt::LeftToRight - - - Is Flying - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 0 - 0 - - - - Image - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 40 - 40 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - true - - - - 0 - 0 - - - - - 48 - 32 - - - - ... - - - - - - - - - - - - 20 - - - - - - 0 - 0 - - - - PointingHandCursor - - - Add - - - - - - - - 0 - 0 - - - - Delete - - - - - - - - - - Towers - - - - - - - - - ArrowCursor - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - 0 - 0 - - - - Name - - - Qt::AlignCenter - - - - - - - - - - - - - - - 0 - 0 - - - - Build time - - - Qt::AlignCenter - - - - - - - 1 - - - 999999999 - - - 50 - - - 50 - - - - - - - - - - - - 0 - 0 - - - - Cost - - - Qt::AlignCenter - - - - - - - 1 - - - 999999999 - - - - - - - - - - - - 0 - 0 - - - - splash - - - Qt::AlignCenter - - - - - - - true - - - - - - - - 0 - 0 - - - - Edit - - - - - - - - - - - - 0 - 0 - - - - Reload - - - Qt::AlignCenter - - - - - - - 1 - - - 999999999 - - - - - - - - - - - - 0 - 0 - - - - Radius - - - Qt::AlignCenter - - - - - - - 3 - - - 1.000000000000000 - - - 0.100000000000000 - - - - - - - - - - - - 0 - 0 - - - - ExpbyShot - - - Qt::AlignCenter - - - - - - - 3 - - - 999999999.000000000000000 - - - - - - - - - - - - 0 - 0 - - - - ExpbyDam - - - Qt::AlignCenter - - - - - - - 3 - - - 999999999.000000000000000 - - - - - - - - - - - - 0 - 0 - - - - ExpbyKill - - - Qt::AlignCenter - - - - - - - 3 - - - 999999999.000000000000000 - - - - - - - - - - - - 0 - 0 - - - - Image - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 40 - 40 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - true - - - - 0 - 0 - - - - - 48 - 32 - - - - PointingHandCursor - - - ... - - - - - - - - - - - - 20 - - - - - - 0 - 0 - - - - PointingHandCursor - - - Add - - - - - - - - 0 - 0 - - - - PointingHandCursor - - - Delete - - - - - - - - - - Splashes - - - - - - QAbstractItemView::AllEditTriggers - - - - - - - true - - - - 0 - 0 - - - - IBeamCursor - - - QFrame::StyledPanel - - - QFrame::Raised - - - - QLayout::SetDefaultConstraint - - - 5 - - - 5 - - - 2 - - - - - - - - 0 - 0 - - - - Name - - - Qt::AlignCenter - - - - - - - - - - - - - - - 0 - 0 - - - - Speed - - - Qt::AlignCenter - - - - - - - - - - 5 - - - 9999.000000000000000 - - - 0.001000000000000 - - - 0.010000000000000 - - - - - - - - - - - - 0 - 0 - - - - LifeTime - - - Qt::AlignCenter - - - - - - - 1 - - - 999999999 - - - 1 - - - - - - - - - - - - 0 - 0 - - - - ArrowCursor - - - Qt::LeftToRight - - - AutoControl - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 0 - 0 - - - - Image - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 40 - 40 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - true - - - - 0 - 0 - - - - - 48 - 32 - - - - PointingHandCursor - - - ... - - - - - - - - - - - - 20 - - - - - - 0 - 0 - - - - PointingHandCursor - - - Add - - - - - - - - 0 - 0 - - - - PointingHandCursor - - - Delete - - - - - - - - - - Trigers - - - - - 0 - -10 - 561 - 411 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - - - 20 - - - - - - 0 - 0 - - - - PointingHandCursor - - - Add - - - - - - - - 0 - 0 - - - - PointingHandCursor - - - Delete - - - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - 0 - 0 - - - - Name - - - Qt::AlignCenter - - - - - - - - - - - - - - - 0 - 0 - - - - count - - - Qt::AlignCenter - - - - - - - 0 - - - 999999999 - - - - - - - - - - - - 0 - 0 - - - - chance - - - - - - - false - - - 999999999.000000000000000 - - - - - - - - - - - - - 0 - 0 - - - - Type - - - - - - - - - 0 - 0 - - - - timer - - - - - - - false - - - - 0 - 0 - - - - 999999999.000000000000000 - - - - - - - - - - - - - - 0 - 0 - - - - ArrowCursor - - - Qt::LeftToRight - - - AlienInRadius - - - - - - - - - - 0 - 0 - - - - ArrowCursor - - - Qt::LeftToRight - - - OnDestination - - - - - - - - - - - - - - - - - - - - + + + MainWindow + + + + 0 + 0 + 598 + 489 + + + + MainWindow + + + QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks|QMainWindow::ForceTabbedDocks + + + + + 2 + + + 2 + + + + + 3 + + + + Aliens + + + + + + QAbstractItemView::AllEditTriggers + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + 0 + 0 + + + + Name + + + Qt::AlignCenter + + + + + + + + + + + + + + + 0 + 0 + + + + Health + + + Qt::AlignCenter + + + + + + + 1 + + + 0.000000000000000 + + + 999999999.000000000000000 + + + 10.000000000000000 + + + 99.000000000000000 + + + + + + + + + + + + 0 + 0 + + + + Armor + + + + + + + false + + + 999999999.000000000000000 + + + + + + + + + + + + 0 + 0 + + + + Regeneration + + + + + + + false + + + 1 + + + 999999999.000000000000000 + + + 5.000000000000000 + + + + + + + + + + + + 0 + 0 + + + + Speed + + + Qt::AlignCenter + + + + + + + + + + 5 + + + 0.000010000000000 + + + 99.000000000000000 + + + 0.010000000000000 + + + 0.010000000000000 + + + + + + + + + + + + 0 + 0 + + + + Prize + + + Qt::AlignCenter + + + + + + + 0 + + + 999999999 + + + + + + + + + + + + 0 + 0 + + + + Score + + + Qt::AlignCenter + + + + + + + 1 + + + 999999999 + + + + + + + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + Is Flying + + + + + + + + + + + + 0 + 0 + + + + Image + + + Qt::AlignCenter + + + + + + + true + + + + 0 + 0 + + + + + 48 + 32 + + + + ... + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 20 + + + + + + 0 + 0 + + + + Add + + + + + + + + 0 + 0 + + + + Delete + + + + + + + + + + Towers + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + 0 + 0 + + + + Name + + + Qt::AlignCenter + + + + + + + + + + + + + + + 0 + 0 + + + + Build time + + + Qt::AlignCenter + + + + + + + 1 + + + 999999999 + + + 50 + + + 50 + + + + + + + + + + + + 0 + 0 + + + + Cost + + + Qt::AlignCenter + + + + + + + 1 + + + 999999999 + + + + + + + + + + + + 0 + 0 + + + + Splash + + + Qt::AlignCenter + + + + + + + true + + + + + + + + 0 + 0 + + + + Edit + + + + + + + + + + + + 0 + 0 + + + + Reload + + + Qt::AlignCenter + + + + + + + 1 + + + 999999999 + + + + + + + + + + + + 0 + 0 + + + + Radius + + + Qt::AlignCenter + + + + + + + 3 + + + 1.000000000000000 + + + 0.100000000000000 + + + + + + + + + + + + 0 + 0 + + + + ExpByShot + + + + + + + 3 + + + 999999999.000000000000000 + + + + + + + + + + + + 0 + 0 + + + + ExpByDam + + + + + + + 3 + + + 999999999.000000000000000 + + + + + + + + + + + + 0 + 0 + + + + ExpByKill + + + + + + + 3 + + + 999999999.000000000000000 + + + + + + + + + + + + 0 + 0 + + + + Image + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 40 + 40 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + true + + + + 0 + 0 + + + + + 48 + 32 + + + + ... + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 20 + + + + + + 0 + 0 + + + + Add + + + + + + + + 0 + 0 + + + + Delete + + + + + + + + + + Splashes + + + + + + QAbstractItemView::AllEditTriggers + + + + + + + true + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + QLayout::SetDefaultConstraint + + + 5 + + + 5 + + + 2 + + + + + + + + 0 + 0 + + + + Name + + + Qt::AlignCenter + + + + + + + + + + + + + + + 0 + 0 + + + + Speed + + + Qt::AlignCenter + + + + + + + + + + 5 + + + 9999.000000000000000 + + + 0.001000000000000 + + + 0.010000000000000 + + + + + + + + + + + + 0 + 0 + + + + LifeTime + + + Qt::AlignCenter + + + + + + + 1 + + + 999999999 + + + 1 + + + + + + + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + AutoControl + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 0 + 0 + + + + Image + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 40 + 40 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + true + + + + 0 + 0 + + + + + 48 + 32 + + + + ... + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 20 + + + + + + 0 + 0 + + + + Add + + + + + + + + 0 + 0 + + + + Delete + + + + + + + + + + Triggers + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + 0 + 0 + + + + Name + + + Qt::AlignCenter + + + + + + + + + + + + + + + 0 + 0 + + + + Count + + + Qt::AlignCenter + + + + + + + 1 + + + 999999999 + + + + + + + + + + + + 0 + 0 + + + + Random radius + + + + + + + 3 + + + 999999999.000000000000000 + + + + + + + + + + + + 0 + 0 + + + + Chance + + + + + + + 1 + + + 100 + + + 100 + + + + + + + + + Delete parent + + + + + + + + + + 0 + 0 + + + + Child aim + + + Qt::AlignCenter + + + + + + + true + + + + + + + + + + + + 0 + 0 + + + + Type + + + Qt::AlignCenter + + + + + + + true + + + + + + + + + + + + 0 + 0 + + + + Timer + + + Qt::AlignCenter + + + + + + + 1 + + + 999999999 + + + 50 + + + 50 + + + + + + + + + + + + 0 + 0 + + + + Damage + + + + + + + 3 + + + 999999999.000000000000000 + + + + + + + + + + + + 0 + 0 + + + + Damage radius + + + + + + + 3 + + + 999999999.000000000000000 + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 20 + + + + + + 0 + 0 + + + + Add + + + + + + + + 0 + 0 + + + + Delete + + + + + + + + + + + + + Save + + + + + + + Cancel + + + + + + + + + + diff --git a/ADeditor/triggermodel.cpp b/ADeditor/triggermodel.cpp new file mode 100644 index 0000000..8912ad3 --- /dev/null +++ b/ADeditor/triggermodel.cpp @@ -0,0 +1,35 @@ +#include "triggermodel.h" + +TriggerModel::TriggerModel(QList mtriggers, QObject *parent) : + QAbstractListModel(parent) +{ + triggers = mtriggers; +} + + +void TriggerModel::refresh(QList 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(); +} diff --git a/ADeditor/triggermodel.h b/ADeditor/triggermodel.h new file mode 100644 index 0000000..5ba9b4f --- /dev/null +++ b/ADeditor/triggermodel.h @@ -0,0 +1,22 @@ +#ifndef TRIGGERMODEL_H +#define TRIGGERMODEL_H + +#include +#include "../loader.h" + +class TriggerModel : public QAbstractListModel +{ + Q_OBJECT +public: + explicit TriggerModel(QList triggers, QObject *parent = 0); + int rowCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role) const; + void refresh(QList triggers); +signals: + +public slots: +private: + QList triggers; +}; + +#endif // TRIGGERMODEL_H diff --git a/AlienDefender-readme.txt b/AlienDefender-readme.txt deleted file mode 100644 index de5d720..0000000 --- a/AlienDefender-readme.txt +++ /dev/null @@ -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. diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..4633693 --- /dev/null +++ b/CMakeLists.txt @@ -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}) diff --git a/Makefile b/Makefile deleted file mode 100644 index e0929cb..0000000 --- a/Makefile +++ /dev/null @@ -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: - diff --git a/ad_graphics.cpp b/ad_graphics.cpp new file mode 100644 index 0000000..36eecc9 --- /dev/null +++ b/ad_graphics.cpp @@ -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; imap->cells().size(); i++) { + for (int j=0; jmap->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::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; + } + } +} diff --git a/ad_graphics.h b/ad_graphics.h new file mode 100644 index 0000000..4a6598d --- /dev/null +++ b/ad_graphics.h @@ -0,0 +1,38 @@ +#ifndef AD_GRAPHICS_H +#define AD_GRAPHICS_H +#include +#include +#include +#include + +#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 > images; + //QGraphicsWidget * gsw; + +protected: + void timerEvent(QTimerEvent * ); +}; + +#endif // AD_GRAPHICS_H diff --git a/adcore.cpp b/adcore.cpp index 95b0996..444d359 100644 --- a/adcore.cpp +++ b/adcore.cpp @@ -1,40 +1,82 @@ #include "adcore.h" -adCore::adCore(QObject *parent) : - QThread(parent) +AD_Core::AD_Core(QObject *parent) : + QThread(parent) { step = 0; //admap = new Map(1); //addata = new Game_Data(admap); adloader = new Loader(); + adloader->load("data2.xml"); + //adloader->save("data2.xml"); addata = adloader->loadlevel(1); if (addata != 0) qDebug("Sucsess"); - else qDebug("Error"); - //admap->load(); - //adload->create(); - //adload->readAliens(); -// Player * pl1 = new Player(0); + else qFatal("Error"); + Player * pl1 = new Player(0); // Player * pl2 = new Player(0); -// addata->players.push_back(pl1); + addata->players.push_back(pl1); // addata->players.push_back(pl2); -// adaliens = new Aliens(addata); -// adtowers = new Towers(addata); -// adsplashes = new Splashes(addata); -// connect(admap,SIGNAL(RecreateAlienPath(bool*)),adaliens,SLOT(retrace(bool*))); -// adaliens->AddAlien(0); + adaliens = new Aliens(addata); + adtowers = new Towers(addata); + adsplashes = new Splashes(addata); + connect(addata->map,SIGNAL(recreateAlienPath(bool*)),adaliens,SLOT(retrace(bool*))); +// adaliens->addAlien(0); // adaliens->AddAlien(0); // adaliens->AddAlien(0); // for (int i=0; imapsize.width(),admap->mapsize.height()); i++) // adtowers->AddTower(0,0,QPoint(i,i)); // for (int i=0; imapsize.height();i++) // adtowers->AddTower(1,0,QPoint(admap->mapsize.width()-2,i)); + waveInProgress = false; + startTimer(50); } -void adCore::next() +void AD_Core::next() { adtowers->update(); adsplashes->update(); adaliens->update(); + waveProcessing(); 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; iwaves.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--; + } +} diff --git a/adcore.h b/adcore.h index 7a1fafc..b20b8d7 100644 --- a/adcore.h +++ b/adcore.h @@ -8,22 +8,30 @@ #include "splashes.h" #include "loader.h" -class adCore : public QThread +class AD_Core : public QThread { Q_OBJECT public: - explicit adCore(QObject *parent = 0); + explicit AD_Core(QObject *parent = 0); Game_Data * addata; Aliens * adaliens; Towers * adtowers; Splashes * adsplashes; Loader * adloader; unsigned int step; -signals: +private: + void timerEvent(QTimerEvent * ); + void waveProcessing(); + + bool waveInProgress; + int wavetime; public slots: void next(); -private: + void nextWave(); + void addTower(QPoint pos) {adtowers->addTower(0, 0, pos);}; + +signals: }; #endif // ADCORE_H diff --git a/adgraphics.odp b/adgraphics.odp new file mode 100644 index 0000000..5350e22 Binary files /dev/null and b/adgraphics.odp differ diff --git a/aliendefender b/aliendefender deleted file mode 100755 index 866784b..0000000 Binary files a/aliendefender and /dev/null differ diff --git a/aliendefender.kdev4 b/aliendefender.kdev4 new file mode 100644 index 0000000..ef3da10 --- /dev/null +++ b/aliendefender.kdev4 @@ -0,0 +1,3 @@ +[Project] +Manager=KDevCMakeManager +Name=aliendefender diff --git a/aliendefender.pro b/aliendefender.pro index 329ee30..0037ccf 100644 --- a/aliendefender.pro +++ b/aliendefender.pro @@ -6,7 +6,9 @@ HEADERS += base_types.h \ splashes.h \ adcore.h \ player.h \ - loader.h + loader.h \ + animation.h \ + ad_graphics.h SOURCES += map.cpp \ game_data.cpp \ aliens.cpp \ @@ -15,14 +17,14 @@ SOURCES += map.cpp \ splashes.cpp \ adcore.cpp \ player.cpp \ - loader.cpp + loader.cpp \ + animation.cpp \ + ad_graphics.cpp RESOURCES += images.qrc -OTHER_FILES += map.conf \ - example16x16.map \ - example16x12.map \ +OTHER_FILES += \ data.xml \ schema.xml \ - example16x16_64.map + data2.xml QT += core \ gui \ network \ diff --git a/aliendefender.pro.user b/aliendefender.pro.user index 70767dc..7122a0f 100644 --- a/aliendefender.pro.user +++ b/aliendefender.pro.user @@ -46,8 +46,8 @@ Отладка Qt4ProjectManager.Qt4BuildConfiguration 2 - C:/Users/Andrey/Desktop/aliendefender-build-desktop - 5 + C:/Users/Andrey/Desktop/build-AD + 9 2 true @@ -81,7 +81,7 @@ Qt4ProjectManager.Qt4BuildConfiguration 0 C:/Users/Andrey/Desktop/aliendefender-build-desktop - 5 + 9 2 true @@ -96,8 +96,8 @@ false false - false - + true + C:\Users\Andrey\Desktop\aliendefender 1 diff --git a/aliendefender.pro.user.2.2pre1 b/aliendefender.pro.user.2.2pre1 new file mode 100644 index 0000000..b421708 --- /dev/null +++ b/aliendefender.pro.user.2.2pre1 @@ -0,0 +1,113 @@ + + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + System + + + + ProjectExplorer.Project.Target.0 + + Настольный компьютер + Qt4ProjectManager.Target.DesktopTarget + 0 + 0 + + + qmake + QtProjectManager.QMakeBuildStep + + + + Сборка + Qt4ProjectManager.MakeStep + false + + + + 2 + + Сборка + Qt4ProjectManager.MakeStep + true + + clean + + + + 1 + false + + Отладка + Qt4ProjectManager.Qt4BuildConfiguration + 2 + C:/Users/Andrey/Desktop/aliendefender-build-desktop + 9 + 2 + true + + + + qmake + QtProjectManager.QMakeBuildStep + + + + Сборка + Qt4ProjectManager.MakeStep + false + + + + 2 + + Сборка + Qt4ProjectManager.MakeStep + true + + clean + + + + 1 + false + + Релиз + Qt4ProjectManager.Qt4BuildConfiguration + 0 + C:/Users/Andrey/Desktop/aliendefender-build-desktop + 9 + 2 + true + + 2 + + aliendefender + Qt4ProjectManager.Qt4RunConfiguration + 2 + + aliendefender.pro + false + false + + false + true + C:\Users\Andrey\Desktop\aliendefender + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 4 + + diff --git a/aliens.cpp b/aliens.cpp index fe66b6e..9aae780 100644 --- a/aliens.cpp +++ b/aliens.cpp @@ -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()) { @@ -19,12 +19,13 @@ void Aliens::AddAlien(int srcId) AlienType al;// = gameData->srcAliens.at(srcId); al.Id = nextId; al.src = srcId; - al.finish = gameData->map->Finishs().at(qrand()%gameData->map->Finishs().size()); - al.pos = QPointF(gameData->map->Starts().at(qrand()%gameData->map->Starts().size())); - al.path = gameData->map->CreatePath(al.pos.toPoint(),al.finish); + al.finish = gameData->map->finishs().at(qrand()%gameData->map->finishs().size()); + al.pos = QPointF(gameData->map->starts().at(qrand()%gameData->map->starts().size())); + al.path = gameData->map->createPath(al.pos.toPoint(),al.finish); al.pathIndex = 1; + al.animIndex = 0.f; if (al.path.isEmpty()) qFatal("ERROR create path"); - qDebug() << al.path; + //qDebug() << al.path; al.health = gameData->srcAliens.at(srcId).health; al.speed = gameData->srcAliens.at(srcId).speed; al.imgType = gameData->srcAliens.at(srcId).imgType; @@ -40,14 +41,14 @@ void Aliens::retrace(bool * OK) gameData->map->removeAliensPath(); for (int i=0; icurAliens.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; if (gameData->curAliens.values()[i].path.isEmpty()) *OK = false; } } -void Aliens::DelAlien(int Id) +void Aliens::delAlien(int Id) { gameData->curAliens.remove(Id); } @@ -69,7 +70,7 @@ void Aliens::update() al.pathIndex++; if (al.pathIndex >= al.path.size()) { - qDebug("Missing alien!"); + qDebug() << tr("Missing aliens = %1!").arg(gameData->missingAliens); missIndex.push_back(al.Id); break; } @@ -102,11 +103,11 @@ void Aliens::update() -al.speed*std::cos(arctg)); //return true; 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; jmissingAliens++; - DelAlien(missIndex.at(j)); + delAlien(missIndex.at(j)); } } diff --git a/aliens.h b/aliens.h index 568cfff..891fece 100644 --- a/aliens.h +++ b/aliens.h @@ -9,13 +9,12 @@ class Aliens : public QObject Q_OBJECT public: explicit Aliens(Game_Data * gd, QObject *parent = 0); - void AddAlien(int srcId); - void nextWave(); + void addAlien(int srcId); void update(); signals: public slots: - void DelAlien(int Id); + void delAlien(int Id); void retrace(bool * OK); private: Game_Data * gameData; diff --git a/animation.cpp b/animation.cpp new file mode 100644 index 0000000..ee3d461 --- /dev/null +++ b/animation.cpp @@ -0,0 +1,23 @@ +#include "animation.h" +#include +#include + + +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() +{ + +} + diff --git a/animation.h b/animation.h new file mode 100644 index 0000000..cef64f6 --- /dev/null +++ b/animation.h @@ -0,0 +1,19 @@ +#ifndef ANIMATION_H +#define ANIMATION_H +#include +#include + +class Animation +{ +public: + explicit Animation(const QString & path); + ~Animation(); + + QImage & at(int index) const {return *(images[index]);}; + +private: + QVector images; + +}; + +#endif // ANIMATION_H diff --git a/base_types.h b/base_types.h index cb13bc0..4cf1a3f 100644 --- a/base_types.h +++ b/base_types.h @@ -14,20 +14,6 @@ #include #include -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 path; - int pathIndex; - int imgType; -}; - struct srcAlienType { @@ -43,24 +29,19 @@ struct srcAlienType }; -struct TowerType +struct AlienType { + int Id; // uses for QHash int src; - int aim; // aim alien Id - int oldAim; - int PlayerId; // tower's owner - int imgType; - QPoint pos; // not QPointF because tower fixed on grid + QPointF pos; float angle; // -180 .. 180 - unsigned int reload; // time for reload in ticks - unsigned int build; -}; - - -struct TriggerType -{ - int src; - unsigned int timer; + float speed; // cells per tick (speed=1 is 60cells by 1 sec for 60fps e.g.) + float health; + QPoint finish; + QVector path; + int pathIndex; + int imgType; + float animIndex; }; @@ -72,7 +53,15 @@ struct srcTriggerType onTimer, 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; float damage; float radius; @@ -83,6 +72,13 @@ struct srcTriggerType }; +struct TriggerType +{ + int src; + unsigned int timer; +}; + + struct srcSplashType { 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 triggers; +}; + + struct srcTowerType { QString name; @@ -111,18 +122,17 @@ struct srcTowerType }; -struct SplashType +struct TowerType { - 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 + int aim; // aim alien Id + int oldAim; + int PlayerId; // tower's owner + int imgType; + QPoint pos; // not QPointF because tower fixed on grid float angle; // -180 .. 180 - QPointF pos; - QList triggers; + unsigned int reload; // time for reload in ticks + unsigned int build; }; diff --git a/data2.xml b/data2.xml new file mode 100644 index 0000000..1a003ff --- /dev/null +++ b/data2.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example16x12.map b/example16x12.map deleted file mode 100644 index 7394c70..0000000 Binary files a/example16x12.map and /dev/null differ diff --git a/example16x16.map b/example16x16.map deleted file mode 100644 index c57917a..0000000 Binary files a/example16x16.map and /dev/null differ diff --git a/example16x16_64.map b/example16x16_64.map deleted file mode 100644 index 5b1b119..0000000 --- a/example16x16_64.map +++ /dev/null @@ -1 +0,0 @@ -AAAERHicY2BgEGAA4v///0hQgmFmAGlGcjCxZuCTHzUDuxkMDOr85JrBwKC0A8kMJlwYagYOeYgZ+NXgNwMtPEbNINIMIsynOO8DAG0r1Q0= \ No newline at end of file diff --git a/images.qrc b/images.qrc index c6ec355..4195584 100644 --- a/images.qrc +++ b/images.qrc @@ -1,5 +1,5 @@ - + images/Aliens/Al_00_0.png images/Aliens/Al_00_1.png images/Aliens/Al_00_2.png diff --git a/loader.cpp b/loader.cpp index 8fcd349..c073e85 100644 --- a/loader.cpp +++ b/loader.cpp @@ -188,13 +188,13 @@ void Loader::save(QString filename) elem.setAttribute("randomPosRadius",trig.randomPosRadius); switch (trig.childAim) { - case tbTrigger::allSide : + case srcTriggerType::allSide : elem.setAttribute("childAim","allSide"); break; - case tbTrigger::nearlestAlien : + case srcTriggerType::nearlestAlien : elem.setAttribute("childAim","nearlestAlien"); break; - case tbTrigger::parentAim : + case srcTriggerType::parentAim : elem.setAttribute("childAim","parentAim"); break; default: @@ -203,15 +203,15 @@ void Loader::save(QString filename) } switch (trig.type) { - case tbTrigger::onTimer : - elem.setAttribute("type","onTimer"); - break; - case tbTrigger::onDestination : - elem.setAttribute("type","onDestination"); - break; - case tbTrigger::onAlienInRadius : - elem.setAttribute("type","onAlienInRadius"); - break; + case srcTriggerType::onTimer : + elem.setAttribute("type","onTimer"); + break; + case srcTriggerType::onDestination : + elem.setAttribute("type","onDestination"); + break; + case srcTriggerType::onAlienInRadius : + elem.setAttribute("type","onAlienInRadius"); + break; } } child = data.createElement("chains"); @@ -243,85 +243,152 @@ void Loader::save(QString filename) } -//Game_Data * Loader::loadlevel(int id) -//{ -// if (!levels.contains(id)) -// { -// qCritical() << tr("Error Level %1 not found!").arg(id); -// return 0; -// } -// qDebug() << tr("Loading level %1 ...").arg(levels.value(id).name); -// tbMap tbm = maps.value(levels.value(id).mapId); -// Map * map = new Map(tbm.data,tbm.size,tbm.name,tbm.maxPlayers,tbm.imgType); -// Game_Data * gd = new Game_Data(map); -// QList wollist = levWaves.values(id); -// if (wollist.isEmpty()) -// { -// qCritical() << tr("Error no waves on level!"); -// return 0; -// } -// tbWave tbw; -// tbWavePart tbwpt; -// QList wplist; -// QList alienIds; -// for (int i=0; iwaves.prepend(wt); -// wplist.clear(); -// } -// for (int i=0; iwaves.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; -// wollist.clear(); -// for (int i=0; isrcAliens.append(salt); -// qDebug() << tr("Alien %1 #%2 ").arg(salt.name).arg(i); -// } -// QList tollist = levTowers.values(id); -// tbTower tbt; -// for (int i=0; i wollist = levWaves.values(id); + if (wollist.isEmpty()) + { + qCritical() << tr("Error no waves on level!"); + return 0; + } + tbWave tbw; + tbWavePart tbwpt; + QList wplist; + QList alienIds; + for (int i=0; iwaves.prepend(wt); + wplist.clear(); + } + for (int i=0; iwaves.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; + wollist.clear(); + for (int i=0; isrcAliens.append(salt); + qDebug() << tr("Alien %1 #%2 ").arg(salt.name).arg(i); + } + QList tollist = levTowers.values(id); + tbTower tbt; + for (int i=0; i chlist = chains.values(tbt.id); + QList 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 * chlist, QList * trigIds, srcTowerType * stt, int parId, int parIndex, int * recursiveCheck) +{ + if (*recursiveCheck > 100) + { + qCritical("circle dependencies detected!"); + return; + } + for (int i=0; isize(); 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; Cells.resize(16); @@ -381,11 +448,11 @@ void Loader::readAliens() al.score = nm.namedItem("score").nodeValue().toInt(); al.isFlying = (nm.namedItem("flying").nodeValue() == "true"); 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("================"); + //qDebug("================"); } @@ -402,11 +469,11 @@ void Loader::readWaves() w.prise = nm.namedItem("prise").nodeValue().toInt(); w.timeout = nm.namedItem("timeout").nodeValue().toInt(); 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("================"); + //qDebug("================"); } @@ -435,12 +502,12 @@ void Loader::readWaveParts() if (OK) { 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("================"); + //qDebug("================"); } @@ -483,12 +550,12 @@ void Loader::readChains() if (OK) { 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("================"); + //qDebug("================"); } @@ -516,12 +583,12 @@ void Loader::readLevWaves() if (OK) { 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("================"); + //qDebug("================"); } @@ -549,12 +616,12 @@ void Loader::readLevTowers() if (OK) { 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("================"); + //qDebug("================"); } @@ -579,12 +646,12 @@ void Loader::readLevels() if (OK) { 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("================"); + //qDebug("================"); } @@ -611,26 +678,26 @@ void Loader::readTriggers() trig.delParent = (str == "true"); str = nm.namedItem("type").nodeValue(); if (str == "onDestination") - trig.type = tbTrigger::onDestination; + trig.type = srcTriggerType::onDestination; if (str == "onTimer") - trig.type = tbTrigger::onTimer; + trig.type = srcTriggerType::onTimer; if (str == "onAlienInRadius") - trig.type = tbTrigger::onAlienInRadius; + trig.type = srcTriggerType::onAlienInRadius; str = nm.namedItem("childAim").nodeValue(); - trig.childAim = tbTrigger::noAim; + trig.childAim = srcTriggerType::noAim; if (str == "allSide") - trig.childAim = tbTrigger::allSide; + trig.childAim = srcTriggerType::allSide; if (str == "parentAim") - trig.childAim = tbTrigger::parentAim; + trig.childAim = srcTriggerType::parentAim; if (str == "nearlestAlien") - trig.childAim = tbTrigger::nearlestAlien; + trig.childAim = srcTriggerType::nearlestAlien; 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) - << 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() << 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); } - qDebug("================"); + //qDebug("================"); qDebug() << tr("Found %1 triggers").arg(triggers.size()); - qDebug("================"); + //qDebug("================"); } @@ -652,11 +719,11 @@ void Loader::readSplashes() str = nm.namedItem("autoControl").nodeValue(); s.autoControl = (str == "true"); 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("================"); + //qDebug("================"); } @@ -689,13 +756,13 @@ void Loader::readTowers() if (OK) { 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) - << tr("imgType=%1 expByKill=%2 expByShot=%3 expByDamage=%4").arg(tw.imgType).arg(tw.expByKill).arg(tw.expByShot).arg(tw.expByDamage); + //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); } } - qDebug("================"); + //qDebug("================"); 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.setHeight(mn.namedItem("height").nodeValue().toInt()); 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("================"); + //qDebug("================"); } void Loader::validate(QString filename) { - QFile sfile("schema.xml"); + QFile sfile("schema.xml"); if (!sfile.open(QIODevice::ReadOnly)) qFatal("No file schema.xml found!"); QXmlSchema schema; diff --git a/loader.h b/loader.h index d4fa9cb..4c5cc57 100644 --- a/loader.h +++ b/loader.h @@ -10,8 +10,8 @@ struct tbHeader { - int id; - QString name; + int id; + QString name; }; struct tbAlien : tbHeader @@ -36,26 +36,12 @@ struct tbSplash : tbHeader struct tbTrigger : tbHeader { - enum triggerType - { - onDestination, - onTimer, - onAlienInRadius - }; - - enum aimType - { - noAim, - parentAim, - allSide, - nearlestAlien - }; float damage; float radius; int chance; bool delParent; - aimType childAim; - triggerType type; + srcTriggerType::aimType childAim; + srcTriggerType::triggerType type; unsigned int timer; int count; float randomPosRadius; @@ -191,8 +177,9 @@ private: void readWaveParts(); void readUpgrades(); + void fillTowerChains(QList * chlist, QList * trigIds, srcTowerType * stt, int parId, int parIndex, int * recursiveCheck); void validate(QString filename); - QString CreateMapExample(); + QString createMapExample(); }; #endif // LOADER_H diff --git a/main.cpp b/main.cpp index 90d76b6..9fc0b77 100644 --- a/main.cpp +++ b/main.cpp @@ -2,14 +2,17 @@ #include #include "adcore.h" +#include "ad_graphics.h" int main(int argc, char *argv[]) { - adCore core; QApplication a(argc, argv); + AD_Core core; + AD_Graphics graphics(&core); + graphics.resize(800,600); //QTimer * timer = new QTimer(); //QObject::connect(timer,SIGNAL(timeout()),&core,SLOT(next())); //timer->start(100); - //return a.exec(); + return a.exec(); } diff --git a/map.conf b/map.conf deleted file mode 100644 index d96209b..0000000 --- a/map.conf +++ /dev/null @@ -1,3 +0,0 @@ -cells path = example16x16.map -max players = 2 - diff --git a/map.cpp b/map.cpp index 45b41c4..0da1fae 100644 --- a/map.cpp +++ b/map.cpp @@ -27,11 +27,12 @@ Map::Map(QByteArray data, QSize size, QString name, int maxPlayers, int image, Q } for (int j=0; j Map::CreatePath(QPoint start, QPoint finish) +QVector Map::createPath(QPoint start, QPoint finish) { QPointF tp; QVector srcPath; @@ -175,7 +176,7 @@ QVector Map::CreatePath(QPoint start, QPoint finish) //PathIndex = 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); - srcPath = InvWaveTrace(finish,WaveTrace(start,finish)); + srcPath = invWaveTrace(finish,waveTrace(start,finish)); for (int i=0; i Map::CreatePath(QPoint start, QPoint finish) } -int Map::WaveTrace(QPoint start, QPoint finish) +int Map::waveTrace(QPoint start, QPoint finish) { bool stop = false; int step = 2; @@ -251,29 +252,37 @@ int Map::WaveTrace(QPoint start, QPoint finish) } tp.setX(cp.x() - 1); tp.setY(cp.y()); - if (fr.contains(tp) && TmpCells[tp.x()][tp.y()] == 0) { - TmpCells[tp.x()][tp.y()] = step; - curp.push_back(tp); - stop = false; + if (fr.contains(tp)) { + if (TmpCells[tp.x()][tp.y()] == 0) { + TmpCells[tp.x()][tp.y()] = step; + curp.push_back(tp); + stop = false; + } } tp.setX(cp.x() + 1); - if (fr.contains(tp) && TmpCells[tp.x()][tp.y()] == 0) { - TmpCells[tp.x()][tp.y()] = step; - curp.push_back(tp); - stop = false; + if (fr.contains(tp)) { + if (TmpCells[tp.x()][tp.y()] == 0) { + TmpCells[tp.x()][tp.y()] = step; + curp.push_back(tp); + stop = false; + } } tp.setX(cp.x()); tp.setY(cp.y() - 1); - if (fr.contains(tp) && TmpCells[tp.x()][tp.y()] == 0) { - TmpCells[tp.x()][tp.y()] = step; - curp.push_back(tp); - stop = false; + if (fr.contains(tp)) { + if (TmpCells[tp.x()][tp.y()] == 0) { + TmpCells[tp.x()][tp.y()] = step; + curp.push_back(tp); + stop = false; + } } tp.setY(cp.y() + 1); - if (fr.contains(tp) && TmpCells[tp.x()][tp.y()] == 0) { - TmpCells[tp.x()][tp.y()] = step; - curp.push_back(tp); - stop = false; + if (fr.contains(tp)) { + if (TmpCells[tp.x()][tp.y()] == 0) { + TmpCells[tp.x()][tp.y()] = step; + curp.push_back(tp); + stop = false; + } } } step++; @@ -284,7 +293,7 @@ int Map::WaveTrace(QPoint start, QPoint finish) } -QVector Map::InvWaveTrace(QPoint finish, int cnt) +QVector Map::invWaveTrace(QPoint finish, int cnt) { QPoint wp, Ppnt; QVector alpath; diff --git a/map.h b/map.h index cb25872..f4ed22f 100644 --- a/map.h +++ b/map.h @@ -35,14 +35,15 @@ public: bool isFreePlace(QPoint pos); void delTowerOnMap(QPoint pos); void removeAliensPath(); - QVector CreatePath(QPoint start, QPoint finish); - QRect Rect() const {return QRect(QPoint(),mapSize);} + QVector createPath(QPoint start, QPoint finish); + QRect rect() const {return QRect(QPoint(),mapSize);} // QString name() const {return mapName;} - QList Starts() const {return starts;} - QList Finishs() const {return finishs;} - int Image() const {return imageType;} + QList starts() const {return Starts;} + QList finishs() const {return Finishs;} + QVector < QVector > cells() const {return Cells;} + int image() const {return imageType;} signals: - void RecreateAlienPath(bool * pathOK); + void recreateAlienPath(bool * pathOK); public slots: void printMap(); @@ -52,13 +53,13 @@ private: int players; int imageType; QVector < QVector > Cells; - QList starts; - QList finishs; + QList Starts; + QList Finishs; QVector < QVector > TmpCells; - QVector InvWaveTrace(QPoint finish, int cnt); - int WaveTrace(QPoint start, QPoint finish); + QVector invWaveTrace(QPoint finish, int cnt); + int waveTrace(QPoint start, QPoint finish); //void CreateMapExample(); //void ReadSettings(); }; diff --git a/schema.xml b/schema.xml index 5611a66..c9e29a2 100644 --- a/schema.xml +++ b/schema.xml @@ -110,8 +110,8 @@ - - + + diff --git a/splashes.cpp b/splashes.cpp index 86b6dbd..5a05d86 100644 --- a/splashes.cpp +++ b/splashes.cpp @@ -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()) { @@ -23,7 +23,7 @@ bool Splashes::AddSplash(int srcId, QPointF pos) spl.TowerId = QPoint(-1,-1); spl.life = 0; 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"); return false; @@ -33,7 +33,7 @@ bool Splashes::AddSplash(int srcId, QPointF pos) spl.angle = 0; spl.destination = pos; TriggerType trig; - for(int i; isrTriggers.at(src.triggerIndexes.at(i)).timer; 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; spl.Id = nextId; @@ -63,7 +63,7 @@ void Splashes::AddSplash(srcSplashType src, int index, TowerType tw) spl.life = 0; spl.src = index; TriggerType trig; - for(int i; iplayers.at(tw.PlayerId)->srcTowers.at(tw.src).triggers.at(src.triggerIndexes.at(i)).timer; trig.src = src.triggerIndexes.at(i); @@ -76,13 +76,13 @@ void Splashes::AddSplash(srcSplashType src, int index, TowerType tw) void Splashes::update() { - for (int i; icurSplashes.size(); i++) + for (int i=0; icurSplashes.size(); i++) { SplashType spl = gameData->curSplashes.values().at(i); bool isTowerSplash = false; srcSplashType src; TowerType tw; - if (gameData->map->Rect().contains(spl.TowerId)) + if (gameData->map->rect().contains(spl.TowerId)) { if (gameData->curTowers.contains(spl.TowerId)) { diff --git a/splashes.h b/splashes.h index e124e92..d8bc002 100644 --- a/splashes.h +++ b/splashes.h @@ -8,13 +8,13 @@ class Splashes : public QObject Q_OBJECT public: explicit Splashes(Game_Data * gd, QObject *parent = 0); - bool AddSplash(int srcId, QPointF pos); - void DelSplash(int Id); + bool addSplash(int srcId, QPointF pos); + void delSplash(int Id); void update(); signals: public slots: - void AddSplash(srcSplashType src, int index, TowerType tw); + void addSplash(srcSplashType src, int index, TowerType tw); private: Game_Data *gameData; diff --git a/towers.cpp b/towers.cpp index 8469c40..a9625e7 100644 --- a/towers.cpp +++ b/towers.cpp @@ -6,7 +6,7 @@ Towers::Towers(Game_Data *gd, QObject *parent) : gameData = gd; } -bool Towers::AddTower(int playerId, int srcId, QPoint pos) +bool Towers::addTower(int playerId, int srcId, QPoint pos) { //QByteArray ar; //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); } @@ -48,7 +48,7 @@ void Towers::DelTower(QPoint pos) void Towers::update() { - for (int i; icurTowers.size(); i++) + for (int i=0; icurTowers.size(); i++) { TowerType tw = gameData->curTowers.values().at(i); srcTowerType stw = gameData->players.at(tw.PlayerId)->srcTowers.at(tw.src); diff --git a/towers.h b/towers.h index d934ea5..23aeab4 100644 --- a/towers.h +++ b/towers.h @@ -8,8 +8,8 @@ class Towers : public QObject Q_OBJECT public: explicit Towers(Game_Data * gd, QObject *parent = 0); - bool AddTower(int playerId, int srcId, QPoint pos); - void DelTower(QPoint pos); + bool addTower(int playerId, int srcId, QPoint pos); + void delTower(QPoint pos); void update(); signals: void shot(srcSplashType src, int index, TowerType tw);