mirror of
https://github.com/KranX/Vangers.git
synced 2025-12-01 07:25:28 +07:00
surmap: changes to work with latest version
This commit is contained in:
@@ -88,3 +88,4 @@ ADD_SUBDIRECTORY("lib/xsound")
|
||||
ADD_SUBDIRECTORY("lib/xtool")
|
||||
ADD_SUBDIRECTORY("lib/utils")
|
||||
ADD_SUBDIRECTORY("server")
|
||||
ADD_SUBDIRECTORY("surmap")
|
||||
|
||||
@@ -1770,6 +1770,9 @@ void vrtMap::scaling(int XSrcSize,int cx,int cy,int xc,int yc,int xside,int ysid
|
||||
uchar* data;
|
||||
debug_view = 10;
|
||||
if(DepthShow)
|
||||
//@caiiiycuk: there is something wrong with clipping in XCYCL & YCYCL
|
||||
// in depth mode there are out of bounds mem reads. I think it's because
|
||||
// clip_mask is not calculated correctly, but why???
|
||||
for(i = 0;i < ysize;i++){
|
||||
YSrc = (ysize - 2*i)*XSrcSize/xsize;
|
||||
fx = (cx << 16) - DEPTH((XSrcSize << 0x10)/2,i) + (1 << 15);
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
#include "..\global.h"
|
||||
#pragma hdrstop
|
||||
#include "../src/global.h"
|
||||
|
||||
#include "general.h"
|
||||
#include "3d_shape.h"
|
||||
|
||||
#include "..\common.h"
|
||||
#include "../src/common.h"
|
||||
|
||||
#include "..\terra\vmap.h"
|
||||
#include "..\terra\world.h"
|
||||
#include "..\terra\render.h"
|
||||
#include "../src/terra/vmap.h"
|
||||
#include "../src/terra/world.h"
|
||||
#include "../src/terra/render.h"
|
||||
|
||||
#include "../src/3d/3d_math.h"
|
||||
#include "../src/3d/3dgraph.h"
|
||||
|
||||
#include "missed.h"
|
||||
|
||||
//#define _SHAPE_
|
||||
|
||||
@@ -53,18 +56,18 @@ int shape_control(int code)
|
||||
return 0;
|
||||
|
||||
switch(code){
|
||||
case VK_ESCAPE:
|
||||
case SDLK_ESCAPE:
|
||||
catch_log = 0;
|
||||
break;
|
||||
|
||||
case VK_SPACE:
|
||||
case SDLK_SPACE:
|
||||
A_shape = DBM(1,-1,-1,DIAGONAL);
|
||||
A_shape_inv = DBM(1,-1,1,DIAGONAL);
|
||||
if(XKey.Pressed(VK_CONTROL))
|
||||
if(XKey.Pressed(SDLK_LCTRL))
|
||||
shape_scale_x = shape_scale_y = shape_scale_z = 1;
|
||||
break;
|
||||
|
||||
case VK_RETURN:
|
||||
case SDLK_RETURN:
|
||||
shape.height_project();
|
||||
catch_log = 0;
|
||||
#ifdef _SURMAP_
|
||||
@@ -75,9 +78,9 @@ int shape_control(int code)
|
||||
|
||||
int rotate_step;
|
||||
int move_step;
|
||||
int alt = XKey.Pressed(VK_CONTROL);
|
||||
int alt = XKey.Pressed(SDLK_LCTRL);
|
||||
double scale_step;
|
||||
if(XKey.Pressed(VK_SHIFT)){
|
||||
if(XKey.Pressed(SDLK_LSHIFT)){
|
||||
move_step = 20;
|
||||
rotate_step = Pi/8;
|
||||
scale_step = 1.1;
|
||||
@@ -88,41 +91,42 @@ int shape_control(int code)
|
||||
scale_step = 1.001;
|
||||
}
|
||||
|
||||
if(XKey.Pressed(VK_DELETE)){
|
||||
if(XKey.Pressed(SDLK_DELETE)){
|
||||
A_shape = DBM(-rotate_step,Z_AXIS)*A_shape;
|
||||
A_shape_inv *= DBM(rotate_step,Z_AXIS);
|
||||
}
|
||||
if(XKey.Pressed(VK_NEXT)){
|
||||
//@caiiiycuk: was VK_NEXT
|
||||
if(XKey.Pressed(SDLK_RETURN2)){
|
||||
A_shape = DBM(rotate_step,Z_AXIS)*A_shape;
|
||||
A_shape_inv *= DBM(-rotate_step,Z_AXIS);
|
||||
}
|
||||
|
||||
if(XKey.Pressed(VK_HOME)){
|
||||
if(XKey.Pressed(SDLK_HOME)){
|
||||
A_shape = DBM(-rotate_step,X_AXIS)*A_shape;
|
||||
A_shape_inv *= DBM(rotate_step,X_AXIS);
|
||||
}
|
||||
if(XKey.Pressed(VK_END)){
|
||||
if(XKey.Pressed(SDLK_END)){
|
||||
A_shape = DBM(rotate_step,X_AXIS)*A_shape;
|
||||
A_shape_inv *= DBM(-rotate_step,X_AXIS);
|
||||
}
|
||||
|
||||
if(XKey.Pressed(VK_INSERT)){
|
||||
if(XKey.Pressed(SDLK_INSERT)){
|
||||
A_shape = DBM(rotate_step,Y_AXIS)*A_shape;
|
||||
A_shape_inv *= DBM(-rotate_step,Y_AXIS);
|
||||
}
|
||||
if(XKey.Pressed(VK_PRIOR)){
|
||||
if(XKey.Pressed(SDLK_PRIOR)){
|
||||
A_shape = DBM(-rotate_step,Y_AXIS)*A_shape;
|
||||
A_shape_inv *= DBM(rotate_step,Y_AXIS);
|
||||
}
|
||||
|
||||
if(XKey.Pressed(VK_ADD) || XKey.Pressed(VK_OEM_PLUS)){
|
||||
if(XKey.Pressed(SDLK_PLUS) || XKey.Pressed(SDLK_KP_PLUS)){
|
||||
if(!alt){
|
||||
shape_scale_x *= scale_step;
|
||||
shape_scale_y *= scale_step;
|
||||
}
|
||||
shape_scale_z *= scale_step;
|
||||
}
|
||||
if(XKey.Pressed(VK_SUBTRACT) || XKey.Pressed(VK_OEM_MINUS)){
|
||||
if(XKey.Pressed(SDLK_MINUS) || XKey.Pressed(SDLK_KP_MINUS)){
|
||||
if(!alt){
|
||||
shape_scale_x /= scale_step;
|
||||
shape_scale_y /= scale_step;
|
||||
@@ -130,22 +134,22 @@ int shape_control(int code)
|
||||
shape_scale_z /= scale_step;
|
||||
}
|
||||
|
||||
if(XKey.Pressed(VK_UP))
|
||||
if(XKey.Pressed(SDLK_UP))
|
||||
if(alt)
|
||||
shape_scale_y *= scale_step;
|
||||
else
|
||||
shape.y_off -= move_step;
|
||||
if(XKey.Pressed(VK_DOWN))
|
||||
if(XKey.Pressed(SDLK_DOWN))
|
||||
if(alt)
|
||||
shape_scale_y /= scale_step;
|
||||
else
|
||||
shape.y_off += move_step;
|
||||
if(XKey.Pressed(VK_LEFT))
|
||||
if(XKey.Pressed(SDLK_LEFT))
|
||||
if(alt)
|
||||
shape_scale_x /= scale_step;
|
||||
else
|
||||
shape.x_off -= move_step;
|
||||
if(XKey.Pressed(VK_RIGHT))
|
||||
if(XKey.Pressed(SDLK_RIGHT))
|
||||
if(alt)
|
||||
shape_scale_x *= scale_step;
|
||||
else
|
||||
@@ -326,6 +330,7 @@ void Model::draw_big()
|
||||
for(register int i = 0;i < num_vert;i++)
|
||||
vertices[i].convert_big();
|
||||
|
||||
int i;
|
||||
for(i = 0;i < num_norm;i++)
|
||||
normals[i].fast_calc_intensity();
|
||||
|
||||
@@ -575,6 +580,7 @@ void Model::height_project()
|
||||
memset(upper_buffer,0,shape_size << shape_shift);
|
||||
memset(lower_buffer,255,shape_size << shape_shift);
|
||||
|
||||
int i;
|
||||
for(i = 0;i < num_vert;i++){
|
||||
vertices[i].xscr = vertices[i].turned.x - x_min;
|
||||
vertices[i].yscr = vertices[i].turned.y - y_min;
|
||||
|
||||
58
surmap/CMakeLists.txt
Normal file
58
surmap/CMakeLists.txt
Normal file
@@ -0,0 +1,58 @@
|
||||
INCLUDE_DIRECTORIES(AFTER
|
||||
"${PROJECT_SOURCE_DIR}/lib/xtool"
|
||||
"${PROJECT_SOURCE_DIR}/lib/xgraph"
|
||||
"${PROJECT_SOURCE_DIR}"
|
||||
)
|
||||
|
||||
SET(surmap_SRCS
|
||||
3d_shape.cpp
|
||||
dsidernd.cpp
|
||||
impass.cpp
|
||||
siderend.cpp
|
||||
sqexp.cpp
|
||||
sqibody.cpp
|
||||
sqicore.cpp
|
||||
sqimenu.cpp
|
||||
surmap.cpp
|
||||
tools.cpp
|
||||
track.cpp
|
||||
world.cpp
|
||||
|
||||
missed.cpp
|
||||
)
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(${surmap_SRCS}
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
"-Wno-parentheses -Wno-unused-variable -Wno-unused-parameter -Wno-register -Wno-dangling-else")
|
||||
|
||||
SET(vangers_surmap_SRCS
|
||||
"${PROJECT_SOURCE_DIR}/src/3d/3dobject.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/3d/3d_math.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/3d/3dgraph.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/3d/dynamics.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/3d/optimize.cpp"
|
||||
|
||||
|
||||
"${PROJECT_SOURCE_DIR}/src/terra/land.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/terra/splay.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/terra/vmap.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/units/moveland.cpp"
|
||||
|
||||
"${PROJECT_SOURCE_DIR}/src/palette.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/dast/poly3d.cpp"
|
||||
|
||||
"${PROJECT_SOURCE_DIR}/src/rle.cpp"
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(surmap ${surmap_SRCS} ${vangers_surmap_SRCS})
|
||||
SET_SOURCE_FILES_PROPERTIES(${vangers_surmap_SRCS}
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
"-Wno-parentheses -Wno-unused-variable -Wno-unused-parameter -Wno-dangling-else")
|
||||
|
||||
TARGET_COMPILE_DEFINITIONS(surmap PUBLIC _SURMAP_ _SURMAP_ROUGH_)
|
||||
|
||||
TARGET_LINK_LIBRARIES(surmap
|
||||
${SDL2_LIBRARY}
|
||||
xtool
|
||||
xgraph
|
||||
)
|
||||
7
surmap/README.md
Normal file
7
surmap/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
Основные ключи:
|
||||
* /0 - /2: разрешения (/2 самое большое)
|
||||
* /G* - открыть при запуске мир с указанным номером. Нумерация от 0, в таком порядке, в каком миры прописаны в wrlds.dat (например, /G8;
|
||||
* /I* - инициализировать новый ландшафт для мира в соответствии с параметрами из последнего блока world.ini, вместо звёздочки — размер мира по вертикали (степень двойки). Например, /I14 — инициализировать ландшафт размером с Фострал. Нужно не забыть попутно ключом /G* указать тот мир, ландшафт которого вы будете затирать.
|
||||
|
||||
Новые миры нужно дописывать в wrlds.dat и создавать им соответствующую папку в thechain.
|
||||
Минимум файлов — world.ini, harmony.pal, output.vmp/vmc, output.vpr.
|
||||
@@ -1,11 +1,10 @@
|
||||
#include "..\global.h"
|
||||
#pragma hdrstop
|
||||
#include "../src/global.h"
|
||||
|
||||
#include "..\common.h"
|
||||
#include "..\3d\3d_math.h"
|
||||
#include "..\terra\vmap.h"
|
||||
#include "..\terra\world.h"
|
||||
#include "..\terra\render.h"
|
||||
#include "../src/common.h"
|
||||
#include "../src/3d/3d_math.h"
|
||||
#include "../src/terra/vmap.h"
|
||||
#include "../src/terra/world.h"
|
||||
#include "../src/terra/render.h"
|
||||
|
||||
#define MEMSET(a,b,c) memset(a,b,c)
|
||||
|
||||
@@ -214,15 +213,15 @@ void regDownRender(int LowX,int LowY,int HiX,int HiY,int changed)
|
||||
int LastStep = (H_SIZE - 1 - HiX) * SHADOWDEEP;
|
||||
LastStep -= ((LastStep >> POSPOWER) - MAX_ALT) << POSPOWER;
|
||||
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//препроход
|
||||
downPreStage(LastStep,HiX,pa0,hC,shadowParent);
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//основной проход
|
||||
int x = HiX;
|
||||
BYTE* grid = shadowParent + MAX_ALT;
|
||||
int MaxAlt = 0;
|
||||
downMainStage(pa0,hC,pc0,SizeX,x,grid,MaxAlt);
|
||||
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//пост проход
|
||||
{
|
||||
x |= 1;
|
||||
BYTE* pa = pa0 + x;
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
#include "..\global.h"
|
||||
#pragma hdrstop
|
||||
#include "../src/global.h"
|
||||
|
||||
#include "..\common.h"
|
||||
#include "../src/common.h"
|
||||
|
||||
#include "..\3d\3d_math.h"
|
||||
#include "../src/3d/3d_math.h"
|
||||
|
||||
#include "..\terra\vmap.h"
|
||||
#include "../src/terra/vmap.h"
|
||||
#include "impass.h"
|
||||
#include "..\terra\world.h"
|
||||
#include "..\terra\render.h"
|
||||
#include "../src/terra/world.h"
|
||||
#include "../src/terra/render.h"
|
||||
|
||||
/* ----------------------------- EXTERN SECTION ---------------------------- */
|
||||
/* --------------------------- PROTOTYPE SECTION --------------------------- */
|
||||
@@ -29,7 +28,7 @@ static uchar PeakData[PEAK_SIZE*PEAK_SIZE] = {
|
||||
ImpassType* ImpPattern[IMP_MAX];
|
||||
#ifdef _SURMAP_
|
||||
int curImpIndex;
|
||||
char* ImpItem[IMP_MAX] = {
|
||||
const char* ImpItem[IMP_MAX] = {
|
||||
"SPHERE",
|
||||
"POLYGON",
|
||||
"PEAK"
|
||||
@@ -267,7 +266,7 @@ void ImpPolygon::build(void)
|
||||
else *p += level;
|
||||
}
|
||||
}
|
||||
delete zzz;
|
||||
delete[] zzz;
|
||||
}
|
||||
|
||||
ImpPeak::ImpPeak(int _sx,int _sy,int _force,int _mode,int _level,int _rad,int _h,int _n,int _phase,int _inverse,int _plain,int _noiseLevel,int _noiseAmp)
|
||||
|
||||
@@ -12,7 +12,7 @@ void ImpassSave(void);
|
||||
extern ImpassType* ImpPattern[IMP_MAX];
|
||||
#ifdef _SURMAP_
|
||||
extern int curImpIndex;
|
||||
extern char* ImpItem[IMP_MAX];
|
||||
extern const char* ImpItem[IMP_MAX];
|
||||
#endif
|
||||
|
||||
struct ImpassType {
|
||||
|
||||
195
surmap/missed.cpp
Normal file
195
surmap/missed.cpp
Normal file
@@ -0,0 +1,195 @@
|
||||
//
|
||||
// Created by caiiiycuk on 15.01.2021.
|
||||
//
|
||||
#include <SDL.h>
|
||||
#include <unordered_map>
|
||||
|
||||
typedef unsigned char uchar;
|
||||
|
||||
#include "xglobal.h"
|
||||
#include "xstream.h"
|
||||
#include "xtcore.h"
|
||||
|
||||
#include "../src/3d/3d_math.h"
|
||||
#include "../src/3d/3dobject.h"
|
||||
#include "../src/3d/parser.h"
|
||||
#include "../src/actint/item_api.h"
|
||||
#include "../src/common.h"
|
||||
#include "../src/dast/poly3d.h"
|
||||
#include "../src/units/hobj.h"
|
||||
#include "../src/units/uvsapi.h"
|
||||
#include "../src/units/items.h"
|
||||
#include "../src/lang.h"
|
||||
#include "../src/network.h"
|
||||
#include "../src/sound/hsound.h"
|
||||
#include "../src/xjoystick.h"
|
||||
|
||||
#include "missed.h"
|
||||
|
||||
extern "C" {
|
||||
#include <iniparser/iniparser.h>
|
||||
}
|
||||
|
||||
int NetworkON = 0;
|
||||
int debug_view = 0;
|
||||
|
||||
char * iniparser_getstring_surmap(void * d, const char * cat, const char * key) {
|
||||
return iniparser_getstring((dictionary*) d, (std::string(cat) + ":" + key).c_str(), NULL);
|
||||
}
|
||||
|
||||
XConWrapper& XConWrapper::operator<(const char* str) {
|
||||
printf("%s", str);
|
||||
return *this;
|
||||
}
|
||||
|
||||
XConWrapper& XConWrapper::operator<=(int value) {
|
||||
printf("%d", value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
XConWrapper XCon;
|
||||
|
||||
XKeyWrapper* keyWrapper = 0;
|
||||
std::function<void(int)> keyHandler;
|
||||
std::unordered_map<int, bool> keyStates;
|
||||
void onKeyDown(SDL_Event* e) {
|
||||
if (!keyHandler || e->type != SDL_KEYDOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
keyHandler(e->key.keysym.sym);
|
||||
keyStates[e->key.keysym.sym] = true;
|
||||
}
|
||||
void onKeyUp(SDL_Event* e) {
|
||||
if (!keyHandler || e->type != SDL_KEYUP) {
|
||||
return;
|
||||
}
|
||||
keyStates[e->key.keysym.sym] = false;
|
||||
}
|
||||
XKeyWrapper::XKeyWrapper() {
|
||||
keyWrapper = this;
|
||||
}
|
||||
void XKeyWrapper::init(std::function<void(int)> handlerFn, void*) {
|
||||
set_key_handlers(onKeyDown, onKeyUp);
|
||||
keyHandler = handlerFn;
|
||||
}
|
||||
void XKeyWrapper::finit() {
|
||||
}
|
||||
bool XKeyWrapper::Pressed(int sdlkKey) {
|
||||
return keyStates[sdlkKey] == true;
|
||||
}
|
||||
|
||||
XKeyWrapper XKey;
|
||||
|
||||
void mainWinMinimize() {
|
||||
}
|
||||
|
||||
void mainWinMaximize() {
|
||||
}
|
||||
|
||||
//http://www.delorie.com/djgpp/doc/libc/libc_166.html
|
||||
char* win32_findfirst(const char* mask) {
|
||||
// @caiiiycuk TODO read links
|
||||
abort();
|
||||
}
|
||||
//http://www.delorie.com/djgpp/doc/libc/libc_167.html
|
||||
char* win32_findnext() {
|
||||
// @caiiiycuk TODO read links
|
||||
abort();
|
||||
}
|
||||
|
||||
|
||||
// unused methods
|
||||
void setLang(Language lang) {}
|
||||
void StartEFFECT(EFFECT_VALUE EffectValue,int loop, int pan) {}
|
||||
int iKeyPressed(int id) {
|
||||
return 0;
|
||||
}
|
||||
int XJoystickInput() {
|
||||
return 0;
|
||||
}
|
||||
void SetMotorSound(int speed) {}
|
||||
InputEventBuffer::InputEventBuffer(unsigned int size): XBuffer(size) {}
|
||||
OutputEventBuffer::OutputEventBuffer(unsigned int size): XBuffer(size) {}
|
||||
|
||||
// unimplemented methods, I think that they are unused but not sure
|
||||
DebrisObject* DebrisList::CreateDebris(void) {
|
||||
abort();
|
||||
}
|
||||
void DebrisObject::CreateDebris(int id,int ind) {
|
||||
abort();
|
||||
}
|
||||
void DrawMechosBody(int x,int y,int speed,int level) {
|
||||
abort();
|
||||
}
|
||||
void DrawMechosParticle(int x,int y,int speed,int level,int n,Object* p) {
|
||||
abort();
|
||||
}
|
||||
int CheckStartJump(Object* p) {
|
||||
abort();
|
||||
}
|
||||
void Object::destroy_double_level() {
|
||||
abort();
|
||||
}
|
||||
void UnitBaseListType::ConnectTypeList(GeneralObject* p) {
|
||||
abort();
|
||||
}
|
||||
void UnitBaseListType::DisconnectTypeList(GeneralObject* p) {
|
||||
abort();
|
||||
}
|
||||
void UnitListType::ConnectTypeList(GeneralObject* p) {
|
||||
abort();
|
||||
}
|
||||
void UnitListType::DisconnectTypeList(GeneralObject* p) {
|
||||
abort();
|
||||
}
|
||||
void UnitListType::Init(void) {
|
||||
abort();
|
||||
}
|
||||
void UnitListType::Free(void) {
|
||||
abort();
|
||||
}
|
||||
void UnitListType::Quant(void) {
|
||||
abort();
|
||||
}
|
||||
void UnitListType::NetEvent(int type,int id) {
|
||||
abort();
|
||||
}
|
||||
void UnitListType::FreeUnit(GeneralObject* p) {
|
||||
abort();
|
||||
}
|
||||
|
||||
// unused variables having it to avoid undefined reference errors
|
||||
DebrisList DebrisD;
|
||||
InputEventBuffer events_in(1);
|
||||
OutputEventBuffer events_out(1);
|
||||
XJOYSTATE XJoystickState;
|
||||
uchar DestroyTerrainTable[TERRAIN_MAX];
|
||||
uchar DestroyMoleTable[TERRAIN_MAX];
|
||||
int JoystickStickSwitchButton = 0;
|
||||
int JoystickMode = 0;
|
||||
double camera_mi = 0;
|
||||
double camera_miz = 0;
|
||||
double camera_mit = 0;
|
||||
double camera_mii = 0;
|
||||
double camera_mis = 0;
|
||||
double camera_drag = 0;
|
||||
double camera_dragz = 0;
|
||||
double camera_dragt = 0;
|
||||
double camera_dragi = 0;
|
||||
double camera_drags = 0;
|
||||
double camera_vz_min = 0;
|
||||
double camera_vt_min = 0;
|
||||
double camera_vs_min = 0;
|
||||
int camera_turn_impulse = 0;
|
||||
int max_time_vibration = 0;
|
||||
double A_vibration = 0;
|
||||
double alpha_vibration = 0;
|
||||
double oscillar_vibration = 0;
|
||||
int SoundFlag = 0;
|
||||
char WorldBorderEnable = 0;
|
||||
int aciCurJumpImpulse = 0;
|
||||
int aciMaxJumpImpulse = 0;
|
||||
int aciKeyboardLocked = 0;
|
||||
int aciAutoRun = 0;
|
||||
int EngineNoise = 0;
|
||||
33
surmap/missed.h
Normal file
33
surmap/missed.h
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// Created by caiiiycuk on 15.01.2021.
|
||||
//
|
||||
|
||||
#ifndef SURMAP_MISSED_H
|
||||
#define SURMAP_MISSED_H
|
||||
|
||||
#include <functional>
|
||||
|
||||
#define CLOCK() (SDL_GetTicks()*18/1000)
|
||||
|
||||
class XKeyWrapper {
|
||||
public:
|
||||
XKeyWrapper();
|
||||
void init(std::function<void(int)> handlerFn, void*);
|
||||
void finit();
|
||||
bool Pressed(int sdlkKey);
|
||||
};
|
||||
|
||||
class XConWrapper {
|
||||
public:
|
||||
XConWrapper& operator<(const char* str);
|
||||
XConWrapper& operator<=(int value);
|
||||
};
|
||||
|
||||
char *iniparser_getstring_surmap(/*dictionary*/ void * d, const char * cat, const char * key);
|
||||
void mainWinMinimize();
|
||||
void mainWinMaximize();
|
||||
|
||||
extern XKeyWrapper XKey;
|
||||
extern XConWrapper XCon;
|
||||
|
||||
#endif // SURMAP_MISSED_H
|
||||
@@ -1,11 +1,10 @@
|
||||
#include "..\global.h"
|
||||
#pragma hdrstop
|
||||
#include "../src/global.h"
|
||||
|
||||
#include "..\common.h"
|
||||
#include "..\3d\3d_math.h"
|
||||
#include "..\terra\vmap.h"
|
||||
#include "..\terra\world.h"
|
||||
#include "..\terra\render.h"
|
||||
#include "../src/common.h"
|
||||
#include "../src/3d/3d_math.h"
|
||||
#include "../src/terra/vmap.h"
|
||||
#include "../src/terra/world.h"
|
||||
#include "../src/terra/render.h"
|
||||
|
||||
#define MEMSET(a,b,c) memset(a,b,c)
|
||||
|
||||
@@ -260,15 +259,15 @@ void regRender(int LowX,int LowY,int HiX,int HiY,int changed)
|
||||
int LastStep = (H_SIZE - 1 - HiX) * SHADOWDEEP;
|
||||
LastStep -= ((LastStep >> POSPOWER) - MAX_ALT) << POSPOWER;
|
||||
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//препроход
|
||||
PreStage(LastStep,HiX,pa0,hC,shadowParent + MAX_ALT);
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//основной проход
|
||||
int x = HiX;
|
||||
BYTE* grid = shadowParent + MAX_ALT + MAX_ALT;
|
||||
int MaxAlt = 0;
|
||||
MainStage(pa0,hC,pc0,SizeX,x,grid,MaxAlt);
|
||||
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//пост проход
|
||||
{
|
||||
x |= 1;
|
||||
BYTE* pa = pa0 + x;
|
||||
|
||||
116
surmap/sqexp.cpp
116
surmap/sqexp.cpp
@@ -1,25 +1,28 @@
|
||||
|
||||
#include "..\global.h"
|
||||
#pragma hdrstop
|
||||
#include "../src/global.h"
|
||||
|
||||
#ifdef _SURMAP_
|
||||
#define SESSION
|
||||
#endif
|
||||
|
||||
#include "..\sqint\sqint.h"
|
||||
#include "sqint.h"
|
||||
|
||||
#include "..\common.h"
|
||||
#include "../src/common.h"
|
||||
|
||||
#include "..\terra\vmap.h"
|
||||
#include "../src/terra/vmap.h"
|
||||
#include "impass.h"
|
||||
#include "..\terra\world.h"
|
||||
#include "..\terra\render.h"
|
||||
#include "..\units\moveland.h"
|
||||
#include "../src/terra/world.h"
|
||||
#include "../src/terra/render.h"
|
||||
#include "../src/units/moveland.h"
|
||||
|
||||
#include "sqexp.h"
|
||||
#include "tools.h"
|
||||
#include "track.h"
|
||||
|
||||
#include "port.h"
|
||||
#define itoa port_itoa
|
||||
#include "missed.h"
|
||||
|
||||
#ifdef _NT
|
||||
#include "..\root\win32f.h"
|
||||
#endif
|
||||
@@ -150,7 +153,7 @@ int SecondLayerPriority;
|
||||
|
||||
int MLstatus,MLprocess;
|
||||
|
||||
static char* ibmFName = "LEVEL.IBM";
|
||||
static const char* ibmFName = "LEVEL.IBM";
|
||||
|
||||
ibmFile ibmObj = { 1024,1024,320,240,800,600,250,200 };
|
||||
|
||||
@@ -163,14 +166,17 @@ uchar markBMP[7][7] = {
|
||||
0,0,0,COL1,0,0,0,
|
||||
0,0,0,COL1,0,0,0 };
|
||||
|
||||
static char* RUS(char* s,int back = 0)
|
||||
static const char* RUS(const char* s,int back = 0)
|
||||
{
|
||||
static char buffer[512];
|
||||
if(!back)
|
||||
KDWIN::CharToOemBuff(s,buffer,strlen(s) + 1);
|
||||
else
|
||||
KDWIN::OemToCharBuff(s,buffer,strlen(s) + 1);
|
||||
return buffer;
|
||||
printf("RUS function is not supported\n");
|
||||
//@caiiiycuk TODO: write converter that used internal buffer to avoid memory leak
|
||||
return strdup(s);
|
||||
// static char buffer[512];
|
||||
// if(!back)
|
||||
// KDWIN::CharToOemBuff(s,buffer,strlen(s) + 1);
|
||||
// else
|
||||
// KDWIN::OemToCharBuff(s,buffer,strlen(s) + 1);
|
||||
// return buffer;
|
||||
}
|
||||
|
||||
void sqStateSave(XStream& ff)
|
||||
@@ -380,7 +386,7 @@ void iMainMenu::flush(void)
|
||||
|
||||
struct PrmFormat {
|
||||
int mode;
|
||||
char* string;
|
||||
const char* string;
|
||||
int* prm;
|
||||
int min,max;
|
||||
};
|
||||
@@ -443,7 +449,7 @@ PrmFormat PrmItem1[PRMMAX1] = {
|
||||
};
|
||||
PrmFormat* PrmItemPtr;
|
||||
|
||||
static char* MModeStr[LBM_MAX] = {
|
||||
static const char* MModeStr[LBM_MAX] = {
|
||||
"FLOOD",
|
||||
"DRIFT",
|
||||
"TOOLZER",
|
||||
@@ -583,7 +589,7 @@ void iPrmMenu::keytrap(int key)
|
||||
draw();
|
||||
timer = CLOCK();
|
||||
break;
|
||||
case VK_SUBTRACT:
|
||||
case SDLK_MINUS:
|
||||
n = menu -> getptr(menu -> pointer);
|
||||
*(PrmItemPtr[n].prm) = -(*(PrmItemPtr[n].prm));
|
||||
if(*(PrmItemPtr[n].prm) < PrmItemPtr[n].min) *(PrmItemPtr[n].prm) = PrmItemPtr[n].min;
|
||||
@@ -593,7 +599,7 @@ void iPrmMenu::keytrap(int key)
|
||||
menu -> pointer -> replace(menu,(uchar*)((*buf).GetBuf()));
|
||||
draw();
|
||||
break;
|
||||
case VK_LEFT:
|
||||
case SDLK_LEFT:
|
||||
n = menu -> getptr(menu -> pointer);
|
||||
if(PrmItemPtr[n].prm){
|
||||
buf -> init();
|
||||
@@ -603,7 +609,7 @@ void iPrmMenu::keytrap(int key)
|
||||
draw();
|
||||
}
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
case SDLK_RIGHT:
|
||||
n = menu -> getptr(menu -> pointer);
|
||||
if(PrmItemPtr[n].prm){
|
||||
buf -> init();
|
||||
@@ -786,34 +792,34 @@ iInputForm::iInputForm(sqElem* _owner,int _x,int _y,int _mode)
|
||||
i = !MLstatus ? 6 : (MLstatus == 1 ? 3 : 8);
|
||||
yadd = (i - 1)*16;
|
||||
*this + (menu = new sqPopupMenu(this,7,22,i,&sysfont,0,3));
|
||||
switch(MLstatus){
|
||||
case 0:
|
||||
if(!MLprocess)
|
||||
*menu * new sqMenuBar((uchar*)RUS("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ML-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),menu);
|
||||
else
|
||||
*menu * new sqMenuBar((uchar*)RUS("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ML-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ML-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ML-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..."),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ML-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..."),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ML-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..."),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ML-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..."),menu);
|
||||
break;
|
||||
case 1:
|
||||
*menu * new sqMenuBar((uchar*)RUS("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ML-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ML-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),menu);
|
||||
break;
|
||||
case 2:
|
||||
*menu * new sqMenuBar((uchar*)RUS("[G] <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..."),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("[A] <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("[Q] <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("[N] <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("[D] <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ML-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ML-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),menu);
|
||||
break;
|
||||
}
|
||||
switch(MLstatus){
|
||||
case 0:
|
||||
if(!MLprocess)
|
||||
*menu * new sqMenuBar((uchar*)RUS("Разрешить ML-анимацию"),menu);
|
||||
else
|
||||
*menu * new sqMenuBar((uchar*)RUS("Запретить ML-анимацию"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("Создание нового ML-объекта"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("Покадровое редактирование существующих ML-объектов..."),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("Удаление ML-объектов..."),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("Редактирование параметров у существующих ML-объектов..."),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("Показать один из существующих ML-объектов..."),menu);
|
||||
break;
|
||||
case 1:
|
||||
*menu * new sqMenuBar((uchar*)RUS("Добавить кадр"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("Закончить создание ML-объекта и записать его"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("Прекратить создание ML-объекта без сохранения результатов"),menu);
|
||||
break;
|
||||
case 2:
|
||||
*menu * new sqMenuBar((uchar*)RUS("[G] Перейти на один из существующих кадров..."),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("[A] Запомнить изменения текущего кадра"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("[Q] Восстановить кадр в его начальное состояние"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("[N] Вставить новый кадр"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("[D] Удалить текущий кадр"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("Изменить параметры ML-объекта"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("Закончить редактирование ML-объекта и сохранить все изменения"),menu);
|
||||
*menu * new sqMenuBar((uchar*)RUS("Прекратить редактирование без сохранения всех изменений"),menu);
|
||||
break;
|
||||
}
|
||||
if(copt >= 6) copt = 5;
|
||||
menu -> setpointer(menu -> getbar(copt),0);
|
||||
xadd = menu -> len*8 + 16;
|
||||
@@ -1391,13 +1397,13 @@ void sTrack::linking(void)
|
||||
|
||||
struct LayFormat {
|
||||
int mode;
|
||||
char* string;
|
||||
const char* string;
|
||||
int* prm;
|
||||
int min,max;
|
||||
};
|
||||
|
||||
const int LAYMAX = 9;
|
||||
char* LayEditStr[2] = {
|
||||
const char* LayEditStr[2] = {
|
||||
"Begin editing the second layer",
|
||||
"Accept the created layer"
|
||||
};
|
||||
@@ -1519,7 +1525,7 @@ void iLayerMenu::keytrap(int key)
|
||||
draw();
|
||||
timer = CLOCK();
|
||||
break;
|
||||
case VK_SUBTRACT:
|
||||
case SDLK_MINUS:
|
||||
n = menu -> getptr(menu -> pointer);
|
||||
*(LayItem[n].prm) = -(*(LayItem[n].prm));
|
||||
if(*(LayItem[n].prm) < LayItem[n].min) *(LayItem[n].prm) = LayItem[n].min;
|
||||
@@ -1529,7 +1535,7 @@ void iLayerMenu::keytrap(int key)
|
||||
menu -> pointer -> replace(menu,(uchar*)((*buf).GetBuf()));
|
||||
draw();
|
||||
break;
|
||||
case VK_LEFT:
|
||||
case SDLK_LEFT:
|
||||
n = menu -> getptr(menu -> pointer);
|
||||
if(LayItem[n].prm){
|
||||
buf -> init();
|
||||
@@ -1539,7 +1545,7 @@ void iLayerMenu::keytrap(int key)
|
||||
draw();
|
||||
}
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
case SDLK_RIGHT:
|
||||
n = menu -> getptr(menu -> pointer);
|
||||
if(LayItem[n].prm){
|
||||
buf -> init();
|
||||
@@ -1608,7 +1614,7 @@ void ibmFile::save(int _mapx_center,int _mapy_center,int _x_center,int _y_center
|
||||
ff.write(p,sx);
|
||||
}
|
||||
|
||||
delete p;
|
||||
delete[] p;
|
||||
ff.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
(Main Constructions)
|
||||
*/
|
||||
|
||||
#include "..\global.h"
|
||||
#pragma hdrstop
|
||||
#include "../src/global.h"
|
||||
|
||||
#include "sqint.h"
|
||||
#include "missed.h"
|
||||
|
||||
/* ---------------------------- EXTERN SECTION ----------------------------- */
|
||||
/* --------------------------- PROTOTYPE SECTION --------------------------- */
|
||||
/* --------------------------- DEFINITION SECTION -------------------------- */
|
||||
int sqInputString::insert = 1,sqInputString::rus;
|
||||
|
||||
static char* EventMsg = "EventQueue overflow. Reboot?";
|
||||
static const char* EventMsg = "EventQueue overflow. Reboot?";
|
||||
|
||||
inline char* sqstrNcpy(char* dest,char* src,int len)
|
||||
{
|
||||
@@ -251,7 +251,7 @@ void sqButton::handler(sqEvent* e)
|
||||
}
|
||||
}
|
||||
|
||||
sqInputBox::sqInputBox(sqElem* _owner,int _x,int _y,int _sx,int _sy,sqFont* _font,char* _title)
|
||||
sqInputBox::sqInputBox(sqElem* _owner,int _x,int _y,int _sx,int _sy,sqFont* _font,const char* _title)
|
||||
: sqBox(_owner,0,0,0,0)
|
||||
{
|
||||
owner = _owner;
|
||||
@@ -262,12 +262,16 @@ sqInputBox::sqInputBox(sqElem* _owner,int _x,int _y,int _sx,int _sy,sqFont* _fon
|
||||
// if(x + sx + 2 >= getRX()) x = getRX() - sx - 2;
|
||||
// if(y + sy + 4 >= getRY()) y = getRY() - sy - 4;
|
||||
set();
|
||||
title = _title;
|
||||
title = _title == nullptr ? nullptr : strdup(_title);
|
||||
font = _font;
|
||||
|
||||
KeyTrapObj = this;
|
||||
}
|
||||
|
||||
sqInputBox::~sqInputBox() {
|
||||
free(title);
|
||||
}
|
||||
|
||||
void sqInputBox::close(void)
|
||||
{
|
||||
sqElem* o = KeyTrapObj = owner;
|
||||
@@ -279,11 +283,11 @@ void sqInputBox::close(void)
|
||||
void sqInputBox::keytrap(int key)
|
||||
{
|
||||
switch(key){
|
||||
case VK_F10:
|
||||
case SDLK_F10:
|
||||
message(M_ACCEPT);
|
||||
close();
|
||||
break;
|
||||
case VK_ESCAPE:
|
||||
case SDLK_ESCAPE:
|
||||
message(M_CANCEL);
|
||||
close();
|
||||
break;
|
||||
@@ -479,32 +483,32 @@ void sqInputString::keytrap(int key)
|
||||
col = 6;
|
||||
}
|
||||
switch(key){
|
||||
case VK_TAB:
|
||||
if(XKey.Pressed(VK_SHIFT))
|
||||
case SDLK_TAB:
|
||||
if(XKey.Pressed(SDLK_LSHIFT))
|
||||
owner -> message(M_PREVOBJ);
|
||||
else
|
||||
owner -> message(M_NEXTOBJ);
|
||||
break;
|
||||
case VK_DOWN:
|
||||
case SDLK_DOWN:
|
||||
owner -> message(M_NEXTOBJ);
|
||||
break;
|
||||
case VK_UP:
|
||||
case SDLK_UP:
|
||||
owner -> message(M_PREVOBJ);
|
||||
break;
|
||||
case VK_RETURN:
|
||||
case SDLK_RETURN:
|
||||
owner -> message(M_CHOICE);
|
||||
return;
|
||||
case VK_INSERT:
|
||||
case SDLK_INSERT:
|
||||
delcursor();
|
||||
insert = 1 - insert;
|
||||
break;
|
||||
case VK_RSHIFT:
|
||||
case SDLK_RSHIFT:
|
||||
rus = 1 - rus;
|
||||
break;
|
||||
case VK_LEFT:
|
||||
case SDLK_LEFT:
|
||||
if(index){
|
||||
newindex = index - 1;
|
||||
if(newindex && XKey.Pressed(VK_CONTROL)){
|
||||
if(newindex && XKey.Pressed(SDLK_LCTRL)){
|
||||
if(!isalnum(str[newindex]))
|
||||
while(newindex && !isalnum(str[newindex])) newindex--;
|
||||
while(newindex && isalnum(str[newindex])) newindex--;
|
||||
@@ -514,10 +518,10 @@ void sqInputString::keytrap(int key)
|
||||
if(dp && newindex == dp) newindex--;
|
||||
}
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
case SDLK_RIGHT:
|
||||
if(index < len - 1){
|
||||
newindex = index + 1;
|
||||
if(newindex < len - 1 && XKey.Pressed(VK_CONTROL)){
|
||||
if(newindex < len - 1 && XKey.Pressed(SDLK_LCTRL)){
|
||||
if(isalnum(str[newindex]))
|
||||
while(newindex < len - 1 && isalnum(str[newindex])) newindex++;
|
||||
while(newindex < len - 1 && !isalnum(str[newindex])) newindex++;
|
||||
@@ -526,7 +530,7 @@ void sqInputString::keytrap(int key)
|
||||
if(newindex == dp) newindex++;
|
||||
}
|
||||
break;
|
||||
case VK_HOME:
|
||||
case SDLK_HOME:
|
||||
if(fhome <= 0){
|
||||
if(index) newindex = 0;
|
||||
fhome = 2;
|
||||
@@ -537,7 +541,7 @@ void sqInputString::keytrap(int key)
|
||||
if(i != len) newindex = i;
|
||||
}
|
||||
break;
|
||||
case VK_END:
|
||||
case SDLK_END:
|
||||
if(fend <= 0){
|
||||
if(index < len - 1) newindex = len - 1;
|
||||
fend = 2;
|
||||
@@ -548,8 +552,8 @@ void sqInputString::keytrap(int key)
|
||||
if(i >= 0) newindex = i + 1;
|
||||
}
|
||||
break;
|
||||
case VK_BACK:
|
||||
if(XKey.Pressed(VK_CONTROL)){
|
||||
case SDLK_BACKSPACE:
|
||||
if(XKey.Pressed(SDLK_LCTRL)){
|
||||
memcpy(str,savestr,len);
|
||||
font -> draw(getX() + x + xadd,getY() + y + yadd,str,SQ_SYSCOLOR,SQ_SYSCOLOR + col);
|
||||
}
|
||||
@@ -576,7 +580,7 @@ void sqInputString::keytrap(int key)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case VK_DELETE:
|
||||
case SDLK_DELETE:
|
||||
if(!dp){
|
||||
if(index != clen){
|
||||
newindex = index;
|
||||
@@ -607,7 +611,7 @@ void sqInputString::keytrap(int key)
|
||||
draw();
|
||||
}
|
||||
c = key; // !
|
||||
if(c == VK_SUBTRACT || c == VK_OEM_MINUS) c = '-';
|
||||
if(c == SDLK_MINUS || c == SDLK_KP_MINUS) c = '-';
|
||||
if(!dp){
|
||||
if((type & T_STRING) || ((type & T_NUMERIC) && !dec && ((isdigit(c) || c == ' ' || c == '-')))){
|
||||
if(index < len - 1){
|
||||
@@ -697,7 +701,7 @@ void sqInputString::setstr(unsigned char* s)
|
||||
if(clen == len) clen--,index--;
|
||||
}
|
||||
|
||||
sqField::sqField(sqElem* _owner,char* _prompt,int _x,int _y,int _size,sqFont* _font,unsigned char* _str,int _len,int _type,int _dec)
|
||||
sqField::sqField(sqElem* _owner,const char* _prompt,int _x,int _y,int _size,sqFont* _font,unsigned char* _str,int _len,int _type,int _dec)
|
||||
: sqInputString(_owner,_x + strlen(_prompt)*_font -> sx + 3,_y,_size - strlen(_prompt)*_font -> sx - 3,_font,_str,_len,_type,_dec)
|
||||
{
|
||||
prompt = (unsigned char*)strdup(_prompt);
|
||||
@@ -711,11 +715,11 @@ void sqField::draw(int self)
|
||||
sqInputString::draw();
|
||||
}
|
||||
|
||||
sqTextButton::sqTextButton(sqElem* _owner,int _x,int _y,char* _text,sqFont* _font,int _sx)
|
||||
sqTextButton::sqTextButton(sqElem* _owner,int _x,int _y,const char* _text,sqFont* _font,int _sx)
|
||||
{
|
||||
owner = _owner;
|
||||
x = _x; y = _y;
|
||||
text = _text;
|
||||
text = strdup(_text);
|
||||
font = _font;
|
||||
if(_sx)
|
||||
sx = _sx;
|
||||
@@ -726,6 +730,10 @@ sqTextButton::sqTextButton(sqElem* _owner,int _x,int _y,char* _text,sqFont* _fon
|
||||
offset = (sx - strlen(_text)*_font -> sx)/2;
|
||||
}
|
||||
|
||||
sqTextButton::~sqTextButton() {
|
||||
free(text);
|
||||
}
|
||||
|
||||
void sqTextButton::draw(int self)
|
||||
{
|
||||
const int mask[2*23] = { 6,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,4,3,2,0,
|
||||
@@ -752,22 +760,22 @@ void sqTextButton::handler(sqEvent* e)
|
||||
void sqTextButton::keytrap(int key)
|
||||
{
|
||||
switch(key){
|
||||
case VK_TAB:
|
||||
if(XKey.Pressed(VK_SHIFT))
|
||||
case SDLK_TAB:
|
||||
if(XKey.Pressed(SDLK_RSHIFT))
|
||||
owner -> message(M_PREVOBJ);
|
||||
else
|
||||
owner -> message(M_NEXTOBJ);
|
||||
break;
|
||||
case VK_LEFT:
|
||||
case VK_UP:
|
||||
case SDLK_LEFT:
|
||||
case SDLK_UP:
|
||||
owner -> message(M_PREVOBJ);
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
case VK_DOWN:
|
||||
case SDLK_RIGHT:
|
||||
case SDLK_DOWN:
|
||||
owner -> message(M_NEXTOBJ);
|
||||
break;
|
||||
case VK_RETURN:
|
||||
case VK_SPACE:
|
||||
case SDLK_RETURN:
|
||||
case SDLK_SPACE:
|
||||
owner -> message(M_CHOICE);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
(Core)
|
||||
*/
|
||||
|
||||
#include "..\global.h"
|
||||
#pragma hdrstop
|
||||
#include "../src/global.h"
|
||||
|
||||
#include "sqint.h"
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
(Menu)
|
||||
*/
|
||||
|
||||
#include "..\global.h"
|
||||
#pragma hdrstop
|
||||
#include "../src/global.h"
|
||||
|
||||
#include "sqint.h"
|
||||
#include "missed.h"
|
||||
|
||||
/* ---------------------------- EXTERN SECTION ----------------------------- */
|
||||
/* --------------------------- PROTOTYPE SECTION --------------------------- */
|
||||
@@ -15,7 +15,7 @@
|
||||
const int MAXSEEK = 32;
|
||||
const int SEEKDELAY = 10;
|
||||
|
||||
sqMenuBar::sqMenuBar(unsigned char* s,sqPopupMenu* owner,int _status,int _value,int _rec)
|
||||
sqMenuBar::sqMenuBar(const unsigned char* s,sqPopupMenu* owner,int _status,int _value,int _rec)
|
||||
{
|
||||
int m = owner -> margin;
|
||||
int sl = s?strlen((char*)s):0;
|
||||
@@ -124,7 +124,7 @@ void sqPopupMenu::setlen(int l)
|
||||
memcpy(s,p -> data,len);
|
||||
memset(s + len,' ',l - len);
|
||||
s[l] = '\0';
|
||||
delete p -> data;
|
||||
delete[] p -> data;
|
||||
p -> data = s;
|
||||
p = p -> next;
|
||||
}
|
||||
@@ -181,26 +181,26 @@ int sqPopupMenu::getptr(sqMenuBar* b)
|
||||
void sqPopupMenu::keytrap(int key)
|
||||
{
|
||||
switch(key){
|
||||
case VK_TAB:
|
||||
if(XKey.Pressed(VK_SHIFT))
|
||||
case SDLK_TAB:
|
||||
if(XKey.Pressed(SDLK_LSHIFT))
|
||||
owner -> message(M_PREVOBJ);
|
||||
else
|
||||
owner -> message(M_NEXTOBJ);
|
||||
seeklen = 0;
|
||||
break;
|
||||
case VK_F7:
|
||||
case VK_INSERT:
|
||||
case SDLK_F7:
|
||||
case SDLK_INSERT:
|
||||
owner -> message(M_INSERT);
|
||||
break;
|
||||
case VK_F8:
|
||||
case VK_DELETE:
|
||||
case SDLK_F8:
|
||||
case SDLK_DELETE:
|
||||
owner -> message(M_DELETE);
|
||||
break;
|
||||
case VK_SPACE:
|
||||
case SDLK_SPACE:
|
||||
owner -> message(M_SETOPTION);
|
||||
break;
|
||||
case VK_RETURN:
|
||||
if(XKey.Pressed(VK_SHIFT)){
|
||||
case SDLK_RETURN:
|
||||
if(XKey.Pressed(SDLK_LSHIFT)){
|
||||
if(seeklen)
|
||||
if(pointer -> next)
|
||||
seek(pointer -> next);
|
||||
@@ -212,10 +212,10 @@ void sqPopupMenu::keytrap(int key)
|
||||
owner -> message(M_CHOICE);
|
||||
}
|
||||
break;
|
||||
case VK_RSHIFT:
|
||||
case SDLK_RSHIFT:
|
||||
sqInputString::rus = 1 - sqInputString::rus;
|
||||
break;
|
||||
case VK_UP:
|
||||
case SDLK_UP:
|
||||
if(!pointer -> prev){
|
||||
pointer = getbar(maxbars - 1);
|
||||
topbar = (maxbars >= visibars)?maxbars - visibars:0;
|
||||
@@ -227,7 +227,7 @@ void sqPopupMenu::keytrap(int key)
|
||||
draw();
|
||||
seeklen = 0;
|
||||
break;
|
||||
case VK_DOWN:
|
||||
case SDLK_DOWN:
|
||||
if(!pointer -> next){
|
||||
pointer = first;
|
||||
topbar = 0;
|
||||
@@ -239,7 +239,7 @@ void sqPopupMenu::keytrap(int key)
|
||||
draw();
|
||||
seeklen = 0;
|
||||
break;
|
||||
case VK_HOME:
|
||||
case SDLK_HOME:
|
||||
if(pointer){
|
||||
pointer = first;
|
||||
topbar = 0;
|
||||
@@ -247,7 +247,7 @@ void sqPopupMenu::keytrap(int key)
|
||||
}
|
||||
seeklen = 0;
|
||||
break;
|
||||
case VK_END:
|
||||
case SDLK_END:
|
||||
if(pointer -> next){
|
||||
pointer = getbar(maxbars - 1);
|
||||
topbar = (maxbars >= visibars)?maxbars - visibars:0;
|
||||
@@ -255,21 +255,21 @@ void sqPopupMenu::keytrap(int key)
|
||||
}
|
||||
seeklen = 0;
|
||||
break;
|
||||
case VK_LEFT:
|
||||
case SDLK_LEFT:
|
||||
if(pointer != getbar(topbar)){
|
||||
pointer = getbar(topbar);
|
||||
draw();
|
||||
}
|
||||
seeklen = 0;
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
case SDLK_RIGHT:
|
||||
if(pointer != getbar(topbar + MIN(visibars,maxbars) - 1)){
|
||||
pointer = getbar(topbar + MIN(visibars,maxbars) - 1);
|
||||
draw();
|
||||
}
|
||||
seeklen = 0;
|
||||
break;
|
||||
case VK_PRIOR:
|
||||
case SDLK_PRIOR:
|
||||
if(pointer){
|
||||
topbar = getptr(pointer) - visibars;
|
||||
if(topbar < 0) topbar = 0;
|
||||
@@ -278,7 +278,8 @@ void sqPopupMenu::keytrap(int key)
|
||||
}
|
||||
seeklen = 0;
|
||||
break;
|
||||
case VK_NEXT:
|
||||
//@caiiiycuk: was VK_NEXT
|
||||
case SDLK_RETURN2:
|
||||
if(pointer != getbar(maxbars - 1)){
|
||||
topbar = getptr(pointer) + visibars;
|
||||
if(topbar >= maxbars) topbar = maxbars - 1;
|
||||
@@ -288,10 +289,10 @@ void sqPopupMenu::keytrap(int key)
|
||||
}
|
||||
seeklen = 0;
|
||||
break;
|
||||
case VK_OEM_PLUS:
|
||||
case SDLK_KP_PLUS:
|
||||
owner -> message(M_SETALL);
|
||||
break;
|
||||
case VK_OEM_MINUS:
|
||||
case SDLK_KP_MINUS:
|
||||
owner -> message(M_UNSETALL);
|
||||
break;
|
||||
default:
|
||||
@@ -377,7 +378,8 @@ void sqPopupMenu::seek(sqMenuBar* p0,int force)
|
||||
{
|
||||
sqMenuBar* p = p0;
|
||||
while(p){
|
||||
if(!memicmp(p -> data + margin,seekbuf,seeklen)){
|
||||
//@caiiiycuk TODO: was memicmp
|
||||
if(!memcmp(p -> data + margin,seekbuf,seeklen)){
|
||||
setpointer(p,force);
|
||||
return;
|
||||
}
|
||||
@@ -385,7 +387,8 @@ void sqPopupMenu::seek(sqMenuBar* p0,int force)
|
||||
}
|
||||
p = first;
|
||||
while(p != p0){
|
||||
if(!memicmp(p -> data + margin,seekbuf,seeklen)){
|
||||
//@scaiiiycuk TODO: was memicmp
|
||||
if(!memcmp(p -> data + margin,seekbuf,seeklen)){
|
||||
setpointer(p,force);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -171,7 +171,8 @@ struct sqTextButton : sqElem {
|
||||
sqFont* font;
|
||||
int offset;
|
||||
|
||||
sqTextButton(sqElem* _owner,int _x,int _y,char* _text,sqFont* _font,int _sx = 0);
|
||||
sqTextButton(sqElem* _owner,int _x,int _y,const char* _text,sqFont* _font,int _sx = 0);
|
||||
~sqTextButton();
|
||||
|
||||
virtual int* getXY(void){ return &x; }
|
||||
virtual void draw(int self = 1);
|
||||
@@ -216,7 +217,7 @@ struct sqField : sqInputString {
|
||||
unsigned char* prompt;
|
||||
int x0,y0;
|
||||
|
||||
sqField(sqElem* _owner,char* _prompt,int _x,int _y,int _size,sqFont* _font,unsigned char* _str = NULL,int _len = 0,int _type = T_STRING,int _dec = 0);
|
||||
sqField(sqElem* _owner,const char* _prompt,int _x,int _y,int _size,sqFont* _font,unsigned char* _str = NULL,int _len = 0,int _type = T_STRING,int _dec = 0);
|
||||
~sqField(void){ free(prompt); }
|
||||
|
||||
virtual void draw(int self = 1);
|
||||
@@ -229,8 +230,8 @@ struct sqMenuBar {
|
||||
sqMenuBar* next,*prev;
|
||||
int status,value,rec;
|
||||
|
||||
sqMenuBar(unsigned char* s,sqPopupMenu* owner,int _status = 0,int _value = 0,int _rec = -1);
|
||||
~sqMenuBar(void){ delete data; free(original_data); }
|
||||
sqMenuBar(const unsigned char* s,sqPopupMenu* owner,int _status = 0,int _value = 0,int _rec = -1);
|
||||
~sqMenuBar(void){ delete[] data; free(original_data); }
|
||||
|
||||
void replace(sqPopupMenu* owner,unsigned char* s);
|
||||
};
|
||||
@@ -249,7 +250,7 @@ struct sqPopupMenu : sqElem {
|
||||
unsigned int seekcounter;
|
||||
|
||||
sqPopupMenu(sqElem* _owner,int _x,int _y,int _visibars,sqFont* _font,int _len0 = 0,int _margin = 1);
|
||||
virtual ~sqPopupMenu(void){ free(); delete seekbuf; }
|
||||
virtual ~sqPopupMenu(void){ free(); delete[] seekbuf; }
|
||||
|
||||
sqPopupMenu& operator* (sqMenuBar* obj);
|
||||
void disconnect(sqMenuBar* obj,sqMenuBar** del = NULL);
|
||||
@@ -317,7 +318,8 @@ struct sqInputBox : sqBox {
|
||||
char* title;
|
||||
sqFont* font;
|
||||
|
||||
sqInputBox(sqElem* _owner,int _x,int _y,int _sx,int _sy,sqFont* _font,char* _title = NULL);
|
||||
sqInputBox(sqElem* _owner,int _x,int _y,int _sx,int _sy,sqFont* _font,const char* _title = NULL);
|
||||
~sqInputBox();
|
||||
|
||||
void close(void);
|
||||
|
||||
|
||||
@@ -1,28 +1,35 @@
|
||||
#include "..\global.h"
|
||||
#pragma hdrstop
|
||||
#include "../src/global.h"
|
||||
|
||||
//#define SCREENSHOT
|
||||
|
||||
#ifdef _NT
|
||||
#include "..\root\win32f.h"
|
||||
#endif
|
||||
#include "runtime.h"
|
||||
|
||||
#include "..\sqint\sqint.h"
|
||||
#include "sqint.h"
|
||||
|
||||
#include "..\common.h"
|
||||
#include "../src/common.h"
|
||||
#include "sqexp.h"
|
||||
#include "tools.h"
|
||||
#include "track.h"
|
||||
|
||||
#include "impass.h"
|
||||
#include "..\terra\vmap.h"
|
||||
#include "..\terra\world.h"
|
||||
#include "..\terra\render.h"
|
||||
#include "..\units\moveland.h"
|
||||
#include "..\root\palette.h"
|
||||
#include "../src/terra/vmap.h"
|
||||
#include "../src/terra/world.h"
|
||||
#include "../src/terra/render.h"
|
||||
#include "../src/units/moveland.h"
|
||||
#include "../src/palette.h"
|
||||
|
||||
#include "..\3d\3d_math.h"
|
||||
#include "..\3d\3dgraph.h"
|
||||
#include "..\3d\3dobject.h"
|
||||
#include "../src/3d/3d_math.h"
|
||||
#include "../src/3d/3dgraph.h"
|
||||
#include "../src/3d/3dobject.h"
|
||||
|
||||
#include "missed.h"
|
||||
|
||||
#ifndef DBGCHECK
|
||||
#define DBGCHECK
|
||||
#endif
|
||||
|
||||
#define RANDOMIZE
|
||||
|
||||
@@ -134,9 +141,9 @@ int ConvertLog;
|
||||
int WaterPrm = -1;
|
||||
int videoMode;
|
||||
|
||||
char* mapFName = "WRLDS.DAT";
|
||||
const char* mapFName = "wrlds.dat";
|
||||
int ColorShow = 1;
|
||||
int DepthShow;
|
||||
int DepthShow = 0;
|
||||
|
||||
sTrack Track;
|
||||
|
||||
@@ -159,6 +166,9 @@ int paliterMode;
|
||||
|
||||
int emode;
|
||||
|
||||
extern int __internal_argc;
|
||||
extern char **__internal_argv;
|
||||
|
||||
int xtInitApplication(void)
|
||||
{
|
||||
XCon < "SURMAP Editor v3.03-Win32/DirectX by K-D LAB (C)1996-97. All Rights Reserved.\n";
|
||||
@@ -177,9 +187,10 @@ int xtInitApplication(void)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ComlineAnalyze(__argc,__argv);
|
||||
ErrH.SetRestore(restore);
|
||||
ErrH.SetFlags(XERR_CTRLBRK);
|
||||
ComlineAnalyze(__internal_argc, __internal_argv);
|
||||
//@caiiiycuk: should we ever fix this?
|
||||
//ErrH.SetRestore(restore);
|
||||
//ErrH.SetFlags(XERR_CTRLBRK);
|
||||
|
||||
XKey.init(NULL,NULL);
|
||||
|
||||
@@ -498,15 +509,15 @@ void costab(void)
|
||||
|
||||
void KeyCenter(int key)
|
||||
{
|
||||
if(key == VK_ESCAPE){
|
||||
if(key == SDLK_ESCAPE){
|
||||
sqKey -> top = sqKey -> bottom;
|
||||
sqKey -> put(key);
|
||||
}
|
||||
else
|
||||
if(key != VK_SHIFT && key != VK_CONTROL)
|
||||
if(key != SDLK_LSHIFT && key != SDLK_LCTRL)
|
||||
sqKey -> put(key);
|
||||
else
|
||||
if(key == VK_CONTROL) keyP = 1;
|
||||
if(key == SDLK_LCTRL) keyP = 1;
|
||||
}
|
||||
|
||||
void photo(void)
|
||||
@@ -532,7 +543,7 @@ void photo(void)
|
||||
ff.write(line,SX);
|
||||
}
|
||||
ff.close();
|
||||
delete line;
|
||||
delete[] line;
|
||||
}
|
||||
|
||||
void sqScreen::draw(int self)
|
||||
@@ -550,13 +561,13 @@ void sqScreen::draw(int self)
|
||||
void sqScreen::keytrap(int key)
|
||||
{
|
||||
switch(key){
|
||||
case VK_RETURN:
|
||||
case SDLK_RETURN:
|
||||
sqE -> put(E_MAINMENU,E_COMMON,XGR_MAXX/2,XGR_MAXY/2);
|
||||
break;
|
||||
case VK_F12:
|
||||
case SDLK_F12:
|
||||
DBGCHECK
|
||||
break;
|
||||
case VK_F11:
|
||||
case SDLK_F11:
|
||||
// shotMake();
|
||||
photo();
|
||||
break;
|
||||
@@ -615,20 +626,20 @@ void iGameMap::keytrap(int key)
|
||||
|
||||
int xm,ym;
|
||||
switch(key){
|
||||
case VK_ESCAPE:
|
||||
case SDLK_ESCAPE:
|
||||
if ( TrackBuild == SET_HEIGHT || TrackBuild == SET_HEIGHT_NODE)
|
||||
TrackBuild = WAIT;
|
||||
break;
|
||||
case VK_LBR:
|
||||
case SDLK_LEFTBRACKET:
|
||||
curGMap -> change(-18,-10);
|
||||
break;
|
||||
case VK_RBR:
|
||||
case SDLK_RIGHTBRACKET:
|
||||
curGMap -> change(18,10);
|
||||
break;
|
||||
case VK_DELETE:
|
||||
case SDLK_DELETE:
|
||||
if(!MLstatus)
|
||||
if(XKey.Pressed(VK_SHIFT)) CX--;
|
||||
else if(XKey.Pressed(VK_CONTROL)) CX -= 10;
|
||||
if(XKey.Pressed(SDLK_LSHIFT)) CX--;
|
||||
else if(XKey.Pressed(SDLK_LCTRL)) CX -= 10;
|
||||
else CX -= DELTA;
|
||||
else {
|
||||
LayerStatus = UP_LAYER;
|
||||
@@ -636,25 +647,26 @@ void iGameMap::keytrap(int key)
|
||||
LayerStatus = DOWN_LAYER;
|
||||
}
|
||||
break;
|
||||
case VK_NEXT:
|
||||
//@caiiiycuk: was VK_NEXT
|
||||
case SDLK_RETURN2:
|
||||
if(!MLstatus)
|
||||
if(XKey.Pressed(VK_SHIFT)) CX++;
|
||||
else if(XKey.Pressed(VK_CONTROL)) CX += 10;
|
||||
if(XKey.Pressed(SDLK_LSHIFT)) CX++;
|
||||
else if(XKey.Pressed(SDLK_LCTRL)) CX += 10;
|
||||
else CX += DELTA;
|
||||
break;
|
||||
case VK_HOME:
|
||||
case SDLK_HOME:
|
||||
if(!MLstatus)
|
||||
if(XKey.Pressed(VK_SHIFT)) CY--;
|
||||
else if(XKey.Pressed(VK_CONTROL)) CY -= 10;
|
||||
if(XKey.Pressed(SDLK_LSHIFT)) CY--;
|
||||
else if(XKey.Pressed(SDLK_LCTRL)) CY -= 10;
|
||||
else CY -= DELTA;
|
||||
break;
|
||||
case VK_END:
|
||||
case SDLK_END:
|
||||
if(!MLstatus)
|
||||
if(XKey.Pressed(VK_SHIFT)) CY++;
|
||||
else if(XKey.Pressed(VK_CONTROL)) CY += 10;
|
||||
if(XKey.Pressed(SDLK_LSHIFT)) CY++;
|
||||
else if(XKey.Pressed(SDLK_LCTRL)) CY += 10;
|
||||
else CY += DELTA;
|
||||
break;
|
||||
case VK_LEFT:
|
||||
case SDLK_LEFT:
|
||||
if(MLstatus == 2){
|
||||
MLprevframe();
|
||||
break;
|
||||
@@ -665,10 +677,10 @@ void iGameMap::keytrap(int key)
|
||||
}
|
||||
if(TrackBuild == SET_HEIGHT){
|
||||
DeltalH = -1;
|
||||
if(XKey.Pressed(VK_CONTROL)) DeltalH = -10;
|
||||
if(XKey.Pressed(SDLK_LCTRL)) DeltalH = -10;
|
||||
}
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
case SDLK_RIGHT:
|
||||
if(MLstatus == 2){
|
||||
MLnextframe();
|
||||
break;
|
||||
@@ -678,43 +690,43 @@ void iGameMap::keytrap(int key)
|
||||
break;
|
||||
}
|
||||
if(TrackBuild == SET_HEIGHT){
|
||||
if(XKey.Pressed(VK_CONTROL)) DeltalH = 10;
|
||||
if(XKey.Pressed(SDLK_LCTRL)) DeltalH = 10;
|
||||
else DeltalH = 1;
|
||||
}
|
||||
break;
|
||||
case VK_UP:
|
||||
case SDLK_UP:
|
||||
if(ShowVoxel){
|
||||
SlopeAngle += 16;
|
||||
break;
|
||||
}
|
||||
if ( TrackBuild == SET_HEIGHT || TrackBuild == SET_HEIGHT_NODE){
|
||||
if(XKey.Pressed(VK_CONTROL)) DeltamH = 10;
|
||||
if(XKey.Pressed(SDLK_LCTRL)) DeltamH = 10;
|
||||
else DeltamH = 1;
|
||||
}
|
||||
break;
|
||||
case VK_DOWN:
|
||||
case SDLK_DOWN:
|
||||
if(ShowVoxel){
|
||||
SlopeAngle -= 16;
|
||||
break;
|
||||
}
|
||||
if(TrackBuild == SET_HEIGHT || TrackBuild == SET_HEIGHT_NODE){
|
||||
DeltamH = -1;
|
||||
if(XKey.Pressed(VK_CONTROL)) DeltamH = -10;
|
||||
if(XKey.Pressed(SDLK_LCTRL)) DeltamH = -10;
|
||||
}
|
||||
break;
|
||||
case VK_SUBTRACT:
|
||||
if(XKey.Pressed(VK_CONTROL))
|
||||
case SDLK_MINUS:
|
||||
if(XKey.Pressed(SDLK_LCTRL))
|
||||
TurnSecX += 50;
|
||||
else
|
||||
TurnSecX += 5;
|
||||
break;
|
||||
case VK_ADD:
|
||||
if(XKey.Pressed(VK_CONTROL))
|
||||
case SDLK_PLUS:
|
||||
if(XKey.Pressed(SDLK_LCTRL))
|
||||
TurnSecX -= 50;
|
||||
else
|
||||
TurnSecX -= 5;
|
||||
break;
|
||||
case VK_INSERT:
|
||||
case SDLK_INSERT:
|
||||
if(MLstatus){
|
||||
MLadd();
|
||||
LayerStatus = UP_LAYER;
|
||||
@@ -724,27 +736,27 @@ void iGameMap::keytrap(int key)
|
||||
break;
|
||||
case '1':
|
||||
if(TrackStatus)
|
||||
if(!XKey.Pressed(VK_SHIFT)) Track.save(1);
|
||||
if(!XKey.Pressed(SDLK_LSHIFT)) Track.save(1);
|
||||
else Track.load(1);
|
||||
break;
|
||||
case '2':
|
||||
if(TrackStatus)
|
||||
if(!XKey.Pressed(VK_SHIFT)) Track.save(2);
|
||||
if(!XKey.Pressed(SDLK_LSHIFT)) Track.save(2);
|
||||
else Track.load(2);
|
||||
break;
|
||||
case '3':
|
||||
if(TrackStatus)
|
||||
if(!XKey.Pressed(VK_SHIFT)) Track.save(3);
|
||||
if(!XKey.Pressed(SDLK_LSHIFT)) Track.save(3);
|
||||
else Track.load(3);
|
||||
break;
|
||||
case '4':
|
||||
if(TrackStatus)
|
||||
if(!XKey.Pressed(VK_SHIFT)) Track.save(4);
|
||||
if(!XKey.Pressed(SDLK_LSHIFT)) Track.save(4);
|
||||
else Track.load(4);
|
||||
break;
|
||||
case '5':
|
||||
if(TrackStatus)
|
||||
if(!XKey.Pressed(VK_SHIFT)) Track.save(5);
|
||||
if(!XKey.Pressed(SDLK_LSHIFT)) Track.save(5);
|
||||
else Track.load(5);
|
||||
break;
|
||||
case 'F':
|
||||
@@ -753,7 +765,7 @@ void iGameMap::keytrap(int key)
|
||||
else
|
||||
prmFlag |= PRM_INFO;
|
||||
break;
|
||||
case VK_SPACE:
|
||||
case SDLK_SPACE:
|
||||
if(TrackStatus)
|
||||
message(M_SETOBJ,knobSpline);
|
||||
else
|
||||
@@ -774,20 +786,20 @@ void iGameMap::keytrap(int key)
|
||||
case '9':
|
||||
Track_show_all ^= 1;
|
||||
break;
|
||||
case VK_F1:
|
||||
case VK_F2:
|
||||
case VK_F3:
|
||||
case VK_F4:
|
||||
case VK_F5:
|
||||
case VK_F6:
|
||||
case VK_F7:
|
||||
case VK_F8:
|
||||
case VK_F9:
|
||||
case VK_F10:
|
||||
if(XKey.Pressed(VK_CONTROL))
|
||||
ClipboardOperation(key - VK_F1,1);
|
||||
case SDLK_F1:
|
||||
case SDLK_F2:
|
||||
case SDLK_F3:
|
||||
case SDLK_F4:
|
||||
case SDLK_F5:
|
||||
case SDLK_F6:
|
||||
case SDLK_F7:
|
||||
case SDLK_F8:
|
||||
case SDLK_F9:
|
||||
case SDLK_F10:
|
||||
if(XKey.Pressed(SDLK_LCTRL))
|
||||
ClipboardOperation(key - SDLK_F1,1);
|
||||
else
|
||||
ClipboardOperation(key - VK_F1,0);
|
||||
ClipboardOperation(key - SDLK_F1,0);
|
||||
break;
|
||||
case 'T':
|
||||
message(M_SETOBJ,knobTrack);
|
||||
@@ -799,7 +811,7 @@ void iGameMap::keytrap(int key)
|
||||
sqE -> put(E_PRMMENU,E_COMMON,XGR_MAXX/2,XGR_MAXY/2);
|
||||
break;
|
||||
case 'O':
|
||||
if(XKey.Pressed(VK_CONTROL))
|
||||
if(XKey.Pressed(SDLK_LCTRL))
|
||||
MLvisi = 1 - MLvisi;
|
||||
else
|
||||
sqE -> put(E_MOBILOCMENU,E_COMMON,XGR_MAXX/2,XGR_MAXY/2);
|
||||
@@ -807,13 +819,13 @@ void iGameMap::keytrap(int key)
|
||||
case 'C':
|
||||
sqE -> put(E_VALOCMENU,E_COMMON,XGR_MAXX/2,XGR_MAXY/2);
|
||||
break;
|
||||
case VK_SLASH:
|
||||
case SDLK_SLASH:
|
||||
VisiRegR = 1 - VisiRegR;
|
||||
break;
|
||||
case 'E':
|
||||
paliterMode = 1 - paliterMode;
|
||||
break;
|
||||
case VK_TAB:
|
||||
case SDLK_TAB:
|
||||
GridLog = 1 - GridLog;
|
||||
break;
|
||||
case 'B':
|
||||
@@ -846,7 +858,7 @@ void iGameMap::keytrap(int key)
|
||||
case 'Z':
|
||||
ZoomLog = 1 - ZoomLog;
|
||||
if(ZoomLog)
|
||||
if(XKey.Pressed(VK_SHIFT))
|
||||
if(XKey.Pressed(SDLK_LSHIFT))
|
||||
TurnSecX = curGMap -> xsize/8;
|
||||
else
|
||||
#ifdef POSTER
|
||||
@@ -857,7 +869,7 @@ void iGameMap::keytrap(int key)
|
||||
else
|
||||
TurnSecX = curGMap -> xsize;
|
||||
break;
|
||||
case VK_TILDE:
|
||||
case SDLK_BACKQUOTE:
|
||||
vMap -> squeeze();
|
||||
break;
|
||||
case '0':
|
||||
@@ -1102,7 +1114,7 @@ void iGameMap::quant(void)
|
||||
else if(ym > yc + yside - 8) dy = DELTA;
|
||||
|
||||
if(dx || dy){
|
||||
if(XKey.Pressed(VK_CONTROL)) dx *= 3, dy *= 3;
|
||||
if(XKey.Pressed(SDLK_LCTRL)) dx *= 3, dy *= 3;
|
||||
shift(dx,dy);
|
||||
sqE -> put(E_MUFLER,E_COMMON,0,0);
|
||||
}
|
||||
@@ -1252,7 +1264,7 @@ void analyzeColors(void)
|
||||
ff <= x < ": " <= table[x] < "\r\n";
|
||||
}
|
||||
|
||||
delete table;
|
||||
delete[] table;
|
||||
}
|
||||
|
||||
#ifdef SCREENSHOT
|
||||
@@ -1294,12 +1306,12 @@ struct PrmFile {
|
||||
int len;
|
||||
int index;
|
||||
|
||||
void init(char* name);
|
||||
void init(char const* name);
|
||||
char* getAtom(void);
|
||||
void finit(void){ delete buf; }
|
||||
};
|
||||
|
||||
void PrmFile::init(char* name)
|
||||
void PrmFile::init(char const* name)
|
||||
{
|
||||
XStream ff(name,XS_IN);
|
||||
buf = new char[len = ff.size()];
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
#include "..\global.h"
|
||||
#pragma hdrstop
|
||||
#include "../src/global.h"
|
||||
|
||||
#ifdef _NT
|
||||
#include "..\root\win32f.h"
|
||||
#endif
|
||||
|
||||
#include "..\sqint\sqint.h"
|
||||
#include "sqint.h"
|
||||
|
||||
#include "..\common.h"
|
||||
#include "../src/common.h"
|
||||
#include "tools.h"
|
||||
#include "sqexp.h"
|
||||
|
||||
#include "..\terra\vmap.h"
|
||||
#include "..\terra\world.h"
|
||||
#include "..\terra\render.h"
|
||||
#include "../src/terra/vmap.h"
|
||||
#include "../src/terra/world.h"
|
||||
#include "../src/terra/render.h"
|
||||
#include "impass.h"
|
||||
#include "..\units\moveland.h"
|
||||
#include "../src/units/moveland.h"
|
||||
|
||||
/* ----------------------------- EXTERN SECTION ---------------------------- */
|
||||
extern int LayerStatus;
|
||||
@@ -40,7 +39,7 @@ void load_shape(char* name,int x,int y);
|
||||
void release_shape();
|
||||
void ClipboardOperation(int slot,int save,int render = 1);
|
||||
void LINE_render(int y);
|
||||
char* GetTargetName(char* name);
|
||||
char* GetTargetName(const char* name);
|
||||
/* --------------------------- DEFINITION SECTION -------------------------- */
|
||||
|
||||
BitMap placeBMP;
|
||||
@@ -49,7 +48,7 @@ BitMap mosaicBMP(1);
|
||||
int S3Dmode,S3Dlevel,S3Dinverse,S3DnoiseLevel,S3DnoiseAmp,S3Dside;
|
||||
|
||||
static int* lyrT;
|
||||
static char* lyrFName = "_LAYER_.SSS";
|
||||
static const char* lyrFName = "_LAYER_.SSS";
|
||||
static XStream flyr;
|
||||
|
||||
int VLstatus,VLmode;
|
||||
@@ -925,8 +924,8 @@ void MLdelete(int n)
|
||||
MLTableSize--;
|
||||
}
|
||||
|
||||
static char* vlNames[] = { "TNT","ML Clone","Sensor","Danger" };
|
||||
char* getVLname(void){ return vlNames[VLmode]; }
|
||||
static const char* vlNames[] = { "TNT","ML Clone","Sensor","Danger" };
|
||||
const char* getVLname(void){ return vlNames[VLmode]; }
|
||||
BaseValoc* getVLTail(void)
|
||||
{
|
||||
switch(VLmode){
|
||||
@@ -1121,7 +1120,7 @@ void MLCloneValoc::accept(int _z,int _value)
|
||||
MLCVLpattern = *this;
|
||||
}
|
||||
|
||||
void SensorValoc::accept(int _z,int _id,int _radius,char* _name,int _z0,int _data0,int _data1,int _data2,int _data3,int _data4,int _data5,int _data6)
|
||||
void SensorValoc::accept(int _z,int _id,int _radius,const char* _name,int _z0,int _data0,int _data1,int _data2,int _data3,int _data4,int _data5,int _data6)
|
||||
{
|
||||
z = _z; id = _id; radius = _radius;
|
||||
name = strdup(_name);
|
||||
@@ -1203,7 +1202,8 @@ const int CNUM = 10;
|
||||
static int ClipboardStatus[CNUM + 2];
|
||||
static int ClipboardCX[CNUM + 2];
|
||||
static int ClipboardCY[CNUM + 2];
|
||||
static char* ClipFname = "clpbrd#.___";
|
||||
//@caiiiycuk: memory leak at the end (not worth to fix)
|
||||
static char* ClipFname = strdup("clpbrd#.___");
|
||||
|
||||
void ClipboardInit(void)
|
||||
{
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
#include "..\global.h"
|
||||
#pragma hdrstop
|
||||
#include "../src/global.h"
|
||||
|
||||
#include "..\sqint\sqint.h"
|
||||
#include "sqint.h"
|
||||
|
||||
#include "..\common.h"
|
||||
#include "../src/common.h"
|
||||
#include "sqexp.h"
|
||||
#include "tools.h"
|
||||
#include "track.h"
|
||||
|
||||
#include "impass.h"
|
||||
#include "..\terra\vmap.h"
|
||||
#include "..\terra\world.h"
|
||||
#include "..\terra\render.h"
|
||||
#include "../src/terra/vmap.h"
|
||||
#include "../src/terra/world.h"
|
||||
#include "../src/terra/render.h"
|
||||
|
||||
#include "port.h"
|
||||
#define itoa port_itoa
|
||||
#include "missed.h"
|
||||
|
||||
//XStream fout( "out.txt", XS_OUT );
|
||||
|
||||
@@ -66,8 +69,6 @@ double f5( double t, double );
|
||||
|
||||
unsigned realRND(unsigned m);
|
||||
|
||||
int round( double);
|
||||
|
||||
double f0( double t, double d ){
|
||||
return 0.0;
|
||||
}
|
||||
@@ -1444,7 +1445,7 @@ void sTrack::build_all_node( void ){
|
||||
l_node -> build_polygon( branch, s, 0 );
|
||||
l_node = l_node -> r;
|
||||
}
|
||||
delete s;
|
||||
delete[] s;
|
||||
build_all_branch();
|
||||
}
|
||||
|
||||
@@ -1461,7 +1462,7 @@ void eNode::build_polygon( eBranch*& branch, int*& s, int what ){
|
||||
s[i] = branches[i];
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>室<EFBFBD> <20><>⥩ s[i]
|
||||
// Построение обхода путей s[i]
|
||||
|
||||
for( i = 0; i < n_branch-1; i++ ){
|
||||
for( j = i+1; j < n_branch; j++ )
|
||||
@@ -2065,7 +2066,8 @@ void sTrack::set_height_from_ground(int what){
|
||||
}
|
||||
}
|
||||
|
||||
char* trackName = "track0.trk";
|
||||
//@caiiiycuk: memory leak at the end (not worth to fix)
|
||||
char* trackName = strdup("track0.trk");
|
||||
|
||||
void sTrack::save(int n){
|
||||
int i;
|
||||
@@ -2344,7 +2346,7 @@ void eBranch::build_spline(void){
|
||||
|
||||
n_point = 0;
|
||||
|
||||
if ( data_all != 0 ) delete data_all;
|
||||
if ( data_all != 0 ) delete[] data_all;
|
||||
|
||||
if ( n_section == 2 ){
|
||||
data_all = new rSection[2];
|
||||
@@ -3116,7 +3118,7 @@ void eNode::saveKron( eBranch*& branch, XStream& fout)
|
||||
fout < yp[i];
|
||||
};
|
||||
|
||||
delete s;
|
||||
delete[] s;
|
||||
}
|
||||
|
||||
void eBranch::saveKron(XStream& fout)
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#include "..\global.h"
|
||||
#pragma hdrstop
|
||||
#include "../src/global.h"
|
||||
|
||||
#include "..\sqint\sqint.h"
|
||||
#include "..\common.h"
|
||||
#include "sqint.h"
|
||||
#include "../src/common.h"
|
||||
|
||||
#include "..\terra\vmap.h"
|
||||
#include "..\terra\world.h"
|
||||
#include "..\terra\render.h"
|
||||
#include "../src/terra/vmap.h"
|
||||
#include "../src/terra/world.h"
|
||||
#include "../src/terra/render.h"
|
||||
|
||||
#include "missed.h"
|
||||
|
||||
struct PartParameters {
|
||||
int minAlt;
|
||||
@@ -536,7 +537,7 @@ void WORLD_colcalc(int y0,int y1,int isColor)
|
||||
lxVal = *(pa - dnD);
|
||||
rxVal = *(pa0 + XCYCL(x + 2 - dnD));
|
||||
/*
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// исправление 0-полоски
|
||||
if(x == map_size_x - 1 && (*(pf - 2) & DOUBLE_LEVEL) && (*(pf0 + 1) & DOUBLE_LEVEL)){
|
||||
*pa = (uchar)((int)*(pa - 2) + (int)rxVal >> 1);
|
||||
type = *(pf - 2) & TERRAIN_MASK;
|
||||
@@ -786,10 +787,10 @@ void worldPrepare(void)
|
||||
|
||||
void worldFree(void)
|
||||
{
|
||||
delete r_net_map;
|
||||
delete m_net_map;
|
||||
delete proto_m_net_map;
|
||||
delete new_m_net_map;
|
||||
delete[] r_net_map;
|
||||
delete[] m_net_map;
|
||||
delete[] proto_m_net_map;
|
||||
delete[] new_m_net_map;
|
||||
r_net_map = NULL;
|
||||
}
|
||||
|
||||
@@ -924,8 +925,8 @@ void WORLD_shot(void)
|
||||
ffv.write(p1,2*map_size_x);
|
||||
y = YCYCL(y + 1);
|
||||
} while(y != max);
|
||||
delete p0;
|
||||
delete p1;
|
||||
delete[] p0;
|
||||
delete[] p1;
|
||||
}
|
||||
else
|
||||
do {
|
||||
@@ -941,7 +942,7 @@ void WORLD_shot(void)
|
||||
ff.close();
|
||||
ffh.close();
|
||||
ffv.close();
|
||||
delete buf;
|
||||
delete[] buf;
|
||||
|
||||
ffh.open("HIGHTS.PAL",XS_OUT);
|
||||
for(i = 0;i < 256;i++){
|
||||
@@ -1144,7 +1145,7 @@ void partWrite(XStream& ff,int mode)
|
||||
|
||||
void LoadPP(void)
|
||||
{
|
||||
static char* errMsg = "Wrong VSC data";
|
||||
static const char* errMsg = "Wrong VSC data";
|
||||
|
||||
for(uint i = 0;i < PART_MAX;i++){
|
||||
PartPrm[i].minAlt = MIN_ALT;
|
||||
@@ -1184,6 +1185,8 @@ void SetPP(int n)
|
||||
}
|
||||
|
||||
#ifdef _SURMAP_
|
||||
//@caiiiycuk: not sure that this is right fix
|
||||
extern unsigned realRNDVAL;
|
||||
void LoadVPR(int ind)
|
||||
{
|
||||
XStream ff(vMap -> pname[ind],XS_IN);
|
||||
@@ -1401,7 +1404,7 @@ void CUTVMP(void)
|
||||
int h_size = 1 << *(buf + LEN);
|
||||
int v_size = 1 << *(buf + LEN + 1);
|
||||
|
||||
delete buf;
|
||||
delete[] buf;
|
||||
buf = new uchar[2*h_size];
|
||||
|
||||
vMap -> openMirror();
|
||||
|
||||
Reference in New Issue
Block a user