summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3557433)
raw | patch | inline | side by side (parent: 3557433)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 1 Sep 2017 04:21:11 +0000 (07:21 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 1 Sep 2017 04:21:33 +0000 (07:21 +0300) |
diff --git a/src/game/g_holmes.pas b/src/game/g_holmes.pas
index 566cd19c61b5b5eddb211b79e43f625ee56d06d7..54dc90b1056959eaea23d8229b80c579086a3791 100644 (file)
--- a/src/game/g_holmes.pas
+++ b/src/game/g_holmes.pas
implementation
uses
+ {rttiobj,} typinfo,
SysUtils, Classes, GL, SDL2,
MAPDEF, g_main, g_options,
utils, hashtable, xparser;
// ////////////////////////////////////////////////////////////////////////// //
-//FIXME
+function typeKind2Str (t: TTypeKind): AnsiString;
+begin
+ case t of
+ tkUnknown: result := 'Unknown';
+ tkInteger: result := 'Integer';
+ tkChar: result := 'Char';
+ tkEnumeration: result := 'Enumeration';
+ tkFloat: result := 'Float';
+ tkSet: result := 'Set';
+ tkMethod: result := 'Method';
+ tkSString: result := 'SString';
+ tkLString: result := 'LString';
+ tkAString: result := 'AString';
+ tkWString: result := 'WString';
+ tkVariant: result := 'Variant';
+ tkArray: result := 'Array';
+ tkRecord: result := 'Record';
+ tkInterface: result := 'Interface';
+ tkClass: result := 'Class';
+ tkObject: result := 'Object';
+ tkWChar: result := 'WChar';
+ tkBool: result := 'Bool';
+ tkInt64: result := 'Int64';
+ tkQWord: result := 'QWord';
+ tkDynArray: result := 'DynArray';
+ tkInterfaceRaw: result := 'InterfaceRaw';
+ tkProcVar: result := 'ProcVar';
+ tkUString: result := 'UString';
+ tkUChar: result := 'UChar';
+ tkHelper: result := 'Helper';
+ tkFile: result := 'File';
+ tkClassRef: result := 'ClassRef';
+ tkPointer: result := 'Pointer';
+ else result := '<unknown>';
+ end;
+end;
+
+
+procedure dumpPublishedProperties (obj: TObject);
+var
+ pt: PTypeData;
+ pi: PTypeInfo;
+ i, j: Integer;
+ pp: PPropList;
+begin
+ if (obj = nil) then exit;
+ e_LogWritefln('Object of type ''%s'':', [obj.ClassName]);
+ pi := obj.ClassInfo;
+ pt := GetTypeData(pi);
+ e_LogWritefln('property count: %s', [pt.PropCount]);
+ GetMem(pp, pt^.PropCount*sizeof(Pointer));
+ try
+ j := GetPropList(pi, [tkInteger, tkBool, tkSString, tkLString, tkAString, tkSet, tkEnumeration], pp);
+ //e_LogWritefln('ordinal property count: %s', [j]);
+ for i := 0 to j-1 do
+ begin
+ if (typinfo.PropType(obj, pp^[i].name) in [tkSString, tkLString, tkAString]) then
+ begin
+ e_LogWritefln(' #%s: <%s>; type: %s; value: <%s>', [i+1, pp^[i].name, typeKind2Str(typinfo.PropType(obj, pp^[i].name)), GetStrProp(obj, pp^[i])]);
+ end
+ else if (typinfo.PropType(obj, pp^[i].name) = tkSet) then
+ begin
+ e_LogWritefln(' #%s: <%s>; type: %s; value: %s', [i+1, pp^[i].name, typeKind2Str(typinfo.PropType(obj, pp^[i].name)), GetSetProp(obj, pp^[i], true)]);
+ end
+ else if (typinfo.PropType(obj, pp^[i].name) = tkEnumeration) then
+ begin
+ e_LogWritefln(' #%s: <%s>; type: %s; value: <%s>', [i+1, pp^[i].name, typeKind2Str(typinfo.PropType(obj, pp^[i].name)), GetEnumProp(obj, pp^[i])]);
+ end
+ else
+ begin
+ e_LogWritefln(' #%s: <%s>; type: %s; value: %s', [i+1, pp^[i].name, typeKind2Str(typinfo.PropType(obj, pp^[i].name)), GetOrdProp(obj, pp^[i])]);
+ end;
+ end;
+ finally
+ FreeMem(pp);
+ end;
+end;
+
+
+//FIXME: autogenerate
function trigType2Str (ttype: Integer): AnsiString;
begin
result := '<unknown>';
result := true; // stop
e_WriteLog(Format('monster #%d (UID:%u) (proxyid:%d)', [mon.arrIdx, mon.UID, mon.proxyId]), MSG_NOTIFY);
monMarkedUID := mon.UID;
+ dumpPublishedProperties(mon);
end;
+var
+ plr: TPlayer;
+ x, y, w, h: Integer;
begin
monMarkedUID := -1;
+ if (Length(gPlayers) > 0) then
+ begin
+ plr := gPlayers[0];
+ if (plr <> nil) then
+ begin
+ plr.getMapBox(x, y, w, h);
+ if (pmsCurMapX >= x) and (pmsCurMapY >= y) and (pmsCurMapX < x+w) and (pmsCurMapY < y+h) then
+ begin
+ dumpPublishedProperties(plr);
+ end;
+ end;
+ end;
//e_WriteLog('===========================', MSG_NOTIFY);
monsGrid.forEachAtPoint(pmsCurMapX, pmsCurMapY, monsAtDump);
//e_WriteLog('---------------------------', MSG_NOTIFY);
function wallToggle (pan: TPanel; tag: Integer): Boolean;
begin
result := false; // don't stop
- e_WriteLog(Format('wall #%d(%d); enabled=%d (%d); (%d,%d)-(%d,%d)', [pan.arrIdx, pan.proxyId, Integer(pan.Enabled), Integer(mapGrid.proxyEnabled[pan.proxyId]), pan.X, pan.Y, pan.Width, pan.Height]), MSG_NOTIFY);
+ e_LogWritefln('wall #%d(%d); enabled=%d (%d); (%d,%d)-(%d,%d)', [pan.arrIdx, pan.proxyId, Integer(pan.Enabled), Integer(mapGrid.proxyEnabled[pan.proxyId]), pan.X, pan.Y, pan.Width, pan.Height]);
+ dumpPublishedProperties(pan);
end;
var
hasTrigs: Boolean = false;
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index a4b2064a98e26b9609aa691c77fcb2f90eb61c2f..0df83bb087e16cf1c7b3fd090426c584c30669ea 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
procedure g_Map_ResetFlag(Flag: Byte);
procedure g_Map_DrawFlags();
-function g_Map_PanelForPID(PanelID: Integer; var PanelArrayID: Integer): PPanel;
-
procedure g_Map_SaveState(Var Mem: TBinMemoryWriter);
procedure g_Map_LoadState(Var Mem: TBinMemoryReader);
///// /////
end;
-function g_Map_PanelForPID(PanelID: Integer; var PanelArrayID: Integer): PPanel;
-var
- Arr: TPanelArray;
-begin
- Result := nil;
- if (PanelID < 0) or (PanelID > High(PanelByID)) then Exit;
- Arr := PanelByID[PanelID].PWhere^;
- PanelArrayID := PanelByID[PanelID].PArrID;
- Result := Addr(Arr[PanelByID[PanelID].PArrID]);
-end;
-
// trace liquid, stepping by `dx` and `dy`
// return last seen liquid coords, and `false` if we're started outside of the liquid
index 79e3be36312924e30b4de321a8777ba82efdb716..006d3c87702f2d408dbe3e16290eef590a965bce 100644 (file)
--- a/src/game/g_monsters.pas
+++ b/src/game/g_monsters.pas
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*)
{$INCLUDE ../shared/a_modes.inc}
+{$M+}
{.$DEFINE D2F_DEBUG_MONS_MOVE}
unit g_monsters;
procedure getMapBox (out x, y, w, h: Integer); inline;
+ public
+ property Obj: TObj read FObj;
+
+ property proxyId: Integer read mProxyId;
+ property arrIdx: Integer read mArrIdx;
+
+ published
property MonsterType: Byte read FMonsterType;
property MonsterHealth: Integer read FHealth write FHealth;
property MonsterAmmo: Integer read FAmmo write FAmmo;
property MonsterPain: Integer read FPain write FPain;
property MonsterAnim: Byte read FCurAnim write FCurAnim;
- property Obj: TObj read FObj;
property UID: Word read FUID write FUID;
property SpawnTrigger: Integer read FSpawnTrigger write FSpawnTrigger;
property GameDirection: TDirection read FDirection write FDirection;
property StartID: Integer read FStartID;
-
- property proxyId: Integer read mProxyId;
- property arrIdx: Integer read mArrIdx;
end;
diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas
index 5eec8e780a546456cf85a75a25c04b6160b08b62..7f3e35f9a0b4fabe792e93b17e435450c323fad5 100644 (file)
--- a/src/game/g_panel.pas
+++ b/src/game/g_panel.pas
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*)
{$INCLUDE ../shared/a_modes.inc}
+{$M+}
unit g_panel;
interface
FCurTexture: Integer; // Íîìåð òåêóùåé òåêñòóðû
FCurFrame: Integer;
FCurFrameCount: Byte;
- X, Y: Integer;
- Width, Height: Word;
- PanelType: Word;
- SaveIt: Boolean; // Ñîõðàíÿòü ïðè SaveState?
- Enabled: Boolean;
- Door: Boolean;
- Moved: Boolean;
- LiftType: Byte;
- LastAnimLoop: Byte;
+ FX, FY: Integer;
+ FWidth, FHeight: Word;
+ FPanelType: Word;
+ FSaveIt: Boolean; // Ñîõðàíÿòü ïðè SaveState?
+ FEnabled: Boolean;
+ FDoor: Boolean;
+ FMoved: Boolean;
+ FLiftType: Byte;
+ FLastAnimLoop: Byte;
arrIdx: Integer; // index in one of internal arrays; sorry
tag: Integer; // used in coldets and such; sorry
proxyId: Integer; // proxy id in map grid (DO NOT USE!)
procedure SaveState(var Mem: TBinMemoryWriter);
procedure LoadState(var Mem: TBinMemoryReader);
- property x0: Integer read X;
- property y0: Integer read Y;
+ public
+ property visvalid: Boolean read getvisvalid; // panel is "visvalid" when it's width and height are positive
+
+ published
+ property x0: Integer read FX;
+ property y0: Integer read FY;
property x1: Integer read getx1; // inclusive!
property y1: Integer read gety1; // inclusive!
- property visvalid: Boolean read getvisvalid; // panel is "visvalid" when it's width and height are positive
+ property x: Integer read FX write FX;
+ property y: Integer read FY write FY;
+ property width: Word read FWidth write FWidth;
+ property height: Word read FHeight write FHeight;
+ property panelType: Word read FPanelType write FPanelType;
+ property saveIt: Boolean read FSaveIt write FSaveIt; // Ñîõðàíÿòü ïðè SaveState?
+ property enabled: Boolean read FEnabled write FEnabled; // Ñîõðàíÿòü ïðè SaveState?
+ property door: Boolean read FDoor write FDoor; // Ñîõðàíÿòü ïðè SaveState?
+ property moved: Boolean read FMoved write FMoved; // Ñîõðàíÿòü ïðè SaveState?
+ property liftType: Byte read FLiftType write FLiftType; // Ñîõðàíÿòü ïðè SaveState?
+ property lastAnimLoop: Byte read FLastAnimLoop write FLastAnimLoop; // Ñîõðàíÿòü ïðè SaveState?
end;
- PPanel = ^TPanel;
TPanelArray = Array of TPanel;
implementation
sig := PANEL_SIGNATURE; // 'PANL'
Mem.WriteDWORD(sig);
// Îòêðûòà/çàêðûòà, åñëè äâåðü:
- Mem.WriteBoolean(Enabled);
+ Mem.WriteBoolean(FEnabled);
// Íàïðàâëåíèå ëèôòà, åñëè ëèôò:
- Mem.WriteByte(LiftType);
+ Mem.WriteByte(FLiftType);
// Íîìåð òåêóùåé òåêñòóðû:
Mem.WriteInt(FCurTexture);
// Êîîðäû
- Mem.WriteInt(X);
- Mem.WriteInt(Y);
+ Mem.WriteInt(FX);
+ Mem.WriteInt(FY);
// Àíèìèðîâàííàÿ ëè òåêóùàÿ òåêñòóðà:
if (FCurTexture >= 0) and (FTextureIDs[FCurTexture].Anim) then
begin
raise EBinSizeError.Create('TPanel.LoadState: Wrong Panel Signature');
end;
// Îòêðûòà/çàêðûòà, åñëè äâåðü:
- Mem.ReadBoolean(Enabled);
+ Mem.ReadBoolean(FEnabled);
// Íàïðàâëåíèå ëèôòà, åñëè ëèôò:
- Mem.ReadByte(LiftType);
+ Mem.ReadByte(FLiftType);
// Íîìåð òåêóùåé òåêñòóðû:
Mem.ReadInt(FCurTexture);
// Êîîðäû
- Mem.ReadInt(X);
- Mem.ReadInt(Y);
+ Mem.ReadInt(FX);
+ Mem.ReadInt(FY);
// Àíèìèðîâàííàÿ ëè òåêóùàÿ òåêñòóðà:
Mem.ReadBoolean(anim);
// Åñëè äà - çàãðóæàåì àíèìàöèþ:
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 2d53dc5b6c7c3f0f4c9c3eec7f54b65dcaabbc51..04719fccc88dca671b0e98a9838a388f55d7170f 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*)
{$INCLUDE ../shared/a_modes.inc}
+{$M+}
unit g_player;
interface
procedure getMapBox (out x, y, w, h: Integer); inline;
+ public
+ property Vel: TPoint2i read FObj.Vel;
+ property Obj: TObj read FObj;
+
+ published
property Name: String read FName write FName;
property Model: TPlayerModel read FModel;
property Health: Integer read FHealth write FHealth;
property GameVelY: Integer read FObj.Vel.Y write FObj.Vel.Y;
property GameAccelX: Integer read FObj.Accel.X write FObj.Accel.X;
property GameAccelY: Integer read FObj.Accel.Y write FObj.Accel.Y;
- property Vel: TPoint2i read FObj.Vel;
- property Obj: TObj read FObj;
property IncCam: Integer read FIncCam write FIncCam;
property UID: Word read FUID write FUID;
property JustTeleported: Boolean read FJustTeleported write FJustTeleported;
index 72f5fb23e726f916f937f888e9991ebd7e69bbbf..9e42436ec5a4440f619ec289298c2cf20444f451 100644 (file)
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*)
{$INCLUDE ../shared/a_modes.inc}
+{$M+}
unit g_playermodel;
interface
procedure Update();
procedure Draw(X, Y: Integer; Alpha: Byte = 0);
+ published
property Fire: Boolean read FFire;
property Direction: TDirection read FDirection write FDirection;
property Animation: Byte read FCurrentAnimation;
property Weapon: Byte read FCurrentWeapon;
property Name: String read FName;
+
+ public
property Color: TRGB read FColor write FColor;
end;
diff --git a/src/shared/utils.pas b/src/shared/utils.pas
index c01287f2c53e5fd6f3503292ec25a3ad2a9403dd..f61035e5c4ac6a6fbf736df86b64e53901c4550e 100644 (file)
--- a/src/shared/utils.pas
+++ b/src/shared/utils.pas
xpos := High(strbuf);
strbuf[xpos] := #0; Dec(xpos);
repeat
- if hex then
+ if not hex then
begin
strbuf[xpos] := AnsiChar((n mod 10)+48);
Dec(xpos);
xpos := High(strbuf);
strbuf[xpos] := #0; Dec(xpos);
repeat
- if hex then
+ if not hex then
begin
strbuf[xpos] := AnsiChar((n mod 10)+48);
Dec(xpos);