From 80bda6a6972730c83ec1250e5aa787c5f40ade26 Mon Sep 17 00:00:00 2001 From: LB Date: Sat, 20 Oct 2012 00:42:52 -0500 Subject: [PATCH 001/127] Massive surgery & Documentation rampage --- Extensions/Template/Actions.cpp | 27 +- Extensions/Template/Common.h | 59 +- Extensions/Template/Conditions.cpp | 23 +- Extensions/Template/Edittime.cpp | 1096 +--- Extensions/Template/Expressions.cpp | 32 +- Extensions/Template/Ext.def | 228 +- Extensions/Template/Ext.json | 161 +- Extensions/Template/Ext.rc | 312 +- Extensions/Template/Extension.cpp | 332 +- Extensions/Template/Extension.h | 226 +- Extensions/Template/General.cpp | 330 +- Extensions/Template/Runtime.cpp | 576 +- Extensions/Template/Template.vcproj | 928 ++-- Extensions/Template/resource.h | 36 +- Inc/CfcFile.h | 586 +- Inc/Cncf.h | 7858 +++++++++++++-------------- Inc/Cncy.h | 3266 +++++------ Inc/Cnpdll.h | 2288 ++++---- Inc/Edif.h | 263 +- Inc/ImageFlt.h | 412 +- Inc/ObjectSelection.h | 286 +- Inc/Patch.h | 140 +- Inc/Props.h | 2190 ++++---- Inc/Surface.h | 1394 ++--- Inc/cncr.h | 1228 ++--- Inc/json.h | 384 +- Lib/Edif.Edittime.cpp | 702 +-- Lib/Edif.General.cpp | 406 +- Lib/Edif.Runtime.cpp | 170 +- Lib/Edif.cpp | 1786 +++--- Lib/ObjectSelection.cpp | 298 +- Lib/json.c | 1484 ++--- README | 9 +- 33 files changed, 14487 insertions(+), 15029 deletions(-) diff --git a/Extensions/Template/Actions.cpp b/Extensions/Template/Actions.cpp index e798f4c..ed6d6db 100644 --- a/Extensions/Template/Actions.cpp +++ b/Extensions/Template/Actions.cpp @@ -1,10 +1,17 @@ - -#include "Common.h" - -void Extension::ActionExample(int ExampleParameter) -{ -} - -void Extension::SecondActionExample() -{ -} +/* Actions.cpp + * This is where you should define the + * behavior of your conditions. Make sure + * the parameters match those in the JSON + * exactly! Double check Extension.h + * as well. + */ + +#include "Common.h" + +void Extension::ActionExample(int ExampleParameter) +{ +} + +void Extension::SecondActionExample() +{ +} diff --git a/Extensions/Template/Common.h b/Extensions/Template/Common.h index 95add92..0f6945e 100644 --- a/Extensions/Template/Common.h +++ b/Extensions/Template/Common.h @@ -1,23 +1,36 @@ -#pragma once - -// #define TGFEXT // TGF2, MMF2, MMF2 Dev - #define MMFEXT // MMF2, MMF2 Dev -// #define PROEXT // MMF2 Dev only - -#include "Edif.h" -#include "Resource.h" - -// edPtr : Used at edittime and saved in the MFA/CCN/EXE files - -struct EDITDATA -{ - // Header - required - extHeader eHeader; - - // Object's data -// short swidth; -// short sheight; - -}; - -#include "Extension.h" +/* Common.h + * This is the common header file included + * by almost all other *.cpp files in + * the project. Anything that gets put or + * included in here will be available to you + * everywhere else. You shouldn't need to + * change anything in this file except + * to include headers that you want and + * to change the edition of MMF2 you want + * to support. + */ + +#pragma once + +//Only define one of these at once: +// #define TGFEXT //TGF2, MMF2, MMF2 Dev + #define MMFEXT //MMF2, MMF2 Dev +// #define PROEXT //MMF2 Dev only + +#include "Edif.h" +#include "Resource.h" + +//#include +//#include "YourHeader.hpp" + +/* stdtstring + * A std::string that knows if you're using + * unicode or not. (Protip: strings passed + * to your extension A/C/Es still need to be + * const TCHAR *, and the same goes for strings + * returned from expressions and conditions). + */ +typedef std::basic_string stdtstring; + +#include "EditData.hpp" +#include "Extension.h" diff --git a/Extensions/Template/Conditions.cpp b/Extensions/Template/Conditions.cpp index 00f3a10..6ae7fa5 100644 --- a/Extensions/Template/Conditions.cpp +++ b/Extensions/Template/Conditions.cpp @@ -1,9 +1,14 @@ - -#include "Common.h" - -bool Extension::AreTwoNumbersEqual(int First, int Second) -{ - return First == Second; -} - - +/* Conditions.cpp + * This is where you should define the + * behavior of your conditions. Make sure + * the parameters and return types match those + * in the JSON exactly! Double check Extension.h + * as well. + */ + +#include "Common.h" + +bool Extension::AreTwoNumbersEqual(int First, int Second) +{ + return First == Second; +} diff --git a/Extensions/Template/Edittime.cpp b/Extensions/Template/Edittime.cpp index ce41fa8..295492c 100644 --- a/Extensions/Template/Edittime.cpp +++ b/Extensions/Template/Edittime.cpp @@ -1,799 +1,297 @@ - -// ============================================================================ -// -// This file contains routines that are handled only during the Edittime, -// under the Frame and Event editors. -// -// Including creating, display, and setting up your object. -// -// ============================================================================ - -#include "Common.h" - -#if !defined(RUN_ONLY) - -// PROPERTIES ///////////////////////////////////////////////////////////////// - -// Property identifiers -enum { - PROPID_SETTINGS = PROPID_EXTITEM_CUSTOM_FIRST, - -// Example -// ------- -// PROPID_TEXTTITLE, -// PROPID_TEXT, -// PROPID_CHECK, -// PROPID_COMBO, -// PROPID_COLOR, - -}; - -// Example of content of the PROPID_COMBO combo box -//LPCSTR ComboList[] = { -// 0, // reserved -// MAKEINTRESOURCE(IDS_FIRSTOPTION), -// MAKEINTRESOURCE(IDS_SECONDOPTION), -// MAKEINTRESOURCE(IDS_THIRDOPTION), -// NULL -//}; - -// Property definitions -// -// Type, ID, Text, Text of Info box [, Options, Init Param] -// -PropData Properties[] = { - -// Example -// ------- -// PropData_Group (PROPID_TEXTTITLE, IDS_PROP_TEXTTITLE, IDS_PROP_TEXTTITLE), -// PropData_EditString (PROPID_TEXT, IDS_PROP_TEXT, IDS_PROP_TEXT_INFO), -// PropData_CheckBox (PROPID_CHECK, IDS_PROP_CHECK, IDS_PROP_CHECK_INFO), -// PropData_ComboBox (PROPID_COMBO, IDS_PROP_COMBO, IDS_PROP_COMBO, ComboList), -// PropData_Color (PROPID_COLOR, IDS_PROP_COLOR, IDS_PROP_COLOR_INFO), - - - // End of table (required) - PropData_End() -}; - - -#endif // !defined(RUN_ONLY) - - -// ============================================================================ -// -// ROUTINES USED UNDER FRAME EDITOR -// -// ============================================================================ - - -// -------------------- -// MakeIcon -// -------------------- -// Called once object is created or modified, just after setup. -// Also called before showing the "Insert an object" dialog if your object -// has no icon resource - -int WINAPI DLLExport MakeIconEx ( mv _far *mV, cSurface* pIconSf, LPTSTR lpName, fpObjInfo oiPtr, LPEDATA edPtr ) -{ -#ifndef RUN_ONLY - - pIconSf->Delete(); - pIconSf->Clone(*SDK->Icon); - - pIconSf->SetTransparentColor(RGB(255, 0, 255)); - -#endif // !defined(RUN_ONLY) - return 0; -} - - -// -------------------- -// CreateObject -// -------------------- -// Called when you choose "Create new object". It should display the setup box -// and initialize everything in the datazone. - -int WINAPI DLLExport CreateObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr) -{ -#ifndef RUN_ONLY - - // Check compatibility - if ( IS_COMPATIBLE(mV) ) - { - Edif::Init(mV, edPtr); - - // Set default object settings -// edPtr->swidth = 48; -// edPtr->sheight = 48; - - return 0; - } -#endif // !defined(RUN_ONLY) - - // Error - return -1; -} - -// -------------------- -// EditObject -// -------------------- -// Called when the user selects the Edit command in the object's popup menu -// -BOOL WINAPI EditObject (mv _far *mV, fpObjInfo oiPtr, fpLevObj loPtr, LPEDATA edPtr) -{ -#ifndef RUN_ONLY - // Check compatibility - if ( IS_COMPATIBLE(mV) ) - { - - } -#endif // !defined(RUN_ONLY) - return FALSE; -} - -// -------------------- -// SetEditSize -// -------------------- -// Called when the object has been resized -// -// Note: remove the comments if your object can be resized (and remove the comments in the .def file) -/* -BOOL WINAPI SetEditSize(LPMV mv, LPEDATA edPtr, int cx, int cy) -{ -#ifndef RUN_ONLY - edPtr->swidth = cx; - edPtr->sheight = cy; -#endif // !defined(RUN_ONLY) - return TRUE; // OK -} -*/ - -// -------------------- -// PutObject -// -------------------- -// Called when each individual object is dropped in the frame. -// -void WINAPI DLLExport PutObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr, ushort cpt) -{ -#ifndef RUN_ONLY -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// RemoveObject -// -------------------- -// Called when each individual object is removed from the frame. -// -void WINAPI DLLExport RemoveObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr, ushort cpt) -{ -#ifndef RUN_ONLY - // Is the last object removed? - if (0 == cpt) - { - Edif::Free(edPtr); - - // Do whatever necessary to remove our data - } -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// DuplicateObject -// -------------------- -// Called when an object is created from another one (note: should be called CloneObject instead...) -// -void WINAPI DLLExport DuplicateObject(mv __far *mV, fpObjInfo oiPtr, LPEDATA edPtr) -{ -#ifndef RUN_ONLY -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// GetObjectRect -// -------------------- -// Returns the size of the rectangle of the object in the frame editor. -// -void WINAPI DLLExport GetObjectRect(mv _far *mV, RECT FAR *rc, fpLevObj loPtr, LPEDATA edPtr) -{ -#ifndef RUN_ONLY - rc->right = rc->left + SDK->Icon->GetWidth(); // edPtr->swidth; - rc->bottom = rc->top + SDK->Icon->GetHeight(); // edPtr->sheight; -#endif // !defined(RUN_ONLY) - return; -} - - -// -------------------- -// EditorDisplay -// -------------------- -// Displays the object under the frame editor -// - -void WINAPI DLLExport EditorDisplay(mv _far *mV, fpObjInfo oiPtr, fpLevObj loPtr, LPEDATA edPtr, RECT FAR *rc) -{ -#ifndef RUN_ONLY - - LPSURFACE Surface = WinGetSurface((int) mV->mvIdEditWin); - - if(!Surface) - return; - - SDK->Icon->Blit(*Surface, rc->left, rc->top, BMODE_TRANSP, BOP_COPY, 0); - -#endif // !defined(RUN_ONLY) -} - - -// -------------------- -// IsTransparent -// -------------------- -// This routine tells MMF2 if the mouse pointer is over a transparent zone of the object. -// - -extern "C" BOOL WINAPI DLLExport IsTransparent(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr, int dx, int dy) -{ -#ifndef RUN_ONLY - // Write your code here -#endif // !defined(RUN_ONLY) - return FALSE; -} - -// -------------------- -// PrepareToWriteObject -// -------------------- -// Just before writing the datazone when saving the application, MMF2 calls this routine. -// -void WINAPI DLLExport PrepareToWriteObject(mv _far *mV, LPEDATA edPtr, fpObjInfo adoi) -{ -#ifndef RUN_ONLY - - // Write your code here -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// GetFilters -// -------------------- - -BOOL WINAPI GetFilters(LPMV mV, LPEDATA edPtr, DWORD dwFlags, LPVOID pReserved) -{ -#ifndef RUN_ONLY - // If your extension uses image filters -// if ( (dwFlags & GETFILTERS_IMAGES) != 0 ) -// return TRUE; - - // If your extension uses sound filters -// if ( (dwFlags & GETFILTERS_SOUNDS) != 0 ) -// return TRUE; -#endif // RUN_ONLY - return FALSE; -} - -// -------------------- -// UsesFile -// -------------------- -// Triggers when a file is dropped onto the frame -// Return TRUE if you can create an object from the given file -// -BOOL WINAPI DLLExport UsesFile (LPMV mV, LPTSTR fileName) -{ - BOOL r = FALSE; -#ifndef RUN_ONLY - - // Example: return TRUE if file extension is ".txt" -/* - LPSTR ext, npath; - - if ( fileName != NULL ) - { - if ( (ext=(LPSTR)malloc(_MAX_EXT)) != NULL ) - { - if ( (npath=(LPSTR)malloc(_MAX_PATH)) != NULL ) - { - strcpy(npath, fileName); - _splitpath(npath, NULL, NULL, NULL, ext); - if ( _stricmp(ext, ".txt") == 0 ) - r = TRUE; - free(npath); - } - free(ext); - } - } */ -#endif // !defined(RUN_ONLY) - return r; -} - - -// -------------------- -// CreateFromFile -// -------------------- -// Creates a new object from file -// -void WINAPI DLLExport CreateFromFile (LPMV mV, LPTSTR fileName, LPEDATA edPtr) -{ -#ifndef RUN_ONLY - // Initialize your extension data from the given file -// edPtr->swidth = 48; -// edPtr->sheight = 48; - - // Example: store the filename - // strcpy(edPtr->myFileName, fileName); -#endif // !defined(RUN_ONLY) -} - -// ============================================================================ -// -// PROPERTIES -// -// ============================================================================ - -// -------------------- -// GetProperties -// -------------------- -// Inserts properties into the properties of the object. -// -BOOL WINAPI DLLExport GetProperties(LPMV mV, LPEDATA edPtr, BOOL bMasterItem) -{ -#ifndef RUN_ONLY - mvInsertProps(mV, edPtr, Properties, PROPID_TAB_GENERAL, TRUE); -#endif // !defined(RUN_ONLY) - - // OK - return TRUE; -} - -// -------------------- -// ReleaseProperties -// -------------------- -// Called when the properties are removed from the property window. -// -void WINAPI DLLExport ReleaseProperties(LPMV mV, LPEDATA edPtr, BOOL bMasterItem) -{ -#ifndef RUN_ONLY - // Write your code here -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// GetPropCreateParam -// -------------------- -// Called when a property is initialized and its creation parameter is NULL (in the PropData). -// Allows you, for example, to change the content of a combobox property according to specific settings in the EDITDATA structure. -// -LPARAM WINAPI DLLExport GetPropCreateParam(LPMV mV, LPEDATA edPtr, UINT nPropID) -{ -#ifndef RUN_ONLY - // Example - // ------- -// if ( nPropID == PROPID_COMBO ) -// { -// switch (edPtr->sType) -// { -// case TYPE1: -// return (LPARAM)ComboList1; -// case TYPE2: -// return (LPARAM)ComboList2; -// } -// } -#endif // !defined(RUN_ONLY) - return NULL; -} - -// ---------------------- -// ReleasePropCreateParam -// ---------------------- -// Called after a property has been initialized. -// Allows you, for example, to free memory allocated in GetPropCreateParam. -// -void WINAPI DLLExport ReleasePropCreateParam(LPMV mV, LPEDATA edPtr, UINT nPropID, LPARAM lParam) -{ -#ifndef RUN_ONLY -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// GetPropValue -// -------------------- -// Returns the value of properties that have a value. -// Note: see GetPropCheck for checkbox properties -// -LPVOID WINAPI DLLExport GetPropValue(LPMV mV, LPEDATA edPtr, UINT nPropID) -{ -#ifndef RUN_ONLY - // Example - // ------- -// switch (nPropID) { -// -// // Returns a color. -// case PROPID_COLOR: -// return new CPropDWordValue(edPtr->dwColor); -// -// // Returns a string -// case PROPID_TEXT: -// return new CPropDataValue(&edPtr->szText[0]); -// -// // Returns the value of the combo box -// case PROPID_COMBO: -// return new CPropDWordValue(edPtr->nComboIndex); -// } - -#endif // !defined(RUN_ONLY) - return NULL; -} - -// -------------------- -// GetPropCheck -// -------------------- -// Returns the checked state of properties that have a check box. -// -BOOL WINAPI DLLExport GetPropCheck(LPMV mV, LPEDATA edPtr, UINT nPropID) -{ -#ifndef RUN_ONLY - // Example - // ------- -// switch (nPropID) { -// -// // Return 0 (unchecked) or 1 (checked) -// case PROPID_CHECK: -// return edPtr->nCheck; -// } - -#endif // !defined(RUN_ONLY) - return 0; // Unchecked -} - -// -------------------- -// SetPropValue -// -------------------- -// This routine is called by MMF after a property has been modified. -// -void WINAPI DLLExport SetPropValue(LPMV mV, LPEDATA edPtr, UINT nPropID, LPVOID lParam) -{ -#ifndef RUN_ONLY - // Gets the pointer to the CPropValue structure - CPropValue* pValue = (CPropValue*)lParam; - - // Example - // ------- -// switch (nPropID) { -// -// case PROPID_COMBO: -// // Simply grab the value -// edPtr->nComboIndex = ((CPropDWordValue*)pValue)->m_dwValue; -// break; - -// case PROPID_COLOR: -// // Here too, gets the value -// edPtr->dwColor = ((CPropDWordValue*)pValue)->m_dwValue; -// break; - -// case PROPID_TEXT: -// { -// // Gets the string -// LPSTR pStr = (LPSTR)((CPropDataValue*)pValue)->m_pData; -// -// // You can simply poke the string if your EDITDATA structure has a fixed size, -// // or have an adaptive size of structure like below -// -// // If the length is different -// if (strlen(pStr)!=strlen(edPtr->text)) -// { -// // Asks MMF to reallocate the structure with the new size -// LPEDATA pNewPtr = (LPEDATA)mvReAllocEditData(mV, edPtr, sizeof(EDITDATA)+strlen(pStr)); -// -// // If reallocation worked -// if (pNewPtr!=NULL) -// { -// // Copy the string -// edPtr=pNewPtr; -// strcpy(edPtr->text, pStr); -// } -// } -// else -// { -// // Same size : simply copy -// strcpy(edPtr->text, pStr); -// } -// } -// break; -// } - - // You may want to have your object redrawn in the frame editor after the modifications, - // in this case, just call this function - // mvInvalidateObject(mV, edPtr); - -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// SetPropCheck -// -------------------- -// This routine is called by MMF when the user modifies a checkbox in the properties. -// -void WINAPI DLLExport SetPropCheck(LPMV mV, LPEDATA edPtr, UINT nPropID, BOOL nCheck) -{ -#ifndef RUN_ONLY - // Example - // ------- -// switch (nPropID) -// { -// case PROPID_CHECK: -// edPtr->nCheck = nCheck; -// mvInvalidateObject(mV, edPtr); -// mvRefreshProp(mV, edPtr, PROPID_COMBO, TRUE); -// break; -// } -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// EditProp -// -------------------- -// This routine is called when the user clicks the button of a Button or EditButton property. -// -BOOL WINAPI DLLExport EditProp(LPMV mV, LPEDATA edPtr, UINT nPropID) -{ -#ifndef RUN_ONLY - - // Example - // ------- -/* - if (nPropID==PROPID_EDITCONTENT) - { - if ( EditObject(mV, NULL, NULL, edPtr) ) - return TRUE; - } -*/ - -#endif // !defined(RUN_ONLY) - return FALSE; -} - -// -------------------- -// IsPropEnabled -// -------------------- -// This routine returns the enabled state of a property. -// -BOOL WINAPI IsPropEnabled(LPMV mV, LPEDATA edPtr, UINT nPropID) -{ -#ifndef RUN_ONLY - // Example - // ------- -/* - switch (nPropID) { - - case PROPID_CHECK: - return (edPtr->nComboIndex != 0); - } -*/ -#endif // !defined(RUN_ONLY) - return TRUE; -} - - -// ============================================================================ -// -// TEXT PROPERTIES -// -// ============================================================================ - -// -------------------- -// GetTextCaps -// -------------------- -// Return the text capabilities of the object under the frame editor. -// -DWORD WINAPI DLLExport GetTextCaps(mv _far *mV, LPEDATA edPtr) -{ - return 0; // (TEXT_ALIGN_LEFT|TEXT_ALIGN_HCENTER|TEXT_ALIGN_RIGHT|TEXT_ALIGN_TOP|TEXT_ALIGN_VCENTER|TEXT_ALIGN_BOTTOM|TEXT_FONT|TEXT_COLOR); -} - -// -------------------- -// GetTextFont -// -------------------- -// Return the font used the object. -// Note: the pStyle and cbSize parameters are obsolete and passed for compatibility reasons only. -// -BOOL WINAPI DLLExport GetTextFont(mv _far *mV, LPEDATA edPtr, LPLOGFONT plf, LPTSTR pStyle, UINT cbSize) -{ -#if !defined(RUN_ONLY) - // Example: copy LOGFONT structure from EDITDATA - // memcpy(plf, &edPtr->m_lf, sizeof(LOGFONT)); -#endif // !defined(RUN_ONLY) - - return TRUE; -} - -// -------------------- -// SetTextFont -// -------------------- -// Change the font used the object. -// Note: the pStyle parameter is obsolete and passed for compatibility reasons only. -// -BOOL WINAPI DLLExport SetTextFont(mv _far *mV, LPEDATA edPtr, LPLOGFONT plf, LPCSTR pStyle) -{ -#if !defined(RUN_ONLY) - // Example: copy LOGFONT structure to EDITDATA - // memcpy(&edPtr->m_lf, plf, sizeof(LOGFONT)); -#endif // !defined(RUN_ONLY) - - return TRUE; -} - -// -------------------- -// GetTextClr -// -------------------- -// Get the text color of the object. -// -COLORREF WINAPI DLLExport GetTextClr(mv _far *mV, LPEDATA edPtr) -{ - // Example - return 0; // edPtr->fontColor; -} - -// -------------------- -// SetTextClr -// -------------------- -// Set the text color of the object. -// -void WINAPI DLLExport SetTextClr(mv _far *mV, LPEDATA edPtr, COLORREF color) -{ - // Example - //edPtr->fontColor = color; -} - -// -------------------- -// GetTextAlignment -// -------------------- -// Get the text alignment of the object. -// -DWORD WINAPI DLLExport GetTextAlignment(mv _far *mV, LPEDATA edPtr) -{ - DWORD dw = 0; -#if !defined(RUN_ONLY) - // Example - // ------- -/* if ( (edPtr->eData.dwFlags & ALIGN_LEFT) != 0 ) - dw |= TEXT_ALIGN_LEFT; - if ( (edPtr->eData.dwFlags & ALIGN_HCENTER) != 0 ) - dw |= TEXT_ALIGN_HCENTER; - if ( (edPtr->eData.dwFlags & ALIGN_RIGHT) != 0 ) - dw |= TEXT_ALIGN_RIGHT; - if ( (edPtr->eData.dwFlags & ALIGN_TOP) != 0 ) - dw |= TEXT_ALIGN_TOP; - if ( (edPtr->eData.dwFlags & ALIGN_VCENTER) != 0 ) - dw |= TEXT_ALIGN_VCENTER; - if ( (edPtr->eData.dwFlags & ALIGN_BOTTOM) != 0 ) - dw |= TEXT_ALIGN_BOTTOM; -*/ -#endif // !defined(RUN_ONLY) - return dw; -} - -// -------------------- -// SetTextAlignment -// -------------------- -// Set the text alignment of the object. -// -void WINAPI DLLExport SetTextAlignment(mv _far *mV, LPEDATA edPtr, DWORD dwAlignFlags) -{ -#if !defined(RUN_ONLY) - // Example - // ------- -/* DWORD dw = edPtr->eData.dwFlags; - - if ( (dwAlignFlags & TEXT_ALIGN_LEFT) != 0 ) - dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_LEFT; - if ( (dwAlignFlags & TEXT_ALIGN_HCENTER) != 0 ) - dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_HCENTER; - if ( (dwAlignFlags & TEXT_ALIGN_RIGHT) != 0 ) - dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_RIGHT; - - if ( (dwAlignFlags & TEXT_ALIGN_TOP) != 0 ) - dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_TOP; - if ( (dwAlignFlags & TEXT_ALIGN_VCENTER) != 0 ) - dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_VCENTER; - if ( (dwAlignFlags & TEXT_ALIGN_BOTTOM) != 0 ) - dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_BOTTOM; - - edPtr->eData.dwFlags = dw; -*/ -#endif // !defined(RUN_ONLY) -} - - -// ---------------------------------------------------------- -// Custom Parameters -// ---------------------------------------------------------- - -// -------------------- -// InitParameter -// -------------------- -// Initialize the parameter. -// -void WINAPI InitParameter(mv _far *mV, short code, paramExt* pExt) -{ -#if !defined(RUN_ONLY) - // Example - // ------- - // strcpy(&pExt->pextData[0], "Parameter Test"); - // pExt->pextSize = sizeof(paramExt) + strlen(pExt->pextData)+1; -#endif // !defined(RUN_ONLY) -} - -// Example of custom parameter setup proc -// -------------------------------------- -/* -#if !defined(RUN_ONLY) -BOOL CALLBACK DLLExport SetupProc(HWND hDlg, UINT msgType, WPARAM wParam, LPARAM lParam) -{ - paramExt* pExt; - - switch (msgType) - { - case WM_INITDIALOG: // Init dialog - - // Save edptr - SetWindowLong(hDlg, DWL_USER, lParam); - pExt=(paramExt*)lParam; - - SetDlgItemText(hDlg, IDC_EDIT, pExt->pextData); - return TRUE; - - case WM_COMMAND: // Command - - // Retrieve edptr - pExt = (paramExt *)GetWindowLong(hDlg, DWL_USER); - - switch (wmCommandID) - { - case IDOK: // Exit - GetDlgItemText(hDlg, IDC_EDIT, pExt->pextData, 500); - pExt->pextSize=sizeof(paramExt)+strlen(pExt->pextData)+1; - EndDialog(hDlg, TRUE); - return TRUE; - - default: - break; - } - break; - - default: - break; - } - return FALSE; -} -#endif // !defined(RUN_ONLY) -*/ - -// -------------------- -// EditParameter -// -------------------- -// Edit the parameter. -// -void WINAPI EditParameter(mv _far *mV, short code, paramExt* pExt) -{ -#if !defined(RUN_ONLY) - - // Example - // ------- - // DialogBoxParam(hInstLib, MAKEINTRESOURCE(DB_TRYPARAM), mV->mvHEditWin, SetupProc, (LPARAM)(LPBYTE)pExt); - -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// GetParameterString -// -------------------- -// Initialize the parameter. -// -void WINAPI GetParameterString(mv _far *mV, short code, paramExt* pExt, LPSTR pDest, short size) -{ -#if !defined(RUN_ONLY) - - // Example - // ------- - // wsprintf(pDest, "Super parameter %s", pExt->pextData); - -#endif // !defined(RUN_ONLY) -} +/* Edittime.cpp + * This file contains functions for the + * New Object dialog and the Frame Editor. + * For properties, see Properties.cpp. For + * custom parameters, see CustomParams.cpp. + * For text properties, see TextProps.cpp. + * Functions defined here: + * MakeIconEx + * UsesFile + * CreateFromFile + * CreateObject + * EditObject + * SetEditSize + * PutObject + * RemoveObject + * CloneObject + * GetObjectRect + * EditorDisplay + * IsTransparent + * PrepareToWriteObject + * GetFilters + */ + +#include "Common.h" + +/* CreateObject + * This is the first time you have + * access to the editdata, so it + * needs to be initialized with + * default values. Just be aware + * that if the user chooses to + * create your object from a file, + * CreateFromFile will be called + * instead of this function. + */ +int MMF2Func CreateObject(mv *mV, LO *lo, SerializedED *SED) +{ +#ifndef RUN_ONLY + if(IS_COMPATIBLE(mV)) //Make sure MMF2 hasn't changed in a way that makes your extension incompatible + { + Edif::Init(mV, SED); + + EditData().Serialize(mV, SED); //create & store the default editdata + + return 0; + } +#endif + return -1; +} + +/* MakeIconEx + * Lets you draw the icon dynamically + * by drawing into the Icon surface. The + * current example just uses the + * Icon.png from the resources. + */ +int MMF2Func MakeIconEx(mv *mV, cSurface *Icon, LPTSTR Name, OI *oi, SerializedED *SED) +{ +#ifndef RUN_ONLY + Icon->Delete(); + Icon->Clone(*SDK->Icon); + Icon->SetTransparentColor(RGB(255, 0, 255)); + return 0; +#endif + return -1; +} + +/* UsesFile + * When the user chooses "Create From + * File", MMF2 asks each extension if + * it supports being created from that + * file. Here you should investigate + * the file and see if your extension + * can be created from it in the + * CreateFromFile function below. You + * can simply check the file extension, + * for example. + */ +BOOL MMF2Func UsesFile(mv *mV, LPTSTR FileName) +{ +#ifndef RUN_ONLY + if(IS_COMPATIBLE(mV)) //check for compatibility, since you can't return an error from CreateFromFile + { +// char ext[_MAX_EXT]; +// _tsplitpath(FileName, 0, 0, 0, ext); +// if(stdtstring(".iherebydeclarethatthisfilecontainsmyintmystringandmyarray") == ext) +// { +// return TRUE; +// } + } +#endif + return FALSE; +} + +/* CreateFromFile + * If the user decides to create your object + * from the file you said you were OK with + * above, this is where you take that file + * and actually create your object from it. + * The CreateObject function up above will + * not have executed, so you need to initialize + * the editdata just as you would in CreateObject. + */ +void MMF2Func CreateFromFile(mv *mV, LPTSTR FileName, SerializedED *SED) +{ +#ifndef RUN_ONLY + Edif::Init(mV, SED); + + EditData ed; //default EditData +// std::ifstream in (FileName); +// EditData::MyArray_t::size_type MyArray_size; +// in >> ed.MyString >> ed.MyInt >> MyArray_size; +// ed.MyArray.clear(); +// for(EditData::MyArray_t::size_type i = 0; i < MyArray_size; ++i) +// { +// ed.MyArray.push_back(0); +// in >> ed.MyArray.back(); +// } + ed.Serialize(mV, SED); +#endif +} + +/* PutObject + * Each time a duplicate is made of your + * object, MMF2 calls this function to + * let you know. You still share the same + * editdata, the difference is the + * LevelObject pointer and the number of + * duplicates. + */ +void MMF2Func PutObject(mv *mV, LO *lo, SerializedED *SED, ushort NDup) +{ +#ifndef RUN_ONLY + if(NDup == 1) //is this the first object being created? + { + //You can put common code to both + //CreateObject and CreateFromFile + //as this function will execute + //after either one. + } +#endif +} + +/* RemoveObject + * Just the opposite of the above, when + * the user removes an instance of your + * object. This also functions as a + * DestroyObject function of sorts when + * NDup == 1. + */ +void MMF2Func RemoveObject(mv *mV, LO *lo, SerializedED *SED, ushort NDup) +{ +#ifndef RUN_ONLY + if(NDup == 1) //is this the last object being removed? + { + Edif::Free(SED); + // + } +#endif +} + +/* CloneObject + * When the user makes a clone of your object + * (not just another instance), MMF2 copies the + * contents of the editdata and then lets you + * know that the editdata in question is in + * new hands. Here you can 'fix' anything that + * might be caused by directly copying the + * editdata, though you should never have + * any problems like that in the first place. + */ +void MMF2Func CloneObject(mv *mV, OI *oi, SerializedED *SED) +{ +#ifndef RUN_ONLY + // +#endif +} + +/* EditObject + * If the user double-clicks your object icon + * or chooses the Edit option from a context + * menu, this function is called. This is useful + * as a que to bring up an animation editor for + * animations in your object. Return TRUE if + * changes were made to the editdata, and FALSE + * otherwise. + */ +BOOL MMF2Func EditObject (mv *mV, OI *oi, LO *lo, SerializedED *SED) +{ +#ifndef RUN_ONLY + // +#endif + return FALSE; +} + +/* SetEditSize + * If your object is resizeable, MMF2 calls this + * to let you know that the user has just requested + * a resize of the object. You can take the new + * size as is, or if it reminds you too much of + * 500 page essays you can limit the size to whatever + * you want. If you uncomment this function, make + * sure you also uncomment it in Ext.def. The + * presence of this function tells MMF2 that your + * object can be resized; otherwise it can't. + */ +/*BOOL MMF2Func SetEditSize(mv *mV, SerializedED *SED, int x, int y) +{ +#ifndef RUN_ONLY + EditData ed (SED); + ed.Width = x; + ed.Height = y; + ed.Serialize(mV, SED); + return TRUE; +#endif + return FALSE; +}*/ + +/* GetObjectRect + * MMF2 wants to know from time to time how much + * space your object is taking up on the frame + * editor. Currently this just gives the size of + * your Icon.png, but you can change it to parallel + * with the SetEditSize function above. + */ +void MMF2Func GetObjectRect(mv *mV, RECT *rect, LO *lo, SerializedED *SED) +{ +#ifndef RUN_ONLY + rect->right = rect->left + SDK->Icon->GetWidth(); + rect->bottom = rect->top + SDK->Icon->GetHeight(); +#endif +} + + +/* EditorDisplay + * This function does the work of drawing your + * object on the frame editor. In this example, + * the Icon.png file is simply drawn to the + * frame, but you can change this to draw + * anything you want. + */ +void MMF2Func EditorDisplay(mv *mV, OI *oi, LO *lo, SerializedED *SED, RECT *rect) +{ +#ifndef RUN_ONLY + cSurface *Surface = WinGetSurface(int(mV->mvIdEditWin)); //get access to the frame editor surface + if(!Surface) return; //failure + SDK->Icon->Blit(*Surface, rect->left, rect->top, BMODE_TRANSP, BOP_COPY, 0); //copy the icon onto the frame editor surface +#endif +} + + +/* IsTransparent + * MMF2 calls this to ask if the mouse pointer + * is over a transparent part of your object. + * Don't ask why this isn't called "IsOpaque", + * just accept that it isn't and move on. If the + * given coordinates are over an opaque part of + * your object, return TRUE, otherwise return + * FALSE. (Protip: MMF2 calls this function a + * LOT. Don't put a MessageBox function in here + * or any other kind of debug function.) + */ +extern "C" BOOL MMF2Func IsTransparent(mv *mV, LO *lo, SerializedED *SED, int x, int y) +{ +#ifndef RUN_ONLY + // +#endif + return FALSE; +} + +/* PrepareToWriteObject (DEPRECATED) + * Just before MMF2 writes the editdata to the MFA, + * it calls this function to let you clean up + * a temporary copy of the editdata. Because you + * intelligently designed your EditData::Serialize + * function to always save cleaned data anyway, + * this function is useless. + */ +void MMF2Func PrepareToWriteObject(mv *, SerializedED *, OI *){} + +/* GetFilters + * When the MFA filters are set to Automatic, MMF2 + * asks your extension if it uses filters or not. + * If you use any of either kind of filters, return + * TRUE for that kind. + */ +BOOL MMF2Func GetFilters(mv *mV, SerializedED *SED, DWORD Flags, void *) +{ +#ifndef RUN_ONLY + //If your extension uses image filters +// if((dwFlags & GETFILTERS_IMAGES) != 0) return TRUE; + + //If your extension uses sound filters +// if((dwFlags & GETFILTERS_SOUNDS) != 0) return TRUE; +#endif + return FALSE; +} diff --git a/Extensions/Template/Expressions.cpp b/Extensions/Template/Expressions.cpp index 6ddc908..fe1d1eb 100644 --- a/Extensions/Template/Expressions.cpp +++ b/Extensions/Template/Expressions.cpp @@ -1,12 +1,20 @@ - -#include "Common.h" - -int Extension::Add(int First, int Second) -{ - return First + Second; -} - -const char * Extension::HelloWorld() -{ - return "Hello world!"; -} \ No newline at end of file +/* Conditions.cpp + * This is where you should define the + * behavior of your conditions. Make sure + * the parameters and return types match those + * in the JSON exactly! Double check Extension.h + * as well. + */ + +#include "Common.h" + +int Extension::Add(int First, int Second) +{ + return First + Second; +} + +const TCHAR *Extension::HelloWorld() +{ + return _T("Hello world!"); + //return Runtime.CopyString(MyString.c_str()); //for stdtstrings +} diff --git a/Extensions/Template/Ext.def b/Extensions/Template/Ext.def index 9c45d91..b6615f8 100644 --- a/Extensions/Template/Ext.def +++ b/Extensions/Template/Ext.def @@ -1,110 +1,118 @@ - -EXPORTS - GetInfos @2 - LoadObject @6 - UnloadObject @7 - PutObject @8 - RemoveObject @9 - MakeIconEx @11 - - CreateObject @14 - GetHelpFileName @16 - EditObject @18 - GetObjectRect @19 - EditorDisplay @20 - IsTransparent @21 - PrepareToWriteObject @22 - UpdateFileNames @23 -; EnumElts @24 - Initialize @25 - Free @26 -; ExportTexts @27 -; ImportTexts @28 -; GetSubType @29 - UsesFile @30 - CreateFromFile @31 - DuplicateObject @32 - GetObjInfos @36 - - GetTextCaps @37 - GetTextAlignment @38 - SetTextAlignment @39 - GetTextFont @40 - SetTextFont @41 - GetTextClr @42 - SetTextClr @43 - - GetDependencies @44 - GetFilters @45 - -; conditionsTable @47 -; actionsTable @48 -; expressionsTable @49 - - CreateRunObject @50 - DestroyRunObject @51 - HandleRunObject @52 - DisplayRunObject @53 - PauseRunObject @57 - ContinueRunObject @58 - GetRunObjectInfos @59 - - GetConditionMenu @60 - GetActionMenu @61 - GetExpressionMenu @62 - GetConditionCodeFromMenu @63 - GetActionCodeFromMenu @64 - GetExpressionCodeFromMenu @65 - GetConditionString @66 - GetActionString @67 - GetExpressionString @68 - InitParameter @69 - EditParameter @70 - GetParameterString @71 - GetConditionTitle @72 - GetActionTitle @73 - GetExpressionTitle @74 - GetConditionInfos @75 - GetActionInfos @76 - GetExpressionInfos @77 - UpdateEditStructure @78 - GetRunObjectDataSize @80 -; SaveBackground @81 -; RestoreBackground @82 -; KillBackground @83 -; WindowProc @84 - StartApp @85 - EndApp @86 - StartFrame @87 - EndFrame @88 - GetExpressionParam @89 - -; GetRunObjectSurface @90 -; GetRunObjectCollisionMask @91 - -; GetRunObjectFont @92 -; SetRunObjectFont @93 -; GetRunObjectTextColor @94 -; SetRunObjectTextColor @95 - -; SetEditSize @99 - GetProperties @100 - ReleaseProperties @101 - GetPropValue @102 - SetPropValue @103 - IsPropEnabled @104 - GetPropCheck @105 - SetPropCheck @106 - GetPropCreateParam @107 - ReleasePropCreateParam @108 - EditProp @109 - GetDebugTree @110 - GetDebugItem @111 - EditDebugItem @112 - - SaveRunObject @113 - LoadRunObject @114 - - PrepareFlexBuild @115 - - \ No newline at end of file +; Ext.def +; This is how the linker knows +; which functions to export and +; what names and ordinals the +; exported functions should +; have. If you implemented a +; function that was commented +; out, remove the semicolon comment +; before it in this file. +; + +EXPORTS + GetInfos @2 + LoadObject @6 + UnloadObject @7 + PutObject @8 + RemoveObject @9 + MakeIconEx @11 + + CreateObject @14 + GetHelpFileName @16 + EditObject @18 + GetObjectRect @19 + EditorDisplay @20 + IsTransparent @21 + PrepareToWriteObject @22 + UpdateFileNames @23 +; EnumElts @24 + Initialize=InitExtension @25 + Free=FreeExtension @26 +; ExportTexts @27 +; ImportTexts @28 +; GetSubType @29 + UsesFile @30 + CreateFromFile @31 + DuplicateObject=CloneObject @32 + GetObjInfos @36 + + GetTextCaps @37 + GetTextAlignment @38 + SetTextAlignment @39 + GetTextFont @40 + SetTextFont @41 + GetTextClr @42 + SetTextClr @43 + + GetDependencies @44 + GetFilters @45 + +; conditionsTable @47 +; actionsTable @48 +; expressionsTable @49 + + CreateRunObject @50 + DestroyRunObject @51 + HandleRunObject @52 + DisplayRunObject @53 + PauseRunObject @57 + ContinueRunObject @58 + GetRunObjectInfos @59 + + GetConditionMenu @60 + GetActionMenu @61 + GetExpressionMenu @62 + GetConditionCodeFromMenu @63 + GetActionCodeFromMenu @64 + GetExpressionCodeFromMenu @65 + GetConditionString @66 + GetActionString @67 + GetExpressionString @68 + InitParameter @69 + EditParameter @70 + GetParameterString @71 + GetConditionTitle @72 + GetActionTitle @73 + GetExpressionTitle @74 + GetConditionInfos @75 + GetActionInfos @76 + GetExpressionInfos @77 + UpdateEditStructure @78 + GetRunObjectDataSize @80 +; SaveBackground @81 +; RestoreBackground @82 +; KillBackground @83 +; WindowProc @84 + StartApp @85 + EndApp @86 + StartFrame @87 + EndFrame @88 + GetExpressionParam @89 + +; GetRunObjectSurface @90 +; GetRunObjectCollisionMask @91 + +; GetRunObjectFont @92 +; SetRunObjectFont @93 +; GetRunObjectTextColor @94 +; SetRunObjectTextColor @95 + +; SetEditSize @99 + GetProperties @100 + ReleaseProperties @101 + GetPropValue @102 + SetPropValue @103 + IsPropEnabled @104 + GetPropCheck @105 + SetPropCheck @106 + GetPropCreateParam @107 + ReleasePropCreateParam @108 + EditProp @109 + GetDebugTree @110 + GetDebugItem @111 + EditDebugItem @112 + + SaveRunObject @113 + LoadRunObject @114 + + PrepareFlexBuild @115 diff --git a/Extensions/Template/Ext.json b/Extensions/Template/Ext.json index 8215649..2e28227 100644 --- a/Extensions/Template/Ext.json +++ b/Extensions/Template/Ext.json @@ -1,91 +1,72 @@ -{ - "About": { - "Name": "Example object", - "Author": "Your Name", - "Copyright": "Copyright (C) 2012 Your Name", - "Comment": "A sentence or two to describe your extension", - "URL": "http://www.example.com", - "Help": "Help/Example.chm", - "Identifier": "EXMP" - }, - "ActionMenu": [ - [ - 0, - "Action Example" - ], - "Separator", - [ - "Sub Menu", - [ - 1, - "Second Action Example" - ] - ] - ], - "ConditionMenu": [ - [ - 0, - "Are two numbers equal?" - ] - ], - "ExpressionMenu": [ - [ - 0, - "Add two numbers" - ], - [ - 1, - "Hello world" - ] - ], - "Actions": [ - { - "Title": "Action Example with parameter %0", - "Parameters": [ - [ - "Integer", - "Example Parameter" - ] - ] - }, - { - "Title": "Second Action Example" - } - ], - "Conditions": [ - { - "Title": "%o : Are %0 and %1 equal?", - "Parameters": [ - [ - "Integer", - "First number" - ], - [ - "Integer", - "Second number" - ] - ], - "Triggered": false - } - ], - "Expressions": [ - { - "Title": "Add(", - "Returns": "Integer", - "Parameters": [ - [ - "Integer", - "First number" - ], - [ - "Integer", - "Second number" - ] - ] - }, - { - "Title": "HelloWorld$(", - "Returns": "Text" - } - ] +{ + "About": + { + "Name": "EDIF Template Object", + "Author": "Your Name", + "Copyright": "Copyright © 2012 Your Name", + "Comment": "A sentence or two to describe your extension,\nwith up to four lines of text.", + "URL": "http://www.example.com/", + "Help": "Help/My New EDIF Extension/Help.chm", + "Identifier": "X&pl" + }, + + "ActionMenu": + [ + "Separator", + [0, "Action Example"], + "Separator", + ["Sub Menu", + [1, "Second Action Example"] + ], + "Separator" + ], + "ConditionMenu": + [ + "Separator", + [0, "Are two numbers equal?"] + ], + "ExpressionMenu": + [ + "Separator", + [0, "Add two numbers"], + [1, "Hello world"], + "Separator" + ], + + "Actions": + [ + { "Title": "Action Example with parameter %0", + "Parameters": + [ + ["Integer", "Example Parameter"] + ] + }, + { "Title": "Second Action Example" + } + ], + "Conditions": + [ + { "Title": "%o: Are %0 and %1 equal?", + "Parameters": + [ + ["Integer", "First number"], + ["Integer", "Second number"] + ], + "Triggered": false + } + ], + "Expressions": + [ + { "Title": "Add(", + "Returns": "Integer", + "Parameters": + [ + ["Integer", "First number"], + ["Integer", "Second number"] + ] + }, + { "Title": "HelloWorld$(", + "Returns": "Text" + } + ] } \ No newline at end of file diff --git a/Extensions/Template/Ext.rc b/Extensions/Template/Ext.rc index c4b5941..8dd4b8f 100644 --- a/Extensions/Template/Ext.rc +++ b/Extensions/Template/Ext.rc @@ -1,156 +1,156 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "..\..\Inc\ccx.h" -#define APSTUDIO_HIDDEN_SYMBOLS -#include "windows.h" -#undef APSTUDIO_HIDDEN_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -1 VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x0L -#ifdef _DEBUG - FILEFLAGS 0x21L -#else - FILEFLAGS 0x20L -#endif - FILEOS 0x10001L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "Clickteam" - VALUE "FileDescription", "Edif Object" - VALUE "FileVersion", "2.00" - VALUE "InternalName", "EdifExt" - VALUE "LegalCopyright", "Copyright © 2012 Clickteam" - VALUE "OriginalFilename", "EdifExt.mfx" - VALUE "ProductVersion", "1, 0, 0, 1" - VALUE "SpecialBuild", "00000001" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// RCDATA -// - -KPX_MAGICNUMBER RCDATA -BEGIN - 0x2516, 0x5908 -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""..\\..\\Inc\\ccx.h""\r\n" - "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""windows.h""\r\n" - "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - KPX_MARK "MF2" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.K.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// EDIF -// - -#if defined(APSTUDIO_INVOKED) || defined(EDITOR) -#if defined(APSTUDIO_INVOKED) -IDR_EDIF_ICON$(EDITOR) EDIF "Icon.png" -#else -IDR_EDIF_ICON EDIF "Icon.png" -#endif -#endif -IDR_EDIF_JSON EDIF "Ext.json" -#endif // English (U.K.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "..\..\Inc\ccx.h" +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +1 VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x0L +#ifdef _DEBUG + FILEFLAGS 0x21L +#else + FILEFLAGS 0x20L +#endif + FILEOS 0x10001L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "Clickteam" + VALUE "FileDescription", "Edif Object" + VALUE "FileVersion", "2.00" + VALUE "InternalName", "EdifExt" + VALUE "LegalCopyright", "Copyright © 2012 Clickteam" + VALUE "OriginalFilename", "EdifExt.mfx" + VALUE "ProductVersion", "1, 0, 0, 1" + VALUE "SpecialBuild", "00000001" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// RCDATA +// + +KPX_MAGICNUMBER RCDATA +BEGIN + 0x2516, 0x5908 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""..\\..\\Inc\\ccx.h""\r\n" + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + KPX_MARK "MF2" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.K.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// EDIF +// + +#if defined(APSTUDIO_INVOKED) || defined(EDITOR) +#if defined(APSTUDIO_INVOKED) +IDR_EDIF_ICON$(EDITOR) EDIF "Icon.png" +#else +IDR_EDIF_ICON EDIF "Icon.png" +#endif +#endif +IDR_EDIF_JSON EDIF "Ext.json" +#endif // English (U.K.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Extensions/Template/Extension.cpp b/Extensions/Template/Extension.cpp index 287df33..3ae9795 100644 --- a/Extensions/Template/Extension.cpp +++ b/Extensions/Template/Extension.cpp @@ -1,160 +1,172 @@ - -#include "Common.h" - - -/// -/// EXTENSION CONSTRUCTOR/DESTRUCTOR -/// - -Extension::Extension(LPRDATA _rdPtr, LPEDATA edPtr, fpcob cobPtr) - : rdPtr(_rdPtr), rhPtr(_rdPtr->rHo.hoAdRunHeader), Runtime(_rdPtr) -{ - /* - Link all your action/condition/expression functions to their IDs to match the - IDs in the JSON here - */ - - LinkAction(0, ActionExample); - LinkAction(1, SecondActionExample); - - LinkCondition(0, AreTwoNumbersEqual); - - LinkExpression(0, Add); - LinkExpression(1, HelloWorld); - - - /* - This is where you'd do anything you'd do in CreateRunObject in the original SDK - - It's the only place you'll get access to edPtr at runtime, so you should transfer - anything from edPtr to the extension class here. - - */ - - - -} - -Extension::~Extension() -{ - /* - This is where you'd do anything you'd do in DestroyRunObject in the original SDK. - (except calling destructors and other such atrocities, because that's automatic in Edif) - */ - - - -} - - -short Extension::Handle() -{ - /* - If your extension will draw to the MMF window you should first - check if anything about its display has changed : - - if (rdPtr->roc.rcChanged) - return REFLAG_DISPLAY; - else - return 0; - - You will also need to make sure you change this flag yourself - to 1 whenever you want to redraw your object - - If your extension won't draw to the window, but it still needs - to do something every MMF loop use : - - return 0; - - If you don't need to do something every loop, use : - - return REFLAG_ONESHOT; - - This doesn't mean this function can never run again. If you want MMF - to handle your object again (causing this code to run) use this function: - - Runtime.Rehandle(); - - At the end of the loop this code will run - - */ - - // Will not be called next loop - return REFLAG_ONESHOT; -} - - -short Extension::Display() -{ - /* - If you return REFLAG_DISPLAY in Handle() this routine will run. - */ - - // Ok - return 0; -} - -short Extension::Pause() -{ - - // Ok - return 0; -} - -short Extension::Continue() -{ - - // Ok - return 0; -} - -bool Extension::Save(HANDLE File) -{ - bool OK = false; - - #ifndef VITALIZE - - // Save the object's data here - - OK = true; - - #endif - - return OK; -} - -bool Extension::Load(HANDLE File) -{ - bool OK = false; - - #ifndef VITALIZE - - // Load the object's data here - - OK = true; - - #endif - - return OK; -} - - -// These are called if there's no function linked to an ID - -void Extension::Action(int ID, LPRDATA rdPtr, long param1, long param2) -{ - -} - -long Extension::Condition(int ID, LPRDATA rdPtr, long param1, long param2) -{ - - return false; -} - -long Extension::Expression(int ID, LPRDATA rdPtr, long param) -{ - - return 0; -} - + +#include "Common.h" + +/* + * This is your extension's constructor, which + * is the replacement for the old CreateRunObject + * function. You don't need to manually call + * constructors or pointlessly initialize + * pointers with dynamic memory. Just link + * your A/C/Es, perform initialization steps, and + * you're good to go. + */ +Extension::Extension(RD *rd, SerializedED *SED, createObjectInfo *COB) : rd(rd), rh(rd->rHo.hoAdRunHeader), Runtime(rd) +{ + //Link all your action/condition/expression functions + //to their IDs to match the IDs in the JSON here. + LinkAction(0, ActionExample); + LinkAction(1, SecondActionExample); + + LinkCondition(0, AreTwoNumbersEqual); + + LinkExpression(0, Add); + LinkExpression(1, HelloWorld); + + + //This is where you'd do anything you'd do in CreateRunObject in the original SDK. + //It's the only place you'll get access to the editdata at runtime, so you should + //transfer anything from the editdata to the extension class here. For example: +// EditData ed (SED); +// MyString = ed.MyString; +// MyInt = ed.MyInt; +// MyArray = ed.MyArray; + + // +} + +/* + * This is your extension's destructor, the + * replacement for DestroyRunObject. No calling + * destructors manually or deallocating pointless + * dynamic memory - in most cases this function + * won't need any code written. + */ +Extension::~Extension() +{ + // +} + +/* Handle + * MMF2 calls this function to let your extension + * "live" - if you want, you can have MMF2 call this + * every frame. This is where you'd, for instance, + * simulate physics or move an object. This is + * the analagous function to the old HandleRunObject. + */ +short Extension::Handle() +{ + /* + If your extension will draw to the MMF window you should first + check if anything about its display has changed : + + if (rd->roc.rcChanged) return REFLAG_DISPLAY; + else return 0; + + You will also need to make sure you change this flag yourself + to 1 whenever you want to redraw your object + + If your extension won't draw to the window, but it still needs + to do something every MMF2 loop use: + + return 0; + + If you don't need to do something every loop, use : + + return REFLAG_ONESHOT; + + This doesn't mean this function can never run again. If you want MMF2 + to handle your object again (causing this code to run) use this function: + + Runtime.Rehandle(); + + At the end of the event loop this code will run. + + */ + + // Will not be called next loop + return REFLAG_ONESHOT; +} + +/* Display + * This is the analagous function to + * DisplayRunObject. If you return + * REFLAG_DISPLAY in Handle() this + * routine will run. If you want MMF2 + * to apply ink effects for you, then + * implement GetRunObjectSurface in + * Runtime.cpp instead. + */ +short Extension::Display() +{ + return 0; +} + +/* Pause + * If your extension plays sound, for + * example, then MMF2 calls this to + * let you know to pause the music, + * usually by another extension's request + * or by the player pausing the applcation. + */ +short Extension::Pause() +{ + return 0; +} + +/* Continue + * Opposite to the above, MMF2 lets + * you know that the silence is over; + * your extension may live again. + */ +short Extension::Continue() +{ + return 0; +} + +/* Save + * When the user uses the Save + * Frame Position action, you need + * so serialize your runtime data to + * the File given. It is a Windows + * file handle, but you can use some + * of MMF2's built-in functions for + * writing files. Check the MMF2SDK + * Help file for more information. + */ +bool Extension::Save(HANDLE File) +{ + return true; +} + +/* Load + * As opposed to above, here you need to + * restore your extension's runtime state + * from the given file. Only read what you + * wrote! + */ +bool Extension::Load(HANDLE File) +{ + return true; +} + + +/* Action, Condition, Expression + * These are called if there's no function linked + * to an ID. You may want to put MessageBox calls + * to let you know that the ID is unlinked, or you + * may just want to use unlinked A/C/Es as a feature. + */ +void Extension::Action(int ID, RD *rd, long param1, long param2) +{ +} + +long Extension::Condition(int ID, RD *rd, long param1, long param2) +{ + return false; //hopefully StringComparison (PARAM_CMPSTRING) is not used, or this may crash +} + +long Extension::Expression(int ID, RD *rd, long param) +{ + return long(""); //so that unlinked expressions that return strings won't crash +} + diff --git a/Extensions/Template/Extension.h b/Extensions/Template/Extension.h index c3fee2e..acc6db0 100644 --- a/Extensions/Template/Extension.h +++ b/Extensions/Template/Extension.h @@ -1,83 +1,145 @@ - -class Extension -{ -public: - - LPRDATA rdPtr; - LPRH rhPtr; - - Edif::Runtime Runtime; - - static const int MinimumBuild = 251; - static const int Version = 1; - - static const int OEFLAGS = 0; - static const int OEPREFS = 0; - - static const int WindowProcPriority = 100; - - Extension(LPRDATA rdPtr, LPEDATA edPtr, fpcob cobPtr); - ~Extension(); - - - /* Add any data you want to store in your extension to this class - (eg. what you'd normally store in rdPtr) - - Unlike rdPtr, you can store real C++ objects with constructors - and destructors, without having to call them manually or store - a pointer. - */ - - // int MyVariable; - - - - - /* Add your actions, conditions and expressions as real class member - functions here. The arguments (and return type for expressions) must - match EXACTLY what you defined in the JSON. - - Remember to link the actions, conditions and expressions to their - numeric IDs in the class constructor (Extension.cpp) - */ - - /// Actions - - void ActionExample(int ExampleParameter); - void SecondActionExample(); - - /// Conditions - - bool AreTwoNumbersEqual(int FirstNumber, int SecondNumber); - - /// Expressions - - int Add(int FirstNumber, int SecondNumber); - const char * HelloWorld(); - - - - /* These are called if there's no function linked to an ID */ - - void Action(int ID, LPRDATA rdPtr, long param1, long param2); - long Condition(int ID, LPRDATA rdPtr, long param1, long param2); - long Expression(int ID, LPRDATA rdPtr, long param); - - - - - /* These replace the functions like HandleRunObject that used to be - implemented in Runtime.cpp. They work exactly the same, but they're - inside the extension class. - */ - - short Handle(); - short Display(); - - short Pause(); - short Continue(); - - bool Save(HANDLE File); - bool Load(HANDLE File); - +/* Extension.h + * This is where you define your extension + * class. Runtime variables and function + * declarations go in here; A/C/E function + * definitions go in their respective .cpp + * files, other function definitions go in + * Extension.cpp. This header is included + * at the bottom of Common.h, so you have + * access to everything included by it. + */ + +class Extension +{ +public: + /* rd + * This is a pointer to the classic + * RunData structure. Some things still + * have to be stored there for MMF2's + * sake, so you need to have acces to + * that data. + */ + RD *rd; + /* rh + * This is a pointer to the RunHeader + * structure, which contains some + * application information. + */ + RunHeader *rh; + + /* Runtime + * This is EDIF's compendium of useful + * functions for every day life as an + * extension. You can trigger immediate + * events, read and write global data, + * etc. See the EDIF Help file for + * more information. + */ + Edif::Runtime Runtime; + + /* MinimumBuild + * Always set this to the latest build + * of MMF2 that has been released, unless + * you need to set it higher for a beta + * version of MMF2 to get access to some + * new SDK feature. + */ + static const int MinimumBuild = 255; + /* Version + * This is the version of your extension + * that is stored in the editdata. You should + * only change this when your editdata structure + * changes, not just when you have a new version + * of your extension with new features. + */ + static const int Version = 1; + + /* OEFLAGS, OEPREFS + * These are settings for your extension + * that tell MMF2 how to treat your extension + * and what behaviors and responsibilities + * to add. Check the MMF2SDK Help file for + * more detailed information on the flags you + * can set and what they implicate. + */ + static const int OEFLAGS = OEFLAG_VALUES|OEFLAG_RUNBEFOREFADEIN|OEFLAG_NEVERKILL; + static const int OEPREFS = 0; + + /* WindowProcPrioerity + * If your extension creates a Window + * and implements the WindowProc function, + * this is the priority for that stuff. + */ + static const int WindowProcPriority = 100; + + Extension(RD *rd, SerializedED *SED, createObjectInfo *COB); //defined & documented in Extension.cpp + ~Extension(); //defined & documented in Extension.cpp + + + /* Add any data you want to store in your + * extension to this class (eg. what you'd + * normally store in the rundata). Unlike + * other SDKs, you can store real C++ + * objects with constructors and destructors, + * without having to call them manually or + * store a pointer. + */ + + //stdtstring MyString; + //int MyInt; + //std::vector MyArray; + + + /* Add your actions, conditions and expressions + * as real class member functions here. The + * arguments (and return types for expressions/conditions) + * must match EXACTLY what you defined in the JSON. + * As a handy tip, all parameters will be either + * a pointer, an int, or a float (each only 4 bytes) + * and the same applies to return types. Remember to + * link the actions, conditions and expressions to their + * numeric IDs in the class constructor in Extension.cpp. + */ + + //Actions + void ActionExample(int ExampleParameter); + void SecondActionExample(); + + //Conditions + bool AreTwoNumbersEqual(int FirstNumber, int SecondNumber); + + //Expressions + int Add(int FirstNumber, int SecondNumber); + const char * HelloWorld(); + + + /* Action, Condition, Expression + * These are called if there's no function linked + * to an ID. You may want to put MessageBox calls + * to let you know that the ID is unlinked, or you + * may just want to use unlinked A/C/Es as a feature. + */ + + void Action(int ID, RD *rd, long param1, long param2); + long Condition(int ID, RD *rd, long param1, long param2); + long Expression(int ID, RD *rd, long param); + + + + + /* Handle, Display, Pause, Continue, Save, Load + * These replace the functions like HandleRunObject + * that used to be implemented in Runtime.cpp. They + * work exactly the same, but they're inside the + * extension class. + */ + short Handle(); + short Display(); + + short Pause(); + short Continue(); + + bool Save(HANDLE File); + bool Load(HANDLE File); + }; \ No newline at end of file diff --git a/Extensions/Template/General.cpp b/Extensions/Template/General.cpp index 41f53af..19ab147 100644 --- a/Extensions/Template/General.cpp +++ b/Extensions/Template/General.cpp @@ -1,165 +1,165 @@ - -// ============================================================================ -// -// The following routines are used internally by MMF, and should not need to -// be modified. -// -// -// ============================================================================ - -#include "Common.h" - -HINSTANCE hInstLib; - -// ============================================================================ -// -// LIBRARY ENTRY & QUIT POINTS -// -// ============================================================================ - -// ----------------- -// Entry points -// ----------------- -// Usually you do not need to do any initialization here: you will prefer to -// do them in "Initialize" found in Edittime.cpp -BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) -{ - switch (dwReason) - { - // DLL is attaching to the address space of the current process. - case DLL_PROCESS_ATTACH: - - hInstLib = hDLL; // Store HINSTANCE - break; - - // A new thread is being created in the current process. - case DLL_THREAD_ATTACH: - break; - - // A thread is exiting cleanly. - case DLL_THREAD_DETACH: - break; - - // The calling process is detaching the DLL from its address space. - case DLL_PROCESS_DETACH: - break; - } - - return TRUE; -} - - - -// ----------------- -// Initialize -// ----------------- -// Where you want to do COLD-START initialization. -// Called when the extension is loaded into memory. -// -extern "C" int WINAPI DLLExport Initialize(mv _far *mV, int quiet) -{ - return Edif::Init(mV); - - - // No error - return 0; -} - -// ----------------- -// Free -// ----------------- -// Where you want to kill and initialized data opened in the above routine -// Called just before freeing the DLL. -// -extern "C" int WINAPI DLLExport Free(mv _far *mV) -{ - Edif::Free(mV); - - // No error - return 0; -} - -// ============================================================================ -// -// GENERAL INFO -// -// ============================================================================ - - -// ----------------- -// LoadObject -// ----------------- -// Routine called for each object when the object is read from the MFA file (edit time) -// or from the CCN or EXE file (run time). -// You can load data here, reserve memory etc... -// -int WINAPI DLLExport LoadObject(mv _far *mV, LPCSTR fileName, LPEDATA edPtr, int reserved) -{ - Edif::Init(mV, edPtr); - - - return 0; -} - -// ----------------- -// UnloadObject -// ----------------- -// The counterpart of the above routine: called just before the object is -// deleted from the frame. -// -void WINAPI DLLExport UnloadObject(mv _far *mV, LPEDATA edPtr, int reserved) -{ -} - -// -------------------- -// UpdateEditStructure -// -------------------- -// For you to update your object structure to newer versions -// Called at both edit time and run time -// -HGLOBAL WINAPI DLLExport UpdateEditStructure(mv __far *mV, void __far * OldEdPtr) -{ - // We do nothing here - return 0; -} - -// -------------------- -// UpdateFileNames -// -------------------- -// If you store file names in your datazone, they have to be relocated when the -// application is moved to a different directory: this routine does it. -// Called at edit time and run time. -// -// Call lpfnUpdate to update your file pathname (refer to the documentation) -// -void WINAPI DLLExport UpdateFileNames(mv _far *mV, LPSTR appName, LPEDATA edPtr, void (WINAPI * lpfnUpdate)(LPSTR, LPSTR)) -{ -} - -// --------------------- -// EnumElts -// --------------------- -// -// Uncomment this function if you need to store an image in the image bank. -// -// Note: do not forget to enable the function in the .def file -// if you remove the comments below. -// -/* -int WINAPI DLLExport EnumElts (mv __far *mV, LPEDATA edPtr, ENUMELTPROC enumProc, ENUMELTPROC undoProc, LPARAM lp1, LPARAM lp2) -{ - int error = 0; - - // Replace wImgIdx with the name of the WORD variable you create within the edit structure - - // Enum images - if ( (error = enumProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2)) != 0 ) - { - // Undo enum images - undoProc (&edPtr->wImgIdx, IMG_TAB, lp1, lp2); - } - - return error; -} -*/ - +/* General.cpp + * Contains functions common to both edittime and runtime. + * Functions defined here: + * DllMain + * InitExtension + * FreeExtension + * LoadObject + * UnloadObject + * UpdateEditStrucrure + * UpdateFileNames + * EnumElts + */ + +#include "Common.h" + +/* hInstLib + * This is the HINSTANCE for your extension's DLL. + * It is set by DllMain and used later for anything + * that requires it, such as some Windows API + * functions and some internal EDIF code. You + * shouldn't change its value, ever. + */ +HINSTANCE hInstLib; + +/* DllMain + * This is a required function for Windows DLLs. You + * should not need to edit this function - if you do, + * refer to MSDN for information. + */ +BOOL WINAPI DllMain(HINSTANCE DLL, DWORD Reason, LPVOID) +{ + switch (Reason) + { + case DLL_PROCESS_ATTACH: //DLL is attaching to the address space of the current process. + { + hInstLib = DLL; //Store HINSTANCE + break; + } + case DLL_THREAD_ATTACH: //A new thread is being created in the current process. + { + // + break; + } + case DLL_THREAD_DETACH: //A thread is exiting cleanly. + { + // + break; + } + case DLL_PROCESS_DETACH: //The calling process is detaching the DLL from its address space. + { + // + break; + } + } + return TRUE; +} + + + +/* InitExtension + * MMF2 calls this before anything else when it loads your + * extension. This includes during the splash screen, in which + * case "Quiet" is true. This is where you should initialize + * global information for either edittime or runtime. Be aware, + * though, that at edittime, multiple open MFAs with your + * extension will share the same global information. You can + * use mV->mvEditApp to tell apart different MFAs from each + * other. If an error occurs during this function, return + * -1 and MMF2 will not load your extension. + */ +int MMF2Func InitExtension(mv *mV, int Quiet) +{ + return Edif::Init(mV); +} + +/* FreeExtension + * Called just before MMF2 unloads your extension. You + * should release any memory you allocated above in + * the InitializeExtension function. You should always + * return a value of 0. + */ +int MMF2Func FreeExtension(mv *mV) +{ + // + Edif::Free(mV); + return 0; +} + + +/* LoadObject + * This is called at both edittime and runtime when MMF2 + * loads each unique instance of your object. (Each one + * with a different name, not each instance of the same + * one). Not much needs to be done here. + */ +int MMF2Func LoadObject(mv *mV, LPCSTR FileName, SerializedED *SED, int) +{ + Edif::Init(mV, SED); + return 0; +} + +/* UnloadObject + * new is to delete as LoadObject is to this functon. + * If you initialized stuff above, deinitialize it here. + */ +void MMF2Func UnloadObject(mv *mV, SerializedED *SED, int) +{ + // +} + +/* UpdateEditStructure (DEPRECATED) + * This is called when MMF2 notices that your + * extension has a newer version number than + * the one in the header of the SerializedED. + * Thankfully, however, we don't need this + * function at all - the EditData class is + * as smart as you programmed it to be and + * it changes the size dynamically rather + * than statically. So, you can safely + * ignore this function all together. + * (It would be a pain to write anyway - + * see the MMF2SDK help for an example) + */ +HGLOBAL MMF2Func UpdateEditStructure(mv *mV, SerializedED *OldSED) +{ + return 0; +} + +/* UpdateFileNames + * When the application is moved to a new directory, + * MMF2 asks your extension to ensure that its file + * paths are moving with it. Just call Update for + * each file path - you will need to create buffers + * of size MAX_PATH if you use C++ strings for + * the paths. + */ +void MMF2Func UpdateFileNames(mv *mV, LPSTR appName, SerializedED *SED, void (WINAPI *Update)(LPSTR, LPSTR)) +{ + // +} + +/* EnumElts + * That whacky function that MMF2 uses to enumerate all the + * animation frames associated with your object, because MMF2 + * is nice enough to deal with them for you so you can't-er, + * don't have to. Refer to the MMF2SDK Help file for + * information on how not to misuse this function. + * You must also uncomment the entry in the Ext.def + * file if you uncomment this function. + */ +/*int MMF2Func EnumElts (mv *mV, SerializedED *SED, ENUMELTPROC enumProc, ENUMELTPROC undoProc, LPARAM lp1, LPARAM lp2) +{ + int error = 0; + + //Replace wImgIdx with the name of the WORD variable you create within the edit structure + + //Enum images + if((error = enumProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2)) != 0) + { + //Undo enum images + undoProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2); + } + + return error; +}*/ diff --git a/Extensions/Template/Runtime.cpp b/Extensions/Template/Runtime.cpp index 44a0d48..15dfcb9 100644 --- a/Extensions/Template/Runtime.cpp +++ b/Extensions/Template/Runtime.cpp @@ -1,394 +1,182 @@ - -#include "Common.h" - -// DEBUGGER ///////////////////////////////////////////////////////////////// - -#if !defined(RUN_ONLY) -// Identifiers of items displayed in the debugger -enum -{ -// Example -// ------- -// DB_CURRENTSTRING, -// DB_CURRENTVALUE, -// DB_CURRENTCHECK, -// DB_CURRENTCOMBO -}; - -// Items displayed in the debugger -WORD DebugTree[]= -{ -// Example -// ------- -// DB_CURRENTSTRING|DB_EDITABLE, -// DB_CURRENTVALUE|DB_EDITABLE, -// DB_CURRENTCHECK, -// DB_CURRENTCOMBO, - - // End of table (required) - DB_END -}; - -#endif // !defined(RUN_ONLY) - - - -// ------------------- -// GetRunObjectSurface -// ------------------- -// Implement this function instead of DisplayRunObject if your extension -// supports ink effects and transitions. Note: you can support ink effects -// in DisplayRunObject too, but this is automatically done if you implement -// GetRunObjectSurface (MMF applies the ink effect to the surface). -// -// Note: do not forget to enable the function in the .def file -// if you remove the comments below. -/* -cSurface* WINAPI DLLExport GetRunObjectSurface(LPRDATA rdPtr) -{ - return NULL; -} -*/ - -// ------------------------- -// GetRunObjectCollisionMask -// ------------------------- -// Implement this function if your extension supports fine collision mode (OEPREFS_FINECOLLISIONS), -// Or if it's a background object and you want Obstacle properties for this object. -// -// Should return NULL if the object is not transparent. -// -// Note: do not forget to enable the function in the .def file -// if you remove the comments below. -// -/* -LPSMASK WINAPI DLLExport GetRunObjectCollisionMask(LPRDATA rdPtr, LPARAM lParam) -{ - // Typical example for active objects - // ---------------------------------- - // Opaque? collide with box - if ( (rdPtr->rs.rsEffect & EFFECTFLAG_TRANSPARENT) == 0 ) // Note: only if your object has the OEPREFS_INKEFFECTS option - return NULL; - - // Transparent? Create mask - LPSMASK pMask = rdPtr->m_pColMask; - if ( pMask == NULL ) - { - if ( rdPtr->m_pSurface != NULL ) - { - DWORD dwMaskSize = rdPtr->m_pSurface->CreateMask(NULL, lParam); - if ( dwMaskSize != 0 ) - { - pMask = (LPSMASK)calloc(dwMaskSize, 1); - if ( pMask != NULL ) - { - rdPtr->m_pSurface->CreateMask(pMask, lParam); - rdPtr->m_pColMask = pMask; - } - } - } - } - - // Note: for active objects, lParam is always the same. - // For background objects (OEFLAG_BACKGROUND), lParam maybe be different if the user uses your object - // as obstacle and as platform. In this case, you should store 2 collision masks - // in your data: one if lParam is 0 and another one if lParam is different from 0. - - return pMask; -} -*/ - - -// ============================================================================ -// -// START APP / END APP / START FRAME / END FRAME routines -// -// ============================================================================ - -// ------------------- -// StartApp -// ------------------- -// Called when the application starts or restarts. -// Useful for storing global data -// -void WINAPI DLLExport StartApp(mv _far *mV, CRunApp* pApp) -{ - // Example - // ------- - // Delete global data (if restarts application) -// CMyData* pData = (CMyData*)mV->mvGetExtUserData(pApp, hInstLib); -// if ( pData != NULL ) -// { -// delete pData; -// mV->mvSetExtUserData(pApp, hInstLib, NULL); -// } -} - -// ------------------- -// EndApp -// ------------------- -// Called when the application ends. -// -void WINAPI DLLExport EndApp(mv _far *mV, CRunApp* pApp) -{ - // Example - // ------- - // Delete global data -// CMyData* pData = (CMyData*)mV->mvGetExtUserData(pApp, hInstLib); -// if ( pData != NULL ) -// { -// delete pData; -// mV->mvSetExtUserData(pApp, hInstLib, NULL); -// } -} - -// ------------------- -// StartFrame -// ------------------- -// Called when the frame starts or restarts. -// -void WINAPI DLLExport StartFrame(mv _far *mV, DWORD dwReserved, int nFrameIndex) -{ -} - -// ------------------- -// EndFrame -// ------------------- -// Called when the frame ends. -// -void WINAPI DLLExport EndFrame(mv _far *mV, DWORD dwReserved, int nFrameIndex) -{ -} - -// ============================================================================ -// -// TEXT ROUTINES (if OEFLAG_TEXT) -// -// ============================================================================ - -// ------------------- -// GetRunObjectFont -// ------------------- -// Return the font used by the object. -// -/* - - // Note: do not forget to enable the functions in the .def file - // if you remove the comments below. - -void WINAPI GetRunObjectFont(LPRDATA rdPtr, LOGFONT* pLf) -{ - // Example - // ------- - // GetObject(rdPtr->m_hFont, sizeof(LOGFONT), pLf); -} - -// ------------------- -// SetRunObjectFont -// ------------------- -// Change the font used by the object. -// -void WINAPI SetRunObjectFont(LPRDATA rdPtr, LOGFONT* pLf, RECT* pRc) -{ - // Example - // ------- -// HFONT hFont = CreateFontIndirect(pLf); -// if ( hFont != NULL ) -// { -// if (rdPtr->m_hFont!=0) -// DeleteObject(rdPtr->m_hFont); -// rdPtr->m_hFont = hFont; -// SendMessage(rdPtr->m_hWnd, WM_SETFONT, (WPARAM)rdPtr->m_hFont, FALSE); -// } - -} - -// --------------------- -// GetRunObjectTextColor -// --------------------- -// Return the text color of the object. -// -COLORREF WINAPI GetRunObjectTextColor(LPRDATA rdPtr) -{ - // Example - // ------- - return 0; // rdPtr->m_dwColor; -} - -// --------------------- -// SetRunObjectTextColor -// --------------------- -// Change the text color of the object. -// -void WINAPI SetRunObjectTextColor(LPRDATA rdPtr, COLORREF rgb) -{ - // Example - // ------- - rdPtr->m_dwColor = rgb; - InvalidateRect(rdPtr->m_hWnd, NULL, TRUE); -} -*/ - - -// ============================================================================ -// -// WINDOWPROC (interception of messages sent to hMainWin and hEditWin) -// -// Do not forget to enable the WindowProc function in the .def file if you implement it -// -// ============================================================================ -/* -// Get the pointer to the object's data from its window handle -// Note: the object's window must have been subclassed with a -// callRunTimeFunction(rdPtr, RFUNCTION_SUBCLASSWINDOW, 0, 0); -// See the documentation and the Simple Control example for more info. -// -LPRDATA GetRdPtr(HWND hwnd, LPRH rhPtr) -{ - return (LPRDATA)GetProp(hwnd, (LPCSTR)rhPtr->rh4.rh4AtomRd); -} - -// Called from the window proc of hMainWin and hEditWin. -// You can intercept the messages and/or tell the main proc to ignore them. -// -LRESULT CALLBACK DLLExport WindowProc(LPRH rhPtr, HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) -{ - LPRDATA rdPtr = NULL; - - switch (nMsg) { - - // Example - case WM_CTLCOLORSTATIC: - { - // Get the handle of the control - HWND hWndControl = (HWND)lParam; - - // Get a pointer to the RUNDATA structure (see GetRdptr function above for more info) - rdPtr = GetRdPtr(hWndControl, rhPtr); - - // Check if the rdPtr pointer is valid and points to an object created with this extension - if ( rdPtr == NULL || rdPtr->rHo.hoIdentifier != IDENTIFIER ) - break; - - // OK, intercept the message - HDC hDC = (HDC)wParam; - SetBkColor(hDC, rdPtr->backColor); - SetTextColor(hDC, rdPtr->fontColor); - rhPtr->rh4.rh4KpxReturn = (long)rdPtr->hBackBrush; - return REFLAG_MSGRETURNVALUE; - } - break; - } - - return 0; -} -*/ - -// ============================================================================ -// -// DEBUGGER ROUTINES -// -// ============================================================================ - -// ----------------- -// GetDebugTree -// ----------------- -// This routine returns the address of the debugger tree -// -LPWORD WINAPI DLLExport GetDebugTree(LPRDATA rdPtr) -{ -#if !defined(RUN_ONLY) - return DebugTree; -#else - return NULL; -#endif // !defined(RUN_ONLY) -} - -// ----------------- -// GetDebugItem -// ----------------- -// This routine returns the text of a given item. -// -void WINAPI DLLExport GetDebugItem(LPSTR pBuffer, LPRDATA rdPtr, int id) -{ -#if !defined(RUN_ONLY) - - // Example - // ------- -/* - char temp[DB_BUFFERSIZE]; - - switch (id) - { - case DB_CURRENTSTRING: - LoadString(hInstLib, IDS_CURRENTSTRING, temp, DB_BUFFERSIZE); - wsprintf(pBuffer, temp, rdPtr->text); - break; - case DB_CURRENTVALUE: - LoadString(hInstLib, IDS_CURRENTVALUE, temp, DB_BUFFERSIZE); - wsprintf(pBuffer, temp, rdPtr->value); - break; - case DB_CURRENTCHECK: - LoadString(hInstLib, IDS_CURRENTCHECK, temp, DB_BUFFERSIZE); - if (rdPtr->check) - wsprintf(pBuffer, temp, "TRUE"); - else - wsprintf(pBuffer, temp, "FALSE"); - break; - case DB_CURRENTCOMBO: - LoadString(hInstLib, IDS_CURRENTCOMBO, temp, DB_BUFFERSIZE); - wsprintf(pBuffer, temp, rdPtr->combo); - break; - } -*/ - -#endif // !defined(RUN_ONLY) -} - -// ----------------- -// EditDebugItem -// ----------------- -// This routine allows to edit editable items. -// -void WINAPI DLLExport EditDebugItem(LPRDATA rdPtr, int id) -{ -#if !defined(RUN_ONLY) - - // Example - // ------- -/* - switch (id) - { - case DB_CURRENTSTRING: - { - EditDebugInfo dbi; - char buffer[256]; - - dbi.pText=buffer; - dbi.lText=TEXT_MAX; - dbi.pTitle=NULL; - - strcpy(buffer, rdPtr->text); - long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITTEXT, 0, (LPARAM)&dbi); - if (ret) - strcpy(rdPtr->text, dbi.pText); - } - break; - case DB_CURRENTVALUE: - { - EditDebugInfo dbi; - - dbi.value=rdPtr->value; - dbi.pTitle=NULL; - - long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITINT, 0, (LPARAM)&dbi); - if (ret) - rdPtr->value=dbi.value; - } - break; - } -*/ -#endif // !defined(RUN_ONLY) -} - - +/* Runtime.cpp + * This file contains general runtime functions + * that aren't part of the Extension class. + * Functions defined here: + * GetRunObjectSurface + * GetRunObjectCollisionMask + * StartApp + * EndApp + * StartFrame + * EndFrame + * WindowProc + */ + +#include "Common.h" + +/* GetRunObjectSurface + * Implement this function instead of + * Extension::Display if your extension + * supports ink effects and transitions. + * You can support ink effects in + * DisplayRunObject too, but this is + * done automatically if you implement + * GetRunObjectSurface (MMF2 applies the + * ink effects to the surface). Don't + * forget to enable the function in the + * .def file if you uncomment & implement + * this function. + */ +/*cSurface* MMF2Func GetRunObjectSurface(RD *rd) +{ + return NULL; +}*/ + +/* GetRunObjectCollisionMask + * Implement this function if your extension + * supports fine collision detection + * (OEPREFS_FINECOLLISIONS), rr if it's a + * background object and you want Obstacle + * properties for this object. You should + * return NULL if the object is not transparent. + * Don't forget to enable the function in the + * .def file if you uncomment & implement this + * function. + */ +/*LPSMASK MMF2Func GetRunObjectCollisionMask(RD *rd, LPARAM lParam) +{ + // Typical example for active objects + // ---------------------------------- + // Opaque? collide with box + if ( (rdPtr->rs.rsEffect & EFFECTFLAG_TRANSPARENT) == 0 ) // Note: only if your object has the OEPREFS_INKEFFECTS option + return NULL; + + // Transparent? Create mask + LPSMASK pMask = rdPtr->m_pColMask; + if ( pMask == NULL ) + { + if ( rdPtr->m_pSurface != NULL ) + { + DWORD dwMaskSize = rdPtr->m_pSurface->CreateMask(NULL, lParam); + if ( dwMaskSize != 0 ) + { + pMask = (LPSMASK)calloc(dwMaskSize, 1); + if ( pMask != NULL ) + { + rdPtr->m_pSurface->CreateMask(pMask, lParam); + rdPtr->m_pColMask = pMask; + } + } + } + } + + //Note: for active objects, lParam is always the same. + //For background objects (OEFLAG_BACKGROUND), lParam maybe be different if the user uses your object + //as obstacle and as platform. In this case, you should store 2 collision masks + //in your data: one if lParam is 0 and another one if lParam is different from 0. + + return pMask; +}*/ + +/* StartApp + * Called when the application initially + * starts or when it restarts (EndApp will + * NOT be called beforehand in the case + * of a restart). This is useful if you + * need to store global data across + * frames. + */ +void MMF2Func StartApp(mv *mV, CRunApp *App) +{ + // +} + +/* EndApp + * Called when the application is ending + * and about to close. This is NOT called + * in the event of a Restart Application + * action. You can release any memory you + * aqquired above in StartApp. + */ +void MMF2Func EndApp(mv *mV, CRunApp *App) +{ + // +} + +/* StartFrame + * Called at the start of a frame. If you + * store global data above, you should make + * a copy of it so that it may be restored + * when the frame restarts. This function is + * also called when the frame restarts. + * EndFrame is NOT called when the frame + * restarts. + */ +void MMF2Func StartFrame(mv *mV, CRunApp *App, int FrameIndex) +{ + // +} + +/* EndFrame + * Called when the frame ends. MMF2 + * does NOT call this function in the + * event of a "Restart Frame" action. + */ +void MMF2Func EndFrame(mv *mV, CRunApp *App, int FrameIndex) +{ + // +} + + +// ============================================================================ +// +// WINDOWPROC (interception of messages sent to hMainWin and hEditWin) +// +// Do not forget to enable the WindowProc function in the .def file if you implement it +// +// ============================================================================ +/* +// Get the pointer to the object's data from its window handle +// Note: the object's window must have been subclassed with a +// callRunTimeFunction(rdPtr, RFUNCTION_SUBCLASSWINDOW, 0, 0); +// See the documentation and the Simple Control example for more info. +// +LPRDATA GetRdPtr(HWND hwnd, LPRH rhPtr) +{ + return (LPRDATA)GetProp(hwnd, (LPCSTR)rhPtr->rh4.rh4AtomRd); +} + +// Called from the window proc of hMainWin and hEditWin. +// You can intercept the messages and/or tell the main proc to ignore them. +// +LRESULT CALLBACK DLLExport WindowProc(LPRH rhPtr, HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) +{ + LPRDATA rdPtr = NULL; + + switch (nMsg) { + + // Example + case WM_CTLCOLORSTATIC: + { + // Get the handle of the control + HWND hWndControl = (HWND)lParam; + + // Get a pointer to the RUNDATA structure (see GetRdptr function above for more info) + rdPtr = GetRdPtr(hWndControl, rhPtr); + + // Check if the rdPtr pointer is valid and points to an object created with this extension + if ( rdPtr == NULL || rdPtr->rHo.hoIdentifier != IDENTIFIER ) + break; + + // OK, intercept the message + HDC hDC = (HDC)wParam; + SetBkColor(hDC, rdPtr->backColor); + SetTextColor(hDC, rdPtr->fontColor); + rhPtr->rh4.rh4KpxReturn = (long)rdPtr->hBackBrush; + return REFLAG_MSGRETURNVALUE; + } + break; + } + + return 0; +} +*/ diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index 9033f58..8a000c8 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -216,7 +216,6 @@ /> @@ -940,483 +939,518 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - - - + + + - - - + - - - + - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + MOULI - WORD ocCounter; // Pointer to COUNTER structure - WORD ocData; // Pointer to DATA structure - WORD ocFree; - DWORD ocOEFlags; // New flags - - WORD ocQualifiers[OC_MAX_QUALIFIERS]; // Qualifier list - WORD ocExtension; // Extension structure - WORD ocValues; // Values structure - WORD ocStrings; // String structure - - WORD ocFlags2; // New news flags, before was ocEvents - WORD ocOEPrefs; // Automatically modifiable flags - DWORD ocIdentifier; // Identifier d'objet - - COLORREF ocBackColor; // Background color - DWORD ocFadeIn; // Offset fade in - DWORD ocFadeOut; // Offset fade out - DWORD ocValueNames; // For the debugger - DWORD ocStringNames; - -#ifdef __cplusplus -}; -#else -} OC; -#endif -typedef OC * LPOC; -typedef OC * fpoc; - -typedef struct -{ - WORD number; - long values[1]; -} OCValues; -typedef OCValues* LPOCVALUES; - -#ifdef _UNICODE -typedef struct -{ - WORD number; - TCHAR str[1]; -} OCStringsW; -typedef OCStringsW* LPOCSTRINGS; -#else -typedef struct -{ - WORD number; - char str[2]; -} OCStringsA; -typedef OCStringsA* LPOCSTRINGS; -#endif - - - -typedef struct -{ - WORD number; - char str[2]; - -} OCValueNames; -typedef OCValueNames* LPOCVALUENAMES; - -#define OCFLAGS2_DONTSAVEBKD 0x0001 -#define OCFLAGS2_SOLIDBKD 0x0002 -#define OCFLAGS2_COLBOX 0x0004 -#define OCFLAGS2_VISIBLEATSTART 0x0008 -#define OCFLAGS2_OBSTACLESHIFT 4 -#define OCFLAGS2_OBSTACLEMASK 0x0030 -#define OCFLAGS2_OBSTACLE_SOLID 0x0010 -#define OCFLAGS2_OBSTACLE_PLATFORM 0x0020 -#define OCFLAGS2_OBSTACLE_LADDER 0x0030 -#define OCFLAGS2_AUTOMATICROTATION 0x0040 - -////////////////////////////////////////////////////////////////////////////// -// -// Counter -// -typedef struct tagCT { - WORD ctSize; - long ctInit; // Initial value - long ctMini; // Minimal value - long ctMaxi; // Maximal value -} counter; -typedef counter * fpct; -typedef counter * fpCounter; - -////////////////////////////////////////////////////////////////////////////// -// -// Animations -// -#define ANIMID_MIN 16 - -// Anim header -#ifdef __cplusplus -class AnimHeader { -public: -#else -typedef struct AnimHeader { -#endif - WORD ahSize; - WORD ahAnimMax; // New V2, number of entries in offset table - short ahOffsetToAnim[ANIMID_MIN]; // Minimum 16 animations, can be larger! -#ifdef __cplusplus -}; -#else -} AnimHeader; -#endif -typedef AnimHeader * fpAnimHeader; -typedef AnimHeader * fpah; -typedef AnimHeader * LPAH; - -#ifndef DIRID_MAX -#define DIRID_MAX 32 -#endif - -// Anim structure -typedef struct Anim { - short anOffsetToDir[DIRID_MAX]; // Offset to animations with a direction -} Anim; -typedef Anim * fpAnim; -typedef Anim * fpan; -typedef Anim * LPAN; - -// AnimDirection structure -typedef struct AnimDirection { - BYTE adMinSpeed; // Minimum speed - BYTE adMaxSpeed; // Maximum speed - short adRepeat; // Number of loops - short adRepeatFrame; // Where to loop - short adNumberOfFrame; // Number of frames - short adFrame[1]; // Frames -} AnimDirection; -#define sizeof_AnimDirection (sizeof(AnimDirection)-2) -typedef AnimDirection * fpAnimDir; -typedef AnimDirection * fpad; -typedef AnimDirection * LPAD; - -// Chunks de sauvegarde -#define EVTFILECHUNK_HEAD B2L('E','R','>','>') -#define EVTFILECHUNK_EVTHEAD B2L('E','R','e','s') -#define EVTFILECHUNK_EVENTS B2L('E','R','e','v') -#define EVTFILECHUNK_NEWITEMS B2L('>','N','I','<') -#define EVTFILECHUNK_END B2L('<','<','E','R') - -// Marquage des OI qualifiers -#define OIFLAG_QUALIFIER 0x8000 -#define NDEF_QUALIFIERS 100 -#define MAX_EVENTPROGRAMS 256 - -#define GAMEON_EMPTY 0 -#define GAMEON_UNLOADED 1 -#define GAMEON_TIME0 2 -#define GAMEON_PAUSED 3 -#define GAMEON_RUNNING 4 -#define GAMEON_STEPPING 5 - -// COMMUNICATION STRUCTURE BETWEEN RUNTIME AND EDITOR -typedef struct -{ - DWORD command; - - WORD runMode; - DWORD timer; - - WORD code; - OINUM oi; - DWORD param[2]; - char path[_MAX_PATH]; - -} ComStructure; -enum -{ - RUNCOMMAND_INITCOM=1, - RUNCOMMAND_NEWEVENT, - RUNCOMMAND_NEWSOUND, - RUNCOMMAND_NEWOBJECT, - RUNCOMMAND_NEWEVENTS, - RUNCOMMAND_SETRUNMODE, - RUNCOMMAND_CONTINUE, - RUNCOMMAND_RESTART, - RUNCOMMAND_QUIT, - HANDLEMESSAGE_WAITFORCONFIRM, - HANDLEMESSAGE_WAITFORCOMMAND, - HANDLEMESSAGE_OK, - HANDLEMESSAGE_QUIT, - HANDLEMESSAGE_TIMEOUT -}; -// DIFFERENTS MODES OF RUN -enum -{ - RUNMODE_NONE, - RUNMODE_STOPPED, - RUNMODE_RUNNING, - RUNMODE_PLAYING, - RUNMODE_STEPPING, - RUNMODE_PAUSED, - RUNMODE_WAITING, - RUNMODE_WAITINGQUIT, -}; - - -// ------------------------------------------------------------------------- -// MOVEMENT DEFINITIONS -// ------------------------------------------------------------------------- - -// Definition of animation codes -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define ANIMID_STOP 0 -#define ANIMID_WALK 1 -#define ANIMID_RUN 2 -#define ANIMID_APPEAR 3 -#define ANIMID_DISAPPEAR 4 -#define ANIMID_BOUNCE 5 -#define ANIMID_SHOOT 6 -#define ANIMID_JUMP 7 -#define ANIMID_FALL 8 -#define ANIMID_CLIMB 9 -#define ANIMID_CROUCH 10 -#define ANIMID_UNCROUCH 11 -#define ANIMID_USER1 12 -//#define ANIMID_MAX 16 -#define ANIMNAME_MAXCHAR 64 - -// Definition of direction codes -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define DIRF_ALL 0xFFFFFFFF -#define DIRID_STATIC 32 -#define DIRID_MAX 32 -#define DIRID_SEE 30 -#define DIRID_SE 28 -#define DIRID_SSE 26 -#define DIRID_S 24 -#define DIRID_SSW 22 -#define DIRID_SW 20 -#define DIRID_SWW 18 -#define DIRID_W 16 -#define DIRID_NWW 14 -#define DIRID_NW 12 -#define DIRID_NNW 10 -#define DIRID_N 8 -#define DIRID_NNE 6 -#define DIRID_NE 4 -#define DIRID_NEE 2 -#define DIRID_E 0 - -// Definition of control types -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define MVCONT_COMPUTER 0 -#define MVCONT_PLAYER1 1 -#define MVCONT_PLAYER2 2 -#define MVCONT_PLAYER3 3 -#define MVCONT_PLAYER4 4 -#define NB_MVCONT 5 -#define MAX_PLAYERS 4 - -// Definition of joystick controls -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define JOYSTICK_UP 0b00000001 -#define JOYSTICK_DOWN 0b00000010 -#define JOYSTICK_LEFT 0b00000100 -#define JOYSTICK_RIGHT 0b00001000 -#define JOYSTICK_FIRE1 0b00010000 -#define JOYSTICK_FIRE2 0b00100000 -#define JOYSTICK_FIRE3 0b01000000 -#define JOYSTICK_FIRE4 0b10000000 - -// Definition of movement types -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define MVTYPE_STATIC 0 -#define MVTYPE_MOUSE 1 -#define MVTYPE_RACE 2 -#define MVTYPE_GENERIC 3 -#define MVTYPE_BALL 4 -#define MVTYPE_TAPED 5 -#define MVTYPE_INTELLIGENT 6 -#define MVTYPE_PINBALL 7 -#define MVTYPE_LIST 8 -#define MVTYPE_PLATFORM 9 -#define MVTYPE_GOMOVEMENT 10 -#define MVTYPE_DISAPPEAR 11 -#define MVTYPE_APPEAR 12 -#define MVTYPE_BULLET 13 -#define MVTYPE_EXT 14 -#define MVTYPE_MAX 15 - -#define MVTACTION_SAVEPOSITION 0x1010 -#define MVTACTION_LOADPOSITION 0x1011 - -//////////////////////////////////////////////////////////////////////////////// -// EVENTS -//////////////////////////////////////////////////////////////////////////////// - -// Eventgroup structure, before conditions and actions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagEVG { - short evgSize; // 0 Size of the group (<=0) - BYTE evgNCond; // 2 Number of conditions - BYTE evgNAct; // 3 Number of actions - WORD evgFlags; // 4 Flags - short evgInhibit; // 6 If the group is inhibited - WORD evgInhibitCpt; // 8 Counter - WORD evgIdentifier; // 10 Unique identifier - short evgUndo; // 12 Identifier for UNDO - } eventGroup; -typedef eventGroup * PEVG; -typedef eventGroup * LPEVG; -#define EVG_SIZE 14 - -// MACRO: next group -#define EVGNEXT(evgPtr) ((LPEVG)((LPSTR)evgPtr-evgPtr->evgSize)) -// MACRO: first event -#define EVGFIRSTEVT(p) ((LPEVT)((LPSTR)p+sizeof(eventGroup))) -// MACRO: number of events in the group -#define EVGNEVENTS(p) (p->evgNCond+p->evgNAct) - -// Internal flags of eventgroups -#define EVGFLAGS_ONCE 0x0001 -#define EVGFLAGS_NOTALWAYS 0x0002 -#define EVGFLAGS_REPEAT 0x0004 -#define EVGFLAGS_NOMORE 0x0008 -#define EVGFLAGS_SHUFFLE 0x0010 -#define EVGFLAGS_EDITORMARK 0x0020 -#define EVGFLAGS_UNDOMARK 0x0040 -#define EVGFLAGS_COMPLEXGROUP 0x0080 -#define EVGFLAGS_BREAKPOINT 0x0100 -#define EVGFLAGS_ALWAYSCLEAN 0x0200 -#define EVGFLAGS_ORINGROUP 0x0400 -//#define EVGFLAGS_2MANYACTIONS 0x0400 -#define EVGFLAGS_STOPINGROUP 0x0800 -//#define EVGFLAGS_NOTASSEMBLED 0x1000 -#define EVGFLAGS_ORLOGICAL 0x1000 -#define EVGFLAGS_GROUPED 0x2000 -#define EVGFLAGS_INACTIVE 0x4000 -#define EVGFLAGS_NOGOOD 0x8000 -#define EVGFLAGS_LIMITED (EVGFLAGS_SHUFFLE+EVGFLAGS_NOTALWAYS+EVGFLAGS_REPEAT+EVGFLAGS_NOMORE) -#define EVGFLAGS_DEFAULTMASK (EVGFLAGS_BREAKPOINT+EVGFLAGS_GROUPED) -//#define EVGFLAGS_FADE (EVGFLAGS_FADEIN|EVGFLAGS_FADEOUT) - - -// Condition ou action structure -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagEVTV1 { - short evtSize; - union - { - struct - { - short evtCode; - }; - struct - { - char evtType; - char evtNum; - }; - }; - OINUM evtOi; - short evtOiList; - char evtFlags; - char evtFlags2; - char evtNParams; - char evtDefType; -// For the conditions - short evtIdentifier; - } eventV1; -typedef eventV1 * LPEVTV1; - -#define CND_SIZEV1 14 -#define ACT_SIZEV1 12 -#define EVGFIRSTEVTV1(p) ((LPEVTV1)((LPSTR)p+sizeof(eventGroup))) -#define EVTPARAMSV1(p) ((LPEVP)( p->evtCode<0 ? (LPBYTE)p+CND_SIZEV1 : (LPBYTE)p+ACT_SIZEV1) ) -#define EVTNEXTV1(p) ((LPEVTV1)((LPBYTE)p+p->evtSize)) - - - -typedef struct tagEVT { - short evtSize; // 0 Size of the event - union - { - struct - { - long evtCode; // 2 Code (hi:NUM lo:TYPE) - }; - struct - { - short evtType; // 2 Type of object - short evtNum; // 4 Number of action/condition - }; - }; - OINUM evtOi; // 6 OI if normal object - short evtOiList; // 8 Pointer - char evtFlags; // 10 Flags - char evtFlags2; // 11 Flags II - char evtNParams; // 12 Number of parameters - char evtDefType; // 13 If default, type -// Pour les conditions - short evtIdentifier; // 14 Event identifier - } event; // 16 -typedef event * PEVT; -typedef event * LPEVT; - -#define CND_SIZE 16 -#define ACT_SIZE 14 - -// Definition of conditions / actions flags -#define EVFLAGS_REPEAT 0x01 -#define EVFLAGS_DONE 0x02 -#define EVFLAGS_DEFAULT 0x04 -#define EVFLAGS_DONEBEFOREFADEIN 0x08 -#define EVFLAGS_NOTDONEINSTART 0x10 -#define EVFLAGS_ALWAYS 0x20 -#define EVFLAGS_BAD 0x40 -#define EVFLAGS_BADOBJECT 0x80 -#define EVFLAGS_DEFAULTMASK (EVFLAGS_ALWAYS+EVFLAGS_REPEAT+EVFLAGS_DEFAULT+EVFLAGS_DONEBEFOREFADEIN+EVFLAGS_NOTDONEINSTART) -#define ACTFLAGS_REPEAT 0x0001 - - -// For flags II -// ------------- -#define EVFLAG2_NOT 0x0001 -#define EVFLAG2_NOTABLE 0x0002 -#define EVFLAGS_NOTABLE (EVFLAG2_NOTABLE<<8) -#define EVFLAGS_MONITORABLE 0x0004 -#define EVFLAGS_TODELETE 0x0008 -#define EVFLAGS_NEWSOUND 0x0010 -#define EVFLAG2_MASK (EVFLAG2_NOT|EVFLAG2_NOTABLE|EVFLAGS_MONITORABLE) - -// MACRO: Returns the code for an extension -#define EXTCONDITIONNUM(i) (-((short)(i>>16))-1) -#define EXTACTIONNUM(i) ((short)(i>>16)) - -// PARAM Structure -// ~~~~~~~~~~~~~~~ -#ifdef __cplusplus -class eventParam { -public: -#else -typedef struct eventParam { -#endif - short evpSize; - short evpCode; - union { - struct { - short evpW0; - short evpW1; - short evpW2; - short evpW3; - short evpW4; - short evpW5; - short evpW6; - short evpW7; - } evpW; - struct { - long evpL0; - long evpL1; - long evpL2; - long evpL3; - } evpL; - } evp; -#ifdef __cplusplus -}; -#else -} eventParam; -#endif -typedef eventParam * PEVP; -typedef eventParam * LPEVP; -typedef eventParam * fpevp; - -// MACRO: next parameter -#define EVPNEXT(p) ((LPEVP)((LPSTR)p+p->evpSize)) - - -// Operators / expressions parameters -// -------------------------------------------------- -#define MIN_LONG (-10000000L) -#define MAX_LONG (10000000L) -#define EXPPARAM_LONG 1 -#define EXPPARAM_VARGLO 2 -#define EXPPARAM_STRING 3 -#define EXPPARAM_ALTVALUE 4 -#define EXPPARAM_FLAG 5 -#define EXP_STOP -1 -#define OPERATOR_START 0x00000000 -#define EXPL_END 0x00000000 -#define EXPL_PLUS 0x00020000 -#define EXPL_MOINS 0x00040000 -#define EXPL_MULT 0x00060000 -#define EXPL_DIV 0x00080000 -#define EXPL_MOD 0x000A0000 -#define EXPL_POW 0x000C0000 -#define EXPL_AND 0x000E0000 -#define EXPL_OR 0x00100000 -#define EXPL_XOR 0x00120000 -#define OPERATOR_END 0x00140000 -typedef struct tagEXP { - union - { - struct - { - long expCode; // 2 Code (hi:NUM lo:TYPE) - }; - struct - { - short expType; // 2 Type of object - short expNum; // 3 Expression number - }; - }; - short expSize; - union - { - struct { - short expOi; - short expOiList; - } expo; - struct { - long expLParam; - } expl; - struct { - double expDouble; - float expFloat; - } expd; - struct { - short expWParam0; - short expWParam1; - } expw; - struct { - short expOi; - short expOiList; - short expNum; - } expv; - struct { - long expExtCode; - short expExtNumber; - } expc; - } expu; - } expression; -typedef expression * LPEXP; -typedef expression * PEXP; - -#define CMPOPE_EQU 0x0000 -#define CMPOPE_DIF 0x0001 -#define CMPOPE_LOWEQU 0x0002 -#define CMPOPE_LOW 0x0003 -#define CMPOPE_GREEQU 0x0004 -#define CMPOPE_GRE 0x0005 -#define MAX_CMPOPE 6 -#define EXPNEXT(expPtr) ((LPEXP)((LPSTR)expPtr+expPtr->expSize)) -#define EXPFLAG_STRING 0x0001 -#define EXPFLAG_DOUBLE 0x0002 - -typedef struct tagEXPV1 { - union - { - struct - { - short expCode; - }; - struct - { - char expType; - char expNum; - }; - }; - short expSize; - union - { - struct { - short expOi; - short expOiList; - } expo; - struct { - long expLParam; - } expl; - struct { - double expDouble; - float expFloat; - } expd; - struct { - short expWParam0; - short expWParam1; - } expw; - struct { - short expOi; - short expOiList; - short expNum; - } expv; - struct { - long expExtCode; - short expExtNumber; - } expc; - } expu; - }expressionV1; -typedef expressionV1 * LPEXPV1; - -#define EXPNEXTV1(expPtr) ((LPEXPV1)((LPSTR)expPtr+expPtr->expSize)) - -/* -#define Q_SPR 0x0100 -#define Q_TXT 0x0200 -#define Q_QST 0x0400 -#define Q_ARE 0x0800 -#define Q_CNT 0x1000 -#define Q_PLA 0x2000 -#define Q_GAM 0x4000 -#define Q_TIM 0x8000 -#define Q_COL 0x0001 -#define Q_ZNE 0x0002 -#define Q_MVT 0x0004 -#define Q_ANI 0x0008 -#define Q_OBJ 0x0010 -#define Q_KEY 0x0020 -#define Q_SYS 0x0040 -*/ - -// Information structure -// ---------------------------------------------- -typedef struct tagEVO { - short evoConditions; // Conditions - short evoActions; // Actions - short evoExpressions; // Expressions - short evoMsgMenus; // Menu strings for actions/conditions - short evoMsgDisplay; // Display strings for actions/conditions - short evoMsgExpressions; // Menu/display strings for expressions - short evoMsgExpParams; // Parameter string - short evoNConditions; // Number of conditions - } eventInfosOffsets; -typedef eventInfosOffsets * PEVO; -typedef eventInfosOffsets * LPEVO; - -// Definition of the different system objects (TYPE<0) -// ---------------------------------------------------------- -#define TYPE_DIRECTION -127 -#define TYPE_QUALIFIER -126 -#define NUMBEROF_SYSTEMTYPES 7 -#define OBJ_PLAYER -7 -#define OBJ_KEYBOARD -6 -#define OBJ_CREATE -5 -#define OBJ_TIMER -4 -#define OBJ_GAME -3 -#define OBJ_SPEAKER -2 -#define OBJ_SYSTEM -1 -#define OBJ_FIRST_C_OBJECT 8 -#define OBJ_LAST NB_SYSOBJ - - - - - - - - -// ------------------------------------------------------------ -// EXTENSION OBJECT DATA ZONE -// ------------------------------------------------------------ - -// Flags -#define OEFLAG_DISPLAYINFRONT 0x0001 -#define OEFLAG_BACKGROUND 0x0002 -#define OEFLAG_BACKSAVE 0x0004 -#define OEFLAG_RUNBEFOREFADEIN 0x0008 -#define OEFLAG_MOVEMENTS 0x0010 -#define OEFLAG_ANIMATIONS 0x0020 -#define OEFLAG_TABSTOP 0x0040 -#define OEFLAG_WINDOWPROC 0x0080 -#define OEFLAG_VALUES 0x0100 -#define OEFLAG_SPRITES 0x0200 -#define OEFLAG_INTERNALBACKSAVE 0x0400 -#define OEFLAG_SCROLLINGINDEPENDANT 0x0800 -#define OEFLAG_QUICKDISPLAY 0x1000 -#define OEFLAG_NEVERKILL 0x2000 -#define OEFLAG_NEVERSLEEP 0x4000 -#define OEFLAG_MANUALSLEEP 0x8000 -#define OEFLAG_TEXT 0x10000 -#define OEFLAG_DONTCREATEATSTART 0x20000 - -// Flags modifiable by the program -#define OEPREFS_BACKSAVE 0x0001 -#define OEPREFS_SCROLLINGINDEPENDANT 0x0002 -#define OEPREFS_QUICKDISPLAY 0x0004 -#define OEPREFS_SLEEP 0x0008 -#define OEPREFS_LOADONCALL 0x0010 -#define OEPREFS_GLOBAL 0x0020 -#define OEPREFS_BACKEFFECTS 0x0040 -#define OEPREFS_KILL 0x0080 -#define OEPREFS_INKEFFECTS 0x0100 -#define OEPREFS_TRANSITIONS 0x0200 -#define OEPREFS_FINECOLLISIONS 0x0400 -#define OEPREFS_APPLETPROBLEMS 0x0800 - -// Running flags -#define REFLAG_ONESHOT 0x0001 -#define REFLAG_DISPLAY 0x0002 -#define REFLAG_MSGHANDLED 0x0004 -#define REFLAG_MSGCATCHED 0x0008 -#define REFLAG_MSGDEFPROC 0x0010 - -#define REFLAG_MSGRETURNVALUE 0x0040 - -#define OEFLAGS_DEFAULTSETUPS (OEFLAG_MOVEMENTS|OEFLAG_ANIMATIONS|OEFLAG_SPRITES|OEFLAG_VALUES) - - - -#ifndef IN_KPX - -/////////////////////////////////////////////////////////////////////// -// -// DEFINITION OF EVENTS AND ACTIONS CODES -// -/////////////////////////////////////////////////////////////////////// - -// SYSTEM Conditions / Actions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//#define OBJ_SYSTEM -1 -//-1&255=255 -#define CND_CHANCE ((-26<<8)|255) -#define CND_ORLOGICAL ((-25<<8)|255) -#define CNDL_ORLOGICAL ((-25<<16)|65535) -#define CND_OR ((-24<<8)|255) -#define CNDL_OR ((-24<<16)|65535) -#define CND_GROUPSTART ((-23<<8)|255) -#define CNDL_GROUPSTART ((-23<<16)|65535) -#define CND_CLIPBOARD ((-22<<8)|255) -#define CND_ONCLOSE ((-21<<8)|255) -#define CNDL_ONCLOSE ((-21<<16)|65535) -#define CND_COMPAREGSTRING ((-20<<8)|255) -#define CNDL_COMPAREGSTRING ((-20<<16)|65535) -#define CND_MENUVISIBLE ((-19<<8)|255) -#define CND_MENUENABLED ((-18<<8)|255) -#define CND_MENUCHECKED ((-17<<8)|255) -#define CND_ONLOOP ((-16<<8)|255) -#define CNDL_ONLOOP ((-16<<16)|65535) -#define CND_DROPFILES ((-15<<8)|255) -#define CNDL_DROPFILES ((-15<<16)|65535) -#define CND_MENUSELECTED ((-14<<8)|255) -#define CNDL_MENUSELECTED ((-14<<16)|65535) -#define CND_RECORDKEY ((-13<<8)|255) -#define CNDL_RECORDKEY ((-13<<16)|65535) -#define CND_GROUPACTIVATED ((-12<<8)|255) -#define CNDL_GROUPACTIVATED ((-12<<16)|65535) -#define CND_ENDGROUP ((-11<<8)|255) -#define CNDL_ENDGROUP ((-11<<16)|65535) -#define CND_GROUP ((-10<<8)|255) -#define CNDL_GROUP ((-10<<16)|65535) -#define CND_REMARK ((-9<<8)|255) -#define CNDL_REMARK ((-9<<16)|65535) -#define CND_COMPAREG ((-8<<8)|255) -#define CNDL_COMPAREG ((-8<<16)|65535) -#define CND_NOTALWAYS ((-7<<8)|255) -#define CNDL_NOTALWAYS ((-7<<16)|65535) -#define CND_ONCE ((-6<<8)|255) -#define CNDL_ONCE ((-6<<16)|65535) -#define CND_REPEAT ((-5<<8)|255) -#define CNDL_REPEAT ((-5<<16)|65535) -#define CND_NOMORE ((-4<<8)|255) -#define CNDL_NOMORE ((-4<<16)|65535) -#define CND_COMPARE ((-3<<8)|255) -#define CND_NEVER ((-2<<8)|255) -#define CNDL_NEVER ((-2<<16)|65535) -#define CND_ALWAYS ((-1<<8)|255) -#define CNDL_ALWAYS ((-1<<16)|65535) - -#define ACT_SKIP ((0<<8)|255) -#define ACTL_SKIP ((0<<16)|65535) -#define ACT_SKIPMONITOR ((1<<8)|255) -#define ACTL_SKIPMONITOR ((1<<16)|65535) -#define ACT_EXECPROG ((2<<8)|255) -#define ACT_SETVARG ((3<<8)|255) -#define ACTL_SETVARG ((3<<16)|65535) -#define ACT_SUBVARG ((4<<8)|255) -#define ACTL_SUBVARG ((4<<16)|65535) -#define ACT_ADDVARG ((5<<8)|255) -#define ACTL_ADDVARG ((5<<16)|65535) -#define ACT_GRPACTIVATE ((6<<8)|255) -#define ACTL_GRPACTIVATE ((6<<16)|65535) -#define ACT_GRPDEACTIVATE ((7<<8)|255) -#define ACTL_GRPDEACTIVATE ((7<<16)|65535) -#define ACT_MENUACTIVATE ((8<<8)|255) -#define ACT_MENUDEACTIVATE ((9<<8)|255) -#define ACT_MENUCHECK ((10<<8)|255) -#define ACT_MENUNCHECK ((11<<8)|255) -#define ACT_MENUSHOW ((12<<8)|255) -#define ACTL_MENUSHOW ((12<<16)|65535) -#define ACT_MENUHIDE ((13<<8)|255) -#define ACTL_MENUHIDE ((13<<16)|65535) -#define ACT_STARTLOOP ((14<<8)|255) -#define ACT_STOPLOOP ((15<<8)|255) -#define ACT_SETLOOPINDEX ((16<<8)|255) -#define ACT_RANDOMIZE ((17<<8)|255) -#define ACT_SENDMENUCMD ((18<<8)|255) -#define ACT_SETGLOBALSTRING ((19<<8)|255) -#define ACTL_SETGLOBALSTRING ((19<<16)|65535) -#define ACT_SENDCLIPBOARD ((20<<8)|255) -#define ACT_CLEARCLIPBOARD ((21<<8)|255) -#define ACT_EXECPROG2 ((22<<8)|255) -#define ACT_OPENDEBUGGER ((23<<8)|255) -#define ACT_PAUSEDEBUGGER ((24<<8)|255) -#define ACT_EXTRACTBINFILE ((25<<8)|255) -#define ACT_RELEASEBINFILE ((26<<8)|255) - -#define EXP_LONG ((0<<8)|255) -#define EXPL_LONG ((0<<16)|65535) -#define EXP_RANDOM ((1<<8)|255) -#define EXPL_RANDOM ((1<<16)|65535) -#define EXP_VARGLO ((2<<8)|255) -#define EXPL_VARGLO ((2<<16)|65535) -#define EXP_STRING ((3<<8)|255) -#define EXPL_STRING ((3<<16)|65535) -#define EXP_STR ((4<<8)|255) -#define EXPL_STR ((4<<16)|65535) -#define EXP_VAL ((5<<8)|255) -#define EXPL_VAL ((5<<16)|65535) -#define EXP_DRIVE ((6<<8)|255) -#define EXPL_DRIVE ((6<<16)|65535) -#define EXP_DIRECTORY ((7<<8)|255) -#define EXPL_DIRECTORY ((7<<16)|65535) -#define EXP_PATH ((8<<8)|255) -#define EXPL_PATH ((8<<16)|65535) -#define EXP_APPNAME ((9<<8)|255) -#define EXPL_APPNAME ((9<<16)|65535) -#define EXP_SIN ((10<<8)|255) -#define EXPL_SIN ((10<<16)|65535) -#define EXP_COS ((11<<8)|255) -#define EXPL_COS ((11<<16)|65535) -#define EXP_TAN ((12<<8)|255) -#define EXPL_TAN ((12<<16)|65535) -#define EXP_SQR ((13<<8)|255) -#define EXPL_SQR ((13<<16)|65535) -#define EXP_LOG ((14<<8)|255) -#define EXPL_LOG ((14<<16)|65535) -#define EXP_LN ((15<<8)|255) -#define EXPL_LN ((15<<16)|65535) -#define EXP_HEX ((16<<8)|255) -#define EXPL_HEX ((16<<16)|65535) -#define EXP_BIN ((17<<8)|255) -#define EXPL_BIN ((17<<16)|65535) -#define EXP_EXP ((18<<8)|255) -#define EXPL_EXP ((18<<16)|65535) -#define EXP_LEFT ((19<<8)|255) -#define EXPL_LEFT ((19<<16)|65535) -#define EXP_RIGHT ((20<<8)|255) -#define EXPL_RIGHT ((20<<16)|65535) -#define EXP_MID ((21<<8)|255) -#define EXPL_MID ((21<<16)|65535) -#define EXP_LEN ((22<<8)|255) -#define EXPL_LEN ((22<<16)|65535) -#define EXP_DOUBLE ((23<<8)|255) -#define EXPL_DOUBLE ((23<<16)|65535) -#define EXP_VARGLONAMED ((24<<8)|255) -#define EXPL_VARGLONAMED ((24<<16)|65535) -#define EXP_ENTERSTRINGHERE ((25<<8)|255) -#define EXPL_ENTERSTRINGHERE ((25<<16)|65535) -#define EXP_ENTERVALUEHERE ((26<<8)|255) -#define EXPL_ENTERVALUEHERE ((26<<16)|65535) -#define EXP_FLOAT ((27<<8)|255) -#define EXPL_FLOAT ((27<<16)|65535) -#define EXP_INT ((28<<8)|255) -#define EXPL_INT ((28<<16)|65535) -#define EXP_ABS ((29<<8)|255) -#define EXPL_ABS ((29<<16)|65535) -#define EXP_CEIL ((30<<8)|255) -#define EXPL_CEIL ((30<<16)|65535) -#define EXP_FLOOR ((31<<8)|255) -#define EXPL_FLOOR ((31<<16)|65535) -#define EXP_ACOS ((32<<8)|255) -#define EXPL_ACOS ((32<<16)|65535) -#define EXP_ASIN ((33<<8)|255) -#define EXPL_ASIN ((33<<16)|65535) -#define EXP_ATAN ((34<<8)|255) -#define EXPL_ATAN ((34<<16)|65535) -#define EXP_NOT ((35<<8)|255) -#define EXPL_NOT ((35<<16)|65535) -#define EXP_NDROPFILES ((36<<8)|255) -#define EXPL_NDROPFILES ((36<<16)|65535) -#define EXP_DROPFILE ((37<<8)|255) -#define EXPL_DROPFILE ((37<<16)|65535) -#define EXP_GETCOMMANDLINE ((38<<8)|255) -#define EXPL_GETCOMMANDLINE ((38<<16)|65535) -#define EXP_GETCOMMANDITEM ((39<<8)|255) -#define EXPL_GETCOMMANDITEM ((39<<16)|65535) -#define EXP_MIN ((40<<8)|255) -#define EXPL_MIN ((40<<16)|65535) -#define EXP_MAX ((41<<8)|255) -#define EXPL_MAX ((41<<16)|65535) -#define EXP_GETRGB ((42<<8)|255) -#define EXPL_GETRGB ((42<<16)|65535) -#define EXP_GETRED ((43<<8)|255) -#define EXPL_GETRED ((43<<16)|65535) -#define EXP_GETGREEN ((44<<8)|255) -#define EXPL_GETGREEN ((44<<16)|65535) -#define EXP_GETBLUE ((45<<8)|255) -#define EXPL_GETBLUE ((45<<16)|65535) -#define EXP_LOOPINDEX ((46<<8)|255) -#define EXPL_LOOPINDEX ((46<<16)|65535) -#define EXP_NEWLINE ((47<<8)|255) -#define EXPL_NEWLINE ((47<<16)|65535) -#define EXP_ROUND ((48<<8)|255) -#define EXPL_ROUND ((48<<16)|65535) -#define EXP_STRINGGLO ((49<<8)|255) -#define EXPL_STRINGGLO ((49<<16)|65535) -#define EXP_STRINGGLONAMED ((50<<8)|255) -#define EXPL_STRINGGLONAMED ((50<<16)|65535) -#define EXP_LOWER ((51<<8)|255) -#define EXPL_LOWER ((51<<16)|65535) -#define EXP_UPPER ((52<<8)|255) -#define EXPL_UPPER ((52<<16)|65535) -#define EXP_FIND ((53<<8)|255) -#define EXPL_FIND ((53<<16)|65535) -#define EXP_REVERSEFIND ((54<<8)|255) -#define EXPL_REVERSEFIND ((54<<16)|65535) -#define EXP_GETCLIPBOARD ((55<<8)|255) -#define EXP_TEMPPATH ((56<<8)|255) -#define EXP_BINFILETEMPNAME ((57<<8)|255) -#define EXP_FLOATSTR ((58<<8)|255) -#define EXPL_FLOATSTR ((58<<16)|65535) -#define EXP_ATAN2 ((59<<8)|255) -#define EXPL_ATAN2 ((59<<16)|65535) -#define EXP_ZERO ((60<<8)|255) -#define EXPL_ZERO ((60<<16)|65535) -#define EXP_EMPTY ((61<<8)|255) -#define EXPL_EMPTY ((61<<16)|65535) - -#define EXP_PARENTH1 ((-1<<8)|255) -#define EXPL_PARENTH1 ((-1<<16)|65535) -#define EXP_PARENTH2 ((-2<<8)|255) -#define EXPL_PARENTH2 ((-2<<16)|65535) -#define EXP_VIRGULE ((-3<<8)|255) -#define EXPL_VIRGULE ((-3<<16)|65535) - -// SPEAKER Conditions / Actions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// #define TYPE_SPEAKER -2 -//(TYPE_SPEAKER&255)=254 -#define CND_SPCHANNELPAUSED ((-9<<8)|254) -#define CNDL_SPCHANNELPAUSED ((-9<<16)|65534) -#define CND_NOSPCHANNELPLAYING ((-8<<8)|254) -#define CNDL_NOSPCHANNELPLAYING ((-8<<16)|65534) -#define CND_MUSPAUSED ((-7<<8)|254) -#define CND_SPSAMPAUSED ((-6<<8)|254) -#define CNDL_SPSAMPAUSED ((-6<<16)|65534) -#define CND_MUSICENDS ((-5<<8)|254) -#define CNDL_MUSICENDS ((-5<<16)|65534) -#define CND_NOMUSPLAYING ((-4<<8)|254) -#define CNDL_NOMUSPLAYING ((-4<<16)|65534) -#define CND_NOSAMPLAYING ((-3<<8)|254) -#define CNDL_NOSAMPLAYING ((-3<<16)|65534) -#define CND_NOSPMUSPLAYING ((-2<<8)|254) -#define CND_NOSPSAMPLAYING ((-1<<8)|254) -#define CNDL_NOSPSAMPLAYING ((-1<<16)|65534) -#define ACT_PLAYSAMPLE ((0<<8)|254) -#define ACTL_PLAYSAMPLE ((0<<16)|65534) -#define ACT_STOPSAMPLE ((1<<8)|254) -#define ACTL_STOPSAMPLE ((1<<16)|65534) -#define ACT_PLAYMUSIC ((2<<8)|254) -#define ACTL_PLAYMUSIC ((2<<16)|65534) -#define ACT_STOPMUSIC ((3<<8)|254) -#define ACTL_STOPMUSIC ((3<<16)|65534) -#define ACT_PLAYLOOPSAMPLE ((4<<8)|254) -#define ACTL_PLAYLOOPSAMPLE ((4<<16)|65534) -#define ACT_PLAYLOOPMUSIC ((5<<8)|254) -#define ACT_STOPSPESAMPLE ((6<<8)|254) -#define ACTL_STOPSPESAMPLE ((6<<16)|65534) -#define ACT_PAUSESAMPLE ((7<<8)|254) -#define ACTL_PAUSESAMPLE ((7<<16)|65534) -#define ACT_RESUMESAMPLE ((8<<8)|254) -#define ACTL_RESUMESAMPLE ((8<<16)|65534) -#define ACT_PAUSEMUSIC ((9<<8)|254) -#define ACT_RESUMEMUSIC ((10<<8)|254) -#define ACT_PLAYCHANNEL ((11<<8)|254) -#define ACTL_PLAYCHANNEL ((11<<16)|65534) -#define ACT_PLAYLOOPCHANNEL ((12<<8)|254) -#define ACTL_PLAYLOOPCHANNEL ((12<<16)|65534) -#define ACT_PAUSECHANNEL ((13<<8)|254) -#define ACTL_PAUSECHANNEL ((13<<16)|65534) -#define ACT_RESUMECHANNEL ((14<<8)|254) -#define ACTL_RESUMECHANNEL ((14<<16)|65534) -#define ACT_STOPCHANNEL ((15<<8)|254) -#define ACTL_STOPCHANNEL ((15<<16)|65534) -#define ACT_SETCHANNELPOS ((16<<8)|254) -#define ACTL_SETCHANNELPOS ((16<<16)|65534) -#define ACT_SETCHANNELVOL ((17<<8)|254) -#define ACTL_SETCHANNELVOL ((17<<16)|65534) -#define ACT_SETCHANNELPAN ((18<<8)|254) -#define ACTL_SETCHANNELPAN ((18<<16)|65534) -#define ACT_SETSAMPLEPOS ((19<<8)|254) -#define ACTL_SETSAMPLEPOS ((19<<16)|65534) -#define ACT_SETSAMPLEMAINVOL ((20<<8)|254) -#define ACTL_SETSAMPLEMAINVOL ((20<<16)|65534) -#define ACT_SETSAMPLEVOL ((21<<8)|254) -#define ACTL_SETSAMPLEVOL ((21<<16)|65534) -#define ACT_SETSAMPLEMALNPAN ((22<<8)|254) -#define ACTL_SETSAMPLEMALNPAN ((22<<16)|65534) -#define ACT_SETSAMPLEPAN ((23<<8)|254) -#define ACTL_SETSAMPLEPAN ((23<<16)|65534) -#define ACT_PAUSEALLCHANNELS ((24<<8)|254) -#define ACTL_PAUSEALLCHANNELS ((24<<16)|65534) -#define ACT_RESUMEALLCHANNELS ((25<<8)|254) -#define ACTL_RESUMEALLCHANNELS ((25<<16)|65534) -#define ACT_PLAYMUSICFILE ((26<<8)|254) -#define ACT_PLAYLOOPMUSICFILE ((27<<8)|254) -#define ACT_PLAYFILECHANNEL ((28<<8)|254) -#define ACTL_PLAYFILECHANNEL ((28<<16)|65534) -#define ACT_PLAYLOOPFILECHANNEL ((29<<8)|254) -#define ACTL_PLAYLOOPFILECHANNEL ((29<<16)|65534) -#define ACT_LOCKCHANNEL ((30<<8)|254) -#define ACTL_LOCKCHANNEL ((30<<16)|65534) -#define ACT_UNLOCKCHANNEL ((31<<8)|254) -#define ACTL_UNLOCKCHANNEL ((31<<16)|65534) -#define ACT_SETCHANNELFREQ ((32<<8)|254) -#define ACT_SETSAMPLEFREQ ((33<<8)|254) - -#define EXP_GETSAMPLEMAINVOL ((0<<8)|254) -#define EXP_GETSAMPLEVOL ((1<<8)|254) -#define EXP_GETCHANNELVOL ((2<<8)|254) -#define EXPL_GETCHANNELVOL ((2<<16)|65534) -#define EXP_GETSAMPLEMAINPAN ((3<<8)|254) -#define EXP_GETSAMPLEPAN ((4<<8)|254) -#define EXP_GETCHANNELPAN ((5<<8)|254) -#define EXPL_GETCHANNELPAN ((5<<16)|65534) -#define EXP_GETSAMPLEPOS ((6<<8)|254) -#define EXP_GETCHANNELPOS ((7<<8)|254) -#define EXPL_GETCHANNELPOS ((7<<16)|65534) -#define EXP_GETSAMPLEDUR ((8<<8)|254) -#define EXP_GETCHANNELDUR ((9<<8)|254) -#define EXP_GETSAMPLEFREQ ((10<<8)|254) -#define EXP_GETCHANNELFREQ ((11<<8)|254) - - -// GAME Conditions / Actions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//#define TYPE_GAME -3 -//(TYPE_GAME&255)=253 - -#define CND_FRAMESAVED ((-10<<8)|253) -#define CND_FRAMELOADED ((-9<<8)|253) -#define CNDL_ENDOFPAUSE ((-8<<16)|65533) -#define CND_ENDOFPAUSE ((-8<<8)|253) -#define CND_ISVSYNCON ((-7<<8)|253) -#define CND_ISLADDER ((-6<<8)|253) -#define CND_ISOBSTACLE ((-5<<8)|253) -#define CND_QUITAPPLICATION ((-4<<8)|253) -#define CNDL_QUITAPPLICATION ((-4<<16)|65533) -#define CND_LEVEL ((-3<<8)|253) -#define CND_END ((-2<<8)|253) -#define CNDL_END ((-2<<16)|65533) -#define CND_START ((-1<<8)|253) -#define CNDL_START ((-1<<16)|65533) - -#define ACT_NEXTLEVEL ((0<<8)|253) -#define ACTL_NEXTLEVEL ((0<<16)|65533) -#define ACT_PREVLEVEL ((1<<8)|253) -#define ACTL_PREVLEVEL ((1<<16)|65533) -#define ACT_GOLEVEL ((2<<8)|253) -#define ACTL_GOLEVEL ((2<<16)|65533) -#define ACT_PAUSE ((3<<8)|253) -#define ACT_ENDGAME ((4<<8)|253) -#define ACTL_ENDGAME ((4<<16)|65533) -#define ACT_RESTARTGAME ((5<<8)|253) -#define ACTL_RESTARTGAME ((5<<16)|65533) -#define ACT_RESTARTLEVEL ((6<<8)|253) -#define ACT_CDISPLAY ((7<<8)|253) -#define ACT_CDISPLAYX ((8<<8)|253) -#define ACT_CDISPLAYY ((9<<8)|253) -#define ACT_LOADGAME ((10<<8)|253) -#define ACT_SAVEGAME ((11<<8)|253) -#define ACT_CLS ((12<<8)|253) -#define ACT_CLEARZONE ((13<<8)|253) -#define ACT_FULLSCREENMODE ((14<<8)|253) -#define ACT_WINDOWEDMODE ((15<<8)|253) -#define ACT_SETFRAMERATE ((16<<8)|253) -#define ACT_PAUSEKEY ((17<<8)|253) -#define ACT_PAUSEANYKEY ((18<<8)|253) -#define ACT_SETVSYNCON ((19<<8)|253) -#define ACT_SETVSYNCOFF ((20<<8)|253) -#define ACT_SETVIRTUALWIDTH ((21<<8)|253) -#define ACT_SETVIRTUALHEIGHT ((22<<8)|253) -#define ACT_SETFRAMEBDKCOLOR ((23<<8)|253) -#define ACT_DELCREATEDBKDAT ((24<<8)|253) -#define ACT_DELALLCREATEDBKD ((25<<8)|253) -#define ACT_SETFRAMEWIDTH ((26<<8)|253) -#define ACT_SETFRAMEHEIGHT ((27<<8)|253) -#define ACT_SAVEFRAME ((28<<8)|253) -#define ACT_LOADFRAME ((29<<8)|253) -#define ACT_LOADAPPLICATION ((30<<8)|253) -#define ACT_PLAYDEMO ((31<<8)|253) -#define ACT_SETFRAMEEFFECT ((32<<8)|253) -#define ACT_SETFRAMEEFFECTPARAM ((33<<8)|253) -#define ACT_SETFRAMEEFFECTPARAMTEXTURE ((34<<8)|253) -#define ACT_SETFRAMEALPHACOEF ((35<<8)|253) -#define ACT_SETFRAMERGBCOEF ((36<<8)|253) - -#define EXP_GAMLEVEL ((0<<8)|253) -#define EXP_GAMNPLAYER ((1<<8)|253) -#define EXP_PLAYXLEFT ((2<<8)|253) -#define EXP_PLAYXRIGHT ((3<<8)|253) -#define EXP_PLAYYTOP ((4<<8)|253) -#define EXP_PLAYYBOTTOM ((5<<8)|253) -#define EXP_PLAYWIDTH ((6<<8)|253) -#define EXP_PLAYHEIGHT ((7<<8)|253) -#define EXP_GAMLEVELNEW ((8<<8)|253) -#define EXP_GETCOLLISIONMASK ((9<<8)|253) -#define EXP_FRAMERATE ((10<<8)|253) -#define EXP_GETVIRTUALWIDTH ((11<<8)|253) -#define EXP_GETVIRTUALHEIGHT ((12<<8)|253) -#define EXP_GETFRAMEBKDCOLOR ((13<<8)|253) -#define EXP_GRAPHICMODE ((14<<8)|253) -#define EXP_PIXELSHADERVERSION ((15<<8)|253) -#define EXP_FRAMEALPHACOEF ((16<<8)|253) -#define EXP_FRAMERGBCOEF ((17<<8)|253) -#define EXP_FRAMEEFFECTPARAM ((18<<8)|253) - - -// TIMER Conditions / Actions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define CND_TIMEOUT ((-5<<8)|(OBJ_TIMER&255)) -#define CND_EVERY ((-4<<8)|(OBJ_TIMER&255)) -#define CNDL_EVERY ((-4<<16)|(OBJ_TIMER&0xFFFF)) -#define CND_TIMER ((-3<<8)|(OBJ_TIMER&255)) -#define CNDL_TIMER ((-3<<16)|(OBJ_TIMER&0xFFFF)) -#define CND_TIMERINF ((-2<<8)|(OBJ_TIMER&255)) -#define CNDL_TIMERINF ((-2<<16)|(OBJ_TIMER&0xFFFF)) -#define CND_TIMERSUP ((-1<<8)|(OBJ_TIMER&255)) -#define CNDL_TIMERSUP ((-1<<16)|(OBJ_TIMER&0xFFFF)) -#define ACT_SETTIMER ((0<<8)|(OBJ_TIMER&255)) -#define EXP_TIMVALUE ((0<<8)|(OBJ_TIMER&255)) -#define EXP_TIMCENT ((1<<8)|(OBJ_TIMER&255)) -#define EXP_TIMSECONDS ((2<<8)|(OBJ_TIMER&255)) -#define EXP_TIMHOURS ((3<<8)|(OBJ_TIMER&255)) -#define EXP_TIMMINITS ((4<<8)|(OBJ_TIMER&255)) -#define NUM_EVERY -4 -#define NUM_TIMER -3 -#define NUM_TIMERINF -2 -#define NUM_TIMERSUP -1 - -// KEYBOARD Conditions / Actions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define CNDL_ONMOUSEWHEELDOWN ((-12<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_ONMOUSEWHEELDOWN ((-12<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_ONMOUSEWHEELUP ((-11<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_ONMOUSEWHEELUP ((-11<<8)|(OBJ_KEYBOARD&255)) -#define CND_MOUSEON ((-10<<8)|(OBJ_KEYBOARD&255)) -#define CND_ANYKEY ((-9<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_ANYKEY ((-9<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_MKEYDEPRESSED ((-8<<8)|(OBJ_KEYBOARD&255)) -#define CND_MCLICKONOBJECT ((-7<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_MCLICKONOBJECT ((-7<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_MCLICKINZONE ((-6<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_MCLICKINZONE ((-6<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_MCLICK ((-5<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_MCLICK ((-5<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_MONOBJECT ((-4<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_MONOBJECT ((-4<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_MINZONE ((-3<<8)|(OBJ_KEYBOARD&255)) -#define CND_KBKEYDEPRESSED ((-2<<8)|(OBJ_KEYBOARD&255)) -#define CND_KBPRESSKEY ((-1<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_KBPRESSKEY ((-1<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define ACT_HIDECURSOR ((0<<8)|(OBJ_KEYBOARD&255)) -#define ACT_SHOWCURSOR ((1<<8)|(OBJ_KEYBOARD&255)) -#define EXP_XMOUSE ((0<<8)|(OBJ_KEYBOARD&255)) -#define EXP_YMOUSE ((1<<8)|(OBJ_KEYBOARD&255)) -#define EXP_MOUSEWHEELDELTA ((2<<8)|(OBJ_KEYBOARD&255)) - - -// PLAYERS Conditions / Actions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define CND_JOYPUSHED ((-6<<8)|(OBJ_PLAYER&255)) -#define CND_NOMORELIVE ((-5<<8)|(OBJ_PLAYER&255)) -#define CNDL_NOMORELIVE ((-5<<16)|(OBJ_PLAYER&0xFFFF)) -#define CND_JOYPRESSED ((-4<<8)|(OBJ_PLAYER&255)) -#define CNDL_JOYPRESSED ((-4<<16)|(OBJ_PLAYER&0xFFFF)) -#define CND_LIVE ((-3<<8)|(OBJ_PLAYER&255)) -#define CND_SCORE ((-2<<8)|(OBJ_PLAYER&255)) -#define CND_PLAYERPLAYING ((-1<<8)|(OBJ_PLAYER&255)) - -#define ACT_SETSCORE ((0<<8)|(OBJ_PLAYER&255)) -#define ACT_SETLIVES ((1<<8)|(OBJ_PLAYER&255)) -#define ACT_NOINPUT ((2<<8)|(OBJ_PLAYER&255)) -#define ACT_RESTINPUT ((3<<8)|(OBJ_PLAYER&255)) -#define ACT_ADDSCORE ((4<<8)|(OBJ_PLAYER&255)) -#define ACT_ADDLIVES ((5<<8)|(OBJ_PLAYER&255)) -#define ACT_SUBSCORE ((6<<8)|(OBJ_PLAYER&255)) -#define ACT_SUBLIVES ((7<<8)|(OBJ_PLAYER&255)) -#define ACT_SETINPUT ((8<<8)|(OBJ_PLAYER&255)) -#define ACT_SETINPUTKEY ((9<<8)|(OBJ_PLAYER&255)) -#define ACT_SETPLAYERNAME ((10<<8)|(OBJ_PLAYER&255)) - -#define EXP_PLASCORE ((0<<8)|(OBJ_PLAYER&255)) -#define EXP_PLALIVES ((1<<8)|(OBJ_PLAYER&255)) -#define EXP_GETINPUT ((2<<8)|(OBJ_PLAYER&255)) -#define EXP_GETINPUTKEY ((3<<8)|(OBJ_PLAYER&255)) -#define EXP_GETPLAYERNAME ((4<<8)|(OBJ_PLAYER&255)) -#define NUM_JOYPRESSED -4 - -// CREATE Conditions / Actions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define CND_CHOOSEALLINLINE ((-23<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEFLAGRESET ((-22<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEFLAGSET ((-21<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEVALUE ((-20<<8)|(OBJ_CREATE&255)) -#define CND_PICKFROMID ((-19<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEALLINZONE ((-18<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEALL ((-17<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEZONE ((-16<<8)|(OBJ_CREATE&255)) -#define CND_NUMOFALLOBJECT ((-15<<8)|(OBJ_CREATE&255)) -#define CND_NUMOFALLZONE ((-14<<8)|(OBJ_CREATE&255)) -#define CND_NOMOREALLZONE ((-13<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEFLAGRESET_OLD ((-12<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEFLAGSET_OLD ((-11<<8)|(OBJ_CREATE&255)) -//... -#define CND_CHOOSEVALUE_OLD ((-8<<8)|(OBJ_CREATE&255)) -#define CND_PICKFROMID_OLD ((-7<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEALLINZONE_OLD ((-6<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEALL_OLD ((-5<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEZONE_OLD ((-4<<8)|(OBJ_CREATE&255)) -#define CND_NUMOFALLOBJECT_OLD ((-3<<8)|(OBJ_CREATE&255)) -#define CND_NUMOFALLZONE_OLD ((-2<<8)|(OBJ_CREATE&255)) -#define CND_NOMOREALLZONE_OLD ((-1<<8)|(OBJ_CREATE&255)) -#define ACT_CREATE ((0<<8)|(OBJ_CREATE&255)) -#define EXP_CRENUMBERALL ((0<<8)|(OBJ_CREATE&255)) -#define NUM_END -2 -#define NUM_START -1 - -#endif - -// BALL Movements -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagMB { - WORD mbSpeed; - WORD mbBounce; - WORD mbAngles; - WORD mbSecurity; - WORD mbDecelerate; - WORD mbFree; - } MoveBall; -typedef MoveBall * LPMOVEBALL; - -// MOUSE movement -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagMM { - short mmDx; - short mmFx; - short mmDy; - short mmFy; - short mmFlags; - } MoveMouse; -typedef MoveMouse * LPMOVEMOUSE; - -#define MOUSE_XCENTER 100 -#define MOUSE_YCENTER 100 -#define MMMODE_NORMAL 0 -#define MMMODE_HIDDEN 1 -#define MMMODE_REMOVED 2 - -// 8 Direction movement -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagMG { - WORD mgSpeed; // Max speed - WORD mgAcc; // Acceleration - WORD mgDec; // Deceleration - WORD mgBounceMult; // Bounce factor - DWORD mgDir; // Allowed directions - } MoveGeneric; -typedef MoveGeneric * LPMOVEGENERIC; - -// RACE-CAR movement -// ~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagMR { - WORD mrSpeed; // Max speed - WORD mrAcc; // Acceleration - WORD mrDec; // Deceleration - WORD mrRot; // Rotating speed - WORD mrBounceMult; // Bounce factor - WORD mrAngles; // Number of angles - WORD mrOkReverse; // Allowed reverse speed? - } MoveRace; -typedef MoveRace * LPMOVERACE; - -// Path movement -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// Structure for one move -typedef struct tagMDV1 { - BYTE mdSpeed; - BYTE mdDir; - short mdDx; - short mdDy; - short mdCosinus; - short mdSinus; - short mdLength; - short mdPause; - } MoveDefV1; -typedef MoveDefV1 * LPMOVEDEFV1; - -typedef struct tagMD { - BYTE mdPrevious; - BYTE mdNext; - BYTE mdSpeed; - BYTE mdDir; - short mdDx; - short mdDy; - short mdCosinus; - short mdSinus; - short mdLength; - short mdPause; - TCHAR mdName[2]; - } MoveDef; -typedef MoveDef * LPMOVEDEF; - -// Movement edition -typedef struct tagME { - int meSpeed; - int meDx; - int meDy; - int meFlag; - int meX; - int meY; - int meDelay; - LPTSTR meName; - } MoveEdit; -typedef MoveEdit * LPMOVEEDIT; - -typedef struct tagMA { - MoveEdit me[1]; - }MoveArray; -#define sizeof_MoveArray (sizeof(MoveArray)-sizeof(MoveEdit)) -typedef MoveArray * LPMOVEARRAY; - -typedef struct tagMT { - WORD mtNumber; // Number of movement - WORD mtMinSpeed; // maxs and min speed in the movements - WORD mtMaxSpeed; - BYTE mtLoop; // Loop at end - BYTE mtRepos; // Reposition at end - BYTE mtReverse; // Pingpong? - BYTE mtFree; - BYTE mtMoves[2]; // Start of movement definition - } MoveTaped; -typedef MoveTaped * LPMOVETAPED; - -// PLATFORM mouvement -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagMP { - WORD mpSpeed; // Max speed - WORD mpAcc; // Acceleration - WORD mpDec; // Deceleration - WORD mpJumpControl; // Bounce factor - WORD mpGravity; - WORD mpJump; - } MovePlatform; -typedef MovePlatform * LPMOVEPLATFORM; - -#define MPJC_NOJUMP 0 -#define MPJC_DIAGO 1 -#define MPJC_BUTTON1 2 -#define MPJC_BUTTON2 3 - -// Movement Extension structure -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct MoveExt { - CMvt* meMvt; // Object -} MoveExt; -typedef MoveExt * LPMOVEEXT; - -// Movement Structure -// ~~~~~~~~~~~~~~~~~~ -typedef struct MvtHdr { - DWORD mvhModuleNameOffset; - DWORD mvhID; - DWORD mvhDataOffset; - DWORD mvhDataSize; -} MvtHdr; - -typedef struct MovementTable -{ - DWORD mvtNMvt; // Number of movements - MvtHdr mvtHdr[1]; -} MovementTable; -typedef MovementTable * LPMVTTABLE; - -#define MVTOPT_8DIR_STICK 0x01 // Stick to obstacles (build 249, 8-direction mvt), allows the user to choose between behavior of b247 (avoid obstacles) and b248 (stick to obstacles) - -typedef struct tagMV { - WORD mvControl; // Who controls the object - WORD mvType; // Type of movement - BYTE mvMove; // Move at start? - BYTE mvOpt; // Options - BYTE mvFree1; - BYTE mvFree2; - DWORD mvDirAtStart; - union { - MoveMouse mm; - MoveGeneric mg; - MoveBall mb; - MoveTaped mt; - MoveRace mr; - MovePlatform mp; - MoveExt me; - } mu; -} Movement; -typedef Movement * LPMOVEMENT; - -#ifndef IN_KPX - -// COMMON CONDITIONS FOR NORMAL OBJECTS -////////////////////////////////////////// -#define EVENTS_EXTBASE 80 - -#define CND_EXTISSTRIKEOUT (-40<<8) -#define CND_EXTISUNDERLINE (-39<<8) -#define CND_EXTISITALIC (-38<<8) -#define CND_EXTISBOLD (-37<<8) -#define CND_EXTCMPVARSTRING (-36<<8) -#define CNDL_EXTCMPVARSTRING (-36<<16) -#define CND_EXTPATHNODENAME (-35<<8) -#define CNDL_EXTPATHNODENAME (-35<<16) -#define CND_EXTCHOOSE (-34<<8) -#define CND_EXTNOMOREOBJECT (-33<<8) -#define CNDL_EXTNOMOREOBJECT (-33<<16) -#define CND_EXTNUMOFOBJECT (-32<<8) -#define CND_EXTNOMOREZONE (-31<<8) -#define CND_EXTNUMBERZONE (-30<<8) -#define CND_EXTSHOWN (-29<<8) -#define CND_EXTHIDDEN (-28<<8) -#define CND_EXTCMPVAR (-27<<8) -#define CNDL_EXTCMPVAR (-27<<16) -#define CND_EXTCMPVARFIXED (-26<<8) -#define CND_EXTFLAGSET (-25<<8) -#define CND_EXTFLAGRESET (-24<<8) -#define CND_EXTISCOLBACK (-23<<8) -#define CND_EXTNEARBORDERS (-22<<8) -#define CND_EXTENDPATH (-21<<8) -#define CNDL_EXTENDPATH (-21<<16) -#define CND_EXTPATHNODE (-20<<8) -#define CNDL_EXTPATHNODE (-20<<16) -#define CND_EXTCMPACC (-19<<8) -#define CND_EXTCMPDEC (-18<<8) -#define CND_EXTCMPX (-17<<8) -#define CND_EXTCMPY (-16<<8) -#define CND_EXTCMPSPEED (-15<<8) -#define CND_EXTCOLLISION (-14<<8) -#define CNDL_EXTCOLLISION (-14<<16) -#define CND_EXTCOLBACK (-13<<8) -#define CNDL_EXTCOLBACK (-13<<16) -#define CND_EXTOUTPLAYFIELD (-12<<8) -#define CNDL_EXTOUTPLAYFIELD (-12<<16) -#define CND_EXTINPLAYFIELD (-11<<8) -#define CNDL_EXTINPLAYFIELD (-11<<16) -#define CND_EXTISOUT (-10<<8) -#define CNDL_EXTISOUT (-10<<16) -#define CND_EXTISIN (-9 <<8) -#define CNDL_EXTISIN (-9 <<16) -#define CND_EXTFACING (-8 <<8) -#define CND_EXTSTOPPED (-7 <<8) -#define CND_EXTBOUNCING (-6 <<8) -#define CND_EXTREVERSED (-5 <<8) -#define CND_EXTISCOLLIDING (-4 <<8) -#define CNDL_EXTISCOLLIDING (-4 <<16) -#define CND_EXTANIMPLAYING (-3 <<8) -#define CND_EXTANIMENDOF (-2 <<8) -#define CNDL_EXTANIMENDOF (-2 <<16) -#define CND_EXTCMPFRAME (-1 <<8) - -#define ACT_EXTSETPOS (1 <<8) -#define ACT_EXTSETX (2 <<8) -#define ACT_EXTSETY (3 <<8) -#define ACT_EXTSTOP (4 <<8) -#define ACTL_EXTSTOP (4 <<16) -#define ACT_EXTSTART (5 <<8) -#define ACT_EXTSPEED (6 <<8) -#define ACT_EXTMAXSPEED (7 <<8) -#define ACT_EXTWRAP (8 <<8) -#define ACTL_EXTWRAP (8 <<16) -#define ACT_EXTBOUNCE (9 <<8) -#define ACTL_EXTBOUNCE (9 <<16) -#define ACT_EXTREVERSE (10<<8) -#define ACT_EXTNEXTMOVE (11<<8) -#define ACT_EXTPREVMOVE (12<<8) -#define ACT_EXTSELMOVE (13<<8) -#define ACT_EXTLOOKAT (14<<8) -#define ACT_EXTSTOPANIM (15<<8) -#define ACT_EXTSTARTANIM (16<<8) -#define ACT_EXTFORCEANIM (17<<8) -#define ACT_EXTFORCEDIR (18<<8) -#define ACT_EXTFORCESPEED (19<<8) -#define ACTL_EXTFORCESPEED (19<<16) -#define ACT_EXTRESTANIM (20<<8) -#define ACT_EXTRESTDIR (21<<8) -#define ACT_EXTRESTSPEED (22<<8) -#define ACT_EXTSETDIR (23<<8) -#define ACT_EXTDESTROY (24<<8) -#define ACT_EXTSHUFFLE (25<<8) -#define ACTL_EXTSHUFFLE (25<<16) -#define ACT_EXTHIDE (26<<8) -#define ACT_EXTSHOW (27<<8) -#define ACT_EXTDISPLAYDURING (28<<8) -#define ACT_EXTSHOOT (29<<8) -#define ACTL_EXTSHOOT (29<<16) -#define ACT_EXTSHOOTTOWARD (30<<8) -#define ACTL_EXTSHOOTTOWARD (30<<16) -#define ACT_EXTSETVAR (31<<8) -#define ACTL_EXTSETVAR (31<<16) -#define ACT_EXTADDVAR (32<<8) -#define ACTL_EXTADDVAR (32<<16) -#define ACT_EXTSUBVAR (33<<8) -#define ACTL_EXTSUBVAR (33<<16) -#define ACT_EXTDISPATCHVAR (34<<8) -#define ACTL_EXTDISPATCHVAR (34<<16) -#define ACT_EXTSETFLAG (35<<8) -#define ACT_EXTCLRFLAG (36<<8) -#define ACT_EXTCHGFLAG (37<<8) -#define ACT_EXTINKEFFECT (38<<8) -#define ACT_EXTSETSEMITRANSPARENCY (39<<8) -#define ACT_EXTFORCEFRAME (40<<8) -#define ACT_EXTRESTFRAME (41<<8) -#define ACT_EXTSETACCELERATION (42<<8) -#define ACT_EXTSETDECELERATION (43<<8) -#define ACT_EXTSETROTATINGSPEED (44<<8) -#define ACT_EXTSETDIRECTIONS (45<<8) -#define ACT_EXTBRANCHNODE (46<<8) -#define ACT_EXTSETGRAVITY (47<<8) -#define ACT_EXTGOTONODE (48<<8) -#define ACT_EXTSETVARSTRING (49<<8) -#define ACTL_EXTSETVARSTRING (49<<16) -#define ACT_EXTSETFONTNAME (50<<8) -#define ACT_EXTSETFONTSIZE (51<<8) -#define ACT_EXTSETBOLD (52<<8) -#define ACT_EXTSETITALIC (53<<8) -#define ACT_EXTSETUNDERLINE (54<<8) -#define ACT_EXTSETSRIKEOUT (55<<8) -#define ACT_EXTSETTEXTCOLOR (56<<8) -#define ACT_EXTSPRFRONT (57<<8) -#define ACT_EXTSPRBACK (58<<8) -#define ACT_EXTMOVEBEFORE (59<<8) -#define ACT_EXTMOVEAFTER (60<<8) -#define ACT_EXTMOVETOLAYER (61<<8) -#define ACT_EXTADDTODEBUGGER (62<<8) -#define ACT_EXTSETEFFECT (63<<8) -#define ACT_EXTSETEFFECTPARAM (64<<8) -#define ACT_EXTSETALPHACOEF (65<<8) -#define ACT_EXTSETRGBCOEF (66<<8) -#define ACT_EXTSETEFFECTPARAMTEXTURE (67<<8) - -#define EXP_EXTYSPR ( 1<<8) -#define EXP_EXTISPR ( 2<<8) -#define EXP_EXTSPEED ( 3<<8) -#define EXP_EXTACC ( 4<<8) -#define EXP_EXTDEC ( 5<<8) -#define EXP_EXTDIR ( 6<<8) -#define EXP_EXTXLEFT ( 7<<8) -#define EXP_EXTXRIGHT ( 8<<8) -#define EXP_EXTYTOP ( 9<<8) -#define EXP_EXTYBOTTOM (10<<8) -#define EXP_EXTXSPR (11<<8) -#define EXP_EXTIDENTIFIER (12<<8) -#define EXP_EXTFLAG (13<<8) -#define EXP_EXTNANI (14<<8) -#define EXP_EXTNOBJECTS (15<<8) -#define EXP_EXTVAR (16<<8) -#define EXPL_EXTVAR (16<<16) -#define EXP_EXTGETSEMITRANSPARENCY (17<<8) -#define EXP_EXTNMOVE (18<<8) -#define EXP_EXTVARSTRING (19<<8) -#define EXPL_EXTVARSTRING (19<<16) -#define EXP_EXTGETFONTNAME (20<<8) -#define EXP_EXTGETFONTSIZE (21<<8) -#define EXP_EXTGETFONTCOLOR (22<<8) -#define EXP_EXTGETLAYER (23<<8) -#define EXP_EXTGETGRAVITY (24<<8) -#define EXP_EXTXAP (25<<8) -#define EXP_EXTYAP (26<<8) -#define EXP_EXTALPHACOEF (27<<8) -#define EXP_EXTRGBCOEF (28<<8) -#define EXP_EXTEFFECTPARAM (29<<8) -#define EXP_EXTVARBYINDEX (30<<8) -#define EXP_EXTVARSTRINGBYINDEX (31<<8) - -// TEXT Conditions / Actions -//////////////////////////////////////////// -#define ACT_STRDESTROY (( (EVENTS_EXTBASE+0)<<8)|3) -#define ACT_STRDISPLAY (( (EVENTS_EXTBASE+1)<<8)|3) -#define ACT_STRDISPLAYDURING (( (EVENTS_EXTBASE+2)<<8)|3) -#define ACT_STRSETCOLOUR (( (EVENTS_EXTBASE+3)<<8)|3) -#define ACT_STRSET (( (EVENTS_EXTBASE+4)<<8)|3) -#define ACT_STRPREV (( (EVENTS_EXTBASE+5)<<8)|3) -#define ACT_STRNEXT (( (EVENTS_EXTBASE+6)<<8)|3) -#define ACT_STRDISPLAYSTRING (( (EVENTS_EXTBASE+7)<<8)|3) -#define ACT_STRSETSTRING (( (EVENTS_EXTBASE+8)<<8)|3) -#define EXP_STRNUMBER (( (EVENTS_EXTBASE+0)<<8)|3) -#define EXP_STRGETCURRENT (( (EVENTS_EXTBASE+1)<<8)|3) -#define EXP_STRGETNUMBER (( (EVENTS_EXTBASE+2)<<8)|3) -#define EXP_STRGETNUMERIC (( (EVENTS_EXTBASE+3)<<8)|3) -#define EXP_STRGETNPARA (( (EVENTS_EXTBASE+4)<<8)|3) - -// SPRITES Conditions / Actions -///////////////////////////////////////////// -#define CND_SPRCLICK (((-EVENTS_EXTBASE-1)<<8)|2) -#define ACT_SPRPASTE (((EVENTS_EXTBASE+0)<<8)|2) -#define ACT_SPRFRONT (((EVENTS_EXTBASE+1)<<8)|2) -#define ACT_SPRBACK (((EVENTS_EXTBASE+2)<<8)|2) -#define ACT_SPRADDBKD (((EVENTS_EXTBASE+3)<<8)|2) -#define ACT_SPRREPLACECOLOR (((EVENTS_EXTBASE+4)<<8)|2) -#define ACT_SPRSETSCALE (((EVENTS_EXTBASE+5)<<8)|2) -#define ACT_SPRSETSCALEX (((EVENTS_EXTBASE+6)<<8)|2) -#define ACT_SPRSETSCALEY (((EVENTS_EXTBASE+7)<<8)|2) -#define ACT_SPRSETANGLE (((EVENTS_EXTBASE+8)<<8)|2) -#define ACT_SPRLOADFRAME (((EVENTS_EXTBASE+9)<<8)|2) -#define ACTL_SPRLOADFRAME (((EVENTS_EXTBASE+9)<<16)|2) -#define EXP_GETRGBAT (((EVENTS_EXTBASE+0)<<8)|2) -#define EXP_GETSCALEX (((EVENTS_EXTBASE+1)<<8)|2) -#define EXP_GETSCALEY (((EVENTS_EXTBASE+2)<<8)|2) -#define EXP_GETANGLE (((EVENTS_EXTBASE+3)<<8)|2) - -// COUNTERS Conditions / Actions -////////////////////////////////////////////// -#define CND_CCOUNTER (((-EVENTS_EXTBASE-1)<<8)|7) -#define ACT_CSETVALUE (( (EVENTS_EXTBASE+0)<<8)|7) -#define ACT_CADDVALUE (( (EVENTS_EXTBASE+1)<<8)|7) -#define ACT_CSUBVALUE (( (EVENTS_EXTBASE+2)<<8)|7) -#define ACT_CSETMIN (( (EVENTS_EXTBASE+3)<<8)|7) -#define ACT_CSETMAX (( (EVENTS_EXTBASE+4)<<8)|7) -#define ACT_CSETCOLOR1 (( (EVENTS_EXTBASE+5)<<8)|7) -#define ACT_CSETCOLOR2 (( (EVENTS_EXTBASE+6)<<8)|7) -#define EXP_CVALUE (( (EVENTS_EXTBASE+0)<<8)|7) -#define EXP_CGETMIN (( (EVENTS_EXTBASE+1)<<8)|7) -#define EXP_CGETMAX (( (EVENTS_EXTBASE+2)<<8)|7) -#define EXP_CGETCOLOR1 (( (EVENTS_EXTBASE+3)<<8)|7) -#define EXP_CGETCOLOR2 (( (EVENTS_EXTBASE+4)<<8)|7) - -// QUESTIONS Conditions / Actions -/////////////////////////////////////////////// -#define CND_QEQUAL (((-EVENTS_EXTBASE-3)<<8)|4) -#define CNDL_QEQUAL (((-EVENTS_EXTBASE-3)<<16)|4) -#define CND_QFALSE (((-EVENTS_EXTBASE-2)<<8)|4) -#define CNDL_QFALSE (((-EVENTS_EXTBASE-2)<<16)|4) -#define CND_QEXACT (((-EVENTS_EXTBASE-1)<<8)|4) -#define CNDL_QEXACT (((-EVENTS_EXTBASE-1)<<16)|4) -#define ACT_QASK (( (EVENTS_EXTBASE+0)<<8)|4) - - -// Formatted text Conditions / actions / expressions -////////////////////////////////////////////////////////////////// -#define ACT_RTFSETXPOS (((EVENTS_EXTBASE+0)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSETYPOS (((EVENTS_EXTBASE+1)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSETZOOM (((EVENTS_EXTBASE+2)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_CLEAR (((EVENTS_EXTBASE+3)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_WORDSTRONCE (((EVENTS_EXTBASE+4)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_WORDSTRNEXT (((EVENTS_EXTBASE+5)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_WORDSTRALL (((EVENTS_EXTBASE+6)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_WORD (((EVENTS_EXTBASE+7)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_LINE (((EVENTS_EXTBASE+8)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_PARAGRAPH (((EVENTS_EXTBASE+9)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_PAGE (((EVENTS_EXTBASE+10)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_ALL (((EVENTS_EXTBASE+11)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_RANGE (((EVENTS_EXTBASE+12)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_BOOKMARK (((EVENTS_EXTBASE+13)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSETFOCUSWORD (((EVENTS_EXTBASE+14)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHT_OFF (((EVENTS_EXTBASE+15)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTTEXT_COLOR (((EVENTS_EXTBASE+16)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTTEXT_BOLD (((EVENTS_EXTBASE+17)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTTEXT_ITALIC (((EVENTS_EXTBASE+18)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTTEXT_UNDERL (((EVENTS_EXTBASE+19)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTTEXT_OUTL (((EVENTS_EXTBASE+20)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTBACK_COLOR (((EVENTS_EXTBASE+21)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTBACK_RECT (((EVENTS_EXTBASE+22)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTBACK_MARKER (((EVENTS_EXTBASE+23)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTBACK_HATCH (((EVENTS_EXTBASE+24)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTBACK_INVERSE (((EVENTS_EXTBASE+25)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFDISPLAY (((EVENTS_EXTBASE+26)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSETFOCUSPREV (((EVENTS_EXTBASE+27)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSETFOCUSNEXT (((EVENTS_EXTBASE+28)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFREMOVEFOCUS (((EVENTS_EXTBASE+29)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFAUTOON (((EVENTS_EXTBASE+30)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFAUTOOFF (((EVENTS_EXTBASE+31)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFINSERTSTRING (((EVENTS_EXTBASE+32)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFLOADTEXT (((EVENTS_EXTBASE+33)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFINSERTTEXT (((EVENTS_EXTBASE+34)<<8)|(OBJ_RTF&0x00FF)) - - -#define EXP_RTFXPOS (((EVENTS_EXTBASE+0)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFYPOS (((EVENTS_EXTBASE+1)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFSXPAGE (((EVENTS_EXTBASE+2)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFSYPAGE (((EVENTS_EXTBASE+3)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFZOOM (((EVENTS_EXTBASE+4)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFWORDMOUSE (((EVENTS_EXTBASE+5)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFWORDXY (((EVENTS_EXTBASE+6)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFWORD (((EVENTS_EXTBASE+7)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFXWORD (((EVENTS_EXTBASE+8)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFYWORD (((EVENTS_EXTBASE+9)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFSXWORD (((EVENTS_EXTBASE+10)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFSYWORD (((EVENTS_EXTBASE+11)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFLINEMOUSE (((EVENTS_EXTBASE+12)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFLINEXY (((EVENTS_EXTBASE+13)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFXLINE (((EVENTS_EXTBASE+14)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFYLINE (((EVENTS_EXTBASE+15)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFSXLINE (((EVENTS_EXTBASE+16)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFSYLINE (((EVENTS_EXTBASE+17)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFPARAMOUSE (((EVENTS_EXTBASE+18)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFPARAXY (((EVENTS_EXTBASE+19)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFXPARA (((EVENTS_EXTBASE+20)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFYPARA (((EVENTS_EXTBASE+21)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFSXPARA (((EVENTS_EXTBASE+22)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFSYPARA (((EVENTS_EXTBASE+23)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFXWORDTEXT (((EVENTS_EXTBASE+24)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFYWORDTEXT (((EVENTS_EXTBASE+25)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFXLINETEXT (((EVENTS_EXTBASE+26)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFYLINETEXT (((EVENTS_EXTBASE+27)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFXPARATEXT (((EVENTS_EXTBASE+28)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFYPARATEXT (((EVENTS_EXTBASE+29)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFMEMSIZE (((EVENTS_EXTBASE+30)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFGETFOCUSWORD (((EVENTS_EXTBASE+31)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFGETHYPERLINK (((EVENTS_EXTBASE+32)<<8)|(OBJ_RTF&0x00FF)) - -#define CND_CCAISPAUSED (((-EVENTS_EXTBASE-4)<<8)|(OBJ_CCA&0x00FF)) -#define CND_CCAISVISIBLE (((-EVENTS_EXTBASE-3)<<8)|(OBJ_CCA&0x00FF)) -#define CND_CCAAPPFINISHED (((-EVENTS_EXTBASE-2)<<8)|(OBJ_CCA&0x00FF)) -#define CNDL_CCAAPPFINISHED (((-EVENTS_EXTBASE-2)<<16)|(OBJ_CCA&0xFFFF)) -#define CND_CCAFRAMECHANGED (((-EVENTS_EXTBASE-1)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCARESTARTAPP (((EVENTS_EXTBASE+0)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCARESTARTFRAME (((EVENTS_EXTBASE+1)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCANEXTFRAME (((EVENTS_EXTBASE+2)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCAPREVIOUSFRAME (((EVENTS_EXTBASE+3)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCAENDAPP (((EVENTS_EXTBASE+4)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCANEWAPP (((EVENTS_EXTBASE+5)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCAJUMPFRAME (((EVENTS_EXTBASE+6)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCASETGLOBALVALUE (((EVENTS_EXTBASE+7)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCASHOW (((EVENTS_EXTBASE+8)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCAHIDE (((EVENTS_EXTBASE+9)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCASETGLOBALSTRING (((EVENTS_EXTBASE+10)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCAPAUSEAPP (((EVENTS_EXTBASE+11)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCARESUMEAPP (((EVENTS_EXTBASE+12)<<8)|(OBJ_CCA&0x00FF)) -#define EXP_CCAGETFRAMENUMBER (((EVENTS_EXTBASE+0)<<8)|(OBJ_CCA&0x00FF)) -#define EXP_CCAGETGLOBALVALUE (((EVENTS_EXTBASE+1)<<8)|(OBJ_CCA&0x00FF)) -#define EXP_CCAGETGLOBALSTRING (((EVENTS_EXTBASE+2)<<8)|(OBJ_CCA&0x00FF)) - -#endif // IN_KPX - -/////////////////////////////////////////////////////////////////////// -// -// DEFINITION OF THE DIFFERENT PARAMETERS -// -/////////////////////////////////////////////////////////////////////// - -// -------------------------------- Objects -// W-Offset list OI -// W-Number -// W-TYPE *** Version > FVERSION_NEWOBJECTS -#define PARAM_OBJECT 1 -#define PS_OBJ 6 - -// -------------------------------- Time -// L-Timer -// L-Equivalent loops -#define PARAM_TIME 2 -#define PS_TIM 8 - -// -------------------------------- Border -// W-border -#define PARAM_BORDER 3 -#define PS_BOR 2 -#define BORDER_LEFT 1 -#define BORDER_RIGHT 2 -#define BORDER_TOP 4 -#define BORDER_BOTTOM 8 -#define BORDER_ALL 15 - -// -------------------------------- Direction -// W-direction -#define PARAM_DIRECTION 4 -#define PS_DIR 2 - -// -------------------------------- Integer -// W-shorteger (or base) -// W-nothing (or maximum) -#define PARAM_INTEGER 5 -#define PS_INT 4 - -// -------------------------------- Sample -#define MAX_SOUNDNAME 64 -#define PSOUNDFLAG_UNINTERRUPTABLE 0x0001 -#define PSOUNDFLAG_BAD 0x0002 -#define PSOUNDFLAG_IPHONE_AUDIOPLAYER 0x0004 -#define PSOUNDFLAG_IPHONE_OPENAL 0x0008 - -typedef struct tagSSNDA { - short sndHandle; - short sndFlags; - char sndName[MAX_SOUNDNAME]; - } SoundParamA; -typedef struct tagSSNDW { - short sndHandle; - short sndFlags; - WCHAR sndName[MAX_SOUNDNAME]; - } SoundParamW; -typedef SoundParamA * LPSNDA; -typedef SoundParamW * LPSNDW; - -#define PARAM_SAMPLE 6 -#ifdef _UNICODE -#define PS_SAM sizeof(SoundParamW) -#define LPSND LPSNDW -#else -#define PS_SAM sizeof(SoundParamA) -#define LPSND LPSNDA -#endif - -// -------------------------------- Music -#define PARAM_MUSIC 7 -#ifdef _UNICODE -#define PS_MUS sizeof(SoundParamW) -#else -#define PS_MUS sizeof(SoundParamA) -#endif - - -// POSITION PARAM Structure -// ~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagPPA { - short posOINUMParent; //0 - short posFlags; - short posX; //4 - short posY; - short posSlope; //8 - short posAngle; - long posDir; //12 - ITEMTYPE posTypeParent; //16 - short posOiList; //18 - short posLayer; //20 - } PositionParam; -typedef PositionParam * LPPOS; - -// CREATE PARAM Structure -// ~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagCDP { - PositionParam cdpPos; // Position structure - HFII cdpHFII; // FrameItemInstance number - OINUM cdpOi; // OI of the object to create -// DWORD cdpFII; - DWORD cdpFree; - } CreateDuplicateParam; -typedef CreateDuplicateParam * LPCDP; - -// SHOOT PARAM Structure, should be identical to CREATE PARAM ! -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagSHT { - CreateDuplicateParam shtCdp; - short shtSpeed; // Speed - } ShootParam; -typedef ShootParam * LPSHT; - -#define CPF_DIRECTION 0x0001 -#define CPF_ACTION 0x0002 -#define CPF_INITIALDIR 0x0004 -#define CPF_DEFAULTDIR 0x0008 - - -// -------------------------------- Create -#define PARAM_CREATE 9 -#define PS_CRE sizeof(CreateDuplicateParam) - -// -------------------------------- Animation -// W-Number -// B-Name -#define PARAM_ANIMATION 10 -#define PS_ANI 32 - -// -------------------------------- Nothing -// W- -#define PARAM_NOP 11 -#define PS_NOP 2 - -// -------------------------------- Player -// W- -#define PARAM_PLAYER 12 -#define PS_PLA 2 - -// -------------------------------- Every -// L-delay -// L-compteur -#define PARAM_EVERY 13 -#define PS_EVE 8 - -// -------------------------------- Virtual Key -// W- VK_Code -#define PARAM_KEY 14 -#define PS_KEY 2 - -// -------------------------------- Speed= integer -// Expression -#define PARAM_SPEED 15 - -// -------------------------------- Position -// W- Direction -#define PARAM_POSITION 16 -#define PS_POS sizeof(PositionParam) - -// -------------------------------- Joystick Direcion -// W- Direction -#define PARAM_JOYDIRECTION 17 -#define PS_JOY 2 - -// -------------------------------- Shoot param - -#define PARAM_SHOOT 18 -#define PS_SHT sizeof(ShootParam) - -// -------------------------------- Playfield Zone -#define PARAM_ZONE 19 -#define PS_ZNE 8 - -// -------------------------------- System object position -// W- Direction -#define PARAM_SYSCREATE 21 -#define PS_SSC sizeof(CreateDuplicateParam) - -// -------------------------------- Expression -// W0- Id parametre originel -// W1- 0 (au moins!) -#define PARAM_EXPRESSION 22 -#define PS_EXP 14 - -// -------------------------------- Comparaison -// W0- Id comparaison -// W1- 0 (au moins!) -#define PARAM_COMPARAISON 23 - -// -------------------------------- Text color -// L0- RGB -// L0- Identificateur! -#define PARAM_COLOUR 24 -#define PS_COL 8 - -// -------------------------------- Work buffer -// L0- -#define PARAM_BUFFER4 25 -#define PS_BU4 4 - -// -------------------------------- Storyboard frame number -// W0- -#define PARAM_FRAME 26 -#define PS_FRA 2 - -// -------------------------------- Number of loops for a sample -#define PARAM_SAMLOOP 27 -#define PS_SLOOP 2 -// -------------------------------- Number of loops for a music -#define PARAM_MUSLOOP 28 -#define PS_MLOOP 2 -// -------------------------------- Direction -#define PARAM_NEWDIRECTION 29 -#define PS_NDIR 4 - -// -------------------------------- Text number -#define PARAM_TEXTNUMBER 31 -#define PS_TXN 4 - -// -------------------------------- Click definition -#define PARAM_CLICK 32 -#define PS_KLK 4 -#define PARAMCLICK_MASK 0x00FF -#define PARAMCLICK_DOUBLE 0x0100 - -// -------------------------------- External program -#define PARAM_PROGRAM 33 -typedef struct tagPRGA { - short prgFlags; // Default flags - char prgPath[_MAX_PATH]; // Name of the program - char prgCommand[108]; // Command line - } prgParamA; -typedef prgParamA * LPPRGA; -typedef struct tagPRGW { - short prgFlags; // Default flags - WCHAR prgPath[_MAX_PATH]; // Name of the program - WCHAR prgCommand[108]; // Command line - } prgParamW; -typedef prgParamW * LPPRGW; -#define PS_PRGA sizeof(prgParamA) -#define PS_PRGW sizeof(prgParamW) -#ifdef _UNICODE -#define prgParam prgParamW -#define PS_PRG sizeof(prgParamW) -#define LPPRG LPPRGW -#else -#define prgParam prgParamA -#define PS_PRG sizeof(prgParamA) -#define LPPRG LPPRGA -#endif - -#define PRGFLAGS_WAIT 0x0001 -#define PRGFLAGS_HIDE 0x0002 - -// -------------------------------- Global variable number -#define OLDPARAM_VARGLO 34 -//#define PS_VGLO 4 - -// -------------------------------- Condition sample (no flags) -// W-Number -// W-Flags -// W-Loops -// B-Name -#define PARAM_CNDSAMPLE 35 -// -------------------------------- Condition Music (no flags) -// W-Number -// W-Flags -// W-Loops -// B-Name -#define PARAM_CNDMUSIC 36 -// -------------------------------- Event editor remark -#define PARAM_REMARK 37 -typedef struct tagREMA { - LOGFONTV1A remLogFont; // Font - COLORREF remColorFont; // Text color - COLORREF remColorBack; // Background color - short remAlign; // Alignement flags - WORD remTextId; // Text number in the buffer - char remStyle[40]; // Style - } paramRemarkA; -typedef paramRemarkA* LPRMKA; -typedef struct tagREMW { - LOGFONTV1W remLogFont; // Font - COLORREF remColorFont; // Text color - COLORREF remColorBack; // Background color - short remAlign; // Alignement flags - WORD remTextId; // Text number in the buffer - WCHAR remStyle[40]; // Style - } paramRemarkW; -typedef paramRemarkW* LPRMKW; -#ifdef _UNICODE -#define PS_REM sizeof(paramRemarkW) -#define LPRMK LPRMKW -#else -#define PS_REM sizeof(paramRemarkA) -#define LPRMK LPRMKA -#endif - -// -------------------------------- Group title -#define PARAM_GROUP 38 -#define GROUP_MAXTITLE 80 -#define GROUP_MAXPASSWORD 16 -typedef struct tagGRPW { - short grpFlags; // Active / Unactive? - short grpId; // Group identifier - WCHAR grpTitle[GROUP_MAXTITLE]; // Title - WCHAR grpPassword[GROUP_MAXPASSWORD]; // Protection - DWORD grpChecksum; // Checksum - } paramGroupW; -typedef paramGroupW* LPGRPW; -typedef struct tagGRPA { - short grpFlags; // Active / Unactive? - short grpId; // Group identifier - char grpTitle[GROUP_MAXTITLE]; // Title - char grpPassword[GROUP_MAXPASSWORD]; // Protection - DWORD grpChecksum; // Checksum - } paramGroupA; -typedef paramGroupA* LPGRPA; -typedef struct tagOLDGRP { - short grpFlags; - short grpId; - char grpTitle[GROUP_MAXTITLE]; - } paramGroupV0; -#define PS_GRPA sizeof(paramGroupA) -#define PS_GRPW sizeof(paramGroupW) -#ifdef _UNICODE -#define PS_GRP sizeof(paramGroupW) -#define LPGRP LPGRPW -#define GETEVPGRP(evpPtr) (LPGRPW)&evpPtr->evpW.evpW0 -#else -#define PS_GRP sizeof(paramGroupA) -#define LPGRP LPGRPA -#define GETEVPGRP(evpPtr) (LPGRPA)&evpPtr->evpW.evpW0 -#endif - -#define GRPFLAGS_INACTIVE 0x0001 -#define GRPFLAGS_CLOSED 0x0002 -#define GRPFLAGS_PARENTINACTIVE 0x0004 -#define GRPFLAGS_GROUPINACTIVE 0x0008 -#define GRPFLAGS_UNICODE 0x0010 -//#define GRPFLAGS_FADEIN 0x0004 -//#define GRPFLAGS_FADEOUT 0x0008 -#define GRPFLAGS_GLOBAL 0x0010 -// Pour l'assemblage -typedef struct tagGRPLIST { - DWORD glEvg; - short glId; - } groupList; -typedef groupList * LPGL; - -// -------------------------------- A pointer to a group -#define PARAM_GROUPOINTER 39 -#define PS_GPT 6 -// L - Offset dans programme -// W - Identifier - -// -------------------------------- A pointner to a filename -#define PARAM_FILENAME 40 -#define PS_FILEN _MAX_PATH -// B nom de fichier... - -// -------------------------------- String pointer -#define PARAM_STRING 41 -#define PS_STR 2 -// B string - -// -------------------------------- Time -// L-Timer -// L-Loops -// W-Comparaison -#define PARAM_CMPTIME 42 -#define PS_CTIM 10 - -// --------------------------------- PASTE SPRITE -// W- Flags -// W- Security -#define PARAM_PASTE 43 -#define PS_PASTE 4 - -// -------------------------------- MOUSEKEY VIRTUAL -// W- VK_Code -#define PARAM_VMKEY 44 -#define PS_VMKEY 2 - -// -------------------------------- String expression -// W0- Id original parameter -// W1- 0 (at least!) -#define PARAM_EXPSTRING 45 - -// -------------------------------- String comparaison -// W0- Id comparaison -// W1- 0 (at least!) -#define PARAM_CMPSTRING 46 - -// -------------------------------- Ink effect -// W0- Id effect -// W1- Effet parameter -// L1- Free -#define PARAM_INKEFFECT 47 -#define PS_INK 8 - -// -------------------------------- Menu -// L0- Identifier -// L1- Security -#define PARAM_MENU 48 -#define PS_MENU 8 - -// Access to named variables -#define PARAM_VARGLOBAL 49 -#define PS_VARGLOBAL 4 -#define PARAM_ALTVALUE 50 -#define PS_ALTVALUE 4 -#define PARAM_FLAG 51 -#define PS_FLAG 4 - -// With expressions -#define PARAM_VARGLOBAL_EXP 52 -#define PS_VARGLOBAL_EXP PS_EXP -#define PARAM_ALTVALUE_EXP 53 -#define PS_ALTVALUE_EXP PS_EXP -#define PARAM_FLAG_EXP 54 -#define PS_FLAG_EXP PS_EXP - -// -------------------------------- Extensions parameters -#define PARAM_EXTENSION 55 -#define PARAM_EXTMAXSIZE 512 -typedef struct -{ - short pextSize; - short pextType; - short pextCode; - char pextData[2]; -} paramExt; -#define PARAM_EXTSIZE 12 -#define PARAM_EXTBASE 1000 - -// -------------------------------- Direction -#define PARAM_8DIRECTIONS 56 -#define PS_8DIR 4 - -// -------------------------------- Movement number -#define MAX_MVTNAME 32 -typedef struct tagMvtParamA { - short mvtNumber; - char mvtName[MAX_MVTNAME]; - } MvtParamA; -typedef MvtParamA * LPMVTPA; -typedef struct tagMvtParamW { - short mvtNumber; - WCHAR mvtName[MAX_MVTNAME]; - } MvtParamW; -typedef MvtParamW * LPMVTPW; - -#define PARAM_MVT 57 -#ifdef _UNICODE -#define PS_MVT sizeof(MvtParamW) -#define LPMVTP LPMVTPW -#else -#define PS_MVT sizeof(MvtParamA) -#define LPMVTP LPMVTPA -#endif - -// Access to renamed variables -#define PARAM_STRINGGLOBAL 58 -#define PS_STRINGGLOBAL 4 -#define PARAM_STRINGGLOBAL_EXP 59 -#define PS_STRINGGLOBAL_EXP PS_EXP - -// -------------------------------- External program II -#define PARAM_PROGRAM2 60 -typedef struct tagPRG2 { - short prgFlags; // Default flags - } prgParam2; -typedef prgParam2 * LPPRG2; -#define PS_PRG2 sizeof(prgParam2) - -// -------------------------------- Alterable strings -#define PARAM_ALTSTRING 61 -#define PS_ALTSTRING 4 -#define PARAM_ALTSTRING_EXP 62 -#define PS_ALTSTRING_EXP PS_EXP - -// -------------------------------- A pointer to a filename, version 2 -#define PARAM_FILENAME2 63 -#define PS_FILEN _MAX_PATH -// B nom de fichier... - -// -------------------------------- The name of an effect -#define PARAM_EFFECT 64 -#define PS_EFFECT 2 -// B name of the effect - - -// STRUCTURE FOR FAST LOOPS -/////////////////////////////////////////////////////////////////////// -typedef struct tagFL -{ - LPTSTR next; - TCHAR name[64]; - WORD flags; - long index; -} FastLoop; -typedef FastLoop * LPFL; - -#define MAX_FASTLOOPNAME 64 -#define FLFLAG_STOP 0x0001 - -/////////////////////////////////////////////////////////////// -// -// DEBUGGER -// -/////////////////////////////////////////////////////////////// -#define DBCOMMAND_RUNNING 0 -#define DBCOMMAND_TORUN 1 -#define DBCOMMAND_PAUSE 2 -#define DBCOMMAND_TOPAUSE 3 -#define DBCOMMAND_STEP 4 - -// TREE identification -enum -{ - DBTYPE_SYSTEM, - DBTYPE_OBJECT, - DBTYPE_HO, - DBTYPE_MOVEMENT, - DBTYPE_ANIMATION, - DBTYPE_VALUES, - DBTYPE_COUNTER, - DBTYPE_SCORE, - DBTYPE_LIVES, - DBTYPE_TEXT, - DBTYPE_EXTENSION -}; - -// Genric entries in the tree -enum -{ - DB_END=0xFFFF, - DB_PARENT=0x8000 -}; -#define DB_EDITABLE 0x80 - -// Communication buffer size -#define DB_BUFFERSIZE 256 - -#define DB_MAXGLOBALVALUES 1000 // Maximum number of global values displayed in the debugger -#define DB_MAXGLOBALSTRINGS 1000 - -// System tree entries -enum -{ - DB_SYSTEM, - DB_TIMER, - DB_FPS, - DB_FRAMENUMBER, - DB_GLOBALVALUE, - DB_GLOBALSTRING, - DB_GVALUE, - DB_GSTRING, -}; -// Headerobject tree entries -enum -{ - DB_XY, - DB_SIZE -}; - -// Movements tree entries -enum -{ - DB_MOVEMENTS, - DB_MVTTYPE, - DB_SPEED, - DB_DIRECTION, - DB_ACCELERATION, - DB_DECELERATION -}; - -// Animations tree entries -enum -{ - DB_ANIMATIONS, - DB_ANIMNAME, - DB_FRAME -}; - -// Values tree entries -enum -{ - DB_VALUE, - DB_VALUE0, - DB_VALUE1, - DB_VALUE2, - DB_VALUE3, - DB_VALUE4, - DB_VALUE5, - DB_VALUE6, - DB_VALUE7, - DB_VALUE8, - DB_VALUE9, - DB_VALUE10, - DB_VALUE11, - DB_VALUE12, - DB_VALUE13, - DB_VALUE14, - DB_VALUE15, - DB_VALUE16, - DB_VALUE17, - DB_VALUE18, - DB_VALUE19, - DB_VALUE20, - DB_VALUE21, - DB_VALUE22, - DB_VALUE23, - DB_VALUE24, - DB_VALUE25, - DB_ALTSTRING, - DB_ALTSTRING0, - DB_ALTSTRING1, - DB_ALTSTRING2, - DB_ALTSTRING3, - DB_ALTSTRING4, - DB_ALTSTRING5, - DB_ALTSTRING6, - DB_ALTSTRING7, - DB_ALTSTRING8, - DB_ALTSTRING9, - DB_FLAGS, - DB_FLAG0, - DB_FLAG1, - DB_FLAG2, - DB_FLAG3, - DB_FLAG4, - DB_FLAG5, - DB_FLAG6, - DB_FLAG7, - DB_FLAG8, - DB_FLAG9, - DB_FLAG10, - DB_FLAG11, - DB_FLAG12, - DB_FLAG13, - DB_FLAG14, - DB_FLAG15, - DB_FLAG16, - DB_FLAG17, - DB_FLAG18, - DB_FLAG19, - DB_FLAG20, - DB_FLAG21, - DB_FLAG22, - DB_FLAG23, - DB_FLAG24, - DB_FLAG25, - DB_FLAG26, - DB_FLAG27, - DB_FLAG28, - DB_FLAG29, - DB_FLAG30, - DB_FLAG31 -}; -enum -{ - DB_COUNTERVALUE, - DB_COUNTERMIN, - DB_COUNTERMAX -}; -enum -{ - DB_SCOREVALUE -}; -enum -{ - DB_LIVESVALUE -}; -enum -{ - DB_TEXTVALUE -}; - -#define GETDBPARAMTYPE(a) ((a&0xFF000000)>>24) -#define GETDBPARAMID(a) ((a&0x00FFFF00)>>8) -#define GETDBPARAMCOMMAND(a) (a&0x000000FF) -#define GETDBPARAM(a, b, c) ((a&0xFF)<<24)|((b&0xFFFF)<<8)|(c&0xFF) - -typedef struct -{ - LPSTR pTitle; - int value; - LPSTR pText; - int lText; -} EditDebugInfoA; - -typedef struct -{ - LPWSTR pTitle; - int value; - LPWSTR pText; - int lText; -} EditDebugInfoW; - -#ifdef _UNICODE -#define EditDebugInfo EditDebugInfoW -#else -#define EditDebugInfo EditDebugInfoA -#endif - -/////////////////////////////////////////////////////////////////////// -// -// RUNTIME BUFFER -// -/////////////////////////////////////////////////////////////////////// - -//Modes de demo -enum -{ - DEMONOTHING, - DEMORECORD, - DEMOPLAY, -}; - -typedef void (*ACTIONENDROUTINE)(); - -typedef void (*OBLROUTINE)(headerObject*); -typedef struct tagOBL { - headerObject* oblOffset; - OBLROUTINE oblRoutine; - } objectsList; -typedef objectsList * LPOBL; - -#define GAMEBUFFERS_SIZE (12*1024) -#define GAME_MAXOBJECTS 266 -#define OBJECT_MAX 128L -#define OBJECT_SIZE 256L -#define OBJECT_SHIFT 8 -#define MAX_INTERMEDIATERESULTS 256 -#define STEP_TEMPSTRINGS 64 - -typedef struct tagRH2 { - DWORD rh2OldPlayer; // Previous player entries - DWORD rh2NewPlayer; // Modified player entries - DWORD rh2InputMask; // Inhibated players entries - DWORD rh2InputPlayers; // Valid players entries (mask!) - BYTE rh2MouseKeys; // Mousekey entries - BYTE rh2ActionLoop; // Actions flag - BYTE rh2ActionOn; // Flag are we in actions? - BYTE rh2EnablePick; // Are we in pick for actions? - - int rh2EventCount; // Number of the event - qualToOi* rh2EventQualPos; // ***Position in event objects - headerObject* rh2EventPos; // ***Position in event objects - objInfoList* rh2EventPosOiList; // ***Position in oilist for TYPE exploration - objInfoList* rh2EventPrev; // ***Previous object address - - pev* rh2PushedEvents; // *** - LPBYTE rh2PushedEventsTop; // *** - LPBYTE rh2PushedEventsMax; // *** - int rh2NewPushedEvents; // - - int rh2ActionCount; // Action counter - int rh2ActionLoopCount; // Action loops counter - ACTIONENDROUTINE rh2ActionEndRoutine; // End of action routine - WORD rh2CreationCount; // Number of objects created since beginning of frame - short rh2EventType; - POINT rh2Mouse; // Mouse coordinate - POINT rh2MouseClient; // Mouse coordinates in the window - short rh2CurrentClick; // For click events II - short rh2Free2; - headerObject** rh2ShuffleBuffer; // *** - headerObject** rh2ShufflePos; // *** - int rh2ShuffleNumber; - - POINT rh2MouseSave; // Mouse saving when pause - int rh2PauseCompteur; - DWORD rh2PauseTimer; - UINT rh2PauseVbl; - FARPROC rh2LoopTraceProc; // Debugging routine - FARPROC rh2EventTraceProc; - - } runHeader2; - - -// Flags pour rh3Scrolling -#define RH3SCROLLING_SCROLL 0x0001 -#define RH3SCROLLING_REDRAWLAYERS 0x0002 -#define RH3SCROLLING_REDRAWALL 0x0004 -#define RH3SCROLLING_REDRAWTOTALCOLMASK 0x0008 - -#define GAME_XBORDER 480 -#define GAME_YBORDER 300 - -typedef struct tagRH3 { - - WORD rh3Graine; // random generator seed - WORD rh3Free; // Alignment... - - int rh3DisplayX; // To scroll - int rh3DisplayY; - - long rh3CurrentMenu; // For menu II events - - int rh3WindowSx; // Window size - int rh3WindowSy; - - short rh3CollisionCount; // Collision counter - char rh3DoStop; // Force the test of stop actions - char rh3Scrolling; // Flag: we need to scroll - - int rh3Panic; - - int rh3PanicBase; - int rh3PanicPile; - -// short rh3XBorder_; // Authorised border -// short rh3YBorder_; - int rh3XMinimum; // Object inactivation coordinates - int rh3YMinimum; - int rh3XMaximum; - int rh3YMaximum; - int rh3XMinimumKill; // Object destruction coordinates - int rh3YMinimumKill; - int rh3XMaximumKill; - int rh3YMaximumKill; - - } runHeader3; - -// Extensions -// ~~~~~~~~~~~~~~~~~~~~ -#define KPX_MAXNUMBER 96 -typedef struct tagKPXMSG { - short ( WINAPI * routine) (DWORD, HWND, UINT, WPARAM, LPARAM); - } kpxMsg; -#define KPX_MAXFUNCTIONS 32 -typedef struct tagKPXLIB { - long ( WINAPI * routine) (headerObject*, WPARAM, LPARAM); - } kpxLib; -#define IsRunTimeFunctionPresent(num) (num < KPX_MAXFUNCTIONS && ((LPRH)rdPtr->rHo.hoAdRunHeader)->rh4.rh4KpxFunctions[num].routine != NULL) -#define callRunTimeFunction(rdPtr,num,wParam,lParam) ( ((LPRH)rdPtr->rHo.hoAdRunHeader)->rh4.rh4KpxFunctions[num].routine((LPHO)rdPtr, wParam, lParam) ) -#define callRunTimeFunction2(hoPtr,num,wParam,lParam) ( ((LPRH)hoPtr->hoAdRunHeader)->rh4.rh4KpxFunctions[num].routine(hoPtr, wParam, lParam) ) - -#define RFUNCTION_REHANDLE 0 -#define RFUNCTION_GENERATEEVENT 1 -#define RFUNCTION_PUSHEVENT 2 -#define RFUNCTION_GETSTRINGSPACE_EX 3 -#define RFUNCTION_GETPARAM1 4 -#define RFUNCTION_GETPARAM2 5 -#define RFUNCTION_PUSHEVENTSTOP 6 -#define RFUNCTION_PAUSE 7 -#define RFUNCTION_CONTINUE 8 -#define RFUNCTION_REDISPLAY 9 -#define RFUNCTION_GETFILEINFOS 10 -#define RFUNCTION_SUBCLASSWINDOW 11 -#define RFUNCTION_REDRAW 12 -#define RFUNCTION_DESTROY 13 -#define RFUNCTION_GETSTRINGSPACE 14 -#define RFUNCTION_EXECPROGRAM 15 -#define RFUNCTION_GETOBJECTADDRESS 16 -#define RFUNCTION_GETPARAM 17 -#define RFUNCTION_GETEXPPARAM 18 -#define RFUNCTION_GETPARAMFLOAT 19 -#define RFUNCTION_EDITINT 20 -#define RFUNCTION_EDITTEXT 21 -#define RFUNCTION_CALLMOVEMENT 22 -#define RFUNCTION_SETPOSITION 23 -#define RFUNCTION_GETCALLTABLES 24 - -#define CNC_GetParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0xFFFFFFFF, 0) -#define CNC_GetIntParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0, 0) -#define CNC_GetStringParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0xFFFFFFFF, 0) -#define CNC_GetFloatParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 2, 0) -#define CNC_GetFloatValue(rdPtr, par) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAMFLOAT, par, 0) -#define CNC_GetFirstExpressionParameter(rdPtr, lParam, wParam) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM1, wParam, lParam) -#define CNC_GetNextExpressionParameter(rdPtr, lParam, wParam) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM2, wParam, lParam) - -#define MAX_FRAMERATE 10 - -typedef void (* CALLANIMATIONS) (headerObject*, int); -#define callAnimations(hoPtr, anim) ( (hoPtr->hoAdRunHeader)->rh4.rh4Animations(hoPtr, anim) ) - -typedef DWORD (* CALLDIRATSTART) (headerObject*, DWORD); -#define callDirAtStart(hoPtr, initDir) ( (hoPtr->hoAdRunHeader)->rh4.rh4DirAtStart(hoPtr, initDir) ) - -typedef BOOL (* CALLMOVEIT) (headerObject*); -#define callMoveIt(hoPtr) ( (hoPtr->hoAdRunHeader)->rh4.rh4MoveIt(hoPtr) ) - -#ifdef __cplusplus -typedef BOOL (* CALLAPPROACHOBJECT) (headerObject*, int destX, int destY, int maxX, int maxY, int htFoot, int planCol, int& x, int &y); -#define callApproachObject(x, y, hoPtr, destX, destY, maxX, maxY, htFoot, planCol) ( (hoPtr->hoAdRunHeader)->rh4.rh4ApproachObject(hoPtr, destX, destY, maxX, maxY, htFoot, planCol, x, y) ) -#else -typedef BOOL (* CALLAPPROACHOBJECT) (headerObject*, int destX, int destY, int maxX, int maxY, int htFoot, int planCol, int* x, int *y); -#define callApproachObject(x, y, hoPtr, destX, destY, maxX, maxY, htFoot, planCol) ( (hoPtr->hoAdRunHeader)->rh4.rh4ApproachObject(hoPtr, destX, destY, maxX, maxY, htFoot, planCol, &x, &y) ) -#endif - -typedef void (* CALLCOLLISIONS) (headerObject*); -#define callCollisions(hoPtr) ( (hoPtr->hoAdRunHeader)->rh4.rh4Collisions(hoPtr) ) - -typedef BOOL (* CALLTESTPOSITION) (headerObject*, int x, int y, int htFoot, int planCol, BOOL flag); -#define callTestPosition(hoPtr, x, y, htFoot, planCol) ( (hoPtr->hoAdRunHeader)->rh4.rh4TestPosition(hoPtr, x, y, htFoot, planCol, 0) ) - -typedef BYTE (* CALLGETJOYSTICK) (headerObject*, int); -#define callGetJoystick(hoPtr, player) ( (hoPtr->hoAdRunHeader)->rh4.rh4Joystick(hoPtr, player) ) - -typedef BOOL (* CALLCOLMASKTESTRECT) (headerObject*, int x, int y , int sx, int sy, int nLayer, int plan); -#define callColMaskTestRect(hoPtr, x, y, sx, sy, nLayer, plan) ( (hoPtr->hoAdRunHeader)->rh4.rh4ColMaskTestRect(hoPtr, x, y, sx, sy, nLayer, plan) ) - -typedef BOOL (* CALLCOLMASKTESTPOINT) (headerObject*, int x, int y, int nLayer, int plan); -#define callColMaskTestPoint(hoPtr, x, y, nLayer, plan) ( (hoPtr->hoAdRunHeader)->rh4.rh4ColMaskTestPoint(hoPtr, x, y, nLayer, plan) ) - - -typedef struct tagRH4 { - - kpj* rh4KpxJumps; // Jump table offset - short rh4KpxNumOfWindowProcs; // Number of routines to call - short rh4Free; - kpxMsg rh4KpxWindowProc[KPX_MAXNUMBER]; // Message handle routines - kpxLib rh4KpxFunctions[KPX_MAXFUNCTIONS]; // Available internal routines - CALLANIMATIONS rh4Animations; - CALLDIRATSTART rh4DirAtStart; - CALLMOVEIT rh4MoveIt; - CALLAPPROACHOBJECT rh4ApproachObject; - CALLCOLLISIONS rh4Collisions; - CALLTESTPOSITION rh4TestPosition; - CALLGETJOYSTICK rh4GetJoystick; - CALLCOLMASKTESTRECT rh4ColMaskTestRect; - CALLCOLMASKTESTPOINT rh4ColMaskTestPoint; - - DWORD rh4SaveVersion; - event* rh4ActionStart; // Sauvergarde action courante - int rh4PauseKey; - LPTSTR rh4CurrentFastLoop; - int rh4EndOfPause; - int rh4EventCountOR; // Number of the event for OR conditions - short rh4ConditionsFalse; - short rh4MouseWheelDelta; - int rh4OnMouseWheel; - LPTSTR rh4PSaveFilename; - UINT rh4MusicHandle; - DWORD rh4MusicFlags; - DWORD rh4MusicLoops; - int rh4LoadCount; - short rh4DemoMode; - short rh4SaveFrame; - CDemoRecord* rh4Demo; - int rh4SaveFrameCount; - double rh4MvtTimerCoef; - CIPhoneJoystick* rh4IPhoneJoystick; - CIPhoneAd* rh4IPhoneAd; - char rh4QuitString[32]; // FREE!!!! GREAT! - - - DWORD rh4PickFlags0; // 00-31 - DWORD rh4PickFlags1; // 31-63 - DWORD rh4PickFlags2; // 64-95 - DWORD rh4PickFlags3; // 96-127 - LPDWORD rh4TimerEventsBase; // Timer events base - - short rh4DroppedFlag; - short rh4NDroppedFiles; - LPTSTR rh4DroppedFiles; - LPFL rh4FastLoops; - LPTSTR rh4CreationErrorMessages; - CValue rh4ExpValue1; // New V2 - CValue rh4ExpValue2; - - long rh4KpxReturn; // WindowProc return - LPOBL rh4ObjectCurCreate; - short rh4ObjectAddCreate; - WORD rh4Free10; // For step through : fake key pressed - HINSTANCE rh4Instance; // Application instance - HWND rh4HStopWindow; // STOP window handle - char rh4DoUpdate; // Flag for screen update on first loop - char rh4MenuEaten; // Menu handled in an event? - short rh4Free2; - int rh4OnCloseCount; // For OnClose event - short rh4CursorCount; // Mouse counter - short rh4ScrMode; // Current screen mode - HPALETTE rh4HPalette; // Handle current palette - int rh4VBLDelta; // Number of VBL - DWORD rh4LoopTheoric; // Theorical VBL counter - DWORD rh4EventCount; - drawRoutine* rh4FirstBackDrawRoutine; // Backrgound draw routines list - drawRoutine* rh4LastBackDrawRoutine; // Last routine used - - DWORD rh4ObjectList; // Object list offset - short rh4LastQuickDisplay; // Quick - display list - BYTE rh4CheckDoneInstart; // Build92 to correct start of frame with fade in - BYTE rh4Free0; - mv * rh4Mv; // Yves's data - HCURSOR rh4OldCursor; // Old cursor for Show / HideMouse in Vitalize! mode - headerObject* rh4_2ndObject; // Collision object address - short rh4_2ndObjectNumber; // Number for collisions - short rh4FirstQuickDisplay; // Quick-display object list - int rh4WindowDeltaX; // For scrolling - int rh4WindowDeltaY; - UINT rh4TimeOut; // For time-out! - int rh4MouseXCenter; // To correct CROSOFT bugs! - int rh4MouseYCenter; // To correct CROSOFT bugs! - int rh4TabCounter; // Objects with tabulation - - DWORD rh4AtomNum; // For child window handling - DWORD rh4AtomRd; - DWORD rh4AtomProc; - short rh4SubProcCounter; // To accelerate the windows - short rh4Free3; - - int rh4PosPile; // Expression evaluation pile position - expression* rh4ExpToken; // Current position in expressions - CValue* rh4Results[MAX_INTERMEDIATERESULTS]; // Result pile - long rh4Operators[MAX_INTERMEDIATERESULTS]; // Operators pile - - LPTSTR* rh4PTempStrings; // Debut zone 256 long - int rh4MaxTempStrings; - long rh4Free4[256-2]; // Free buffer - - int rh4NCurTempString; // Pointer on the current string - DWORD rh4FrameRateArray[MAX_FRAMERATE]; // Framerate calculation buffer - int rh4FrameRatePos; // Position in buffer - DWORD rh4FrameRatePrevious; // Previous time - - } runHeader4; - -#define GAMEFLAGS_VBLINDEP 0x0002 -#define GAMEFLAGS_LIMITEDSCROLL 0x0004 -#define GAMEFLAGS_FIRSTLOOPFADEIN 0x0010 -#define GAMEFLAGS_LOADONCALL 0x0020 -#define GAMEFLAGS_REALGAME 0x0040 -#define GAMEFLAGS_PLAY 0x0080 -//#define GAMEFLAGS_FADEIN 0x0080 -//#define GAMEFLAGS_FADEOUT 0x0100 -#define GAMEFLAGS_INITIALISING 0x0200 - -typedef struct RunHeader { - npWin rhIdEditWin; - npWin rhIdMainWin; - npAppli rhIdAppli; - - HWND rhHEditWin; - HWND rhHMainWin; - HWND rhHTopLevelWnd; - - CRunApp* rhApp; // Application info - CRunFrame* rhFrame; // Frame info - - DWORD rhJoystickPatch; // To reroute the joystick - - BYTE rhFree10; // Current movement needs to be stopped - BYTE rhFree12; // Event evaluation flag - BYTE rhNPlayers; // Number of players - BYTE rhMouseUsed; // Players using the mouse - - WORD rhGameFlags; // Game flags - WORD rhFree; // Alignment - DWORD rhPlayer; // Current players entry - - short rhQuit; - short rhQuitBis; // Secondary quit (scrollings) - DWORD rhFree11; // Value to return to the editor - DWORD rhQuitParam; - -// Buffers - int rhNObjects; - int rhMaxObjects; - - DWORD rhFree0; - DWORD rhFree1; - DWORD rhFree2; - DWORD rhFree3; - - int rhNumberOi; // Number of OI in the list - objInfoList* rhOiList; // ObjectInfo list - - LPDWORD rhEvents[NUMBEROF_SYSTEMTYPES+1]; // Events pointers - LPDWORD rhEventLists; // Pointers on pointers list - LPDWORD rhFree8; // Timer pointers - LPDWORD rhEventAlways; // Pointers on events to see at each loop - LPEVG rhPrograms; // Program pointers - OINUM* rhLimitLists; // Movement limitation list - qualToOi* rhQualToOiList; // Conversion qualifier->oilist - - DWORD rhSBuffers; // Buffer size /1024 - LPBYTE rhBuffer; // Position in current buffer - LPBYTE rhFBuffer; // End of current buffer - LPBYTE rhBuffer1; // First buffer - LPBYTE rhBuffer2; // Second buffer - - int rhLevelSx; // Window size - int rhLevelSy; - int rhWindowX; // Start of window in X/Y - int rhWindowY; - - UINT rhVBLDeltaOld; // Number of VBL - UINT rhVBLObjet; // For the objects - UINT rhVBLOld; // For the counter - - int rhEventsSize; - WORD rhMT_VBLStep; // Path movement variables - WORD rhMT_VBLCount; - DWORD rhMT_MoveStep; - - int rhLoopCount; // Number of loops since start of level - UINT rhTimer; // Timer in 1/50 since start of level - UINT rhTimerOld; // For delta calculation - UINT rhTimerDelta; // For delta calculation - - LPEVG rhEventGroup; // Current group - long rhCurCode; // Current event - short rhCurOi; - short rhFree4; // Alignment - long rhCurParam[2]; - short rhCurObjectNumber; // Object number - short rh1stObjectNumber; // Number, for collisions - - long rhOiListPtr; // OI list enumeration - short rhObListNext; // Branch label - - short rhDestroyPos; - long rhFree5; - long rhFree6; - - runHeader2 rh2; // Sub-structure #1 - runHeader3 rh3; // Sub-structure #2 - runHeader4 rh4; // Sub-structure #3 - - LPDWORD rhDestroyList; // Destroy list address - - int rhDebuggerCommand; // Current debugger command - char rhFree13[DB_BUFFERSIZE]; // Buffer libre! - LPVOID rhDbOldHO; - WORD rhDbOldId; - WORD rhFree7; - - objectsList* rhObjectList; // Object list address - - } RunHeader; -typedef RunHeader * fprh; -typedef RunHeader * LPRH; -typedef RunHeader * LPRUNHEADER; - - -/////////////////////////////////////////////////////////////// -// -// RUNTIME OBJECT DEFINITION -// -/////////////////////////////////////////////////////////////// - -#define HOX_INT - -typedef short (WINAPI *HOROUTINE)(headerObject*); - -#ifdef __cplusplus -class headerObject { -public: -#else -#undef headerObject -typedef struct headerObject { -#endif - short hoNumber; // Number of the object - short hoNextSelected; // Selected object list!!! DO NOT CHANGE POSITION!!! - - int hoSize; // Structure size - LPRH hoAdRunHeader; // Run-header address -#ifdef __cplusplus - headerObject* hoAddress; -#else - LPVOID hoAddress; -#endif - HFII hoHFII; // Number of LevObj - OINUM hoOi; // Number of OI - short hoNumPrev; // Same OI previous object - short hoNumNext; // ... next - short hoType; // Type of the object - WORD hoCreationId; // Number of creation - objInfoList* hoOiList; // Pointer to OILIST information - LPDWORD hoEvents; // Pointer to specific events - UINT hoFree0; // Free - LPBYTE hoPrevNoRepeat; // One-shot event handling - LPBYTE hoBaseNoRepeat; - - int hoMark1; // #of loop marker for the events - int hoMark2; - LPTSTR hoMT_NodeName; // Name fo the current node for path movements - - int hoEventNumber; // Number of the event called (for extensions) - int hoFree2; - LPOC hoCommon; // Common structure address - - union - { - struct - { - int hoCalculX; // Low weight value - int hoX; // X coordinate - int hoCalculY; // Low weight value - int hoY; // Y coordinate - }; - struct - { - __int64 hoCalculXLong; - __int64 hoCalculYLong; - }; - }; - int hoImgXSpot; // Hot spot of the current image - int hoImgYSpot; - int hoImgWidth; // Width of the current picture - int hoImgHeight; - RECT hoRect; // Display rectangle - - DWORD hoOEFlags; // Objects flags - short hoFlags; // Flags - BYTE hoSelectedInOR; // Selection lors d'un evenement OR - BYTE hoFree; // Alignement - int hoOffsetValue; // Values structure offset - UINT hoLayer; // Layer - - HOROUTINE hoHandleRoutine; // General handle routine - HOROUTINE hoModifRoutine; // Modification routine when coordinates have been modified - HOROUTINE hoDisplayRoutine; // Display routine - - short hoLimitFlags; // Collision limitation flags - short hoNextQuickDisplay; // Quickdraw list - saveRect hoBackSave; // Background - - LPEVP hoCurrentParam; // Address of the current parameter - - int hoOffsetToWindows; // Offset to windows - DWORD hoIdentifier; // ASCII identifier of the object - -#ifdef __cplusplus -}; -#else -} headerObject; -#endif -typedef headerObject* LPHO; - -#define HOF_DESTROYED 0x0001 -#define HOF_TRUEEVENT 0x0002 -#define HOF_REALSPRITE 0x0004 -#define HOF_FADEIN 0x0008 -#define HOF_FADEOUT 0x0010 -#define HOF_OWNERDRAW 0x0020 -#define HOF_NOCOLLISION 0x2000 -#define HOF_FLOAT 0x4000 -#define HOF_STRING 0x8000 - - -// -------------------------------------- -// Object's movement structure -// -------------------------------------- -typedef struct tagRM { - - int rmAcc; // Current acceleration - int rmDec; // Current Decelaration - int rmCollisionCount; // Collision counter - int rmFree2; - int rmStopSpeed; // If stopped: speed to take again - int rmFree0; - int rmFree1; - int rmAccValue; // Acceleration calculation - int rmDecValue; // Deceleration calculation - short rmEventFlags; // To accelerate events - int rmFree3; - int rmFree4; - BOOL rmFree5; - BOOL rmFree6; - - BOOL rmFree7; - BOOL rmMoveFlag; // Messages/movements - - BOOL rmWrapping; // For CHECK POSITION - BOOL rmReverse; // Ahaid or reverse? - - BOOL rmBouncing; // Bouncing? - int rmMvtNum; // Number of the current movement - - union - { - struct - { - BYTE rmMvData[80]; // Space for data - }; - struct - { - int MT_Speed; - int MT_Sinus; - int MT_Cosinus; - DWORD MT_Longueur; - int MT_XOrigin; - int MT_YOrigin; - int MT_XDest; - int MT_YDest; - int MT_MoveNumber; - LPMOVEDEF MT_MoveAddress; - BOOL MT_Direction; - LPMOVETAPED MT_Movement; - int MT_Calculs; - int MT_XStart; - int MT_YStart; - int MT_Pause; - LPTSTR MT_GotoNode; - }; - struct - { - int MM_DXMouse; - int MM_DYMouse; - int MM_FXMouse; - int MM_FYMouse; - int MM_Stopped; - int MM_OldSpeed; - BYTE MM_MvOpt; - }; - struct - { - int MG_Bounce; - long MG_OkDirs; - int MG_BounceMu; - int MG_Speed; - int MG_LastBounce; - int MG_DirMask; - BYTE MG_MvOpt; - }; - struct - { - int MR_Bounce; - int MR_BounceMu; - int MR_Speed; - int MR_RotSpeed; - int MR_RotCpt; - int MR_RotPos; - int MR_RotMask; - int MR_OkReverse; - int MR_OldJoy; - int MR_LastBounce; - BYTE MR_MvOpt; - }; - struct - { - long MB_StartDir; - int MB_Angles; - int MB_Securite; - int MB_SecuCpt; - int MB_Bounce; - int MB_Speed; - int MB_MaskBounce; - int MB_LastBounce; - int MB_Blocked; - }; - struct - { - int MBul_Wait; - LPHO MBul_ShootObject; - }; - struct - { - int MP_Type; - int MP_Bounce; - int MP_BounceMu; - int MP_XSpeed; - int MP_Gravity; - int MP_Jump; - int MP_YSpeed; - int MP_XMB; - int MP_YMB; - int MP_HTFOOT; - int MP_JumpControl; - int MP_JumpStopped; - int MP_PreviousDir; - LPHO MP_ObjectUnder; - int MP_XObjectUnder; - int MP_YObjectUnder; - BOOL MP_NoJump; - }; - }; - } rMvt; -typedef rMvt* LPRMV; -enum -{ - MPTYPE_WALK, - MPTYPE_CLIMB, - MPTYPE_JUMP, - MPTYPE_FALL, - MPTYPE_CROUCH, - MPTYPE_UNCROUCH -}; - -// ---------------------------------------- -// Object's animation structure -// ---------------------------------------- -typedef struct tagRA { - int raAnimForced; // Flags if forced - int raAnimDirForced; - int raAnimSpeedForced; - BOOL raAnimStopped; - int raAnimOn; // Current animation - LPAN raAnimOffset; - int raAnimDir; // Direction of current animation - int raAnimPreviousDir; // Previous OK direction - LPAD raAnimDirOffset; - int raAnimSpeed; - int raAnimMinSpeed; // Minimum speed of movement - int raAnimMaxSpeed; // Maximum speed of movement - int raAnimDeltaSpeed; - int raAnimCounter; // Animation speed counter - int raAnimDelta; // Speed counter - int raAnimRepeat; // Number of repeats - int raAnimRepeatLoop; // Looping picture - int raAnimFrame; // Current frame - int raAnimNumberOfFrame; // Number of frames - - int raAnimFrameForced; - - } rAni; -typedef rAni* LPRA; - -// ---------------------------------------- -// Sprite display structure -// ---------------------------------------- -typedef struct tagRSPR { - - int rsFlash; // Flash objets - int rsFlashCpt; - int rsLayer; // Layer - int rsZOrder; // Z-order value - int rsCreaFlags; // Creation flags - COLORREF rsBackColor; // background saving color - DWORD rsEffect; // Sprite effects - LPARAM rsEffectParam; - WORD rsFlags; // Handling flags - WORD rsFadeCreaFlags; // Saved during a fadein - } rSpr; -typedef rSpr * LPRSP; - -#define RSFLAG_HIDDEN 0x0001 -#define RSFLAG_INACTIVE 0x0002 -#define RSFLAG_SLEEPING 0x0004 -#define RSFLAG_SCALE_RESAMPLE 0x0008 -#define RSFLAG_ROTATE_ANTIA 0x0010 -#define RSFLAG_VISIBLE 0x0020 -#define RSFLAG_CREATEDEFFECT 0x0040 - - -// ---------------------------------------- -// Objects's internal variables (build # >= 243) -// ---------------------------------------- -typedef struct tagRV { - CValue* rvpValues; - long rvFree1[VALUES_NUMBEROF_ALTERABLE-1]; - long rvValueFlags; - BYTE rvFree2[VALUES_NUMBEROF_ALTERABLE]; - LPTSTR rvStrings[STRINGS_NUMBEROF_ALTERABLE]; - } rVal; -typedef rVal * LPRVAL; - -/* - Obsolete (build 242 or below) - Note: don't remove this (for the SDK) - -typedef struct tagRV { - long rvValues[VALUES_NUMBEROF_ALTERABLE]; - long rvValueFlags; - BYTE rvValuesType[VALUES_NUMBEROF_ALTERABLE]; - LPSTR rvStrings[STRINGS_NUMBEROF_ALTERABLE]; - } rVal; -typedef rVal * LPRVAL; -*/ - - -// ----------------------------------------------- -// Objects animation and movement structure -// ----------------------------------------------- -#if !defined(ANGLETYPE) -#if defined(HWABETA) -#define ANGLETYPE float -#else -#define ANGLETYPE int -#endif -#endif -typedef void (* RCROUTINE)(LPHO); -typedef struct tagRCOM { - - int rcOffsetAnimation; // Offset to anims structures - int rcOffsetSprite; // Offset to sprites structures - RCROUTINE rcRoutineMove; // Offset to movement routine - RCROUTINE rcRoutineAnimation; // Offset to animation routine - - int rcPlayer; // Player who controls - - int rcNMovement; // Number of the current movement - CRunMvt* rcRunMvt; // Pointer to extension movement - fpSpr rcSprite; // Sprite ID if defined - int rcAnim; // Wanted animation - int rcImage; // Current frame - float rcScaleX; - float rcScaleY; - ANGLETYPE rcAngle; - int rcDir; // Current direction - int rcSpeed; // Current speed - int rcMinSpeed; // Minimum speed - int rcMaxSpeed; // Maximum speed - BOOL rcChanged; // Flag: modified object - BOOL rcCheckCollides; // For static objects - - int rcOldX; // Previous coordinates - int rcOldY; - int rcOldImage; - ANGLETYPE rcOldAngle; - int rcOldDir; - int rcOldX1; // For zone detections - int rcOldY1; - int rcOldX2; - int rcOldY2; - - long rcFadeIn; - long rcFadeOut; - - } rCom; - - -// ------------------------------------------------------------ -// ACTIVE OBJECTS DATAZONE -// ------------------------------------------------------------ -typedef struct tagRO { - - headerObject roHo; // Common structure - - rCom roc; // Anim/movement structure - rMvt rom; // Movement structure - rAni roa; // Animation structure - rSpr ros; // Sprite handling structure - rVal rov; // Values structure - - } RunObject; -typedef RunObject * LPRO; -typedef RunObject * LPRUNOBJECT; - -#define EF_GOESINPLAYFIELD 0x0001 -#define EF_GOESOUTPLAYFIELD 0x0002 -#define EF_WRAP 0x0004 - - - -// ------------------------------------------------------ -// EXTENSION EDITION HEADER STRUCTURE -// ------------------------------------------------------ -typedef struct tagEditExtension_v1 -{ - short extSize; - short extMaxSize; - short extOldFlags; // For conversion purpose - short extVersion; // Version number -} extHeader_v1; -typedef extHeader_v1* LPEXTV1; - -typedef struct extHeader -{ - DWORD extSize; - DWORD extMaxSize; - DWORD extVersion; // Version number - LPVOID extID; // object's identifier - LPVOID extPrivateData; // private data -} extHeader; -typedef extHeader * LPEXT; - -// ------------------------------------------------------ -// System objects (text, question, score, lives, counter) -// ------------------------------------------------------ -typedef struct tagRs { - - headerObject rsHo; // For all the objects - rCom rsc; // Anims / movements / sprites structures - rMvt rom; // Mouvement structure - rSpr rss; // Sprite handling - - short rsPlayer; // Number of the player if score or lives - short rsFlags; // Type + flags - - union { - LPBYTE rsSubAppli; // Application (CCA object) - }; - union - { - long rsMini; - long rsOldLevel; - }; - union - { - long rsMaxi; // - long rsLevel; - }; - CValue rsValue; - LONG rsBoxCx; // Dimensions box (for lives, counters, texts) - LONG rsBoxCy; - double rsMiniDouble; - double rsMaxiDouble; - short rsOldFrame; // Counter only - BYTE rsHidden; - BYTE rsFree; - LPTSTR rsTextBuffer; // Text buffer - int rsLBuffer; // Length of the buffer in BYTES - DWORD rsFont; // Temporary font for texts - union { - COLORREF rsTextColor; // Text color - COLORREF rsColor1; // Bar color - }; - COLORREF rsColor2; // Gradient bar color -} rs; -typedef rs * LPRS; - - -// OILIST Structure : Data concerning the objects in the game -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define MAX_QUALIFIERS 8 // Maximum number of qualifiers per object -typedef LPHO (*OILROUTINE)(objInfoList*, BOOL*); - -#ifdef __cplusplus -class objInfoList { -public: -#else -#undef objInfoList -typedef struct objInfoList { -#endif - OINUM oilOi; // THE oi - short oilListSelected; // First selection !!! DO NOT CHANGE POSITION !!! - short oilType; // Type of the object - short oilObject; // First objects in the game - DWORD oilEvents; // Events - char oilWrap; // WRAP flags - char oilNextFlag; - WORD oilFree; // Not used - int oilNObjects; // Current number - int oilActionCount; // Action loop counter - int oilActionLoopCount; // Action loop counter - OILROUTINE oilCurrentRoutine; // Current routine for the actions - int oilCurrentOi; // Current object - int oilNext; // Pointer on the next - int oilEventCount; // When the event list is done - int oilNumOfSelected; // Number of selected objects - DWORD oilOEFlags; // Object's flags - short oilLimitFlags; // Movement limitation flags - short oilLimitList; // Pointer to limitation list - short oilOIFlags; // Objects preferences - short oilOCFlags2; // Objects preferences II - long oilInkEffect; // Ink effect - long oilEffectParam; // Ink effect param - HFII oilHFII; // First available frameitem - COLORREF oilBackColor; // Background erasing color - short oilQualifiers[MAX_QUALIFIERS]; // Qualifiers for this object - TCHAR oilName[24]; // Name - int oilEventCountOR; // Selection in a list of events with OR -#ifdef HWABETA - OINUM* oilColList; // Liste de collisions sprites -#endif -#ifdef __cplusplus -}; -#else -} objInfoList; -#endif -typedef objInfoList * LPOIL; - -#define OILIMITFLAGS_BORDERS 0x000F -#define OILIMITFLAGS_BACKDROPS 0x0010 -#define OILIMITFLAGS_ONCOLLIDE 0x0080 // used by HWA -#define OILIMITFLAGS_QUICKCOL 0x0100 -#define OILIMITFLAGS_QUICKBACK 0x0200 -#define OILIMITFLAGS_QUICKBORDER 0x0400 -#define OILIMITFLAGS_QUICKSPR 0x0800 -#define OILIMITFLAGS_QUICKEXT 0x1000 -#define OILIMITFLAGS_ALL 0xFFFF - -// Object creation structure -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagCOB { - LO* cobLevObj; // Leave first! - WORD cobLevObjSeg; - WORD cobFlags; - int cobX; - int cobY; - int cobDir; - int cobLayer; - int cobZOrder; - } createObjectInfo; -typedef createObjectInfo * LPCOB; -typedef createObjectInfo * fpcob; - -// Flags for Create Objects -// ------------------------- -#define COF_NOMOVEMENT 0x0001 -#define COF_HIDDEN 0x0002 -#define COF_FIRSTTEXT 0x0004 - -// Qualifier to oilist for machine langage -// --------------------------------------- -typedef LPHO (*QOIROUTINE)(qualToOi*, BOOL* pRepeatFlag); - -#ifdef __cplusplus -class qualToOi { -public: -#else -#undef qualToOi -typedef struct qualToOi { -#endif - short qoiCurrentOi; - short qoiNext; - int qoiActionPos; - QOIROUTINE qoiCurrentRoutine; - int qoiActionCount; - int qoiActionLoopCount; - char qoiNextFlag; - char qoiSelectedFlag; - OINUM qoiOi; // Array OINUM / OFFSET - short qoiOiList; -#ifdef __cplusplus -}; -#else -} qualToOi; -#endif -typedef qualToOi * LPQOI; - - -// ------------------------------------------------------------------ -// ------------------------------------------------------------------ -// EXTENSION HANDLING -// ------------------------------------------------------------------ -// ------------------------------------------------------------------ - -#ifdef STAND_ALONE -typedef BOOL (WINAPI *EXTCONDROUTINE)(headerObject*, long, long); -typedef short (WINAPI *EXTACTROUTINE)(headerObject*, long, long); -typedef long (WINAPI *EXTEXPROUTINE)(headerObject*, long); -#else -#define EXTCONDROUTINE VOID -#define EXTACTROUTINE VOID -#define EXTEXPROUTINE VOID -#endif - -// Information structure about the extension -#ifdef __cplusplus -class kpxRunInfos { -public: -#else -typedef struct kpxRunInfos { -#endif - EXTCONDROUTINE* conditions; // 00 Offset to condition jump list - EXTACTROUTINE* actions; // 04 Offset to action jump list - EXTEXPROUTINE* expressions; // 08 Offset to expression jump list - short numOfConditions; // 0C Number of conditions - short numOfActions; // 0E Number of actions - short numOfExpressions; // 10 Number of expressions - WORD editDataSize; // 12 Size of the data zone when exploded - DWORD editFlags; // 14 Object flags - char windowProcPriority; // 16 Priority of the routine 0-255 - char free; - short editPrefs; // 18 Preferences d'edition - long identifier; // 1A Chaine d'identification - short version; // 1E Version courante - // 20 -#ifdef __cplusplus -}; -#else -} kpxRunInfos; -#endif -typedef kpxRunInfos * LPKPXRUNINFOS; -typedef kpxRunInfos * fpKpxRunInfos; - -// Extension jump table -// -------------------- -typedef short (WINAPI * CREATERUNOBJECT_PROC) (LPHO hoPtr, LPEXT extPtr, LPCOB); -typedef unsigned short (WINAPI * GETRUNDATASIZE_PROC)(LPRH, LPEXT); -typedef short (WINAPI * DESTROYRUNOBJECT_PROC)(LPHO, long fast); -typedef short (WINAPI * HANDLERUNOBJECT_PROC)(LPHO); -typedef short (WINAPI * DISPLAYRUNOBJECT_PROC)(LPHO); -typedef cSurface* (WINAPI * GETRUNOBJECTSURFACE_PROC)(LPHO); -typedef short (WINAPI * REINITRUNOBJECT_PROC)(LPHO); -typedef short (WINAPI * PAUSERUNOBJECT_PROC)(LPHO); -typedef short (WINAPI * CONTINUERUNOBJECT_PROC)(LPHO); -typedef short (WINAPI * PREPARETOSAVE_PROC)(LPHO); -typedef short (WINAPI * SAVEBACKGROUND_PROC)(LPHO); -typedef short (WINAPI * RESTOREBACKGROUND_PROC)(LPHO); -typedef short (WINAPI * CHANGERUNDATA_PROC)(LPHO, LPHO); -typedef short (WINAPI * KILLBACKGROUND_PROC) (LPHO); -typedef short (WINAPI * GETZONEINFO_PROC)(LPHO); -typedef LPWORD (WINAPI * GETDEBUGTREE_PROC)(LPHO); -typedef void (WINAPI * GETDEBUGITEM_PROC)(LPTSTR, LPHO, int); -typedef void (WINAPI* EDITDEBUGITEM_PROC)(LPHO, int); -typedef void (WINAPI* GETRUNOBJECTFONT_PROC)(LPHO, LOGFONT*); -typedef void (WINAPI* SETRUNOBJECTFONT_PROC)(LPHO, LOGFONT*, RECT*); -typedef COLORREF (WINAPI* GETRUNOBJECTTEXTCOLOR_PROC)(LPHO); -typedef void (WINAPI* SETRUNOBJECTTEXTCOLOR_PROC)(LPHO, COLORREF); -typedef short (WINAPI * GETRUNOBJECTWINDOW_PROC)(LPHO); -typedef sMask* (WINAPI * GETRUNOBJECTCOLLISIONMASK_PROC)(LPHO, LPARAM); -typedef BOOL (WINAPI * SAVERUNOBJECT_PROC)(LPHO, HANDLE); -typedef BOOL (WINAPI * LOADRUNOBJECT_PROC)(LPHO, HANDLE); -typedef void (WINAPI * GETRUNOBJECTMEMORYUSAGE_PROC)(LPHO, int*, int*, int*); - -#ifdef __cplusplus -class kpj { -public: -#else -#undef kpj -typedef struct kpj { -#endif - CREATERUNOBJECT_PROC CreateRunObject; - DESTROYRUNOBJECT_PROC DestroyRunObject; - HANDLERUNOBJECT_PROC HandleRunObject; - DISPLAYRUNOBJECT_PROC DisplayRunObject; - GETRUNOBJECTSURFACE_PROC GetRunObjectSurface; - REINITRUNOBJECT_PROC ReInitRunObject; - PAUSERUNOBJECT_PROC PauseRunObject; - CONTINUERUNOBJECT_PROC ContinueRunObject; - PREPARETOSAVE_PROC PrepareToSave; - PREPARETOSAVE_PROC PrepareToSave2; - GETRUNDATASIZE_PROC GetRunObjectDataSize; - SAVEBACKGROUND_PROC SaveBackground; - RESTOREBACKGROUND_PROC RestoreBackground; - CHANGERUNDATA_PROC ChangeRunData; - KILLBACKGROUND_PROC KillBackground; - GETZONEINFO_PROC GetZoneInfo; - GETDEBUGTREE_PROC GetDebugTree; - GETDEBUGITEM_PROC GetDebugItem; - EDITDEBUGITEM_PROC EditDebugItem; - GETRUNOBJECTFONT_PROC GetRunObjectFont; - SETRUNOBJECTFONT_PROC SetRunObjectFont; - GETRUNOBJECTTEXTCOLOR_PROC GetRunObjectTextColor; - SETRUNOBJECTTEXTCOLOR_PROC SetRunObjectTextColor; - GETRUNOBJECTWINDOW_PROC GetRunObjectWindow; - GETRUNOBJECTCOLLISIONMASK_PROC GetRunObjectCollisionMask; - SAVERUNOBJECT_PROC SaveRunObject; - LOADRUNOBJECT_PROC LoadRunObject; - GETRUNOBJECTMEMORYUSAGE_PROC GetRunObjectMemoryUsage; - - kpxRunInfos infos; - -#ifdef __cplusplus -}; -#else -} kpj; -#endif -typedef kpj * LPKPJ; - -#define KPJ_SHIFT 7 -#define KPJ_SIZE 0x80 -#define KPJ_MAXNUMBER 128 -#define KPJ_STEP 8 -#define kpjJCreate 0x00 -#define kpjJDestroy 0x04 -#define kpjJRoutine 0x08 -#define kpjJDisplay 0x0C -#define kpjJReInit 0x10 -#define kpjJPause 0x14 -#define kpjJEndPause 0x18 -#define kpjJPrepareToSave 0x1C -#define kpjJRestart 0x20 -#define kpjJGetRunDataSize 0x24 -#define kpjJSaveBackground 0x28 -#define kpjJRestoreBackground 0x2C -#define kpjJKillBackground 0x30 - -// Possible states of the application, see LApplication::SetRunningState() -#define GAMEON_EMPTY 0 -#define GAMEON_UNLOADED 1 -#define GAMEON_TIME0 2 -#define GAMEON_PAUSED 3 -#define GAMEON_RUNNING 4 -#define GAMEON_STEPPING 5 - - -////////////////////////////////////////////////////////////////////////////// -// Condition/action jumps -typedef BOOL (*CALLCOND1_ROUTINE)(event* pe, LPHO pHo); -typedef BOOL (*CALLCOND2_ROUTINE)(event* pe); -typedef void (*CALLACTION_ROUTINE)(event* pe); -typedef void (*CALLEXP_ROUTINE)(); -typedef BOOL (*CONDROUTINE)(event* pe, LPHO pHo); -typedef void (*ACTROUTINE)(event* pe); -typedef void (*EXPROUTINE)(); -typedef void (*CALLOPERATOR_ROUTINE)(); - -typedef struct tagCallTables -{ - CALLCOND1_ROUTINE* pConditions1; - CALLCOND2_ROUTINE* pConditions2; - CALLACTION_ROUTINE* pActions; - CALLEXP_ROUTINE* pExpressions; -}CallTables; - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////// -// -// Run-time Definitions -// - -#define COMPARE_EQ 0 -#define COMPARE_NE 1 -#define COMPARE_LE 2 -#define COMPARE_LT 3 -#define COMPARE_GE 4 -#define COMPARE_GT 5 - -#ifdef RUN_TIME - - #define OINUM_ERROR -1 - #define B2L(a,b,c,d) ((DWORD)(((DWORD)((unsigned char)(d))<<24)|((DWORD)((unsigned char)(c))<<16)|((DWORD)((unsigned char)(b))<<8)|(DWORD)((unsigned char)(a)))) - - // Pour la routine GetFileInfos - #define FILEINFO_DRIVE 1 - #define FILEINFO_DIR 2 - #define FILEINFO_PATH 3 - #define FILEINFO_APPNAME 4 - #define FILEINFO_TEMPPATH 5 - - // MACRO: next event - #define EVTNEXT(p) ((LPEVT)((LPBYTE)p+p->evtSize)) - // MACRO: returns first param - #define EVTPARAMS(p) ((LPEVP)(p->evtCode<0 ? (LPBYTE)p+CND_SIZE : (LPBYTE)p+ACT_SIZE )) - // MACRO: returns the extension condition code - #define EXTCONDITIONNUM(i) (-((short)(i>>16))-1) - #define EXTACTIONNUM(i) ((short)(i>>16)) - - #define KPXNAME_SIZE 60 - #define BADNAME_SIZE (OINAME_SIZE+KPXNAME_SIZE+8) - - // Extensions - // ---------- - typedef struct TABKPT { - kpj kpx[2]; - } kpxData; - typedef kpxData * fpkpdt; - - // Main loop exit codes - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ - #define LOOPEXIT_NEXTLEVEL 1 - #define LOOPEXIT_PREVLEVEL 2 - #define LOOPEXIT_GOTOLEVEL 3 - #define LOOPEXIT_NEWGAME 4 - #define LOOPEXIT_PAUSEGAME 5 - #define LOOPEXIT_SAVEAPPLICATION 6 - #define LOOPEXIT_LOADAPPLICATION 7 - #define LOOPEXIT_SAVEFRAME 8 - #define LOOPEXIT_LOADFRAME 9 - #define LOOPEXIT_ENDGAME -2 - - #define LOOPEXIT_QUIT 100 - #define LOOPEXIT_RESTART 101 - #define LOOPEXIT_TIMER 102 - #define LOOPEXIT_STEP 103 - #define LOOPEXIT_MONITOR 104 - #define LOOPEXIT_EVENTEDITOR 105 - #define LOOPEXIT_ESC 106 - #define LOOPEXIT_MENU 107 - #define LOOPEXIT_JUMPTO 108 - #define LOOPEXIT_RESET 109 - #define LOOPEXIT_PAUSE 110 - #define LOOPEXIT_PLAY 111 - - // Backdrop draw routines - // ---------------------------------------- - typedef void (* DRAWROUTINE_PROC)(drawRoutine*); - - #ifdef __cplusplus - class drawRoutine { - public: - #else - #undef drawRoutine - typedef struct drawRoutine { - #endif - #ifdef __cplusplus - drawRoutine* next; - #else - LPVOID next; - #endif - DRAWROUTINE_PROC routine; - long param1; - long param2; - long param3; - long param4; - long param5; - long param6; - #ifdef __cplusplus - }; - #else - } drawRoutine; - #endif - - // To push an event - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - #define MAX_PUSHEDEVENTS 32 - typedef void (*PEV_ROUTINE)(LPHO, long); - - #ifdef __cplusplus - class pev { - public: - #else - #undef pev - typedef struct pev { - #endif - long pevCode; - PEV_ROUTINE pevRoutine; - long pevParam; - LPHO pevObject; - short pevOi; - #ifdef __cplusplus - }; - #else - } pev; - #endif - #define PIXEL_SPEED 5 - - // QUALIFIERS - typedef struct - { - OINUM qOi; - ITEMTYPE qType; - WORD qList; - } qualifierLoad; - typedef qualifierLoad * LPQLOAD; - -#endif // RUN_TIME - -#ifndef __cplusplus -#undef headerObject -#undef kpj -#undef objInfoList -#undef drawRoutine -#undef LO -#undef pev -#undef qualToOi -//#undef CValue -#undef CRunApp -#undef CRunFrame -#endif; - -// Restores structure alignment... -#ifndef _H2INC -#pragma pack( pop, _pack_cncf_ ) -#endif - -#endif //CNCF_H - - - + +#ifndef _CNCF_H_ +#define _CNCF_H_ + +#include "cncy.h" +#ifdef STAND_ALONE +#include "CValue.h" +#else + +// Definitions for extensions +#define TYPE_LONG 0x0000 +#define TYPE_INT TYPE_LONG +#define TYPE_STRING 0x0001 +#define TYPE_FLOAT 0x0002 // Pour les extensions +#define TYPE_DOUBLE 0x0002 + +#ifdef __cplusplus +class CValue { +public: +#else +typedef struct CValue { +#endif + UINT m_type; + UINT m_paddle; + union + { + long m_long; + double m_double; + LPTSTR m_pString; + }; +#ifdef __cplusplus +}; +#else +} CValue; +#endif +#endif // STAND_ALONE + +// Changes the structure alignment +#ifndef _H2INC +#pragma pack( push, _pack_cncf_ ) +#pragma pack(2) +#endif +typedef short * LPSHORT; + +#ifdef __cplusplus +class headerObject; +class kpj; +class objInfoList; +class drawRoutine; +class LO; +class pev; +class qualToOi; +class CRunApp; +class CRunFrame; +class CRunMvt; +class CMvt; +class CDemoRecord; +class CIPhoneJoystick; +class CIPhoneAd; + +//class CValue; +#else +#define headerObject VOID +#define kpj VOID +#define objInfoList VOID +#define drawRoutine VOID +#define LO VOID +#define pev VOID +#define qualToOi VOID +//#define CValue VOID +#define CRunApp void +#define CRunFrame void +#define CRunMvt void +#define CMvt void +#define CDemoRecord void +#define CIPhoneJoystick void +#define CIPhoneAd void +#endif + +// Number of values +#define VALUES_NUMBEROF_ALTERABLE 26 +#define VALUES_NUMBEROF_MAX 26 +#define STRINGS_NUMBEROF_ALTERABLE 10 +#define STRINGS_NUMBEROF_MAX 10 + +typedef short ITEMTYPE; +typedef short OINUM; +typedef short HFII; + +// LOGFONT 16 structure for compatibility with old extensions +///////////////////////////////////////////////////////////// +typedef struct tagLOGFONTV1A { + short lfHeight; + short lfWidth; + short lfEscapement; + short lfOrientation; + short lfWeight; + BYTE lfItalic; + BYTE lfUnderline; + BYTE lfStrikeOut; + BYTE lfCharSet; + BYTE lfOutPrecision; + BYTE lfClipPrecision; + BYTE lfQuality; + BYTE lfPitchAndFamily; + char lfFaceName[LF_FACESIZE]; +} LOGFONTV1A; +typedef struct tagLOGFONTV1W { + short lfHeight; + short lfWidth; + short lfEscapement; + short lfOrientation; + short lfWeight; + BYTE lfItalic; + BYTE lfUnderline; + BYTE lfStrikeOut; + BYTE lfCharSet; + BYTE lfOutPrecision; + BYTE lfClipPrecision; + BYTE lfQuality; + BYTE lfPitchAndFamily; + WCHAR lfFaceName[LF_FACESIZE]; +} LOGFONTV1W; +#ifdef _UNICODE +#define LOGFONTV1 LOGFONTV1W +#else +#define LOGFONTV1 LOGFONTV1A +#endif + +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +// +// ObjectsCommon - Dynamic items +// +#define OC_MAX_QUALIFIERS 8 + +#ifdef __cplusplus +class OC { +public: +#else +typedef struct OC { +#endif + + DWORD ocDWSize; // Total size of the structures + + WORD ocMovements; // Offset of the movements + WORD ocAnimations; // Offset of the animations + WORD ocVersion; // For version versions > MOULI + WORD ocCounter; // Pointer to COUNTER structure + WORD ocData; // Pointer to DATA structure + WORD ocFree; + DWORD ocOEFlags; // New flags + + WORD ocQualifiers[OC_MAX_QUALIFIERS]; // Qualifier list + WORD ocExtension; // Extension structure + WORD ocValues; // Values structure + WORD ocStrings; // String structure + + WORD ocFlags2; // New news flags, before was ocEvents + WORD ocOEPrefs; // Automatically modifiable flags + DWORD ocIdentifier; // Identifier d'objet + + COLORREF ocBackColor; // Background color + DWORD ocFadeIn; // Offset fade in + DWORD ocFadeOut; // Offset fade out + DWORD ocValueNames; // For the debugger + DWORD ocStringNames; + +#ifdef __cplusplus +}; +#else +} OC; +#endif +typedef OC * LPOC; +typedef OC * fpoc; + +typedef struct +{ + WORD number; + long values[1]; +} OCValues; +typedef OCValues* LPOCVALUES; + +#ifdef _UNICODE +typedef struct +{ + WORD number; + TCHAR str[1]; +} OCStringsW; +typedef OCStringsW* LPOCSTRINGS; +#else +typedef struct +{ + WORD number; + char str[2]; +} OCStringsA; +typedef OCStringsA* LPOCSTRINGS; +#endif + + + +typedef struct +{ + WORD number; + char str[2]; + +} OCValueNames; +typedef OCValueNames* LPOCVALUENAMES; + +#define OCFLAGS2_DONTSAVEBKD 0x0001 +#define OCFLAGS2_SOLIDBKD 0x0002 +#define OCFLAGS2_COLBOX 0x0004 +#define OCFLAGS2_VISIBLEATSTART 0x0008 +#define OCFLAGS2_OBSTACLESHIFT 4 +#define OCFLAGS2_OBSTACLEMASK 0x0030 +#define OCFLAGS2_OBSTACLE_SOLID 0x0010 +#define OCFLAGS2_OBSTACLE_PLATFORM 0x0020 +#define OCFLAGS2_OBSTACLE_LADDER 0x0030 +#define OCFLAGS2_AUTOMATICROTATION 0x0040 + +////////////////////////////////////////////////////////////////////////////// +// +// Counter +// +typedef struct tagCT { + WORD ctSize; + long ctInit; // Initial value + long ctMini; // Minimal value + long ctMaxi; // Maximal value +} counter; +typedef counter * fpct; +typedef counter * fpCounter; + +////////////////////////////////////////////////////////////////////////////// +// +// Animations +// +#define ANIMID_MIN 16 + +// Anim header +#ifdef __cplusplus +class AnimHeader { +public: +#else +typedef struct AnimHeader { +#endif + WORD ahSize; + WORD ahAnimMax; // New V2, number of entries in offset table + short ahOffsetToAnim[ANIMID_MIN]; // Minimum 16 animations, can be larger! +#ifdef __cplusplus +}; +#else +} AnimHeader; +#endif +typedef AnimHeader * fpAnimHeader; +typedef AnimHeader * fpah; +typedef AnimHeader * LPAH; + +#ifndef DIRID_MAX +#define DIRID_MAX 32 +#endif + +// Anim structure +typedef struct Anim { + short anOffsetToDir[DIRID_MAX]; // Offset to animations with a direction +} Anim; +typedef Anim * fpAnim; +typedef Anim * fpan; +typedef Anim * LPAN; + +// AnimDirection structure +typedef struct AnimDirection { + BYTE adMinSpeed; // Minimum speed + BYTE adMaxSpeed; // Maximum speed + short adRepeat; // Number of loops + short adRepeatFrame; // Where to loop + short adNumberOfFrame; // Number of frames + short adFrame[1]; // Frames +} AnimDirection; +#define sizeof_AnimDirection (sizeof(AnimDirection)-2) +typedef AnimDirection * fpAnimDir; +typedef AnimDirection * fpad; +typedef AnimDirection * LPAD; + +// Chunks de sauvegarde +#define EVTFILECHUNK_HEAD B2L('E','R','>','>') +#define EVTFILECHUNK_EVTHEAD B2L('E','R','e','s') +#define EVTFILECHUNK_EVENTS B2L('E','R','e','v') +#define EVTFILECHUNK_NEWITEMS B2L('>','N','I','<') +#define EVTFILECHUNK_END B2L('<','<','E','R') + +// Marquage des OI qualifiers +#define OIFLAG_QUALIFIER 0x8000 +#define NDEF_QUALIFIERS 100 +#define MAX_EVENTPROGRAMS 256 + +#define GAMEON_EMPTY 0 +#define GAMEON_UNLOADED 1 +#define GAMEON_TIME0 2 +#define GAMEON_PAUSED 3 +#define GAMEON_RUNNING 4 +#define GAMEON_STEPPING 5 + +// COMMUNICATION STRUCTURE BETWEEN RUNTIME AND EDITOR +typedef struct +{ + DWORD command; + + WORD runMode; + DWORD timer; + + WORD code; + OINUM oi; + DWORD param[2]; + char path[_MAX_PATH]; + +} ComStructure; +enum +{ + RUNCOMMAND_INITCOM=1, + RUNCOMMAND_NEWEVENT, + RUNCOMMAND_NEWSOUND, + RUNCOMMAND_NEWOBJECT, + RUNCOMMAND_NEWEVENTS, + RUNCOMMAND_SETRUNMODE, + RUNCOMMAND_CONTINUE, + RUNCOMMAND_RESTART, + RUNCOMMAND_QUIT, + HANDLEMESSAGE_WAITFORCONFIRM, + HANDLEMESSAGE_WAITFORCOMMAND, + HANDLEMESSAGE_OK, + HANDLEMESSAGE_QUIT, + HANDLEMESSAGE_TIMEOUT +}; +// DIFFERENTS MODES OF RUN +enum +{ + RUNMODE_NONE, + RUNMODE_STOPPED, + RUNMODE_RUNNING, + RUNMODE_PLAYING, + RUNMODE_STEPPING, + RUNMODE_PAUSED, + RUNMODE_WAITING, + RUNMODE_WAITINGQUIT, +}; + + +// ------------------------------------------------------------------------- +// MOVEMENT DEFINITIONS +// ------------------------------------------------------------------------- + +// Definition of animation codes +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define ANIMID_STOP 0 +#define ANIMID_WALK 1 +#define ANIMID_RUN 2 +#define ANIMID_APPEAR 3 +#define ANIMID_DISAPPEAR 4 +#define ANIMID_BOUNCE 5 +#define ANIMID_SHOOT 6 +#define ANIMID_JUMP 7 +#define ANIMID_FALL 8 +#define ANIMID_CLIMB 9 +#define ANIMID_CROUCH 10 +#define ANIMID_UNCROUCH 11 +#define ANIMID_USER1 12 +//#define ANIMID_MAX 16 +#define ANIMNAME_MAXCHAR 64 + +// Definition of direction codes +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define DIRF_ALL 0xFFFFFFFF +#define DIRID_STATIC 32 +#define DIRID_MAX 32 +#define DIRID_SEE 30 +#define DIRID_SE 28 +#define DIRID_SSE 26 +#define DIRID_S 24 +#define DIRID_SSW 22 +#define DIRID_SW 20 +#define DIRID_SWW 18 +#define DIRID_W 16 +#define DIRID_NWW 14 +#define DIRID_NW 12 +#define DIRID_NNW 10 +#define DIRID_N 8 +#define DIRID_NNE 6 +#define DIRID_NE 4 +#define DIRID_NEE 2 +#define DIRID_E 0 + +// Definition of control types +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define MVCONT_COMPUTER 0 +#define MVCONT_PLAYER1 1 +#define MVCONT_PLAYER2 2 +#define MVCONT_PLAYER3 3 +#define MVCONT_PLAYER4 4 +#define NB_MVCONT 5 +#define MAX_PLAYERS 4 + +// Definition of joystick controls +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define JOYSTICK_UP 0b00000001 +#define JOYSTICK_DOWN 0b00000010 +#define JOYSTICK_LEFT 0b00000100 +#define JOYSTICK_RIGHT 0b00001000 +#define JOYSTICK_FIRE1 0b00010000 +#define JOYSTICK_FIRE2 0b00100000 +#define JOYSTICK_FIRE3 0b01000000 +#define JOYSTICK_FIRE4 0b10000000 + +// Definition of movement types +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define MVTYPE_STATIC 0 +#define MVTYPE_MOUSE 1 +#define MVTYPE_RACE 2 +#define MVTYPE_GENERIC 3 +#define MVTYPE_BALL 4 +#define MVTYPE_TAPED 5 +#define MVTYPE_INTELLIGENT 6 +#define MVTYPE_PINBALL 7 +#define MVTYPE_LIST 8 +#define MVTYPE_PLATFORM 9 +#define MVTYPE_GOMOVEMENT 10 +#define MVTYPE_DISAPPEAR 11 +#define MVTYPE_APPEAR 12 +#define MVTYPE_BULLET 13 +#define MVTYPE_EXT 14 +#define MVTYPE_MAX 15 + +#define MVTACTION_SAVEPOSITION 0x1010 +#define MVTACTION_LOADPOSITION 0x1011 + +//////////////////////////////////////////////////////////////////////////////// +// EVENTS +//////////////////////////////////////////////////////////////////////////////// + +// Eventgroup structure, before conditions and actions +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagEVG { + short evgSize; // 0 Size of the group (<=0) + BYTE evgNCond; // 2 Number of conditions + BYTE evgNAct; // 3 Number of actions + WORD evgFlags; // 4 Flags + short evgInhibit; // 6 If the group is inhibited + WORD evgInhibitCpt; // 8 Counter + WORD evgIdentifier; // 10 Unique identifier + short evgUndo; // 12 Identifier for UNDO + } eventGroup; +typedef eventGroup * PEVG; +typedef eventGroup * LPEVG; +#define EVG_SIZE 14 + +// MACRO: next group +#define EVGNEXT(evgPtr) ((LPEVG)((LPSTR)evgPtr-evgPtr->evgSize)) +// MACRO: first event +#define EVGFIRSTEVT(p) ((LPEVT)((LPSTR)p+sizeof(eventGroup))) +// MACRO: number of events in the group +#define EVGNEVENTS(p) (p->evgNCond+p->evgNAct) + +// Internal flags of eventgroups +#define EVGFLAGS_ONCE 0x0001 +#define EVGFLAGS_NOTALWAYS 0x0002 +#define EVGFLAGS_REPEAT 0x0004 +#define EVGFLAGS_NOMORE 0x0008 +#define EVGFLAGS_SHUFFLE 0x0010 +#define EVGFLAGS_EDITORMARK 0x0020 +#define EVGFLAGS_UNDOMARK 0x0040 +#define EVGFLAGS_COMPLEXGROUP 0x0080 +#define EVGFLAGS_BREAKPOINT 0x0100 +#define EVGFLAGS_ALWAYSCLEAN 0x0200 +#define EVGFLAGS_ORINGROUP 0x0400 +//#define EVGFLAGS_2MANYACTIONS 0x0400 +#define EVGFLAGS_STOPINGROUP 0x0800 +//#define EVGFLAGS_NOTASSEMBLED 0x1000 +#define EVGFLAGS_ORLOGICAL 0x1000 +#define EVGFLAGS_GROUPED 0x2000 +#define EVGFLAGS_INACTIVE 0x4000 +#define EVGFLAGS_NOGOOD 0x8000 +#define EVGFLAGS_LIMITED (EVGFLAGS_SHUFFLE+EVGFLAGS_NOTALWAYS+EVGFLAGS_REPEAT+EVGFLAGS_NOMORE) +#define EVGFLAGS_DEFAULTMASK (EVGFLAGS_BREAKPOINT+EVGFLAGS_GROUPED) +//#define EVGFLAGS_FADE (EVGFLAGS_FADEIN|EVGFLAGS_FADEOUT) + + +// Condition ou action structure +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagEVTV1 { + short evtSize; + union + { + struct + { + short evtCode; + }; + struct + { + char evtType; + char evtNum; + }; + }; + OINUM evtOi; + short evtOiList; + char evtFlags; + char evtFlags2; + char evtNParams; + char evtDefType; +// For the conditions + short evtIdentifier; + } eventV1; +typedef eventV1 * LPEVTV1; + +#define CND_SIZEV1 14 +#define ACT_SIZEV1 12 +#define EVGFIRSTEVTV1(p) ((LPEVTV1)((LPSTR)p+sizeof(eventGroup))) +#define EVTPARAMSV1(p) ((LPEVP)( p->evtCode<0 ? (LPBYTE)p+CND_SIZEV1 : (LPBYTE)p+ACT_SIZEV1) ) +#define EVTNEXTV1(p) ((LPEVTV1)((LPBYTE)p+p->evtSize)) + + + +typedef struct tagEVT { + short evtSize; // 0 Size of the event + union + { + struct + { + long evtCode; // 2 Code (hi:NUM lo:TYPE) + }; + struct + { + short evtType; // 2 Type of object + short evtNum; // 4 Number of action/condition + }; + }; + OINUM evtOi; // 6 OI if normal object + short evtOiList; // 8 Pointer + char evtFlags; // 10 Flags + char evtFlags2; // 11 Flags II + char evtNParams; // 12 Number of parameters + char evtDefType; // 13 If default, type +// Pour les conditions + short evtIdentifier; // 14 Event identifier + } event; // 16 +typedef event * PEVT; +typedef event * LPEVT; + +#define CND_SIZE 16 +#define ACT_SIZE 14 + +// Definition of conditions / actions flags +#define EVFLAGS_REPEAT 0x01 +#define EVFLAGS_DONE 0x02 +#define EVFLAGS_DEFAULT 0x04 +#define EVFLAGS_DONEBEFOREFADEIN 0x08 +#define EVFLAGS_NOTDONEINSTART 0x10 +#define EVFLAGS_ALWAYS 0x20 +#define EVFLAGS_BAD 0x40 +#define EVFLAGS_BADOBJECT 0x80 +#define EVFLAGS_DEFAULTMASK (EVFLAGS_ALWAYS+EVFLAGS_REPEAT+EVFLAGS_DEFAULT+EVFLAGS_DONEBEFOREFADEIN+EVFLAGS_NOTDONEINSTART) +#define ACTFLAGS_REPEAT 0x0001 + + +// For flags II +// ------------- +#define EVFLAG2_NOT 0x0001 +#define EVFLAG2_NOTABLE 0x0002 +#define EVFLAGS_NOTABLE (EVFLAG2_NOTABLE<<8) +#define EVFLAGS_MONITORABLE 0x0004 +#define EVFLAGS_TODELETE 0x0008 +#define EVFLAGS_NEWSOUND 0x0010 +#define EVFLAG2_MASK (EVFLAG2_NOT|EVFLAG2_NOTABLE|EVFLAGS_MONITORABLE) + +// MACRO: Returns the code for an extension +#define EXTCONDITIONNUM(i) (-((short)(i>>16))-1) +#define EXTACTIONNUM(i) ((short)(i>>16)) + +// PARAM Structure +// ~~~~~~~~~~~~~~~ +#ifdef __cplusplus +class eventParam { +public: +#else +typedef struct eventParam { +#endif + short evpSize; + short evpCode; + union { + struct { + short evpW0; + short evpW1; + short evpW2; + short evpW3; + short evpW4; + short evpW5; + short evpW6; + short evpW7; + } evpW; + struct { + long evpL0; + long evpL1; + long evpL2; + long evpL3; + } evpL; + } evp; +#ifdef __cplusplus +}; +#else +} eventParam; +#endif +typedef eventParam * PEVP; +typedef eventParam * LPEVP; +typedef eventParam * fpevp; + +// MACRO: next parameter +#define EVPNEXT(p) ((LPEVP)((LPSTR)p+p->evpSize)) + + +// Operators / expressions parameters +// -------------------------------------------------- +#define MIN_LONG (-10000000L) +#define MAX_LONG (10000000L) +#define EXPPARAM_LONG 1 +#define EXPPARAM_VARGLO 2 +#define EXPPARAM_STRING 3 +#define EXPPARAM_ALTVALUE 4 +#define EXPPARAM_FLAG 5 +#define EXP_STOP -1 +#define OPERATOR_START 0x00000000 +#define EXPL_END 0x00000000 +#define EXPL_PLUS 0x00020000 +#define EXPL_MOINS 0x00040000 +#define EXPL_MULT 0x00060000 +#define EXPL_DIV 0x00080000 +#define EXPL_MOD 0x000A0000 +#define EXPL_POW 0x000C0000 +#define EXPL_AND 0x000E0000 +#define EXPL_OR 0x00100000 +#define EXPL_XOR 0x00120000 +#define OPERATOR_END 0x00140000 +typedef struct tagEXP { + union + { + struct + { + long expCode; // 2 Code (hi:NUM lo:TYPE) + }; + struct + { + short expType; // 2 Type of object + short expNum; // 3 Expression number + }; + }; + short expSize; + union + { + struct { + short expOi; + short expOiList; + } expo; + struct { + long expLParam; + } expl; + struct { + double expDouble; + float expFloat; + } expd; + struct { + short expWParam0; + short expWParam1; + } expw; + struct { + short expOi; + short expOiList; + short expNum; + } expv; + struct { + long expExtCode; + short expExtNumber; + } expc; + } expu; + } expression; +typedef expression * LPEXP; +typedef expression * PEXP; + +#define CMPOPE_EQU 0x0000 +#define CMPOPE_DIF 0x0001 +#define CMPOPE_LOWEQU 0x0002 +#define CMPOPE_LOW 0x0003 +#define CMPOPE_GREEQU 0x0004 +#define CMPOPE_GRE 0x0005 +#define MAX_CMPOPE 6 +#define EXPNEXT(expPtr) ((LPEXP)((LPSTR)expPtr+expPtr->expSize)) +#define EXPFLAG_STRING 0x0001 +#define EXPFLAG_DOUBLE 0x0002 + +typedef struct tagEXPV1 { + union + { + struct + { + short expCode; + }; + struct + { + char expType; + char expNum; + }; + }; + short expSize; + union + { + struct { + short expOi; + short expOiList; + } expo; + struct { + long expLParam; + } expl; + struct { + double expDouble; + float expFloat; + } expd; + struct { + short expWParam0; + short expWParam1; + } expw; + struct { + short expOi; + short expOiList; + short expNum; + } expv; + struct { + long expExtCode; + short expExtNumber; + } expc; + } expu; + }expressionV1; +typedef expressionV1 * LPEXPV1; + +#define EXPNEXTV1(expPtr) ((LPEXPV1)((LPSTR)expPtr+expPtr->expSize)) + +/* +#define Q_SPR 0x0100 +#define Q_TXT 0x0200 +#define Q_QST 0x0400 +#define Q_ARE 0x0800 +#define Q_CNT 0x1000 +#define Q_PLA 0x2000 +#define Q_GAM 0x4000 +#define Q_TIM 0x8000 +#define Q_COL 0x0001 +#define Q_ZNE 0x0002 +#define Q_MVT 0x0004 +#define Q_ANI 0x0008 +#define Q_OBJ 0x0010 +#define Q_KEY 0x0020 +#define Q_SYS 0x0040 +*/ + +// Information structure +// ---------------------------------------------- +typedef struct tagEVO { + short evoConditions; // Conditions + short evoActions; // Actions + short evoExpressions; // Expressions + short evoMsgMenus; // Menu strings for actions/conditions + short evoMsgDisplay; // Display strings for actions/conditions + short evoMsgExpressions; // Menu/display strings for expressions + short evoMsgExpParams; // Parameter string + short evoNConditions; // Number of conditions + } eventInfosOffsets; +typedef eventInfosOffsets * PEVO; +typedef eventInfosOffsets * LPEVO; + +// Definition of the different system objects (TYPE<0) +// ---------------------------------------------------------- +#define TYPE_DIRECTION -127 +#define TYPE_QUALIFIER -126 +#define NUMBEROF_SYSTEMTYPES 7 +#define OBJ_PLAYER -7 +#define OBJ_KEYBOARD -6 +#define OBJ_CREATE -5 +#define OBJ_TIMER -4 +#define OBJ_GAME -3 +#define OBJ_SPEAKER -2 +#define OBJ_SYSTEM -1 +#define OBJ_FIRST_C_OBJECT 8 +#define OBJ_LAST NB_SYSOBJ + + + + + + + + +// ------------------------------------------------------------ +// EXTENSION OBJECT DATA ZONE +// ------------------------------------------------------------ + +// Flags +#define OEFLAG_DISPLAYINFRONT 0x0001 +#define OEFLAG_BACKGROUND 0x0002 +#define OEFLAG_BACKSAVE 0x0004 +#define OEFLAG_RUNBEFOREFADEIN 0x0008 +#define OEFLAG_MOVEMENTS 0x0010 +#define OEFLAG_ANIMATIONS 0x0020 +#define OEFLAG_TABSTOP 0x0040 +#define OEFLAG_WINDOWPROC 0x0080 +#define OEFLAG_VALUES 0x0100 +#define OEFLAG_SPRITES 0x0200 +#define OEFLAG_INTERNALBACKSAVE 0x0400 +#define OEFLAG_SCROLLINGINDEPENDANT 0x0800 +#define OEFLAG_QUICKDISPLAY 0x1000 +#define OEFLAG_NEVERKILL 0x2000 +#define OEFLAG_NEVERSLEEP 0x4000 +#define OEFLAG_MANUALSLEEP 0x8000 +#define OEFLAG_TEXT 0x10000 +#define OEFLAG_DONTCREATEATSTART 0x20000 + +// Flags modifiable by the program +#define OEPREFS_BACKSAVE 0x0001 +#define OEPREFS_SCROLLINGINDEPENDANT 0x0002 +#define OEPREFS_QUICKDISPLAY 0x0004 +#define OEPREFS_SLEEP 0x0008 +#define OEPREFS_LOADONCALL 0x0010 +#define OEPREFS_GLOBAL 0x0020 +#define OEPREFS_BACKEFFECTS 0x0040 +#define OEPREFS_KILL 0x0080 +#define OEPREFS_INKEFFECTS 0x0100 +#define OEPREFS_TRANSITIONS 0x0200 +#define OEPREFS_FINECOLLISIONS 0x0400 +#define OEPREFS_APPLETPROBLEMS 0x0800 + +// Running flags +#define REFLAG_ONESHOT 0x0001 +#define REFLAG_DISPLAY 0x0002 +#define REFLAG_MSGHANDLED 0x0004 +#define REFLAG_MSGCATCHED 0x0008 +#define REFLAG_MSGDEFPROC 0x0010 + +#define REFLAG_MSGRETURNVALUE 0x0040 + +#define OEFLAGS_DEFAULTSETUPS (OEFLAG_MOVEMENTS|OEFLAG_ANIMATIONS|OEFLAG_SPRITES|OEFLAG_VALUES) + + + +#ifndef IN_KPX + +/////////////////////////////////////////////////////////////////////// +// +// DEFINITION OF EVENTS AND ACTIONS CODES +// +/////////////////////////////////////////////////////////////////////// + +// SYSTEM Conditions / Actions +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +//#define OBJ_SYSTEM -1 +//-1&255=255 +#define CND_CHANCE ((-26<<8)|255) +#define CND_ORLOGICAL ((-25<<8)|255) +#define CNDL_ORLOGICAL ((-25<<16)|65535) +#define CND_OR ((-24<<8)|255) +#define CNDL_OR ((-24<<16)|65535) +#define CND_GROUPSTART ((-23<<8)|255) +#define CNDL_GROUPSTART ((-23<<16)|65535) +#define CND_CLIPBOARD ((-22<<8)|255) +#define CND_ONCLOSE ((-21<<8)|255) +#define CNDL_ONCLOSE ((-21<<16)|65535) +#define CND_COMPAREGSTRING ((-20<<8)|255) +#define CNDL_COMPAREGSTRING ((-20<<16)|65535) +#define CND_MENUVISIBLE ((-19<<8)|255) +#define CND_MENUENABLED ((-18<<8)|255) +#define CND_MENUCHECKED ((-17<<8)|255) +#define CND_ONLOOP ((-16<<8)|255) +#define CNDL_ONLOOP ((-16<<16)|65535) +#define CND_DROPFILES ((-15<<8)|255) +#define CNDL_DROPFILES ((-15<<16)|65535) +#define CND_MENUSELECTED ((-14<<8)|255) +#define CNDL_MENUSELECTED ((-14<<16)|65535) +#define CND_RECORDKEY ((-13<<8)|255) +#define CNDL_RECORDKEY ((-13<<16)|65535) +#define CND_GROUPACTIVATED ((-12<<8)|255) +#define CNDL_GROUPACTIVATED ((-12<<16)|65535) +#define CND_ENDGROUP ((-11<<8)|255) +#define CNDL_ENDGROUP ((-11<<16)|65535) +#define CND_GROUP ((-10<<8)|255) +#define CNDL_GROUP ((-10<<16)|65535) +#define CND_REMARK ((-9<<8)|255) +#define CNDL_REMARK ((-9<<16)|65535) +#define CND_COMPAREG ((-8<<8)|255) +#define CNDL_COMPAREG ((-8<<16)|65535) +#define CND_NOTALWAYS ((-7<<8)|255) +#define CNDL_NOTALWAYS ((-7<<16)|65535) +#define CND_ONCE ((-6<<8)|255) +#define CNDL_ONCE ((-6<<16)|65535) +#define CND_REPEAT ((-5<<8)|255) +#define CNDL_REPEAT ((-5<<16)|65535) +#define CND_NOMORE ((-4<<8)|255) +#define CNDL_NOMORE ((-4<<16)|65535) +#define CND_COMPARE ((-3<<8)|255) +#define CND_NEVER ((-2<<8)|255) +#define CNDL_NEVER ((-2<<16)|65535) +#define CND_ALWAYS ((-1<<8)|255) +#define CNDL_ALWAYS ((-1<<16)|65535) + +#define ACT_SKIP ((0<<8)|255) +#define ACTL_SKIP ((0<<16)|65535) +#define ACT_SKIPMONITOR ((1<<8)|255) +#define ACTL_SKIPMONITOR ((1<<16)|65535) +#define ACT_EXECPROG ((2<<8)|255) +#define ACT_SETVARG ((3<<8)|255) +#define ACTL_SETVARG ((3<<16)|65535) +#define ACT_SUBVARG ((4<<8)|255) +#define ACTL_SUBVARG ((4<<16)|65535) +#define ACT_ADDVARG ((5<<8)|255) +#define ACTL_ADDVARG ((5<<16)|65535) +#define ACT_GRPACTIVATE ((6<<8)|255) +#define ACTL_GRPACTIVATE ((6<<16)|65535) +#define ACT_GRPDEACTIVATE ((7<<8)|255) +#define ACTL_GRPDEACTIVATE ((7<<16)|65535) +#define ACT_MENUACTIVATE ((8<<8)|255) +#define ACT_MENUDEACTIVATE ((9<<8)|255) +#define ACT_MENUCHECK ((10<<8)|255) +#define ACT_MENUNCHECK ((11<<8)|255) +#define ACT_MENUSHOW ((12<<8)|255) +#define ACTL_MENUSHOW ((12<<16)|65535) +#define ACT_MENUHIDE ((13<<8)|255) +#define ACTL_MENUHIDE ((13<<16)|65535) +#define ACT_STARTLOOP ((14<<8)|255) +#define ACT_STOPLOOP ((15<<8)|255) +#define ACT_SETLOOPINDEX ((16<<8)|255) +#define ACT_RANDOMIZE ((17<<8)|255) +#define ACT_SENDMENUCMD ((18<<8)|255) +#define ACT_SETGLOBALSTRING ((19<<8)|255) +#define ACTL_SETGLOBALSTRING ((19<<16)|65535) +#define ACT_SENDCLIPBOARD ((20<<8)|255) +#define ACT_CLEARCLIPBOARD ((21<<8)|255) +#define ACT_EXECPROG2 ((22<<8)|255) +#define ACT_OPENDEBUGGER ((23<<8)|255) +#define ACT_PAUSEDEBUGGER ((24<<8)|255) +#define ACT_EXTRACTBINFILE ((25<<8)|255) +#define ACT_RELEASEBINFILE ((26<<8)|255) + +#define EXP_LONG ((0<<8)|255) +#define EXPL_LONG ((0<<16)|65535) +#define EXP_RANDOM ((1<<8)|255) +#define EXPL_RANDOM ((1<<16)|65535) +#define EXP_VARGLO ((2<<8)|255) +#define EXPL_VARGLO ((2<<16)|65535) +#define EXP_STRING ((3<<8)|255) +#define EXPL_STRING ((3<<16)|65535) +#define EXP_STR ((4<<8)|255) +#define EXPL_STR ((4<<16)|65535) +#define EXP_VAL ((5<<8)|255) +#define EXPL_VAL ((5<<16)|65535) +#define EXP_DRIVE ((6<<8)|255) +#define EXPL_DRIVE ((6<<16)|65535) +#define EXP_DIRECTORY ((7<<8)|255) +#define EXPL_DIRECTORY ((7<<16)|65535) +#define EXP_PATH ((8<<8)|255) +#define EXPL_PATH ((8<<16)|65535) +#define EXP_APPNAME ((9<<8)|255) +#define EXPL_APPNAME ((9<<16)|65535) +#define EXP_SIN ((10<<8)|255) +#define EXPL_SIN ((10<<16)|65535) +#define EXP_COS ((11<<8)|255) +#define EXPL_COS ((11<<16)|65535) +#define EXP_TAN ((12<<8)|255) +#define EXPL_TAN ((12<<16)|65535) +#define EXP_SQR ((13<<8)|255) +#define EXPL_SQR ((13<<16)|65535) +#define EXP_LOG ((14<<8)|255) +#define EXPL_LOG ((14<<16)|65535) +#define EXP_LN ((15<<8)|255) +#define EXPL_LN ((15<<16)|65535) +#define EXP_HEX ((16<<8)|255) +#define EXPL_HEX ((16<<16)|65535) +#define EXP_BIN ((17<<8)|255) +#define EXPL_BIN ((17<<16)|65535) +#define EXP_EXP ((18<<8)|255) +#define EXPL_EXP ((18<<16)|65535) +#define EXP_LEFT ((19<<8)|255) +#define EXPL_LEFT ((19<<16)|65535) +#define EXP_RIGHT ((20<<8)|255) +#define EXPL_RIGHT ((20<<16)|65535) +#define EXP_MID ((21<<8)|255) +#define EXPL_MID ((21<<16)|65535) +#define EXP_LEN ((22<<8)|255) +#define EXPL_LEN ((22<<16)|65535) +#define EXP_DOUBLE ((23<<8)|255) +#define EXPL_DOUBLE ((23<<16)|65535) +#define EXP_VARGLONAMED ((24<<8)|255) +#define EXPL_VARGLONAMED ((24<<16)|65535) +#define EXP_ENTERSTRINGHERE ((25<<8)|255) +#define EXPL_ENTERSTRINGHERE ((25<<16)|65535) +#define EXP_ENTERVALUEHERE ((26<<8)|255) +#define EXPL_ENTERVALUEHERE ((26<<16)|65535) +#define EXP_FLOAT ((27<<8)|255) +#define EXPL_FLOAT ((27<<16)|65535) +#define EXP_INT ((28<<8)|255) +#define EXPL_INT ((28<<16)|65535) +#define EXP_ABS ((29<<8)|255) +#define EXPL_ABS ((29<<16)|65535) +#define EXP_CEIL ((30<<8)|255) +#define EXPL_CEIL ((30<<16)|65535) +#define EXP_FLOOR ((31<<8)|255) +#define EXPL_FLOOR ((31<<16)|65535) +#define EXP_ACOS ((32<<8)|255) +#define EXPL_ACOS ((32<<16)|65535) +#define EXP_ASIN ((33<<8)|255) +#define EXPL_ASIN ((33<<16)|65535) +#define EXP_ATAN ((34<<8)|255) +#define EXPL_ATAN ((34<<16)|65535) +#define EXP_NOT ((35<<8)|255) +#define EXPL_NOT ((35<<16)|65535) +#define EXP_NDROPFILES ((36<<8)|255) +#define EXPL_NDROPFILES ((36<<16)|65535) +#define EXP_DROPFILE ((37<<8)|255) +#define EXPL_DROPFILE ((37<<16)|65535) +#define EXP_GETCOMMANDLINE ((38<<8)|255) +#define EXPL_GETCOMMANDLINE ((38<<16)|65535) +#define EXP_GETCOMMANDITEM ((39<<8)|255) +#define EXPL_GETCOMMANDITEM ((39<<16)|65535) +#define EXP_MIN ((40<<8)|255) +#define EXPL_MIN ((40<<16)|65535) +#define EXP_MAX ((41<<8)|255) +#define EXPL_MAX ((41<<16)|65535) +#define EXP_GETRGB ((42<<8)|255) +#define EXPL_GETRGB ((42<<16)|65535) +#define EXP_GETRED ((43<<8)|255) +#define EXPL_GETRED ((43<<16)|65535) +#define EXP_GETGREEN ((44<<8)|255) +#define EXPL_GETGREEN ((44<<16)|65535) +#define EXP_GETBLUE ((45<<8)|255) +#define EXPL_GETBLUE ((45<<16)|65535) +#define EXP_LOOPINDEX ((46<<8)|255) +#define EXPL_LOOPINDEX ((46<<16)|65535) +#define EXP_NEWLINE ((47<<8)|255) +#define EXPL_NEWLINE ((47<<16)|65535) +#define EXP_ROUND ((48<<8)|255) +#define EXPL_ROUND ((48<<16)|65535) +#define EXP_STRINGGLO ((49<<8)|255) +#define EXPL_STRINGGLO ((49<<16)|65535) +#define EXP_STRINGGLONAMED ((50<<8)|255) +#define EXPL_STRINGGLONAMED ((50<<16)|65535) +#define EXP_LOWER ((51<<8)|255) +#define EXPL_LOWER ((51<<16)|65535) +#define EXP_UPPER ((52<<8)|255) +#define EXPL_UPPER ((52<<16)|65535) +#define EXP_FIND ((53<<8)|255) +#define EXPL_FIND ((53<<16)|65535) +#define EXP_REVERSEFIND ((54<<8)|255) +#define EXPL_REVERSEFIND ((54<<16)|65535) +#define EXP_GETCLIPBOARD ((55<<8)|255) +#define EXP_TEMPPATH ((56<<8)|255) +#define EXP_BINFILETEMPNAME ((57<<8)|255) +#define EXP_FLOATSTR ((58<<8)|255) +#define EXPL_FLOATSTR ((58<<16)|65535) +#define EXP_ATAN2 ((59<<8)|255) +#define EXPL_ATAN2 ((59<<16)|65535) +#define EXP_ZERO ((60<<8)|255) +#define EXPL_ZERO ((60<<16)|65535) +#define EXP_EMPTY ((61<<8)|255) +#define EXPL_EMPTY ((61<<16)|65535) + +#define EXP_PARENTH1 ((-1<<8)|255) +#define EXPL_PARENTH1 ((-1<<16)|65535) +#define EXP_PARENTH2 ((-2<<8)|255) +#define EXPL_PARENTH2 ((-2<<16)|65535) +#define EXP_VIRGULE ((-3<<8)|255) +#define EXPL_VIRGULE ((-3<<16)|65535) + +// SPEAKER Conditions / Actions +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// #define TYPE_SPEAKER -2 +//(TYPE_SPEAKER&255)=254 +#define CND_SPCHANNELPAUSED ((-9<<8)|254) +#define CNDL_SPCHANNELPAUSED ((-9<<16)|65534) +#define CND_NOSPCHANNELPLAYING ((-8<<8)|254) +#define CNDL_NOSPCHANNELPLAYING ((-8<<16)|65534) +#define CND_MUSPAUSED ((-7<<8)|254) +#define CND_SPSAMPAUSED ((-6<<8)|254) +#define CNDL_SPSAMPAUSED ((-6<<16)|65534) +#define CND_MUSICENDS ((-5<<8)|254) +#define CNDL_MUSICENDS ((-5<<16)|65534) +#define CND_NOMUSPLAYING ((-4<<8)|254) +#define CNDL_NOMUSPLAYING ((-4<<16)|65534) +#define CND_NOSAMPLAYING ((-3<<8)|254) +#define CNDL_NOSAMPLAYING ((-3<<16)|65534) +#define CND_NOSPMUSPLAYING ((-2<<8)|254) +#define CND_NOSPSAMPLAYING ((-1<<8)|254) +#define CNDL_NOSPSAMPLAYING ((-1<<16)|65534) +#define ACT_PLAYSAMPLE ((0<<8)|254) +#define ACTL_PLAYSAMPLE ((0<<16)|65534) +#define ACT_STOPSAMPLE ((1<<8)|254) +#define ACTL_STOPSAMPLE ((1<<16)|65534) +#define ACT_PLAYMUSIC ((2<<8)|254) +#define ACTL_PLAYMUSIC ((2<<16)|65534) +#define ACT_STOPMUSIC ((3<<8)|254) +#define ACTL_STOPMUSIC ((3<<16)|65534) +#define ACT_PLAYLOOPSAMPLE ((4<<8)|254) +#define ACTL_PLAYLOOPSAMPLE ((4<<16)|65534) +#define ACT_PLAYLOOPMUSIC ((5<<8)|254) +#define ACT_STOPSPESAMPLE ((6<<8)|254) +#define ACTL_STOPSPESAMPLE ((6<<16)|65534) +#define ACT_PAUSESAMPLE ((7<<8)|254) +#define ACTL_PAUSESAMPLE ((7<<16)|65534) +#define ACT_RESUMESAMPLE ((8<<8)|254) +#define ACTL_RESUMESAMPLE ((8<<16)|65534) +#define ACT_PAUSEMUSIC ((9<<8)|254) +#define ACT_RESUMEMUSIC ((10<<8)|254) +#define ACT_PLAYCHANNEL ((11<<8)|254) +#define ACTL_PLAYCHANNEL ((11<<16)|65534) +#define ACT_PLAYLOOPCHANNEL ((12<<8)|254) +#define ACTL_PLAYLOOPCHANNEL ((12<<16)|65534) +#define ACT_PAUSECHANNEL ((13<<8)|254) +#define ACTL_PAUSECHANNEL ((13<<16)|65534) +#define ACT_RESUMECHANNEL ((14<<8)|254) +#define ACTL_RESUMECHANNEL ((14<<16)|65534) +#define ACT_STOPCHANNEL ((15<<8)|254) +#define ACTL_STOPCHANNEL ((15<<16)|65534) +#define ACT_SETCHANNELPOS ((16<<8)|254) +#define ACTL_SETCHANNELPOS ((16<<16)|65534) +#define ACT_SETCHANNELVOL ((17<<8)|254) +#define ACTL_SETCHANNELVOL ((17<<16)|65534) +#define ACT_SETCHANNELPAN ((18<<8)|254) +#define ACTL_SETCHANNELPAN ((18<<16)|65534) +#define ACT_SETSAMPLEPOS ((19<<8)|254) +#define ACTL_SETSAMPLEPOS ((19<<16)|65534) +#define ACT_SETSAMPLEMAINVOL ((20<<8)|254) +#define ACTL_SETSAMPLEMAINVOL ((20<<16)|65534) +#define ACT_SETSAMPLEVOL ((21<<8)|254) +#define ACTL_SETSAMPLEVOL ((21<<16)|65534) +#define ACT_SETSAMPLEMALNPAN ((22<<8)|254) +#define ACTL_SETSAMPLEMALNPAN ((22<<16)|65534) +#define ACT_SETSAMPLEPAN ((23<<8)|254) +#define ACTL_SETSAMPLEPAN ((23<<16)|65534) +#define ACT_PAUSEALLCHANNELS ((24<<8)|254) +#define ACTL_PAUSEALLCHANNELS ((24<<16)|65534) +#define ACT_RESUMEALLCHANNELS ((25<<8)|254) +#define ACTL_RESUMEALLCHANNELS ((25<<16)|65534) +#define ACT_PLAYMUSICFILE ((26<<8)|254) +#define ACT_PLAYLOOPMUSICFILE ((27<<8)|254) +#define ACT_PLAYFILECHANNEL ((28<<8)|254) +#define ACTL_PLAYFILECHANNEL ((28<<16)|65534) +#define ACT_PLAYLOOPFILECHANNEL ((29<<8)|254) +#define ACTL_PLAYLOOPFILECHANNEL ((29<<16)|65534) +#define ACT_LOCKCHANNEL ((30<<8)|254) +#define ACTL_LOCKCHANNEL ((30<<16)|65534) +#define ACT_UNLOCKCHANNEL ((31<<8)|254) +#define ACTL_UNLOCKCHANNEL ((31<<16)|65534) +#define ACT_SETCHANNELFREQ ((32<<8)|254) +#define ACT_SETSAMPLEFREQ ((33<<8)|254) + +#define EXP_GETSAMPLEMAINVOL ((0<<8)|254) +#define EXP_GETSAMPLEVOL ((1<<8)|254) +#define EXP_GETCHANNELVOL ((2<<8)|254) +#define EXPL_GETCHANNELVOL ((2<<16)|65534) +#define EXP_GETSAMPLEMAINPAN ((3<<8)|254) +#define EXP_GETSAMPLEPAN ((4<<8)|254) +#define EXP_GETCHANNELPAN ((5<<8)|254) +#define EXPL_GETCHANNELPAN ((5<<16)|65534) +#define EXP_GETSAMPLEPOS ((6<<8)|254) +#define EXP_GETCHANNELPOS ((7<<8)|254) +#define EXPL_GETCHANNELPOS ((7<<16)|65534) +#define EXP_GETSAMPLEDUR ((8<<8)|254) +#define EXP_GETCHANNELDUR ((9<<8)|254) +#define EXP_GETSAMPLEFREQ ((10<<8)|254) +#define EXP_GETCHANNELFREQ ((11<<8)|254) + + +// GAME Conditions / Actions +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +//#define TYPE_GAME -3 +//(TYPE_GAME&255)=253 + +#define CND_FRAMESAVED ((-10<<8)|253) +#define CND_FRAMELOADED ((-9<<8)|253) +#define CNDL_ENDOFPAUSE ((-8<<16)|65533) +#define CND_ENDOFPAUSE ((-8<<8)|253) +#define CND_ISVSYNCON ((-7<<8)|253) +#define CND_ISLADDER ((-6<<8)|253) +#define CND_ISOBSTACLE ((-5<<8)|253) +#define CND_QUITAPPLICATION ((-4<<8)|253) +#define CNDL_QUITAPPLICATION ((-4<<16)|65533) +#define CND_LEVEL ((-3<<8)|253) +#define CND_END ((-2<<8)|253) +#define CNDL_END ((-2<<16)|65533) +#define CND_START ((-1<<8)|253) +#define CNDL_START ((-1<<16)|65533) + +#define ACT_NEXTLEVEL ((0<<8)|253) +#define ACTL_NEXTLEVEL ((0<<16)|65533) +#define ACT_PREVLEVEL ((1<<8)|253) +#define ACTL_PREVLEVEL ((1<<16)|65533) +#define ACT_GOLEVEL ((2<<8)|253) +#define ACTL_GOLEVEL ((2<<16)|65533) +#define ACT_PAUSE ((3<<8)|253) +#define ACT_ENDGAME ((4<<8)|253) +#define ACTL_ENDGAME ((4<<16)|65533) +#define ACT_RESTARTGAME ((5<<8)|253) +#define ACTL_RESTARTGAME ((5<<16)|65533) +#define ACT_RESTARTLEVEL ((6<<8)|253) +#define ACT_CDISPLAY ((7<<8)|253) +#define ACT_CDISPLAYX ((8<<8)|253) +#define ACT_CDISPLAYY ((9<<8)|253) +#define ACT_LOADGAME ((10<<8)|253) +#define ACT_SAVEGAME ((11<<8)|253) +#define ACT_CLS ((12<<8)|253) +#define ACT_CLEARZONE ((13<<8)|253) +#define ACT_FULLSCREENMODE ((14<<8)|253) +#define ACT_WINDOWEDMODE ((15<<8)|253) +#define ACT_SETFRAMERATE ((16<<8)|253) +#define ACT_PAUSEKEY ((17<<8)|253) +#define ACT_PAUSEANYKEY ((18<<8)|253) +#define ACT_SETVSYNCON ((19<<8)|253) +#define ACT_SETVSYNCOFF ((20<<8)|253) +#define ACT_SETVIRTUALWIDTH ((21<<8)|253) +#define ACT_SETVIRTUALHEIGHT ((22<<8)|253) +#define ACT_SETFRAMEBDKCOLOR ((23<<8)|253) +#define ACT_DELCREATEDBKDAT ((24<<8)|253) +#define ACT_DELALLCREATEDBKD ((25<<8)|253) +#define ACT_SETFRAMEWIDTH ((26<<8)|253) +#define ACT_SETFRAMEHEIGHT ((27<<8)|253) +#define ACT_SAVEFRAME ((28<<8)|253) +#define ACT_LOADFRAME ((29<<8)|253) +#define ACT_LOADAPPLICATION ((30<<8)|253) +#define ACT_PLAYDEMO ((31<<8)|253) +#define ACT_SETFRAMEEFFECT ((32<<8)|253) +#define ACT_SETFRAMEEFFECTPARAM ((33<<8)|253) +#define ACT_SETFRAMEEFFECTPARAMTEXTURE ((34<<8)|253) +#define ACT_SETFRAMEALPHACOEF ((35<<8)|253) +#define ACT_SETFRAMERGBCOEF ((36<<8)|253) + +#define EXP_GAMLEVEL ((0<<8)|253) +#define EXP_GAMNPLAYER ((1<<8)|253) +#define EXP_PLAYXLEFT ((2<<8)|253) +#define EXP_PLAYXRIGHT ((3<<8)|253) +#define EXP_PLAYYTOP ((4<<8)|253) +#define EXP_PLAYYBOTTOM ((5<<8)|253) +#define EXP_PLAYWIDTH ((6<<8)|253) +#define EXP_PLAYHEIGHT ((7<<8)|253) +#define EXP_GAMLEVELNEW ((8<<8)|253) +#define EXP_GETCOLLISIONMASK ((9<<8)|253) +#define EXP_FRAMERATE ((10<<8)|253) +#define EXP_GETVIRTUALWIDTH ((11<<8)|253) +#define EXP_GETVIRTUALHEIGHT ((12<<8)|253) +#define EXP_GETFRAMEBKDCOLOR ((13<<8)|253) +#define EXP_GRAPHICMODE ((14<<8)|253) +#define EXP_PIXELSHADERVERSION ((15<<8)|253) +#define EXP_FRAMEALPHACOEF ((16<<8)|253) +#define EXP_FRAMERGBCOEF ((17<<8)|253) +#define EXP_FRAMEEFFECTPARAM ((18<<8)|253) + + +// TIMER Conditions / Actions +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define CND_TIMEOUT ((-5<<8)|(OBJ_TIMER&255)) +#define CND_EVERY ((-4<<8)|(OBJ_TIMER&255)) +#define CNDL_EVERY ((-4<<16)|(OBJ_TIMER&0xFFFF)) +#define CND_TIMER ((-3<<8)|(OBJ_TIMER&255)) +#define CNDL_TIMER ((-3<<16)|(OBJ_TIMER&0xFFFF)) +#define CND_TIMERINF ((-2<<8)|(OBJ_TIMER&255)) +#define CNDL_TIMERINF ((-2<<16)|(OBJ_TIMER&0xFFFF)) +#define CND_TIMERSUP ((-1<<8)|(OBJ_TIMER&255)) +#define CNDL_TIMERSUP ((-1<<16)|(OBJ_TIMER&0xFFFF)) +#define ACT_SETTIMER ((0<<8)|(OBJ_TIMER&255)) +#define EXP_TIMVALUE ((0<<8)|(OBJ_TIMER&255)) +#define EXP_TIMCENT ((1<<8)|(OBJ_TIMER&255)) +#define EXP_TIMSECONDS ((2<<8)|(OBJ_TIMER&255)) +#define EXP_TIMHOURS ((3<<8)|(OBJ_TIMER&255)) +#define EXP_TIMMINITS ((4<<8)|(OBJ_TIMER&255)) +#define NUM_EVERY -4 +#define NUM_TIMER -3 +#define NUM_TIMERINF -2 +#define NUM_TIMERSUP -1 + +// KEYBOARD Conditions / Actions +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define CNDL_ONMOUSEWHEELDOWN ((-12<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_ONMOUSEWHEELDOWN ((-12<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_ONMOUSEWHEELUP ((-11<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_ONMOUSEWHEELUP ((-11<<8)|(OBJ_KEYBOARD&255)) +#define CND_MOUSEON ((-10<<8)|(OBJ_KEYBOARD&255)) +#define CND_ANYKEY ((-9<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_ANYKEY ((-9<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_MKEYDEPRESSED ((-8<<8)|(OBJ_KEYBOARD&255)) +#define CND_MCLICKONOBJECT ((-7<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_MCLICKONOBJECT ((-7<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_MCLICKINZONE ((-6<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_MCLICKINZONE ((-6<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_MCLICK ((-5<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_MCLICK ((-5<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_MONOBJECT ((-4<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_MONOBJECT ((-4<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_MINZONE ((-3<<8)|(OBJ_KEYBOARD&255)) +#define CND_KBKEYDEPRESSED ((-2<<8)|(OBJ_KEYBOARD&255)) +#define CND_KBPRESSKEY ((-1<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_KBPRESSKEY ((-1<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define ACT_HIDECURSOR ((0<<8)|(OBJ_KEYBOARD&255)) +#define ACT_SHOWCURSOR ((1<<8)|(OBJ_KEYBOARD&255)) +#define EXP_XMOUSE ((0<<8)|(OBJ_KEYBOARD&255)) +#define EXP_YMOUSE ((1<<8)|(OBJ_KEYBOARD&255)) +#define EXP_MOUSEWHEELDELTA ((2<<8)|(OBJ_KEYBOARD&255)) + + +// PLAYERS Conditions / Actions +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define CND_JOYPUSHED ((-6<<8)|(OBJ_PLAYER&255)) +#define CND_NOMORELIVE ((-5<<8)|(OBJ_PLAYER&255)) +#define CNDL_NOMORELIVE ((-5<<16)|(OBJ_PLAYER&0xFFFF)) +#define CND_JOYPRESSED ((-4<<8)|(OBJ_PLAYER&255)) +#define CNDL_JOYPRESSED ((-4<<16)|(OBJ_PLAYER&0xFFFF)) +#define CND_LIVE ((-3<<8)|(OBJ_PLAYER&255)) +#define CND_SCORE ((-2<<8)|(OBJ_PLAYER&255)) +#define CND_PLAYERPLAYING ((-1<<8)|(OBJ_PLAYER&255)) + +#define ACT_SETSCORE ((0<<8)|(OBJ_PLAYER&255)) +#define ACT_SETLIVES ((1<<8)|(OBJ_PLAYER&255)) +#define ACT_NOINPUT ((2<<8)|(OBJ_PLAYER&255)) +#define ACT_RESTINPUT ((3<<8)|(OBJ_PLAYER&255)) +#define ACT_ADDSCORE ((4<<8)|(OBJ_PLAYER&255)) +#define ACT_ADDLIVES ((5<<8)|(OBJ_PLAYER&255)) +#define ACT_SUBSCORE ((6<<8)|(OBJ_PLAYER&255)) +#define ACT_SUBLIVES ((7<<8)|(OBJ_PLAYER&255)) +#define ACT_SETINPUT ((8<<8)|(OBJ_PLAYER&255)) +#define ACT_SETINPUTKEY ((9<<8)|(OBJ_PLAYER&255)) +#define ACT_SETPLAYERNAME ((10<<8)|(OBJ_PLAYER&255)) + +#define EXP_PLASCORE ((0<<8)|(OBJ_PLAYER&255)) +#define EXP_PLALIVES ((1<<8)|(OBJ_PLAYER&255)) +#define EXP_GETINPUT ((2<<8)|(OBJ_PLAYER&255)) +#define EXP_GETINPUTKEY ((3<<8)|(OBJ_PLAYER&255)) +#define EXP_GETPLAYERNAME ((4<<8)|(OBJ_PLAYER&255)) +#define NUM_JOYPRESSED -4 + +// CREATE Conditions / Actions +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define CND_CHOOSEALLINLINE ((-23<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEFLAGRESET ((-22<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEFLAGSET ((-21<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEVALUE ((-20<<8)|(OBJ_CREATE&255)) +#define CND_PICKFROMID ((-19<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEALLINZONE ((-18<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEALL ((-17<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEZONE ((-16<<8)|(OBJ_CREATE&255)) +#define CND_NUMOFALLOBJECT ((-15<<8)|(OBJ_CREATE&255)) +#define CND_NUMOFALLZONE ((-14<<8)|(OBJ_CREATE&255)) +#define CND_NOMOREALLZONE ((-13<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEFLAGRESET_OLD ((-12<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEFLAGSET_OLD ((-11<<8)|(OBJ_CREATE&255)) +//... +#define CND_CHOOSEVALUE_OLD ((-8<<8)|(OBJ_CREATE&255)) +#define CND_PICKFROMID_OLD ((-7<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEALLINZONE_OLD ((-6<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEALL_OLD ((-5<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEZONE_OLD ((-4<<8)|(OBJ_CREATE&255)) +#define CND_NUMOFALLOBJECT_OLD ((-3<<8)|(OBJ_CREATE&255)) +#define CND_NUMOFALLZONE_OLD ((-2<<8)|(OBJ_CREATE&255)) +#define CND_NOMOREALLZONE_OLD ((-1<<8)|(OBJ_CREATE&255)) +#define ACT_CREATE ((0<<8)|(OBJ_CREATE&255)) +#define EXP_CRENUMBERALL ((0<<8)|(OBJ_CREATE&255)) +#define NUM_END -2 +#define NUM_START -1 + +#endif + +// BALL Movements +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagMB { + WORD mbSpeed; + WORD mbBounce; + WORD mbAngles; + WORD mbSecurity; + WORD mbDecelerate; + WORD mbFree; + } MoveBall; +typedef MoveBall * LPMOVEBALL; + +// MOUSE movement +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagMM { + short mmDx; + short mmFx; + short mmDy; + short mmFy; + short mmFlags; + } MoveMouse; +typedef MoveMouse * LPMOVEMOUSE; + +#define MOUSE_XCENTER 100 +#define MOUSE_YCENTER 100 +#define MMMODE_NORMAL 0 +#define MMMODE_HIDDEN 1 +#define MMMODE_REMOVED 2 + +// 8 Direction movement +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagMG { + WORD mgSpeed; // Max speed + WORD mgAcc; // Acceleration + WORD mgDec; // Deceleration + WORD mgBounceMult; // Bounce factor + DWORD mgDir; // Allowed directions + } MoveGeneric; +typedef MoveGeneric * LPMOVEGENERIC; + +// RACE-CAR movement +// ~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagMR { + WORD mrSpeed; // Max speed + WORD mrAcc; // Acceleration + WORD mrDec; // Deceleration + WORD mrRot; // Rotating speed + WORD mrBounceMult; // Bounce factor + WORD mrAngles; // Number of angles + WORD mrOkReverse; // Allowed reverse speed? + } MoveRace; +typedef MoveRace * LPMOVERACE; + +// Path movement +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Structure for one move +typedef struct tagMDV1 { + BYTE mdSpeed; + BYTE mdDir; + short mdDx; + short mdDy; + short mdCosinus; + short mdSinus; + short mdLength; + short mdPause; + } MoveDefV1; +typedef MoveDefV1 * LPMOVEDEFV1; + +typedef struct tagMD { + BYTE mdPrevious; + BYTE mdNext; + BYTE mdSpeed; + BYTE mdDir; + short mdDx; + short mdDy; + short mdCosinus; + short mdSinus; + short mdLength; + short mdPause; + TCHAR mdName[2]; + } MoveDef; +typedef MoveDef * LPMOVEDEF; + +// Movement edition +typedef struct tagME { + int meSpeed; + int meDx; + int meDy; + int meFlag; + int meX; + int meY; + int meDelay; + LPTSTR meName; + } MoveEdit; +typedef MoveEdit * LPMOVEEDIT; + +typedef struct tagMA { + MoveEdit me[1]; + }MoveArray; +#define sizeof_MoveArray (sizeof(MoveArray)-sizeof(MoveEdit)) +typedef MoveArray * LPMOVEARRAY; + +typedef struct tagMT { + WORD mtNumber; // Number of movement + WORD mtMinSpeed; // maxs and min speed in the movements + WORD mtMaxSpeed; + BYTE mtLoop; // Loop at end + BYTE mtRepos; // Reposition at end + BYTE mtReverse; // Pingpong? + BYTE mtFree; + BYTE mtMoves[2]; // Start of movement definition + } MoveTaped; +typedef MoveTaped * LPMOVETAPED; + +// PLATFORM mouvement +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagMP { + WORD mpSpeed; // Max speed + WORD mpAcc; // Acceleration + WORD mpDec; // Deceleration + WORD mpJumpControl; // Bounce factor + WORD mpGravity; + WORD mpJump; + } MovePlatform; +typedef MovePlatform * LPMOVEPLATFORM; + +#define MPJC_NOJUMP 0 +#define MPJC_DIAGO 1 +#define MPJC_BUTTON1 2 +#define MPJC_BUTTON2 3 + +// Movement Extension structure +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct MoveExt { + CMvt* meMvt; // Object +} MoveExt; +typedef MoveExt * LPMOVEEXT; + +// Movement Structure +// ~~~~~~~~~~~~~~~~~~ +typedef struct MvtHdr { + DWORD mvhModuleNameOffset; + DWORD mvhID; + DWORD mvhDataOffset; + DWORD mvhDataSize; +} MvtHdr; + +typedef struct MovementTable +{ + DWORD mvtNMvt; // Number of movements + MvtHdr mvtHdr[1]; +} MovementTable; +typedef MovementTable * LPMVTTABLE; + +#define MVTOPT_8DIR_STICK 0x01 // Stick to obstacles (build 249, 8-direction mvt), allows the user to choose between behavior of b247 (avoid obstacles) and b248 (stick to obstacles) + +typedef struct tagMV { + WORD mvControl; // Who controls the object + WORD mvType; // Type of movement + BYTE mvMove; // Move at start? + BYTE mvOpt; // Options + BYTE mvFree1; + BYTE mvFree2; + DWORD mvDirAtStart; + union { + MoveMouse mm; + MoveGeneric mg; + MoveBall mb; + MoveTaped mt; + MoveRace mr; + MovePlatform mp; + MoveExt me; + } mu; +} Movement; +typedef Movement * LPMOVEMENT; + +#ifndef IN_KPX + +// COMMON CONDITIONS FOR NORMAL OBJECTS +////////////////////////////////////////// +#define EVENTS_EXTBASE 80 + +#define CND_EXTISSTRIKEOUT (-40<<8) +#define CND_EXTISUNDERLINE (-39<<8) +#define CND_EXTISITALIC (-38<<8) +#define CND_EXTISBOLD (-37<<8) +#define CND_EXTCMPVARSTRING (-36<<8) +#define CNDL_EXTCMPVARSTRING (-36<<16) +#define CND_EXTPATHNODENAME (-35<<8) +#define CNDL_EXTPATHNODENAME (-35<<16) +#define CND_EXTCHOOSE (-34<<8) +#define CND_EXTNOMOREOBJECT (-33<<8) +#define CNDL_EXTNOMOREOBJECT (-33<<16) +#define CND_EXTNUMOFOBJECT (-32<<8) +#define CND_EXTNOMOREZONE (-31<<8) +#define CND_EXTNUMBERZONE (-30<<8) +#define CND_EXTSHOWN (-29<<8) +#define CND_EXTHIDDEN (-28<<8) +#define CND_EXTCMPVAR (-27<<8) +#define CNDL_EXTCMPVAR (-27<<16) +#define CND_EXTCMPVARFIXED (-26<<8) +#define CND_EXTFLAGSET (-25<<8) +#define CND_EXTFLAGRESET (-24<<8) +#define CND_EXTISCOLBACK (-23<<8) +#define CND_EXTNEARBORDERS (-22<<8) +#define CND_EXTENDPATH (-21<<8) +#define CNDL_EXTENDPATH (-21<<16) +#define CND_EXTPATHNODE (-20<<8) +#define CNDL_EXTPATHNODE (-20<<16) +#define CND_EXTCMPACC (-19<<8) +#define CND_EXTCMPDEC (-18<<8) +#define CND_EXTCMPX (-17<<8) +#define CND_EXTCMPY (-16<<8) +#define CND_EXTCMPSPEED (-15<<8) +#define CND_EXTCOLLISION (-14<<8) +#define CNDL_EXTCOLLISION (-14<<16) +#define CND_EXTCOLBACK (-13<<8) +#define CNDL_EXTCOLBACK (-13<<16) +#define CND_EXTOUTPLAYFIELD (-12<<8) +#define CNDL_EXTOUTPLAYFIELD (-12<<16) +#define CND_EXTINPLAYFIELD (-11<<8) +#define CNDL_EXTINPLAYFIELD (-11<<16) +#define CND_EXTISOUT (-10<<8) +#define CNDL_EXTISOUT (-10<<16) +#define CND_EXTISIN (-9 <<8) +#define CNDL_EXTISIN (-9 <<16) +#define CND_EXTFACING (-8 <<8) +#define CND_EXTSTOPPED (-7 <<8) +#define CND_EXTBOUNCING (-6 <<8) +#define CND_EXTREVERSED (-5 <<8) +#define CND_EXTISCOLLIDING (-4 <<8) +#define CNDL_EXTISCOLLIDING (-4 <<16) +#define CND_EXTANIMPLAYING (-3 <<8) +#define CND_EXTANIMENDOF (-2 <<8) +#define CNDL_EXTANIMENDOF (-2 <<16) +#define CND_EXTCMPFRAME (-1 <<8) + +#define ACT_EXTSETPOS (1 <<8) +#define ACT_EXTSETX (2 <<8) +#define ACT_EXTSETY (3 <<8) +#define ACT_EXTSTOP (4 <<8) +#define ACTL_EXTSTOP (4 <<16) +#define ACT_EXTSTART (5 <<8) +#define ACT_EXTSPEED (6 <<8) +#define ACT_EXTMAXSPEED (7 <<8) +#define ACT_EXTWRAP (8 <<8) +#define ACTL_EXTWRAP (8 <<16) +#define ACT_EXTBOUNCE (9 <<8) +#define ACTL_EXTBOUNCE (9 <<16) +#define ACT_EXTREVERSE (10<<8) +#define ACT_EXTNEXTMOVE (11<<8) +#define ACT_EXTPREVMOVE (12<<8) +#define ACT_EXTSELMOVE (13<<8) +#define ACT_EXTLOOKAT (14<<8) +#define ACT_EXTSTOPANIM (15<<8) +#define ACT_EXTSTARTANIM (16<<8) +#define ACT_EXTFORCEANIM (17<<8) +#define ACT_EXTFORCEDIR (18<<8) +#define ACT_EXTFORCESPEED (19<<8) +#define ACTL_EXTFORCESPEED (19<<16) +#define ACT_EXTRESTANIM (20<<8) +#define ACT_EXTRESTDIR (21<<8) +#define ACT_EXTRESTSPEED (22<<8) +#define ACT_EXTSETDIR (23<<8) +#define ACT_EXTDESTROY (24<<8) +#define ACT_EXTSHUFFLE (25<<8) +#define ACTL_EXTSHUFFLE (25<<16) +#define ACT_EXTHIDE (26<<8) +#define ACT_EXTSHOW (27<<8) +#define ACT_EXTDISPLAYDURING (28<<8) +#define ACT_EXTSHOOT (29<<8) +#define ACTL_EXTSHOOT (29<<16) +#define ACT_EXTSHOOTTOWARD (30<<8) +#define ACTL_EXTSHOOTTOWARD (30<<16) +#define ACT_EXTSETVAR (31<<8) +#define ACTL_EXTSETVAR (31<<16) +#define ACT_EXTADDVAR (32<<8) +#define ACTL_EXTADDVAR (32<<16) +#define ACT_EXTSUBVAR (33<<8) +#define ACTL_EXTSUBVAR (33<<16) +#define ACT_EXTDISPATCHVAR (34<<8) +#define ACTL_EXTDISPATCHVAR (34<<16) +#define ACT_EXTSETFLAG (35<<8) +#define ACT_EXTCLRFLAG (36<<8) +#define ACT_EXTCHGFLAG (37<<8) +#define ACT_EXTINKEFFECT (38<<8) +#define ACT_EXTSETSEMITRANSPARENCY (39<<8) +#define ACT_EXTFORCEFRAME (40<<8) +#define ACT_EXTRESTFRAME (41<<8) +#define ACT_EXTSETACCELERATION (42<<8) +#define ACT_EXTSETDECELERATION (43<<8) +#define ACT_EXTSETROTATINGSPEED (44<<8) +#define ACT_EXTSETDIRECTIONS (45<<8) +#define ACT_EXTBRANCHNODE (46<<8) +#define ACT_EXTSETGRAVITY (47<<8) +#define ACT_EXTGOTONODE (48<<8) +#define ACT_EXTSETVARSTRING (49<<8) +#define ACTL_EXTSETVARSTRING (49<<16) +#define ACT_EXTSETFONTNAME (50<<8) +#define ACT_EXTSETFONTSIZE (51<<8) +#define ACT_EXTSETBOLD (52<<8) +#define ACT_EXTSETITALIC (53<<8) +#define ACT_EXTSETUNDERLINE (54<<8) +#define ACT_EXTSETSRIKEOUT (55<<8) +#define ACT_EXTSETTEXTCOLOR (56<<8) +#define ACT_EXTSPRFRONT (57<<8) +#define ACT_EXTSPRBACK (58<<8) +#define ACT_EXTMOVEBEFORE (59<<8) +#define ACT_EXTMOVEAFTER (60<<8) +#define ACT_EXTMOVETOLAYER (61<<8) +#define ACT_EXTADDTODEBUGGER (62<<8) +#define ACT_EXTSETEFFECT (63<<8) +#define ACT_EXTSETEFFECTPARAM (64<<8) +#define ACT_EXTSETALPHACOEF (65<<8) +#define ACT_EXTSETRGBCOEF (66<<8) +#define ACT_EXTSETEFFECTPARAMTEXTURE (67<<8) + +#define EXP_EXTYSPR ( 1<<8) +#define EXP_EXTISPR ( 2<<8) +#define EXP_EXTSPEED ( 3<<8) +#define EXP_EXTACC ( 4<<8) +#define EXP_EXTDEC ( 5<<8) +#define EXP_EXTDIR ( 6<<8) +#define EXP_EXTXLEFT ( 7<<8) +#define EXP_EXTXRIGHT ( 8<<8) +#define EXP_EXTYTOP ( 9<<8) +#define EXP_EXTYBOTTOM (10<<8) +#define EXP_EXTXSPR (11<<8) +#define EXP_EXTIDENTIFIER (12<<8) +#define EXP_EXTFLAG (13<<8) +#define EXP_EXTNANI (14<<8) +#define EXP_EXTNOBJECTS (15<<8) +#define EXP_EXTVAR (16<<8) +#define EXPL_EXTVAR (16<<16) +#define EXP_EXTGETSEMITRANSPARENCY (17<<8) +#define EXP_EXTNMOVE (18<<8) +#define EXP_EXTVARSTRING (19<<8) +#define EXPL_EXTVARSTRING (19<<16) +#define EXP_EXTGETFONTNAME (20<<8) +#define EXP_EXTGETFONTSIZE (21<<8) +#define EXP_EXTGETFONTCOLOR (22<<8) +#define EXP_EXTGETLAYER (23<<8) +#define EXP_EXTGETGRAVITY (24<<8) +#define EXP_EXTXAP (25<<8) +#define EXP_EXTYAP (26<<8) +#define EXP_EXTALPHACOEF (27<<8) +#define EXP_EXTRGBCOEF (28<<8) +#define EXP_EXTEFFECTPARAM (29<<8) +#define EXP_EXTVARBYINDEX (30<<8) +#define EXP_EXTVARSTRINGBYINDEX (31<<8) + +// TEXT Conditions / Actions +//////////////////////////////////////////// +#define ACT_STRDESTROY (( (EVENTS_EXTBASE+0)<<8)|3) +#define ACT_STRDISPLAY (( (EVENTS_EXTBASE+1)<<8)|3) +#define ACT_STRDISPLAYDURING (( (EVENTS_EXTBASE+2)<<8)|3) +#define ACT_STRSETCOLOUR (( (EVENTS_EXTBASE+3)<<8)|3) +#define ACT_STRSET (( (EVENTS_EXTBASE+4)<<8)|3) +#define ACT_STRPREV (( (EVENTS_EXTBASE+5)<<8)|3) +#define ACT_STRNEXT (( (EVENTS_EXTBASE+6)<<8)|3) +#define ACT_STRDISPLAYSTRING (( (EVENTS_EXTBASE+7)<<8)|3) +#define ACT_STRSETSTRING (( (EVENTS_EXTBASE+8)<<8)|3) +#define EXP_STRNUMBER (( (EVENTS_EXTBASE+0)<<8)|3) +#define EXP_STRGETCURRENT (( (EVENTS_EXTBASE+1)<<8)|3) +#define EXP_STRGETNUMBER (( (EVENTS_EXTBASE+2)<<8)|3) +#define EXP_STRGETNUMERIC (( (EVENTS_EXTBASE+3)<<8)|3) +#define EXP_STRGETNPARA (( (EVENTS_EXTBASE+4)<<8)|3) + +// SPRITES Conditions / Actions +///////////////////////////////////////////// +#define CND_SPRCLICK (((-EVENTS_EXTBASE-1)<<8)|2) +#define ACT_SPRPASTE (((EVENTS_EXTBASE+0)<<8)|2) +#define ACT_SPRFRONT (((EVENTS_EXTBASE+1)<<8)|2) +#define ACT_SPRBACK (((EVENTS_EXTBASE+2)<<8)|2) +#define ACT_SPRADDBKD (((EVENTS_EXTBASE+3)<<8)|2) +#define ACT_SPRREPLACECOLOR (((EVENTS_EXTBASE+4)<<8)|2) +#define ACT_SPRSETSCALE (((EVENTS_EXTBASE+5)<<8)|2) +#define ACT_SPRSETSCALEX (((EVENTS_EXTBASE+6)<<8)|2) +#define ACT_SPRSETSCALEY (((EVENTS_EXTBASE+7)<<8)|2) +#define ACT_SPRSETANGLE (((EVENTS_EXTBASE+8)<<8)|2) +#define ACT_SPRLOADFRAME (((EVENTS_EXTBASE+9)<<8)|2) +#define ACTL_SPRLOADFRAME (((EVENTS_EXTBASE+9)<<16)|2) +#define EXP_GETRGBAT (((EVENTS_EXTBASE+0)<<8)|2) +#define EXP_GETSCALEX (((EVENTS_EXTBASE+1)<<8)|2) +#define EXP_GETSCALEY (((EVENTS_EXTBASE+2)<<8)|2) +#define EXP_GETANGLE (((EVENTS_EXTBASE+3)<<8)|2) + +// COUNTERS Conditions / Actions +////////////////////////////////////////////// +#define CND_CCOUNTER (((-EVENTS_EXTBASE-1)<<8)|7) +#define ACT_CSETVALUE (( (EVENTS_EXTBASE+0)<<8)|7) +#define ACT_CADDVALUE (( (EVENTS_EXTBASE+1)<<8)|7) +#define ACT_CSUBVALUE (( (EVENTS_EXTBASE+2)<<8)|7) +#define ACT_CSETMIN (( (EVENTS_EXTBASE+3)<<8)|7) +#define ACT_CSETMAX (( (EVENTS_EXTBASE+4)<<8)|7) +#define ACT_CSETCOLOR1 (( (EVENTS_EXTBASE+5)<<8)|7) +#define ACT_CSETCOLOR2 (( (EVENTS_EXTBASE+6)<<8)|7) +#define EXP_CVALUE (( (EVENTS_EXTBASE+0)<<8)|7) +#define EXP_CGETMIN (( (EVENTS_EXTBASE+1)<<8)|7) +#define EXP_CGETMAX (( (EVENTS_EXTBASE+2)<<8)|7) +#define EXP_CGETCOLOR1 (( (EVENTS_EXTBASE+3)<<8)|7) +#define EXP_CGETCOLOR2 (( (EVENTS_EXTBASE+4)<<8)|7) + +// QUESTIONS Conditions / Actions +/////////////////////////////////////////////// +#define CND_QEQUAL (((-EVENTS_EXTBASE-3)<<8)|4) +#define CNDL_QEQUAL (((-EVENTS_EXTBASE-3)<<16)|4) +#define CND_QFALSE (((-EVENTS_EXTBASE-2)<<8)|4) +#define CNDL_QFALSE (((-EVENTS_EXTBASE-2)<<16)|4) +#define CND_QEXACT (((-EVENTS_EXTBASE-1)<<8)|4) +#define CNDL_QEXACT (((-EVENTS_EXTBASE-1)<<16)|4) +#define ACT_QASK (( (EVENTS_EXTBASE+0)<<8)|4) + + +// Formatted text Conditions / actions / expressions +////////////////////////////////////////////////////////////////// +#define ACT_RTFSETXPOS (((EVENTS_EXTBASE+0)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSETYPOS (((EVENTS_EXTBASE+1)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSETZOOM (((EVENTS_EXTBASE+2)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_CLEAR (((EVENTS_EXTBASE+3)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_WORDSTRONCE (((EVENTS_EXTBASE+4)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_WORDSTRNEXT (((EVENTS_EXTBASE+5)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_WORDSTRALL (((EVENTS_EXTBASE+6)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_WORD (((EVENTS_EXTBASE+7)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_LINE (((EVENTS_EXTBASE+8)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_PARAGRAPH (((EVENTS_EXTBASE+9)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_PAGE (((EVENTS_EXTBASE+10)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_ALL (((EVENTS_EXTBASE+11)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_RANGE (((EVENTS_EXTBASE+12)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_BOOKMARK (((EVENTS_EXTBASE+13)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSETFOCUSWORD (((EVENTS_EXTBASE+14)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHT_OFF (((EVENTS_EXTBASE+15)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTTEXT_COLOR (((EVENTS_EXTBASE+16)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTTEXT_BOLD (((EVENTS_EXTBASE+17)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTTEXT_ITALIC (((EVENTS_EXTBASE+18)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTTEXT_UNDERL (((EVENTS_EXTBASE+19)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTTEXT_OUTL (((EVENTS_EXTBASE+20)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTBACK_COLOR (((EVENTS_EXTBASE+21)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTBACK_RECT (((EVENTS_EXTBASE+22)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTBACK_MARKER (((EVENTS_EXTBASE+23)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTBACK_HATCH (((EVENTS_EXTBASE+24)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTBACK_INVERSE (((EVENTS_EXTBASE+25)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFDISPLAY (((EVENTS_EXTBASE+26)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSETFOCUSPREV (((EVENTS_EXTBASE+27)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSETFOCUSNEXT (((EVENTS_EXTBASE+28)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFREMOVEFOCUS (((EVENTS_EXTBASE+29)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFAUTOON (((EVENTS_EXTBASE+30)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFAUTOOFF (((EVENTS_EXTBASE+31)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFINSERTSTRING (((EVENTS_EXTBASE+32)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFLOADTEXT (((EVENTS_EXTBASE+33)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFINSERTTEXT (((EVENTS_EXTBASE+34)<<8)|(OBJ_RTF&0x00FF)) + + +#define EXP_RTFXPOS (((EVENTS_EXTBASE+0)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFYPOS (((EVENTS_EXTBASE+1)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFSXPAGE (((EVENTS_EXTBASE+2)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFSYPAGE (((EVENTS_EXTBASE+3)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFZOOM (((EVENTS_EXTBASE+4)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFWORDMOUSE (((EVENTS_EXTBASE+5)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFWORDXY (((EVENTS_EXTBASE+6)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFWORD (((EVENTS_EXTBASE+7)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFXWORD (((EVENTS_EXTBASE+8)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFYWORD (((EVENTS_EXTBASE+9)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFSXWORD (((EVENTS_EXTBASE+10)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFSYWORD (((EVENTS_EXTBASE+11)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFLINEMOUSE (((EVENTS_EXTBASE+12)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFLINEXY (((EVENTS_EXTBASE+13)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFXLINE (((EVENTS_EXTBASE+14)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFYLINE (((EVENTS_EXTBASE+15)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFSXLINE (((EVENTS_EXTBASE+16)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFSYLINE (((EVENTS_EXTBASE+17)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFPARAMOUSE (((EVENTS_EXTBASE+18)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFPARAXY (((EVENTS_EXTBASE+19)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFXPARA (((EVENTS_EXTBASE+20)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFYPARA (((EVENTS_EXTBASE+21)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFSXPARA (((EVENTS_EXTBASE+22)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFSYPARA (((EVENTS_EXTBASE+23)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFXWORDTEXT (((EVENTS_EXTBASE+24)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFYWORDTEXT (((EVENTS_EXTBASE+25)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFXLINETEXT (((EVENTS_EXTBASE+26)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFYLINETEXT (((EVENTS_EXTBASE+27)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFXPARATEXT (((EVENTS_EXTBASE+28)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFYPARATEXT (((EVENTS_EXTBASE+29)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFMEMSIZE (((EVENTS_EXTBASE+30)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFGETFOCUSWORD (((EVENTS_EXTBASE+31)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFGETHYPERLINK (((EVENTS_EXTBASE+32)<<8)|(OBJ_RTF&0x00FF)) + +#define CND_CCAISPAUSED (((-EVENTS_EXTBASE-4)<<8)|(OBJ_CCA&0x00FF)) +#define CND_CCAISVISIBLE (((-EVENTS_EXTBASE-3)<<8)|(OBJ_CCA&0x00FF)) +#define CND_CCAAPPFINISHED (((-EVENTS_EXTBASE-2)<<8)|(OBJ_CCA&0x00FF)) +#define CNDL_CCAAPPFINISHED (((-EVENTS_EXTBASE-2)<<16)|(OBJ_CCA&0xFFFF)) +#define CND_CCAFRAMECHANGED (((-EVENTS_EXTBASE-1)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCARESTARTAPP (((EVENTS_EXTBASE+0)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCARESTARTFRAME (((EVENTS_EXTBASE+1)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCANEXTFRAME (((EVENTS_EXTBASE+2)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCAPREVIOUSFRAME (((EVENTS_EXTBASE+3)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCAENDAPP (((EVENTS_EXTBASE+4)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCANEWAPP (((EVENTS_EXTBASE+5)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCAJUMPFRAME (((EVENTS_EXTBASE+6)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCASETGLOBALVALUE (((EVENTS_EXTBASE+7)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCASHOW (((EVENTS_EXTBASE+8)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCAHIDE (((EVENTS_EXTBASE+9)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCASETGLOBALSTRING (((EVENTS_EXTBASE+10)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCAPAUSEAPP (((EVENTS_EXTBASE+11)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCARESUMEAPP (((EVENTS_EXTBASE+12)<<8)|(OBJ_CCA&0x00FF)) +#define EXP_CCAGETFRAMENUMBER (((EVENTS_EXTBASE+0)<<8)|(OBJ_CCA&0x00FF)) +#define EXP_CCAGETGLOBALVALUE (((EVENTS_EXTBASE+1)<<8)|(OBJ_CCA&0x00FF)) +#define EXP_CCAGETGLOBALSTRING (((EVENTS_EXTBASE+2)<<8)|(OBJ_CCA&0x00FF)) + +#endif // IN_KPX + +/////////////////////////////////////////////////////////////////////// +// +// DEFINITION OF THE DIFFERENT PARAMETERS +// +/////////////////////////////////////////////////////////////////////// + +// -------------------------------- Objects +// W-Offset list OI +// W-Number +// W-TYPE *** Version > FVERSION_NEWOBJECTS +#define PARAM_OBJECT 1 +#define PS_OBJ 6 + +// -------------------------------- Time +// L-Timer +// L-Equivalent loops +#define PARAM_TIME 2 +#define PS_TIM 8 + +// -------------------------------- Border +// W-border +#define PARAM_BORDER 3 +#define PS_BOR 2 +#define BORDER_LEFT 1 +#define BORDER_RIGHT 2 +#define BORDER_TOP 4 +#define BORDER_BOTTOM 8 +#define BORDER_ALL 15 + +// -------------------------------- Direction +// W-direction +#define PARAM_DIRECTION 4 +#define PS_DIR 2 + +// -------------------------------- Integer +// W-shorteger (or base) +// W-nothing (or maximum) +#define PARAM_INTEGER 5 +#define PS_INT 4 + +// -------------------------------- Sample +#define MAX_SOUNDNAME 64 +#define PSOUNDFLAG_UNINTERRUPTABLE 0x0001 +#define PSOUNDFLAG_BAD 0x0002 +#define PSOUNDFLAG_IPHONE_AUDIOPLAYER 0x0004 +#define PSOUNDFLAG_IPHONE_OPENAL 0x0008 + +typedef struct tagSSNDA { + short sndHandle; + short sndFlags; + char sndName[MAX_SOUNDNAME]; + } SoundParamA; +typedef struct tagSSNDW { + short sndHandle; + short sndFlags; + WCHAR sndName[MAX_SOUNDNAME]; + } SoundParamW; +typedef SoundParamA * LPSNDA; +typedef SoundParamW * LPSNDW; + +#define PARAM_SAMPLE 6 +#ifdef _UNICODE +#define PS_SAM sizeof(SoundParamW) +#define LPSND LPSNDW +#else +#define PS_SAM sizeof(SoundParamA) +#define LPSND LPSNDA +#endif + +// -------------------------------- Music +#define PARAM_MUSIC 7 +#ifdef _UNICODE +#define PS_MUS sizeof(SoundParamW) +#else +#define PS_MUS sizeof(SoundParamA) +#endif + + +// POSITION PARAM Structure +// ~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagPPA { + short posOINUMParent; //0 + short posFlags; + short posX; //4 + short posY; + short posSlope; //8 + short posAngle; + long posDir; //12 + ITEMTYPE posTypeParent; //16 + short posOiList; //18 + short posLayer; //20 + } PositionParam; +typedef PositionParam * LPPOS; + +// CREATE PARAM Structure +// ~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagCDP { + PositionParam cdpPos; // Position structure + HFII cdpHFII; // FrameItemInstance number + OINUM cdpOi; // OI of the object to create +// DWORD cdpFII; + DWORD cdpFree; + } CreateDuplicateParam; +typedef CreateDuplicateParam * LPCDP; + +// SHOOT PARAM Structure, should be identical to CREATE PARAM ! +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagSHT { + CreateDuplicateParam shtCdp; + short shtSpeed; // Speed + } ShootParam; +typedef ShootParam * LPSHT; + +#define CPF_DIRECTION 0x0001 +#define CPF_ACTION 0x0002 +#define CPF_INITIALDIR 0x0004 +#define CPF_DEFAULTDIR 0x0008 + + +// -------------------------------- Create +#define PARAM_CREATE 9 +#define PS_CRE sizeof(CreateDuplicateParam) + +// -------------------------------- Animation +// W-Number +// B-Name +#define PARAM_ANIMATION 10 +#define PS_ANI 32 + +// -------------------------------- Nothing +// W- +#define PARAM_NOP 11 +#define PS_NOP 2 + +// -------------------------------- Player +// W- +#define PARAM_PLAYER 12 +#define PS_PLA 2 + +// -------------------------------- Every +// L-delay +// L-compteur +#define PARAM_EVERY 13 +#define PS_EVE 8 + +// -------------------------------- Virtual Key +// W- VK_Code +#define PARAM_KEY 14 +#define PS_KEY 2 + +// -------------------------------- Speed= integer +// Expression +#define PARAM_SPEED 15 + +// -------------------------------- Position +// W- Direction +#define PARAM_POSITION 16 +#define PS_POS sizeof(PositionParam) + +// -------------------------------- Joystick Direcion +// W- Direction +#define PARAM_JOYDIRECTION 17 +#define PS_JOY 2 + +// -------------------------------- Shoot param + +#define PARAM_SHOOT 18 +#define PS_SHT sizeof(ShootParam) + +// -------------------------------- Playfield Zone +#define PARAM_ZONE 19 +#define PS_ZNE 8 + +// -------------------------------- System object position +// W- Direction +#define PARAM_SYSCREATE 21 +#define PS_SSC sizeof(CreateDuplicateParam) + +// -------------------------------- Expression +// W0- Id parametre originel +// W1- 0 (au moins!) +#define PARAM_EXPRESSION 22 +#define PS_EXP 14 + +// -------------------------------- Comparaison +// W0- Id comparaison +// W1- 0 (au moins!) +#define PARAM_COMPARAISON 23 + +// -------------------------------- Text color +// L0- RGB +// L0- Identificateur! +#define PARAM_COLOUR 24 +#define PS_COL 8 + +// -------------------------------- Work buffer +// L0- +#define PARAM_BUFFER4 25 +#define PS_BU4 4 + +// -------------------------------- Storyboard frame number +// W0- +#define PARAM_FRAME 26 +#define PS_FRA 2 + +// -------------------------------- Number of loops for a sample +#define PARAM_SAMLOOP 27 +#define PS_SLOOP 2 +// -------------------------------- Number of loops for a music +#define PARAM_MUSLOOP 28 +#define PS_MLOOP 2 +// -------------------------------- Direction +#define PARAM_NEWDIRECTION 29 +#define PS_NDIR 4 + +// -------------------------------- Text number +#define PARAM_TEXTNUMBER 31 +#define PS_TXN 4 + +// -------------------------------- Click definition +#define PARAM_CLICK 32 +#define PS_KLK 4 +#define PARAMCLICK_MASK 0x00FF +#define PARAMCLICK_DOUBLE 0x0100 + +// -------------------------------- External program +#define PARAM_PROGRAM 33 +typedef struct tagPRGA { + short prgFlags; // Default flags + char prgPath[_MAX_PATH]; // Name of the program + char prgCommand[108]; // Command line + } prgParamA; +typedef prgParamA * LPPRGA; +typedef struct tagPRGW { + short prgFlags; // Default flags + WCHAR prgPath[_MAX_PATH]; // Name of the program + WCHAR prgCommand[108]; // Command line + } prgParamW; +typedef prgParamW * LPPRGW; +#define PS_PRGA sizeof(prgParamA) +#define PS_PRGW sizeof(prgParamW) +#ifdef _UNICODE +#define prgParam prgParamW +#define PS_PRG sizeof(prgParamW) +#define LPPRG LPPRGW +#else +#define prgParam prgParamA +#define PS_PRG sizeof(prgParamA) +#define LPPRG LPPRGA +#endif + +#define PRGFLAGS_WAIT 0x0001 +#define PRGFLAGS_HIDE 0x0002 + +// -------------------------------- Global variable number +#define OLDPARAM_VARGLO 34 +//#define PS_VGLO 4 + +// -------------------------------- Condition sample (no flags) +// W-Number +// W-Flags +// W-Loops +// B-Name +#define PARAM_CNDSAMPLE 35 +// -------------------------------- Condition Music (no flags) +// W-Number +// W-Flags +// W-Loops +// B-Name +#define PARAM_CNDMUSIC 36 +// -------------------------------- Event editor remark +#define PARAM_REMARK 37 +typedef struct tagREMA { + LOGFONTV1A remLogFont; // Font + COLORREF remColorFont; // Text color + COLORREF remColorBack; // Background color + short remAlign; // Alignement flags + WORD remTextId; // Text number in the buffer + char remStyle[40]; // Style + } paramRemarkA; +typedef paramRemarkA* LPRMKA; +typedef struct tagREMW { + LOGFONTV1W remLogFont; // Font + COLORREF remColorFont; // Text color + COLORREF remColorBack; // Background color + short remAlign; // Alignement flags + WORD remTextId; // Text number in the buffer + WCHAR remStyle[40]; // Style + } paramRemarkW; +typedef paramRemarkW* LPRMKW; +#ifdef _UNICODE +#define PS_REM sizeof(paramRemarkW) +#define LPRMK LPRMKW +#else +#define PS_REM sizeof(paramRemarkA) +#define LPRMK LPRMKA +#endif + +// -------------------------------- Group title +#define PARAM_GROUP 38 +#define GROUP_MAXTITLE 80 +#define GROUP_MAXPASSWORD 16 +typedef struct tagGRPW { + short grpFlags; // Active / Unactive? + short grpId; // Group identifier + WCHAR grpTitle[GROUP_MAXTITLE]; // Title + WCHAR grpPassword[GROUP_MAXPASSWORD]; // Protection + DWORD grpChecksum; // Checksum + } paramGroupW; +typedef paramGroupW* LPGRPW; +typedef struct tagGRPA { + short grpFlags; // Active / Unactive? + short grpId; // Group identifier + char grpTitle[GROUP_MAXTITLE]; // Title + char grpPassword[GROUP_MAXPASSWORD]; // Protection + DWORD grpChecksum; // Checksum + } paramGroupA; +typedef paramGroupA* LPGRPA; +typedef struct tagOLDGRP { + short grpFlags; + short grpId; + char grpTitle[GROUP_MAXTITLE]; + } paramGroupV0; +#define PS_GRPA sizeof(paramGroupA) +#define PS_GRPW sizeof(paramGroupW) +#ifdef _UNICODE +#define PS_GRP sizeof(paramGroupW) +#define LPGRP LPGRPW +#define GETEVPGRP(evpPtr) (LPGRPW)&evpPtr->evpW.evpW0 +#else +#define PS_GRP sizeof(paramGroupA) +#define LPGRP LPGRPA +#define GETEVPGRP(evpPtr) (LPGRPA)&evpPtr->evpW.evpW0 +#endif + +#define GRPFLAGS_INACTIVE 0x0001 +#define GRPFLAGS_CLOSED 0x0002 +#define GRPFLAGS_PARENTINACTIVE 0x0004 +#define GRPFLAGS_GROUPINACTIVE 0x0008 +#define GRPFLAGS_UNICODE 0x0010 +//#define GRPFLAGS_FADEIN 0x0004 +//#define GRPFLAGS_FADEOUT 0x0008 +#define GRPFLAGS_GLOBAL 0x0010 +// Pour l'assemblage +typedef struct tagGRPLIST { + DWORD glEvg; + short glId; + } groupList; +typedef groupList * LPGL; + +// -------------------------------- A pointer to a group +#define PARAM_GROUPOINTER 39 +#define PS_GPT 6 +// L - Offset dans programme +// W - Identifier + +// -------------------------------- A pointner to a filename +#define PARAM_FILENAME 40 +#define PS_FILEN _MAX_PATH +// B nom de fichier... + +// -------------------------------- String pointer +#define PARAM_STRING 41 +#define PS_STR 2 +// B string + +// -------------------------------- Time +// L-Timer +// L-Loops +// W-Comparaison +#define PARAM_CMPTIME 42 +#define PS_CTIM 10 + +// --------------------------------- PASTE SPRITE +// W- Flags +// W- Security +#define PARAM_PASTE 43 +#define PS_PASTE 4 + +// -------------------------------- MOUSEKEY VIRTUAL +// W- VK_Code +#define PARAM_VMKEY 44 +#define PS_VMKEY 2 + +// -------------------------------- String expression +// W0- Id original parameter +// W1- 0 (at least!) +#define PARAM_EXPSTRING 45 + +// -------------------------------- String comparaison +// W0- Id comparaison +// W1- 0 (at least!) +#define PARAM_CMPSTRING 46 + +// -------------------------------- Ink effect +// W0- Id effect +// W1- Effet parameter +// L1- Free +#define PARAM_INKEFFECT 47 +#define PS_INK 8 + +// -------------------------------- Menu +// L0- Identifier +// L1- Security +#define PARAM_MENU 48 +#define PS_MENU 8 + +// Access to named variables +#define PARAM_VARGLOBAL 49 +#define PS_VARGLOBAL 4 +#define PARAM_ALTVALUE 50 +#define PS_ALTVALUE 4 +#define PARAM_FLAG 51 +#define PS_FLAG 4 + +// With expressions +#define PARAM_VARGLOBAL_EXP 52 +#define PS_VARGLOBAL_EXP PS_EXP +#define PARAM_ALTVALUE_EXP 53 +#define PS_ALTVALUE_EXP PS_EXP +#define PARAM_FLAG_EXP 54 +#define PS_FLAG_EXP PS_EXP + +// -------------------------------- Extensions parameters +#define PARAM_EXTENSION 55 +#define PARAM_EXTMAXSIZE 512 +typedef struct +{ + short pextSize; + short pextType; + short pextCode; + char pextData[2]; +} paramExt; +#define PARAM_EXTSIZE 12 +#define PARAM_EXTBASE 1000 + +// -------------------------------- Direction +#define PARAM_8DIRECTIONS 56 +#define PS_8DIR 4 + +// -------------------------------- Movement number +#define MAX_MVTNAME 32 +typedef struct tagMvtParamA { + short mvtNumber; + char mvtName[MAX_MVTNAME]; + } MvtParamA; +typedef MvtParamA * LPMVTPA; +typedef struct tagMvtParamW { + short mvtNumber; + WCHAR mvtName[MAX_MVTNAME]; + } MvtParamW; +typedef MvtParamW * LPMVTPW; + +#define PARAM_MVT 57 +#ifdef _UNICODE +#define PS_MVT sizeof(MvtParamW) +#define LPMVTP LPMVTPW +#else +#define PS_MVT sizeof(MvtParamA) +#define LPMVTP LPMVTPA +#endif + +// Access to renamed variables +#define PARAM_STRINGGLOBAL 58 +#define PS_STRINGGLOBAL 4 +#define PARAM_STRINGGLOBAL_EXP 59 +#define PS_STRINGGLOBAL_EXP PS_EXP + +// -------------------------------- External program II +#define PARAM_PROGRAM2 60 +typedef struct tagPRG2 { + short prgFlags; // Default flags + } prgParam2; +typedef prgParam2 * LPPRG2; +#define PS_PRG2 sizeof(prgParam2) + +// -------------------------------- Alterable strings +#define PARAM_ALTSTRING 61 +#define PS_ALTSTRING 4 +#define PARAM_ALTSTRING_EXP 62 +#define PS_ALTSTRING_EXP PS_EXP + +// -------------------------------- A pointer to a filename, version 2 +#define PARAM_FILENAME2 63 +#define PS_FILEN _MAX_PATH +// B nom de fichier... + +// -------------------------------- The name of an effect +#define PARAM_EFFECT 64 +#define PS_EFFECT 2 +// B name of the effect + + +// STRUCTURE FOR FAST LOOPS +/////////////////////////////////////////////////////////////////////// +typedef struct tagFL +{ + LPTSTR next; + TCHAR name[64]; + WORD flags; + long index; +} FastLoop; +typedef FastLoop * LPFL; + +#define MAX_FASTLOOPNAME 64 +#define FLFLAG_STOP 0x0001 + +/////////////////////////////////////////////////////////////// +// +// DEBUGGER +// +/////////////////////////////////////////////////////////////// +#define DBCOMMAND_RUNNING 0 +#define DBCOMMAND_TORUN 1 +#define DBCOMMAND_PAUSE 2 +#define DBCOMMAND_TOPAUSE 3 +#define DBCOMMAND_STEP 4 + +// TREE identification +enum +{ + DBTYPE_SYSTEM, + DBTYPE_OBJECT, + DBTYPE_HO, + DBTYPE_MOVEMENT, + DBTYPE_ANIMATION, + DBTYPE_VALUES, + DBTYPE_COUNTER, + DBTYPE_SCORE, + DBTYPE_LIVES, + DBTYPE_TEXT, + DBTYPE_EXTENSION +}; + +// Genric entries in the tree +enum +{ + DB_END=0xFFFF, + DB_PARENT=0x8000 +}; +#define DB_EDITABLE 0x80 + +// Communication buffer size +#define DB_BUFFERSIZE 256 + +#define DB_MAXGLOBALVALUES 1000 // Maximum number of global values displayed in the debugger +#define DB_MAXGLOBALSTRINGS 1000 + +// System tree entries +enum +{ + DB_SYSTEM, + DB_TIMER, + DB_FPS, + DB_FRAMENUMBER, + DB_GLOBALVALUE, + DB_GLOBALSTRING, + DB_GVALUE, + DB_GSTRING, +}; +// Headerobject tree entries +enum +{ + DB_XY, + DB_SIZE +}; + +// Movements tree entries +enum +{ + DB_MOVEMENTS, + DB_MVTTYPE, + DB_SPEED, + DB_DIRECTION, + DB_ACCELERATION, + DB_DECELERATION +}; + +// Animations tree entries +enum +{ + DB_ANIMATIONS, + DB_ANIMNAME, + DB_FRAME +}; + +// Values tree entries +enum +{ + DB_VALUE, + DB_VALUE0, + DB_VALUE1, + DB_VALUE2, + DB_VALUE3, + DB_VALUE4, + DB_VALUE5, + DB_VALUE6, + DB_VALUE7, + DB_VALUE8, + DB_VALUE9, + DB_VALUE10, + DB_VALUE11, + DB_VALUE12, + DB_VALUE13, + DB_VALUE14, + DB_VALUE15, + DB_VALUE16, + DB_VALUE17, + DB_VALUE18, + DB_VALUE19, + DB_VALUE20, + DB_VALUE21, + DB_VALUE22, + DB_VALUE23, + DB_VALUE24, + DB_VALUE25, + DB_ALTSTRING, + DB_ALTSTRING0, + DB_ALTSTRING1, + DB_ALTSTRING2, + DB_ALTSTRING3, + DB_ALTSTRING4, + DB_ALTSTRING5, + DB_ALTSTRING6, + DB_ALTSTRING7, + DB_ALTSTRING8, + DB_ALTSTRING9, + DB_FLAGS, + DB_FLAG0, + DB_FLAG1, + DB_FLAG2, + DB_FLAG3, + DB_FLAG4, + DB_FLAG5, + DB_FLAG6, + DB_FLAG7, + DB_FLAG8, + DB_FLAG9, + DB_FLAG10, + DB_FLAG11, + DB_FLAG12, + DB_FLAG13, + DB_FLAG14, + DB_FLAG15, + DB_FLAG16, + DB_FLAG17, + DB_FLAG18, + DB_FLAG19, + DB_FLAG20, + DB_FLAG21, + DB_FLAG22, + DB_FLAG23, + DB_FLAG24, + DB_FLAG25, + DB_FLAG26, + DB_FLAG27, + DB_FLAG28, + DB_FLAG29, + DB_FLAG30, + DB_FLAG31 +}; +enum +{ + DB_COUNTERVALUE, + DB_COUNTERMIN, + DB_COUNTERMAX +}; +enum +{ + DB_SCOREVALUE +}; +enum +{ + DB_LIVESVALUE +}; +enum +{ + DB_TEXTVALUE +}; + +#define GETDBPARAMTYPE(a) ((a&0xFF000000)>>24) +#define GETDBPARAMID(a) ((a&0x00FFFF00)>>8) +#define GETDBPARAMCOMMAND(a) (a&0x000000FF) +#define GETDBPARAM(a, b, c) ((a&0xFF)<<24)|((b&0xFFFF)<<8)|(c&0xFF) + +typedef struct +{ + LPSTR pTitle; + int value; + LPSTR pText; + int lText; +} EditDebugInfoA; + +typedef struct +{ + LPWSTR pTitle; + int value; + LPWSTR pText; + int lText; +} EditDebugInfoW; + +#ifdef _UNICODE +#define EditDebugInfo EditDebugInfoW +#else +#define EditDebugInfo EditDebugInfoA +#endif + +/////////////////////////////////////////////////////////////////////// +// +// RUNTIME BUFFER +// +/////////////////////////////////////////////////////////////////////// + +//Modes de demo +enum +{ + DEMONOTHING, + DEMORECORD, + DEMOPLAY, +}; + +typedef void (*ACTIONENDROUTINE)(); + +typedef void (*OBLROUTINE)(headerObject*); +typedef struct tagOBL { + headerObject* oblOffset; + OBLROUTINE oblRoutine; + } objectsList; +typedef objectsList * LPOBL; + +#define GAMEBUFFERS_SIZE (12*1024) +#define GAME_MAXOBJECTS 266 +#define OBJECT_MAX 128L +#define OBJECT_SIZE 256L +#define OBJECT_SHIFT 8 +#define MAX_INTERMEDIATERESULTS 256 +#define STEP_TEMPSTRINGS 64 + +typedef struct tagRH2 { + DWORD rh2OldPlayer; // Previous player entries + DWORD rh2NewPlayer; // Modified player entries + DWORD rh2InputMask; // Inhibated players entries + DWORD rh2InputPlayers; // Valid players entries (mask!) + BYTE rh2MouseKeys; // Mousekey entries + BYTE rh2ActionLoop; // Actions flag + BYTE rh2ActionOn; // Flag are we in actions? + BYTE rh2EnablePick; // Are we in pick for actions? + + int rh2EventCount; // Number of the event + qualToOi* rh2EventQualPos; // ***Position in event objects + headerObject* rh2EventPos; // ***Position in event objects + objInfoList* rh2EventPosOiList; // ***Position in oilist for TYPE exploration + objInfoList* rh2EventPrev; // ***Previous object address + + pev* rh2PushedEvents; // *** + LPBYTE rh2PushedEventsTop; // *** + LPBYTE rh2PushedEventsMax; // *** + int rh2NewPushedEvents; // + + int rh2ActionCount; // Action counter + int rh2ActionLoopCount; // Action loops counter + ACTIONENDROUTINE rh2ActionEndRoutine; // End of action routine + WORD rh2CreationCount; // Number of objects created since beginning of frame + short rh2EventType; + POINT rh2Mouse; // Mouse coordinate + POINT rh2MouseClient; // Mouse coordinates in the window + short rh2CurrentClick; // For click events II + short rh2Free2; + headerObject** rh2ShuffleBuffer; // *** + headerObject** rh2ShufflePos; // *** + int rh2ShuffleNumber; + + POINT rh2MouseSave; // Mouse saving when pause + int rh2PauseCompteur; + DWORD rh2PauseTimer; + UINT rh2PauseVbl; + FARPROC rh2LoopTraceProc; // Debugging routine + FARPROC rh2EventTraceProc; + + } runHeader2; + + +// Flags pour rh3Scrolling +#define RH3SCROLLING_SCROLL 0x0001 +#define RH3SCROLLING_REDRAWLAYERS 0x0002 +#define RH3SCROLLING_REDRAWALL 0x0004 +#define RH3SCROLLING_REDRAWTOTALCOLMASK 0x0008 + +#define GAME_XBORDER 480 +#define GAME_YBORDER 300 + +typedef struct tagRH3 { + + WORD rh3Graine; // random generator seed + WORD rh3Free; // Alignment... + + int rh3DisplayX; // To scroll + int rh3DisplayY; + + long rh3CurrentMenu; // For menu II events + + int rh3WindowSx; // Window size + int rh3WindowSy; + + short rh3CollisionCount; // Collision counter + char rh3DoStop; // Force the test of stop actions + char rh3Scrolling; // Flag: we need to scroll + + int rh3Panic; + + int rh3PanicBase; + int rh3PanicPile; + +// short rh3XBorder_; // Authorised border +// short rh3YBorder_; + int rh3XMinimum; // Object inactivation coordinates + int rh3YMinimum; + int rh3XMaximum; + int rh3YMaximum; + int rh3XMinimumKill; // Object destruction coordinates + int rh3YMinimumKill; + int rh3XMaximumKill; + int rh3YMaximumKill; + + } runHeader3; + +// Extensions +// ~~~~~~~~~~~~~~~~~~~~ +#define KPX_MAXNUMBER 96 +typedef struct tagKPXMSG { + short ( WINAPI * routine) (DWORD, HWND, UINT, WPARAM, LPARAM); + } kpxMsg; +#define KPX_MAXFUNCTIONS 32 +typedef struct tagKPXLIB { + long ( WINAPI * routine) (headerObject*, WPARAM, LPARAM); + } kpxLib; +#define IsRunTimeFunctionPresent(num) (num < KPX_MAXFUNCTIONS && ((LPRH)rdPtr->rHo.hoAdRunHeader)->rh4.rh4KpxFunctions[num].routine != NULL) +#define callRunTimeFunction(rdPtr,num,wParam,lParam) ( ((LPRH)rdPtr->rHo.hoAdRunHeader)->rh4.rh4KpxFunctions[num].routine((LPHO)rdPtr, wParam, lParam) ) +#define callRunTimeFunction2(hoPtr,num,wParam,lParam) ( ((LPRH)hoPtr->hoAdRunHeader)->rh4.rh4KpxFunctions[num].routine(hoPtr, wParam, lParam) ) + +#define RFUNCTION_REHANDLE 0 +#define RFUNCTION_GENERATEEVENT 1 +#define RFUNCTION_PUSHEVENT 2 +#define RFUNCTION_GETSTRINGSPACE_EX 3 +#define RFUNCTION_GETPARAM1 4 +#define RFUNCTION_GETPARAM2 5 +#define RFUNCTION_PUSHEVENTSTOP 6 +#define RFUNCTION_PAUSE 7 +#define RFUNCTION_CONTINUE 8 +#define RFUNCTION_REDISPLAY 9 +#define RFUNCTION_GETFILEINFOS 10 +#define RFUNCTION_SUBCLASSWINDOW 11 +#define RFUNCTION_REDRAW 12 +#define RFUNCTION_DESTROY 13 +#define RFUNCTION_GETSTRINGSPACE 14 +#define RFUNCTION_EXECPROGRAM 15 +#define RFUNCTION_GETOBJECTADDRESS 16 +#define RFUNCTION_GETPARAM 17 +#define RFUNCTION_GETEXPPARAM 18 +#define RFUNCTION_GETPARAMFLOAT 19 +#define RFUNCTION_EDITINT 20 +#define RFUNCTION_EDITTEXT 21 +#define RFUNCTION_CALLMOVEMENT 22 +#define RFUNCTION_SETPOSITION 23 +#define RFUNCTION_GETCALLTABLES 24 + +#define CNC_GetParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0xFFFFFFFF, 0) +#define CNC_GetIntParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0, 0) +#define CNC_GetStringParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0xFFFFFFFF, 0) +#define CNC_GetFloatParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 2, 0) +#define CNC_GetFloatValue(rdPtr, par) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAMFLOAT, par, 0) +#define CNC_GetFirstExpressionParameter(rdPtr, lParam, wParam) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM1, wParam, lParam) +#define CNC_GetNextExpressionParameter(rdPtr, lParam, wParam) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM2, wParam, lParam) + +#define MAX_FRAMERATE 10 + +typedef void (* CALLANIMATIONS) (headerObject*, int); +#define callAnimations(hoPtr, anim) ( (hoPtr->hoAdRunHeader)->rh4.rh4Animations(hoPtr, anim) ) + +typedef DWORD (* CALLDIRATSTART) (headerObject*, DWORD); +#define callDirAtStart(hoPtr, initDir) ( (hoPtr->hoAdRunHeader)->rh4.rh4DirAtStart(hoPtr, initDir) ) + +typedef BOOL (* CALLMOVEIT) (headerObject*); +#define callMoveIt(hoPtr) ( (hoPtr->hoAdRunHeader)->rh4.rh4MoveIt(hoPtr) ) + +#ifdef __cplusplus +typedef BOOL (* CALLAPPROACHOBJECT) (headerObject*, int destX, int destY, int maxX, int maxY, int htFoot, int planCol, int& x, int &y); +#define callApproachObject(x, y, hoPtr, destX, destY, maxX, maxY, htFoot, planCol) ( (hoPtr->hoAdRunHeader)->rh4.rh4ApproachObject(hoPtr, destX, destY, maxX, maxY, htFoot, planCol, x, y) ) +#else +typedef BOOL (* CALLAPPROACHOBJECT) (headerObject*, int destX, int destY, int maxX, int maxY, int htFoot, int planCol, int* x, int *y); +#define callApproachObject(x, y, hoPtr, destX, destY, maxX, maxY, htFoot, planCol) ( (hoPtr->hoAdRunHeader)->rh4.rh4ApproachObject(hoPtr, destX, destY, maxX, maxY, htFoot, planCol, &x, &y) ) +#endif + +typedef void (* CALLCOLLISIONS) (headerObject*); +#define callCollisions(hoPtr) ( (hoPtr->hoAdRunHeader)->rh4.rh4Collisions(hoPtr) ) + +typedef BOOL (* CALLTESTPOSITION) (headerObject*, int x, int y, int htFoot, int planCol, BOOL flag); +#define callTestPosition(hoPtr, x, y, htFoot, planCol) ( (hoPtr->hoAdRunHeader)->rh4.rh4TestPosition(hoPtr, x, y, htFoot, planCol, 0) ) + +typedef BYTE (* CALLGETJOYSTICK) (headerObject*, int); +#define callGetJoystick(hoPtr, player) ( (hoPtr->hoAdRunHeader)->rh4.rh4Joystick(hoPtr, player) ) + +typedef BOOL (* CALLCOLMASKTESTRECT) (headerObject*, int x, int y , int sx, int sy, int nLayer, int plan); +#define callColMaskTestRect(hoPtr, x, y, sx, sy, nLayer, plan) ( (hoPtr->hoAdRunHeader)->rh4.rh4ColMaskTestRect(hoPtr, x, y, sx, sy, nLayer, plan) ) + +typedef BOOL (* CALLCOLMASKTESTPOINT) (headerObject*, int x, int y, int nLayer, int plan); +#define callColMaskTestPoint(hoPtr, x, y, nLayer, plan) ( (hoPtr->hoAdRunHeader)->rh4.rh4ColMaskTestPoint(hoPtr, x, y, nLayer, plan) ) + + +typedef struct tagRH4 { + + kpj* rh4KpxJumps; // Jump table offset + short rh4KpxNumOfWindowProcs; // Number of routines to call + short rh4Free; + kpxMsg rh4KpxWindowProc[KPX_MAXNUMBER]; // Message handle routines + kpxLib rh4KpxFunctions[KPX_MAXFUNCTIONS]; // Available internal routines + CALLANIMATIONS rh4Animations; + CALLDIRATSTART rh4DirAtStart; + CALLMOVEIT rh4MoveIt; + CALLAPPROACHOBJECT rh4ApproachObject; + CALLCOLLISIONS rh4Collisions; + CALLTESTPOSITION rh4TestPosition; + CALLGETJOYSTICK rh4GetJoystick; + CALLCOLMASKTESTRECT rh4ColMaskTestRect; + CALLCOLMASKTESTPOINT rh4ColMaskTestPoint; + + DWORD rh4SaveVersion; + event* rh4ActionStart; // Sauvergarde action courante + int rh4PauseKey; + LPTSTR rh4CurrentFastLoop; + int rh4EndOfPause; + int rh4EventCountOR; // Number of the event for OR conditions + short rh4ConditionsFalse; + short rh4MouseWheelDelta; + int rh4OnMouseWheel; + LPTSTR rh4PSaveFilename; + UINT rh4MusicHandle; + DWORD rh4MusicFlags; + DWORD rh4MusicLoops; + int rh4LoadCount; + short rh4DemoMode; + short rh4SaveFrame; + CDemoRecord* rh4Demo; + int rh4SaveFrameCount; + double rh4MvtTimerCoef; + CIPhoneJoystick* rh4IPhoneJoystick; + CIPhoneAd* rh4IPhoneAd; + char rh4QuitString[32]; // FREE!!!! GREAT! + + + DWORD rh4PickFlags0; // 00-31 + DWORD rh4PickFlags1; // 31-63 + DWORD rh4PickFlags2; // 64-95 + DWORD rh4PickFlags3; // 96-127 + LPDWORD rh4TimerEventsBase; // Timer events base + + short rh4DroppedFlag; + short rh4NDroppedFiles; + LPTSTR rh4DroppedFiles; + LPFL rh4FastLoops; + LPTSTR rh4CreationErrorMessages; + CValue rh4ExpValue1; // New V2 + CValue rh4ExpValue2; + + long rh4KpxReturn; // WindowProc return + LPOBL rh4ObjectCurCreate; + short rh4ObjectAddCreate; + WORD rh4Free10; // For step through : fake key pressed + HINSTANCE rh4Instance; // Application instance + HWND rh4HStopWindow; // STOP window handle + char rh4DoUpdate; // Flag for screen update on first loop + char rh4MenuEaten; // Menu handled in an event? + short rh4Free2; + int rh4OnCloseCount; // For OnClose event + short rh4CursorCount; // Mouse counter + short rh4ScrMode; // Current screen mode + HPALETTE rh4HPalette; // Handle current palette + int rh4VBLDelta; // Number of VBL + DWORD rh4LoopTheoric; // Theorical VBL counter + DWORD rh4EventCount; + drawRoutine* rh4FirstBackDrawRoutine; // Backrgound draw routines list + drawRoutine* rh4LastBackDrawRoutine; // Last routine used + + DWORD rh4ObjectList; // Object list offset + short rh4LastQuickDisplay; // Quick - display list + BYTE rh4CheckDoneInstart; // Build92 to correct start of frame with fade in + BYTE rh4Free0; + mv * rh4Mv; // Yves's data + HCURSOR rh4OldCursor; // Old cursor for Show / HideMouse in Vitalize! mode + headerObject* rh4_2ndObject; // Collision object address + short rh4_2ndObjectNumber; // Number for collisions + short rh4FirstQuickDisplay; // Quick-display object list + int rh4WindowDeltaX; // For scrolling + int rh4WindowDeltaY; + UINT rh4TimeOut; // For time-out! + int rh4MouseXCenter; // To correct CROSOFT bugs! + int rh4MouseYCenter; // To correct CROSOFT bugs! + int rh4TabCounter; // Objects with tabulation + + DWORD rh4AtomNum; // For child window handling + DWORD rh4AtomRd; + DWORD rh4AtomProc; + short rh4SubProcCounter; // To accelerate the windows + short rh4Free3; + + int rh4PosPile; // Expression evaluation pile position + expression* rh4ExpToken; // Current position in expressions + CValue* rh4Results[MAX_INTERMEDIATERESULTS]; // Result pile + long rh4Operators[MAX_INTERMEDIATERESULTS]; // Operators pile + + LPTSTR* rh4PTempStrings; // Debut zone 256 long + int rh4MaxTempStrings; + long rh4Free4[256-2]; // Free buffer + + int rh4NCurTempString; // Pointer on the current string + DWORD rh4FrameRateArray[MAX_FRAMERATE]; // Framerate calculation buffer + int rh4FrameRatePos; // Position in buffer + DWORD rh4FrameRatePrevious; // Previous time + + } runHeader4; + +#define GAMEFLAGS_VBLINDEP 0x0002 +#define GAMEFLAGS_LIMITEDSCROLL 0x0004 +#define GAMEFLAGS_FIRSTLOOPFADEIN 0x0010 +#define GAMEFLAGS_LOADONCALL 0x0020 +#define GAMEFLAGS_REALGAME 0x0040 +#define GAMEFLAGS_PLAY 0x0080 +//#define GAMEFLAGS_FADEIN 0x0080 +//#define GAMEFLAGS_FADEOUT 0x0100 +#define GAMEFLAGS_INITIALISING 0x0200 + +typedef struct RunHeader { + npWin rhIdEditWin; + npWin rhIdMainWin; + npAppli rhIdAppli; + + HWND rhHEditWin; + HWND rhHMainWin; + HWND rhHTopLevelWnd; + + CRunApp* rhApp; // Application info + CRunFrame* rhFrame; // Frame info + + DWORD rhJoystickPatch; // To reroute the joystick + + BYTE rhFree10; // Current movement needs to be stopped + BYTE rhFree12; // Event evaluation flag + BYTE rhNPlayers; // Number of players + BYTE rhMouseUsed; // Players using the mouse + + WORD rhGameFlags; // Game flags + WORD rhFree; // Alignment + DWORD rhPlayer; // Current players entry + + short rhQuit; + short rhQuitBis; // Secondary quit (scrollings) + DWORD rhFree11; // Value to return to the editor + DWORD rhQuitParam; + +// Buffers + int rhNObjects; + int rhMaxObjects; + + DWORD rhFree0; + DWORD rhFree1; + DWORD rhFree2; + DWORD rhFree3; + + int rhNumberOi; // Number of OI in the list + objInfoList* rhOiList; // ObjectInfo list + + LPDWORD rhEvents[NUMBEROF_SYSTEMTYPES+1]; // Events pointers + LPDWORD rhEventLists; // Pointers on pointers list + LPDWORD rhFree8; // Timer pointers + LPDWORD rhEventAlways; // Pointers on events to see at each loop + LPEVG rhPrograms; // Program pointers + OINUM* rhLimitLists; // Movement limitation list + qualToOi* rhQualToOiList; // Conversion qualifier->oilist + + DWORD rhSBuffers; // Buffer size /1024 + LPBYTE rhBuffer; // Position in current buffer + LPBYTE rhFBuffer; // End of current buffer + LPBYTE rhBuffer1; // First buffer + LPBYTE rhBuffer2; // Second buffer + + int rhLevelSx; // Window size + int rhLevelSy; + int rhWindowX; // Start of window in X/Y + int rhWindowY; + + UINT rhVBLDeltaOld; // Number of VBL + UINT rhVBLObjet; // For the objects + UINT rhVBLOld; // For the counter + + int rhEventsSize; + WORD rhMT_VBLStep; // Path movement variables + WORD rhMT_VBLCount; + DWORD rhMT_MoveStep; + + int rhLoopCount; // Number of loops since start of level + UINT rhTimer; // Timer in 1/50 since start of level + UINT rhTimerOld; // For delta calculation + UINT rhTimerDelta; // For delta calculation + + LPEVG rhEventGroup; // Current group + long rhCurCode; // Current event + short rhCurOi; + short rhFree4; // Alignment + long rhCurParam[2]; + short rhCurObjectNumber; // Object number + short rh1stObjectNumber; // Number, for collisions + + long rhOiListPtr; // OI list enumeration + short rhObListNext; // Branch label + + short rhDestroyPos; + long rhFree5; + long rhFree6; + + runHeader2 rh2; // Sub-structure #1 + runHeader3 rh3; // Sub-structure #2 + runHeader4 rh4; // Sub-structure #3 + + LPDWORD rhDestroyList; // Destroy list address + + int rhDebuggerCommand; // Current debugger command + char rhFree13[DB_BUFFERSIZE]; // Buffer libre! + LPVOID rhDbOldHO; + WORD rhDbOldId; + WORD rhFree7; + + objectsList* rhObjectList; // Object list address + + } RunHeader; +typedef RunHeader * fprh; +typedef RunHeader * LPRH; +typedef RunHeader * LPRUNHEADER; + + +/////////////////////////////////////////////////////////////// +// +// RUNTIME OBJECT DEFINITION +// +/////////////////////////////////////////////////////////////// + +#define HOX_INT + +typedef short (WINAPI *HOROUTINE)(headerObject*); + +#ifdef __cplusplus +class headerObject { +public: +#else +#undef headerObject +typedef struct headerObject { +#endif + short hoNumber; // Number of the object + short hoNextSelected; // Selected object list!!! DO NOT CHANGE POSITION!!! + + int hoSize; // Structure size + LPRH hoAdRunHeader; // Run-header address +#ifdef __cplusplus + headerObject* hoAddress; +#else + LPVOID hoAddress; +#endif + HFII hoHFII; // Number of LevObj + OINUM hoOi; // Number of OI + short hoNumPrev; // Same OI previous object + short hoNumNext; // ... next + short hoType; // Type of the object + WORD hoCreationId; // Number of creation + objInfoList* hoOiList; // Pointer to OILIST information + LPDWORD hoEvents; // Pointer to specific events + UINT hoFree0; // Free + LPBYTE hoPrevNoRepeat; // One-shot event handling + LPBYTE hoBaseNoRepeat; + + int hoMark1; // #of loop marker for the events + int hoMark2; + LPTSTR hoMT_NodeName; // Name fo the current node for path movements + + int hoEventNumber; // Number of the event called (for extensions) + int hoFree2; + LPOC hoCommon; // Common structure address + + union + { + struct + { + int hoCalculX; // Low weight value + int hoX; // X coordinate + int hoCalculY; // Low weight value + int hoY; // Y coordinate + }; + struct + { + __int64 hoCalculXLong; + __int64 hoCalculYLong; + }; + }; + int hoImgXSpot; // Hot spot of the current image + int hoImgYSpot; + int hoImgWidth; // Width of the current picture + int hoImgHeight; + RECT hoRect; // Display rectangle + + DWORD hoOEFlags; // Objects flags + short hoFlags; // Flags + BYTE hoSelectedInOR; // Selection lors d'un evenement OR + BYTE hoFree; // Alignement + int hoOffsetValue; // Values structure offset + UINT hoLayer; // Layer + + HOROUTINE hoHandleRoutine; // General handle routine + HOROUTINE hoModifRoutine; // Modification routine when coordinates have been modified + HOROUTINE hoDisplayRoutine; // Display routine + + short hoLimitFlags; // Collision limitation flags + short hoNextQuickDisplay; // Quickdraw list + saveRect hoBackSave; // Background + + LPEVP hoCurrentParam; // Address of the current parameter + + int hoOffsetToWindows; // Offset to windows + DWORD hoIdentifier; // ASCII identifier of the object + +#ifdef __cplusplus +}; +#else +} headerObject; +#endif +typedef headerObject* LPHO; + +#define HOF_DESTROYED 0x0001 +#define HOF_TRUEEVENT 0x0002 +#define HOF_REALSPRITE 0x0004 +#define HOF_FADEIN 0x0008 +#define HOF_FADEOUT 0x0010 +#define HOF_OWNERDRAW 0x0020 +#define HOF_NOCOLLISION 0x2000 +#define HOF_FLOAT 0x4000 +#define HOF_STRING 0x8000 + + +// -------------------------------------- +// Object's movement structure +// -------------------------------------- +typedef struct tagRM { + + int rmAcc; // Current acceleration + int rmDec; // Current Decelaration + int rmCollisionCount; // Collision counter + int rmFree2; + int rmStopSpeed; // If stopped: speed to take again + int rmFree0; + int rmFree1; + int rmAccValue; // Acceleration calculation + int rmDecValue; // Deceleration calculation + short rmEventFlags; // To accelerate events + int rmFree3; + int rmFree4; + BOOL rmFree5; + BOOL rmFree6; + + BOOL rmFree7; + BOOL rmMoveFlag; // Messages/movements + + BOOL rmWrapping; // For CHECK POSITION + BOOL rmReverse; // Ahaid or reverse? + + BOOL rmBouncing; // Bouncing? + int rmMvtNum; // Number of the current movement + + union + { + struct + { + BYTE rmMvData[80]; // Space for data + }; + struct + { + int MT_Speed; + int MT_Sinus; + int MT_Cosinus; + DWORD MT_Longueur; + int MT_XOrigin; + int MT_YOrigin; + int MT_XDest; + int MT_YDest; + int MT_MoveNumber; + LPMOVEDEF MT_MoveAddress; + BOOL MT_Direction; + LPMOVETAPED MT_Movement; + int MT_Calculs; + int MT_XStart; + int MT_YStart; + int MT_Pause; + LPTSTR MT_GotoNode; + }; + struct + { + int MM_DXMouse; + int MM_DYMouse; + int MM_FXMouse; + int MM_FYMouse; + int MM_Stopped; + int MM_OldSpeed; + BYTE MM_MvOpt; + }; + struct + { + int MG_Bounce; + long MG_OkDirs; + int MG_BounceMu; + int MG_Speed; + int MG_LastBounce; + int MG_DirMask; + BYTE MG_MvOpt; + }; + struct + { + int MR_Bounce; + int MR_BounceMu; + int MR_Speed; + int MR_RotSpeed; + int MR_RotCpt; + int MR_RotPos; + int MR_RotMask; + int MR_OkReverse; + int MR_OldJoy; + int MR_LastBounce; + BYTE MR_MvOpt; + }; + struct + { + long MB_StartDir; + int MB_Angles; + int MB_Securite; + int MB_SecuCpt; + int MB_Bounce; + int MB_Speed; + int MB_MaskBounce; + int MB_LastBounce; + int MB_Blocked; + }; + struct + { + int MBul_Wait; + LPHO MBul_ShootObject; + }; + struct + { + int MP_Type; + int MP_Bounce; + int MP_BounceMu; + int MP_XSpeed; + int MP_Gravity; + int MP_Jump; + int MP_YSpeed; + int MP_XMB; + int MP_YMB; + int MP_HTFOOT; + int MP_JumpControl; + int MP_JumpStopped; + int MP_PreviousDir; + LPHO MP_ObjectUnder; + int MP_XObjectUnder; + int MP_YObjectUnder; + BOOL MP_NoJump; + }; + }; + } rMvt; +typedef rMvt* LPRMV; +enum +{ + MPTYPE_WALK, + MPTYPE_CLIMB, + MPTYPE_JUMP, + MPTYPE_FALL, + MPTYPE_CROUCH, + MPTYPE_UNCROUCH +}; + +// ---------------------------------------- +// Object's animation structure +// ---------------------------------------- +typedef struct tagRA { + int raAnimForced; // Flags if forced + int raAnimDirForced; + int raAnimSpeedForced; + BOOL raAnimStopped; + int raAnimOn; // Current animation + LPAN raAnimOffset; + int raAnimDir; // Direction of current animation + int raAnimPreviousDir; // Previous OK direction + LPAD raAnimDirOffset; + int raAnimSpeed; + int raAnimMinSpeed; // Minimum speed of movement + int raAnimMaxSpeed; // Maximum speed of movement + int raAnimDeltaSpeed; + int raAnimCounter; // Animation speed counter + int raAnimDelta; // Speed counter + int raAnimRepeat; // Number of repeats + int raAnimRepeatLoop; // Looping picture + int raAnimFrame; // Current frame + int raAnimNumberOfFrame; // Number of frames + + int raAnimFrameForced; + + } rAni; +typedef rAni* LPRA; + +// ---------------------------------------- +// Sprite display structure +// ---------------------------------------- +typedef struct tagRSPR { + + int rsFlash; // Flash objets + int rsFlashCpt; + int rsLayer; // Layer + int rsZOrder; // Z-order value + int rsCreaFlags; // Creation flags + COLORREF rsBackColor; // background saving color + DWORD rsEffect; // Sprite effects + LPARAM rsEffectParam; + WORD rsFlags; // Handling flags + WORD rsFadeCreaFlags; // Saved during a fadein + } rSpr; +typedef rSpr * LPRSP; + +#define RSFLAG_HIDDEN 0x0001 +#define RSFLAG_INACTIVE 0x0002 +#define RSFLAG_SLEEPING 0x0004 +#define RSFLAG_SCALE_RESAMPLE 0x0008 +#define RSFLAG_ROTATE_ANTIA 0x0010 +#define RSFLAG_VISIBLE 0x0020 +#define RSFLAG_CREATEDEFFECT 0x0040 + + +// ---------------------------------------- +// Objects's internal variables (build # >= 243) +// ---------------------------------------- +typedef struct tagRV { + CValue* rvpValues; + long rvFree1[VALUES_NUMBEROF_ALTERABLE-1]; + long rvValueFlags; + BYTE rvFree2[VALUES_NUMBEROF_ALTERABLE]; + LPTSTR rvStrings[STRINGS_NUMBEROF_ALTERABLE]; + } rVal; +typedef rVal * LPRVAL; + +/* + Obsolete (build 242 or below) - Note: don't remove this (for the SDK) + +typedef struct tagRV { + long rvValues[VALUES_NUMBEROF_ALTERABLE]; + long rvValueFlags; + BYTE rvValuesType[VALUES_NUMBEROF_ALTERABLE]; + LPSTR rvStrings[STRINGS_NUMBEROF_ALTERABLE]; + } rVal; +typedef rVal * LPRVAL; +*/ + + +// ----------------------------------------------- +// Objects animation and movement structure +// ----------------------------------------------- +#if !defined(ANGLETYPE) +#if defined(HWABETA) +#define ANGLETYPE float +#else +#define ANGLETYPE int +#endif +#endif +typedef void (* RCROUTINE)(LPHO); +typedef struct tagRCOM { + + int rcOffsetAnimation; // Offset to anims structures + int rcOffsetSprite; // Offset to sprites structures + RCROUTINE rcRoutineMove; // Offset to movement routine + RCROUTINE rcRoutineAnimation; // Offset to animation routine + + int rcPlayer; // Player who controls + + int rcNMovement; // Number of the current movement + CRunMvt* rcRunMvt; // Pointer to extension movement + fpSpr rcSprite; // Sprite ID if defined + int rcAnim; // Wanted animation + int rcImage; // Current frame + float rcScaleX; + float rcScaleY; + ANGLETYPE rcAngle; + int rcDir; // Current direction + int rcSpeed; // Current speed + int rcMinSpeed; // Minimum speed + int rcMaxSpeed; // Maximum speed + BOOL rcChanged; // Flag: modified object + BOOL rcCheckCollides; // For static objects + + int rcOldX; // Previous coordinates + int rcOldY; + int rcOldImage; + ANGLETYPE rcOldAngle; + int rcOldDir; + int rcOldX1; // For zone detections + int rcOldY1; + int rcOldX2; + int rcOldY2; + + long rcFadeIn; + long rcFadeOut; + + } rCom; + + +// ------------------------------------------------------------ +// ACTIVE OBJECTS DATAZONE +// ------------------------------------------------------------ +typedef struct tagRO { + + headerObject roHo; // Common structure + + rCom roc; // Anim/movement structure + rMvt rom; // Movement structure + rAni roa; // Animation structure + rSpr ros; // Sprite handling structure + rVal rov; // Values structure + + } RunObject; +typedef RunObject * LPRO; +typedef RunObject * LPRUNOBJECT; + +#define EF_GOESINPLAYFIELD 0x0001 +#define EF_GOESOUTPLAYFIELD 0x0002 +#define EF_WRAP 0x0004 + + + +// ------------------------------------------------------ +// EXTENSION EDITION HEADER STRUCTURE +// ------------------------------------------------------ +typedef struct tagEditExtension_v1 +{ + short extSize; + short extMaxSize; + short extOldFlags; // For conversion purpose + short extVersion; // Version number +} extHeader_v1; +typedef extHeader_v1* LPEXTV1; + +typedef struct extHeader +{ + DWORD extSize; + DWORD extMaxSize; + DWORD extVersion; // Version number + LPVOID extID; // object's identifier + LPVOID extPrivateData; // private data +} extHeader; +typedef extHeader * LPEXT; + +// ------------------------------------------------------ +// System objects (text, question, score, lives, counter) +// ------------------------------------------------------ +typedef struct tagRs { + + headerObject rsHo; // For all the objects + rCom rsc; // Anims / movements / sprites structures + rMvt rom; // Mouvement structure + rSpr rss; // Sprite handling + + short rsPlayer; // Number of the player if score or lives + short rsFlags; // Type + flags + + union { + LPBYTE rsSubAppli; // Application (CCA object) + }; + union + { + long rsMini; + long rsOldLevel; + }; + union + { + long rsMaxi; // + long rsLevel; + }; + CValue rsValue; + LONG rsBoxCx; // Dimensions box (for lives, counters, texts) + LONG rsBoxCy; + double rsMiniDouble; + double rsMaxiDouble; + short rsOldFrame; // Counter only + BYTE rsHidden; + BYTE rsFree; + LPTSTR rsTextBuffer; // Text buffer + int rsLBuffer; // Length of the buffer in BYTES + DWORD rsFont; // Temporary font for texts + union { + COLORREF rsTextColor; // Text color + COLORREF rsColor1; // Bar color + }; + COLORREF rsColor2; // Gradient bar color +} rs; +typedef rs * LPRS; + + +// OILIST Structure : Data concerning the objects in the game +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define MAX_QUALIFIERS 8 // Maximum number of qualifiers per object +typedef LPHO (*OILROUTINE)(objInfoList*, BOOL*); + +#ifdef __cplusplus +class objInfoList { +public: +#else +#undef objInfoList +typedef struct objInfoList { +#endif + OINUM oilOi; // THE oi + short oilListSelected; // First selection !!! DO NOT CHANGE POSITION !!! + short oilType; // Type of the object + short oilObject; // First objects in the game + DWORD oilEvents; // Events + char oilWrap; // WRAP flags + char oilNextFlag; + WORD oilFree; // Not used + int oilNObjects; // Current number + int oilActionCount; // Action loop counter + int oilActionLoopCount; // Action loop counter + OILROUTINE oilCurrentRoutine; // Current routine for the actions + int oilCurrentOi; // Current object + int oilNext; // Pointer on the next + int oilEventCount; // When the event list is done + int oilNumOfSelected; // Number of selected objects + DWORD oilOEFlags; // Object's flags + short oilLimitFlags; // Movement limitation flags + short oilLimitList; // Pointer to limitation list + short oilOIFlags; // Objects preferences + short oilOCFlags2; // Objects preferences II + long oilInkEffect; // Ink effect + long oilEffectParam; // Ink effect param + HFII oilHFII; // First available frameitem + COLORREF oilBackColor; // Background erasing color + short oilQualifiers[MAX_QUALIFIERS]; // Qualifiers for this object + TCHAR oilName[24]; // Name + int oilEventCountOR; // Selection in a list of events with OR +#ifdef HWABETA + OINUM* oilColList; // Liste de collisions sprites +#endif +#ifdef __cplusplus +}; +#else +} objInfoList; +#endif +typedef objInfoList * LPOIL; + +#define OILIMITFLAGS_BORDERS 0x000F +#define OILIMITFLAGS_BACKDROPS 0x0010 +#define OILIMITFLAGS_ONCOLLIDE 0x0080 // used by HWA +#define OILIMITFLAGS_QUICKCOL 0x0100 +#define OILIMITFLAGS_QUICKBACK 0x0200 +#define OILIMITFLAGS_QUICKBORDER 0x0400 +#define OILIMITFLAGS_QUICKSPR 0x0800 +#define OILIMITFLAGS_QUICKEXT 0x1000 +#define OILIMITFLAGS_ALL 0xFFFF + +// Object creation structure +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagCOB { + LO* cobLevObj; // Leave first! + WORD cobLevObjSeg; + WORD cobFlags; + int cobX; + int cobY; + int cobDir; + int cobLayer; + int cobZOrder; + } createObjectInfo; +typedef createObjectInfo * LPCOB; +typedef createObjectInfo * fpcob; + +// Flags for Create Objects +// ------------------------- +#define COF_NOMOVEMENT 0x0001 +#define COF_HIDDEN 0x0002 +#define COF_FIRSTTEXT 0x0004 + +// Qualifier to oilist for machine langage +// --------------------------------------- +typedef LPHO (*QOIROUTINE)(qualToOi*, BOOL* pRepeatFlag); + +#ifdef __cplusplus +class qualToOi { +public: +#else +#undef qualToOi +typedef struct qualToOi { +#endif + short qoiCurrentOi; + short qoiNext; + int qoiActionPos; + QOIROUTINE qoiCurrentRoutine; + int qoiActionCount; + int qoiActionLoopCount; + char qoiNextFlag; + char qoiSelectedFlag; + OINUM qoiOi; // Array OINUM / OFFSET + short qoiOiList; +#ifdef __cplusplus +}; +#else +} qualToOi; +#endif +typedef qualToOi * LPQOI; + + +// ------------------------------------------------------------------ +// ------------------------------------------------------------------ +// EXTENSION HANDLING +// ------------------------------------------------------------------ +// ------------------------------------------------------------------ + +#ifdef STAND_ALONE +typedef BOOL (WINAPI *EXTCONDROUTINE)(headerObject*, long, long); +typedef short (WINAPI *EXTACTROUTINE)(headerObject*, long, long); +typedef long (WINAPI *EXTEXPROUTINE)(headerObject*, long); +#else +#define EXTCONDROUTINE VOID +#define EXTACTROUTINE VOID +#define EXTEXPROUTINE VOID +#endif + +// Information structure about the extension +#ifdef __cplusplus +class kpxRunInfos { +public: +#else +typedef struct kpxRunInfos { +#endif + EXTCONDROUTINE* conditions; // 00 Offset to condition jump list + EXTACTROUTINE* actions; // 04 Offset to action jump list + EXTEXPROUTINE* expressions; // 08 Offset to expression jump list + short numOfConditions; // 0C Number of conditions + short numOfActions; // 0E Number of actions + short numOfExpressions; // 10 Number of expressions + WORD editDataSize; // 12 Size of the data zone when exploded + DWORD editFlags; // 14 Object flags + char windowProcPriority; // 16 Priority of the routine 0-255 + char free; + short editPrefs; // 18 Preferences d'edition + long identifier; // 1A Chaine d'identification + short version; // 1E Version courante + // 20 +#ifdef __cplusplus +}; +#else +} kpxRunInfos; +#endif +typedef kpxRunInfos * LPKPXRUNINFOS; +typedef kpxRunInfos * fpKpxRunInfos; + +// Extension jump table +// -------------------- +typedef short (WINAPI * CREATERUNOBJECT_PROC) (LPHO hoPtr, LPEXT extPtr, LPCOB); +typedef unsigned short (WINAPI * GETRUNDATASIZE_PROC)(LPRH, LPEXT); +typedef short (WINAPI * DESTROYRUNOBJECT_PROC)(LPHO, long fast); +typedef short (WINAPI * HANDLERUNOBJECT_PROC)(LPHO); +typedef short (WINAPI * DISPLAYRUNOBJECT_PROC)(LPHO); +typedef cSurface* (WINAPI * GETRUNOBJECTSURFACE_PROC)(LPHO); +typedef short (WINAPI * REINITRUNOBJECT_PROC)(LPHO); +typedef short (WINAPI * PAUSERUNOBJECT_PROC)(LPHO); +typedef short (WINAPI * CONTINUERUNOBJECT_PROC)(LPHO); +typedef short (WINAPI * PREPARETOSAVE_PROC)(LPHO); +typedef short (WINAPI * SAVEBACKGROUND_PROC)(LPHO); +typedef short (WINAPI * RESTOREBACKGROUND_PROC)(LPHO); +typedef short (WINAPI * CHANGERUNDATA_PROC)(LPHO, LPHO); +typedef short (WINAPI * KILLBACKGROUND_PROC) (LPHO); +typedef short (WINAPI * GETZONEINFO_PROC)(LPHO); +typedef LPWORD (WINAPI * GETDEBUGTREE_PROC)(LPHO); +typedef void (WINAPI * GETDEBUGITEM_PROC)(LPTSTR, LPHO, int); +typedef void (WINAPI* EDITDEBUGITEM_PROC)(LPHO, int); +typedef void (WINAPI* GETRUNOBJECTFONT_PROC)(LPHO, LOGFONT*); +typedef void (WINAPI* SETRUNOBJECTFONT_PROC)(LPHO, LOGFONT*, RECT*); +typedef COLORREF (WINAPI* GETRUNOBJECTTEXTCOLOR_PROC)(LPHO); +typedef void (WINAPI* SETRUNOBJECTTEXTCOLOR_PROC)(LPHO, COLORREF); +typedef short (WINAPI * GETRUNOBJECTWINDOW_PROC)(LPHO); +typedef sMask* (WINAPI * GETRUNOBJECTCOLLISIONMASK_PROC)(LPHO, LPARAM); +typedef BOOL (WINAPI * SAVERUNOBJECT_PROC)(LPHO, HANDLE); +typedef BOOL (WINAPI * LOADRUNOBJECT_PROC)(LPHO, HANDLE); +typedef void (WINAPI * GETRUNOBJECTMEMORYUSAGE_PROC)(LPHO, int*, int*, int*); + +#ifdef __cplusplus +class kpj { +public: +#else +#undef kpj +typedef struct kpj { +#endif + CREATERUNOBJECT_PROC CreateRunObject; + DESTROYRUNOBJECT_PROC DestroyRunObject; + HANDLERUNOBJECT_PROC HandleRunObject; + DISPLAYRUNOBJECT_PROC DisplayRunObject; + GETRUNOBJECTSURFACE_PROC GetRunObjectSurface; + REINITRUNOBJECT_PROC ReInitRunObject; + PAUSERUNOBJECT_PROC PauseRunObject; + CONTINUERUNOBJECT_PROC ContinueRunObject; + PREPARETOSAVE_PROC PrepareToSave; + PREPARETOSAVE_PROC PrepareToSave2; + GETRUNDATASIZE_PROC GetRunObjectDataSize; + SAVEBACKGROUND_PROC SaveBackground; + RESTOREBACKGROUND_PROC RestoreBackground; + CHANGERUNDATA_PROC ChangeRunData; + KILLBACKGROUND_PROC KillBackground; + GETZONEINFO_PROC GetZoneInfo; + GETDEBUGTREE_PROC GetDebugTree; + GETDEBUGITEM_PROC GetDebugItem; + EDITDEBUGITEM_PROC EditDebugItem; + GETRUNOBJECTFONT_PROC GetRunObjectFont; + SETRUNOBJECTFONT_PROC SetRunObjectFont; + GETRUNOBJECTTEXTCOLOR_PROC GetRunObjectTextColor; + SETRUNOBJECTTEXTCOLOR_PROC SetRunObjectTextColor; + GETRUNOBJECTWINDOW_PROC GetRunObjectWindow; + GETRUNOBJECTCOLLISIONMASK_PROC GetRunObjectCollisionMask; + SAVERUNOBJECT_PROC SaveRunObject; + LOADRUNOBJECT_PROC LoadRunObject; + GETRUNOBJECTMEMORYUSAGE_PROC GetRunObjectMemoryUsage; + + kpxRunInfos infos; + +#ifdef __cplusplus +}; +#else +} kpj; +#endif +typedef kpj * LPKPJ; + +#define KPJ_SHIFT 7 +#define KPJ_SIZE 0x80 +#define KPJ_MAXNUMBER 128 +#define KPJ_STEP 8 +#define kpjJCreate 0x00 +#define kpjJDestroy 0x04 +#define kpjJRoutine 0x08 +#define kpjJDisplay 0x0C +#define kpjJReInit 0x10 +#define kpjJPause 0x14 +#define kpjJEndPause 0x18 +#define kpjJPrepareToSave 0x1C +#define kpjJRestart 0x20 +#define kpjJGetRunDataSize 0x24 +#define kpjJSaveBackground 0x28 +#define kpjJRestoreBackground 0x2C +#define kpjJKillBackground 0x30 + +// Possible states of the application, see LApplication::SetRunningState() +#define GAMEON_EMPTY 0 +#define GAMEON_UNLOADED 1 +#define GAMEON_TIME0 2 +#define GAMEON_PAUSED 3 +#define GAMEON_RUNNING 4 +#define GAMEON_STEPPING 5 + + +////////////////////////////////////////////////////////////////////////////// +// Condition/action jumps +typedef BOOL (*CALLCOND1_ROUTINE)(event* pe, LPHO pHo); +typedef BOOL (*CALLCOND2_ROUTINE)(event* pe); +typedef void (*CALLACTION_ROUTINE)(event* pe); +typedef void (*CALLEXP_ROUTINE)(); +typedef BOOL (*CONDROUTINE)(event* pe, LPHO pHo); +typedef void (*ACTROUTINE)(event* pe); +typedef void (*EXPROUTINE)(); +typedef void (*CALLOPERATOR_ROUTINE)(); + +typedef struct tagCallTables +{ + CALLCOND1_ROUTINE* pConditions1; + CALLCOND2_ROUTINE* pConditions2; + CALLACTION_ROUTINE* pActions; + CALLEXP_ROUTINE* pExpressions; +}CallTables; + +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +// +// Run-time Definitions +// + +#define COMPARE_EQ 0 +#define COMPARE_NE 1 +#define COMPARE_LE 2 +#define COMPARE_LT 3 +#define COMPARE_GE 4 +#define COMPARE_GT 5 + +#ifdef RUN_TIME + + #define OINUM_ERROR -1 + #define B2L(a,b,c,d) ((DWORD)(((DWORD)((unsigned char)(d))<<24)|((DWORD)((unsigned char)(c))<<16)|((DWORD)((unsigned char)(b))<<8)|(DWORD)((unsigned char)(a)))) + + // Pour la routine GetFileInfos + #define FILEINFO_DRIVE 1 + #define FILEINFO_DIR 2 + #define FILEINFO_PATH 3 + #define FILEINFO_APPNAME 4 + #define FILEINFO_TEMPPATH 5 + + // MACRO: next event + #define EVTNEXT(p) ((LPEVT)((LPBYTE)p+p->evtSize)) + // MACRO: returns first param + #define EVTPARAMS(p) ((LPEVP)(p->evtCode<0 ? (LPBYTE)p+CND_SIZE : (LPBYTE)p+ACT_SIZE )) + // MACRO: returns the extension condition code + #define EXTCONDITIONNUM(i) (-((short)(i>>16))-1) + #define EXTACTIONNUM(i) ((short)(i>>16)) + + #define KPXNAME_SIZE 60 + #define BADNAME_SIZE (OINAME_SIZE+KPXNAME_SIZE+8) + + // Extensions + // ---------- + typedef struct TABKPT { + kpj kpx[2]; + } kpxData; + typedef kpxData * fpkpdt; + + // Main loop exit codes + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + #define LOOPEXIT_NEXTLEVEL 1 + #define LOOPEXIT_PREVLEVEL 2 + #define LOOPEXIT_GOTOLEVEL 3 + #define LOOPEXIT_NEWGAME 4 + #define LOOPEXIT_PAUSEGAME 5 + #define LOOPEXIT_SAVEAPPLICATION 6 + #define LOOPEXIT_LOADAPPLICATION 7 + #define LOOPEXIT_SAVEFRAME 8 + #define LOOPEXIT_LOADFRAME 9 + #define LOOPEXIT_ENDGAME -2 + + #define LOOPEXIT_QUIT 100 + #define LOOPEXIT_RESTART 101 + #define LOOPEXIT_TIMER 102 + #define LOOPEXIT_STEP 103 + #define LOOPEXIT_MONITOR 104 + #define LOOPEXIT_EVENTEDITOR 105 + #define LOOPEXIT_ESC 106 + #define LOOPEXIT_MENU 107 + #define LOOPEXIT_JUMPTO 108 + #define LOOPEXIT_RESET 109 + #define LOOPEXIT_PAUSE 110 + #define LOOPEXIT_PLAY 111 + + // Backdrop draw routines + // ---------------------------------------- + typedef void (* DRAWROUTINE_PROC)(drawRoutine*); + + #ifdef __cplusplus + class drawRoutine { + public: + #else + #undef drawRoutine + typedef struct drawRoutine { + #endif + #ifdef __cplusplus + drawRoutine* next; + #else + LPVOID next; + #endif + DRAWROUTINE_PROC routine; + long param1; + long param2; + long param3; + long param4; + long param5; + long param6; + #ifdef __cplusplus + }; + #else + } drawRoutine; + #endif + + // To push an event + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + #define MAX_PUSHEDEVENTS 32 + typedef void (*PEV_ROUTINE)(LPHO, long); + + #ifdef __cplusplus + class pev { + public: + #else + #undef pev + typedef struct pev { + #endif + long pevCode; + PEV_ROUTINE pevRoutine; + long pevParam; + LPHO pevObject; + short pevOi; + #ifdef __cplusplus + }; + #else + } pev; + #endif + #define PIXEL_SPEED 5 + + // QUALIFIERS + typedef struct + { + OINUM qOi; + ITEMTYPE qType; + WORD qList; + } qualifierLoad; + typedef qualifierLoad * LPQLOAD; + +#endif // RUN_TIME + +#ifndef __cplusplus +#undef headerObject +#undef kpj +#undef objInfoList +#undef drawRoutine +#undef LO +#undef pev +#undef qualToOi +//#undef CValue +#undef CRunApp +#undef CRunFrame +#endif; + +// Restores structure alignment... +#ifndef _H2INC +#pragma pack( pop, _pack_cncf_ ) +#endif + +#endif //CNCF_H + + + diff --git a/Inc/Cncy.h b/Inc/Cncy.h index ed97cba..c8513aa 100644 --- a/Inc/Cncy.h +++ b/Inc/Cncy.h @@ -1,1633 +1,1633 @@ - -#ifndef CNCY_H -#define CNCY_H - -#include "PictEdDefs.h" - -#ifdef __cplusplus -class cSurface; -class CImageFilterMgr; -class CSoundFilterMgr; -class CSoundManager; -class CRunApp; -class CRunFrame; -class CEditApp; -class CEditFrame; -class CMvt; -class CPropValue; -class OI; -class dllTrans; -class CValue; -#else -#define cSurface void -#define CImageFilterMgr void -#define CSoundFilterMgr void -#define CSoundManager void -#define CRunApp void -#define CRunFrame void -#define CEditApp void -#define CEditFrame void -#define CMvt void -#define CPropValue void -#define OI void -#define dllTrans void -struct CValue; -#endif -struct PropData; -struct RunHeader; - -// Force structure alignement -#ifndef _H2INC -#pragma pack( push, _pack_cncy_ ) -#pragma pack(2) -#endif - -#ifndef _H2INC - -// Object instance parent types -enum { - PARENT_NONE, - PARENT_FRAME, - PARENT_FRAMEITEM, - PARENT_QUALIFIER -}; - -// Proc definition -typedef void (WINAPI * UPDATEFILENAMEPROCA)(LPCSTR, LPSTR); -typedef void (WINAPI * UPDATEFILENAMEPROCW)(LPCWSTR, LPWSTR); -typedef void (WINAPI * UPDATEFILENAMEPROC)(LPCTSTR, LPTSTR); - -// Old object name size, still used in events -#ifndef OINAME_SIZE -#define OINAME_SIZE 24 -#endif // OINAME_SIZE - -// Obsolete -enum { - MODIF_SIZE, - MODIF_PLANE, - MODIF_FLAGS, - MODIF_PICTURE, - MODIF_HFRAN, - MODIF_BOX, - MODIF_TEXT, - MODIF_PREFS -}; -#define KPX_MODIF_BASE 1024 - -#endif // _H2INC - -// Standard objects -#define KPX_BASE 32 // Extensions -enum { - OBJ_BOX, - OBJ_BKD, - OBJ_SPR, - OBJ_TEXT, - OBJ_QUEST, - OBJ_SCORE, - OBJ_LIVES, - OBJ_COUNTER, - OBJ_RTF, - OBJ_CCA, - NB_SYSOBJ -}; - -// Menu header (v2) -typedef struct MenuHdr { - - DWORD mhHdrSize; // == sizeof(MenuHdr) - DWORD mhMenuOffset; // From start of MenuHdr - DWORD mhMenuSize; - DWORD mhAccelOffset; // From start of MenuHdr - DWORD mhAccelSize; - // Total data size = mhHdrSize + mhMenuSize + mhAccelSize -} MenuHdr; - -////////////////////////////////////////////////////////////////////////////// -// Application mini Header -// -typedef struct AppMiniHeader { - - union { - char gaType[4]; // "PAME" - DWORD gaDWType; - }; - WORD gaVersion; // Version number - WORD gaSubVersion; // Sub-version number - DWORD gaPrdVersion; // MMF version - DWORD gaPrdBuild; // MMF build number - -} AppMiniHeader; - -#define RUNTIME_DWTYPEA 'EMAP' -#define RUNTIME_DWTYPEW 'UMAP' -#define RUNTIME_DWTYPE_VTZA ' ZTV' -#define RUNTIME_DWTYPE_VTZW 'UZTV' - -#ifdef _UNICODE -#define RUNTIME_DWTYPE RUNTIME_DWTYPEW -#define RUNTIME_DWTYPE_VTZ RUNTIME_DWTYPE_VTZW -#else -#define RUNTIME_DWTYPE RUNTIME_DWTYPEA -#define RUNTIME_DWTYPE_VTZ RUNTIME_DWTYPE_VTZA -#endif -#define RUNTIME_VERSION_MMF1 0x0300 -#define RUNTIME_VERSION_MMF15 0x0301 -#define RUNTIME_VERSION_MMF2 0x0302 -#define RUNTIME_VERSION RUNTIME_VERSION_MMF2 - -////////////////////////////////////////////////////////////////////////////// -// Application full Header -// - -enum { - CTRLTYPE_MOUSE, // not used - CTRLTYPE_JOY1, - CTRLTYPE_JOY2, - CTRLTYPE_JOY3, - CTRLTYPE_JOY4, - CTRLTYPE_KEYBOARD, - MAX_CTRLTYPE -}; - -#define MAX_PLAYER 4 -#define MAX_KEY 8 -#define PLAYERNAME_SIZE 100 - -typedef struct PlayerCtrls { - - WORD pcCtrlType[MAX_PLAYER]; // Control type per player (0=mouse,1=joy1, 2=joy2, 3=keyb) - WORD pcCtrlKeys[MAX_PLAYER][MAX_KEY]; // Control keys per player - -} PlayerCtrls; -typedef PlayerCtrls* fpPlayerCtrls; - -typedef struct AppHeader { - - DWORD gaSize; // Structure size - WORD gaFlags; // Flags - WORD gaNewFlags; // New flags - WORD gaMode; // graphic mode - WORD gaOtherFlags; // Other Flags - short gaCxWin; // Window x-size - short gaCyWin; // Window y-size - DWORD gaScoreInit; // Initial score - DWORD gaLivesInit; // Initial number of lives - PlayerCtrls gaPlayerCtrls; - DWORD gaBorderColour; // Border colour - DWORD gaNbFrames; // Number of frames - DWORD gaFrameRate; // Number of frames per second - BYTE gaMDIWindowMenu; // Index of Window menu for MDI applications - BYTE gaFree[3]; - -} AppHeader; - -// gaFlags -#define GA_BORDERMAX 0x0001 -#define GA_NOHEADING 0x0002 -#define GA_PANIC 0x0004 -#define GA_SPEEDINDEPENDANT 0x0008 -#define GA_STRETCH 0x0010 -#define GA_LOADALLIMAGESATSTART 0x0020 -#define GA_LOADALLSOUNDSATSTART 0x0040 -#define GA_MENUHIDDEN 0x0080 -#define GA_MENUBAR 0x0100 -#define GA_MAXIMISE 0x0200 -#define GA_MIX 0x0400 -#define GA_FULLSCREENATSTART 0x0800 -#define GA_FULLSCREENSWITCH 0x1000 -#define GA_PROTECTED 0x2000 -#define GA_COPYRIGHT 0x4000 -#define GA_ONEFILE 0x8000 - -// gaNewFlags -#define GANF_SAMPLESOVERFRAMES 0x0001 -#define GANF_RELOCFILES 0x0002 -#define GANF_RUNFRAME 0x0004 -#define GANF_SAMPLESEVENIFNOTFOCUS 0x0008 - -// New in build 92 -#define GANF_NOMINIMIZEBOX 0x0010 -#define GANF_NOMAXIMIZEBOX 0x0020 -#define GANF_NOTHICKFRAME 0x0040 -#define GANF_DONOTCENTERFRAME 0x0080 - -// New in build 101 (MMF 1.5) -#define GANF_SCREENSAVER_NOAUTOSTOP 0x0100 -#define GANF_DISABLE_CLOSE 0x0200 - -// New in build 105 -#define GANF_HIDDENATSTART 0x0400 - -// New in build 110 -#define GANF_XPVISUALTHEMESUPPORT 0x0800 - -// New in MMF2 -#define GANF_VSYNC 0x1000 -#define GANF_RUNWHENMINIMIZED 0x2000 -#define GANF_MDI 0x4000 -#define GANF_RUNWHILERESIZING 0x8000 - -// Other flags -#define GAOF_DEBUGGERSHORTCUTS 0x0001 -#define GAOF_DDRAW 0x0002 -#define GAOF_DDRAWVRAM 0x0004 -#define GAOF_OBSOLETE 0x0008 -#define GAOF_AUTOIMGFLT 0x0010 -#define GAOF_AUTOSNDFLT 0x0020 -#define GAOF_ALLINONE 0x0040 -#define GAOF_SHOWDEBUGGER 0x0080 -#define GAOF_RESERVED_1 0x0100 -#define GAOF_RESERVED_2 0x0200 -#define GAOF_RESERVED_3 0x0400 -#define GAOF_RESERVED_4 0x0800 -#define GAOF_JAVASWING 0x1000 -#define GAOF_JAVAAPPLET 0x2000 -#define GAOF_D3D9 0x4000 -#define GAOF_D3D8 0x8000 - -// Optional header -typedef struct AppHeader2 { - - DWORD dwOptions; - DWORD dwBuildType; - DWORD dwBuildFlags; - WORD wScreenRatioTolerance; - WORD wScreenAngle; // 0 (no rotation/portrait), 1 (90 clockwise/landscape left), 2 (90 anticlockwise/landscape right), 3 (automatic portrait), 4 (automatic landscape), 5 (fully automatic) - DWORD dwUnused2; - -} AppHeader2; - -#define AH2OPT_KEEPSCREENRATIO 0x0001 -#define AH2OPT_FRAMETRANSITION 0x0002 // (HWA only) a frame has a transition -#define AH2OPT_RESAMPLESTRETCH 0x0004 // (HWA only) "resample when resizing" (works with "resize to fill window" option) -#define AH2OPT_GLOBALREFRESH 0x0008 // (Mobile) force global refresh -#define AH2OPT_MULTITASK 0x0010 // (iPhone) Multitask -#define AH2OPT_RTL 0x0020 // (Unicode) Right-to-left reading -#define AH2OPT_STATUSLINE 0x0040 // (iPhone/Android) Display status line -#define AH2OPT_RTLLAYOUT 0x0080 // (Unicode) Right-to-left layout -#define AH2OPT_ENABLEIAD 0x0100 // (iPhone) Enable iAd -#define AH2OPT_IADBOTTOM 0x0200 // (iPhone) Display ad at bottom -#define AH2OPT_AUTOEND 0x0400 // (Android) -#define AH2OPT_DISABLEBACKBUTTON 0x0800 // (Android) Disable Back button behavior -#define AH2OPT_ANTIALIASED 0x1000 // (iPhone) Smooth resizing on bigger screens -#define AH2OPT_CRASHREPORTING 0x2000 // (Android) Enable online crash reporting - -enum { - SCREENORIENTATION_PORTRAIT, - SCREENORIENTATION_LANDSCAPE_LEFT, - SCREENORIENTATION_LANDSCAPE_RIGHT, - SCREENORIENTATION_AUTO, - SCREENORIENTATION_LANDSCAPE_AUTO, - SCREENORIENTATION_PORTRAIT_AUTO, -}; - -#ifndef _H2INC - -// Build type values -enum { - BUILDTYPE_STANDALONE, - BUILDTYPE_SCREENSAVER, - BUILDTYPE_INTERNETAPP, - BUILDTYPE_JAVA, - BUILDTYPE_JAVASTANDALONE, - BUILDTYPE_JAVAAPPLET, - BUILDTYPE_JAVAWEBSTART, - BUILDTYPE_JAVAMOBILE, - BUILDTYPE_JAVABLURAY, - BUILDTYPE_JAVAMAC, - BUILDTYPE_FLASH, - BUILDTYPE_JAVABLACKBERRY, - BUILDTYPE_ANDROID, - BUILDTYPE_IPHONE, - BUILDTYPE_IPHONEDEVEL, - BUILDTYPE_IPHONEFINAL, - BUILDTYPE_XNA_WINDOWS_APP, - BUILDTYPE_MAC, - BUILDTYPE_XNA_WINDOWS, - BUILDTYPE_XNA_XBOX, - BUILDTYPE_XNA_PHONE, - BUILDTYPE_XNA_XBOX_APP, - BUILDTYPE_XNA_PHONE_APP, - BUILDTYPE_STDMAX, // end of standard build types -}; - -// Build flag values -#define BUILDFLAG_MAXCOMP 0x0001 -#define BUILDFLAG_COMPSND 0x0002 -#define BUILDFLAG_INCLUDEEXTFILES 0x0004 -#define BUILDFLAG_MANUALIMGFILTERS 0x0008 -#define BUILDFLAG_MANUALSNDFILTERS 0x0010 -#define BUILDFLAG_NOAUTOEXTRACT 0x0020 -#define BUILDFLAG_NOAPPLETCHECK 0x0040 -#define BUILDFLAG_TEST 0x0080 -#define BUILDFLAG_NOWARNINGS 0x0100 - -#endif - -////////////////////////////////////////////////////////////////////////////// -// Element of chunk Extensions -// -#ifndef _H2INC -typedef struct ExtDesc { - WORD extSize; - WORD extIndex; - DWORD extMagicNumber; -} ExtDesc; -typedef ExtDesc *LPEXTDESC; - -typedef struct ExtDesc2 { - WORD extSize; - WORD extIndex; - DWORD extMagicNumber; - DWORD extVersionLS; - DWORD extVersionMS; -} ExtDesc2; -typedef ExtDesc2 *LPEXTDESC2; -#endif - -////////////////////////////////////////////////////////////////////////////// -// Movement Extensions Chunk -// -typedef struct MvtExtDesc { - WORD extTotalSize; - WORD extHdrSize; - DWORD extBuild; -} MvtExtDesc; -typedef MvtExtDesc *LPMVTEXTDESC; - -////////////////////////////////////////////////////////////////////////////// -// Frame Header -// -typedef struct FrameHeader -{ - // Playfield - LONG leWidth; // Playfield width in pixels - LONG leHeight; // Playfield height in pixels - COLORREF leBackground; - - // Options - DWORD leFlags; - - -} FrameHeader; - -// leFlags -#define LEF_DISPLAYNAME 0x0001 -#define LEF_GRABDESKTOP 0x0002 -#define LEF_KEEPDISPLAY 0x0004 -//#define LEF_FADEIN 0x0008 -//#define LEF_FADEOUT 0x0010 -#define LEF_TOTALCOLMASK 0x0020 -#define LEF_PASSWORD 0x0040 -#define LEF_RESIZEATSTART 0x0100 -#define LEF_DONOTCENTER 0x0200 -#define LEF_FORCE_LOADONCALL 0x0400 -#define LEF_NOSURFACE 0x0800 -#define LEF_RESERVED_1 0x1000 -#define LEF_RESERVED_2 0x2000 -#define LEF_RECORDDEMO 0x4000 -#define LEF_TIMEDMVTS 0x8000 - -////////////////////////////////////////////////////////////////////////////// -// Layers -// - -#define FLOPT_XCOEF 0x0001 -#define FLOPT_YCOEF 0x0002 -#define FLOPT_NOSAVEBKD 0x0004 -#define FLOPT_WRAP_OBSOLETE 0x0008 -#define FLOPT_VISIBLE 0x0010 -#define FLOPT_WRAP_HORZ 0x0020 -#define FLOPT_WRAP_VERT 0x0040 -#define FLOPT_PREVIOUSEFFECT 0x0080 -#define FLOPT_REDRAW 0x000010000 -#define FLOPT_TOHIDE 0x000020000 -#define FLOPT_TOSHOW 0x000040000 - -typedef struct EditFrameLayer -{ - DWORD dwOptions; // Options - float xCoef; - float yCoef; - DWORD nBkdLOs; - DWORD nFirstLOIndex; - -} EditFrameLayer; - -typedef struct EditFrameLayerEffect { - - DWORD dwInkFx; - DWORD dwRGBA; - DWORD dwExtInkFxIdx; - DWORD nParams; - LPARAM paramData; // offset - -} EditFrameLayerEffect; - -// Effects -#ifdef HWABETA - -typedef struct EffectHdr { - DWORD dwEffectNameOffset; - DWORD dwEffectDataOffset; - DWORD dwEffectParamsOffset; - DWORD dwOptions; -} EffectHdr; - -#define EFFECTOPT_BKDTEXTUREMASK 0x000F - -typedef struct EffectParamsHdr { - DWORD dwNParams; - DWORD dwParamTypesOffset; - DWORD dwParamNamesOffset; -} EffectParamsHdr; - -typedef struct EffectRunData { - - DWORD erdEffectIndex; - DWORD erdNParams; -} EffectRunData; - -typedef struct FrameEffect { - - DWORD ffxInkEffect; - DWORD ffxInkEffectParam; -} FrameEffect; - -#endif - -////////////////////////////////////////////////////////////////////////////// -// ObjInfo/FrameItem Header -// -typedef struct ObjInfoHeader -{ - WORD oiHandle; - WORD oiType; - WORD oiFlags; // Memory flags - WORD oiReserved; // No longer used - DWORD oiInkEffect; // Ink effect - DWORD oiInkEffectParam; // Ink effect param - -} ObjInfoHeader; - -// oiFlags -#define OIF_LOADONCALL 0x0001 -#define OIF_DISCARDABLE 0x0002 -#define OIF_GLOBAL 0x0004 -#define OIF_RESERVED_1 0x0008 -#define OIF_GLOBAL_EDITOR_NOSYNC 0x0010 -#define OIF_GLOBAL_EDITOR_FORCESYNC 0x0020 - -////////////////////////////////////////////////////////////////////////////// -// LevObj/FrameItemInstance -// - -#ifndef _H2INC -#ifdef __cplusplus -class diskLO { -public: -#else -typedef struct diskLO { -#endif - WORD loHandle; // HLO - WORD loOiHandle; // HOI - LONG loX; // Coords - LONG loY; - WORD loParentType; // Parent type - WORD loOiParentHandle; // HOI Parent - WORD loLayer; // Layer - WORD loFree; // Not used -#ifdef __cplusplus -}; -#else -} diskLO; -#endif -typedef diskLO * fpDiskLO; -#endif - -////////////////////////////////////////////////////////////////////////////// -// -// ObjInfo/FrameItem ObjectsCommon -// - -// Obstacle types -enum { - OBSTACLE_NONE, - OBSTACLE_SOLID, - OBSTACLE_PLATFORM, - OBSTACLE_LADDER, - OBSTACLE_TRANSPARENT // for Add Backdrop -}; - -//////////////////////////////// -// Static object - ObjectsCommon -// -#ifndef _H2INC -typedef struct Static_OC { - - // Size - DWORD ocDWSize; - - // Obstacle type & collision mode - WORD ocObstacleType; - WORD ocColMode; // Collision mode (0 = fine, 1 = box) - - LONG ocCx; // Size - LONG ocCy; - -} Static_OC; -typedef Static_OC * LPStatic_OC; -#endif - -/////////////////////////////////////////////////////////////// -// Fill Type & shapes - Definitions -// - -#ifndef _H2INC -// Gradient -typedef struct GradientData { - COLORREF color1; - COLORREF color2; - DWORD vertical; -} GradientData; - -// Shapes -enum { - SHAPE_NONE=0, // Error - SHAPE_LINE, - SHAPE_RECTANGLE, - SHAPE_ELLIPSE -}; - -// Fill types -enum { - FILLTYPE_NONE, - FILLTYPE_SOLID, - FILLTYPE_GRADIENT, - FILLTYPE_MOTIF -}; - -// Line flags -#define LINEF_INVX 0x0001 -#define LINEF_INVY 0x0002 - -#endif - -/////////////////////////////////////////////////////////////// -// Fill Type - Part of FilledShape -// -#ifndef _H2INC - -#ifdef __cplusplus -class FillType_Data { -public: -#else -typedef struct FillType_Data { -#endif - WORD ocFillType; - union { - struct { - DWORD ocLineFlags; // Only for lines in non filled mode - }; - struct { - COLORREF ocColor; // Solid - }; - struct { - COLORREF ocColor1; // Gradient - COLORREF ocColor2; - DWORD ocGradientFlags; - }; - struct { - WORD ocImage; // Image - }; - }; -#ifdef __cplusplus -}; -#else -} FillType_Data; -#endif - -#endif - -/////////////////////////////////////////////////////////////// -// Filled Shape - Part of QuickBackdrop / Counter ObjectsCommon -// -#ifndef _H2INC - -#ifdef __cplusplus -class FilledShape_Data { -public: -#else -typedef struct FilledShape_Data { -#endif - WORD ocBorderSize; // Border - COLORREF ocBorderColor; - WORD ocShape; // Shape - FillType_Data ocFillData; // Fill Type infos -#ifdef __cplusplus -}; -#else -} FilledShape_Data; -#endif -typedef FilledShape_Data * LPFilledShape_Data; - -#endif - -///////////////////////////////// -// Quick backdrop - ObjectsCommon -// -#ifndef _H2INC - -typedef struct QuickBackdrop_OC { - - DWORD ocDWSize; - - WORD ocObstacleType; // Obstacle type - WORD ocColMode; // Collision mode (0 = fine, 1 = box) - - LONG ocCx; // Size - LONG ocCy; - - FilledShape_Data ocFilledShape; // Filled shape infos - -} QuickBackdrop_OC; -typedef QuickBackdrop_OC * LPQuickBackdrop_OC; - -#endif - -///////////////////////////////// -// Backdrop - ObjectsCommon -// -#ifndef _H2INC - -typedef struct Backdrop_OC { - - DWORD ocDWSize; - - WORD ocObstacleType; // Obstacle type - WORD ocColMode; // Collision mode (0 = fine, 1 = box) - - LONG ocCx; // Size - LONG ocCy; - - WORD ocImage; // Image - -} Backdrop_OC; -typedef Backdrop_OC * LPBackdrop_OC; - -#endif - -////////////////////////////////////////////////////////////////////////////// -// -// ObjInfo/FrameItem ObjectsCommon Data -// - -////////////////////////////////////////////////////////////////////////////// -// ImageSet -// - -#ifdef __cplusplus -class ImageSet_Data { -public: -#else -typedef struct ImageSet_Data { -#endif - WORD nbFrames; // Number of frames - // Followed by list of image handles (WORD[]) -#ifdef __cplusplus -}; -#else -} ImageSet_Data; -#endif -typedef ImageSet_Data * LPImageSet_Data; - -//////////////////////////////////////// -// Text - ocData -// -typedef struct otText { - - DWORD otDWSize; - LONG otCx; - LONG otCy; - DWORD otNumberOfText; // Paragraph number (> 1 if question object) - DWORD otStringOffset[1]; // String offsets - -} otText; -typedef otText * fpot; -#define sizeof_ot (sizeof(otText)-sizeof(DWORD)) - -typedef struct txString { - WORD tsFont; // Font - WORD tsFlags; // Flags - COLORREF tsColor; // Color - TCHAR tsChar[1]; -} txString; -typedef txString * fpts; -#define sizeof_ts 8 // (sizeof(txString)-1) - -#define TSF_LEFT 0x0000 // DT_LEFT -#define TSF_HCENTER 0x0001 // DT_CENTER -#define TSF_RIGHT 0x0002 // DT_RIGHT -#define TSF_VCENTER 0x0004 // DT_VCENTER -#define TSF_HALIGN 0x000F // DT_LEFT | DT_RIGHT | DT_CENTER | DT_VCENTER | DT_BOTTOM - -#define TSF_CORRECT 0x0100 -#define TSF_RELIEF 0x0200 -#define TSF_RTL 0x0400 - -//////////////////////////////////////// -// Scores, lives, counters -// -typedef struct CtAnim_Data { - - DWORD odDWSize; - LONG odCx; // Size: only lives & counters - LONG odCy; - WORD odPlayer; // Player: only score & lives - WORD odDisplayType; // CTA_xxx - WORD odDisplayFlags; // BARFLAG_INVERSE - WORD odFont; // Font - - // Followed by display data: -// union { -// ImageSet_Data odImages; -// FilledShape_Data odShape; -// }; - -} CtAnim_Data; -typedef CtAnim_Data * LPCtAnim_Data; - -// Display types -enum { - CTA_HIDDEN, - CTA_DIGITS, - CTA_VBAR, - CTA_HBAR, - CTA_ANIM, - CTA_TEXT, -}; - -// Display flags -#define CPTDISPFLAG_INTNDIGITS 0x000F // 0 = normal display, other value = pad with zeros or truncate -#define CPTDISPFLAG_FLOATNDIGITS 0x00F0 // add 1 to get the number of significant digits to display -#define CPTDISPFLAG_FLOATNDIGITS_SHIFT 4 -#define CPTDISPFLAG_FLOATNDECIMALS 0xF000 // number of digits to display after the decimal point -#define CPTDISPFLAG_FLOATNDECIMALS_SHIFT 12 -#define BARFLAG_INVERSE 0x0100 -#define CPTDISPFLAG_FLOAT_FORMAT 0x0200 // 1 to use the specified numbers of digits, 0 to use standard display (%g) -#define CPTDISPFLAG_FLOAT_USENDECIMALS 0x0400 // 1 to use the specified numbers of digits after the decimal point -#define CPTDISPFLAG_FLOAT_PADD 0x0800 // 1 to left padd with zeros - -// Counters images -enum { - COUNTER_IMAGE_0, - COUNTER_IMAGE_1, - COUNTER_IMAGE_2, - COUNTER_IMAGE_3, - COUNTER_IMAGE_4, - COUNTER_IMAGE_5, - COUNTER_IMAGE_6, - COUNTER_IMAGE_7, - COUNTER_IMAGE_8, - COUNTER_IMAGE_9, - COUNTER_IMAGE_SIGN_NEG, - COUNTER_IMAGE_SIGN_PLUS, - COUNTER_IMAGE_POINT, - COUNTER_IMAGE_EXP, - COUNTER_IMAGE_MAX -}; -#define V1_COUNTER_IMAGE_MAX (COUNTER_IMAGE_SIGN_NEG+1) - -//////////////////////////////////////// -// -// Objet RTF - ocData -// -#ifndef _H2INC - -typedef struct ocRTF { - - DWORD odDWSize; - DWORD odVersion; // 0 - DWORD odOptions; // Options - COLORREF odBackColor; // Background color - LONG odCx; // Size - LONG odCy; - -} ocRTF; -typedef ocRTF * LPOCRTF; - -//#define RTFOPT_TRANSPARENT 0x0001 // Transparent -//#define RTFOPT_VSLIDER 0x0002 // Display vertical slider if necessary -//#define RTFOPT_HSLIDER 0x0004 // Display horizontal slider if necessary - -#endif - -//////////////////////////////////////// -// -// Objet CCA - ocData -// -#ifndef _H2INC - -typedef struct ocCCA { - - DWORD odDWSize; - LONG odCx; // Size (ignored) - LONG odCy; - WORD odVersion; // 0 - WORD odNStartFrame; - DWORD odOptions; // Options - DWORD odIconOffset; // Icon offset - DWORD odFree; // Free - -} ocCCA; -typedef ocCCA * LPOCCCA; - -// Options -#define CCAF_SHARE_GLOBALVALUES 0x00000001 -#define CCAF_SHARE_LIVES 0x00000002 -#define CCAF_SHARE_SCORES 0x00000004 -#define CCAF_SHARE_WINATTRIB 0x00000008 -#define CCAF_STRETCH 0x00000010 -#define CCAF_POPUP 0x00000020 -#define CCAF_CAPTION 0x00000040 -#define CCAF_TOOLCAPTION 0x00000080 -#define CCAF_BORDER 0x00000100 -#define CCAF_WINRESIZE 0x00000200 -#define CCAF_SYSMENU 0x00000400 -#define CCAF_DISABLECLOSE 0x00000800 -#define CCAF_MODAL 0x00001000 -#define CCAF_DIALOGFRAME 0x00002000 -#define CCAF_INTERNAL 0x00004000 -#define CCAF_HIDEONCLOSE 0x00008000 -#define CCAF_CUSTOMSIZE 0x00010000 -#define CCAF_INTERNALABOUTBOX 0x00020000 -#define CCAF_CLIPSIBLINGS 0x00040000 -#define CCAF_SHARE_PLAYERCTRLS 0x00080000 -#define CCAF_MDICHILD 0x00100000 -#define CCAF_DOCKED 0x00200000 -#define CCAF_DOCKING_AREA 0x00C00000 -#define CCAF_DOCKED_LEFT 0x00000000 -#define CCAF_DOCKED_TOP 0x00400000 -#define CCAF_DOCKED_RIGHT 0x00800000 -#define CCAF_DOCKED_BOTTOM 0x00C00000 -#define CCAF_REOPEN 0x01000000 -#define CCAF_MDIRUNEVENIFNOTACTIVE 0x02000000 -#define CCAF_DISPLAYASSPRITE 0x04000000 - -#endif - -//////////////////////////////////////// -// -// Transition -// - -#ifndef _H2INC - -// Transition header -typedef struct TransitionHdr { - DWORD trDllID; // DLL id - DWORD trID; // Transition ID - DWORD trDuration; // Duration - DWORD trFlags; // From / to color / background - DWORD trColor; // Color -} TransitionHdr; - -// Transition run-time data -#ifdef __cplusplus -class Transition_Data { -public: -#else -typedef struct Transition_Data { -#endif - TransitionHdr trHdr; - DWORD trDllNameOffset; - DWORD trParamsOffset; - DWORD trParamsSize; - // Followed by DLL name & transition parameters -#ifdef __cplusplus -}; -#else -} Transition_Data; -#endif -typedef Transition_Data * LPTRANSITIONDATA; - -#define TRFLAG_COLOR 0x0001 -#define TRFLAG_UNICODE 0x0002 - -#endif - -// Text alignment flags -#define TEXT_ALIGN_LEFT 0x00000001 -#define TEXT_ALIGN_HCENTER 0x00000002 -#define TEXT_ALIGN_RIGHT 0x00000004 -#define TEXT_ALIGN_TOP 0x00000008 -#define TEXT_ALIGN_VCENTER 0x00000010 -#define TEXT_ALIGN_BOTTOM 0x00000020 - -// Right-to-left ordering -#define TEXT_RTL 0x00000100 - -// Text caps -#define TEXT_FONT 0x00010000 -#define TEXT_COLOR 0x00020000 -#define TEXT_COLOR16 0x00040000 - -////////////////////////////////////////////////////////////////////////////// -// -// Run-time Definitions -// - -#ifdef RUN_TIME - -#ifndef _H2INC -typedef short * LPSHORT; -typedef LPVOID * LPLPVOID; -#endif - -// Versions -#define KNPV1_VERSION 0x126 // First K&P version -#define CNCV1_VERSION 0x207 // Click & Create / The Games Factory -#define KNP_VERSION 0x300 - -// Internet Versions -#define FIRST_NETVERSION 0x001 // First vitalize version -#define CCN_NETVERSION 0x002 // CCN applications -#define MORECOMP_NETVERSION 0x003 // Short OIs, compression of levObjs, adpcm sounds, -#define CNC_NETVERSION 0x003 // Current Internet Version - -// Collision mask margins -#define COLMASK_XMARGIN 64 -#define COLMASK_YMARGIN 16 - -// Messages -#define UM_KNP_GETAPPID (WM_APP+7) // No longer used -#define UM_HVSCROLL (WM_APP+8) // No longer used - -// App IDs -#define APPID_KNC 0x3952 // No longer used -#define APPID_KNCSA 0x9172 // No longer used - -// Control IDs -#define ID_EDIT_WIN 300 // ID of edit window - -#endif // RUN_TIME - -// No longer used -#ifndef HFRAN -#define HFRAN LPBYTE -#endif - -// HLO -#define HLO WORD -#define HLO_ERROR ((HLO)-1) -typedef HLO * LPHLO; - -// Frame password size -#define PASSWORD_SIZE 9 - -// Cross-ref tables -enum { - IMG_TAB, - FONT_TAB, - SOUND_TAB, - MUSIC_TAB, - MAX_TABREF -}; - -#ifdef RUN_TIME - -// Preferences -#define PREF_MUSICON 0x4000 -#define PREF_SOUNDON 0x8000 - -// Frame handles -#define HCELL WORD -#define HCELL_ERROR ((WORD)-1) - -// Jump flags -#define MPJC_NOJUMP 0 -#define MPJC_DIAGO 1 -#define MPJC_BUTTON1 2 -#define MPJC_BUTTON2 3 - -// How to play (no longer used) -enum { - HTP_NO=0, - HTP_TXT, - HTP_WRI, - HTP_HLP -}; -#define NB_HTPTYPE 4 - -#endif // RUN_TIME - -// Versions -#define MMFVERSION_MASK 0xFFFF0000 -#define MMFBUILD_MASK 0x00000FFF // MMF build -#define MMFVERFLAG_MASK 0x0000F000 -#define MMFVERFLAG_HOME 0x00008000 // TGF -#define MMFVERFLAG_PRO 0x00004000 // MMF Pro -#define MMFVERFLAG_DEMO 0x00002000 // Demo -#define MMFVERFLAG_PLUGIN 0x00001000 // Plugin -#define MMFVERSION_15 0x01050000 // MMF 1.5 -#define MMFVERSION_20 0x02000000 // MMF 2.0 -#define MMF_CURRENTVERSION MMFVERSION_20 - -// Build numbers -#define MMF_BUILD_NONAME 203 -#define MMF_BUILD_MENUIMAGES 204 -#define MMF_BUILD_SUBAPPICON 205 -#define MMF_BUILD_WINMENUIDX 206 -#define MMF_BUILD_NOTUSED 207 -#define MMF_BUILD_ABOUTTEXT 208 -#define MMF_BUILD_FRAMEDPOS 209 -#define MMF_BUILD_TRSPCOLOR 210 -#define MMF_BUILD_211 211 -#define MMF_BUILD_DEMO 212 -#define MMF_BUILD_PREBETA_2 213 -#define MMF_BUILD_PREBETA_3 214 -#define MMF_BUILD_PREBETA_4 215 // First update Jason's book -#define MMF_BUILD_ALTVALUES 216 -#define MMF_BUILD_EDTCHUNKS 217 -#define MMF_BUILD_COUNTERTEXT 218 -#define MMF_BUILD_SDK 219 // Pre-SDK version -#define MMF_BUILD_SDK2 220 // Second SDK version -#define MMF_BUILD_MVTSDK2 221 // Second Mvt SDK version -#define MMF_BUILD_FIXCOLLISANDBEH 222 -#define MMF_BUILD_PROPFILTERS 223 -#define MMF_BUILD_MFXEXTS 224 -#define MMF_BUILD_LASTFRAMEOFFSET 225 -#define MMF_BUILD_EDUDEMOFEB06 226 -#define MMF_BUILD_GLBOBJBUG 227 -#define MMF_BUILD_IDTC 228 -#define MMF_BUILD_229 229 -#define MMF_BUILD_230 230 -#define MMF_BUILD_231 231 -#define MMF_BUILD_FIXQUALIF 232 -#define MMF_BUILD_233 233 -#define MMF_BUILD_234_TGFPR 234 -#define MMF_BUILD_235 235 -#define MMF_BUILD_236 236 -#define MMF_BUILD_237 237 -#define MMF_BUILD_238 238 -#define MMF_BUILD_239_CD 239 -#define MMF_BUILD_240_DEMO 240 -#define MMF_BUILD_241_SP1 241 -#define MMF_BUILD_242_SP2 242 -#define MMF_BUILD_243_SP3 243 -#define MMF_BUILD_244_SP4 244 -#define MMF_BUILD_245_SP5 245 -#define MMF_BUILD_246_SP6 246 -#define MMF_BUILD_247_SP7 247 -#define MMF_BUILD_248_JAVA 248 -#define MMF_BUILD_249_MOBILE_FLASH 249 -#define MMF_BUILD_250 250 -#define MMF_BUILD_251 251 -#define MMF_BUILD_252 252 -#define MMF_BUILD_253 253 -#define MMF_BUILD_254 254 -#define MMF_CURRENTBUILD MMF_BUILD_254 - -// MFA file format versions -#define MFA_BUILD_ALTSTR 1 // Alterable strings -#define MFA_BUILD_COUNTERTEXT 2 // Text mode in counters -#define MFA_BUILD_LASTFRAMEOFFSET 3 // Additional frame offset -#define MFA_BUILD_FIXQUALIF 4 // Fix in qualifiers + prd version -#ifdef _UNICODE -#define MFA_BUILD_LANGID 5 // Language ID -#define MFA_CURRENTBUILD MFA_BUILD_LANGID -#else -#define MFA_CURRENTBUILD MFA_BUILD_FIXQUALIF -#endif - -// Structures for picture editor -typedef struct EditSurfaceParamsA { - - DWORD m_dwSize; // sizeof(EditSurfaceParams) - LPSTR m_pWindowTitle; // Picture Editor title (NULL = default title) - cSurface* m_pSf; // Surface to edit - DWORD m_dwOptions; // Options, see PictEdDefs.h - DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) - DWORD m_dwFixedHeight;// Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) - POINT m_hotSpot; // Hot spot coordinates - POINT m_actionPoint; // Action point coordinates - -} EditSurfaceParamsA; -typedef EditSurfaceParamsA* LPEDITSURFACEPARAMSA; - -typedef struct EditSurfaceParamsW { - - DWORD m_dwSize; // sizeof(EditSurfaceParams) - LPWSTR m_pWindowTitle; // Picture Editor title (NULL = default title) - cSurface* m_pSf; // Surface to edit - DWORD m_dwOptions; // Options, see PictEdDefs.h - DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) - DWORD m_dwFixedHeight;// Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) - POINT m_hotSpot; // Hot spot coordinates - POINT m_actionPoint; // Action point coordinates - -} EditSurfaceParamsW; -typedef EditSurfaceParamsW* LPEDITSURFACEPARAMSW; - -#ifdef _UNICODE -#define EditSurfaceParams EditSurfaceParamsW -typedef EditSurfaceParamsW* LPEDITSURFACEPARAMS; -#else -#define EditSurfaceParams EditSurfaceParamsA -typedef EditSurfaceParamsA* LPEDITSURFACEPARAMS; -#endif - -typedef struct EditImageParamsA { - - DWORD m_dwSize; // sizeof(EditImageParams) - LPSTR m_pWindowTitle; // Picture Editor title (NULL = default title) - DWORD m_dwImage; // Image to edit - note: only the LOWORD is used in this version - DWORD m_dwOptions; // Options, see PictEdDefs.h - DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) - DWORD m_dwFixedHeight; // Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) - -} EditImageParamsA; -typedef EditImageParamsA* LPEDITIMAGEPARAMSA; - -typedef struct EditImageParamsW { - - DWORD m_dwSize; // sizeof(EditImageParams) - LPWSTR m_pWindowTitle; // Picture Editor title (NULL = default title) - DWORD m_dwImage; // Image to edit - note: only the LOWORD is used in this version - DWORD m_dwOptions; // Options, see PictEdDefs.h - DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) - DWORD m_dwFixedHeight; // Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) - -} EditImageParamsW; -typedef EditImageParamsW* LPEDITIMAGEPARAMSW; - -#ifdef _UNICODE -#define EditImageParams EditImageParamsW -typedef EditImageParamsW* LPEDITIMAGEPARAMS; -#else -#define EditImageParams EditImageParamsA -typedef EditImageParamsA* LPEDITIMAGEPARAMS; -#endif - -// Structure for image list editor -typedef struct EditAnimationParamsA { - - DWORD m_dwSize; // sizeof(EditAnimationParams) - LPSTR m_pWindowTitle; // Picture Editor title (NULL = default title) - int m_nImages; // Number of images in the list - int m_nMaxImages; // Maximum number of images in the list - int m_nStartIndex; // Index of first image to edit in the editor - LPWORD m_pImages; // Image list (one WORD per image) - LPSTR* m_pImageTitles; // Image titles (can be NULL) - DWORD m_dwOptions; // Options, see PictEdDefs.h - DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) - DWORD m_dwFixedHeight; // Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) - -} EditAnimationParamsA; -typedef EditAnimationParamsA* LPEDITANIMATIONPARAMSA; - -typedef struct EditAnimationParamsW { - - DWORD m_dwSize; // sizeof(EditAnimationParams) - LPWSTR m_pWindowTitle; // Picture Editor title (NULL = default title) - int m_nImages; // Number of images in the list - int m_nMaxImages; // Maximum number of images in the list - int m_nStartIndex; // Index of first image to edit in the editor - LPWORD m_pImages; // Image list (one WORD per image) - LPWSTR* m_pImageTitles; // Image titles (can be NULL) - DWORD m_dwOptions; // Options, see PictEdDefs.h - DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) - DWORD m_dwFixedHeight; // Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) - -} EditAnimationParamsW; -typedef EditAnimationParamsW* LPEDITANIMATIONPARAMSW; - -#ifdef _UNICODE -#define EditAnimationParams EditAnimationParamsW -typedef EditAnimationParamsW* LPEDITANIMATIONPARAMS; -#else -#define EditAnimationParams EditAnimationParamsA -typedef EditAnimationParamsA* LPEDITANIMATIONPARAMS; -#endif - -// Global variables structure -#ifdef __cplusplus -class mv { -public: -#else -typedef struct mv { -#endif - - // Common to editor and runtime - HINSTANCE mvHInst; // Application HINSTANCE - npAppli mvIdAppli; // Application object in DLL - npWin mvIdMainWin; // Main window object in DLL - npWin mvIdEditWin; // Child window object in DLL - HWND mvHMainWin; // Main window handle - HWND mvHEditWin; // Child window handle - HPALETTE mvHPal256; // 256 color palette - WORD mvAppMode; // Screen mode with flags - WORD mvScrMode; // Screen mode - DWORD mvEditDXDocToClient; // Edit time only: top-left coordinates - DWORD mvEditDYDocToClient; - CImageFilterMgr* mvImgFilterMgr; // Image filter manager - CSoundFilterMgr* mvSndFilterMgr; // Sound filter manager - CSoundManager* mvSndMgr; // Sound manager - - union { - CEditApp* mvEditApp; // Current application, edit time (not used) - CRunApp* mvRunApp; // Current application, runtime - }; - union { - CEditFrame* mvEditFrame; - CRunFrame* mvRunFrame; - }; - - // Runtime - #ifdef __cplusplus - RunHeader* mvRunHdr; // Current RunHeader - #else - LPVOID mvRunHdr; - #endif - DWORD mvPrefs; // Preferences (sound on/off) - LPTSTR subType; - BOOL mvFullScreen; // Full screen mode - LPTSTR mvMainAppFileName; // App filename - int mvAppListCount; - int mvAppListSize; - CRunApp** mvAppList; - int mvExtListCount; - int mvExtListSize; - LPTSTR * mvExtList; - int mvNbDllTrans; - dllTrans* mvDllTransList; - DWORD mvJoyCaps[32]; - HHOOK mvHMsgHook; - int mvModalLoop; - int mvModalSubAppCount; - LPVOID mvFree[5]; - - // Functions - //////////// - - // Editor: Open Help file - void (CALLBACK * mvHelpA) (LPCSTR pHelpFile, UINT nID, LPARAM lParam); - - // Editor: Get default font for object creation - BOOL (CALLBACK * mvGetDefaultFontA) (LPLOGFONTA plf, LPSTR pStyle, int cbSize); - - // Editor: Edit images and animations - BOOL (CALLBACK * mvEditSurfaceA) (LPVOID edPtr, LPEDITSURFACEPARAMSA pParams, HWND hParent); - BOOL (CALLBACK * mvEditImageA) (LPVOID edPtr, LPEDITIMAGEPARAMSA pParams, HWND hParent); - BOOL (CALLBACK * mvEditAnimationA) (LPVOID edPtr, LPEDITANIMATIONPARAMSA pParams, HWND hParent); - - // Runtime: Extension User data - LPVOID (CALLBACK * mvGetExtUserData) (CRunApp* pApp, HINSTANCE hInst); - LPVOID (CALLBACK * mvSetExtUserData) (CRunApp* pApp, HINSTANCE hInst, LPVOID pData); - - // Runtime: Register dialog box - void (CALLBACK * mvRegisterDialogBox) (HWND hDlg); - void (CALLBACK * mvUnregisterDialogBox) (HWND hDlg); - - // Runtime: Add surface as backdrop object - void (CALLBACK * mvAddBackdrop) (cSurface* pSf, int x, int y, DWORD dwInkEffect, DWORD dwInkEffectParam, int nObstacleType, int nLayer); - - // Runtime: Binary files - BOOL (CALLBACK * mvGetFileA)(LPCSTR pPath, LPSTR pFilePath, DWORD dwFlags); - void (CALLBACK * mvReleaseFileA)(LPCSTR pPath); - HANDLE (CALLBACK * mvOpenHFileA)(LPCSTR pPath, LPDWORD pDwSize, DWORD dwFlags); - void (CALLBACK * mvCloseHFile)(HANDLE hf); - - // Plugin: download file - int (CALLBACK * mvLoadNetFileA) (LPSTR pFilename); - - // Plugin: send command to Vitalize - int (CALLBACK * mvNetCommandA) (int, LPVOID, DWORD, LPVOID, DWORD); - - // Editor & Runtime: Returns the version of MMF or of the runtime - DWORD (CALLBACK * mvGetVersion) (); - - // Editor & Runtime: callback function for properties or other functions - #ifdef _cplusplus - LRESULT (CALLBACK * mvCallFunction) (LPVOID edPtr, int nFnc, LPARAM lParam1=0, LPARAM lParam2=0, LPARAM lParam3=0); - #else - LRESULT (CALLBACK * mvCallFunction) (LPVOID edPtr, int nFnc, LPARAM lParam1, LPARAM lParam2, LPARAM lParam3); - #endif - - // Editor: Open Help file (UNICODE) - void (CALLBACK * mvHelpW) (LPCWSTR pHelpFile, UINT nID, LPARAM lParam); - - // Editor: Get default font for object creation (UNICODE) - BOOL (CALLBACK * mvGetDefaultFontW) (LPLOGFONTW plf, LPWSTR pStyle, int cbSize); - - // Editor: Edit images and animations (UNICODE) - BOOL (CALLBACK * mvEditSurfaceW) (LPVOID edPtr, LPEDITSURFACEPARAMSW pParams, HWND hParent); - BOOL (CALLBACK * mvEditImageW) (LPVOID edPtr, LPEDITIMAGEPARAMSW pParams, HWND hParent); - BOOL (CALLBACK * mvEditAnimationW) (LPVOID edPtr, LPEDITANIMATIONPARAMSW pParams, HWND hParent); - - // Runtime: Binary files (UNICODE - BOOL (CALLBACK * mvGetFileW)(LPCWSTR pPath, LPWSTR pFilePath, DWORD dwFlags); - void (CALLBACK * mvReleaseFileW)(LPCWSTR pPath); - HANDLE (CALLBACK * mvOpenHFileW)(LPCWSTR pPath, LPDWORD pDwSize, DWORD dwFlags); - - // Plugin: download file - int (CALLBACK * mvLoadNetFileW) (LPWSTR pFilename); - - // Plugin: send command to Vitalize - int (CALLBACK * mvNetCommandW) (int, LPVOID, DWORD, LPVOID, DWORD); - - // Place-holder for next versions - LPVOID mvAdditionalFncs[6]; - -#ifdef __cplusplus -}; -#else -} mv; -#endif -typedef mv *LPMV; - -#ifdef _UNICODE -#define mvHelp mvHelpW -#define mvGetDefaultFont mvGetDefaultFontW -#define mvEditSurface mvEditSurfaceW -#define mvEditImage mvEditImageW -#define mvEditAnimation mvEditAnimationW -#define mvGetFile mvGetFileW -#define mvReleaseFile mvReleaseFileW -#define mvLoadNetFile mvLoadNetFileW -#define mvNetCommand mvNetCommandW -#define mvGetFile mvGetFileW -#define mvReleaseFile mvReleaseFileW -#define mvOpenHFile mvOpenHFileW -#else -#define mvHelp mvHelpA -#define mvGetDefaultFont mvGetDefaultFontA -#define mvEditSurface mvEditSurfaceA -#define mvEditImage mvEditImageA -#define mvEditAnimation mvEditAnimationA -#define mvGetFile mvGetFileA -#define mvReleaseFile mvReleaseFileA -#define mvLoadNetFile mvLoadNetFileA -#define mvNetCommand mvNetCommandA -#define mvGetFile mvGetFileA -#define mvReleaseFile mvReleaseFileA -#define mvOpenHFile mvOpenHFileA -#endif - -// Callback function identifiers for mvCallFunction -enum { - // Editor only - EF_INSERTPROPS=1, // Insert properties into Property window - EF_REMOVEPROP, // Remove property - EF_REMOVEPROPS, // Remove properties - EF_REFRESHPROP, // Refresh propery - EF_REALLOCEDITDATA, // Reallocate edPtr - EF_GETPROPVALUE, // Get object's property value - EF_GETAPPPROPVALUE, // Get application's property value - EF_GETFRAMEPROPVALUE, // Get frame's property value - EF_SETPROPVALUE, // Set object's property value - EF_SETAPPPROPVALUE, // Set application's property value - EF_SETFRAMEPROPVALUE, // Set frame's property value - EF_GETPROPCHECK, // Get object's property check state - EF_GETAPPPROPCHECK, // Get application's property check state - EF_GETFRAMEPROPCHECK, // Get frame's property check state - EF_SETPROPCHECK, // Set object's property check state - EF_SETAPPPROPCHECK, // Set application's property check state - EF_SETFRAMEPROPCHECK, // Set frame's property check state - EF_INVALIDATEOBJECT, // Refresh object in frame editor - EF_RECALCLAYOUT, // Recalc runtime layout (docking) - EF_GETNITEMS, // Get number of items - not yet implemented - EF_GETNEXTITEM, // Get next item - not yet implemented - EF_GETNINSTANCES, // Get number of item instances - not yet implemented - EF_GETNEXTINSTANCE, // Get next item instance - not yet implemented - - // Editor & runtime - EF_MALLOC=100, // Allocate memory - EF_CALLOC, // Allocate memory & set it to 0 - EF_REALLOC, // Re-allocate memory - EF_FREE, // Free memory - EF_GETSOUNDMGR, // Get sound manager - EF_CLOSESOUNDMGR, // Close sound manager - EF_ENTERMODALLOOP, // Reserved - EF_EXITMODALLOOP, // Reserved - EF_CREATEEFFECT, // Create effect (runtime only) - EF_DELETEEFFECT, // Delete effect (runtime only) - EF_CREATEIMAGEFROMFILEA,// Create image from file (runtime only) - EF_NEEDBACKGROUNDACCESS,// HWA : tell the frame the frame surface can be read (runtime only) - EF_ISHWA, // Returns TRUE if HWA version (editor and runtime) - EF_ISUNICODE, // Returns TRUE if the editor or runtime is in Unicode mode - EF_ISUNICODEAPP, // Returns TRUE if the application being loaded is a Unicode application - EF_GETAPPCODEPAGE, // Returns the code page of the application - EF_CREATEIMAGEFROMFILEW,// Create image from file (runtime only) -}; - -// 3rd parameter of EF_CREATEIMAGEFROMFILE -typedef struct CreateImageFromFileInfo { - int nSize; - int xHS; - int yHS; - int xAP; - int yAP; - COLORREF trspColor; -} CreateImageFromFileInfo; - - -// Callback function macros for mvCallFunction -#ifdef __cplusplus -__inline void mvInsertProps(LPMV mV, LPVOID edPtr, PropData* pProperties, UINT nInsertPropID, BOOL bAfter) \ - { mV->mvCallFunction(edPtr, EF_INSERTPROPS, (LPARAM)pProperties, (LPARAM)nInsertPropID, (LPARAM)bAfter); } - -__inline void mvRemoveProp(LPMV mV, LPVOID edPtr, UINT nPropID) \ - { mV->mvCallFunction(edPtr, EF_REMOVEPROP, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } - -__inline void mvRemoveProps(LPMV mV, LPVOID edPtr, PropData* pProperties) \ - { mV->mvCallFunction(edPtr, EF_REMOVEPROPS, (LPARAM)pProperties, (LPARAM)0, (LPARAM)0); } - -__inline void mvRefreshProp(LPMV mV, LPVOID edPtr, UINT nPropID, BOOL bReInit) \ - { mV->mvCallFunction(edPtr, EF_REFRESHPROP, (LPARAM)nPropID, (LPARAM)bReInit, (LPARAM)0); } - -__inline LPVOID mvReAllocEditData(LPMV mV, LPVOID edPtr, DWORD dwNewSize) \ - { return (LPVOID)mV->mvCallFunction(edPtr, EF_REALLOCEDITDATA, (LPARAM)edPtr, dwNewSize, 0); } - -__inline CPropValue* mvGetPropValue(LPMV mV, LPVOID edPtr, UINT nPropID) \ - { return (CPropValue*)mV->mvCallFunction(edPtr, EF_GETPROPVALUE, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } - -__inline CPropValue* mvGetAppPropValue(LPMV mV, LPVOID edPtr, UINT nPropID) \ - { return (CPropValue*)mV->mvCallFunction(edPtr, EF_GETAPPPROPVALUE, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } - -__inline CPropValue* mvGetFramePropValue(LPMV mV, LPVOID edPtr, UINT nPropID) \ - { return (CPropValue*)mV->mvCallFunction(edPtr, EF_GETFRAMEPROPVALUE, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } - -__inline void mvSetPropValue(LPMV mV, LPVOID edPtr, UINT nPropID, CPropValue* pValue) \ - { mV->mvCallFunction(edPtr, EF_SETPROPVALUE, (LPARAM)nPropID, (LPARAM)pValue, (LPARAM)0); } - -__inline void mvSetAppPropValue(LPMV mV, LPVOID edPtr, UINT nPropID, CPropValue* pValue) \ - { mV->mvCallFunction(edPtr, EF_SETAPPPROPVALUE, (LPARAM)nPropID, (LPARAM)pValue, (LPARAM)0); } - -__inline void mvSetFramePropValue(LPMV mV, LPVOID edPtr, UINT nPropID, CPropValue* pValue) \ - { mV->mvCallFunction(edPtr, EF_SETFRAMEPROPVALUE, (LPARAM)nPropID, (LPARAM)pValue, (LPARAM)0); } - -__inline UINT mvGetPropCheck(LPMV mV, LPVOID edPtr, UINT nPropID) \ - { return (UINT)mV->mvCallFunction(edPtr, EF_GETPROPCHECK, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } - -__inline UINT mvGetAppPropCheck(LPMV mV, LPVOID edPtr, UINT nPropID) \ - { return (UINT)mV->mvCallFunction(edPtr, EF_GETAPPPROPCHECK, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } - -__inline UINT mvGetFramePropCheck(LPMV mV, LPVOID edPtr, UINT nPropID) \ - { return (UINT)mV->mvCallFunction(edPtr, EF_GETFRAMEPROPCHECK, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } - -__inline void mvSetPropCheck(LPMV mV, LPVOID edPtr, UINT nPropID, UINT nCheck) \ - { mV->mvCallFunction(edPtr, EF_SETPROPCHECK, (LPARAM)nPropID, (LPARAM)nCheck, (LPARAM)0); } - -__inline void mvSetAppPropCheck(LPMV mV, LPVOID edPtr, UINT nPropID, UINT nCheck) \ - { mV->mvCallFunction(edPtr, EF_SETAPPPROPCHECK, (LPARAM)nPropID, (LPARAM)nCheck, (LPARAM)0); } - -__inline void mvSetFramePropCheck(LPMV mV, LPVOID edPtr, UINT nPropID, UINT nCheck) \ - { mV->mvCallFunction(edPtr, EF_SETFRAMEPROPCHECK, (LPARAM)nPropID, (LPARAM)nCheck, (LPARAM)0); } - -__inline void mvInvalidateObject(LPMV mV, LPVOID edPtr) \ - { mV->mvCallFunction(edPtr, EF_INVALIDATEOBJECT, (LPARAM)0, (LPARAM)0, (LPARAM)0); } - -__inline LPVOID mvMalloc(LPMV mV, int nSize) \ - { return (LPVOID)mV->mvCallFunction(NULL, EF_MALLOC, (LPARAM)nSize, (LPARAM)0, (LPARAM)0); } - -__inline LPVOID mvCalloc(LPMV mV, int nSize) \ - { return (LPVOID)mV->mvCallFunction(NULL, EF_CALLOC, (LPARAM)nSize, (LPARAM)0, (LPARAM)0); } - -__inline LPVOID mvReAlloc(LPMV mV, LPVOID ptr, int nNewSize) \ - { return (LPVOID)mV->mvCallFunction(NULL, EF_REALLOC, (LPARAM)ptr, (LPARAM)nNewSize, (LPARAM)0); } - -__inline void mvFree(LPMV mV, LPVOID ptr) \ - { mV->mvCallFunction(NULL, EF_FREE, (LPARAM)ptr, (LPARAM)0, (LPARAM)0); } - -__inline void mvRecalcLayout(LPMV mV) \ - { mV->mvCallFunction(NULL, EF_RECALCLAYOUT, (LPARAM)0, (LPARAM)0, (LPARAM)0); } - -__inline CSoundManager* mvGetSoundMgr(LPMV mV) \ - { mV->mvCallFunction(NULL, EF_GETSOUNDMGR, (LPARAM)0, (LPARAM)0, (LPARAM)0); } - -__inline void mvCloseSoundMgr(LPMV mV) \ - { mV->mvCallFunction(NULL, EF_CLOSESOUNDMGR, (LPARAM)0, (LPARAM)0, (LPARAM)0); } - -__inline int mvGetNItems(LPMV mV, LPVOID edPtr, LPCSTR extName) \ - { return mV->mvCallFunction(edPtr, EF_GETNITEMS, (LPARAM)extName, (LPARAM)0, (LPARAM)0); } - -__inline LPVOID mvGetFirstItem(LPMV mV, LPVOID edPtr, LPCSTR extName) \ - { return (LPVOID)mV->mvCallFunction(edPtr, EF_GETNEXTITEM, (LPARAM)extName, (LPARAM)0, (LPARAM)0); } - -__inline LPVOID mvGetNextItem(LPMV mV, LPVOID edPtr, LPVOID edPtr1, LPCSTR extName) \ - { return (LPVOID)mV->mvCallFunction(edPtr, EF_GETNEXTITEM, (LPARAM)edPtr1, (LPARAM)extName, (LPARAM)0); } - -#ifdef HWABETA - -__inline BOOL mvCreateEffect(LPMV mV, LPCSTR pEffectName, LPINT pEffect, LPARAM* pEffectParam) \ - { return (BOOL)mV->mvCallFunction(NULL, EF_CREATEEFFECT, (LPARAM)pEffectName, (LPARAM)pEffect, (LPARAM)pEffectParam); } - -__inline void mvDeleteEffect(LPMV mV, int nEffect, LPARAM lEffectParam) \ - { mV->mvCallFunction(NULL, EF_DELETEEFFECT, (LPARAM)nEffect, (LPARAM)lEffectParam, (LPARAM)0); } - -#endif // HWABETA - -__inline BOOL mvCreateImageFromFileA(LPMV mV, LPWORD pwImg, LPCSTR pFilename, CreateImageFromFileInfo* pInfo) \ - { return (BOOL)mV->mvCallFunction(NULL, EF_CREATEIMAGEFROMFILEA, (LPARAM)pwImg, (LPARAM)pFilename, (LPARAM)pInfo); } - -__inline BOOL mvCreateImageFromFileW(LPMV mV, LPWORD pwImg, LPCWSTR pFilename, CreateImageFromFileInfo* pInfo) \ - { return (BOOL)mV->mvCallFunction(NULL, EF_CREATEIMAGEFROMFILEW, (LPARAM)pwImg, (LPARAM)pFilename, (LPARAM)pInfo); } - -__inline LPVOID mvNeebBackgroundAccess(LPMV mV, CRunFrame* pFrame, BOOL bNeedAccess) \ - { return (LPVOID)mV->mvCallFunction(NULL, EF_NEEDBACKGROUNDACCESS, (LPARAM)pFrame, (LPARAM)bNeedAccess, (LPARAM)0); } - -__inline BOOL mvIsHWAVersion(LPMV mV) \ - { return mV->mvCallFunction(NULL, EF_ISHWA, (LPARAM)0, (LPARAM)0, (LPARAM)0); } - -__inline BOOL mvIsUnicodeVersion(LPMV mV) \ - { return mV->mvCallFunction(NULL, EF_ISUNICODE, (LPARAM)0, (LPARAM)0, (LPARAM)0); } - -__inline BOOL mvIsUnicodeApp(LPMV mV, LPVOID pApp) \ - { return mV->mvCallFunction(NULL, EF_ISUNICODEAPP, (LPARAM)pApp, (LPARAM)0, (LPARAM)0); } - -__inline int mvGetAppCodePage(LPMV mV, LPVOID pApp) \ - { return mV->mvCallFunction(NULL, EF_GETAPPCODEPAGE, (LPARAM)pApp, (LPARAM)0, (LPARAM)0); } - -#ifdef _UNICODE -#define mvCreateImageFromFile mvCreateImageFromFileW -#else -#define mvCreateImageFromFile mvCreateImageFromFileA -#endif - -#endif // __cplusplus - -// Options for OpenHFile -#define OHFF_LOCALFILE 0x0001 // Vitalize mode only: don't try to download file from server - -#ifdef RUN_TIME - -// EnumEltProc definition -typedef int (CALLBACK* ENUMELTPROC)(LPWORD, int, LPARAM, LPARAM); - -// Extension function table -typedef struct tagKpxFunc { - HINSTANCE kpxHInst; - LPTSTR kpxName; - LPTSTR kpxSubType; - LPVOID kpxUserData; - DWORD ( WINAPI * kpxGetInfos) (int); - int ( WINAPI * kpxLoadObject) (mv *, OI*, LPBYTE, int); - void ( WINAPI * kpxUnloadObject) (mv *, LPBYTE, int); - void ( WINAPI * kpxUpdateFileNames) (mv *, LPTSTR, LPBYTE, void (WINAPI * )(LPCTSTR, LPTSTR)); - short( WINAPI * kpxGetRunObjectInfos) (mv *, LPBYTE); - short( WINAPI * kpxWindowProc) (LPBYTE, HWND, UINT, WPARAM, LPARAM); - int ( WINAPI * kpxEnumElts) (mv *, LPBYTE, ENUMELTPROC, ENUMELTPROC, LPARAM, LPARAM); - int ( WINAPI * kpxLoadData) (mv *, OI*, LPBYTE, HFILE, DWORD); // Not used - int ( WINAPI * kpxUnloadData) (mv *, OI*, LPBYTE); // Not used - void ( WINAPI * kpxStartApp) (mv *, CRunApp*); - void ( WINAPI * kpxEndApp) (mv *, CRunApp*); - void ( WINAPI * kpxStartFrame) (mv *, CRunApp*, int); - void ( WINAPI * kpxEndFrame) (mv *, CRunApp*, int); - HGLOBAL ( WINAPI * kpxUpdateEditStructure) (mv *, LPVOID); -#if defined(VITALIZE) - BOOL bValidated; -#endif - BOOL bUnicode; -} kpxFunc; -typedef kpxFunc * fpKpxFunc; - -// Movement Extension -typedef struct MvxFnc { - HINSTANCE mvxHInst; - LPTSTR mvxFileTitle; - - CMvt* ( CALLBACK * mvxCreateMvt) (DWORD); - - #if defined(VITALIZE) - BOOL bValidated; - #endif -} MvxFnc; - -// Old 16/32 bit macros -#define ADDPTR32(p,l) p+=l; -#define SUBPTR32(p,l) p-=l; -#define INCPTR32(p) p++; - -#endif // RUN_TIME - -// Restore structure alignement -#ifndef _H2INC -#pragma pack( pop, _pack_cncy_ ) -#endif - -#ifndef __cplusplus -#undef CImageFilterMgr -#undef CSoundFilterMgr -#undef CSoundManager -#undef CRunApp -#undef CRunFrame -#undef CEditApp -#undef CEditFrame -#undef CMvt -#undef CPropValue -#endif - -#endif // CNCY_H + +#ifndef CNCY_H +#define CNCY_H + +#include "PictEdDefs.h" + +#ifdef __cplusplus +class cSurface; +class CImageFilterMgr; +class CSoundFilterMgr; +class CSoundManager; +class CRunApp; +class CRunFrame; +class CEditApp; +class CEditFrame; +class CMvt; +class CPropValue; +class OI; +class dllTrans; +class CValue; +#else +#define cSurface void +#define CImageFilterMgr void +#define CSoundFilterMgr void +#define CSoundManager void +#define CRunApp void +#define CRunFrame void +#define CEditApp void +#define CEditFrame void +#define CMvt void +#define CPropValue void +#define OI void +#define dllTrans void +struct CValue; +#endif +struct PropData; +struct RunHeader; + +// Force structure alignement +#ifndef _H2INC +#pragma pack( push, _pack_cncy_ ) +#pragma pack(2) +#endif + +#ifndef _H2INC + +// Object instance parent types +enum { + PARENT_NONE, + PARENT_FRAME, + PARENT_FRAMEITEM, + PARENT_QUALIFIER +}; + +// Proc definition +typedef void (WINAPI * UPDATEFILENAMEPROCA)(LPCSTR, LPSTR); +typedef void (WINAPI * UPDATEFILENAMEPROCW)(LPCWSTR, LPWSTR); +typedef void (WINAPI * UPDATEFILENAMEPROC)(LPCTSTR, LPTSTR); + +// Old object name size, still used in events +#ifndef OINAME_SIZE +#define OINAME_SIZE 24 +#endif // OINAME_SIZE + +// Obsolete +enum { + MODIF_SIZE, + MODIF_PLANE, + MODIF_FLAGS, + MODIF_PICTURE, + MODIF_HFRAN, + MODIF_BOX, + MODIF_TEXT, + MODIF_PREFS +}; +#define KPX_MODIF_BASE 1024 + +#endif // _H2INC + +// Standard objects +#define KPX_BASE 32 // Extensions +enum { + OBJ_BOX, + OBJ_BKD, + OBJ_SPR, + OBJ_TEXT, + OBJ_QUEST, + OBJ_SCORE, + OBJ_LIVES, + OBJ_COUNTER, + OBJ_RTF, + OBJ_CCA, + NB_SYSOBJ +}; + +// Menu header (v2) +typedef struct MenuHdr { + + DWORD mhHdrSize; // == sizeof(MenuHdr) + DWORD mhMenuOffset; // From start of MenuHdr + DWORD mhMenuSize; + DWORD mhAccelOffset; // From start of MenuHdr + DWORD mhAccelSize; + // Total data size = mhHdrSize + mhMenuSize + mhAccelSize +} MenuHdr; + +////////////////////////////////////////////////////////////////////////////// +// Application mini Header +// +typedef struct AppMiniHeader { + + union { + char gaType[4]; // "PAME" + DWORD gaDWType; + }; + WORD gaVersion; // Version number + WORD gaSubVersion; // Sub-version number + DWORD gaPrdVersion; // MMF version + DWORD gaPrdBuild; // MMF build number + +} AppMiniHeader; + +#define RUNTIME_DWTYPEA 'EMAP' +#define RUNTIME_DWTYPEW 'UMAP' +#define RUNTIME_DWTYPE_VTZA ' ZTV' +#define RUNTIME_DWTYPE_VTZW 'UZTV' + +#ifdef _UNICODE +#define RUNTIME_DWTYPE RUNTIME_DWTYPEW +#define RUNTIME_DWTYPE_VTZ RUNTIME_DWTYPE_VTZW +#else +#define RUNTIME_DWTYPE RUNTIME_DWTYPEA +#define RUNTIME_DWTYPE_VTZ RUNTIME_DWTYPE_VTZA +#endif +#define RUNTIME_VERSION_MMF1 0x0300 +#define RUNTIME_VERSION_MMF15 0x0301 +#define RUNTIME_VERSION_MMF2 0x0302 +#define RUNTIME_VERSION RUNTIME_VERSION_MMF2 + +////////////////////////////////////////////////////////////////////////////// +// Application full Header +// + +enum { + CTRLTYPE_MOUSE, // not used + CTRLTYPE_JOY1, + CTRLTYPE_JOY2, + CTRLTYPE_JOY3, + CTRLTYPE_JOY4, + CTRLTYPE_KEYBOARD, + MAX_CTRLTYPE +}; + +#define MAX_PLAYER 4 +#define MAX_KEY 8 +#define PLAYERNAME_SIZE 100 + +typedef struct PlayerCtrls { + + WORD pcCtrlType[MAX_PLAYER]; // Control type per player (0=mouse,1=joy1, 2=joy2, 3=keyb) + WORD pcCtrlKeys[MAX_PLAYER][MAX_KEY]; // Control keys per player + +} PlayerCtrls; +typedef PlayerCtrls* fpPlayerCtrls; + +typedef struct AppHeader { + + DWORD gaSize; // Structure size + WORD gaFlags; // Flags + WORD gaNewFlags; // New flags + WORD gaMode; // graphic mode + WORD gaOtherFlags; // Other Flags + short gaCxWin; // Window x-size + short gaCyWin; // Window y-size + DWORD gaScoreInit; // Initial score + DWORD gaLivesInit; // Initial number of lives + PlayerCtrls gaPlayerCtrls; + DWORD gaBorderColour; // Border colour + DWORD gaNbFrames; // Number of frames + DWORD gaFrameRate; // Number of frames per second + BYTE gaMDIWindowMenu; // Index of Window menu for MDI applications + BYTE gaFree[3]; + +} AppHeader; + +// gaFlags +#define GA_BORDERMAX 0x0001 +#define GA_NOHEADING 0x0002 +#define GA_PANIC 0x0004 +#define GA_SPEEDINDEPENDANT 0x0008 +#define GA_STRETCH 0x0010 +#define GA_LOADALLIMAGESATSTART 0x0020 +#define GA_LOADALLSOUNDSATSTART 0x0040 +#define GA_MENUHIDDEN 0x0080 +#define GA_MENUBAR 0x0100 +#define GA_MAXIMISE 0x0200 +#define GA_MIX 0x0400 +#define GA_FULLSCREENATSTART 0x0800 +#define GA_FULLSCREENSWITCH 0x1000 +#define GA_PROTECTED 0x2000 +#define GA_COPYRIGHT 0x4000 +#define GA_ONEFILE 0x8000 + +// gaNewFlags +#define GANF_SAMPLESOVERFRAMES 0x0001 +#define GANF_RELOCFILES 0x0002 +#define GANF_RUNFRAME 0x0004 +#define GANF_SAMPLESEVENIFNOTFOCUS 0x0008 + +// New in build 92 +#define GANF_NOMINIMIZEBOX 0x0010 +#define GANF_NOMAXIMIZEBOX 0x0020 +#define GANF_NOTHICKFRAME 0x0040 +#define GANF_DONOTCENTERFRAME 0x0080 + +// New in build 101 (MMF 1.5) +#define GANF_SCREENSAVER_NOAUTOSTOP 0x0100 +#define GANF_DISABLE_CLOSE 0x0200 + +// New in build 105 +#define GANF_HIDDENATSTART 0x0400 + +// New in build 110 +#define GANF_XPVISUALTHEMESUPPORT 0x0800 + +// New in MMF2 +#define GANF_VSYNC 0x1000 +#define GANF_RUNWHENMINIMIZED 0x2000 +#define GANF_MDI 0x4000 +#define GANF_RUNWHILERESIZING 0x8000 + +// Other flags +#define GAOF_DEBUGGERSHORTCUTS 0x0001 +#define GAOF_DDRAW 0x0002 +#define GAOF_DDRAWVRAM 0x0004 +#define GAOF_OBSOLETE 0x0008 +#define GAOF_AUTOIMGFLT 0x0010 +#define GAOF_AUTOSNDFLT 0x0020 +#define GAOF_ALLINONE 0x0040 +#define GAOF_SHOWDEBUGGER 0x0080 +#define GAOF_RESERVED_1 0x0100 +#define GAOF_RESERVED_2 0x0200 +#define GAOF_RESERVED_3 0x0400 +#define GAOF_RESERVED_4 0x0800 +#define GAOF_JAVASWING 0x1000 +#define GAOF_JAVAAPPLET 0x2000 +#define GAOF_D3D9 0x4000 +#define GAOF_D3D8 0x8000 + +// Optional header +typedef struct AppHeader2 { + + DWORD dwOptions; + DWORD dwBuildType; + DWORD dwBuildFlags; + WORD wScreenRatioTolerance; + WORD wScreenAngle; // 0 (no rotation/portrait), 1 (90 clockwise/landscape left), 2 (90 anticlockwise/landscape right), 3 (automatic portrait), 4 (automatic landscape), 5 (fully automatic) + DWORD dwUnused2; + +} AppHeader2; + +#define AH2OPT_KEEPSCREENRATIO 0x0001 +#define AH2OPT_FRAMETRANSITION 0x0002 // (HWA only) a frame has a transition +#define AH2OPT_RESAMPLESTRETCH 0x0004 // (HWA only) "resample when resizing" (works with "resize to fill window" option) +#define AH2OPT_GLOBALREFRESH 0x0008 // (Mobile) force global refresh +#define AH2OPT_MULTITASK 0x0010 // (iPhone) Multitask +#define AH2OPT_RTL 0x0020 // (Unicode) Right-to-left reading +#define AH2OPT_STATUSLINE 0x0040 // (iPhone/Android) Display status line +#define AH2OPT_RTLLAYOUT 0x0080 // (Unicode) Right-to-left layout +#define AH2OPT_ENABLEIAD 0x0100 // (iPhone) Enable iAd +#define AH2OPT_IADBOTTOM 0x0200 // (iPhone) Display ad at bottom +#define AH2OPT_AUTOEND 0x0400 // (Android) +#define AH2OPT_DISABLEBACKBUTTON 0x0800 // (Android) Disable Back button behavior +#define AH2OPT_ANTIALIASED 0x1000 // (iPhone) Smooth resizing on bigger screens +#define AH2OPT_CRASHREPORTING 0x2000 // (Android) Enable online crash reporting + +enum { + SCREENORIENTATION_PORTRAIT, + SCREENORIENTATION_LANDSCAPE_LEFT, + SCREENORIENTATION_LANDSCAPE_RIGHT, + SCREENORIENTATION_AUTO, + SCREENORIENTATION_LANDSCAPE_AUTO, + SCREENORIENTATION_PORTRAIT_AUTO, +}; + +#ifndef _H2INC + +// Build type values +enum { + BUILDTYPE_STANDALONE, + BUILDTYPE_SCREENSAVER, + BUILDTYPE_INTERNETAPP, + BUILDTYPE_JAVA, + BUILDTYPE_JAVASTANDALONE, + BUILDTYPE_JAVAAPPLET, + BUILDTYPE_JAVAWEBSTART, + BUILDTYPE_JAVAMOBILE, + BUILDTYPE_JAVABLURAY, + BUILDTYPE_JAVAMAC, + BUILDTYPE_FLASH, + BUILDTYPE_JAVABLACKBERRY, + BUILDTYPE_ANDROID, + BUILDTYPE_IPHONE, + BUILDTYPE_IPHONEDEVEL, + BUILDTYPE_IPHONEFINAL, + BUILDTYPE_XNA_WINDOWS_APP, + BUILDTYPE_MAC, + BUILDTYPE_XNA_WINDOWS, + BUILDTYPE_XNA_XBOX, + BUILDTYPE_XNA_PHONE, + BUILDTYPE_XNA_XBOX_APP, + BUILDTYPE_XNA_PHONE_APP, + BUILDTYPE_STDMAX, // end of standard build types +}; + +// Build flag values +#define BUILDFLAG_MAXCOMP 0x0001 +#define BUILDFLAG_COMPSND 0x0002 +#define BUILDFLAG_INCLUDEEXTFILES 0x0004 +#define BUILDFLAG_MANUALIMGFILTERS 0x0008 +#define BUILDFLAG_MANUALSNDFILTERS 0x0010 +#define BUILDFLAG_NOAUTOEXTRACT 0x0020 +#define BUILDFLAG_NOAPPLETCHECK 0x0040 +#define BUILDFLAG_TEST 0x0080 +#define BUILDFLAG_NOWARNINGS 0x0100 + +#endif + +////////////////////////////////////////////////////////////////////////////// +// Element of chunk Extensions +// +#ifndef _H2INC +typedef struct ExtDesc { + WORD extSize; + WORD extIndex; + DWORD extMagicNumber; +} ExtDesc; +typedef ExtDesc *LPEXTDESC; + +typedef struct ExtDesc2 { + WORD extSize; + WORD extIndex; + DWORD extMagicNumber; + DWORD extVersionLS; + DWORD extVersionMS; +} ExtDesc2; +typedef ExtDesc2 *LPEXTDESC2; +#endif + +////////////////////////////////////////////////////////////////////////////// +// Movement Extensions Chunk +// +typedef struct MvtExtDesc { + WORD extTotalSize; + WORD extHdrSize; + DWORD extBuild; +} MvtExtDesc; +typedef MvtExtDesc *LPMVTEXTDESC; + +////////////////////////////////////////////////////////////////////////////// +// Frame Header +// +typedef struct FrameHeader +{ + // Playfield + LONG leWidth; // Playfield width in pixels + LONG leHeight; // Playfield height in pixels + COLORREF leBackground; + + // Options + DWORD leFlags; + + +} FrameHeader; + +// leFlags +#define LEF_DISPLAYNAME 0x0001 +#define LEF_GRABDESKTOP 0x0002 +#define LEF_KEEPDISPLAY 0x0004 +//#define LEF_FADEIN 0x0008 +//#define LEF_FADEOUT 0x0010 +#define LEF_TOTALCOLMASK 0x0020 +#define LEF_PASSWORD 0x0040 +#define LEF_RESIZEATSTART 0x0100 +#define LEF_DONOTCENTER 0x0200 +#define LEF_FORCE_LOADONCALL 0x0400 +#define LEF_NOSURFACE 0x0800 +#define LEF_RESERVED_1 0x1000 +#define LEF_RESERVED_2 0x2000 +#define LEF_RECORDDEMO 0x4000 +#define LEF_TIMEDMVTS 0x8000 + +////////////////////////////////////////////////////////////////////////////// +// Layers +// + +#define FLOPT_XCOEF 0x0001 +#define FLOPT_YCOEF 0x0002 +#define FLOPT_NOSAVEBKD 0x0004 +#define FLOPT_WRAP_OBSOLETE 0x0008 +#define FLOPT_VISIBLE 0x0010 +#define FLOPT_WRAP_HORZ 0x0020 +#define FLOPT_WRAP_VERT 0x0040 +#define FLOPT_PREVIOUSEFFECT 0x0080 +#define FLOPT_REDRAW 0x000010000 +#define FLOPT_TOHIDE 0x000020000 +#define FLOPT_TOSHOW 0x000040000 + +typedef struct EditFrameLayer +{ + DWORD dwOptions; // Options + float xCoef; + float yCoef; + DWORD nBkdLOs; + DWORD nFirstLOIndex; + +} EditFrameLayer; + +typedef struct EditFrameLayerEffect { + + DWORD dwInkFx; + DWORD dwRGBA; + DWORD dwExtInkFxIdx; + DWORD nParams; + LPARAM paramData; // offset + +} EditFrameLayerEffect; + +// Effects +#ifdef HWABETA + +typedef struct EffectHdr { + DWORD dwEffectNameOffset; + DWORD dwEffectDataOffset; + DWORD dwEffectParamsOffset; + DWORD dwOptions; +} EffectHdr; + +#define EFFECTOPT_BKDTEXTUREMASK 0x000F + +typedef struct EffectParamsHdr { + DWORD dwNParams; + DWORD dwParamTypesOffset; + DWORD dwParamNamesOffset; +} EffectParamsHdr; + +typedef struct EffectRunData { + + DWORD erdEffectIndex; + DWORD erdNParams; +} EffectRunData; + +typedef struct FrameEffect { + + DWORD ffxInkEffect; + DWORD ffxInkEffectParam; +} FrameEffect; + +#endif + +////////////////////////////////////////////////////////////////////////////// +// ObjInfo/FrameItem Header +// +typedef struct ObjInfoHeader +{ + WORD oiHandle; + WORD oiType; + WORD oiFlags; // Memory flags + WORD oiReserved; // No longer used + DWORD oiInkEffect; // Ink effect + DWORD oiInkEffectParam; // Ink effect param + +} ObjInfoHeader; + +// oiFlags +#define OIF_LOADONCALL 0x0001 +#define OIF_DISCARDABLE 0x0002 +#define OIF_GLOBAL 0x0004 +#define OIF_RESERVED_1 0x0008 +#define OIF_GLOBAL_EDITOR_NOSYNC 0x0010 +#define OIF_GLOBAL_EDITOR_FORCESYNC 0x0020 + +////////////////////////////////////////////////////////////////////////////// +// LevObj/FrameItemInstance +// + +#ifndef _H2INC +#ifdef __cplusplus +class diskLO { +public: +#else +typedef struct diskLO { +#endif + WORD loHandle; // HLO + WORD loOiHandle; // HOI + LONG loX; // Coords + LONG loY; + WORD loParentType; // Parent type + WORD loOiParentHandle; // HOI Parent + WORD loLayer; // Layer + WORD loFree; // Not used +#ifdef __cplusplus +}; +#else +} diskLO; +#endif +typedef diskLO * fpDiskLO; +#endif + +////////////////////////////////////////////////////////////////////////////// +// +// ObjInfo/FrameItem ObjectsCommon +// + +// Obstacle types +enum { + OBSTACLE_NONE, + OBSTACLE_SOLID, + OBSTACLE_PLATFORM, + OBSTACLE_LADDER, + OBSTACLE_TRANSPARENT // for Add Backdrop +}; + +//////////////////////////////// +// Static object - ObjectsCommon +// +#ifndef _H2INC +typedef struct Static_OC { + + // Size + DWORD ocDWSize; + + // Obstacle type & collision mode + WORD ocObstacleType; + WORD ocColMode; // Collision mode (0 = fine, 1 = box) + + LONG ocCx; // Size + LONG ocCy; + +} Static_OC; +typedef Static_OC * LPStatic_OC; +#endif + +/////////////////////////////////////////////////////////////// +// Fill Type & shapes - Definitions +// + +#ifndef _H2INC +// Gradient +typedef struct GradientData { + COLORREF color1; + COLORREF color2; + DWORD vertical; +} GradientData; + +// Shapes +enum { + SHAPE_NONE=0, // Error + SHAPE_LINE, + SHAPE_RECTANGLE, + SHAPE_ELLIPSE +}; + +// Fill types +enum { + FILLTYPE_NONE, + FILLTYPE_SOLID, + FILLTYPE_GRADIENT, + FILLTYPE_MOTIF +}; + +// Line flags +#define LINEF_INVX 0x0001 +#define LINEF_INVY 0x0002 + +#endif + +/////////////////////////////////////////////////////////////// +// Fill Type - Part of FilledShape +// +#ifndef _H2INC + +#ifdef __cplusplus +class FillType_Data { +public: +#else +typedef struct FillType_Data { +#endif + WORD ocFillType; + union { + struct { + DWORD ocLineFlags; // Only for lines in non filled mode + }; + struct { + COLORREF ocColor; // Solid + }; + struct { + COLORREF ocColor1; // Gradient + COLORREF ocColor2; + DWORD ocGradientFlags; + }; + struct { + WORD ocImage; // Image + }; + }; +#ifdef __cplusplus +}; +#else +} FillType_Data; +#endif + +#endif + +/////////////////////////////////////////////////////////////// +// Filled Shape - Part of QuickBackdrop / Counter ObjectsCommon +// +#ifndef _H2INC + +#ifdef __cplusplus +class FilledShape_Data { +public: +#else +typedef struct FilledShape_Data { +#endif + WORD ocBorderSize; // Border + COLORREF ocBorderColor; + WORD ocShape; // Shape + FillType_Data ocFillData; // Fill Type infos +#ifdef __cplusplus +}; +#else +} FilledShape_Data; +#endif +typedef FilledShape_Data * LPFilledShape_Data; + +#endif + +///////////////////////////////// +// Quick backdrop - ObjectsCommon +// +#ifndef _H2INC + +typedef struct QuickBackdrop_OC { + + DWORD ocDWSize; + + WORD ocObstacleType; // Obstacle type + WORD ocColMode; // Collision mode (0 = fine, 1 = box) + + LONG ocCx; // Size + LONG ocCy; + + FilledShape_Data ocFilledShape; // Filled shape infos + +} QuickBackdrop_OC; +typedef QuickBackdrop_OC * LPQuickBackdrop_OC; + +#endif + +///////////////////////////////// +// Backdrop - ObjectsCommon +// +#ifndef _H2INC + +typedef struct Backdrop_OC { + + DWORD ocDWSize; + + WORD ocObstacleType; // Obstacle type + WORD ocColMode; // Collision mode (0 = fine, 1 = box) + + LONG ocCx; // Size + LONG ocCy; + + WORD ocImage; // Image + +} Backdrop_OC; +typedef Backdrop_OC * LPBackdrop_OC; + +#endif + +////////////////////////////////////////////////////////////////////////////// +// +// ObjInfo/FrameItem ObjectsCommon Data +// + +////////////////////////////////////////////////////////////////////////////// +// ImageSet +// + +#ifdef __cplusplus +class ImageSet_Data { +public: +#else +typedef struct ImageSet_Data { +#endif + WORD nbFrames; // Number of frames + // Followed by list of image handles (WORD[]) +#ifdef __cplusplus +}; +#else +} ImageSet_Data; +#endif +typedef ImageSet_Data * LPImageSet_Data; + +//////////////////////////////////////// +// Text - ocData +// +typedef struct otText { + + DWORD otDWSize; + LONG otCx; + LONG otCy; + DWORD otNumberOfText; // Paragraph number (> 1 if question object) + DWORD otStringOffset[1]; // String offsets + +} otText; +typedef otText * fpot; +#define sizeof_ot (sizeof(otText)-sizeof(DWORD)) + +typedef struct txString { + WORD tsFont; // Font + WORD tsFlags; // Flags + COLORREF tsColor; // Color + TCHAR tsChar[1]; +} txString; +typedef txString * fpts; +#define sizeof_ts 8 // (sizeof(txString)-1) + +#define TSF_LEFT 0x0000 // DT_LEFT +#define TSF_HCENTER 0x0001 // DT_CENTER +#define TSF_RIGHT 0x0002 // DT_RIGHT +#define TSF_VCENTER 0x0004 // DT_VCENTER +#define TSF_HALIGN 0x000F // DT_LEFT | DT_RIGHT | DT_CENTER | DT_VCENTER | DT_BOTTOM + +#define TSF_CORRECT 0x0100 +#define TSF_RELIEF 0x0200 +#define TSF_RTL 0x0400 + +//////////////////////////////////////// +// Scores, lives, counters +// +typedef struct CtAnim_Data { + + DWORD odDWSize; + LONG odCx; // Size: only lives & counters + LONG odCy; + WORD odPlayer; // Player: only score & lives + WORD odDisplayType; // CTA_xxx + WORD odDisplayFlags; // BARFLAG_INVERSE + WORD odFont; // Font + + // Followed by display data: +// union { +// ImageSet_Data odImages; +// FilledShape_Data odShape; +// }; + +} CtAnim_Data; +typedef CtAnim_Data * LPCtAnim_Data; + +// Display types +enum { + CTA_HIDDEN, + CTA_DIGITS, + CTA_VBAR, + CTA_HBAR, + CTA_ANIM, + CTA_TEXT, +}; + +// Display flags +#define CPTDISPFLAG_INTNDIGITS 0x000F // 0 = normal display, other value = pad with zeros or truncate +#define CPTDISPFLAG_FLOATNDIGITS 0x00F0 // add 1 to get the number of significant digits to display +#define CPTDISPFLAG_FLOATNDIGITS_SHIFT 4 +#define CPTDISPFLAG_FLOATNDECIMALS 0xF000 // number of digits to display after the decimal point +#define CPTDISPFLAG_FLOATNDECIMALS_SHIFT 12 +#define BARFLAG_INVERSE 0x0100 +#define CPTDISPFLAG_FLOAT_FORMAT 0x0200 // 1 to use the specified numbers of digits, 0 to use standard display (%g) +#define CPTDISPFLAG_FLOAT_USENDECIMALS 0x0400 // 1 to use the specified numbers of digits after the decimal point +#define CPTDISPFLAG_FLOAT_PADD 0x0800 // 1 to left padd with zeros + +// Counters images +enum { + COUNTER_IMAGE_0, + COUNTER_IMAGE_1, + COUNTER_IMAGE_2, + COUNTER_IMAGE_3, + COUNTER_IMAGE_4, + COUNTER_IMAGE_5, + COUNTER_IMAGE_6, + COUNTER_IMAGE_7, + COUNTER_IMAGE_8, + COUNTER_IMAGE_9, + COUNTER_IMAGE_SIGN_NEG, + COUNTER_IMAGE_SIGN_PLUS, + COUNTER_IMAGE_POINT, + COUNTER_IMAGE_EXP, + COUNTER_IMAGE_MAX +}; +#define V1_COUNTER_IMAGE_MAX (COUNTER_IMAGE_SIGN_NEG+1) + +//////////////////////////////////////// +// +// Objet RTF - ocData +// +#ifndef _H2INC + +typedef struct ocRTF { + + DWORD odDWSize; + DWORD odVersion; // 0 + DWORD odOptions; // Options + COLORREF odBackColor; // Background color + LONG odCx; // Size + LONG odCy; + +} ocRTF; +typedef ocRTF * LPOCRTF; + +//#define RTFOPT_TRANSPARENT 0x0001 // Transparent +//#define RTFOPT_VSLIDER 0x0002 // Display vertical slider if necessary +//#define RTFOPT_HSLIDER 0x0004 // Display horizontal slider if necessary + +#endif + +//////////////////////////////////////// +// +// Objet CCA - ocData +// +#ifndef _H2INC + +typedef struct ocCCA { + + DWORD odDWSize; + LONG odCx; // Size (ignored) + LONG odCy; + WORD odVersion; // 0 + WORD odNStartFrame; + DWORD odOptions; // Options + DWORD odIconOffset; // Icon offset + DWORD odFree; // Free + +} ocCCA; +typedef ocCCA * LPOCCCA; + +// Options +#define CCAF_SHARE_GLOBALVALUES 0x00000001 +#define CCAF_SHARE_LIVES 0x00000002 +#define CCAF_SHARE_SCORES 0x00000004 +#define CCAF_SHARE_WINATTRIB 0x00000008 +#define CCAF_STRETCH 0x00000010 +#define CCAF_POPUP 0x00000020 +#define CCAF_CAPTION 0x00000040 +#define CCAF_TOOLCAPTION 0x00000080 +#define CCAF_BORDER 0x00000100 +#define CCAF_WINRESIZE 0x00000200 +#define CCAF_SYSMENU 0x00000400 +#define CCAF_DISABLECLOSE 0x00000800 +#define CCAF_MODAL 0x00001000 +#define CCAF_DIALOGFRAME 0x00002000 +#define CCAF_INTERNAL 0x00004000 +#define CCAF_HIDEONCLOSE 0x00008000 +#define CCAF_CUSTOMSIZE 0x00010000 +#define CCAF_INTERNALABOUTBOX 0x00020000 +#define CCAF_CLIPSIBLINGS 0x00040000 +#define CCAF_SHARE_PLAYERCTRLS 0x00080000 +#define CCAF_MDICHILD 0x00100000 +#define CCAF_DOCKED 0x00200000 +#define CCAF_DOCKING_AREA 0x00C00000 +#define CCAF_DOCKED_LEFT 0x00000000 +#define CCAF_DOCKED_TOP 0x00400000 +#define CCAF_DOCKED_RIGHT 0x00800000 +#define CCAF_DOCKED_BOTTOM 0x00C00000 +#define CCAF_REOPEN 0x01000000 +#define CCAF_MDIRUNEVENIFNOTACTIVE 0x02000000 +#define CCAF_DISPLAYASSPRITE 0x04000000 + +#endif + +//////////////////////////////////////// +// +// Transition +// + +#ifndef _H2INC + +// Transition header +typedef struct TransitionHdr { + DWORD trDllID; // DLL id + DWORD trID; // Transition ID + DWORD trDuration; // Duration + DWORD trFlags; // From / to color / background + DWORD trColor; // Color +} TransitionHdr; + +// Transition run-time data +#ifdef __cplusplus +class Transition_Data { +public: +#else +typedef struct Transition_Data { +#endif + TransitionHdr trHdr; + DWORD trDllNameOffset; + DWORD trParamsOffset; + DWORD trParamsSize; + // Followed by DLL name & transition parameters +#ifdef __cplusplus +}; +#else +} Transition_Data; +#endif +typedef Transition_Data * LPTRANSITIONDATA; + +#define TRFLAG_COLOR 0x0001 +#define TRFLAG_UNICODE 0x0002 + +#endif + +// Text alignment flags +#define TEXT_ALIGN_LEFT 0x00000001 +#define TEXT_ALIGN_HCENTER 0x00000002 +#define TEXT_ALIGN_RIGHT 0x00000004 +#define TEXT_ALIGN_TOP 0x00000008 +#define TEXT_ALIGN_VCENTER 0x00000010 +#define TEXT_ALIGN_BOTTOM 0x00000020 + +// Right-to-left ordering +#define TEXT_RTL 0x00000100 + +// Text caps +#define TEXT_FONT 0x00010000 +#define TEXT_COLOR 0x00020000 +#define TEXT_COLOR16 0x00040000 + +////////////////////////////////////////////////////////////////////////////// +// +// Run-time Definitions +// + +#ifdef RUN_TIME + +#ifndef _H2INC +typedef short * LPSHORT; +typedef LPVOID * LPLPVOID; +#endif + +// Versions +#define KNPV1_VERSION 0x126 // First K&P version +#define CNCV1_VERSION 0x207 // Click & Create / The Games Factory +#define KNP_VERSION 0x300 + +// Internet Versions +#define FIRST_NETVERSION 0x001 // First vitalize version +#define CCN_NETVERSION 0x002 // CCN applications +#define MORECOMP_NETVERSION 0x003 // Short OIs, compression of levObjs, adpcm sounds, +#define CNC_NETVERSION 0x003 // Current Internet Version + +// Collision mask margins +#define COLMASK_XMARGIN 64 +#define COLMASK_YMARGIN 16 + +// Messages +#define UM_KNP_GETAPPID (WM_APP+7) // No longer used +#define UM_HVSCROLL (WM_APP+8) // No longer used + +// App IDs +#define APPID_KNC 0x3952 // No longer used +#define APPID_KNCSA 0x9172 // No longer used + +// Control IDs +#define ID_EDIT_WIN 300 // ID of edit window + +#endif // RUN_TIME + +// No longer used +#ifndef HFRAN +#define HFRAN LPBYTE +#endif + +// HLO +#define HLO WORD +#define HLO_ERROR ((HLO)-1) +typedef HLO * LPHLO; + +// Frame password size +#define PASSWORD_SIZE 9 + +// Cross-ref tables +enum { + IMG_TAB, + FONT_TAB, + SOUND_TAB, + MUSIC_TAB, + MAX_TABREF +}; + +#ifdef RUN_TIME + +// Preferences +#define PREF_MUSICON 0x4000 +#define PREF_SOUNDON 0x8000 + +// Frame handles +#define HCELL WORD +#define HCELL_ERROR ((WORD)-1) + +// Jump flags +#define MPJC_NOJUMP 0 +#define MPJC_DIAGO 1 +#define MPJC_BUTTON1 2 +#define MPJC_BUTTON2 3 + +// How to play (no longer used) +enum { + HTP_NO=0, + HTP_TXT, + HTP_WRI, + HTP_HLP +}; +#define NB_HTPTYPE 4 + +#endif // RUN_TIME + +// Versions +#define MMFVERSION_MASK 0xFFFF0000 +#define MMFBUILD_MASK 0x00000FFF // MMF build +#define MMFVERFLAG_MASK 0x0000F000 +#define MMFVERFLAG_HOME 0x00008000 // TGF +#define MMFVERFLAG_PRO 0x00004000 // MMF Pro +#define MMFVERFLAG_DEMO 0x00002000 // Demo +#define MMFVERFLAG_PLUGIN 0x00001000 // Plugin +#define MMFVERSION_15 0x01050000 // MMF 1.5 +#define MMFVERSION_20 0x02000000 // MMF 2.0 +#define MMF_CURRENTVERSION MMFVERSION_20 + +// Build numbers +#define MMF_BUILD_NONAME 203 +#define MMF_BUILD_MENUIMAGES 204 +#define MMF_BUILD_SUBAPPICON 205 +#define MMF_BUILD_WINMENUIDX 206 +#define MMF_BUILD_NOTUSED 207 +#define MMF_BUILD_ABOUTTEXT 208 +#define MMF_BUILD_FRAMEDPOS 209 +#define MMF_BUILD_TRSPCOLOR 210 +#define MMF_BUILD_211 211 +#define MMF_BUILD_DEMO 212 +#define MMF_BUILD_PREBETA_2 213 +#define MMF_BUILD_PREBETA_3 214 +#define MMF_BUILD_PREBETA_4 215 // First update Jason's book +#define MMF_BUILD_ALTVALUES 216 +#define MMF_BUILD_EDTCHUNKS 217 +#define MMF_BUILD_COUNTERTEXT 218 +#define MMF_BUILD_SDK 219 // Pre-SDK version +#define MMF_BUILD_SDK2 220 // Second SDK version +#define MMF_BUILD_MVTSDK2 221 // Second Mvt SDK version +#define MMF_BUILD_FIXCOLLISANDBEH 222 +#define MMF_BUILD_PROPFILTERS 223 +#define MMF_BUILD_MFXEXTS 224 +#define MMF_BUILD_LASTFRAMEOFFSET 225 +#define MMF_BUILD_EDUDEMOFEB06 226 +#define MMF_BUILD_GLBOBJBUG 227 +#define MMF_BUILD_IDTC 228 +#define MMF_BUILD_229 229 +#define MMF_BUILD_230 230 +#define MMF_BUILD_231 231 +#define MMF_BUILD_FIXQUALIF 232 +#define MMF_BUILD_233 233 +#define MMF_BUILD_234_TGFPR 234 +#define MMF_BUILD_235 235 +#define MMF_BUILD_236 236 +#define MMF_BUILD_237 237 +#define MMF_BUILD_238 238 +#define MMF_BUILD_239_CD 239 +#define MMF_BUILD_240_DEMO 240 +#define MMF_BUILD_241_SP1 241 +#define MMF_BUILD_242_SP2 242 +#define MMF_BUILD_243_SP3 243 +#define MMF_BUILD_244_SP4 244 +#define MMF_BUILD_245_SP5 245 +#define MMF_BUILD_246_SP6 246 +#define MMF_BUILD_247_SP7 247 +#define MMF_BUILD_248_JAVA 248 +#define MMF_BUILD_249_MOBILE_FLASH 249 +#define MMF_BUILD_250 250 +#define MMF_BUILD_251 251 +#define MMF_BUILD_252 252 +#define MMF_BUILD_253 253 +#define MMF_BUILD_254 254 +#define MMF_CURRENTBUILD MMF_BUILD_254 + +// MFA file format versions +#define MFA_BUILD_ALTSTR 1 // Alterable strings +#define MFA_BUILD_COUNTERTEXT 2 // Text mode in counters +#define MFA_BUILD_LASTFRAMEOFFSET 3 // Additional frame offset +#define MFA_BUILD_FIXQUALIF 4 // Fix in qualifiers + prd version +#ifdef _UNICODE +#define MFA_BUILD_LANGID 5 // Language ID +#define MFA_CURRENTBUILD MFA_BUILD_LANGID +#else +#define MFA_CURRENTBUILD MFA_BUILD_FIXQUALIF +#endif + +// Structures for picture editor +typedef struct EditSurfaceParamsA { + + DWORD m_dwSize; // sizeof(EditSurfaceParams) + LPSTR m_pWindowTitle; // Picture Editor title (NULL = default title) + cSurface* m_pSf; // Surface to edit + DWORD m_dwOptions; // Options, see PictEdDefs.h + DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) + DWORD m_dwFixedHeight;// Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) + POINT m_hotSpot; // Hot spot coordinates + POINT m_actionPoint; // Action point coordinates + +} EditSurfaceParamsA; +typedef EditSurfaceParamsA* LPEDITSURFACEPARAMSA; + +typedef struct EditSurfaceParamsW { + + DWORD m_dwSize; // sizeof(EditSurfaceParams) + LPWSTR m_pWindowTitle; // Picture Editor title (NULL = default title) + cSurface* m_pSf; // Surface to edit + DWORD m_dwOptions; // Options, see PictEdDefs.h + DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) + DWORD m_dwFixedHeight;// Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) + POINT m_hotSpot; // Hot spot coordinates + POINT m_actionPoint; // Action point coordinates + +} EditSurfaceParamsW; +typedef EditSurfaceParamsW* LPEDITSURFACEPARAMSW; + +#ifdef _UNICODE +#define EditSurfaceParams EditSurfaceParamsW +typedef EditSurfaceParamsW* LPEDITSURFACEPARAMS; +#else +#define EditSurfaceParams EditSurfaceParamsA +typedef EditSurfaceParamsA* LPEDITSURFACEPARAMS; +#endif + +typedef struct EditImageParamsA { + + DWORD m_dwSize; // sizeof(EditImageParams) + LPSTR m_pWindowTitle; // Picture Editor title (NULL = default title) + DWORD m_dwImage; // Image to edit - note: only the LOWORD is used in this version + DWORD m_dwOptions; // Options, see PictEdDefs.h + DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) + DWORD m_dwFixedHeight; // Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) + +} EditImageParamsA; +typedef EditImageParamsA* LPEDITIMAGEPARAMSA; + +typedef struct EditImageParamsW { + + DWORD m_dwSize; // sizeof(EditImageParams) + LPWSTR m_pWindowTitle; // Picture Editor title (NULL = default title) + DWORD m_dwImage; // Image to edit - note: only the LOWORD is used in this version + DWORD m_dwOptions; // Options, see PictEdDefs.h + DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) + DWORD m_dwFixedHeight; // Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) + +} EditImageParamsW; +typedef EditImageParamsW* LPEDITIMAGEPARAMSW; + +#ifdef _UNICODE +#define EditImageParams EditImageParamsW +typedef EditImageParamsW* LPEDITIMAGEPARAMS; +#else +#define EditImageParams EditImageParamsA +typedef EditImageParamsA* LPEDITIMAGEPARAMS; +#endif + +// Structure for image list editor +typedef struct EditAnimationParamsA { + + DWORD m_dwSize; // sizeof(EditAnimationParams) + LPSTR m_pWindowTitle; // Picture Editor title (NULL = default title) + int m_nImages; // Number of images in the list + int m_nMaxImages; // Maximum number of images in the list + int m_nStartIndex; // Index of first image to edit in the editor + LPWORD m_pImages; // Image list (one WORD per image) + LPSTR* m_pImageTitles; // Image titles (can be NULL) + DWORD m_dwOptions; // Options, see PictEdDefs.h + DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) + DWORD m_dwFixedHeight; // Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) + +} EditAnimationParamsA; +typedef EditAnimationParamsA* LPEDITANIMATIONPARAMSA; + +typedef struct EditAnimationParamsW { + + DWORD m_dwSize; // sizeof(EditAnimationParams) + LPWSTR m_pWindowTitle; // Picture Editor title (NULL = default title) + int m_nImages; // Number of images in the list + int m_nMaxImages; // Maximum number of images in the list + int m_nStartIndex; // Index of first image to edit in the editor + LPWORD m_pImages; // Image list (one WORD per image) + LPWSTR* m_pImageTitles; // Image titles (can be NULL) + DWORD m_dwOptions; // Options, see PictEdDefs.h + DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) + DWORD m_dwFixedHeight; // Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) + +} EditAnimationParamsW; +typedef EditAnimationParamsW* LPEDITANIMATIONPARAMSW; + +#ifdef _UNICODE +#define EditAnimationParams EditAnimationParamsW +typedef EditAnimationParamsW* LPEDITANIMATIONPARAMS; +#else +#define EditAnimationParams EditAnimationParamsA +typedef EditAnimationParamsA* LPEDITANIMATIONPARAMS; +#endif + +// Global variables structure +#ifdef __cplusplus +class mv { +public: +#else +typedef struct mv { +#endif + + // Common to editor and runtime + HINSTANCE mvHInst; // Application HINSTANCE + npAppli mvIdAppli; // Application object in DLL + npWin mvIdMainWin; // Main window object in DLL + npWin mvIdEditWin; // Child window object in DLL + HWND mvHMainWin; // Main window handle + HWND mvHEditWin; // Child window handle + HPALETTE mvHPal256; // 256 color palette + WORD mvAppMode; // Screen mode with flags + WORD mvScrMode; // Screen mode + DWORD mvEditDXDocToClient; // Edit time only: top-left coordinates + DWORD mvEditDYDocToClient; + CImageFilterMgr* mvImgFilterMgr; // Image filter manager + CSoundFilterMgr* mvSndFilterMgr; // Sound filter manager + CSoundManager* mvSndMgr; // Sound manager + + union { + CEditApp* mvEditApp; // Current application, edit time (not used) + CRunApp* mvRunApp; // Current application, runtime + }; + union { + CEditFrame* mvEditFrame; + CRunFrame* mvRunFrame; + }; + + // Runtime + #ifdef __cplusplus + RunHeader* mvRunHdr; // Current RunHeader + #else + LPVOID mvRunHdr; + #endif + DWORD mvPrefs; // Preferences (sound on/off) + LPTSTR subType; + BOOL mvFullScreen; // Full screen mode + LPTSTR mvMainAppFileName; // App filename + int mvAppListCount; + int mvAppListSize; + CRunApp** mvAppList; + int mvExtListCount; + int mvExtListSize; + LPTSTR * mvExtList; + int mvNbDllTrans; + dllTrans* mvDllTransList; + DWORD mvJoyCaps[32]; + HHOOK mvHMsgHook; + int mvModalLoop; + int mvModalSubAppCount; + LPVOID mvFree[5]; + + // Functions + //////////// + + // Editor: Open Help file + void (CALLBACK * mvHelpA) (LPCSTR pHelpFile, UINT nID, LPARAM lParam); + + // Editor: Get default font for object creation + BOOL (CALLBACK * mvGetDefaultFontA) (LPLOGFONTA plf, LPSTR pStyle, int cbSize); + + // Editor: Edit images and animations + BOOL (CALLBACK * mvEditSurfaceA) (LPVOID edPtr, LPEDITSURFACEPARAMSA pParams, HWND hParent); + BOOL (CALLBACK * mvEditImageA) (LPVOID edPtr, LPEDITIMAGEPARAMSA pParams, HWND hParent); + BOOL (CALLBACK * mvEditAnimationA) (LPVOID edPtr, LPEDITANIMATIONPARAMSA pParams, HWND hParent); + + // Runtime: Extension User data + LPVOID (CALLBACK * mvGetExtUserData) (CRunApp* pApp, HINSTANCE hInst); + LPVOID (CALLBACK * mvSetExtUserData) (CRunApp* pApp, HINSTANCE hInst, LPVOID pData); + + // Runtime: Register dialog box + void (CALLBACK * mvRegisterDialogBox) (HWND hDlg); + void (CALLBACK * mvUnregisterDialogBox) (HWND hDlg); + + // Runtime: Add surface as backdrop object + void (CALLBACK * mvAddBackdrop) (cSurface* pSf, int x, int y, DWORD dwInkEffect, DWORD dwInkEffectParam, int nObstacleType, int nLayer); + + // Runtime: Binary files + BOOL (CALLBACK * mvGetFileA)(LPCSTR pPath, LPSTR pFilePath, DWORD dwFlags); + void (CALLBACK * mvReleaseFileA)(LPCSTR pPath); + HANDLE (CALLBACK * mvOpenHFileA)(LPCSTR pPath, LPDWORD pDwSize, DWORD dwFlags); + void (CALLBACK * mvCloseHFile)(HANDLE hf); + + // Plugin: download file + int (CALLBACK * mvLoadNetFileA) (LPSTR pFilename); + + // Plugin: send command to Vitalize + int (CALLBACK * mvNetCommandA) (int, LPVOID, DWORD, LPVOID, DWORD); + + // Editor & Runtime: Returns the version of MMF or of the runtime + DWORD (CALLBACK * mvGetVersion) (); + + // Editor & Runtime: callback function for properties or other functions + #ifdef _cplusplus + LRESULT (CALLBACK * mvCallFunction) (LPVOID edPtr, int nFnc, LPARAM lParam1=0, LPARAM lParam2=0, LPARAM lParam3=0); + #else + LRESULT (CALLBACK * mvCallFunction) (LPVOID edPtr, int nFnc, LPARAM lParam1, LPARAM lParam2, LPARAM lParam3); + #endif + + // Editor: Open Help file (UNICODE) + void (CALLBACK * mvHelpW) (LPCWSTR pHelpFile, UINT nID, LPARAM lParam); + + // Editor: Get default font for object creation (UNICODE) + BOOL (CALLBACK * mvGetDefaultFontW) (LPLOGFONTW plf, LPWSTR pStyle, int cbSize); + + // Editor: Edit images and animations (UNICODE) + BOOL (CALLBACK * mvEditSurfaceW) (LPVOID edPtr, LPEDITSURFACEPARAMSW pParams, HWND hParent); + BOOL (CALLBACK * mvEditImageW) (LPVOID edPtr, LPEDITIMAGEPARAMSW pParams, HWND hParent); + BOOL (CALLBACK * mvEditAnimationW) (LPVOID edPtr, LPEDITANIMATIONPARAMSW pParams, HWND hParent); + + // Runtime: Binary files (UNICODE + BOOL (CALLBACK * mvGetFileW)(LPCWSTR pPath, LPWSTR pFilePath, DWORD dwFlags); + void (CALLBACK * mvReleaseFileW)(LPCWSTR pPath); + HANDLE (CALLBACK * mvOpenHFileW)(LPCWSTR pPath, LPDWORD pDwSize, DWORD dwFlags); + + // Plugin: download file + int (CALLBACK * mvLoadNetFileW) (LPWSTR pFilename); + + // Plugin: send command to Vitalize + int (CALLBACK * mvNetCommandW) (int, LPVOID, DWORD, LPVOID, DWORD); + + // Place-holder for next versions + LPVOID mvAdditionalFncs[6]; + +#ifdef __cplusplus +}; +#else +} mv; +#endif +typedef mv *LPMV; + +#ifdef _UNICODE +#define mvHelp mvHelpW +#define mvGetDefaultFont mvGetDefaultFontW +#define mvEditSurface mvEditSurfaceW +#define mvEditImage mvEditImageW +#define mvEditAnimation mvEditAnimationW +#define mvGetFile mvGetFileW +#define mvReleaseFile mvReleaseFileW +#define mvLoadNetFile mvLoadNetFileW +#define mvNetCommand mvNetCommandW +#define mvGetFile mvGetFileW +#define mvReleaseFile mvReleaseFileW +#define mvOpenHFile mvOpenHFileW +#else +#define mvHelp mvHelpA +#define mvGetDefaultFont mvGetDefaultFontA +#define mvEditSurface mvEditSurfaceA +#define mvEditImage mvEditImageA +#define mvEditAnimation mvEditAnimationA +#define mvGetFile mvGetFileA +#define mvReleaseFile mvReleaseFileA +#define mvLoadNetFile mvLoadNetFileA +#define mvNetCommand mvNetCommandA +#define mvGetFile mvGetFileA +#define mvReleaseFile mvReleaseFileA +#define mvOpenHFile mvOpenHFileA +#endif + +// Callback function identifiers for mvCallFunction +enum { + // Editor only + EF_INSERTPROPS=1, // Insert properties into Property window + EF_REMOVEPROP, // Remove property + EF_REMOVEPROPS, // Remove properties + EF_REFRESHPROP, // Refresh propery + EF_REALLOCEDITDATA, // Reallocate edPtr + EF_GETPROPVALUE, // Get object's property value + EF_GETAPPPROPVALUE, // Get application's property value + EF_GETFRAMEPROPVALUE, // Get frame's property value + EF_SETPROPVALUE, // Set object's property value + EF_SETAPPPROPVALUE, // Set application's property value + EF_SETFRAMEPROPVALUE, // Set frame's property value + EF_GETPROPCHECK, // Get object's property check state + EF_GETAPPPROPCHECK, // Get application's property check state + EF_GETFRAMEPROPCHECK, // Get frame's property check state + EF_SETPROPCHECK, // Set object's property check state + EF_SETAPPPROPCHECK, // Set application's property check state + EF_SETFRAMEPROPCHECK, // Set frame's property check state + EF_INVALIDATEOBJECT, // Refresh object in frame editor + EF_RECALCLAYOUT, // Recalc runtime layout (docking) + EF_GETNITEMS, // Get number of items - not yet implemented + EF_GETNEXTITEM, // Get next item - not yet implemented + EF_GETNINSTANCES, // Get number of item instances - not yet implemented + EF_GETNEXTINSTANCE, // Get next item instance - not yet implemented + + // Editor & runtime + EF_MALLOC=100, // Allocate memory + EF_CALLOC, // Allocate memory & set it to 0 + EF_REALLOC, // Re-allocate memory + EF_FREE, // Free memory + EF_GETSOUNDMGR, // Get sound manager + EF_CLOSESOUNDMGR, // Close sound manager + EF_ENTERMODALLOOP, // Reserved + EF_EXITMODALLOOP, // Reserved + EF_CREATEEFFECT, // Create effect (runtime only) + EF_DELETEEFFECT, // Delete effect (runtime only) + EF_CREATEIMAGEFROMFILEA,// Create image from file (runtime only) + EF_NEEDBACKGROUNDACCESS,// HWA : tell the frame the frame surface can be read (runtime only) + EF_ISHWA, // Returns TRUE if HWA version (editor and runtime) + EF_ISUNICODE, // Returns TRUE if the editor or runtime is in Unicode mode + EF_ISUNICODEAPP, // Returns TRUE if the application being loaded is a Unicode application + EF_GETAPPCODEPAGE, // Returns the code page of the application + EF_CREATEIMAGEFROMFILEW,// Create image from file (runtime only) +}; + +// 3rd parameter of EF_CREATEIMAGEFROMFILE +typedef struct CreateImageFromFileInfo { + int nSize; + int xHS; + int yHS; + int xAP; + int yAP; + COLORREF trspColor; +} CreateImageFromFileInfo; + + +// Callback function macros for mvCallFunction +#ifdef __cplusplus +__inline void mvInsertProps(LPMV mV, LPVOID edPtr, PropData* pProperties, UINT nInsertPropID, BOOL bAfter) \ + { mV->mvCallFunction(edPtr, EF_INSERTPROPS, (LPARAM)pProperties, (LPARAM)nInsertPropID, (LPARAM)bAfter); } + +__inline void mvRemoveProp(LPMV mV, LPVOID edPtr, UINT nPropID) \ + { mV->mvCallFunction(edPtr, EF_REMOVEPROP, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } + +__inline void mvRemoveProps(LPMV mV, LPVOID edPtr, PropData* pProperties) \ + { mV->mvCallFunction(edPtr, EF_REMOVEPROPS, (LPARAM)pProperties, (LPARAM)0, (LPARAM)0); } + +__inline void mvRefreshProp(LPMV mV, LPVOID edPtr, UINT nPropID, BOOL bReInit) \ + { mV->mvCallFunction(edPtr, EF_REFRESHPROP, (LPARAM)nPropID, (LPARAM)bReInit, (LPARAM)0); } + +__inline LPVOID mvReAllocEditData(LPMV mV, LPVOID edPtr, DWORD dwNewSize) \ + { return (LPVOID)mV->mvCallFunction(edPtr, EF_REALLOCEDITDATA, (LPARAM)edPtr, dwNewSize, 0); } + +__inline CPropValue* mvGetPropValue(LPMV mV, LPVOID edPtr, UINT nPropID) \ + { return (CPropValue*)mV->mvCallFunction(edPtr, EF_GETPROPVALUE, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } + +__inline CPropValue* mvGetAppPropValue(LPMV mV, LPVOID edPtr, UINT nPropID) \ + { return (CPropValue*)mV->mvCallFunction(edPtr, EF_GETAPPPROPVALUE, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } + +__inline CPropValue* mvGetFramePropValue(LPMV mV, LPVOID edPtr, UINT nPropID) \ + { return (CPropValue*)mV->mvCallFunction(edPtr, EF_GETFRAMEPROPVALUE, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } + +__inline void mvSetPropValue(LPMV mV, LPVOID edPtr, UINT nPropID, CPropValue* pValue) \ + { mV->mvCallFunction(edPtr, EF_SETPROPVALUE, (LPARAM)nPropID, (LPARAM)pValue, (LPARAM)0); } + +__inline void mvSetAppPropValue(LPMV mV, LPVOID edPtr, UINT nPropID, CPropValue* pValue) \ + { mV->mvCallFunction(edPtr, EF_SETAPPPROPVALUE, (LPARAM)nPropID, (LPARAM)pValue, (LPARAM)0); } + +__inline void mvSetFramePropValue(LPMV mV, LPVOID edPtr, UINT nPropID, CPropValue* pValue) \ + { mV->mvCallFunction(edPtr, EF_SETFRAMEPROPVALUE, (LPARAM)nPropID, (LPARAM)pValue, (LPARAM)0); } + +__inline UINT mvGetPropCheck(LPMV mV, LPVOID edPtr, UINT nPropID) \ + { return (UINT)mV->mvCallFunction(edPtr, EF_GETPROPCHECK, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } + +__inline UINT mvGetAppPropCheck(LPMV mV, LPVOID edPtr, UINT nPropID) \ + { return (UINT)mV->mvCallFunction(edPtr, EF_GETAPPPROPCHECK, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } + +__inline UINT mvGetFramePropCheck(LPMV mV, LPVOID edPtr, UINT nPropID) \ + { return (UINT)mV->mvCallFunction(edPtr, EF_GETFRAMEPROPCHECK, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } + +__inline void mvSetPropCheck(LPMV mV, LPVOID edPtr, UINT nPropID, UINT nCheck) \ + { mV->mvCallFunction(edPtr, EF_SETPROPCHECK, (LPARAM)nPropID, (LPARAM)nCheck, (LPARAM)0); } + +__inline void mvSetAppPropCheck(LPMV mV, LPVOID edPtr, UINT nPropID, UINT nCheck) \ + { mV->mvCallFunction(edPtr, EF_SETAPPPROPCHECK, (LPARAM)nPropID, (LPARAM)nCheck, (LPARAM)0); } + +__inline void mvSetFramePropCheck(LPMV mV, LPVOID edPtr, UINT nPropID, UINT nCheck) \ + { mV->mvCallFunction(edPtr, EF_SETFRAMEPROPCHECK, (LPARAM)nPropID, (LPARAM)nCheck, (LPARAM)0); } + +__inline void mvInvalidateObject(LPMV mV, LPVOID edPtr) \ + { mV->mvCallFunction(edPtr, EF_INVALIDATEOBJECT, (LPARAM)0, (LPARAM)0, (LPARAM)0); } + +__inline LPVOID mvMalloc(LPMV mV, int nSize) \ + { return (LPVOID)mV->mvCallFunction(NULL, EF_MALLOC, (LPARAM)nSize, (LPARAM)0, (LPARAM)0); } + +__inline LPVOID mvCalloc(LPMV mV, int nSize) \ + { return (LPVOID)mV->mvCallFunction(NULL, EF_CALLOC, (LPARAM)nSize, (LPARAM)0, (LPARAM)0); } + +__inline LPVOID mvReAlloc(LPMV mV, LPVOID ptr, int nNewSize) \ + { return (LPVOID)mV->mvCallFunction(NULL, EF_REALLOC, (LPARAM)ptr, (LPARAM)nNewSize, (LPARAM)0); } + +__inline void mvFree(LPMV mV, LPVOID ptr) \ + { mV->mvCallFunction(NULL, EF_FREE, (LPARAM)ptr, (LPARAM)0, (LPARAM)0); } + +__inline void mvRecalcLayout(LPMV mV) \ + { mV->mvCallFunction(NULL, EF_RECALCLAYOUT, (LPARAM)0, (LPARAM)0, (LPARAM)0); } + +__inline CSoundManager* mvGetSoundMgr(LPMV mV) \ + { mV->mvCallFunction(NULL, EF_GETSOUNDMGR, (LPARAM)0, (LPARAM)0, (LPARAM)0); } + +__inline void mvCloseSoundMgr(LPMV mV) \ + { mV->mvCallFunction(NULL, EF_CLOSESOUNDMGR, (LPARAM)0, (LPARAM)0, (LPARAM)0); } + +__inline int mvGetNItems(LPMV mV, LPVOID edPtr, LPCSTR extName) \ + { return mV->mvCallFunction(edPtr, EF_GETNITEMS, (LPARAM)extName, (LPARAM)0, (LPARAM)0); } + +__inline LPVOID mvGetFirstItem(LPMV mV, LPVOID edPtr, LPCSTR extName) \ + { return (LPVOID)mV->mvCallFunction(edPtr, EF_GETNEXTITEM, (LPARAM)extName, (LPARAM)0, (LPARAM)0); } + +__inline LPVOID mvGetNextItem(LPMV mV, LPVOID edPtr, LPVOID edPtr1, LPCSTR extName) \ + { return (LPVOID)mV->mvCallFunction(edPtr, EF_GETNEXTITEM, (LPARAM)edPtr1, (LPARAM)extName, (LPARAM)0); } + +#ifdef HWABETA + +__inline BOOL mvCreateEffect(LPMV mV, LPCSTR pEffectName, LPINT pEffect, LPARAM* pEffectParam) \ + { return (BOOL)mV->mvCallFunction(NULL, EF_CREATEEFFECT, (LPARAM)pEffectName, (LPARAM)pEffect, (LPARAM)pEffectParam); } + +__inline void mvDeleteEffect(LPMV mV, int nEffect, LPARAM lEffectParam) \ + { mV->mvCallFunction(NULL, EF_DELETEEFFECT, (LPARAM)nEffect, (LPARAM)lEffectParam, (LPARAM)0); } + +#endif // HWABETA + +__inline BOOL mvCreateImageFromFileA(LPMV mV, LPWORD pwImg, LPCSTR pFilename, CreateImageFromFileInfo* pInfo) \ + { return (BOOL)mV->mvCallFunction(NULL, EF_CREATEIMAGEFROMFILEA, (LPARAM)pwImg, (LPARAM)pFilename, (LPARAM)pInfo); } + +__inline BOOL mvCreateImageFromFileW(LPMV mV, LPWORD pwImg, LPCWSTR pFilename, CreateImageFromFileInfo* pInfo) \ + { return (BOOL)mV->mvCallFunction(NULL, EF_CREATEIMAGEFROMFILEW, (LPARAM)pwImg, (LPARAM)pFilename, (LPARAM)pInfo); } + +__inline LPVOID mvNeebBackgroundAccess(LPMV mV, CRunFrame* pFrame, BOOL bNeedAccess) \ + { return (LPVOID)mV->mvCallFunction(NULL, EF_NEEDBACKGROUNDACCESS, (LPARAM)pFrame, (LPARAM)bNeedAccess, (LPARAM)0); } + +__inline BOOL mvIsHWAVersion(LPMV mV) \ + { return mV->mvCallFunction(NULL, EF_ISHWA, (LPARAM)0, (LPARAM)0, (LPARAM)0); } + +__inline BOOL mvIsUnicodeVersion(LPMV mV) \ + { return mV->mvCallFunction(NULL, EF_ISUNICODE, (LPARAM)0, (LPARAM)0, (LPARAM)0); } + +__inline BOOL mvIsUnicodeApp(LPMV mV, LPVOID pApp) \ + { return mV->mvCallFunction(NULL, EF_ISUNICODEAPP, (LPARAM)pApp, (LPARAM)0, (LPARAM)0); } + +__inline int mvGetAppCodePage(LPMV mV, LPVOID pApp) \ + { return mV->mvCallFunction(NULL, EF_GETAPPCODEPAGE, (LPARAM)pApp, (LPARAM)0, (LPARAM)0); } + +#ifdef _UNICODE +#define mvCreateImageFromFile mvCreateImageFromFileW +#else +#define mvCreateImageFromFile mvCreateImageFromFileA +#endif + +#endif // __cplusplus + +// Options for OpenHFile +#define OHFF_LOCALFILE 0x0001 // Vitalize mode only: don't try to download file from server + +#ifdef RUN_TIME + +// EnumEltProc definition +typedef int (CALLBACK* ENUMELTPROC)(LPWORD, int, LPARAM, LPARAM); + +// Extension function table +typedef struct tagKpxFunc { + HINSTANCE kpxHInst; + LPTSTR kpxName; + LPTSTR kpxSubType; + LPVOID kpxUserData; + DWORD ( WINAPI * kpxGetInfos) (int); + int ( WINAPI * kpxLoadObject) (mv *, OI*, LPBYTE, int); + void ( WINAPI * kpxUnloadObject) (mv *, LPBYTE, int); + void ( WINAPI * kpxUpdateFileNames) (mv *, LPTSTR, LPBYTE, void (WINAPI * )(LPCTSTR, LPTSTR)); + short( WINAPI * kpxGetRunObjectInfos) (mv *, LPBYTE); + short( WINAPI * kpxWindowProc) (LPBYTE, HWND, UINT, WPARAM, LPARAM); + int ( WINAPI * kpxEnumElts) (mv *, LPBYTE, ENUMELTPROC, ENUMELTPROC, LPARAM, LPARAM); + int ( WINAPI * kpxLoadData) (mv *, OI*, LPBYTE, HFILE, DWORD); // Not used + int ( WINAPI * kpxUnloadData) (mv *, OI*, LPBYTE); // Not used + void ( WINAPI * kpxStartApp) (mv *, CRunApp*); + void ( WINAPI * kpxEndApp) (mv *, CRunApp*); + void ( WINAPI * kpxStartFrame) (mv *, CRunApp*, int); + void ( WINAPI * kpxEndFrame) (mv *, CRunApp*, int); + HGLOBAL ( WINAPI * kpxUpdateEditStructure) (mv *, LPVOID); +#if defined(VITALIZE) + BOOL bValidated; +#endif + BOOL bUnicode; +} kpxFunc; +typedef kpxFunc * fpKpxFunc; + +// Movement Extension +typedef struct MvxFnc { + HINSTANCE mvxHInst; + LPTSTR mvxFileTitle; + + CMvt* ( CALLBACK * mvxCreateMvt) (DWORD); + + #if defined(VITALIZE) + BOOL bValidated; + #endif +} MvxFnc; + +// Old 16/32 bit macros +#define ADDPTR32(p,l) p+=l; +#define SUBPTR32(p,l) p-=l; +#define INCPTR32(p) p++; + +#endif // RUN_TIME + +// Restore structure alignement +#ifndef _H2INC +#pragma pack( pop, _pack_cncy_ ) +#endif + +#ifndef __cplusplus +#undef CImageFilterMgr +#undef CSoundFilterMgr +#undef CSoundManager +#undef CRunApp +#undef CRunFrame +#undef CEditApp +#undef CEditFrame +#undef CMvt +#undef CPropValue +#endif + +#endif // CNCY_H diff --git a/Inc/Cnpdll.h b/Inc/Cnpdll.h index 2d32f1c..dbbbc3f 100644 --- a/Inc/Cnpdll.h +++ b/Inc/Cnpdll.h @@ -1,1144 +1,1144 @@ -//----------------------------------------------// -// Constantes et structures // -//----------------------------------------------// - -#ifndef _cnpdll_h // Si deja inclus, ignorer -#define _cnpdll_h - -#ifndef PI -#define PI ((double)3.1415926535) -#endif - -#ifndef _H2INC -#ifdef WIN32 -#pragma pack(push, 2) -#else -#pragma pack(2) -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// Include files for H2Inc -#ifdef _H2INC - - #define NOATOM - #define NOMETAFILE 1 - #define NOMINMAX - #define NOMSG - #define NOOPENFILE - #define NOSCROLL - #define NOSOUND 1 - #define NOSYSMETRICS - #define NOTEXTMETRIC - #define NODBCS - #define NOSYSTEMPARAMSINFO - #define NOCOMM 1 - #define NOOEMRESOURCE - #define NOPROFILER 1 - #define NOMDI 1 - - #define MMNODRV 1 - #define MMNOSOUND 1 - #define MMNOAUX 1 - #define MMNOTIMER - #define MMNOMMSYSTEM 1 - - #pragma warning (disable:4010) - #ifdef WIN32 - # include "win32.h" - #endif - #include "empty.h" - -#endif // _H2INC - -#ifdef __cplusplus -class cSurface; -class cSurfaceImplementation; -struct sMask; -#else -#define cSurface void -#define cSurfaceImplementation void -#define sMask void -#endif - - -// Current build -#define MMFS2_CURRENT_BUILD 250 -#define MMFS2_BUILD_MASK 0x0000FFFF -#define MMFS2_BUILD_FLAG_UNICODE 0x00010000 // Unicode support -#define MMFS2_BUILD_FLAG_HWA 0x00020000 // HWA support - -// 2/4 characters -> WORD/DWORD -#ifndef MAC -#define WORDSTR(c1,c2) ((WORD)((WORD)c2<<8|(WORD)c1)) -#define DWORDSTR(c1,c2,c3,c4) ((DWORD)((DWORD)c4<<24|(DWORD)c3<<16|(DWORD)c2<<8|(DWORD)c1)) -#endif - - // Definitions differentes si WIN32 - -// ================== -// Win 32 -// ================== -#ifdef WIN32 - - #define _near - #define __near - #define _far - #define __far - #define _pascal _stdcall - #define __pascal __stdcall - - // Export - #define DLLExport - #ifdef _H2INC - #define DLLExport32 - #else - #ifdef IN_DLL - #define DLLExport32 __declspec(dllexport) - #else - #define DLLExport32 __declspec(dllimport) - #endif - #endif - #define _export - #define __export - - // User messages - #define WM_AMOA WM_APP - -#endif - - // Flags boites de dialogues (obsolete) - // ------------------------- -#define DL_MODAL 1 -#define DL_CENTER_WINDOW 2 -#define DL_CENTER_SCREEN 4 - - // Messages propres a KNP - // ---------------------- -#define WM_IT50 (WM_AMOA+123) -#define WM_NET_FIRST (WM_AMOA+174) // v2 -#define WM_NET_LAST (WM_AMOA+199) - -#define UM_KEYDOWN (WM_AMOA+5) -#define UM_PANIC (WM_AMOA+6) - -#define IT50_WPARAMID 0x2775 - - // Classes de fenetres - // ------------------- -#define PCS_DBL 0x0001 -#define PCS_SNG 0x0002 -#define PCS_SCR 0x0003 -#define PCS_CLASS 0x00FF - -#define PCSF_STRETCH 0x0100 // Stretch log to phys - -#define PCSF_MDIMAIN 0x1000 -#define PCSF_MDICHILD 0x2000 - - // Extra-bytes - // ----------- -#define KNP_WINDOWEXTRA 12 // (3 dwords) -#define KWL_FPWIN 0 // pointeur sur structure DLL fenetre -#define KWL_USER 4 // DWORD disponible pour utilisateur - - // Objects -#ifndef _dllpriv_h -#define Appli void -#define Win void -#define npAppli Appli * -#define npWin Win * -#endif - - // Identifiants errones - // -------------------- -#define NPSPR_ERROR 0 -#define HSPR_ERROR 0 - -enum { - WIN_MEMERR, - WIN_APPERR, - WIN_CREATERR -}; -enum { - CREATELOG_MEMERR=16, - CREATELOG_DCERR, - CREATELOG_BMPERR -}; -#define WIN_ERROR ((npWin)32) -//#define HWIN_ERROR ((HWIN)32) - -enum { - APPLI_MEMERR, - APPLI_TIMERR -}; -#define APPLI_ERROR ((npAppli)32) -//#define HAPPLI_ERROR ((HAPPLI)32) - -// Modes ecran -// ----------- -#define SM_DEFAULT 0x00 // Pour SetModeAppli: mode par défaut - -#define SM_1 0x01 // DDB or DIB -#define SM_4 0x02 // DDB or DIB -#define SM_8 0x03 // DDB or DIB -#define SM_24 0x04 // DDB or DIB -#define SM_4p 0x05 // DDB only -#define SM_15 0x06 // DDB only - -#define SM_16 (SM_15+1) -#define SM_32 (SM_16+1) -#define MAX_MODE SM_32 - -#define SM_D3D 0x10 -#define SM_DDRAW 0x20 // Flag "Direct Draw" -#define SM_VRAM 0x40 // Flag "Video RAM" -#define SM_D3D8 0x80 -#define SM_NOTDIB (SM_DDRAW | SM_VRAM) -#define SM_MASK 0x0F // Mask mode - -// Modes graphiques -#define GROP_NORMAL R2_COPYPEN -#define GROP_XOR R2_XORPEN - -// Modes collisions -#define CM_BOX 0 -#define CM_BITMAP 1 - -// Test collisions -#define CM_TEST_OBSTACLE 0 -#define CM_TEST_PLATFORM 1 - -// Masques de bits d'écriture des plans de collision -#define CM_OBSTACLE 0x0001 -#define CM_PLATFORM 0x0002 - -// Hauteur des plateformes -#define HEIGHT_PLATFORM 6 -#define GCMF_OBSTACLE 0x0000 -#define GCMF_PLATFORM 0x0001 - -// Flags pour GetImageSize -#define GIS_WITHMASK 0x8000 -#define GIS_EXACT 0x4000 - - // AddImage flags -#define AI_WITHMASK 0x0010 // L'image originale a un masque (si son mode en a un) -#define AI_COMPARE 0x0020 // Comparer l'image aux autres -#define AI_ACE 0x0080 // En mode >= 256 couleurs, compacter le sprite -#define AI_FLAGS 0x00F0 // Masque flags - -#define AI_NOCOMP 0x0000 -#define AI_RLE 0x0100 // Compactage type RLE -#define AI_RLEW 0x0200 // Compactage type RLEW -#define AI_RLET 0x0400 // Compactage type RLET -#define AI_LZX 0x0800 // Compactage type LZX -#define AI_ALPHA 0x1000 // The image contains an alpha channel -#define AI_ACECOMP 0x4000 // Compactage sprite type ACE -#define AI_MAC 0x8000 // Flag temporaire utilise par la version MAC (sur?) -#define AI_COMPMASK (IF_RLE | IF_RLEW | IF_RLET) - - // imgFlags -#define IF_NOCOMP 0x00 -#define IF_RLE 0x01 // Compactage type RLE -#define IF_RLEW 0x02 // Compactage type RLEW -#define IF_RLET 0x04 // Compactage type RLET -#define IF_LZX 0x08 // Compactage type LZX -#define IF_ALPHA 0x10 // The image contains an alpha channel -#define IF_ACE 0x40 // Compactage sprite type ACE -#define IF_MAC 0x80 // Flag temporaire utilise par la version MAC (sur?) -#define IF_COMPMASK (IF_RLE | IF_RLEW | IF_RLET) - - // PasteSprite flags -#define PSF_HOTSPOT 0x0001 // Take hot spot into account -#define PSF_NOTRANSP 0x0002 // Non transparent image... ignored in PasteSpriteEffect - - // Ink effects -enum { - EFFECT_NONE=0, - EFFECT_SEMITRANSP, - EFFECT_INVERTED, - EFFECT_XOR, - EFFECT_AND, - EFFECT_OR, - MAX_EFFECT -}; - -#define EFFECTFLAG_TRANSPARENT 0x10000000L -#define EFFECTFLAG_ANTIALIAS 0x20000000L -#define EFFECT_MASK 0xFFFF - - // AddSound flags -#define AS_COMPARE 0x00010000 // Compare to others -#define AS_MASK 0xFFFF0000 - - // PlaySound flags -#define PS_NORMAL 0x0000 // Nothing special -#define PS_UNINTER 0x0001 // Cannot be stopped by other sound except by other UNINTER_PRIO -#define PS_UNINTER_PRIO 0x0002 // Cannot be stopped -#define PS_LOOP 0x0010 // Loop, sLParam = loop number, 0 = continuous -#define PS_GLOBALFOCUS 0x0020 // Sound not stopped if the application loses the focus -#define PS_DSOUND 0x0100 // To play with Direct Sound - - // AddFont flags -#define AF_COMPARE 0x100 // Compare to others - - // WinPasteText flags -#define WPTF_CALCRECT 0x8000 -#define WPTF_WITHPREFIX 0x4000 - - - -// ======================================================================= -// Memory banks -// ======================================================================= -// Public: -// ------- - -// Types -enum { - BK_IMGS, // Image bank - BK_SNGS, // Sound bank - BK_COLMASKS, // Collision mask bank - BK_COLMASKS_PLATFORM, // Platform collision mask bank - BK_IMGTEXTURES, // Image textures - BK_FONTS, // Font bank - BK_MAX -}; - -// ======================================================================= -// Images -// ======================================================================= - -typedef struct Img -{ - DWORD imgCheckSum; - DWORD imgCount; - DWORD imgSize; - short imgWidth; - short imgHeight; - BYTE imgFormat; - BYTE imgFlags; - WORD imgNotUsed; - short imgXSpot; - short imgYSpot; - short imgXAction; - short imgYAction; - COLORREF imgTrspColor; -} Img; -typedef Img* npImg; -typedef Img* fpImg; - - -// ======================================================================= -// Sounds -// ======================================================================= - -typedef struct Sound -{ - DWORD snCheckSum; // Checksum (du son sans l'entete) - DWORD snCount; // Ref count - DWORD snSize; // Taille of datas (including name) - DWORD snFlags; // Type (SP_MIDI, SP_WAVE) + flags - DWORD snReserved; - DWORD snNameSize; -} Sound; -typedef Sound* fpSound; - - // Sound flags -#define SP_WAVE 0x0001 // Flags -#define SP_MIDI 0x0002 -#define SNDF_TYPEMASK 0x000F -#define SNDF_LOADONCALL 0x0010 -#define SNDF_PLAYFROMDISK 0x0020 -#define SNDF_FILE 0x0040 -#define SNDF_UNICODEFILE 0x0080 -#define SNDF_LOADED 0x1000 - -// ======================================================================= -// Fonts -// ======================================================================= - -#ifndef _H2INC - -// Structure Font -typedef struct FontW -{ - DWORD fnCheckSum; // Checksum (des images) - DWORD fnCount; // Compteur d'utilisations - DWORD fnSize; // Taille sans l'entete - LOGFONTW fnLf; // Header font (pour CreateFont si Windows font) -} FontW; -typedef FontW *npFontW; -typedef FontW *fpFontW; - -typedef struct FontA -{ - DWORD fnCheckSum; // Checksum (des images) - DWORD fnCount; // Compteur d'utilisations - DWORD fnSize; // Taille sans l'entete - LOGFONTA fnLf; // Header font (pour CreateFont si Windows font) -} FontA; -typedef FontA *npFontA; -typedef FontA *fpFontA; - -#ifdef _UNICODE -#define Font FontW -#define fpFont fpFontW -#else -#define Font FontA -#define fpFont fpFontA -#endif - -#endif // _H2INC - - // Font avec LOGFONT 16 bits pour version 32 bits - -typedef struct tagLOGFONT16 { - short lfHeight; - short lfWidth; - short lfEscapement; - short lfOrientation; - short lfWeight; - BYTE lfItalic; - BYTE lfUnderline; - BYTE lfStrikeOut; - BYTE lfCharSet; - BYTE lfOutPrecision; - BYTE lfClipPrecision; - BYTE lfQuality; - BYTE lfPitchAndFamily; - BYTE lfFaceName[LF_FACESIZE]; -} LOGFONT16; - - // Structures - // ---------- - - // Zone, box, rectangle -#ifndef _dllpriv_h -typedef struct tagBox -{ - short x1,y1,x2,y2; -} Box; -typedef Box *npBox; -typedef Box *fpBox; -#endif - - // Structure infos ecran -typedef struct tagSMI { - UINT totalBitCount; // I.e. 16 - UINT usedBitCount; // I.e. 15 - UINT mainMode; // SM_4, SM_8, SM_etc... avec flags SM_DDRAW - UINT subMode; // sous-mode - DWORD rMask; - DWORD gMask; - DWORD bMask; - UINT flags; -} screenModeInfos; - - // Objet fenetre -#define WF_SIZE 0x0001 // Flag "resize in progress" -#define WF_STRETCH 0x0002 // Flag "stretch log to phys" -#define WF_NOPAINT 0x0008 // No paint -#define WF_DONOTMERGEZONES 0x0010 // Do not merge new zones -#define WF_IDLE 0x0020 // Idle mode (GetMessage) -#define WF_IDLE50 0x0040 // Idle mode (GetMessage + IT50) -#define WF_IDLEFLAGS (WF_IDLE | WF_IDLE50) // Idle mode flags -#define WF_UNICODE 0x0080 // Flag "view zones" en mode debug -#define WF_SCR 0x0100 // Flag "Screen saver window" -#define WF_MDIMAIN 0x0200 // MDI Frame -#define WF_MDICLIENT 0x0400 // MDI Client -#define WF_MDICHILD 0x0800 // MDI Child -#define WF_OWNDC 0x1000 -#define WF_OWNDCLOG 0x2000 -#define WF_FULLSCREENX2 0x4000 -#define WF_DONOTDESTROY 0x8000 - -#define WF2_NOUPDATE 0x0001 -#define WF2_DIBFULLSCREEN 0x0002 -#define WF2_MMF15 0x0004 -#define WF2_VSYNC 0x0008 -#define WF2_NOBACKSURF 0x0010 - - // Objet application -#define APPF_ENDAPP 0x0001 // Internal -#define APPF_GLOBALSOUNDS 0x0004 - - // Objet sprite -#define SF_RAMBO 0x00000001 // flag "rentre dans tout le monde" -#define SF_RECALCSURF 0x00000002 // Recalc surface (if rotation or stretch) -#define SF_PRIVATE 0x00000004 // flag privé utilisé par le runtime pour la destruction des fade -#define SF_INACTIF 0x00000008 // flag "inactif" = reaffichage ssi intersection avec un autre -#define SF_TOHIDE 0x00000010 // flag "a cacher" -#define SF_TOKILL 0x00000020 // flag "a detruire" -#define SF_REAF 0x00000040 // flag "a reafficher" -#define SF_HIDDEN 0x00000080 // flag "cache" -#define SF_COLBOX 0x00000100 // flag "collisions en mode box" -#define SF_NOSAVE 0x00000200 // flag "do not save background" -#define SF_FILLBACK 0x00000400 // flag "fill background using a solid colour (sprAdrBack)" -#define SF_DISABLED 0x00000800 -#define SF_REAFINT 0x00001000 // Internal -#define SF_OWNERDRAW 0x00002000 // flag "owner draw" -#define SF_OWNERSAVE 0x00004000 // flag "owner save" -#define SF_FADE 0x00008000 // Private - -#define SF_OBSTACLE 0x00010000 // Obstacle -#define SF_PLATFORM 0x00020000 // Platform -#define SF_BACKGROUND 0x00080000 // Backdrop object - -#define SF_SCALE_RESAMPLE 0x00100000 // Resample when stretching -#define SF_ROTATE_ANTIA 0x00200000 // Antialiasing for rotations -#define SF_NOHOTSPOT 0x00400000 // No hot spot -#define SF_OWNERCOLMASK 0x00800000 // Owner-draw sprite supports collision masks - -#define SF_UPDATECOLLIST 0x10000000 - -// SpriteCol_TestPoint / SpriteCol_TestSprite -#define SCF_OBSTACLE 0x01 -#define SCF_PLATFORM 0x02 -#define SCF_EVENNOCOL 0x04 // Flag: returns even sprites that haven't the SF_RAMBO flag -#define SCF_BACKGROUND 0x08 // Flag: if 0, returns active sprites, otherwise returns background sprites -#define SCF_TESTFEET 0x10 // Test only the bottom of the sprite - -#define LAYER_ALL (-1) - -// GetFirst/Last/Next/PrevSprite -#define GS_BACKGROUND 0x0001 -#define GS_SAMELAYER 0x0002 - -// ActiveSprite -#define AS_DEACTIVATE 0x0000 // Desactive un sprite actif -#define AS_REDRAW 0x0001 // Reaffiche un sprite inactif -#define AS_ACTIVATE 0x0002 // Active un sprite inactif -#define AS_ENABLE 0x0004 -#define AS_DISABLE 0x0008 -#define AS_REDRAW_NOBKD 0x0011 -#define AS_REDRAW_RECT 0x0020 - -#define SSF_HIDE 0x0000 // Cacher un sprite -#define SSF_SHOW 0x0001 // Montrer un sprite - -// Ownerdraw sprites, callback function -enum { - SPRITE_DRAW, - SPRITE_RESTORE, - SPRITE_SAVE, - SPRITE_KILL, - SPRITE_GETCOLMASK, -}; - - // Objet libre -#ifndef _dllpriv_h -typedef struct tagObj -{ - UINT objSize; // Taille de l'objet: 0 = fin objets - UINT objPrevSize; // Taille objet precedent (0 = 1er objet) - UINT objType; // Type d'objet (1=vide,2=appli,3=fenetre,...) - UINT objPrev; // Adresse objet precedent de meme type (0 = first) - UINT objNext; // Adresse objet suivant de meme type (0 = last) -} Obj; -typedef Obj *npObj; -typedef Obj *fpObj; -#endif - -#ifndef _H2INC -#ifdef IN_DLL -class Spr; -#endif -#endif - -#define SPRCOLLISLIST - -#ifdef __cplusplus -class Spr -{ -public: -#else -typedef struct Spr -{ -#endif -#ifndef SPRLIST - Obj sprObj; -#endif - DWORD sprFlags; // Flags - WORD sprLayer; // Sprite plane (layer) - short sprAngle; // Angle - int sprZOrder; // Z-order value - - // Coordinates - int sprX; - int sprY; - - // Bounding box - int sprX1; - int sprY1; - int sprX2; - int sprY2; - - // New coordinates - int sprXnew; - int sprYnew; - - // New bounding box - int sprX1new; - int sprY1new; - int sprX2new; - int sprY2new; - - // Background bounding box - int sprX1z; - int sprY1z; - int sprX2z; - int sprY2z; - - // Scale & Angle - float sprScaleX; - float sprScaleY; - - // Temporary values for collisions - WORD sprTempImg; // TODO: use DWORD later? - short sprTempAngle; - float sprTempScaleX; - float sprTempScaleY; - - // Image or owner-draw routine - union { - struct { - DWORD sprImg; // Numero d'image - DWORD sprImgNew; // Nouvelle image - }; - LPARAM sprRout; // Ownerdraw callback routine - }; - - // Ink effect - DWORD sprEffect; // 0=normal, 1=semi-transparent, > 16 = routine - LPARAM sprEffectParam; // parametre effet (coef transparence, etc...) - - // Fill color (wipe with color mode) - COLORREF sprBackColor; - - // Surfaces - cSurfaceImplementation* sprBackSurf; // Background surface, if no general background surface - - cSurfaceImplementation* sprSf; // Surface (if stretched or rotated) - sMask* sprColMask; // Collision mask (if stretched or rotated) - - cSurfaceImplementation* sprTempSf; // Temp surface (if stretched or rotated) - sMask* sprTempColMask; // Temp collision mask (if stretched or rotated) - - // User data - LPARAM sprExtraInfo; - - // Colliding sprites -#ifndef _H2INC -#ifdef IN_DLL - CPTypeArray sprCollisList; // liste de sprites entrant en collisions -#else - int sprCollisList[2]; -#endif -#endif - -#ifdef __cplusplus -}; -#else -} Spr; -#endif -typedef Spr *npSpr; -typedef Spr *fpSpr; - - // Structure "taille d'une appli" -typedef struct tagAppSize { - DWORD asInternal; // Place occupee dans le segment DLL - DWORD asLogics; // Taille ecrans logiques - DWORD asColMasks; // Taille buffers de collision avec le decor - DWORD asImages; // Banque des images - DWORD asMasks; // Banque des masques de collision des images - DWORD asSounds; // Banque des sons - DWORD asFonts; // Banque des fonts - DWORD asSprites; // Buffers de sauvegarde des fonds des sprites -} appSize; -typedef appSize *fpas; - -#ifdef _H2INC -#define CREATESTRUCTA CREATESTRUCT -#define CREATESTRUCTW CREATESTRUCT -#endif - -// Structure pour WinOpenEx -typedef struct tagCWA { - DWORD cwSize; - CREATESTRUCTA cwCreateStruct; - int cwCxMax; - int cwCyMax; - HCURSOR cwHCursor; - union { - DWORD cwBackColor; - HBRUSH cwHBackBrush; - }; - int cwClsWin; - int cwWinFlags; -} CREATEWINA; - -typedef struct CREATEWINEXA { - DWORD cwSize; - CREATESTRUCTA cwCreateStruct; - int cwCxMax; - int cwCyMax; - HCURSOR cwHCursor; - union { - DWORD cwBackColor; - HBRUSH cwHBackBrush; - }; - int cwClsWin; - int cwWinFlags; - HWND cwHWnd; - LPARAM cwNotUsed; -} CREATEWINEXA; - -typedef struct tagCWW { - DWORD cwSize; - CREATESTRUCTW cwCreateStruct; - int cwCxMax; - int cwCyMax; - HCURSOR cwHCursor; - union { - DWORD cwBackColor; - HBRUSH cwHBackBrush; - }; - int cwClsWin; - int cwWinFlags; -} CREATEWINW; - -typedef struct CREATEWINEXW { - DWORD cwSize; - CREATESTRUCTW cwCreateStruct; - int cwCxMax; - int cwCyMax; - HCURSOR cwHCursor; - union { - DWORD cwBackColor; - HBRUSH cwHBackBrush; - }; - int cwClsWin; - int cwWinFlags; - HWND cwHWnd; - LPARAM cwNotUsed; -} CREATEWINEXW; - -#ifdef _UNICODE -#define CREATEWIN CREATEWINW -#define CREATEWINEX CREATEWINEXW -#else -#define CREATEWIN CREATEWINA -#define CREATEWINEX CREATEWINEXA -#endif - -// Structure for SaveRect -typedef struct saveRect { - LPBYTE pData; - RECT rc; -} saveRect; -typedef saveRect* fpSaveRect; - - -//------------------------------ -// Prototypes des fonctions KNPS -//------------------------------ - -#define DialOpen(hi,id,hp,pr,a,b,c,lp) DialogBoxParam(hi,id,hp,pr,lp) - -DLLExport32 DWORD WINAPI GetDLLVersion(); - - // Application - // ----------- -DLLExport32 npAppli WINAPI InitAppli (HINSTANCE, HPALETTE); -DLLExport32 DWORD WINAPI SetModeAppli (npAppli, int); -DLLExport32 int WINAPI LockBank (npAppli, int); -DLLExport32 int WINAPI UnlockBank (npAppli, int); -DLLExport32 int WINAPI PurgeBank (npAppli, int); -DLLExport32 void WINAPI KillBank (npAppli, int); -DLLExport32 int WINAPI Bank_GetEltCount (npAppli ptApp, UINT bkNum); -DLLExport32 LPVOID WINAPI Bank_GetEltAddr (npAppli ptApp, UINT bkNum, UINT eNum); - -DLLExport32 void WINAPI EndAppli (npAppli); - - // Windows, dialogues - // ------------------ -DLLExport32 npWin WINAPI WinOpenExA (npAppli, CREATEWINA *); -DLLExport32 npWin WINAPI WinOpenExW (npAppli, CREATEWINW *); -DLLExport32 npWin WINAPI SCRWinOpenA (npAppli, HWND); -DLLExport32 npWin WINAPI SCRWinOpenW (npAppli, HWND); -DLLExport32 void WINAPI WCDClose (npWin); -DLLExport32 HWND WINAPI WinGetHandle (npWin); -DLLExport32 HWND WINAPI WinGetMCHandle (npWin); -DLLExport32 HDC WINAPI WinGetHDC (npWin); -DLLExport32 HDC WINAPI WinGetHDCLog (npWin); -DLLExport32 void WINAPI WinReleaseHDC (npWin, HDC); -DLLExport32 void WINAPI WinReleaseHDCLog (npWin, HDC); -DLLExport32 void WINAPI WinGetLogRect (npWin, RECT *); -DLLExport32 npWin WINAPI WinSearch (HWND); - -DLLExport32 LRESULT CALLBACK DefMsgProcA (HWND hWin, UINT uMsg, WPARAM wParam, LPARAM lParam); -DLLExport32 LRESULT CALLBACK DefMsgProcW (HWND hWin, UINT uMsg, WPARAM wParam, LPARAM lParam); - -#ifdef _UNICODE -#define WinOpenEx WinOpenExW -#define SCRWinOpen SCRWinOpenW -#define DefMsgProc DefMsgProcW -#else -#define WinOpenEx WinOpenExA -#define SCRWinOpen SCRWinOpenA -#define DefMsgProc DefMsgProcA -#endif - - // Menus - // ----- -DLLExport32 HMENU WINAPI WinSetMenu (npWin, HMENU, HACCEL); -//DLLExport32 void WINAPI WinSetAccel (npWin, HACCEL); - - // Souris - // ------ -DLLExport32 HCURSOR WINAPI WinSetMouse (npWin, HCURSOR); -DLLExport32 void WINAPI WinStartWait (npWin); -DLLExport32 void WINAPI WinEndWait (npWin); - - // Events - // ------ -//DLLExport32 WORD WINAPI GetMsg (npWin, fpKm); -//DLLExport32 DWORD WINAPI GetIt50 (void); -//DLLExport32 DWORD WINAPI RazCptVbl (void); -//DLLExport32 DWORD WINAPI GetCptVbl (void); -//DLLExport32 void WINAPI EnableIt50 (npWin, int); - - // Graphics - // -------- -DLLExport32 void WINAPI WinClip (npWin, int, int, int, int); -DLLExport32 void WINAPI WinFillRect (npWin, int, int, int, int, DWORD); -DLLExport32 void WINAPI WinFillBr (npWin, int, int, int, int, HBRUSH); -DLLExport32 void WINAPI WinBox (npWin, fpBox); -DLLExport32 void WINAPI WinRect (npWin, RECT *); -DLLExport32 void WINAPI WinLine (npWin, POINT *, UINT); -DLLExport32 void WINAPI WinGrabDesktop (npWin); - -#ifndef IN_KPX -DLLExport32 int WINAPI StartFullScreen (npWin, int, int, int); -DLLExport32 int WINAPI EndFullScreen (); -#endif // IN_KPX - -DLLExport32 void WINAPI WinPaper (npWin, COLORREF); -DLLExport32 void WINAPI WinPen (npWin, COLORREF, int, int); -DLLExport32 void WINAPI WinGraphMode (npWin, int); - -#define WSP_NBSPRITES 1 -#define WSP_SETAPPFLAGS 2 -#define WSP_GETAPPFLAGS 4 -#define WSP_GETWINFLAGS2 9 -#define WSP_SETWINFLAGS2 10 -DLLExport32 BOOL WINAPI WinSetParam (npWin, int, UINT, DWORD); - - // Dibs - // ---- -DLLExport32 DWORD WINAPI InitDibHeader (npAppli, int, int, int, BITMAPINFO *); -DLLExport32 void WINAPI FillDib (BITMAPINFO *, COLORREF); -DLLExport32 DWORD WINAPI ImageToDib (npAppli, DWORD, DWORD, LPBYTE); -DLLExport32 DWORD WINAPI DibToImage (npAppli, fpImg, BITMAPINFOHEADER *); -DLLExport32 DWORD WINAPI DibToImageEx (npAppli, fpImg, BITMAPINFOHEADER *, COLORREF, DWORD); -DLLExport32 void WINAPI RemapDib (BITMAPINFO *, npAppli, LPBYTE); - - // Palette - // ------- -DLLExport32 HPALETTE WINAPI SetDefaultPalette256 (PALETTEENTRY *); -DLLExport32 void WINAPI SetPaletteAppli (npAppli, HPALETTE); -DLLExport32 int WINAPI GetPaletteAppli (LOGPALETTE *, int, npAppli); -DLLExport32 int WINAPI GetNearestIndex (npAppli, int, COLORREF); -DLLExport32 COLORREF WINAPI GetRGB (npAppli, int, int); -DLLExport32 int WINAPI GetOpaqueBlack (npAppli); - - // Font - // ---- -#ifndef _H2INC -DLLExport32 DWORD WINAPI AddFontA (npAppli, DWORD, fpFontA, LPDWORD, DWORD); -DLLExport32 DWORD WINAPI IncFontCount (npAppli, DWORD); -DLLExport32 long WINAPI DelFont (npAppli, DWORD); -DLLExport32 int WINAPI GetFontInfosA (npAppli, DWORD, fpFontA, LPDWORD); -DLLExport32 HFONT WINAPI WinCreateFont (npAppli, DWORD); -DLLExport32 int WINAPI WinPasteTextA (npWin, HFONT, RECT*, LPSTR, COLORREF, DWORD); - -DLLExport32 DWORD WINAPI AddFontW (npAppli ptApp, DWORD fType, fpFontW fntHdr, LPDWORD lpw, DWORD nbw); -DLLExport32 int WINAPI GetFontInfosW (npAppli ptApp, DWORD nFont, fpFontW fntHdr, LPDWORD lpw); -DLLExport32 int WINAPI WinPasteTextW (npWin, HFONT, RECT*, LPWSTR, COLORREF, DWORD); - - // Fonts - fonctions 32 bits utilisant des structures 16 bits -DLLExport32 void WINAPI LogFont16To32A ( LOGFONTA * lf32, LOGFONT16 * lf16 ); -DLLExport32 void WINAPI LogFont32To16A ( LOGFONT16 * lf16, LOGFONTA * lf32 ); -DLLExport32 HFONT WINAPI CreateFontIndirect16 ( LOGFONT16 * lFont ); - -DLLExport32 void WINAPI LogFont16To32W ( LOGFONTW * lf32, LOGFONT16 * lf16 ); -DLLExport32 void WINAPI LogFont32To16W ( LOGFONT16 * lf16, LOGFONTW * lf32 ); - -#ifdef _UNICODE -#define AddFont AddFontW -#define GetFontInfos GetFontInfosW -#define WinPasteText WinPasteTextW -#define LogFont16To32 LogFont16To32W -#define LogFont32To16 LogFont32To16W -#else -#define AddFont AddFontA -#define GetFontInfos GetFontInfosA -#define WinPasteText WinPasteTextA -#define LogFont16To32 LogFont16To32A -#define LogFont32To16 LogFont32To16A -#endif - -#endif // _H2INC - - - - // Images - // ------ -DLLExport32 void WINAPI PasteSprite (npWin, DWORD, int, int, DWORD); -DLLExport32 void WINAPI PasteSpriteEffect (npWin, DWORD, int, int, DWORD, DWORD, LPARAM); -DLLExport32 DWORD WINAPI AddImage (npAppli, WORD, WORD, short, short, short, short, COLORREF, DWORD, LPVOID, LPBYTE); -DLLExport32 DWORD WINAPI IncImageCount (npAppli, DWORD); -DLLExport32 int WINAPI IsImageEmpty (npAppli, DWORD); -DLLExport32 DWORD WINAPI GetImageBits (npAppli, DWORD, DWORD, LPBYTE); -DLLExport32 void WINAPI StretchImage (npAppli, DWORD, WORD, WORD, LPBYTE); -DLLExport32 long WINAPI DelImage (npAppli, DWORD); -DLLExport32 sMask* WINAPI AddMask (npAppli ptApp, DWORD iNum, UINT nFlags); -DLLExport32 long WINAPI DelMask (npAppli, DWORD); -DLLExport32 int WINAPI GetImageInfos (npAppli, DWORD, fpImg); -DLLExport32 int WINAPI GetImageInfoEx (npAppli pApp, DWORD nImage, int nAngle, float fScaleX, float fScaleY, fpImg pIfo); -DLLExport32 DWORD WINAPI GetImageSize (WORD, WORD, WORD); -DLLExport32 sMask* WINAPI GetImageMask (npAppli ptApp, DWORD dwImage, UINT nFlags); -DLLExport32 sMask* WINAPI CompleteSpriteColMask (npWin ptrWin, npSpr ptSpr, DWORD dwPSCFlags, UINT nWidth, UINT nHeight); -DLLExport32 DWORD WINAPI PrepareSpriteColMask (npWin ptrWin, npSpr ptSpr, DWORD newImg, int newX, int newY, int newAngle, float newScaleX, float newScaleY, RECT* prc, sMask** ppMask); - - // Sprites - // ------- -DLLExport32 npSpr WINAPI AddSprite (npWin ptrWin, int xSpr, int ySpr, DWORD iSpr, WORD wLayer, int nZOrder, DWORD backSpr, DWORD sFlags, LPARAM extraInfo); -DLLExport32 npSpr WINAPI AddOwnerDrawSprite (npWin ptrWin, int x1, int y1, int x2, int y2, WORD wLayer, int nZOrder, DWORD backSpr, DWORD sFlags, LPARAM extraInfo, LPARAM sprProc); -DLLExport32 npSpr WINAPI ModifSprite (npWin ptrWin, npSpr ptSpr, int xSpr, int ySpr, DWORD iSpr); -DLLExport32 npSpr WINAPI ModifSpriteEx (npWin ptrWin, npSpr ptSpr, int xSpr, int ySpr, DWORD iSpr, float fScaleX, float fScaleY, BOOL bResample, int nAngle, BOOL bAntiA); -DLLExport32 npSpr WINAPI ModifSpriteEffect (npWin ptrWin, npSpr ptSpr, DWORD effect, LPARAM effectParam); -DLLExport32 npSpr WINAPI ModifOwnerDrawSprite (npWin ptrWin, npSpr ptSprModif, int x1, int y1, int x2, int y2); -DLLExport32 void WINAPI ShowSprite (npWin, npSpr, int); -DLLExport32 void WINAPI ActiveSprite (npWin, npSpr, int); -DLLExport32 void WINAPI DelSprites (npWin); -DLLExport32 void WINAPI DelSprite (npWin, npSpr); -DLLExport32 void WINAPI DelSpriteFast (npWin, npSpr); -DLLExport32 LPARAM WINAPI GetSpriteExtra (npWin, npSpr); -DLLExport32 DWORD WINAPI GetSpriteFlags (npWin, npSpr); -DLLExport32 DWORD WINAPI SetSpriteFlags (npWin ptrWin, npSpr ptSpr, DWORD dwNewFlags); -DLLExport32 void WINAPI SpriteClear (npWin); -DLLExport32 void WINAPI SpriteDraw (npWin); -DLLExport32 void WINAPI SpriteUpdate (npWin); -DLLExport32 void WINAPI ScreenUpdate (npWin); - -DLLExport32 void WINAPI GetSpriteScale (npWin ptrWin, npSpr ptSpr, float* pScaleX, float* pScaleY, BOOL* pResample); -DLLExport32 void WINAPI SetSpriteScale (npWin ptrWin, npSpr ptSpr, float fScaleX, float fScaleY, BOOL bResample); -DLLExport32 int WINAPI GetSpriteAngle (npWin ptrWin, npSpr ptSpr, BOOL* pAntiA); -DLLExport32 void WINAPI SetSpriteAngle (npWin ptrWin, npSpr ptSpr, int nAngle, BOOL bAntiA); -DLLExport32 void WINAPI GetSpriteRect (npWin ptrWin, npSpr ptSpr, RECT* prc); -DLLExport32 void WINAPI MoveSpriteToFront(npWin ptrWin, npSpr pSpr); -DLLExport32 void WINAPI MoveSpriteToBack (npWin ptrWin, npSpr pSpr); -DLLExport32 void WINAPI MoveSpriteBefore (npWin ptrWin, npSpr pSprToMove, npSpr pSprDest); -DLLExport32 void WINAPI MoveSpriteAfter (npWin ptrWin, npSpr pSprToMove, npSpr pSprDest); -DLLExport32 BOOL WINAPI IsSpriteBefore (npWin ptrWin, npSpr pSpr, npSpr pSprDest); -DLLExport32 BOOL WINAPI IsSpriteAfter (npWin ptrWin, npSpr pSpr, npSpr pSprDest); -DLLExport32 void WINAPI SwapSprites (npWin ptrWin, npSpr sp1, npSpr sp2); -DLLExport32 int WINAPI GetSpriteLayer (npWin ptrWin, npSpr ptSpr); -DLLExport32 void WINAPI SetSpriteLayer (npWin ptrWin, npSpr ptSpr, int nLayer); -DLLExport32 sMask* WINAPI GetSpriteMask (npWin ptrWin, npSpr pSpr, UINT newImg, UINT nFlags); - -DLLExport32 npSpr WINAPI GetFirstSprite (npWin ptrWin, int nLayer, DWORD dwFlags); -DLLExport32 npSpr WINAPI GetNextSprite (npWin ptrWin, npSpr pSpr, DWORD dwFlags); -DLLExport32 npSpr WINAPI GetPrevSprite (npWin ptrWin, npSpr pSpr, DWORD dwFlags); -DLLExport32 npSpr WINAPI GetLastSprite (npWin ptrWin, int nLayer, DWORD dwFlags); - - // Sauvegarde / Restitution de zones - // --------------------------------- -DLLExport32 void WINAPI WinResetZones (npWin); -DLLExport32 void WINAPI WinAddZone (npWin, RECT *); -DLLExport32 void WINAPI WinAddCoord (npWin, int, int, int, int); -DLLExport32 int WINAPI SaveRect (npWin, fpSaveRect, int, int, int, int); -DLLExport32 void WINAPI RestoreRect (npWin, fpSaveRect); -DLLExport32 void WINAPI KillRect (fpSaveRect); -DLLExport32 UINT* WINAPI WinGetZones (npWin); -DLLExport32 void WINAPI WinEnableUpdate (npWin, int); - - // Collisions - // ---------- -DLLExport32 DWORD WINAPI SetSpriteColFlag (npWin, npSpr, DWORD); // UINT = SF_xxxx -DLLExport32 npSpr WINAPI SpriteCol_TestPoint (npWin, npSpr, int, int, int, DWORD); // Entre 1 pixel et les sprites sauf un -DLLExport32 npSpr WINAPI SpriteCol_TestRect (npWin, npSpr, int, int, int, int, int, DWORD); // Entre 1 rectangle et les sprites sauf un -DLLExport32 npSpr WINAPI SpriteCol_TestSprite (npWin ptrWin, npSpr ptSpr, DWORD newImg, int newX, int newY, int newAngle, float newScaleX, float newScaleY, int subHt, DWORD dwFlags); -DLLExport32 UINT WINAPI SpriteCol_TestSprite_All (npWin, npSpr, LPVOID*, DWORD, int, int, int, float, float, DWORD); -DLLExport32 int WINAPI WinSetColMode (npWin, WORD); // Mode BOX ou BITMAP - -DLLExport32 BOOL WINAPI ColMask_Create (npWin, UINT, UINT, DWORD); // Creation bitmap masque fond -DLLExport32 BOOL WINAPI ColMask_CreateEx (npWin, int, int, int, int, DWORD); -DLLExport32 void WINAPI ColMask_Kill (npWin); // Destruction masque fond -DLLExport32 void WINAPI ColMask_Fill (npWin, DWORD); // Init masque fond -DLLExport32 int WINAPI ColMask_FillRectangle (npWin, int, int, int, int, DWORD); -DLLExport32 void WINAPI ColMask_OrImage (npWin, DWORD, int, int, DWORD); -DLLExport32 void WINAPI ColMask_OrMask (npWin, sMask*, int, int, DWORD, DWORD); -DLLExport32 void WINAPI ColMask_OrPlatform (npWin, DWORD, int, int); -DLLExport32 void WINAPI ColMask_OrPlatformMask (npWin, sMask*, int, int); -DLLExport32 int WINAPI ColMask_Scroll (npWin, int, int, RECT *, RECT *); -DLLExport32 void WINAPI ColMask_SetOrigin (npWin, int, int); -DLLExport32 void WINAPI ColMask_ToLog (npWin ptrWin, UINT nPlane); -DLLExport32 void WINAPI ColMask_SetClip (npWin, RECT *); - -DLLExport32 BOOL WINAPI ColMask_TestPoint (npWin ptrWin, int x, int y, UINT nPlane); -DLLExport32 BOOL WINAPI ColMask_TestSprite (npWin ptrWin, npSpr pSpr, int newImg, int newX, int newY, int newAngle, float newScaleX, float newScaleY, int subHt, UINT nPlane); -DLLExport32 int WINAPI ColMask_TestRect (npWin, int, int, int, int, UINT nPlane); - -DLLExport32 BOOL WINAPI Mask_TestPoint (LPBYTE pMask, int x, int y, int nMaskWidth, int nMaskHeight); -DLLExport32 BOOL WINAPI Mask_TestMask (LPBYTE pMaskBits1, LPBYTE pMaskBits2, int x1Spr1, int y1Spr1, int wSpr1, int hSpr1, int x1Spr2, int y1Spr2, int wSpr2, int hSpr2); -DLLExport32 BOOL WINAPI Mask_TestRect (LPBYTE pMask, int nMaskWidth, int nMaskHeight, int x, int y, int nWidth, int nHeight); - - // Hooks - // ----- -DLLExport32 HHOOK WINAPI StartFilterHook (HWND); -DLLExport32 int WINAPI StopFilterHook (HHOOK); - - // Divers - // ------ -#define WavePerio() - - // New - // --- -DLLExport32 void WINAPI WinSetFlags (npWin, WORD); -DLLExport32 WORD WINAPI WinGetFlags (npWin); -DLLExport32 int WINAPI WinScroll (npWin, int, int, int, int, int, int); - -DLLExport32 int WINAPI EnumScreenModes (screenModeInfos *ptsfo, int maxModes, UINT flags); - - // V2 - // -- - -#define HCSPALETTE UINT - -DLLExport32 HCSPALETTE WINAPI AddPalette (LOGPALETTE* pLogPal); -DLLExport32 void WINAPI DelPalette (HCSPALETTE pCsPal); -DLLExport32 void WINAPI SetAppCSPalette (npAppli ptrApp, HPALETTE hpal, HCSPALETTE pCsPal); -DLLExport32 HCSPALETTE WINAPI GetAppCSPalette (npAppli ptrApp); - -// Sounds - -#ifdef __cplusplus -class CSoundManager; -DLLExport32 int WINAPI PlaySndA (CSoundManager* pSndMgr, npAppli ptApp, UINT sNum, HWND hWin, DWORD sFlags, DWORD sLParam, UINT nChannel); -DLLExport32 int WINAPI PlaySndW (CSoundManager* pSndMgr, npAppli ptApp, UINT sNum, HWND hWin, DWORD sFlags, DWORD sLParam, UINT nChannel); -#endif // __cplusplus - -DLLExport32 void WINAPI PauseSnd (npAppli ptApp, UINT sType, UINT sNum); -DLLExport32 void WINAPI PauseSndChannel (npAppli ptApp, UINT nChannel); -DLLExport32 void WINAPI ResumeSnd (npAppli ptApp, UINT sType, UINT sNum); -DLLExport32 void WINAPI ResumeSndChannel (npAppli ptApp, UINT nChannel); -DLLExport32 void WINAPI StopSnd (npAppli ptApp, UINT sType, UINT sNum); -DLLExport32 void WINAPI StopSndChannel (npAppli ptApp, UINT nChannel); -DLLExport32 int WINAPI IsSndPlaying (npAppli ptApp, UINT nSound); -DLLExport32 int WINAPI IsSndChannelPlaying (npAppli ptApp, UINT nChannel); -DLLExport32 int WINAPI IsSndPaused (npAppli ptApp, UINT nSound); -DLLExport32 int WINAPI IsSndChannelPaused (npAppli ptApp, UINT nChannel); -DLLExport32 void WINAPI SetSndMainVolume (npAppli ptApp, UINT sType, int nVolume); -DLLExport32 void WINAPI SetSndMainPan (npAppli ptApp, UINT sType, int nPan); -DLLExport32 int WINAPI GetSndMainVolume (npAppli ptApp, UINT sType); -DLLExport32 int WINAPI GetSndMainPan (npAppli ptApp, UINT sType); -DLLExport32 void WINAPI SetSndChannelVolume (npAppli ptApp, UINT nChannel, int nVolume); -DLLExport32 void WINAPI SetSndChannelPan (npAppli ptApp, UINT nChannel, int nPan); -DLLExport32 void WINAPI SetSndVolume (npAppli ptApp, UINT sType, UINT sNum, int nVolume); -DLLExport32 void WINAPI SetSndPan (npAppli ptApp, UINT sType, UINT sNum, int nPan); -DLLExport32 int WINAPI GetSndChannelVolume (npAppli ptApp, UINT nChannel); -DLLExport32 int WINAPI GetSndChannelPan (npAppli ptApp, UINT nChannel); -DLLExport32 int WINAPI GetSndVolume (npAppli ptApp, UINT sType, UINT sNum); -DLLExport32 int WINAPI GetSndPan (npAppli ptApp, UINT sType, UINT sNum); -DLLExport32 DWORD WINAPI GetSndChannelDuration (npAppli ptApp, UINT nChannel); -DLLExport32 DWORD WINAPI GetSndChannelPosition (npAppli ptApp, UINT nChannel); -DLLExport32 void WINAPI SetSndChannelPosition (npAppli ptApp, UINT nChannel, DWORD dwPosition); -DLLExport32 DWORD WINAPI GetSndDuration (npAppli ptApp, UINT sType, UINT sNum); -DLLExport32 DWORD WINAPI GetSndPosition (npAppli ptApp, UINT sType, UINT sNum); -DLLExport32 void WINAPI SetSndPosition (npAppli ptApp, UINT sType, UINT sNum, DWORD dwPosition); -DLLExport32 UINT WINAPI FindSndFromNameA(npAppli ptApp, UINT sType, LPCSTR pName); -DLLExport32 UINT WINAPI FindSndFromNameW(npAppli ptApp, UINT sType, LPCWSTR pName); -DLLExport32 int WINAPI GetSndChannel(npAppli ptApp, UINT sNum); - -DLLExport32 void WINAPI LockSndChannel (npAppli ptApp, UINT nChannel, BOOL bLock); -DLLExport32 void WINAPI SetSndChannelFreq (npAppli ptApp, UINT nChannel, DWORD dwFreq); -DLLExport32 void WINAPI SetSndFreq (npAppli ptApp, UINT sType, UINT sNum, DWORD dwFreq); -DLLExport32 DWORD WINAPI GetSndChannelFreq (npAppli ptApp, UINT nChannel); -DLLExport32 DWORD WINAPI GetSndFreq (npAppli ptApp, UINT sType, UINT sNum); - -DLLExport32 UINT WINAPI AddSoundA (npAppli, UINT, LPSTR, LPBYTE, DWORD); -DLLExport32 UINT WINAPI ReplaceSoundA (npAppli ptApp, UINT sFlags, UINT nSound, LPSTR fpName, LPBYTE lpData, DWORD dwDataSize); -DLLExport32 BOOL WINAPI SetSoundFlags (npAppli ptApp, UINT nSound, UINT sFlags); -DLLExport32 DWORD WINAPI IncSoundCount (npAppli, UINT); -DLLExport32 int WINAPI GetSoundInfoA (npAppli, UINT, fpSound); -DLLExport32 int WINAPI GetSoundNameA (npAppli, UINT, LPSTR, UINT); -DLLExport32 long WINAPI GetSoundData (npAppli, UINT, LPBYTE); -DLLExport32 LPBYTE WINAPI GetSoundDataPtr (npAppli, UINT); -DLLExport32 long WINAPI DelSound (npAppli, UINT); - -DLLExport32 UINT WINAPI AddSoundW (npAppli, UINT, LPWSTR, LPBYTE, DWORD); -DLLExport32 UINT WINAPI ReplaceSoundW (npAppli ptApp, UINT sFlags, UINT nSound, LPWSTR fpName, LPBYTE lpData, DWORD dwDataSize); -DLLExport32 int WINAPI GetSoundNameW (npAppli, UINT, LPWSTR, UINT); -DLLExport32 int WINAPI GetSoundInfoW (npAppli, UINT, fpSound); - -#ifdef _UNICODE -#define AddSound AddSoundW -#define ReplaceSound ReplaceSoundW -#define GetSoundName GetSoundNameW -#define GetSoundInfo GetSoundInfoW -#define FindSndFromName FindSndFromNameW -#define PlaySnd PlaySndW -#else -#define AddSound AddSoundA -#define ReplaceSound ReplaceSoundA -#define GetSoundName GetSoundNameA -#define GetSoundInfo GetSoundInfoA -#define FindSndFromName FindSndFromNameA -#define PlaySnd PlaySndA -#endif - -DLLExport32 int WINAPI WaveSetChannels (npAppli ptApp, int nChannels); - -#ifdef __cplusplus -} -#endif - -#ifndef _H2INC -enum { - LOCKIMAGE_READBLITONLY, - LOCKIMAGE_ALLREADACCESS, - LOCKIMAGE_HWACOMPATIBLE -}; - -#ifdef __cplusplus -DLLExport32 BOOL WINAPI WinAttachSurface (int idWin, cSurface * cs); -DLLExport32 void WINAPI WinDetachSurface (int idWin); - -DLLExport32 BOOL WINAPI LockImageSurface (LPVOID, DWORD hImage, cSurface &cs, int flags=LOCKIMAGE_READBLITONLY); -DLLExport32 void WINAPI UnlockImageSurface (cSurface &cs); - -// Get window surface (logical screen) -enum { - WSURF_LOGSCREEN, - WSURF_BACKSAVE -}; -DLLExport32 cSurface * WINAPI WinGetSurface (int idWin, int surfID=WSURF_LOGSCREEN); -#endif // __cplusplus -#endif // !defined(_H2INC) - -#ifndef _H2INC -#ifdef WIN32 -#pragma pack(pop) -#else -#pragma pack() -#endif -#endif - -#endif // _cnpdll_h +//----------------------------------------------// +// Constantes et structures // +//----------------------------------------------// + +#ifndef _cnpdll_h // Si deja inclus, ignorer +#define _cnpdll_h + +#ifndef PI +#define PI ((double)3.1415926535) +#endif + +#ifndef _H2INC +#ifdef WIN32 +#pragma pack(push, 2) +#else +#pragma pack(2) +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// Include files for H2Inc +#ifdef _H2INC + + #define NOATOM + #define NOMETAFILE 1 + #define NOMINMAX + #define NOMSG + #define NOOPENFILE + #define NOSCROLL + #define NOSOUND 1 + #define NOSYSMETRICS + #define NOTEXTMETRIC + #define NODBCS + #define NOSYSTEMPARAMSINFO + #define NOCOMM 1 + #define NOOEMRESOURCE + #define NOPROFILER 1 + #define NOMDI 1 + + #define MMNODRV 1 + #define MMNOSOUND 1 + #define MMNOAUX 1 + #define MMNOTIMER + #define MMNOMMSYSTEM 1 + + #pragma warning (disable:4010) + #ifdef WIN32 + # include "win32.h" + #endif + #include "empty.h" + +#endif // _H2INC + +#ifdef __cplusplus +class cSurface; +class cSurfaceImplementation; +struct sMask; +#else +#define cSurface void +#define cSurfaceImplementation void +#define sMask void +#endif + + +// Current build +#define MMFS2_CURRENT_BUILD 250 +#define MMFS2_BUILD_MASK 0x0000FFFF +#define MMFS2_BUILD_FLAG_UNICODE 0x00010000 // Unicode support +#define MMFS2_BUILD_FLAG_HWA 0x00020000 // HWA support + +// 2/4 characters -> WORD/DWORD +#ifndef MAC +#define WORDSTR(c1,c2) ((WORD)((WORD)c2<<8|(WORD)c1)) +#define DWORDSTR(c1,c2,c3,c4) ((DWORD)((DWORD)c4<<24|(DWORD)c3<<16|(DWORD)c2<<8|(DWORD)c1)) +#endif + + // Definitions differentes si WIN32 + +// ================== +// Win 32 +// ================== +#ifdef WIN32 + + #define _near + #define __near + #define _far + #define __far + #define _pascal _stdcall + #define __pascal __stdcall + + // Export + #define DLLExport + #ifdef _H2INC + #define DLLExport32 + #else + #ifdef IN_DLL + #define DLLExport32 __declspec(dllexport) + #else + #define DLLExport32 __declspec(dllimport) + #endif + #endif + #define _export + #define __export + + // User messages + #define WM_AMOA WM_APP + +#endif + + // Flags boites de dialogues (obsolete) + // ------------------------- +#define DL_MODAL 1 +#define DL_CENTER_WINDOW 2 +#define DL_CENTER_SCREEN 4 + + // Messages propres a KNP + // ---------------------- +#define WM_IT50 (WM_AMOA+123) +#define WM_NET_FIRST (WM_AMOA+174) // v2 +#define WM_NET_LAST (WM_AMOA+199) + +#define UM_KEYDOWN (WM_AMOA+5) +#define UM_PANIC (WM_AMOA+6) + +#define IT50_WPARAMID 0x2775 + + // Classes de fenetres + // ------------------- +#define PCS_DBL 0x0001 +#define PCS_SNG 0x0002 +#define PCS_SCR 0x0003 +#define PCS_CLASS 0x00FF + +#define PCSF_STRETCH 0x0100 // Stretch log to phys + +#define PCSF_MDIMAIN 0x1000 +#define PCSF_MDICHILD 0x2000 + + // Extra-bytes + // ----------- +#define KNP_WINDOWEXTRA 12 // (3 dwords) +#define KWL_FPWIN 0 // pointeur sur structure DLL fenetre +#define KWL_USER 4 // DWORD disponible pour utilisateur + + // Objects +#ifndef _dllpriv_h +#define Appli void +#define Win void +#define npAppli Appli * +#define npWin Win * +#endif + + // Identifiants errones + // -------------------- +#define NPSPR_ERROR 0 +#define HSPR_ERROR 0 + +enum { + WIN_MEMERR, + WIN_APPERR, + WIN_CREATERR +}; +enum { + CREATELOG_MEMERR=16, + CREATELOG_DCERR, + CREATELOG_BMPERR +}; +#define WIN_ERROR ((npWin)32) +//#define HWIN_ERROR ((HWIN)32) + +enum { + APPLI_MEMERR, + APPLI_TIMERR +}; +#define APPLI_ERROR ((npAppli)32) +//#define HAPPLI_ERROR ((HAPPLI)32) + +// Modes ecran +// ----------- +#define SM_DEFAULT 0x00 // Pour SetModeAppli: mode par défaut + +#define SM_1 0x01 // DDB or DIB +#define SM_4 0x02 // DDB or DIB +#define SM_8 0x03 // DDB or DIB +#define SM_24 0x04 // DDB or DIB +#define SM_4p 0x05 // DDB only +#define SM_15 0x06 // DDB only + +#define SM_16 (SM_15+1) +#define SM_32 (SM_16+1) +#define MAX_MODE SM_32 + +#define SM_D3D 0x10 +#define SM_DDRAW 0x20 // Flag "Direct Draw" +#define SM_VRAM 0x40 // Flag "Video RAM" +#define SM_D3D8 0x80 +#define SM_NOTDIB (SM_DDRAW | SM_VRAM) +#define SM_MASK 0x0F // Mask mode + +// Modes graphiques +#define GROP_NORMAL R2_COPYPEN +#define GROP_XOR R2_XORPEN + +// Modes collisions +#define CM_BOX 0 +#define CM_BITMAP 1 + +// Test collisions +#define CM_TEST_OBSTACLE 0 +#define CM_TEST_PLATFORM 1 + +// Masques de bits d'écriture des plans de collision +#define CM_OBSTACLE 0x0001 +#define CM_PLATFORM 0x0002 + +// Hauteur des plateformes +#define HEIGHT_PLATFORM 6 +#define GCMF_OBSTACLE 0x0000 +#define GCMF_PLATFORM 0x0001 + +// Flags pour GetImageSize +#define GIS_WITHMASK 0x8000 +#define GIS_EXACT 0x4000 + + // AddImage flags +#define AI_WITHMASK 0x0010 // L'image originale a un masque (si son mode en a un) +#define AI_COMPARE 0x0020 // Comparer l'image aux autres +#define AI_ACE 0x0080 // En mode >= 256 couleurs, compacter le sprite +#define AI_FLAGS 0x00F0 // Masque flags + +#define AI_NOCOMP 0x0000 +#define AI_RLE 0x0100 // Compactage type RLE +#define AI_RLEW 0x0200 // Compactage type RLEW +#define AI_RLET 0x0400 // Compactage type RLET +#define AI_LZX 0x0800 // Compactage type LZX +#define AI_ALPHA 0x1000 // The image contains an alpha channel +#define AI_ACECOMP 0x4000 // Compactage sprite type ACE +#define AI_MAC 0x8000 // Flag temporaire utilise par la version MAC (sur?) +#define AI_COMPMASK (IF_RLE | IF_RLEW | IF_RLET) + + // imgFlags +#define IF_NOCOMP 0x00 +#define IF_RLE 0x01 // Compactage type RLE +#define IF_RLEW 0x02 // Compactage type RLEW +#define IF_RLET 0x04 // Compactage type RLET +#define IF_LZX 0x08 // Compactage type LZX +#define IF_ALPHA 0x10 // The image contains an alpha channel +#define IF_ACE 0x40 // Compactage sprite type ACE +#define IF_MAC 0x80 // Flag temporaire utilise par la version MAC (sur?) +#define IF_COMPMASK (IF_RLE | IF_RLEW | IF_RLET) + + // PasteSprite flags +#define PSF_HOTSPOT 0x0001 // Take hot spot into account +#define PSF_NOTRANSP 0x0002 // Non transparent image... ignored in PasteSpriteEffect + + // Ink effects +enum { + EFFECT_NONE=0, + EFFECT_SEMITRANSP, + EFFECT_INVERTED, + EFFECT_XOR, + EFFECT_AND, + EFFECT_OR, + MAX_EFFECT +}; + +#define EFFECTFLAG_TRANSPARENT 0x10000000L +#define EFFECTFLAG_ANTIALIAS 0x20000000L +#define EFFECT_MASK 0xFFFF + + // AddSound flags +#define AS_COMPARE 0x00010000 // Compare to others +#define AS_MASK 0xFFFF0000 + + // PlaySound flags +#define PS_NORMAL 0x0000 // Nothing special +#define PS_UNINTER 0x0001 // Cannot be stopped by other sound except by other UNINTER_PRIO +#define PS_UNINTER_PRIO 0x0002 // Cannot be stopped +#define PS_LOOP 0x0010 // Loop, sLParam = loop number, 0 = continuous +#define PS_GLOBALFOCUS 0x0020 // Sound not stopped if the application loses the focus +#define PS_DSOUND 0x0100 // To play with Direct Sound + + // AddFont flags +#define AF_COMPARE 0x100 // Compare to others + + // WinPasteText flags +#define WPTF_CALCRECT 0x8000 +#define WPTF_WITHPREFIX 0x4000 + + + +// ======================================================================= +// Memory banks +// ======================================================================= +// Public: +// ------- + +// Types +enum { + BK_IMGS, // Image bank + BK_SNGS, // Sound bank + BK_COLMASKS, // Collision mask bank + BK_COLMASKS_PLATFORM, // Platform collision mask bank + BK_IMGTEXTURES, // Image textures + BK_FONTS, // Font bank + BK_MAX +}; + +// ======================================================================= +// Images +// ======================================================================= + +typedef struct Img +{ + DWORD imgCheckSum; + DWORD imgCount; + DWORD imgSize; + short imgWidth; + short imgHeight; + BYTE imgFormat; + BYTE imgFlags; + WORD imgNotUsed; + short imgXSpot; + short imgYSpot; + short imgXAction; + short imgYAction; + COLORREF imgTrspColor; +} Img; +typedef Img* npImg; +typedef Img* fpImg; + + +// ======================================================================= +// Sounds +// ======================================================================= + +typedef struct Sound +{ + DWORD snCheckSum; // Checksum (du son sans l'entete) + DWORD snCount; // Ref count + DWORD snSize; // Taille of datas (including name) + DWORD snFlags; // Type (SP_MIDI, SP_WAVE) + flags + DWORD snReserved; + DWORD snNameSize; +} Sound; +typedef Sound* fpSound; + + // Sound flags +#define SP_WAVE 0x0001 // Flags +#define SP_MIDI 0x0002 +#define SNDF_TYPEMASK 0x000F +#define SNDF_LOADONCALL 0x0010 +#define SNDF_PLAYFROMDISK 0x0020 +#define SNDF_FILE 0x0040 +#define SNDF_UNICODEFILE 0x0080 +#define SNDF_LOADED 0x1000 + +// ======================================================================= +// Fonts +// ======================================================================= + +#ifndef _H2INC + +// Structure Font +typedef struct FontW +{ + DWORD fnCheckSum; // Checksum (des images) + DWORD fnCount; // Compteur d'utilisations + DWORD fnSize; // Taille sans l'entete + LOGFONTW fnLf; // Header font (pour CreateFont si Windows font) +} FontW; +typedef FontW *npFontW; +typedef FontW *fpFontW; + +typedef struct FontA +{ + DWORD fnCheckSum; // Checksum (des images) + DWORD fnCount; // Compteur d'utilisations + DWORD fnSize; // Taille sans l'entete + LOGFONTA fnLf; // Header font (pour CreateFont si Windows font) +} FontA; +typedef FontA *npFontA; +typedef FontA *fpFontA; + +#ifdef _UNICODE +#define Font FontW +#define fpFont fpFontW +#else +#define Font FontA +#define fpFont fpFontA +#endif + +#endif // _H2INC + + // Font avec LOGFONT 16 bits pour version 32 bits + +typedef struct tagLOGFONT16 { + short lfHeight; + short lfWidth; + short lfEscapement; + short lfOrientation; + short lfWeight; + BYTE lfItalic; + BYTE lfUnderline; + BYTE lfStrikeOut; + BYTE lfCharSet; + BYTE lfOutPrecision; + BYTE lfClipPrecision; + BYTE lfQuality; + BYTE lfPitchAndFamily; + BYTE lfFaceName[LF_FACESIZE]; +} LOGFONT16; + + // Structures + // ---------- + + // Zone, box, rectangle +#ifndef _dllpriv_h +typedef struct tagBox +{ + short x1,y1,x2,y2; +} Box; +typedef Box *npBox; +typedef Box *fpBox; +#endif + + // Structure infos ecran +typedef struct tagSMI { + UINT totalBitCount; // I.e. 16 + UINT usedBitCount; // I.e. 15 + UINT mainMode; // SM_4, SM_8, SM_etc... avec flags SM_DDRAW + UINT subMode; // sous-mode + DWORD rMask; + DWORD gMask; + DWORD bMask; + UINT flags; +} screenModeInfos; + + // Objet fenetre +#define WF_SIZE 0x0001 // Flag "resize in progress" +#define WF_STRETCH 0x0002 // Flag "stretch log to phys" +#define WF_NOPAINT 0x0008 // No paint +#define WF_DONOTMERGEZONES 0x0010 // Do not merge new zones +#define WF_IDLE 0x0020 // Idle mode (GetMessage) +#define WF_IDLE50 0x0040 // Idle mode (GetMessage + IT50) +#define WF_IDLEFLAGS (WF_IDLE | WF_IDLE50) // Idle mode flags +#define WF_UNICODE 0x0080 // Flag "view zones" en mode debug +#define WF_SCR 0x0100 // Flag "Screen saver window" +#define WF_MDIMAIN 0x0200 // MDI Frame +#define WF_MDICLIENT 0x0400 // MDI Client +#define WF_MDICHILD 0x0800 // MDI Child +#define WF_OWNDC 0x1000 +#define WF_OWNDCLOG 0x2000 +#define WF_FULLSCREENX2 0x4000 +#define WF_DONOTDESTROY 0x8000 + +#define WF2_NOUPDATE 0x0001 +#define WF2_DIBFULLSCREEN 0x0002 +#define WF2_MMF15 0x0004 +#define WF2_VSYNC 0x0008 +#define WF2_NOBACKSURF 0x0010 + + // Objet application +#define APPF_ENDAPP 0x0001 // Internal +#define APPF_GLOBALSOUNDS 0x0004 + + // Objet sprite +#define SF_RAMBO 0x00000001 // flag "rentre dans tout le monde" +#define SF_RECALCSURF 0x00000002 // Recalc surface (if rotation or stretch) +#define SF_PRIVATE 0x00000004 // flag privé utilisé par le runtime pour la destruction des fade +#define SF_INACTIF 0x00000008 // flag "inactif" = reaffichage ssi intersection avec un autre +#define SF_TOHIDE 0x00000010 // flag "a cacher" +#define SF_TOKILL 0x00000020 // flag "a detruire" +#define SF_REAF 0x00000040 // flag "a reafficher" +#define SF_HIDDEN 0x00000080 // flag "cache" +#define SF_COLBOX 0x00000100 // flag "collisions en mode box" +#define SF_NOSAVE 0x00000200 // flag "do not save background" +#define SF_FILLBACK 0x00000400 // flag "fill background using a solid colour (sprAdrBack)" +#define SF_DISABLED 0x00000800 +#define SF_REAFINT 0x00001000 // Internal +#define SF_OWNERDRAW 0x00002000 // flag "owner draw" +#define SF_OWNERSAVE 0x00004000 // flag "owner save" +#define SF_FADE 0x00008000 // Private + +#define SF_OBSTACLE 0x00010000 // Obstacle +#define SF_PLATFORM 0x00020000 // Platform +#define SF_BACKGROUND 0x00080000 // Backdrop object + +#define SF_SCALE_RESAMPLE 0x00100000 // Resample when stretching +#define SF_ROTATE_ANTIA 0x00200000 // Antialiasing for rotations +#define SF_NOHOTSPOT 0x00400000 // No hot spot +#define SF_OWNERCOLMASK 0x00800000 // Owner-draw sprite supports collision masks + +#define SF_UPDATECOLLIST 0x10000000 + +// SpriteCol_TestPoint / SpriteCol_TestSprite +#define SCF_OBSTACLE 0x01 +#define SCF_PLATFORM 0x02 +#define SCF_EVENNOCOL 0x04 // Flag: returns even sprites that haven't the SF_RAMBO flag +#define SCF_BACKGROUND 0x08 // Flag: if 0, returns active sprites, otherwise returns background sprites +#define SCF_TESTFEET 0x10 // Test only the bottom of the sprite + +#define LAYER_ALL (-1) + +// GetFirst/Last/Next/PrevSprite +#define GS_BACKGROUND 0x0001 +#define GS_SAMELAYER 0x0002 + +// ActiveSprite +#define AS_DEACTIVATE 0x0000 // Desactive un sprite actif +#define AS_REDRAW 0x0001 // Reaffiche un sprite inactif +#define AS_ACTIVATE 0x0002 // Active un sprite inactif +#define AS_ENABLE 0x0004 +#define AS_DISABLE 0x0008 +#define AS_REDRAW_NOBKD 0x0011 +#define AS_REDRAW_RECT 0x0020 + +#define SSF_HIDE 0x0000 // Cacher un sprite +#define SSF_SHOW 0x0001 // Montrer un sprite + +// Ownerdraw sprites, callback function +enum { + SPRITE_DRAW, + SPRITE_RESTORE, + SPRITE_SAVE, + SPRITE_KILL, + SPRITE_GETCOLMASK, +}; + + // Objet libre +#ifndef _dllpriv_h +typedef struct tagObj +{ + UINT objSize; // Taille de l'objet: 0 = fin objets + UINT objPrevSize; // Taille objet precedent (0 = 1er objet) + UINT objType; // Type d'objet (1=vide,2=appli,3=fenetre,...) + UINT objPrev; // Adresse objet precedent de meme type (0 = first) + UINT objNext; // Adresse objet suivant de meme type (0 = last) +} Obj; +typedef Obj *npObj; +typedef Obj *fpObj; +#endif + +#ifndef _H2INC +#ifdef IN_DLL +class Spr; +#endif +#endif + +#define SPRCOLLISLIST + +#ifdef __cplusplus +class Spr +{ +public: +#else +typedef struct Spr +{ +#endif +#ifndef SPRLIST + Obj sprObj; +#endif + DWORD sprFlags; // Flags + WORD sprLayer; // Sprite plane (layer) + short sprAngle; // Angle + int sprZOrder; // Z-order value + + // Coordinates + int sprX; + int sprY; + + // Bounding box + int sprX1; + int sprY1; + int sprX2; + int sprY2; + + // New coordinates + int sprXnew; + int sprYnew; + + // New bounding box + int sprX1new; + int sprY1new; + int sprX2new; + int sprY2new; + + // Background bounding box + int sprX1z; + int sprY1z; + int sprX2z; + int sprY2z; + + // Scale & Angle + float sprScaleX; + float sprScaleY; + + // Temporary values for collisions + WORD sprTempImg; // TODO: use DWORD later? + short sprTempAngle; + float sprTempScaleX; + float sprTempScaleY; + + // Image or owner-draw routine + union { + struct { + DWORD sprImg; // Numero d'image + DWORD sprImgNew; // Nouvelle image + }; + LPARAM sprRout; // Ownerdraw callback routine + }; + + // Ink effect + DWORD sprEffect; // 0=normal, 1=semi-transparent, > 16 = routine + LPARAM sprEffectParam; // parametre effet (coef transparence, etc...) + + // Fill color (wipe with color mode) + COLORREF sprBackColor; + + // Surfaces + cSurfaceImplementation* sprBackSurf; // Background surface, if no general background surface + + cSurfaceImplementation* sprSf; // Surface (if stretched or rotated) + sMask* sprColMask; // Collision mask (if stretched or rotated) + + cSurfaceImplementation* sprTempSf; // Temp surface (if stretched or rotated) + sMask* sprTempColMask; // Temp collision mask (if stretched or rotated) + + // User data + LPARAM sprExtraInfo; + + // Colliding sprites +#ifndef _H2INC +#ifdef IN_DLL + CPTypeArray sprCollisList; // liste de sprites entrant en collisions +#else + int sprCollisList[2]; +#endif +#endif + +#ifdef __cplusplus +}; +#else +} Spr; +#endif +typedef Spr *npSpr; +typedef Spr *fpSpr; + + // Structure "taille d'une appli" +typedef struct tagAppSize { + DWORD asInternal; // Place occupee dans le segment DLL + DWORD asLogics; // Taille ecrans logiques + DWORD asColMasks; // Taille buffers de collision avec le decor + DWORD asImages; // Banque des images + DWORD asMasks; // Banque des masques de collision des images + DWORD asSounds; // Banque des sons + DWORD asFonts; // Banque des fonts + DWORD asSprites; // Buffers de sauvegarde des fonds des sprites +} appSize; +typedef appSize *fpas; + +#ifdef _H2INC +#define CREATESTRUCTA CREATESTRUCT +#define CREATESTRUCTW CREATESTRUCT +#endif + +// Structure pour WinOpenEx +typedef struct tagCWA { + DWORD cwSize; + CREATESTRUCTA cwCreateStruct; + int cwCxMax; + int cwCyMax; + HCURSOR cwHCursor; + union { + DWORD cwBackColor; + HBRUSH cwHBackBrush; + }; + int cwClsWin; + int cwWinFlags; +} CREATEWINA; + +typedef struct CREATEWINEXA { + DWORD cwSize; + CREATESTRUCTA cwCreateStruct; + int cwCxMax; + int cwCyMax; + HCURSOR cwHCursor; + union { + DWORD cwBackColor; + HBRUSH cwHBackBrush; + }; + int cwClsWin; + int cwWinFlags; + HWND cwHWnd; + LPARAM cwNotUsed; +} CREATEWINEXA; + +typedef struct tagCWW { + DWORD cwSize; + CREATESTRUCTW cwCreateStruct; + int cwCxMax; + int cwCyMax; + HCURSOR cwHCursor; + union { + DWORD cwBackColor; + HBRUSH cwHBackBrush; + }; + int cwClsWin; + int cwWinFlags; +} CREATEWINW; + +typedef struct CREATEWINEXW { + DWORD cwSize; + CREATESTRUCTW cwCreateStruct; + int cwCxMax; + int cwCyMax; + HCURSOR cwHCursor; + union { + DWORD cwBackColor; + HBRUSH cwHBackBrush; + }; + int cwClsWin; + int cwWinFlags; + HWND cwHWnd; + LPARAM cwNotUsed; +} CREATEWINEXW; + +#ifdef _UNICODE +#define CREATEWIN CREATEWINW +#define CREATEWINEX CREATEWINEXW +#else +#define CREATEWIN CREATEWINA +#define CREATEWINEX CREATEWINEXA +#endif + +// Structure for SaveRect +typedef struct saveRect { + LPBYTE pData; + RECT rc; +} saveRect; +typedef saveRect* fpSaveRect; + + +//------------------------------ +// Prototypes des fonctions KNPS +//------------------------------ + +#define DialOpen(hi,id,hp,pr,a,b,c,lp) DialogBoxParam(hi,id,hp,pr,lp) + +DLLExport32 DWORD WINAPI GetDLLVersion(); + + // Application + // ----------- +DLLExport32 npAppli WINAPI InitAppli (HINSTANCE, HPALETTE); +DLLExport32 DWORD WINAPI SetModeAppli (npAppli, int); +DLLExport32 int WINAPI LockBank (npAppli, int); +DLLExport32 int WINAPI UnlockBank (npAppli, int); +DLLExport32 int WINAPI PurgeBank (npAppli, int); +DLLExport32 void WINAPI KillBank (npAppli, int); +DLLExport32 int WINAPI Bank_GetEltCount (npAppli ptApp, UINT bkNum); +DLLExport32 LPVOID WINAPI Bank_GetEltAddr (npAppli ptApp, UINT bkNum, UINT eNum); + +DLLExport32 void WINAPI EndAppli (npAppli); + + // Windows, dialogues + // ------------------ +DLLExport32 npWin WINAPI WinOpenExA (npAppli, CREATEWINA *); +DLLExport32 npWin WINAPI WinOpenExW (npAppli, CREATEWINW *); +DLLExport32 npWin WINAPI SCRWinOpenA (npAppli, HWND); +DLLExport32 npWin WINAPI SCRWinOpenW (npAppli, HWND); +DLLExport32 void WINAPI WCDClose (npWin); +DLLExport32 HWND WINAPI WinGetHandle (npWin); +DLLExport32 HWND WINAPI WinGetMCHandle (npWin); +DLLExport32 HDC WINAPI WinGetHDC (npWin); +DLLExport32 HDC WINAPI WinGetHDCLog (npWin); +DLLExport32 void WINAPI WinReleaseHDC (npWin, HDC); +DLLExport32 void WINAPI WinReleaseHDCLog (npWin, HDC); +DLLExport32 void WINAPI WinGetLogRect (npWin, RECT *); +DLLExport32 npWin WINAPI WinSearch (HWND); + +DLLExport32 LRESULT CALLBACK DefMsgProcA (HWND hWin, UINT uMsg, WPARAM wParam, LPARAM lParam); +DLLExport32 LRESULT CALLBACK DefMsgProcW (HWND hWin, UINT uMsg, WPARAM wParam, LPARAM lParam); + +#ifdef _UNICODE +#define WinOpenEx WinOpenExW +#define SCRWinOpen SCRWinOpenW +#define DefMsgProc DefMsgProcW +#else +#define WinOpenEx WinOpenExA +#define SCRWinOpen SCRWinOpenA +#define DefMsgProc DefMsgProcA +#endif + + // Menus + // ----- +DLLExport32 HMENU WINAPI WinSetMenu (npWin, HMENU, HACCEL); +//DLLExport32 void WINAPI WinSetAccel (npWin, HACCEL); + + // Souris + // ------ +DLLExport32 HCURSOR WINAPI WinSetMouse (npWin, HCURSOR); +DLLExport32 void WINAPI WinStartWait (npWin); +DLLExport32 void WINAPI WinEndWait (npWin); + + // Events + // ------ +//DLLExport32 WORD WINAPI GetMsg (npWin, fpKm); +//DLLExport32 DWORD WINAPI GetIt50 (void); +//DLLExport32 DWORD WINAPI RazCptVbl (void); +//DLLExport32 DWORD WINAPI GetCptVbl (void); +//DLLExport32 void WINAPI EnableIt50 (npWin, int); + + // Graphics + // -------- +DLLExport32 void WINAPI WinClip (npWin, int, int, int, int); +DLLExport32 void WINAPI WinFillRect (npWin, int, int, int, int, DWORD); +DLLExport32 void WINAPI WinFillBr (npWin, int, int, int, int, HBRUSH); +DLLExport32 void WINAPI WinBox (npWin, fpBox); +DLLExport32 void WINAPI WinRect (npWin, RECT *); +DLLExport32 void WINAPI WinLine (npWin, POINT *, UINT); +DLLExport32 void WINAPI WinGrabDesktop (npWin); + +#ifndef IN_KPX +DLLExport32 int WINAPI StartFullScreen (npWin, int, int, int); +DLLExport32 int WINAPI EndFullScreen (); +#endif // IN_KPX + +DLLExport32 void WINAPI WinPaper (npWin, COLORREF); +DLLExport32 void WINAPI WinPen (npWin, COLORREF, int, int); +DLLExport32 void WINAPI WinGraphMode (npWin, int); + +#define WSP_NBSPRITES 1 +#define WSP_SETAPPFLAGS 2 +#define WSP_GETAPPFLAGS 4 +#define WSP_GETWINFLAGS2 9 +#define WSP_SETWINFLAGS2 10 +DLLExport32 BOOL WINAPI WinSetParam (npWin, int, UINT, DWORD); + + // Dibs + // ---- +DLLExport32 DWORD WINAPI InitDibHeader (npAppli, int, int, int, BITMAPINFO *); +DLLExport32 void WINAPI FillDib (BITMAPINFO *, COLORREF); +DLLExport32 DWORD WINAPI ImageToDib (npAppli, DWORD, DWORD, LPBYTE); +DLLExport32 DWORD WINAPI DibToImage (npAppli, fpImg, BITMAPINFOHEADER *); +DLLExport32 DWORD WINAPI DibToImageEx (npAppli, fpImg, BITMAPINFOHEADER *, COLORREF, DWORD); +DLLExport32 void WINAPI RemapDib (BITMAPINFO *, npAppli, LPBYTE); + + // Palette + // ------- +DLLExport32 HPALETTE WINAPI SetDefaultPalette256 (PALETTEENTRY *); +DLLExport32 void WINAPI SetPaletteAppli (npAppli, HPALETTE); +DLLExport32 int WINAPI GetPaletteAppli (LOGPALETTE *, int, npAppli); +DLLExport32 int WINAPI GetNearestIndex (npAppli, int, COLORREF); +DLLExport32 COLORREF WINAPI GetRGB (npAppli, int, int); +DLLExport32 int WINAPI GetOpaqueBlack (npAppli); + + // Font + // ---- +#ifndef _H2INC +DLLExport32 DWORD WINAPI AddFontA (npAppli, DWORD, fpFontA, LPDWORD, DWORD); +DLLExport32 DWORD WINAPI IncFontCount (npAppli, DWORD); +DLLExport32 long WINAPI DelFont (npAppli, DWORD); +DLLExport32 int WINAPI GetFontInfosA (npAppli, DWORD, fpFontA, LPDWORD); +DLLExport32 HFONT WINAPI WinCreateFont (npAppli, DWORD); +DLLExport32 int WINAPI WinPasteTextA (npWin, HFONT, RECT*, LPSTR, COLORREF, DWORD); + +DLLExport32 DWORD WINAPI AddFontW (npAppli ptApp, DWORD fType, fpFontW fntHdr, LPDWORD lpw, DWORD nbw); +DLLExport32 int WINAPI GetFontInfosW (npAppli ptApp, DWORD nFont, fpFontW fntHdr, LPDWORD lpw); +DLLExport32 int WINAPI WinPasteTextW (npWin, HFONT, RECT*, LPWSTR, COLORREF, DWORD); + + // Fonts - fonctions 32 bits utilisant des structures 16 bits +DLLExport32 void WINAPI LogFont16To32A ( LOGFONTA * lf32, LOGFONT16 * lf16 ); +DLLExport32 void WINAPI LogFont32To16A ( LOGFONT16 * lf16, LOGFONTA * lf32 ); +DLLExport32 HFONT WINAPI CreateFontIndirect16 ( LOGFONT16 * lFont ); + +DLLExport32 void WINAPI LogFont16To32W ( LOGFONTW * lf32, LOGFONT16 * lf16 ); +DLLExport32 void WINAPI LogFont32To16W ( LOGFONT16 * lf16, LOGFONTW * lf32 ); + +#ifdef _UNICODE +#define AddFont AddFontW +#define GetFontInfos GetFontInfosW +#define WinPasteText WinPasteTextW +#define LogFont16To32 LogFont16To32W +#define LogFont32To16 LogFont32To16W +#else +#define AddFont AddFontA +#define GetFontInfos GetFontInfosA +#define WinPasteText WinPasteTextA +#define LogFont16To32 LogFont16To32A +#define LogFont32To16 LogFont32To16A +#endif + +#endif // _H2INC + + + + // Images + // ------ +DLLExport32 void WINAPI PasteSprite (npWin, DWORD, int, int, DWORD); +DLLExport32 void WINAPI PasteSpriteEffect (npWin, DWORD, int, int, DWORD, DWORD, LPARAM); +DLLExport32 DWORD WINAPI AddImage (npAppli, WORD, WORD, short, short, short, short, COLORREF, DWORD, LPVOID, LPBYTE); +DLLExport32 DWORD WINAPI IncImageCount (npAppli, DWORD); +DLLExport32 int WINAPI IsImageEmpty (npAppli, DWORD); +DLLExport32 DWORD WINAPI GetImageBits (npAppli, DWORD, DWORD, LPBYTE); +DLLExport32 void WINAPI StretchImage (npAppli, DWORD, WORD, WORD, LPBYTE); +DLLExport32 long WINAPI DelImage (npAppli, DWORD); +DLLExport32 sMask* WINAPI AddMask (npAppli ptApp, DWORD iNum, UINT nFlags); +DLLExport32 long WINAPI DelMask (npAppli, DWORD); +DLLExport32 int WINAPI GetImageInfos (npAppli, DWORD, fpImg); +DLLExport32 int WINAPI GetImageInfoEx (npAppli pApp, DWORD nImage, int nAngle, float fScaleX, float fScaleY, fpImg pIfo); +DLLExport32 DWORD WINAPI GetImageSize (WORD, WORD, WORD); +DLLExport32 sMask* WINAPI GetImageMask (npAppli ptApp, DWORD dwImage, UINT nFlags); +DLLExport32 sMask* WINAPI CompleteSpriteColMask (npWin ptrWin, npSpr ptSpr, DWORD dwPSCFlags, UINT nWidth, UINT nHeight); +DLLExport32 DWORD WINAPI PrepareSpriteColMask (npWin ptrWin, npSpr ptSpr, DWORD newImg, int newX, int newY, int newAngle, float newScaleX, float newScaleY, RECT* prc, sMask** ppMask); + + // Sprites + // ------- +DLLExport32 npSpr WINAPI AddSprite (npWin ptrWin, int xSpr, int ySpr, DWORD iSpr, WORD wLayer, int nZOrder, DWORD backSpr, DWORD sFlags, LPARAM extraInfo); +DLLExport32 npSpr WINAPI AddOwnerDrawSprite (npWin ptrWin, int x1, int y1, int x2, int y2, WORD wLayer, int nZOrder, DWORD backSpr, DWORD sFlags, LPARAM extraInfo, LPARAM sprProc); +DLLExport32 npSpr WINAPI ModifSprite (npWin ptrWin, npSpr ptSpr, int xSpr, int ySpr, DWORD iSpr); +DLLExport32 npSpr WINAPI ModifSpriteEx (npWin ptrWin, npSpr ptSpr, int xSpr, int ySpr, DWORD iSpr, float fScaleX, float fScaleY, BOOL bResample, int nAngle, BOOL bAntiA); +DLLExport32 npSpr WINAPI ModifSpriteEffect (npWin ptrWin, npSpr ptSpr, DWORD effect, LPARAM effectParam); +DLLExport32 npSpr WINAPI ModifOwnerDrawSprite (npWin ptrWin, npSpr ptSprModif, int x1, int y1, int x2, int y2); +DLLExport32 void WINAPI ShowSprite (npWin, npSpr, int); +DLLExport32 void WINAPI ActiveSprite (npWin, npSpr, int); +DLLExport32 void WINAPI DelSprites (npWin); +DLLExport32 void WINAPI DelSprite (npWin, npSpr); +DLLExport32 void WINAPI DelSpriteFast (npWin, npSpr); +DLLExport32 LPARAM WINAPI GetSpriteExtra (npWin, npSpr); +DLLExport32 DWORD WINAPI GetSpriteFlags (npWin, npSpr); +DLLExport32 DWORD WINAPI SetSpriteFlags (npWin ptrWin, npSpr ptSpr, DWORD dwNewFlags); +DLLExport32 void WINAPI SpriteClear (npWin); +DLLExport32 void WINAPI SpriteDraw (npWin); +DLLExport32 void WINAPI SpriteUpdate (npWin); +DLLExport32 void WINAPI ScreenUpdate (npWin); + +DLLExport32 void WINAPI GetSpriteScale (npWin ptrWin, npSpr ptSpr, float* pScaleX, float* pScaleY, BOOL* pResample); +DLLExport32 void WINAPI SetSpriteScale (npWin ptrWin, npSpr ptSpr, float fScaleX, float fScaleY, BOOL bResample); +DLLExport32 int WINAPI GetSpriteAngle (npWin ptrWin, npSpr ptSpr, BOOL* pAntiA); +DLLExport32 void WINAPI SetSpriteAngle (npWin ptrWin, npSpr ptSpr, int nAngle, BOOL bAntiA); +DLLExport32 void WINAPI GetSpriteRect (npWin ptrWin, npSpr ptSpr, RECT* prc); +DLLExport32 void WINAPI MoveSpriteToFront(npWin ptrWin, npSpr pSpr); +DLLExport32 void WINAPI MoveSpriteToBack (npWin ptrWin, npSpr pSpr); +DLLExport32 void WINAPI MoveSpriteBefore (npWin ptrWin, npSpr pSprToMove, npSpr pSprDest); +DLLExport32 void WINAPI MoveSpriteAfter (npWin ptrWin, npSpr pSprToMove, npSpr pSprDest); +DLLExport32 BOOL WINAPI IsSpriteBefore (npWin ptrWin, npSpr pSpr, npSpr pSprDest); +DLLExport32 BOOL WINAPI IsSpriteAfter (npWin ptrWin, npSpr pSpr, npSpr pSprDest); +DLLExport32 void WINAPI SwapSprites (npWin ptrWin, npSpr sp1, npSpr sp2); +DLLExport32 int WINAPI GetSpriteLayer (npWin ptrWin, npSpr ptSpr); +DLLExport32 void WINAPI SetSpriteLayer (npWin ptrWin, npSpr ptSpr, int nLayer); +DLLExport32 sMask* WINAPI GetSpriteMask (npWin ptrWin, npSpr pSpr, UINT newImg, UINT nFlags); + +DLLExport32 npSpr WINAPI GetFirstSprite (npWin ptrWin, int nLayer, DWORD dwFlags); +DLLExport32 npSpr WINAPI GetNextSprite (npWin ptrWin, npSpr pSpr, DWORD dwFlags); +DLLExport32 npSpr WINAPI GetPrevSprite (npWin ptrWin, npSpr pSpr, DWORD dwFlags); +DLLExport32 npSpr WINAPI GetLastSprite (npWin ptrWin, int nLayer, DWORD dwFlags); + + // Sauvegarde / Restitution de zones + // --------------------------------- +DLLExport32 void WINAPI WinResetZones (npWin); +DLLExport32 void WINAPI WinAddZone (npWin, RECT *); +DLLExport32 void WINAPI WinAddCoord (npWin, int, int, int, int); +DLLExport32 int WINAPI SaveRect (npWin, fpSaveRect, int, int, int, int); +DLLExport32 void WINAPI RestoreRect (npWin, fpSaveRect); +DLLExport32 void WINAPI KillRect (fpSaveRect); +DLLExport32 UINT* WINAPI WinGetZones (npWin); +DLLExport32 void WINAPI WinEnableUpdate (npWin, int); + + // Collisions + // ---------- +DLLExport32 DWORD WINAPI SetSpriteColFlag (npWin, npSpr, DWORD); // UINT = SF_xxxx +DLLExport32 npSpr WINAPI SpriteCol_TestPoint (npWin, npSpr, int, int, int, DWORD); // Entre 1 pixel et les sprites sauf un +DLLExport32 npSpr WINAPI SpriteCol_TestRect (npWin, npSpr, int, int, int, int, int, DWORD); // Entre 1 rectangle et les sprites sauf un +DLLExport32 npSpr WINAPI SpriteCol_TestSprite (npWin ptrWin, npSpr ptSpr, DWORD newImg, int newX, int newY, int newAngle, float newScaleX, float newScaleY, int subHt, DWORD dwFlags); +DLLExport32 UINT WINAPI SpriteCol_TestSprite_All (npWin, npSpr, LPVOID*, DWORD, int, int, int, float, float, DWORD); +DLLExport32 int WINAPI WinSetColMode (npWin, WORD); // Mode BOX ou BITMAP + +DLLExport32 BOOL WINAPI ColMask_Create (npWin, UINT, UINT, DWORD); // Creation bitmap masque fond +DLLExport32 BOOL WINAPI ColMask_CreateEx (npWin, int, int, int, int, DWORD); +DLLExport32 void WINAPI ColMask_Kill (npWin); // Destruction masque fond +DLLExport32 void WINAPI ColMask_Fill (npWin, DWORD); // Init masque fond +DLLExport32 int WINAPI ColMask_FillRectangle (npWin, int, int, int, int, DWORD); +DLLExport32 void WINAPI ColMask_OrImage (npWin, DWORD, int, int, DWORD); +DLLExport32 void WINAPI ColMask_OrMask (npWin, sMask*, int, int, DWORD, DWORD); +DLLExport32 void WINAPI ColMask_OrPlatform (npWin, DWORD, int, int); +DLLExport32 void WINAPI ColMask_OrPlatformMask (npWin, sMask*, int, int); +DLLExport32 int WINAPI ColMask_Scroll (npWin, int, int, RECT *, RECT *); +DLLExport32 void WINAPI ColMask_SetOrigin (npWin, int, int); +DLLExport32 void WINAPI ColMask_ToLog (npWin ptrWin, UINT nPlane); +DLLExport32 void WINAPI ColMask_SetClip (npWin, RECT *); + +DLLExport32 BOOL WINAPI ColMask_TestPoint (npWin ptrWin, int x, int y, UINT nPlane); +DLLExport32 BOOL WINAPI ColMask_TestSprite (npWin ptrWin, npSpr pSpr, int newImg, int newX, int newY, int newAngle, float newScaleX, float newScaleY, int subHt, UINT nPlane); +DLLExport32 int WINAPI ColMask_TestRect (npWin, int, int, int, int, UINT nPlane); + +DLLExport32 BOOL WINAPI Mask_TestPoint (LPBYTE pMask, int x, int y, int nMaskWidth, int nMaskHeight); +DLLExport32 BOOL WINAPI Mask_TestMask (LPBYTE pMaskBits1, LPBYTE pMaskBits2, int x1Spr1, int y1Spr1, int wSpr1, int hSpr1, int x1Spr2, int y1Spr2, int wSpr2, int hSpr2); +DLLExport32 BOOL WINAPI Mask_TestRect (LPBYTE pMask, int nMaskWidth, int nMaskHeight, int x, int y, int nWidth, int nHeight); + + // Hooks + // ----- +DLLExport32 HHOOK WINAPI StartFilterHook (HWND); +DLLExport32 int WINAPI StopFilterHook (HHOOK); + + // Divers + // ------ +#define WavePerio() + + // New + // --- +DLLExport32 void WINAPI WinSetFlags (npWin, WORD); +DLLExport32 WORD WINAPI WinGetFlags (npWin); +DLLExport32 int WINAPI WinScroll (npWin, int, int, int, int, int, int); + +DLLExport32 int WINAPI EnumScreenModes (screenModeInfos *ptsfo, int maxModes, UINT flags); + + // V2 + // -- + +#define HCSPALETTE UINT + +DLLExport32 HCSPALETTE WINAPI AddPalette (LOGPALETTE* pLogPal); +DLLExport32 void WINAPI DelPalette (HCSPALETTE pCsPal); +DLLExport32 void WINAPI SetAppCSPalette (npAppli ptrApp, HPALETTE hpal, HCSPALETTE pCsPal); +DLLExport32 HCSPALETTE WINAPI GetAppCSPalette (npAppli ptrApp); + +// Sounds + +#ifdef __cplusplus +class CSoundManager; +DLLExport32 int WINAPI PlaySndA (CSoundManager* pSndMgr, npAppli ptApp, UINT sNum, HWND hWin, DWORD sFlags, DWORD sLParam, UINT nChannel); +DLLExport32 int WINAPI PlaySndW (CSoundManager* pSndMgr, npAppli ptApp, UINT sNum, HWND hWin, DWORD sFlags, DWORD sLParam, UINT nChannel); +#endif // __cplusplus + +DLLExport32 void WINAPI PauseSnd (npAppli ptApp, UINT sType, UINT sNum); +DLLExport32 void WINAPI PauseSndChannel (npAppli ptApp, UINT nChannel); +DLLExport32 void WINAPI ResumeSnd (npAppli ptApp, UINT sType, UINT sNum); +DLLExport32 void WINAPI ResumeSndChannel (npAppli ptApp, UINT nChannel); +DLLExport32 void WINAPI StopSnd (npAppli ptApp, UINT sType, UINT sNum); +DLLExport32 void WINAPI StopSndChannel (npAppli ptApp, UINT nChannel); +DLLExport32 int WINAPI IsSndPlaying (npAppli ptApp, UINT nSound); +DLLExport32 int WINAPI IsSndChannelPlaying (npAppli ptApp, UINT nChannel); +DLLExport32 int WINAPI IsSndPaused (npAppli ptApp, UINT nSound); +DLLExport32 int WINAPI IsSndChannelPaused (npAppli ptApp, UINT nChannel); +DLLExport32 void WINAPI SetSndMainVolume (npAppli ptApp, UINT sType, int nVolume); +DLLExport32 void WINAPI SetSndMainPan (npAppli ptApp, UINT sType, int nPan); +DLLExport32 int WINAPI GetSndMainVolume (npAppli ptApp, UINT sType); +DLLExport32 int WINAPI GetSndMainPan (npAppli ptApp, UINT sType); +DLLExport32 void WINAPI SetSndChannelVolume (npAppli ptApp, UINT nChannel, int nVolume); +DLLExport32 void WINAPI SetSndChannelPan (npAppli ptApp, UINT nChannel, int nPan); +DLLExport32 void WINAPI SetSndVolume (npAppli ptApp, UINT sType, UINT sNum, int nVolume); +DLLExport32 void WINAPI SetSndPan (npAppli ptApp, UINT sType, UINT sNum, int nPan); +DLLExport32 int WINAPI GetSndChannelVolume (npAppli ptApp, UINT nChannel); +DLLExport32 int WINAPI GetSndChannelPan (npAppli ptApp, UINT nChannel); +DLLExport32 int WINAPI GetSndVolume (npAppli ptApp, UINT sType, UINT sNum); +DLLExport32 int WINAPI GetSndPan (npAppli ptApp, UINT sType, UINT sNum); +DLLExport32 DWORD WINAPI GetSndChannelDuration (npAppli ptApp, UINT nChannel); +DLLExport32 DWORD WINAPI GetSndChannelPosition (npAppli ptApp, UINT nChannel); +DLLExport32 void WINAPI SetSndChannelPosition (npAppli ptApp, UINT nChannel, DWORD dwPosition); +DLLExport32 DWORD WINAPI GetSndDuration (npAppli ptApp, UINT sType, UINT sNum); +DLLExport32 DWORD WINAPI GetSndPosition (npAppli ptApp, UINT sType, UINT sNum); +DLLExport32 void WINAPI SetSndPosition (npAppli ptApp, UINT sType, UINT sNum, DWORD dwPosition); +DLLExport32 UINT WINAPI FindSndFromNameA(npAppli ptApp, UINT sType, LPCSTR pName); +DLLExport32 UINT WINAPI FindSndFromNameW(npAppli ptApp, UINT sType, LPCWSTR pName); +DLLExport32 int WINAPI GetSndChannel(npAppli ptApp, UINT sNum); + +DLLExport32 void WINAPI LockSndChannel (npAppli ptApp, UINT nChannel, BOOL bLock); +DLLExport32 void WINAPI SetSndChannelFreq (npAppli ptApp, UINT nChannel, DWORD dwFreq); +DLLExport32 void WINAPI SetSndFreq (npAppli ptApp, UINT sType, UINT sNum, DWORD dwFreq); +DLLExport32 DWORD WINAPI GetSndChannelFreq (npAppli ptApp, UINT nChannel); +DLLExport32 DWORD WINAPI GetSndFreq (npAppli ptApp, UINT sType, UINT sNum); + +DLLExport32 UINT WINAPI AddSoundA (npAppli, UINT, LPSTR, LPBYTE, DWORD); +DLLExport32 UINT WINAPI ReplaceSoundA (npAppli ptApp, UINT sFlags, UINT nSound, LPSTR fpName, LPBYTE lpData, DWORD dwDataSize); +DLLExport32 BOOL WINAPI SetSoundFlags (npAppli ptApp, UINT nSound, UINT sFlags); +DLLExport32 DWORD WINAPI IncSoundCount (npAppli, UINT); +DLLExport32 int WINAPI GetSoundInfoA (npAppli, UINT, fpSound); +DLLExport32 int WINAPI GetSoundNameA (npAppli, UINT, LPSTR, UINT); +DLLExport32 long WINAPI GetSoundData (npAppli, UINT, LPBYTE); +DLLExport32 LPBYTE WINAPI GetSoundDataPtr (npAppli, UINT); +DLLExport32 long WINAPI DelSound (npAppli, UINT); + +DLLExport32 UINT WINAPI AddSoundW (npAppli, UINT, LPWSTR, LPBYTE, DWORD); +DLLExport32 UINT WINAPI ReplaceSoundW (npAppli ptApp, UINT sFlags, UINT nSound, LPWSTR fpName, LPBYTE lpData, DWORD dwDataSize); +DLLExport32 int WINAPI GetSoundNameW (npAppli, UINT, LPWSTR, UINT); +DLLExport32 int WINAPI GetSoundInfoW (npAppli, UINT, fpSound); + +#ifdef _UNICODE +#define AddSound AddSoundW +#define ReplaceSound ReplaceSoundW +#define GetSoundName GetSoundNameW +#define GetSoundInfo GetSoundInfoW +#define FindSndFromName FindSndFromNameW +#define PlaySnd PlaySndW +#else +#define AddSound AddSoundA +#define ReplaceSound ReplaceSoundA +#define GetSoundName GetSoundNameA +#define GetSoundInfo GetSoundInfoA +#define FindSndFromName FindSndFromNameA +#define PlaySnd PlaySndA +#endif + +DLLExport32 int WINAPI WaveSetChannels (npAppli ptApp, int nChannels); + +#ifdef __cplusplus +} +#endif + +#ifndef _H2INC +enum { + LOCKIMAGE_READBLITONLY, + LOCKIMAGE_ALLREADACCESS, + LOCKIMAGE_HWACOMPATIBLE +}; + +#ifdef __cplusplus +DLLExport32 BOOL WINAPI WinAttachSurface (int idWin, cSurface * cs); +DLLExport32 void WINAPI WinDetachSurface (int idWin); + +DLLExport32 BOOL WINAPI LockImageSurface (LPVOID, DWORD hImage, cSurface &cs, int flags=LOCKIMAGE_READBLITONLY); +DLLExport32 void WINAPI UnlockImageSurface (cSurface &cs); + +// Get window surface (logical screen) +enum { + WSURF_LOGSCREEN, + WSURF_BACKSAVE +}; +DLLExport32 cSurface * WINAPI WinGetSurface (int idWin, int surfID=WSURF_LOGSCREEN); +#endif // __cplusplus +#endif // !defined(_H2INC) + +#ifndef _H2INC +#ifdef WIN32 +#pragma pack(pop) +#else +#pragma pack() +#endif +#endif + +#endif // _cnpdll_h diff --git a/Inc/Edif.h b/Inc/Edif.h index a150dcb..ce80f5a 100644 --- a/Inc/Edif.h +++ b/Inc/Edif.h @@ -28,86 +28,83 @@ class Extension; #endif #define LinkAction(ID, Function) \ - SDK->ActionFunctions[ID] = Edif::MemberFunctionPointer(&Extension::Function); + SDK->ActionFunctions[ID] = Edif::MemberFunctionPointer(&Extension::Function); #define LinkCondition(ID, Function) \ - SDK->ConditionFunctions[ID] = Edif::MemberFunctionPointer(&Extension::Function); + SDK->ConditionFunctions[ID] = Edif::MemberFunctionPointer(&Extension::Function); #define LinkExpression(ID, Function) \ - SDK->ExpressionFunctions[ID] = Edif::MemberFunctionPointer(&Extension::Function); + SDK->ExpressionFunctions[ID] = Edif::MemberFunctionPointer(&Extension::Function); extern HINSTANCE hInstLib; -struct RUNDATA; -struct EDITDATA; - -typedef RUNDATA * LPRDATA; -typedef EDITDATA * LPEDATA; +struct RD; typedef RD RUNDATA; typedef RUNDATA * LPRDATA; +struct SerializedED; typedef SerializedED EDITDATA; typedef EDITDATA * LPEDATA; LPEVENTINFOS2 GetEventInformations(LPEVENTINFOS2 eiPtr, short code); namespace Edif { - class SDK - { - public: + class SDK + { + public: - json_value &json; + json_value &json; - SDK (mv * mV, json_value &); - ~SDK (); + SDK (mv * mV, json_value &); + ~SDK (); - vector ActionInfos; - vector ConditionInfos; - vector ExpressionInfos; + vector ActionInfos; + vector ConditionInfos; + vector ExpressionInfos; - void ** ActionJumps; - void ** ConditionJumps; - void ** ExpressionJumps; + void ** ActionJumps; + void ** ConditionJumps; + void ** ExpressionJumps; - vector ActionFunctions; - vector ConditionFunctions; - vector ExpressionFunctions; + vector ActionFunctions; + vector ConditionFunctions; + vector ExpressionFunctions; - vector ExpressionTypes; + vector ExpressionTypes; - vector ActionFloatFlags; - vector ConditionFloatFlags; - vector ExpressionFloatFlags; + vector ActionFloatFlags; + vector ConditionFloatFlags; + vector ExpressionFloatFlags; - unsigned char * FunctionMemory; + unsigned char * FunctionMemory; mv* mV; - cSurface * Icon; - }; - - class Runtime - { - protected: + cSurface * Icon; + }; + + class Runtime + { + protected: - LPRDATA rdPtr; + LPRDATA rdPtr; - public: + public: - long param1, param2; + long param1, param2; - Runtime(LPRDATA _rdPtr); - ~Runtime(); + Runtime(LPRDATA _rdPtr); + ~Runtime(); - void Rehandle(); + void Rehandle(); - void GenerateEvent(int EventID); - void PushEvent(int EventID); + void GenerateEvent(int EventID); + void PushEvent(int EventID); - void * Allocate(size_t); - TCHAR * CopyString(const TCHAR *); + void * Allocate(size_t); + TCHAR * CopyString(const TCHAR *); - void Pause(); - void Resume(); + void Pause(); + void Resume(); - void Redisplay(); - void Redraw(); + void Redisplay(); + void Redraw(); LPRO LPROFromFixed(int fixedValue); int FixedFromLPRO(LPRO object); @@ -115,48 +112,48 @@ namespace Edif void SetPosition(int X, int Y); CallTables* GetCallTables(); - void CallMovement(int ID, long Parameter); + void CallMovement(int ID, long Parameter); - void Destroy(); + void Destroy(); - void GetApplicationDrive(TCHAR * Buffer); - void GetApplicationDirectory(TCHAR * Buffer); - void GetApplicationPath(TCHAR * Buffer); - void GetApplicationName(TCHAR * Buffer); - void GetApplicationTempPath(TCHAR * Buffer); + void GetApplicationDrive(TCHAR * Buffer); + void GetApplicationDirectory(TCHAR * Buffer); + void GetApplicationPath(TCHAR * Buffer); + void GetApplicationName(TCHAR * Buffer); + void GetApplicationTempPath(TCHAR * Buffer); - void ExecuteProgram(prgParam * Program); + void ExecuteProgram(prgParam * Program); - long EditInteger(EditDebugInfo *); - long EditText(EditDebugInfo *); + long EditInteger(EditDebugInfo *); + long EditText(EditDebugInfo *); - bool IsHWA(); - bool IsUnicode(); + bool IsHWA(); + bool IsUnicode(); - event &CurrentEvent(); + event &CurrentEvent(); - Riggs::ObjectSelection ObjectSelection; + Riggs::ObjectSelection ObjectSelection; - void WriteGlobal(const TCHAR * Name, void * Value); - void * ReadGlobal(const TCHAR * Name); + void WriteGlobal(const TCHAR * Name, void * Value); + void * ReadGlobal(const TCHAR * Name); - #ifdef EdifUseJS - - JSContext * GetJSContext(); + #ifdef EdifUseJS + + JSContext * GetJSContext(); - #endif - - }; + #endif + + }; - extern bool ExternalJSON; + extern bool ExternalJSON; - void GetSiblingPath (TCHAR * Buffer, const TCHAR * Extension); - - const int DependencyNotFound = 0; - const int DependencyWasFile = 1; - const int DependencyWasResource = 2; + void GetSiblingPath (TCHAR * Buffer, const TCHAR * Extension); + + const int DependencyNotFound = 0; + const int DependencyWasFile = 1; + const int DependencyWasResource = 2; - int GetDependency (char *& Buffer, size_t &Size, const TCHAR * FileExtension, int Resource); + int GetDependency (char *& Buffer, size_t &Size, const TCHAR * FileExtension, int Resource); TCHAR* ConvertString(const char* urf8String); TCHAR* ConvertAndCopyString(TCHAR* tstr, const char* urf8String, int maxLength); @@ -165,43 +162,43 @@ namespace Edif free(s); } - extern TCHAR LanguageCode[3]; - extern bool IsEdittime; + extern TCHAR LanguageCode[3]; + extern bool IsEdittime; - extern HMENU ActionMenu, ConditionMenu, ExpressionMenu; + extern HMENU ActionMenu, ConditionMenu, ExpressionMenu; - HMENU LoadMenuJSON (int BaseID, const json_value &Source, HMENU Parent = 0); + HMENU LoadMenuJSON (int BaseID, const json_value &Source, HMENU Parent = 0); - int Init(mv _far * mV); - void Init(mv _far * mV, LPEDATA edPtr); + int Init(mv _far * mV); + void Init(mv _far * mV, LPEDATA edPtr); - void Free(mv _far * mV); - void Free(LPEDATA edPtr); + void Free(mv _far * mV); + void Free(LPEDATA edPtr); - long __stdcall Condition (LPRDATA rdPtr, long param1, long param2); - short __stdcall Action (LPRDATA rdPtr, long param1, long param2); - long __stdcall Expression (LPRDATA rdPtr, long param); + long __stdcall Condition (LPRDATA rdPtr, long param1, long param2); + short __stdcall Action (LPRDATA rdPtr, long param1, long param2); + long __stdcall Expression (LPRDATA rdPtr, long param); - inline int ActionID(int ID) - { - return 25000 + ID; - } - - inline int ConditionID(int ID) - { - return 26000 + ID; - } - - inline int ExpressionID(int ID) - { - return 27000 + ID; - } - - template inline void * MemberFunctionPointer(T Function) - { - T _Function = Function; - return *(void **) &_Function; - } + inline int ActionID(int ID) + { + return 25000 + ID; + } + + inline int ConditionID(int ID) + { + return 26000 + ID; + } + + inline int ExpressionID(int ID) + { + return 27000 + ID; + } + + template inline void * MemberFunctionPointer(T Function) + { + T _Function = Function; + return *(void **) &_Function; + } } extern Edif::SDK * SDK; @@ -209,10 +206,19 @@ extern Edif::SDK * SDK; class Extension; -struct RUNDATA +/* RD + * This is the extension runtime data. + * Because all your runtime data is + * stored in your Extension class, this + * class is global to all extensions and + * should not be changed. Some functions + * will give you a pointer to this class, + * and from it you can get a pointer to + * your extension class' instance. + */ +struct RD { - //Main header - headerObject rHo; + headerObject rHo; //Main header char r //Placeholder for the optional structures [ @@ -229,3 +235,38 @@ struct RUNDATA Extension * pExtension; }; + +/* SerializedED + * This is the editdata. The class + * name is a reminder - any data in + * here is fully serialized, ready + * to be written to a file on disk, + * such as the MFA or EXE file. It + * will also be this way when you + * get access to it in other runtimes. + * You should not change this class + * as the change will affect all other + * extensions as well. Instead, open + * EditData.hpp and read about how to + * implement the editdata there. + */ +struct SerializedED +{ + /* Header + * This required data member contains + * information about your extension for + * MMF2, such as the version number + * from Extension::Version. + */ + extHeader Header; + + /* data + * This is used as a pointer to + * the start of the serialized + * data. See the EditData class + * for more information. + */ + char data[1]; +}; + +#define MMF2Func WINAPI DLLExport diff --git a/Inc/ImageFlt.h b/Inc/ImageFlt.h index 607bd0d..a44df2d 100644 --- a/Inc/ImageFlt.h +++ b/Inc/ImageFlt.h @@ -1,206 +1,206 @@ - -#ifndef _ImageFlt_h -#define _ImageFlt_h - -#include "FilterMgr.h" -#include "ImgFltDefs.h" - -////////////////////////////////////// -// Forwards - -class CImageFilter; -class CImageFilterMgr; -class CFilterImpl; -class CInputFile; -class COutputFile; -class CFilterImpl; - -////////////////////////////////////// -// Error codes - -enum { - IF_OK=0, - IF_NOTENOUGHMEM, - IF_CANNOTOPENFILE, - IF_CANNOTCREATEFILE, - IF_CANNOTWRITEFILE, - IF_UNKNOWNFORMAT, - IF_UNSUPPORTEDFORMAT, - IF_NOFILESPECIFIED, - IF_NOTSUPPORTED, - IF_NOTOPEN, - IF_UNSUPPORTEDDEPTH, - IF_INVALIDFILE, - IF_LESSTHAN256COLOR, - IF_INCORRECTDIMENSIONS, - IF_BADPARAMETER, - IF_UNINITIALIZEDFILTER, - IF_INVALIDPALETTE, - IF_ALREADYOPEN, - IF_ENDOFFILE, - IF_NOTANIMATIONFILTER, - IF_UNKNOWNERROR, -}; - -// Filter color caps -#define FLTCOLORCAPS_1 0x0001 -#define FLTCOLORCAPS_4 0x0002 -#define FLTCOLORCAPS_8 0x0004 -#define FLTCOLORCAPS_15 0x0008 -#define FLTCOLORCAPS_16 0x0010 -#define FLTCOLORCAPS_24 0x0020 -#define FLTCOLORCAPS_32 0x0040 - -// Filter type -#define FLTTYPE_IMAGES 0x0001 -#define FLTTYPE_ANIMATIONS 0x0002 - -// Compression -#define COMPRESSION_DEFAULT (-1) -#define COMPRESSION_MIN 0 -#define COMPRESSION_MAX 100 - -// SaveAnimation flags -#define SAVEANIMFLAG_SEPARATEFRAMES 0x00000001 - -// Progress proc -typedef BOOL (CALLBACK * PROGRESSPROC) (int p); - - -////////////////////////////////////////////////////////////////////////////// -// -// Image Filter Manager -// - -class IMGFLTMGR_API CImageFilterMgr : public CFilterMgr -{ -// Public -public: - CImageFilterMgr (); - virtual ~CImageFilterMgr(); - - static CImageFilterMgr* CreateInstance(); - - // Initialize - void Initialize(LPCSTR pFilterPath, DWORD dwFlags); - void Initialize(LPCWSTR pFilterPath, DWORD dwFlags); - virtual void Free(); - - // Filter infos - BOOL DoesFilterSupportImages(int nIndex); - BOOL DoesFilterSupportAnimations(int nIndex); - - // Data -protected: - friend class CImageFilter; -}; - -////////////////////////////////////////////////////////////////////////////// -// -// Image Filter -// -class IMGFLTMGR_API CImageFilter -{ -public: - // Constructeur / destructeur - CImageFilter(CImageFilterMgr* pMgr); - ~CImageFilter(); - - // Customisation - BOOL UseSpecificFilterIndex(int index); - BOOL UseSpecificFilterID(DWORD dwID); - - // Save customization - void SetCompressionLevel(int nLevel=-1); // 0 -> 100 - - // Picture - int Open(LPCSTR fileName); - int Open(LPCWSTR fileName); - int Open(CInputFile* pf); - int PrepareLoading(int width, int height, int depth, LPLOGPALETTE pPal); - int Load(LPBYTE pData, int width, int height, int pitch, int depth=0, LPLOGPALETTE pPal=NULL, LPBYTE pAlpha=NULL, int nAlphaPitch=0); - int Save(LPCSTR fileName, LPBYTE pData, int nWidth, int nHeight, int nDepth, int nPitch, LPLOGPALETTE pPal, LPBYTE pAlpha=NULL, int nAlphaPitch=0); - int Save(LPCWSTR fileName, LPBYTE pData, int nWidth, int nHeight, int nDepth, int nPitch, LPLOGPALETTE pPal, LPBYTE pAlpha=NULL, int nAlphaPitch=0); - void Close(); - int GetWidth(); - int GetHeight(); - int GetPitch(); - int GetDepth(); - DWORD GetDataSize(); - LPLOGPALETTE GetPalette(); - BOOL GetTransparentColor(COLORREF* pTranspColor); - BOOL ContainsAlphaChannel(); - - // Load animation - BOOL IsAnimation(); - int GetNumberOfFrames(); - int GetCurrentFrame(); - int GetFrameDelay(int frameIndex=-1); - DWORD GetAnimDuration(); - LPBYTE GetUserInfo(); - DWORD GetUserInfoSize(); - - void Restart(); - int GoToImage(LPBYTE pData, int pitch, int n); - void GetUpdateRect(LPRECT pRc); - int GetLoopCount(); - int GetLoopFrame(); - - // Save animation - int CreateAnimation(LPCSTR fname, int width, int height, int depth, - int nFrames, int msFrameDuration, - int nLoopCount = 1, int nLoopFrame = 0, - LPBYTE pUserInfo = NULL, DWORD dwUserInfoSize = 0); - int CreateAnimation(LPCWSTR fname, int width, int height, int depth, - int nFrames, int msFrameDuration, - int nLoopCount = 1, int nLoopFrame = 0, - LPBYTE pUserInfo = NULL, DWORD dwUserInfoSize = 0); - int CreateAnimation(COutputFile* pfout, int width, int height, int depth, - int nFrames, int msFrameDuration, - int nLoopCount = 1, int nLoopFrame = 0, - LPBYTE pUserInfo = NULL, DWORD dwUserInfoSize = 0); - int SaveAnimationFrame(LPBYTE pData, int width, int height, int pitch, int depth, LPLOGPALETTE pPal, LPBYTE pAlpha, int nAlphaPitch, int msFrameDuration, DWORD dwFlags); - int SaveAnimationFrame(LPBYTE pData, LPBYTE pPrevData, int width, int height, int pitch, int depth, LPLOGPALETTE pPal, LPBYTE pAlpha, LPBYTE pPrevAlpha, int nAlphaPitch, int msFrameDuration, DWORD dwFlags); - void AddPreviousFrameDuration(int msFrameDuration); - DWORD GetCurrentSaveAnimSize(); - - // File handling - void SetProgressCallBack(PROGRESSPROC pProc); - - // Filter info - DWORD GetFilterID(); - LPCSTR GetFilterNameA(); - int GetFilterIndex(); - DWORD GetFilterColorCaps(); - BOOL CanSave(); - BOOL CanSaveAnim(); - LPCWSTR GetFilterNameW(); - -protected: - int ReadHeader(); - - // Data -protected: - - // Image filter manager - CImageFilterMgr* m_pMgr; - - // Input - CInputFile* m_pfin; // Input file - BOOL m_bAutoDeletePfin; - BOOL m_bPrepared; - - // Output - COutputFile* m_pfout; // Output file - BOOL m_bAutoDeletePfout; - LPBYTE m_prevBuf; - - // Progress callback - PROGRESSPROC m_pProgressProc; - - // Filter implementation - CFilterImpl* m_pFilterImpl; -}; -typedef CImageFilter * LPIMAGEFILTER; - -#endif // _ImageFlt_h + +#ifndef _ImageFlt_h +#define _ImageFlt_h + +#include "FilterMgr.h" +#include "ImgFltDefs.h" + +////////////////////////////////////// +// Forwards + +class CImageFilter; +class CImageFilterMgr; +class CFilterImpl; +class CInputFile; +class COutputFile; +class CFilterImpl; + +////////////////////////////////////// +// Error codes + +enum { + IF_OK=0, + IF_NOTENOUGHMEM, + IF_CANNOTOPENFILE, + IF_CANNOTCREATEFILE, + IF_CANNOTWRITEFILE, + IF_UNKNOWNFORMAT, + IF_UNSUPPORTEDFORMAT, + IF_NOFILESPECIFIED, + IF_NOTSUPPORTED, + IF_NOTOPEN, + IF_UNSUPPORTEDDEPTH, + IF_INVALIDFILE, + IF_LESSTHAN256COLOR, + IF_INCORRECTDIMENSIONS, + IF_BADPARAMETER, + IF_UNINITIALIZEDFILTER, + IF_INVALIDPALETTE, + IF_ALREADYOPEN, + IF_ENDOFFILE, + IF_NOTANIMATIONFILTER, + IF_UNKNOWNERROR, +}; + +// Filter color caps +#define FLTCOLORCAPS_1 0x0001 +#define FLTCOLORCAPS_4 0x0002 +#define FLTCOLORCAPS_8 0x0004 +#define FLTCOLORCAPS_15 0x0008 +#define FLTCOLORCAPS_16 0x0010 +#define FLTCOLORCAPS_24 0x0020 +#define FLTCOLORCAPS_32 0x0040 + +// Filter type +#define FLTTYPE_IMAGES 0x0001 +#define FLTTYPE_ANIMATIONS 0x0002 + +// Compression +#define COMPRESSION_DEFAULT (-1) +#define COMPRESSION_MIN 0 +#define COMPRESSION_MAX 100 + +// SaveAnimation flags +#define SAVEANIMFLAG_SEPARATEFRAMES 0x00000001 + +// Progress proc +typedef BOOL (CALLBACK * PROGRESSPROC) (int p); + + +////////////////////////////////////////////////////////////////////////////// +// +// Image Filter Manager +// + +class IMGFLTMGR_API CImageFilterMgr : public CFilterMgr +{ +// Public +public: + CImageFilterMgr (); + virtual ~CImageFilterMgr(); + + static CImageFilterMgr* CreateInstance(); + + // Initialize + void Initialize(LPCSTR pFilterPath, DWORD dwFlags); + void Initialize(LPCWSTR pFilterPath, DWORD dwFlags); + virtual void Free(); + + // Filter infos + BOOL DoesFilterSupportImages(int nIndex); + BOOL DoesFilterSupportAnimations(int nIndex); + + // Data +protected: + friend class CImageFilter; +}; + +////////////////////////////////////////////////////////////////////////////// +// +// Image Filter +// +class IMGFLTMGR_API CImageFilter +{ +public: + // Constructeur / destructeur + CImageFilter(CImageFilterMgr* pMgr); + ~CImageFilter(); + + // Customisation + BOOL UseSpecificFilterIndex(int index); + BOOL UseSpecificFilterID(DWORD dwID); + + // Save customization + void SetCompressionLevel(int nLevel=-1); // 0 -> 100 + + // Picture + int Open(LPCSTR fileName); + int Open(LPCWSTR fileName); + int Open(CInputFile* pf); + int PrepareLoading(int width, int height, int depth, LPLOGPALETTE pPal); + int Load(LPBYTE pData, int width, int height, int pitch, int depth=0, LPLOGPALETTE pPal=NULL, LPBYTE pAlpha=NULL, int nAlphaPitch=0); + int Save(LPCSTR fileName, LPBYTE pData, int nWidth, int nHeight, int nDepth, int nPitch, LPLOGPALETTE pPal, LPBYTE pAlpha=NULL, int nAlphaPitch=0); + int Save(LPCWSTR fileName, LPBYTE pData, int nWidth, int nHeight, int nDepth, int nPitch, LPLOGPALETTE pPal, LPBYTE pAlpha=NULL, int nAlphaPitch=0); + void Close(); + int GetWidth(); + int GetHeight(); + int GetPitch(); + int GetDepth(); + DWORD GetDataSize(); + LPLOGPALETTE GetPalette(); + BOOL GetTransparentColor(COLORREF* pTranspColor); + BOOL ContainsAlphaChannel(); + + // Load animation + BOOL IsAnimation(); + int GetNumberOfFrames(); + int GetCurrentFrame(); + int GetFrameDelay(int frameIndex=-1); + DWORD GetAnimDuration(); + LPBYTE GetUserInfo(); + DWORD GetUserInfoSize(); + + void Restart(); + int GoToImage(LPBYTE pData, int pitch, int n); + void GetUpdateRect(LPRECT pRc); + int GetLoopCount(); + int GetLoopFrame(); + + // Save animation + int CreateAnimation(LPCSTR fname, int width, int height, int depth, + int nFrames, int msFrameDuration, + int nLoopCount = 1, int nLoopFrame = 0, + LPBYTE pUserInfo = NULL, DWORD dwUserInfoSize = 0); + int CreateAnimation(LPCWSTR fname, int width, int height, int depth, + int nFrames, int msFrameDuration, + int nLoopCount = 1, int nLoopFrame = 0, + LPBYTE pUserInfo = NULL, DWORD dwUserInfoSize = 0); + int CreateAnimation(COutputFile* pfout, int width, int height, int depth, + int nFrames, int msFrameDuration, + int nLoopCount = 1, int nLoopFrame = 0, + LPBYTE pUserInfo = NULL, DWORD dwUserInfoSize = 0); + int SaveAnimationFrame(LPBYTE pData, int width, int height, int pitch, int depth, LPLOGPALETTE pPal, LPBYTE pAlpha, int nAlphaPitch, int msFrameDuration, DWORD dwFlags); + int SaveAnimationFrame(LPBYTE pData, LPBYTE pPrevData, int width, int height, int pitch, int depth, LPLOGPALETTE pPal, LPBYTE pAlpha, LPBYTE pPrevAlpha, int nAlphaPitch, int msFrameDuration, DWORD dwFlags); + void AddPreviousFrameDuration(int msFrameDuration); + DWORD GetCurrentSaveAnimSize(); + + // File handling + void SetProgressCallBack(PROGRESSPROC pProc); + + // Filter info + DWORD GetFilterID(); + LPCSTR GetFilterNameA(); + int GetFilterIndex(); + DWORD GetFilterColorCaps(); + BOOL CanSave(); + BOOL CanSaveAnim(); + LPCWSTR GetFilterNameW(); + +protected: + int ReadHeader(); + + // Data +protected: + + // Image filter manager + CImageFilterMgr* m_pMgr; + + // Input + CInputFile* m_pfin; // Input file + BOOL m_bAutoDeletePfin; + BOOL m_bPrepared; + + // Output + COutputFile* m_pfout; // Output file + BOOL m_bAutoDeletePfout; + LPBYTE m_prevBuf; + + // Progress callback + PROGRESSPROC m_pProgressProc; + + // Filter implementation + CFilterImpl* m_pFilterImpl; +}; +typedef CImageFilter * LPIMAGEFILTER; + +#endif // _ImageFlt_h diff --git a/Inc/ObjectSelection.h b/Inc/ObjectSelection.h index e634568..1783ef2 100644 --- a/Inc/ObjectSelection.h +++ b/Inc/ObjectSelection.h @@ -1,144 +1,144 @@ - -// By Anders Riggelsen (Andos) -// http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=214148&gonew=1 - -// These files do not match up with the originals - modified for Edif (callbacks inside the extension class, etc..) - -#if !defined(OBJECTSELECTION) -#define OBJECTSELECTION - -#if !defined(EF_ISHWA) -#define EF_ISHWA 112 -#endif -#if !defined(EF_ISUNICODE) -#define EF_ISUNICODE 113 -#endif - -namespace Riggs -{ - class ObjectSelection - { - public: - - Extension * pExtension; - - ObjectSelection(LPRH rhPtr); - - void SelectAll(short Oi); - void SelectNone(short Oi); - void SelectOneObject(LPRO object); - void SelectObjects(short Oi, LPRO* objects, int count); - bool ObjectIsOfType(LPRO object, short Oi); - int GetNumberOfSelected(short Oi); - - template bool FilterObjects(short Oi, bool negate, T filterFunction) - { - if(Oi & 0x8000) - return FilterQualifierObjects(Oi & 0x7FFF, negate, filterFunction) ^ negate; - else - return FilterNonQualifierObjects(Oi, negate, filterFunction) ^ negate; - } - - protected: - - LPRH rhPtr; - LPOBL ObjectList; - LPOIL OiList; - LPQOI QualToOiList; - int oiListItemSize; - - LPOIL GetOILFromOI(short Oi); - - template bool DoCallback(void * Class, T Function, LPRO Parameter) - { - T _Function = Function; - void * FunctionPointer = *(void **) &_Function; - - int Result; - - __asm - { - pushad - - mov ecx, Class - - push Parameter - call FunctionPointer - add esp, 4 - - mov Result, eax - - popad - }; - - return (*(char *) &Result) != 0; - } - - template bool FilterQualifierObjects(short Oi, bool negate, T filterFunction) - { - LPQOI CurrentQualToOiStart = (LPQOI)((char*)QualToOiList + Oi); - LPQOI CurrentQualToOi = CurrentQualToOiStart; - - bool hasSelected = false; - - while(CurrentQualToOi->qoiOiList >= 0) - { - LPOIL CurrentOi = GetOILFromOI(CurrentQualToOi->qoiOiList); - hasSelected |= FilterNonQualifierObjects(CurrentOi->oilOi, negate, filterFunction); - CurrentQualToOi = (LPQOI)((char*)CurrentQualToOi + 4); - } - return hasSelected; - } - - template bool FilterNonQualifierObjects(short Oi, bool negate, T filterFunction) - { - LPOIL pObjectInfo = GetOILFromOI(Oi); - bool hasSelected = false; - - if(pObjectInfo->oilEventCount != rhPtr->rh2.rh2EventCount) - SelectAll(Oi); //The SOL is invalid, must reset. - - //If SOL is empty - if(pObjectInfo->oilNumOfSelected <= 0) - return false; - - int firstSelected = -1; - int count = 0; - int current = pObjectInfo->oilListSelected; - LPHO previous = NULL; - - while(current >= 0) - { - LPHO pObject = ObjectList[current].oblOffset; - bool useObject = DoCallback((void *) pExtension, filterFunction, (LPRO)pObject); - - if(negate) - useObject = !useObject; - - hasSelected |= useObject; - - if(useObject) - { - if(firstSelected == -1) - firstSelected = current; - - if(previous != NULL) - previous->hoNextSelected = current; - - previous = pObject; - count++; - } - current = pObject->hoNextSelected; - } - if(previous != NULL) - previous->hoNextSelected = -1; - - pObjectInfo->oilListSelected = firstSelected; - pObjectInfo->oilNumOfSelected = count; - - return hasSelected; - } - }; -} - + +// By Anders Riggelsen (Andos) +// http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=214148&gonew=1 + +// These files do not match up with the originals - modified for Edif (callbacks inside the extension class, etc..) + +#if !defined(OBJECTSELECTION) +#define OBJECTSELECTION + +#if !defined(EF_ISHWA) +#define EF_ISHWA 112 +#endif +#if !defined(EF_ISUNICODE) +#define EF_ISUNICODE 113 +#endif + +namespace Riggs +{ + class ObjectSelection + { + public: + + Extension * pExtension; + + ObjectSelection(LPRH rhPtr); + + void SelectAll(short Oi); + void SelectNone(short Oi); + void SelectOneObject(LPRO object); + void SelectObjects(short Oi, LPRO* objects, int count); + bool ObjectIsOfType(LPRO object, short Oi); + int GetNumberOfSelected(short Oi); + + template bool FilterObjects(short Oi, bool negate, T filterFunction) + { + if(Oi & 0x8000) + return FilterQualifierObjects(Oi & 0x7FFF, negate, filterFunction) ^ negate; + else + return FilterNonQualifierObjects(Oi, negate, filterFunction) ^ negate; + } + + protected: + + LPRH rhPtr; + LPOBL ObjectList; + LPOIL OiList; + LPQOI QualToOiList; + int oiListItemSize; + + LPOIL GetOILFromOI(short Oi); + + template bool DoCallback(void * Class, T Function, LPRO Parameter) + { + T _Function = Function; + void * FunctionPointer = *(void **) &_Function; + + int Result; + + __asm + { + pushad + + mov ecx, Class + + push Parameter + call FunctionPointer + add esp, 4 + + mov Result, eax + + popad + }; + + return (*(char *) &Result) != 0; + } + + template bool FilterQualifierObjects(short Oi, bool negate, T filterFunction) + { + LPQOI CurrentQualToOiStart = (LPQOI)((char*)QualToOiList + Oi); + LPQOI CurrentQualToOi = CurrentQualToOiStart; + + bool hasSelected = false; + + while(CurrentQualToOi->qoiOiList >= 0) + { + LPOIL CurrentOi = GetOILFromOI(CurrentQualToOi->qoiOiList); + hasSelected |= FilterNonQualifierObjects(CurrentOi->oilOi, negate, filterFunction); + CurrentQualToOi = (LPQOI)((char*)CurrentQualToOi + 4); + } + return hasSelected; + } + + template bool FilterNonQualifierObjects(short Oi, bool negate, T filterFunction) + { + LPOIL pObjectInfo = GetOILFromOI(Oi); + bool hasSelected = false; + + if(pObjectInfo->oilEventCount != rhPtr->rh2.rh2EventCount) + SelectAll(Oi); //The SOL is invalid, must reset. + + //If SOL is empty + if(pObjectInfo->oilNumOfSelected <= 0) + return false; + + int firstSelected = -1; + int count = 0; + int current = pObjectInfo->oilListSelected; + LPHO previous = NULL; + + while(current >= 0) + { + LPHO pObject = ObjectList[current].oblOffset; + bool useObject = DoCallback((void *) pExtension, filterFunction, (LPRO)pObject); + + if(negate) + useObject = !useObject; + + hasSelected |= useObject; + + if(useObject) + { + if(firstSelected == -1) + firstSelected = current; + + if(previous != NULL) + previous->hoNextSelected = current; + + previous = pObject; + count++; + } + current = pObject->hoNextSelected; + } + if(previous != NULL) + previous->hoNextSelected = -1; + + pObjectInfo->oilListSelected = firstSelected; + pObjectInfo->oilNumOfSelected = count; + + return hasSelected; + } + }; +} + #endif // !defined(OBJECTSELECTION) \ No newline at end of file diff --git a/Inc/Patch.h b/Inc/Patch.h index 6f8a2c2..050b8fa 100644 --- a/Inc/Patch.h +++ b/Inc/Patch.h @@ -1,70 +1,70 @@ - -class MemoryLock -{ -protected: - - DWORD OldProtect; - - void * Address; - size_t Size; - -public: - - const char * Error; - - inline MemoryLock(void * Address, size_t Size) - { - Error = 0; - - this->Address = Address; - this->Size = Size; - - if(!VirtualProtectEx(GetCurrentProcess(), Address, Size, PAGE_EXECUTE_READWRITE, &OldProtect)) - { - Error = "Failed to change memory protection"; - return; - } - } - - inline ~MemoryLock() - { - if(Error) - return; - - DWORD Unused; - VirtualProtectEx(GetCurrentProcess(), Address, Size, OldProtect, &Unused); - } - - -}; - -class Patch -{ -public: - - const char * Error; - - inline Patch(void * Address, const char * Old, const char * New, size_t Size) - { - Error = 0; - - { MemoryLock Lock(Address, Size); - - if(Lock.Error) - { - Error = Lock.Error; - return; - } - - if(memcmp(Address, Old, Size)) - { - Error = "Old memory isn't as expected - wrong version?"; - return; - } - - memcpy(Address, New, Size); - } - } - -}; - + +class MemoryLock +{ +protected: + + DWORD OldProtect; + + void * Address; + size_t Size; + +public: + + const char * Error; + + inline MemoryLock(void * Address, size_t Size) + { + Error = 0; + + this->Address = Address; + this->Size = Size; + + if(!VirtualProtectEx(GetCurrentProcess(), Address, Size, PAGE_EXECUTE_READWRITE, &OldProtect)) + { + Error = "Failed to change memory protection"; + return; + } + } + + inline ~MemoryLock() + { + if(Error) + return; + + DWORD Unused; + VirtualProtectEx(GetCurrentProcess(), Address, Size, OldProtect, &Unused); + } + + +}; + +class Patch +{ +public: + + const char * Error; + + inline Patch(void * Address, const char * Old, const char * New, size_t Size) + { + Error = 0; + + { MemoryLock Lock(Address, Size); + + if(Lock.Error) + { + Error = Lock.Error; + return; + } + + if(memcmp(Address, Old, Size)) + { + Error = "Old memory isn't as expected - wrong version?"; + return; + } + + memcpy(Address, New, Size); + } + } + +}; + diff --git a/Inc/Props.h b/Inc/Props.h index 2c9750c..52fb467 100644 --- a/Inc/Props.h +++ b/Inc/Props.h @@ -1,1095 +1,1095 @@ -// Property definitions - -#ifndef MMF2_Props_h -#define MMF2_Props_h - -/////////////////////////////////////////////////////// -// -// Property data - used in property definition tables -// -typedef struct PropData -{ - int dwID; // Identifier - UINT_PTR sName; // Name = ID of the property name in the resources, or LPCSTR - UINT_PTR sInfo; // Info = ID of the property description in the resources, or LPCSTR - UINT_PTR lType; // Property type, or pointer to CPropItem (custom properties) - DWORD dwOptions; // Options (check box, bold, etc) - LPARAM lCreateParam; // Parameter -} PropData; - -#ifdef __cplusplus - -/////////////////////////////////////////////////////// -// -// Property values - used to set or get property values -// -class CPropValue; - -////////////// -// Base class -////////////// - -/** - * Property Value. - * This class is the base class of the classes that contain the values of editable properties. - * CPropValue objects allow to communicate values between the property window and the object data. - * This is a pure virtual class. - */ -class CPropValue -{ -protected: - virtual ~CPropValue() {} -public: - CPropValue() {} - - virtual void Delete() = 0; - virtual CPropValue* CreateCopy() = 0; - virtual BOOL IsEqual(CPropValue* value) = 0; - virtual DWORD GetClassID() = 0; -}; - -////////////// -// Int -////////////// - -/** - * Integer Property Value. - */ -class CPropIntValue : public CPropValue -{ -protected: - virtual ~CPropIntValue() {} -public: - CPropIntValue() { m_nValue = 0; } - CPropIntValue(int nValue) { m_nValue = nValue; } - - virtual void Delete() { delete this; } - virtual CPropValue* CreateCopy() { return new CPropIntValue(m_nValue); } - virtual BOOL IsEqual(CPropValue* value) { return (m_nValue == ((CPropIntValue*)value)->m_nValue); } - virtual DWORD GetClassID() { return 'INT '; } - -public: - int m_nValue; -}; - -////////////// -// DWORD -////////////// -// -/** - * DWORD Property Value. - */ -class CPropDWordValue : public CPropValue -{ -protected: - virtual ~CPropDWordValue() {} -public: - CPropDWordValue() { m_dwValue = 0L; } - CPropDWordValue(DWORD dwValue) { m_dwValue = dwValue; } - - virtual void Delete() { delete this; } - virtual CPropValue* CreateCopy() { return new CPropDWordValue(m_dwValue); } - virtual BOOL IsEqual(CPropValue* value) { return (m_dwValue == ((CPropDWordValue*)value)->m_dwValue); } - virtual DWORD GetClassID() { return 'DWRD'; } - -public: - DWORD m_dwValue; -}; - -////////////// -// Float -////////////// -// -/** - * Float Property Value. - */ -class CPropFloatValue : public CPropValue -{ -protected: - virtual ~CPropFloatValue() {} -public: - CPropFloatValue() { m_fValue = 0.0f; } - CPropFloatValue(float fValue) { m_fValue = fValue; } - - virtual void Delete() { delete this; } - virtual CPropValue* CreateCopy() { return new CPropFloatValue(m_fValue); } - virtual BOOL IsEqual(CPropValue* value) { return (m_fValue == ((CPropFloatValue*)value)->m_fValue); } - virtual DWORD GetClassID() { return 'FLOT'; } - -public: - float m_fValue; -}; - -////////////// -// Double -////////////// -// -/** - * Double Property Value. - */ -class CPropDoubleValue : public CPropValue -{ -protected: - virtual ~CPropDoubleValue() {} -public: - CPropDoubleValue() { m_dValue = 0.0; } - CPropDoubleValue(double dValue) { m_dValue = dValue; } - - virtual void Delete() { delete this; } - virtual CPropValue* CreateCopy() { return new CPropDoubleValue(m_dValue); } - virtual BOOL IsEqual(CPropValue* value) { return (m_dValue == ((CPropDoubleValue*)value)->m_dValue); } - virtual DWORD GetClassID() { return 'DBLE'; } - -public: - double m_dValue; -}; - -////////////// -// Size -////////////// -// -/** - * Size Property Value. - * Width and height, integer values. - */ -class CPropSizeValue : public CPropValue -{ -protected: - virtual ~CPropSizeValue() {} -public: - CPropSizeValue() { m_cx = m_cy = 0L; } - CPropSizeValue(int cx, int cy) { m_cx = cx; m_cy = cy; } - - virtual void Delete() { delete this; } - virtual CPropValue* CreateCopy() { return new CPropSizeValue(m_cx, m_cy); } - virtual BOOL IsEqual(CPropValue* value) { return (m_cx == ((CPropSizeValue*)value)->m_cx && m_cy == ((CPropSizeValue*)value)->m_cy); } - virtual DWORD GetClassID() { return 'SIZE'; } - -public: - int m_cx; - int m_cy; -}; - -////////////// -// Int64 -////////////// -// -/** - * Large Integer Property Value. - */ -class CPropInt64Value : public CPropValue -{ -protected: - virtual ~CPropInt64Value() {} -public: - CPropInt64Value() { m_nValue = 0; } - CPropInt64Value(__int64 nValue) { m_nValue = nValue; } - - virtual void Delete() { delete this; } - virtual CPropValue* CreateCopy() { return new CPropInt64Value(m_nValue); } - virtual BOOL IsEqual(CPropValue* value) { return (m_nValue == ((CPropInt64Value*)value)->m_nValue); } - virtual DWORD GetClassID() { return 'INT2'; } - -public: - __int64 m_nValue; -}; - -////////////// -// Pointer -////////////// -// -/** - * Pointer Property Value. - */ -class CPropPtrValue : public CPropValue -{ -protected: - virtual ~CPropPtrValue() {} -public: - CPropPtrValue() { m_ptr = NULL; } - CPropPtrValue(LPVOID ptr) { m_ptr = ptr; } - - virtual void Delete() { delete this; } - virtual CPropValue* CreateCopy() { return new CPropPtrValue(m_ptr); } - virtual BOOL IsEqual(CPropValue* value) { return (m_ptr == ((CPropPtrValue*)value)->m_ptr); } - virtual DWORD GetClassID() { return 'LPTR'; } - -public: - LPVOID m_ptr; -}; - -////////////// -// Buffer -////////////// -// -/** - * Buffer Property Value. - */ -class CPropDataValue : public CPropValue -{ -protected: - virtual ~CPropDataValue() {} -public: - CPropDataValue() { m_dwDataSize = 0L; m_pData = 0; } - CPropDataValue(DWORD dwDataSize, LPBYTE pData) { - m_dwDataSize = dwDataSize; - m_pData = NULL; - if ( dwDataSize != 0 ) - { - m_pData = (LPBYTE)malloc(dwDataSize); - if ( m_pData != NULL ) - { - if ( pData != NULL ) - memcpy(m_pData, pData, dwDataSize); - } - else - m_dwDataSize = 0; - } - } - CPropDataValue(LPCSTR pStr) { - m_dwDataSize = 0; - m_pData = NULL; - if ( pStr == NULL ) - return; - m_pData = (LPBYTE)_strdup(pStr); - m_dwDataSize = strlen((LPCSTR)m_pData)+1; - }; - - virtual void Delete() { free(m_pData); m_pData = NULL; m_dwDataSize = 0; delete this; } - virtual CPropValue* CreateCopy() { return new CPropDataValue(m_dwDataSize, m_pData); } - virtual BOOL IsEqual(CPropValue* value) { - if ( m_dwDataSize != ((CPropDataValue*)value)->m_dwDataSize ) - return FALSE; - if ( m_dwDataSize == 0 ) - return TRUE; - if ( m_pData == NULL || ((CPropDataValue*)value)->m_pData == NULL ) - return FALSE; - return (memcmp(m_pData, ((CPropDataValue*)value)->m_pData, m_dwDataSize) == 0); - } - virtual DWORD GetClassID() { return 'DATA'; } - -public: - DWORD m_dwDataSize; - LPBYTE m_pData; -}; - -///////////////// -// String (ANSI) -///////////////// -// -/** - * ANSI string Property Value. - */ -class CPropAStringValue : public CPropValue -{ -protected: - virtual ~CPropAStringValue() {} -public: - CPropAStringValue() { m_pStr = _strdup(""); m_unused = 0; } - CPropAStringValue(LPCSTR pStr) { - if ( pStr == NULL ) - m_pStr = _strdup(""); - else - m_pStr = _strdup(pStr); - m_unused = 0; - } - CPropAStringValue(LPCWSTR pWStr) { - if ( pWStr == NULL ) - m_pStr = _strdup(""); - else - { - // m_pStr = _strdup(pStr); - int lg = wcslen(pWStr); - m_pStr = (LPSTR)calloc(lg+1, 1); // TODO : change that if we use something else than CP_ACP - WideCharToMultiByte(CP_ACP, 0, pWStr, lg, m_pStr, lg, NULL, NULL); - m_pStr[lg] = 0; - } - m_unused = 0; - } - CPropAStringValue(int nStringSize) { - if ( nStringSize > 0 ) - m_pStr = (LPSTR)calloc(nStringSize+1, 1); - else - m_pStr = _strdup(""); - } - LPCSTR GetString() { - return m_pStr; - } - virtual void Delete() { free(m_pStr); m_pStr = NULL; delete this; } - virtual CPropValue* CreateCopy() { return new CPropAStringValue(m_pStr); } - virtual BOOL IsEqual(CPropValue* value) { - if ( m_pStr == NULL || ((CPropAStringValue*)value)->m_pStr == NULL ) - return (m_pStr == ((CPropAStringValue*)value)->m_pStr); - return (strcmp(m_pStr, ((CPropAStringValue*)value)->m_pStr) == 0); - } - virtual DWORD GetClassID() { return 'STRA'; } - -public: - DWORD m_unused; // for compatibility with Data property - LPSTR m_pStr; -}; - -/////////////////// -// String (UNICODE) -/////////////////// -// -/** - * Unicode string Property Value. - */ -class CPropWStringValue : public CPropValue -{ -protected: - virtual ~CPropWStringValue() {} -public: - CPropWStringValue() { m_pWStr = _wcsdup(L""); m_unused = 0; } - CPropWStringValue(LPCWSTR pWStr) { - if ( pWStr == NULL ) - m_pWStr = _wcsdup(L""); - else - m_pWStr = _wcsdup(pWStr); - m_unused = 0; - } - CPropWStringValue(LPCSTR pStr) { - if ( pStr == NULL ) - m_pWStr = _wcsdup(L""); - else - { - // m_pStr = _strdup(pStr); - int lg = strlen(pStr); - m_pWStr = (LPWSTR)calloc(lg+1, sizeof(wchar_t)); - MultiByteToWideChar(CP_ACP, 0, pStr, lg, m_pWStr, lg); - m_pWStr[lg] = 0; - } - m_unused = 0; - } - CPropWStringValue(int nStringSize) { - if ( nStringSize > 0 ) - m_pWStr = (LPWSTR)calloc(nStringSize+1, sizeof(wchar_t)); - else - m_pWStr = _wcsdup(L""); - } - LPCWSTR GetString() { - return m_pWStr; - } - virtual void Delete() { free(m_pWStr); m_pWStr = NULL; delete this; } - virtual CPropValue* CreateCopy() { return new CPropWStringValue(m_pWStr); } - virtual BOOL IsEqual(CPropValue* value) { - if ( m_pWStr == NULL || ((CPropWStringValue*)value)->m_pWStr == NULL ) - return (m_pWStr == ((CPropWStringValue*)value)->m_pWStr); - return (wcscmp(m_pWStr, ((CPropWStringValue*)value)->m_pWStr) == 0); - } - virtual DWORD GetClassID() { return 'STRW'; } - -public: - DWORD m_unused; // for compatibility with Data property - LPWSTR m_pWStr; -}; - -////////////////////////////////////////////////////////////////// -// String (ANSI or UNICODE, depending on preprocessor definitions) -////////////////////////////////////////////////////////////////// -#ifdef _UNICODE -#define CPropStringValue CPropWStringValue -#else -#define CPropStringValue CPropAStringValue -#endif - - -////////////////// -// Custom property -////////////////// -/** - * Custom property. - * This class allows to define a new type of property control. - * Derived classes must implement the methods to draw, activate, deactivate the control, - * as well as the methods to get and set values. - */ -class CCustomProp -{ -public: - CCustomProp() {} - - virtual void Initialize(HINSTANCE hInst, LPARAM lCreateParam, BOOL bReInit) {} - virtual void Delete() { delete this; } - - virtual void Draw(HDC hDC, LPRECT pRc, HFONT hFont, COLORREF textColor) {} - virtual CPropValue* GetPropValue() { return NULL; } - virtual void SetPropValue(CPropValue* pValue) {} - - virtual void Activate(HWND hParent, LPRECT pRc, HFONT hFont) {} - virtual void Deactivate() {} - virtual void Refresh() {} - virtual void Move(LPRECT pRc) {} - virtual BOOL UpdateData() { return FALSE; } - -protected: - virtual ~CCustomProp() {} -}; - -typedef CCustomProp* (CALLBACK* CP_CREATEINSTANCE)(); - -typedef struct CustomPropCreateStruct { - - CP_CREATEINSTANCE m_pCreateCustomPropFnc; - LPARAM m_lCreateParam; - -} CustomPropCreateStruct; - -// Notification Codes for custom properties -#define PWN_FIRST (0U-2000U) - -// Tells property window to validate the property item -// => the property window gets the property value from the property item -// and applies it to the other selected items -#define PWN_VALIDATECUSTOMITEM (PWN_FIRST-1) - -// Parameter structure for the PWN_VALIDATECUSTOMITEM notification message -typedef struct _NMPROPWND -{ - NMHDR hdr; - CCustomProp* pCP; -} NMPROPWND, *PNMPROPWND, FAR *LPNMPROPWND; - -// Example: -// -// NMPROPWND nmp; -// UINT id = (UINT)IDC_CUSTOMITEM; // identifier of the control that sends the notification message, if any -// nmp.hdr.code = PWN_VALIDATECUSTOMITEM; -// nmp.hdr.hwndFrom = m_hWnd; // hWnd of the control that sends the notification message, if any -// nmp.hdr.idFrom = id; -// nmp.pCP = this; // CCustomProp* -// -// // Edit property -// if ( OnEdit() ) -// { -// // Notify parent -// ::SendMessage(hParent, WM_NOTIFY, (WPARAM)id, (LPARAM)&nmp); -// } - -// Internal symbol used by MMF, not important -#define IDC_CUSTOMITEM 1500 - -#endif // __cplusplus - -//////////////////////////////////////////////// -// -// Property types -// - -/** - * List of property types. - */ -enum { - PROPTYPE_STATIC = 1, //! Simple static text - PROPTYPE_FOLDER, //! Folder - PROPTYPE_FOLDER_END, //! Folder End - PROPTYPE_EDITBUTTON, //! Edit button, param1 = button text, or NULL if Edit - PROPTYPE_EDIT_STRING, //! Edit box for strings, parameter = max length - PROPTYPE_EDIT_NUMBER, //! Edit box for numbers, parameters = min value, max value - PROPTYPE_COMBOBOX, //! Combo box, parameters = list of strings, options (sorted, etc) - PROPTYPE_SIZE, //! Size - PROPTYPE_COLOR, //! Color - PROPTYPE_LEFTCHECKBOX, //! Checkbox - PROPTYPE_SLIDEREDIT, //! Edit + Slider - PROPTYPE_SPINEDIT, //! Edit + Spin - PROPTYPE_DIRCTRL, //! Direction Selector - PROPTYPE_GROUP, //! Group - PROPTYPE_LISTBTN, //! Internal, do not use - PROPTYPE_FILENAME, //! Edit box + browse file button, parameter = FilenameCreateParam - PROPTYPE_FONT, //! Font dialog box - PROPTYPE_CUSTOM, //! Custom property - PROPTYPE_PICTUREFILENAME, //! Edit box + browse image file button - PROPTYPE_COMBOBOXBTN, //! Combo box, parameters = list of strings, options (sorted, etc) - PROPTYPE_EDIT_FLOAT, //! Edit box for floating point numbers, parameters = min value, max value, options (signed, float, spin) - PROPTYPE_EDIT_MULTILINE, //! Edit box for multiline texts, no parameter - PROPTYPE_IMAGELIST, //! Image list - PROPTYPE_ICONCOMBOBOX, //! Combo box with icons - PROPTYPE_URLBUTTON, //! URL button - PROPTYPE_DIRECTORYNAME, //! Directory pathname - PROPTYPE_SPINEDITFLOAT, //! Edit + Spin, value = floating point number -}; - -/////////////////// -// Property options -/////////////////// -// -#define PROPOPT_NIL 0x00000000 -#define PROPOPT_CHECKBOX 0x00000001 // Left check box -#define PROPOPT_BOLD 0x00000002 // Name must be displayed in bold characters -#define PROPOPT_PARAMREQUIRED 0x00000004 // A non-null parameter must be provided -#define PROPOPT_REMOVABLE 0x00000008 // The property can be deleted by the user -#define PROPOPT_RENAMABLE 0x00000010 // The property can be renamed by the user -#define PROPOPT_MOVABLE 0x00000020 // The property can be moved by the user (list only) -#define PROPOPT_LIST 0x00000040 // The property is a list -#define PROPOPT_SINGLESEL 0x00000080 // This property is not displayed in multi-selection mode - -// Property-specific options -#define PROPOPT_EDIT_PASSWORD 0x00010000 // For Edit String property -#define PROPOPT_EDIT_LOWERCASE 0x00020000 // For Edit String property -#define PROPOPT_EDIT_UPPERCASE 0x00040000 // For Edit String property - -// Internal, not used by extensions -#define PROPID_ROOT 0 - -///////////////////////////// -// Property definition macros -///////////////////////////// -// -#define PropData_Folder(id,name,info) {id,name,info,PROPTYPE_FOLDER,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_Folder_End() {-1,0,0,PROPTYPE_FOLDER_END,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_Group(id,name,info) {id,name,info,PROPTYPE_GROUP,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_StaticString(id,name,info) {id,name,info,PROPTYPE_STATIC,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_StaticString_Opt(id,name,info,opt) {id,name,info,PROPTYPE_STATIC,opt,(LPARAM)NULL} -#define PropData_StaticString_List(id,name,info) {id,name,info,PROPTYPE_STATIC,PROPOPT_LIST,(LPARAM)NULL} -#define PropData_EditString(id,name,info) {id,name,info,PROPTYPE_EDIT_STRING,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_EditString_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_STRING,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_EditString_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_STRING,opt,(LPARAM)NULL} -#define PropData_EditNumber(id,name,info) {id,name,info,PROPTYPE_EDIT_NUMBER,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_EditNumber_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_NUMBER,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_EditNumber_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_NUMBER,opt,(LPARAM)NULL} -#define PropData_EditFloat(id,name,info) {id,name,info,PROPTYPE_EDIT_FLOAT,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_EditFloat_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_FLOAT,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_EditFloat_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_FLOAT,opt,(LPARAM)NULL} -#define PropData_EditMultiLine(id,name,info) {id,name,info,PROPTYPE_EDIT_MULTILINE,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_EditMultiLine_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_MULTILINE,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_EditMultiLine_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_MULTILINE,opt,(LPARAM)NULL} -#define PropData_SliderEdit(id,name,info,minmax) {id,name,info,PROPTYPE_SLIDEREDIT,PROPOPT_PARAMREQUIRED,(LPARAM)minmax} -#define PropData_SliderEdit_Check(id,name,info,minmax) {id,name,info,PROPTYPE_SLIDEREDIT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmax} -#define PropData_SliderEdit_Opt(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SLIDEREDIT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmax} -#define PropData_SpinEdit(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDIT,PROPOPT_PARAMREQUIRED,(LPARAM)minmax} -#define PropData_SpinEdit_Check(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDIT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmax} -#define PropData_SpinEdit_Opt(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SPINEDIT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmax} -#define PropData_Button(id,name,info,text) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_NIL, (LPARAM)text} -#define PropData_Button_Check(id,name,info,text) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_CHECKBOX,(LPARAM)text} -#define PropData_Button_Opt(id,name,info,opt,text) {id,name,info,PROPTYPE_EDITBUTTON,opt,(LPARAM)text} -#define PropData_EditButton(id,name,info) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_NIL, (LPARAM)NULL} -#define PropData_EditButton_Check(id,name,info) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_EditButton_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDITBUTTON,opt,(LPARAM)NULL} -#define PropData_Size(id,name,info,tab) {id,name,info,PROPTYPE_SIZE,PROPOPT_PARAMREQUIRED,(LPARAM)tab} -#define PropData_Size_Check(id,name,info,tab) {id,name,info,PROPTYPE_SIZE,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)tab} -#define PropData_Size_Opt(id,name,info,opt,tab) {id,name,info,PROPTYPE_SIZE,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)tab} -#define PropData_Color(id,name,info) {id,name,info,PROPTYPE_COLOR,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_Color_Check(id,name,info) {id,name,info,PROPTYPE_COLOR,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_Color_Opt(id,name,info,opt) {id,name,info,PROPTYPE_COLOR,opt,(LPARAM)NULL} -#define PropData_ComboBox(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOX,PROPOPT_PARAMREQUIRED,(LPARAM)list} -#define PropData_ComboBox_Check(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOX,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} -#define PropData_ComboBox_Opt(id,name,info,opt,list) {id,name,info,PROPTYPE_COMBOBOX,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} -#define PropData_CheckBox(id,name,info) {id,name,info,PROPTYPE_LEFTCHECKBOX,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_CheckBox_Opt(id,name,info,opt) {id,name,info,PROPTYPE_LEFTCHECKBOX,(PROPOPT_CHECKBOX|opt),(LPARAM)NULL} -#define PropData_DirCtrl(id,name,info,param) {id,name,info,PROPTYPE_DIRCTRL,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_DirCtrl_Check(id,name,info,param) {id,name,info,PROPTYPE_DIRCTRL,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_DirCtrl_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_DIRCTRL,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_Filename(id,name,info,param) {id,name,info,PROPTYPE_FILENAME,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_Filename_Check(id,name,info,param) {id,name,info,PROPTYPE_FILENAME,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_Filename_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_FILENAME,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_PictureFilename(id,name,info,param) {id,name,info,PROPTYPE_PICTUREFILENAME,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_PictureFilename_Check(id,name,info,param) {id,name,info,PROPTYPE_PICTUREFILENAME,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_PictureFilename_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_PICTUREFILENAME,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_Font(id,name,info,param) {id,name,info,PROPTYPE_FONT,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_Font_Check(id,name,info,param) {id,name,info,PROPTYPE_FONT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_Font_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_FONT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_Custom(id,name,info,param) {id,name,info,PROPTYPE_CUSTOM,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_Custom_Check(id,name,info,param) {id,name,info,PROPTYPE_CUSTOM,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_Custom_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_CUSTOM,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_ComboBoxBtn(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOXBTN,PROPOPT_PARAMREQUIRED,(LPARAM)list} -#define PropData_ComboBoxBtn_Check(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOXBTN,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} -#define PropData_ComboBoxBtn_Opt(id,name,info,opt,list) {id,name,info,PROPTYPE_COMBOBOXBTN,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} -#define PropData_ImageList(id,name,info) {id,name,info,PROPTYPE_IMAGELIST,0,NULL} -#define PropData_ImageList_Check(id,name,info) {id,name,info,PROPTYPE_IMAGELIST,PROPOPT_CHECKBOX,NULL} -#define PropData_ImageList_Opt(id,name,info,opt) {id,name,info,PROPTYPE_IMAGELIST,opt,NULL} -#define PropData_IconComboBox(id,name,info,list) {id,name,info,PROPTYPE_ICONCOMBOBOX,PROPOPT_PARAMREQUIRED,(LPARAM)list} -#define PropData_IconComboBox_Check(id,name,info,list) {id,name,info,PROPTYPE_ICONCOMBOBOX,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} -#define PropData_IconComboBox_Opt(id,name,info,opt,list) {id,name,info,PROPTYPE_ICONCOMBOBOX,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} -#define PropData_URLButton(id,name,info,url) {id,name,info,PROPTYPE_URLBUTTON,PROPOPT_PARAMREQUIRED, (LPARAM)url} -#define PropData_URLButton_Check(id,name,info,url) {id,name,info,PROPTYPE_URLBUTTON,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)url} -#define PropData_URLButton_Opt(id,name,info,opt,url) {id,name,info,PROPTYPE_URLBUTTON,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)url} -#define PropData_DirectoryName(id,name,info,param) {id,name,info,PROPTYPE_DIRECTORYNAME,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_DirectoryName_Check(id,name,info,param) {id,name,info,PROPTYPE_DIRECTORYNAME,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_DirectoryName_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_DIRECTORYNAME,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_SpinEditFloat(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT,PROPOPT_PARAMREQUIRED,(LPARAM)minmaxdelta} -#define PropData_SpinEditFloat_Check(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmaxdelta} -#define PropData_SpinEditFloat_Opt(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmaxdelta} -#define PropData_End() {0} - -///////////////////////////////// -// Property definition parameters -///////////////////////////////// - -// Parameter for slider & spin property items -typedef struct { - int nMinValue; // Minimum value (note: cannot be less than -32768 for SpinEdit property) - int nMaxValue; // Maximum value (note: cannot be greater than 32767 for SpinEdit property) -} MinMaxParam; -typedef MinMaxParam* LPMINMAXPARAM; - -// Parameter for floating point slider & spin property items -typedef struct { - float fMinValue; // Minimum value (e.g. 0.0f) - float fMaxValue; // Maximum value (e.g. 1.0f) - float fDelta; // Delta value (e.g. 0.01f) -} MinMaxFloatParam; -typedef MinMaxFloatParam* LPMINMAXFLOATPARAM; - -// Direction Control Styles -enum -{ - DCS_NOBORDER = 0, // No border - DCS_FLAT = 1, // Flat - DCS_3D = 2, // 3D - DCS_SLIDER = 4, // Slider to change the number of directions - DCS_EMPTY = 8, // ??? should affect the appearance of direction spots... - DCS_SETALL_BTNS = 16, // "Select All" and "Reset" buttons -}; - -// Initialization structure for direction property -typedef struct { - BOOL bMultiSel; // TRUE for multi-selection - int numDirs; // Number of directions: 4,8,16,32 - DWORD style; // Style DCS_NOBORDER, DCS_FLAT, DCS_3D, [DCS_SLIDER,] DCS_EMPTY, DCS_SETALL_BTNS -} DirCtrlCreateParam; - -// Direction Property Value -typedef struct { - int selDir; // Direction index, single selection mode - DWORD selDir32; // 32-bit direction mask, multi-selection mode - int numDirs; // Number of directions (4, 8, 16 or 32) - int reserved; // Not used -} PropDirValue; - -// Initialization structure for file selector property -typedef struct { - LPCSTR extFilter; // Filter string for GetOpenFilename dialog (for example "All Files (*.*)|*.*|") - DWORD options; // Options for GetOpenFilename dialog (OFN_FILEMUSTEXIST, OFN_PATHMUSTEXIST, OFN_HIDEREADONLY, etc.) -} FilenameCreateParam; - -//////////////////////////////////////////////// -// -// MMF property identifier -// - -////////// -// Tab IDs -////////// -// -enum { - PROPID_TAB_GENERAL=1, - PROPID_TAB_DISPLAY, - PROPID_TAB_WINDOW, - PROPID_TAB_SIZEPOS, - PROPID_TAB_TEXTOPT, - PROPID_TAB_MOVEMENT, - PROPID_TAB_RUNOPT, - PROPID_TAB_VALUES, - PROPID_TAB_EVENTS, - PROPID_TAB_ABOUT, - PROPID_TAB_BLURAY, - PROPID_TAB_IPHONE, - PROPID_TAB_ANDROID, - PROPID_TAB_XNA, - PROPID_TAB_MAC, - PROPID_TAB_CUSTOM1 = 18, - PROPID_TAB_CUSTOM2, - PROPTAB_MAX // 20 -}; - -/////////////// -// Property IDs -////////// -// -// If you need them, you can retrieve, set or refresh -// standard properties with the mvSetPropValue, etc. macros -// and the following identifiers. -// - -// Objects -enum { - PROPID_ITEM_FIRST = 20, - PROPID_ITEM_NAME, - PROPID_ITEM_ICON, - PROPID_ITEM_HELP, - PROPID_ITEM_LAST, - - PROPID_FII_FIRST = 180, - PROPID_FII_POS, // Those properties are not available if the frame editor is not open - PROPID_FII_X, - PROPID_FII_Y, - PROPID_FII_SIZE, - PROPID_FII_CX, - PROPID_FII_CY, - PROPID_FII_ROT, - PROPID_FII_ANGLE, - PROPID_FII_LAST, - - PROPID_FITEM_FIRST=200, - PROPID_FITEM_INKFXFOLDER, - PROPID_FITEM_TRANSPARENT, - PROPID_FITEM_INKFX, - PROPID_FITEM_INKFXPARAM, - PROPID_FITEM_ANTIA, - PROPID_FITEM_MEMORYFOLDER, - PROPID_FITEM_GLOBAL, - PROPID_FITEM_LOADONCALL, - PROPID_FITEM_OPTIONS, - PROPID_FITEM_RGBCOEF, - PROPID_FITEM_BLENDCOEF, - PROPID_FITEM_IMAGECOMPRESSION, - PROPID_FITEM_GLOBAL_EDITORSYNCHRO, - PROPID_FITEM_LAST=249, - - PROPID_DYNITEM_FIRST=250, - - PROPID_DYNITEM_TRANSITIONS=250, - PROPID_DYNITEM_FADEIN, - PROPID_DYNITEM_FADEOUT, - PROPID_DYNITEM_OBSTACLE, - PROPID_DYNITEM_OBSTACLETYPE, - PROPID_DYNITEM_AUTOROTATEGROUP, - PROPID_DYNITEM_AUTOROTATE, - - PROPID_MVT_FIRST=300, - PROPID_DYNITEM_MVTFOLDER, - PROPID_DYNITEM_MVTLIST, - PROPID_DYNITEM_MVTTYPE, - PROPID_DYNITEM_INITDIR, - PROPID_DYNITEM_TRYMVT, - PROPID_DYNITEM_SPEEDFOLDER, - PROPID_DYNITEM_SPEED, - PROPID_DYNITEM_DECEL, - PROPID_DYNITEM_ACCEL, - PROPID_DYNITEM_MOVEATSTART, - PROPID_DYNITEM_BOUNCEFOLDER, - PROPID_DYNITEM_NANGLES, - PROPID_DYNITEM_RANDOMIZER, - PROPID_DYNITEM_SECURITY, - PROPID_DYNITEM_EDITMVT, - PROPID_DYNITEM_PLAYER, - PROPID_DYNITEM_DIRS, - PROPID_DYNITEM_ENABLEREVERSE, - PROPID_DYNITEM_ROTATION, - PROPID_DYNITEM_ROTSPEED, - PROPID_DYNITEM_JUMP, - PROPID_DYNITEM_GRAVITY, - PROPID_DYNITEM_JUMPSTRENGTH, - PROPID_DYNITEM_JUMPCONTROL, - PROPID_DYNITEM_MVTHELP, - PROPID_DYNITEM_8DIR_STICKOBST, - PROPID_MVT_LAST, - - PROPID_DYNITEM_ALTVALUES_GROUP=350, - PROPID_DYNITEM_ALTSTRINGS_GROUP, - PROPID_DYNITEM_QUALIF, - PROPID_DYNITEM_DISPLAY, - PROPID_DYNITEM_VISIBLEATSTART, - PROPID_DYNITEM_DISPLAYASBKD, - PROPID_DYNITEM_BKDFOLDER, - PROPID_DYNITEM_SAVEBKD, - PROPID_DYNITEM_WIPEWITHCOLOR, - PROPID_DYNITEM_CREATEBEFOREFADEIN, - PROPID_DYNITEM_SCROLLING, - PROPID_DYNITEM_FOLLOWFRAME, - PROPID_DYNITEM_DESTROYIFTOOFAR, - PROPID_DYNITEM_INACTIVATEIFTOOFAR, - PROPID_DYNITEM_COLLISIONS, - PROPID_DYNITEM_FINECOLL, - PROPID_DYNITEM_BEHAVIOR_HDR, - PROPID_DYNITEM_BEHAVIOR_END, - PROPID_DYNITEM_CREATE, - PROPID_DYNITEM_CREATEATSTART, - PROPID_DYNITEM_BACKCOLOROPACITY, - - PROPID_TEXT_FIRST=380, - PROPID_TEXT_FONT, - PROPID_TEXT_FACENAME, - PROPID_TEXT_SIZE, - PROPID_TEXT_BOLD, - PROPID_TEXT_ITALIC, - PROPID_TEXT_UNDERLINE, - PROPID_TEXT_STRIKEOUT, - PROPID_TEXT_COLOR, - PROPID_TEXT_ALIGNGROUP, - PROPID_TEXT_HALIGN, - PROPID_TEXT_VALIGN, - PROPID_TEXT_RTL, - PROPID_TEXT_LAST, - - PROPID_DYNITEM_LAST, - - PROPID_EXTITEM_FIRST=400, - PROPID_EXTITEM_EDIT, - PROPID_EXTITEM_ABOUT, - PROPID_EXTITEM_NAME, - PROPID_EXTITEM_AUTHOR, - PROPID_EXTITEM_COPYRIGHT, - PROPID_EXTITEM_COMMENT, - PROPID_EXTITEM_WEBSITE, - PROPID_EXTITEM_FILENAME, - PROPID_EXTITEM_LAST, - - PROPID_DYNITEM_ALTVALUE_FIRST=0x50000, - PROPID_DYNITEM_ALTVALUE_LAST =0x50019, - - PROPID_DYNITEM_ALTSTRING_FIRST=0x50800, - PROPID_DYNITEM_ALTSTRING_LAST =0x50809, - - PROPID_DYNITEM_BEHAVIOR_FIRST=0x51000, - PROPID_DYNITEM_BEHAVIOR_LAST =0x51FFF, - - PROPID_MVTEXT_FIRST=0x52000, - PROPID_MVTEXT_LAST =0x52FFF, - - PROPID_FADE_PARAM_FIRST=0x53000, - PROPID_FADE_PARAM_LAST =0x53FFF, - - PROPID_FITEM_FXPARAM_FIRST=0x54000, - PROPID_FITEM_FXPARAM_LAST=0x54FFF, - - // Extensions must use property identifiers between PROPID_EXTITEM_CUSTOM_FIRST and PROPID_EXTITEM_CUSTOM_LAST - PROPID_EXTITEM_CUSTOM_FIRST=0x80000, - PROPID_EXTITEM_CUSTOM_LAST =0xFFFFF, -}; - -// Application -enum { - PROPID_APP_FIRST = 50, - PROPID_APP_ABOUT, - PROPID_APP_AUTHOR, - PROPID_APP_DESCRIPTION, - PROPID_APP_COPYRIGHT, - PROPID_APP_COMPANY, - PROPID_APP_FILEVERSION, - PROPID_APP_ICON, - PROPID_APP_WINDOWSIZE, - PROPID_APP_WINDOWBACKGROUNDCOLOR, - PROPID_APP_WINDOWSTYLE, - PROPID_APP_HEADING, - PROPID_APP_HEADINGMAX, - PROPID_APP_MENU, - PROPID_APP_MENUBAR, - PROPID_APP_MENUBOOTUP, - PROPID_APP_NOMINIMIZEBOX, - PROPID_APP_NOMAXIMIZEBOX, - PROPID_APP_NOTHICKFRAME, - PROPID_APP_MAXIMIZEDONBOOTUP, - PROPID_APP_HIDDENATSTART, - PROPID_APP_DISABLECLOSE, - PROPID_APP_OPTIONS, - PROPID_APP_FULLSCREEN, - PROPID_APP_FULLSWITCH, - PROPID_APP_RESIZETOWINDOWSIZE, - PROPID_APP_DONOTCENTERFRAME, - PROPID_APP_MACHINEINDEP, - PROPID_APP_SCREENSAVER_NOAUTOSTOP, - PROPID_APP_SOUNDOPT, - PROPID_APP_MULTISAMPLE, - PROPID_APP_SOUNDSOVERFRAMES, - PROPID_APP_SAMPLESEVENIFNOTFOCUS, - PROPID_APP_DISPOPT, - PROPID_APP_DISPLAYMODE, - PROPID_APP_ENABLEVISUALTHEMES, - PROPID_APP_PLAYERS, - PROPID_APP_INITSCORE, - PROPID_APP_INITLIVES, - PROPID_APP_FILENAME, - PROPID_APP_HELP, - PROPID_APP_HELPFILE, - PROPID_APP_PLAYERCTRLS, - PROPID_APP_VTZ, - PROPID_APP_VTZPREVIEWFILE, - PROPID_APP_GLOBALVALUE_GROUP, - PROPID_APP_GLOBALSTRING_GROUP, - PROPID_APP_GLOBALEVENTS, - PROPID_APP_BUILD, - PROPID_APP_BUILDTYPE, - PROPID_APP_INSTALLSETTINGS, - PROPID_APP_BUILDFILE, - PROPID_APP_BUILDOPT, - PROPID_APP_COMPLEVEL, - PROPID_APP_COMPSND, - PROPID_APP_ALLINONE, - PROPID_APP_FRAMERATE, - PROPID_APP_VSYNC, - PROPID_APP_RUNWHENMINIMIZED, - PROPID_APP_RUNOPTGROUP, - PROPID_APP_RUNCMDLINE, - PROPID_APP_MDI, - PROPID_APP_WINMENUIDX, - PROPID_APP_ABOUTTEXT, - PROPID_APP_RUNWHILERESIZING, - PROPID_APP_DEBUGGERSHORTCUTS, - PROPID_APP_GRAPHICS, - PROPID_APP_GRAPHICMODE, - PROPID_APP_IMAGEFILTERS, - PROPID_APP_SOUNDFILTERS, - PROPID_APP_SHOWDEBUGGER, - PROPID_APP_COMPRUNTIME, - PROPID_APP_DONOTSHAREDATA, - PROPID_APP_VTZONLYFROMURL, - PROPID_APP_VTZENABLESCRIPT, - PROPID_APP_VISTAOPT, - PROPID_APP_EXECLEVEL, - PROPID_APP_VTZONLY, - PROPID_APP_BUILDJARURL, - PROPID_APP_WNDTRANSP, - PROPID_APP_BRBUILDDIR, - PROPID_APP_LOADANIM_GROUP, - PROPID_APP_LOADANIM_IMAGE, - PROPID_APP_LOADANIM_NIMAGES, - PROPID_APP_BRBUILDFILE, - PROPID_APP_BRUSEMOSAIC, - PROPID_APP_BRGRAPHICSINJAR, - PROPID_APP_BRSIGNED, - PROPID_APP_BRORGID, - PROPID_APP_BRAPPID, - PROPID_APP_BRSGACT, - PROPID_APP_BRSGKEYSTORE, - PROPID_APP_BRSGKEYSTOREPW, - PROPID_APP_BRSGKEY, - PROPID_APP_BRSGKEYPW, - PROPID_APP_BRBACKSURFACE, - PROPID_APP_BRGRAPHICS_GROUP, - PROPID_APP_BRSIGNING_GROUP, - PROPID_APP_BRLOADOPTIONS_GROUP, - PROPID_APP_BRLOADALLIMAGESATSTART, - PROPID_APP_BRLOADALLSOUNDSATSTART, - PROPID_APP_BRSOUNDS_GROUP, - PROPID_APP_BREXTERNALSOUNDS, - PROPID_APP_BUILDDIR, - PROPID_APP_FULLSCREENGROUP, - PROPID_APP_KEEPSCREENRATIO, - PROPID_APP_SCREENRATIOTOLERANCE, - PROPID_APP_BRBUILDDIR2, - PROPID_APP_RESAMPLESTRETCH, - PROPID_APP_GLOBALREFRESH, - PROPID_APP_FLASH_MOCHIADS_GROUP, - PROPID_APP_FLASH_MOCHIADS, - PROPID_APP_FLASH_MOCHIADS_GAMEID, - PROPID_APP_FLASH_MOCHIADS_START, - PROPID_APP_FLASH_MOCHIADS_END, - PROPID_APP_LANGUAGE, - PROPID_APP_SCREENROTATION, - PROPID_APP_FLASH_PRELOADER_GROUP, - PROPID_APP_FLASH_PRELOADER, - PROPID_APP_FLASH_PRELOADER_FILENAME, - PROPID_APP_FLASH_PRELOADER_PGB_X, - PROPID_APP_FLASH_PRELOADER_PGB_Y, - PROPID_APP_FLASH_PRELOADER_PGB_RADIUS, - PROPID_APP_FLASH_PRELOADER_PGB_THICKNESS, - PROPID_APP_FLASH_PRELOADER_PGB_COLOR, - PROPID_APP_FLASH_PRELOADER_BACK_COLOR, - PROPID_APP_MP3_GROUP, - PROPID_APP_MP3_FORCEFREQ, - PROPID_APP_MP3_BITRATE, - PROPID_APP_MP3_ENCODER, - PROPID_APP_FLASH_MOCHIADS_SIGNUP, - PROPID_APP_FLASH_PRELOADERTYPE, - PROPID_APP_FLASH_EMBEDDEDFONTS_GROUP, - PROPID_APP_FLASH_EMBEDDEDFONTS, - PROPID_APP_IPHONE_GROUP, - PROPID_APP_IPHONE_ORIENTATION, - PROPID_APP_RTL, - PROPID_APP_IPHONEBUNDLEID, - PROPID_APP_IPHONETEXTURECOMPRESSION, - PROPID_APP_IPHONEMULTITASK, - PROPID_APP_IPHONEIMAGES_GROUP, - PROPID_APP_IPHONEAPPICON_IPHONE, - PROPID_APP_IPHONELAUNCHIMAGE_IPHONE, - PROPID_APP_IPHONEITUNEARTWORK, - PROPID_APP_ANDROIDKEYSTORE, - PROPID_APP_ANDROIDKEYNAME, - PROPID_APP_ANDROIDRELEASE, - PROPID_APP_ANDROIDPACKAGENAME, - PROPID_APP_ANDROIDIMAGES_GROUP, - PROPID_APP_ANDROIDLAUNCHERICON, - PROPID_APP_ANDROIDMENUICON, - PROPID_APP_ANDROIDTESTMODE, - PROPID_APP_ANDROIDEMULATORS, - PROPID_APP_IPHONESTATUSLINE, - PROPID_APP_RTLLAYOUT, - PROPID_APP_IPHONEIAD_GROUP, - PROPID_APP_IPHONEENABLEIAD, - PROPID_APP_IPHONEIADBOTTOM, - PROPID_APP_OPTIONAL_MODULES, - PROPID_APP_ANDROIDVERSION, - PROPID_APP_IPHONEBUNDLEVERSION, - PROPID_APP_IPHONETARGETDEVICE, - PROPID_APP_IPHONEARCHITECTURE, - PROPID_APP_IPHONEAPPICON_IPAD, - PROPID_APP_IPHONELAUNCHIMAGE_IPAD, - PROPID_APP_XNAPROJECTPATH, - PROPID_APP_XNAPROJECTNAME, - PROPID_APP_XNASTATUSLINE, - PROPID_APP_XNAFONT_GROUP, - PROPID_APP_XNAFONT_FIRSTCHAR, - PROPID_APP_XNAFONT_LASTCHAR, - PROPID_APP_JOYSTICKIMAGES, - PROPID_APP_ANDROIDSTATUSLINE, - PROPID_APP_BUILDTYPE_REAL, - PROPID_APP_ANDROID_PERMS, - PROPID_APP_ANDROIDDISABLEBACKBUTTON, - PROPID_APP_IPHONEANTIALIAS, - PROPID_APP_ANDROID_AUTOEND, - PROPID_APP_ANDROIDCRASHREPORTING, - PROPID_APP_FLASH_TARGETPLAYER, - PROPID_APP_BUILDWARNINGS, - PROPID_APP_XNAADS, - PROPID_APP_XNAPUBCENTERID, - PROPID_APP_LAST, - - PROPID_APP_ANDROID_PERM_FIRST = 90001, - PROPID_APP_ANDROID_PERM_LAST = 90105, - - PROPID_APP_GLOBALVALUE_FIRST = 100000, - PROPID_APP_GLOBALVALUE_LAST = 199998, - - PROPID_APP_GLOBALSTRING_FIRST = 200000, - PROPID_APP_GLOBALSTRING_LAST = 299998, - -}; - -// Frame -enum { - PROPID_FRAME_FIRST = 100, - PROPID_FRAME_FRAME, - PROPID_FRAME_SIZE, - PROPID_FRAME_BACKGROUNDCOLOR, - PROPID_FRAME_PALETTE, - PROPID_FRAME_RUNOPT, - PROPID_FRAME_GRABDESKTOP, - PROPID_FRAME_KEEPDISPLAY, - PROPID_FRAME_TOTALCOLMASK, - PROPID_FRAME_FRAMETITLEINCAPTION, - PROPID_FRAME_RESIZETOSCREENSIZE, - PROPID_FRAME_FORCELOADONCALL, - PROPID_FRAME_NOBJECTS, - PROPID_FRAME_PASSWORD, - PROPID_FRAME_TRANSITIONS, - PROPID_FRAME_FADEIN, - PROPID_FRAME_FADEOUT, - PROPID_FRAME_NOSURFACE, - PROPID_FRAME_SCRSETUP, - PROPID_FRAME_VIRTUALRIGHT, - PROPID_FRAME_VIRTUALBOTTOM, - PROPID_FRAME_DEMO, - PROPID_FRAME_DEMOFILENAME, - PROPID_FRAME_RECORD, - PROPID_FRAME_RANDOMSEED, - PROPID_FRAME_WNDTRANSP, - PROPID_FRAME_KEYRELEASETIME, - PROPID_FRAME_TIMEDMVTS, - PROPID_FRAME_TIMEDMVTSBASE, - PROPID_FRAME_FLASH_MOCHIADS_INTER, - PROPID_FRAME_GLOBALEVENTS, - PROPID_FRAME_IPHONE_JOYSTICK_GROUP, - PROPID_FRAME_IPHONE_JOYSTICK_TYPE, - PROPID_FRAME_IPHONE_JOYSTICK_FIRE1, - PROPID_FRAME_IPHONE_JOYSTICK_FIRE2, - PROPID_FRAME_IPHONE_JOYSTICK_LEFTHAND, - PROPID_FRAME_IPHONE_GROUP, - PROPID_FRAME_IPHONE_TOUCHMODE, - PROPID_FRAME_DISABLEIDLETIMER, - PROPID_FRAME_IPHONEIAD_GROUP, - PROPID_FRAME_IPHONEIAD, - PROPID_FRAME_LAST, -}; - -#endif // MMF2_Props_h +// Property definitions + +#ifndef MMF2_Props_h +#define MMF2_Props_h + +/////////////////////////////////////////////////////// +// +// Property data - used in property definition tables +// +typedef struct PropData +{ + int dwID; // Identifier + UINT_PTR sName; // Name = ID of the property name in the resources, or LPCSTR + UINT_PTR sInfo; // Info = ID of the property description in the resources, or LPCSTR + UINT_PTR lType; // Property type, or pointer to CPropItem (custom properties) + DWORD dwOptions; // Options (check box, bold, etc) + LPARAM lCreateParam; // Parameter +} PropData; + +#ifdef __cplusplus + +/////////////////////////////////////////////////////// +// +// Property values - used to set or get property values +// +class CPropValue; + +////////////// +// Base class +////////////// + +/** + * Property Value. + * This class is the base class of the classes that contain the values of editable properties. + * CPropValue objects allow to communicate values between the property window and the object data. + * This is a pure virtual class. + */ +class CPropValue +{ +protected: + virtual ~CPropValue() {} +public: + CPropValue() {} + + virtual void Delete() = 0; + virtual CPropValue* CreateCopy() = 0; + virtual BOOL IsEqual(CPropValue* value) = 0; + virtual DWORD GetClassID() = 0; +}; + +////////////// +// Int +////////////// + +/** + * Integer Property Value. + */ +class CPropIntValue : public CPropValue +{ +protected: + virtual ~CPropIntValue() {} +public: + CPropIntValue() { m_nValue = 0; } + CPropIntValue(int nValue) { m_nValue = nValue; } + + virtual void Delete() { delete this; } + virtual CPropValue* CreateCopy() { return new CPropIntValue(m_nValue); } + virtual BOOL IsEqual(CPropValue* value) { return (m_nValue == ((CPropIntValue*)value)->m_nValue); } + virtual DWORD GetClassID() { return 'INT '; } + +public: + int m_nValue; +}; + +////////////// +// DWORD +////////////// +// +/** + * DWORD Property Value. + */ +class CPropDWordValue : public CPropValue +{ +protected: + virtual ~CPropDWordValue() {} +public: + CPropDWordValue() { m_dwValue = 0L; } + CPropDWordValue(DWORD dwValue) { m_dwValue = dwValue; } + + virtual void Delete() { delete this; } + virtual CPropValue* CreateCopy() { return new CPropDWordValue(m_dwValue); } + virtual BOOL IsEqual(CPropValue* value) { return (m_dwValue == ((CPropDWordValue*)value)->m_dwValue); } + virtual DWORD GetClassID() { return 'DWRD'; } + +public: + DWORD m_dwValue; +}; + +////////////// +// Float +////////////// +// +/** + * Float Property Value. + */ +class CPropFloatValue : public CPropValue +{ +protected: + virtual ~CPropFloatValue() {} +public: + CPropFloatValue() { m_fValue = 0.0f; } + CPropFloatValue(float fValue) { m_fValue = fValue; } + + virtual void Delete() { delete this; } + virtual CPropValue* CreateCopy() { return new CPropFloatValue(m_fValue); } + virtual BOOL IsEqual(CPropValue* value) { return (m_fValue == ((CPropFloatValue*)value)->m_fValue); } + virtual DWORD GetClassID() { return 'FLOT'; } + +public: + float m_fValue; +}; + +////////////// +// Double +////////////// +// +/** + * Double Property Value. + */ +class CPropDoubleValue : public CPropValue +{ +protected: + virtual ~CPropDoubleValue() {} +public: + CPropDoubleValue() { m_dValue = 0.0; } + CPropDoubleValue(double dValue) { m_dValue = dValue; } + + virtual void Delete() { delete this; } + virtual CPropValue* CreateCopy() { return new CPropDoubleValue(m_dValue); } + virtual BOOL IsEqual(CPropValue* value) { return (m_dValue == ((CPropDoubleValue*)value)->m_dValue); } + virtual DWORD GetClassID() { return 'DBLE'; } + +public: + double m_dValue; +}; + +////////////// +// Size +////////////// +// +/** + * Size Property Value. + * Width and height, integer values. + */ +class CPropSizeValue : public CPropValue +{ +protected: + virtual ~CPropSizeValue() {} +public: + CPropSizeValue() { m_cx = m_cy = 0L; } + CPropSizeValue(int cx, int cy) { m_cx = cx; m_cy = cy; } + + virtual void Delete() { delete this; } + virtual CPropValue* CreateCopy() { return new CPropSizeValue(m_cx, m_cy); } + virtual BOOL IsEqual(CPropValue* value) { return (m_cx == ((CPropSizeValue*)value)->m_cx && m_cy == ((CPropSizeValue*)value)->m_cy); } + virtual DWORD GetClassID() { return 'SIZE'; } + +public: + int m_cx; + int m_cy; +}; + +////////////// +// Int64 +////////////// +// +/** + * Large Integer Property Value. + */ +class CPropInt64Value : public CPropValue +{ +protected: + virtual ~CPropInt64Value() {} +public: + CPropInt64Value() { m_nValue = 0; } + CPropInt64Value(__int64 nValue) { m_nValue = nValue; } + + virtual void Delete() { delete this; } + virtual CPropValue* CreateCopy() { return new CPropInt64Value(m_nValue); } + virtual BOOL IsEqual(CPropValue* value) { return (m_nValue == ((CPropInt64Value*)value)->m_nValue); } + virtual DWORD GetClassID() { return 'INT2'; } + +public: + __int64 m_nValue; +}; + +////////////// +// Pointer +////////////// +// +/** + * Pointer Property Value. + */ +class CPropPtrValue : public CPropValue +{ +protected: + virtual ~CPropPtrValue() {} +public: + CPropPtrValue() { m_ptr = NULL; } + CPropPtrValue(LPVOID ptr) { m_ptr = ptr; } + + virtual void Delete() { delete this; } + virtual CPropValue* CreateCopy() { return new CPropPtrValue(m_ptr); } + virtual BOOL IsEqual(CPropValue* value) { return (m_ptr == ((CPropPtrValue*)value)->m_ptr); } + virtual DWORD GetClassID() { return 'LPTR'; } + +public: + LPVOID m_ptr; +}; + +////////////// +// Buffer +////////////// +// +/** + * Buffer Property Value. + */ +class CPropDataValue : public CPropValue +{ +protected: + virtual ~CPropDataValue() {} +public: + CPropDataValue() { m_dwDataSize = 0L; m_pData = 0; } + CPropDataValue(DWORD dwDataSize, LPBYTE pData) { + m_dwDataSize = dwDataSize; + m_pData = NULL; + if ( dwDataSize != 0 ) + { + m_pData = (LPBYTE)malloc(dwDataSize); + if ( m_pData != NULL ) + { + if ( pData != NULL ) + memcpy(m_pData, pData, dwDataSize); + } + else + m_dwDataSize = 0; + } + } + CPropDataValue(LPCSTR pStr) { + m_dwDataSize = 0; + m_pData = NULL; + if ( pStr == NULL ) + return; + m_pData = (LPBYTE)_strdup(pStr); + m_dwDataSize = strlen((LPCSTR)m_pData)+1; + }; + + virtual void Delete() { free(m_pData); m_pData = NULL; m_dwDataSize = 0; delete this; } + virtual CPropValue* CreateCopy() { return new CPropDataValue(m_dwDataSize, m_pData); } + virtual BOOL IsEqual(CPropValue* value) { + if ( m_dwDataSize != ((CPropDataValue*)value)->m_dwDataSize ) + return FALSE; + if ( m_dwDataSize == 0 ) + return TRUE; + if ( m_pData == NULL || ((CPropDataValue*)value)->m_pData == NULL ) + return FALSE; + return (memcmp(m_pData, ((CPropDataValue*)value)->m_pData, m_dwDataSize) == 0); + } + virtual DWORD GetClassID() { return 'DATA'; } + +public: + DWORD m_dwDataSize; + LPBYTE m_pData; +}; + +///////////////// +// String (ANSI) +///////////////// +// +/** + * ANSI string Property Value. + */ +class CPropAStringValue : public CPropValue +{ +protected: + virtual ~CPropAStringValue() {} +public: + CPropAStringValue() { m_pStr = _strdup(""); m_unused = 0; } + CPropAStringValue(LPCSTR pStr) { + if ( pStr == NULL ) + m_pStr = _strdup(""); + else + m_pStr = _strdup(pStr); + m_unused = 0; + } + CPropAStringValue(LPCWSTR pWStr) { + if ( pWStr == NULL ) + m_pStr = _strdup(""); + else + { + // m_pStr = _strdup(pStr); + int lg = wcslen(pWStr); + m_pStr = (LPSTR)calloc(lg+1, 1); // TODO : change that if we use something else than CP_ACP + WideCharToMultiByte(CP_ACP, 0, pWStr, lg, m_pStr, lg, NULL, NULL); + m_pStr[lg] = 0; + } + m_unused = 0; + } + CPropAStringValue(int nStringSize) { + if ( nStringSize > 0 ) + m_pStr = (LPSTR)calloc(nStringSize+1, 1); + else + m_pStr = _strdup(""); + } + LPCSTR GetString() { + return m_pStr; + } + virtual void Delete() { free(m_pStr); m_pStr = NULL; delete this; } + virtual CPropValue* CreateCopy() { return new CPropAStringValue(m_pStr); } + virtual BOOL IsEqual(CPropValue* value) { + if ( m_pStr == NULL || ((CPropAStringValue*)value)->m_pStr == NULL ) + return (m_pStr == ((CPropAStringValue*)value)->m_pStr); + return (strcmp(m_pStr, ((CPropAStringValue*)value)->m_pStr) == 0); + } + virtual DWORD GetClassID() { return 'STRA'; } + +public: + DWORD m_unused; // for compatibility with Data property + LPSTR m_pStr; +}; + +/////////////////// +// String (UNICODE) +/////////////////// +// +/** + * Unicode string Property Value. + */ +class CPropWStringValue : public CPropValue +{ +protected: + virtual ~CPropWStringValue() {} +public: + CPropWStringValue() { m_pWStr = _wcsdup(L""); m_unused = 0; } + CPropWStringValue(LPCWSTR pWStr) { + if ( pWStr == NULL ) + m_pWStr = _wcsdup(L""); + else + m_pWStr = _wcsdup(pWStr); + m_unused = 0; + } + CPropWStringValue(LPCSTR pStr) { + if ( pStr == NULL ) + m_pWStr = _wcsdup(L""); + else + { + // m_pStr = _strdup(pStr); + int lg = strlen(pStr); + m_pWStr = (LPWSTR)calloc(lg+1, sizeof(wchar_t)); + MultiByteToWideChar(CP_ACP, 0, pStr, lg, m_pWStr, lg); + m_pWStr[lg] = 0; + } + m_unused = 0; + } + CPropWStringValue(int nStringSize) { + if ( nStringSize > 0 ) + m_pWStr = (LPWSTR)calloc(nStringSize+1, sizeof(wchar_t)); + else + m_pWStr = _wcsdup(L""); + } + LPCWSTR GetString() { + return m_pWStr; + } + virtual void Delete() { free(m_pWStr); m_pWStr = NULL; delete this; } + virtual CPropValue* CreateCopy() { return new CPropWStringValue(m_pWStr); } + virtual BOOL IsEqual(CPropValue* value) { + if ( m_pWStr == NULL || ((CPropWStringValue*)value)->m_pWStr == NULL ) + return (m_pWStr == ((CPropWStringValue*)value)->m_pWStr); + return (wcscmp(m_pWStr, ((CPropWStringValue*)value)->m_pWStr) == 0); + } + virtual DWORD GetClassID() { return 'STRW'; } + +public: + DWORD m_unused; // for compatibility with Data property + LPWSTR m_pWStr; +}; + +////////////////////////////////////////////////////////////////// +// String (ANSI or UNICODE, depending on preprocessor definitions) +////////////////////////////////////////////////////////////////// +#ifdef _UNICODE +#define CPropStringValue CPropWStringValue +#else +#define CPropStringValue CPropAStringValue +#endif + + +////////////////// +// Custom property +////////////////// +/** + * Custom property. + * This class allows to define a new type of property control. + * Derived classes must implement the methods to draw, activate, deactivate the control, + * as well as the methods to get and set values. + */ +class CCustomProp +{ +public: + CCustomProp() {} + + virtual void Initialize(HINSTANCE hInst, LPARAM lCreateParam, BOOL bReInit) {} + virtual void Delete() { delete this; } + + virtual void Draw(HDC hDC, LPRECT pRc, HFONT hFont, COLORREF textColor) {} + virtual CPropValue* GetPropValue() { return NULL; } + virtual void SetPropValue(CPropValue* pValue) {} + + virtual void Activate(HWND hParent, LPRECT pRc, HFONT hFont) {} + virtual void Deactivate() {} + virtual void Refresh() {} + virtual void Move(LPRECT pRc) {} + virtual BOOL UpdateData() { return FALSE; } + +protected: + virtual ~CCustomProp() {} +}; + +typedef CCustomProp* (CALLBACK* CP_CREATEINSTANCE)(); + +typedef struct CustomPropCreateStruct { + + CP_CREATEINSTANCE m_pCreateCustomPropFnc; + LPARAM m_lCreateParam; + +} CustomPropCreateStruct; + +// Notification Codes for custom properties +#define PWN_FIRST (0U-2000U) + +// Tells property window to validate the property item +// => the property window gets the property value from the property item +// and applies it to the other selected items +#define PWN_VALIDATECUSTOMITEM (PWN_FIRST-1) + +// Parameter structure for the PWN_VALIDATECUSTOMITEM notification message +typedef struct _NMPROPWND +{ + NMHDR hdr; + CCustomProp* pCP; +} NMPROPWND, *PNMPROPWND, FAR *LPNMPROPWND; + +// Example: +// +// NMPROPWND nmp; +// UINT id = (UINT)IDC_CUSTOMITEM; // identifier of the control that sends the notification message, if any +// nmp.hdr.code = PWN_VALIDATECUSTOMITEM; +// nmp.hdr.hwndFrom = m_hWnd; // hWnd of the control that sends the notification message, if any +// nmp.hdr.idFrom = id; +// nmp.pCP = this; // CCustomProp* +// +// // Edit property +// if ( OnEdit() ) +// { +// // Notify parent +// ::SendMessage(hParent, WM_NOTIFY, (WPARAM)id, (LPARAM)&nmp); +// } + +// Internal symbol used by MMF, not important +#define IDC_CUSTOMITEM 1500 + +#endif // __cplusplus + +//////////////////////////////////////////////// +// +// Property types +// + +/** + * List of property types. + */ +enum { + PROPTYPE_STATIC = 1, //! Simple static text + PROPTYPE_FOLDER, //! Folder + PROPTYPE_FOLDER_END, //! Folder End + PROPTYPE_EDITBUTTON, //! Edit button, param1 = button text, or NULL if Edit + PROPTYPE_EDIT_STRING, //! Edit box for strings, parameter = max length + PROPTYPE_EDIT_NUMBER, //! Edit box for numbers, parameters = min value, max value + PROPTYPE_COMBOBOX, //! Combo box, parameters = list of strings, options (sorted, etc) + PROPTYPE_SIZE, //! Size + PROPTYPE_COLOR, //! Color + PROPTYPE_LEFTCHECKBOX, //! Checkbox + PROPTYPE_SLIDEREDIT, //! Edit + Slider + PROPTYPE_SPINEDIT, //! Edit + Spin + PROPTYPE_DIRCTRL, //! Direction Selector + PROPTYPE_GROUP, //! Group + PROPTYPE_LISTBTN, //! Internal, do not use + PROPTYPE_FILENAME, //! Edit box + browse file button, parameter = FilenameCreateParam + PROPTYPE_FONT, //! Font dialog box + PROPTYPE_CUSTOM, //! Custom property + PROPTYPE_PICTUREFILENAME, //! Edit box + browse image file button + PROPTYPE_COMBOBOXBTN, //! Combo box, parameters = list of strings, options (sorted, etc) + PROPTYPE_EDIT_FLOAT, //! Edit box for floating point numbers, parameters = min value, max value, options (signed, float, spin) + PROPTYPE_EDIT_MULTILINE, //! Edit box for multiline texts, no parameter + PROPTYPE_IMAGELIST, //! Image list + PROPTYPE_ICONCOMBOBOX, //! Combo box with icons + PROPTYPE_URLBUTTON, //! URL button + PROPTYPE_DIRECTORYNAME, //! Directory pathname + PROPTYPE_SPINEDITFLOAT, //! Edit + Spin, value = floating point number +}; + +/////////////////// +// Property options +/////////////////// +// +#define PROPOPT_NIL 0x00000000 +#define PROPOPT_CHECKBOX 0x00000001 // Left check box +#define PROPOPT_BOLD 0x00000002 // Name must be displayed in bold characters +#define PROPOPT_PARAMREQUIRED 0x00000004 // A non-null parameter must be provided +#define PROPOPT_REMOVABLE 0x00000008 // The property can be deleted by the user +#define PROPOPT_RENAMABLE 0x00000010 // The property can be renamed by the user +#define PROPOPT_MOVABLE 0x00000020 // The property can be moved by the user (list only) +#define PROPOPT_LIST 0x00000040 // The property is a list +#define PROPOPT_SINGLESEL 0x00000080 // This property is not displayed in multi-selection mode + +// Property-specific options +#define PROPOPT_EDIT_PASSWORD 0x00010000 // For Edit String property +#define PROPOPT_EDIT_LOWERCASE 0x00020000 // For Edit String property +#define PROPOPT_EDIT_UPPERCASE 0x00040000 // For Edit String property + +// Internal, not used by extensions +#define PROPID_ROOT 0 + +///////////////////////////// +// Property definition macros +///////////////////////////// +// +#define PropData_Folder(id,name,info) {id,name,info,PROPTYPE_FOLDER,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_Folder_End() {-1,0,0,PROPTYPE_FOLDER_END,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_Group(id,name,info) {id,name,info,PROPTYPE_GROUP,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_StaticString(id,name,info) {id,name,info,PROPTYPE_STATIC,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_StaticString_Opt(id,name,info,opt) {id,name,info,PROPTYPE_STATIC,opt,(LPARAM)NULL} +#define PropData_StaticString_List(id,name,info) {id,name,info,PROPTYPE_STATIC,PROPOPT_LIST,(LPARAM)NULL} +#define PropData_EditString(id,name,info) {id,name,info,PROPTYPE_EDIT_STRING,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_EditString_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_STRING,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditString_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_STRING,opt,(LPARAM)NULL} +#define PropData_EditNumber(id,name,info) {id,name,info,PROPTYPE_EDIT_NUMBER,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_EditNumber_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_NUMBER,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditNumber_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_NUMBER,opt,(LPARAM)NULL} +#define PropData_EditFloat(id,name,info) {id,name,info,PROPTYPE_EDIT_FLOAT,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_EditFloat_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_FLOAT,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditFloat_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_FLOAT,opt,(LPARAM)NULL} +#define PropData_EditMultiLine(id,name,info) {id,name,info,PROPTYPE_EDIT_MULTILINE,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_EditMultiLine_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_MULTILINE,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditMultiLine_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_MULTILINE,opt,(LPARAM)NULL} +#define PropData_SliderEdit(id,name,info,minmax) {id,name,info,PROPTYPE_SLIDEREDIT,PROPOPT_PARAMREQUIRED,(LPARAM)minmax} +#define PropData_SliderEdit_Check(id,name,info,minmax) {id,name,info,PROPTYPE_SLIDEREDIT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmax} +#define PropData_SliderEdit_Opt(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SLIDEREDIT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmax} +#define PropData_SpinEdit(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDIT,PROPOPT_PARAMREQUIRED,(LPARAM)minmax} +#define PropData_SpinEdit_Check(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDIT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmax} +#define PropData_SpinEdit_Opt(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SPINEDIT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmax} +#define PropData_Button(id,name,info,text) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_NIL, (LPARAM)text} +#define PropData_Button_Check(id,name,info,text) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_CHECKBOX,(LPARAM)text} +#define PropData_Button_Opt(id,name,info,opt,text) {id,name,info,PROPTYPE_EDITBUTTON,opt,(LPARAM)text} +#define PropData_EditButton(id,name,info) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_NIL, (LPARAM)NULL} +#define PropData_EditButton_Check(id,name,info) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditButton_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDITBUTTON,opt,(LPARAM)NULL} +#define PropData_Size(id,name,info,tab) {id,name,info,PROPTYPE_SIZE,PROPOPT_PARAMREQUIRED,(LPARAM)tab} +#define PropData_Size_Check(id,name,info,tab) {id,name,info,PROPTYPE_SIZE,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)tab} +#define PropData_Size_Opt(id,name,info,opt,tab) {id,name,info,PROPTYPE_SIZE,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)tab} +#define PropData_Color(id,name,info) {id,name,info,PROPTYPE_COLOR,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_Color_Check(id,name,info) {id,name,info,PROPTYPE_COLOR,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_Color_Opt(id,name,info,opt) {id,name,info,PROPTYPE_COLOR,opt,(LPARAM)NULL} +#define PropData_ComboBox(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOX,PROPOPT_PARAMREQUIRED,(LPARAM)list} +#define PropData_ComboBox_Check(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOX,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} +#define PropData_ComboBox_Opt(id,name,info,opt,list) {id,name,info,PROPTYPE_COMBOBOX,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} +#define PropData_CheckBox(id,name,info) {id,name,info,PROPTYPE_LEFTCHECKBOX,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_CheckBox_Opt(id,name,info,opt) {id,name,info,PROPTYPE_LEFTCHECKBOX,(PROPOPT_CHECKBOX|opt),(LPARAM)NULL} +#define PropData_DirCtrl(id,name,info,param) {id,name,info,PROPTYPE_DIRCTRL,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_DirCtrl_Check(id,name,info,param) {id,name,info,PROPTYPE_DIRCTRL,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_DirCtrl_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_DIRCTRL,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_Filename(id,name,info,param) {id,name,info,PROPTYPE_FILENAME,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_Filename_Check(id,name,info,param) {id,name,info,PROPTYPE_FILENAME,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_Filename_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_FILENAME,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_PictureFilename(id,name,info,param) {id,name,info,PROPTYPE_PICTUREFILENAME,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_PictureFilename_Check(id,name,info,param) {id,name,info,PROPTYPE_PICTUREFILENAME,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_PictureFilename_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_PICTUREFILENAME,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_Font(id,name,info,param) {id,name,info,PROPTYPE_FONT,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_Font_Check(id,name,info,param) {id,name,info,PROPTYPE_FONT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_Font_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_FONT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_Custom(id,name,info,param) {id,name,info,PROPTYPE_CUSTOM,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_Custom_Check(id,name,info,param) {id,name,info,PROPTYPE_CUSTOM,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_Custom_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_CUSTOM,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_ComboBoxBtn(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOXBTN,PROPOPT_PARAMREQUIRED,(LPARAM)list} +#define PropData_ComboBoxBtn_Check(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOXBTN,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} +#define PropData_ComboBoxBtn_Opt(id,name,info,opt,list) {id,name,info,PROPTYPE_COMBOBOXBTN,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} +#define PropData_ImageList(id,name,info) {id,name,info,PROPTYPE_IMAGELIST,0,NULL} +#define PropData_ImageList_Check(id,name,info) {id,name,info,PROPTYPE_IMAGELIST,PROPOPT_CHECKBOX,NULL} +#define PropData_ImageList_Opt(id,name,info,opt) {id,name,info,PROPTYPE_IMAGELIST,opt,NULL} +#define PropData_IconComboBox(id,name,info,list) {id,name,info,PROPTYPE_ICONCOMBOBOX,PROPOPT_PARAMREQUIRED,(LPARAM)list} +#define PropData_IconComboBox_Check(id,name,info,list) {id,name,info,PROPTYPE_ICONCOMBOBOX,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} +#define PropData_IconComboBox_Opt(id,name,info,opt,list) {id,name,info,PROPTYPE_ICONCOMBOBOX,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} +#define PropData_URLButton(id,name,info,url) {id,name,info,PROPTYPE_URLBUTTON,PROPOPT_PARAMREQUIRED, (LPARAM)url} +#define PropData_URLButton_Check(id,name,info,url) {id,name,info,PROPTYPE_URLBUTTON,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)url} +#define PropData_URLButton_Opt(id,name,info,opt,url) {id,name,info,PROPTYPE_URLBUTTON,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)url} +#define PropData_DirectoryName(id,name,info,param) {id,name,info,PROPTYPE_DIRECTORYNAME,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_DirectoryName_Check(id,name,info,param) {id,name,info,PROPTYPE_DIRECTORYNAME,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_DirectoryName_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_DIRECTORYNAME,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_SpinEditFloat(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT,PROPOPT_PARAMREQUIRED,(LPARAM)minmaxdelta} +#define PropData_SpinEditFloat_Check(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmaxdelta} +#define PropData_SpinEditFloat_Opt(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmaxdelta} +#define PropData_End() {0} + +///////////////////////////////// +// Property definition parameters +///////////////////////////////// + +// Parameter for slider & spin property items +typedef struct { + int nMinValue; // Minimum value (note: cannot be less than -32768 for SpinEdit property) + int nMaxValue; // Maximum value (note: cannot be greater than 32767 for SpinEdit property) +} MinMaxParam; +typedef MinMaxParam* LPMINMAXPARAM; + +// Parameter for floating point slider & spin property items +typedef struct { + float fMinValue; // Minimum value (e.g. 0.0f) + float fMaxValue; // Maximum value (e.g. 1.0f) + float fDelta; // Delta value (e.g. 0.01f) +} MinMaxFloatParam; +typedef MinMaxFloatParam* LPMINMAXFLOATPARAM; + +// Direction Control Styles +enum +{ + DCS_NOBORDER = 0, // No border + DCS_FLAT = 1, // Flat + DCS_3D = 2, // 3D + DCS_SLIDER = 4, // Slider to change the number of directions + DCS_EMPTY = 8, // ??? should affect the appearance of direction spots... + DCS_SETALL_BTNS = 16, // "Select All" and "Reset" buttons +}; + +// Initialization structure for direction property +typedef struct { + BOOL bMultiSel; // TRUE for multi-selection + int numDirs; // Number of directions: 4,8,16,32 + DWORD style; // Style DCS_NOBORDER, DCS_FLAT, DCS_3D, [DCS_SLIDER,] DCS_EMPTY, DCS_SETALL_BTNS +} DirCtrlCreateParam; + +// Direction Property Value +typedef struct { + int selDir; // Direction index, single selection mode + DWORD selDir32; // 32-bit direction mask, multi-selection mode + int numDirs; // Number of directions (4, 8, 16 or 32) + int reserved; // Not used +} PropDirValue; + +// Initialization structure for file selector property +typedef struct { + LPCSTR extFilter; // Filter string for GetOpenFilename dialog (for example "All Files (*.*)|*.*|") + DWORD options; // Options for GetOpenFilename dialog (OFN_FILEMUSTEXIST, OFN_PATHMUSTEXIST, OFN_HIDEREADONLY, etc.) +} FilenameCreateParam; + +//////////////////////////////////////////////// +// +// MMF property identifier +// + +////////// +// Tab IDs +////////// +// +enum { + PROPID_TAB_GENERAL=1, + PROPID_TAB_DISPLAY, + PROPID_TAB_WINDOW, + PROPID_TAB_SIZEPOS, + PROPID_TAB_TEXTOPT, + PROPID_TAB_MOVEMENT, + PROPID_TAB_RUNOPT, + PROPID_TAB_VALUES, + PROPID_TAB_EVENTS, + PROPID_TAB_ABOUT, + PROPID_TAB_BLURAY, + PROPID_TAB_IPHONE, + PROPID_TAB_ANDROID, + PROPID_TAB_XNA, + PROPID_TAB_MAC, + PROPID_TAB_CUSTOM1 = 18, + PROPID_TAB_CUSTOM2, + PROPTAB_MAX // 20 +}; + +/////////////// +// Property IDs +////////// +// +// If you need them, you can retrieve, set or refresh +// standard properties with the mvSetPropValue, etc. macros +// and the following identifiers. +// + +// Objects +enum { + PROPID_ITEM_FIRST = 20, + PROPID_ITEM_NAME, + PROPID_ITEM_ICON, + PROPID_ITEM_HELP, + PROPID_ITEM_LAST, + + PROPID_FII_FIRST = 180, + PROPID_FII_POS, // Those properties are not available if the frame editor is not open + PROPID_FII_X, + PROPID_FII_Y, + PROPID_FII_SIZE, + PROPID_FII_CX, + PROPID_FII_CY, + PROPID_FII_ROT, + PROPID_FII_ANGLE, + PROPID_FII_LAST, + + PROPID_FITEM_FIRST=200, + PROPID_FITEM_INKFXFOLDER, + PROPID_FITEM_TRANSPARENT, + PROPID_FITEM_INKFX, + PROPID_FITEM_INKFXPARAM, + PROPID_FITEM_ANTIA, + PROPID_FITEM_MEMORYFOLDER, + PROPID_FITEM_GLOBAL, + PROPID_FITEM_LOADONCALL, + PROPID_FITEM_OPTIONS, + PROPID_FITEM_RGBCOEF, + PROPID_FITEM_BLENDCOEF, + PROPID_FITEM_IMAGECOMPRESSION, + PROPID_FITEM_GLOBAL_EDITORSYNCHRO, + PROPID_FITEM_LAST=249, + + PROPID_DYNITEM_FIRST=250, + + PROPID_DYNITEM_TRANSITIONS=250, + PROPID_DYNITEM_FADEIN, + PROPID_DYNITEM_FADEOUT, + PROPID_DYNITEM_OBSTACLE, + PROPID_DYNITEM_OBSTACLETYPE, + PROPID_DYNITEM_AUTOROTATEGROUP, + PROPID_DYNITEM_AUTOROTATE, + + PROPID_MVT_FIRST=300, + PROPID_DYNITEM_MVTFOLDER, + PROPID_DYNITEM_MVTLIST, + PROPID_DYNITEM_MVTTYPE, + PROPID_DYNITEM_INITDIR, + PROPID_DYNITEM_TRYMVT, + PROPID_DYNITEM_SPEEDFOLDER, + PROPID_DYNITEM_SPEED, + PROPID_DYNITEM_DECEL, + PROPID_DYNITEM_ACCEL, + PROPID_DYNITEM_MOVEATSTART, + PROPID_DYNITEM_BOUNCEFOLDER, + PROPID_DYNITEM_NANGLES, + PROPID_DYNITEM_RANDOMIZER, + PROPID_DYNITEM_SECURITY, + PROPID_DYNITEM_EDITMVT, + PROPID_DYNITEM_PLAYER, + PROPID_DYNITEM_DIRS, + PROPID_DYNITEM_ENABLEREVERSE, + PROPID_DYNITEM_ROTATION, + PROPID_DYNITEM_ROTSPEED, + PROPID_DYNITEM_JUMP, + PROPID_DYNITEM_GRAVITY, + PROPID_DYNITEM_JUMPSTRENGTH, + PROPID_DYNITEM_JUMPCONTROL, + PROPID_DYNITEM_MVTHELP, + PROPID_DYNITEM_8DIR_STICKOBST, + PROPID_MVT_LAST, + + PROPID_DYNITEM_ALTVALUES_GROUP=350, + PROPID_DYNITEM_ALTSTRINGS_GROUP, + PROPID_DYNITEM_QUALIF, + PROPID_DYNITEM_DISPLAY, + PROPID_DYNITEM_VISIBLEATSTART, + PROPID_DYNITEM_DISPLAYASBKD, + PROPID_DYNITEM_BKDFOLDER, + PROPID_DYNITEM_SAVEBKD, + PROPID_DYNITEM_WIPEWITHCOLOR, + PROPID_DYNITEM_CREATEBEFOREFADEIN, + PROPID_DYNITEM_SCROLLING, + PROPID_DYNITEM_FOLLOWFRAME, + PROPID_DYNITEM_DESTROYIFTOOFAR, + PROPID_DYNITEM_INACTIVATEIFTOOFAR, + PROPID_DYNITEM_COLLISIONS, + PROPID_DYNITEM_FINECOLL, + PROPID_DYNITEM_BEHAVIOR_HDR, + PROPID_DYNITEM_BEHAVIOR_END, + PROPID_DYNITEM_CREATE, + PROPID_DYNITEM_CREATEATSTART, + PROPID_DYNITEM_BACKCOLOROPACITY, + + PROPID_TEXT_FIRST=380, + PROPID_TEXT_FONT, + PROPID_TEXT_FACENAME, + PROPID_TEXT_SIZE, + PROPID_TEXT_BOLD, + PROPID_TEXT_ITALIC, + PROPID_TEXT_UNDERLINE, + PROPID_TEXT_STRIKEOUT, + PROPID_TEXT_COLOR, + PROPID_TEXT_ALIGNGROUP, + PROPID_TEXT_HALIGN, + PROPID_TEXT_VALIGN, + PROPID_TEXT_RTL, + PROPID_TEXT_LAST, + + PROPID_DYNITEM_LAST, + + PROPID_EXTITEM_FIRST=400, + PROPID_EXTITEM_EDIT, + PROPID_EXTITEM_ABOUT, + PROPID_EXTITEM_NAME, + PROPID_EXTITEM_AUTHOR, + PROPID_EXTITEM_COPYRIGHT, + PROPID_EXTITEM_COMMENT, + PROPID_EXTITEM_WEBSITE, + PROPID_EXTITEM_FILENAME, + PROPID_EXTITEM_LAST, + + PROPID_DYNITEM_ALTVALUE_FIRST=0x50000, + PROPID_DYNITEM_ALTVALUE_LAST =0x50019, + + PROPID_DYNITEM_ALTSTRING_FIRST=0x50800, + PROPID_DYNITEM_ALTSTRING_LAST =0x50809, + + PROPID_DYNITEM_BEHAVIOR_FIRST=0x51000, + PROPID_DYNITEM_BEHAVIOR_LAST =0x51FFF, + + PROPID_MVTEXT_FIRST=0x52000, + PROPID_MVTEXT_LAST =0x52FFF, + + PROPID_FADE_PARAM_FIRST=0x53000, + PROPID_FADE_PARAM_LAST =0x53FFF, + + PROPID_FITEM_FXPARAM_FIRST=0x54000, + PROPID_FITEM_FXPARAM_LAST=0x54FFF, + + // Extensions must use property identifiers between PROPID_EXTITEM_CUSTOM_FIRST and PROPID_EXTITEM_CUSTOM_LAST + PROPID_EXTITEM_CUSTOM_FIRST=0x80000, + PROPID_EXTITEM_CUSTOM_LAST =0xFFFFF, +}; + +// Application +enum { + PROPID_APP_FIRST = 50, + PROPID_APP_ABOUT, + PROPID_APP_AUTHOR, + PROPID_APP_DESCRIPTION, + PROPID_APP_COPYRIGHT, + PROPID_APP_COMPANY, + PROPID_APP_FILEVERSION, + PROPID_APP_ICON, + PROPID_APP_WINDOWSIZE, + PROPID_APP_WINDOWBACKGROUNDCOLOR, + PROPID_APP_WINDOWSTYLE, + PROPID_APP_HEADING, + PROPID_APP_HEADINGMAX, + PROPID_APP_MENU, + PROPID_APP_MENUBAR, + PROPID_APP_MENUBOOTUP, + PROPID_APP_NOMINIMIZEBOX, + PROPID_APP_NOMAXIMIZEBOX, + PROPID_APP_NOTHICKFRAME, + PROPID_APP_MAXIMIZEDONBOOTUP, + PROPID_APP_HIDDENATSTART, + PROPID_APP_DISABLECLOSE, + PROPID_APP_OPTIONS, + PROPID_APP_FULLSCREEN, + PROPID_APP_FULLSWITCH, + PROPID_APP_RESIZETOWINDOWSIZE, + PROPID_APP_DONOTCENTERFRAME, + PROPID_APP_MACHINEINDEP, + PROPID_APP_SCREENSAVER_NOAUTOSTOP, + PROPID_APP_SOUNDOPT, + PROPID_APP_MULTISAMPLE, + PROPID_APP_SOUNDSOVERFRAMES, + PROPID_APP_SAMPLESEVENIFNOTFOCUS, + PROPID_APP_DISPOPT, + PROPID_APP_DISPLAYMODE, + PROPID_APP_ENABLEVISUALTHEMES, + PROPID_APP_PLAYERS, + PROPID_APP_INITSCORE, + PROPID_APP_INITLIVES, + PROPID_APP_FILENAME, + PROPID_APP_HELP, + PROPID_APP_HELPFILE, + PROPID_APP_PLAYERCTRLS, + PROPID_APP_VTZ, + PROPID_APP_VTZPREVIEWFILE, + PROPID_APP_GLOBALVALUE_GROUP, + PROPID_APP_GLOBALSTRING_GROUP, + PROPID_APP_GLOBALEVENTS, + PROPID_APP_BUILD, + PROPID_APP_BUILDTYPE, + PROPID_APP_INSTALLSETTINGS, + PROPID_APP_BUILDFILE, + PROPID_APP_BUILDOPT, + PROPID_APP_COMPLEVEL, + PROPID_APP_COMPSND, + PROPID_APP_ALLINONE, + PROPID_APP_FRAMERATE, + PROPID_APP_VSYNC, + PROPID_APP_RUNWHENMINIMIZED, + PROPID_APP_RUNOPTGROUP, + PROPID_APP_RUNCMDLINE, + PROPID_APP_MDI, + PROPID_APP_WINMENUIDX, + PROPID_APP_ABOUTTEXT, + PROPID_APP_RUNWHILERESIZING, + PROPID_APP_DEBUGGERSHORTCUTS, + PROPID_APP_GRAPHICS, + PROPID_APP_GRAPHICMODE, + PROPID_APP_IMAGEFILTERS, + PROPID_APP_SOUNDFILTERS, + PROPID_APP_SHOWDEBUGGER, + PROPID_APP_COMPRUNTIME, + PROPID_APP_DONOTSHAREDATA, + PROPID_APP_VTZONLYFROMURL, + PROPID_APP_VTZENABLESCRIPT, + PROPID_APP_VISTAOPT, + PROPID_APP_EXECLEVEL, + PROPID_APP_VTZONLY, + PROPID_APP_BUILDJARURL, + PROPID_APP_WNDTRANSP, + PROPID_APP_BRBUILDDIR, + PROPID_APP_LOADANIM_GROUP, + PROPID_APP_LOADANIM_IMAGE, + PROPID_APP_LOADANIM_NIMAGES, + PROPID_APP_BRBUILDFILE, + PROPID_APP_BRUSEMOSAIC, + PROPID_APP_BRGRAPHICSINJAR, + PROPID_APP_BRSIGNED, + PROPID_APP_BRORGID, + PROPID_APP_BRAPPID, + PROPID_APP_BRSGACT, + PROPID_APP_BRSGKEYSTORE, + PROPID_APP_BRSGKEYSTOREPW, + PROPID_APP_BRSGKEY, + PROPID_APP_BRSGKEYPW, + PROPID_APP_BRBACKSURFACE, + PROPID_APP_BRGRAPHICS_GROUP, + PROPID_APP_BRSIGNING_GROUP, + PROPID_APP_BRLOADOPTIONS_GROUP, + PROPID_APP_BRLOADALLIMAGESATSTART, + PROPID_APP_BRLOADALLSOUNDSATSTART, + PROPID_APP_BRSOUNDS_GROUP, + PROPID_APP_BREXTERNALSOUNDS, + PROPID_APP_BUILDDIR, + PROPID_APP_FULLSCREENGROUP, + PROPID_APP_KEEPSCREENRATIO, + PROPID_APP_SCREENRATIOTOLERANCE, + PROPID_APP_BRBUILDDIR2, + PROPID_APP_RESAMPLESTRETCH, + PROPID_APP_GLOBALREFRESH, + PROPID_APP_FLASH_MOCHIADS_GROUP, + PROPID_APP_FLASH_MOCHIADS, + PROPID_APP_FLASH_MOCHIADS_GAMEID, + PROPID_APP_FLASH_MOCHIADS_START, + PROPID_APP_FLASH_MOCHIADS_END, + PROPID_APP_LANGUAGE, + PROPID_APP_SCREENROTATION, + PROPID_APP_FLASH_PRELOADER_GROUP, + PROPID_APP_FLASH_PRELOADER, + PROPID_APP_FLASH_PRELOADER_FILENAME, + PROPID_APP_FLASH_PRELOADER_PGB_X, + PROPID_APP_FLASH_PRELOADER_PGB_Y, + PROPID_APP_FLASH_PRELOADER_PGB_RADIUS, + PROPID_APP_FLASH_PRELOADER_PGB_THICKNESS, + PROPID_APP_FLASH_PRELOADER_PGB_COLOR, + PROPID_APP_FLASH_PRELOADER_BACK_COLOR, + PROPID_APP_MP3_GROUP, + PROPID_APP_MP3_FORCEFREQ, + PROPID_APP_MP3_BITRATE, + PROPID_APP_MP3_ENCODER, + PROPID_APP_FLASH_MOCHIADS_SIGNUP, + PROPID_APP_FLASH_PRELOADERTYPE, + PROPID_APP_FLASH_EMBEDDEDFONTS_GROUP, + PROPID_APP_FLASH_EMBEDDEDFONTS, + PROPID_APP_IPHONE_GROUP, + PROPID_APP_IPHONE_ORIENTATION, + PROPID_APP_RTL, + PROPID_APP_IPHONEBUNDLEID, + PROPID_APP_IPHONETEXTURECOMPRESSION, + PROPID_APP_IPHONEMULTITASK, + PROPID_APP_IPHONEIMAGES_GROUP, + PROPID_APP_IPHONEAPPICON_IPHONE, + PROPID_APP_IPHONELAUNCHIMAGE_IPHONE, + PROPID_APP_IPHONEITUNEARTWORK, + PROPID_APP_ANDROIDKEYSTORE, + PROPID_APP_ANDROIDKEYNAME, + PROPID_APP_ANDROIDRELEASE, + PROPID_APP_ANDROIDPACKAGENAME, + PROPID_APP_ANDROIDIMAGES_GROUP, + PROPID_APP_ANDROIDLAUNCHERICON, + PROPID_APP_ANDROIDMENUICON, + PROPID_APP_ANDROIDTESTMODE, + PROPID_APP_ANDROIDEMULATORS, + PROPID_APP_IPHONESTATUSLINE, + PROPID_APP_RTLLAYOUT, + PROPID_APP_IPHONEIAD_GROUP, + PROPID_APP_IPHONEENABLEIAD, + PROPID_APP_IPHONEIADBOTTOM, + PROPID_APP_OPTIONAL_MODULES, + PROPID_APP_ANDROIDVERSION, + PROPID_APP_IPHONEBUNDLEVERSION, + PROPID_APP_IPHONETARGETDEVICE, + PROPID_APP_IPHONEARCHITECTURE, + PROPID_APP_IPHONEAPPICON_IPAD, + PROPID_APP_IPHONELAUNCHIMAGE_IPAD, + PROPID_APP_XNAPROJECTPATH, + PROPID_APP_XNAPROJECTNAME, + PROPID_APP_XNASTATUSLINE, + PROPID_APP_XNAFONT_GROUP, + PROPID_APP_XNAFONT_FIRSTCHAR, + PROPID_APP_XNAFONT_LASTCHAR, + PROPID_APP_JOYSTICKIMAGES, + PROPID_APP_ANDROIDSTATUSLINE, + PROPID_APP_BUILDTYPE_REAL, + PROPID_APP_ANDROID_PERMS, + PROPID_APP_ANDROIDDISABLEBACKBUTTON, + PROPID_APP_IPHONEANTIALIAS, + PROPID_APP_ANDROID_AUTOEND, + PROPID_APP_ANDROIDCRASHREPORTING, + PROPID_APP_FLASH_TARGETPLAYER, + PROPID_APP_BUILDWARNINGS, + PROPID_APP_XNAADS, + PROPID_APP_XNAPUBCENTERID, + PROPID_APP_LAST, + + PROPID_APP_ANDROID_PERM_FIRST = 90001, + PROPID_APP_ANDROID_PERM_LAST = 90105, + + PROPID_APP_GLOBALVALUE_FIRST = 100000, + PROPID_APP_GLOBALVALUE_LAST = 199998, + + PROPID_APP_GLOBALSTRING_FIRST = 200000, + PROPID_APP_GLOBALSTRING_LAST = 299998, + +}; + +// Frame +enum { + PROPID_FRAME_FIRST = 100, + PROPID_FRAME_FRAME, + PROPID_FRAME_SIZE, + PROPID_FRAME_BACKGROUNDCOLOR, + PROPID_FRAME_PALETTE, + PROPID_FRAME_RUNOPT, + PROPID_FRAME_GRABDESKTOP, + PROPID_FRAME_KEEPDISPLAY, + PROPID_FRAME_TOTALCOLMASK, + PROPID_FRAME_FRAMETITLEINCAPTION, + PROPID_FRAME_RESIZETOSCREENSIZE, + PROPID_FRAME_FORCELOADONCALL, + PROPID_FRAME_NOBJECTS, + PROPID_FRAME_PASSWORD, + PROPID_FRAME_TRANSITIONS, + PROPID_FRAME_FADEIN, + PROPID_FRAME_FADEOUT, + PROPID_FRAME_NOSURFACE, + PROPID_FRAME_SCRSETUP, + PROPID_FRAME_VIRTUALRIGHT, + PROPID_FRAME_VIRTUALBOTTOM, + PROPID_FRAME_DEMO, + PROPID_FRAME_DEMOFILENAME, + PROPID_FRAME_RECORD, + PROPID_FRAME_RANDOMSEED, + PROPID_FRAME_WNDTRANSP, + PROPID_FRAME_KEYRELEASETIME, + PROPID_FRAME_TIMEDMVTS, + PROPID_FRAME_TIMEDMVTSBASE, + PROPID_FRAME_FLASH_MOCHIADS_INTER, + PROPID_FRAME_GLOBALEVENTS, + PROPID_FRAME_IPHONE_JOYSTICK_GROUP, + PROPID_FRAME_IPHONE_JOYSTICK_TYPE, + PROPID_FRAME_IPHONE_JOYSTICK_FIRE1, + PROPID_FRAME_IPHONE_JOYSTICK_FIRE2, + PROPID_FRAME_IPHONE_JOYSTICK_LEFTHAND, + PROPID_FRAME_IPHONE_GROUP, + PROPID_FRAME_IPHONE_TOUCHMODE, + PROPID_FRAME_DISABLEIDLETIMER, + PROPID_FRAME_IPHONEIAD_GROUP, + PROPID_FRAME_IPHONEIAD, + PROPID_FRAME_LAST, +}; + +#endif // MMF2_Props_h diff --git a/Inc/Surface.h b/Inc/Surface.h index a1ecb4c..29e8a64 100644 --- a/Inc/Surface.h +++ b/Inc/Surface.h @@ -1,697 +1,697 @@ -////////////////////////////////////////////////////////////////////////////// -// -// cSurface class -// - -#ifndef _Surface_h -#define _Surface_h - -#include "Fill.h" -#include "Palet.h" -#include "SurfaceDefs.h" - -// Convention : SfSrc.FilterBlit(SfDest, MyCallBack, param) -// ========== will call MyCallBack(pixelDest, pixelSrc, param) - -typedef COLORREF (CALLBACK * FILTERBLITPROC)(COLORREF, COLORREF, DWORD); -typedef COLORREF (CALLBACK * MATRIXFILTERBLITPROC)(COLORREF FAR *, COLORREF FAR *, DWORD); - -// Display mode -typedef struct DisplayMode { - int mcx; - int mcy; - int mDepth; -// int mNearestBitCount; -// int mDriver; -} DisplayMode; - -typedef BOOL (CALLBACK * LPENUMSCREENMODESPROC)(DisplayMode*, LPVOID); - -#ifdef HWABETA -// Lost device callback function -typedef void (CALLBACK * LOSTDEVICECALLBACKPROC)(cSurface*, LPARAM); -#endif - -// System colors -#ifndef COLOR_GRADIENTINACTIVECAPTION -#define COLOR_GRADIENTINACTIVECAPTION 28 -#endif - -// Forwards -class FAR cSurface; -class FAR cSurfaceImplementation; -class FAR CFillData; -class FAR CInputFile; - -// Types -typedef cSurface FAR * LPSURFACE; - -// Blit modes -typedef enum { - BMODE_OPAQUE, - BMODE_TRANSP, - BMODE_MAX -} BlitMode; - -// Blit operations -typedef enum { - BOP_COPY, // None - BOP_BLEND, // dest = ((dest * coef) + (src * (128-coef)))/128 - BOP_INVERT, // dest = src XOR 0xFFFFFF - BOP_XOR, // dest = src XOR dest - BOP_AND, // dest = src AND dest - BOP_OR, // dest = src OR dest - BOP_BLEND_REPLACETRANSP, // dest = ((dest * coef) + ((src==transp)?replace:src * (128-coef)))/128 - BOP_DWROP, - BOP_ANDNOT, - BOP_ADD, - BOP_MONO, - BOP_SUB, - BOP_BLEND_DONTREPLACECOLOR, - BOP_EFFECTEX, - BOP_MAX, - BOP_MASK = 0xFFF, - BOP_RGBAFILTER = 0x1000, -} BlitOp; - -#define ALPHATOSEMITRANSP(a) ((a==0) ? 128:(255-a)/2) -#define SEMITRANSPTOALPHA(s) ((s==128) ? 0:(255-s*2)) - -typedef DWORD RGBAREF; -#define COLORREFATORGBA(c,a) ((c & 0x00FFFFFF) | (a << 24)) - -// Surface capabilities -typedef enum -{ - // Capabilities - SC_GETPIXEL, - SC_SETPIXEL, - SC_FILL, - SC_DRAW, - SC_ROTATE, - SC_STRETCH, - SC_MAX -} SurfaceCap; - -// SetPalette actions -typedef enum -{ - SPA_NONE, // Just update palette - SPA_REMAPSURFACE, // remap current surface pixels to new palette - SPA_MAX -} SetPaletteAction; - -// Surface types -enum -{ - ST_MEMORY, // Buffer only - ST_MEMORYWITHDC, // Buffer + DC (i.e. DIBSection, DDRAW surface, etc... - ST_MEMORYWITHPERMANENTDC, // Buffer + permanent DC (i.e. DIBDC) - ST_DDRAW_SYSTEMMEMORY, // Surface Direct Draw en mémoire systeme - ST_HWA_SCREEN, // Screen surface in HWA mode - ST_HWA_RTTEXTURE, // Render target texture in HWA mode - ST_HWA_ROUTEXTURE, // HWA texture created in video memory, unmanaged (lost when device is lost) - ST_HWA_ROMTEXTURE, // HWA texture created in video memory, managed (automatically reloaded when the device is lost) - ST_MAX -}; - -// Drivers for memory + DC surfaces -enum -{ - SD_DIB, // DIB (standard driver: DIBSection) - SD_WING, // WinG - SD_DDRAW, // Direct Draw - SD_BITMAP, // Win 3.1 bitmap - SD_3DFX, // 3DFX - SD_D3D9, // Direct3D9 - SD_D3D8, // Direct3D8 - SD_MAX -}; - -typedef enum // Warning, bit mask, not enumeration! -{ - LI_NONE=0x0000, - LI_REMAP=0x0001, - LI_CHANGESURFACEDEPTH=0x0002, - LI_DONOTNORMALIZEPALETTE = 0x0004 // do not normalize palette -} LIFlags; - -typedef enum -{ - SI_NONE=0x0000, - SI_ONLYHEADER=0x0001, - SI_SAVEALPHA=0x0002 -} SIFlags; - -enum { - LBF_DONOTCHANGESURFACEDEPTH = 0x0001 -}; - -// Blilt options -enum { - BLTF_ANTIA = 0x0001, // Anti-aliasing - BLTF_COPYALPHA = 0x0002, // Copy alpha channel to destination alpha channel instead of applying it -#ifdef HWABETA - BLTF_SAFESRC = 0x0010, - BLTF_TILE = 0x0020 -#endif -}; - -// Stretch & BlitEx options -enum { - STRF_RESAMPLE = 0x0001, // Resample bitmap - STRF_RESAMPLE_TRANSP = 0x0002, // Resample bitmap, but doesn't resample the transparent color - STRF_COPYALPHA = 0x0004, // Copy (stretch) alpha channel to destination alpha channel instead of applying it -#ifdef HWABETA - STRF_SAFESRC = 0x0010, - STRF_TILE = 0x0020 -#endif -}; - - -// Transparent monochrome mask for collisions -typedef struct sMask -{ - int mkSize; - int mkWidth; - int mkHeight; - UINT mkWidthBytes; - int mkXSpot; - int mkYSpot; - DWORD mkFlags; - RECT mkRect; -} sMask; -typedef sMask *LPSMASK; - -#define SCMF_FULL 0x0000 -#define SCMF_PLATFORM 0x0001 - -#ifndef PI -#define PI ((double)3.141592653589) -#endif - -// Allocate/Free surface -SURFACES_API LPSURFACE WINAPI NewSurface(); -SURFACES_API void WINAPI DeleteSurface(LPSURFACE pSurf); - -// Get surface prototype -SURFACES_API BOOL WINAPI GetSurfacePrototype (LPSURFACE FAR *proto, int depth, int st, int drv); - -// DIB -SURFACES_API DWORD WINAPI GetDIBHeaderSize(int depth); -SURFACES_API DWORD WINAPI GetDIBWidthBytes ( int width, int depth ); -SURFACES_API DWORD WINAPI GetDIBSize ( int width, int height, int depth ); -SURFACES_API LPBYTE WINAPI GetDIBBitmap ( LPBITMAPINFO pBmi ); - -// cSurface class -class SURFACES_API cSurface -{ - public: - // ====================== - // Creation / Destruction - // ====================== - cSurface(); - ~cSurface(); - - // Init - static void InitializeSurfaces(); - static void FreeSurfaces(); -#ifdef HWABETA - static void FreeExternalModules(); -#endif - - // Operators - cSurface FAR & operator= (const cSurface FAR & source); - - // Create surface implementation from surface prototype - void Create (int width, int height, LPSURFACE prototype); - - // Create pure DC surface from DC - void Create (HDC hDC); - - // Create pure DC surface from a window - void Create (HWND hWnd, BOOL IncludeFrame); - - // Create screen surface (fullscreen mode) - BOOL CreateScreenSurface(); - BOOL IsScreenSurface(); - - // Valid? - BOOL IsValid (); - - // Get driver & type - int GetType(); - int GetDriver(); - DWORD GetDriverInfo(LPVOID pInfo); - - // Clone surface (= create with same size + Blit) - void Clone (const cSurface FAR & pSrcSurface, int newW = -1, int newH = -1); - - // Delete surface implementation (before to create another one) - void Delete(); - - // ====================== - // Error codes - // ====================== - int GetLastError(void); - - // ====================== - // Surface info - // ====================== - int GetWidth(void) const; - int GetHeight(void) const; - int GetDepth(void) const; - BOOL GetInfo(int FAR & width, int FAR & height, int FAR & depth) const; - - // ====================== - // Surface coordinate management - // ====================== - - void SetOrigin(int x, int y); - void SetOrigin(POINT c); - - void GetOrigin(POINT FAR &pt); - void GetOrigin(int FAR & x, int FAR & y); - - void OffsetOrigin(int dx, int dy); - void OffsetOrigin(POINT delta); - - // ====================== - // Raster operations - // ====================== - LPBYTE LockBuffer(); - void UnlockBuffer(LPBYTE spBuffer); - int GetPitch() const; - - // ====================== - // Double-buffer handling - // ====================== - void SetCurrentDevice(); - int BeginRendering(BOOL bClear, RGBAREF dwRgba); - int EndRendering(); - BOOL UpdateScreen(); -#ifdef HWABETA - cSurface* GetRenderTargetSurface(); - void ReleaseRenderTargetSurface(cSurface* psf); - void Flush(BOOL bMax); - void SetZBuffer(float z2D); -#endif - - // ====================== - // Device context for graphic operations - // ====================== - HDC GetDC(void); - void ReleaseDC(HDC dc); - void AttachWindow (HWND hWnd); - - // ====================== - // Clipping - // ====================== - void GetClipRect(int FAR & x, int FAR & y, int FAR & w, int FAR & h); - void SetClipRect(int x, int y, int w, int h); - void ClearClipRect(void); - - // ====================== - // LoadImage (DIB format) / SaveImage (DIB format) - // ====================== - #undef LoadImage - - BOOL LoadImageA (HFILE hf, DWORD lsize, LIFlags loadFlags = LI_NONE); - BOOL LoadImageA (LPCSTR fileName, LIFlags loadFlags = LI_NONE); -#ifdef _WINDOWS - BOOL LoadImageA (HINSTANCE hInst, int bmpID, LIFlags loadFlags = LI_NONE); -#endif // _WINDOWS - BOOL LoadImageA (LPBITMAPINFO pBmi, LPBYTE pBits = NULL, LIFlags loadFlags = LI_NONE); - - BOOL LoadImageW (HFILE hf, DWORD lsize, LIFlags loadFlags = LI_NONE); - BOOL LoadImageW (LPCWSTR fileName, LIFlags loadFlags = LI_NONE); -#ifdef _WINDOWS - BOOL LoadImageW (HINSTANCE hInst, int bmpID, LIFlags loadFlags = LI_NONE); -#endif // _WINDOWS - BOOL LoadImageW (LPBITMAPINFO pBmi, LPBYTE pBits = NULL, LIFlags loadFlags = LI_NONE); - - #ifdef _UNICODE - #define LoadImage LoadImageW - #else - #define LoadImage LoadImageA - #endif - - BOOL SaveImage (HFILE hf, SIFlags saveFlags = SI_NONE); - BOOL SaveImage (LPCSTR fileName, SIFlags saveFlags = SI_NONE); - BOOL SaveImage (LPCWSTR fileName, SIFlags saveFlags = SI_NONE); - BOOL SaveImage (LPBITMAPINFO pBmi, LPBYTE pBits, SIFlags saveFlags = SI_NONE); - - DWORD GetDIBSize (); - - // ====================== - // Pixel functions - // ====================== - // Set pixel - void SetPixel(int x, int y, COLORREF c); - void SetPixel(int x, int y, BYTE R, BYTE G, BYTE B); - void SetPixel(int x, int y, int index); - - // Faster: assume clipping is done, the origin is at (0,0) and the surface is locked - void SetPixelFast(int x, int y, COLORREF c); - void SetPixelFast8(int x, int y, int index); - - // Get pixel - BOOL GetPixel(int x, int y, COLORREF FAR & c) const; - BOOL GetPixel(int x, int y, BYTE FAR & R, BYTE FAR & G, BYTE FAR & B) const; - BOOL GetPixel(int x, int y, int FAR & index) const; - - // Faster: assume clipping is done, the origin is at (0,0) and the surface is locked - COLORREF GetPixelFast(int x, int y); - int GetPixelFast8(int x, int y); - - // ====================== - // Blit functions - // ====================== - // Blit surface to surface - BOOL Blit(cSurface FAR & dest) const; - - BOOL Blit(cSurface FAR & dest, int destX, int destY, - BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, - DWORD dwBlitFlags = 0) const; - - // Blit rectangle to surface - BOOL Blit(cSurface FAR & dest, int destX, int destY, - int srcX, int srcY, int srcWidth, int srcHeight, - BlitMode bm /*= BMODE_OPAQUE*/, BlitOp bo = BOP_COPY, LPARAM param = 0, - DWORD dwBlitFlags = 0) const; - - // Extended blit : can do stretch & rotate at the same time - // Only implemented in 3D mode -#ifdef HWABETA - BOOL BlitEx(cSurface FAR & dest, float dX, float dY, float fScaleX, float fScaleY, - int sX, int sY, int sW, int sH, LPPOINT pCenter, float fAngle, - BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, DWORD dwFlags = 0) const; -#endif - // Scrolling - BOOL Scroll (int xDest, int yDest, int xSrc, int ySrc, int width, int height); - - // Blit via callback - BOOL FilterBlit (cSurface FAR & dest, int destX, int destY, - int srcX, int srcY, int srcWidth, int srcHeight, - BlitMode bm, FILTERBLITPROC fbProc, LPARAM lUserParam) const; - - BOOL FilterBlit (cSurface FAR & dest, FILTERBLITPROC fbProc, - LPARAM lUserParam, BlitMode bm = BMODE_OPAQUE) const; - - // Matrix blit via callback - BOOL MatrixFilterBlit (cSurface FAR & dest, int destX, int destY, - int srcX, int srcY, int srcWidth, int srcHeight, - int mWidth, int mHeight, int mDXCenter, int mDYCenter, - MATRIXFILTERBLITPROC fbProc, LPARAM lUserParam) const; - - // Stretch surface to surface - BOOL Stretch(cSurface FAR & dest, DWORD dwFlags = 0) const; - - // Stretch surface to rectangle - BOOL Stretch(cSurface FAR & dest, int destX, int destY, int destWidth, int destHeight, - BlitMode bm /*= BMODE_OPAQUE*/, BlitOp bo = BOP_COPY, LPARAM param = 0, DWORD dwFlags = 0) const; - - // Stretch rectangle to rectangle - BOOL Stretch(cSurface FAR & dest, int destX, int destY, int destWidth, int destHeight, - int srcX, int srcY, int srcWidth, int srcHeight, - BlitMode bm /*= BMODE_OPAQUE*/, BlitOp bo = BOP_COPY, LPARAM param = 0, DWORD dwFlags = 0) const; - - // Revert surface horizontally - BOOL ReverseX(); - - // Revert rectangle horizontally - BOOL ReverseX(int x, int y, int width, int height); - - // Revert surface vertically - BOOL ReverseY(); - - // Revert rectangle vertically - BOOL ReverseY(int x, int y, int width, int height); - - // Remove empty borders - BOOL GetMinimizeRect(RECT FAR*); - BOOL Minimize(); - BOOL Minimize(RECT FAR* r); - - // ============================= - // Blit from screen or memory DC - // ============================= - - static BOOL CaptureDC(HDC srcDC,HDC dstDC,LONG srcX,LONG srcY,LONG dstX,LONG dstY,LONG srcWidth,LONG srcHeight,LONG dstWidth,LONG dstHeight,BOOL bFlushMessage,BOOL bKeepRatio); - - // ====================== - // Fill - // ====================== - - // Fill surface - BOOL Fill(COLORREF c); - BOOL Fill(CFillData FAR * fd); - BOOL Fill(int index); - BOOL Fill(int R, int G, int B); - - // Fill block - BOOL Fill(int x, int y, int w, int h, COLORREF c); - BOOL Fill(int x, int y, int w, int h, CFillData FAR * fd); - BOOL Fill(int x, int y, int w, int h, int index); - BOOL Fill(int x, int y, int w, int h, int R, int G, int B); -#ifdef HWABETA - BOOL Fill(int x, int y, int w, int h, COLORREF* pColors, DWORD dwFlags); -#endif - - // ====================== - // Geometric Primitives - // ====================== - - // 1. Simple routines : call GDI with Surface DC - // ============================================= - - BOOL Ellipse(int left, int top, int right, int bottom, int thickness = 1, COLORREF crOutl = BLACK); - - BOOL Ellipse(int left, int top, int right, int bottom, COLORREF crFill, int thickness /*= 0*/, - COLORREF crOutl /*= BLACK*/, BOOL Fill = TRUE); - - BOOL Rectangle(int left, int top, int right, int bottom, int thickness = 1, COLORREF crOutl = BLACK); - - BOOL Rectangle(int left, int top, int right, int bottom, COLORREF crFill, int thickness /*= 0*/, - COLORREF crOutl /*= BLACK*/, BOOL bFill = TRUE); - - BOOL Polygon(LPPOINT pts, int nPts, int thickness = 1, COLORREF crOutl = BLACK); - - BOOL Polygon(LPPOINT pts, int nPts, COLORREF crFill, int thickness = 0, - COLORREF crOutl = BLACK, BOOL bFill = TRUE); - - BOOL Line(int x1, int y1, int x2, int y2, int thickness = 1, COLORREF crOutl = BLACK); - - // 2. More complex but slower (variable opacity, anti-alias, custom filling, ...) - // ============================================================================== - - BOOL Ellipse(int left, int top, int right, int bottom, int thickness, CFillData FAR * fdOutl, BOOL AntiA = FALSE, - BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - BOOL Ellipse(int left, int top, int right, int bottom, CFillData FAR * fdFill, - BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - BOOL Ellipse(int left, int top, int right, int bottom, CFillData FAR * fdFill, int thickness, CFillData FAR * fdOutl, - BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, BOOL Fill = TRUE); - - BOOL Rectangle(int left, int top, int right, int bottom, int thickness, CFillData FAR * fdOutl, BOOL AntiA = FALSE, - BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - BOOL Rectangle(int left, int top, int right, int bottom, CFillData FAR * fdFill, - BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - BOOL Rectangle(int left, int top, int right, int bottom, CFillData FAR * fdFill, int thickness, CFillData FAR * fdOutl, - BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, BOOL Fill = TRUE); - - BOOL Polygon(LPPOINT pts, int nPts, int thickness, CFillData FAR * fdOutl, BOOL AntiA = FALSE, - BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - BOOL Polygon(LPPOINT pts, int nPts, CFillData FAR * fdFill, - BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - BOOL Polygon(LPPOINT pts, int nPts, CFillData FAR * fdFill, int thickness, CFillData FAR * fdOutl, - BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, BOOL Fill = TRUE); - - BOOL Line(int x1, int y1, int x2, int y2, int thickness, CFillData FAR * fdOutl, BOOL AntiA, - BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - // Filled Primitives - - BOOL FloodFill(int x, int y, int FAR & left, int FAR & top, int FAR & right, int FAR & bottom, COLORREF crFill, BOOL AntiA = FALSE, - int tol = 0, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - BOOL FloodFill(int x, int y, COLORREF crFill, BOOL AntiA = FALSE, int tol = 0, - BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - // ====================== - // Rotation - // ====================== - // Rotate surface - BOOL Rotate(cSurface FAR& dest, double a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); // radian - BOOL Rotate(cSurface FAR& dest, int a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); // degree - BOOL Rotate90(cSurface FAR& dest, BOOL b270); - - // Create rotated surface - BOOL CreateRotatedSurface (cSurface FAR& ps, double a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); - BOOL CreateRotatedSurface (cSurface FAR& ps, int a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); - -#ifdef HWABETA - static void GetSizeOfRotatedRect (int FAR *pWidth, int FAR *pHeight, float angle); -#else - static void GetSizeOfRotatedRect (int FAR *pWidth, int FAR *pHeight, int angle); -#endif - - // ====================== - // Text - // ====================== - -#undef TextOut - - int TextOutA(LPCSTR text, DWORD dwCharCount,int x,int y,DWORD alignMode,LPRECT pClipRc, COLORREF color=0, HFONT hFnt=(HFONT)NULL, BlitMode bm=BMODE_TRANSP, BlitOp=BOP_COPY, LPARAM param=0, int AntiA=0); - int TextOutW(LPCWSTR text, DWORD dwCharCount,int x,int y,DWORD alignMode,LPRECT pClipRc, COLORREF color=0, HFONT hFnt=(HFONT)NULL, BlitMode bm=BMODE_TRANSP, BlitOp=BOP_COPY, LPARAM param=0, int AntiA=0); - -#ifdef _UNICODE -#define TextOut TextOutW -#else -#define TextOut TextOutA -#endif - -#undef DrawText - - int DrawTextA(LPCSTR text, DWORD dwCharCount,LPRECT pRc, DWORD dtflags, COLORREF color=0, HFONT hFnt=(HFONT)NULL, - BlitMode bm=BMODE_TRANSP, BlitOp bo=BOP_COPY, LPARAM param=0, int AntiA=0,DWORD dwLeftMargin=0,DWORD dwRightMargin=0,DWORD dwTabSize=8); - int DrawTextW(LPCWSTR text, DWORD dwCharCount,LPRECT pRc, DWORD dtflags, COLORREF color=0, HFONT hFnt=(HFONT)NULL, - BlitMode bm=BMODE_TRANSP, BlitOp bo=BOP_COPY, LPARAM param=0, int AntiA=0,DWORD dwLeftMargin=0,DWORD dwRightMargin=0,DWORD dwTabSize=8); - -#ifdef _UNICODE -#define DrawText DrawTextW -#else -#define DrawText DrawTextA -#endif - - // ====================== - // Color / Palette functions - // ====================== - // Is transparent - BOOL IsTransparent(); - - // Replace color - BOOL ReplaceColor (COLORREF newColor, COLORREF oldColor); - - // Test collision fine entre deux surfaces - BOOL IsColliding(cSurface FAR & dest, int xDest, int yDest, int xSrc, int ySrc, int rcWidth, int rcHeight); - - // Create icon - HICON CreateIcon(int iconWidth, int iconHeight, COLORREF transpColor,POINT *pHotSpot); - - // Palette support - BOOL Indexed(void); - - BOOL SetPalette(LPLOGPALETTE palette, SetPaletteAction action=SPA_NONE); - BOOL SetPalette (LPCSPALETTE pCsPal, SetPaletteAction action=SPA_NONE); - BOOL SetPalette (cSurface FAR& src, SetPaletteAction action=SPA_NONE); - BOOL SetPalette(HPALETTE palette, SetPaletteAction action=SPA_NONE); - - void Remap(cSurface FAR& src); - void Remap(LPBYTE remapTable); - - LPCSPALETTE GetPalette(); - UINT GetPaletteEntries(LPPALETTEENTRY paletteEntry, int index, int nbColors); - - int GetNearestColorIndex(COLORREF rgb); - COLORREF GetRGB(int index); - int GetOpaqueBlackIndex(); - - // ====================== - // Full screen - // ====================== - void EnumScreenModes(LPENUMSCREENMODESPROC pProc, LPVOID lParam); - BOOL SetScreenMode(HWND hWnd, int width, int height, int depth); - void RestoreWindowedMode(HWND hWnd); - void CopyScreenModeInfo(cSurface* pSrc); - -#ifdef HWABETA - BOOL SetAutoVSync(int nAutoVSync); -#endif - BOOL WaitForVBlank(); - - // System colors - static COLORREF GetSysColor(int colorIndex); - static void OnSysColorChange(); - - // Transparent color - void SetTransparentColor(COLORREF rgb); - COLORREF GetTransparentColor(); - int GetTransparentColorIndex(); - - // Alpha channel - BOOL HasAlpha(); - LPBYTE LockAlpha(); - void UnlockAlpha(); - int GetAlphaPitch(); - void CreateAlpha(); - void SetAlpha(LPBYTE pAlpha, int nPitch); - void AttachAlpha(LPBYTE pAlpha, int nPitch); - LPBYTE DetachAlpha(LPLONG pPitch); - cSurface* GetAlphaSurface(); - void ReleaseAlphaSurface(cSurface* pAlphaSf); - - // Transparent monochrome mask - DWORD CreateMask(LPSMASK pMask, UINT dwFlags); - - // Lost device callback -#ifdef HWABETA - void OnLostDevice(); - void AddLostDeviceCallBack(LOSTDEVICECALLBACKPROC pCallback, LPARAM lUserParam); - void RemoveLostDeviceCallBack(LOSTDEVICECALLBACKPROC pCallback, LPARAM lUserParam); -#endif - - // Friend functions - // ---------------- - SURFACES_API friend cSurfaceImplementation FAR * WINAPI GetSurfaceImplementation(cSurface FAR &cs); - SURFACES_API friend void WINAPI SetSurfaceImplementation(cSurface FAR &cs, cSurfaceImplementation FAR *psi); - - protected: -#ifdef _WINDOWS - static void BuildSysColorTable(); -#endif // _WINDOWS - - // Clipping - //---------- - HRGN SetDrawClip(HDC hDC); - void RestoreDrawClip(HDC hDC,HRGN hOldClipRgn); - - // Private functions - // ----------------- - private: - BOOL LoadPicture (CInputFile FAR * pFile, DWORD bitmapSize, LIFlags loadFlags); - BOOL LoadDIB (LPBITMAPINFO pBmi, LPBYTE pBits, LIFlags loadFlags); - - // Private data - // ------------ - private: - cSurfaceImplementation FAR *m_actual; - POINT origin; - - // System colors - static BOOL m_bSysColorTab; - static COLORREF m_sysColorTab[COLOR_GRADIENTINACTIVECAPTION+1]; - - protected: - int m_error; // Est-ce qu'on doit toujours garder ça? -}; - -// maximum opacity -#define OP_MAX 128 // 100 - -#ifdef __cplusplus -extern "C" { -#endif - - SURFACES_API BOOL WINAPI BuildRemapTable (LPBYTE, LOGPALETTE FAR *, LOGPALETTE FAR *, WORD); - -#ifdef __cplusplus -} -#endif - -#endif // _Surface_h +////////////////////////////////////////////////////////////////////////////// +// +// cSurface class +// + +#ifndef _Surface_h +#define _Surface_h + +#include "Fill.h" +#include "Palet.h" +#include "SurfaceDefs.h" + +// Convention : SfSrc.FilterBlit(SfDest, MyCallBack, param) +// ========== will call MyCallBack(pixelDest, pixelSrc, param) + +typedef COLORREF (CALLBACK * FILTERBLITPROC)(COLORREF, COLORREF, DWORD); +typedef COLORREF (CALLBACK * MATRIXFILTERBLITPROC)(COLORREF FAR *, COLORREF FAR *, DWORD); + +// Display mode +typedef struct DisplayMode { + int mcx; + int mcy; + int mDepth; +// int mNearestBitCount; +// int mDriver; +} DisplayMode; + +typedef BOOL (CALLBACK * LPENUMSCREENMODESPROC)(DisplayMode*, LPVOID); + +#ifdef HWABETA +// Lost device callback function +typedef void (CALLBACK * LOSTDEVICECALLBACKPROC)(cSurface*, LPARAM); +#endif + +// System colors +#ifndef COLOR_GRADIENTINACTIVECAPTION +#define COLOR_GRADIENTINACTIVECAPTION 28 +#endif + +// Forwards +class FAR cSurface; +class FAR cSurfaceImplementation; +class FAR CFillData; +class FAR CInputFile; + +// Types +typedef cSurface FAR * LPSURFACE; + +// Blit modes +typedef enum { + BMODE_OPAQUE, + BMODE_TRANSP, + BMODE_MAX +} BlitMode; + +// Blit operations +typedef enum { + BOP_COPY, // None + BOP_BLEND, // dest = ((dest * coef) + (src * (128-coef)))/128 + BOP_INVERT, // dest = src XOR 0xFFFFFF + BOP_XOR, // dest = src XOR dest + BOP_AND, // dest = src AND dest + BOP_OR, // dest = src OR dest + BOP_BLEND_REPLACETRANSP, // dest = ((dest * coef) + ((src==transp)?replace:src * (128-coef)))/128 + BOP_DWROP, + BOP_ANDNOT, + BOP_ADD, + BOP_MONO, + BOP_SUB, + BOP_BLEND_DONTREPLACECOLOR, + BOP_EFFECTEX, + BOP_MAX, + BOP_MASK = 0xFFF, + BOP_RGBAFILTER = 0x1000, +} BlitOp; + +#define ALPHATOSEMITRANSP(a) ((a==0) ? 128:(255-a)/2) +#define SEMITRANSPTOALPHA(s) ((s==128) ? 0:(255-s*2)) + +typedef DWORD RGBAREF; +#define COLORREFATORGBA(c,a) ((c & 0x00FFFFFF) | (a << 24)) + +// Surface capabilities +typedef enum +{ + // Capabilities + SC_GETPIXEL, + SC_SETPIXEL, + SC_FILL, + SC_DRAW, + SC_ROTATE, + SC_STRETCH, + SC_MAX +} SurfaceCap; + +// SetPalette actions +typedef enum +{ + SPA_NONE, // Just update palette + SPA_REMAPSURFACE, // remap current surface pixels to new palette + SPA_MAX +} SetPaletteAction; + +// Surface types +enum +{ + ST_MEMORY, // Buffer only + ST_MEMORYWITHDC, // Buffer + DC (i.e. DIBSection, DDRAW surface, etc... + ST_MEMORYWITHPERMANENTDC, // Buffer + permanent DC (i.e. DIBDC) + ST_DDRAW_SYSTEMMEMORY, // Surface Direct Draw en mémoire systeme + ST_HWA_SCREEN, // Screen surface in HWA mode + ST_HWA_RTTEXTURE, // Render target texture in HWA mode + ST_HWA_ROUTEXTURE, // HWA texture created in video memory, unmanaged (lost when device is lost) + ST_HWA_ROMTEXTURE, // HWA texture created in video memory, managed (automatically reloaded when the device is lost) + ST_MAX +}; + +// Drivers for memory + DC surfaces +enum +{ + SD_DIB, // DIB (standard driver: DIBSection) + SD_WING, // WinG + SD_DDRAW, // Direct Draw + SD_BITMAP, // Win 3.1 bitmap + SD_3DFX, // 3DFX + SD_D3D9, // Direct3D9 + SD_D3D8, // Direct3D8 + SD_MAX +}; + +typedef enum // Warning, bit mask, not enumeration! +{ + LI_NONE=0x0000, + LI_REMAP=0x0001, + LI_CHANGESURFACEDEPTH=0x0002, + LI_DONOTNORMALIZEPALETTE = 0x0004 // do not normalize palette +} LIFlags; + +typedef enum +{ + SI_NONE=0x0000, + SI_ONLYHEADER=0x0001, + SI_SAVEALPHA=0x0002 +} SIFlags; + +enum { + LBF_DONOTCHANGESURFACEDEPTH = 0x0001 +}; + +// Blilt options +enum { + BLTF_ANTIA = 0x0001, // Anti-aliasing + BLTF_COPYALPHA = 0x0002, // Copy alpha channel to destination alpha channel instead of applying it +#ifdef HWABETA + BLTF_SAFESRC = 0x0010, + BLTF_TILE = 0x0020 +#endif +}; + +// Stretch & BlitEx options +enum { + STRF_RESAMPLE = 0x0001, // Resample bitmap + STRF_RESAMPLE_TRANSP = 0x0002, // Resample bitmap, but doesn't resample the transparent color + STRF_COPYALPHA = 0x0004, // Copy (stretch) alpha channel to destination alpha channel instead of applying it +#ifdef HWABETA + STRF_SAFESRC = 0x0010, + STRF_TILE = 0x0020 +#endif +}; + + +// Transparent monochrome mask for collisions +typedef struct sMask +{ + int mkSize; + int mkWidth; + int mkHeight; + UINT mkWidthBytes; + int mkXSpot; + int mkYSpot; + DWORD mkFlags; + RECT mkRect; +} sMask; +typedef sMask *LPSMASK; + +#define SCMF_FULL 0x0000 +#define SCMF_PLATFORM 0x0001 + +#ifndef PI +#define PI ((double)3.141592653589) +#endif + +// Allocate/Free surface +SURFACES_API LPSURFACE WINAPI NewSurface(); +SURFACES_API void WINAPI DeleteSurface(LPSURFACE pSurf); + +// Get surface prototype +SURFACES_API BOOL WINAPI GetSurfacePrototype (LPSURFACE FAR *proto, int depth, int st, int drv); + +// DIB +SURFACES_API DWORD WINAPI GetDIBHeaderSize(int depth); +SURFACES_API DWORD WINAPI GetDIBWidthBytes ( int width, int depth ); +SURFACES_API DWORD WINAPI GetDIBSize ( int width, int height, int depth ); +SURFACES_API LPBYTE WINAPI GetDIBBitmap ( LPBITMAPINFO pBmi ); + +// cSurface class +class SURFACES_API cSurface +{ + public: + // ====================== + // Creation / Destruction + // ====================== + cSurface(); + ~cSurface(); + + // Init + static void InitializeSurfaces(); + static void FreeSurfaces(); +#ifdef HWABETA + static void FreeExternalModules(); +#endif + + // Operators + cSurface FAR & operator= (const cSurface FAR & source); + + // Create surface implementation from surface prototype + void Create (int width, int height, LPSURFACE prototype); + + // Create pure DC surface from DC + void Create (HDC hDC); + + // Create pure DC surface from a window + void Create (HWND hWnd, BOOL IncludeFrame); + + // Create screen surface (fullscreen mode) + BOOL CreateScreenSurface(); + BOOL IsScreenSurface(); + + // Valid? + BOOL IsValid (); + + // Get driver & type + int GetType(); + int GetDriver(); + DWORD GetDriverInfo(LPVOID pInfo); + + // Clone surface (= create with same size + Blit) + void Clone (const cSurface FAR & pSrcSurface, int newW = -1, int newH = -1); + + // Delete surface implementation (before to create another one) + void Delete(); + + // ====================== + // Error codes + // ====================== + int GetLastError(void); + + // ====================== + // Surface info + // ====================== + int GetWidth(void) const; + int GetHeight(void) const; + int GetDepth(void) const; + BOOL GetInfo(int FAR & width, int FAR & height, int FAR & depth) const; + + // ====================== + // Surface coordinate management + // ====================== + + void SetOrigin(int x, int y); + void SetOrigin(POINT c); + + void GetOrigin(POINT FAR &pt); + void GetOrigin(int FAR & x, int FAR & y); + + void OffsetOrigin(int dx, int dy); + void OffsetOrigin(POINT delta); + + // ====================== + // Raster operations + // ====================== + LPBYTE LockBuffer(); + void UnlockBuffer(LPBYTE spBuffer); + int GetPitch() const; + + // ====================== + // Double-buffer handling + // ====================== + void SetCurrentDevice(); + int BeginRendering(BOOL bClear, RGBAREF dwRgba); + int EndRendering(); + BOOL UpdateScreen(); +#ifdef HWABETA + cSurface* GetRenderTargetSurface(); + void ReleaseRenderTargetSurface(cSurface* psf); + void Flush(BOOL bMax); + void SetZBuffer(float z2D); +#endif + + // ====================== + // Device context for graphic operations + // ====================== + HDC GetDC(void); + void ReleaseDC(HDC dc); + void AttachWindow (HWND hWnd); + + // ====================== + // Clipping + // ====================== + void GetClipRect(int FAR & x, int FAR & y, int FAR & w, int FAR & h); + void SetClipRect(int x, int y, int w, int h); + void ClearClipRect(void); + + // ====================== + // LoadImage (DIB format) / SaveImage (DIB format) + // ====================== + #undef LoadImage + + BOOL LoadImageA (HFILE hf, DWORD lsize, LIFlags loadFlags = LI_NONE); + BOOL LoadImageA (LPCSTR fileName, LIFlags loadFlags = LI_NONE); +#ifdef _WINDOWS + BOOL LoadImageA (HINSTANCE hInst, int bmpID, LIFlags loadFlags = LI_NONE); +#endif // _WINDOWS + BOOL LoadImageA (LPBITMAPINFO pBmi, LPBYTE pBits = NULL, LIFlags loadFlags = LI_NONE); + + BOOL LoadImageW (HFILE hf, DWORD lsize, LIFlags loadFlags = LI_NONE); + BOOL LoadImageW (LPCWSTR fileName, LIFlags loadFlags = LI_NONE); +#ifdef _WINDOWS + BOOL LoadImageW (HINSTANCE hInst, int bmpID, LIFlags loadFlags = LI_NONE); +#endif // _WINDOWS + BOOL LoadImageW (LPBITMAPINFO pBmi, LPBYTE pBits = NULL, LIFlags loadFlags = LI_NONE); + + #ifdef _UNICODE + #define LoadImage LoadImageW + #else + #define LoadImage LoadImageA + #endif + + BOOL SaveImage (HFILE hf, SIFlags saveFlags = SI_NONE); + BOOL SaveImage (LPCSTR fileName, SIFlags saveFlags = SI_NONE); + BOOL SaveImage (LPCWSTR fileName, SIFlags saveFlags = SI_NONE); + BOOL SaveImage (LPBITMAPINFO pBmi, LPBYTE pBits, SIFlags saveFlags = SI_NONE); + + DWORD GetDIBSize (); + + // ====================== + // Pixel functions + // ====================== + // Set pixel + void SetPixel(int x, int y, COLORREF c); + void SetPixel(int x, int y, BYTE R, BYTE G, BYTE B); + void SetPixel(int x, int y, int index); + + // Faster: assume clipping is done, the origin is at (0,0) and the surface is locked + void SetPixelFast(int x, int y, COLORREF c); + void SetPixelFast8(int x, int y, int index); + + // Get pixel + BOOL GetPixel(int x, int y, COLORREF FAR & c) const; + BOOL GetPixel(int x, int y, BYTE FAR & R, BYTE FAR & G, BYTE FAR & B) const; + BOOL GetPixel(int x, int y, int FAR & index) const; + + // Faster: assume clipping is done, the origin is at (0,0) and the surface is locked + COLORREF GetPixelFast(int x, int y); + int GetPixelFast8(int x, int y); + + // ====================== + // Blit functions + // ====================== + // Blit surface to surface + BOOL Blit(cSurface FAR & dest) const; + + BOOL Blit(cSurface FAR & dest, int destX, int destY, + BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, + DWORD dwBlitFlags = 0) const; + + // Blit rectangle to surface + BOOL Blit(cSurface FAR & dest, int destX, int destY, + int srcX, int srcY, int srcWidth, int srcHeight, + BlitMode bm /*= BMODE_OPAQUE*/, BlitOp bo = BOP_COPY, LPARAM param = 0, + DWORD dwBlitFlags = 0) const; + + // Extended blit : can do stretch & rotate at the same time + // Only implemented in 3D mode +#ifdef HWABETA + BOOL BlitEx(cSurface FAR & dest, float dX, float dY, float fScaleX, float fScaleY, + int sX, int sY, int sW, int sH, LPPOINT pCenter, float fAngle, + BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, DWORD dwFlags = 0) const; +#endif + // Scrolling + BOOL Scroll (int xDest, int yDest, int xSrc, int ySrc, int width, int height); + + // Blit via callback + BOOL FilterBlit (cSurface FAR & dest, int destX, int destY, + int srcX, int srcY, int srcWidth, int srcHeight, + BlitMode bm, FILTERBLITPROC fbProc, LPARAM lUserParam) const; + + BOOL FilterBlit (cSurface FAR & dest, FILTERBLITPROC fbProc, + LPARAM lUserParam, BlitMode bm = BMODE_OPAQUE) const; + + // Matrix blit via callback + BOOL MatrixFilterBlit (cSurface FAR & dest, int destX, int destY, + int srcX, int srcY, int srcWidth, int srcHeight, + int mWidth, int mHeight, int mDXCenter, int mDYCenter, + MATRIXFILTERBLITPROC fbProc, LPARAM lUserParam) const; + + // Stretch surface to surface + BOOL Stretch(cSurface FAR & dest, DWORD dwFlags = 0) const; + + // Stretch surface to rectangle + BOOL Stretch(cSurface FAR & dest, int destX, int destY, int destWidth, int destHeight, + BlitMode bm /*= BMODE_OPAQUE*/, BlitOp bo = BOP_COPY, LPARAM param = 0, DWORD dwFlags = 0) const; + + // Stretch rectangle to rectangle + BOOL Stretch(cSurface FAR & dest, int destX, int destY, int destWidth, int destHeight, + int srcX, int srcY, int srcWidth, int srcHeight, + BlitMode bm /*= BMODE_OPAQUE*/, BlitOp bo = BOP_COPY, LPARAM param = 0, DWORD dwFlags = 0) const; + + // Revert surface horizontally + BOOL ReverseX(); + + // Revert rectangle horizontally + BOOL ReverseX(int x, int y, int width, int height); + + // Revert surface vertically + BOOL ReverseY(); + + // Revert rectangle vertically + BOOL ReverseY(int x, int y, int width, int height); + + // Remove empty borders + BOOL GetMinimizeRect(RECT FAR*); + BOOL Minimize(); + BOOL Minimize(RECT FAR* r); + + // ============================= + // Blit from screen or memory DC + // ============================= + + static BOOL CaptureDC(HDC srcDC,HDC dstDC,LONG srcX,LONG srcY,LONG dstX,LONG dstY,LONG srcWidth,LONG srcHeight,LONG dstWidth,LONG dstHeight,BOOL bFlushMessage,BOOL bKeepRatio); + + // ====================== + // Fill + // ====================== + + // Fill surface + BOOL Fill(COLORREF c); + BOOL Fill(CFillData FAR * fd); + BOOL Fill(int index); + BOOL Fill(int R, int G, int B); + + // Fill block + BOOL Fill(int x, int y, int w, int h, COLORREF c); + BOOL Fill(int x, int y, int w, int h, CFillData FAR * fd); + BOOL Fill(int x, int y, int w, int h, int index); + BOOL Fill(int x, int y, int w, int h, int R, int G, int B); +#ifdef HWABETA + BOOL Fill(int x, int y, int w, int h, COLORREF* pColors, DWORD dwFlags); +#endif + + // ====================== + // Geometric Primitives + // ====================== + + // 1. Simple routines : call GDI with Surface DC + // ============================================= + + BOOL Ellipse(int left, int top, int right, int bottom, int thickness = 1, COLORREF crOutl = BLACK); + + BOOL Ellipse(int left, int top, int right, int bottom, COLORREF crFill, int thickness /*= 0*/, + COLORREF crOutl /*= BLACK*/, BOOL Fill = TRUE); + + BOOL Rectangle(int left, int top, int right, int bottom, int thickness = 1, COLORREF crOutl = BLACK); + + BOOL Rectangle(int left, int top, int right, int bottom, COLORREF crFill, int thickness /*= 0*/, + COLORREF crOutl /*= BLACK*/, BOOL bFill = TRUE); + + BOOL Polygon(LPPOINT pts, int nPts, int thickness = 1, COLORREF crOutl = BLACK); + + BOOL Polygon(LPPOINT pts, int nPts, COLORREF crFill, int thickness = 0, + COLORREF crOutl = BLACK, BOOL bFill = TRUE); + + BOOL Line(int x1, int y1, int x2, int y2, int thickness = 1, COLORREF crOutl = BLACK); + + // 2. More complex but slower (variable opacity, anti-alias, custom filling, ...) + // ============================================================================== + + BOOL Ellipse(int left, int top, int right, int bottom, int thickness, CFillData FAR * fdOutl, BOOL AntiA = FALSE, + BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + BOOL Ellipse(int left, int top, int right, int bottom, CFillData FAR * fdFill, + BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + BOOL Ellipse(int left, int top, int right, int bottom, CFillData FAR * fdFill, int thickness, CFillData FAR * fdOutl, + BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, BOOL Fill = TRUE); + + BOOL Rectangle(int left, int top, int right, int bottom, int thickness, CFillData FAR * fdOutl, BOOL AntiA = FALSE, + BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + BOOL Rectangle(int left, int top, int right, int bottom, CFillData FAR * fdFill, + BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + BOOL Rectangle(int left, int top, int right, int bottom, CFillData FAR * fdFill, int thickness, CFillData FAR * fdOutl, + BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, BOOL Fill = TRUE); + + BOOL Polygon(LPPOINT pts, int nPts, int thickness, CFillData FAR * fdOutl, BOOL AntiA = FALSE, + BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + BOOL Polygon(LPPOINT pts, int nPts, CFillData FAR * fdFill, + BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + BOOL Polygon(LPPOINT pts, int nPts, CFillData FAR * fdFill, int thickness, CFillData FAR * fdOutl, + BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, BOOL Fill = TRUE); + + BOOL Line(int x1, int y1, int x2, int y2, int thickness, CFillData FAR * fdOutl, BOOL AntiA, + BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + // Filled Primitives + + BOOL FloodFill(int x, int y, int FAR & left, int FAR & top, int FAR & right, int FAR & bottom, COLORREF crFill, BOOL AntiA = FALSE, + int tol = 0, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + BOOL FloodFill(int x, int y, COLORREF crFill, BOOL AntiA = FALSE, int tol = 0, + BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + // ====================== + // Rotation + // ====================== + // Rotate surface + BOOL Rotate(cSurface FAR& dest, double a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); // radian + BOOL Rotate(cSurface FAR& dest, int a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); // degree + BOOL Rotate90(cSurface FAR& dest, BOOL b270); + + // Create rotated surface + BOOL CreateRotatedSurface (cSurface FAR& ps, double a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); + BOOL CreateRotatedSurface (cSurface FAR& ps, int a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); + +#ifdef HWABETA + static void GetSizeOfRotatedRect (int FAR *pWidth, int FAR *pHeight, float angle); +#else + static void GetSizeOfRotatedRect (int FAR *pWidth, int FAR *pHeight, int angle); +#endif + + // ====================== + // Text + // ====================== + +#undef TextOut + + int TextOutA(LPCSTR text, DWORD dwCharCount,int x,int y,DWORD alignMode,LPRECT pClipRc, COLORREF color=0, HFONT hFnt=(HFONT)NULL, BlitMode bm=BMODE_TRANSP, BlitOp=BOP_COPY, LPARAM param=0, int AntiA=0); + int TextOutW(LPCWSTR text, DWORD dwCharCount,int x,int y,DWORD alignMode,LPRECT pClipRc, COLORREF color=0, HFONT hFnt=(HFONT)NULL, BlitMode bm=BMODE_TRANSP, BlitOp=BOP_COPY, LPARAM param=0, int AntiA=0); + +#ifdef _UNICODE +#define TextOut TextOutW +#else +#define TextOut TextOutA +#endif + +#undef DrawText + + int DrawTextA(LPCSTR text, DWORD dwCharCount,LPRECT pRc, DWORD dtflags, COLORREF color=0, HFONT hFnt=(HFONT)NULL, + BlitMode bm=BMODE_TRANSP, BlitOp bo=BOP_COPY, LPARAM param=0, int AntiA=0,DWORD dwLeftMargin=0,DWORD dwRightMargin=0,DWORD dwTabSize=8); + int DrawTextW(LPCWSTR text, DWORD dwCharCount,LPRECT pRc, DWORD dtflags, COLORREF color=0, HFONT hFnt=(HFONT)NULL, + BlitMode bm=BMODE_TRANSP, BlitOp bo=BOP_COPY, LPARAM param=0, int AntiA=0,DWORD dwLeftMargin=0,DWORD dwRightMargin=0,DWORD dwTabSize=8); + +#ifdef _UNICODE +#define DrawText DrawTextW +#else +#define DrawText DrawTextA +#endif + + // ====================== + // Color / Palette functions + // ====================== + // Is transparent + BOOL IsTransparent(); + + // Replace color + BOOL ReplaceColor (COLORREF newColor, COLORREF oldColor); + + // Test collision fine entre deux surfaces + BOOL IsColliding(cSurface FAR & dest, int xDest, int yDest, int xSrc, int ySrc, int rcWidth, int rcHeight); + + // Create icon + HICON CreateIcon(int iconWidth, int iconHeight, COLORREF transpColor,POINT *pHotSpot); + + // Palette support + BOOL Indexed(void); + + BOOL SetPalette(LPLOGPALETTE palette, SetPaletteAction action=SPA_NONE); + BOOL SetPalette (LPCSPALETTE pCsPal, SetPaletteAction action=SPA_NONE); + BOOL SetPalette (cSurface FAR& src, SetPaletteAction action=SPA_NONE); + BOOL SetPalette(HPALETTE palette, SetPaletteAction action=SPA_NONE); + + void Remap(cSurface FAR& src); + void Remap(LPBYTE remapTable); + + LPCSPALETTE GetPalette(); + UINT GetPaletteEntries(LPPALETTEENTRY paletteEntry, int index, int nbColors); + + int GetNearestColorIndex(COLORREF rgb); + COLORREF GetRGB(int index); + int GetOpaqueBlackIndex(); + + // ====================== + // Full screen + // ====================== + void EnumScreenModes(LPENUMSCREENMODESPROC pProc, LPVOID lParam); + BOOL SetScreenMode(HWND hWnd, int width, int height, int depth); + void RestoreWindowedMode(HWND hWnd); + void CopyScreenModeInfo(cSurface* pSrc); + +#ifdef HWABETA + BOOL SetAutoVSync(int nAutoVSync); +#endif + BOOL WaitForVBlank(); + + // System colors + static COLORREF GetSysColor(int colorIndex); + static void OnSysColorChange(); + + // Transparent color + void SetTransparentColor(COLORREF rgb); + COLORREF GetTransparentColor(); + int GetTransparentColorIndex(); + + // Alpha channel + BOOL HasAlpha(); + LPBYTE LockAlpha(); + void UnlockAlpha(); + int GetAlphaPitch(); + void CreateAlpha(); + void SetAlpha(LPBYTE pAlpha, int nPitch); + void AttachAlpha(LPBYTE pAlpha, int nPitch); + LPBYTE DetachAlpha(LPLONG pPitch); + cSurface* GetAlphaSurface(); + void ReleaseAlphaSurface(cSurface* pAlphaSf); + + // Transparent monochrome mask + DWORD CreateMask(LPSMASK pMask, UINT dwFlags); + + // Lost device callback +#ifdef HWABETA + void OnLostDevice(); + void AddLostDeviceCallBack(LOSTDEVICECALLBACKPROC pCallback, LPARAM lUserParam); + void RemoveLostDeviceCallBack(LOSTDEVICECALLBACKPROC pCallback, LPARAM lUserParam); +#endif + + // Friend functions + // ---------------- + SURFACES_API friend cSurfaceImplementation FAR * WINAPI GetSurfaceImplementation(cSurface FAR &cs); + SURFACES_API friend void WINAPI SetSurfaceImplementation(cSurface FAR &cs, cSurfaceImplementation FAR *psi); + + protected: +#ifdef _WINDOWS + static void BuildSysColorTable(); +#endif // _WINDOWS + + // Clipping + //---------- + HRGN SetDrawClip(HDC hDC); + void RestoreDrawClip(HDC hDC,HRGN hOldClipRgn); + + // Private functions + // ----------------- + private: + BOOL LoadPicture (CInputFile FAR * pFile, DWORD bitmapSize, LIFlags loadFlags); + BOOL LoadDIB (LPBITMAPINFO pBmi, LPBYTE pBits, LIFlags loadFlags); + + // Private data + // ------------ + private: + cSurfaceImplementation FAR *m_actual; + POINT origin; + + // System colors + static BOOL m_bSysColorTab; + static COLORREF m_sysColorTab[COLOR_GRADIENTINACTIVECAPTION+1]; + + protected: + int m_error; // Est-ce qu'on doit toujours garder ça? +}; + +// maximum opacity +#define OP_MAX 128 // 100 + +#ifdef __cplusplus +extern "C" { +#endif + + SURFACES_API BOOL WINAPI BuildRemapTable (LPBYTE, LOGPALETTE FAR *, LOGPALETTE FAR *, WORD); + +#ifdef __cplusplus +} +#endif + +#endif // _Surface_h diff --git a/Inc/cncr.h b/Inc/cncr.h index d87c8a6..7bc9821 100644 --- a/Inc/cncr.h +++ b/Inc/cncr.h @@ -1,614 +1,614 @@ - -#ifndef _cncinc_h -#define _cncinc_h - -#include "cncy.h" -#include "cncf.h" - -#ifdef __cplusplus -class cSurface; -class CTransition; -class CDebugger; -class CRunApp; -#ifdef HWABETA -class CEffectEx; -class CPList; -#endif -#else -#define cSurface void -#define CTransition void -#define CDebugger void -#ifdef HWABETA -#define CEffectEx void -#define CPList void -#endif -#endif - -////////////////////////////////////////////////////////////////////////////// -// -// LO (frame object instance) -// -// -// Note: mainly used at runtime - -#ifdef __cplusplus -class LO { -public: -#else -typedef struct LO { -#endif - - WORD loHandle; // HLO - WORD loOiHandle; // HOI - int loX; // Coords - int loY; - WORD loParentType; // Parent type - WORD loOiParentHandle; // HOI Parent - WORD loLayer; // Layer - WORD loType; - npSpr loSpr[4]; // Sprite handles for backdrop objects from layers > 1 - -#ifdef __cplusplus -}; -#else -} LO; -#endif -typedef LO *LPLO; -typedef LO *fpLevObj; - - -////////////////////////////////////////////////////////////////////////////// -// -// OI (frame object) -// - -#define OILF_OCLOADED 0x0001 // -#define OILF_ELTLOADED 0x0002 // -#define OILF_TOLOAD 0x0004 // -#define OILF_TODELETE 0x0008 // -#define OILF_CURFRAME 0x0010 // -#define OILF_TORELOAD 0x0020 // Reload images when frame change -#define OILF_IGNORELOADONCALL 0x0040 // Ignore load on call option - -//////////////////// -// ObjInfo structure -//////////////////// -// -// Note: mainly used at runtime -// only some members of the oiHdr member are valid at editing time -// -#ifdef OI -#undef OI -#endif - -#ifdef __cplusplus -class OI { -public: -#else -typedef struct OI { -#endif - ObjInfoHeader oiHdr; // Header - LPTSTR oiName; // Name - LPOC oiOC; // ObjectsCommon - - DWORD oiFileOffset; - DWORD oiLoadFlags; - WORD oiLoadCount; - WORD oiCount; - -#ifdef HWABETA - LPBYTE oiExtEffect; - CEffectEx* oiExtEffectEx; // Pour backdrops, faut trouver un système plus efficace (banque d'effets pour les backdrops) -#endif // HWABETA - -#ifdef __cplusplus -}; -#else -} OI; -#endif -typedef OI *LPOI; -typedef OI* fpObjInfo; - -// Runtime only -#ifdef RUN_TIME - -/////////////////////////////////////////////// -// -// Added backdrop objects -// -typedef struct bkd2 { - - WORD loHnd; // 0 - WORD oiHnd; // 0 - int x; - int y; - WORD img; - WORD colMode; - WORD nLayer; - WORD obstacleType; - npSpr pSpr[4]; - DWORD inkEffect; - DWORD inkEffectParam; - -} bkd2; -typedef bkd2 *LPBKD2; - -#define MAX_BKD2 (curFrame.m_maxObjects) - -/////////////////////////////////////////////// -// -// Layer at runtime -// -typedef struct RunFrameLayer -{ - // Name - LPTSTR pName; // Name - - // Offset - int x; // Current offset - int y; - int dx; // Offset to apply to the next refresh - int dy; - - // Added backdrops - int m_nBkd2Count; - LPBKD2 m_pBkd2; - - // Ladders - int m_nLadderMax; - int m_nLadders; - LPRECT m_pLadders; - - // Z-order max index for dynamic objects - int m_nZOrderMax; - - // Permanent data (EditFrameLayer) - DWORD dwOptions; // Options - float xCoef; - float yCoef; - DWORD nBkdLOs; // Number of backdrop objects - DWORD nFirstLOIndex; // Index of first backdrop object in LO table - - // EditFrameLayerEffect -#ifdef HWABETA - DWORD dwEffect; - LPARAM dwEffectParam; // CEffectEx si extended -#endif // HWABETA - - // Backup for restart - DWORD backUp_dwOptions; - float backUp_xCoef; - float backUp_yCoef; - DWORD backUp_nBkdLOs; - DWORD backUp_nFirstLOIndex; - -#ifdef HWABETA -// DWORD backUp_dwEffect; // A voir -// LPARAM backUp_dwEffectParam; -#endif // HWABETA - -} RunFrameLayer; - -// Object transition data -typedef struct objTransInfo { - - CTransition* m_pTrans; // Transition object - cSurface* m_SfSave; // Background surface - cSurface* m_SfDisplay; // Working surface - cSurface* m_Sf1; // Source surface - cSurface* m_Sf2; // Destination surface - BOOL m_fadeOut; // fade type - BOOL m_fill1withbackground; // source = background (opaque mode) - BOOL m_fill2withbackground; // dest = background (opaque mode) - BOOL m_saved; // m_SfSave has been updated - int m_xsave; - int m_ysave; - int m_cxsave; - int m_cysave; -#ifdef HWABETA - BOOL m_bStepDrawBlit; // Use StepDrawBlit instead of StepDraw -#endif - -} objTransInfo; -typedef objTransInfo * LPOBJTRANSINFO; - -////////////////////////////////////////////////////////////////////////////// -// -// Frame at runtime -// - -#define MAX_TEMPSTRING 16 -#define IPHONEOPT_JOYSTICK_FIRE1 0x0001 -#define IPHONEOPT_JOYSTICK_FIRE2 0x0002 -#define IPHONEOPT_JOYSTICK_LEFTHAND 0x0004 -#define IPHONEFOPT_MULTITOUCH 0x0008 -#define IPHONEFOPT_SCREENLOCKING 0x0010 -#define IPHONEFOPT_IPHONEFRAMEIAD 0x0020 -#define JOYSTICK_NONE 0x0000 -#define JOYSTICK_TOUCH 0x0001 -#define JOYSTICK_ACCELEROMETER 0x0002 -#define JOYSTICK_EXT 0x0003 - - -#ifdef __cplusplus -class CRunFrame { -public: -#else -typedef struct CRunFrame { -#endif - - // Header - FrameHeader m_hdr; - - // Name - LPTSTR m_name; - - // Palette - LPLOGPALETTE m_palette; - - // Background surface - cSurface* m_pSurface; - - // Coordinates of top-level pixel in edit window - int m_leX; - int m_leY; - int m_leLastScrlX; - int m_leLastScrlY; - - // Layers - int m_nLayers; - RunFrameLayer* m_pLayers; - - // Virtual rectangle - RECT m_leVirtualRect; - - // Instances of frame objects - int m_loMaxIndex; - int m_loMaxHandle; - LPWORD m_lo_handle_to_index; - LPLO m_los; - - // Variables for enumeration functions - int m_loFranIndex; - int m_oiFranIndex; - - // Remap table or palette handle for sub-application - LPBYTE m_remapTable; - - // Transitions - LPBYTE m_fadeIn; - LPBYTE m_fadeOut; - cSurface* m_pFadeInSurface1; - cSurface* m_pFadeInSurface2; - CTransition* m_pTrans; - - // Exit code - DWORD m_levelQuit; - - // Events - int m_rhOK; // TRUE when the events are initialized - LPRH m_rhPtr; // Pointer to RunHeader - LPEVG m_eventPrograms; - DWORD m_free[MAX_EVENTPROGRAMS-1]; - LPOIL m_oiList; - LPVOID m_free0; - LPWORD m_qualToOiList; - LPWORD m_qualOilPtr; // Ne pas liberer! - LPWORD m_qualOilPtr2; // Ne pas liberer! - OINUM* m_limitBuffer; - LPDWORD m_listPointers; - LPDWORD m_eventPointers; - LPQLOAD m_qualifiers; - short m_nQualifiers; - - short m_nConditions[NUMBEROF_SYSTEMTYPES+OBJ_LAST]; - DWORD m_free2[MAX_EVENTPROGRAMS]; - WORD m_wJoystick; - WORD m_wIPhoneOptions; - LPBYTE m_swapBuffers; - DWORD m_objectList; - LPBYTE m_destroyList; - int m_free3; - int m_nPlayers; - int m_nPlayersReal; - int m_level_loop_state; - int m_startLeX; - int m_startLeY; - short m_maxObjects; - short m_maxOI; - LPOBL m_oblEnum; - int m_oblEnumCpt; - BOOL m_eventsBranched; - BOOL m_fade; - DWORD m_fadeTimerDelta; - DWORD m_fadeVblDelta; - DWORD m_pasteMask; - - int m_nCurTempString; - LPTSTR m_pTempString[MAX_TEMPSTRING]; // not used - - // Other - cSurface* m_pSaveSurface; - int m_leEditWinWidth; - int m_leEditWinHeight; - DWORD m_dwColMaskBits; - LPTSTR m_demoFilePath; - WORD m_wRandomSeed; - WORD m_wFree; - DWORD m_dwMvtTimerBase; - -#ifdef HWABETA - LPBYTE m_pLayerEffects; - - // Frame effect - FrameEffect* m_pEffect; // Frame effect (chunk data, contains effect index & param used in blit) - CEffectEx* m_pEffectEx; // Current effect - bool m_bFrameEffectChanged; // Frame effect has been modified - bool m_bAlwaysUseSecondarySurface; // This frame always use a secondary surface - - // Secondary surface (render target used if background or frame effects) - cSurface* m_pSecondarySurface; - - // List of sub-app surfaces to refresh at the end in D3D full screen mode - CPList* m_pSurfacedSubApps; -#endif - -#ifdef __cplusplus -}; -#else -} CRunFrame; -#endif -typedef CRunFrame *fpRunFrame; - -//////////////////////// -// -// Binary files -// -#ifdef __cplusplus -class CBinaryFile { -public: - CBinaryFile() { m_path[0] = 0; m_pTempPath = NULL; m_fileSize = m_fileOffset = 0; m_tempCount = 0; } - ~CBinaryFile() { if ( m_pTempPath != NULL ) { _tremove(m_pTempPath); free(m_pTempPath); m_pTempPath = NULL; m_tempCount = 0; } } - -public: - TCHAR m_path[_MAX_PATH]; // path stored in ccn file - LPTSTR m_pTempPath; // path in temporary folder, if any - DWORD m_fileSize; // file size - DWORD m_fileOffset; // file offset in EXE/CCN file - long m_tempCount; // usage count -}; -#endif // __cplusplus - -////////////////////////////////////////////////////////////////////////////// -// -// Application -// - -#define ARF_MENUINIT 0x0001 -#define ARF_MENUIMAGESLOADED 0x0002 // menu images have been loaded into memory -#define ARF_INGAMELOOP 0x0004 -#define ARF_PAUSEDBEFOREMODALLOOP 0x0008 - -#ifdef __cplusplus -class CRunApp { -public: -#else -typedef struct CRunApp { -#endif - - // Application info - AppMiniHeader m_miniHdr; // Version - AppHeader m_hdr; // General info - LPTSTR m_name; // Name of the application - LPTSTR m_appFileName; // filename (temporary file in editor mode) - LPTSTR m_editorFileName; // filename of original .mfa file - LPTSTR m_copyright; // copyright - LPTSTR m_aboutText; // text to display in the About box - - // File infos - LPTSTR m_targetFileName; // filename of original CCN/EXE file - LPTSTR m_tempPath; // Temporary directory for external files - HFILE m_file; // File handle - DWORD m_startOffset; - - // Help file - LPTSTR m_doc; // Help file pathname - - // Icon - LPBYTE m_icon16x16x8; // = LPBITMAPINFOHEADER - HICON m_hIcon16x16x8; // Small icon for the main window - - // Menu - HMENU m_hRunMenu; // Menu - LPBYTE m_accels; // Accelerators - LPTSTR m_pMenuTexts; // Menu texts (for ownerdraw menu) - LPBYTE m_pMenuImages; // Images index used in the menu - MenuHdr* m_pMenu; - - // Frame offsets - int m_frameMaxIndex; // Max. number of frames - int m_frameMaxHandle; // Max. frame handle - LPWORD m_frame_handle_to_index; // Handle -> index table - LPDWORD m_frameOffset; // Frame offsets in the file - - // Frame passwords - LPTSTR * m_framePasswords; // Table of frame passwords - - // Extensions - int m_nbKpx; // Number of extensions - fpKpxFunc m_kpxTab; // Function table 1 - fpkpdt m_kpxDataTable; // Function table 2 - - // Movement Extensions - int m_nbMvx; // Number of extensions - MvxFnc* m_mvxTable; // DLL info - - // Elements - LPTSTR m_eltFileName[MAX_TABREF]; // Element banks - HFILE m_hfElt[MAX_TABREF]; - - DWORD m_eltBaseOff; - WORD m_nbEltOff[MAX_TABREF]; // Sizes of file offset tables - LPDWORD m_adTabEltOff[MAX_TABREF]; // File offsets of bank elements - - WORD m_nbEltMemToDisk[MAX_TABREF]; // Size of elt cross-ref tables - LPWORD m_EltMemToDisk[MAX_TABREF]; // Element memory index -> element disk index - LPWORD m_EltDiskToMem[MAX_TABREF]; // Element disk index -> memory index - - WORD m_tabNbCpt[MAX_TABREF]; // Sizes of usage count tables - LPLONG m_tabAdCpt[MAX_TABREF]; // Usage count tables of bank elements - - // Binary files - #ifdef STAND_ALONE - CTypedPList m_binaryFiles; // Embeded files - #else - UINT m_binaryFiles[8]; - #endif - - // Temporary images - UINT m_nImagesTemp; // List of temporary images (used by Replace Color action) - LPBYTE m_pImagesTemp; - - // Frame objects - int m_oiMaxIndex; - int m_oiMaxHandle; - LPWORD m_oi_handle_to_index; - LPOI * m_ois; - int m_oiFranIndex; // for enumerating - int m_oiExtFranIndex; // for enumerating - - // Sub-application - #ifndef __cplusplus - #define CRunApp void - #endif - CRunApp* m_pParentApp; // Parent application - #ifndef __cplusplus - #undef CRunApp - #endif - LPVOID m_pSubAppObject; // LPRS - DWORD m_dwSubAppOptions; // Sub-app options - BOOL m_bSubAppIsVisible; // Sub-app visibility - HICON m_hSubAppIcon; // Sub-app icon - int m_cx; // Subapp: valid if stretch - int m_cy; - - // DLL infos - npAppli m_idAppli; // App object in DLL - int m_nDepth; // Screen depth - cSurface* m_protoLogScreen; // Surface prototype - - // Edit window - HWND m_hEditWin; // Edit Window handle - npWin m_idEditWin; // Edit Window identifier - - // Current frame - CRunFrame* m_Frame; // Pointer to current frame - - // Run-time status - int m_bResizeTimer; - int m_refTime; - int m_appRunningState; - int m_startFrame; - int m_nextFrame; - int m_nCurrentFrame; - BOOL m_bWakeUp; - WORD m_oldFlags; - WORD m_appRunFlags; - BOOL m_bPlayFromMsgProc; - - // Debugger - CDebugger* m_pDebugger; - - // Full Screen - int m_depthFullScreen; - WINDOWPLACEMENT m_sWndPlacement; // Window position backup - int m_oldCxMax; // Window size backup - int m_oldCyMax; - cSurface* m_pFullScreenSurface; - - // Global data - BOOL m_bSharePlayerCtrls; // Sub-app: TRUE if shares player controls - BOOL m_bShareLives; // Sub-app: TRUE if shares lives - BOOL m_bShareScores; // Sub-app: TRUE if shares scores - BOOL m_bShareGlobalValues; // Sub-app: TRUE if shares global values - BOOL m_bShareGlobalStrings; // Sub-app: TRUE if shares global strings - - // Players - fpPlayerCtrls m_pPlayerCtrls; - LPLONG m_pLives; - LPLONG m_pScores; - - // Global values (warning: not valid if sub-app and global values are shared) - LPBYTE m_pGlobalValuesInit; - int m_nGlobalValues; // Number of global values - CValue* m_pGlobalValues; // Global values - LPBYTE m_pFree; // No longer used - LPBYTE m_pGlobalValueNames; - - // Global strings (warning: not valid if sub-app and global values are shared) - LPBYTE m_pGlobalStringInit; // Default global string values - int m_nGlobalStrings; // Number of global strings - LPTSTR* m_pGlobalString; // Pointers to global strings - LPBYTE m_pGlobalStringNames; - - // Global objects - LPBYTE m_AdGO; // Global objects data - - // FRANCOIS - short m_NConditions[NUMBEROF_SYSTEMTYPES+KPX_BASE-1]; - - // External sound files - LPTSTR m_pExtMusicFile; - LPTSTR m_pExtSampleFile[32]; // External sample file per channel - - // New Build 243 - int m_nInModalLoopCount; - LPTSTR m_pPlayerNames; - DWORD m_dwColorCache; - - // New Build 245 - LPBYTE m_pVtz4Opt; // not used - DWORD m_dwFree; // not used - - // Application load - LPTSTR m_pLoadFilename; - DWORD m_saveVersion; - BOOL m_bLoading; - - // Bluray - LPVOID m_pBROpt; - - // Build info - AppHeader2* m_pHdr2; - - // Code page -#ifdef _UNICODE - DWORD m_dwCodePage; - bool m_bUnicodeAppFile; -#endif - - // Effects -#ifdef HWABETA - LPBYTE m_pEffects; // effects used in the application - cSurface* m_pOldSecondarySurface; // secondary surface of the last frame, used in transitions - bool m_bAlwaysUseSecondarySurface; // at least one frame has a transition => always use a secondary surface in all the frames - bool m_bShowWindowedMenu; // to show menu after switch from full screen to windowed mode - int m_nSubAppShowCount; // to show the child window otherwise it's not displayed... -#endif // HWABETA - -#ifdef __cplusplus -}; -#else -} CRunApp; -#endif -typedef CRunApp* fpRunApp; - -#endif // RUN_TIME - -#ifndef __cplusplus -#undef cSurface -#undef CTransition -#undef CDebugger -#endif - -#endif // _cncinc_h + +#ifndef _cncinc_h +#define _cncinc_h + +#include "cncy.h" +#include "cncf.h" + +#ifdef __cplusplus +class cSurface; +class CTransition; +class CDebugger; +class CRunApp; +#ifdef HWABETA +class CEffectEx; +class CPList; +#endif +#else +#define cSurface void +#define CTransition void +#define CDebugger void +#ifdef HWABETA +#define CEffectEx void +#define CPList void +#endif +#endif + +////////////////////////////////////////////////////////////////////////////// +// +// LO (frame object instance) +// +// +// Note: mainly used at runtime + +#ifdef __cplusplus +class LO { +public: +#else +typedef struct LO { +#endif + + WORD loHandle; // HLO + WORD loOiHandle; // HOI + int loX; // Coords + int loY; + WORD loParentType; // Parent type + WORD loOiParentHandle; // HOI Parent + WORD loLayer; // Layer + WORD loType; + npSpr loSpr[4]; // Sprite handles for backdrop objects from layers > 1 + +#ifdef __cplusplus +}; +#else +} LO; +#endif +typedef LO *LPLO; +typedef LO *fpLevObj; + + +////////////////////////////////////////////////////////////////////////////// +// +// OI (frame object) +// + +#define OILF_OCLOADED 0x0001 // +#define OILF_ELTLOADED 0x0002 // +#define OILF_TOLOAD 0x0004 // +#define OILF_TODELETE 0x0008 // +#define OILF_CURFRAME 0x0010 // +#define OILF_TORELOAD 0x0020 // Reload images when frame change +#define OILF_IGNORELOADONCALL 0x0040 // Ignore load on call option + +//////////////////// +// ObjInfo structure +//////////////////// +// +// Note: mainly used at runtime +// only some members of the oiHdr member are valid at editing time +// +#ifdef OI +#undef OI +#endif + +#ifdef __cplusplus +class OI { +public: +#else +typedef struct OI { +#endif + ObjInfoHeader oiHdr; // Header + LPTSTR oiName; // Name + LPOC oiOC; // ObjectsCommon + + DWORD oiFileOffset; + DWORD oiLoadFlags; + WORD oiLoadCount; + WORD oiCount; + +#ifdef HWABETA + LPBYTE oiExtEffect; + CEffectEx* oiExtEffectEx; // Pour backdrops, faut trouver un système plus efficace (banque d'effets pour les backdrops) +#endif // HWABETA + +#ifdef __cplusplus +}; +#else +} OI; +#endif +typedef OI *LPOI; +typedef OI* fpObjInfo; + +// Runtime only +#ifdef RUN_TIME + +/////////////////////////////////////////////// +// +// Added backdrop objects +// +typedef struct bkd2 { + + WORD loHnd; // 0 + WORD oiHnd; // 0 + int x; + int y; + WORD img; + WORD colMode; + WORD nLayer; + WORD obstacleType; + npSpr pSpr[4]; + DWORD inkEffect; + DWORD inkEffectParam; + +} bkd2; +typedef bkd2 *LPBKD2; + +#define MAX_BKD2 (curFrame.m_maxObjects) + +/////////////////////////////////////////////// +// +// Layer at runtime +// +typedef struct RunFrameLayer +{ + // Name + LPTSTR pName; // Name + + // Offset + int x; // Current offset + int y; + int dx; // Offset to apply to the next refresh + int dy; + + // Added backdrops + int m_nBkd2Count; + LPBKD2 m_pBkd2; + + // Ladders + int m_nLadderMax; + int m_nLadders; + LPRECT m_pLadders; + + // Z-order max index for dynamic objects + int m_nZOrderMax; + + // Permanent data (EditFrameLayer) + DWORD dwOptions; // Options + float xCoef; + float yCoef; + DWORD nBkdLOs; // Number of backdrop objects + DWORD nFirstLOIndex; // Index of first backdrop object in LO table + + // EditFrameLayerEffect +#ifdef HWABETA + DWORD dwEffect; + LPARAM dwEffectParam; // CEffectEx si extended +#endif // HWABETA + + // Backup for restart + DWORD backUp_dwOptions; + float backUp_xCoef; + float backUp_yCoef; + DWORD backUp_nBkdLOs; + DWORD backUp_nFirstLOIndex; + +#ifdef HWABETA +// DWORD backUp_dwEffect; // A voir +// LPARAM backUp_dwEffectParam; +#endif // HWABETA + +} RunFrameLayer; + +// Object transition data +typedef struct objTransInfo { + + CTransition* m_pTrans; // Transition object + cSurface* m_SfSave; // Background surface + cSurface* m_SfDisplay; // Working surface + cSurface* m_Sf1; // Source surface + cSurface* m_Sf2; // Destination surface + BOOL m_fadeOut; // fade type + BOOL m_fill1withbackground; // source = background (opaque mode) + BOOL m_fill2withbackground; // dest = background (opaque mode) + BOOL m_saved; // m_SfSave has been updated + int m_xsave; + int m_ysave; + int m_cxsave; + int m_cysave; +#ifdef HWABETA + BOOL m_bStepDrawBlit; // Use StepDrawBlit instead of StepDraw +#endif + +} objTransInfo; +typedef objTransInfo * LPOBJTRANSINFO; + +////////////////////////////////////////////////////////////////////////////// +// +// Frame at runtime +// + +#define MAX_TEMPSTRING 16 +#define IPHONEOPT_JOYSTICK_FIRE1 0x0001 +#define IPHONEOPT_JOYSTICK_FIRE2 0x0002 +#define IPHONEOPT_JOYSTICK_LEFTHAND 0x0004 +#define IPHONEFOPT_MULTITOUCH 0x0008 +#define IPHONEFOPT_SCREENLOCKING 0x0010 +#define IPHONEFOPT_IPHONEFRAMEIAD 0x0020 +#define JOYSTICK_NONE 0x0000 +#define JOYSTICK_TOUCH 0x0001 +#define JOYSTICK_ACCELEROMETER 0x0002 +#define JOYSTICK_EXT 0x0003 + + +#ifdef __cplusplus +class CRunFrame { +public: +#else +typedef struct CRunFrame { +#endif + + // Header + FrameHeader m_hdr; + + // Name + LPTSTR m_name; + + // Palette + LPLOGPALETTE m_palette; + + // Background surface + cSurface* m_pSurface; + + // Coordinates of top-level pixel in edit window + int m_leX; + int m_leY; + int m_leLastScrlX; + int m_leLastScrlY; + + // Layers + int m_nLayers; + RunFrameLayer* m_pLayers; + + // Virtual rectangle + RECT m_leVirtualRect; + + // Instances of frame objects + int m_loMaxIndex; + int m_loMaxHandle; + LPWORD m_lo_handle_to_index; + LPLO m_los; + + // Variables for enumeration functions + int m_loFranIndex; + int m_oiFranIndex; + + // Remap table or palette handle for sub-application + LPBYTE m_remapTable; + + // Transitions + LPBYTE m_fadeIn; + LPBYTE m_fadeOut; + cSurface* m_pFadeInSurface1; + cSurface* m_pFadeInSurface2; + CTransition* m_pTrans; + + // Exit code + DWORD m_levelQuit; + + // Events + int m_rhOK; // TRUE when the events are initialized + LPRH m_rhPtr; // Pointer to RunHeader + LPEVG m_eventPrograms; + DWORD m_free[MAX_EVENTPROGRAMS-1]; + LPOIL m_oiList; + LPVOID m_free0; + LPWORD m_qualToOiList; + LPWORD m_qualOilPtr; // Ne pas liberer! + LPWORD m_qualOilPtr2; // Ne pas liberer! + OINUM* m_limitBuffer; + LPDWORD m_listPointers; + LPDWORD m_eventPointers; + LPQLOAD m_qualifiers; + short m_nQualifiers; + + short m_nConditions[NUMBEROF_SYSTEMTYPES+OBJ_LAST]; + DWORD m_free2[MAX_EVENTPROGRAMS]; + WORD m_wJoystick; + WORD m_wIPhoneOptions; + LPBYTE m_swapBuffers; + DWORD m_objectList; + LPBYTE m_destroyList; + int m_free3; + int m_nPlayers; + int m_nPlayersReal; + int m_level_loop_state; + int m_startLeX; + int m_startLeY; + short m_maxObjects; + short m_maxOI; + LPOBL m_oblEnum; + int m_oblEnumCpt; + BOOL m_eventsBranched; + BOOL m_fade; + DWORD m_fadeTimerDelta; + DWORD m_fadeVblDelta; + DWORD m_pasteMask; + + int m_nCurTempString; + LPTSTR m_pTempString[MAX_TEMPSTRING]; // not used + + // Other + cSurface* m_pSaveSurface; + int m_leEditWinWidth; + int m_leEditWinHeight; + DWORD m_dwColMaskBits; + LPTSTR m_demoFilePath; + WORD m_wRandomSeed; + WORD m_wFree; + DWORD m_dwMvtTimerBase; + +#ifdef HWABETA + LPBYTE m_pLayerEffects; + + // Frame effect + FrameEffect* m_pEffect; // Frame effect (chunk data, contains effect index & param used in blit) + CEffectEx* m_pEffectEx; // Current effect + bool m_bFrameEffectChanged; // Frame effect has been modified + bool m_bAlwaysUseSecondarySurface; // This frame always use a secondary surface + + // Secondary surface (render target used if background or frame effects) + cSurface* m_pSecondarySurface; + + // List of sub-app surfaces to refresh at the end in D3D full screen mode + CPList* m_pSurfacedSubApps; +#endif + +#ifdef __cplusplus +}; +#else +} CRunFrame; +#endif +typedef CRunFrame *fpRunFrame; + +//////////////////////// +// +// Binary files +// +#ifdef __cplusplus +class CBinaryFile { +public: + CBinaryFile() { m_path[0] = 0; m_pTempPath = NULL; m_fileSize = m_fileOffset = 0; m_tempCount = 0; } + ~CBinaryFile() { if ( m_pTempPath != NULL ) { _tremove(m_pTempPath); free(m_pTempPath); m_pTempPath = NULL; m_tempCount = 0; } } + +public: + TCHAR m_path[_MAX_PATH]; // path stored in ccn file + LPTSTR m_pTempPath; // path in temporary folder, if any + DWORD m_fileSize; // file size + DWORD m_fileOffset; // file offset in EXE/CCN file + long m_tempCount; // usage count +}; +#endif // __cplusplus + +////////////////////////////////////////////////////////////////////////////// +// +// Application +// + +#define ARF_MENUINIT 0x0001 +#define ARF_MENUIMAGESLOADED 0x0002 // menu images have been loaded into memory +#define ARF_INGAMELOOP 0x0004 +#define ARF_PAUSEDBEFOREMODALLOOP 0x0008 + +#ifdef __cplusplus +class CRunApp { +public: +#else +typedef struct CRunApp { +#endif + + // Application info + AppMiniHeader m_miniHdr; // Version + AppHeader m_hdr; // General info + LPTSTR m_name; // Name of the application + LPTSTR m_appFileName; // filename (temporary file in editor mode) + LPTSTR m_editorFileName; // filename of original .mfa file + LPTSTR m_copyright; // copyright + LPTSTR m_aboutText; // text to display in the About box + + // File infos + LPTSTR m_targetFileName; // filename of original CCN/EXE file + LPTSTR m_tempPath; // Temporary directory for external files + HFILE m_file; // File handle + DWORD m_startOffset; + + // Help file + LPTSTR m_doc; // Help file pathname + + // Icon + LPBYTE m_icon16x16x8; // = LPBITMAPINFOHEADER + HICON m_hIcon16x16x8; // Small icon for the main window + + // Menu + HMENU m_hRunMenu; // Menu + LPBYTE m_accels; // Accelerators + LPTSTR m_pMenuTexts; // Menu texts (for ownerdraw menu) + LPBYTE m_pMenuImages; // Images index used in the menu + MenuHdr* m_pMenu; + + // Frame offsets + int m_frameMaxIndex; // Max. number of frames + int m_frameMaxHandle; // Max. frame handle + LPWORD m_frame_handle_to_index; // Handle -> index table + LPDWORD m_frameOffset; // Frame offsets in the file + + // Frame passwords + LPTSTR * m_framePasswords; // Table of frame passwords + + // Extensions + int m_nbKpx; // Number of extensions + fpKpxFunc m_kpxTab; // Function table 1 + fpkpdt m_kpxDataTable; // Function table 2 + + // Movement Extensions + int m_nbMvx; // Number of extensions + MvxFnc* m_mvxTable; // DLL info + + // Elements + LPTSTR m_eltFileName[MAX_TABREF]; // Element banks + HFILE m_hfElt[MAX_TABREF]; + + DWORD m_eltBaseOff; + WORD m_nbEltOff[MAX_TABREF]; // Sizes of file offset tables + LPDWORD m_adTabEltOff[MAX_TABREF]; // File offsets of bank elements + + WORD m_nbEltMemToDisk[MAX_TABREF]; // Size of elt cross-ref tables + LPWORD m_EltMemToDisk[MAX_TABREF]; // Element memory index -> element disk index + LPWORD m_EltDiskToMem[MAX_TABREF]; // Element disk index -> memory index + + WORD m_tabNbCpt[MAX_TABREF]; // Sizes of usage count tables + LPLONG m_tabAdCpt[MAX_TABREF]; // Usage count tables of bank elements + + // Binary files + #ifdef STAND_ALONE + CTypedPList m_binaryFiles; // Embeded files + #else + UINT m_binaryFiles[8]; + #endif + + // Temporary images + UINT m_nImagesTemp; // List of temporary images (used by Replace Color action) + LPBYTE m_pImagesTemp; + + // Frame objects + int m_oiMaxIndex; + int m_oiMaxHandle; + LPWORD m_oi_handle_to_index; + LPOI * m_ois; + int m_oiFranIndex; // for enumerating + int m_oiExtFranIndex; // for enumerating + + // Sub-application + #ifndef __cplusplus + #define CRunApp void + #endif + CRunApp* m_pParentApp; // Parent application + #ifndef __cplusplus + #undef CRunApp + #endif + LPVOID m_pSubAppObject; // LPRS + DWORD m_dwSubAppOptions; // Sub-app options + BOOL m_bSubAppIsVisible; // Sub-app visibility + HICON m_hSubAppIcon; // Sub-app icon + int m_cx; // Subapp: valid if stretch + int m_cy; + + // DLL infos + npAppli m_idAppli; // App object in DLL + int m_nDepth; // Screen depth + cSurface* m_protoLogScreen; // Surface prototype + + // Edit window + HWND m_hEditWin; // Edit Window handle + npWin m_idEditWin; // Edit Window identifier + + // Current frame + CRunFrame* m_Frame; // Pointer to current frame + + // Run-time status + int m_bResizeTimer; + int m_refTime; + int m_appRunningState; + int m_startFrame; + int m_nextFrame; + int m_nCurrentFrame; + BOOL m_bWakeUp; + WORD m_oldFlags; + WORD m_appRunFlags; + BOOL m_bPlayFromMsgProc; + + // Debugger + CDebugger* m_pDebugger; + + // Full Screen + int m_depthFullScreen; + WINDOWPLACEMENT m_sWndPlacement; // Window position backup + int m_oldCxMax; // Window size backup + int m_oldCyMax; + cSurface* m_pFullScreenSurface; + + // Global data + BOOL m_bSharePlayerCtrls; // Sub-app: TRUE if shares player controls + BOOL m_bShareLives; // Sub-app: TRUE if shares lives + BOOL m_bShareScores; // Sub-app: TRUE if shares scores + BOOL m_bShareGlobalValues; // Sub-app: TRUE if shares global values + BOOL m_bShareGlobalStrings; // Sub-app: TRUE if shares global strings + + // Players + fpPlayerCtrls m_pPlayerCtrls; + LPLONG m_pLives; + LPLONG m_pScores; + + // Global values (warning: not valid if sub-app and global values are shared) + LPBYTE m_pGlobalValuesInit; + int m_nGlobalValues; // Number of global values + CValue* m_pGlobalValues; // Global values + LPBYTE m_pFree; // No longer used + LPBYTE m_pGlobalValueNames; + + // Global strings (warning: not valid if sub-app and global values are shared) + LPBYTE m_pGlobalStringInit; // Default global string values + int m_nGlobalStrings; // Number of global strings + LPTSTR* m_pGlobalString; // Pointers to global strings + LPBYTE m_pGlobalStringNames; + + // Global objects + LPBYTE m_AdGO; // Global objects data + + // FRANCOIS + short m_NConditions[NUMBEROF_SYSTEMTYPES+KPX_BASE-1]; + + // External sound files + LPTSTR m_pExtMusicFile; + LPTSTR m_pExtSampleFile[32]; // External sample file per channel + + // New Build 243 + int m_nInModalLoopCount; + LPTSTR m_pPlayerNames; + DWORD m_dwColorCache; + + // New Build 245 + LPBYTE m_pVtz4Opt; // not used + DWORD m_dwFree; // not used + + // Application load + LPTSTR m_pLoadFilename; + DWORD m_saveVersion; + BOOL m_bLoading; + + // Bluray + LPVOID m_pBROpt; + + // Build info + AppHeader2* m_pHdr2; + + // Code page +#ifdef _UNICODE + DWORD m_dwCodePage; + bool m_bUnicodeAppFile; +#endif + + // Effects +#ifdef HWABETA + LPBYTE m_pEffects; // effects used in the application + cSurface* m_pOldSecondarySurface; // secondary surface of the last frame, used in transitions + bool m_bAlwaysUseSecondarySurface; // at least one frame has a transition => always use a secondary surface in all the frames + bool m_bShowWindowedMenu; // to show menu after switch from full screen to windowed mode + int m_nSubAppShowCount; // to show the child window otherwise it's not displayed... +#endif // HWABETA + +#ifdef __cplusplus +}; +#else +} CRunApp; +#endif +typedef CRunApp* fpRunApp; + +#endif // RUN_TIME + +#ifndef __cplusplus +#undef cSurface +#undef CTransition +#undef CDebugger +#endif + +#endif // _cncinc_h diff --git a/Inc/json.h b/Inc/json.h index cbddc69..b700ac5 100644 --- a/Inc/json.h +++ b/Inc/json.h @@ -1,192 +1,192 @@ - -/* vim: set et ts=3 sw=3 ft=c: - * - * Copyright (C) 2012 James McLaughlin et al. All rights reserved. - * https://github.com/udp/json-parser - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _JSON_H -#define _JSON_H - -#ifndef json_char - #define json_char char -#endif - -#ifdef __cplusplus - - #include - - extern "C" - { - -#endif - -typedef struct -{ - unsigned long max_memory; - int settings; - -} json_settings; - -#define json_relaxed_commas 1 - -typedef enum -{ - json_none, - json_object, - json_array, - json_integer, - json_double, - json_string, - json_boolean, - json_null - -} json_type; - -extern const struct _json_value json_value_none; - -typedef struct _json_value -{ - struct _json_value * parent; - - json_type type; - - union - { - int boolean; - long integer; - double dbl; - - struct - { - unsigned int length; - json_char * ptr; /* null terminated */ - - } string; - - struct - { - unsigned int length; - - struct - { - json_char * name; - struct _json_value * value; - - } * values; - - } object; - - struct - { - unsigned int length; - struct _json_value ** values; - - } array; - - } u; - - union - { - struct _json_value * next_alloc; - void * object_mem; - - } _reserved; - - - /* Some C++ operator sugar */ - - #ifdef __cplusplus - - public: - - inline _json_value () - { memset (this, 0, sizeof (_json_value)); - } - - inline const struct _json_value &operator [] (int index) const - { - if (type != json_array || index < 0 - || ((unsigned int) index) >= u.array.length) - { - return json_value_none; - } - - return *u.array.values [index]; - } - - inline const struct _json_value &operator [] (const char * index) const - { - if (type != json_object) - return json_value_none; - - for (unsigned int i = 0; i < u.object.length; ++ i) - if (!strcmp (u.object.values [i].name, index)) - return *u.object.values [i].value; - - return json_value_none; - } - - inline operator const char * () const - { - switch (type) - { - case json_string: - return u.string.ptr; - - default: - return ""; - }; - } - - inline operator long () const - { return u.integer; - } - - inline operator bool () const - { return u.boolean != 0; - } - - #endif - -} json_value; - -json_value * json_parse - (const json_char * json); - -json_value * json_parse_ex - (json_settings * settings, const json_char * json, char * error); - -void json_value_free (json_value *); - - -#ifdef __cplusplus - } /* extern "C" */ -#endif - -#endif - - + +/* vim: set et ts=3 sw=3 ft=c: + * + * Copyright (C) 2012 James McLaughlin et al. All rights reserved. + * https://github.com/udp/json-parser + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _JSON_H +#define _JSON_H + +#ifndef json_char + #define json_char char +#endif + +#ifdef __cplusplus + + #include + + extern "C" + { + +#endif + +typedef struct +{ + unsigned long max_memory; + int settings; + +} json_settings; + +#define json_relaxed_commas 1 + +typedef enum +{ + json_none, + json_object, + json_array, + json_integer, + json_double, + json_string, + json_boolean, + json_null + +} json_type; + +extern const struct _json_value json_value_none; + +typedef struct _json_value +{ + struct _json_value * parent; + + json_type type; + + union + { + int boolean; + long integer; + double dbl; + + struct + { + unsigned int length; + json_char * ptr; /* null terminated */ + + } string; + + struct + { + unsigned int length; + + struct + { + json_char * name; + struct _json_value * value; + + } * values; + + } object; + + struct + { + unsigned int length; + struct _json_value ** values; + + } array; + + } u; + + union + { + struct _json_value * next_alloc; + void * object_mem; + + } _reserved; + + + /* Some C++ operator sugar */ + + #ifdef __cplusplus + + public: + + inline _json_value () + { memset (this, 0, sizeof (_json_value)); + } + + inline const struct _json_value &operator [] (int index) const + { + if (type != json_array || index < 0 + || ((unsigned int) index) >= u.array.length) + { + return json_value_none; + } + + return *u.array.values [index]; + } + + inline const struct _json_value &operator [] (const char * index) const + { + if (type != json_object) + return json_value_none; + + for (unsigned int i = 0; i < u.object.length; ++ i) + if (!strcmp (u.object.values [i].name, index)) + return *u.object.values [i].value; + + return json_value_none; + } + + inline operator const char * () const + { + switch (type) + { + case json_string: + return u.string.ptr; + + default: + return ""; + }; + } + + inline operator long () const + { return u.integer; + } + + inline operator bool () const + { return u.boolean != 0; + } + + #endif + +} json_value; + +json_value * json_parse + (const json_char * json); + +json_value * json_parse_ex + (json_settings * settings, const json_char * json, char * error); + +void json_value_free (json_value *); + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif + + diff --git a/Lib/Edif.Edittime.cpp b/Lib/Edif.Edittime.cpp index 7f52dbf..7468907 100644 --- a/Lib/Edif.Edittime.cpp +++ b/Lib/Edif.Edittime.cpp @@ -1,351 +1,351 @@ - -#include "Common.h" - -void WINAPI DLLExport GetObjInfos (mv _far *mV, void *, LPTSTR ObjName, LPTSTR ObjAuthor, - LPTSTR ObjCopyright, LPTSTR ObjComment, LPTSTR ObjHttp) -{ -#ifndef RUN_ONLY - - const json_value &Properties = SDK->json["About"]; - - Edif::ConvertAndCopyString(ObjAuthor, Properties["Author"], MAX_PATH); - Edif::ConvertAndCopyString(ObjCopyright, Properties["Copyright"],MAX_PATH); - Edif::ConvertAndCopyString(ObjComment, Properties["Comment"], MAX_PATH); - Edif::ConvertAndCopyString(ObjHttp, Properties["URL"], MAX_PATH); - Edif::ConvertAndCopyString(ObjName, Properties["Name"], MAX_PATH); - - -#endif // !defined(RUN_ONLY) -} - -LPCTSTR WINAPI GetHelpFileName() -{ -#ifndef RUN_ONLY - // Return a file without path if your help file can be loaded by the MMF help file. -// return "MyExt.chm"; - - // Or return the path of your file, relatively to the MMF directory - // if your file is not loaded by the MMF help file. - static TCHAR TempString[MAX_PATH]; // used by GetHelpFileName() - return Edif::ConvertAndCopyString(TempString, SDK->json["About"]["Help"], MAX_PATH); -#else - return NULL; -#endif // !defined(RUN_ONLY) -} - -void WINAPI DLLExport GetConditionTitle(mv _far *mV, short code, short param, LPTSTR strBuf, short maxLen) -{ -#ifndef RUN_ONLY - - if(!IS_COMPATIBLE(mV)) - return; - - const json_value &Parameter = SDK->json["Conditions"][code]["Parameters"][param]; - - if(Parameter.type == json_object) - Edif::ConvertAndCopyString(strBuf, Parameter["Title"], maxLen); - else - Edif::ConvertAndCopyString(strBuf, Parameter[1], maxLen); - -#endif // !defined(RUN_ONLY) -} - -void WINAPI DLLExport GetActionTitle(mv _far *mV, short code, short param, LPTSTR strBuf, short maxLen) -{ -#ifndef RUN_ONLY - - if(!IS_COMPATIBLE(mV)) - return; - - const json_value &Parameter = SDK->json["Actions"][code]["Parameters"][param]; - - if(Parameter.type == json_object) - Edif::ConvertAndCopyString(strBuf, Parameter["Title"], maxLen); - else - Edif::ConvertAndCopyString(strBuf, Parameter[1], maxLen); - -#endif // !defined(RUN_ONLY) -} - - -void WINAPI DLLExport GetExpressionParam(mv _far *mV, short code, short param, LPTSTR strBuf, short maxLen) -{ -#ifndef RUN_ONLY - - if(!IS_COMPATIBLE(mV)) - return; - - const json_value &Parameter = SDK->json["Expressions"][code]["Parameters"][param]; - - if(Parameter.type == json_object) - Edif::ConvertAndCopyString(strBuf, Parameter["Title"], maxLen); - else - Edif::ConvertAndCopyString(strBuf, Parameter[1], maxLen); - - -#endif // !defined(RUN_ONLY) -} - - -void WINAPI DLLExport GetExpressionTitle(mv _far *mV, short code, LPTSTR strBuf, short maxLen) -{ -#ifndef RUN_ONLY - - if(!IS_COMPATIBLE(mV)) - return; - - Edif::ConvertAndCopyString(strBuf, SDK->json["Expressions"][code]["Title"], maxLen); - -#endif // !defined(RUN_ONLY) -} - -void WINAPI DLLExport GetConditionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) -{ -#ifndef RUN_ONLY - - if(!IS_COMPATIBLE(mV)) - return; - - Edif::ConvertAndCopyString(strPtr, SDK->json["Conditions"][code]["Title"], maxLen); - -#endif // !defined(RUN_ONLY) -} - -void WINAPI DLLExport GetActionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) -{ -#ifndef RUN_ONLY - - if(!IS_COMPATIBLE(mV)) - return; - - Edif::ConvertAndCopyString(strPtr, SDK->json["Actions"][code]["Title"], maxLen); - -#endif // !defined(RUN_ONLY) -} - -void WINAPI DLLExport GetExpressionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) -{ -#ifndef RUN_ONLY - - if(!IS_COMPATIBLE(mV)) - return; - - Edif::ConvertAndCopyString(strPtr, SDK->json["Expressions"][code]["Title"], maxLen); - -#endif // !defined(RUN_ONLY) -} - -LPINFOEVENTSV2 WINAPI DLLExport GetConditionInfos(mv _far *mV, short code) -{ -#ifndef RUN_ONLY - - if(IS_COMPATIBLE(mV)) - return &GetEventInformations((LPEVENTINFOS2) &SDK->ConditionInfos[0], code)->infos; - -#endif // !defined(RUN_ONLY) - return NULL; -} - -LPINFOEVENTSV2 WINAPI DLLExport GetActionInfos(mv _far *mV, short code) -{ -#ifndef RUN_ONLY - - if(IS_COMPATIBLE(mV)) - return &GetEventInformations((LPEVENTINFOS2) &SDK->ActionInfos[0], code)->infos; - -#endif // !defined(RUN_ONLY) - return NULL; -} - -LPINFOEVENTSV2 WINAPI DLLExport GetExpressionInfos(mv _far *mV, short code) -{ -#ifndef RUN_ONLY - - if(IS_COMPATIBLE(mV)) - return &GetEventInformations((LPEVENTINFOS2) &SDK->ExpressionInfos[0], code)->infos; - -#endif // !defined(RUN_ONLY) - return NULL; -} - -short WINAPI DLLExport GetConditionCodeFromMenu(mv _far *mV, short menuId) -{ -#ifndef RUN_ONLY - - return menuId - Edif::ConditionID(0); - -#endif // !defined(RUN_ONLY) - return -1; -} - -short WINAPI DLLExport GetActionCodeFromMenu(mv _far *mV, short menuId) -{ -#ifndef RUN_ONLY - - return menuId - Edif::ActionID(0); - -#endif // !defined(RUN_ONLY) - return -1; -} - -short WINAPI DLLExport GetExpressionCodeFromMenu(mv _far *mV, short menuId) -{ -#ifndef RUN_ONLY - - return menuId - Edif::ExpressionID(0); - -#endif // !defined(RUN_ONLY) - return -1; -} - -void menucpy(HMENU hTargetMenu, HMENU hSourceMenu) -{ -#ifndef RUN_ONLY - int n, id, nMn; - LPTSTR strBuf; - HMENU hSubMenu; - - nMn = GetMenuItemCount(hSourceMenu); - strBuf = (LPTSTR)calloc(80, sizeof(TCHAR)); - for (n = 0; n < nMn; n++) - { - if (0 == (id = GetMenuItemID(hSourceMenu, n))) - AppendMenu(hTargetMenu, MF_SEPARATOR, 0, 0L); - else - { - GetMenuString(hSourceMenu, n, strBuf, 80, MF_BYPOSITION); - if (id != -1) - AppendMenu(hTargetMenu, GetMenuState(hSourceMenu, n, MF_BYPOSITION), id, strBuf); - else - { - hSubMenu = CreatePopupMenu(); - AppendMenu(hTargetMenu, MF_POPUP | MF_STRING, (uint)hSubMenu, strBuf); - menucpy(hSubMenu, GetSubMenu(hSourceMenu, n)); - } - } - } - free(strBuf); -#endif -} - -HMENU WINAPI DLLExport GetConditionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA edPtr) -{ -#ifndef RUN_ONLY - // Check compatibility - if ( IS_COMPATIBLE(mV) ) - { - HMENU Menu = CreatePopupMenu(); - menucpy(Menu, Edif::ConditionMenu); - return Menu; - } -#endif // !defined(RUN_ONLY) - return NULL; -} - -HMENU WINAPI DLLExport GetActionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA edPtr) -{ -#ifndef RUN_ONLY - // Check compatibility - if ( IS_COMPATIBLE(mV) ) - { - HMENU Menu = CreatePopupMenu(); - menucpy(Menu, Edif::ActionMenu); - return Menu; - } -#endif // !defined(RUN_ONLY) - return NULL; -} - -HMENU WINAPI DLLExport GetExpressionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA edPtr) -{ -#ifndef RUN_ONLY - // Check compatibility - if ( IS_COMPATIBLE(mV) ) - { - HMENU Menu = CreatePopupMenu(); - menucpy(Menu, Edif::ExpressionMenu); - return Menu; - } -#endif // !defined(RUN_ONLY) - return NULL; -} - -#ifdef _UNICODE -#define _tstring wstring -#else -#define _tstring string -#endif - -void AddDirectory(_tstring &From, _tstring &To) -{ - HANDLE FileHandle; - WIN32_FIND_DATA Filejson; - - _tstring SearchString; - - SearchString += From; - SearchString += _T("*.*"); - - FileHandle = FindFirstFile(SearchString.c_str(), &Filejson); - - if(FileHandle == INVALID_HANDLE_VALUE) - return; - - do - { - if(*Filejson.cFileName == '.') - continue; - - if((Filejson.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) - { - _tstring OldPath; - - OldPath += From; - OldPath += Filejson.cFileName; - OldPath += _T("\\"); - - _tstring NewPath; - - NewPath += To; - NewPath += Filejson.cFileName; - NewPath += _T("\\"); - - CreateDirectory(NewPath.c_str(), 0); - AddDirectory(OldPath, NewPath); - - continue; - } - - CopyFile((From + Filejson.cFileName).c_str(), (To + Filejson.cFileName).c_str(), FALSE); - - } while(FindNextFile(FileHandle, &Filejson)); - - FindClose(FileHandle); -} - -void WINAPI PrepareFlexBuild(LPMV pMV, LPEDATA edPtr, LPCWSTR wTempFolder) -{ -#if !defined(RUN_ONLY) - - TCHAR FlashFolderPath[MAX_PATH]; - Edif::GetSiblingPath(FlashFolderPath, _T("Flash")); - - if (!*FlashFolderPath) - return; - - LPTSTR TempFolder; - -#ifdef _UNICODE - TempFolder = (LPTSTR)wTempFolder; -#else - { size_t Length = WideCharToMultiByte(CP_ACP, 0, wTempFolder, -1, 0, 0, 0, 0); - TempFolder = (LPSTR) alloca(Length + 1); - - WideCharToMultiByte(CP_ACP, 0, wTempFolder, -1, TempFolder, Length, 0, 0); - } -#endif - - AddDirectory(((_tstring) FlashFolderPath + _T("\\")), (_tstring) TempFolder); - -#endif // !defined(RUN_ONLY) -} + +#include "Common.h" + +void WINAPI DLLExport GetObjInfos (mv _far *mV, void *, LPTSTR ObjName, LPTSTR ObjAuthor, + LPTSTR ObjCopyright, LPTSTR ObjComment, LPTSTR ObjHttp) +{ +#ifndef RUN_ONLY + + const json_value &Properties = SDK->json["About"]; + + Edif::ConvertAndCopyString(ObjAuthor, Properties["Author"], MAX_PATH); + Edif::ConvertAndCopyString(ObjCopyright,Properties["Copyright"],MAX_PATH); + Edif::ConvertAndCopyString(ObjComment, Properties["Comment"], MAX_PATH); + Edif::ConvertAndCopyString(ObjHttp, Properties["URL"], MAX_PATH); + Edif::ConvertAndCopyString(ObjName, Properties["Name"], MAX_PATH); + + +#endif // !defined(RUN_ONLY) +} + +LPCTSTR WINAPI GetHelpFileName() +{ +#ifndef RUN_ONLY + // Return a file without path if your help file can be loaded by the MMF help file. +// return "MyExt.chm"; + + // Or return the path of your file, relatively to the MMF directory + // if your file is not loaded by the MMF help file. + static TCHAR TempString[MAX_PATH]; // used by GetHelpFileName() + return Edif::ConvertAndCopyString(TempString, SDK->json["About"]["Help"], MAX_PATH); +#else + return NULL; +#endif // !defined(RUN_ONLY) +} + +void WINAPI DLLExport GetConditionTitle(mv _far *mV, short code, short param, LPTSTR strBuf, short maxLen) +{ +#ifndef RUN_ONLY + + if(!IS_COMPATIBLE(mV)) + return; + + const json_value &Parameter = SDK->json["Conditions"][code]["Parameters"][param]; + + if(Parameter.type == json_object) + Edif::ConvertAndCopyString(strBuf, Parameter["Title"], maxLen); + else + Edif::ConvertAndCopyString(strBuf, Parameter[1], maxLen); + +#endif // !defined(RUN_ONLY) +} + +void WINAPI DLLExport GetActionTitle(mv _far *mV, short code, short param, LPTSTR strBuf, short maxLen) +{ +#ifndef RUN_ONLY + + if(!IS_COMPATIBLE(mV)) + return; + + const json_value &Parameter = SDK->json["Actions"][code]["Parameters"][param]; + + if(Parameter.type == json_object) + Edif::ConvertAndCopyString(strBuf, Parameter["Title"], maxLen); + else + Edif::ConvertAndCopyString(strBuf, Parameter[1], maxLen); + +#endif // !defined(RUN_ONLY) +} + + +void WINAPI DLLExport GetExpressionParam(mv _far *mV, short code, short param, LPTSTR strBuf, short maxLen) +{ +#ifndef RUN_ONLY + + if(!IS_COMPATIBLE(mV)) + return; + + const json_value &Parameter = SDK->json["Expressions"][code]["Parameters"][param]; + + if(Parameter.type == json_object) + Edif::ConvertAndCopyString(strBuf, Parameter["Title"], maxLen); + else + Edif::ConvertAndCopyString(strBuf, Parameter[1], maxLen); + + +#endif // !defined(RUN_ONLY) +} + + +void WINAPI DLLExport GetExpressionTitle(mv _far *mV, short code, LPTSTR strBuf, short maxLen) +{ +#ifndef RUN_ONLY + + if(!IS_COMPATIBLE(mV)) + return; + + Edif::ConvertAndCopyString(strBuf, SDK->json["Expressions"][code]["Title"], maxLen); + +#endif // !defined(RUN_ONLY) +} + +void WINAPI DLLExport GetConditionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) +{ +#ifndef RUN_ONLY + + if(!IS_COMPATIBLE(mV)) + return; + + Edif::ConvertAndCopyString(strPtr, SDK->json["Conditions"][code]["Title"], maxLen); + +#endif // !defined(RUN_ONLY) +} + +void WINAPI DLLExport GetActionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) +{ +#ifndef RUN_ONLY + + if(!IS_COMPATIBLE(mV)) + return; + + Edif::ConvertAndCopyString(strPtr, SDK->json["Actions"][code]["Title"], maxLen); + +#endif // !defined(RUN_ONLY) +} + +void WINAPI DLLExport GetExpressionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) +{ +#ifndef RUN_ONLY + + if(!IS_COMPATIBLE(mV)) + return; + + Edif::ConvertAndCopyString(strPtr, SDK->json["Expressions"][code]["Title"], maxLen); + +#endif // !defined(RUN_ONLY) +} + +LPINFOEVENTSV2 WINAPI DLLExport GetConditionInfos(mv _far *mV, short code) +{ +#ifndef RUN_ONLY + + if(IS_COMPATIBLE(mV)) + return &GetEventInformations((LPEVENTINFOS2) &SDK->ConditionInfos[0], code)->infos; + +#endif // !defined(RUN_ONLY) + return NULL; +} + +LPINFOEVENTSV2 WINAPI DLLExport GetActionInfos(mv _far *mV, short code) +{ +#ifndef RUN_ONLY + + if(IS_COMPATIBLE(mV)) + return &GetEventInformations((LPEVENTINFOS2) &SDK->ActionInfos[0], code)->infos; + +#endif // !defined(RUN_ONLY) + return NULL; +} + +LPINFOEVENTSV2 WINAPI DLLExport GetExpressionInfos(mv _far *mV, short code) +{ +#ifndef RUN_ONLY + + if(IS_COMPATIBLE(mV)) + return &GetEventInformations((LPEVENTINFOS2) &SDK->ExpressionInfos[0], code)->infos; + +#endif // !defined(RUN_ONLY) + return NULL; +} + +short WINAPI DLLExport GetConditionCodeFromMenu(mv _far *mV, short menuId) +{ +#ifndef RUN_ONLY + + return menuId - Edif::ConditionID(0); + +#endif // !defined(RUN_ONLY) + return -1; +} + +short WINAPI DLLExport GetActionCodeFromMenu(mv _far *mV, short menuId) +{ +#ifndef RUN_ONLY + + return menuId - Edif::ActionID(0); + +#endif // !defined(RUN_ONLY) + return -1; +} + +short WINAPI DLLExport GetExpressionCodeFromMenu(mv _far *mV, short menuId) +{ +#ifndef RUN_ONLY + + return menuId - Edif::ExpressionID(0); + +#endif // !defined(RUN_ONLY) + return -1; +} + +void menucpy(HMENU hTargetMenu, HMENU hSourceMenu) +{ +#ifndef RUN_ONLY + int n, id, nMn; + LPTSTR strBuf; + HMENU hSubMenu; + + nMn = GetMenuItemCount(hSourceMenu); + strBuf = (LPTSTR)calloc(80, sizeof(TCHAR)); + for (n = 0; n < nMn; n++) + { + if (0 == (id = GetMenuItemID(hSourceMenu, n))) + AppendMenu(hTargetMenu, MF_SEPARATOR, 0, 0L); + else + { + GetMenuString(hSourceMenu, n, strBuf, 80, MF_BYPOSITION); + if (id != -1) + AppendMenu(hTargetMenu, GetMenuState(hSourceMenu, n, MF_BYPOSITION), id, strBuf); + else + { + hSubMenu = CreatePopupMenu(); + AppendMenu(hTargetMenu, MF_POPUP | MF_STRING, (uint)hSubMenu, strBuf); + menucpy(hSubMenu, GetSubMenu(hSourceMenu, n)); + } + } + } + free(strBuf); +#endif +} + +HMENU WINAPI DLLExport GetConditionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA edPtr) +{ +#ifndef RUN_ONLY + // Check compatibility + if ( IS_COMPATIBLE(mV) ) + { + HMENU Menu = CreatePopupMenu(); + menucpy(Menu, Edif::ConditionMenu); + return Menu; + } +#endif // !defined(RUN_ONLY) + return NULL; +} + +HMENU WINAPI DLLExport GetActionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA edPtr) +{ +#ifndef RUN_ONLY + // Check compatibility + if ( IS_COMPATIBLE(mV) ) + { + HMENU Menu = CreatePopupMenu(); + menucpy(Menu, Edif::ActionMenu); + return Menu; + } +#endif // !defined(RUN_ONLY) + return NULL; +} + +HMENU WINAPI DLLExport GetExpressionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA edPtr) +{ +#ifndef RUN_ONLY + // Check compatibility + if ( IS_COMPATIBLE(mV) ) + { + HMENU Menu = CreatePopupMenu(); + menucpy(Menu, Edif::ExpressionMenu); + return Menu; + } +#endif // !defined(RUN_ONLY) + return NULL; +} + +#ifdef _UNICODE +#define _tstring wstring +#else +#define _tstring string +#endif + +void AddDirectory(_tstring &From, _tstring &To) +{ + HANDLE FileHandle; + WIN32_FIND_DATA Filejson; + + _tstring SearchString; + + SearchString += From; + SearchString += _T("*.*"); + + FileHandle = FindFirstFile(SearchString.c_str(), &Filejson); + + if(FileHandle == INVALID_HANDLE_VALUE) + return; + + do + { + if(*Filejson.cFileName == '.') + continue; + + if((Filejson.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) + { + _tstring OldPath; + + OldPath += From; + OldPath += Filejson.cFileName; + OldPath += _T("\\"); + + _tstring NewPath; + + NewPath += To; + NewPath += Filejson.cFileName; + NewPath += _T("\\"); + + CreateDirectory(NewPath.c_str(), 0); + AddDirectory(OldPath, NewPath); + + continue; + } + + CopyFile((From + Filejson.cFileName).c_str(), (To + Filejson.cFileName).c_str(), FALSE); + + } while(FindNextFile(FileHandle, &Filejson)); + + FindClose(FileHandle); +} + +void WINAPI PrepareFlexBuild(LPMV pMV, LPEDATA edPtr, LPCWSTR wTempFolder) +{ +#if !defined(RUN_ONLY) + + TCHAR FlashFolderPath[MAX_PATH]; + Edif::GetSiblingPath(FlashFolderPath, _T("Flash")); + + if (!*FlashFolderPath) + return; + + LPTSTR TempFolder; + +#ifdef _UNICODE + TempFolder = (LPTSTR)wTempFolder; +#else + { size_t Length = WideCharToMultiByte(CP_ACP, 0, wTempFolder, -1, 0, 0, 0, 0); + TempFolder = (LPSTR) alloca(Length + 1); + + WideCharToMultiByte(CP_ACP, 0, wTempFolder, -1, TempFolder, Length, 0, 0); + } +#endif + + AddDirectory(((_tstring) FlashFolderPath + _T("\\")), (_tstring) TempFolder); + +#endif // !defined(RUN_ONLY) +} diff --git a/Lib/Edif.General.cpp b/Lib/Edif.General.cpp index 7d49fb8..0faa17d 100644 --- a/Lib/Edif.General.cpp +++ b/Lib/Edif.General.cpp @@ -1,203 +1,203 @@ -#include "Common.h" - -LPCTSTR * Dependencies = 0; - -LPCTSTR * WINAPI DLLExport GetDependencies() -{ - if(!Dependencies) - { - const json_value &DependenciesJSON = SDK->json["About"]["Dependencies"]; - - Dependencies = new LPCTSTR [DependenciesJSON.u.array.length + 2]; - - int Offset = 0; - - if (Edif::ExternalJSON) - { - TCHAR * JSONFilename = (TCHAR *)malloc(MAX_PATH * sizeof(TCHAR)); - - GetModuleFileName (hInstLib, JSONFilename, MAX_PATH); - - TCHAR * Iterator = JSONFilename + _tcslen(JSONFilename) - 1; - - while(*Iterator != '.') - -- Iterator; - - _tcscpy(++ Iterator, _T("json")); - - Iterator = JSONFilename + _tcslen(JSONFilename) - 1; - - while(*Iterator != '\\' && *Iterator != '/') - -- Iterator; - - Dependencies [Offset ++] = ++ Iterator; - } - - unsigned int i = 0; - - for(; i < DependenciesJSON.u.array.length; ++ i) - { - TCHAR* tstr = Edif::ConvertString(DependenciesJSON[i]); - Dependencies[Offset + i] = tstr; - //Edif::FreeString(tstr); - } - - Dependencies[Offset + i] = 0; - } - - return Dependencies; -} - -short WINAPI DLLExport GetRunObjectInfos(mv _far *mV, fpKpxRunInfos infoPtr) -{ - infoPtr->conditions = &SDK->ConditionJumps[0]; - infoPtr->actions = &SDK->ActionJumps[0]; - infoPtr->expressions = &SDK->ExpressionJumps[0]; - - infoPtr->numOfConditions = SDK->json["Conditions"].u.array.length; - infoPtr->numOfActions = SDK->json["Actions"].u.array.length; - infoPtr->numOfExpressions = SDK->json["Expressions"].u.array.length; - - infoPtr->editDataSize = sizeof(EDITDATA); - - infoPtr->windowProcPriority = Extension::WindowProcPriority; - - infoPtr->editFlags = Extension::OEFLAGS; - infoPtr->editPrefs = Extension::OEPREFS; - - memcpy(&infoPtr->identifier, SDK->json["About"]["Identifier"], 4); - - infoPtr->version = Extension::Version; - - return TRUE; -} - -extern "C" -{ - DWORD WINAPI DLLExport GetInfos(int info) - { - - switch (info) - { - case KGI_VERSION: - return EXT_VERSION2; - - case KGI_PLUGIN: - return EXT_PLUGIN_VERSION1; - - case KGI_PRODUCT: - - #ifdef PROEXT - return PRODUCT_VERSION_DEV; - #endif - - #ifdef TGFEXT - return PRODUCT_VERSION_HOME; - #endif - - return PRODUCT_VERSION_STANDARD; - - case KGI_BUILD: - return Extension::MinimumBuild; - - case KGI_UNICODE: - - #ifdef _UNICODE - return TRUE; - #else - return FALSE; - #endif - - default: - return 0; - } - } -} - -short WINAPI DLLExport CreateRunObject(LPRDATA rdPtr, LPEDATA edPtr, fpcob cobPtr) -{ - /* Global to all extensions! Use the constructor of your Extension class (Extension.cpp) instead! */ - - rdPtr->rc = 0; - rdPtr->rm = 0; - rdPtr->rs = 0; - rdPtr->rv = 0; - unsigned off = 0; - if(Extension::OEFLAGS & OEFLAG_MOVEMENTS - || Extension::OEFLAGS & OEFLAG_SPRITES) - { - rdPtr->rc = (rCom *)(rdPtr->r + off); - off += sizeof(rCom); - } - if(Extension::OEFLAGS & OEFLAG_MOVEMENTS) - { - rdPtr->rm = (rMvt *)(rdPtr->r + off); - off += sizeof(rMvt); - } - if(Extension::OEFLAGS & OEFLAG_SPRITES) - { - rdPtr->rs = (rSpr *)(rdPtr->r + off); - off += sizeof(rSpr); - } - if(Extension::OEFLAGS & OEFLAG_VALUES) - { - rdPtr->rv = (rVal *)(rdPtr->r + off); - } - rdPtr->pExtension = new Extension(rdPtr, edPtr, cobPtr); - rdPtr->pExtension->Runtime.ObjectSelection.pExtension = rdPtr->pExtension; - - return 0; -} - - -/* Don't touch any of these, they're global to all extensions! See Extension.cpp */ - -short WINAPI DLLExport DestroyRunObject(LPRDATA rdPtr, long fast) -{ - delete rdPtr->pExtension; - - return 0; -} - -short WINAPI DLLExport HandleRunObject(LPRDATA rdPtr) -{ - return rdPtr->pExtension->Handle(); -} - -short WINAPI DLLExport DisplayRunObject(LPRDATA rdPtr) -{ - return rdPtr->pExtension->Display(); -} - -ushort WINAPI DLLExport GetRunObjectDataSize(fprh rhPtr, LPEDATA edPtr) -{ - return(sizeof(RUNDATA)); -} - -short WINAPI DLLExport PauseRunObject(LPRDATA rdPtr) -{ - return rdPtr->pExtension->Pause(); -} - -short WINAPI DLLExport ContinueRunObject(LPRDATA rdPtr) -{ - return rdPtr->pExtension->Continue(); -} - -BOOL WINAPI SaveRunObject(LPRDATA rdPtr, HANDLE hf) -{ - return rdPtr->pExtension->Save(hf) ? TRUE : FALSE; -} - -BOOL WINAPI LoadRunObject(LPRDATA rdPtr, HANDLE hf) -{ - return rdPtr->pExtension->Load(hf) ? TRUE : FALSE; -} - -LPEVENTINFOS2 GetEventInformations(LPEVENTINFOS2 eiPtr, short code) -{ - while(eiPtr->infos.code != code) - eiPtr = EVINFO2_NEXT(eiPtr); - - return eiPtr; -} +#include "Common.h" + +LPCTSTR * Dependencies = 0; + +LPCTSTR * WINAPI DLLExport GetDependencies() +{ + if(!Dependencies) + { + const json_value &DependenciesJSON = SDK->json["About"]["Dependencies"]; + + Dependencies = new LPCTSTR [DependenciesJSON.u.array.length + 2]; + + int Offset = 0; + + if (Edif::ExternalJSON) + { + TCHAR * JSONFilename = (TCHAR *)malloc(MAX_PATH * sizeof(TCHAR)); + + GetModuleFileName (hInstLib, JSONFilename, MAX_PATH); + + TCHAR * Iterator = JSONFilename + _tcslen(JSONFilename) - 1; + + while(*Iterator != '.') + -- Iterator; + + _tcscpy(++ Iterator, _T("json")); + + Iterator = JSONFilename + _tcslen(JSONFilename) - 1; + + while(*Iterator != '\\' && *Iterator != '/') + -- Iterator; + + Dependencies [Offset ++] = ++ Iterator; + } + + unsigned int i = 0; + + for(; i < DependenciesJSON.u.array.length; ++ i) + { + TCHAR* tstr = Edif::ConvertString(DependenciesJSON[i]); + Dependencies[Offset + i] = tstr; + //Edif::FreeString(tstr); + } + + Dependencies[Offset + i] = 0; + } + + return Dependencies; +} + +short WINAPI DLLExport GetRunObjectInfos(mv _far *mV, fpKpxRunInfos infoPtr) +{ + infoPtr->conditions = &SDK->ConditionJumps[0]; + infoPtr->actions = &SDK->ActionJumps[0]; + infoPtr->expressions = &SDK->ExpressionJumps[0]; + + infoPtr->numOfConditions = SDK->json["Conditions"].u.array.length; + infoPtr->numOfActions = SDK->json["Actions"].u.array.length; + infoPtr->numOfExpressions = SDK->json["Expressions"].u.array.length; + + infoPtr->editDataSize = sizeof(EDITDATA); + + infoPtr->windowProcPriority = Extension::WindowProcPriority; + + infoPtr->editFlags = Extension::OEFLAGS; + infoPtr->editPrefs = Extension::OEPREFS; + + memcpy(&infoPtr->identifier, SDK->json["About"]["Identifier"], 4); + + infoPtr->version = Extension::Version; + + return TRUE; +} + +extern "C" +{ + DWORD WINAPI DLLExport GetInfos(int info) + { + + switch (info) + { + case KGI_VERSION: + return EXT_VERSION2; + + case KGI_PLUGIN: + return EXT_PLUGIN_VERSION1; + + case KGI_PRODUCT: + + #ifdef PROEXT + return PRODUCT_VERSION_DEV; + #endif + + #ifdef TGFEXT + return PRODUCT_VERSION_HOME; + #endif + + return PRODUCT_VERSION_STANDARD; + + case KGI_BUILD: + return Extension::MinimumBuild; + + case KGI_UNICODE: + + #ifdef _UNICODE + return TRUE; + #else + return FALSE; + #endif + + default: + return 0; + } + } +} + +short WINAPI DLLExport CreateRunObject(LPRDATA rdPtr, LPEDATA edPtr, fpcob cobPtr) +{ + /* Global to all extensions! Use the constructor of your Extension class (Extension.cpp) instead! */ + + rdPtr->rc = 0; + rdPtr->rm = 0; + rdPtr->rs = 0; + rdPtr->rv = 0; + unsigned off = 0; + if(Extension::OEFLAGS & OEFLAG_MOVEMENTS + || Extension::OEFLAGS & OEFLAG_SPRITES) + { + rdPtr->rc = (rCom *)(rdPtr->r + off); + off += sizeof(rCom); + } + if(Extension::OEFLAGS & OEFLAG_MOVEMENTS) + { + rdPtr->rm = (rMvt *)(rdPtr->r + off); + off += sizeof(rMvt); + } + if(Extension::OEFLAGS & OEFLAG_SPRITES) + { + rdPtr->rs = (rSpr *)(rdPtr->r + off); + off += sizeof(rSpr); + } + if(Extension::OEFLAGS & OEFLAG_VALUES) + { + rdPtr->rv = (rVal *)(rdPtr->r + off); + } + rdPtr->pExtension = new Extension(rdPtr, edPtr, cobPtr); + rdPtr->pExtension->Runtime.ObjectSelection.pExtension = rdPtr->pExtension; + + return 0; +} + + +/* Don't touch any of these, they're global to all extensions! See Extension.cpp */ + +short WINAPI DLLExport DestroyRunObject(LPRDATA rdPtr, long fast) +{ + delete rdPtr->pExtension; + + return 0; +} + +short WINAPI DLLExport HandleRunObject(LPRDATA rdPtr) +{ + return rdPtr->pExtension->Handle(); +} + +short WINAPI DLLExport DisplayRunObject(LPRDATA rdPtr) +{ + return rdPtr->pExtension->Display(); +} + +ushort WINAPI DLLExport GetRunObjectDataSize(fprh rhPtr, LPEDATA edPtr) +{ + return(sizeof(RUNDATA)); +} + +short WINAPI DLLExport PauseRunObject(LPRDATA rdPtr) +{ + return rdPtr->pExtension->Pause(); +} + +short WINAPI DLLExport ContinueRunObject(LPRDATA rdPtr) +{ + return rdPtr->pExtension->Continue(); +} + +BOOL WINAPI SaveRunObject(LPRDATA rdPtr, HANDLE hf) +{ + return rdPtr->pExtension->Save(hf) ? TRUE : FALSE; +} + +BOOL WINAPI LoadRunObject(LPRDATA rdPtr, HANDLE hf) +{ + return rdPtr->pExtension->Load(hf) ? TRUE : FALSE; +} + +LPEVENTINFOS2 GetEventInformations(LPEVENTINFOS2 eiPtr, short code) +{ + while(eiPtr->infos.code != code) + eiPtr = EVINFO2_NEXT(eiPtr); + + return eiPtr; +} diff --git a/Lib/Edif.Runtime.cpp b/Lib/Edif.Runtime.cpp index 6b20f87..c3f74b5 100644 --- a/Lib/Edif.Runtime.cpp +++ b/Lib/Edif.Runtime.cpp @@ -10,125 +10,125 @@ Edif::Runtime::~Runtime() void Edif::Runtime::Rehandle() { - callRunTimeFunction(rdPtr, RFUNCTION_REHANDLE, 0, 0); + callRunTimeFunction(rdPtr, RFUNCTION_REHANDLE, 0, 0); } void Edif::Runtime::GenerateEvent(int EventID) { - callRunTimeFunction(rdPtr, RFUNCTION_GENERATEEVENT, EventID, 0); + callRunTimeFunction(rdPtr, RFUNCTION_GENERATEEVENT, EventID, 0); } void Edif::Runtime::PushEvent(int EventID) { - callRunTimeFunction(rdPtr, RFUNCTION_PUSHEVENT, EventID, 0); + callRunTimeFunction(rdPtr, RFUNCTION_PUSHEVENT, EventID, 0); } void * Edif::Runtime::Allocate(size_t Size) { - return (void *) callRunTimeFunction(rdPtr, RFUNCTION_GETSTRINGSPACE_EX, 0, Size * sizeof(TCHAR)); + return (void *) callRunTimeFunction(rdPtr, RFUNCTION_GETSTRINGSPACE_EX, 0, Size * sizeof(TCHAR)); } TCHAR * Edif::Runtime::CopyString(const TCHAR * String) { - TCHAR * New = (TCHAR *) Allocate(_tcslen(String) + 1); - _tcscpy(New, String); - - return New; + TCHAR * New = (TCHAR *) Allocate(_tcslen(String) + 1); + _tcscpy(New, String); + + return New; } void Edif::Runtime::Pause() { - callRunTimeFunction(rdPtr, RFUNCTION_PAUSE, 0, 0); + callRunTimeFunction(rdPtr, RFUNCTION_PAUSE, 0, 0); } void Edif::Runtime::Resume() { - callRunTimeFunction(rdPtr, RFUNCTION_CONTINUE, 0, 0); + callRunTimeFunction(rdPtr, RFUNCTION_CONTINUE, 0, 0); } void Edif::Runtime::Redisplay() { - callRunTimeFunction(rdPtr, RFUNCTION_REDISPLAY, 0, 0); + callRunTimeFunction(rdPtr, RFUNCTION_REDISPLAY, 0, 0); } void Edif::Runtime::GetApplicationDrive(TCHAR * Buffer) { - callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_DRIVE, (long) Buffer); + callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_DRIVE, (long) Buffer); } void Edif::Runtime::GetApplicationDirectory(TCHAR * Buffer) { - callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_DIR, (long) Buffer); + callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_DIR, (long) Buffer); } void Edif::Runtime::GetApplicationPath(TCHAR * Buffer) { - callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_PATH, (long) Buffer); + callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_PATH, (long) Buffer); } void Edif::Runtime::GetApplicationName(TCHAR * Buffer) { - callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_APPNAME, (long) Buffer); + callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_APPNAME, (long) Buffer); } void Edif::Runtime::GetApplicationTempPath(TCHAR * Buffer) { - callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_TEMPPATH, (long) Buffer); + callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_TEMPPATH, (long) Buffer); } void Edif::Runtime::Redraw() { - callRunTimeFunction(rdPtr, RFUNCTION_REDRAW, 0, 0); + callRunTimeFunction(rdPtr, RFUNCTION_REDRAW, 0, 0); } void Edif::Runtime::Destroy() { - callRunTimeFunction(rdPtr, RFUNCTION_DESTROY, 0, 0); + callRunTimeFunction(rdPtr, RFUNCTION_DESTROY, 0, 0); } void Edif::Runtime::ExecuteProgram(prgParam * Program) { - callRunTimeFunction(rdPtr, RFUNCTION_EXECPROGRAM, 0, (long) Program); + callRunTimeFunction(rdPtr, RFUNCTION_EXECPROGRAM, 0, (long) Program); } long Edif::Runtime::EditInteger(EditDebugInfo * EDI) { - return callRunTimeFunction(rdPtr, RFUNCTION_EDITINT, 0, (long) EDI); + return callRunTimeFunction(rdPtr, RFUNCTION_EDITINT, 0, (long) EDI); } long Edif::Runtime::EditText(EditDebugInfo * EDI) { - return callRunTimeFunction(rdPtr, RFUNCTION_EDITTEXT, 0, (long) EDI); + return callRunTimeFunction(rdPtr, RFUNCTION_EDITTEXT, 0, (long) EDI); } void Edif::Runtime::CallMovement(int ID, long Parameter) { - callRunTimeFunction(rdPtr, RFUNCTION_CALLMOVEMENT, ID, Parameter); + callRunTimeFunction(rdPtr, RFUNCTION_CALLMOVEMENT, ID, Parameter); } void Edif::Runtime::SetPosition(int X, int Y) { - callRunTimeFunction(rdPtr, RFUNCTION_SETPOSITION, X, Y); + callRunTimeFunction(rdPtr, RFUNCTION_SETPOSITION, X, Y); } CallTables* Edif::Runtime::GetCallTables() { - return (CallTables*)callRunTimeFunction(rdPtr, RFUNCTION_GETCALLTABLES, 0, 0); + return (CallTables*)callRunTimeFunction(rdPtr, RFUNCTION_GETCALLTABLES, 0, 0); } bool Edif::Runtime::IsHWA() { - return rdPtr->rHo.hoAdRunHeader->rh4.rh4Mv->mvCallFunction(NULL, 112, 0, 0, 0) == 1; + return rdPtr->rHo.hoAdRunHeader->rh4.rh4Mv->mvCallFunction(NULL, 112, 0, 0, 0) == 1; } bool Edif::Runtime::IsUnicode() { - return rdPtr->rHo.hoAdRunHeader->rh4.rh4Mv->mvCallFunction(NULL, 113, 0, 0, 0) == 1; + return rdPtr->rHo.hoAdRunHeader->rh4.rh4Mv->mvCallFunction(NULL, 113, 0, 0, 0) == 1; } event &Edif::Runtime::CurrentEvent() { - return *(event *) (((char *) param1) - CND_SIZE); + return *(event *) (((char *) param1) - CND_SIZE); } LPRO Edif::Runtime::LPROFromFixed(int fixedvalue) @@ -172,106 +172,106 @@ extern HINSTANCE hInstLib; struct EdifGlobal { - TCHAR Name[256]; - void * Value; + TCHAR Name[256]; + void * Value; - EdifGlobal * Next; + EdifGlobal * Next; }; void Edif::Runtime::WriteGlobal(const TCHAR * Name, void * Value) { - LPRH rhPtr = rdPtr->rHo.hoAdRunHeader; + LPRH rhPtr = rdPtr->rHo.hoAdRunHeader; while(rhPtr->rhApp->m_pParentApp) rhPtr = rhPtr->rhApp->m_pParentApp->m_Frame->m_rhPtr; - EdifGlobal * Global = (EdifGlobal *) rhPtr->rh4.rh4Mv->mvGetExtUserData(rhPtr->rhApp, hInstLib); + EdifGlobal * Global = (EdifGlobal *) rhPtr->rh4.rh4Mv->mvGetExtUserData(rhPtr->rhApp, hInstLib); - if(!Global) - { - Global = new EdifGlobal; + if(!Global) + { + Global = new EdifGlobal; - _tcscpy(Global->Name, Name); - Global->Value = Value; + _tcscpy(Global->Name, Name); + Global->Value = Value; - Global->Next = 0; + Global->Next = 0; - rhPtr->rh4.rh4Mv->mvSetExtUserData(rhPtr->rhApp, hInstLib, Global); + rhPtr->rh4.rh4Mv->mvSetExtUserData(rhPtr->rhApp, hInstLib, Global); - return; - } + return; + } - while(Global) - { - if(!_tcsicmp(Global->Name, Name)) - { - Global->Value = Value; - return; - } + while(Global) + { + if(!_tcsicmp(Global->Name, Name)) + { + Global->Value = Value; + return; + } - if(!Global->Next) - break; + if(!Global->Next) + break; - Global = Global->Next; - } + Global = Global->Next; + } - Global->Next = new EdifGlobal; - Global = Global->Next; + Global->Next = new EdifGlobal; + Global = Global->Next; - _tcscpy(Global->Name, Name); + _tcscpy(Global->Name, Name); - Global->Value = Value; - Global->Next = 0; + Global->Value = Value; + Global->Next = 0; } void * Edif::Runtime::ReadGlobal(const TCHAR * Name) { - LPRH rhPtr = rdPtr->rHo.hoAdRunHeader; + LPRH rhPtr = rdPtr->rHo.hoAdRunHeader; while(rhPtr->rhApp->m_pParentApp) rhPtr = rhPtr->rhApp->m_pParentApp->m_Frame->m_rhPtr; - EdifGlobal * Global = (EdifGlobal *) rhPtr->rh4.rh4Mv->mvGetExtUserData(rhPtr->rhApp, hInstLib); + EdifGlobal * Global = (EdifGlobal *) rhPtr->rh4.rh4Mv->mvGetExtUserData(rhPtr->rhApp, hInstLib); - while(Global) - { - if(!_tcsicmp(Global->Name, Name)) - return Global->Value; + while(Global) + { + if(!_tcsicmp(Global->Name, Name)) + return Global->Value; - Global = Global->Next; - } + Global = Global->Next; + } - return 0; + return 0; } #ifdef EdifUseJS - /* Breaking versions of Edif should change these so that newer extensions don't - try to work with an older JS context. */ + /* Breaking versions of Edif should change these so that newer extensions don't + try to work with an older JS context. */ - const char * const ContextName = "JSContext-V1"; + const char * const ContextName = "JSContext-V1"; - JSContext * Edif::Runtime::GetJSContext() - { - JSContext * Context = ReadGlobal(ContextName); + JSContext * Edif::Runtime::GetJSContext() + { + JSContext * Context = ReadGlobal(ContextName); - if(!Context) - { - Context = JS_NewContext(JS_NewRuntime(8 * 1024 * 1024), 8192); + if(!Context) + { + Context = JS_NewContext(JS_NewRuntime(8 * 1024 * 1024), 8192); - JS_SetOptions(Context, JSOPTION_VAROBJFIX | JSOPTION_JIT | JSOPTION_METHODJIT | JSOPTION_NO_SCRIPT_RVAL); - JS_SetVersion(Context, JSVERSION_LATEST); - - JSObject * Global = JS_NewGlobalObject(context, &GlobalClass); + JS_SetOptions(Context, JSOPTION_VAROBJFIX | JSOPTION_JIT | JSOPTION_METHODJIT | JSOPTION_NO_SCRIPT_RVAL); + JS_SetVersion(Context, JSVERSION_LATEST); + + JSObject * Global = JS_NewGlobalObject(context, &GlobalClass); - JS_SetGlobalObject (Context, Global); - JS_InitStandardClasses(Context, Global); + JS_SetGlobalObject (Context, Global); + JS_InitStandardClasses(Context, Global); - WriteGlobal(ContextName, Context); - } + WriteGlobal(ContextName, Context); + } - return Context; - } + return Context; + } #endif diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index d52c0a6..58ace64 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -1,893 +1,893 @@ -#include "Common.h" - -Edif::SDK * SDK; - -TCHAR Edif::LanguageCode[3]; - -bool Edif::IsEdittime; -bool Edif::ExternalJSON; - -HMENU Edif::ActionMenu, Edif::ConditionMenu, Edif::ExpressionMenu; - -short ReadParameterType(const char * Text) -{ - if(!_stricmp(Text, "Text") || !_stricmp(Text, "String")) - return PARAM_EXPSTRING; - - if(!_stricmp(Text, "Filename") || !_stricmp(Text, "File")) - return PARAM_FILENAME; - - if(!_stricmp(Text, "Float")) - return PARAM_EXPRESSION; - - if(!_stricmp(Text, "Integer")) - return PARAM_EXPRESSION; - - if(!_stricmp(Text, "Object")) - return PARAM_OBJECT; - - if(!_stricmp(Text, "Position")) - return PARAM_POSITION; - - if(!_stricmp(Text, "Create")) - return PARAM_CREATE; - - if(!_stricmp(Text, "SysCreate")) - return PARAM_SYSCREATE; - - if(!_stricmp(Text, "Animation")) - return PARAM_ANIMATION; - - if(!_stricmp(Text, "Nop")) - return PARAM_NOP; - - if(!_stricmp(Text, "Player")) - return PARAM_PLAYER; - - if(!_stricmp(Text, "Every")) - return PARAM_EVERY; - - if(!_stricmp(Text, "Key")) - return PARAM_KEY; - - if(!_stricmp(Text, "Speed")) - return PARAM_SPEED; - - if(!_stricmp(Text, "JoyDirection")) - return PARAM_JOYDIRECTION; - - if(!_stricmp(Text, "Shoot")) - return PARAM_SHOOT; - - if(!_stricmp(Text, "Zone")) - return PARAM_ZONE; - - if(!_stricmp(Text, "Comparison")) - return PARAM_COMPARAISON; - - if(!_stricmp(Text, "StringComparison")) - return PARAM_CMPSTRING; - - if(!_stricmp(Text, "Colour") || !_stricmp(Text, "Color")) - return PARAM_COLOUR; - - if(!_stricmp(Text, "Frame")) - return PARAM_FRAME; - - if(!_stricmp(Text, "SampleLoop")) - return PARAM_SAMLOOP; - - if(!_stricmp(Text, "MusicLoop")) - return PARAM_MUSLOOP; - - if(!_stricmp(Text, "NewDirection")) - return PARAM_NEWDIRECTION; - - if(!_stricmp(Text, "TextNumber")) - return PARAM_TEXTNUMBER; - - if(!_stricmp(Text, "Click")) - return PARAM_CLICK; - - if(!_stricmp(Text, "Program")) - return PARAM_PROGRAM; - - if(!_strnicmp(Text, "Custom", 6)) - return PARAM_EXTBASE+atoi(Text+6); - - return 0; -} - -short ReadExpressionParameterType(const char * Text) -{ - if(!_stricmp(Text, "Text") || !_stricmp(Text, "String")) - return EXPPARAM_STRING; - - if(!_stricmp(Text, "Float")) - return EXPPARAM_LONG; - - if(!_stricmp(Text, "Integer")) - return EXPPARAM_LONG; - - return 0; -} - -void Edif::Init(mv * _far mV, LPEDATA edPtr) -{ - IsEdittime = mV->mvHMainWin != 0; - - mvInvalidateObject(mV, edPtr); -} - -void Edif::Free(mv * _far mV) -{ - delete ::SDK; - ::SDK = NULL; -} - -void Edif::Free(LPEDATA edPtr) -{ -} - -int Edif::Init(mv _far * mV) -{ - _tcscpy (LanguageCode, _T ("EN")); - - // Get pathname of MMF2 - LPTSTR mmfname = (LPTSTR)calloc(_MAX_PATH, sizeof(TCHAR)); - if ( mmfname != NULL ) - { - // Load resources - GetModuleFileName (NULL, mmfname, _MAX_PATH); - HINSTANCE hRes = LoadLibraryEx(mmfname, NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE); - if ( hRes != NULL ) - { - // Load string 720, contains the language code - TCHAR langCode[20]; - LoadString(hRes, 720, langCode, 20); - - int nCode = _ttoi(langCode); - switch (nCode) { - case 0x40C: - _tcscpy (LanguageCode, _T ("FR")); - break; - case 0x411: - _tcscpy (LanguageCode, _T ("JP")); - break; - } - - // Free resources - FreeLibrary(hRes); - } - free(mmfname); - } - - // Get JSON file - char * JSON; - size_t JSON_Size; - - int result = Edif::GetDependency (JSON, JSON_Size, _T("json"), IDR_EDIF_JSON); - - if (result == Edif::DependencyNotFound) - { - TCHAR temp [MAX_PATH]; - GetModuleFileName (hInstLib, temp, sizeof(temp)/sizeof(TCHAR)); - LPTSTR filetitle = _tcsrchr(temp, _T('\\')); - if ( filetitle != NULL ) - _tcscpy(temp, filetitle); - else - temp[0] = 0; - _tcscat(temp, _T(" - Error")); - - MessageBox(0, _T("JSON file not found on disk or in MFX resources"), temp, 0); - return -1; // error, init failed - } - - Edif::ExternalJSON = (result == Edif::DependencyWasFile); - - char * copy = (char *) malloc (JSON_Size + 1); - memcpy (copy, JSON, JSON_Size); - copy [JSON_Size] = 0; - if ( result != Edif::DependencyWasResource ) - free(JSON); - - char json_error [256]; - - json_settings settings; - memset (&settings, 0, sizeof (settings)); - - // settings.settings = json_setting_permissive_commas; - - json_value * json = json_parse_ex (&settings, copy, json_error); - - if (!json) - { - MessageBoxA(0, json_error, "Error parsing JSON", 0); - return -1; - } - - ::SDK = new Edif::SDK(mV, *json); - return 0; // no error -} - -Edif::SDK::SDK(mv * mV, json_value &_json) : json (_json) -{ - this->mV = mV; - -#ifndef RUN_ONLY - Icon = new cSurface; - if(mV->mvImgFilterMgr) - { - char * IconData; - size_t IconSize; - - int result = Edif::GetDependency (IconData, IconSize, _T("png"), IDR_EDIF_ICON); - if (result != Edif::DependencyNotFound) - { - CInputMemFile * File = CInputMemFile::NewInstance (); - File->Create ((LPBYTE)IconData, IconSize); - - DWORD PNG = FILTERID_PNG; - ImportImageFromInputFile(mV->mvImgFilterMgr, File, Icon, &PNG, 0); - - File->Delete(); - - if(!Icon->HasAlpha()) - Icon->SetTransparentColor(RGB(255, 0, 255)); - if ( result != Edif::DependencyWasResource ) - free(IconData); - } - } -#endif // RUN_ONLY - - const json_value &Actions = json["Actions"]; - const json_value &Conditions = json["Conditions"]; - const json_value &Expressions = json["Expressions"]; - - ActionJumps = new void * [Actions.u.array.length + 1]; - ConditionJumps = new void * [Conditions.u.array.length + 1]; - ExpressionJumps = new void * [Expressions.u.array.length + 1]; - - ActionJumps [Actions.u.array.length] = 0; - ConditionJumps [Conditions.u.array.length] = 0; - ExpressionJumps [Expressions.u.array.length] = 0; - - for(unsigned int i = 0; i < Actions.u.array.length; ++ i) - { - const json_value &Action = Actions[i]; - - ActionJumps [i] = (void *) Edif::Action; - - ActionFunctions.push_back(0); - - int ActionID = Edif::ActionID(i); - - ActionInfos.push_back(ActionID); // Menu ID - ActionInfos.push_back(ActionID); // String ID - ActionInfos.push_back(i); // Code - - ActionInfos.push_back(0); // Flags - - const json_value &Parameters = Action["Parameters"]; - - ActionInfos.push_back(Parameters.u.array.length); - - { short IsFloat = 0; - - for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) - { - const json_value &Parameter = Parameters[i]; - - const char * Type; - - if(Parameter.type == json_object) - Type = Parameter["Type"]; - else - Type = Parameter[0]; - - ActionInfos.push_back(ReadParameterType(Type)); - - if(!_stricmp(Type, "Float")) - IsFloat |= 1 << i; - } - - ActionFloatFlags.push_back(IsFloat); - } - - for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) - ActionInfos.push_back(0); - } - - for(unsigned int i = 0; i < Conditions.u.array.length; ++ i) - { - const json_value &Condition = Conditions[i]; - - ConditionJumps [i] = (void *) Edif::Condition; - - ConditionFunctions.push_back(0); - - int ConditionID = Edif::ConditionID(i); - - ConditionInfos.push_back(ConditionID); - ConditionInfos.push_back(ConditionID); - ConditionInfos.push_back(i); - - ConditionInfos.push_back(((bool) Condition["Triggered"]) ? 0 : (EVFLAGS_ALWAYS | EVFLAGS_NOTABLE)); - - const json_value &Parameters = Condition["Parameters"]; - - ConditionInfos.push_back(Parameters.u.array.length); - - { short IsFloat = 0; - - for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) - { - const json_value &Parameter = Parameters[i]; - - const char * Type; - - if(Parameter.type == json_object) - Type = Parameter["Type"]; - else - Type = Parameter[0]; - - ConditionInfos.push_back(ReadParameterType(Type)); - - if(!_stricmp(Type, "Float")) - IsFloat |= 1 << i; - } - - ConditionFloatFlags.push_back(IsFloat); - } - - for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) - ConditionInfos.push_back(0); - } - - for(unsigned int i = 0; i < Expressions.u.array.length; ++ i) - { - const json_value &Expression = Expressions[i]; - - ExpressionJumps [i] = (void *) Edif::Expression; - - ExpressionFunctions.push_back(0); - - if(!_stricmp(Expression["Returns"], "Integer")) - ExpressionTypes.push_back(0); - else if(!_stricmp(Expression["Returns"], "Float")) - ExpressionTypes.push_back(1); - else if(!_stricmp(Expression["Returns"], "Text") || !_stricmp(Expression["Returns"], "String")) - ExpressionTypes.push_back(2); - else - ExpressionTypes.push_back(0); - - int ExpressionID = Edif::ExpressionID(i); - - ExpressionInfos.push_back(ExpressionID); - ExpressionInfos.push_back(ExpressionID); - ExpressionInfos.push_back(i); - - { short FlagsValue = 0; - - if(ExpressionTypes.back() == 1) - FlagsValue |= EXPFLAG_DOUBLE; - - if(ExpressionTypes.back() == 2) - FlagsValue |= EXPFLAG_STRING; - - ExpressionInfos.push_back(FlagsValue); - } - - const json_value &Parameters = Expression["Parameters"]; - - ExpressionInfos.push_back(Parameters.u.array.length); - - { short IsFloat = 0; - - for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) - { - const json_value &Parameter = Parameters[i]; - - const char * Type; - - if(Parameter.type == json_object) - Type = Parameter["Type"]; - else - Type = Parameter[0]; - - ExpressionInfos.push_back(ReadExpressionParameterType(Type)); - - if(!_stricmp(Type, "Float")) - IsFloat |= 1 << i; - } - - ExpressionFloatFlags.push_back(IsFloat); - } - - for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) - ExpressionInfos.push_back(0); - } - - ActionMenu = LoadMenuJSON(Edif::ActionID(0), json["ActionMenu"]); - ConditionMenu = LoadMenuJSON(Edif::ConditionID(0), json["ConditionMenu"]); - ExpressionMenu = LoadMenuJSON(Edif::ExpressionID(0), json["ExpressionMenu"]); -} - -Edif::SDK::~SDK() -{ - json_value_free (&json); - - delete [] ActionJumps; - delete [] ConditionJumps; - delete [] ExpressionJumps; - - delete Icon; -} - -int ActionOrCondition(vector &FloatFlags, LPEVENTINFOS2 Info, void * Function, int ID, LPRDATA rdPtr, long param1, long param2) -{ - int * Parameters; - int ParameterCount; - - { Info = GetEventInformations(Info, ID); - - ParameterCount = Info->infos.nParams; - Parameters = (int *) alloca(sizeof(int) * ParameterCount); - - for(int i = 0; i < ParameterCount; ++ i) - { - switch(EVINFO2_PARAM(Info, i)) - { - case PARAM_EXPRESSION: - - if((FloatFlags[ID] & (1 << i)) != 0) - { - Parameters[i] = CNC_GetFloatParameter(rdPtr); - break; - } - - Parameters[i] = CNC_GetIntParameter(rdPtr); - break; - - case PARAM_EXPSTRING: - case PARAM_FILENAME: - - Parameters[i] = CNC_GetStringParameter(rdPtr); - break; - - default: - - Parameters[i] = CNC_GetParameter(rdPtr); - break; - } - } - } - - void * Extension = rdPtr->pExtension; - - int Result; - - __asm - { - pushad - - mov ecx, ParameterCount - - cmp ecx, 0 - je CallNow - - mov edx, Parameters - - mov ebx, ecx - shl ebx, 2 - - add edx, ebx - sub edx, 4 - - PushLoop: - - push [edx] - sub edx, 4 - - dec ecx - - cmp ecx, 0 - jne PushLoop - - CallNow: - - mov ecx, Extension - call Function - - mov Result, eax - - popad - } - - return Result; -} - -HMENU Edif::LoadMenuJSON(int BaseID, const json_value &Source, HMENU Parent) -{ - if(!Parent) - Parent = CreateMenu(); - - for(unsigned int i = 0; i < Source.u.array.length; ++ i) - { - const json_value &MenuItem = Source[i]; - - if(MenuItem.type == json_string) - { - if(!_stricmp(MenuItem, "Separator")) - { - AppendMenu(Parent, MF_BYPOSITION | MF_SEPARATOR, 0, 0); - continue; - } - - continue; - } - - if(MenuItem[0].type == json_string && MenuItem[1].type == json_array) - { - HMENU SubMenu = CreatePopupMenu(); - LoadMenuJSON(BaseID, MenuItem, SubMenu); - - TCHAR* str = ConvertString(MenuItem[0]); - AppendMenu(Parent, MF_BYPOSITION | MF_STRING | MF_POPUP, (UINT) SubMenu, str); - FreeString(str); - - continue; - } - - unsigned int ItemOffset = 0; - - int ID = BaseID + (int) MenuItem[ItemOffset].u.integer; - TCHAR * Text = ConvertString(MenuItem[ItemOffset + 1]); - bool Disabled = MenuItem.u.array.length > (ItemOffset + 2) ? ((bool) MenuItem[ItemOffset + 2]) != 0 : false; - - AppendMenu(Parent, Disabled ? MF_GRAYED | MF_UNCHECKED | MF_BYPOSITION | MF_STRING - : MF_BYPOSITION | MF_STRING, ID, Text); - - FreeString(Text); - } - - return Parent; -} - -long __stdcall Edif::Condition(LPRDATA rdPtr, long param1, long param2) -{ - int ID = rdPtr->rHo.hoEventNumber; - - rdPtr->pExtension->Runtime.param1 = param1; - rdPtr->pExtension->Runtime.param2 = param2; - - void * Function = ::SDK->ConditionFunctions[ID]; - - if(!Function) - return rdPtr->pExtension->Condition(ID, rdPtr, param1, param2); - - int Result = ActionOrCondition(::SDK->ConditionFloatFlags, (LPEVENTINFOS2) &::SDK->ConditionInfos[0], - Function, ID, rdPtr, param1, param2); - - return *(char *) &Result; -} - -short __stdcall Edif::Action(LPRDATA rdPtr, long param1, long param2) -{ - /* int ID = rdPtr->rHo.hoAdRunHeader->rh4.rh4ActionStart->evtNum; */ - int ID = rdPtr->rHo.hoEventNumber; - - rdPtr->pExtension->Runtime.param1 = param1; - rdPtr->pExtension->Runtime.param2 = param2; - - void * Function = ::SDK->ActionFunctions[ID]; - - if(!Function) - { - rdPtr->pExtension->Action(ID, rdPtr, param1, param2); - return 0; - } - - ActionOrCondition(::SDK->ActionFloatFlags, (LPEVENTINFOS2) &::SDK->ActionInfos[0], - Function, ID, rdPtr, param1, param2); - - return 0; -} - - -long __stdcall Edif::Expression(LPRDATA rdPtr, long param) -{ - int ID = rdPtr->rHo.hoEventNumber; - - rdPtr->pExtension->Runtime.param1 = param; - rdPtr->pExtension->Runtime.param2 = 0; - - int * Parameters; - int ParameterCount; - - void * Function = ::SDK->ExpressionFunctions[ID]; - - if(!Function) - return rdPtr->pExtension->Expression(ID, rdPtr, param); - - { LPEVENTINFOS2 Infos = GetEventInformations((LPEVENTINFOS2) &::SDK->ExpressionInfos[0], ID); - - ParameterCount = Infos->infos.nParams; - Parameters = (int *) alloca(sizeof(int) * ParameterCount); - - for(int i = 0; i < ParameterCount; ++ i) - { - switch(EVINFO2_PARAM(Infos, i)) - { - case EXPPARAM_STRING: - - if(!i) - { - Parameters[i] = CNC_GetFirstExpressionParameter(rdPtr, param, TYPE_STRING); - break; - } - - Parameters[i] = CNC_GetNextExpressionParameter(rdPtr, param, TYPE_STRING); - break; - - case EXPPARAM_LONG: - - int Type = ((::SDK->ExpressionFloatFlags[ID] & (1 << i)) != 0) ? TYPE_FLOAT : TYPE_LONG; - - if(!i) - { - Parameters[i] = CNC_GetFirstExpressionParameter(rdPtr, param, Type); - break; - } - - Parameters[i] = CNC_GetNextExpressionParameter(rdPtr, param, Type); - break; - } - } - } - - void * Extension = rdPtr->pExtension; - - int Result; - int ExpressionType = ::SDK->ExpressionTypes[ID]; - - __asm - { - pushad - - mov ecx, ParameterCount - - cmp ecx, 0 - je CallNow - - mov edx, Parameters - - mov ebx, ecx - shl ebx, 2 - - add edx, ebx - sub edx, 4 - - PushLoop: - - push [edx] - sub edx, 4 - - dec ecx - - cmp ecx, 0 - jne PushLoop - - CallNow: - - mov ecx, Extension - call Function - - mov ecx, ExpressionType; - - cmp ecx, 1 - jne NotFloat - - fstp Result - jmp End - - NotFloat: - - mov Result, eax - - End: - - popad - } - - switch(ExpressionType) - { - case 1: // Float - { - rdPtr->rHo.hoFlags |= HOF_FLOAT; - break; - } - - case 2: // String - { - rdPtr->rHo.hoFlags |= HOF_STRING; - break; - } - }; - - return Result; -} - -int Edif::GetDependency (char *& Buffer, size_t &Size, const TCHAR * FileExtension, int Resource) -{ - TCHAR Filename [MAX_PATH]; - GetSiblingPath (Filename, FileExtension); - - Buffer = NULL; - if (*Filename) - { - FILE * File = NULL; - int error = _tfopen_s(&File, Filename, _T("rb")); - - if (!File) - return DependencyNotFound; - - fseek (File, 0, SEEK_END); - Size = ftell (File); - fseek (File, 0, SEEK_SET); - - Buffer = (char *) malloc (Size + 1); - Buffer [Size] = 0; - - fread (Buffer, 1, Size, File); - - fclose (File); - - return DependencyWasFile; - } - - if (!Resource) - return DependencyNotFound; - - HRSRC res = FindResource (hInstLib, MAKEINTRESOURCE (Resource), _T("EDIF")); - - if (!res) - return DependencyNotFound; - - Size = SizeofResource (hInstLib, res); - Buffer = (char *) LockResource (LoadResource (hInstLib, res)); - - return DependencyWasResource; -} - -static void GetSiblingPath (TCHAR * Buffer, const TCHAR * FileExtension) -{ - TCHAR temp [MAX_PATH]; - - GetModuleFileName (hInstLib, temp, sizeof(temp)/sizeof(TCHAR)); - - TCHAR * Filename = temp + _tcslen(temp) - 1; - - while(*Filename != '.') - -- Filename; - - _tcscpy(++ Filename, FileExtension); - - Filename = Filename + _tcslen(Filename) - 1; - - while(*Filename != '\\' && *Filename != '/') - -- Filename; - - ++ Filename; - - // Is the file in the directory of the MFX? (if so, use this pathname) - TCHAR FullFilename [MAX_PATH]; - _tcscpy(FullFilename, temp); - if(GetFileAttributes(FullFilename) == 0xFFFFFFFF) - { - // No => editor - TCHAR ExecutablePath [MAX_PATH]; - GetModuleFileName (GetModuleHandle (0), ExecutablePath, sizeof(ExecutablePath)/sizeof(TCHAR)); - - { TCHAR * Iterator = ExecutablePath + _tcslen(ExecutablePath) - 1; - - while(*Iterator != '\\' && *Iterator != '/') - -- Iterator; - - *Iterator = 0; - } - - // Same path as the executable? - _stprintf_s(FullFilename, sizeof(ExecutablePath)/sizeof(TCHAR), _T("%s/%s"), ExecutablePath, Filename); - if(GetFileAttributes(FullFilename) == 0xFFFFFFFF) - { - // No => try Data/Runtime - _stprintf_s(FullFilename, sizeof(ExecutablePath)/sizeof(TCHAR), _T("%s/Data/Runtime/%s"), ExecutablePath, Filename); - if(GetFileAttributes(FullFilename) == 0xFFFFFFFF) - { - // No => try .. (maybe we're in the Unicode or HWA folder) - _stprintf_s(FullFilename, sizeof(ExecutablePath)/sizeof(TCHAR), _T("%s/../%s"), ExecutablePath, Filename); - if(GetFileAttributes(FullFilename) == 0xFFFFFFFF) - { - *Buffer = 0; - return; - } - } - } - } - - _tcscpy(Buffer, FullFilename); -} - -void Edif::GetSiblingPath (TCHAR * Buffer, const TCHAR * FileExtension) -{ - TCHAR * Extension = (TCHAR *) - alloca ((_tcslen (FileExtension) + _tcslen (LanguageCode) + 2) * sizeof(TCHAR)); - - _tcscpy (Extension, LanguageCode); - _tcscat (Extension, _T (".")); - _tcscat (Extension, FileExtension); - - ::GetSiblingPath (Buffer, Extension); - - if (*Buffer) - return; - - ::GetSiblingPath (Buffer, FileExtension); -} - -#ifdef _UNICODE -WCHAR* Edif::ConvertString(const char* utf8String) -{ - size_t Length = MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, 0, 0); - if ( Length == 0 ) - Length = 1; - WCHAR* tstr = (WCHAR*)calloc(Length, sizeof(WCHAR)); - MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, tstr, Length); - return tstr; -} - -WCHAR* Edif::ConvertAndCopyString(WCHAR* tstr, const char* utf8String, int maxLength) -{ - MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, tstr, maxLength); - return tstr; -} -#else -char* Edif::ConvertString(const char* utf8String) -{ - // Convert string to Unicode - size_t Length = MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, 0, 0); - if ( Length == 0 ) - Length = 1; - WCHAR* wstr = (WCHAR*)calloc(Length, sizeof(WCHAR)); - MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, wstr, Length); - - // Convert Unicode string using current user code page - int len2 = WideCharToMultiByte(CP_ACP, 0, wstr, -1, 0, 0, NULL, NULL); - if ( len2 == 0 ) - len2 = 1; - char* str = (char*)calloc(len2, sizeof(char)); - WideCharToMultiByte(CP_ACP, 0, wstr, -1, str, len2, NULL, NULL); - free(wstr); - - return str; -} - -char* Edif::ConvertAndCopyString(char* str, const char* utf8String, int maxLength) -{ - // MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, tstr, maxLength); - - // Convert string to Unicode - size_t Length = MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, 0, 0); - if ( Length == 0 ) - Length = 1; - WCHAR* wstr = (WCHAR*)calloc(Length, sizeof(WCHAR)); - MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, wstr, Length); - - // Convert Unicode string using current user code page - WideCharToMultiByte(CP_ACP, 0, wstr, -1, str, maxLength, NULL, NULL); - free(wstr); - - return str; -} -#endif // _UNICODE +#include "Common.h" + +Edif::SDK * SDK; + +TCHAR Edif::LanguageCode[3]; + +bool Edif::IsEdittime; +bool Edif::ExternalJSON; + +HMENU Edif::ActionMenu, Edif::ConditionMenu, Edif::ExpressionMenu; + +short ReadParameterType(const char * Text) +{ + if(!_stricmp(Text, "Text") || !_stricmp(Text, "String")) + return PARAM_EXPSTRING; + + if(!_stricmp(Text, "Filename") || !_stricmp(Text, "File")) + return PARAM_FILENAME; + + if(!_stricmp(Text, "Float")) + return PARAM_EXPRESSION; + + if(!_stricmp(Text, "Integer")) + return PARAM_EXPRESSION; + + if(!_stricmp(Text, "Object")) + return PARAM_OBJECT; + + if(!_stricmp(Text, "Position")) + return PARAM_POSITION; + + if(!_stricmp(Text, "Create")) + return PARAM_CREATE; + + if(!_stricmp(Text, "SysCreate")) + return PARAM_SYSCREATE; + + if(!_stricmp(Text, "Animation")) + return PARAM_ANIMATION; + + if(!_stricmp(Text, "Nop")) + return PARAM_NOP; + + if(!_stricmp(Text, "Player")) + return PARAM_PLAYER; + + if(!_stricmp(Text, "Every")) + return PARAM_EVERY; + + if(!_stricmp(Text, "Key")) + return PARAM_KEY; + + if(!_stricmp(Text, "Speed")) + return PARAM_SPEED; + + if(!_stricmp(Text, "JoyDirection")) + return PARAM_JOYDIRECTION; + + if(!_stricmp(Text, "Shoot")) + return PARAM_SHOOT; + + if(!_stricmp(Text, "Zone")) + return PARAM_ZONE; + + if(!_stricmp(Text, "Comparison")) + return PARAM_COMPARAISON; + + if(!_stricmp(Text, "StringComparison")) + return PARAM_CMPSTRING; + + if(!_stricmp(Text, "Colour") || !_stricmp(Text, "Color")) + return PARAM_COLOUR; + + if(!_stricmp(Text, "Frame")) + return PARAM_FRAME; + + if(!_stricmp(Text, "SampleLoop")) + return PARAM_SAMLOOP; + + if(!_stricmp(Text, "MusicLoop")) + return PARAM_MUSLOOP; + + if(!_stricmp(Text, "NewDirection")) + return PARAM_NEWDIRECTION; + + if(!_stricmp(Text, "TextNumber")) + return PARAM_TEXTNUMBER; + + if(!_stricmp(Text, "Click")) + return PARAM_CLICK; + + if(!_stricmp(Text, "Program")) + return PARAM_PROGRAM; + + if(!_strnicmp(Text, "Custom", 6)) + return PARAM_EXTBASE+atoi(Text+6); + + return 0; +} + +short ReadExpressionParameterType(const char * Text) +{ + if(!_stricmp(Text, "Text") || !_stricmp(Text, "String")) + return EXPPARAM_STRING; + + if(!_stricmp(Text, "Float")) + return EXPPARAM_LONG; + + if(!_stricmp(Text, "Integer")) + return EXPPARAM_LONG; + + return 0; +} + +void Edif::Init(mv * _far mV, LPEDATA edPtr) +{ + IsEdittime = mV->mvHMainWin != 0; + + mvInvalidateObject(mV, edPtr); +} + +void Edif::Free(mv * _far mV) +{ + delete ::SDK; + ::SDK = NULL; +} + +void Edif::Free(LPEDATA edPtr) +{ +} + +int Edif::Init(mv _far * mV) +{ + _tcscpy (LanguageCode, _T ("EN")); + + // Get pathname of MMF2 + LPTSTR mmfname = (LPTSTR)calloc(_MAX_PATH, sizeof(TCHAR)); + if ( mmfname != NULL ) + { + // Load resources + GetModuleFileName (NULL, mmfname, _MAX_PATH); + HINSTANCE hRes = LoadLibraryEx(mmfname, NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE); + if ( hRes != NULL ) + { + // Load string 720, contains the language code + TCHAR langCode[20]; + LoadString(hRes, 720, langCode, 20); + + int nCode = _ttoi(langCode); + switch (nCode) { + case 0x40C: + _tcscpy (LanguageCode, _T ("FR")); + break; + case 0x411: + _tcscpy (LanguageCode, _T ("JP")); + break; + } + + // Free resources + FreeLibrary(hRes); + } + free(mmfname); + } + + // Get JSON file + char * JSON; + size_t JSON_Size; + + int result = Edif::GetDependency (JSON, JSON_Size, _T("json"), IDR_EDIF_JSON); + + if (result == Edif::DependencyNotFound) + { + TCHAR temp [MAX_PATH]; + GetModuleFileName (hInstLib, temp, sizeof(temp)/sizeof(TCHAR)); + LPTSTR filetitle = _tcsrchr(temp, _T('\\')); + if ( filetitle != NULL ) + _tcscpy(temp, filetitle); + else + temp[0] = 0; + _tcscat(temp, _T(" - Error")); + + MessageBox(0, _T("JSON file not found on disk or in MFX resources"), temp, 0); + return -1; // error, init failed + } + + Edif::ExternalJSON = (result == Edif::DependencyWasFile); + + char * copy = (char *) malloc (JSON_Size + 1); + memcpy (copy, JSON, JSON_Size); + copy [JSON_Size] = 0; + if ( result != Edif::DependencyWasResource ) + free(JSON); + + char json_error [256]; + + json_settings settings; + memset (&settings, 0, sizeof (settings)); + + // settings.settings = json_setting_permissive_commas; + + json_value * json = json_parse_ex (&settings, copy, json_error); + + if (!json) + { + MessageBoxA(0, json_error, "Error parsing JSON", 0); + return -1; + } + + ::SDK = new Edif::SDK(mV, *json); + return 0; // no error +} + +Edif::SDK::SDK(mv * mV, json_value &_json) : json (_json) +{ + this->mV = mV; + +#ifndef RUN_ONLY + Icon = new cSurface; + if(mV->mvImgFilterMgr) + { + char * IconData; + size_t IconSize; + + int result = Edif::GetDependency (IconData, IconSize, _T("png"), IDR_EDIF_ICON); + if (result != Edif::DependencyNotFound) + { + CInputMemFile * File = CInputMemFile::NewInstance (); + File->Create ((LPBYTE)IconData, IconSize); + + DWORD PNG = FILTERID_PNG; + ImportImageFromInputFile(mV->mvImgFilterMgr, File, Icon, &PNG, 0); + + File->Delete(); + + if(!Icon->HasAlpha()) + Icon->SetTransparentColor(RGB(255, 0, 255)); + if ( result != Edif::DependencyWasResource ) + free(IconData); + } + } +#endif // RUN_ONLY + + const json_value &Actions = json["Actions"]; + const json_value &Conditions = json["Conditions"]; + const json_value &Expressions = json["Expressions"]; + + ActionJumps = new void * [Actions.u.array.length + 1]; + ConditionJumps = new void * [Conditions.u.array.length + 1]; + ExpressionJumps = new void * [Expressions.u.array.length + 1]; + + ActionJumps [Actions.u.array.length] = 0; + ConditionJumps [Conditions.u.array.length] = 0; + ExpressionJumps [Expressions.u.array.length] = 0; + + for(unsigned int i = 0; i < Actions.u.array.length; ++ i) + { + const json_value &Action = Actions[i]; + + ActionJumps [i] = (void *) Edif::Action; + + ActionFunctions.push_back(0); + + int ActionID = Edif::ActionID(i); + + ActionInfos.push_back(ActionID); // Menu ID + ActionInfos.push_back(ActionID); // String ID + ActionInfos.push_back(i); // Code + + ActionInfos.push_back(0); // Flags + + const json_value &Parameters = Action["Parameters"]; + + ActionInfos.push_back(Parameters.u.array.length); + + { short IsFloat = 0; + + for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) + { + const json_value &Parameter = Parameters[i]; + + const char * Type; + + if(Parameter.type == json_object) + Type = Parameter["Type"]; + else + Type = Parameter[0]; + + ActionInfos.push_back(ReadParameterType(Type)); + + if(!_stricmp(Type, "Float")) + IsFloat |= 1 << i; + } + + ActionFloatFlags.push_back(IsFloat); + } + + for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) + ActionInfos.push_back(0); + } + + for(unsigned int i = 0; i < Conditions.u.array.length; ++ i) + { + const json_value &Condition = Conditions[i]; + + ConditionJumps [i] = (void *) Edif::Condition; + + ConditionFunctions.push_back(0); + + int ConditionID = Edif::ConditionID(i); + + ConditionInfos.push_back(ConditionID); + ConditionInfos.push_back(ConditionID); + ConditionInfos.push_back(i); + + ConditionInfos.push_back(((bool) Condition["Triggered"]) ? 0 : (EVFLAGS_ALWAYS | EVFLAGS_NOTABLE)); + + const json_value &Parameters = Condition["Parameters"]; + + ConditionInfos.push_back(Parameters.u.array.length); + + { short IsFloat = 0; + + for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) + { + const json_value &Parameter = Parameters[i]; + + const char * Type; + + if(Parameter.type == json_object) + Type = Parameter["Type"]; + else + Type = Parameter[0]; + + ConditionInfos.push_back(ReadParameterType(Type)); + + if(!_stricmp(Type, "Float")) + IsFloat |= 1 << i; + } + + ConditionFloatFlags.push_back(IsFloat); + } + + for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) + ConditionInfos.push_back(0); + } + + for(unsigned int i = 0; i < Expressions.u.array.length; ++ i) + { + const json_value &Expression = Expressions[i]; + + ExpressionJumps [i] = (void *) Edif::Expression; + + ExpressionFunctions.push_back(0); + + if(!_stricmp(Expression["Returns"], "Integer")) + ExpressionTypes.push_back(0); + else if(!_stricmp(Expression["Returns"], "Float")) + ExpressionTypes.push_back(1); + else if(!_stricmp(Expression["Returns"], "Text") || !_stricmp(Expression["Returns"], "String")) + ExpressionTypes.push_back(2); + else + ExpressionTypes.push_back(0); + + int ExpressionID = Edif::ExpressionID(i); + + ExpressionInfos.push_back(ExpressionID); + ExpressionInfos.push_back(ExpressionID); + ExpressionInfos.push_back(i); + + { short FlagsValue = 0; + + if(ExpressionTypes.back() == 1) + FlagsValue |= EXPFLAG_DOUBLE; + + if(ExpressionTypes.back() == 2) + FlagsValue |= EXPFLAG_STRING; + + ExpressionInfos.push_back(FlagsValue); + } + + const json_value &Parameters = Expression["Parameters"]; + + ExpressionInfos.push_back(Parameters.u.array.length); + + { short IsFloat = 0; + + for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) + { + const json_value &Parameter = Parameters[i]; + + const char * Type; + + if(Parameter.type == json_object) + Type = Parameter["Type"]; + else + Type = Parameter[0]; + + ExpressionInfos.push_back(ReadExpressionParameterType(Type)); + + if(!_stricmp(Type, "Float")) + IsFloat |= 1 << i; + } + + ExpressionFloatFlags.push_back(IsFloat); + } + + for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) + ExpressionInfos.push_back(0); + } + + ActionMenu = LoadMenuJSON(Edif::ActionID(0), json["ActionMenu"]); + ConditionMenu = LoadMenuJSON(Edif::ConditionID(0), json["ConditionMenu"]); + ExpressionMenu = LoadMenuJSON(Edif::ExpressionID(0), json["ExpressionMenu"]); +} + +Edif::SDK::~SDK() +{ + json_value_free (&json); + + delete [] ActionJumps; + delete [] ConditionJumps; + delete [] ExpressionJumps; + + delete Icon; +} + +int ActionOrCondition(vector &FloatFlags, LPEVENTINFOS2 Info, void * Function, int ID, LPRDATA rdPtr, long param1, long param2) +{ + int * Parameters; + int ParameterCount; + + { Info = GetEventInformations(Info, ID); + + ParameterCount = Info->infos.nParams; + Parameters = (int *) alloca(sizeof(int) * ParameterCount); + + for(int i = 0; i < ParameterCount; ++ i) + { + switch(EVINFO2_PARAM(Info, i)) + { + case PARAM_EXPRESSION: + + if((FloatFlags[ID] & (1 << i)) != 0) + { + Parameters[i] = CNC_GetFloatParameter(rdPtr); + break; + } + + Parameters[i] = CNC_GetIntParameter(rdPtr); + break; + + case PARAM_EXPSTRING: + case PARAM_FILENAME: + + Parameters[i] = CNC_GetStringParameter(rdPtr); + break; + + default: + + Parameters[i] = CNC_GetParameter(rdPtr); + break; + } + } + } + + void * Extension = rdPtr->pExtension; + + int Result; + + __asm + { + pushad + + mov ecx, ParameterCount + + cmp ecx, 0 + je CallNow + + mov edx, Parameters + + mov ebx, ecx + shl ebx, 2 + + add edx, ebx + sub edx, 4 + + PushLoop: + + push [edx] + sub edx, 4 + + dec ecx + + cmp ecx, 0 + jne PushLoop + + CallNow: + + mov ecx, Extension + call Function + + mov Result, eax + + popad + } + + return Result; +} + +HMENU Edif::LoadMenuJSON(int BaseID, const json_value &Source, HMENU Parent) +{ + if(!Parent) + Parent = CreateMenu(); + + for(unsigned int i = 0; i < Source.u.array.length; ++ i) + { + const json_value &MenuItem = Source[i]; + + if(MenuItem.type == json_string) + { + if(!_stricmp(MenuItem, "Separator")) + { + AppendMenu(Parent, MF_BYPOSITION | MF_SEPARATOR, 0, 0); + continue; + } + + continue; + } + + if(MenuItem[0].type == json_string && MenuItem[1].type == json_array) + { + HMENU SubMenu = CreatePopupMenu(); + LoadMenuJSON(BaseID, MenuItem, SubMenu); + + TCHAR* str = ConvertString(MenuItem[0]); + AppendMenu(Parent, MF_BYPOSITION | MF_STRING | MF_POPUP, (UINT) SubMenu, str); + FreeString(str); + + continue; + } + + unsigned int ItemOffset = 0; + + int ID = BaseID + (int) MenuItem[ItemOffset].u.integer; + TCHAR * Text = ConvertString(MenuItem[ItemOffset + 1]); + bool Disabled = MenuItem.u.array.length > (ItemOffset + 2) ? ((bool) MenuItem[ItemOffset + 2]) != 0 : false; + + AppendMenu(Parent, Disabled ? MF_GRAYED | MF_UNCHECKED | MF_BYPOSITION | MF_STRING + : MF_BYPOSITION | MF_STRING, ID, Text); + + FreeString(Text); + } + + return Parent; +} + +long __stdcall Edif::Condition(LPRDATA rdPtr, long param1, long param2) +{ + int ID = rdPtr->rHo.hoEventNumber; + + rdPtr->pExtension->Runtime.param1 = param1; + rdPtr->pExtension->Runtime.param2 = param2; + + void * Function = ::SDK->ConditionFunctions[ID]; + + if(!Function) + return rdPtr->pExtension->Condition(ID, rdPtr, param1, param2); + + int Result = ActionOrCondition(::SDK->ConditionFloatFlags, (LPEVENTINFOS2) &::SDK->ConditionInfos[0], + Function, ID, rdPtr, param1, param2); + + return *(char *) &Result; +} + +short __stdcall Edif::Action(LPRDATA rdPtr, long param1, long param2) +{ + /* int ID = rdPtr->rHo.hoAdRunHeader->rh4.rh4ActionStart->evtNum; */ + int ID = rdPtr->rHo.hoEventNumber; + + rdPtr->pExtension->Runtime.param1 = param1; + rdPtr->pExtension->Runtime.param2 = param2; + + void * Function = ::SDK->ActionFunctions[ID]; + + if(!Function) + { + rdPtr->pExtension->Action(ID, rdPtr, param1, param2); + return 0; + } + + ActionOrCondition(::SDK->ActionFloatFlags, (LPEVENTINFOS2) &::SDK->ActionInfos[0], + Function, ID, rdPtr, param1, param2); + + return 0; +} + + +long __stdcall Edif::Expression(LPRDATA rdPtr, long param) +{ + int ID = rdPtr->rHo.hoEventNumber; + + rdPtr->pExtension->Runtime.param1 = param; + rdPtr->pExtension->Runtime.param2 = 0; + + int * Parameters; + int ParameterCount; + + void * Function = ::SDK->ExpressionFunctions[ID]; + + if(!Function) + return rdPtr->pExtension->Expression(ID, rdPtr, param); + + { LPEVENTINFOS2 Infos = GetEventInformations((LPEVENTINFOS2) &::SDK->ExpressionInfos[0], ID); + + ParameterCount = Infos->infos.nParams; + Parameters = (int *) alloca(sizeof(int) * ParameterCount); + + for(int i = 0; i < ParameterCount; ++ i) + { + switch(EVINFO2_PARAM(Infos, i)) + { + case EXPPARAM_STRING: + + if(!i) + { + Parameters[i] = CNC_GetFirstExpressionParameter(rdPtr, param, TYPE_STRING); + break; + } + + Parameters[i] = CNC_GetNextExpressionParameter(rdPtr, param, TYPE_STRING); + break; + + case EXPPARAM_LONG: + + int Type = ((::SDK->ExpressionFloatFlags[ID] & (1 << i)) != 0) ? TYPE_FLOAT : TYPE_LONG; + + if(!i) + { + Parameters[i] = CNC_GetFirstExpressionParameter(rdPtr, param, Type); + break; + } + + Parameters[i] = CNC_GetNextExpressionParameter(rdPtr, param, Type); + break; + } + } + } + + void * Extension = rdPtr->pExtension; + + int Result; + int ExpressionType = ::SDK->ExpressionTypes[ID]; + + __asm + { + pushad + + mov ecx, ParameterCount + + cmp ecx, 0 + je CallNow + + mov edx, Parameters + + mov ebx, ecx + shl ebx, 2 + + add edx, ebx + sub edx, 4 + + PushLoop: + + push [edx] + sub edx, 4 + + dec ecx + + cmp ecx, 0 + jne PushLoop + + CallNow: + + mov ecx, Extension + call Function + + mov ecx, ExpressionType; + + cmp ecx, 1 + jne NotFloat + + fstp Result + jmp End + + NotFloat: + + mov Result, eax + + End: + + popad + } + + switch(ExpressionType) + { + case 1: // Float + { + rdPtr->rHo.hoFlags |= HOF_FLOAT; + break; + } + + case 2: // String + { + rdPtr->rHo.hoFlags |= HOF_STRING; + break; + } + }; + + return Result; +} + +int Edif::GetDependency (char *& Buffer, size_t &Size, const TCHAR * FileExtension, int Resource) +{ + TCHAR Filename [MAX_PATH]; + GetSiblingPath (Filename, FileExtension); + + Buffer = NULL; + if (*Filename) + { + FILE * File = NULL; + int error = _tfopen_s(&File, Filename, _T("rb")); + + if (!File) + return DependencyNotFound; + + fseek (File, 0, SEEK_END); + Size = ftell (File); + fseek (File, 0, SEEK_SET); + + Buffer = (char *) malloc (Size + 1); + Buffer [Size] = 0; + + fread (Buffer, 1, Size, File); + + fclose (File); + + return DependencyWasFile; + } + + if (!Resource) + return DependencyNotFound; + + HRSRC res = FindResource (hInstLib, MAKEINTRESOURCE (Resource), _T("EDIF")); + + if (!res) + return DependencyNotFound; + + Size = SizeofResource (hInstLib, res); + Buffer = (char *) LockResource (LoadResource (hInstLib, res)); + + return DependencyWasResource; +} + +static void GetSiblingPath (TCHAR * Buffer, const TCHAR * FileExtension) +{ + TCHAR temp [MAX_PATH]; + + GetModuleFileName (hInstLib, temp, sizeof(temp)/sizeof(TCHAR)); + + TCHAR * Filename = temp + _tcslen(temp) - 1; + + while(*Filename != '.') + -- Filename; + + _tcscpy(++ Filename, FileExtension); + + Filename = Filename + _tcslen(Filename) - 1; + + while(*Filename != '\\' && *Filename != '/') + -- Filename; + + ++ Filename; + + // Is the file in the directory of the MFX? (if so, use this pathname) + TCHAR FullFilename [MAX_PATH]; + _tcscpy(FullFilename, temp); + if(GetFileAttributes(FullFilename) == 0xFFFFFFFF) + { + // No => editor + TCHAR ExecutablePath [MAX_PATH]; + GetModuleFileName (GetModuleHandle (0), ExecutablePath, sizeof(ExecutablePath)/sizeof(TCHAR)); + + { TCHAR * Iterator = ExecutablePath + _tcslen(ExecutablePath) - 1; + + while(*Iterator != '\\' && *Iterator != '/') + -- Iterator; + + *Iterator = 0; + } + + // Same path as the executable? + _stprintf_s(FullFilename, sizeof(ExecutablePath)/sizeof(TCHAR), _T("%s/%s"), ExecutablePath, Filename); + if(GetFileAttributes(FullFilename) == 0xFFFFFFFF) + { + // No => try Data/Runtime + _stprintf_s(FullFilename, sizeof(ExecutablePath)/sizeof(TCHAR), _T("%s/Data/Runtime/%s"), ExecutablePath, Filename); + if(GetFileAttributes(FullFilename) == 0xFFFFFFFF) + { + // No => try .. (maybe we're in the Unicode or HWA folder) + _stprintf_s(FullFilename, sizeof(ExecutablePath)/sizeof(TCHAR), _T("%s/../%s"), ExecutablePath, Filename); + if(GetFileAttributes(FullFilename) == 0xFFFFFFFF) + { + *Buffer = 0; + return; + } + } + } + } + + _tcscpy(Buffer, FullFilename); +} + +void Edif::GetSiblingPath (TCHAR * Buffer, const TCHAR * FileExtension) +{ + TCHAR * Extension = (TCHAR *) + alloca ((_tcslen (FileExtension) + _tcslen (LanguageCode) + 2) * sizeof(TCHAR)); + + _tcscpy (Extension, LanguageCode); + _tcscat (Extension, _T (".")); + _tcscat (Extension, FileExtension); + + ::GetSiblingPath (Buffer, Extension); + + if (*Buffer) + return; + + ::GetSiblingPath (Buffer, FileExtension); +} + +#ifdef _UNICODE +WCHAR* Edif::ConvertString(const char* utf8String) +{ + size_t Length = MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, 0, 0); + if ( Length == 0 ) + Length = 1; + WCHAR* tstr = (WCHAR*)calloc(Length, sizeof(WCHAR)); + MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, tstr, Length); + return tstr; +} + +WCHAR* Edif::ConvertAndCopyString(WCHAR* tstr, const char* utf8String, int maxLength) +{ + MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, tstr, maxLength); + return tstr; +} +#else +char* Edif::ConvertString(const char* utf8String) +{ + // Convert string to Unicode + size_t Length = MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, 0, 0); + if ( Length == 0 ) + Length = 1; + WCHAR* wstr = (WCHAR*)calloc(Length, sizeof(WCHAR)); + MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, wstr, Length); + + // Convert Unicode string using current user code page + int len2 = WideCharToMultiByte(CP_ACP, 0, wstr, -1, 0, 0, NULL, NULL); + if ( len2 == 0 ) + len2 = 1; + char* str = (char*)calloc(len2, sizeof(char)); + WideCharToMultiByte(CP_ACP, 0, wstr, -1, str, len2, NULL, NULL); + free(wstr); + + return str; +} + +char* Edif::ConvertAndCopyString(char* str, const char* utf8String, int maxLength) +{ + // MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, tstr, maxLength); + + // Convert string to Unicode + size_t Length = MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, 0, 0); + if ( Length == 0 ) + Length = 1; + WCHAR* wstr = (WCHAR*)calloc(Length, sizeof(WCHAR)); + MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, wstr, Length); + + // Convert Unicode string using current user code page + WideCharToMultiByte(CP_ACP, 0, wstr, -1, str, maxLength, NULL, NULL); + free(wstr); + + return str; +} +#endif // _UNICODE diff --git a/Lib/ObjectSelection.cpp b/Lib/ObjectSelection.cpp index bb2036d..4b48248 100644 --- a/Lib/ObjectSelection.cpp +++ b/Lib/ObjectSelection.cpp @@ -1,149 +1,149 @@ - -// By Anders Riggelsen (Andos) -// http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=214148&gonew=1 - -// These files do not match up with the originals - modified for Edif (callbacks inside the extension class, etc..) - -#include "Common.h" - -Riggs::ObjectSelection::ObjectSelection(LPRH rhPtr) -{ - this->rhPtr = rhPtr; - this->ObjectList = rhPtr->rhObjectList; //get a pointer to the mmf object list - this->OiList = rhPtr->rhOiList; //get a pointer to the mmf object info list - this->QualToOiList = rhPtr->rhQualToOiList; //get a pointer to the mmf qualifier to Oi list - oiListItemSize = sizeof(objInfoList); - -//Only add the sizes to the runtime structures if they weren't compiled directly for those runtimes -#ifndef UNICODE - if ( rhPtr->rh4.rh4Mv->mvCallFunction(NULL, EF_ISUNICODE, 0, 0, 0) ) - oiListItemSize += 24; -#endif -#ifndef HWABETA - if ( rhPtr->rh4.rh4Mv->mvCallFunction(NULL, EF_ISHWA, 0, 0, 0) ) - oiListItemSize += sizeof(LPVOID); -#endif -} - -//Selects *all* objects of the given object-type -void Riggs::ObjectSelection::SelectAll(short Oi) -{ - const LPOIL pObjectInfo = GetOILFromOI(Oi); - - pObjectInfo->oilNumOfSelected = pObjectInfo->oilNObjects; - pObjectInfo->oilListSelected = pObjectInfo->oilObject; - pObjectInfo->oilEventCount = rhPtr->rh2.rh2EventCount; - - int i = pObjectInfo->oilObject; - while(i >= 0) - { - LPHO pObject = ObjectList[i].oblOffset; - pObject->hoNextSelected = pObject->hoNumNext; - i = pObject->hoNumNext; - } -} - -//Resets all objects of the given object-type -void Riggs::ObjectSelection::SelectNone(short Oi) -{ - LPOIL pObjectInfo = GetOILFromOI(Oi); - - pObjectInfo->oilNumOfSelected = 0; - pObjectInfo->oilListSelected = -1; - pObjectInfo->oilEventCount = rhPtr->rh2.rh2EventCount; -} - -//Resets the SOL and inserts only one given object -void Riggs::ObjectSelection::SelectOneObject(LPRO object) -{ - LPOIL pObjectInfo = GetOILFromOI(object->roHo.hoOi); - - pObjectInfo->oilNumOfSelected = 1; - pObjectInfo->oilEventCount = rhPtr->rh2.rh2EventCount; - pObjectInfo->oilListSelected = object->roHo.hoNumber; - ObjectList[object->roHo.hoNumber].oblOffset->hoNextSelected = -1; -} - -//Resets the SOL and inserts the given list of objects -void Riggs::ObjectSelection::SelectObjects(short Oi, LPRO* objects, int count) -{ - if(count <= 0) - return; - - LPOIL pObjectInfo = GetOILFromOI(Oi); - - pObjectInfo->oilNumOfSelected = count; - pObjectInfo->oilEventCount = rhPtr->rh2.rh2EventCount; - - short prevNumber = objects[0]->roHo.hoNumber; - pObjectInfo->oilListSelected = prevNumber; - - for(int i=1; iroHo.hoNumber; - ObjectList[prevNumber].oblOffset->hoNextSelected = currentNumber; - prevNumber = currentNumber; - } - ObjectList[prevNumber].oblOffset->hoNextSelected = -1; -} - -//Return the number of selected objects for the given object-type -int Riggs::ObjectSelection::GetNumberOfSelected(short Oi) -{ - if(Oi & 0x8000) - { - Oi &= 0x7FFF; //Mask out the qualifier part - int numberSelected = 0; - - LPQOI CurrentQualToOiStart = (LPQOI)((char*)QualToOiList + Oi); - LPQOI CurrentQualToOi = CurrentQualToOiStart; - - while(CurrentQualToOi->qoiOiList >= 0) - { - LPOIL CurrentOi = GetOILFromOI(CurrentQualToOi->qoiOiList); - numberSelected += CurrentOi->oilNumOfSelected; - CurrentQualToOi = (LPQOI)((char*)CurrentQualToOi + 4); - } - return numberSelected; - } - else - { - LPOIL pObjectInfo = GetOILFromOI(Oi); - return pObjectInfo->oilNumOfSelected; - } -} - -bool Riggs::ObjectSelection::ObjectIsOfType(LPRO object, short Oi) -{ - if(Oi & 0x8000) - { - Oi &= 0x7FFF; //Mask out the qualifier part - LPQOI CurrentQualToOiStart = (LPQOI)((char*)QualToOiList + Oi); - LPQOI CurrentQualToOi = CurrentQualToOiStart; - - while(CurrentQualToOi->qoiOiList >= 0) - { - LPOIL CurrentOi = GetOILFromOI(CurrentQualToOi->qoiOiList); - if(CurrentOi->oilOi == object->roHo.hoOi) - return true; - CurrentQualToOi = (LPQOI)((char*)CurrentQualToOi + 4); - } - return false; - } - else - return (object->roHo.hoOi == Oi); -} - - -//Returns the object-info structure from a given object-type -LPOIL Riggs::ObjectSelection::GetOILFromOI(short Oi) -{ - for(int i=0; irhNumberOi; ++i) - { - LPOIL oil = (LPOIL)(((char*)OiList) + oiListItemSize*i); - if(oil->oilOi == Oi) - return oil; - } - return NULL; -} - + +// By Anders Riggelsen (Andos) +// http://community.clickteam.com/showthread.php?t=61672 + +// These files do not match up with the originals - modified for Edif (callbacks inside the extension class, etc..) + +#include "Common.h" + +Riggs::ObjectSelection::ObjectSelection(LPRH rhPtr) +{ + this->rhPtr = rhPtr; + this->ObjectList = rhPtr->rhObjectList; //get a pointer to the mmf object list + this->OiList = rhPtr->rhOiList; //get a pointer to the mmf object info list + this->QualToOiList = rhPtr->rhQualToOiList; //get a pointer to the mmf qualifier to Oi list + oiListItemSize = sizeof(objInfoList); + +//Only add the sizes to the runtime structures if they weren't compiled directly for those runtimes +#ifndef UNICODE + if ( rhPtr->rh4.rh4Mv->mvCallFunction(NULL, EF_ISUNICODE, 0, 0, 0) ) + oiListItemSize += 24; +#endif +#ifndef HWABETA + if ( rhPtr->rh4.rh4Mv->mvCallFunction(NULL, EF_ISHWA, 0, 0, 0) ) + oiListItemSize += sizeof(LPVOID); +#endif +} + +//Selects *all* objects of the given object-type +void Riggs::ObjectSelection::SelectAll(short Oi) +{ + const LPOIL pObjectInfo = GetOILFromOI(Oi); + + pObjectInfo->oilNumOfSelected = pObjectInfo->oilNObjects; + pObjectInfo->oilListSelected = pObjectInfo->oilObject; + pObjectInfo->oilEventCount = rhPtr->rh2.rh2EventCount; + + int i = pObjectInfo->oilObject; + while(i >= 0) + { + LPHO pObject = ObjectList[i].oblOffset; + pObject->hoNextSelected = pObject->hoNumNext; + i = pObject->hoNumNext; + } +} + +//Resets all objects of the given object-type +void Riggs::ObjectSelection::SelectNone(short Oi) +{ + LPOIL pObjectInfo = GetOILFromOI(Oi); + + pObjectInfo->oilNumOfSelected = 0; + pObjectInfo->oilListSelected = -1; + pObjectInfo->oilEventCount = rhPtr->rh2.rh2EventCount; +} + +//Resets the SOL and inserts only one given object +void Riggs::ObjectSelection::SelectOneObject(LPRO object) +{ + LPOIL pObjectInfo = GetOILFromOI(object->roHo.hoOi); + + pObjectInfo->oilNumOfSelected = 1; + pObjectInfo->oilEventCount = rhPtr->rh2.rh2EventCount; + pObjectInfo->oilListSelected = object->roHo.hoNumber; + ObjectList[object->roHo.hoNumber].oblOffset->hoNextSelected = -1; +} + +//Resets the SOL and inserts the given list of objects +void Riggs::ObjectSelection::SelectObjects(short Oi, LPRO* objects, int count) +{ + if(count <= 0) + return; + + LPOIL pObjectInfo = GetOILFromOI(Oi); + + pObjectInfo->oilNumOfSelected = count; + pObjectInfo->oilEventCount = rhPtr->rh2.rh2EventCount; + + short prevNumber = objects[0]->roHo.hoNumber; + pObjectInfo->oilListSelected = prevNumber; + + for(int i=1; iroHo.hoNumber; + ObjectList[prevNumber].oblOffset->hoNextSelected = currentNumber; + prevNumber = currentNumber; + } + ObjectList[prevNumber].oblOffset->hoNextSelected = -1; +} + +//Return the number of selected objects for the given object-type +int Riggs::ObjectSelection::GetNumberOfSelected(short Oi) +{ + if(Oi & 0x8000) + { + Oi &= 0x7FFF; //Mask out the qualifier part + int numberSelected = 0; + + LPQOI CurrentQualToOiStart = (LPQOI)((char*)QualToOiList + Oi); + LPQOI CurrentQualToOi = CurrentQualToOiStart; + + while(CurrentQualToOi->qoiOiList >= 0) + { + LPOIL CurrentOi = GetOILFromOI(CurrentQualToOi->qoiOiList); + numberSelected += CurrentOi->oilNumOfSelected; + CurrentQualToOi = (LPQOI)((char*)CurrentQualToOi + 4); + } + return numberSelected; + } + else + { + LPOIL pObjectInfo = GetOILFromOI(Oi); + return pObjectInfo->oilNumOfSelected; + } +} + +bool Riggs::ObjectSelection::ObjectIsOfType(LPRO object, short Oi) +{ + if(Oi & 0x8000) + { + Oi &= 0x7FFF; //Mask out the qualifier part + LPQOI CurrentQualToOiStart = (LPQOI)((char*)QualToOiList + Oi); + LPQOI CurrentQualToOi = CurrentQualToOiStart; + + while(CurrentQualToOi->qoiOiList >= 0) + { + LPOIL CurrentOi = GetOILFromOI(CurrentQualToOi->qoiOiList); + if(CurrentOi->oilOi == object->roHo.hoOi) + return true; + CurrentQualToOi = (LPQOI)((char*)CurrentQualToOi + 4); + } + return false; + } + else + return (object->roHo.hoOi == Oi); +} + + +//Returns the object-info structure from a given object-type +LPOIL Riggs::ObjectSelection::GetOILFromOI(short Oi) +{ + for(int i=0; irhNumberOi; ++i) + { + LPOIL oil = (LPOIL)(((char*)OiList) + oiListItemSize*i); + if(oil->oilOi == Oi) + return oil; + } + return NULL; +} + diff --git a/Lib/json.c b/Lib/json.c index e37c83f..5977952 100644 --- a/Lib/json.c +++ b/Lib/json.c @@ -1,742 +1,742 @@ - -/* vim: set et ts=3 sw=3 ft=c: - * - * Copyright (C) 2012 James McLaughlin et al. All rights reserved. - * https://github.com/udp/json-parser - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "json.h" - -#ifdef _MSC_VER - #ifndef _CRT_SECURE_NO_WARNINGS - #define _CRT_SECURE_NO_WARNINGS - #endif -#endif - -#ifdef __cplusplus - const struct _json_value json_value_none; /* zero-d by ctor */ -#else - const struct _json_value json_value_none = { 0 }; -#endif - -#include -#include -#include -#include - -typedef unsigned short json_uchar; - -static unsigned char hex_value (json_char c) -{ - if (c >= 'A' && c <= 'F') - return (c - 'A') + 10; - - if (c >= 'a' && c <= 'f') - return (c - 'a') + 10; - - if (c >= '0' && c <= '9') - return c - '0'; - - return 0xFF; -} - -typedef struct -{ - json_settings settings; - int first_pass; - - unsigned long used_memory; - - unsigned int uint_max; - unsigned long ulong_max; - -} json_state; - -static void * json_alloc (json_state * state, unsigned long size, int zero) -{ - void * mem; - - if ((state->ulong_max - state->used_memory) < size) - return 0; - - if (state->settings.max_memory - && (state->used_memory += size) > state->settings.max_memory) - { - return 0; - } - - if (! (mem = zero ? calloc (size, 1) : malloc (size))) - return 0; - - return mem; -} - -static int new_value - (json_state * state, json_value ** top, json_value ** root, json_value ** alloc, json_type type) -{ - json_value * value; - int values_size; - - if (!state->first_pass) - { - value = *top = *alloc; - *alloc = (*alloc)->_reserved.next_alloc; - - if (!*root) - *root = value; - - switch (value->type) - { - case json_array: - - if (! (value->u.array.values = (json_value **) json_alloc - (state, value->u.array.length * sizeof (json_value *), 0)) ) - { - return 0; - } - - break; - - case json_object: - - values_size = sizeof (*value->u.object.values) * value->u.object.length; - - if (! ((*(void **) &value->u.object.values) = json_alloc - (state, values_size + ((unsigned long) value->u.object.values), 0)) ) - { - return 0; - } - - value->_reserved.object_mem = (*(char **) &value->u.object.values) + values_size; - - break; - - case json_string: - - if (! (value->u.string.ptr = (json_char *) json_alloc - (state, (value->u.string.length + 1) * sizeof (json_char), 0)) ) - { - return 0; - } - - break; - - default: - break; - }; - - value->u.array.length = 0; - - return 1; - } - - value = (json_value *) json_alloc (state, sizeof (json_value), 1); - - if (!value) - return 0; - - if (!*root) - *root = value; - - value->type = type; - value->parent = *top; - - if (*alloc) - (*alloc)->_reserved.next_alloc = value; - - *alloc = *top = value; - - return 1; -} - -#define e_off \ - ((int) (i - cur_line_begin)) - -#define whitespace \ - case '\n': ++ cur_line; cur_line_begin = i; \ - case ' ': case '\t': case '\r' - -#define string_add(b) \ - do { if (!state.first_pass) string [string_length] = b; ++ string_length; } while (0); - -const static int - flag_next = 1, flag_reproc = 2, flag_need_comma = 4, flag_seek_value = 8, flag_exponent = 16, - flag_got_exponent_sign = 32, flag_escaped = 64, flag_string = 128, flag_need_colon = 256, - flag_done = 512; - -json_value * json_parse_ex (json_settings * settings, const json_char * json, char * error_buf) -{ - json_char error [128]; - unsigned int cur_line; - const json_char * cur_line_begin, * i; - json_value * top, * root, * alloc = 0; - json_state state; - int flags; - - error[0] = '\0'; - - memset (&state, 0, sizeof (json_state)); - memcpy (&state.settings, settings, sizeof (json_settings)); - - memset (&state.uint_max, 0xFF, sizeof (state.uint_max)); - memset (&state.ulong_max, 0xFF, sizeof (state.ulong_max)); - - state.uint_max -= 8; /* limit of how much can be added before next check */ - state.ulong_max -= 8; - - for (state.first_pass = 1; state.first_pass >= 0; -- state.first_pass) - { - json_uchar uchar; - unsigned char uc_b1, uc_b2, uc_b3, uc_b4; - json_char * string; - unsigned int string_length; - - top = root = 0; - flags = flag_seek_value; - - cur_line = 1; - cur_line_begin = json; - - for (i = json ;; ++ i) - { - json_char b = *i; - - if (flags & flag_done) - { - if (!b) - break; - - switch (b) - { - whitespace: - continue; - - default: - sprintf (error, "%d:%d: Trailing garbage: `%c`", cur_line, e_off, b); - goto e_failed; - }; - } - - if (flags & flag_string) - { - if (!b) - { sprintf (error, "Unexpected EOF in string (at %d:%d)", cur_line, e_off); - goto e_failed; - } - - if (string_length > state.uint_max) - goto e_overflow; - - if (flags & flag_escaped) - { - flags &= ~ flag_escaped; - - switch (b) - { - case 'b': string_add ('\b'); break; - case 'f': string_add ('\f'); break; - case 'n': string_add ('\n'); break; - case 'r': string_add ('\r'); break; - case 't': string_add ('\t'); break; - case 'u': - - if ((uc_b1 = hex_value (*++ i)) == 0xFF || (uc_b2 = hex_value (*++ i)) == 0xFF - || (uc_b3 = hex_value (*++ i)) == 0xFF || (uc_b4 = hex_value (*++ i)) == 0xFF) - { - sprintf (error, "Invalid character value `%c` (at %d:%d)", b, cur_line, e_off); - goto e_failed; - } - - uc_b1 = uc_b1 * 16 + uc_b2; - uc_b2 = uc_b3 * 16 + uc_b4; - - uchar = ((json_char) uc_b1) * 256 + uc_b2; - - if (sizeof (json_char) >= sizeof (json_uchar) || (uc_b1 == 0 && uc_b2 <= 0x7F)) - { - string_add ((json_char) uchar); - break; - } - - if (uchar <= 0x7FF) - { - if (state.first_pass) - string_length += 2; - else - { string [string_length ++] = 0xC0 | ((uc_b2 & 0xC0) >> 6) | ((uc_b1 & 0x3) << 3); - string [string_length ++] = 0x80 | (uc_b2 & 0x3F); - } - - break; - } - - if (state.first_pass) - string_length += 3; - else - { string [string_length ++] = 0xE0 | ((uc_b1 & 0xF0) >> 4); - string [string_length ++] = 0x80 | ((uc_b1 & 0xF) << 2) | ((uc_b2 & 0xC0) >> 6); - string [string_length ++] = 0x80 | (uc_b2 & 0x3F); - } - - break; - - default: - string_add (b); - }; - - continue; - } - - if (b == '\\') - { - flags |= flag_escaped; - continue; - } - - if (b == '"') - { - if (!state.first_pass) - string [string_length] = 0; - - flags &= ~ flag_string; - string = 0; - - switch (top->type) - { - case json_string: - - top->u.string.length = string_length; - flags |= flag_next; - - break; - - case json_object: - - if (state.first_pass) - (*(json_char **) &top->u.object.values) += string_length + 1; - else - { - top->u.object.values [top->u.object.length].name - = (json_char *) top->_reserved.object_mem; - - (*(json_char **) &top->_reserved.object_mem) += string_length + 1; - } - - flags |= flag_seek_value | flag_need_colon; - continue; - - default: - break; - }; - } - else - { - string_add (b); - continue; - } - } - - if (flags & flag_seek_value) - { - switch (b) - { - whitespace: - continue; - - case ']': - - if (top->type == json_array) - flags = (flags & ~ (flag_need_comma | flag_seek_value)) | flag_next; - else if (!state.settings.settings & json_relaxed_commas) - { sprintf (error, "%d:%d: Unexpected ]", cur_line, e_off); - goto e_failed; - } - - break; - - default: - - if (flags & flag_need_comma) - { - if (b == ',') - { flags &= ~ flag_need_comma; - continue; - } - else - { sprintf (error, "%d:%d: Expected , before %c", cur_line, e_off, b); - goto e_failed; - } - } - - if (flags & flag_need_colon) - { - if (b == ':') - { flags &= ~ flag_need_colon; - continue; - } - else - { sprintf (error, "%d:%d: Expected : before %c", cur_line, e_off, b); - goto e_failed; - } - } - - flags &= ~ flag_seek_value; - - switch (b) - { - case '{': - - if (!new_value (&state, &top, &root, &alloc, json_object)) - goto e_alloc_failure; - - continue; - - case '[': - - if (!new_value (&state, &top, &root, &alloc, json_array)) - goto e_alloc_failure; - - flags |= flag_seek_value; - continue; - - case '"': - - if (!new_value (&state, &top, &root, &alloc, json_string)) - goto e_alloc_failure; - - flags |= flag_string; - - string = top->u.string.ptr; - string_length = 0; - - continue; - - case 't': - - if (*(++ i) != 'r' || *(++ i) != 'u' || *(++ i) != 'e') - goto e_unknown_value; - - if (!new_value (&state, &top, &root, &alloc, json_boolean)) - goto e_alloc_failure; - - top->u.boolean = 1; - - flags |= flag_next; - break; - - case 'f': - - if (*(++ i) != 'a' || *(++ i) != 'l' || *(++ i) != 's' || *(++ i) != 'e') - goto e_unknown_value; - - if (!new_value (&state, &top, &root, &alloc, json_boolean)) - goto e_alloc_failure; - - flags |= flag_next; - break; - - case 'n': - - if (*(++ i) != 'u' || *(++ i) != 'l' || *(++ i) != 'l') - goto e_unknown_value; - - if (!new_value (&state, &top, &root, &alloc, json_null)) - goto e_alloc_failure; - - flags |= flag_next; - break; - - default: - - if (isdigit (b) || b == '-') - { - if (!new_value (&state, &top, &root, &alloc, json_integer)) - goto e_alloc_failure; - - flags &= ~ (flag_exponent | flag_got_exponent_sign); - - if (state.first_pass) - continue; - - if (top->type == json_double) - top->u.dbl = strtod (i, (json_char **) &i); - else - top->u.integer = strtol (i, (json_char **) &i, 10); - - flags |= flag_next | flag_reproc; - } - else - { sprintf (error, "%d:%d: Unexpected %c when seeking value", cur_line, e_off, b); - goto e_failed; - } - }; - }; - } - else - { - switch (top->type) - { - case json_object: - - switch (b) - { - whitespace: - continue; - - case '"': - - if (flags & flag_need_comma && (!state.settings.settings & json_relaxed_commas)) - { - sprintf (error, "%d:%d: Expected , before \"", cur_line, e_off); - goto e_failed; - } - - flags |= flag_string; - - string = (json_char *) top->_reserved.object_mem; - string_length = 0; - - break; - - case '}': - - flags = (flags & ~ flag_need_comma) | flag_next; - break; - - case ',': - - if (flags & flag_need_comma) - { - flags &= ~ flag_need_comma; - break; - } - - default: - - sprintf (error, "%d:%d: Unexpected `%c` in object", cur_line, e_off, b); - goto e_failed; - }; - - break; - - case json_integer: - case json_double: - - if (isdigit (b)) - continue; - - if (b == 'e' || b == 'E') - { - if (!(flags & flag_exponent)) - { - flags |= flag_exponent; - top->type = json_double; - - continue; - } - } - else if (b == '+' || b == '-') - { - if (flags & flag_exponent && !(flags & flag_got_exponent_sign)) - { - flags |= flag_got_exponent_sign; - continue; - } - } - else if (b == '.' && top->type == json_integer) - { - top->type = json_double; - continue; - } - - flags |= flag_next | flag_reproc; - break; - - default: - break; - }; - } - - if (flags & flag_reproc) - { - flags &= ~ flag_reproc; - -- i; - } - - if (flags & flag_next) - { - flags = (flags & ~ flag_next) | flag_need_comma; - - if (!top->parent) - { - /* root value done */ - - flags |= flag_done; - continue; - } - - if (top->parent->type == json_array) - flags |= flag_seek_value; - - if (!state.first_pass) - { - json_value * parent = top->parent; - - switch (parent->type) - { - case json_object: - - parent->u.object.values - [parent->u.object.length].value = top; - - break; - - case json_array: - - parent->u.array.values - [parent->u.array.length] = top; - - break; - - default: - break; - }; - } - - if ( (++ top->parent->u.array.length) > state.uint_max) - goto e_overflow; - - top = top->parent; - - continue; - } - } - - alloc = root; - } - - return root; - -e_unknown_value: - - sprintf (error, "%d:%d: Unknown value", cur_line, e_off); - goto e_failed; - -e_alloc_failure: - - strcpy (error, "Memory allocation failure"); - goto e_failed; - -e_overflow: - - sprintf (error, "%d:%d: Too long (caught overflow)", cur_line, e_off); - goto e_failed; - -e_failed: - - if (error_buf) - { - if (*error) - strcpy (error_buf, error); - else - strcpy (error_buf, "Unknown error"); - } - - if (state.first_pass) - alloc = root; - - while (alloc) - { - top = alloc->_reserved.next_alloc; - free (alloc); - alloc = top; - } - - if (!state.first_pass) - json_value_free (root); - - return 0; -} - -json_value * json_parse (const json_char * json) -{ - json_settings settings; - memset (&settings, 0, sizeof (json_settings)); - - return json_parse_ex (&settings, json, 0); -} - -void json_value_free (json_value * value) -{ - json_value * cur_value; - - if (!value) - return; - - value->parent = 0; - - while (value) - { - switch (value->type) - { - case json_array: - - if (!value->u.array.length) - { - free (value->u.array.values); - break; - } - - value = value->u.array.values [-- value->u.array.length]; - continue; - - case json_object: - - if (!value->u.object.length) - { - free (value->u.object.values); - break; - } - - value = value->u.object.values [-- value->u.object.length].value; - continue; - - case json_string: - - free (value->u.string.ptr); - break; - - default: - break; - }; - - cur_value = value; - value = value->parent; - free (cur_value); - } -} - - + +/* vim: set et ts=3 sw=3 ft=c: + * + * Copyright (C) 2012 James McLaughlin et al. All rights reserved. + * https://github.com/udp/json-parser + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "json.h" + +#ifdef _MSC_VER + #ifndef _CRT_SECURE_NO_WARNINGS + #define _CRT_SECURE_NO_WARNINGS + #endif +#endif + +#ifdef __cplusplus + const struct _json_value json_value_none; /* zero-d by ctor */ +#else + const struct _json_value json_value_none = { 0 }; +#endif + +#include +#include +#include +#include + +typedef unsigned short json_uchar; + +static unsigned char hex_value (json_char c) +{ + if (c >= 'A' && c <= 'F') + return (c - 'A') + 10; + + if (c >= 'a' && c <= 'f') + return (c - 'a') + 10; + + if (c >= '0' && c <= '9') + return c - '0'; + + return 0xFF; +} + +typedef struct +{ + json_settings settings; + int first_pass; + + unsigned long used_memory; + + unsigned int uint_max; + unsigned long ulong_max; + +} json_state; + +static void * json_alloc (json_state * state, unsigned long size, int zero) +{ + void * mem; + + if ((state->ulong_max - state->used_memory) < size) + return 0; + + if (state->settings.max_memory + && (state->used_memory += size) > state->settings.max_memory) + { + return 0; + } + + if (! (mem = zero ? calloc (size, 1) : malloc (size))) + return 0; + + return mem; +} + +static int new_value + (json_state * state, json_value ** top, json_value ** root, json_value ** alloc, json_type type) +{ + json_value * value; + int values_size; + + if (!state->first_pass) + { + value = *top = *alloc; + *alloc = (*alloc)->_reserved.next_alloc; + + if (!*root) + *root = value; + + switch (value->type) + { + case json_array: + + if (! (value->u.array.values = (json_value **) json_alloc + (state, value->u.array.length * sizeof (json_value *), 0)) ) + { + return 0; + } + + break; + + case json_object: + + values_size = sizeof (*value->u.object.values) * value->u.object.length; + + if (! ((*(void **) &value->u.object.values) = json_alloc + (state, values_size + ((unsigned long) value->u.object.values), 0)) ) + { + return 0; + } + + value->_reserved.object_mem = (*(char **) &value->u.object.values) + values_size; + + break; + + case json_string: + + if (! (value->u.string.ptr = (json_char *) json_alloc + (state, (value->u.string.length + 1) * sizeof (json_char), 0)) ) + { + return 0; + } + + break; + + default: + break; + }; + + value->u.array.length = 0; + + return 1; + } + + value = (json_value *) json_alloc (state, sizeof (json_value), 1); + + if (!value) + return 0; + + if (!*root) + *root = value; + + value->type = type; + value->parent = *top; + + if (*alloc) + (*alloc)->_reserved.next_alloc = value; + + *alloc = *top = value; + + return 1; +} + +#define e_off \ + ((int) (i - cur_line_begin)) + +#define whitespace \ + case '\n': ++ cur_line; cur_line_begin = i; \ + case ' ': case '\t': case '\r' + +#define string_add(b) \ + do { if (!state.first_pass) string [string_length] = b; ++ string_length; } while (0); + +const static int + flag_next = 1, flag_reproc = 2, flag_need_comma = 4, flag_seek_value = 8, flag_exponent = 16, + flag_got_exponent_sign = 32, flag_escaped = 64, flag_string = 128, flag_need_colon = 256, + flag_done = 512; + +json_value * json_parse_ex (json_settings * settings, const json_char * json, char * error_buf) +{ + json_char error [128]; + unsigned int cur_line; + const json_char * cur_line_begin, * i; + json_value * top, * root, * alloc = 0; + json_state state; + int flags; + + error[0] = '\0'; + + memset (&state, 0, sizeof (json_state)); + memcpy (&state.settings, settings, sizeof (json_settings)); + + memset (&state.uint_max, 0xFF, sizeof (state.uint_max)); + memset (&state.ulong_max, 0xFF, sizeof (state.ulong_max)); + + state.uint_max -= 8; /* limit of how much can be added before next check */ + state.ulong_max -= 8; + + for (state.first_pass = 1; state.first_pass >= 0; -- state.first_pass) + { + json_uchar uchar; + unsigned char uc_b1, uc_b2, uc_b3, uc_b4; + json_char * string; + unsigned int string_length; + + top = root = 0; + flags = flag_seek_value; + + cur_line = 1; + cur_line_begin = json; + + for (i = json ;; ++ i) + { + json_char b = *i; + + if (flags & flag_done) + { + if (!b) + break; + + switch (b) + { + whitespace: + continue; + + default: + sprintf (error, "%d:%d: Trailing garbage: `%c`", cur_line, e_off, b); + goto e_failed; + }; + } + + if (flags & flag_string) + { + if (!b) + { sprintf (error, "Unexpected EOF in string (at %d:%d)", cur_line, e_off); + goto e_failed; + } + + if (string_length > state.uint_max) + goto e_overflow; + + if (flags & flag_escaped) + { + flags &= ~ flag_escaped; + + switch (b) + { + case 'b': string_add ('\b'); break; + case 'f': string_add ('\f'); break; + case 'n': string_add ('\n'); break; + case 'r': string_add ('\r'); break; + case 't': string_add ('\t'); break; + case 'u': + + if ((uc_b1 = hex_value (*++ i)) == 0xFF || (uc_b2 = hex_value (*++ i)) == 0xFF + || (uc_b3 = hex_value (*++ i)) == 0xFF || (uc_b4 = hex_value (*++ i)) == 0xFF) + { + sprintf (error, "Invalid character value `%c` (at %d:%d)", b, cur_line, e_off); + goto e_failed; + } + + uc_b1 = uc_b1 * 16 + uc_b2; + uc_b2 = uc_b3 * 16 + uc_b4; + + uchar = ((json_char) uc_b1) * 256 + uc_b2; + + if (sizeof (json_char) >= sizeof (json_uchar) || (uc_b1 == 0 && uc_b2 <= 0x7F)) + { + string_add ((json_char) uchar); + break; + } + + if (uchar <= 0x7FF) + { + if (state.first_pass) + string_length += 2; + else + { string [string_length ++] = 0xC0 | ((uc_b2 & 0xC0) >> 6) | ((uc_b1 & 0x3) << 3); + string [string_length ++] = 0x80 | (uc_b2 & 0x3F); + } + + break; + } + + if (state.first_pass) + string_length += 3; + else + { string [string_length ++] = 0xE0 | ((uc_b1 & 0xF0) >> 4); + string [string_length ++] = 0x80 | ((uc_b1 & 0xF) << 2) | ((uc_b2 & 0xC0) >> 6); + string [string_length ++] = 0x80 | (uc_b2 & 0x3F); + } + + break; + + default: + string_add (b); + }; + + continue; + } + + if (b == '\\') + { + flags |= flag_escaped; + continue; + } + + if (b == '"') + { + if (!state.first_pass) + string [string_length] = 0; + + flags &= ~ flag_string; + string = 0; + + switch (top->type) + { + case json_string: + + top->u.string.length = string_length; + flags |= flag_next; + + break; + + case json_object: + + if (state.first_pass) + (*(json_char **) &top->u.object.values) += string_length + 1; + else + { + top->u.object.values [top->u.object.length].name + = (json_char *) top->_reserved.object_mem; + + (*(json_char **) &top->_reserved.object_mem) += string_length + 1; + } + + flags |= flag_seek_value | flag_need_colon; + continue; + + default: + break; + }; + } + else + { + string_add (b); + continue; + } + } + + if (flags & flag_seek_value) + { + switch (b) + { + whitespace: + continue; + + case ']': + + if (top->type == json_array) + flags = (flags & ~ (flag_need_comma | flag_seek_value)) | flag_next; + else if (!state.settings.settings & json_relaxed_commas) + { sprintf (error, "%d:%d: Unexpected ]", cur_line, e_off); + goto e_failed; + } + + break; + + default: + + if (flags & flag_need_comma) + { + if (b == ',') + { flags &= ~ flag_need_comma; + continue; + } + else + { sprintf (error, "%d:%d: Expected , before %c", cur_line, e_off, b); + goto e_failed; + } + } + + if (flags & flag_need_colon) + { + if (b == ':') + { flags &= ~ flag_need_colon; + continue; + } + else + { sprintf (error, "%d:%d: Expected : before %c", cur_line, e_off, b); + goto e_failed; + } + } + + flags &= ~ flag_seek_value; + + switch (b) + { + case '{': + + if (!new_value (&state, &top, &root, &alloc, json_object)) + goto e_alloc_failure; + + continue; + + case '[': + + if (!new_value (&state, &top, &root, &alloc, json_array)) + goto e_alloc_failure; + + flags |= flag_seek_value; + continue; + + case '"': + + if (!new_value (&state, &top, &root, &alloc, json_string)) + goto e_alloc_failure; + + flags |= flag_string; + + string = top->u.string.ptr; + string_length = 0; + + continue; + + case 't': + + if (*(++ i) != 'r' || *(++ i) != 'u' || *(++ i) != 'e') + goto e_unknown_value; + + if (!new_value (&state, &top, &root, &alloc, json_boolean)) + goto e_alloc_failure; + + top->u.boolean = 1; + + flags |= flag_next; + break; + + case 'f': + + if (*(++ i) != 'a' || *(++ i) != 'l' || *(++ i) != 's' || *(++ i) != 'e') + goto e_unknown_value; + + if (!new_value (&state, &top, &root, &alloc, json_boolean)) + goto e_alloc_failure; + + flags |= flag_next; + break; + + case 'n': + + if (*(++ i) != 'u' || *(++ i) != 'l' || *(++ i) != 'l') + goto e_unknown_value; + + if (!new_value (&state, &top, &root, &alloc, json_null)) + goto e_alloc_failure; + + flags |= flag_next; + break; + + default: + + if (isdigit (b) || b == '-') + { + if (!new_value (&state, &top, &root, &alloc, json_integer)) + goto e_alloc_failure; + + flags &= ~ (flag_exponent | flag_got_exponent_sign); + + if (state.first_pass) + continue; + + if (top->type == json_double) + top->u.dbl = strtod (i, (json_char **) &i); + else + top->u.integer = strtol (i, (json_char **) &i, 10); + + flags |= flag_next | flag_reproc; + } + else + { sprintf (error, "%d:%d: Unexpected %c when seeking value", cur_line, e_off, b); + goto e_failed; + } + }; + }; + } + else + { + switch (top->type) + { + case json_object: + + switch (b) + { + whitespace: + continue; + + case '"': + + if (flags & flag_need_comma && (!state.settings.settings & json_relaxed_commas)) + { + sprintf (error, "%d:%d: Expected , before \"", cur_line, e_off); + goto e_failed; + } + + flags |= flag_string; + + string = (json_char *) top->_reserved.object_mem; + string_length = 0; + + break; + + case '}': + + flags = (flags & ~ flag_need_comma) | flag_next; + break; + + case ',': + + if (flags & flag_need_comma) + { + flags &= ~ flag_need_comma; + break; + } + + default: + + sprintf (error, "%d:%d: Unexpected `%c` in object", cur_line, e_off, b); + goto e_failed; + }; + + break; + + case json_integer: + case json_double: + + if (isdigit (b)) + continue; + + if (b == 'e' || b == 'E') + { + if (!(flags & flag_exponent)) + { + flags |= flag_exponent; + top->type = json_double; + + continue; + } + } + else if (b == '+' || b == '-') + { + if (flags & flag_exponent && !(flags & flag_got_exponent_sign)) + { + flags |= flag_got_exponent_sign; + continue; + } + } + else if (b == '.' && top->type == json_integer) + { + top->type = json_double; + continue; + } + + flags |= flag_next | flag_reproc; + break; + + default: + break; + }; + } + + if (flags & flag_reproc) + { + flags &= ~ flag_reproc; + -- i; + } + + if (flags & flag_next) + { + flags = (flags & ~ flag_next) | flag_need_comma; + + if (!top->parent) + { + /* root value done */ + + flags |= flag_done; + continue; + } + + if (top->parent->type == json_array) + flags |= flag_seek_value; + + if (!state.first_pass) + { + json_value * parent = top->parent; + + switch (parent->type) + { + case json_object: + + parent->u.object.values + [parent->u.object.length].value = top; + + break; + + case json_array: + + parent->u.array.values + [parent->u.array.length] = top; + + break; + + default: + break; + }; + } + + if ( (++ top->parent->u.array.length) > state.uint_max) + goto e_overflow; + + top = top->parent; + + continue; + } + } + + alloc = root; + } + + return root; + +e_unknown_value: + + sprintf (error, "%d:%d: Unknown value", cur_line, e_off); + goto e_failed; + +e_alloc_failure: + + strcpy (error, "Memory allocation failure"); + goto e_failed; + +e_overflow: + + sprintf (error, "%d:%d: Too long (caught overflow)", cur_line, e_off); + goto e_failed; + +e_failed: + + if (error_buf) + { + if (*error) + strcpy (error_buf, error); + else + strcpy (error_buf, "Unknown error"); + } + + if (state.first_pass) + alloc = root; + + while (alloc) + { + top = alloc->_reserved.next_alloc; + free (alloc); + alloc = top; + } + + if (!state.first_pass) + json_value_free (root); + + return 0; +} + +json_value * json_parse (const json_char * json) +{ + json_settings settings; + memset (&settings, 0, sizeof (json_settings)); + + return json_parse_ex (&settings, json, 0); +} + +void json_value_free (json_value * value) +{ + json_value * cur_value; + + if (!value) + return; + + value->parent = 0; + + while (value) + { + switch (value->type) + { + case json_array: + + if (!value->u.array.length) + { + free (value->u.array.values); + break; + } + + value = value->u.array.values [-- value->u.array.length]; + continue; + + case json_object: + + if (!value->u.object.length) + { + free (value->u.object.values); + break; + } + + value = value->u.object.values [-- value->u.object.length].value; + continue; + + case json_string: + + free (value->u.string.ptr); + break; + + default: + break; + }; + + cur_value = value; + value = value->parent; + free (cur_value); + } +} + + diff --git a/README b/README index 8e7a9f3..f86854e 100644 --- a/README +++ b/README @@ -1,4 +1,5 @@ -Edif is an alternate extension development SDK for Multimedia Fusion 2, in which your extension -is a true C++ class, with a JSON file (optionally external) to describe it. - -TODO: Insert some helpful information here? \ No newline at end of file +Edif is an alternate extension development SDK for Multimedia Fusion 2, in which your extension +is a true C++ class, with a JSON file (optionally external) to describe it. + +TODO: Insert some helpful information here? +TODO: Create EDIF Help file... \ No newline at end of file From db92fa90714880fbe12442ac3dcfbfb6276fc65c Mon Sep 17 00:00:00 2001 From: LB Date: Sat, 20 Oct 2012 00:52:36 -0500 Subject: [PATCH 002/127] Added missing files from last commit --- .gitignore | 165 ++++++++++++++- Extensions/Template/CustomParams.cpp | 108 ++++++++++ Extensions/Template/Debugger.cpp | 141 +++++++++++++ Extensions/Template/EditData.hpp | 154 ++++++++++++++ Extensions/Template/Properties.cpp | 292 +++++++++++++++++++++++++++ Extensions/Template/Text.cpp | 63 ++++++ Extensions/Template/TextProps.cpp | 116 +++++++++++ 7 files changed, 1037 insertions(+), 2 deletions(-) create mode 100644 Extensions/Template/CustomParams.cpp create mode 100644 Extensions/Template/Debugger.cpp create mode 100644 Extensions/Template/EditData.hpp create mode 100644 Extensions/Template/Properties.cpp create mode 100644 Extensions/Template/Text.cpp create mode 100644 Extensions/Template/TextProps.cpp diff --git a/.gitignore b/.gitignore index 618f42f..d2fcacd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,163 @@ -#Ignore any local extensions -Extensions/ +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Rr]elease/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.vspscc +.builds +*.dotCover + +## TODO: If you have NuGet Package Restore enabled, uncomment this +#packages/ + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp + +# ReSharper is a .NET coding add-in +_ReSharper* + +# Installshield output folder +[Ee]xpress + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish + +# Others +[Bb]in +[Oo]bj +sql +TestResults +*.Cache +ClientBin +stylecop.* +~$* +*.dbmdl +Generated_Code #added for RIA/Silverlight projects + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML + + + +############ +## Windows +############ + +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg + +# Mac crap +.DS_Store diff --git a/Extensions/Template/CustomParams.cpp b/Extensions/Template/CustomParams.cpp new file mode 100644 index 0000000..238bc0a --- /dev/null +++ b/Extensions/Template/CustomParams.cpp @@ -0,0 +1,108 @@ +/* CustomParams.cpp + * Just as with all the other SDKs, EDIF + * supports the creation and use of custom, + * you-defined parameters. Your own dialog, + * your own display string, your own sense + * of control. Read the MMF2SDK Help file + * for more information. To use custom + * parameters with EDIF, the parameter type + * must be "Custom" or "Custom#" where # is + * the number of the custom parameter. + * Functions defined here: + * InitParameter + * EditParameter + * GetParameterString + */ + +#include "Common.h" + +/* InitParameter + * Like with the editdata, this data will + * be written as-is to disk and later read + * back. The most you can store is defined + * by PARAM_EXTMAXSIZE, which currently is + * 512 bytes. Use them wisely! + */ +void MMF2Func InitParameter(mv *mV, short ID, paramExt *ParamData) +{ +#ifndef RUN_ONLY + //store data in ParamData->pextData + //store the size of the data in ParamData->pextSize +#endif +} + +// Example of custom parameter setup proc +// -------------------------------------- +/* +#ifndef RUN_ONLY +BOOL CALLBACK SetupProc(HWND hDlg, UINT msgType, WPARAM wParam, LPARAM lParam) +{ + paramExt* pExt; + + switch (msgType) + { + case WM_INITDIALOG: // Init dialog + + // Save edptr + SetWindowLong(hDlg, DWL_USER, lParam); + pExt=(paramExt*)lParam; + + SetDlgItemText(hDlg, IDC_EDIT, pExt->pextData); + return TRUE; + + case WM_COMMAND: // Command + + // Retrieve edptr + pExt = (paramExt *)GetWindowLong(hDlg, DWL_USER); + + switch (wmCommandID) + { + case IDOK: // Exit + GetDlgItemText(hDlg, IDC_EDIT, pExt->pextData, 500); + pExt->pextSize=sizeof(paramExt)+strlen(pExt->pextData)+1; + EndDialog(hDlg, TRUE); + return TRUE; + + default: + break; + } + break; + + default: + break; + } + return FALSE; +} +#endif +*/ + +/* EditParameter + * This is where you actually bring up + * the dialog and take input from + * the user and store it. + */ +void MMF2Func EditParameter(mv _far *mV, short code, paramExt* pExt) +{ +#ifndef RUN_ONLY + // Example + // ------- + // DialogBoxParam(hInstLib, MAKEINTRESOURCE(DB_TRYPARAM), mV->mvHEditWin, SetupProc, (LPARAM)(LPBYTE)pExt); +#endif +} + +/* GetParameterString + * This is where you give MMF2 the display + * string for your custom parameter. Remember, + * this is the display for ONE PARAMETER. It + * will appear amongst all the other parameter + * displays depending on the A/C's display + * string. + */ +void MMF2Func GetParameterString(mv _far *mV, short code, paramExt* pExt, LPSTR pDest, short size) +{ +#ifndef RUN_ONLY + // Example + // ------- + // wsprintf(pDest, "Super parameter %s", pExt->pextData); +#endif +} diff --git a/Extensions/Template/Debugger.cpp b/Extensions/Template/Debugger.cpp new file mode 100644 index 0000000..f3f943b --- /dev/null +++ b/Extensions/Template/Debugger.cpp @@ -0,0 +1,141 @@ +/* Debugger.cpp + * Here you will be able to interact + * with the MMF2 debugger (that thing + * in the top left when you run your + * MFA from MMF2). You can add your own + * fields of your choice to your object's + * debugger tree. + * Functions defined here: + * GetDebugTree + * GetDebugItem + * EditDebugItem + */ + +#include "Common.h" + +#ifndef RUN_ONLY //The debugger is only available when running from MMF2, which uses the Edittime MFX + +/* DB + * This is the namespace the debugger identifiers + * are stored in. It keeps them out of the global + * namespace and it helps with intellisense. + */ +namespace DB +{ + /* + * The debugger identitifers. + */ + enum + { +// MyString, +// MyInt, + }; +} + +/* DebugTree + * The list of items to be displayed + * in the debugger tree. + */ +WORD DebugTree[] = +{ +// DB::MyString|DB_EDITABLE, +// DB::MyInt|DB_EDITABLE, +// DB::SomethingThatIDontWantTheUserToBeAbleToEditAtRuntime, + DB_END +}; + +#endif + +/* GetDerbugTree + * Plain and simple, just return the debug + * tree pointer from above. If you really + * want to you can create the debug tree + * dynamically and return that, but you'll + * need to store the pointer in your extension + * class every time so that you can release + * the memory in your extension class' destructor. + */ +LPWORD MMF2Func GetDebugTree(RD *rd) +{ +#ifndef RUN_ONLY + return DebugTree; +#endif + return NULL; +} + +/* GetDebugItem + * With respect to DB_BUFFERSIZE, give + * MMF2 the string to display in the + * debugger. You must include both the + * name and the value in the string, + * or any format you want. + */ +void MMF2Func GetDebugItem(LPSTR Buffer, RD *rd, int ID) +{ +#ifndef RUN_ONLY +// char temp[DB_BUFFERSIZE]; +// switch (ID) +// { +// case DB::MyString: +// { +// LoadString(hInstLib, IDS_CURRENTSTRING, temp, DB_BUFFERSIZE); +// wsprintf(pBuffer, temp, rdPtr->text); +// break; +// } +// case DB::MyInt: +// { +// LoadString(hInstLib, IDS_CURRENTVALUE, temp, DB_BUFFERSIZE); +// wsprintf(pBuffer, temp, rdPtr->value); +// break; +// } +// } +#endif +} + +/* EditDebugItem + * When the user chooses to edit an + * editable debug item, this function + * is called. You can use the RFUNCTIONs + * provided by MMF2 to do simple text and + * number edits, or you can do whatever you + * want, such as creating a dialog that lets + * the user enter more sophisticated input to + * the debug item, or simply display more info. + */ +void MMF2Func EditDebugItem(RD *rd, int ID) +{ +#ifndef RUN_ONLY +/* + switch(ID) + { + case DB::MyString: + { + EditDebugInfo dbi; + char buffer[256]; + + dbi.pText=buffer; + dbi.lText=TEXT_MAX; + dbi.pTitle=NULL; + + strcpy(buffer, rdPtr->text); + long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITTEXT, 0, (LPARAM)&dbi); + if (ret) + strcpy(rdPtr->text, dbi.pText); + } + break; + case DB::MyInt: + { + EditDebugInfo dbi; + + dbi.value=rdPtr->value; + dbi.pTitle=NULL; + + long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITINT, 0, (LPARAM)&dbi); + if (ret) + rdPtr->value=dbi.value; + } + break; + } +*/ +#endif +} diff --git a/Extensions/Template/EditData.hpp b/Extensions/Template/EditData.hpp new file mode 100644 index 0000000..f2a2676 --- /dev/null +++ b/Extensions/Template/EditData.hpp @@ -0,0 +1,154 @@ +/* EditData.hpp + * This is where you control what data + * you want to have at edittime. You + * are responsible for serializing and + * deserializing (saving/loading) the + * data to/from the SerializedED structure + * as if it were a file on the hard drive. + * It doesn't need to be efficient; this + * is just at edittime and once at the + * start of the runtime. + */ + +struct EditData +{ + /* MyString, MyInt, MyArray_t, MyArray + * Example data + */ + //stdtstring MyString; + //int MyInt; + //typedef std::vector MyArray_t; + //MyArray_t MyArray; + + /* + * This is where you provide default values for + * your editdata. This constructor is used + * when your extension is first created and + * default values are needed. + */ + EditData() // : MyString("Hello, world!"), MyInt(1337) + { + //MyArray.push_back(3.1415926f); + } + + /* + * As a convenience in other parts of your code, + * you should copy data from another instance + * of the EditData class. Make sure you deep-copy + * dynamically allocated memory e.g. with pointers. + */ + EditData(const EditData &from) // : MyString(from.MyString), MyInt(from.MyInt), MyArray(from.MyArray) + { + // + } + + /* operator= + * This is essentially the same as the copy + * constructor above, except you are working + * with an instance that is already + * constructed. + */ + EditData &operator=(const EditData &from) + { + //MyString = from.MyString; + //MyInt = from.MyInt; + //MyArray = from.MyArray; + } + + /* Serialize + * This is where you need to "write" data + * to SerializedED like a file. Make sure + * you can read the data back in the + * constructor below! + */ + bool Serialize(mv *mV, SerializedED *&SED) const + { + //First, figure out how much space is needed + unsigned size = 0; + //size += (MyString.length()+1) * sizeof(stdtstring::value_type); + //size += sizeof(MyInt); + //size += sizeof(MyArray_t::size_type); + //size += MyArray.size() * sizeof(MyArray_t::value_type); + + //Then, ask MMF2 to provide this space for us in the SerializedED + { + SerializedED *t = (SerializedED *)mvReAllocEditData(mV, SED, sizeof(SerializedED)+size); + if(t) //if it worked + { + SED = t; + //Since SED is a pointer passed by reference, + //it will update outside this function so that + //the calling code keeps a valid pointer to + //the SerializedED. + } + else return false; //could not allocate space + } + + //Now, the crazy-looking part: serialize the data + char *p = (char *)(&SED->data); //put the pointer at the beginning of the space MMF2 gave us + //Perform the copy: Advance the pointer: + //_tcscpy(p, MyString.c_str()); p += (MyString.length()+1) * sizeof(stdtstring::value_type); + //memcpy(p, &MyInt, sizeof(MyInt)); p += sizeof(MyInt); + //MyArray_t::size_type MyArray_size = MyArray.size(); + //memcpy(p, &MyArray_size, sizeof(MyArray_size)); p += sizeof(MyArray_size); + //for(MyArray_t::size_type i = 0; i < MyArray_size; ++i) + //{ + //memcpy(p, &MyArray[i], sizeof(MyArray_t::value_type)); p += sizeof(MyArray_t::value_type); + //} + //If you get tired of retyping the size stuff from above, you can always store + //the sizes in variables or make macros for them. + + //Done! + return true; //return false in the event of an error + } + + /* + * This is the primary constructor for the + * EditData class. Here you will have to + * "read" SerializedED like a file and + * load back everything that gets saved + * above in Serialize. Make sure you check + * the version information first, this + * constructor is used to update from + * older versions of your editdata as well. + */ + EditData(SerializedED *SED) + { + if(SED->Header.extVersion == 0) + { + //code to update from an older version + } + else if(SED->Header.extVersion == 1) + { + //We have to do some crazy stuff again! + char *p = (char *)(&SED->data); + //Load the data: Advance the pointer: + //MyString = p; /*std::string is smart enough for this*/ p += (MyString.length()+1) * sizeof(stdtstring::value_type); + //MyInt = *(int *)p; p += sizeof(MyInt); + //MyArray_t::size_type MyArray_size = *(MyArray_t::size_type *)p; p += sizeof(MyArray_size); + //for(MyArray_t::size_type i = 0; i < MyArray_size; ++i) + //{ + //MyArray.push_back(*(MyArray_t::value_type *)p); p += sizeof(MyArray_t::value_type); + //} + } + else //the version is newer than current + { + //Either try to load the data anyway assuming your + //future self was smart enough to keep the data in + //the same format with new data at the end, or + //make an error dialog and load some default data. + //MessageBox(NULL, _T("The MFA you are trying to load was saved" + // "with a newer version of this extension."), + // _T("Error Loading My Extension"), MB_OK); + } + } + + /* + * If you grabbed any memory e.g. with new, + * make sure to e.g. delete it in here. + */ + ~EditData() + { + // + } +}; diff --git a/Extensions/Template/Properties.cpp b/Extensions/Template/Properties.cpp new file mode 100644 index 0000000..3e2e3a7 --- /dev/null +++ b/Extensions/Template/Properties.cpp @@ -0,0 +1,292 @@ +/* Properties.cpp + * In this file you will define the edittime + * properties for your extension. By default + * only a version number is displayed. + * Functions defined here: + * GetProperties + * ReleaseProperties + * GetPropCreateParam + * ReleasePropCreateParam + * GetPropValue + * SetPropValue + * GetPropCheck + * SetPropCheck + * EditProp + * IsPropEnabled + */ + +#include "Common.h" + +#ifndef RUN_ONLY + +/* Prop + * This is the namespace the property identifiers + * are stored in. It keeps them out of the global + * namespace and it helps with intellisense. + */ +namespace Prop +{ + /* + * The property identitifers. + */ + enum + { + zNOT_USED = PROPID_EXTITEM_CUSTOM_FIRST, + Version, + //MyString, + //MyInt, + }; +} + +PropData Properties[] = //See the MMF2SDK help file for information on PropData_ macros. +{ + PropData_StaticString(Prop::Version, (UINT_PTR)"Version #", (UINT_PTR)"This is the current version of the EDIF Template object."), + //PropData_EditMultiLine(Prop::MyString, (UINT_PTR)"My String", (UINT_PTR)"The contents of my string."), + //PropData_EditNumber(Prop::MyInt, (UINT_PTR)"My Integer", (UINT_PTR)"The value of my integer."), + PropData_End() +}; + +#endif + +/* GetProperties + * Here, you choose what proeprties to insert + * into which tabs. Lots of dynamic things can + * be done in here, such as dynamically + * generating the properties based on the + * number of stored values in the editdata. + */ +BOOL MMF2Func GetProperties(mv *mV, SerializedED *SED, BOOL MasterItem) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //ed.stuff; + mvInsertProps(mV, SED, Properties, PROPID_TAB_GENERAL, TRUE); + //if you changed ed: + //ed.Serialize(mV, SED); + return TRUE; +#endif + return FALSE; +} + +/* ReleaseProperties + * If you dynamically allocated memory for + * property arrays in GetProperties, release + * that memory in this function. + */ +void MMF2Func ReleaseProperties(mv *mV, SerializedED *SED, BOOL MasterItem) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //ed.stuff; + // + //if you changed ed: + //ed.Serialize(mV, SED); +#endif +} + +/* GetPropCreateParam + * A convenience function if you use the + * hard-coded Properties array above. Allows + * you to dynamically create e.g. combo + * lists and other things that have + * additional parameters for their + * properties. However if you dynamically + * allocated everything in GetProperties, + * this function is useless. + */ +LPARAM MMF2Func GetPropCreateParam(mv *mV, SerializedED *SED, UINT PropID) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //ed.stuff; + //return (LPARAM)TheParameter; + //if you changed ed: + //ed.Serialize(mV, SED); +#endif + return NULL; +} + +/* ReleasePropCreateParam + * If you found a useful way to use the + * above function and you dynamically + * allocated memory, release it here. + */ +void MMF2Func ReleasePropCreateParam(mv *mV, SerializedED *SED, UINT PropID, LPARAM lParam) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //ed.stuff; + //MyAwesomeMemoryFreeingFunction(lParam); + //if you changed ed: + //ed.Serialize(mV, SED); +#endif +} + +/* GetPropValue + * This is where you return the display + * values for the properties you defined. + * Refer to the MMF2SDK Help file for + * information on what to return for + * each kind of property. + */ +void *MMF2Func GetPropValue(mv *mV, SerializedED *SED, UINT PropID) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + switch(PropID) + { + case Prop::Version: + { + return new CPropDataValue("Default.EDIF.Template.0"); + } + //case Prop::MyString: + // { + // return new CPropDataValue(ed.MyString.c_str()); + // } + //case Prop::MyInt: + // { + // return new CPropDWordValue(ed.MyInt); + // } + } + //if you changed ed: + //ed.Serialize(mV, SED); +#endif + return NULL; +} + +/* SetPropValue + * The user has just finished entering their + * 500 page essay into your MyString field. + * MMF2 isn't so kind as to save that for them, + * so it entrusts it with you. Store it! + */ +void MMF2Func SetPropValue(mv *mV, SerializedED *SED, UINT PropID, CPropValue *PropVal) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //switch(PropID) + //{ + //case PropData::MyString: + // { + // ed.MyString = (LPSTR)((CPropDataValue*)PropVal)->m_pData; + // break; + // } + //case PropData::MyInt: + // { + // ed.MyInt = (CPropDWordValue*)PropVal)->m_dwValue; + // break; + // } + //} + //since you changed ed: + //ed.Serialize(mV, SED); + + //You may want to have your object redrawn in the + //frame editor after the modifications; in this + //case, just call this function: + //mvInvalidateObject(mV, SED); +#endif +} + +/* GetPropCheck + * There are checkbox properties, and + * there are properties that have their + * own checkbox as an option. This is + * where you tell MMF2 whether those + * boxes are ticked or not. + */ +BOOL MMF2Func GetPropCheck(mv *mV, SerializedED *SED, UINT PropID) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //switch(PropID) + //{ + //case Prop::MyCheckBoxPropertyOrPropertyThatHasTheCheckboxOptionSet: + // { + // return ed.WhetherOrNotThatPropertyOfMineIsTicked ? TRUE : FALSE; + // } + //} + //if you changed ed: + //ed.Serialize(mV, SED); +#endif + return FALSE; +} + +/* SetPropCheck + * The user has painstakingly moved the + * mouse cursor over the checkbox and + * expended the immense effort required + * to click the mouse and toggle the + * state of the tickbox. Don't let their + * effort be all for naught! + */ +void MMF2Func SetPropCheck(mv *mV, SerializedED *SED, UINT PropID, BOOL Ticked) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //switch(PropID) + //{ + //case Prop::MyCheckBoxPropertyOrPropertyThatHasTheCheckboxOptionSet: + // { + // ed.WhetherOrNotThatPropertyOfMineIsTicked = Ticked != FALSE ? true : false; + // } + //} + //since you changed ed: + //ed.Serialize(mV, SED); +#endif +} + +/* EditProp + * If you use a button proeprty or a + * property that has a button, then + * you would be impolite to ignore + * the user when the click on that + * button. Here is where you respond + * to that button press e.g. with + * a dialog. + */ +BOOL MMF2Func EditProp(mv *mV, SerializedED *SED, UINT PropID) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //switch(PropID) + //{ + //case Prop::MyButtonPropertyOrPropertyThatHasAButtonWithIt: + // { + // // + // break; + // } + //} + //if you changed ed: + //ed.Serialize(mV, SED); +#endif + return FALSE; +} + +/* IsPropEnabled + * Let's say you're tired of having to deal + * with the user's various 500 page essays, + * tickbox toggles, and button clicks. Here, + * you can simply disable a property by + * returning FALSE for that property. + */ +BOOL MMF2Func IsPropEnabled(mv *mV, SerializedED *SED, UINT PropID) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + switch(PropID) + { + case Prop::Version: + { + return FALSE; //Makes the version proeprty greyed out + } + //case Prop::MyString: //intentional\\ + //case Prop::MyInt: //fallthrough\\ + // { + // return TRUE; //allows the user to interact with these proeprties + // } + } + //if you changed ed: + //ed.Serialize(mV, SED); +#endif + return FALSE; +} diff --git a/Extensions/Template/Text.cpp b/Extensions/Template/Text.cpp new file mode 100644 index 0000000..c753dcd --- /dev/null +++ b/Extensions/Template/Text.cpp @@ -0,0 +1,63 @@ +/* Text.cpp + * If you define the OEFLAG_TEXT flag, + * then this file is for you. Here you + * will deal with text at runtime similarly + * to how you dealt with it at edittime. + * By default all functions are commented + * out, if you implement them (and you + * should implement them in an all-or- + * nothing fashion), then you need to + * uncomment them in Ext.def as well. + * Functions defined here: + * GetRunObjectFont + * SetRunObjectFont + * GetRunObjectTextColor + * SetRunObjectTextColor + */ + +#include "Common.h" + +/* GetRunObjectFont + * Copy the current font into the Lf parameter. + */ +/*void MMF2Func GetRunObjectFont(RD *rd, LOGFONT *Lf) +{ + //GetObject(rd->pExtension->MyHFont, sizeof(LOGFONT), Lf); +}*/ + +/* SetRunObjectFont + * Store the font set by the user. Some + * action needs to be taken when rect is + * not null - read the MMF2SDK Help file + * for more information. + */ +/*void MMF2Func SetRunObjectFont(RD *rd, LOGFONT *Lf, RECT *rect) +{ +// Extension &ext = *(rd->pExtension); +// HFONT HFont = CreateFontIndirect(Lf); +// if(hFont != NULL) +// { +// if(ext.MyHFont != 0) DeleteObject(ext.MyHFont); +// ext.MyHFont = HFont; +// SendMessage(ext.MyHWindow, WM_SETFONT, WPARAM(ext.MyHFont), FALSE); +// } +}*/ + +/* GetRunObjectTextColor + * Plain and simple, return the color + * of the text. + */ +/*COLORREF MMF2Func GetRunObjectTextColor(RD *rd) +{ + return 0; +}*/ + +/* SetRunObjectTextColor + * Store the new color of the text + * and force and update on your window. + */ +/*void MMF2Func SetRunObjectTextColor(RD *rd, COLORREF color) +{ +// rd->pExtension->MyTextColor = color; +// InvalidateRect(rd->pExtension->MyHWindow, NULL, TRUE); +}*/ diff --git a/Extensions/Template/TextProps.cpp b/Extensions/Template/TextProps.cpp new file mode 100644 index 0000000..1505e32 --- /dev/null +++ b/Extensions/Template/TextProps.cpp @@ -0,0 +1,116 @@ +/* TextProps.cpp + * If you plan on allowing MMF2 to manage + * your extension's text display properties + * for you, this is the file to look into. + * Functions defined here: + * GetTextCaps + * GetTextFont + * SetTextFont + * GetTextClr + * SetTextClr + * GetTextAlignment + * SetTextAlignment + */ + +#include "Common.h" + +/* GetTextCaps + * Return the text capabilities + * of your extension at edittime. + */ +DWORD MMF2Func GetTextCaps(mv *mV, SerializedED *SED) +{ +#ifndef RUN_ONLY +// return TEXT_ALIGN_LEFT|TEXT_ALIGN_HCENTER|TEXT_ALIGN_RIGHT +// |TEXT_ALIGN_TOP|TEXT_ALIGN_VCENTER|TEXT_ALIGN_BOTTOM +// |TEXT_FONT|TEXT_COLOR; +#endif + return 0; +} + +/* GetTextFont + * Return the font used by your extension. + */ +BOOL MMF2Func GetTextFont(mv *mV, SerializedED *SED, LOGFONT *lf, LPTSTR, UINT) +{ +#ifndef RUN_ONLY + // + return TRUE; +#endif + return FALSE; +} + +/* SetTextFont + * Changes the font used by your extension. + */ +BOOL MMF2Func SetTextFont(mv *mV, SerializedED *SED, LOGFONT *lf, LPCSTR) +{ +#ifndef RUN_ONLY + // + return TRUE; +#endif + return FALSE; +} + +/* GetTextClr + * Return the RGB color value of the text color. + */ +COLORREF MMF2Func GetTextClr(mv *mV, SerializedED *SED) +{ +#ifndef RUN_ONLY + // + return 200<<8; //green +#endif + return 0; +} + +/* SetTextClr + * Sets the color of the text. + */ +void MMF2Func SetTextClr(mv *mV, SerializedED *SED, COLORREF Color) +{ +#ifndef RUN_ONLY + // +#endif +} + +/* GetTextAlignment + * Return the alignment of the text. + */ +DWORD MMF2Func GetTextAlignment(mv *mV, SerializedED *SED) +{ +#ifndef RUN_ONLY +// DWORD dw = 0; + +// if((ed.Flags & ALIGN_LEFT) != 0) dw |= TEXT_ALIGN_LEFT; +// if((ed.Flags & ALIGN_HCENTER) != 0) dw |= TEXT_ALIGN_HCENTER; +// if((ed.Flags & ALIGN_RIGHT) != 0) dw |= TEXT_ALIGN_RIGHT; + +// if((ed.Flags & ALIGN_TOP) != 0) dw |= TEXT_ALIGN_TOP; +// if((ed.Flags & ALIGN_VCENTER) != 0) dw |= TEXT_ALIGN_VCENTER; +// if((ed.Flags & ALIGN_BOTTOM) != 0) dw |= TEXT_ALIGN_BOTTOM; + +// return dw; +#endif + return 0; +} + +/* SetTextAlignment + * Sets the alignment of the text. + */ +void MMF2Func SetTextAlignment(mv *mV, SerializedED *SED, DWORD AlignFlags) +{ +#ifndef RUN_ONLY +// DWORD dw = ed.Flags; + +// if((AlignFlags & TEXT_ALIGN_LEFT) != 0) dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_LEFT; +// if((AlignFlags & TEXT_ALIGN_HCENTER)!= 0) dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_HCENTER; +// if((AlignFlags & TEXT_ALIGN_RIGHT) != 0) dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_RIGHT; + +// if((AlignFlags & TEXT_ALIGN_TOP) != 0) dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_TOP; +// if((AlignFlags & TEXT_ALIGN_VCENTER)!= 0) dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_VCENTER; +// if((AlignFlags & TEXT_ALIGN_BOTTOM) != 0) dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_BOTTOM; + +// edFlags = dw; +#endif +} From b16d9a195291fa66cde01d145a102ba8c9ee96c7 Mon Sep 17 00:00:00 2001 From: LB Date: Sat, 20 Oct 2012 01:11:10 -0500 Subject: [PATCH 003/127] bells and whistles --- .gitattributes | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain From cca724d4c22b78762ec559dc32fa31187481f760 Mon Sep 17 00:00:00 2001 From: LB Date: Sat, 20 Oct 2012 12:34:31 -0500 Subject: [PATCH 004/127] Fix header extension inconsistency --- Extensions/Template/Common.h | 72 +- .../Template/{Extension.h => Extension.hpp} | 288 +- Extensions/Template/Template.vcproj | 3190 ++++++++--------- 3 files changed, 1775 insertions(+), 1775 deletions(-) rename Extensions/Template/{Extension.h => Extension.hpp} (96%) diff --git a/Extensions/Template/Common.h b/Extensions/Template/Common.h index 0f6945e..0d926a5 100644 --- a/Extensions/Template/Common.h +++ b/Extensions/Template/Common.h @@ -1,36 +1,36 @@ -/* Common.h - * This is the common header file included - * by almost all other *.cpp files in - * the project. Anything that gets put or - * included in here will be available to you - * everywhere else. You shouldn't need to - * change anything in this file except - * to include headers that you want and - * to change the edition of MMF2 you want - * to support. - */ - -#pragma once - -//Only define one of these at once: -// #define TGFEXT //TGF2, MMF2, MMF2 Dev - #define MMFEXT //MMF2, MMF2 Dev -// #define PROEXT //MMF2 Dev only - -#include "Edif.h" -#include "Resource.h" - -//#include -//#include "YourHeader.hpp" - -/* stdtstring - * A std::string that knows if you're using - * unicode or not. (Protip: strings passed - * to your extension A/C/Es still need to be - * const TCHAR *, and the same goes for strings - * returned from expressions and conditions). - */ -typedef std::basic_string stdtstring; - -#include "EditData.hpp" -#include "Extension.h" +/* Common.h + * This is the common header file included + * by almost all other *.cpp files in + * the project. Anything that gets put or + * included in here will be available to you + * everywhere else. You shouldn't need to + * change anything in this file except + * to include headers that you want and + * to change the edition of MMF2 you want + * to support. + */ + +#pragma once + +//Only define one of these at once: +// #define TGFEXT //TGF2, MMF2, MMF2 Dev + #define MMFEXT //MMF2, MMF2 Dev +// #define PROEXT //MMF2 Dev only + +#include "Edif.h" +#include "Resource.h" + +//#include +//#include "YourHeader.hpp" + +/* stdtstring + * A std::string that knows if you're using + * unicode or not. (Protip: strings passed + * to your extension A/C/Es still need to be + * const TCHAR *, and the same goes for strings + * returned from expressions and conditions). + */ +typedef std::basic_string stdtstring; + +#include "EditData.hpp" +#include "Extension.hpp" diff --git a/Extensions/Template/Extension.h b/Extensions/Template/Extension.hpp similarity index 96% rename from Extensions/Template/Extension.h rename to Extensions/Template/Extension.hpp index acc6db0..12bebdb 100644 --- a/Extensions/Template/Extension.h +++ b/Extensions/Template/Extension.hpp @@ -1,145 +1,145 @@ -/* Extension.h - * This is where you define your extension - * class. Runtime variables and function - * declarations go in here; A/C/E function - * definitions go in their respective .cpp - * files, other function definitions go in - * Extension.cpp. This header is included - * at the bottom of Common.h, so you have - * access to everything included by it. - */ - -class Extension -{ -public: - /* rd - * This is a pointer to the classic - * RunData structure. Some things still - * have to be stored there for MMF2's - * sake, so you need to have acces to - * that data. - */ - RD *rd; - /* rh - * This is a pointer to the RunHeader - * structure, which contains some - * application information. - */ - RunHeader *rh; - - /* Runtime - * This is EDIF's compendium of useful - * functions for every day life as an - * extension. You can trigger immediate - * events, read and write global data, - * etc. See the EDIF Help file for - * more information. - */ - Edif::Runtime Runtime; - - /* MinimumBuild - * Always set this to the latest build - * of MMF2 that has been released, unless - * you need to set it higher for a beta - * version of MMF2 to get access to some - * new SDK feature. - */ - static const int MinimumBuild = 255; - /* Version - * This is the version of your extension - * that is stored in the editdata. You should - * only change this when your editdata structure - * changes, not just when you have a new version - * of your extension with new features. - */ - static const int Version = 1; - - /* OEFLAGS, OEPREFS - * These are settings for your extension - * that tell MMF2 how to treat your extension - * and what behaviors and responsibilities - * to add. Check the MMF2SDK Help file for - * more detailed information on the flags you - * can set and what they implicate. - */ - static const int OEFLAGS = OEFLAG_VALUES|OEFLAG_RUNBEFOREFADEIN|OEFLAG_NEVERKILL; - static const int OEPREFS = 0; - - /* WindowProcPrioerity - * If your extension creates a Window - * and implements the WindowProc function, - * this is the priority for that stuff. - */ - static const int WindowProcPriority = 100; - - Extension(RD *rd, SerializedED *SED, createObjectInfo *COB); //defined & documented in Extension.cpp - ~Extension(); //defined & documented in Extension.cpp - - - /* Add any data you want to store in your - * extension to this class (eg. what you'd - * normally store in the rundata). Unlike - * other SDKs, you can store real C++ - * objects with constructors and destructors, - * without having to call them manually or - * store a pointer. - */ - - //stdtstring MyString; - //int MyInt; - //std::vector MyArray; - - - /* Add your actions, conditions and expressions - * as real class member functions here. The - * arguments (and return types for expressions/conditions) - * must match EXACTLY what you defined in the JSON. - * As a handy tip, all parameters will be either - * a pointer, an int, or a float (each only 4 bytes) - * and the same applies to return types. Remember to - * link the actions, conditions and expressions to their - * numeric IDs in the class constructor in Extension.cpp. - */ - - //Actions - void ActionExample(int ExampleParameter); - void SecondActionExample(); - - //Conditions - bool AreTwoNumbersEqual(int FirstNumber, int SecondNumber); - - //Expressions - int Add(int FirstNumber, int SecondNumber); - const char * HelloWorld(); - - - /* Action, Condition, Expression - * These are called if there's no function linked - * to an ID. You may want to put MessageBox calls - * to let you know that the ID is unlinked, or you - * may just want to use unlinked A/C/Es as a feature. - */ - - void Action(int ID, RD *rd, long param1, long param2); - long Condition(int ID, RD *rd, long param1, long param2); - long Expression(int ID, RD *rd, long param); - - - - - /* Handle, Display, Pause, Continue, Save, Load - * These replace the functions like HandleRunObject - * that used to be implemented in Runtime.cpp. They - * work exactly the same, but they're inside the - * extension class. - */ - short Handle(); - short Display(); - - short Pause(); - short Continue(); - - bool Save(HANDLE File); - bool Load(HANDLE File); - +/* Extension.h + * This is where you define your extension + * class. Runtime variables and function + * declarations go in here; A/C/E function + * definitions go in their respective .cpp + * files, other function definitions go in + * Extension.cpp. This header is included + * at the bottom of Common.h, so you have + * access to everything included by it. + */ + +class Extension +{ +public: + /* rd + * This is a pointer to the classic + * RunData structure. Some things still + * have to be stored there for MMF2's + * sake, so you need to have acces to + * that data. + */ + RD *rd; + /* rh + * This is a pointer to the RunHeader + * structure, which contains some + * application information. + */ + RunHeader *rh; + + /* Runtime + * This is EDIF's compendium of useful + * functions for every day life as an + * extension. You can trigger immediate + * events, read and write global data, + * etc. See the EDIF Help file for + * more information. + */ + Edif::Runtime Runtime; + + /* MinimumBuild + * Always set this to the latest build + * of MMF2 that has been released, unless + * you need to set it higher for a beta + * version of MMF2 to get access to some + * new SDK feature. + */ + static const int MinimumBuild = 255; + /* Version + * This is the version of your extension + * that is stored in the editdata. You should + * only change this when your editdata structure + * changes, not just when you have a new version + * of your extension with new features. + */ + static const int Version = 1; + + /* OEFLAGS, OEPREFS + * These are settings for your extension + * that tell MMF2 how to treat your extension + * and what behaviors and responsibilities + * to add. Check the MMF2SDK Help file for + * more detailed information on the flags you + * can set and what they implicate. + */ + static const int OEFLAGS = OEFLAG_VALUES|OEFLAG_RUNBEFOREFADEIN|OEFLAG_NEVERKILL; + static const int OEPREFS = 0; + + /* WindowProcPrioerity + * If your extension creates a Window + * and implements the WindowProc function, + * this is the priority for that stuff. + */ + static const int WindowProcPriority = 100; + + Extension(RD *rd, SerializedED *SED, createObjectInfo *COB); //defined & documented in Extension.cpp + ~Extension(); //defined & documented in Extension.cpp + + + /* Add any data you want to store in your + * extension to this class (eg. what you'd + * normally store in the rundata). Unlike + * other SDKs, you can store real C++ + * objects with constructors and destructors, + * without having to call them manually or + * store a pointer. + */ + + //stdtstring MyString; + //int MyInt; + //std::vector MyArray; + + + /* Add your actions, conditions and expressions + * as real class member functions here. The + * arguments (and return types for expressions/conditions) + * must match EXACTLY what you defined in the JSON. + * As a handy tip, all parameters will be either + * a pointer, an int, or a float (each only 4 bytes) + * and the same applies to return types. Remember to + * link the actions, conditions and expressions to their + * numeric IDs in the class constructor in Extension.cpp. + */ + + //Actions + void ActionExample(int ExampleParameter); + void SecondActionExample(); + + //Conditions + bool AreTwoNumbersEqual(int FirstNumber, int SecondNumber); + + //Expressions + int Add(int FirstNumber, int SecondNumber); + const char * HelloWorld(); + + + /* Action, Condition, Expression + * These are called if there's no function linked + * to an ID. You may want to put MessageBox calls + * to let you know that the ID is unlinked, or you + * may just want to use unlinked A/C/Es as a feature. + */ + + void Action(int ID, RD *rd, long param1, long param2); + long Condition(int ID, RD *rd, long param1, long param2); + long Expression(int ID, RD *rd, long param); + + + + + /* Handle, Display, Pause, Continue, Save, Load + * These replace the functions like HandleRunObject + * that used to be implemented in Runtime.cpp. They + * work exactly the same, but they're inside the + * extension class. + */ + short Handle(); + short Display(); + + short Pause(); + short Continue(); + + bool Save(HANDLE File); + bool Load(HANDLE File); + }; \ No newline at end of file diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index 8a000c8..814f349 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -1,1595 +1,1595 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 546deedd812117a7d21de92d7e4117b353f28b0c Mon Sep 17 00:00:00 2001 From: LB Date: Sat, 20 Oct 2012 22:57:15 -0500 Subject: [PATCH 005/127] Make EditData::Serialize unavailable for RUN_ONLY --- Extensions/Template/EditData.hpp | 310 ++++++++++++++++--------------- 1 file changed, 156 insertions(+), 154 deletions(-) diff --git a/Extensions/Template/EditData.hpp b/Extensions/Template/EditData.hpp index f2a2676..08997fd 100644 --- a/Extensions/Template/EditData.hpp +++ b/Extensions/Template/EditData.hpp @@ -1,154 +1,156 @@ -/* EditData.hpp - * This is where you control what data - * you want to have at edittime. You - * are responsible for serializing and - * deserializing (saving/loading) the - * data to/from the SerializedED structure - * as if it were a file on the hard drive. - * It doesn't need to be efficient; this - * is just at edittime and once at the - * start of the runtime. - */ - -struct EditData -{ - /* MyString, MyInt, MyArray_t, MyArray - * Example data - */ - //stdtstring MyString; - //int MyInt; - //typedef std::vector MyArray_t; - //MyArray_t MyArray; - - /* - * This is where you provide default values for - * your editdata. This constructor is used - * when your extension is first created and - * default values are needed. - */ - EditData() // : MyString("Hello, world!"), MyInt(1337) - { - //MyArray.push_back(3.1415926f); - } - - /* - * As a convenience in other parts of your code, - * you should copy data from another instance - * of the EditData class. Make sure you deep-copy - * dynamically allocated memory e.g. with pointers. - */ - EditData(const EditData &from) // : MyString(from.MyString), MyInt(from.MyInt), MyArray(from.MyArray) - { - // - } - - /* operator= - * This is essentially the same as the copy - * constructor above, except you are working - * with an instance that is already - * constructed. - */ - EditData &operator=(const EditData &from) - { - //MyString = from.MyString; - //MyInt = from.MyInt; - //MyArray = from.MyArray; - } - - /* Serialize - * This is where you need to "write" data - * to SerializedED like a file. Make sure - * you can read the data back in the - * constructor below! - */ - bool Serialize(mv *mV, SerializedED *&SED) const - { - //First, figure out how much space is needed - unsigned size = 0; - //size += (MyString.length()+1) * sizeof(stdtstring::value_type); - //size += sizeof(MyInt); - //size += sizeof(MyArray_t::size_type); - //size += MyArray.size() * sizeof(MyArray_t::value_type); - - //Then, ask MMF2 to provide this space for us in the SerializedED - { - SerializedED *t = (SerializedED *)mvReAllocEditData(mV, SED, sizeof(SerializedED)+size); - if(t) //if it worked - { - SED = t; - //Since SED is a pointer passed by reference, - //it will update outside this function so that - //the calling code keeps a valid pointer to - //the SerializedED. - } - else return false; //could not allocate space - } - - //Now, the crazy-looking part: serialize the data - char *p = (char *)(&SED->data); //put the pointer at the beginning of the space MMF2 gave us - //Perform the copy: Advance the pointer: - //_tcscpy(p, MyString.c_str()); p += (MyString.length()+1) * sizeof(stdtstring::value_type); - //memcpy(p, &MyInt, sizeof(MyInt)); p += sizeof(MyInt); - //MyArray_t::size_type MyArray_size = MyArray.size(); - //memcpy(p, &MyArray_size, sizeof(MyArray_size)); p += sizeof(MyArray_size); - //for(MyArray_t::size_type i = 0; i < MyArray_size; ++i) - //{ - //memcpy(p, &MyArray[i], sizeof(MyArray_t::value_type)); p += sizeof(MyArray_t::value_type); - //} - //If you get tired of retyping the size stuff from above, you can always store - //the sizes in variables or make macros for them. - - //Done! - return true; //return false in the event of an error - } - - /* - * This is the primary constructor for the - * EditData class. Here you will have to - * "read" SerializedED like a file and - * load back everything that gets saved - * above in Serialize. Make sure you check - * the version information first, this - * constructor is used to update from - * older versions of your editdata as well. - */ - EditData(SerializedED *SED) - { - if(SED->Header.extVersion == 0) - { - //code to update from an older version - } - else if(SED->Header.extVersion == 1) - { - //We have to do some crazy stuff again! - char *p = (char *)(&SED->data); - //Load the data: Advance the pointer: - //MyString = p; /*std::string is smart enough for this*/ p += (MyString.length()+1) * sizeof(stdtstring::value_type); - //MyInt = *(int *)p; p += sizeof(MyInt); - //MyArray_t::size_type MyArray_size = *(MyArray_t::size_type *)p; p += sizeof(MyArray_size); - //for(MyArray_t::size_type i = 0; i < MyArray_size; ++i) - //{ - //MyArray.push_back(*(MyArray_t::value_type *)p); p += sizeof(MyArray_t::value_type); - //} - } - else //the version is newer than current - { - //Either try to load the data anyway assuming your - //future self was smart enough to keep the data in - //the same format with new data at the end, or - //make an error dialog and load some default data. - //MessageBox(NULL, _T("The MFA you are trying to load was saved" - // "with a newer version of this extension."), - // _T("Error Loading My Extension"), MB_OK); - } - } - - /* - * If you grabbed any memory e.g. with new, - * make sure to e.g. delete it in here. - */ - ~EditData() - { - // - } -}; +/* EditData.hpp + * This is where you control what data + * you want to have at edittime. You + * are responsible for serializing and + * deserializing (saving/loading) the + * data to/from the SerializedED structure + * as if it were a file on the hard drive. + * It doesn't need to be efficient; this + * is just at edittime and once at the + * start of the runtime. + */ + +struct EditData +{ + /* MyString, MyInt, MyArray_t, MyArray + * Example data + */ + //stdtstring MyString; + //int MyInt; + //typedef std::vector MyArray_t; + //MyArray_t MyArray; + + /* + * This is where you provide default values for + * your editdata. This constructor is used + * when your extension is first created and + * default values are needed. + */ + EditData() // : MyString("Hello, world!"), MyInt(1337) + { + //MyArray.push_back(3.1415926f); + } + + /* + * As a convenience in other parts of your code, + * you should copy data from another instance + * of the EditData class. Make sure you deep-copy + * dynamically allocated memory e.g. with pointers. + */ + EditData(const EditData &from) // : MyString(from.MyString), MyInt(from.MyInt), MyArray(from.MyArray) + { + // + } + + /* operator= + * This is essentially the same as the copy + * constructor above, except you are working + * with an instance that is already + * constructed. + */ + EditData &operator=(const EditData &from) + { + //MyString = from.MyString; + //MyInt = from.MyInt; + //MyArray = from.MyArray; + } + +#ifndef RUN_ONLY + /* Serialize + * This is where you need to "write" data + * to SerializedED like a file. Make sure + * you can read the data back in the + * constructor below! + */ + bool Serialize(mv *mV, SerializedED *&SED) const + { + //First, figure out how much space is needed + unsigned size = 0; + //size += (MyString.length()+1) * sizeof(stdtstring::value_type); + //size += sizeof(MyInt); + //size += sizeof(MyArray_t::size_type); + //size += MyArray.size() * sizeof(MyArray_t::value_type); + + //Then, ask MMF2 to provide this space for us in the SerializedED + { + SerializedED *t = (SerializedED *)mvReAllocEditData(mV, SED, sizeof(SerializedED)+size); + if(t) //if it worked + { + SED = t; + //Since SED is a pointer passed by reference, + //it will update outside this function so that + //the calling code keeps a valid pointer to + //the SerializedED. + } + else return false; //could not allocate space + } + + //Now, the crazy-looking part: serialize the data + char *p = (char *)(&SED->data); //put the pointer at the beginning of the space MMF2 gave us + //Perform the copy: Advance the pointer: + //_tcscpy(p, MyString.c_str()); p += (MyString.length()+1) * sizeof(stdtstring::value_type); + //memcpy(p, &MyInt, sizeof(MyInt)); p += sizeof(MyInt); + //MyArray_t::size_type MyArray_size = MyArray.size(); + //memcpy(p, &MyArray_size, sizeof(MyArray_size)); p += sizeof(MyArray_size); + //for(MyArray_t::size_type i = 0; i < MyArray_size; ++i) + //{ + //memcpy(p, &MyArray[i], sizeof(MyArray_t::value_type)); p += sizeof(MyArray_t::value_type); + //} + //If you get tired of retyping the size stuff from above, you can always store + //the sizes in variables or make macros for them. + + //Done! + return true; //return false in the event of an error + } +#endif + + /* + * This is the primary constructor for the + * EditData class. Here you will have to + * "read" SerializedED like a file and + * load back everything that gets saved + * above in Serialize. Make sure you check + * the version information first, this + * constructor is used to update from + * older versions of your editdata as well. + */ + EditData(SerializedED *SED) + { + if(SED->Header.extVersion == 0) + { + //code to update from an older version + } + else if(SED->Header.extVersion == 1) + { + //We have to do some crazy stuff again! + char *p = (char *)(&SED->data); + //Load the data: Advance the pointer: + //MyString = p; /*std::string is smart enough for this*/ p += (MyString.length()+1) * sizeof(stdtstring::value_type); + //MyInt = *(int *)p; p += sizeof(MyInt); + //MyArray_t::size_type MyArray_size = *(MyArray_t::size_type *)p; p += sizeof(MyArray_size); + //for(MyArray_t::size_type i = 0; i < MyArray_size; ++i) + //{ + //MyArray.push_back(*(MyArray_t::value_type *)p); p += sizeof(MyArray_t::value_type); + //} + } + else //the version is newer than current + { + //Either try to load the data anyway assuming your + //future self was smart enough to keep the data in + //the same format with new data at the end, or + //make an error dialog and load some default data. + //MessageBox(NULL, _T("The MFA you are trying to load was saved" + // "with a newer version of this extension."), + // _T("Error Loading My Extension"), MB_OK); + } + } + + /* + * If you grabbed any memory e.g. with new, + * make sure to e.g. delete it in here. + */ + ~EditData() + { + // + } +}; From ca940e0e24c50c40356271f12246aff3307504e6 Mon Sep 17 00:00:00 2001 From: LB Date: Sat, 20 Oct 2012 23:24:40 -0500 Subject: [PATCH 006/127] Changed README to GitHub Flavored MarkDown --- README | 5 ----- README.md | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/README b/README deleted file mode 100644 index f86854e..0000000 --- a/README +++ /dev/null @@ -1,5 +0,0 @@ -Edif is an alternate extension development SDK for Multimedia Fusion 2, in which your extension -is a true C++ class, with a JSON file (optionally external) to describe it. - -TODO: Insert some helpful information here? -TODO: Create EDIF Help file... \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a6ac2bc --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Edif is an alternate extension development SDK for Multimedia Fusion 2, in which your extension is a true C++ class, with a JSON file (optionally external) to describe it. We recommend that you [check out the wiki](./wiki/). If you're new to EDIF, read the [Getting Started](./wiki/Getting-Started) page. From e3e00ce2361b7b90e2d100fb4e0cfbc8ed933b0c Mon Sep 17 00:00:00 2001 From: LB Date: Sat, 20 Oct 2012 23:27:37 -0500 Subject: [PATCH 007/127] Add title --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a6ac2bc..cb7838e 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ +# Extension Development Is Fun Edif is an alternate extension development SDK for Multimedia Fusion 2, in which your extension is a true C++ class, with a JSON file (optionally external) to describe it. We recommend that you [check out the wiki](./wiki/). If you're new to EDIF, read the [Getting Started](./wiki/Getting-Started) page. From a6bbccee49a9cb0f8e569f5e0e2bfb957a33e993 Mon Sep 17 00:00:00 2001 From: LB Date: Sat, 20 Oct 2012 23:33:19 -0500 Subject: [PATCH 008/127] Fix broken links --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cb7838e..ef75979 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Extension Development Is Fun -Edif is an alternate extension development SDK for Multimedia Fusion 2, in which your extension is a true C++ class, with a JSON file (optionally external) to describe it. We recommend that you [check out the wiki](./wiki/). If you're new to EDIF, read the [Getting Started](./wiki/Getting-Started) page. +Edif is an alternate extension development SDK for Multimedia Fusion 2, in which your extension is a true C++ class, with a JSON file (optionally external) to describe it. We recommend that you [check out the wiki](wiki/). If you're new to EDIF, read the [Getting Started](wiki/Getting-started) page. From 7f188732681751c93acb8bf2d5ddd06a0efa8dc0 Mon Sep 17 00:00:00 2001 From: LB Date: Sat, 20 Oct 2012 23:36:59 -0500 Subject: [PATCH 009/127] "works-for-now" fix broken links --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ef75979..722312f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Extension Development Is Fun -Edif is an alternate extension development SDK for Multimedia Fusion 2, in which your extension is a true C++ class, with a JSON file (optionally external) to describe it. We recommend that you [check out the wiki](wiki/). If you're new to EDIF, read the [Getting Started](wiki/Getting-started) page. +Edif is an alternate extension development SDK for Multimedia Fusion 2, in which your extension is a true C++ class, with a JSON file (optionally external) to describe it. We recommend that you [check out the wiki](./windows-edif/wiki/). If you're new to EDIF, read the [Getting Started](./windows-edif/wiki/Getting-started) page. From 284ea0ba41203fd29e1c02ef09d6f21120f28a41 Mon Sep 17 00:00:00 2001 From: LB Date: Sun, 21 Oct 2012 00:47:23 -0500 Subject: [PATCH 010/127] Miscellaneous fixes --- Extensions/Template/Actions.cpp | 34 +- Extensions/Template/Conditions.cpp | 28 +- Extensions/Template/Expressions.cpp | 40 +- Extensions/Template/Extension.cpp | 362 +- Extensions/Template/Extension.hpp | 60 +- Inc/Cncf.h | 7858 +++++++++++++-------------- Inc/cncr.h | 1228 ++--- Lib/Edif.cpp | 1726 +++--- 8 files changed, 5641 insertions(+), 5695 deletions(-) diff --git a/Extensions/Template/Actions.cpp b/Extensions/Template/Actions.cpp index ed6d6db..4e38040 100644 --- a/Extensions/Template/Actions.cpp +++ b/Extensions/Template/Actions.cpp @@ -1,17 +1,17 @@ -/* Actions.cpp - * This is where you should define the - * behavior of your conditions. Make sure - * the parameters match those in the JSON - * exactly! Double check Extension.h - * as well. - */ - -#include "Common.h" - -void Extension::ActionExample(int ExampleParameter) -{ -} - -void Extension::SecondActionExample() -{ -} +/* Actions.cpp + * This is where you should define the + * behavior of your actions. Make sure + * the parameters match those in the JSON + * exactly! Double check Extension.h + * as well. + */ + +#include "Common.h" + +void Extension::ActionExample(int ExampleParameter) +{ +} + +void Extension::SecondActionExample() +{ +} diff --git a/Extensions/Template/Conditions.cpp b/Extensions/Template/Conditions.cpp index 6ae7fa5..41b2b7b 100644 --- a/Extensions/Template/Conditions.cpp +++ b/Extensions/Template/Conditions.cpp @@ -1,14 +1,14 @@ -/* Conditions.cpp - * This is where you should define the - * behavior of your conditions. Make sure - * the parameters and return types match those - * in the JSON exactly! Double check Extension.h - * as well. - */ - -#include "Common.h" - -bool Extension::AreTwoNumbersEqual(int First, int Second) -{ - return First == Second; -} +/* Conditions.cpp + * This is where you should define the + * behavior of your conditions. Make sure + * the parameters and return types match those + * in the JSON exactly! Double check Extension.h + * as well. + */ + +#include "Common.h" + +bool Extension::AreTwoNumbersEqual(int First, int Second) +{ + return First == Second; +} diff --git a/Extensions/Template/Expressions.cpp b/Extensions/Template/Expressions.cpp index fe1d1eb..65a6afa 100644 --- a/Extensions/Template/Expressions.cpp +++ b/Extensions/Template/Expressions.cpp @@ -1,20 +1,20 @@ -/* Conditions.cpp - * This is where you should define the - * behavior of your conditions. Make sure - * the parameters and return types match those - * in the JSON exactly! Double check Extension.h - * as well. - */ - -#include "Common.h" - -int Extension::Add(int First, int Second) -{ - return First + Second; -} - -const TCHAR *Extension::HelloWorld() -{ - return _T("Hello world!"); - //return Runtime.CopyString(MyString.c_str()); //for stdtstrings -} +/* Expressions.cpp + * This is where you should define the + * behavior of your expressions. Make sure + * the parameters and return types match those + * in the JSON exactly! Double check Extension.h + * as well. + */ + +#include "Common.h" + +int Extension::Add(int First, int Second) +{ + return First + Second; +} + +const TCHAR *Extension::HelloWorld() +{ + return _T("Hello world!"); + //return Runtime.CopyString(MyString.c_str()); //for stdtstrings +} diff --git a/Extensions/Template/Extension.cpp b/Extensions/Template/Extension.cpp index 3ae9795..46e7f56 100644 --- a/Extensions/Template/Extension.cpp +++ b/Extensions/Template/Extension.cpp @@ -1,172 +1,190 @@ - -#include "Common.h" - -/* - * This is your extension's constructor, which - * is the replacement for the old CreateRunObject - * function. You don't need to manually call - * constructors or pointlessly initialize - * pointers with dynamic memory. Just link - * your A/C/Es, perform initialization steps, and - * you're good to go. - */ -Extension::Extension(RD *rd, SerializedED *SED, createObjectInfo *COB) : rd(rd), rh(rd->rHo.hoAdRunHeader), Runtime(rd) -{ - //Link all your action/condition/expression functions - //to their IDs to match the IDs in the JSON here. - LinkAction(0, ActionExample); - LinkAction(1, SecondActionExample); - - LinkCondition(0, AreTwoNumbersEqual); - - LinkExpression(0, Add); - LinkExpression(1, HelloWorld); - - - //This is where you'd do anything you'd do in CreateRunObject in the original SDK. - //It's the only place you'll get access to the editdata at runtime, so you should - //transfer anything from the editdata to the extension class here. For example: -// EditData ed (SED); -// MyString = ed.MyString; -// MyInt = ed.MyInt; -// MyArray = ed.MyArray; - - // -} - -/* - * This is your extension's destructor, the - * replacement for DestroyRunObject. No calling - * destructors manually or deallocating pointless - * dynamic memory - in most cases this function - * won't need any code written. - */ -Extension::~Extension() -{ - // -} - -/* Handle - * MMF2 calls this function to let your extension - * "live" - if you want, you can have MMF2 call this - * every frame. This is where you'd, for instance, - * simulate physics or move an object. This is - * the analagous function to the old HandleRunObject. - */ -short Extension::Handle() -{ - /* - If your extension will draw to the MMF window you should first - check if anything about its display has changed : - - if (rd->roc.rcChanged) return REFLAG_DISPLAY; - else return 0; - - You will also need to make sure you change this flag yourself - to 1 whenever you want to redraw your object - - If your extension won't draw to the window, but it still needs - to do something every MMF2 loop use: - - return 0; - - If you don't need to do something every loop, use : - - return REFLAG_ONESHOT; - - This doesn't mean this function can never run again. If you want MMF2 - to handle your object again (causing this code to run) use this function: - - Runtime.Rehandle(); - - At the end of the event loop this code will run. - - */ - - // Will not be called next loop - return REFLAG_ONESHOT; -} - -/* Display - * This is the analagous function to - * DisplayRunObject. If you return - * REFLAG_DISPLAY in Handle() this - * routine will run. If you want MMF2 - * to apply ink effects for you, then - * implement GetRunObjectSurface in - * Runtime.cpp instead. - */ -short Extension::Display() -{ - return 0; -} - -/* Pause - * If your extension plays sound, for - * example, then MMF2 calls this to - * let you know to pause the music, - * usually by another extension's request - * or by the player pausing the applcation. - */ -short Extension::Pause() -{ - return 0; -} - -/* Continue - * Opposite to the above, MMF2 lets - * you know that the silence is over; - * your extension may live again. - */ -short Extension::Continue() -{ - return 0; -} - -/* Save - * When the user uses the Save - * Frame Position action, you need - * so serialize your runtime data to - * the File given. It is a Windows - * file handle, but you can use some - * of MMF2's built-in functions for - * writing files. Check the MMF2SDK - * Help file for more information. - */ -bool Extension::Save(HANDLE File) -{ - return true; -} - -/* Load - * As opposed to above, here you need to - * restore your extension's runtime state - * from the given file. Only read what you - * wrote! - */ -bool Extension::Load(HANDLE File) -{ - return true; -} - - -/* Action, Condition, Expression - * These are called if there's no function linked - * to an ID. You may want to put MessageBox calls - * to let you know that the ID is unlinked, or you - * may just want to use unlinked A/C/Es as a feature. - */ -void Extension::Action(int ID, RD *rd, long param1, long param2) -{ -} - -long Extension::Condition(int ID, RD *rd, long param1, long param2) -{ - return false; //hopefully StringComparison (PARAM_CMPSTRING) is not used, or this may crash -} - -long Extension::Expression(int ID, RD *rd, long param) -{ - return long(""); //so that unlinked expressions that return strings won't crash -} - +/* Extension.cpp + * This file contains the definitions for + * your extension's general runtime functions, + * such as the constructor and destructor, + * handling routines, etc. + * Functions defined here: + * Extension::Extension + * Extension::~Extension + * Extension::Handle + * Extension::Display + * Extension::Pause + * Extension::Continue + * Extension::Save + * Extension::Load + * Extension::Action <--| + * Extension::Condition <--|- not what you think! + * Extension::Expression <--| + */ + +#include "Common.h" + +/* + * This is your extension's constructor, which + * is the replacement for the old CreateRunObject + * function. You don't need to manually call + * constructors or pointlessly initialize + * pointers with dynamic memory. Just link + * your A/C/Es, perform initialization steps, and + * you're good to go. + */ +Extension::Extension(RD *rd, SerializedED *SED, createObjectInfo *COB) : rd(rd), rh(rd->rHo.hoAdRunHeader), Runtime(rd) +{ + //Link all your action/condition/expression functions + //to their IDs to match the IDs in the JSON here. + LinkAction(0, ActionExample); + LinkAction(1, SecondActionExample); + + LinkCondition(0, AreTwoNumbersEqual); + + LinkExpression(0, Add); + LinkExpression(1, HelloWorld); + + + //This is where you'd do anything you'd do in CreateRunObject in the original SDK. + //It's the only place you'll get access to the editdata at runtime, so you should + //transfer anything from the editdata to the extension class here. For example: +// EditData ed (SED); +// MyString = ed.MyString; +// MyInt = ed.MyInt; +// MyArray = ed.MyArray; + + // +} + +/* + * This is your extension's destructor, the + * replacement for DestroyRunObject. No calling + * destructors manually or deallocating pointless + * dynamic memory - in most cases this function + * won't need any code written. + */ +Extension::~Extension() +{ + // +} + +/* Handle + * MMF2 calls this function to let your extension + * "live" - if you want, you can have MMF2 call this + * every frame. This is where you'd, for instance, + * simulate physics or move an object. This is + * the analagous function to the old HandleRunObject. + */ +short Extension::Handle() +{ + /* + If your extension will draw to the MMF window you should first + check if anything about its display has changed : + + if (rd->roc.rcChanged) return REFLAG_DISPLAY; + else return 0; + + You will also need to make sure you change this flag yourself + to 1 whenever you want to redraw your object + + If your extension won't draw to the window, but it still needs + to do something every MMF2 loop use: + + return 0; + + If you don't need to do something every loop, use : + + return REFLAG_ONESHOT; + + This doesn't mean this function can never run again. If you want MMF2 + to handle your object again (causing this code to run) use this function: + + Runtime.Rehandle(); + + At the end of the event loop this code will run. + + */ + + //Will not be called next loop + return REFLAG_ONESHOT; +} + +/* Display + * This is the analagous function to + * DisplayRunObject. If you return + * REFLAG_DISPLAY in Handle() this + * routine will run. If you want MMF2 + * to apply ink effects for you, then + * implement GetRunObjectSurface in + * Runtime.cpp instead. + */ +short Extension::Display() +{ + return 0; +} + +/* Pause + * If your extension plays sound, for + * example, then MMF2 calls this to + * let you know to pause the music, + * usually by another extension's request + * or by the player pausing the applcation. + */ +short Extension::Pause() +{ + return 0; +} + +/* Continue + * Opposite to the above, MMF2 lets + * you know that the silence is over; + * your extension may live again. + */ +short Extension::Continue() +{ + return 0; +} + +/* Save + * When the user uses the Save + * Frame Position action, you need + * so serialize your runtime data to + * the File given. It is a Windows + * file handle, but you can use some + * of MMF2's built-in functions for + * writing files. Check the MMF2SDK + * Help file for more information. + */ +bool Extension::Save(HANDLE File) +{ + return true; +} + +/* Load + * As opposed to above, here you need to + * restore your extension's runtime state + * from the given file. Only read what you + * wrote! + */ +bool Extension::Load(HANDLE File) +{ + return true; +} + + +/* Action, Condition, Expression + * These are called if there's no function linked + * to an ID. You may want to put MessageBox calls + * to let you know that the ID is unlinked, or you + * may just want to use unlinked A/C/Es as a feature. + */ +void Extension::Action(int ID, RD *rd, long param1, long param2) +{ +} + +long Extension::Condition(int ID, RD *rd, long param1, long param2) +{ + return false; //hopefully StringComparison (PARAM_CMPSTRING) is not used, or this may crash +} + +long Extension::Expression(int ID, RD *rd, long param) +{ + return long(""); //so that unlinked expressions that return strings won't crash +} + diff --git a/Extensions/Template/Extension.hpp b/Extensions/Template/Extension.hpp index 12bebdb..46be460 100644 --- a/Extensions/Template/Extension.hpp +++ b/Extensions/Template/Extension.hpp @@ -17,9 +17,12 @@ class Extension * RunData structure. Some things still * have to be stored there for MMF2's * sake, so you need to have acces to - * that data. + * that data. You should not modify + * the rundata structure, however, + * as it is global to all extensions. */ RD *rd; + /* rh * This is a pointer to the RunHeader * structure, which contains some @@ -32,8 +35,8 @@ class Extension * functions for every day life as an * extension. You can trigger immediate * events, read and write global data, - * etc. See the EDIF Help file for - * more information. + * etc. See the EDIF wiki for more + * information. */ Edif::Runtime Runtime; @@ -45,6 +48,7 @@ class Extension * new SDK feature. */ static const int MinimumBuild = 255; + /* Version * This is the version of your extension * that is stored in the editdata. You should @@ -65,7 +69,7 @@ class Extension static const int OEFLAGS = OEFLAG_VALUES|OEFLAG_RUNBEFOREFADEIN|OEFLAG_NEVERKILL; static const int OEPREFS = 0; - /* WindowProcPrioerity + /* WindowProcPriority * If your extension creates a Window * and implements the WindowProc function, * this is the priority for that stuff. @@ -90,9 +94,9 @@ class Extension //std::vector MyArray; - /* Add your actions, conditions and expressions - * as real class member functions here. The - * arguments (and return types for expressions/conditions) + /* Add your actions, conditions, and expressions + * as real class member functions here. The arguments + * (and return types for expressions/conditions) * must match EXACTLY what you defined in the JSON. * As a handy tip, all parameters will be either * a pointer, an int, or a float (each only 4 bytes) @@ -101,45 +105,29 @@ class Extension * numeric IDs in the class constructor in Extension.cpp. */ - //Actions + //Actions - Defined in Actions.cpp void ActionExample(int ExampleParameter); void SecondActionExample(); - //Conditions + //Conditions - Defined in Conditions.cpp bool AreTwoNumbersEqual(int FirstNumber, int SecondNumber); - //Expressions + //Expressions - Defined in Expressions.cpp int Add(int FirstNumber, int SecondNumber); const char * HelloWorld(); - /* Action, Condition, Expression - * These are called if there's no function linked - * to an ID. You may want to put MessageBox calls - * to let you know that the ID is unlinked, or you - * may just want to use unlinked A/C/Es as a feature. - */ + short Handle(); //defined & documented in Extension.cpp + short Display(); //defined & documented in Extension.cpp + + short Pause(); //defined & documented in Extension.cpp + short Continue(); //defined & documented in Extension.cpp + bool Save(HANDLE File); //defined & documented in Extension.cpp + bool Load(HANDLE File); //defined & documented in Extension.cpp + + //defined & documented in Extension.cpp void Action(int ID, RD *rd, long param1, long param2); long Condition(int ID, RD *rd, long param1, long param2); long Expression(int ID, RD *rd, long param); - - - - - /* Handle, Display, Pause, Continue, Save, Load - * These replace the functions like HandleRunObject - * that used to be implemented in Runtime.cpp. They - * work exactly the same, but they're inside the - * extension class. - */ - short Handle(); - short Display(); - - short Pause(); - short Continue(); - - bool Save(HANDLE File); - bool Load(HANDLE File); - -}; \ No newline at end of file +}; diff --git a/Inc/Cncf.h b/Inc/Cncf.h index d11a734..78c345a 100644 --- a/Inc/Cncf.h +++ b/Inc/Cncf.h @@ -1,3929 +1,3929 @@ - -#ifndef _CNCF_H_ -#define _CNCF_H_ - -#include "cncy.h" -#ifdef STAND_ALONE -#include "CValue.h" -#else - -// Definitions for extensions -#define TYPE_LONG 0x0000 -#define TYPE_INT TYPE_LONG -#define TYPE_STRING 0x0001 -#define TYPE_FLOAT 0x0002 // Pour les extensions -#define TYPE_DOUBLE 0x0002 - -#ifdef __cplusplus -class CValue { -public: -#else -typedef struct CValue { -#endif - UINT m_type; - UINT m_paddle; - union - { - long m_long; - double m_double; - LPTSTR m_pString; - }; -#ifdef __cplusplus -}; -#else -} CValue; -#endif -#endif // STAND_ALONE - -// Changes the structure alignment -#ifndef _H2INC -#pragma pack( push, _pack_cncf_ ) -#pragma pack(2) -#endif -typedef short * LPSHORT; - -#ifdef __cplusplus -class headerObject; -class kpj; -class objInfoList; -class drawRoutine; -class LO; -class pev; -class qualToOi; -class CRunApp; -class CRunFrame; -class CRunMvt; -class CMvt; -class CDemoRecord; -class CIPhoneJoystick; -class CIPhoneAd; - -//class CValue; -#else -#define headerObject VOID -#define kpj VOID -#define objInfoList VOID -#define drawRoutine VOID -#define LO VOID -#define pev VOID -#define qualToOi VOID -//#define CValue VOID -#define CRunApp void -#define CRunFrame void -#define CRunMvt void -#define CMvt void -#define CDemoRecord void -#define CIPhoneJoystick void -#define CIPhoneAd void -#endif - -// Number of values -#define VALUES_NUMBEROF_ALTERABLE 26 -#define VALUES_NUMBEROF_MAX 26 -#define STRINGS_NUMBEROF_ALTERABLE 10 -#define STRINGS_NUMBEROF_MAX 10 - -typedef short ITEMTYPE; -typedef short OINUM; -typedef short HFII; - -// LOGFONT 16 structure for compatibility with old extensions -///////////////////////////////////////////////////////////// -typedef struct tagLOGFONTV1A { - short lfHeight; - short lfWidth; - short lfEscapement; - short lfOrientation; - short lfWeight; - BYTE lfItalic; - BYTE lfUnderline; - BYTE lfStrikeOut; - BYTE lfCharSet; - BYTE lfOutPrecision; - BYTE lfClipPrecision; - BYTE lfQuality; - BYTE lfPitchAndFamily; - char lfFaceName[LF_FACESIZE]; -} LOGFONTV1A; -typedef struct tagLOGFONTV1W { - short lfHeight; - short lfWidth; - short lfEscapement; - short lfOrientation; - short lfWeight; - BYTE lfItalic; - BYTE lfUnderline; - BYTE lfStrikeOut; - BYTE lfCharSet; - BYTE lfOutPrecision; - BYTE lfClipPrecision; - BYTE lfQuality; - BYTE lfPitchAndFamily; - WCHAR lfFaceName[LF_FACESIZE]; -} LOGFONTV1W; -#ifdef _UNICODE -#define LOGFONTV1 LOGFONTV1W -#else -#define LOGFONTV1 LOGFONTV1A -#endif - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -// -// ObjectsCommon - Dynamic items -// -#define OC_MAX_QUALIFIERS 8 - -#ifdef __cplusplus -class OC { -public: -#else -typedef struct OC { -#endif - - DWORD ocDWSize; // Total size of the structures - - WORD ocMovements; // Offset of the movements - WORD ocAnimations; // Offset of the animations - WORD ocVersion; // For version versions > MOULI - WORD ocCounter; // Pointer to COUNTER structure - WORD ocData; // Pointer to DATA structure - WORD ocFree; - DWORD ocOEFlags; // New flags - - WORD ocQualifiers[OC_MAX_QUALIFIERS]; // Qualifier list - WORD ocExtension; // Extension structure - WORD ocValues; // Values structure - WORD ocStrings; // String structure - - WORD ocFlags2; // New news flags, before was ocEvents - WORD ocOEPrefs; // Automatically modifiable flags - DWORD ocIdentifier; // Identifier d'objet - - COLORREF ocBackColor; // Background color - DWORD ocFadeIn; // Offset fade in - DWORD ocFadeOut; // Offset fade out - DWORD ocValueNames; // For the debugger - DWORD ocStringNames; - -#ifdef __cplusplus -}; -#else -} OC; -#endif -typedef OC * LPOC; -typedef OC * fpoc; - -typedef struct -{ - WORD number; - long values[1]; -} OCValues; -typedef OCValues* LPOCVALUES; - -#ifdef _UNICODE -typedef struct -{ - WORD number; - TCHAR str[1]; -} OCStringsW; -typedef OCStringsW* LPOCSTRINGS; -#else -typedef struct -{ - WORD number; - char str[2]; -} OCStringsA; -typedef OCStringsA* LPOCSTRINGS; -#endif - - - -typedef struct -{ - WORD number; - char str[2]; - -} OCValueNames; -typedef OCValueNames* LPOCVALUENAMES; - -#define OCFLAGS2_DONTSAVEBKD 0x0001 -#define OCFLAGS2_SOLIDBKD 0x0002 -#define OCFLAGS2_COLBOX 0x0004 -#define OCFLAGS2_VISIBLEATSTART 0x0008 -#define OCFLAGS2_OBSTACLESHIFT 4 -#define OCFLAGS2_OBSTACLEMASK 0x0030 -#define OCFLAGS2_OBSTACLE_SOLID 0x0010 -#define OCFLAGS2_OBSTACLE_PLATFORM 0x0020 -#define OCFLAGS2_OBSTACLE_LADDER 0x0030 -#define OCFLAGS2_AUTOMATICROTATION 0x0040 - -////////////////////////////////////////////////////////////////////////////// -// -// Counter -// -typedef struct tagCT { - WORD ctSize; - long ctInit; // Initial value - long ctMini; // Minimal value - long ctMaxi; // Maximal value -} counter; -typedef counter * fpct; -typedef counter * fpCounter; - -////////////////////////////////////////////////////////////////////////////// -// -// Animations -// -#define ANIMID_MIN 16 - -// Anim header -#ifdef __cplusplus -class AnimHeader { -public: -#else -typedef struct AnimHeader { -#endif - WORD ahSize; - WORD ahAnimMax; // New V2, number of entries in offset table - short ahOffsetToAnim[ANIMID_MIN]; // Minimum 16 animations, can be larger! -#ifdef __cplusplus -}; -#else -} AnimHeader; -#endif -typedef AnimHeader * fpAnimHeader; -typedef AnimHeader * fpah; -typedef AnimHeader * LPAH; - -#ifndef DIRID_MAX -#define DIRID_MAX 32 -#endif - -// Anim structure -typedef struct Anim { - short anOffsetToDir[DIRID_MAX]; // Offset to animations with a direction -} Anim; -typedef Anim * fpAnim; -typedef Anim * fpan; -typedef Anim * LPAN; - -// AnimDirection structure -typedef struct AnimDirection { - BYTE adMinSpeed; // Minimum speed - BYTE adMaxSpeed; // Maximum speed - short adRepeat; // Number of loops - short adRepeatFrame; // Where to loop - short adNumberOfFrame; // Number of frames - short adFrame[1]; // Frames -} AnimDirection; -#define sizeof_AnimDirection (sizeof(AnimDirection)-2) -typedef AnimDirection * fpAnimDir; -typedef AnimDirection * fpad; -typedef AnimDirection * LPAD; - -// Chunks de sauvegarde -#define EVTFILECHUNK_HEAD B2L('E','R','>','>') -#define EVTFILECHUNK_EVTHEAD B2L('E','R','e','s') -#define EVTFILECHUNK_EVENTS B2L('E','R','e','v') -#define EVTFILECHUNK_NEWITEMS B2L('>','N','I','<') -#define EVTFILECHUNK_END B2L('<','<','E','R') - -// Marquage des OI qualifiers -#define OIFLAG_QUALIFIER 0x8000 -#define NDEF_QUALIFIERS 100 -#define MAX_EVENTPROGRAMS 256 - -#define GAMEON_EMPTY 0 -#define GAMEON_UNLOADED 1 -#define GAMEON_TIME0 2 -#define GAMEON_PAUSED 3 -#define GAMEON_RUNNING 4 -#define GAMEON_STEPPING 5 - -// COMMUNICATION STRUCTURE BETWEEN RUNTIME AND EDITOR -typedef struct -{ - DWORD command; - - WORD runMode; - DWORD timer; - - WORD code; - OINUM oi; - DWORD param[2]; - char path[_MAX_PATH]; - -} ComStructure; -enum -{ - RUNCOMMAND_INITCOM=1, - RUNCOMMAND_NEWEVENT, - RUNCOMMAND_NEWSOUND, - RUNCOMMAND_NEWOBJECT, - RUNCOMMAND_NEWEVENTS, - RUNCOMMAND_SETRUNMODE, - RUNCOMMAND_CONTINUE, - RUNCOMMAND_RESTART, - RUNCOMMAND_QUIT, - HANDLEMESSAGE_WAITFORCONFIRM, - HANDLEMESSAGE_WAITFORCOMMAND, - HANDLEMESSAGE_OK, - HANDLEMESSAGE_QUIT, - HANDLEMESSAGE_TIMEOUT -}; -// DIFFERENTS MODES OF RUN -enum -{ - RUNMODE_NONE, - RUNMODE_STOPPED, - RUNMODE_RUNNING, - RUNMODE_PLAYING, - RUNMODE_STEPPING, - RUNMODE_PAUSED, - RUNMODE_WAITING, - RUNMODE_WAITINGQUIT, -}; - - -// ------------------------------------------------------------------------- -// MOVEMENT DEFINITIONS -// ------------------------------------------------------------------------- - -// Definition of animation codes -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define ANIMID_STOP 0 -#define ANIMID_WALK 1 -#define ANIMID_RUN 2 -#define ANIMID_APPEAR 3 -#define ANIMID_DISAPPEAR 4 -#define ANIMID_BOUNCE 5 -#define ANIMID_SHOOT 6 -#define ANIMID_JUMP 7 -#define ANIMID_FALL 8 -#define ANIMID_CLIMB 9 -#define ANIMID_CROUCH 10 -#define ANIMID_UNCROUCH 11 -#define ANIMID_USER1 12 -//#define ANIMID_MAX 16 -#define ANIMNAME_MAXCHAR 64 - -// Definition of direction codes -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define DIRF_ALL 0xFFFFFFFF -#define DIRID_STATIC 32 -#define DIRID_MAX 32 -#define DIRID_SEE 30 -#define DIRID_SE 28 -#define DIRID_SSE 26 -#define DIRID_S 24 -#define DIRID_SSW 22 -#define DIRID_SW 20 -#define DIRID_SWW 18 -#define DIRID_W 16 -#define DIRID_NWW 14 -#define DIRID_NW 12 -#define DIRID_NNW 10 -#define DIRID_N 8 -#define DIRID_NNE 6 -#define DIRID_NE 4 -#define DIRID_NEE 2 -#define DIRID_E 0 - -// Definition of control types -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define MVCONT_COMPUTER 0 -#define MVCONT_PLAYER1 1 -#define MVCONT_PLAYER2 2 -#define MVCONT_PLAYER3 3 -#define MVCONT_PLAYER4 4 -#define NB_MVCONT 5 -#define MAX_PLAYERS 4 - -// Definition of joystick controls -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define JOYSTICK_UP 0b00000001 -#define JOYSTICK_DOWN 0b00000010 -#define JOYSTICK_LEFT 0b00000100 -#define JOYSTICK_RIGHT 0b00001000 -#define JOYSTICK_FIRE1 0b00010000 -#define JOYSTICK_FIRE2 0b00100000 -#define JOYSTICK_FIRE3 0b01000000 -#define JOYSTICK_FIRE4 0b10000000 - -// Definition of movement types -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define MVTYPE_STATIC 0 -#define MVTYPE_MOUSE 1 -#define MVTYPE_RACE 2 -#define MVTYPE_GENERIC 3 -#define MVTYPE_BALL 4 -#define MVTYPE_TAPED 5 -#define MVTYPE_INTELLIGENT 6 -#define MVTYPE_PINBALL 7 -#define MVTYPE_LIST 8 -#define MVTYPE_PLATFORM 9 -#define MVTYPE_GOMOVEMENT 10 -#define MVTYPE_DISAPPEAR 11 -#define MVTYPE_APPEAR 12 -#define MVTYPE_BULLET 13 -#define MVTYPE_EXT 14 -#define MVTYPE_MAX 15 - -#define MVTACTION_SAVEPOSITION 0x1010 -#define MVTACTION_LOADPOSITION 0x1011 - -//////////////////////////////////////////////////////////////////////////////// -// EVENTS -//////////////////////////////////////////////////////////////////////////////// - -// Eventgroup structure, before conditions and actions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagEVG { - short evgSize; // 0 Size of the group (<=0) - BYTE evgNCond; // 2 Number of conditions - BYTE evgNAct; // 3 Number of actions - WORD evgFlags; // 4 Flags - short evgInhibit; // 6 If the group is inhibited - WORD evgInhibitCpt; // 8 Counter - WORD evgIdentifier; // 10 Unique identifier - short evgUndo; // 12 Identifier for UNDO - } eventGroup; -typedef eventGroup * PEVG; -typedef eventGroup * LPEVG; -#define EVG_SIZE 14 - -// MACRO: next group -#define EVGNEXT(evgPtr) ((LPEVG)((LPSTR)evgPtr-evgPtr->evgSize)) -// MACRO: first event -#define EVGFIRSTEVT(p) ((LPEVT)((LPSTR)p+sizeof(eventGroup))) -// MACRO: number of events in the group -#define EVGNEVENTS(p) (p->evgNCond+p->evgNAct) - -// Internal flags of eventgroups -#define EVGFLAGS_ONCE 0x0001 -#define EVGFLAGS_NOTALWAYS 0x0002 -#define EVGFLAGS_REPEAT 0x0004 -#define EVGFLAGS_NOMORE 0x0008 -#define EVGFLAGS_SHUFFLE 0x0010 -#define EVGFLAGS_EDITORMARK 0x0020 -#define EVGFLAGS_UNDOMARK 0x0040 -#define EVGFLAGS_COMPLEXGROUP 0x0080 -#define EVGFLAGS_BREAKPOINT 0x0100 -#define EVGFLAGS_ALWAYSCLEAN 0x0200 -#define EVGFLAGS_ORINGROUP 0x0400 -//#define EVGFLAGS_2MANYACTIONS 0x0400 -#define EVGFLAGS_STOPINGROUP 0x0800 -//#define EVGFLAGS_NOTASSEMBLED 0x1000 -#define EVGFLAGS_ORLOGICAL 0x1000 -#define EVGFLAGS_GROUPED 0x2000 -#define EVGFLAGS_INACTIVE 0x4000 -#define EVGFLAGS_NOGOOD 0x8000 -#define EVGFLAGS_LIMITED (EVGFLAGS_SHUFFLE+EVGFLAGS_NOTALWAYS+EVGFLAGS_REPEAT+EVGFLAGS_NOMORE) -#define EVGFLAGS_DEFAULTMASK (EVGFLAGS_BREAKPOINT+EVGFLAGS_GROUPED) -//#define EVGFLAGS_FADE (EVGFLAGS_FADEIN|EVGFLAGS_FADEOUT) - - -// Condition ou action structure -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagEVTV1 { - short evtSize; - union - { - struct - { - short evtCode; - }; - struct - { - char evtType; - char evtNum; - }; - }; - OINUM evtOi; - short evtOiList; - char evtFlags; - char evtFlags2; - char evtNParams; - char evtDefType; -// For the conditions - short evtIdentifier; - } eventV1; -typedef eventV1 * LPEVTV1; - -#define CND_SIZEV1 14 -#define ACT_SIZEV1 12 -#define EVGFIRSTEVTV1(p) ((LPEVTV1)((LPSTR)p+sizeof(eventGroup))) -#define EVTPARAMSV1(p) ((LPEVP)( p->evtCode<0 ? (LPBYTE)p+CND_SIZEV1 : (LPBYTE)p+ACT_SIZEV1) ) -#define EVTNEXTV1(p) ((LPEVTV1)((LPBYTE)p+p->evtSize)) - - - -typedef struct tagEVT { - short evtSize; // 0 Size of the event - union - { - struct - { - long evtCode; // 2 Code (hi:NUM lo:TYPE) - }; - struct - { - short evtType; // 2 Type of object - short evtNum; // 4 Number of action/condition - }; - }; - OINUM evtOi; // 6 OI if normal object - short evtOiList; // 8 Pointer - char evtFlags; // 10 Flags - char evtFlags2; // 11 Flags II - char evtNParams; // 12 Number of parameters - char evtDefType; // 13 If default, type -// Pour les conditions - short evtIdentifier; // 14 Event identifier - } event; // 16 -typedef event * PEVT; -typedef event * LPEVT; - -#define CND_SIZE 16 -#define ACT_SIZE 14 - -// Definition of conditions / actions flags -#define EVFLAGS_REPEAT 0x01 -#define EVFLAGS_DONE 0x02 -#define EVFLAGS_DEFAULT 0x04 -#define EVFLAGS_DONEBEFOREFADEIN 0x08 -#define EVFLAGS_NOTDONEINSTART 0x10 -#define EVFLAGS_ALWAYS 0x20 -#define EVFLAGS_BAD 0x40 -#define EVFLAGS_BADOBJECT 0x80 -#define EVFLAGS_DEFAULTMASK (EVFLAGS_ALWAYS+EVFLAGS_REPEAT+EVFLAGS_DEFAULT+EVFLAGS_DONEBEFOREFADEIN+EVFLAGS_NOTDONEINSTART) -#define ACTFLAGS_REPEAT 0x0001 - - -// For flags II -// ------------- -#define EVFLAG2_NOT 0x0001 -#define EVFLAG2_NOTABLE 0x0002 -#define EVFLAGS_NOTABLE (EVFLAG2_NOTABLE<<8) -#define EVFLAGS_MONITORABLE 0x0004 -#define EVFLAGS_TODELETE 0x0008 -#define EVFLAGS_NEWSOUND 0x0010 -#define EVFLAG2_MASK (EVFLAG2_NOT|EVFLAG2_NOTABLE|EVFLAGS_MONITORABLE) - -// MACRO: Returns the code for an extension -#define EXTCONDITIONNUM(i) (-((short)(i>>16))-1) -#define EXTACTIONNUM(i) ((short)(i>>16)) - -// PARAM Structure -// ~~~~~~~~~~~~~~~ -#ifdef __cplusplus -class eventParam { -public: -#else -typedef struct eventParam { -#endif - short evpSize; - short evpCode; - union { - struct { - short evpW0; - short evpW1; - short evpW2; - short evpW3; - short evpW4; - short evpW5; - short evpW6; - short evpW7; - } evpW; - struct { - long evpL0; - long evpL1; - long evpL2; - long evpL3; - } evpL; - } evp; -#ifdef __cplusplus -}; -#else -} eventParam; -#endif -typedef eventParam * PEVP; -typedef eventParam * LPEVP; -typedef eventParam * fpevp; - -// MACRO: next parameter -#define EVPNEXT(p) ((LPEVP)((LPSTR)p+p->evpSize)) - - -// Operators / expressions parameters -// -------------------------------------------------- -#define MIN_LONG (-10000000L) -#define MAX_LONG (10000000L) -#define EXPPARAM_LONG 1 -#define EXPPARAM_VARGLO 2 -#define EXPPARAM_STRING 3 -#define EXPPARAM_ALTVALUE 4 -#define EXPPARAM_FLAG 5 -#define EXP_STOP -1 -#define OPERATOR_START 0x00000000 -#define EXPL_END 0x00000000 -#define EXPL_PLUS 0x00020000 -#define EXPL_MOINS 0x00040000 -#define EXPL_MULT 0x00060000 -#define EXPL_DIV 0x00080000 -#define EXPL_MOD 0x000A0000 -#define EXPL_POW 0x000C0000 -#define EXPL_AND 0x000E0000 -#define EXPL_OR 0x00100000 -#define EXPL_XOR 0x00120000 -#define OPERATOR_END 0x00140000 -typedef struct tagEXP { - union - { - struct - { - long expCode; // 2 Code (hi:NUM lo:TYPE) - }; - struct - { - short expType; // 2 Type of object - short expNum; // 3 Expression number - }; - }; - short expSize; - union - { - struct { - short expOi; - short expOiList; - } expo; - struct { - long expLParam; - } expl; - struct { - double expDouble; - float expFloat; - } expd; - struct { - short expWParam0; - short expWParam1; - } expw; - struct { - short expOi; - short expOiList; - short expNum; - } expv; - struct { - long expExtCode; - short expExtNumber; - } expc; - } expu; - } expression; -typedef expression * LPEXP; -typedef expression * PEXP; - -#define CMPOPE_EQU 0x0000 -#define CMPOPE_DIF 0x0001 -#define CMPOPE_LOWEQU 0x0002 -#define CMPOPE_LOW 0x0003 -#define CMPOPE_GREEQU 0x0004 -#define CMPOPE_GRE 0x0005 -#define MAX_CMPOPE 6 -#define EXPNEXT(expPtr) ((LPEXP)((LPSTR)expPtr+expPtr->expSize)) -#define EXPFLAG_STRING 0x0001 -#define EXPFLAG_DOUBLE 0x0002 - -typedef struct tagEXPV1 { - union - { - struct - { - short expCode; - }; - struct - { - char expType; - char expNum; - }; - }; - short expSize; - union - { - struct { - short expOi; - short expOiList; - } expo; - struct { - long expLParam; - } expl; - struct { - double expDouble; - float expFloat; - } expd; - struct { - short expWParam0; - short expWParam1; - } expw; - struct { - short expOi; - short expOiList; - short expNum; - } expv; - struct { - long expExtCode; - short expExtNumber; - } expc; - } expu; - }expressionV1; -typedef expressionV1 * LPEXPV1; - -#define EXPNEXTV1(expPtr) ((LPEXPV1)((LPSTR)expPtr+expPtr->expSize)) - -/* -#define Q_SPR 0x0100 -#define Q_TXT 0x0200 -#define Q_QST 0x0400 -#define Q_ARE 0x0800 -#define Q_CNT 0x1000 -#define Q_PLA 0x2000 -#define Q_GAM 0x4000 -#define Q_TIM 0x8000 -#define Q_COL 0x0001 -#define Q_ZNE 0x0002 -#define Q_MVT 0x0004 -#define Q_ANI 0x0008 -#define Q_OBJ 0x0010 -#define Q_KEY 0x0020 -#define Q_SYS 0x0040 -*/ - -// Information structure -// ---------------------------------------------- -typedef struct tagEVO { - short evoConditions; // Conditions - short evoActions; // Actions - short evoExpressions; // Expressions - short evoMsgMenus; // Menu strings for actions/conditions - short evoMsgDisplay; // Display strings for actions/conditions - short evoMsgExpressions; // Menu/display strings for expressions - short evoMsgExpParams; // Parameter string - short evoNConditions; // Number of conditions - } eventInfosOffsets; -typedef eventInfosOffsets * PEVO; -typedef eventInfosOffsets * LPEVO; - -// Definition of the different system objects (TYPE<0) -// ---------------------------------------------------------- -#define TYPE_DIRECTION -127 -#define TYPE_QUALIFIER -126 -#define NUMBEROF_SYSTEMTYPES 7 -#define OBJ_PLAYER -7 -#define OBJ_KEYBOARD -6 -#define OBJ_CREATE -5 -#define OBJ_TIMER -4 -#define OBJ_GAME -3 -#define OBJ_SPEAKER -2 -#define OBJ_SYSTEM -1 -#define OBJ_FIRST_C_OBJECT 8 -#define OBJ_LAST NB_SYSOBJ - - - - - - - - -// ------------------------------------------------------------ -// EXTENSION OBJECT DATA ZONE -// ------------------------------------------------------------ - -// Flags -#define OEFLAG_DISPLAYINFRONT 0x0001 -#define OEFLAG_BACKGROUND 0x0002 -#define OEFLAG_BACKSAVE 0x0004 -#define OEFLAG_RUNBEFOREFADEIN 0x0008 -#define OEFLAG_MOVEMENTS 0x0010 -#define OEFLAG_ANIMATIONS 0x0020 -#define OEFLAG_TABSTOP 0x0040 -#define OEFLAG_WINDOWPROC 0x0080 -#define OEFLAG_VALUES 0x0100 -#define OEFLAG_SPRITES 0x0200 -#define OEFLAG_INTERNALBACKSAVE 0x0400 -#define OEFLAG_SCROLLINGINDEPENDANT 0x0800 -#define OEFLAG_QUICKDISPLAY 0x1000 -#define OEFLAG_NEVERKILL 0x2000 -#define OEFLAG_NEVERSLEEP 0x4000 -#define OEFLAG_MANUALSLEEP 0x8000 -#define OEFLAG_TEXT 0x10000 -#define OEFLAG_DONTCREATEATSTART 0x20000 - -// Flags modifiable by the program -#define OEPREFS_BACKSAVE 0x0001 -#define OEPREFS_SCROLLINGINDEPENDANT 0x0002 -#define OEPREFS_QUICKDISPLAY 0x0004 -#define OEPREFS_SLEEP 0x0008 -#define OEPREFS_LOADONCALL 0x0010 -#define OEPREFS_GLOBAL 0x0020 -#define OEPREFS_BACKEFFECTS 0x0040 -#define OEPREFS_KILL 0x0080 -#define OEPREFS_INKEFFECTS 0x0100 -#define OEPREFS_TRANSITIONS 0x0200 -#define OEPREFS_FINECOLLISIONS 0x0400 -#define OEPREFS_APPLETPROBLEMS 0x0800 - -// Running flags -#define REFLAG_ONESHOT 0x0001 -#define REFLAG_DISPLAY 0x0002 -#define REFLAG_MSGHANDLED 0x0004 -#define REFLAG_MSGCATCHED 0x0008 -#define REFLAG_MSGDEFPROC 0x0010 - -#define REFLAG_MSGRETURNVALUE 0x0040 - -#define OEFLAGS_DEFAULTSETUPS (OEFLAG_MOVEMENTS|OEFLAG_ANIMATIONS|OEFLAG_SPRITES|OEFLAG_VALUES) - - - -#ifndef IN_KPX - -/////////////////////////////////////////////////////////////////////// -// -// DEFINITION OF EVENTS AND ACTIONS CODES -// -/////////////////////////////////////////////////////////////////////// - -// SYSTEM Conditions / Actions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//#define OBJ_SYSTEM -1 -//-1&255=255 -#define CND_CHANCE ((-26<<8)|255) -#define CND_ORLOGICAL ((-25<<8)|255) -#define CNDL_ORLOGICAL ((-25<<16)|65535) -#define CND_OR ((-24<<8)|255) -#define CNDL_OR ((-24<<16)|65535) -#define CND_GROUPSTART ((-23<<8)|255) -#define CNDL_GROUPSTART ((-23<<16)|65535) -#define CND_CLIPBOARD ((-22<<8)|255) -#define CND_ONCLOSE ((-21<<8)|255) -#define CNDL_ONCLOSE ((-21<<16)|65535) -#define CND_COMPAREGSTRING ((-20<<8)|255) -#define CNDL_COMPAREGSTRING ((-20<<16)|65535) -#define CND_MENUVISIBLE ((-19<<8)|255) -#define CND_MENUENABLED ((-18<<8)|255) -#define CND_MENUCHECKED ((-17<<8)|255) -#define CND_ONLOOP ((-16<<8)|255) -#define CNDL_ONLOOP ((-16<<16)|65535) -#define CND_DROPFILES ((-15<<8)|255) -#define CNDL_DROPFILES ((-15<<16)|65535) -#define CND_MENUSELECTED ((-14<<8)|255) -#define CNDL_MENUSELECTED ((-14<<16)|65535) -#define CND_RECORDKEY ((-13<<8)|255) -#define CNDL_RECORDKEY ((-13<<16)|65535) -#define CND_GROUPACTIVATED ((-12<<8)|255) -#define CNDL_GROUPACTIVATED ((-12<<16)|65535) -#define CND_ENDGROUP ((-11<<8)|255) -#define CNDL_ENDGROUP ((-11<<16)|65535) -#define CND_GROUP ((-10<<8)|255) -#define CNDL_GROUP ((-10<<16)|65535) -#define CND_REMARK ((-9<<8)|255) -#define CNDL_REMARK ((-9<<16)|65535) -#define CND_COMPAREG ((-8<<8)|255) -#define CNDL_COMPAREG ((-8<<16)|65535) -#define CND_NOTALWAYS ((-7<<8)|255) -#define CNDL_NOTALWAYS ((-7<<16)|65535) -#define CND_ONCE ((-6<<8)|255) -#define CNDL_ONCE ((-6<<16)|65535) -#define CND_REPEAT ((-5<<8)|255) -#define CNDL_REPEAT ((-5<<16)|65535) -#define CND_NOMORE ((-4<<8)|255) -#define CNDL_NOMORE ((-4<<16)|65535) -#define CND_COMPARE ((-3<<8)|255) -#define CND_NEVER ((-2<<8)|255) -#define CNDL_NEVER ((-2<<16)|65535) -#define CND_ALWAYS ((-1<<8)|255) -#define CNDL_ALWAYS ((-1<<16)|65535) - -#define ACT_SKIP ((0<<8)|255) -#define ACTL_SKIP ((0<<16)|65535) -#define ACT_SKIPMONITOR ((1<<8)|255) -#define ACTL_SKIPMONITOR ((1<<16)|65535) -#define ACT_EXECPROG ((2<<8)|255) -#define ACT_SETVARG ((3<<8)|255) -#define ACTL_SETVARG ((3<<16)|65535) -#define ACT_SUBVARG ((4<<8)|255) -#define ACTL_SUBVARG ((4<<16)|65535) -#define ACT_ADDVARG ((5<<8)|255) -#define ACTL_ADDVARG ((5<<16)|65535) -#define ACT_GRPACTIVATE ((6<<8)|255) -#define ACTL_GRPACTIVATE ((6<<16)|65535) -#define ACT_GRPDEACTIVATE ((7<<8)|255) -#define ACTL_GRPDEACTIVATE ((7<<16)|65535) -#define ACT_MENUACTIVATE ((8<<8)|255) -#define ACT_MENUDEACTIVATE ((9<<8)|255) -#define ACT_MENUCHECK ((10<<8)|255) -#define ACT_MENUNCHECK ((11<<8)|255) -#define ACT_MENUSHOW ((12<<8)|255) -#define ACTL_MENUSHOW ((12<<16)|65535) -#define ACT_MENUHIDE ((13<<8)|255) -#define ACTL_MENUHIDE ((13<<16)|65535) -#define ACT_STARTLOOP ((14<<8)|255) -#define ACT_STOPLOOP ((15<<8)|255) -#define ACT_SETLOOPINDEX ((16<<8)|255) -#define ACT_RANDOMIZE ((17<<8)|255) -#define ACT_SENDMENUCMD ((18<<8)|255) -#define ACT_SETGLOBALSTRING ((19<<8)|255) -#define ACTL_SETGLOBALSTRING ((19<<16)|65535) -#define ACT_SENDCLIPBOARD ((20<<8)|255) -#define ACT_CLEARCLIPBOARD ((21<<8)|255) -#define ACT_EXECPROG2 ((22<<8)|255) -#define ACT_OPENDEBUGGER ((23<<8)|255) -#define ACT_PAUSEDEBUGGER ((24<<8)|255) -#define ACT_EXTRACTBINFILE ((25<<8)|255) -#define ACT_RELEASEBINFILE ((26<<8)|255) - -#define EXP_LONG ((0<<8)|255) -#define EXPL_LONG ((0<<16)|65535) -#define EXP_RANDOM ((1<<8)|255) -#define EXPL_RANDOM ((1<<16)|65535) -#define EXP_VARGLO ((2<<8)|255) -#define EXPL_VARGLO ((2<<16)|65535) -#define EXP_STRING ((3<<8)|255) -#define EXPL_STRING ((3<<16)|65535) -#define EXP_STR ((4<<8)|255) -#define EXPL_STR ((4<<16)|65535) -#define EXP_VAL ((5<<8)|255) -#define EXPL_VAL ((5<<16)|65535) -#define EXP_DRIVE ((6<<8)|255) -#define EXPL_DRIVE ((6<<16)|65535) -#define EXP_DIRECTORY ((7<<8)|255) -#define EXPL_DIRECTORY ((7<<16)|65535) -#define EXP_PATH ((8<<8)|255) -#define EXPL_PATH ((8<<16)|65535) -#define EXP_APPNAME ((9<<8)|255) -#define EXPL_APPNAME ((9<<16)|65535) -#define EXP_SIN ((10<<8)|255) -#define EXPL_SIN ((10<<16)|65535) -#define EXP_COS ((11<<8)|255) -#define EXPL_COS ((11<<16)|65535) -#define EXP_TAN ((12<<8)|255) -#define EXPL_TAN ((12<<16)|65535) -#define EXP_SQR ((13<<8)|255) -#define EXPL_SQR ((13<<16)|65535) -#define EXP_LOG ((14<<8)|255) -#define EXPL_LOG ((14<<16)|65535) -#define EXP_LN ((15<<8)|255) -#define EXPL_LN ((15<<16)|65535) -#define EXP_HEX ((16<<8)|255) -#define EXPL_HEX ((16<<16)|65535) -#define EXP_BIN ((17<<8)|255) -#define EXPL_BIN ((17<<16)|65535) -#define EXP_EXP ((18<<8)|255) -#define EXPL_EXP ((18<<16)|65535) -#define EXP_LEFT ((19<<8)|255) -#define EXPL_LEFT ((19<<16)|65535) -#define EXP_RIGHT ((20<<8)|255) -#define EXPL_RIGHT ((20<<16)|65535) -#define EXP_MID ((21<<8)|255) -#define EXPL_MID ((21<<16)|65535) -#define EXP_LEN ((22<<8)|255) -#define EXPL_LEN ((22<<16)|65535) -#define EXP_DOUBLE ((23<<8)|255) -#define EXPL_DOUBLE ((23<<16)|65535) -#define EXP_VARGLONAMED ((24<<8)|255) -#define EXPL_VARGLONAMED ((24<<16)|65535) -#define EXP_ENTERSTRINGHERE ((25<<8)|255) -#define EXPL_ENTERSTRINGHERE ((25<<16)|65535) -#define EXP_ENTERVALUEHERE ((26<<8)|255) -#define EXPL_ENTERVALUEHERE ((26<<16)|65535) -#define EXP_FLOAT ((27<<8)|255) -#define EXPL_FLOAT ((27<<16)|65535) -#define EXP_INT ((28<<8)|255) -#define EXPL_INT ((28<<16)|65535) -#define EXP_ABS ((29<<8)|255) -#define EXPL_ABS ((29<<16)|65535) -#define EXP_CEIL ((30<<8)|255) -#define EXPL_CEIL ((30<<16)|65535) -#define EXP_FLOOR ((31<<8)|255) -#define EXPL_FLOOR ((31<<16)|65535) -#define EXP_ACOS ((32<<8)|255) -#define EXPL_ACOS ((32<<16)|65535) -#define EXP_ASIN ((33<<8)|255) -#define EXPL_ASIN ((33<<16)|65535) -#define EXP_ATAN ((34<<8)|255) -#define EXPL_ATAN ((34<<16)|65535) -#define EXP_NOT ((35<<8)|255) -#define EXPL_NOT ((35<<16)|65535) -#define EXP_NDROPFILES ((36<<8)|255) -#define EXPL_NDROPFILES ((36<<16)|65535) -#define EXP_DROPFILE ((37<<8)|255) -#define EXPL_DROPFILE ((37<<16)|65535) -#define EXP_GETCOMMANDLINE ((38<<8)|255) -#define EXPL_GETCOMMANDLINE ((38<<16)|65535) -#define EXP_GETCOMMANDITEM ((39<<8)|255) -#define EXPL_GETCOMMANDITEM ((39<<16)|65535) -#define EXP_MIN ((40<<8)|255) -#define EXPL_MIN ((40<<16)|65535) -#define EXP_MAX ((41<<8)|255) -#define EXPL_MAX ((41<<16)|65535) -#define EXP_GETRGB ((42<<8)|255) -#define EXPL_GETRGB ((42<<16)|65535) -#define EXP_GETRED ((43<<8)|255) -#define EXPL_GETRED ((43<<16)|65535) -#define EXP_GETGREEN ((44<<8)|255) -#define EXPL_GETGREEN ((44<<16)|65535) -#define EXP_GETBLUE ((45<<8)|255) -#define EXPL_GETBLUE ((45<<16)|65535) -#define EXP_LOOPINDEX ((46<<8)|255) -#define EXPL_LOOPINDEX ((46<<16)|65535) -#define EXP_NEWLINE ((47<<8)|255) -#define EXPL_NEWLINE ((47<<16)|65535) -#define EXP_ROUND ((48<<8)|255) -#define EXPL_ROUND ((48<<16)|65535) -#define EXP_STRINGGLO ((49<<8)|255) -#define EXPL_STRINGGLO ((49<<16)|65535) -#define EXP_STRINGGLONAMED ((50<<8)|255) -#define EXPL_STRINGGLONAMED ((50<<16)|65535) -#define EXP_LOWER ((51<<8)|255) -#define EXPL_LOWER ((51<<16)|65535) -#define EXP_UPPER ((52<<8)|255) -#define EXPL_UPPER ((52<<16)|65535) -#define EXP_FIND ((53<<8)|255) -#define EXPL_FIND ((53<<16)|65535) -#define EXP_REVERSEFIND ((54<<8)|255) -#define EXPL_REVERSEFIND ((54<<16)|65535) -#define EXP_GETCLIPBOARD ((55<<8)|255) -#define EXP_TEMPPATH ((56<<8)|255) -#define EXP_BINFILETEMPNAME ((57<<8)|255) -#define EXP_FLOATSTR ((58<<8)|255) -#define EXPL_FLOATSTR ((58<<16)|65535) -#define EXP_ATAN2 ((59<<8)|255) -#define EXPL_ATAN2 ((59<<16)|65535) -#define EXP_ZERO ((60<<8)|255) -#define EXPL_ZERO ((60<<16)|65535) -#define EXP_EMPTY ((61<<8)|255) -#define EXPL_EMPTY ((61<<16)|65535) - -#define EXP_PARENTH1 ((-1<<8)|255) -#define EXPL_PARENTH1 ((-1<<16)|65535) -#define EXP_PARENTH2 ((-2<<8)|255) -#define EXPL_PARENTH2 ((-2<<16)|65535) -#define EXP_VIRGULE ((-3<<8)|255) -#define EXPL_VIRGULE ((-3<<16)|65535) - -// SPEAKER Conditions / Actions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// #define TYPE_SPEAKER -2 -//(TYPE_SPEAKER&255)=254 -#define CND_SPCHANNELPAUSED ((-9<<8)|254) -#define CNDL_SPCHANNELPAUSED ((-9<<16)|65534) -#define CND_NOSPCHANNELPLAYING ((-8<<8)|254) -#define CNDL_NOSPCHANNELPLAYING ((-8<<16)|65534) -#define CND_MUSPAUSED ((-7<<8)|254) -#define CND_SPSAMPAUSED ((-6<<8)|254) -#define CNDL_SPSAMPAUSED ((-6<<16)|65534) -#define CND_MUSICENDS ((-5<<8)|254) -#define CNDL_MUSICENDS ((-5<<16)|65534) -#define CND_NOMUSPLAYING ((-4<<8)|254) -#define CNDL_NOMUSPLAYING ((-4<<16)|65534) -#define CND_NOSAMPLAYING ((-3<<8)|254) -#define CNDL_NOSAMPLAYING ((-3<<16)|65534) -#define CND_NOSPMUSPLAYING ((-2<<8)|254) -#define CND_NOSPSAMPLAYING ((-1<<8)|254) -#define CNDL_NOSPSAMPLAYING ((-1<<16)|65534) -#define ACT_PLAYSAMPLE ((0<<8)|254) -#define ACTL_PLAYSAMPLE ((0<<16)|65534) -#define ACT_STOPSAMPLE ((1<<8)|254) -#define ACTL_STOPSAMPLE ((1<<16)|65534) -#define ACT_PLAYMUSIC ((2<<8)|254) -#define ACTL_PLAYMUSIC ((2<<16)|65534) -#define ACT_STOPMUSIC ((3<<8)|254) -#define ACTL_STOPMUSIC ((3<<16)|65534) -#define ACT_PLAYLOOPSAMPLE ((4<<8)|254) -#define ACTL_PLAYLOOPSAMPLE ((4<<16)|65534) -#define ACT_PLAYLOOPMUSIC ((5<<8)|254) -#define ACT_STOPSPESAMPLE ((6<<8)|254) -#define ACTL_STOPSPESAMPLE ((6<<16)|65534) -#define ACT_PAUSESAMPLE ((7<<8)|254) -#define ACTL_PAUSESAMPLE ((7<<16)|65534) -#define ACT_RESUMESAMPLE ((8<<8)|254) -#define ACTL_RESUMESAMPLE ((8<<16)|65534) -#define ACT_PAUSEMUSIC ((9<<8)|254) -#define ACT_RESUMEMUSIC ((10<<8)|254) -#define ACT_PLAYCHANNEL ((11<<8)|254) -#define ACTL_PLAYCHANNEL ((11<<16)|65534) -#define ACT_PLAYLOOPCHANNEL ((12<<8)|254) -#define ACTL_PLAYLOOPCHANNEL ((12<<16)|65534) -#define ACT_PAUSECHANNEL ((13<<8)|254) -#define ACTL_PAUSECHANNEL ((13<<16)|65534) -#define ACT_RESUMECHANNEL ((14<<8)|254) -#define ACTL_RESUMECHANNEL ((14<<16)|65534) -#define ACT_STOPCHANNEL ((15<<8)|254) -#define ACTL_STOPCHANNEL ((15<<16)|65534) -#define ACT_SETCHANNELPOS ((16<<8)|254) -#define ACTL_SETCHANNELPOS ((16<<16)|65534) -#define ACT_SETCHANNELVOL ((17<<8)|254) -#define ACTL_SETCHANNELVOL ((17<<16)|65534) -#define ACT_SETCHANNELPAN ((18<<8)|254) -#define ACTL_SETCHANNELPAN ((18<<16)|65534) -#define ACT_SETSAMPLEPOS ((19<<8)|254) -#define ACTL_SETSAMPLEPOS ((19<<16)|65534) -#define ACT_SETSAMPLEMAINVOL ((20<<8)|254) -#define ACTL_SETSAMPLEMAINVOL ((20<<16)|65534) -#define ACT_SETSAMPLEVOL ((21<<8)|254) -#define ACTL_SETSAMPLEVOL ((21<<16)|65534) -#define ACT_SETSAMPLEMALNPAN ((22<<8)|254) -#define ACTL_SETSAMPLEMALNPAN ((22<<16)|65534) -#define ACT_SETSAMPLEPAN ((23<<8)|254) -#define ACTL_SETSAMPLEPAN ((23<<16)|65534) -#define ACT_PAUSEALLCHANNELS ((24<<8)|254) -#define ACTL_PAUSEALLCHANNELS ((24<<16)|65534) -#define ACT_RESUMEALLCHANNELS ((25<<8)|254) -#define ACTL_RESUMEALLCHANNELS ((25<<16)|65534) -#define ACT_PLAYMUSICFILE ((26<<8)|254) -#define ACT_PLAYLOOPMUSICFILE ((27<<8)|254) -#define ACT_PLAYFILECHANNEL ((28<<8)|254) -#define ACTL_PLAYFILECHANNEL ((28<<16)|65534) -#define ACT_PLAYLOOPFILECHANNEL ((29<<8)|254) -#define ACTL_PLAYLOOPFILECHANNEL ((29<<16)|65534) -#define ACT_LOCKCHANNEL ((30<<8)|254) -#define ACTL_LOCKCHANNEL ((30<<16)|65534) -#define ACT_UNLOCKCHANNEL ((31<<8)|254) -#define ACTL_UNLOCKCHANNEL ((31<<16)|65534) -#define ACT_SETCHANNELFREQ ((32<<8)|254) -#define ACT_SETSAMPLEFREQ ((33<<8)|254) - -#define EXP_GETSAMPLEMAINVOL ((0<<8)|254) -#define EXP_GETSAMPLEVOL ((1<<8)|254) -#define EXP_GETCHANNELVOL ((2<<8)|254) -#define EXPL_GETCHANNELVOL ((2<<16)|65534) -#define EXP_GETSAMPLEMAINPAN ((3<<8)|254) -#define EXP_GETSAMPLEPAN ((4<<8)|254) -#define EXP_GETCHANNELPAN ((5<<8)|254) -#define EXPL_GETCHANNELPAN ((5<<16)|65534) -#define EXP_GETSAMPLEPOS ((6<<8)|254) -#define EXP_GETCHANNELPOS ((7<<8)|254) -#define EXPL_GETCHANNELPOS ((7<<16)|65534) -#define EXP_GETSAMPLEDUR ((8<<8)|254) -#define EXP_GETCHANNELDUR ((9<<8)|254) -#define EXP_GETSAMPLEFREQ ((10<<8)|254) -#define EXP_GETCHANNELFREQ ((11<<8)|254) - - -// GAME Conditions / Actions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//#define TYPE_GAME -3 -//(TYPE_GAME&255)=253 - -#define CND_FRAMESAVED ((-10<<8)|253) -#define CND_FRAMELOADED ((-9<<8)|253) -#define CNDL_ENDOFPAUSE ((-8<<16)|65533) -#define CND_ENDOFPAUSE ((-8<<8)|253) -#define CND_ISVSYNCON ((-7<<8)|253) -#define CND_ISLADDER ((-6<<8)|253) -#define CND_ISOBSTACLE ((-5<<8)|253) -#define CND_QUITAPPLICATION ((-4<<8)|253) -#define CNDL_QUITAPPLICATION ((-4<<16)|65533) -#define CND_LEVEL ((-3<<8)|253) -#define CND_END ((-2<<8)|253) -#define CNDL_END ((-2<<16)|65533) -#define CND_START ((-1<<8)|253) -#define CNDL_START ((-1<<16)|65533) - -#define ACT_NEXTLEVEL ((0<<8)|253) -#define ACTL_NEXTLEVEL ((0<<16)|65533) -#define ACT_PREVLEVEL ((1<<8)|253) -#define ACTL_PREVLEVEL ((1<<16)|65533) -#define ACT_GOLEVEL ((2<<8)|253) -#define ACTL_GOLEVEL ((2<<16)|65533) -#define ACT_PAUSE ((3<<8)|253) -#define ACT_ENDGAME ((4<<8)|253) -#define ACTL_ENDGAME ((4<<16)|65533) -#define ACT_RESTARTGAME ((5<<8)|253) -#define ACTL_RESTARTGAME ((5<<16)|65533) -#define ACT_RESTARTLEVEL ((6<<8)|253) -#define ACT_CDISPLAY ((7<<8)|253) -#define ACT_CDISPLAYX ((8<<8)|253) -#define ACT_CDISPLAYY ((9<<8)|253) -#define ACT_LOADGAME ((10<<8)|253) -#define ACT_SAVEGAME ((11<<8)|253) -#define ACT_CLS ((12<<8)|253) -#define ACT_CLEARZONE ((13<<8)|253) -#define ACT_FULLSCREENMODE ((14<<8)|253) -#define ACT_WINDOWEDMODE ((15<<8)|253) -#define ACT_SETFRAMERATE ((16<<8)|253) -#define ACT_PAUSEKEY ((17<<8)|253) -#define ACT_PAUSEANYKEY ((18<<8)|253) -#define ACT_SETVSYNCON ((19<<8)|253) -#define ACT_SETVSYNCOFF ((20<<8)|253) -#define ACT_SETVIRTUALWIDTH ((21<<8)|253) -#define ACT_SETVIRTUALHEIGHT ((22<<8)|253) -#define ACT_SETFRAMEBDKCOLOR ((23<<8)|253) -#define ACT_DELCREATEDBKDAT ((24<<8)|253) -#define ACT_DELALLCREATEDBKD ((25<<8)|253) -#define ACT_SETFRAMEWIDTH ((26<<8)|253) -#define ACT_SETFRAMEHEIGHT ((27<<8)|253) -#define ACT_SAVEFRAME ((28<<8)|253) -#define ACT_LOADFRAME ((29<<8)|253) -#define ACT_LOADAPPLICATION ((30<<8)|253) -#define ACT_PLAYDEMO ((31<<8)|253) -#define ACT_SETFRAMEEFFECT ((32<<8)|253) -#define ACT_SETFRAMEEFFECTPARAM ((33<<8)|253) -#define ACT_SETFRAMEEFFECTPARAMTEXTURE ((34<<8)|253) -#define ACT_SETFRAMEALPHACOEF ((35<<8)|253) -#define ACT_SETFRAMERGBCOEF ((36<<8)|253) - -#define EXP_GAMLEVEL ((0<<8)|253) -#define EXP_GAMNPLAYER ((1<<8)|253) -#define EXP_PLAYXLEFT ((2<<8)|253) -#define EXP_PLAYXRIGHT ((3<<8)|253) -#define EXP_PLAYYTOP ((4<<8)|253) -#define EXP_PLAYYBOTTOM ((5<<8)|253) -#define EXP_PLAYWIDTH ((6<<8)|253) -#define EXP_PLAYHEIGHT ((7<<8)|253) -#define EXP_GAMLEVELNEW ((8<<8)|253) -#define EXP_GETCOLLISIONMASK ((9<<8)|253) -#define EXP_FRAMERATE ((10<<8)|253) -#define EXP_GETVIRTUALWIDTH ((11<<8)|253) -#define EXP_GETVIRTUALHEIGHT ((12<<8)|253) -#define EXP_GETFRAMEBKDCOLOR ((13<<8)|253) -#define EXP_GRAPHICMODE ((14<<8)|253) -#define EXP_PIXELSHADERVERSION ((15<<8)|253) -#define EXP_FRAMEALPHACOEF ((16<<8)|253) -#define EXP_FRAMERGBCOEF ((17<<8)|253) -#define EXP_FRAMEEFFECTPARAM ((18<<8)|253) - - -// TIMER Conditions / Actions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define CND_TIMEOUT ((-5<<8)|(OBJ_TIMER&255)) -#define CND_EVERY ((-4<<8)|(OBJ_TIMER&255)) -#define CNDL_EVERY ((-4<<16)|(OBJ_TIMER&0xFFFF)) -#define CND_TIMER ((-3<<8)|(OBJ_TIMER&255)) -#define CNDL_TIMER ((-3<<16)|(OBJ_TIMER&0xFFFF)) -#define CND_TIMERINF ((-2<<8)|(OBJ_TIMER&255)) -#define CNDL_TIMERINF ((-2<<16)|(OBJ_TIMER&0xFFFF)) -#define CND_TIMERSUP ((-1<<8)|(OBJ_TIMER&255)) -#define CNDL_TIMERSUP ((-1<<16)|(OBJ_TIMER&0xFFFF)) -#define ACT_SETTIMER ((0<<8)|(OBJ_TIMER&255)) -#define EXP_TIMVALUE ((0<<8)|(OBJ_TIMER&255)) -#define EXP_TIMCENT ((1<<8)|(OBJ_TIMER&255)) -#define EXP_TIMSECONDS ((2<<8)|(OBJ_TIMER&255)) -#define EXP_TIMHOURS ((3<<8)|(OBJ_TIMER&255)) -#define EXP_TIMMINITS ((4<<8)|(OBJ_TIMER&255)) -#define NUM_EVERY -4 -#define NUM_TIMER -3 -#define NUM_TIMERINF -2 -#define NUM_TIMERSUP -1 - -// KEYBOARD Conditions / Actions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define CNDL_ONMOUSEWHEELDOWN ((-12<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_ONMOUSEWHEELDOWN ((-12<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_ONMOUSEWHEELUP ((-11<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_ONMOUSEWHEELUP ((-11<<8)|(OBJ_KEYBOARD&255)) -#define CND_MOUSEON ((-10<<8)|(OBJ_KEYBOARD&255)) -#define CND_ANYKEY ((-9<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_ANYKEY ((-9<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_MKEYDEPRESSED ((-8<<8)|(OBJ_KEYBOARD&255)) -#define CND_MCLICKONOBJECT ((-7<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_MCLICKONOBJECT ((-7<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_MCLICKINZONE ((-6<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_MCLICKINZONE ((-6<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_MCLICK ((-5<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_MCLICK ((-5<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_MONOBJECT ((-4<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_MONOBJECT ((-4<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_MINZONE ((-3<<8)|(OBJ_KEYBOARD&255)) -#define CND_KBKEYDEPRESSED ((-2<<8)|(OBJ_KEYBOARD&255)) -#define CND_KBPRESSKEY ((-1<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_KBPRESSKEY ((-1<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define ACT_HIDECURSOR ((0<<8)|(OBJ_KEYBOARD&255)) -#define ACT_SHOWCURSOR ((1<<8)|(OBJ_KEYBOARD&255)) -#define EXP_XMOUSE ((0<<8)|(OBJ_KEYBOARD&255)) -#define EXP_YMOUSE ((1<<8)|(OBJ_KEYBOARD&255)) -#define EXP_MOUSEWHEELDELTA ((2<<8)|(OBJ_KEYBOARD&255)) - - -// PLAYERS Conditions / Actions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define CND_JOYPUSHED ((-6<<8)|(OBJ_PLAYER&255)) -#define CND_NOMORELIVE ((-5<<8)|(OBJ_PLAYER&255)) -#define CNDL_NOMORELIVE ((-5<<16)|(OBJ_PLAYER&0xFFFF)) -#define CND_JOYPRESSED ((-4<<8)|(OBJ_PLAYER&255)) -#define CNDL_JOYPRESSED ((-4<<16)|(OBJ_PLAYER&0xFFFF)) -#define CND_LIVE ((-3<<8)|(OBJ_PLAYER&255)) -#define CND_SCORE ((-2<<8)|(OBJ_PLAYER&255)) -#define CND_PLAYERPLAYING ((-1<<8)|(OBJ_PLAYER&255)) - -#define ACT_SETSCORE ((0<<8)|(OBJ_PLAYER&255)) -#define ACT_SETLIVES ((1<<8)|(OBJ_PLAYER&255)) -#define ACT_NOINPUT ((2<<8)|(OBJ_PLAYER&255)) -#define ACT_RESTINPUT ((3<<8)|(OBJ_PLAYER&255)) -#define ACT_ADDSCORE ((4<<8)|(OBJ_PLAYER&255)) -#define ACT_ADDLIVES ((5<<8)|(OBJ_PLAYER&255)) -#define ACT_SUBSCORE ((6<<8)|(OBJ_PLAYER&255)) -#define ACT_SUBLIVES ((7<<8)|(OBJ_PLAYER&255)) -#define ACT_SETINPUT ((8<<8)|(OBJ_PLAYER&255)) -#define ACT_SETINPUTKEY ((9<<8)|(OBJ_PLAYER&255)) -#define ACT_SETPLAYERNAME ((10<<8)|(OBJ_PLAYER&255)) - -#define EXP_PLASCORE ((0<<8)|(OBJ_PLAYER&255)) -#define EXP_PLALIVES ((1<<8)|(OBJ_PLAYER&255)) -#define EXP_GETINPUT ((2<<8)|(OBJ_PLAYER&255)) -#define EXP_GETINPUTKEY ((3<<8)|(OBJ_PLAYER&255)) -#define EXP_GETPLAYERNAME ((4<<8)|(OBJ_PLAYER&255)) -#define NUM_JOYPRESSED -4 - -// CREATE Conditions / Actions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define CND_CHOOSEALLINLINE ((-23<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEFLAGRESET ((-22<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEFLAGSET ((-21<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEVALUE ((-20<<8)|(OBJ_CREATE&255)) -#define CND_PICKFROMID ((-19<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEALLINZONE ((-18<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEALL ((-17<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEZONE ((-16<<8)|(OBJ_CREATE&255)) -#define CND_NUMOFALLOBJECT ((-15<<8)|(OBJ_CREATE&255)) -#define CND_NUMOFALLZONE ((-14<<8)|(OBJ_CREATE&255)) -#define CND_NOMOREALLZONE ((-13<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEFLAGRESET_OLD ((-12<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEFLAGSET_OLD ((-11<<8)|(OBJ_CREATE&255)) -//... -#define CND_CHOOSEVALUE_OLD ((-8<<8)|(OBJ_CREATE&255)) -#define CND_PICKFROMID_OLD ((-7<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEALLINZONE_OLD ((-6<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEALL_OLD ((-5<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEZONE_OLD ((-4<<8)|(OBJ_CREATE&255)) -#define CND_NUMOFALLOBJECT_OLD ((-3<<8)|(OBJ_CREATE&255)) -#define CND_NUMOFALLZONE_OLD ((-2<<8)|(OBJ_CREATE&255)) -#define CND_NOMOREALLZONE_OLD ((-1<<8)|(OBJ_CREATE&255)) -#define ACT_CREATE ((0<<8)|(OBJ_CREATE&255)) -#define EXP_CRENUMBERALL ((0<<8)|(OBJ_CREATE&255)) -#define NUM_END -2 -#define NUM_START -1 - -#endif - -// BALL Movements -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagMB { - WORD mbSpeed; - WORD mbBounce; - WORD mbAngles; - WORD mbSecurity; - WORD mbDecelerate; - WORD mbFree; - } MoveBall; -typedef MoveBall * LPMOVEBALL; - -// MOUSE movement -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagMM { - short mmDx; - short mmFx; - short mmDy; - short mmFy; - short mmFlags; - } MoveMouse; -typedef MoveMouse * LPMOVEMOUSE; - -#define MOUSE_XCENTER 100 -#define MOUSE_YCENTER 100 -#define MMMODE_NORMAL 0 -#define MMMODE_HIDDEN 1 -#define MMMODE_REMOVED 2 - -// 8 Direction movement -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagMG { - WORD mgSpeed; // Max speed - WORD mgAcc; // Acceleration - WORD mgDec; // Deceleration - WORD mgBounceMult; // Bounce factor - DWORD mgDir; // Allowed directions - } MoveGeneric; -typedef MoveGeneric * LPMOVEGENERIC; - -// RACE-CAR movement -// ~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagMR { - WORD mrSpeed; // Max speed - WORD mrAcc; // Acceleration - WORD mrDec; // Deceleration - WORD mrRot; // Rotating speed - WORD mrBounceMult; // Bounce factor - WORD mrAngles; // Number of angles - WORD mrOkReverse; // Allowed reverse speed? - } MoveRace; -typedef MoveRace * LPMOVERACE; - -// Path movement -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// Structure for one move -typedef struct tagMDV1 { - BYTE mdSpeed; - BYTE mdDir; - short mdDx; - short mdDy; - short mdCosinus; - short mdSinus; - short mdLength; - short mdPause; - } MoveDefV1; -typedef MoveDefV1 * LPMOVEDEFV1; - -typedef struct tagMD { - BYTE mdPrevious; - BYTE mdNext; - BYTE mdSpeed; - BYTE mdDir; - short mdDx; - short mdDy; - short mdCosinus; - short mdSinus; - short mdLength; - short mdPause; - TCHAR mdName[2]; - } MoveDef; -typedef MoveDef * LPMOVEDEF; - -// Movement edition -typedef struct tagME { - int meSpeed; - int meDx; - int meDy; - int meFlag; - int meX; - int meY; - int meDelay; - LPTSTR meName; - } MoveEdit; -typedef MoveEdit * LPMOVEEDIT; - -typedef struct tagMA { - MoveEdit me[1]; - }MoveArray; -#define sizeof_MoveArray (sizeof(MoveArray)-sizeof(MoveEdit)) -typedef MoveArray * LPMOVEARRAY; - -typedef struct tagMT { - WORD mtNumber; // Number of movement - WORD mtMinSpeed; // maxs and min speed in the movements - WORD mtMaxSpeed; - BYTE mtLoop; // Loop at end - BYTE mtRepos; // Reposition at end - BYTE mtReverse; // Pingpong? - BYTE mtFree; - BYTE mtMoves[2]; // Start of movement definition - } MoveTaped; -typedef MoveTaped * LPMOVETAPED; - -// PLATFORM mouvement -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagMP { - WORD mpSpeed; // Max speed - WORD mpAcc; // Acceleration - WORD mpDec; // Deceleration - WORD mpJumpControl; // Bounce factor - WORD mpGravity; - WORD mpJump; - } MovePlatform; -typedef MovePlatform * LPMOVEPLATFORM; - -#define MPJC_NOJUMP 0 -#define MPJC_DIAGO 1 -#define MPJC_BUTTON1 2 -#define MPJC_BUTTON2 3 - -// Movement Extension structure -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct MoveExt { - CMvt* meMvt; // Object -} MoveExt; -typedef MoveExt * LPMOVEEXT; - -// Movement Structure -// ~~~~~~~~~~~~~~~~~~ -typedef struct MvtHdr { - DWORD mvhModuleNameOffset; - DWORD mvhID; - DWORD mvhDataOffset; - DWORD mvhDataSize; -} MvtHdr; - -typedef struct MovementTable -{ - DWORD mvtNMvt; // Number of movements - MvtHdr mvtHdr[1]; -} MovementTable; -typedef MovementTable * LPMVTTABLE; - -#define MVTOPT_8DIR_STICK 0x01 // Stick to obstacles (build 249, 8-direction mvt), allows the user to choose between behavior of b247 (avoid obstacles) and b248 (stick to obstacles) - -typedef struct tagMV { - WORD mvControl; // Who controls the object - WORD mvType; // Type of movement - BYTE mvMove; // Move at start? - BYTE mvOpt; // Options - BYTE mvFree1; - BYTE mvFree2; - DWORD mvDirAtStart; - union { - MoveMouse mm; - MoveGeneric mg; - MoveBall mb; - MoveTaped mt; - MoveRace mr; - MovePlatform mp; - MoveExt me; - } mu; -} Movement; -typedef Movement * LPMOVEMENT; - -#ifndef IN_KPX - -// COMMON CONDITIONS FOR NORMAL OBJECTS -////////////////////////////////////////// -#define EVENTS_EXTBASE 80 - -#define CND_EXTISSTRIKEOUT (-40<<8) -#define CND_EXTISUNDERLINE (-39<<8) -#define CND_EXTISITALIC (-38<<8) -#define CND_EXTISBOLD (-37<<8) -#define CND_EXTCMPVARSTRING (-36<<8) -#define CNDL_EXTCMPVARSTRING (-36<<16) -#define CND_EXTPATHNODENAME (-35<<8) -#define CNDL_EXTPATHNODENAME (-35<<16) -#define CND_EXTCHOOSE (-34<<8) -#define CND_EXTNOMOREOBJECT (-33<<8) -#define CNDL_EXTNOMOREOBJECT (-33<<16) -#define CND_EXTNUMOFOBJECT (-32<<8) -#define CND_EXTNOMOREZONE (-31<<8) -#define CND_EXTNUMBERZONE (-30<<8) -#define CND_EXTSHOWN (-29<<8) -#define CND_EXTHIDDEN (-28<<8) -#define CND_EXTCMPVAR (-27<<8) -#define CNDL_EXTCMPVAR (-27<<16) -#define CND_EXTCMPVARFIXED (-26<<8) -#define CND_EXTFLAGSET (-25<<8) -#define CND_EXTFLAGRESET (-24<<8) -#define CND_EXTISCOLBACK (-23<<8) -#define CND_EXTNEARBORDERS (-22<<8) -#define CND_EXTENDPATH (-21<<8) -#define CNDL_EXTENDPATH (-21<<16) -#define CND_EXTPATHNODE (-20<<8) -#define CNDL_EXTPATHNODE (-20<<16) -#define CND_EXTCMPACC (-19<<8) -#define CND_EXTCMPDEC (-18<<8) -#define CND_EXTCMPX (-17<<8) -#define CND_EXTCMPY (-16<<8) -#define CND_EXTCMPSPEED (-15<<8) -#define CND_EXTCOLLISION (-14<<8) -#define CNDL_EXTCOLLISION (-14<<16) -#define CND_EXTCOLBACK (-13<<8) -#define CNDL_EXTCOLBACK (-13<<16) -#define CND_EXTOUTPLAYFIELD (-12<<8) -#define CNDL_EXTOUTPLAYFIELD (-12<<16) -#define CND_EXTINPLAYFIELD (-11<<8) -#define CNDL_EXTINPLAYFIELD (-11<<16) -#define CND_EXTISOUT (-10<<8) -#define CNDL_EXTISOUT (-10<<16) -#define CND_EXTISIN (-9 <<8) -#define CNDL_EXTISIN (-9 <<16) -#define CND_EXTFACING (-8 <<8) -#define CND_EXTSTOPPED (-7 <<8) -#define CND_EXTBOUNCING (-6 <<8) -#define CND_EXTREVERSED (-5 <<8) -#define CND_EXTISCOLLIDING (-4 <<8) -#define CNDL_EXTISCOLLIDING (-4 <<16) -#define CND_EXTANIMPLAYING (-3 <<8) -#define CND_EXTANIMENDOF (-2 <<8) -#define CNDL_EXTANIMENDOF (-2 <<16) -#define CND_EXTCMPFRAME (-1 <<8) - -#define ACT_EXTSETPOS (1 <<8) -#define ACT_EXTSETX (2 <<8) -#define ACT_EXTSETY (3 <<8) -#define ACT_EXTSTOP (4 <<8) -#define ACTL_EXTSTOP (4 <<16) -#define ACT_EXTSTART (5 <<8) -#define ACT_EXTSPEED (6 <<8) -#define ACT_EXTMAXSPEED (7 <<8) -#define ACT_EXTWRAP (8 <<8) -#define ACTL_EXTWRAP (8 <<16) -#define ACT_EXTBOUNCE (9 <<8) -#define ACTL_EXTBOUNCE (9 <<16) -#define ACT_EXTREVERSE (10<<8) -#define ACT_EXTNEXTMOVE (11<<8) -#define ACT_EXTPREVMOVE (12<<8) -#define ACT_EXTSELMOVE (13<<8) -#define ACT_EXTLOOKAT (14<<8) -#define ACT_EXTSTOPANIM (15<<8) -#define ACT_EXTSTARTANIM (16<<8) -#define ACT_EXTFORCEANIM (17<<8) -#define ACT_EXTFORCEDIR (18<<8) -#define ACT_EXTFORCESPEED (19<<8) -#define ACTL_EXTFORCESPEED (19<<16) -#define ACT_EXTRESTANIM (20<<8) -#define ACT_EXTRESTDIR (21<<8) -#define ACT_EXTRESTSPEED (22<<8) -#define ACT_EXTSETDIR (23<<8) -#define ACT_EXTDESTROY (24<<8) -#define ACT_EXTSHUFFLE (25<<8) -#define ACTL_EXTSHUFFLE (25<<16) -#define ACT_EXTHIDE (26<<8) -#define ACT_EXTSHOW (27<<8) -#define ACT_EXTDISPLAYDURING (28<<8) -#define ACT_EXTSHOOT (29<<8) -#define ACTL_EXTSHOOT (29<<16) -#define ACT_EXTSHOOTTOWARD (30<<8) -#define ACTL_EXTSHOOTTOWARD (30<<16) -#define ACT_EXTSETVAR (31<<8) -#define ACTL_EXTSETVAR (31<<16) -#define ACT_EXTADDVAR (32<<8) -#define ACTL_EXTADDVAR (32<<16) -#define ACT_EXTSUBVAR (33<<8) -#define ACTL_EXTSUBVAR (33<<16) -#define ACT_EXTDISPATCHVAR (34<<8) -#define ACTL_EXTDISPATCHVAR (34<<16) -#define ACT_EXTSETFLAG (35<<8) -#define ACT_EXTCLRFLAG (36<<8) -#define ACT_EXTCHGFLAG (37<<8) -#define ACT_EXTINKEFFECT (38<<8) -#define ACT_EXTSETSEMITRANSPARENCY (39<<8) -#define ACT_EXTFORCEFRAME (40<<8) -#define ACT_EXTRESTFRAME (41<<8) -#define ACT_EXTSETACCELERATION (42<<8) -#define ACT_EXTSETDECELERATION (43<<8) -#define ACT_EXTSETROTATINGSPEED (44<<8) -#define ACT_EXTSETDIRECTIONS (45<<8) -#define ACT_EXTBRANCHNODE (46<<8) -#define ACT_EXTSETGRAVITY (47<<8) -#define ACT_EXTGOTONODE (48<<8) -#define ACT_EXTSETVARSTRING (49<<8) -#define ACTL_EXTSETVARSTRING (49<<16) -#define ACT_EXTSETFONTNAME (50<<8) -#define ACT_EXTSETFONTSIZE (51<<8) -#define ACT_EXTSETBOLD (52<<8) -#define ACT_EXTSETITALIC (53<<8) -#define ACT_EXTSETUNDERLINE (54<<8) -#define ACT_EXTSETSRIKEOUT (55<<8) -#define ACT_EXTSETTEXTCOLOR (56<<8) -#define ACT_EXTSPRFRONT (57<<8) -#define ACT_EXTSPRBACK (58<<8) -#define ACT_EXTMOVEBEFORE (59<<8) -#define ACT_EXTMOVEAFTER (60<<8) -#define ACT_EXTMOVETOLAYER (61<<8) -#define ACT_EXTADDTODEBUGGER (62<<8) -#define ACT_EXTSETEFFECT (63<<8) -#define ACT_EXTSETEFFECTPARAM (64<<8) -#define ACT_EXTSETALPHACOEF (65<<8) -#define ACT_EXTSETRGBCOEF (66<<8) -#define ACT_EXTSETEFFECTPARAMTEXTURE (67<<8) - -#define EXP_EXTYSPR ( 1<<8) -#define EXP_EXTISPR ( 2<<8) -#define EXP_EXTSPEED ( 3<<8) -#define EXP_EXTACC ( 4<<8) -#define EXP_EXTDEC ( 5<<8) -#define EXP_EXTDIR ( 6<<8) -#define EXP_EXTXLEFT ( 7<<8) -#define EXP_EXTXRIGHT ( 8<<8) -#define EXP_EXTYTOP ( 9<<8) -#define EXP_EXTYBOTTOM (10<<8) -#define EXP_EXTXSPR (11<<8) -#define EXP_EXTIDENTIFIER (12<<8) -#define EXP_EXTFLAG (13<<8) -#define EXP_EXTNANI (14<<8) -#define EXP_EXTNOBJECTS (15<<8) -#define EXP_EXTVAR (16<<8) -#define EXPL_EXTVAR (16<<16) -#define EXP_EXTGETSEMITRANSPARENCY (17<<8) -#define EXP_EXTNMOVE (18<<8) -#define EXP_EXTVARSTRING (19<<8) -#define EXPL_EXTVARSTRING (19<<16) -#define EXP_EXTGETFONTNAME (20<<8) -#define EXP_EXTGETFONTSIZE (21<<8) -#define EXP_EXTGETFONTCOLOR (22<<8) -#define EXP_EXTGETLAYER (23<<8) -#define EXP_EXTGETGRAVITY (24<<8) -#define EXP_EXTXAP (25<<8) -#define EXP_EXTYAP (26<<8) -#define EXP_EXTALPHACOEF (27<<8) -#define EXP_EXTRGBCOEF (28<<8) -#define EXP_EXTEFFECTPARAM (29<<8) -#define EXP_EXTVARBYINDEX (30<<8) -#define EXP_EXTVARSTRINGBYINDEX (31<<8) - -// TEXT Conditions / Actions -//////////////////////////////////////////// -#define ACT_STRDESTROY (( (EVENTS_EXTBASE+0)<<8)|3) -#define ACT_STRDISPLAY (( (EVENTS_EXTBASE+1)<<8)|3) -#define ACT_STRDISPLAYDURING (( (EVENTS_EXTBASE+2)<<8)|3) -#define ACT_STRSETCOLOUR (( (EVENTS_EXTBASE+3)<<8)|3) -#define ACT_STRSET (( (EVENTS_EXTBASE+4)<<8)|3) -#define ACT_STRPREV (( (EVENTS_EXTBASE+5)<<8)|3) -#define ACT_STRNEXT (( (EVENTS_EXTBASE+6)<<8)|3) -#define ACT_STRDISPLAYSTRING (( (EVENTS_EXTBASE+7)<<8)|3) -#define ACT_STRSETSTRING (( (EVENTS_EXTBASE+8)<<8)|3) -#define EXP_STRNUMBER (( (EVENTS_EXTBASE+0)<<8)|3) -#define EXP_STRGETCURRENT (( (EVENTS_EXTBASE+1)<<8)|3) -#define EXP_STRGETNUMBER (( (EVENTS_EXTBASE+2)<<8)|3) -#define EXP_STRGETNUMERIC (( (EVENTS_EXTBASE+3)<<8)|3) -#define EXP_STRGETNPARA (( (EVENTS_EXTBASE+4)<<8)|3) - -// SPRITES Conditions / Actions -///////////////////////////////////////////// -#define CND_SPRCLICK (((-EVENTS_EXTBASE-1)<<8)|2) -#define ACT_SPRPASTE (((EVENTS_EXTBASE+0)<<8)|2) -#define ACT_SPRFRONT (((EVENTS_EXTBASE+1)<<8)|2) -#define ACT_SPRBACK (((EVENTS_EXTBASE+2)<<8)|2) -#define ACT_SPRADDBKD (((EVENTS_EXTBASE+3)<<8)|2) -#define ACT_SPRREPLACECOLOR (((EVENTS_EXTBASE+4)<<8)|2) -#define ACT_SPRSETSCALE (((EVENTS_EXTBASE+5)<<8)|2) -#define ACT_SPRSETSCALEX (((EVENTS_EXTBASE+6)<<8)|2) -#define ACT_SPRSETSCALEY (((EVENTS_EXTBASE+7)<<8)|2) -#define ACT_SPRSETANGLE (((EVENTS_EXTBASE+8)<<8)|2) -#define ACT_SPRLOADFRAME (((EVENTS_EXTBASE+9)<<8)|2) -#define ACTL_SPRLOADFRAME (((EVENTS_EXTBASE+9)<<16)|2) -#define EXP_GETRGBAT (((EVENTS_EXTBASE+0)<<8)|2) -#define EXP_GETSCALEX (((EVENTS_EXTBASE+1)<<8)|2) -#define EXP_GETSCALEY (((EVENTS_EXTBASE+2)<<8)|2) -#define EXP_GETANGLE (((EVENTS_EXTBASE+3)<<8)|2) - -// COUNTERS Conditions / Actions -////////////////////////////////////////////// -#define CND_CCOUNTER (((-EVENTS_EXTBASE-1)<<8)|7) -#define ACT_CSETVALUE (( (EVENTS_EXTBASE+0)<<8)|7) -#define ACT_CADDVALUE (( (EVENTS_EXTBASE+1)<<8)|7) -#define ACT_CSUBVALUE (( (EVENTS_EXTBASE+2)<<8)|7) -#define ACT_CSETMIN (( (EVENTS_EXTBASE+3)<<8)|7) -#define ACT_CSETMAX (( (EVENTS_EXTBASE+4)<<8)|7) -#define ACT_CSETCOLOR1 (( (EVENTS_EXTBASE+5)<<8)|7) -#define ACT_CSETCOLOR2 (( (EVENTS_EXTBASE+6)<<8)|7) -#define EXP_CVALUE (( (EVENTS_EXTBASE+0)<<8)|7) -#define EXP_CGETMIN (( (EVENTS_EXTBASE+1)<<8)|7) -#define EXP_CGETMAX (( (EVENTS_EXTBASE+2)<<8)|7) -#define EXP_CGETCOLOR1 (( (EVENTS_EXTBASE+3)<<8)|7) -#define EXP_CGETCOLOR2 (( (EVENTS_EXTBASE+4)<<8)|7) - -// QUESTIONS Conditions / Actions -/////////////////////////////////////////////// -#define CND_QEQUAL (((-EVENTS_EXTBASE-3)<<8)|4) -#define CNDL_QEQUAL (((-EVENTS_EXTBASE-3)<<16)|4) -#define CND_QFALSE (((-EVENTS_EXTBASE-2)<<8)|4) -#define CNDL_QFALSE (((-EVENTS_EXTBASE-2)<<16)|4) -#define CND_QEXACT (((-EVENTS_EXTBASE-1)<<8)|4) -#define CNDL_QEXACT (((-EVENTS_EXTBASE-1)<<16)|4) -#define ACT_QASK (( (EVENTS_EXTBASE+0)<<8)|4) - - -// Formatted text Conditions / actions / expressions -////////////////////////////////////////////////////////////////// -#define ACT_RTFSETXPOS (((EVENTS_EXTBASE+0)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSETYPOS (((EVENTS_EXTBASE+1)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSETZOOM (((EVENTS_EXTBASE+2)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_CLEAR (((EVENTS_EXTBASE+3)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_WORDSTRONCE (((EVENTS_EXTBASE+4)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_WORDSTRNEXT (((EVENTS_EXTBASE+5)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_WORDSTRALL (((EVENTS_EXTBASE+6)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_WORD (((EVENTS_EXTBASE+7)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_LINE (((EVENTS_EXTBASE+8)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_PARAGRAPH (((EVENTS_EXTBASE+9)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_PAGE (((EVENTS_EXTBASE+10)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_ALL (((EVENTS_EXTBASE+11)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_RANGE (((EVENTS_EXTBASE+12)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSELECT_BOOKMARK (((EVENTS_EXTBASE+13)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSETFOCUSWORD (((EVENTS_EXTBASE+14)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHT_OFF (((EVENTS_EXTBASE+15)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTTEXT_COLOR (((EVENTS_EXTBASE+16)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTTEXT_BOLD (((EVENTS_EXTBASE+17)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTTEXT_ITALIC (((EVENTS_EXTBASE+18)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTTEXT_UNDERL (((EVENTS_EXTBASE+19)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTTEXT_OUTL (((EVENTS_EXTBASE+20)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTBACK_COLOR (((EVENTS_EXTBASE+21)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTBACK_RECT (((EVENTS_EXTBASE+22)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTBACK_MARKER (((EVENTS_EXTBASE+23)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTBACK_HATCH (((EVENTS_EXTBASE+24)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFHLIGHTBACK_INVERSE (((EVENTS_EXTBASE+25)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFDISPLAY (((EVENTS_EXTBASE+26)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSETFOCUSPREV (((EVENTS_EXTBASE+27)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFSETFOCUSNEXT (((EVENTS_EXTBASE+28)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFREMOVEFOCUS (((EVENTS_EXTBASE+29)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFAUTOON (((EVENTS_EXTBASE+30)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFAUTOOFF (((EVENTS_EXTBASE+31)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFINSERTSTRING (((EVENTS_EXTBASE+32)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFLOADTEXT (((EVENTS_EXTBASE+33)<<8)|(OBJ_RTF&0x00FF)) -#define ACT_RTFINSERTTEXT (((EVENTS_EXTBASE+34)<<8)|(OBJ_RTF&0x00FF)) - - -#define EXP_RTFXPOS (((EVENTS_EXTBASE+0)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFYPOS (((EVENTS_EXTBASE+1)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFSXPAGE (((EVENTS_EXTBASE+2)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFSYPAGE (((EVENTS_EXTBASE+3)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFZOOM (((EVENTS_EXTBASE+4)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFWORDMOUSE (((EVENTS_EXTBASE+5)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFWORDXY (((EVENTS_EXTBASE+6)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFWORD (((EVENTS_EXTBASE+7)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFXWORD (((EVENTS_EXTBASE+8)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFYWORD (((EVENTS_EXTBASE+9)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFSXWORD (((EVENTS_EXTBASE+10)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFSYWORD (((EVENTS_EXTBASE+11)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFLINEMOUSE (((EVENTS_EXTBASE+12)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFLINEXY (((EVENTS_EXTBASE+13)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFXLINE (((EVENTS_EXTBASE+14)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFYLINE (((EVENTS_EXTBASE+15)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFSXLINE (((EVENTS_EXTBASE+16)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFSYLINE (((EVENTS_EXTBASE+17)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFPARAMOUSE (((EVENTS_EXTBASE+18)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFPARAXY (((EVENTS_EXTBASE+19)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFXPARA (((EVENTS_EXTBASE+20)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFYPARA (((EVENTS_EXTBASE+21)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFSXPARA (((EVENTS_EXTBASE+22)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFSYPARA (((EVENTS_EXTBASE+23)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFXWORDTEXT (((EVENTS_EXTBASE+24)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFYWORDTEXT (((EVENTS_EXTBASE+25)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFXLINETEXT (((EVENTS_EXTBASE+26)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFYLINETEXT (((EVENTS_EXTBASE+27)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFXPARATEXT (((EVENTS_EXTBASE+28)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFYPARATEXT (((EVENTS_EXTBASE+29)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFMEMSIZE (((EVENTS_EXTBASE+30)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFGETFOCUSWORD (((EVENTS_EXTBASE+31)<<8)|(OBJ_RTF&0x00FF)) -#define EXP_RTFGETHYPERLINK (((EVENTS_EXTBASE+32)<<8)|(OBJ_RTF&0x00FF)) - -#define CND_CCAISPAUSED (((-EVENTS_EXTBASE-4)<<8)|(OBJ_CCA&0x00FF)) -#define CND_CCAISVISIBLE (((-EVENTS_EXTBASE-3)<<8)|(OBJ_CCA&0x00FF)) -#define CND_CCAAPPFINISHED (((-EVENTS_EXTBASE-2)<<8)|(OBJ_CCA&0x00FF)) -#define CNDL_CCAAPPFINISHED (((-EVENTS_EXTBASE-2)<<16)|(OBJ_CCA&0xFFFF)) -#define CND_CCAFRAMECHANGED (((-EVENTS_EXTBASE-1)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCARESTARTAPP (((EVENTS_EXTBASE+0)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCARESTARTFRAME (((EVENTS_EXTBASE+1)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCANEXTFRAME (((EVENTS_EXTBASE+2)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCAPREVIOUSFRAME (((EVENTS_EXTBASE+3)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCAENDAPP (((EVENTS_EXTBASE+4)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCANEWAPP (((EVENTS_EXTBASE+5)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCAJUMPFRAME (((EVENTS_EXTBASE+6)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCASETGLOBALVALUE (((EVENTS_EXTBASE+7)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCASHOW (((EVENTS_EXTBASE+8)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCAHIDE (((EVENTS_EXTBASE+9)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCASETGLOBALSTRING (((EVENTS_EXTBASE+10)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCAPAUSEAPP (((EVENTS_EXTBASE+11)<<8)|(OBJ_CCA&0x00FF)) -#define ACT_CCARESUMEAPP (((EVENTS_EXTBASE+12)<<8)|(OBJ_CCA&0x00FF)) -#define EXP_CCAGETFRAMENUMBER (((EVENTS_EXTBASE+0)<<8)|(OBJ_CCA&0x00FF)) -#define EXP_CCAGETGLOBALVALUE (((EVENTS_EXTBASE+1)<<8)|(OBJ_CCA&0x00FF)) -#define EXP_CCAGETGLOBALSTRING (((EVENTS_EXTBASE+2)<<8)|(OBJ_CCA&0x00FF)) - -#endif // IN_KPX - -/////////////////////////////////////////////////////////////////////// -// -// DEFINITION OF THE DIFFERENT PARAMETERS -// -/////////////////////////////////////////////////////////////////////// - -// -------------------------------- Objects -// W-Offset list OI -// W-Number -// W-TYPE *** Version > FVERSION_NEWOBJECTS -#define PARAM_OBJECT 1 -#define PS_OBJ 6 - -// -------------------------------- Time -// L-Timer -// L-Equivalent loops -#define PARAM_TIME 2 -#define PS_TIM 8 - -// -------------------------------- Border -// W-border -#define PARAM_BORDER 3 -#define PS_BOR 2 -#define BORDER_LEFT 1 -#define BORDER_RIGHT 2 -#define BORDER_TOP 4 -#define BORDER_BOTTOM 8 -#define BORDER_ALL 15 - -// -------------------------------- Direction -// W-direction -#define PARAM_DIRECTION 4 -#define PS_DIR 2 - -// -------------------------------- Integer -// W-shorteger (or base) -// W-nothing (or maximum) -#define PARAM_INTEGER 5 -#define PS_INT 4 - -// -------------------------------- Sample -#define MAX_SOUNDNAME 64 -#define PSOUNDFLAG_UNINTERRUPTABLE 0x0001 -#define PSOUNDFLAG_BAD 0x0002 -#define PSOUNDFLAG_IPHONE_AUDIOPLAYER 0x0004 -#define PSOUNDFLAG_IPHONE_OPENAL 0x0008 - -typedef struct tagSSNDA { - short sndHandle; - short sndFlags; - char sndName[MAX_SOUNDNAME]; - } SoundParamA; -typedef struct tagSSNDW { - short sndHandle; - short sndFlags; - WCHAR sndName[MAX_SOUNDNAME]; - } SoundParamW; -typedef SoundParamA * LPSNDA; -typedef SoundParamW * LPSNDW; - -#define PARAM_SAMPLE 6 -#ifdef _UNICODE -#define PS_SAM sizeof(SoundParamW) -#define LPSND LPSNDW -#else -#define PS_SAM sizeof(SoundParamA) -#define LPSND LPSNDA -#endif - -// -------------------------------- Music -#define PARAM_MUSIC 7 -#ifdef _UNICODE -#define PS_MUS sizeof(SoundParamW) -#else -#define PS_MUS sizeof(SoundParamA) -#endif - - -// POSITION PARAM Structure -// ~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagPPA { - short posOINUMParent; //0 - short posFlags; - short posX; //4 - short posY; - short posSlope; //8 - short posAngle; - long posDir; //12 - ITEMTYPE posTypeParent; //16 - short posOiList; //18 - short posLayer; //20 - } PositionParam; -typedef PositionParam * LPPOS; - -// CREATE PARAM Structure -// ~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagCDP { - PositionParam cdpPos; // Position structure - HFII cdpHFII; // FrameItemInstance number - OINUM cdpOi; // OI of the object to create -// DWORD cdpFII; - DWORD cdpFree; - } CreateDuplicateParam; -typedef CreateDuplicateParam * LPCDP; - -// SHOOT PARAM Structure, should be identical to CREATE PARAM ! -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagSHT { - CreateDuplicateParam shtCdp; - short shtSpeed; // Speed - } ShootParam; -typedef ShootParam * LPSHT; - -#define CPF_DIRECTION 0x0001 -#define CPF_ACTION 0x0002 -#define CPF_INITIALDIR 0x0004 -#define CPF_DEFAULTDIR 0x0008 - - -// -------------------------------- Create -#define PARAM_CREATE 9 -#define PS_CRE sizeof(CreateDuplicateParam) - -// -------------------------------- Animation -// W-Number -// B-Name -#define PARAM_ANIMATION 10 -#define PS_ANI 32 - -// -------------------------------- Nothing -// W- -#define PARAM_NOP 11 -#define PS_NOP 2 - -// -------------------------------- Player -// W- -#define PARAM_PLAYER 12 -#define PS_PLA 2 - -// -------------------------------- Every -// L-delay -// L-compteur -#define PARAM_EVERY 13 -#define PS_EVE 8 - -// -------------------------------- Virtual Key -// W- VK_Code -#define PARAM_KEY 14 -#define PS_KEY 2 - -// -------------------------------- Speed= integer -// Expression -#define PARAM_SPEED 15 - -// -------------------------------- Position -// W- Direction -#define PARAM_POSITION 16 -#define PS_POS sizeof(PositionParam) - -// -------------------------------- Joystick Direcion -// W- Direction -#define PARAM_JOYDIRECTION 17 -#define PS_JOY 2 - -// -------------------------------- Shoot param - -#define PARAM_SHOOT 18 -#define PS_SHT sizeof(ShootParam) - -// -------------------------------- Playfield Zone -#define PARAM_ZONE 19 -#define PS_ZNE 8 - -// -------------------------------- System object position -// W- Direction -#define PARAM_SYSCREATE 21 -#define PS_SSC sizeof(CreateDuplicateParam) - -// -------------------------------- Expression -// W0- Id parametre originel -// W1- 0 (au moins!) -#define PARAM_EXPRESSION 22 -#define PS_EXP 14 - -// -------------------------------- Comparaison -// W0- Id comparaison -// W1- 0 (au moins!) -#define PARAM_COMPARAISON 23 - -// -------------------------------- Text color -// L0- RGB -// L0- Identificateur! -#define PARAM_COLOUR 24 -#define PS_COL 8 - -// -------------------------------- Work buffer -// L0- -#define PARAM_BUFFER4 25 -#define PS_BU4 4 - -// -------------------------------- Storyboard frame number -// W0- -#define PARAM_FRAME 26 -#define PS_FRA 2 - -// -------------------------------- Number of loops for a sample -#define PARAM_SAMLOOP 27 -#define PS_SLOOP 2 -// -------------------------------- Number of loops for a music -#define PARAM_MUSLOOP 28 -#define PS_MLOOP 2 -// -------------------------------- Direction -#define PARAM_NEWDIRECTION 29 -#define PS_NDIR 4 - -// -------------------------------- Text number -#define PARAM_TEXTNUMBER 31 -#define PS_TXN 4 - -// -------------------------------- Click definition -#define PARAM_CLICK 32 -#define PS_KLK 4 -#define PARAMCLICK_MASK 0x00FF -#define PARAMCLICK_DOUBLE 0x0100 - -// -------------------------------- External program -#define PARAM_PROGRAM 33 -typedef struct tagPRGA { - short prgFlags; // Default flags - char prgPath[_MAX_PATH]; // Name of the program - char prgCommand[108]; // Command line - } prgParamA; -typedef prgParamA * LPPRGA; -typedef struct tagPRGW { - short prgFlags; // Default flags - WCHAR prgPath[_MAX_PATH]; // Name of the program - WCHAR prgCommand[108]; // Command line - } prgParamW; -typedef prgParamW * LPPRGW; -#define PS_PRGA sizeof(prgParamA) -#define PS_PRGW sizeof(prgParamW) -#ifdef _UNICODE -#define prgParam prgParamW -#define PS_PRG sizeof(prgParamW) -#define LPPRG LPPRGW -#else -#define prgParam prgParamA -#define PS_PRG sizeof(prgParamA) -#define LPPRG LPPRGA -#endif - -#define PRGFLAGS_WAIT 0x0001 -#define PRGFLAGS_HIDE 0x0002 - -// -------------------------------- Global variable number -#define OLDPARAM_VARGLO 34 -//#define PS_VGLO 4 - -// -------------------------------- Condition sample (no flags) -// W-Number -// W-Flags -// W-Loops -// B-Name -#define PARAM_CNDSAMPLE 35 -// -------------------------------- Condition Music (no flags) -// W-Number -// W-Flags -// W-Loops -// B-Name -#define PARAM_CNDMUSIC 36 -// -------------------------------- Event editor remark -#define PARAM_REMARK 37 -typedef struct tagREMA { - LOGFONTV1A remLogFont; // Font - COLORREF remColorFont; // Text color - COLORREF remColorBack; // Background color - short remAlign; // Alignement flags - WORD remTextId; // Text number in the buffer - char remStyle[40]; // Style - } paramRemarkA; -typedef paramRemarkA* LPRMKA; -typedef struct tagREMW { - LOGFONTV1W remLogFont; // Font - COLORREF remColorFont; // Text color - COLORREF remColorBack; // Background color - short remAlign; // Alignement flags - WORD remTextId; // Text number in the buffer - WCHAR remStyle[40]; // Style - } paramRemarkW; -typedef paramRemarkW* LPRMKW; -#ifdef _UNICODE -#define PS_REM sizeof(paramRemarkW) -#define LPRMK LPRMKW -#else -#define PS_REM sizeof(paramRemarkA) -#define LPRMK LPRMKA -#endif - -// -------------------------------- Group title -#define PARAM_GROUP 38 -#define GROUP_MAXTITLE 80 -#define GROUP_MAXPASSWORD 16 -typedef struct tagGRPW { - short grpFlags; // Active / Unactive? - short grpId; // Group identifier - WCHAR grpTitle[GROUP_MAXTITLE]; // Title - WCHAR grpPassword[GROUP_MAXPASSWORD]; // Protection - DWORD grpChecksum; // Checksum - } paramGroupW; -typedef paramGroupW* LPGRPW; -typedef struct tagGRPA { - short grpFlags; // Active / Unactive? - short grpId; // Group identifier - char grpTitle[GROUP_MAXTITLE]; // Title - char grpPassword[GROUP_MAXPASSWORD]; // Protection - DWORD grpChecksum; // Checksum - } paramGroupA; -typedef paramGroupA* LPGRPA; -typedef struct tagOLDGRP { - short grpFlags; - short grpId; - char grpTitle[GROUP_MAXTITLE]; - } paramGroupV0; -#define PS_GRPA sizeof(paramGroupA) -#define PS_GRPW sizeof(paramGroupW) -#ifdef _UNICODE -#define PS_GRP sizeof(paramGroupW) -#define LPGRP LPGRPW -#define GETEVPGRP(evpPtr) (LPGRPW)&evpPtr->evpW.evpW0 -#else -#define PS_GRP sizeof(paramGroupA) -#define LPGRP LPGRPA -#define GETEVPGRP(evpPtr) (LPGRPA)&evpPtr->evpW.evpW0 -#endif - -#define GRPFLAGS_INACTIVE 0x0001 -#define GRPFLAGS_CLOSED 0x0002 -#define GRPFLAGS_PARENTINACTIVE 0x0004 -#define GRPFLAGS_GROUPINACTIVE 0x0008 -#define GRPFLAGS_UNICODE 0x0010 -//#define GRPFLAGS_FADEIN 0x0004 -//#define GRPFLAGS_FADEOUT 0x0008 -#define GRPFLAGS_GLOBAL 0x0010 -// Pour l'assemblage -typedef struct tagGRPLIST { - DWORD glEvg; - short glId; - } groupList; -typedef groupList * LPGL; - -// -------------------------------- A pointer to a group -#define PARAM_GROUPOINTER 39 -#define PS_GPT 6 -// L - Offset dans programme -// W - Identifier - -// -------------------------------- A pointner to a filename -#define PARAM_FILENAME 40 -#define PS_FILEN _MAX_PATH -// B nom de fichier... - -// -------------------------------- String pointer -#define PARAM_STRING 41 -#define PS_STR 2 -// B string - -// -------------------------------- Time -// L-Timer -// L-Loops -// W-Comparaison -#define PARAM_CMPTIME 42 -#define PS_CTIM 10 - -// --------------------------------- PASTE SPRITE -// W- Flags -// W- Security -#define PARAM_PASTE 43 -#define PS_PASTE 4 - -// -------------------------------- MOUSEKEY VIRTUAL -// W- VK_Code -#define PARAM_VMKEY 44 -#define PS_VMKEY 2 - -// -------------------------------- String expression -// W0- Id original parameter -// W1- 0 (at least!) -#define PARAM_EXPSTRING 45 - -// -------------------------------- String comparaison -// W0- Id comparaison -// W1- 0 (at least!) -#define PARAM_CMPSTRING 46 - -// -------------------------------- Ink effect -// W0- Id effect -// W1- Effet parameter -// L1- Free -#define PARAM_INKEFFECT 47 -#define PS_INK 8 - -// -------------------------------- Menu -// L0- Identifier -// L1- Security -#define PARAM_MENU 48 -#define PS_MENU 8 - -// Access to named variables -#define PARAM_VARGLOBAL 49 -#define PS_VARGLOBAL 4 -#define PARAM_ALTVALUE 50 -#define PS_ALTVALUE 4 -#define PARAM_FLAG 51 -#define PS_FLAG 4 - -// With expressions -#define PARAM_VARGLOBAL_EXP 52 -#define PS_VARGLOBAL_EXP PS_EXP -#define PARAM_ALTVALUE_EXP 53 -#define PS_ALTVALUE_EXP PS_EXP -#define PARAM_FLAG_EXP 54 -#define PS_FLAG_EXP PS_EXP - -// -------------------------------- Extensions parameters -#define PARAM_EXTENSION 55 -#define PARAM_EXTMAXSIZE 512 -typedef struct -{ - short pextSize; - short pextType; - short pextCode; - char pextData[2]; -} paramExt; -#define PARAM_EXTSIZE 12 -#define PARAM_EXTBASE 1000 - -// -------------------------------- Direction -#define PARAM_8DIRECTIONS 56 -#define PS_8DIR 4 - -// -------------------------------- Movement number -#define MAX_MVTNAME 32 -typedef struct tagMvtParamA { - short mvtNumber; - char mvtName[MAX_MVTNAME]; - } MvtParamA; -typedef MvtParamA * LPMVTPA; -typedef struct tagMvtParamW { - short mvtNumber; - WCHAR mvtName[MAX_MVTNAME]; - } MvtParamW; -typedef MvtParamW * LPMVTPW; - -#define PARAM_MVT 57 -#ifdef _UNICODE -#define PS_MVT sizeof(MvtParamW) -#define LPMVTP LPMVTPW -#else -#define PS_MVT sizeof(MvtParamA) -#define LPMVTP LPMVTPA -#endif - -// Access to renamed variables -#define PARAM_STRINGGLOBAL 58 -#define PS_STRINGGLOBAL 4 -#define PARAM_STRINGGLOBAL_EXP 59 -#define PS_STRINGGLOBAL_EXP PS_EXP - -// -------------------------------- External program II -#define PARAM_PROGRAM2 60 -typedef struct tagPRG2 { - short prgFlags; // Default flags - } prgParam2; -typedef prgParam2 * LPPRG2; -#define PS_PRG2 sizeof(prgParam2) - -// -------------------------------- Alterable strings -#define PARAM_ALTSTRING 61 -#define PS_ALTSTRING 4 -#define PARAM_ALTSTRING_EXP 62 -#define PS_ALTSTRING_EXP PS_EXP - -// -------------------------------- A pointer to a filename, version 2 -#define PARAM_FILENAME2 63 -#define PS_FILEN _MAX_PATH -// B nom de fichier... - -// -------------------------------- The name of an effect -#define PARAM_EFFECT 64 -#define PS_EFFECT 2 -// B name of the effect - - -// STRUCTURE FOR FAST LOOPS -/////////////////////////////////////////////////////////////////////// -typedef struct tagFL -{ - LPTSTR next; - TCHAR name[64]; - WORD flags; - long index; -} FastLoop; -typedef FastLoop * LPFL; - -#define MAX_FASTLOOPNAME 64 -#define FLFLAG_STOP 0x0001 - -/////////////////////////////////////////////////////////////// -// -// DEBUGGER -// -/////////////////////////////////////////////////////////////// -#define DBCOMMAND_RUNNING 0 -#define DBCOMMAND_TORUN 1 -#define DBCOMMAND_PAUSE 2 -#define DBCOMMAND_TOPAUSE 3 -#define DBCOMMAND_STEP 4 - -// TREE identification -enum -{ - DBTYPE_SYSTEM, - DBTYPE_OBJECT, - DBTYPE_HO, - DBTYPE_MOVEMENT, - DBTYPE_ANIMATION, - DBTYPE_VALUES, - DBTYPE_COUNTER, - DBTYPE_SCORE, - DBTYPE_LIVES, - DBTYPE_TEXT, - DBTYPE_EXTENSION -}; - -// Genric entries in the tree -enum -{ - DB_END=0xFFFF, - DB_PARENT=0x8000 -}; -#define DB_EDITABLE 0x80 - -// Communication buffer size -#define DB_BUFFERSIZE 256 - -#define DB_MAXGLOBALVALUES 1000 // Maximum number of global values displayed in the debugger -#define DB_MAXGLOBALSTRINGS 1000 - -// System tree entries -enum -{ - DB_SYSTEM, - DB_TIMER, - DB_FPS, - DB_FRAMENUMBER, - DB_GLOBALVALUE, - DB_GLOBALSTRING, - DB_GVALUE, - DB_GSTRING, -}; -// Headerobject tree entries -enum -{ - DB_XY, - DB_SIZE -}; - -// Movements tree entries -enum -{ - DB_MOVEMENTS, - DB_MVTTYPE, - DB_SPEED, - DB_DIRECTION, - DB_ACCELERATION, - DB_DECELERATION -}; - -// Animations tree entries -enum -{ - DB_ANIMATIONS, - DB_ANIMNAME, - DB_FRAME -}; - -// Values tree entries -enum -{ - DB_VALUE, - DB_VALUE0, - DB_VALUE1, - DB_VALUE2, - DB_VALUE3, - DB_VALUE4, - DB_VALUE5, - DB_VALUE6, - DB_VALUE7, - DB_VALUE8, - DB_VALUE9, - DB_VALUE10, - DB_VALUE11, - DB_VALUE12, - DB_VALUE13, - DB_VALUE14, - DB_VALUE15, - DB_VALUE16, - DB_VALUE17, - DB_VALUE18, - DB_VALUE19, - DB_VALUE20, - DB_VALUE21, - DB_VALUE22, - DB_VALUE23, - DB_VALUE24, - DB_VALUE25, - DB_ALTSTRING, - DB_ALTSTRING0, - DB_ALTSTRING1, - DB_ALTSTRING2, - DB_ALTSTRING3, - DB_ALTSTRING4, - DB_ALTSTRING5, - DB_ALTSTRING6, - DB_ALTSTRING7, - DB_ALTSTRING8, - DB_ALTSTRING9, - DB_FLAGS, - DB_FLAG0, - DB_FLAG1, - DB_FLAG2, - DB_FLAG3, - DB_FLAG4, - DB_FLAG5, - DB_FLAG6, - DB_FLAG7, - DB_FLAG8, - DB_FLAG9, - DB_FLAG10, - DB_FLAG11, - DB_FLAG12, - DB_FLAG13, - DB_FLAG14, - DB_FLAG15, - DB_FLAG16, - DB_FLAG17, - DB_FLAG18, - DB_FLAG19, - DB_FLAG20, - DB_FLAG21, - DB_FLAG22, - DB_FLAG23, - DB_FLAG24, - DB_FLAG25, - DB_FLAG26, - DB_FLAG27, - DB_FLAG28, - DB_FLAG29, - DB_FLAG30, - DB_FLAG31 -}; -enum -{ - DB_COUNTERVALUE, - DB_COUNTERMIN, - DB_COUNTERMAX -}; -enum -{ - DB_SCOREVALUE -}; -enum -{ - DB_LIVESVALUE -}; -enum -{ - DB_TEXTVALUE -}; - -#define GETDBPARAMTYPE(a) ((a&0xFF000000)>>24) -#define GETDBPARAMID(a) ((a&0x00FFFF00)>>8) -#define GETDBPARAMCOMMAND(a) (a&0x000000FF) -#define GETDBPARAM(a, b, c) ((a&0xFF)<<24)|((b&0xFFFF)<<8)|(c&0xFF) - -typedef struct -{ - LPSTR pTitle; - int value; - LPSTR pText; - int lText; -} EditDebugInfoA; - -typedef struct -{ - LPWSTR pTitle; - int value; - LPWSTR pText; - int lText; -} EditDebugInfoW; - -#ifdef _UNICODE -#define EditDebugInfo EditDebugInfoW -#else -#define EditDebugInfo EditDebugInfoA -#endif - -/////////////////////////////////////////////////////////////////////// -// -// RUNTIME BUFFER -// -/////////////////////////////////////////////////////////////////////// - -//Modes de demo -enum -{ - DEMONOTHING, - DEMORECORD, - DEMOPLAY, -}; - -typedef void (*ACTIONENDROUTINE)(); - -typedef void (*OBLROUTINE)(headerObject*); -typedef struct tagOBL { - headerObject* oblOffset; - OBLROUTINE oblRoutine; - } objectsList; -typedef objectsList * LPOBL; - -#define GAMEBUFFERS_SIZE (12*1024) -#define GAME_MAXOBJECTS 266 -#define OBJECT_MAX 128L -#define OBJECT_SIZE 256L -#define OBJECT_SHIFT 8 -#define MAX_INTERMEDIATERESULTS 256 -#define STEP_TEMPSTRINGS 64 - -typedef struct tagRH2 { - DWORD rh2OldPlayer; // Previous player entries - DWORD rh2NewPlayer; // Modified player entries - DWORD rh2InputMask; // Inhibated players entries - DWORD rh2InputPlayers; // Valid players entries (mask!) - BYTE rh2MouseKeys; // Mousekey entries - BYTE rh2ActionLoop; // Actions flag - BYTE rh2ActionOn; // Flag are we in actions? - BYTE rh2EnablePick; // Are we in pick for actions? - - int rh2EventCount; // Number of the event - qualToOi* rh2EventQualPos; // ***Position in event objects - headerObject* rh2EventPos; // ***Position in event objects - objInfoList* rh2EventPosOiList; // ***Position in oilist for TYPE exploration - objInfoList* rh2EventPrev; // ***Previous object address - - pev* rh2PushedEvents; // *** - LPBYTE rh2PushedEventsTop; // *** - LPBYTE rh2PushedEventsMax; // *** - int rh2NewPushedEvents; // - - int rh2ActionCount; // Action counter - int rh2ActionLoopCount; // Action loops counter - ACTIONENDROUTINE rh2ActionEndRoutine; // End of action routine - WORD rh2CreationCount; // Number of objects created since beginning of frame - short rh2EventType; - POINT rh2Mouse; // Mouse coordinate - POINT rh2MouseClient; // Mouse coordinates in the window - short rh2CurrentClick; // For click events II - short rh2Free2; - headerObject** rh2ShuffleBuffer; // *** - headerObject** rh2ShufflePos; // *** - int rh2ShuffleNumber; - - POINT rh2MouseSave; // Mouse saving when pause - int rh2PauseCompteur; - DWORD rh2PauseTimer; - UINT rh2PauseVbl; - FARPROC rh2LoopTraceProc; // Debugging routine - FARPROC rh2EventTraceProc; - - } runHeader2; - - -// Flags pour rh3Scrolling -#define RH3SCROLLING_SCROLL 0x0001 -#define RH3SCROLLING_REDRAWLAYERS 0x0002 -#define RH3SCROLLING_REDRAWALL 0x0004 -#define RH3SCROLLING_REDRAWTOTALCOLMASK 0x0008 - -#define GAME_XBORDER 480 -#define GAME_YBORDER 300 - -typedef struct tagRH3 { - - WORD rh3Graine; // random generator seed - WORD rh3Free; // Alignment... - - int rh3DisplayX; // To scroll - int rh3DisplayY; - - long rh3CurrentMenu; // For menu II events - - int rh3WindowSx; // Window size - int rh3WindowSy; - - short rh3CollisionCount; // Collision counter - char rh3DoStop; // Force the test of stop actions - char rh3Scrolling; // Flag: we need to scroll - - int rh3Panic; - - int rh3PanicBase; - int rh3PanicPile; - -// short rh3XBorder_; // Authorised border -// short rh3YBorder_; - int rh3XMinimum; // Object inactivation coordinates - int rh3YMinimum; - int rh3XMaximum; - int rh3YMaximum; - int rh3XMinimumKill; // Object destruction coordinates - int rh3YMinimumKill; - int rh3XMaximumKill; - int rh3YMaximumKill; - - } runHeader3; - -// Extensions -// ~~~~~~~~~~~~~~~~~~~~ -#define KPX_MAXNUMBER 96 -typedef struct tagKPXMSG { - short ( WINAPI * routine) (DWORD, HWND, UINT, WPARAM, LPARAM); - } kpxMsg; -#define KPX_MAXFUNCTIONS 32 -typedef struct tagKPXLIB { - long ( WINAPI * routine) (headerObject*, WPARAM, LPARAM); - } kpxLib; -#define IsRunTimeFunctionPresent(num) (num < KPX_MAXFUNCTIONS && ((LPRH)rdPtr->rHo.hoAdRunHeader)->rh4.rh4KpxFunctions[num].routine != NULL) -#define callRunTimeFunction(rdPtr,num,wParam,lParam) ( ((LPRH)rdPtr->rHo.hoAdRunHeader)->rh4.rh4KpxFunctions[num].routine((LPHO)rdPtr, wParam, lParam) ) -#define callRunTimeFunction2(hoPtr,num,wParam,lParam) ( ((LPRH)hoPtr->hoAdRunHeader)->rh4.rh4KpxFunctions[num].routine(hoPtr, wParam, lParam) ) - -#define RFUNCTION_REHANDLE 0 -#define RFUNCTION_GENERATEEVENT 1 -#define RFUNCTION_PUSHEVENT 2 -#define RFUNCTION_GETSTRINGSPACE_EX 3 -#define RFUNCTION_GETPARAM1 4 -#define RFUNCTION_GETPARAM2 5 -#define RFUNCTION_PUSHEVENTSTOP 6 -#define RFUNCTION_PAUSE 7 -#define RFUNCTION_CONTINUE 8 -#define RFUNCTION_REDISPLAY 9 -#define RFUNCTION_GETFILEINFOS 10 -#define RFUNCTION_SUBCLASSWINDOW 11 -#define RFUNCTION_REDRAW 12 -#define RFUNCTION_DESTROY 13 -#define RFUNCTION_GETSTRINGSPACE 14 -#define RFUNCTION_EXECPROGRAM 15 -#define RFUNCTION_GETOBJECTADDRESS 16 -#define RFUNCTION_GETPARAM 17 -#define RFUNCTION_GETEXPPARAM 18 -#define RFUNCTION_GETPARAMFLOAT 19 -#define RFUNCTION_EDITINT 20 -#define RFUNCTION_EDITTEXT 21 -#define RFUNCTION_CALLMOVEMENT 22 -#define RFUNCTION_SETPOSITION 23 -#define RFUNCTION_GETCALLTABLES 24 - -#define CNC_GetParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0xFFFFFFFF, 0) -#define CNC_GetIntParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0, 0) -#define CNC_GetStringParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0xFFFFFFFF, 0) -#define CNC_GetFloatParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 2, 0) -#define CNC_GetFloatValue(rdPtr, par) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAMFLOAT, par, 0) -#define CNC_GetFirstExpressionParameter(rdPtr, lParam, wParam) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM1, wParam, lParam) -#define CNC_GetNextExpressionParameter(rdPtr, lParam, wParam) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM2, wParam, lParam) - -#define MAX_FRAMERATE 10 - -typedef void (* CALLANIMATIONS) (headerObject*, int); -#define callAnimations(hoPtr, anim) ( (hoPtr->hoAdRunHeader)->rh4.rh4Animations(hoPtr, anim) ) - -typedef DWORD (* CALLDIRATSTART) (headerObject*, DWORD); -#define callDirAtStart(hoPtr, initDir) ( (hoPtr->hoAdRunHeader)->rh4.rh4DirAtStart(hoPtr, initDir) ) - -typedef BOOL (* CALLMOVEIT) (headerObject*); -#define callMoveIt(hoPtr) ( (hoPtr->hoAdRunHeader)->rh4.rh4MoveIt(hoPtr) ) - -#ifdef __cplusplus -typedef BOOL (* CALLAPPROACHOBJECT) (headerObject*, int destX, int destY, int maxX, int maxY, int htFoot, int planCol, int& x, int &y); -#define callApproachObject(x, y, hoPtr, destX, destY, maxX, maxY, htFoot, planCol) ( (hoPtr->hoAdRunHeader)->rh4.rh4ApproachObject(hoPtr, destX, destY, maxX, maxY, htFoot, planCol, x, y) ) -#else -typedef BOOL (* CALLAPPROACHOBJECT) (headerObject*, int destX, int destY, int maxX, int maxY, int htFoot, int planCol, int* x, int *y); -#define callApproachObject(x, y, hoPtr, destX, destY, maxX, maxY, htFoot, planCol) ( (hoPtr->hoAdRunHeader)->rh4.rh4ApproachObject(hoPtr, destX, destY, maxX, maxY, htFoot, planCol, &x, &y) ) -#endif - -typedef void (* CALLCOLLISIONS) (headerObject*); -#define callCollisions(hoPtr) ( (hoPtr->hoAdRunHeader)->rh4.rh4Collisions(hoPtr) ) - -typedef BOOL (* CALLTESTPOSITION) (headerObject*, int x, int y, int htFoot, int planCol, BOOL flag); -#define callTestPosition(hoPtr, x, y, htFoot, planCol) ( (hoPtr->hoAdRunHeader)->rh4.rh4TestPosition(hoPtr, x, y, htFoot, planCol, 0) ) - -typedef BYTE (* CALLGETJOYSTICK) (headerObject*, int); -#define callGetJoystick(hoPtr, player) ( (hoPtr->hoAdRunHeader)->rh4.rh4Joystick(hoPtr, player) ) - -typedef BOOL (* CALLCOLMASKTESTRECT) (headerObject*, int x, int y , int sx, int sy, int nLayer, int plan); -#define callColMaskTestRect(hoPtr, x, y, sx, sy, nLayer, plan) ( (hoPtr->hoAdRunHeader)->rh4.rh4ColMaskTestRect(hoPtr, x, y, sx, sy, nLayer, plan) ) - -typedef BOOL (* CALLCOLMASKTESTPOINT) (headerObject*, int x, int y, int nLayer, int plan); -#define callColMaskTestPoint(hoPtr, x, y, nLayer, plan) ( (hoPtr->hoAdRunHeader)->rh4.rh4ColMaskTestPoint(hoPtr, x, y, nLayer, plan) ) - - -typedef struct tagRH4 { - - kpj* rh4KpxJumps; // Jump table offset - short rh4KpxNumOfWindowProcs; // Number of routines to call - short rh4Free; - kpxMsg rh4KpxWindowProc[KPX_MAXNUMBER]; // Message handle routines - kpxLib rh4KpxFunctions[KPX_MAXFUNCTIONS]; // Available internal routines - CALLANIMATIONS rh4Animations; - CALLDIRATSTART rh4DirAtStart; - CALLMOVEIT rh4MoveIt; - CALLAPPROACHOBJECT rh4ApproachObject; - CALLCOLLISIONS rh4Collisions; - CALLTESTPOSITION rh4TestPosition; - CALLGETJOYSTICK rh4GetJoystick; - CALLCOLMASKTESTRECT rh4ColMaskTestRect; - CALLCOLMASKTESTPOINT rh4ColMaskTestPoint; - - DWORD rh4SaveVersion; - event* rh4ActionStart; // Sauvergarde action courante - int rh4PauseKey; - LPTSTR rh4CurrentFastLoop; - int rh4EndOfPause; - int rh4EventCountOR; // Number of the event for OR conditions - short rh4ConditionsFalse; - short rh4MouseWheelDelta; - int rh4OnMouseWheel; - LPTSTR rh4PSaveFilename; - UINT rh4MusicHandle; - DWORD rh4MusicFlags; - DWORD rh4MusicLoops; - int rh4LoadCount; - short rh4DemoMode; - short rh4SaveFrame; - CDemoRecord* rh4Demo; - int rh4SaveFrameCount; - double rh4MvtTimerCoef; - CIPhoneJoystick* rh4IPhoneJoystick; - CIPhoneAd* rh4IPhoneAd; - char rh4QuitString[32]; // FREE!!!! GREAT! - - - DWORD rh4PickFlags0; // 00-31 - DWORD rh4PickFlags1; // 31-63 - DWORD rh4PickFlags2; // 64-95 - DWORD rh4PickFlags3; // 96-127 - LPDWORD rh4TimerEventsBase; // Timer events base - - short rh4DroppedFlag; - short rh4NDroppedFiles; - LPTSTR rh4DroppedFiles; - LPFL rh4FastLoops; - LPTSTR rh4CreationErrorMessages; - CValue rh4ExpValue1; // New V2 - CValue rh4ExpValue2; - - long rh4KpxReturn; // WindowProc return - LPOBL rh4ObjectCurCreate; - short rh4ObjectAddCreate; - WORD rh4Free10; // For step through : fake key pressed - HINSTANCE rh4Instance; // Application instance - HWND rh4HStopWindow; // STOP window handle - char rh4DoUpdate; // Flag for screen update on first loop - char rh4MenuEaten; // Menu handled in an event? - short rh4Free2; - int rh4OnCloseCount; // For OnClose event - short rh4CursorCount; // Mouse counter - short rh4ScrMode; // Current screen mode - HPALETTE rh4HPalette; // Handle current palette - int rh4VBLDelta; // Number of VBL - DWORD rh4LoopTheoric; // Theorical VBL counter - DWORD rh4EventCount; - drawRoutine* rh4FirstBackDrawRoutine; // Backrgound draw routines list - drawRoutine* rh4LastBackDrawRoutine; // Last routine used - - DWORD rh4ObjectList; // Object list offset - short rh4LastQuickDisplay; // Quick - display list - BYTE rh4CheckDoneInstart; // Build92 to correct start of frame with fade in - BYTE rh4Free0; - mv * rh4Mv; // Yves's data - HCURSOR rh4OldCursor; // Old cursor for Show / HideMouse in Vitalize! mode - headerObject* rh4_2ndObject; // Collision object address - short rh4_2ndObjectNumber; // Number for collisions - short rh4FirstQuickDisplay; // Quick-display object list - int rh4WindowDeltaX; // For scrolling - int rh4WindowDeltaY; - UINT rh4TimeOut; // For time-out! - int rh4MouseXCenter; // To correct CROSOFT bugs! - int rh4MouseYCenter; // To correct CROSOFT bugs! - int rh4TabCounter; // Objects with tabulation - - DWORD rh4AtomNum; // For child window handling - DWORD rh4AtomRd; - DWORD rh4AtomProc; - short rh4SubProcCounter; // To accelerate the windows - short rh4Free3; - - int rh4PosPile; // Expression evaluation pile position - expression* rh4ExpToken; // Current position in expressions - CValue* rh4Results[MAX_INTERMEDIATERESULTS]; // Result pile - long rh4Operators[MAX_INTERMEDIATERESULTS]; // Operators pile - - LPTSTR* rh4PTempStrings; // Debut zone 256 long - int rh4MaxTempStrings; - long rh4Free4[256-2]; // Free buffer - - int rh4NCurTempString; // Pointer on the current string - DWORD rh4FrameRateArray[MAX_FRAMERATE]; // Framerate calculation buffer - int rh4FrameRatePos; // Position in buffer - DWORD rh4FrameRatePrevious; // Previous time - - } runHeader4; - -#define GAMEFLAGS_VBLINDEP 0x0002 -#define GAMEFLAGS_LIMITEDSCROLL 0x0004 -#define GAMEFLAGS_FIRSTLOOPFADEIN 0x0010 -#define GAMEFLAGS_LOADONCALL 0x0020 -#define GAMEFLAGS_REALGAME 0x0040 -#define GAMEFLAGS_PLAY 0x0080 -//#define GAMEFLAGS_FADEIN 0x0080 -//#define GAMEFLAGS_FADEOUT 0x0100 -#define GAMEFLAGS_INITIALISING 0x0200 - -typedef struct RunHeader { - npWin rhIdEditWin; - npWin rhIdMainWin; - npAppli rhIdAppli; - - HWND rhHEditWin; - HWND rhHMainWin; - HWND rhHTopLevelWnd; - - CRunApp* rhApp; // Application info - CRunFrame* rhFrame; // Frame info - - DWORD rhJoystickPatch; // To reroute the joystick - - BYTE rhFree10; // Current movement needs to be stopped - BYTE rhFree12; // Event evaluation flag - BYTE rhNPlayers; // Number of players - BYTE rhMouseUsed; // Players using the mouse - - WORD rhGameFlags; // Game flags - WORD rhFree; // Alignment - DWORD rhPlayer; // Current players entry - - short rhQuit; - short rhQuitBis; // Secondary quit (scrollings) - DWORD rhFree11; // Value to return to the editor - DWORD rhQuitParam; - -// Buffers - int rhNObjects; - int rhMaxObjects; - - DWORD rhFree0; - DWORD rhFree1; - DWORD rhFree2; - DWORD rhFree3; - - int rhNumberOi; // Number of OI in the list - objInfoList* rhOiList; // ObjectInfo list - - LPDWORD rhEvents[NUMBEROF_SYSTEMTYPES+1]; // Events pointers - LPDWORD rhEventLists; // Pointers on pointers list - LPDWORD rhFree8; // Timer pointers - LPDWORD rhEventAlways; // Pointers on events to see at each loop - LPEVG rhPrograms; // Program pointers - OINUM* rhLimitLists; // Movement limitation list - qualToOi* rhQualToOiList; // Conversion qualifier->oilist - - DWORD rhSBuffers; // Buffer size /1024 - LPBYTE rhBuffer; // Position in current buffer - LPBYTE rhFBuffer; // End of current buffer - LPBYTE rhBuffer1; // First buffer - LPBYTE rhBuffer2; // Second buffer - - int rhLevelSx; // Window size - int rhLevelSy; - int rhWindowX; // Start of window in X/Y - int rhWindowY; - - UINT rhVBLDeltaOld; // Number of VBL - UINT rhVBLObjet; // For the objects - UINT rhVBLOld; // For the counter - - int rhEventsSize; - WORD rhMT_VBLStep; // Path movement variables - WORD rhMT_VBLCount; - DWORD rhMT_MoveStep; - - int rhLoopCount; // Number of loops since start of level - UINT rhTimer; // Timer in 1/50 since start of level - UINT rhTimerOld; // For delta calculation - UINT rhTimerDelta; // For delta calculation - - LPEVG rhEventGroup; // Current group - long rhCurCode; // Current event - short rhCurOi; - short rhFree4; // Alignment - long rhCurParam[2]; - short rhCurObjectNumber; // Object number - short rh1stObjectNumber; // Number, for collisions - - long rhOiListPtr; // OI list enumeration - short rhObListNext; // Branch label - - short rhDestroyPos; - long rhFree5; - long rhFree6; - - runHeader2 rh2; // Sub-structure #1 - runHeader3 rh3; // Sub-structure #2 - runHeader4 rh4; // Sub-structure #3 - - LPDWORD rhDestroyList; // Destroy list address - - int rhDebuggerCommand; // Current debugger command - char rhFree13[DB_BUFFERSIZE]; // Buffer libre! - LPVOID rhDbOldHO; - WORD rhDbOldId; - WORD rhFree7; - - objectsList* rhObjectList; // Object list address - - } RunHeader; -typedef RunHeader * fprh; -typedef RunHeader * LPRH; -typedef RunHeader * LPRUNHEADER; - - -/////////////////////////////////////////////////////////////// -// -// RUNTIME OBJECT DEFINITION -// -/////////////////////////////////////////////////////////////// - -#define HOX_INT - -typedef short (WINAPI *HOROUTINE)(headerObject*); - -#ifdef __cplusplus -class headerObject { -public: -#else -#undef headerObject -typedef struct headerObject { -#endif - short hoNumber; // Number of the object - short hoNextSelected; // Selected object list!!! DO NOT CHANGE POSITION!!! - - int hoSize; // Structure size - LPRH hoAdRunHeader; // Run-header address -#ifdef __cplusplus - headerObject* hoAddress; -#else - LPVOID hoAddress; -#endif - HFII hoHFII; // Number of LevObj - OINUM hoOi; // Number of OI - short hoNumPrev; // Same OI previous object - short hoNumNext; // ... next - short hoType; // Type of the object - WORD hoCreationId; // Number of creation - objInfoList* hoOiList; // Pointer to OILIST information - LPDWORD hoEvents; // Pointer to specific events - UINT hoFree0; // Free - LPBYTE hoPrevNoRepeat; // One-shot event handling - LPBYTE hoBaseNoRepeat; - - int hoMark1; // #of loop marker for the events - int hoMark2; - LPTSTR hoMT_NodeName; // Name fo the current node for path movements - - int hoEventNumber; // Number of the event called (for extensions) - int hoFree2; - LPOC hoCommon; // Common structure address - - union - { - struct - { - int hoCalculX; // Low weight value - int hoX; // X coordinate - int hoCalculY; // Low weight value - int hoY; // Y coordinate - }; - struct - { - __int64 hoCalculXLong; - __int64 hoCalculYLong; - }; - }; - int hoImgXSpot; // Hot spot of the current image - int hoImgYSpot; - int hoImgWidth; // Width of the current picture - int hoImgHeight; - RECT hoRect; // Display rectangle - - DWORD hoOEFlags; // Objects flags - short hoFlags; // Flags - BYTE hoSelectedInOR; // Selection lors d'un evenement OR - BYTE hoFree; // Alignement - int hoOffsetValue; // Values structure offset - UINT hoLayer; // Layer - - HOROUTINE hoHandleRoutine; // General handle routine - HOROUTINE hoModifRoutine; // Modification routine when coordinates have been modified - HOROUTINE hoDisplayRoutine; // Display routine - - short hoLimitFlags; // Collision limitation flags - short hoNextQuickDisplay; // Quickdraw list - saveRect hoBackSave; // Background - - LPEVP hoCurrentParam; // Address of the current parameter - - int hoOffsetToWindows; // Offset to windows - DWORD hoIdentifier; // ASCII identifier of the object - -#ifdef __cplusplus -}; -#else -} headerObject; -#endif -typedef headerObject* LPHO; - -#define HOF_DESTROYED 0x0001 -#define HOF_TRUEEVENT 0x0002 -#define HOF_REALSPRITE 0x0004 -#define HOF_FADEIN 0x0008 -#define HOF_FADEOUT 0x0010 -#define HOF_OWNERDRAW 0x0020 -#define HOF_NOCOLLISION 0x2000 -#define HOF_FLOAT 0x4000 -#define HOF_STRING 0x8000 - - -// -------------------------------------- -// Object's movement structure -// -------------------------------------- -typedef struct tagRM { - - int rmAcc; // Current acceleration - int rmDec; // Current Decelaration - int rmCollisionCount; // Collision counter - int rmFree2; - int rmStopSpeed; // If stopped: speed to take again - int rmFree0; - int rmFree1; - int rmAccValue; // Acceleration calculation - int rmDecValue; // Deceleration calculation - short rmEventFlags; // To accelerate events - int rmFree3; - int rmFree4; - BOOL rmFree5; - BOOL rmFree6; - - BOOL rmFree7; - BOOL rmMoveFlag; // Messages/movements - - BOOL rmWrapping; // For CHECK POSITION - BOOL rmReverse; // Ahaid or reverse? - - BOOL rmBouncing; // Bouncing? - int rmMvtNum; // Number of the current movement - - union - { - struct - { - BYTE rmMvData[80]; // Space for data - }; - struct - { - int MT_Speed; - int MT_Sinus; - int MT_Cosinus; - DWORD MT_Longueur; - int MT_XOrigin; - int MT_YOrigin; - int MT_XDest; - int MT_YDest; - int MT_MoveNumber; - LPMOVEDEF MT_MoveAddress; - BOOL MT_Direction; - LPMOVETAPED MT_Movement; - int MT_Calculs; - int MT_XStart; - int MT_YStart; - int MT_Pause; - LPTSTR MT_GotoNode; - }; - struct - { - int MM_DXMouse; - int MM_DYMouse; - int MM_FXMouse; - int MM_FYMouse; - int MM_Stopped; - int MM_OldSpeed; - BYTE MM_MvOpt; - }; - struct - { - int MG_Bounce; - long MG_OkDirs; - int MG_BounceMu; - int MG_Speed; - int MG_LastBounce; - int MG_DirMask; - BYTE MG_MvOpt; - }; - struct - { - int MR_Bounce; - int MR_BounceMu; - int MR_Speed; - int MR_RotSpeed; - int MR_RotCpt; - int MR_RotPos; - int MR_RotMask; - int MR_OkReverse; - int MR_OldJoy; - int MR_LastBounce; - BYTE MR_MvOpt; - }; - struct - { - long MB_StartDir; - int MB_Angles; - int MB_Securite; - int MB_SecuCpt; - int MB_Bounce; - int MB_Speed; - int MB_MaskBounce; - int MB_LastBounce; - int MB_Blocked; - }; - struct - { - int MBul_Wait; - LPHO MBul_ShootObject; - }; - struct - { - int MP_Type; - int MP_Bounce; - int MP_BounceMu; - int MP_XSpeed; - int MP_Gravity; - int MP_Jump; - int MP_YSpeed; - int MP_XMB; - int MP_YMB; - int MP_HTFOOT; - int MP_JumpControl; - int MP_JumpStopped; - int MP_PreviousDir; - LPHO MP_ObjectUnder; - int MP_XObjectUnder; - int MP_YObjectUnder; - BOOL MP_NoJump; - }; - }; - } rMvt; -typedef rMvt* LPRMV; -enum -{ - MPTYPE_WALK, - MPTYPE_CLIMB, - MPTYPE_JUMP, - MPTYPE_FALL, - MPTYPE_CROUCH, - MPTYPE_UNCROUCH -}; - -// ---------------------------------------- -// Object's animation structure -// ---------------------------------------- -typedef struct tagRA { - int raAnimForced; // Flags if forced - int raAnimDirForced; - int raAnimSpeedForced; - BOOL raAnimStopped; - int raAnimOn; // Current animation - LPAN raAnimOffset; - int raAnimDir; // Direction of current animation - int raAnimPreviousDir; // Previous OK direction - LPAD raAnimDirOffset; - int raAnimSpeed; - int raAnimMinSpeed; // Minimum speed of movement - int raAnimMaxSpeed; // Maximum speed of movement - int raAnimDeltaSpeed; - int raAnimCounter; // Animation speed counter - int raAnimDelta; // Speed counter - int raAnimRepeat; // Number of repeats - int raAnimRepeatLoop; // Looping picture - int raAnimFrame; // Current frame - int raAnimNumberOfFrame; // Number of frames - - int raAnimFrameForced; - - } rAni; -typedef rAni* LPRA; - -// ---------------------------------------- -// Sprite display structure -// ---------------------------------------- -typedef struct tagRSPR { - - int rsFlash; // Flash objets - int rsFlashCpt; - int rsLayer; // Layer - int rsZOrder; // Z-order value - int rsCreaFlags; // Creation flags - COLORREF rsBackColor; // background saving color - DWORD rsEffect; // Sprite effects - LPARAM rsEffectParam; - WORD rsFlags; // Handling flags - WORD rsFadeCreaFlags; // Saved during a fadein - } rSpr; -typedef rSpr * LPRSP; - -#define RSFLAG_HIDDEN 0x0001 -#define RSFLAG_INACTIVE 0x0002 -#define RSFLAG_SLEEPING 0x0004 -#define RSFLAG_SCALE_RESAMPLE 0x0008 -#define RSFLAG_ROTATE_ANTIA 0x0010 -#define RSFLAG_VISIBLE 0x0020 -#define RSFLAG_CREATEDEFFECT 0x0040 - - -// ---------------------------------------- -// Objects's internal variables (build # >= 243) -// ---------------------------------------- -typedef struct tagRV { - CValue* rvpValues; - long rvFree1[VALUES_NUMBEROF_ALTERABLE-1]; - long rvValueFlags; - BYTE rvFree2[VALUES_NUMBEROF_ALTERABLE]; - LPTSTR rvStrings[STRINGS_NUMBEROF_ALTERABLE]; - } rVal; -typedef rVal * LPRVAL; - -/* - Obsolete (build 242 or below) - Note: don't remove this (for the SDK) - -typedef struct tagRV { - long rvValues[VALUES_NUMBEROF_ALTERABLE]; - long rvValueFlags; - BYTE rvValuesType[VALUES_NUMBEROF_ALTERABLE]; - LPSTR rvStrings[STRINGS_NUMBEROF_ALTERABLE]; - } rVal; -typedef rVal * LPRVAL; -*/ - - -// ----------------------------------------------- -// Objects animation and movement structure -// ----------------------------------------------- -#if !defined(ANGLETYPE) -#if defined(HWABETA) -#define ANGLETYPE float -#else -#define ANGLETYPE int -#endif -#endif -typedef void (* RCROUTINE)(LPHO); -typedef struct tagRCOM { - - int rcOffsetAnimation; // Offset to anims structures - int rcOffsetSprite; // Offset to sprites structures - RCROUTINE rcRoutineMove; // Offset to movement routine - RCROUTINE rcRoutineAnimation; // Offset to animation routine - - int rcPlayer; // Player who controls - - int rcNMovement; // Number of the current movement - CRunMvt* rcRunMvt; // Pointer to extension movement - fpSpr rcSprite; // Sprite ID if defined - int rcAnim; // Wanted animation - int rcImage; // Current frame - float rcScaleX; - float rcScaleY; - ANGLETYPE rcAngle; - int rcDir; // Current direction - int rcSpeed; // Current speed - int rcMinSpeed; // Minimum speed - int rcMaxSpeed; // Maximum speed - BOOL rcChanged; // Flag: modified object - BOOL rcCheckCollides; // For static objects - - int rcOldX; // Previous coordinates - int rcOldY; - int rcOldImage; - ANGLETYPE rcOldAngle; - int rcOldDir; - int rcOldX1; // For zone detections - int rcOldY1; - int rcOldX2; - int rcOldY2; - - long rcFadeIn; - long rcFadeOut; - - } rCom; - - -// ------------------------------------------------------------ -// ACTIVE OBJECTS DATAZONE -// ------------------------------------------------------------ -typedef struct tagRO { - - headerObject roHo; // Common structure - - rCom roc; // Anim/movement structure - rMvt rom; // Movement structure - rAni roa; // Animation structure - rSpr ros; // Sprite handling structure - rVal rov; // Values structure - - } RunObject; -typedef RunObject * LPRO; -typedef RunObject * LPRUNOBJECT; - -#define EF_GOESINPLAYFIELD 0x0001 -#define EF_GOESOUTPLAYFIELD 0x0002 -#define EF_WRAP 0x0004 - - - -// ------------------------------------------------------ -// EXTENSION EDITION HEADER STRUCTURE -// ------------------------------------------------------ -typedef struct tagEditExtension_v1 -{ - short extSize; - short extMaxSize; - short extOldFlags; // For conversion purpose - short extVersion; // Version number -} extHeader_v1; -typedef extHeader_v1* LPEXTV1; - -typedef struct extHeader -{ - DWORD extSize; - DWORD extMaxSize; - DWORD extVersion; // Version number - LPVOID extID; // object's identifier - LPVOID extPrivateData; // private data -} extHeader; -typedef extHeader * LPEXT; - -// ------------------------------------------------------ -// System objects (text, question, score, lives, counter) -// ------------------------------------------------------ -typedef struct tagRs { - - headerObject rsHo; // For all the objects - rCom rsc; // Anims / movements / sprites structures - rMvt rom; // Mouvement structure - rSpr rss; // Sprite handling - - short rsPlayer; // Number of the player if score or lives - short rsFlags; // Type + flags - - union { - LPBYTE rsSubAppli; // Application (CCA object) - }; - union - { - long rsMini; - long rsOldLevel; - }; - union - { - long rsMaxi; // - long rsLevel; - }; - CValue rsValue; - LONG rsBoxCx; // Dimensions box (for lives, counters, texts) - LONG rsBoxCy; - double rsMiniDouble; - double rsMaxiDouble; - short rsOldFrame; // Counter only - BYTE rsHidden; - BYTE rsFree; - LPTSTR rsTextBuffer; // Text buffer - int rsLBuffer; // Length of the buffer in BYTES - DWORD rsFont; // Temporary font for texts - union { - COLORREF rsTextColor; // Text color - COLORREF rsColor1; // Bar color - }; - COLORREF rsColor2; // Gradient bar color -} rs; -typedef rs * LPRS; - - -// OILIST Structure : Data concerning the objects in the game -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define MAX_QUALIFIERS 8 // Maximum number of qualifiers per object -typedef LPHO (*OILROUTINE)(objInfoList*, BOOL*); - -#ifdef __cplusplus -class objInfoList { -public: -#else -#undef objInfoList -typedef struct objInfoList { -#endif - OINUM oilOi; // THE oi - short oilListSelected; // First selection !!! DO NOT CHANGE POSITION !!! - short oilType; // Type of the object - short oilObject; // First objects in the game - DWORD oilEvents; // Events - char oilWrap; // WRAP flags - char oilNextFlag; - WORD oilFree; // Not used - int oilNObjects; // Current number - int oilActionCount; // Action loop counter - int oilActionLoopCount; // Action loop counter - OILROUTINE oilCurrentRoutine; // Current routine for the actions - int oilCurrentOi; // Current object - int oilNext; // Pointer on the next - int oilEventCount; // When the event list is done - int oilNumOfSelected; // Number of selected objects - DWORD oilOEFlags; // Object's flags - short oilLimitFlags; // Movement limitation flags - short oilLimitList; // Pointer to limitation list - short oilOIFlags; // Objects preferences - short oilOCFlags2; // Objects preferences II - long oilInkEffect; // Ink effect - long oilEffectParam; // Ink effect param - HFII oilHFII; // First available frameitem - COLORREF oilBackColor; // Background erasing color - short oilQualifiers[MAX_QUALIFIERS]; // Qualifiers for this object - TCHAR oilName[24]; // Name - int oilEventCountOR; // Selection in a list of events with OR -#ifdef HWABETA - OINUM* oilColList; // Liste de collisions sprites -#endif -#ifdef __cplusplus -}; -#else -} objInfoList; -#endif -typedef objInfoList * LPOIL; - -#define OILIMITFLAGS_BORDERS 0x000F -#define OILIMITFLAGS_BACKDROPS 0x0010 -#define OILIMITFLAGS_ONCOLLIDE 0x0080 // used by HWA -#define OILIMITFLAGS_QUICKCOL 0x0100 -#define OILIMITFLAGS_QUICKBACK 0x0200 -#define OILIMITFLAGS_QUICKBORDER 0x0400 -#define OILIMITFLAGS_QUICKSPR 0x0800 -#define OILIMITFLAGS_QUICKEXT 0x1000 -#define OILIMITFLAGS_ALL 0xFFFF - -// Object creation structure -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -typedef struct tagCOB { - LO* cobLevObj; // Leave first! - WORD cobLevObjSeg; - WORD cobFlags; - int cobX; - int cobY; - int cobDir; - int cobLayer; - int cobZOrder; - } createObjectInfo; -typedef createObjectInfo * LPCOB; -typedef createObjectInfo * fpcob; - -// Flags for Create Objects -// ------------------------- -#define COF_NOMOVEMENT 0x0001 -#define COF_HIDDEN 0x0002 -#define COF_FIRSTTEXT 0x0004 - -// Qualifier to oilist for machine langage -// --------------------------------------- -typedef LPHO (*QOIROUTINE)(qualToOi*, BOOL* pRepeatFlag); - -#ifdef __cplusplus -class qualToOi { -public: -#else -#undef qualToOi -typedef struct qualToOi { -#endif - short qoiCurrentOi; - short qoiNext; - int qoiActionPos; - QOIROUTINE qoiCurrentRoutine; - int qoiActionCount; - int qoiActionLoopCount; - char qoiNextFlag; - char qoiSelectedFlag; - OINUM qoiOi; // Array OINUM / OFFSET - short qoiOiList; -#ifdef __cplusplus -}; -#else -} qualToOi; -#endif -typedef qualToOi * LPQOI; - - -// ------------------------------------------------------------------ -// ------------------------------------------------------------------ -// EXTENSION HANDLING -// ------------------------------------------------------------------ -// ------------------------------------------------------------------ - -#ifdef STAND_ALONE -typedef BOOL (WINAPI *EXTCONDROUTINE)(headerObject*, long, long); -typedef short (WINAPI *EXTACTROUTINE)(headerObject*, long, long); -typedef long (WINAPI *EXTEXPROUTINE)(headerObject*, long); -#else -#define EXTCONDROUTINE VOID -#define EXTACTROUTINE VOID -#define EXTEXPROUTINE VOID -#endif - -// Information structure about the extension -#ifdef __cplusplus -class kpxRunInfos { -public: -#else -typedef struct kpxRunInfos { -#endif - EXTCONDROUTINE* conditions; // 00 Offset to condition jump list - EXTACTROUTINE* actions; // 04 Offset to action jump list - EXTEXPROUTINE* expressions; // 08 Offset to expression jump list - short numOfConditions; // 0C Number of conditions - short numOfActions; // 0E Number of actions - short numOfExpressions; // 10 Number of expressions - WORD editDataSize; // 12 Size of the data zone when exploded - DWORD editFlags; // 14 Object flags - char windowProcPriority; // 16 Priority of the routine 0-255 - char free; - short editPrefs; // 18 Preferences d'edition - long identifier; // 1A Chaine d'identification - short version; // 1E Version courante - // 20 -#ifdef __cplusplus -}; -#else -} kpxRunInfos; -#endif -typedef kpxRunInfos * LPKPXRUNINFOS; -typedef kpxRunInfos * fpKpxRunInfos; - -// Extension jump table -// -------------------- -typedef short (WINAPI * CREATERUNOBJECT_PROC) (LPHO hoPtr, LPEXT extPtr, LPCOB); -typedef unsigned short (WINAPI * GETRUNDATASIZE_PROC)(LPRH, LPEXT); -typedef short (WINAPI * DESTROYRUNOBJECT_PROC)(LPHO, long fast); -typedef short (WINAPI * HANDLERUNOBJECT_PROC)(LPHO); -typedef short (WINAPI * DISPLAYRUNOBJECT_PROC)(LPHO); -typedef cSurface* (WINAPI * GETRUNOBJECTSURFACE_PROC)(LPHO); -typedef short (WINAPI * REINITRUNOBJECT_PROC)(LPHO); -typedef short (WINAPI * PAUSERUNOBJECT_PROC)(LPHO); -typedef short (WINAPI * CONTINUERUNOBJECT_PROC)(LPHO); -typedef short (WINAPI * PREPARETOSAVE_PROC)(LPHO); -typedef short (WINAPI * SAVEBACKGROUND_PROC)(LPHO); -typedef short (WINAPI * RESTOREBACKGROUND_PROC)(LPHO); -typedef short (WINAPI * CHANGERUNDATA_PROC)(LPHO, LPHO); -typedef short (WINAPI * KILLBACKGROUND_PROC) (LPHO); -typedef short (WINAPI * GETZONEINFO_PROC)(LPHO); -typedef LPWORD (WINAPI * GETDEBUGTREE_PROC)(LPHO); -typedef void (WINAPI * GETDEBUGITEM_PROC)(LPTSTR, LPHO, int); -typedef void (WINAPI* EDITDEBUGITEM_PROC)(LPHO, int); -typedef void (WINAPI* GETRUNOBJECTFONT_PROC)(LPHO, LOGFONT*); -typedef void (WINAPI* SETRUNOBJECTFONT_PROC)(LPHO, LOGFONT*, RECT*); -typedef COLORREF (WINAPI* GETRUNOBJECTTEXTCOLOR_PROC)(LPHO); -typedef void (WINAPI* SETRUNOBJECTTEXTCOLOR_PROC)(LPHO, COLORREF); -typedef short (WINAPI * GETRUNOBJECTWINDOW_PROC)(LPHO); -typedef sMask* (WINAPI * GETRUNOBJECTCOLLISIONMASK_PROC)(LPHO, LPARAM); -typedef BOOL (WINAPI * SAVERUNOBJECT_PROC)(LPHO, HANDLE); -typedef BOOL (WINAPI * LOADRUNOBJECT_PROC)(LPHO, HANDLE); -typedef void (WINAPI * GETRUNOBJECTMEMORYUSAGE_PROC)(LPHO, int*, int*, int*); - -#ifdef __cplusplus -class kpj { -public: -#else -#undef kpj -typedef struct kpj { -#endif - CREATERUNOBJECT_PROC CreateRunObject; - DESTROYRUNOBJECT_PROC DestroyRunObject; - HANDLERUNOBJECT_PROC HandleRunObject; - DISPLAYRUNOBJECT_PROC DisplayRunObject; - GETRUNOBJECTSURFACE_PROC GetRunObjectSurface; - REINITRUNOBJECT_PROC ReInitRunObject; - PAUSERUNOBJECT_PROC PauseRunObject; - CONTINUERUNOBJECT_PROC ContinueRunObject; - PREPARETOSAVE_PROC PrepareToSave; - PREPARETOSAVE_PROC PrepareToSave2; - GETRUNDATASIZE_PROC GetRunObjectDataSize; - SAVEBACKGROUND_PROC SaveBackground; - RESTOREBACKGROUND_PROC RestoreBackground; - CHANGERUNDATA_PROC ChangeRunData; - KILLBACKGROUND_PROC KillBackground; - GETZONEINFO_PROC GetZoneInfo; - GETDEBUGTREE_PROC GetDebugTree; - GETDEBUGITEM_PROC GetDebugItem; - EDITDEBUGITEM_PROC EditDebugItem; - GETRUNOBJECTFONT_PROC GetRunObjectFont; - SETRUNOBJECTFONT_PROC SetRunObjectFont; - GETRUNOBJECTTEXTCOLOR_PROC GetRunObjectTextColor; - SETRUNOBJECTTEXTCOLOR_PROC SetRunObjectTextColor; - GETRUNOBJECTWINDOW_PROC GetRunObjectWindow; - GETRUNOBJECTCOLLISIONMASK_PROC GetRunObjectCollisionMask; - SAVERUNOBJECT_PROC SaveRunObject; - LOADRUNOBJECT_PROC LoadRunObject; - GETRUNOBJECTMEMORYUSAGE_PROC GetRunObjectMemoryUsage; - - kpxRunInfos infos; - -#ifdef __cplusplus -}; -#else -} kpj; -#endif -typedef kpj * LPKPJ; - -#define KPJ_SHIFT 7 -#define KPJ_SIZE 0x80 -#define KPJ_MAXNUMBER 128 -#define KPJ_STEP 8 -#define kpjJCreate 0x00 -#define kpjJDestroy 0x04 -#define kpjJRoutine 0x08 -#define kpjJDisplay 0x0C -#define kpjJReInit 0x10 -#define kpjJPause 0x14 -#define kpjJEndPause 0x18 -#define kpjJPrepareToSave 0x1C -#define kpjJRestart 0x20 -#define kpjJGetRunDataSize 0x24 -#define kpjJSaveBackground 0x28 -#define kpjJRestoreBackground 0x2C -#define kpjJKillBackground 0x30 - -// Possible states of the application, see LApplication::SetRunningState() -#define GAMEON_EMPTY 0 -#define GAMEON_UNLOADED 1 -#define GAMEON_TIME0 2 -#define GAMEON_PAUSED 3 -#define GAMEON_RUNNING 4 -#define GAMEON_STEPPING 5 - - -////////////////////////////////////////////////////////////////////////////// -// Condition/action jumps -typedef BOOL (*CALLCOND1_ROUTINE)(event* pe, LPHO pHo); -typedef BOOL (*CALLCOND2_ROUTINE)(event* pe); -typedef void (*CALLACTION_ROUTINE)(event* pe); -typedef void (*CALLEXP_ROUTINE)(); -typedef BOOL (*CONDROUTINE)(event* pe, LPHO pHo); -typedef void (*ACTROUTINE)(event* pe); -typedef void (*EXPROUTINE)(); -typedef void (*CALLOPERATOR_ROUTINE)(); - -typedef struct tagCallTables -{ - CALLCOND1_ROUTINE* pConditions1; - CALLCOND2_ROUTINE* pConditions2; - CALLACTION_ROUTINE* pActions; - CALLEXP_ROUTINE* pExpressions; -}CallTables; - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////// -// -// Run-time Definitions -// - -#define COMPARE_EQ 0 -#define COMPARE_NE 1 -#define COMPARE_LE 2 -#define COMPARE_LT 3 -#define COMPARE_GE 4 -#define COMPARE_GT 5 - -#ifdef RUN_TIME - - #define OINUM_ERROR -1 - #define B2L(a,b,c,d) ((DWORD)(((DWORD)((unsigned char)(d))<<24)|((DWORD)((unsigned char)(c))<<16)|((DWORD)((unsigned char)(b))<<8)|(DWORD)((unsigned char)(a)))) - - // Pour la routine GetFileInfos - #define FILEINFO_DRIVE 1 - #define FILEINFO_DIR 2 - #define FILEINFO_PATH 3 - #define FILEINFO_APPNAME 4 - #define FILEINFO_TEMPPATH 5 - - // MACRO: next event - #define EVTNEXT(p) ((LPEVT)((LPBYTE)p+p->evtSize)) - // MACRO: returns first param - #define EVTPARAMS(p) ((LPEVP)(p->evtCode<0 ? (LPBYTE)p+CND_SIZE : (LPBYTE)p+ACT_SIZE )) - // MACRO: returns the extension condition code - #define EXTCONDITIONNUM(i) (-((short)(i>>16))-1) - #define EXTACTIONNUM(i) ((short)(i>>16)) - - #define KPXNAME_SIZE 60 - #define BADNAME_SIZE (OINAME_SIZE+KPXNAME_SIZE+8) - - // Extensions - // ---------- - typedef struct TABKPT { - kpj kpx[2]; - } kpxData; - typedef kpxData * fpkpdt; - - // Main loop exit codes - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ - #define LOOPEXIT_NEXTLEVEL 1 - #define LOOPEXIT_PREVLEVEL 2 - #define LOOPEXIT_GOTOLEVEL 3 - #define LOOPEXIT_NEWGAME 4 - #define LOOPEXIT_PAUSEGAME 5 - #define LOOPEXIT_SAVEAPPLICATION 6 - #define LOOPEXIT_LOADAPPLICATION 7 - #define LOOPEXIT_SAVEFRAME 8 - #define LOOPEXIT_LOADFRAME 9 - #define LOOPEXIT_ENDGAME -2 - - #define LOOPEXIT_QUIT 100 - #define LOOPEXIT_RESTART 101 - #define LOOPEXIT_TIMER 102 - #define LOOPEXIT_STEP 103 - #define LOOPEXIT_MONITOR 104 - #define LOOPEXIT_EVENTEDITOR 105 - #define LOOPEXIT_ESC 106 - #define LOOPEXIT_MENU 107 - #define LOOPEXIT_JUMPTO 108 - #define LOOPEXIT_RESET 109 - #define LOOPEXIT_PAUSE 110 - #define LOOPEXIT_PLAY 111 - - // Backdrop draw routines - // ---------------------------------------- - typedef void (* DRAWROUTINE_PROC)(drawRoutine*); - - #ifdef __cplusplus - class drawRoutine { - public: - #else - #undef drawRoutine - typedef struct drawRoutine { - #endif - #ifdef __cplusplus - drawRoutine* next; - #else - LPVOID next; - #endif - DRAWROUTINE_PROC routine; - long param1; - long param2; - long param3; - long param4; - long param5; - long param6; - #ifdef __cplusplus - }; - #else - } drawRoutine; - #endif - - // To push an event - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - #define MAX_PUSHEDEVENTS 32 - typedef void (*PEV_ROUTINE)(LPHO, long); - - #ifdef __cplusplus - class pev { - public: - #else - #undef pev - typedef struct pev { - #endif - long pevCode; - PEV_ROUTINE pevRoutine; - long pevParam; - LPHO pevObject; - short pevOi; - #ifdef __cplusplus - }; - #else - } pev; - #endif - #define PIXEL_SPEED 5 - - // QUALIFIERS - typedef struct - { - OINUM qOi; - ITEMTYPE qType; - WORD qList; - } qualifierLoad; - typedef qualifierLoad * LPQLOAD; - -#endif // RUN_TIME - -#ifndef __cplusplus -#undef headerObject -#undef kpj -#undef objInfoList -#undef drawRoutine -#undef LO -#undef pev -#undef qualToOi -//#undef CValue -#undef CRunApp -#undef CRunFrame -#endif; - -// Restores structure alignment... -#ifndef _H2INC -#pragma pack( pop, _pack_cncf_ ) -#endif - -#endif //CNCF_H - - - + +#ifndef _CNCF_H_ +#define _CNCF_H_ + +#include "cncy.h" +#ifdef STAND_ALONE +#include "CValue.h" +#else + +// Definitions for extensions +#define TYPE_LONG 0x0000 +#define TYPE_INT TYPE_LONG +#define TYPE_STRING 0x0001 +#define TYPE_FLOAT 0x0002 // Pour les extensions +#define TYPE_DOUBLE 0x0002 + +#ifdef __cplusplus +class CValue { +public: +#else +typedef struct CValue { +#endif + UINT m_type; + UINT m_paddle; + union + { + long m_long; + double m_double; + LPTSTR m_pString; + }; +#ifdef __cplusplus +}; +#else +} CValue; +#endif +#endif // STAND_ALONE + +// Changes the structure alignment +#ifndef _H2INC +#pragma pack( push, _pack_cncf_ ) +#pragma pack(2) +#endif +typedef short * LPSHORT; + +#ifdef __cplusplus +class headerObject; +class kpj; +class objInfoList; +class drawRoutine; +class LO; +class pev; +class qualToOi; +class CRunApp; +class CRunFrame; +class CRunMvt; +class CMvt; +class CDemoRecord; +class CIPhoneJoystick; +class CIPhoneAd; + +//class CValue; +#else +#define headerObject VOID +#define kpj VOID +#define objInfoList VOID +#define drawRoutine VOID +#define LO VOID +#define pev VOID +#define qualToOi VOID +//#define CValue VOID +#define CRunApp void +#define CRunFrame void +#define CRunMvt void +#define CMvt void +#define CDemoRecord void +#define CIPhoneJoystick void +#define CIPhoneAd void +#endif + +// Number of values +#define VALUES_NUMBEROF_ALTERABLE 26 +#define VALUES_NUMBEROF_MAX 26 +#define STRINGS_NUMBEROF_ALTERABLE 10 +#define STRINGS_NUMBEROF_MAX 10 + +typedef short ITEMTYPE; +typedef short OINUM; +typedef short HFII; + +// LOGFONT 16 structure for compatibility with old extensions +///////////////////////////////////////////////////////////// +typedef struct tagLOGFONTV1A { + short lfHeight; + short lfWidth; + short lfEscapement; + short lfOrientation; + short lfWeight; + BYTE lfItalic; + BYTE lfUnderline; + BYTE lfStrikeOut; + BYTE lfCharSet; + BYTE lfOutPrecision; + BYTE lfClipPrecision; + BYTE lfQuality; + BYTE lfPitchAndFamily; + char lfFaceName[LF_FACESIZE]; +} LOGFONTV1A; +typedef struct tagLOGFONTV1W { + short lfHeight; + short lfWidth; + short lfEscapement; + short lfOrientation; + short lfWeight; + BYTE lfItalic; + BYTE lfUnderline; + BYTE lfStrikeOut; + BYTE lfCharSet; + BYTE lfOutPrecision; + BYTE lfClipPrecision; + BYTE lfQuality; + BYTE lfPitchAndFamily; + WCHAR lfFaceName[LF_FACESIZE]; +} LOGFONTV1W; +#ifdef _UNICODE +#define LOGFONTV1 LOGFONTV1W +#else +#define LOGFONTV1 LOGFONTV1A +#endif + +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +// +// ObjectsCommon - Dynamic items +// +#define OC_MAX_QUALIFIERS 8 + +#ifdef __cplusplus +class OC { +public: +#else +typedef struct OC { +#endif + + DWORD ocDWSize; // Total size of the structures + + WORD ocMovements; // Offset of the movements + WORD ocAnimations; // Offset of the animations + WORD ocVersion; // For version versions > MOULI + WORD ocCounter; // Pointer to COUNTER structure + WORD ocData; // Pointer to DATA structure + WORD ocFree; + DWORD ocOEFlags; // New flags + + WORD ocQualifiers[OC_MAX_QUALIFIERS]; // Qualifier list + WORD ocExtension; // Extension structure + WORD ocValues; // Values structure + WORD ocStrings; // String structure + + WORD ocFlags2; // New news flags, before was ocEvents + WORD ocOEPrefs; // Automatically modifiable flags + DWORD ocIdentifier; // Identifier d'objet + + COLORREF ocBackColor; // Background color + DWORD ocFadeIn; // Offset fade in + DWORD ocFadeOut; // Offset fade out + DWORD ocValueNames; // For the debugger + DWORD ocStringNames; + +#ifdef __cplusplus +}; +#else +} OC; +#endif +typedef OC * LPOC; +typedef OC * fpoc; + +typedef struct +{ + WORD number; + long values[1]; +} OCValues; +typedef OCValues* LPOCVALUES; + +#ifdef _UNICODE +typedef struct +{ + WORD number; + TCHAR str[1]; +} OCStringsW; +typedef OCStringsW* LPOCSTRINGS; +#else +typedef struct +{ + WORD number; + char str[2]; +} OCStringsA; +typedef OCStringsA* LPOCSTRINGS; +#endif + + + +typedef struct +{ + WORD number; + char str[2]; + +} OCValueNames; +typedef OCValueNames* LPOCVALUENAMES; + +#define OCFLAGS2_DONTSAVEBKD 0x0001 +#define OCFLAGS2_SOLIDBKD 0x0002 +#define OCFLAGS2_COLBOX 0x0004 +#define OCFLAGS2_VISIBLEATSTART 0x0008 +#define OCFLAGS2_OBSTACLESHIFT 4 +#define OCFLAGS2_OBSTACLEMASK 0x0030 +#define OCFLAGS2_OBSTACLE_SOLID 0x0010 +#define OCFLAGS2_OBSTACLE_PLATFORM 0x0020 +#define OCFLAGS2_OBSTACLE_LADDER 0x0030 +#define OCFLAGS2_AUTOMATICROTATION 0x0040 + +////////////////////////////////////////////////////////////////////////////// +// +// Counter +// +typedef struct tagCT { + WORD ctSize; + long ctInit; // Initial value + long ctMini; // Minimal value + long ctMaxi; // Maximal value +} counter; +typedef counter * fpct; +typedef counter * fpCounter; + +////////////////////////////////////////////////////////////////////////////// +// +// Animations +// +#define ANIMID_MIN 16 + +// Anim header +#ifdef __cplusplus +class AnimHeader { +public: +#else +typedef struct AnimHeader { +#endif + WORD ahSize; + WORD ahAnimMax; // New V2, number of entries in offset table + short ahOffsetToAnim[ANIMID_MIN]; // Minimum 16 animations, can be larger! +#ifdef __cplusplus +}; +#else +} AnimHeader; +#endif +typedef AnimHeader * fpAnimHeader; +typedef AnimHeader * fpah; +typedef AnimHeader * LPAH; + +#ifndef DIRID_MAX +#define DIRID_MAX 32 +#endif + +// Anim structure +typedef struct Anim { + short anOffsetToDir[DIRID_MAX]; // Offset to animations with a direction +} Anim; +typedef Anim * fpAnim; +typedef Anim * fpan; +typedef Anim * LPAN; + +// AnimDirection structure +typedef struct AnimDirection { + BYTE adMinSpeed; // Minimum speed + BYTE adMaxSpeed; // Maximum speed + short adRepeat; // Number of loops + short adRepeatFrame; // Where to loop + short adNumberOfFrame; // Number of frames + short adFrame[1]; // Frames +} AnimDirection; +#define sizeof_AnimDirection (sizeof(AnimDirection)-2) +typedef AnimDirection * fpAnimDir; +typedef AnimDirection * fpad; +typedef AnimDirection * LPAD; + +// Chunks de sauvegarde +#define EVTFILECHUNK_HEAD B2L('E','R','>','>') +#define EVTFILECHUNK_EVTHEAD B2L('E','R','e','s') +#define EVTFILECHUNK_EVENTS B2L('E','R','e','v') +#define EVTFILECHUNK_NEWITEMS B2L('>','N','I','<') +#define EVTFILECHUNK_END B2L('<','<','E','R') + +// Marquage des OI qualifiers +#define OIFLAG_QUALIFIER 0x8000 +#define NDEF_QUALIFIERS 100 +#define MAX_EVENTPROGRAMS 256 + +#define GAMEON_EMPTY 0 +#define GAMEON_UNLOADED 1 +#define GAMEON_TIME0 2 +#define GAMEON_PAUSED 3 +#define GAMEON_RUNNING 4 +#define GAMEON_STEPPING 5 + +// COMMUNICATION STRUCTURE BETWEEN RUNTIME AND EDITOR +typedef struct +{ + DWORD command; + + WORD runMode; + DWORD timer; + + WORD code; + OINUM oi; + DWORD param[2]; + char path[_MAX_PATH]; + +} ComStructure; +enum +{ + RUNCOMMAND_INITCOM=1, + RUNCOMMAND_NEWEVENT, + RUNCOMMAND_NEWSOUND, + RUNCOMMAND_NEWOBJECT, + RUNCOMMAND_NEWEVENTS, + RUNCOMMAND_SETRUNMODE, + RUNCOMMAND_CONTINUE, + RUNCOMMAND_RESTART, + RUNCOMMAND_QUIT, + HANDLEMESSAGE_WAITFORCONFIRM, + HANDLEMESSAGE_WAITFORCOMMAND, + HANDLEMESSAGE_OK, + HANDLEMESSAGE_QUIT, + HANDLEMESSAGE_TIMEOUT +}; +// DIFFERENTS MODES OF RUN +enum +{ + RUNMODE_NONE, + RUNMODE_STOPPED, + RUNMODE_RUNNING, + RUNMODE_PLAYING, + RUNMODE_STEPPING, + RUNMODE_PAUSED, + RUNMODE_WAITING, + RUNMODE_WAITINGQUIT, +}; + + +// ------------------------------------------------------------------------- +// MOVEMENT DEFINITIONS +// ------------------------------------------------------------------------- + +// Definition of animation codes +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define ANIMID_STOP 0 +#define ANIMID_WALK 1 +#define ANIMID_RUN 2 +#define ANIMID_APPEAR 3 +#define ANIMID_DISAPPEAR 4 +#define ANIMID_BOUNCE 5 +#define ANIMID_SHOOT 6 +#define ANIMID_JUMP 7 +#define ANIMID_FALL 8 +#define ANIMID_CLIMB 9 +#define ANIMID_CROUCH 10 +#define ANIMID_UNCROUCH 11 +#define ANIMID_USER1 12 +//#define ANIMID_MAX 16 +#define ANIMNAME_MAXCHAR 64 + +// Definition of direction codes +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define DIRF_ALL 0xFFFFFFFF +#define DIRID_STATIC 32 +#define DIRID_MAX 32 +#define DIRID_SEE 30 +#define DIRID_SE 28 +#define DIRID_SSE 26 +#define DIRID_S 24 +#define DIRID_SSW 22 +#define DIRID_SW 20 +#define DIRID_SWW 18 +#define DIRID_W 16 +#define DIRID_NWW 14 +#define DIRID_NW 12 +#define DIRID_NNW 10 +#define DIRID_N 8 +#define DIRID_NNE 6 +#define DIRID_NE 4 +#define DIRID_NEE 2 +#define DIRID_E 0 + +// Definition of control types +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define MVCONT_COMPUTER 0 +#define MVCONT_PLAYER1 1 +#define MVCONT_PLAYER2 2 +#define MVCONT_PLAYER3 3 +#define MVCONT_PLAYER4 4 +#define NB_MVCONT 5 +#define MAX_PLAYERS 4 + +// Definition of joystick controls +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define JOYSTICK_UP 0b00000001 +#define JOYSTICK_DOWN 0b00000010 +#define JOYSTICK_LEFT 0b00000100 +#define JOYSTICK_RIGHT 0b00001000 +#define JOYSTICK_FIRE1 0b00010000 +#define JOYSTICK_FIRE2 0b00100000 +#define JOYSTICK_FIRE3 0b01000000 +#define JOYSTICK_FIRE4 0b10000000 + +// Definition of movement types +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define MVTYPE_STATIC 0 +#define MVTYPE_MOUSE 1 +#define MVTYPE_RACE 2 +#define MVTYPE_GENERIC 3 +#define MVTYPE_BALL 4 +#define MVTYPE_TAPED 5 +#define MVTYPE_INTELLIGENT 6 +#define MVTYPE_PINBALL 7 +#define MVTYPE_LIST 8 +#define MVTYPE_PLATFORM 9 +#define MVTYPE_GOMOVEMENT 10 +#define MVTYPE_DISAPPEAR 11 +#define MVTYPE_APPEAR 12 +#define MVTYPE_BULLET 13 +#define MVTYPE_EXT 14 +#define MVTYPE_MAX 15 + +#define MVTACTION_SAVEPOSITION 0x1010 +#define MVTACTION_LOADPOSITION 0x1011 + +//////////////////////////////////////////////////////////////////////////////// +// EVENTS +//////////////////////////////////////////////////////////////////////////////// + +// Eventgroup structure, before conditions and actions +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagEVG { + short evgSize; // 0 Size of the group (<=0) + BYTE evgNCond; // 2 Number of conditions + BYTE evgNAct; // 3 Number of actions + WORD evgFlags; // 4 Flags + short evgInhibit; // 6 If the group is inhibited + WORD evgInhibitCpt; // 8 Counter + WORD evgIdentifier; // 10 Unique identifier + short evgUndo; // 12 Identifier for UNDO + } eventGroup; +typedef eventGroup * PEVG; +typedef eventGroup * LPEVG; +#define EVG_SIZE 14 + +// MACRO: next group +#define EVGNEXT(evgPtr) ((LPEVG)((LPSTR)evgPtr-evgPtr->evgSize)) +// MACRO: first event +#define EVGFIRSTEVT(p) ((LPEVT)((LPSTR)p+sizeof(eventGroup))) +// MACRO: number of events in the group +#define EVGNEVENTS(p) (p->evgNCond+p->evgNAct) + +// Internal flags of eventgroups +#define EVGFLAGS_ONCE 0x0001 +#define EVGFLAGS_NOTALWAYS 0x0002 +#define EVGFLAGS_REPEAT 0x0004 +#define EVGFLAGS_NOMORE 0x0008 +#define EVGFLAGS_SHUFFLE 0x0010 +#define EVGFLAGS_EDITORMARK 0x0020 +#define EVGFLAGS_UNDOMARK 0x0040 +#define EVGFLAGS_COMPLEXGROUP 0x0080 +#define EVGFLAGS_BREAKPOINT 0x0100 +#define EVGFLAGS_ALWAYSCLEAN 0x0200 +#define EVGFLAGS_ORINGROUP 0x0400 +//#define EVGFLAGS_2MANYACTIONS 0x0400 +#define EVGFLAGS_STOPINGROUP 0x0800 +//#define EVGFLAGS_NOTASSEMBLED 0x1000 +#define EVGFLAGS_ORLOGICAL 0x1000 +#define EVGFLAGS_GROUPED 0x2000 +#define EVGFLAGS_INACTIVE 0x4000 +#define EVGFLAGS_NOGOOD 0x8000 +#define EVGFLAGS_LIMITED (EVGFLAGS_SHUFFLE+EVGFLAGS_NOTALWAYS+EVGFLAGS_REPEAT+EVGFLAGS_NOMORE) +#define EVGFLAGS_DEFAULTMASK (EVGFLAGS_BREAKPOINT+EVGFLAGS_GROUPED) +//#define EVGFLAGS_FADE (EVGFLAGS_FADEIN|EVGFLAGS_FADEOUT) + + +// Condition ou action structure +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagEVTV1 { + short evtSize; + union + { + struct + { + short evtCode; + }; + struct + { + char evtType; + char evtNum; + }; + }; + OINUM evtOi; + short evtOiList; + char evtFlags; + char evtFlags2; + char evtNParams; + char evtDefType; +// For the conditions + short evtIdentifier; + } eventV1; +typedef eventV1 * LPEVTV1; + +#define CND_SIZEV1 14 +#define ACT_SIZEV1 12 +#define EVGFIRSTEVTV1(p) ((LPEVTV1)((LPSTR)p+sizeof(eventGroup))) +#define EVTPARAMSV1(p) ((LPEVP)( p->evtCode<0 ? (LPBYTE)p+CND_SIZEV1 : (LPBYTE)p+ACT_SIZEV1) ) +#define EVTNEXTV1(p) ((LPEVTV1)((LPBYTE)p+p->evtSize)) + + + +typedef struct tagEVT { + short evtSize; // 0 Size of the event + union + { + struct + { + long evtCode; // 2 Code (hi:NUM lo:TYPE) + }; + struct + { + short evtType; // 2 Type of object + short evtNum; // 4 Number of action/condition + }; + }; + OINUM evtOi; // 6 OI if normal object + short evtOiList; // 8 Pointer + char evtFlags; // 10 Flags + char evtFlags2; // 11 Flags II + char evtNParams; // 12 Number of parameters + char evtDefType; // 13 If default, type +// Pour les conditions + short evtIdentifier; // 14 Event identifier + } event; // 16 +typedef event * PEVT; +typedef event * LPEVT; + +#define CND_SIZE 16 +#define ACT_SIZE 14 + +// Definition of conditions / actions flags +#define EVFLAGS_REPEAT 0x01 +#define EVFLAGS_DONE 0x02 +#define EVFLAGS_DEFAULT 0x04 +#define EVFLAGS_DONEBEFOREFADEIN 0x08 +#define EVFLAGS_NOTDONEINSTART 0x10 +#define EVFLAGS_ALWAYS 0x20 +#define EVFLAGS_BAD 0x40 +#define EVFLAGS_BADOBJECT 0x80 +#define EVFLAGS_DEFAULTMASK (EVFLAGS_ALWAYS+EVFLAGS_REPEAT+EVFLAGS_DEFAULT+EVFLAGS_DONEBEFOREFADEIN+EVFLAGS_NOTDONEINSTART) +#define ACTFLAGS_REPEAT 0x0001 + + +// For flags II +// ------------- +#define EVFLAG2_NOT 0x0001 +#define EVFLAG2_NOTABLE 0x0002 +#define EVFLAGS_NOTABLE (EVFLAG2_NOTABLE<<8) +#define EVFLAGS_MONITORABLE 0x0004 +#define EVFLAGS_TODELETE 0x0008 +#define EVFLAGS_NEWSOUND 0x0010 +#define EVFLAG2_MASK (EVFLAG2_NOT|EVFLAG2_NOTABLE|EVFLAGS_MONITORABLE) + +// MACRO: Returns the code for an extension +#define EXTCONDITIONNUM(i) (-((short)(i>>16))-1) +#define EXTACTIONNUM(i) ((short)(i>>16)) + +// PARAM Structure +// ~~~~~~~~~~~~~~~ +#ifdef __cplusplus +class eventParam { +public: +#else +typedef struct eventParam { +#endif + short evpSize; + short evpCode; + union { + struct { + short evpW0; + short evpW1; + short evpW2; + short evpW3; + short evpW4; + short evpW5; + short evpW6; + short evpW7; + } evpW; + struct { + long evpL0; + long evpL1; + long evpL2; + long evpL3; + } evpL; + } evp; +#ifdef __cplusplus +}; +#else +} eventParam; +#endif +typedef eventParam * PEVP; +typedef eventParam * LPEVP; +typedef eventParam * fpevp; + +// MACRO: next parameter +#define EVPNEXT(p) ((LPEVP)((LPSTR)p+p->evpSize)) + + +// Operators / expressions parameters +// -------------------------------------------------- +#define MIN_LONG (-10000000L) +#define MAX_LONG (10000000L) +#define EXPPARAM_LONG 1 +#define EXPPARAM_VARGLO 2 +#define EXPPARAM_STRING 3 +#define EXPPARAM_ALTVALUE 4 +#define EXPPARAM_FLAG 5 +#define EXP_STOP -1 +#define OPERATOR_START 0x00000000 +#define EXPL_END 0x00000000 +#define EXPL_PLUS 0x00020000 +#define EXPL_MOINS 0x00040000 +#define EXPL_MULT 0x00060000 +#define EXPL_DIV 0x00080000 +#define EXPL_MOD 0x000A0000 +#define EXPL_POW 0x000C0000 +#define EXPL_AND 0x000E0000 +#define EXPL_OR 0x00100000 +#define EXPL_XOR 0x00120000 +#define OPERATOR_END 0x00140000 +typedef struct tagEXP { + union + { + struct + { + long expCode; // 2 Code (hi:NUM lo:TYPE) + }; + struct + { + short expType; // 2 Type of object + short expNum; // 3 Expression number + }; + }; + short expSize; + union + { + struct { + short expOi; + short expOiList; + } expo; + struct { + long expLParam; + } expl; + struct { + double expDouble; + float expFloat; + } expd; + struct { + short expWParam0; + short expWParam1; + } expw; + struct { + short expOi; + short expOiList; + short expNum; + } expv; + struct { + long expExtCode; + short expExtNumber; + } expc; + } expu; + } expression; +typedef expression * LPEXP; +typedef expression * PEXP; + +#define CMPOPE_EQU 0x0000 +#define CMPOPE_DIF 0x0001 +#define CMPOPE_LOWEQU 0x0002 +#define CMPOPE_LOW 0x0003 +#define CMPOPE_GREEQU 0x0004 +#define CMPOPE_GRE 0x0005 +#define MAX_CMPOPE 6 +#define EXPNEXT(expPtr) ((LPEXP)((LPSTR)expPtr+expPtr->expSize)) +#define EXPFLAG_STRING 0x0001 +#define EXPFLAG_DOUBLE 0x0002 + +typedef struct tagEXPV1 { + union + { + struct + { + short expCode; + }; + struct + { + char expType; + char expNum; + }; + }; + short expSize; + union + { + struct { + short expOi; + short expOiList; + } expo; + struct { + long expLParam; + } expl; + struct { + double expDouble; + float expFloat; + } expd; + struct { + short expWParam0; + short expWParam1; + } expw; + struct { + short expOi; + short expOiList; + short expNum; + } expv; + struct { + long expExtCode; + short expExtNumber; + } expc; + } expu; + }expressionV1; +typedef expressionV1 * LPEXPV1; + +#define EXPNEXTV1(expPtr) ((LPEXPV1)((LPSTR)expPtr+expPtr->expSize)) + +/* +#define Q_SPR 0x0100 +#define Q_TXT 0x0200 +#define Q_QST 0x0400 +#define Q_ARE 0x0800 +#define Q_CNT 0x1000 +#define Q_PLA 0x2000 +#define Q_GAM 0x4000 +#define Q_TIM 0x8000 +#define Q_COL 0x0001 +#define Q_ZNE 0x0002 +#define Q_MVT 0x0004 +#define Q_ANI 0x0008 +#define Q_OBJ 0x0010 +#define Q_KEY 0x0020 +#define Q_SYS 0x0040 +*/ + +// Information structure +// ---------------------------------------------- +typedef struct tagEVO { + short evoConditions; // Conditions + short evoActions; // Actions + short evoExpressions; // Expressions + short evoMsgMenus; // Menu strings for actions/conditions + short evoMsgDisplay; // Display strings for actions/conditions + short evoMsgExpressions; // Menu/display strings for expressions + short evoMsgExpParams; // Parameter string + short evoNConditions; // Number of conditions + } eventInfosOffsets; +typedef eventInfosOffsets * PEVO; +typedef eventInfosOffsets * LPEVO; + +// Definition of the different system objects (TYPE<0) +// ---------------------------------------------------------- +#define TYPE_DIRECTION -127 +#define TYPE_QUALIFIER -126 +#define NUMBEROF_SYSTEMTYPES 7 +#define OBJ_PLAYER -7 +#define OBJ_KEYBOARD -6 +#define OBJ_CREATE -5 +#define OBJ_TIMER -4 +#define OBJ_GAME -3 +#define OBJ_SPEAKER -2 +#define OBJ_SYSTEM -1 +#define OBJ_FIRST_C_OBJECT 8 +#define OBJ_LAST NB_SYSOBJ + + + + + + + + +// ------------------------------------------------------------ +// EXTENSION OBJECT DATA ZONE +// ------------------------------------------------------------ + +// Flags +#define OEFLAG_DISPLAYINFRONT 0x0001 +#define OEFLAG_BACKGROUND 0x0002 +#define OEFLAG_BACKSAVE 0x0004 +#define OEFLAG_RUNBEFOREFADEIN 0x0008 +#define OEFLAG_MOVEMENTS 0x0010 +#define OEFLAG_ANIMATIONS 0x0020 +#define OEFLAG_TABSTOP 0x0040 +#define OEFLAG_WINDOWPROC 0x0080 +#define OEFLAG_VALUES 0x0100 +#define OEFLAG_SPRITES 0x0200 +#define OEFLAG_INTERNALBACKSAVE 0x0400 +#define OEFLAG_SCROLLINGINDEPENDANT 0x0800 +#define OEFLAG_QUICKDISPLAY 0x1000 +#define OEFLAG_NEVERKILL 0x2000 +#define OEFLAG_NEVERSLEEP 0x4000 +#define OEFLAG_MANUALSLEEP 0x8000 +#define OEFLAG_TEXT 0x10000 +#define OEFLAG_DONTCREATEATSTART 0x20000 + +// Flags modifiable by the program +#define OEPREFS_BACKSAVE 0x0001 +#define OEPREFS_SCROLLINGINDEPENDANT 0x0002 +#define OEPREFS_QUICKDISPLAY 0x0004 +#define OEPREFS_SLEEP 0x0008 +#define OEPREFS_LOADONCALL 0x0010 +#define OEPREFS_GLOBAL 0x0020 +#define OEPREFS_BACKEFFECTS 0x0040 +#define OEPREFS_KILL 0x0080 +#define OEPREFS_INKEFFECTS 0x0100 +#define OEPREFS_TRANSITIONS 0x0200 +#define OEPREFS_FINECOLLISIONS 0x0400 +#define OEPREFS_APPLETPROBLEMS 0x0800 + +// Running flags +#define REFLAG_ONESHOT 0x0001 +#define REFLAG_DISPLAY 0x0002 +#define REFLAG_MSGHANDLED 0x0004 +#define REFLAG_MSGCATCHED 0x0008 +#define REFLAG_MSGDEFPROC 0x0010 + +#define REFLAG_MSGRETURNVALUE 0x0040 + +#define OEFLAGS_DEFAULTSETUPS (OEFLAG_MOVEMENTS|OEFLAG_ANIMATIONS|OEFLAG_SPRITES|OEFLAG_VALUES) + + + +#ifndef IN_KPX + +/////////////////////////////////////////////////////////////////////// +// +// DEFINITION OF EVENTS AND ACTIONS CODES +// +/////////////////////////////////////////////////////////////////////// + +// SYSTEM Conditions / Actions +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +//#define OBJ_SYSTEM -1 +//-1&255=255 +#define CND_CHANCE ((-26<<8)|255) +#define CND_ORLOGICAL ((-25<<8)|255) +#define CNDL_ORLOGICAL ((-25<<16)|65535) +#define CND_OR ((-24<<8)|255) +#define CNDL_OR ((-24<<16)|65535) +#define CND_GROUPSTART ((-23<<8)|255) +#define CNDL_GROUPSTART ((-23<<16)|65535) +#define CND_CLIPBOARD ((-22<<8)|255) +#define CND_ONCLOSE ((-21<<8)|255) +#define CNDL_ONCLOSE ((-21<<16)|65535) +#define CND_COMPAREGSTRING ((-20<<8)|255) +#define CNDL_COMPAREGSTRING ((-20<<16)|65535) +#define CND_MENUVISIBLE ((-19<<8)|255) +#define CND_MENUENABLED ((-18<<8)|255) +#define CND_MENUCHECKED ((-17<<8)|255) +#define CND_ONLOOP ((-16<<8)|255) +#define CNDL_ONLOOP ((-16<<16)|65535) +#define CND_DROPFILES ((-15<<8)|255) +#define CNDL_DROPFILES ((-15<<16)|65535) +#define CND_MENUSELECTED ((-14<<8)|255) +#define CNDL_MENUSELECTED ((-14<<16)|65535) +#define CND_RECORDKEY ((-13<<8)|255) +#define CNDL_RECORDKEY ((-13<<16)|65535) +#define CND_GROUPACTIVATED ((-12<<8)|255) +#define CNDL_GROUPACTIVATED ((-12<<16)|65535) +#define CND_ENDGROUP ((-11<<8)|255) +#define CNDL_ENDGROUP ((-11<<16)|65535) +#define CND_GROUP ((-10<<8)|255) +#define CNDL_GROUP ((-10<<16)|65535) +#define CND_REMARK ((-9<<8)|255) +#define CNDL_REMARK ((-9<<16)|65535) +#define CND_COMPAREG ((-8<<8)|255) +#define CNDL_COMPAREG ((-8<<16)|65535) +#define CND_NOTALWAYS ((-7<<8)|255) +#define CNDL_NOTALWAYS ((-7<<16)|65535) +#define CND_ONCE ((-6<<8)|255) +#define CNDL_ONCE ((-6<<16)|65535) +#define CND_REPEAT ((-5<<8)|255) +#define CNDL_REPEAT ((-5<<16)|65535) +#define CND_NOMORE ((-4<<8)|255) +#define CNDL_NOMORE ((-4<<16)|65535) +#define CND_COMPARE ((-3<<8)|255) +#define CND_NEVER ((-2<<8)|255) +#define CNDL_NEVER ((-2<<16)|65535) +#define CND_ALWAYS ((-1<<8)|255) +#define CNDL_ALWAYS ((-1<<16)|65535) + +#define ACT_SKIP ((0<<8)|255) +#define ACTL_SKIP ((0<<16)|65535) +#define ACT_SKIPMONITOR ((1<<8)|255) +#define ACTL_SKIPMONITOR ((1<<16)|65535) +#define ACT_EXECPROG ((2<<8)|255) +#define ACT_SETVARG ((3<<8)|255) +#define ACTL_SETVARG ((3<<16)|65535) +#define ACT_SUBVARG ((4<<8)|255) +#define ACTL_SUBVARG ((4<<16)|65535) +#define ACT_ADDVARG ((5<<8)|255) +#define ACTL_ADDVARG ((5<<16)|65535) +#define ACT_GRPACTIVATE ((6<<8)|255) +#define ACTL_GRPACTIVATE ((6<<16)|65535) +#define ACT_GRPDEACTIVATE ((7<<8)|255) +#define ACTL_GRPDEACTIVATE ((7<<16)|65535) +#define ACT_MENUACTIVATE ((8<<8)|255) +#define ACT_MENUDEACTIVATE ((9<<8)|255) +#define ACT_MENUCHECK ((10<<8)|255) +#define ACT_MENUNCHECK ((11<<8)|255) +#define ACT_MENUSHOW ((12<<8)|255) +#define ACTL_MENUSHOW ((12<<16)|65535) +#define ACT_MENUHIDE ((13<<8)|255) +#define ACTL_MENUHIDE ((13<<16)|65535) +#define ACT_STARTLOOP ((14<<8)|255) +#define ACT_STOPLOOP ((15<<8)|255) +#define ACT_SETLOOPINDEX ((16<<8)|255) +#define ACT_RANDOMIZE ((17<<8)|255) +#define ACT_SENDMENUCMD ((18<<8)|255) +#define ACT_SETGLOBALSTRING ((19<<8)|255) +#define ACTL_SETGLOBALSTRING ((19<<16)|65535) +#define ACT_SENDCLIPBOARD ((20<<8)|255) +#define ACT_CLEARCLIPBOARD ((21<<8)|255) +#define ACT_EXECPROG2 ((22<<8)|255) +#define ACT_OPENDEBUGGER ((23<<8)|255) +#define ACT_PAUSEDEBUGGER ((24<<8)|255) +#define ACT_EXTRACTBINFILE ((25<<8)|255) +#define ACT_RELEASEBINFILE ((26<<8)|255) + +#define EXP_LONG ((0<<8)|255) +#define EXPL_LONG ((0<<16)|65535) +#define EXP_RANDOM ((1<<8)|255) +#define EXPL_RANDOM ((1<<16)|65535) +#define EXP_VARGLO ((2<<8)|255) +#define EXPL_VARGLO ((2<<16)|65535) +#define EXP_STRING ((3<<8)|255) +#define EXPL_STRING ((3<<16)|65535) +#define EXP_STR ((4<<8)|255) +#define EXPL_STR ((4<<16)|65535) +#define EXP_VAL ((5<<8)|255) +#define EXPL_VAL ((5<<16)|65535) +#define EXP_DRIVE ((6<<8)|255) +#define EXPL_DRIVE ((6<<16)|65535) +#define EXP_DIRECTORY ((7<<8)|255) +#define EXPL_DIRECTORY ((7<<16)|65535) +#define EXP_PATH ((8<<8)|255) +#define EXPL_PATH ((8<<16)|65535) +#define EXP_APPNAME ((9<<8)|255) +#define EXPL_APPNAME ((9<<16)|65535) +#define EXP_SIN ((10<<8)|255) +#define EXPL_SIN ((10<<16)|65535) +#define EXP_COS ((11<<8)|255) +#define EXPL_COS ((11<<16)|65535) +#define EXP_TAN ((12<<8)|255) +#define EXPL_TAN ((12<<16)|65535) +#define EXP_SQR ((13<<8)|255) +#define EXPL_SQR ((13<<16)|65535) +#define EXP_LOG ((14<<8)|255) +#define EXPL_LOG ((14<<16)|65535) +#define EXP_LN ((15<<8)|255) +#define EXPL_LN ((15<<16)|65535) +#define EXP_HEX ((16<<8)|255) +#define EXPL_HEX ((16<<16)|65535) +#define EXP_BIN ((17<<8)|255) +#define EXPL_BIN ((17<<16)|65535) +#define EXP_EXP ((18<<8)|255) +#define EXPL_EXP ((18<<16)|65535) +#define EXP_LEFT ((19<<8)|255) +#define EXPL_LEFT ((19<<16)|65535) +#define EXP_RIGHT ((20<<8)|255) +#define EXPL_RIGHT ((20<<16)|65535) +#define EXP_MID ((21<<8)|255) +#define EXPL_MID ((21<<16)|65535) +#define EXP_LEN ((22<<8)|255) +#define EXPL_LEN ((22<<16)|65535) +#define EXP_DOUBLE ((23<<8)|255) +#define EXPL_DOUBLE ((23<<16)|65535) +#define EXP_VARGLONAMED ((24<<8)|255) +#define EXPL_VARGLONAMED ((24<<16)|65535) +#define EXP_ENTERSTRINGHERE ((25<<8)|255) +#define EXPL_ENTERSTRINGHERE ((25<<16)|65535) +#define EXP_ENTERVALUEHERE ((26<<8)|255) +#define EXPL_ENTERVALUEHERE ((26<<16)|65535) +#define EXP_FLOAT ((27<<8)|255) +#define EXPL_FLOAT ((27<<16)|65535) +#define EXP_INT ((28<<8)|255) +#define EXPL_INT ((28<<16)|65535) +#define EXP_ABS ((29<<8)|255) +#define EXPL_ABS ((29<<16)|65535) +#define EXP_CEIL ((30<<8)|255) +#define EXPL_CEIL ((30<<16)|65535) +#define EXP_FLOOR ((31<<8)|255) +#define EXPL_FLOOR ((31<<16)|65535) +#define EXP_ACOS ((32<<8)|255) +#define EXPL_ACOS ((32<<16)|65535) +#define EXP_ASIN ((33<<8)|255) +#define EXPL_ASIN ((33<<16)|65535) +#define EXP_ATAN ((34<<8)|255) +#define EXPL_ATAN ((34<<16)|65535) +#define EXP_NOT ((35<<8)|255) +#define EXPL_NOT ((35<<16)|65535) +#define EXP_NDROPFILES ((36<<8)|255) +#define EXPL_NDROPFILES ((36<<16)|65535) +#define EXP_DROPFILE ((37<<8)|255) +#define EXPL_DROPFILE ((37<<16)|65535) +#define EXP_GETCOMMANDLINE ((38<<8)|255) +#define EXPL_GETCOMMANDLINE ((38<<16)|65535) +#define EXP_GETCOMMANDITEM ((39<<8)|255) +#define EXPL_GETCOMMANDITEM ((39<<16)|65535) +#define EXP_MIN ((40<<8)|255) +#define EXPL_MIN ((40<<16)|65535) +#define EXP_MAX ((41<<8)|255) +#define EXPL_MAX ((41<<16)|65535) +#define EXP_GETRGB ((42<<8)|255) +#define EXPL_GETRGB ((42<<16)|65535) +#define EXP_GETRED ((43<<8)|255) +#define EXPL_GETRED ((43<<16)|65535) +#define EXP_GETGREEN ((44<<8)|255) +#define EXPL_GETGREEN ((44<<16)|65535) +#define EXP_GETBLUE ((45<<8)|255) +#define EXPL_GETBLUE ((45<<16)|65535) +#define EXP_LOOPINDEX ((46<<8)|255) +#define EXPL_LOOPINDEX ((46<<16)|65535) +#define EXP_NEWLINE ((47<<8)|255) +#define EXPL_NEWLINE ((47<<16)|65535) +#define EXP_ROUND ((48<<8)|255) +#define EXPL_ROUND ((48<<16)|65535) +#define EXP_STRINGGLO ((49<<8)|255) +#define EXPL_STRINGGLO ((49<<16)|65535) +#define EXP_STRINGGLONAMED ((50<<8)|255) +#define EXPL_STRINGGLONAMED ((50<<16)|65535) +#define EXP_LOWER ((51<<8)|255) +#define EXPL_LOWER ((51<<16)|65535) +#define EXP_UPPER ((52<<8)|255) +#define EXPL_UPPER ((52<<16)|65535) +#define EXP_FIND ((53<<8)|255) +#define EXPL_FIND ((53<<16)|65535) +#define EXP_REVERSEFIND ((54<<8)|255) +#define EXPL_REVERSEFIND ((54<<16)|65535) +#define EXP_GETCLIPBOARD ((55<<8)|255) +#define EXP_TEMPPATH ((56<<8)|255) +#define EXP_BINFILETEMPNAME ((57<<8)|255) +#define EXP_FLOATSTR ((58<<8)|255) +#define EXPL_FLOATSTR ((58<<16)|65535) +#define EXP_ATAN2 ((59<<8)|255) +#define EXPL_ATAN2 ((59<<16)|65535) +#define EXP_ZERO ((60<<8)|255) +#define EXPL_ZERO ((60<<16)|65535) +#define EXP_EMPTY ((61<<8)|255) +#define EXPL_EMPTY ((61<<16)|65535) + +#define EXP_PARENTH1 ((-1<<8)|255) +#define EXPL_PARENTH1 ((-1<<16)|65535) +#define EXP_PARENTH2 ((-2<<8)|255) +#define EXPL_PARENTH2 ((-2<<16)|65535) +#define EXP_VIRGULE ((-3<<8)|255) +#define EXPL_VIRGULE ((-3<<16)|65535) + +// SPEAKER Conditions / Actions +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// #define TYPE_SPEAKER -2 +//(TYPE_SPEAKER&255)=254 +#define CND_SPCHANNELPAUSED ((-9<<8)|254) +#define CNDL_SPCHANNELPAUSED ((-9<<16)|65534) +#define CND_NOSPCHANNELPLAYING ((-8<<8)|254) +#define CNDL_NOSPCHANNELPLAYING ((-8<<16)|65534) +#define CND_MUSPAUSED ((-7<<8)|254) +#define CND_SPSAMPAUSED ((-6<<8)|254) +#define CNDL_SPSAMPAUSED ((-6<<16)|65534) +#define CND_MUSICENDS ((-5<<8)|254) +#define CNDL_MUSICENDS ((-5<<16)|65534) +#define CND_NOMUSPLAYING ((-4<<8)|254) +#define CNDL_NOMUSPLAYING ((-4<<16)|65534) +#define CND_NOSAMPLAYING ((-3<<8)|254) +#define CNDL_NOSAMPLAYING ((-3<<16)|65534) +#define CND_NOSPMUSPLAYING ((-2<<8)|254) +#define CND_NOSPSAMPLAYING ((-1<<8)|254) +#define CNDL_NOSPSAMPLAYING ((-1<<16)|65534) +#define ACT_PLAYSAMPLE ((0<<8)|254) +#define ACTL_PLAYSAMPLE ((0<<16)|65534) +#define ACT_STOPSAMPLE ((1<<8)|254) +#define ACTL_STOPSAMPLE ((1<<16)|65534) +#define ACT_PLAYMUSIC ((2<<8)|254) +#define ACTL_PLAYMUSIC ((2<<16)|65534) +#define ACT_STOPMUSIC ((3<<8)|254) +#define ACTL_STOPMUSIC ((3<<16)|65534) +#define ACT_PLAYLOOPSAMPLE ((4<<8)|254) +#define ACTL_PLAYLOOPSAMPLE ((4<<16)|65534) +#define ACT_PLAYLOOPMUSIC ((5<<8)|254) +#define ACT_STOPSPESAMPLE ((6<<8)|254) +#define ACTL_STOPSPESAMPLE ((6<<16)|65534) +#define ACT_PAUSESAMPLE ((7<<8)|254) +#define ACTL_PAUSESAMPLE ((7<<16)|65534) +#define ACT_RESUMESAMPLE ((8<<8)|254) +#define ACTL_RESUMESAMPLE ((8<<16)|65534) +#define ACT_PAUSEMUSIC ((9<<8)|254) +#define ACT_RESUMEMUSIC ((10<<8)|254) +#define ACT_PLAYCHANNEL ((11<<8)|254) +#define ACTL_PLAYCHANNEL ((11<<16)|65534) +#define ACT_PLAYLOOPCHANNEL ((12<<8)|254) +#define ACTL_PLAYLOOPCHANNEL ((12<<16)|65534) +#define ACT_PAUSECHANNEL ((13<<8)|254) +#define ACTL_PAUSECHANNEL ((13<<16)|65534) +#define ACT_RESUMECHANNEL ((14<<8)|254) +#define ACTL_RESUMECHANNEL ((14<<16)|65534) +#define ACT_STOPCHANNEL ((15<<8)|254) +#define ACTL_STOPCHANNEL ((15<<16)|65534) +#define ACT_SETCHANNELPOS ((16<<8)|254) +#define ACTL_SETCHANNELPOS ((16<<16)|65534) +#define ACT_SETCHANNELVOL ((17<<8)|254) +#define ACTL_SETCHANNELVOL ((17<<16)|65534) +#define ACT_SETCHANNELPAN ((18<<8)|254) +#define ACTL_SETCHANNELPAN ((18<<16)|65534) +#define ACT_SETSAMPLEPOS ((19<<8)|254) +#define ACTL_SETSAMPLEPOS ((19<<16)|65534) +#define ACT_SETSAMPLEMAINVOL ((20<<8)|254) +#define ACTL_SETSAMPLEMAINVOL ((20<<16)|65534) +#define ACT_SETSAMPLEVOL ((21<<8)|254) +#define ACTL_SETSAMPLEVOL ((21<<16)|65534) +#define ACT_SETSAMPLEMALNPAN ((22<<8)|254) +#define ACTL_SETSAMPLEMALNPAN ((22<<16)|65534) +#define ACT_SETSAMPLEPAN ((23<<8)|254) +#define ACTL_SETSAMPLEPAN ((23<<16)|65534) +#define ACT_PAUSEALLCHANNELS ((24<<8)|254) +#define ACTL_PAUSEALLCHANNELS ((24<<16)|65534) +#define ACT_RESUMEALLCHANNELS ((25<<8)|254) +#define ACTL_RESUMEALLCHANNELS ((25<<16)|65534) +#define ACT_PLAYMUSICFILE ((26<<8)|254) +#define ACT_PLAYLOOPMUSICFILE ((27<<8)|254) +#define ACT_PLAYFILECHANNEL ((28<<8)|254) +#define ACTL_PLAYFILECHANNEL ((28<<16)|65534) +#define ACT_PLAYLOOPFILECHANNEL ((29<<8)|254) +#define ACTL_PLAYLOOPFILECHANNEL ((29<<16)|65534) +#define ACT_LOCKCHANNEL ((30<<8)|254) +#define ACTL_LOCKCHANNEL ((30<<16)|65534) +#define ACT_UNLOCKCHANNEL ((31<<8)|254) +#define ACTL_UNLOCKCHANNEL ((31<<16)|65534) +#define ACT_SETCHANNELFREQ ((32<<8)|254) +#define ACT_SETSAMPLEFREQ ((33<<8)|254) + +#define EXP_GETSAMPLEMAINVOL ((0<<8)|254) +#define EXP_GETSAMPLEVOL ((1<<8)|254) +#define EXP_GETCHANNELVOL ((2<<8)|254) +#define EXPL_GETCHANNELVOL ((2<<16)|65534) +#define EXP_GETSAMPLEMAINPAN ((3<<8)|254) +#define EXP_GETSAMPLEPAN ((4<<8)|254) +#define EXP_GETCHANNELPAN ((5<<8)|254) +#define EXPL_GETCHANNELPAN ((5<<16)|65534) +#define EXP_GETSAMPLEPOS ((6<<8)|254) +#define EXP_GETCHANNELPOS ((7<<8)|254) +#define EXPL_GETCHANNELPOS ((7<<16)|65534) +#define EXP_GETSAMPLEDUR ((8<<8)|254) +#define EXP_GETCHANNELDUR ((9<<8)|254) +#define EXP_GETSAMPLEFREQ ((10<<8)|254) +#define EXP_GETCHANNELFREQ ((11<<8)|254) + + +// GAME Conditions / Actions +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +//#define TYPE_GAME -3 +//(TYPE_GAME&255)=253 + +#define CND_FRAMESAVED ((-10<<8)|253) +#define CND_FRAMELOADED ((-9<<8)|253) +#define CNDL_ENDOFPAUSE ((-8<<16)|65533) +#define CND_ENDOFPAUSE ((-8<<8)|253) +#define CND_ISVSYNCON ((-7<<8)|253) +#define CND_ISLADDER ((-6<<8)|253) +#define CND_ISOBSTACLE ((-5<<8)|253) +#define CND_QUITAPPLICATION ((-4<<8)|253) +#define CNDL_QUITAPPLICATION ((-4<<16)|65533) +#define CND_LEVEL ((-3<<8)|253) +#define CND_END ((-2<<8)|253) +#define CNDL_END ((-2<<16)|65533) +#define CND_START ((-1<<8)|253) +#define CNDL_START ((-1<<16)|65533) + +#define ACT_NEXTLEVEL ((0<<8)|253) +#define ACTL_NEXTLEVEL ((0<<16)|65533) +#define ACT_PREVLEVEL ((1<<8)|253) +#define ACTL_PREVLEVEL ((1<<16)|65533) +#define ACT_GOLEVEL ((2<<8)|253) +#define ACTL_GOLEVEL ((2<<16)|65533) +#define ACT_PAUSE ((3<<8)|253) +#define ACT_ENDGAME ((4<<8)|253) +#define ACTL_ENDGAME ((4<<16)|65533) +#define ACT_RESTARTGAME ((5<<8)|253) +#define ACTL_RESTARTGAME ((5<<16)|65533) +#define ACT_RESTARTLEVEL ((6<<8)|253) +#define ACT_CDISPLAY ((7<<8)|253) +#define ACT_CDISPLAYX ((8<<8)|253) +#define ACT_CDISPLAYY ((9<<8)|253) +#define ACT_LOADGAME ((10<<8)|253) +#define ACT_SAVEGAME ((11<<8)|253) +#define ACT_CLS ((12<<8)|253) +#define ACT_CLEARZONE ((13<<8)|253) +#define ACT_FULLSCREENMODE ((14<<8)|253) +#define ACT_WINDOWEDMODE ((15<<8)|253) +#define ACT_SETFRAMERATE ((16<<8)|253) +#define ACT_PAUSEKEY ((17<<8)|253) +#define ACT_PAUSEANYKEY ((18<<8)|253) +#define ACT_SETVSYNCON ((19<<8)|253) +#define ACT_SETVSYNCOFF ((20<<8)|253) +#define ACT_SETVIRTUALWIDTH ((21<<8)|253) +#define ACT_SETVIRTUALHEIGHT ((22<<8)|253) +#define ACT_SETFRAMEBDKCOLOR ((23<<8)|253) +#define ACT_DELCREATEDBKDAT ((24<<8)|253) +#define ACT_DELALLCREATEDBKD ((25<<8)|253) +#define ACT_SETFRAMEWIDTH ((26<<8)|253) +#define ACT_SETFRAMEHEIGHT ((27<<8)|253) +#define ACT_SAVEFRAME ((28<<8)|253) +#define ACT_LOADFRAME ((29<<8)|253) +#define ACT_LOADAPPLICATION ((30<<8)|253) +#define ACT_PLAYDEMO ((31<<8)|253) +#define ACT_SETFRAMEEFFECT ((32<<8)|253) +#define ACT_SETFRAMEEFFECTPARAM ((33<<8)|253) +#define ACT_SETFRAMEEFFECTPARAMTEXTURE ((34<<8)|253) +#define ACT_SETFRAMEALPHACOEF ((35<<8)|253) +#define ACT_SETFRAMERGBCOEF ((36<<8)|253) + +#define EXP_GAMLEVEL ((0<<8)|253) +#define EXP_GAMNPLAYER ((1<<8)|253) +#define EXP_PLAYXLEFT ((2<<8)|253) +#define EXP_PLAYXRIGHT ((3<<8)|253) +#define EXP_PLAYYTOP ((4<<8)|253) +#define EXP_PLAYYBOTTOM ((5<<8)|253) +#define EXP_PLAYWIDTH ((6<<8)|253) +#define EXP_PLAYHEIGHT ((7<<8)|253) +#define EXP_GAMLEVELNEW ((8<<8)|253) +#define EXP_GETCOLLISIONMASK ((9<<8)|253) +#define EXP_FRAMERATE ((10<<8)|253) +#define EXP_GETVIRTUALWIDTH ((11<<8)|253) +#define EXP_GETVIRTUALHEIGHT ((12<<8)|253) +#define EXP_GETFRAMEBKDCOLOR ((13<<8)|253) +#define EXP_GRAPHICMODE ((14<<8)|253) +#define EXP_PIXELSHADERVERSION ((15<<8)|253) +#define EXP_FRAMEALPHACOEF ((16<<8)|253) +#define EXP_FRAMERGBCOEF ((17<<8)|253) +#define EXP_FRAMEEFFECTPARAM ((18<<8)|253) + + +// TIMER Conditions / Actions +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define CND_TIMEOUT ((-5<<8)|(OBJ_TIMER&255)) +#define CND_EVERY ((-4<<8)|(OBJ_TIMER&255)) +#define CNDL_EVERY ((-4<<16)|(OBJ_TIMER&0xFFFF)) +#define CND_TIMER ((-3<<8)|(OBJ_TIMER&255)) +#define CNDL_TIMER ((-3<<16)|(OBJ_TIMER&0xFFFF)) +#define CND_TIMERINF ((-2<<8)|(OBJ_TIMER&255)) +#define CNDL_TIMERINF ((-2<<16)|(OBJ_TIMER&0xFFFF)) +#define CND_TIMERSUP ((-1<<8)|(OBJ_TIMER&255)) +#define CNDL_TIMERSUP ((-1<<16)|(OBJ_TIMER&0xFFFF)) +#define ACT_SETTIMER ((0<<8)|(OBJ_TIMER&255)) +#define EXP_TIMVALUE ((0<<8)|(OBJ_TIMER&255)) +#define EXP_TIMCENT ((1<<8)|(OBJ_TIMER&255)) +#define EXP_TIMSECONDS ((2<<8)|(OBJ_TIMER&255)) +#define EXP_TIMHOURS ((3<<8)|(OBJ_TIMER&255)) +#define EXP_TIMMINITS ((4<<8)|(OBJ_TIMER&255)) +#define NUM_EVERY -4 +#define NUM_TIMER -3 +#define NUM_TIMERINF -2 +#define NUM_TIMERSUP -1 + +// KEYBOARD Conditions / Actions +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define CNDL_ONMOUSEWHEELDOWN ((-12<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_ONMOUSEWHEELDOWN ((-12<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_ONMOUSEWHEELUP ((-11<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_ONMOUSEWHEELUP ((-11<<8)|(OBJ_KEYBOARD&255)) +#define CND_MOUSEON ((-10<<8)|(OBJ_KEYBOARD&255)) +#define CND_ANYKEY ((-9<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_ANYKEY ((-9<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_MKEYDEPRESSED ((-8<<8)|(OBJ_KEYBOARD&255)) +#define CND_MCLICKONOBJECT ((-7<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_MCLICKONOBJECT ((-7<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_MCLICKINZONE ((-6<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_MCLICKINZONE ((-6<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_MCLICK ((-5<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_MCLICK ((-5<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_MONOBJECT ((-4<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_MONOBJECT ((-4<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_MINZONE ((-3<<8)|(OBJ_KEYBOARD&255)) +#define CND_KBKEYDEPRESSED ((-2<<8)|(OBJ_KEYBOARD&255)) +#define CND_KBPRESSKEY ((-1<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_KBPRESSKEY ((-1<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define ACT_HIDECURSOR ((0<<8)|(OBJ_KEYBOARD&255)) +#define ACT_SHOWCURSOR ((1<<8)|(OBJ_KEYBOARD&255)) +#define EXP_XMOUSE ((0<<8)|(OBJ_KEYBOARD&255)) +#define EXP_YMOUSE ((1<<8)|(OBJ_KEYBOARD&255)) +#define EXP_MOUSEWHEELDELTA ((2<<8)|(OBJ_KEYBOARD&255)) + + +// PLAYERS Conditions / Actions +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define CND_JOYPUSHED ((-6<<8)|(OBJ_PLAYER&255)) +#define CND_NOMORELIVE ((-5<<8)|(OBJ_PLAYER&255)) +#define CNDL_NOMORELIVE ((-5<<16)|(OBJ_PLAYER&0xFFFF)) +#define CND_JOYPRESSED ((-4<<8)|(OBJ_PLAYER&255)) +#define CNDL_JOYPRESSED ((-4<<16)|(OBJ_PLAYER&0xFFFF)) +#define CND_LIVE ((-3<<8)|(OBJ_PLAYER&255)) +#define CND_SCORE ((-2<<8)|(OBJ_PLAYER&255)) +#define CND_PLAYERPLAYING ((-1<<8)|(OBJ_PLAYER&255)) + +#define ACT_SETSCORE ((0<<8)|(OBJ_PLAYER&255)) +#define ACT_SETLIVES ((1<<8)|(OBJ_PLAYER&255)) +#define ACT_NOINPUT ((2<<8)|(OBJ_PLAYER&255)) +#define ACT_RESTINPUT ((3<<8)|(OBJ_PLAYER&255)) +#define ACT_ADDSCORE ((4<<8)|(OBJ_PLAYER&255)) +#define ACT_ADDLIVES ((5<<8)|(OBJ_PLAYER&255)) +#define ACT_SUBSCORE ((6<<8)|(OBJ_PLAYER&255)) +#define ACT_SUBLIVES ((7<<8)|(OBJ_PLAYER&255)) +#define ACT_SETINPUT ((8<<8)|(OBJ_PLAYER&255)) +#define ACT_SETINPUTKEY ((9<<8)|(OBJ_PLAYER&255)) +#define ACT_SETPLAYERNAME ((10<<8)|(OBJ_PLAYER&255)) + +#define EXP_PLASCORE ((0<<8)|(OBJ_PLAYER&255)) +#define EXP_PLALIVES ((1<<8)|(OBJ_PLAYER&255)) +#define EXP_GETINPUT ((2<<8)|(OBJ_PLAYER&255)) +#define EXP_GETINPUTKEY ((3<<8)|(OBJ_PLAYER&255)) +#define EXP_GETPLAYERNAME ((4<<8)|(OBJ_PLAYER&255)) +#define NUM_JOYPRESSED -4 + +// CREATE Conditions / Actions +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define CND_CHOOSEALLINLINE ((-23<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEFLAGRESET ((-22<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEFLAGSET ((-21<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEVALUE ((-20<<8)|(OBJ_CREATE&255)) +#define CND_PICKFROMID ((-19<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEALLINZONE ((-18<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEALL ((-17<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEZONE ((-16<<8)|(OBJ_CREATE&255)) +#define CND_NUMOFALLOBJECT ((-15<<8)|(OBJ_CREATE&255)) +#define CND_NUMOFALLZONE ((-14<<8)|(OBJ_CREATE&255)) +#define CND_NOMOREALLZONE ((-13<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEFLAGRESET_OLD ((-12<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEFLAGSET_OLD ((-11<<8)|(OBJ_CREATE&255)) +//... +#define CND_CHOOSEVALUE_OLD ((-8<<8)|(OBJ_CREATE&255)) +#define CND_PICKFROMID_OLD ((-7<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEALLINZONE_OLD ((-6<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEALL_OLD ((-5<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEZONE_OLD ((-4<<8)|(OBJ_CREATE&255)) +#define CND_NUMOFALLOBJECT_OLD ((-3<<8)|(OBJ_CREATE&255)) +#define CND_NUMOFALLZONE_OLD ((-2<<8)|(OBJ_CREATE&255)) +#define CND_NOMOREALLZONE_OLD ((-1<<8)|(OBJ_CREATE&255)) +#define ACT_CREATE ((0<<8)|(OBJ_CREATE&255)) +#define EXP_CRENUMBERALL ((0<<8)|(OBJ_CREATE&255)) +#define NUM_END -2 +#define NUM_START -1 + +#endif + +// BALL Movements +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagMB { + WORD mbSpeed; + WORD mbBounce; + WORD mbAngles; + WORD mbSecurity; + WORD mbDecelerate; + WORD mbFree; + } MoveBall; +typedef MoveBall * LPMOVEBALL; + +// MOUSE movement +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagMM { + short mmDx; + short mmFx; + short mmDy; + short mmFy; + short mmFlags; + } MoveMouse; +typedef MoveMouse * LPMOVEMOUSE; + +#define MOUSE_XCENTER 100 +#define MOUSE_YCENTER 100 +#define MMMODE_NORMAL 0 +#define MMMODE_HIDDEN 1 +#define MMMODE_REMOVED 2 + +// 8 Direction movement +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagMG { + WORD mgSpeed; // Max speed + WORD mgAcc; // Acceleration + WORD mgDec; // Deceleration + WORD mgBounceMult; // Bounce factor + DWORD mgDir; // Allowed directions + } MoveGeneric; +typedef MoveGeneric * LPMOVEGENERIC; + +// RACE-CAR movement +// ~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagMR { + WORD mrSpeed; // Max speed + WORD mrAcc; // Acceleration + WORD mrDec; // Deceleration + WORD mrRot; // Rotating speed + WORD mrBounceMult; // Bounce factor + WORD mrAngles; // Number of angles + WORD mrOkReverse; // Allowed reverse speed? + } MoveRace; +typedef MoveRace * LPMOVERACE; + +// Path movement +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Structure for one move +typedef struct tagMDV1 { + BYTE mdSpeed; + BYTE mdDir; + short mdDx; + short mdDy; + short mdCosinus; + short mdSinus; + short mdLength; + short mdPause; + } MoveDefV1; +typedef MoveDefV1 * LPMOVEDEFV1; + +typedef struct tagMD { + BYTE mdPrevious; + BYTE mdNext; + BYTE mdSpeed; + BYTE mdDir; + short mdDx; + short mdDy; + short mdCosinus; + short mdSinus; + short mdLength; + short mdPause; + TCHAR mdName[2]; + } MoveDef; +typedef MoveDef * LPMOVEDEF; + +// Movement edition +typedef struct tagME { + int meSpeed; + int meDx; + int meDy; + int meFlag; + int meX; + int meY; + int meDelay; + LPTSTR meName; + } MoveEdit; +typedef MoveEdit * LPMOVEEDIT; + +typedef struct tagMA { + MoveEdit me[1]; + }MoveArray; +#define sizeof_MoveArray (sizeof(MoveArray)-sizeof(MoveEdit)) +typedef MoveArray * LPMOVEARRAY; + +typedef struct tagMT { + WORD mtNumber; // Number of movement + WORD mtMinSpeed; // maxs and min speed in the movements + WORD mtMaxSpeed; + BYTE mtLoop; // Loop at end + BYTE mtRepos; // Reposition at end + BYTE mtReverse; // Pingpong? + BYTE mtFree; + BYTE mtMoves[2]; // Start of movement definition + } MoveTaped; +typedef MoveTaped * LPMOVETAPED; + +// PLATFORM mouvement +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagMP { + WORD mpSpeed; // Max speed + WORD mpAcc; // Acceleration + WORD mpDec; // Deceleration + WORD mpJumpControl; // Bounce factor + WORD mpGravity; + WORD mpJump; + } MovePlatform; +typedef MovePlatform * LPMOVEPLATFORM; + +#define MPJC_NOJUMP 0 +#define MPJC_DIAGO 1 +#define MPJC_BUTTON1 2 +#define MPJC_BUTTON2 3 + +// Movement Extension structure +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct MoveExt { + CMvt* meMvt; // Object +} MoveExt; +typedef MoveExt * LPMOVEEXT; + +// Movement Structure +// ~~~~~~~~~~~~~~~~~~ +typedef struct MvtHdr { + DWORD mvhModuleNameOffset; + DWORD mvhID; + DWORD mvhDataOffset; + DWORD mvhDataSize; +} MvtHdr; + +typedef struct MovementTable +{ + DWORD mvtNMvt; // Number of movements + MvtHdr mvtHdr[1]; +} MovementTable; +typedef MovementTable * LPMVTTABLE; + +#define MVTOPT_8DIR_STICK 0x01 // Stick to obstacles (build 249, 8-direction mvt), allows the user to choose between behavior of b247 (avoid obstacles) and b248 (stick to obstacles) + +typedef struct tagMV { + WORD mvControl; // Who controls the object + WORD mvType; // Type of movement + BYTE mvMove; // Move at start? + BYTE mvOpt; // Options + BYTE mvFree1; + BYTE mvFree2; + DWORD mvDirAtStart; + union { + MoveMouse mm; + MoveGeneric mg; + MoveBall mb; + MoveTaped mt; + MoveRace mr; + MovePlatform mp; + MoveExt me; + } mu; +} Movement; +typedef Movement * LPMOVEMENT; + +#ifndef IN_KPX + +// COMMON CONDITIONS FOR NORMAL OBJECTS +////////////////////////////////////////// +#define EVENTS_EXTBASE 80 + +#define CND_EXTISSTRIKEOUT (-40<<8) +#define CND_EXTISUNDERLINE (-39<<8) +#define CND_EXTISITALIC (-38<<8) +#define CND_EXTISBOLD (-37<<8) +#define CND_EXTCMPVARSTRING (-36<<8) +#define CNDL_EXTCMPVARSTRING (-36<<16) +#define CND_EXTPATHNODENAME (-35<<8) +#define CNDL_EXTPATHNODENAME (-35<<16) +#define CND_EXTCHOOSE (-34<<8) +#define CND_EXTNOMOREOBJECT (-33<<8) +#define CNDL_EXTNOMOREOBJECT (-33<<16) +#define CND_EXTNUMOFOBJECT (-32<<8) +#define CND_EXTNOMOREZONE (-31<<8) +#define CND_EXTNUMBERZONE (-30<<8) +#define CND_EXTSHOWN (-29<<8) +#define CND_EXTHIDDEN (-28<<8) +#define CND_EXTCMPVAR (-27<<8) +#define CNDL_EXTCMPVAR (-27<<16) +#define CND_EXTCMPVARFIXED (-26<<8) +#define CND_EXTFLAGSET (-25<<8) +#define CND_EXTFLAGRESET (-24<<8) +#define CND_EXTISCOLBACK (-23<<8) +#define CND_EXTNEARBORDERS (-22<<8) +#define CND_EXTENDPATH (-21<<8) +#define CNDL_EXTENDPATH (-21<<16) +#define CND_EXTPATHNODE (-20<<8) +#define CNDL_EXTPATHNODE (-20<<16) +#define CND_EXTCMPACC (-19<<8) +#define CND_EXTCMPDEC (-18<<8) +#define CND_EXTCMPX (-17<<8) +#define CND_EXTCMPY (-16<<8) +#define CND_EXTCMPSPEED (-15<<8) +#define CND_EXTCOLLISION (-14<<8) +#define CNDL_EXTCOLLISION (-14<<16) +#define CND_EXTCOLBACK (-13<<8) +#define CNDL_EXTCOLBACK (-13<<16) +#define CND_EXTOUTPLAYFIELD (-12<<8) +#define CNDL_EXTOUTPLAYFIELD (-12<<16) +#define CND_EXTINPLAYFIELD (-11<<8) +#define CNDL_EXTINPLAYFIELD (-11<<16) +#define CND_EXTISOUT (-10<<8) +#define CNDL_EXTISOUT (-10<<16) +#define CND_EXTISIN (-9 <<8) +#define CNDL_EXTISIN (-9 <<16) +#define CND_EXTFACING (-8 <<8) +#define CND_EXTSTOPPED (-7 <<8) +#define CND_EXTBOUNCING (-6 <<8) +#define CND_EXTREVERSED (-5 <<8) +#define CND_EXTISCOLLIDING (-4 <<8) +#define CNDL_EXTISCOLLIDING (-4 <<16) +#define CND_EXTANIMPLAYING (-3 <<8) +#define CND_EXTANIMENDOF (-2 <<8) +#define CNDL_EXTANIMENDOF (-2 <<16) +#define CND_EXTCMPFRAME (-1 <<8) + +#define ACT_EXTSETPOS (1 <<8) +#define ACT_EXTSETX (2 <<8) +#define ACT_EXTSETY (3 <<8) +#define ACT_EXTSTOP (4 <<8) +#define ACTL_EXTSTOP (4 <<16) +#define ACT_EXTSTART (5 <<8) +#define ACT_EXTSPEED (6 <<8) +#define ACT_EXTMAXSPEED (7 <<8) +#define ACT_EXTWRAP (8 <<8) +#define ACTL_EXTWRAP (8 <<16) +#define ACT_EXTBOUNCE (9 <<8) +#define ACTL_EXTBOUNCE (9 <<16) +#define ACT_EXTREVERSE (10<<8) +#define ACT_EXTNEXTMOVE (11<<8) +#define ACT_EXTPREVMOVE (12<<8) +#define ACT_EXTSELMOVE (13<<8) +#define ACT_EXTLOOKAT (14<<8) +#define ACT_EXTSTOPANIM (15<<8) +#define ACT_EXTSTARTANIM (16<<8) +#define ACT_EXTFORCEANIM (17<<8) +#define ACT_EXTFORCEDIR (18<<8) +#define ACT_EXTFORCESPEED (19<<8) +#define ACTL_EXTFORCESPEED (19<<16) +#define ACT_EXTRESTANIM (20<<8) +#define ACT_EXTRESTDIR (21<<8) +#define ACT_EXTRESTSPEED (22<<8) +#define ACT_EXTSETDIR (23<<8) +#define ACT_EXTDESTROY (24<<8) +#define ACT_EXTSHUFFLE (25<<8) +#define ACTL_EXTSHUFFLE (25<<16) +#define ACT_EXTHIDE (26<<8) +#define ACT_EXTSHOW (27<<8) +#define ACT_EXTDISPLAYDURING (28<<8) +#define ACT_EXTSHOOT (29<<8) +#define ACTL_EXTSHOOT (29<<16) +#define ACT_EXTSHOOTTOWARD (30<<8) +#define ACTL_EXTSHOOTTOWARD (30<<16) +#define ACT_EXTSETVAR (31<<8) +#define ACTL_EXTSETVAR (31<<16) +#define ACT_EXTADDVAR (32<<8) +#define ACTL_EXTADDVAR (32<<16) +#define ACT_EXTSUBVAR (33<<8) +#define ACTL_EXTSUBVAR (33<<16) +#define ACT_EXTDISPATCHVAR (34<<8) +#define ACTL_EXTDISPATCHVAR (34<<16) +#define ACT_EXTSETFLAG (35<<8) +#define ACT_EXTCLRFLAG (36<<8) +#define ACT_EXTCHGFLAG (37<<8) +#define ACT_EXTINKEFFECT (38<<8) +#define ACT_EXTSETSEMITRANSPARENCY (39<<8) +#define ACT_EXTFORCEFRAME (40<<8) +#define ACT_EXTRESTFRAME (41<<8) +#define ACT_EXTSETACCELERATION (42<<8) +#define ACT_EXTSETDECELERATION (43<<8) +#define ACT_EXTSETROTATINGSPEED (44<<8) +#define ACT_EXTSETDIRECTIONS (45<<8) +#define ACT_EXTBRANCHNODE (46<<8) +#define ACT_EXTSETGRAVITY (47<<8) +#define ACT_EXTGOTONODE (48<<8) +#define ACT_EXTSETVARSTRING (49<<8) +#define ACTL_EXTSETVARSTRING (49<<16) +#define ACT_EXTSETFONTNAME (50<<8) +#define ACT_EXTSETFONTSIZE (51<<8) +#define ACT_EXTSETBOLD (52<<8) +#define ACT_EXTSETITALIC (53<<8) +#define ACT_EXTSETUNDERLINE (54<<8) +#define ACT_EXTSETSRIKEOUT (55<<8) +#define ACT_EXTSETTEXTCOLOR (56<<8) +#define ACT_EXTSPRFRONT (57<<8) +#define ACT_EXTSPRBACK (58<<8) +#define ACT_EXTMOVEBEFORE (59<<8) +#define ACT_EXTMOVEAFTER (60<<8) +#define ACT_EXTMOVETOLAYER (61<<8) +#define ACT_EXTADDTODEBUGGER (62<<8) +#define ACT_EXTSETEFFECT (63<<8) +#define ACT_EXTSETEFFECTPARAM (64<<8) +#define ACT_EXTSETALPHACOEF (65<<8) +#define ACT_EXTSETRGBCOEF (66<<8) +#define ACT_EXTSETEFFECTPARAMTEXTURE (67<<8) + +#define EXP_EXTYSPR ( 1<<8) +#define EXP_EXTISPR ( 2<<8) +#define EXP_EXTSPEED ( 3<<8) +#define EXP_EXTACC ( 4<<8) +#define EXP_EXTDEC ( 5<<8) +#define EXP_EXTDIR ( 6<<8) +#define EXP_EXTXLEFT ( 7<<8) +#define EXP_EXTXRIGHT ( 8<<8) +#define EXP_EXTYTOP ( 9<<8) +#define EXP_EXTYBOTTOM (10<<8) +#define EXP_EXTXSPR (11<<8) +#define EXP_EXTIDENTIFIER (12<<8) +#define EXP_EXTFLAG (13<<8) +#define EXP_EXTNANI (14<<8) +#define EXP_EXTNOBJECTS (15<<8) +#define EXP_EXTVAR (16<<8) +#define EXPL_EXTVAR (16<<16) +#define EXP_EXTGETSEMITRANSPARENCY (17<<8) +#define EXP_EXTNMOVE (18<<8) +#define EXP_EXTVARSTRING (19<<8) +#define EXPL_EXTVARSTRING (19<<16) +#define EXP_EXTGETFONTNAME (20<<8) +#define EXP_EXTGETFONTSIZE (21<<8) +#define EXP_EXTGETFONTCOLOR (22<<8) +#define EXP_EXTGETLAYER (23<<8) +#define EXP_EXTGETGRAVITY (24<<8) +#define EXP_EXTXAP (25<<8) +#define EXP_EXTYAP (26<<8) +#define EXP_EXTALPHACOEF (27<<8) +#define EXP_EXTRGBCOEF (28<<8) +#define EXP_EXTEFFECTPARAM (29<<8) +#define EXP_EXTVARBYINDEX (30<<8) +#define EXP_EXTVARSTRINGBYINDEX (31<<8) + +// TEXT Conditions / Actions +//////////////////////////////////////////// +#define ACT_STRDESTROY (( (EVENTS_EXTBASE+0)<<8)|3) +#define ACT_STRDISPLAY (( (EVENTS_EXTBASE+1)<<8)|3) +#define ACT_STRDISPLAYDURING (( (EVENTS_EXTBASE+2)<<8)|3) +#define ACT_STRSETCOLOUR (( (EVENTS_EXTBASE+3)<<8)|3) +#define ACT_STRSET (( (EVENTS_EXTBASE+4)<<8)|3) +#define ACT_STRPREV (( (EVENTS_EXTBASE+5)<<8)|3) +#define ACT_STRNEXT (( (EVENTS_EXTBASE+6)<<8)|3) +#define ACT_STRDISPLAYSTRING (( (EVENTS_EXTBASE+7)<<8)|3) +#define ACT_STRSETSTRING (( (EVENTS_EXTBASE+8)<<8)|3) +#define EXP_STRNUMBER (( (EVENTS_EXTBASE+0)<<8)|3) +#define EXP_STRGETCURRENT (( (EVENTS_EXTBASE+1)<<8)|3) +#define EXP_STRGETNUMBER (( (EVENTS_EXTBASE+2)<<8)|3) +#define EXP_STRGETNUMERIC (( (EVENTS_EXTBASE+3)<<8)|3) +#define EXP_STRGETNPARA (( (EVENTS_EXTBASE+4)<<8)|3) + +// SPRITES Conditions / Actions +///////////////////////////////////////////// +#define CND_SPRCLICK (((-EVENTS_EXTBASE-1)<<8)|2) +#define ACT_SPRPASTE (((EVENTS_EXTBASE+0)<<8)|2) +#define ACT_SPRFRONT (((EVENTS_EXTBASE+1)<<8)|2) +#define ACT_SPRBACK (((EVENTS_EXTBASE+2)<<8)|2) +#define ACT_SPRADDBKD (((EVENTS_EXTBASE+3)<<8)|2) +#define ACT_SPRREPLACECOLOR (((EVENTS_EXTBASE+4)<<8)|2) +#define ACT_SPRSETSCALE (((EVENTS_EXTBASE+5)<<8)|2) +#define ACT_SPRSETSCALEX (((EVENTS_EXTBASE+6)<<8)|2) +#define ACT_SPRSETSCALEY (((EVENTS_EXTBASE+7)<<8)|2) +#define ACT_SPRSETANGLE (((EVENTS_EXTBASE+8)<<8)|2) +#define ACT_SPRLOADFRAME (((EVENTS_EXTBASE+9)<<8)|2) +#define ACTL_SPRLOADFRAME (((EVENTS_EXTBASE+9)<<16)|2) +#define EXP_GETRGBAT (((EVENTS_EXTBASE+0)<<8)|2) +#define EXP_GETSCALEX (((EVENTS_EXTBASE+1)<<8)|2) +#define EXP_GETSCALEY (((EVENTS_EXTBASE+2)<<8)|2) +#define EXP_GETANGLE (((EVENTS_EXTBASE+3)<<8)|2) + +// COUNTERS Conditions / Actions +////////////////////////////////////////////// +#define CND_CCOUNTER (((-EVENTS_EXTBASE-1)<<8)|7) +#define ACT_CSETVALUE (( (EVENTS_EXTBASE+0)<<8)|7) +#define ACT_CADDVALUE (( (EVENTS_EXTBASE+1)<<8)|7) +#define ACT_CSUBVALUE (( (EVENTS_EXTBASE+2)<<8)|7) +#define ACT_CSETMIN (( (EVENTS_EXTBASE+3)<<8)|7) +#define ACT_CSETMAX (( (EVENTS_EXTBASE+4)<<8)|7) +#define ACT_CSETCOLOR1 (( (EVENTS_EXTBASE+5)<<8)|7) +#define ACT_CSETCOLOR2 (( (EVENTS_EXTBASE+6)<<8)|7) +#define EXP_CVALUE (( (EVENTS_EXTBASE+0)<<8)|7) +#define EXP_CGETMIN (( (EVENTS_EXTBASE+1)<<8)|7) +#define EXP_CGETMAX (( (EVENTS_EXTBASE+2)<<8)|7) +#define EXP_CGETCOLOR1 (( (EVENTS_EXTBASE+3)<<8)|7) +#define EXP_CGETCOLOR2 (( (EVENTS_EXTBASE+4)<<8)|7) + +// QUESTIONS Conditions / Actions +/////////////////////////////////////////////// +#define CND_QEQUAL (((-EVENTS_EXTBASE-3)<<8)|4) +#define CNDL_QEQUAL (((-EVENTS_EXTBASE-3)<<16)|4) +#define CND_QFALSE (((-EVENTS_EXTBASE-2)<<8)|4) +#define CNDL_QFALSE (((-EVENTS_EXTBASE-2)<<16)|4) +#define CND_QEXACT (((-EVENTS_EXTBASE-1)<<8)|4) +#define CNDL_QEXACT (((-EVENTS_EXTBASE-1)<<16)|4) +#define ACT_QASK (( (EVENTS_EXTBASE+0)<<8)|4) + + +// Formatted text Conditions / actions / expressions +////////////////////////////////////////////////////////////////// +#define ACT_RTFSETXPOS (((EVENTS_EXTBASE+0)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSETYPOS (((EVENTS_EXTBASE+1)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSETZOOM (((EVENTS_EXTBASE+2)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_CLEAR (((EVENTS_EXTBASE+3)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_WORDSTRONCE (((EVENTS_EXTBASE+4)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_WORDSTRNEXT (((EVENTS_EXTBASE+5)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_WORDSTRALL (((EVENTS_EXTBASE+6)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_WORD (((EVENTS_EXTBASE+7)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_LINE (((EVENTS_EXTBASE+8)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_PARAGRAPH (((EVENTS_EXTBASE+9)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_PAGE (((EVENTS_EXTBASE+10)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_ALL (((EVENTS_EXTBASE+11)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_RANGE (((EVENTS_EXTBASE+12)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSELECT_BOOKMARK (((EVENTS_EXTBASE+13)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSETFOCUSWORD (((EVENTS_EXTBASE+14)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHT_OFF (((EVENTS_EXTBASE+15)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTTEXT_COLOR (((EVENTS_EXTBASE+16)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTTEXT_BOLD (((EVENTS_EXTBASE+17)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTTEXT_ITALIC (((EVENTS_EXTBASE+18)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTTEXT_UNDERL (((EVENTS_EXTBASE+19)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTTEXT_OUTL (((EVENTS_EXTBASE+20)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTBACK_COLOR (((EVENTS_EXTBASE+21)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTBACK_RECT (((EVENTS_EXTBASE+22)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTBACK_MARKER (((EVENTS_EXTBASE+23)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTBACK_HATCH (((EVENTS_EXTBASE+24)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFHLIGHTBACK_INVERSE (((EVENTS_EXTBASE+25)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFDISPLAY (((EVENTS_EXTBASE+26)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSETFOCUSPREV (((EVENTS_EXTBASE+27)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFSETFOCUSNEXT (((EVENTS_EXTBASE+28)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFREMOVEFOCUS (((EVENTS_EXTBASE+29)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFAUTOON (((EVENTS_EXTBASE+30)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFAUTOOFF (((EVENTS_EXTBASE+31)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFINSERTSTRING (((EVENTS_EXTBASE+32)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFLOADTEXT (((EVENTS_EXTBASE+33)<<8)|(OBJ_RTF&0x00FF)) +#define ACT_RTFINSERTTEXT (((EVENTS_EXTBASE+34)<<8)|(OBJ_RTF&0x00FF)) + + +#define EXP_RTFXPOS (((EVENTS_EXTBASE+0)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFYPOS (((EVENTS_EXTBASE+1)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFSXPAGE (((EVENTS_EXTBASE+2)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFSYPAGE (((EVENTS_EXTBASE+3)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFZOOM (((EVENTS_EXTBASE+4)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFWORDMOUSE (((EVENTS_EXTBASE+5)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFWORDXY (((EVENTS_EXTBASE+6)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFWORD (((EVENTS_EXTBASE+7)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFXWORD (((EVENTS_EXTBASE+8)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFYWORD (((EVENTS_EXTBASE+9)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFSXWORD (((EVENTS_EXTBASE+10)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFSYWORD (((EVENTS_EXTBASE+11)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFLINEMOUSE (((EVENTS_EXTBASE+12)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFLINEXY (((EVENTS_EXTBASE+13)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFXLINE (((EVENTS_EXTBASE+14)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFYLINE (((EVENTS_EXTBASE+15)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFSXLINE (((EVENTS_EXTBASE+16)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFSYLINE (((EVENTS_EXTBASE+17)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFPARAMOUSE (((EVENTS_EXTBASE+18)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFPARAXY (((EVENTS_EXTBASE+19)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFXPARA (((EVENTS_EXTBASE+20)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFYPARA (((EVENTS_EXTBASE+21)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFSXPARA (((EVENTS_EXTBASE+22)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFSYPARA (((EVENTS_EXTBASE+23)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFXWORDTEXT (((EVENTS_EXTBASE+24)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFYWORDTEXT (((EVENTS_EXTBASE+25)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFXLINETEXT (((EVENTS_EXTBASE+26)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFYLINETEXT (((EVENTS_EXTBASE+27)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFXPARATEXT (((EVENTS_EXTBASE+28)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFYPARATEXT (((EVENTS_EXTBASE+29)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFMEMSIZE (((EVENTS_EXTBASE+30)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFGETFOCUSWORD (((EVENTS_EXTBASE+31)<<8)|(OBJ_RTF&0x00FF)) +#define EXP_RTFGETHYPERLINK (((EVENTS_EXTBASE+32)<<8)|(OBJ_RTF&0x00FF)) + +#define CND_CCAISPAUSED (((-EVENTS_EXTBASE-4)<<8)|(OBJ_CCA&0x00FF)) +#define CND_CCAISVISIBLE (((-EVENTS_EXTBASE-3)<<8)|(OBJ_CCA&0x00FF)) +#define CND_CCAAPPFINISHED (((-EVENTS_EXTBASE-2)<<8)|(OBJ_CCA&0x00FF)) +#define CNDL_CCAAPPFINISHED (((-EVENTS_EXTBASE-2)<<16)|(OBJ_CCA&0xFFFF)) +#define CND_CCAFRAMECHANGED (((-EVENTS_EXTBASE-1)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCARESTARTAPP (((EVENTS_EXTBASE+0)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCARESTARTFRAME (((EVENTS_EXTBASE+1)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCANEXTFRAME (((EVENTS_EXTBASE+2)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCAPREVIOUSFRAME (((EVENTS_EXTBASE+3)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCAENDAPP (((EVENTS_EXTBASE+4)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCANEWAPP (((EVENTS_EXTBASE+5)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCAJUMPFRAME (((EVENTS_EXTBASE+6)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCASETGLOBALVALUE (((EVENTS_EXTBASE+7)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCASHOW (((EVENTS_EXTBASE+8)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCAHIDE (((EVENTS_EXTBASE+9)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCASETGLOBALSTRING (((EVENTS_EXTBASE+10)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCAPAUSEAPP (((EVENTS_EXTBASE+11)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCARESUMEAPP (((EVENTS_EXTBASE+12)<<8)|(OBJ_CCA&0x00FF)) +#define EXP_CCAGETFRAMENUMBER (((EVENTS_EXTBASE+0)<<8)|(OBJ_CCA&0x00FF)) +#define EXP_CCAGETGLOBALVALUE (((EVENTS_EXTBASE+1)<<8)|(OBJ_CCA&0x00FF)) +#define EXP_CCAGETGLOBALSTRING (((EVENTS_EXTBASE+2)<<8)|(OBJ_CCA&0x00FF)) + +#endif // IN_KPX + +/////////////////////////////////////////////////////////////////////// +// +// DEFINITION OF THE DIFFERENT PARAMETERS +// +/////////////////////////////////////////////////////////////////////// + +// -------------------------------- Objects +// W-Offset list OI +// W-Number +// W-TYPE *** Version > FVERSION_NEWOBJECTS +#define PARAM_OBJECT 1 +#define PS_OBJ 6 + +// -------------------------------- Time +// L-Timer +// L-Equivalent loops +#define PARAM_TIME 2 +#define PS_TIM 8 + +// -------------------------------- Border +// W-border +#define PARAM_BORDER 3 +#define PS_BOR 2 +#define BORDER_LEFT 1 +#define BORDER_RIGHT 2 +#define BORDER_TOP 4 +#define BORDER_BOTTOM 8 +#define BORDER_ALL 15 + +// -------------------------------- Direction +// W-direction +#define PARAM_DIRECTION 4 +#define PS_DIR 2 + +// -------------------------------- Integer +// W-shorteger (or base) +// W-nothing (or maximum) +#define PARAM_INTEGER 5 +#define PS_INT 4 + +// -------------------------------- Sample +#define MAX_SOUNDNAME 64 +#define PSOUNDFLAG_UNINTERRUPTABLE 0x0001 +#define PSOUNDFLAG_BAD 0x0002 +#define PSOUNDFLAG_IPHONE_AUDIOPLAYER 0x0004 +#define PSOUNDFLAG_IPHONE_OPENAL 0x0008 + +typedef struct tagSSNDA { + short sndHandle; + short sndFlags; + char sndName[MAX_SOUNDNAME]; + } SoundParamA; +typedef struct tagSSNDW { + short sndHandle; + short sndFlags; + WCHAR sndName[MAX_SOUNDNAME]; + } SoundParamW; +typedef SoundParamA * LPSNDA; +typedef SoundParamW * LPSNDW; + +#define PARAM_SAMPLE 6 +#ifdef _UNICODE +#define PS_SAM sizeof(SoundParamW) +#define LPSND LPSNDW +#else +#define PS_SAM sizeof(SoundParamA) +#define LPSND LPSNDA +#endif + +// -------------------------------- Music +#define PARAM_MUSIC 7 +#ifdef _UNICODE +#define PS_MUS sizeof(SoundParamW) +#else +#define PS_MUS sizeof(SoundParamA) +#endif + + +// POSITION PARAM Structure +// ~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagPPA { + short posOINUMParent; //0 + short posFlags; + short posX; //4 + short posY; + short posSlope; //8 + short posAngle; + long posDir; //12 + ITEMTYPE posTypeParent; //16 + short posOiList; //18 + short posLayer; //20 + } PositionParam; +typedef PositionParam * LPPOS; + +// CREATE PARAM Structure +// ~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagCDP { + PositionParam cdpPos; // Position structure + HFII cdpHFII; // FrameItemInstance number + OINUM cdpOi; // OI of the object to create +// DWORD cdpFII; + DWORD cdpFree; + } CreateDuplicateParam; +typedef CreateDuplicateParam * LPCDP; + +// SHOOT PARAM Structure, should be identical to CREATE PARAM ! +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagSHT { + CreateDuplicateParam shtCdp; + short shtSpeed; // Speed + } ShootParam; +typedef ShootParam * LPSHT; + +#define CPF_DIRECTION 0x0001 +#define CPF_ACTION 0x0002 +#define CPF_INITIALDIR 0x0004 +#define CPF_DEFAULTDIR 0x0008 + + +// -------------------------------- Create +#define PARAM_CREATE 9 +#define PS_CRE sizeof(CreateDuplicateParam) + +// -------------------------------- Animation +// W-Number +// B-Name +#define PARAM_ANIMATION 10 +#define PS_ANI 32 + +// -------------------------------- Nothing +// W- +#define PARAM_NOP 11 +#define PS_NOP 2 + +// -------------------------------- Player +// W- +#define PARAM_PLAYER 12 +#define PS_PLA 2 + +// -------------------------------- Every +// L-delay +// L-compteur +#define PARAM_EVERY 13 +#define PS_EVE 8 + +// -------------------------------- Virtual Key +// W- VK_Code +#define PARAM_KEY 14 +#define PS_KEY 2 + +// -------------------------------- Speed= integer +// Expression +#define PARAM_SPEED 15 + +// -------------------------------- Position +// W- Direction +#define PARAM_POSITION 16 +#define PS_POS sizeof(PositionParam) + +// -------------------------------- Joystick Direcion +// W- Direction +#define PARAM_JOYDIRECTION 17 +#define PS_JOY 2 + +// -------------------------------- Shoot param + +#define PARAM_SHOOT 18 +#define PS_SHT sizeof(ShootParam) + +// -------------------------------- Playfield Zone +#define PARAM_ZONE 19 +#define PS_ZNE 8 + +// -------------------------------- System object position +// W- Direction +#define PARAM_SYSCREATE 21 +#define PS_SSC sizeof(CreateDuplicateParam) + +// -------------------------------- Expression +// W0- Id parametre originel +// W1- 0 (au moins!) +#define PARAM_EXPRESSION 22 +#define PS_EXP 14 + +// -------------------------------- Comparaison +// W0- Id comparaison +// W1- 0 (au moins!) +#define PARAM_COMPARAISON 23 + +// -------------------------------- Text color +// L0- RGB +// L0- Identificateur! +#define PARAM_COLOUR 24 +#define PS_COL 8 + +// -------------------------------- Work buffer +// L0- +#define PARAM_BUFFER4 25 +#define PS_BU4 4 + +// -------------------------------- Storyboard frame number +// W0- +#define PARAM_FRAME 26 +#define PS_FRA 2 + +// -------------------------------- Number of loops for a sample +#define PARAM_SAMLOOP 27 +#define PS_SLOOP 2 +// -------------------------------- Number of loops for a music +#define PARAM_MUSLOOP 28 +#define PS_MLOOP 2 +// -------------------------------- Direction +#define PARAM_NEWDIRECTION 29 +#define PS_NDIR 4 + +// -------------------------------- Text number +#define PARAM_TEXTNUMBER 31 +#define PS_TXN 4 + +// -------------------------------- Click definition +#define PARAM_CLICK 32 +#define PS_KLK 4 +#define PARAMCLICK_MASK 0x00FF +#define PARAMCLICK_DOUBLE 0x0100 + +// -------------------------------- External program +#define PARAM_PROGRAM 33 +typedef struct tagPRGA { + short prgFlags; // Default flags + char prgPath[_MAX_PATH]; // Name of the program + char prgCommand[108]; // Command line + } prgParamA; +typedef prgParamA * LPPRGA; +typedef struct tagPRGW { + short prgFlags; // Default flags + WCHAR prgPath[_MAX_PATH]; // Name of the program + WCHAR prgCommand[108]; // Command line + } prgParamW; +typedef prgParamW * LPPRGW; +#define PS_PRGA sizeof(prgParamA) +#define PS_PRGW sizeof(prgParamW) +#ifdef _UNICODE +#define prgParam prgParamW +#define PS_PRG sizeof(prgParamW) +#define LPPRG LPPRGW +#else +#define prgParam prgParamA +#define PS_PRG sizeof(prgParamA) +#define LPPRG LPPRGA +#endif + +#define PRGFLAGS_WAIT 0x0001 +#define PRGFLAGS_HIDE 0x0002 + +// -------------------------------- Global variable number +#define OLDPARAM_VARGLO 34 +//#define PS_VGLO 4 + +// -------------------------------- Condition sample (no flags) +// W-Number +// W-Flags +// W-Loops +// B-Name +#define PARAM_CNDSAMPLE 35 +// -------------------------------- Condition Music (no flags) +// W-Number +// W-Flags +// W-Loops +// B-Name +#define PARAM_CNDMUSIC 36 +// -------------------------------- Event editor remark +#define PARAM_REMARK 37 +typedef struct tagREMA { + LOGFONTV1A remLogFont; // Font + COLORREF remColorFont; // Text color + COLORREF remColorBack; // Background color + short remAlign; // Alignement flags + WORD remTextId; // Text number in the buffer + char remStyle[40]; // Style + } paramRemarkA; +typedef paramRemarkA* LPRMKA; +typedef struct tagREMW { + LOGFONTV1W remLogFont; // Font + COLORREF remColorFont; // Text color + COLORREF remColorBack; // Background color + short remAlign; // Alignement flags + WORD remTextId; // Text number in the buffer + WCHAR remStyle[40]; // Style + } paramRemarkW; +typedef paramRemarkW* LPRMKW; +#ifdef _UNICODE +#define PS_REM sizeof(paramRemarkW) +#define LPRMK LPRMKW +#else +#define PS_REM sizeof(paramRemarkA) +#define LPRMK LPRMKA +#endif + +// -------------------------------- Group title +#define PARAM_GROUP 38 +#define GROUP_MAXTITLE 80 +#define GROUP_MAXPASSWORD 16 +typedef struct tagGRPW { + short grpFlags; // Active / Unactive? + short grpId; // Group identifier + WCHAR grpTitle[GROUP_MAXTITLE]; // Title + WCHAR grpPassword[GROUP_MAXPASSWORD]; // Protection + DWORD grpChecksum; // Checksum + } paramGroupW; +typedef paramGroupW* LPGRPW; +typedef struct tagGRPA { + short grpFlags; // Active / Unactive? + short grpId; // Group identifier + char grpTitle[GROUP_MAXTITLE]; // Title + char grpPassword[GROUP_MAXPASSWORD]; // Protection + DWORD grpChecksum; // Checksum + } paramGroupA; +typedef paramGroupA* LPGRPA; +typedef struct tagOLDGRP { + short grpFlags; + short grpId; + char grpTitle[GROUP_MAXTITLE]; + } paramGroupV0; +#define PS_GRPA sizeof(paramGroupA) +#define PS_GRPW sizeof(paramGroupW) +#ifdef _UNICODE +#define PS_GRP sizeof(paramGroupW) +#define LPGRP LPGRPW +#define GETEVPGRP(evpPtr) (LPGRPW)&evpPtr->evpW.evpW0 +#else +#define PS_GRP sizeof(paramGroupA) +#define LPGRP LPGRPA +#define GETEVPGRP(evpPtr) (LPGRPA)&evpPtr->evpW.evpW0 +#endif + +#define GRPFLAGS_INACTIVE 0x0001 +#define GRPFLAGS_CLOSED 0x0002 +#define GRPFLAGS_PARENTINACTIVE 0x0004 +#define GRPFLAGS_GROUPINACTIVE 0x0008 +#define GRPFLAGS_UNICODE 0x0010 +//#define GRPFLAGS_FADEIN 0x0004 +//#define GRPFLAGS_FADEOUT 0x0008 +#define GRPFLAGS_GLOBAL 0x0010 +// Pour l'assemblage +typedef struct tagGRPLIST { + DWORD glEvg; + short glId; + } groupList; +typedef groupList * LPGL; + +// -------------------------------- A pointer to a group +#define PARAM_GROUPOINTER 39 +#define PS_GPT 6 +// L - Offset dans programme +// W - Identifier + +// -------------------------------- A pointner to a filename +#define PARAM_FILENAME 40 +#define PS_FILEN _MAX_PATH +// B nom de fichier... + +// -------------------------------- String pointer +#define PARAM_STRING 41 +#define PS_STR 2 +// B string + +// -------------------------------- Time +// L-Timer +// L-Loops +// W-Comparaison +#define PARAM_CMPTIME 42 +#define PS_CTIM 10 + +// --------------------------------- PASTE SPRITE +// W- Flags +// W- Security +#define PARAM_PASTE 43 +#define PS_PASTE 4 + +// -------------------------------- MOUSEKEY VIRTUAL +// W- VK_Code +#define PARAM_VMKEY 44 +#define PS_VMKEY 2 + +// -------------------------------- String expression +// W0- Id original parameter +// W1- 0 (at least!) +#define PARAM_EXPSTRING 45 + +// -------------------------------- String comparaison +// W0- Id comparaison +// W1- 0 (at least!) +#define PARAM_CMPSTRING 46 + +// -------------------------------- Ink effect +// W0- Id effect +// W1- Effet parameter +// L1- Free +#define PARAM_INKEFFECT 47 +#define PS_INK 8 + +// -------------------------------- Menu +// L0- Identifier +// L1- Security +#define PARAM_MENU 48 +#define PS_MENU 8 + +// Access to named variables +#define PARAM_VARGLOBAL 49 +#define PS_VARGLOBAL 4 +#define PARAM_ALTVALUE 50 +#define PS_ALTVALUE 4 +#define PARAM_FLAG 51 +#define PS_FLAG 4 + +// With expressions +#define PARAM_VARGLOBAL_EXP 52 +#define PS_VARGLOBAL_EXP PS_EXP +#define PARAM_ALTVALUE_EXP 53 +#define PS_ALTVALUE_EXP PS_EXP +#define PARAM_FLAG_EXP 54 +#define PS_FLAG_EXP PS_EXP + +// -------------------------------- Extensions parameters +#define PARAM_EXTENSION 55 +#define PARAM_EXTMAXSIZE 512 +typedef struct +{ + short pextSize; + short pextType; + short pextCode; + char pextData[2]; +} paramExt; +#define PARAM_EXTSIZE 12 +#define PARAM_EXTBASE 1000 + +// -------------------------------- Direction +#define PARAM_8DIRECTIONS 56 +#define PS_8DIR 4 + +// -------------------------------- Movement number +#define MAX_MVTNAME 32 +typedef struct tagMvtParamA { + short mvtNumber; + char mvtName[MAX_MVTNAME]; + } MvtParamA; +typedef MvtParamA * LPMVTPA; +typedef struct tagMvtParamW { + short mvtNumber; + WCHAR mvtName[MAX_MVTNAME]; + } MvtParamW; +typedef MvtParamW * LPMVTPW; + +#define PARAM_MVT 57 +#ifdef _UNICODE +#define PS_MVT sizeof(MvtParamW) +#define LPMVTP LPMVTPW +#else +#define PS_MVT sizeof(MvtParamA) +#define LPMVTP LPMVTPA +#endif + +// Access to renamed variables +#define PARAM_STRINGGLOBAL 58 +#define PS_STRINGGLOBAL 4 +#define PARAM_STRINGGLOBAL_EXP 59 +#define PS_STRINGGLOBAL_EXP PS_EXP + +// -------------------------------- External program II +#define PARAM_PROGRAM2 60 +typedef struct tagPRG2 { + short prgFlags; // Default flags + } prgParam2; +typedef prgParam2 * LPPRG2; +#define PS_PRG2 sizeof(prgParam2) + +// -------------------------------- Alterable strings +#define PARAM_ALTSTRING 61 +#define PS_ALTSTRING 4 +#define PARAM_ALTSTRING_EXP 62 +#define PS_ALTSTRING_EXP PS_EXP + +// -------------------------------- A pointer to a filename, version 2 +#define PARAM_FILENAME2 63 +#define PS_FILEN _MAX_PATH +// B nom de fichier... + +// -------------------------------- The name of an effect +#define PARAM_EFFECT 64 +#define PS_EFFECT 2 +// B name of the effect + + +// STRUCTURE FOR FAST LOOPS +/////////////////////////////////////////////////////////////////////// +typedef struct tagFL +{ + LPTSTR next; + TCHAR name[64]; + WORD flags; + long index; +} FastLoop; +typedef FastLoop * LPFL; + +#define MAX_FASTLOOPNAME 64 +#define FLFLAG_STOP 0x0001 + +/////////////////////////////////////////////////////////////// +// +// DEBUGGER +// +/////////////////////////////////////////////////////////////// +#define DBCOMMAND_RUNNING 0 +#define DBCOMMAND_TORUN 1 +#define DBCOMMAND_PAUSE 2 +#define DBCOMMAND_TOPAUSE 3 +#define DBCOMMAND_STEP 4 + +// TREE identification +enum +{ + DBTYPE_SYSTEM, + DBTYPE_OBJECT, + DBTYPE_HO, + DBTYPE_MOVEMENT, + DBTYPE_ANIMATION, + DBTYPE_VALUES, + DBTYPE_COUNTER, + DBTYPE_SCORE, + DBTYPE_LIVES, + DBTYPE_TEXT, + DBTYPE_EXTENSION +}; + +// Genric entries in the tree +enum +{ + DB_END=0xFFFF, + DB_PARENT=0x8000 +}; +#define DB_EDITABLE 0x80 + +// Communication buffer size +#define DB_BUFFERSIZE 256 + +#define DB_MAXGLOBALVALUES 1000 // Maximum number of global values displayed in the debugger +#define DB_MAXGLOBALSTRINGS 1000 + +// System tree entries +enum +{ + DB_SYSTEM, + DB_TIMER, + DB_FPS, + DB_FRAMENUMBER, + DB_GLOBALVALUE, + DB_GLOBALSTRING, + DB_GVALUE, + DB_GSTRING, +}; +// Headerobject tree entries +enum +{ + DB_XY, + DB_SIZE +}; + +// Movements tree entries +enum +{ + DB_MOVEMENTS, + DB_MVTTYPE, + DB_SPEED, + DB_DIRECTION, + DB_ACCELERATION, + DB_DECELERATION +}; + +// Animations tree entries +enum +{ + DB_ANIMATIONS, + DB_ANIMNAME, + DB_FRAME +}; + +// Values tree entries +enum +{ + DB_VALUE, + DB_VALUE0, + DB_VALUE1, + DB_VALUE2, + DB_VALUE3, + DB_VALUE4, + DB_VALUE5, + DB_VALUE6, + DB_VALUE7, + DB_VALUE8, + DB_VALUE9, + DB_VALUE10, + DB_VALUE11, + DB_VALUE12, + DB_VALUE13, + DB_VALUE14, + DB_VALUE15, + DB_VALUE16, + DB_VALUE17, + DB_VALUE18, + DB_VALUE19, + DB_VALUE20, + DB_VALUE21, + DB_VALUE22, + DB_VALUE23, + DB_VALUE24, + DB_VALUE25, + DB_ALTSTRING, + DB_ALTSTRING0, + DB_ALTSTRING1, + DB_ALTSTRING2, + DB_ALTSTRING3, + DB_ALTSTRING4, + DB_ALTSTRING5, + DB_ALTSTRING6, + DB_ALTSTRING7, + DB_ALTSTRING8, + DB_ALTSTRING9, + DB_FLAGS, + DB_FLAG0, + DB_FLAG1, + DB_FLAG2, + DB_FLAG3, + DB_FLAG4, + DB_FLAG5, + DB_FLAG6, + DB_FLAG7, + DB_FLAG8, + DB_FLAG9, + DB_FLAG10, + DB_FLAG11, + DB_FLAG12, + DB_FLAG13, + DB_FLAG14, + DB_FLAG15, + DB_FLAG16, + DB_FLAG17, + DB_FLAG18, + DB_FLAG19, + DB_FLAG20, + DB_FLAG21, + DB_FLAG22, + DB_FLAG23, + DB_FLAG24, + DB_FLAG25, + DB_FLAG26, + DB_FLAG27, + DB_FLAG28, + DB_FLAG29, + DB_FLAG30, + DB_FLAG31 +}; +enum +{ + DB_COUNTERVALUE, + DB_COUNTERMIN, + DB_COUNTERMAX +}; +enum +{ + DB_SCOREVALUE +}; +enum +{ + DB_LIVESVALUE +}; +enum +{ + DB_TEXTVALUE +}; + +#define GETDBPARAMTYPE(a) ((a&0xFF000000)>>24) +#define GETDBPARAMID(a) ((a&0x00FFFF00)>>8) +#define GETDBPARAMCOMMAND(a) (a&0x000000FF) +#define GETDBPARAM(a, b, c) ((a&0xFF)<<24)|((b&0xFFFF)<<8)|(c&0xFF) + +typedef struct +{ + LPSTR pTitle; + int value; + LPSTR pText; + int lText; +} EditDebugInfoA; + +typedef struct +{ + LPWSTR pTitle; + int value; + LPWSTR pText; + int lText; +} EditDebugInfoW; + +#ifdef _UNICODE +#define EditDebugInfo EditDebugInfoW +#else +#define EditDebugInfo EditDebugInfoA +#endif + +/////////////////////////////////////////////////////////////////////// +// +// RUNTIME BUFFER +// +/////////////////////////////////////////////////////////////////////// + +//Modes de demo +enum +{ + DEMONOTHING, + DEMORECORD, + DEMOPLAY, +}; + +typedef void (*ACTIONENDROUTINE)(); + +typedef void (*OBLROUTINE)(headerObject*); +typedef struct tagOBL { + headerObject* oblOffset; + OBLROUTINE oblRoutine; + } objectsList; +typedef objectsList * LPOBL; + +#define GAMEBUFFERS_SIZE (12*1024) +#define GAME_MAXOBJECTS 266 +#define OBJECT_MAX 128L +#define OBJECT_SIZE 256L +#define OBJECT_SHIFT 8 +#define MAX_INTERMEDIATERESULTS 256 +#define STEP_TEMPSTRINGS 64 + +typedef struct tagRH2 { + DWORD rh2OldPlayer; // Previous player entries + DWORD rh2NewPlayer; // Modified player entries + DWORD rh2InputMask; // Inhibated players entries + DWORD rh2InputPlayers; // Valid players entries (mask!) + BYTE rh2MouseKeys; // Mousekey entries + BYTE rh2ActionLoop; // Actions flag + BYTE rh2ActionOn; // Flag are we in actions? + BYTE rh2EnablePick; // Are we in pick for actions? + + int rh2EventCount; // Number of the event + qualToOi* rh2EventQualPos; // ***Position in event objects + headerObject* rh2EventPos; // ***Position in event objects + objInfoList* rh2EventPosOiList; // ***Position in oilist for TYPE exploration + objInfoList* rh2EventPrev; // ***Previous object address + + pev* rh2PushedEvents; // *** + LPBYTE rh2PushedEventsTop; // *** + LPBYTE rh2PushedEventsMax; // *** + int rh2NewPushedEvents; // + + int rh2ActionCount; // Action counter + int rh2ActionLoopCount; // Action loops counter + ACTIONENDROUTINE rh2ActionEndRoutine; // End of action routine + WORD rh2CreationCount; // Number of objects created since beginning of frame + short rh2EventType; + POINT rh2Mouse; // Mouse coordinate + POINT rh2MouseClient; // Mouse coordinates in the window + short rh2CurrentClick; // For click events II + short rh2Free2; + headerObject** rh2ShuffleBuffer; // *** + headerObject** rh2ShufflePos; // *** + int rh2ShuffleNumber; + + POINT rh2MouseSave; // Mouse saving when pause + int rh2PauseCompteur; + DWORD rh2PauseTimer; + UINT rh2PauseVbl; + FARPROC rh2LoopTraceProc; // Debugging routine + FARPROC rh2EventTraceProc; + + } runHeader2; + + +// Flags pour rh3Scrolling +#define RH3SCROLLING_SCROLL 0x0001 +#define RH3SCROLLING_REDRAWLAYERS 0x0002 +#define RH3SCROLLING_REDRAWALL 0x0004 +#define RH3SCROLLING_REDRAWTOTALCOLMASK 0x0008 + +#define GAME_XBORDER 480 +#define GAME_YBORDER 300 + +typedef struct tagRH3 { + + WORD rh3Graine; // random generator seed + WORD rh3Free; // Alignment... + + int rh3DisplayX; // To scroll + int rh3DisplayY; + + long rh3CurrentMenu; // For menu II events + + int rh3WindowSx; // Window size + int rh3WindowSy; + + short rh3CollisionCount; // Collision counter + char rh3DoStop; // Force the test of stop actions + char rh3Scrolling; // Flag: we need to scroll + + int rh3Panic; + + int rh3PanicBase; + int rh3PanicPile; + +// short rh3XBorder_; // Authorised border +// short rh3YBorder_; + int rh3XMinimum; // Object inactivation coordinates + int rh3YMinimum; + int rh3XMaximum; + int rh3YMaximum; + int rh3XMinimumKill; // Object destruction coordinates + int rh3YMinimumKill; + int rh3XMaximumKill; + int rh3YMaximumKill; + + } runHeader3; + +// Extensions +// ~~~~~~~~~~~~~~~~~~~~ +#define KPX_MAXNUMBER 96 +typedef struct tagKPXMSG { + short ( WINAPI * routine) (DWORD, HWND, UINT, WPARAM, LPARAM); + } kpxMsg; +#define KPX_MAXFUNCTIONS 32 +typedef struct tagKPXLIB { + long ( WINAPI * routine) (headerObject*, WPARAM, LPARAM); + } kpxLib; +#define IsRunTimeFunctionPresent(num) (num < KPX_MAXFUNCTIONS && ((LPRH)rdPtr->rHo.hoAdRunHeader)->rh4.rh4KpxFunctions[num].routine != NULL) +#define callRunTimeFunction(rdPtr,num,wParam,lParam) ( ((LPRH)rdPtr->rHo.hoAdRunHeader)->rh4.rh4KpxFunctions[num].routine((LPHO)rdPtr, wParam, lParam) ) +#define callRunTimeFunction2(hoPtr,num,wParam,lParam) ( ((LPRH)hoPtr->hoAdRunHeader)->rh4.rh4KpxFunctions[num].routine(hoPtr, wParam, lParam) ) + +#define RFUNCTION_REHANDLE 0 +#define RFUNCTION_GENERATEEVENT 1 +#define RFUNCTION_PUSHEVENT 2 +#define RFUNCTION_GETSTRINGSPACE_EX 3 +#define RFUNCTION_GETPARAM1 4 +#define RFUNCTION_GETPARAM2 5 +#define RFUNCTION_PUSHEVENTSTOP 6 +#define RFUNCTION_PAUSE 7 +#define RFUNCTION_CONTINUE 8 +#define RFUNCTION_REDISPLAY 9 +#define RFUNCTION_GETFILEINFOS 10 +#define RFUNCTION_SUBCLASSWINDOW 11 +#define RFUNCTION_REDRAW 12 +#define RFUNCTION_DESTROY 13 +#define RFUNCTION_GETSTRINGSPACE 14 +#define RFUNCTION_EXECPROGRAM 15 +#define RFUNCTION_GETOBJECTADDRESS 16 +#define RFUNCTION_GETPARAM 17 +#define RFUNCTION_GETEXPPARAM 18 +#define RFUNCTION_GETPARAMFLOAT 19 +#define RFUNCTION_EDITINT 20 +#define RFUNCTION_EDITTEXT 21 +#define RFUNCTION_CALLMOVEMENT 22 +#define RFUNCTION_SETPOSITION 23 +#define RFUNCTION_GETCALLTABLES 24 + +#define CNC_GetParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0xFFFFFFFF, 0) +#define CNC_GetIntParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0, 0) +#define CNC_GetStringParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0xFFFFFFFF, 0) +#define CNC_GetFloatParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 2, 0) +#define CNC_GetFloatValue(rdPtr, par) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAMFLOAT, par, 0) +#define CNC_GetFirstExpressionParameter(rdPtr, lParam, wParam) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM1, wParam, lParam) +#define CNC_GetNextExpressionParameter(rdPtr, lParam, wParam) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM2, wParam, lParam) + +#define MAX_FRAMERATE 10 + +typedef void (* CALLANIMATIONS) (headerObject*, int); +#define callAnimations(hoPtr, anim) ( (hoPtr->hoAdRunHeader)->rh4.rh4Animations(hoPtr, anim) ) + +typedef DWORD (* CALLDIRATSTART) (headerObject*, DWORD); +#define callDirAtStart(hoPtr, initDir) ( (hoPtr->hoAdRunHeader)->rh4.rh4DirAtStart(hoPtr, initDir) ) + +typedef BOOL (* CALLMOVEIT) (headerObject*); +#define callMoveIt(hoPtr) ( (hoPtr->hoAdRunHeader)->rh4.rh4MoveIt(hoPtr) ) + +#ifdef __cplusplus +typedef BOOL (* CALLAPPROACHOBJECT) (headerObject*, int destX, int destY, int maxX, int maxY, int htFoot, int planCol, int& x, int &y); +#define callApproachObject(x, y, hoPtr, destX, destY, maxX, maxY, htFoot, planCol) ( (hoPtr->hoAdRunHeader)->rh4.rh4ApproachObject(hoPtr, destX, destY, maxX, maxY, htFoot, planCol, x, y) ) +#else +typedef BOOL (* CALLAPPROACHOBJECT) (headerObject*, int destX, int destY, int maxX, int maxY, int htFoot, int planCol, int* x, int *y); +#define callApproachObject(x, y, hoPtr, destX, destY, maxX, maxY, htFoot, planCol) ( (hoPtr->hoAdRunHeader)->rh4.rh4ApproachObject(hoPtr, destX, destY, maxX, maxY, htFoot, planCol, &x, &y) ) +#endif + +typedef void (* CALLCOLLISIONS) (headerObject*); +#define callCollisions(hoPtr) ( (hoPtr->hoAdRunHeader)->rh4.rh4Collisions(hoPtr) ) + +typedef BOOL (* CALLTESTPOSITION) (headerObject*, int x, int y, int htFoot, int planCol, BOOL flag); +#define callTestPosition(hoPtr, x, y, htFoot, planCol) ( (hoPtr->hoAdRunHeader)->rh4.rh4TestPosition(hoPtr, x, y, htFoot, planCol, 0) ) + +typedef BYTE (* CALLGETJOYSTICK) (headerObject*, int); +#define callGetJoystick(hoPtr, player) ( (hoPtr->hoAdRunHeader)->rh4.rh4Joystick(hoPtr, player) ) + +typedef BOOL (* CALLCOLMASKTESTRECT) (headerObject*, int x, int y , int sx, int sy, int nLayer, int plan); +#define callColMaskTestRect(hoPtr, x, y, sx, sy, nLayer, plan) ( (hoPtr->hoAdRunHeader)->rh4.rh4ColMaskTestRect(hoPtr, x, y, sx, sy, nLayer, plan) ) + +typedef BOOL (* CALLCOLMASKTESTPOINT) (headerObject*, int x, int y, int nLayer, int plan); +#define callColMaskTestPoint(hoPtr, x, y, nLayer, plan) ( (hoPtr->hoAdRunHeader)->rh4.rh4ColMaskTestPoint(hoPtr, x, y, nLayer, plan) ) + + +typedef struct tagRH4 { + + kpj* rh4KpxJumps; // Jump table offset + short rh4KpxNumOfWindowProcs; // Number of routines to call + short rh4Free; + kpxMsg rh4KpxWindowProc[KPX_MAXNUMBER]; // Message handle routines + kpxLib rh4KpxFunctions[KPX_MAXFUNCTIONS]; // Available internal routines + CALLANIMATIONS rh4Animations; + CALLDIRATSTART rh4DirAtStart; + CALLMOVEIT rh4MoveIt; + CALLAPPROACHOBJECT rh4ApproachObject; + CALLCOLLISIONS rh4Collisions; + CALLTESTPOSITION rh4TestPosition; + CALLGETJOYSTICK rh4GetJoystick; + CALLCOLMASKTESTRECT rh4ColMaskTestRect; + CALLCOLMASKTESTPOINT rh4ColMaskTestPoint; + + DWORD rh4SaveVersion; + event* rh4ActionStart; // Sauvergarde action courante + int rh4PauseKey; + LPTSTR rh4CurrentFastLoop; + int rh4EndOfPause; + int rh4EventCountOR; // Number of the event for OR conditions + short rh4ConditionsFalse; + short rh4MouseWheelDelta; + int rh4OnMouseWheel; + LPTSTR rh4PSaveFilename; + UINT rh4MusicHandle; + DWORD rh4MusicFlags; + DWORD rh4MusicLoops; + int rh4LoadCount; + short rh4DemoMode; + short rh4SaveFrame; + CDemoRecord* rh4Demo; + int rh4SaveFrameCount; + double rh4MvtTimerCoef; + CIPhoneJoystick* rh4IPhoneJoystick; + CIPhoneAd* rh4IPhoneAd; + char rh4QuitString[32]; // FREE!!!! GREAT! + + + DWORD rh4PickFlags0; // 00-31 + DWORD rh4PickFlags1; // 31-63 + DWORD rh4PickFlags2; // 64-95 + DWORD rh4PickFlags3; // 96-127 + LPDWORD rh4TimerEventsBase; // Timer events base + + short rh4DroppedFlag; + short rh4NDroppedFiles; + LPTSTR rh4DroppedFiles; + LPFL rh4FastLoops; + LPTSTR rh4CreationErrorMessages; + CValue rh4ExpValue1; // New V2 + CValue rh4ExpValue2; + + long rh4KpxReturn; // WindowProc return + LPOBL rh4ObjectCurCreate; + short rh4ObjectAddCreate; + WORD rh4Free10; // For step through : fake key pressed + HINSTANCE rh4Instance; // Application instance + HWND rh4HStopWindow; // STOP window handle + char rh4DoUpdate; // Flag for screen update on first loop + char rh4MenuEaten; // Menu handled in an event? + short rh4Free2; + int rh4OnCloseCount; // For OnClose event + short rh4CursorCount; // Mouse counter + short rh4ScrMode; // Current screen mode + HPALETTE rh4HPalette; // Handle current palette + int rh4VBLDelta; // Number of VBL + DWORD rh4LoopTheoric; // Theorical VBL counter + DWORD rh4EventCount; + drawRoutine* rh4FirstBackDrawRoutine; // Backrgound draw routines list + drawRoutine* rh4LastBackDrawRoutine; // Last routine used + + DWORD rh4ObjectList; // Object list offset + short rh4LastQuickDisplay; // Quick - display list + BYTE rh4CheckDoneInstart; // Build92 to correct start of frame with fade in + BYTE rh4Free0; + mv * rh4Mv; // Yves's data + HCURSOR rh4OldCursor; // Old cursor for Show / HideMouse in Vitalize! mode + headerObject* rh4_2ndObject; // Collision object address + short rh4_2ndObjectNumber; // Number for collisions + short rh4FirstQuickDisplay; // Quick-display object list + int rh4WindowDeltaX; // For scrolling + int rh4WindowDeltaY; + UINT rh4TimeOut; // For time-out! + int rh4MouseXCenter; // To correct CROSOFT bugs! + int rh4MouseYCenter; // To correct CROSOFT bugs! + int rh4TabCounter; // Objects with tabulation + + DWORD rh4AtomNum; // For child window handling + DWORD rh4AtomRd; + DWORD rh4AtomProc; + short rh4SubProcCounter; // To accelerate the windows + short rh4Free3; + + int rh4PosPile; // Expression evaluation pile position + expression* rh4ExpToken; // Current position in expressions + CValue* rh4Results[MAX_INTERMEDIATERESULTS]; // Result pile + long rh4Operators[MAX_INTERMEDIATERESULTS]; // Operators pile + + LPTSTR* rh4PTempStrings; // Debut zone 256 long + int rh4MaxTempStrings; + long rh4Free4[256-2]; // Free buffer + + int rh4NCurTempString; // Pointer on the current string + DWORD rh4FrameRateArray[MAX_FRAMERATE]; // Framerate calculation buffer + int rh4FrameRatePos; // Position in buffer + DWORD rh4FrameRatePrevious; // Previous time + + } runHeader4; + +#define GAMEFLAGS_VBLINDEP 0x0002 +#define GAMEFLAGS_LIMITEDSCROLL 0x0004 +#define GAMEFLAGS_FIRSTLOOPFADEIN 0x0010 +#define GAMEFLAGS_LOADONCALL 0x0020 +#define GAMEFLAGS_REALGAME 0x0040 +#define GAMEFLAGS_PLAY 0x0080 +//#define GAMEFLAGS_FADEIN 0x0080 +//#define GAMEFLAGS_FADEOUT 0x0100 +#define GAMEFLAGS_INITIALISING 0x0200 + +typedef struct RunHeader { + npWin rhIdEditWin; + npWin rhIdMainWin; + npAppli rhIdAppli; + + HWND rhHEditWin; + HWND rhHMainWin; + HWND rhHTopLevelWnd; + + CRunApp* rhApp; // Application info + CRunFrame* rhFrame; // Frame info + + DWORD rhJoystickPatch; // To reroute the joystick + + BYTE rhFree10; // Current movement needs to be stopped + BYTE rhFree12; // Event evaluation flag + BYTE rhNPlayers; // Number of players + BYTE rhMouseUsed; // Players using the mouse + + WORD rhGameFlags; // Game flags + WORD rhFree; // Alignment + DWORD rhPlayer; // Current players entry + + short rhQuit; + short rhQuitBis; // Secondary quit (scrollings) + DWORD rhFree11; // Value to return to the editor + DWORD rhQuitParam; + +// Buffers + int rhNObjects; + int rhMaxObjects; + + DWORD rhFree0; + DWORD rhFree1; + DWORD rhFree2; + DWORD rhFree3; + + int rhNumberOi; // Number of OI in the list + objInfoList* rhOiList; // ObjectInfo list + + LPDWORD rhEvents[NUMBEROF_SYSTEMTYPES+1]; // Events pointers + LPDWORD rhEventLists; // Pointers on pointers list + LPDWORD rhFree8; // Timer pointers + LPDWORD rhEventAlways; // Pointers on events to see at each loop + LPEVG rhPrograms; // Program pointers + OINUM* rhLimitLists; // Movement limitation list + qualToOi* rhQualToOiList; // Conversion qualifier->oilist + + DWORD rhSBuffers; // Buffer size /1024 + LPBYTE rhBuffer; // Position in current buffer + LPBYTE rhFBuffer; // End of current buffer + LPBYTE rhBuffer1; // First buffer + LPBYTE rhBuffer2; // Second buffer + + int rhLevelSx; // Window size + int rhLevelSy; + int rhWindowX; // Start of window in X/Y + int rhWindowY; + + UINT rhVBLDeltaOld; // Number of VBL + UINT rhVBLObjet; // For the objects + UINT rhVBLOld; // For the counter + + int rhEventsSize; + WORD rhMT_VBLStep; // Path movement variables + WORD rhMT_VBLCount; + DWORD rhMT_MoveStep; + + int rhLoopCount; // Number of loops since start of level + UINT rhTimer; // Timer in 1/50 since start of level + UINT rhTimerOld; // For delta calculation + UINT rhTimerDelta; // For delta calculation + + LPEVG rhEventGroup; // Current group + long rhCurCode; // Current event + short rhCurOi; + short rhFree4; // Alignment + long rhCurParam[2]; + short rhCurObjectNumber; // Object number + short rh1stObjectNumber; // Number, for collisions + + long rhOiListPtr; // OI list enumeration + short rhObListNext; // Branch label + + short rhDestroyPos; + long rhFree5; + long rhFree6; + + runHeader2 rh2; // Sub-structure #1 + runHeader3 rh3; // Sub-structure #2 + runHeader4 rh4; // Sub-structure #3 + + LPDWORD rhDestroyList; // Destroy list address + + int rhDebuggerCommand; // Current debugger command + char rhFree13[DB_BUFFERSIZE]; // Buffer libre! + LPVOID rhDbOldHO; + WORD rhDbOldId; + WORD rhFree7; + + objectsList* rhObjectList; // Object list address + + } RunHeader; +typedef RunHeader * fprh; +typedef RunHeader * LPRH; +typedef RunHeader * LPRUNHEADER; + + +/////////////////////////////////////////////////////////////// +// +// RUNTIME OBJECT DEFINITION +// +/////////////////////////////////////////////////////////////// + +#define HOX_INT + +typedef short (WINAPI *HOROUTINE)(headerObject*); + +#ifdef __cplusplus +class headerObject { +public: +#else +#undef headerObject +typedef struct headerObject { +#endif + short hoNumber; // Number of the object + short hoNextSelected; // Selected object list!!! DO NOT CHANGE POSITION!!! + + int hoSize; // Structure size + LPRH hoAdRunHeader; // Run-header address +#ifdef __cplusplus + headerObject* hoAddress; +#else + LPVOID hoAddress; +#endif + HFII hoHFII; // Number of LevObj + OINUM hoOi; // Number of OI + short hoNumPrev; // Same OI previous object + short hoNumNext; // ... next + short hoType; // Type of the object + WORD hoCreationId; // Number of creation + objInfoList* hoOiList; // Pointer to OILIST information + LPDWORD hoEvents; // Pointer to specific events + UINT hoFree0; // Free + LPBYTE hoPrevNoRepeat; // One-shot event handling + LPBYTE hoBaseNoRepeat; + + int hoMark1; // #of loop marker for the events + int hoMark2; + LPTSTR hoMT_NodeName; // Name fo the current node for path movements + + int hoEventNumber; // Number of the event called (for extensions) + int hoFree2; + LPOC hoCommon; // Common structure address + + union + { + struct + { + int hoCalculX; // Low weight value + int hoX; // X coordinate + int hoCalculY; // Low weight value + int hoY; // Y coordinate + }; + struct + { + __int64 hoCalculXLong; + __int64 hoCalculYLong; + }; + }; + int hoImgXSpot; // Hot spot of the current image + int hoImgYSpot; + int hoImgWidth; // Width of the current picture + int hoImgHeight; + RECT hoRect; // Display rectangle + + DWORD hoOEFlags; // Objects flags + short hoFlags; // Flags + BYTE hoSelectedInOR; // Selection lors d'un evenement OR + BYTE hoFree; // Alignement + int hoOffsetValue; // Values structure offset + UINT hoLayer; // Layer + + HOROUTINE hoHandleRoutine; // General handle routine + HOROUTINE hoModifRoutine; // Modification routine when coordinates have been modified + HOROUTINE hoDisplayRoutine; // Display routine + + short hoLimitFlags; // Collision limitation flags + short hoNextQuickDisplay; // Quickdraw list + saveRect hoBackSave; // Background + + LPEVP hoCurrentParam; // Address of the current parameter + + int hoOffsetToWindows; // Offset to windows + DWORD hoIdentifier; // ASCII identifier of the object + +#ifdef __cplusplus +}; +#else +} headerObject; +#endif +typedef headerObject* LPHO; + +#define HOF_DESTROYED 0x0001 +#define HOF_TRUEEVENT 0x0002 +#define HOF_REALSPRITE 0x0004 +#define HOF_FADEIN 0x0008 +#define HOF_FADEOUT 0x0010 +#define HOF_OWNERDRAW 0x0020 +#define HOF_NOCOLLISION 0x2000 +#define HOF_FLOAT 0x4000 +#define HOF_STRING 0x8000 + + +// -------------------------------------- +// Object's movement structure +// -------------------------------------- +typedef struct tagRM { + + int rmAcc; // Current acceleration + int rmDec; // Current Decelaration + int rmCollisionCount; // Collision counter + int rmFree2; + int rmStopSpeed; // If stopped: speed to take again + int rmFree0; + int rmFree1; + int rmAccValue; // Acceleration calculation + int rmDecValue; // Deceleration calculation + short rmEventFlags; // To accelerate events + int rmFree3; + int rmFree4; + BOOL rmFree5; + BOOL rmFree6; + + BOOL rmFree7; + BOOL rmMoveFlag; // Messages/movements + + BOOL rmWrapping; // For CHECK POSITION + BOOL rmReverse; // Ahaid or reverse? + + BOOL rmBouncing; // Bouncing? + int rmMvtNum; // Number of the current movement + + union + { + struct + { + BYTE rmMvData[80]; // Space for data + }; + struct + { + int MT_Speed; + int MT_Sinus; + int MT_Cosinus; + DWORD MT_Longueur; + int MT_XOrigin; + int MT_YOrigin; + int MT_XDest; + int MT_YDest; + int MT_MoveNumber; + LPMOVEDEF MT_MoveAddress; + BOOL MT_Direction; + LPMOVETAPED MT_Movement; + int MT_Calculs; + int MT_XStart; + int MT_YStart; + int MT_Pause; + LPTSTR MT_GotoNode; + }; + struct + { + int MM_DXMouse; + int MM_DYMouse; + int MM_FXMouse; + int MM_FYMouse; + int MM_Stopped; + int MM_OldSpeed; + BYTE MM_MvOpt; + }; + struct + { + int MG_Bounce; + long MG_OkDirs; + int MG_BounceMu; + int MG_Speed; + int MG_LastBounce; + int MG_DirMask; + BYTE MG_MvOpt; + }; + struct + { + int MR_Bounce; + int MR_BounceMu; + int MR_Speed; + int MR_RotSpeed; + int MR_RotCpt; + int MR_RotPos; + int MR_RotMask; + int MR_OkReverse; + int MR_OldJoy; + int MR_LastBounce; + BYTE MR_MvOpt; + }; + struct + { + long MB_StartDir; + int MB_Angles; + int MB_Securite; + int MB_SecuCpt; + int MB_Bounce; + int MB_Speed; + int MB_MaskBounce; + int MB_LastBounce; + int MB_Blocked; + }; + struct + { + int MBul_Wait; + LPHO MBul_ShootObject; + }; + struct + { + int MP_Type; + int MP_Bounce; + int MP_BounceMu; + int MP_XSpeed; + int MP_Gravity; + int MP_Jump; + int MP_YSpeed; + int MP_XMB; + int MP_YMB; + int MP_HTFOOT; + int MP_JumpControl; + int MP_JumpStopped; + int MP_PreviousDir; + LPHO MP_ObjectUnder; + int MP_XObjectUnder; + int MP_YObjectUnder; + BOOL MP_NoJump; + }; + }; + } rMvt; +typedef rMvt* LPRMV; +enum +{ + MPTYPE_WALK, + MPTYPE_CLIMB, + MPTYPE_JUMP, + MPTYPE_FALL, + MPTYPE_CROUCH, + MPTYPE_UNCROUCH +}; + +// ---------------------------------------- +// Object's animation structure +// ---------------------------------------- +typedef struct tagRA { + int raAnimForced; // Flags if forced + int raAnimDirForced; + int raAnimSpeedForced; + BOOL raAnimStopped; + int raAnimOn; // Current animation + LPAN raAnimOffset; + int raAnimDir; // Direction of current animation + int raAnimPreviousDir; // Previous OK direction + LPAD raAnimDirOffset; + int raAnimSpeed; + int raAnimMinSpeed; // Minimum speed of movement + int raAnimMaxSpeed; // Maximum speed of movement + int raAnimDeltaSpeed; + int raAnimCounter; // Animation speed counter + int raAnimDelta; // Speed counter + int raAnimRepeat; // Number of repeats + int raAnimRepeatLoop; // Looping picture + int raAnimFrame; // Current frame + int raAnimNumberOfFrame; // Number of frames + + int raAnimFrameForced; + + } rAni; +typedef rAni* LPRA; + +// ---------------------------------------- +// Sprite display structure +// ---------------------------------------- +typedef struct tagRSPR { + + int rsFlash; // Flash objets + int rsFlashCpt; + int rsLayer; // Layer + int rsZOrder; // Z-order value + int rsCreaFlags; // Creation flags + COLORREF rsBackColor; // background saving color + DWORD rsEffect; // Sprite effects + LPARAM rsEffectParam; + WORD rsFlags; // Handling flags + WORD rsFadeCreaFlags; // Saved during a fadein + } rSpr; +typedef rSpr * LPRSP; + +#define RSFLAG_HIDDEN 0x0001 +#define RSFLAG_INACTIVE 0x0002 +#define RSFLAG_SLEEPING 0x0004 +#define RSFLAG_SCALE_RESAMPLE 0x0008 +#define RSFLAG_ROTATE_ANTIA 0x0010 +#define RSFLAG_VISIBLE 0x0020 +#define RSFLAG_CREATEDEFFECT 0x0040 + + +// ---------------------------------------- +// Objects's internal variables (build # >= 243) +// ---------------------------------------- +typedef struct tagRV { + CValue* rvpValues; + long rvFree1[VALUES_NUMBEROF_ALTERABLE-1]; + long rvValueFlags; + BYTE rvFree2[VALUES_NUMBEROF_ALTERABLE]; + LPTSTR rvStrings[STRINGS_NUMBEROF_ALTERABLE]; + } rVal; +typedef rVal * LPRVAL; + +/* + Obsolete (build 242 or below) - Note: don't remove this (for the SDK) + +typedef struct tagRV { + long rvValues[VALUES_NUMBEROF_ALTERABLE]; + long rvValueFlags; + BYTE rvValuesType[VALUES_NUMBEROF_ALTERABLE]; + LPSTR rvStrings[STRINGS_NUMBEROF_ALTERABLE]; + } rVal; +typedef rVal * LPRVAL; +*/ + + +// ----------------------------------------------- +// Objects animation and movement structure +// ----------------------------------------------- +#if !defined(ANGLETYPE) +#if defined(HWABETA) +#define ANGLETYPE float +#else +#define ANGLETYPE int +#endif +#endif +typedef void (* RCROUTINE)(LPHO); +typedef struct tagRCOM { + + int rcOffsetAnimation; // Offset to anims structures + int rcOffsetSprite; // Offset to sprites structures + RCROUTINE rcRoutineMove; // Offset to movement routine + RCROUTINE rcRoutineAnimation; // Offset to animation routine + + int rcPlayer; // Player who controls + + int rcNMovement; // Number of the current movement + CRunMvt* rcRunMvt; // Pointer to extension movement + fpSpr rcSprite; // Sprite ID if defined + int rcAnim; // Wanted animation + int rcImage; // Current frame + float rcScaleX; + float rcScaleY; + ANGLETYPE rcAngle; + int rcDir; // Current direction + int rcSpeed; // Current speed + int rcMinSpeed; // Minimum speed + int rcMaxSpeed; // Maximum speed + BOOL rcChanged; // Flag: modified object + BOOL rcCheckCollides; // For static objects + + int rcOldX; // Previous coordinates + int rcOldY; + int rcOldImage; + ANGLETYPE rcOldAngle; + int rcOldDir; + int rcOldX1; // For zone detections + int rcOldY1; + int rcOldX2; + int rcOldY2; + + long rcFadeIn; + long rcFadeOut; + + } rCom; + + +// ------------------------------------------------------------ +// ACTIVE OBJECTS DATAZONE +// ------------------------------------------------------------ +typedef struct tagRO { + + headerObject roHo; // Common structure + + rCom roc; // Anim/movement structure + rMvt rom; // Movement structure + rAni roa; // Animation structure + rSpr ros; // Sprite handling structure + rVal rov; // Values structure + + } RunObject; +typedef RunObject * LPRO; +typedef RunObject * LPRUNOBJECT; + +#define EF_GOESINPLAYFIELD 0x0001 +#define EF_GOESOUTPLAYFIELD 0x0002 +#define EF_WRAP 0x0004 + + + +// ------------------------------------------------------ +// EXTENSION EDITION HEADER STRUCTURE +// ------------------------------------------------------ +typedef struct tagEditExtension_v1 +{ + short extSize; + short extMaxSize; + short extOldFlags; // For conversion purpose + short extVersion; // Version number +} extHeader_v1; +typedef extHeader_v1* LPEXTV1; + +typedef struct extHeader +{ + DWORD extSize; + DWORD extMaxSize; + DWORD extVersion; // Version number + LPVOID extID; // object's identifier + LPVOID extPrivateData; // private data +} extHeader; +typedef extHeader * LPEXT; + +// ------------------------------------------------------ +// System objects (text, question, score, lives, counter) +// ------------------------------------------------------ +typedef struct tagRs { + + headerObject rsHo; // For all the objects + rCom rsc; // Anims / movements / sprites structures + rMvt rom; // Mouvement structure + rSpr rss; // Sprite handling + + short rsPlayer; // Number of the player if score or lives + short rsFlags; // Type + flags + + union { + LPBYTE rsSubAppli; // Application (CCA object) + }; + union + { + long rsMini; + long rsOldLevel; + }; + union + { + long rsMaxi; // + long rsLevel; + }; + CValue rsValue; + LONG rsBoxCx; // Dimensions box (for lives, counters, texts) + LONG rsBoxCy; + double rsMiniDouble; + double rsMaxiDouble; + short rsOldFrame; // Counter only + BYTE rsHidden; + BYTE rsFree; + LPTSTR rsTextBuffer; // Text buffer + int rsLBuffer; // Length of the buffer in BYTES + DWORD rsFont; // Temporary font for texts + union { + COLORREF rsTextColor; // Text color + COLORREF rsColor1; // Bar color + }; + COLORREF rsColor2; // Gradient bar color +} rs; +typedef rs * LPRS; + + +// OILIST Structure : Data concerning the objects in the game +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define MAX_QUALIFIERS 8 // Maximum number of qualifiers per object +typedef LPHO (*OILROUTINE)(objInfoList*, BOOL*); + +#ifdef __cplusplus +class objInfoList { +public: +#else +#undef objInfoList +typedef struct objInfoList { +#endif + OINUM oilOi; // THE oi + short oilListSelected; // First selection !!! DO NOT CHANGE POSITION !!! + short oilType; // Type of the object + short oilObject; // First objects in the game + DWORD oilEvents; // Events + char oilWrap; // WRAP flags + char oilNextFlag; + WORD oilFree; // Not used + int oilNObjects; // Current number + int oilActionCount; // Action loop counter + int oilActionLoopCount; // Action loop counter + OILROUTINE oilCurrentRoutine; // Current routine for the actions + int oilCurrentOi; // Current object + int oilNext; // Pointer on the next + int oilEventCount; // When the event list is done + int oilNumOfSelected; // Number of selected objects + DWORD oilOEFlags; // Object's flags + short oilLimitFlags; // Movement limitation flags + short oilLimitList; // Pointer to limitation list + short oilOIFlags; // Objects preferences + short oilOCFlags2; // Objects preferences II + long oilInkEffect; // Ink effect + long oilEffectParam; // Ink effect param + HFII oilHFII; // First available frameitem + COLORREF oilBackColor; // Background erasing color + short oilQualifiers[MAX_QUALIFIERS]; // Qualifiers for this object + TCHAR oilName[24]; // Name + int oilEventCountOR; // Selection in a list of events with OR +#ifdef HWABETA + OINUM* oilColList; // Liste de collisions sprites +#endif +#ifdef __cplusplus +}; +#else +} objInfoList; +#endif +typedef objInfoList * LPOIL; + +#define OILIMITFLAGS_BORDERS 0x000F +#define OILIMITFLAGS_BACKDROPS 0x0010 +#define OILIMITFLAGS_ONCOLLIDE 0x0080 // used by HWA +#define OILIMITFLAGS_QUICKCOL 0x0100 +#define OILIMITFLAGS_QUICKBACK 0x0200 +#define OILIMITFLAGS_QUICKBORDER 0x0400 +#define OILIMITFLAGS_QUICKSPR 0x0800 +#define OILIMITFLAGS_QUICKEXT 0x1000 +#define OILIMITFLAGS_ALL 0xFFFF + +// Object creation structure +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +typedef struct tagCOB { + LO* cobLevObj; // Leave first! + WORD cobLevObjSeg; + WORD cobFlags; + int cobX; + int cobY; + int cobDir; + int cobLayer; + int cobZOrder; + } createObjectInfo; +typedef createObjectInfo * LPCOB; +typedef createObjectInfo * fpcob; + +// Flags for Create Objects +// ------------------------- +#define COF_NOMOVEMENT 0x0001 +#define COF_HIDDEN 0x0002 +#define COF_FIRSTTEXT 0x0004 + +// Qualifier to oilist for machine langage +// --------------------------------------- +typedef LPHO (*QOIROUTINE)(qualToOi*, BOOL* pRepeatFlag); + +#ifdef __cplusplus +class qualToOi { +public: +#else +#undef qualToOi +typedef struct qualToOi { +#endif + short qoiCurrentOi; + short qoiNext; + int qoiActionPos; + QOIROUTINE qoiCurrentRoutine; + int qoiActionCount; + int qoiActionLoopCount; + char qoiNextFlag; + char qoiSelectedFlag; + OINUM qoiOi; // Array OINUM / OFFSET + short qoiOiList; +#ifdef __cplusplus +}; +#else +} qualToOi; +#endif +typedef qualToOi * LPQOI; + + +// ------------------------------------------------------------------ +// ------------------------------------------------------------------ +// EXTENSION HANDLING +// ------------------------------------------------------------------ +// ------------------------------------------------------------------ + +#ifdef STAND_ALONE +typedef BOOL (WINAPI *EXTCONDROUTINE)(headerObject*, long, long); +typedef short (WINAPI *EXTACTROUTINE)(headerObject*, long, long); +typedef long (WINAPI *EXTEXPROUTINE)(headerObject*, long); +#else +#define EXTCONDROUTINE VOID +#define EXTACTROUTINE VOID +#define EXTEXPROUTINE VOID +#endif + +// Information structure about the extension +#ifdef __cplusplus +class kpxRunInfos { +public: +#else +typedef struct kpxRunInfos { +#endif + EXTCONDROUTINE* conditions; // 00 Offset to condition jump list + EXTACTROUTINE* actions; // 04 Offset to action jump list + EXTEXPROUTINE* expressions; // 08 Offset to expression jump list + short numOfConditions; // 0C Number of conditions + short numOfActions; // 0E Number of actions + short numOfExpressions; // 10 Number of expressions + WORD editDataSize; // 12 Size of the data zone when exploded + DWORD editFlags; // 14 Object flags + char windowProcPriority; // 16 Priority of the routine 0-255 + char free; + short editPrefs; // 18 Preferences d'edition + long identifier; // 1A Chaine d'identification + short version; // 1E Version courante + // 20 +#ifdef __cplusplus +}; +#else +} kpxRunInfos; +#endif +typedef kpxRunInfos * LPKPXRUNINFOS; +typedef kpxRunInfos * fpKpxRunInfos; + +// Extension jump table +// -------------------- +typedef short (WINAPI * CREATERUNOBJECT_PROC) (LPHO hoPtr, LPEXT extPtr, LPCOB); +typedef unsigned short (WINAPI * GETRUNDATASIZE_PROC)(LPRH, LPEXT); +typedef short (WINAPI * DESTROYRUNOBJECT_PROC)(LPHO, long fast); +typedef short (WINAPI * HANDLERUNOBJECT_PROC)(LPHO); +typedef short (WINAPI * DISPLAYRUNOBJECT_PROC)(LPHO); +typedef cSurface* (WINAPI * GETRUNOBJECTSURFACE_PROC)(LPHO); +typedef short (WINAPI * REINITRUNOBJECT_PROC)(LPHO); +typedef short (WINAPI * PAUSERUNOBJECT_PROC)(LPHO); +typedef short (WINAPI * CONTINUERUNOBJECT_PROC)(LPHO); +typedef short (WINAPI * PREPARETOSAVE_PROC)(LPHO); +typedef short (WINAPI * SAVEBACKGROUND_PROC)(LPHO); +typedef short (WINAPI * RESTOREBACKGROUND_PROC)(LPHO); +typedef short (WINAPI * CHANGERUNDATA_PROC)(LPHO, LPHO); +typedef short (WINAPI * KILLBACKGROUND_PROC) (LPHO); +typedef short (WINAPI * GETZONEINFO_PROC)(LPHO); +typedef LPWORD (WINAPI * GETDEBUGTREE_PROC)(LPHO); +typedef void (WINAPI * GETDEBUGITEM_PROC)(LPTSTR, LPHO, int); +typedef void (WINAPI* EDITDEBUGITEM_PROC)(LPHO, int); +typedef void (WINAPI* GETRUNOBJECTFONT_PROC)(LPHO, LOGFONT*); +typedef void (WINAPI* SETRUNOBJECTFONT_PROC)(LPHO, LOGFONT*, RECT*); +typedef COLORREF (WINAPI* GETRUNOBJECTTEXTCOLOR_PROC)(LPHO); +typedef void (WINAPI* SETRUNOBJECTTEXTCOLOR_PROC)(LPHO, COLORREF); +typedef short (WINAPI * GETRUNOBJECTWINDOW_PROC)(LPHO); +typedef sMask* (WINAPI * GETRUNOBJECTCOLLISIONMASK_PROC)(LPHO, LPARAM); +typedef BOOL (WINAPI * SAVERUNOBJECT_PROC)(LPHO, HANDLE); +typedef BOOL (WINAPI * LOADRUNOBJECT_PROC)(LPHO, HANDLE); +typedef void (WINAPI * GETRUNOBJECTMEMORYUSAGE_PROC)(LPHO, int*, int*, int*); + +#ifdef __cplusplus +class kpj { +public: +#else +#undef kpj +typedef struct kpj { +#endif + CREATERUNOBJECT_PROC CreateRunObject; + DESTROYRUNOBJECT_PROC DestroyRunObject; + HANDLERUNOBJECT_PROC HandleRunObject; + DISPLAYRUNOBJECT_PROC DisplayRunObject; + GETRUNOBJECTSURFACE_PROC GetRunObjectSurface; + REINITRUNOBJECT_PROC ReInitRunObject; + PAUSERUNOBJECT_PROC PauseRunObject; + CONTINUERUNOBJECT_PROC ContinueRunObject; + PREPARETOSAVE_PROC PrepareToSave; + PREPARETOSAVE_PROC PrepareToSave2; + GETRUNDATASIZE_PROC GetRunObjectDataSize; + SAVEBACKGROUND_PROC SaveBackground; + RESTOREBACKGROUND_PROC RestoreBackground; + CHANGERUNDATA_PROC ChangeRunData; + KILLBACKGROUND_PROC KillBackground; + GETZONEINFO_PROC GetZoneInfo; + GETDEBUGTREE_PROC GetDebugTree; + GETDEBUGITEM_PROC GetDebugItem; + EDITDEBUGITEM_PROC EditDebugItem; + GETRUNOBJECTFONT_PROC GetRunObjectFont; + SETRUNOBJECTFONT_PROC SetRunObjectFont; + GETRUNOBJECTTEXTCOLOR_PROC GetRunObjectTextColor; + SETRUNOBJECTTEXTCOLOR_PROC SetRunObjectTextColor; + GETRUNOBJECTWINDOW_PROC GetRunObjectWindow; + GETRUNOBJECTCOLLISIONMASK_PROC GetRunObjectCollisionMask; + SAVERUNOBJECT_PROC SaveRunObject; + LOADRUNOBJECT_PROC LoadRunObject; + GETRUNOBJECTMEMORYUSAGE_PROC GetRunObjectMemoryUsage; + + kpxRunInfos infos; + +#ifdef __cplusplus +}; +#else +} kpj; +#endif +typedef kpj * LPKPJ; + +#define KPJ_SHIFT 7 +#define KPJ_SIZE 0x80 +#define KPJ_MAXNUMBER 128 +#define KPJ_STEP 8 +#define kpjJCreate 0x00 +#define kpjJDestroy 0x04 +#define kpjJRoutine 0x08 +#define kpjJDisplay 0x0C +#define kpjJReInit 0x10 +#define kpjJPause 0x14 +#define kpjJEndPause 0x18 +#define kpjJPrepareToSave 0x1C +#define kpjJRestart 0x20 +#define kpjJGetRunDataSize 0x24 +#define kpjJSaveBackground 0x28 +#define kpjJRestoreBackground 0x2C +#define kpjJKillBackground 0x30 + +// Possible states of the application, see LApplication::SetRunningState() +#define GAMEON_EMPTY 0 +#define GAMEON_UNLOADED 1 +#define GAMEON_TIME0 2 +#define GAMEON_PAUSED 3 +#define GAMEON_RUNNING 4 +#define GAMEON_STEPPING 5 + + +////////////////////////////////////////////////////////////////////////////// +// Condition/action jumps +typedef BOOL (*CALLCOND1_ROUTINE)(event* pe, LPHO pHo); +typedef BOOL (*CALLCOND2_ROUTINE)(event* pe); +typedef void (*CALLACTION_ROUTINE)(event* pe); +typedef void (*CALLEXP_ROUTINE)(); +typedef BOOL (*CONDROUTINE)(event* pe, LPHO pHo); +typedef void (*ACTROUTINE)(event* pe); +typedef void (*EXPROUTINE)(); +typedef void (*CALLOPERATOR_ROUTINE)(); + +typedef struct tagCallTables +{ + CALLCOND1_ROUTINE* pConditions1; + CALLCOND2_ROUTINE* pConditions2; + CALLACTION_ROUTINE* pActions; + CALLEXP_ROUTINE* pExpressions; +}CallTables; + +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +// +// Run-time Definitions +// + +#define COMPARE_EQ 0 +#define COMPARE_NE 1 +#define COMPARE_LE 2 +#define COMPARE_LT 3 +#define COMPARE_GE 4 +#define COMPARE_GT 5 + +#ifdef RUN_TIME + + #define OINUM_ERROR -1 + #define B2L(a,b,c,d) ((DWORD)(((DWORD)((unsigned char)(d))<<24)|((DWORD)((unsigned char)(c))<<16)|((DWORD)((unsigned char)(b))<<8)|(DWORD)((unsigned char)(a)))) + + // Pour la routine GetFileInfos + #define FILEINFO_DRIVE 1 + #define FILEINFO_DIR 2 + #define FILEINFO_PATH 3 + #define FILEINFO_APPNAME 4 + #define FILEINFO_TEMPPATH 5 + + // MACRO: next event + #define EVTNEXT(p) ((LPEVT)((LPBYTE)p+p->evtSize)) + // MACRO: returns first param + #define EVTPARAMS(p) ((LPEVP)(p->evtCode<0 ? (LPBYTE)p+CND_SIZE : (LPBYTE)p+ACT_SIZE )) + // MACRO: returns the extension condition code + #define EXTCONDITIONNUM(i) (-((short)(i>>16))-1) + #define EXTACTIONNUM(i) ((short)(i>>16)) + + #define KPXNAME_SIZE 60 + #define BADNAME_SIZE (OINAME_SIZE+KPXNAME_SIZE+8) + + // Extensions + // ---------- + typedef struct TABKPT { + kpj kpx[2]; + } kpxData; + typedef kpxData * fpkpdt; + + // Main loop exit codes + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + #define LOOPEXIT_NEXTLEVEL 1 + #define LOOPEXIT_PREVLEVEL 2 + #define LOOPEXIT_GOTOLEVEL 3 + #define LOOPEXIT_NEWGAME 4 + #define LOOPEXIT_PAUSEGAME 5 + #define LOOPEXIT_SAVEAPPLICATION 6 + #define LOOPEXIT_LOADAPPLICATION 7 + #define LOOPEXIT_SAVEFRAME 8 + #define LOOPEXIT_LOADFRAME 9 + #define LOOPEXIT_ENDGAME -2 + + #define LOOPEXIT_QUIT 100 + #define LOOPEXIT_RESTART 101 + #define LOOPEXIT_TIMER 102 + #define LOOPEXIT_STEP 103 + #define LOOPEXIT_MONITOR 104 + #define LOOPEXIT_EVENTEDITOR 105 + #define LOOPEXIT_ESC 106 + #define LOOPEXIT_MENU 107 + #define LOOPEXIT_JUMPTO 108 + #define LOOPEXIT_RESET 109 + #define LOOPEXIT_PAUSE 110 + #define LOOPEXIT_PLAY 111 + + // Backdrop draw routines + // ---------------------------------------- + typedef void (* DRAWROUTINE_PROC)(drawRoutine*); + + #ifdef __cplusplus + class drawRoutine { + public: + #else + #undef drawRoutine + typedef struct drawRoutine { + #endif + #ifdef __cplusplus + drawRoutine* next; + #else + LPVOID next; + #endif + DRAWROUTINE_PROC routine; + long param1; + long param2; + long param3; + long param4; + long param5; + long param6; + #ifdef __cplusplus + }; + #else + } drawRoutine; + #endif + + // To push an event + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + #define MAX_PUSHEDEVENTS 32 + typedef void (*PEV_ROUTINE)(LPHO, long); + + #ifdef __cplusplus + class pev { + public: + #else + #undef pev + typedef struct pev { + #endif + long pevCode; + PEV_ROUTINE pevRoutine; + long pevParam; + LPHO pevObject; + short pevOi; + #ifdef __cplusplus + }; + #else + } pev; + #endif + #define PIXEL_SPEED 5 + + // QUALIFIERS + typedef struct + { + OINUM qOi; + ITEMTYPE qType; + WORD qList; + } qualifierLoad; + typedef qualifierLoad * LPQLOAD; + +#endif // RUN_TIME + +#ifndef __cplusplus +#undef headerObject +#undef kpj +#undef objInfoList +#undef drawRoutine +#undef LO +#undef pev +#undef qualToOi +//#undef CValue +#undef CRunApp +#undef CRunFrame +#endif; + +// Restores structure alignment... +#ifndef _H2INC +#pragma pack( pop, _pack_cncf_ ) +#endif + +#endif //CNCF_H + + + diff --git a/Inc/cncr.h b/Inc/cncr.h index 7bc9821..6b87bda 100644 --- a/Inc/cncr.h +++ b/Inc/cncr.h @@ -1,614 +1,614 @@ - -#ifndef _cncinc_h -#define _cncinc_h - -#include "cncy.h" -#include "cncf.h" - -#ifdef __cplusplus -class cSurface; -class CTransition; -class CDebugger; -class CRunApp; -#ifdef HWABETA -class CEffectEx; -class CPList; -#endif -#else -#define cSurface void -#define CTransition void -#define CDebugger void -#ifdef HWABETA -#define CEffectEx void -#define CPList void -#endif -#endif - -////////////////////////////////////////////////////////////////////////////// -// -// LO (frame object instance) -// -// -// Note: mainly used at runtime - -#ifdef __cplusplus -class LO { -public: -#else -typedef struct LO { -#endif - - WORD loHandle; // HLO - WORD loOiHandle; // HOI - int loX; // Coords - int loY; - WORD loParentType; // Parent type - WORD loOiParentHandle; // HOI Parent - WORD loLayer; // Layer - WORD loType; - npSpr loSpr[4]; // Sprite handles for backdrop objects from layers > 1 - -#ifdef __cplusplus -}; -#else -} LO; -#endif -typedef LO *LPLO; -typedef LO *fpLevObj; - - -////////////////////////////////////////////////////////////////////////////// -// -// OI (frame object) -// - -#define OILF_OCLOADED 0x0001 // -#define OILF_ELTLOADED 0x0002 // -#define OILF_TOLOAD 0x0004 // -#define OILF_TODELETE 0x0008 // -#define OILF_CURFRAME 0x0010 // -#define OILF_TORELOAD 0x0020 // Reload images when frame change -#define OILF_IGNORELOADONCALL 0x0040 // Ignore load on call option - -//////////////////// -// ObjInfo structure -//////////////////// -// -// Note: mainly used at runtime -// only some members of the oiHdr member are valid at editing time -// -#ifdef OI -#undef OI -#endif - -#ifdef __cplusplus -class OI { -public: -#else -typedef struct OI { -#endif - ObjInfoHeader oiHdr; // Header - LPTSTR oiName; // Name - LPOC oiOC; // ObjectsCommon - - DWORD oiFileOffset; - DWORD oiLoadFlags; - WORD oiLoadCount; - WORD oiCount; - -#ifdef HWABETA - LPBYTE oiExtEffect; - CEffectEx* oiExtEffectEx; // Pour backdrops, faut trouver un système plus efficace (banque d'effets pour les backdrops) -#endif // HWABETA - -#ifdef __cplusplus -}; -#else -} OI; -#endif -typedef OI *LPOI; -typedef OI* fpObjInfo; - -// Runtime only -#ifdef RUN_TIME - -/////////////////////////////////////////////// -// -// Added backdrop objects -// -typedef struct bkd2 { - - WORD loHnd; // 0 - WORD oiHnd; // 0 - int x; - int y; - WORD img; - WORD colMode; - WORD nLayer; - WORD obstacleType; - npSpr pSpr[4]; - DWORD inkEffect; - DWORD inkEffectParam; - -} bkd2; -typedef bkd2 *LPBKD2; - -#define MAX_BKD2 (curFrame.m_maxObjects) - -/////////////////////////////////////////////// -// -// Layer at runtime -// -typedef struct RunFrameLayer -{ - // Name - LPTSTR pName; // Name - - // Offset - int x; // Current offset - int y; - int dx; // Offset to apply to the next refresh - int dy; - - // Added backdrops - int m_nBkd2Count; - LPBKD2 m_pBkd2; - - // Ladders - int m_nLadderMax; - int m_nLadders; - LPRECT m_pLadders; - - // Z-order max index for dynamic objects - int m_nZOrderMax; - - // Permanent data (EditFrameLayer) - DWORD dwOptions; // Options - float xCoef; - float yCoef; - DWORD nBkdLOs; // Number of backdrop objects - DWORD nFirstLOIndex; // Index of first backdrop object in LO table - - // EditFrameLayerEffect -#ifdef HWABETA - DWORD dwEffect; - LPARAM dwEffectParam; // CEffectEx si extended -#endif // HWABETA - - // Backup for restart - DWORD backUp_dwOptions; - float backUp_xCoef; - float backUp_yCoef; - DWORD backUp_nBkdLOs; - DWORD backUp_nFirstLOIndex; - -#ifdef HWABETA -// DWORD backUp_dwEffect; // A voir -// LPARAM backUp_dwEffectParam; -#endif // HWABETA - -} RunFrameLayer; - -// Object transition data -typedef struct objTransInfo { - - CTransition* m_pTrans; // Transition object - cSurface* m_SfSave; // Background surface - cSurface* m_SfDisplay; // Working surface - cSurface* m_Sf1; // Source surface - cSurface* m_Sf2; // Destination surface - BOOL m_fadeOut; // fade type - BOOL m_fill1withbackground; // source = background (opaque mode) - BOOL m_fill2withbackground; // dest = background (opaque mode) - BOOL m_saved; // m_SfSave has been updated - int m_xsave; - int m_ysave; - int m_cxsave; - int m_cysave; -#ifdef HWABETA - BOOL m_bStepDrawBlit; // Use StepDrawBlit instead of StepDraw -#endif - -} objTransInfo; -typedef objTransInfo * LPOBJTRANSINFO; - -////////////////////////////////////////////////////////////////////////////// -// -// Frame at runtime -// - -#define MAX_TEMPSTRING 16 -#define IPHONEOPT_JOYSTICK_FIRE1 0x0001 -#define IPHONEOPT_JOYSTICK_FIRE2 0x0002 -#define IPHONEOPT_JOYSTICK_LEFTHAND 0x0004 -#define IPHONEFOPT_MULTITOUCH 0x0008 -#define IPHONEFOPT_SCREENLOCKING 0x0010 -#define IPHONEFOPT_IPHONEFRAMEIAD 0x0020 -#define JOYSTICK_NONE 0x0000 -#define JOYSTICK_TOUCH 0x0001 -#define JOYSTICK_ACCELEROMETER 0x0002 -#define JOYSTICK_EXT 0x0003 - - -#ifdef __cplusplus -class CRunFrame { -public: -#else -typedef struct CRunFrame { -#endif - - // Header - FrameHeader m_hdr; - - // Name - LPTSTR m_name; - - // Palette - LPLOGPALETTE m_palette; - - // Background surface - cSurface* m_pSurface; - - // Coordinates of top-level pixel in edit window - int m_leX; - int m_leY; - int m_leLastScrlX; - int m_leLastScrlY; - - // Layers - int m_nLayers; - RunFrameLayer* m_pLayers; - - // Virtual rectangle - RECT m_leVirtualRect; - - // Instances of frame objects - int m_loMaxIndex; - int m_loMaxHandle; - LPWORD m_lo_handle_to_index; - LPLO m_los; - - // Variables for enumeration functions - int m_loFranIndex; - int m_oiFranIndex; - - // Remap table or palette handle for sub-application - LPBYTE m_remapTable; - - // Transitions - LPBYTE m_fadeIn; - LPBYTE m_fadeOut; - cSurface* m_pFadeInSurface1; - cSurface* m_pFadeInSurface2; - CTransition* m_pTrans; - - // Exit code - DWORD m_levelQuit; - - // Events - int m_rhOK; // TRUE when the events are initialized - LPRH m_rhPtr; // Pointer to RunHeader - LPEVG m_eventPrograms; - DWORD m_free[MAX_EVENTPROGRAMS-1]; - LPOIL m_oiList; - LPVOID m_free0; - LPWORD m_qualToOiList; - LPWORD m_qualOilPtr; // Ne pas liberer! - LPWORD m_qualOilPtr2; // Ne pas liberer! - OINUM* m_limitBuffer; - LPDWORD m_listPointers; - LPDWORD m_eventPointers; - LPQLOAD m_qualifiers; - short m_nQualifiers; - - short m_nConditions[NUMBEROF_SYSTEMTYPES+OBJ_LAST]; - DWORD m_free2[MAX_EVENTPROGRAMS]; - WORD m_wJoystick; - WORD m_wIPhoneOptions; - LPBYTE m_swapBuffers; - DWORD m_objectList; - LPBYTE m_destroyList; - int m_free3; - int m_nPlayers; - int m_nPlayersReal; - int m_level_loop_state; - int m_startLeX; - int m_startLeY; - short m_maxObjects; - short m_maxOI; - LPOBL m_oblEnum; - int m_oblEnumCpt; - BOOL m_eventsBranched; - BOOL m_fade; - DWORD m_fadeTimerDelta; - DWORD m_fadeVblDelta; - DWORD m_pasteMask; - - int m_nCurTempString; - LPTSTR m_pTempString[MAX_TEMPSTRING]; // not used - - // Other - cSurface* m_pSaveSurface; - int m_leEditWinWidth; - int m_leEditWinHeight; - DWORD m_dwColMaskBits; - LPTSTR m_demoFilePath; - WORD m_wRandomSeed; - WORD m_wFree; - DWORD m_dwMvtTimerBase; - -#ifdef HWABETA - LPBYTE m_pLayerEffects; - - // Frame effect - FrameEffect* m_pEffect; // Frame effect (chunk data, contains effect index & param used in blit) - CEffectEx* m_pEffectEx; // Current effect - bool m_bFrameEffectChanged; // Frame effect has been modified - bool m_bAlwaysUseSecondarySurface; // This frame always use a secondary surface - - // Secondary surface (render target used if background or frame effects) - cSurface* m_pSecondarySurface; - - // List of sub-app surfaces to refresh at the end in D3D full screen mode - CPList* m_pSurfacedSubApps; -#endif - -#ifdef __cplusplus -}; -#else -} CRunFrame; -#endif -typedef CRunFrame *fpRunFrame; - -//////////////////////// -// -// Binary files -// -#ifdef __cplusplus -class CBinaryFile { -public: - CBinaryFile() { m_path[0] = 0; m_pTempPath = NULL; m_fileSize = m_fileOffset = 0; m_tempCount = 0; } - ~CBinaryFile() { if ( m_pTempPath != NULL ) { _tremove(m_pTempPath); free(m_pTempPath); m_pTempPath = NULL; m_tempCount = 0; } } - -public: - TCHAR m_path[_MAX_PATH]; // path stored in ccn file - LPTSTR m_pTempPath; // path in temporary folder, if any - DWORD m_fileSize; // file size - DWORD m_fileOffset; // file offset in EXE/CCN file - long m_tempCount; // usage count -}; -#endif // __cplusplus - -////////////////////////////////////////////////////////////////////////////// -// -// Application -// - -#define ARF_MENUINIT 0x0001 -#define ARF_MENUIMAGESLOADED 0x0002 // menu images have been loaded into memory -#define ARF_INGAMELOOP 0x0004 -#define ARF_PAUSEDBEFOREMODALLOOP 0x0008 - -#ifdef __cplusplus -class CRunApp { -public: -#else -typedef struct CRunApp { -#endif - - // Application info - AppMiniHeader m_miniHdr; // Version - AppHeader m_hdr; // General info - LPTSTR m_name; // Name of the application - LPTSTR m_appFileName; // filename (temporary file in editor mode) - LPTSTR m_editorFileName; // filename of original .mfa file - LPTSTR m_copyright; // copyright - LPTSTR m_aboutText; // text to display in the About box - - // File infos - LPTSTR m_targetFileName; // filename of original CCN/EXE file - LPTSTR m_tempPath; // Temporary directory for external files - HFILE m_file; // File handle - DWORD m_startOffset; - - // Help file - LPTSTR m_doc; // Help file pathname - - // Icon - LPBYTE m_icon16x16x8; // = LPBITMAPINFOHEADER - HICON m_hIcon16x16x8; // Small icon for the main window - - // Menu - HMENU m_hRunMenu; // Menu - LPBYTE m_accels; // Accelerators - LPTSTR m_pMenuTexts; // Menu texts (for ownerdraw menu) - LPBYTE m_pMenuImages; // Images index used in the menu - MenuHdr* m_pMenu; - - // Frame offsets - int m_frameMaxIndex; // Max. number of frames - int m_frameMaxHandle; // Max. frame handle - LPWORD m_frame_handle_to_index; // Handle -> index table - LPDWORD m_frameOffset; // Frame offsets in the file - - // Frame passwords - LPTSTR * m_framePasswords; // Table of frame passwords - - // Extensions - int m_nbKpx; // Number of extensions - fpKpxFunc m_kpxTab; // Function table 1 - fpkpdt m_kpxDataTable; // Function table 2 - - // Movement Extensions - int m_nbMvx; // Number of extensions - MvxFnc* m_mvxTable; // DLL info - - // Elements - LPTSTR m_eltFileName[MAX_TABREF]; // Element banks - HFILE m_hfElt[MAX_TABREF]; - - DWORD m_eltBaseOff; - WORD m_nbEltOff[MAX_TABREF]; // Sizes of file offset tables - LPDWORD m_adTabEltOff[MAX_TABREF]; // File offsets of bank elements - - WORD m_nbEltMemToDisk[MAX_TABREF]; // Size of elt cross-ref tables - LPWORD m_EltMemToDisk[MAX_TABREF]; // Element memory index -> element disk index - LPWORD m_EltDiskToMem[MAX_TABREF]; // Element disk index -> memory index - - WORD m_tabNbCpt[MAX_TABREF]; // Sizes of usage count tables - LPLONG m_tabAdCpt[MAX_TABREF]; // Usage count tables of bank elements - - // Binary files - #ifdef STAND_ALONE - CTypedPList m_binaryFiles; // Embeded files - #else - UINT m_binaryFiles[8]; - #endif - - // Temporary images - UINT m_nImagesTemp; // List of temporary images (used by Replace Color action) - LPBYTE m_pImagesTemp; - - // Frame objects - int m_oiMaxIndex; - int m_oiMaxHandle; - LPWORD m_oi_handle_to_index; - LPOI * m_ois; - int m_oiFranIndex; // for enumerating - int m_oiExtFranIndex; // for enumerating - - // Sub-application - #ifndef __cplusplus - #define CRunApp void - #endif - CRunApp* m_pParentApp; // Parent application - #ifndef __cplusplus - #undef CRunApp - #endif - LPVOID m_pSubAppObject; // LPRS - DWORD m_dwSubAppOptions; // Sub-app options - BOOL m_bSubAppIsVisible; // Sub-app visibility - HICON m_hSubAppIcon; // Sub-app icon - int m_cx; // Subapp: valid if stretch - int m_cy; - - // DLL infos - npAppli m_idAppli; // App object in DLL - int m_nDepth; // Screen depth - cSurface* m_protoLogScreen; // Surface prototype - - // Edit window - HWND m_hEditWin; // Edit Window handle - npWin m_idEditWin; // Edit Window identifier - - // Current frame - CRunFrame* m_Frame; // Pointer to current frame - - // Run-time status - int m_bResizeTimer; - int m_refTime; - int m_appRunningState; - int m_startFrame; - int m_nextFrame; - int m_nCurrentFrame; - BOOL m_bWakeUp; - WORD m_oldFlags; - WORD m_appRunFlags; - BOOL m_bPlayFromMsgProc; - - // Debugger - CDebugger* m_pDebugger; - - // Full Screen - int m_depthFullScreen; - WINDOWPLACEMENT m_sWndPlacement; // Window position backup - int m_oldCxMax; // Window size backup - int m_oldCyMax; - cSurface* m_pFullScreenSurface; - - // Global data - BOOL m_bSharePlayerCtrls; // Sub-app: TRUE if shares player controls - BOOL m_bShareLives; // Sub-app: TRUE if shares lives - BOOL m_bShareScores; // Sub-app: TRUE if shares scores - BOOL m_bShareGlobalValues; // Sub-app: TRUE if shares global values - BOOL m_bShareGlobalStrings; // Sub-app: TRUE if shares global strings - - // Players - fpPlayerCtrls m_pPlayerCtrls; - LPLONG m_pLives; - LPLONG m_pScores; - - // Global values (warning: not valid if sub-app and global values are shared) - LPBYTE m_pGlobalValuesInit; - int m_nGlobalValues; // Number of global values - CValue* m_pGlobalValues; // Global values - LPBYTE m_pFree; // No longer used - LPBYTE m_pGlobalValueNames; - - // Global strings (warning: not valid if sub-app and global values are shared) - LPBYTE m_pGlobalStringInit; // Default global string values - int m_nGlobalStrings; // Number of global strings - LPTSTR* m_pGlobalString; // Pointers to global strings - LPBYTE m_pGlobalStringNames; - - // Global objects - LPBYTE m_AdGO; // Global objects data - - // FRANCOIS - short m_NConditions[NUMBEROF_SYSTEMTYPES+KPX_BASE-1]; - - // External sound files - LPTSTR m_pExtMusicFile; - LPTSTR m_pExtSampleFile[32]; // External sample file per channel - - // New Build 243 - int m_nInModalLoopCount; - LPTSTR m_pPlayerNames; - DWORD m_dwColorCache; - - // New Build 245 - LPBYTE m_pVtz4Opt; // not used - DWORD m_dwFree; // not used - - // Application load - LPTSTR m_pLoadFilename; - DWORD m_saveVersion; - BOOL m_bLoading; - - // Bluray - LPVOID m_pBROpt; - - // Build info - AppHeader2* m_pHdr2; - - // Code page -#ifdef _UNICODE - DWORD m_dwCodePage; - bool m_bUnicodeAppFile; -#endif - - // Effects -#ifdef HWABETA - LPBYTE m_pEffects; // effects used in the application - cSurface* m_pOldSecondarySurface; // secondary surface of the last frame, used in transitions - bool m_bAlwaysUseSecondarySurface; // at least one frame has a transition => always use a secondary surface in all the frames - bool m_bShowWindowedMenu; // to show menu after switch from full screen to windowed mode - int m_nSubAppShowCount; // to show the child window otherwise it's not displayed... -#endif // HWABETA - -#ifdef __cplusplus -}; -#else -} CRunApp; -#endif -typedef CRunApp* fpRunApp; - -#endif // RUN_TIME - -#ifndef __cplusplus -#undef cSurface -#undef CTransition -#undef CDebugger -#endif - -#endif // _cncinc_h + +#ifndef _cncinc_h +#define _cncinc_h + +#include "cncy.h" +#include "cncf.h" + +#ifdef __cplusplus +class cSurface; +class CTransition; +class CDebugger; +class CRunApp; +#ifdef HWABETA +class CEffectEx; +class CPList; +#endif +#else +#define cSurface void +#define CTransition void +#define CDebugger void +#ifdef HWABETA +#define CEffectEx void +#define CPList void +#endif +#endif + +////////////////////////////////////////////////////////////////////////////// +// +// LO (frame object instance) +// +// +// Note: mainly used at runtime + +#ifdef __cplusplus +class LO { +public: +#else +typedef struct LO { +#endif + + WORD loHandle; // HLO + WORD loOiHandle; // HOI + int loX; // Coords + int loY; + WORD loParentType; // Parent type + WORD loOiParentHandle; // HOI Parent + WORD loLayer; // Layer + WORD loType; + npSpr loSpr[4]; // Sprite handles for backdrop objects from layers > 1 + +#ifdef __cplusplus +}; +#else +} LO; +#endif +typedef LO *LPLO; +typedef LO *fpLevObj; + + +////////////////////////////////////////////////////////////////////////////// +// +// OI (frame object) +// + +#define OILF_OCLOADED 0x0001 // +#define OILF_ELTLOADED 0x0002 // +#define OILF_TOLOAD 0x0004 // +#define OILF_TODELETE 0x0008 // +#define OILF_CURFRAME 0x0010 // +#define OILF_TORELOAD 0x0020 // Reload images when frame change +#define OILF_IGNORELOADONCALL 0x0040 // Ignore load on call option + +//////////////////// +// ObjInfo structure +//////////////////// +// +// Note: mainly used at runtime +// only some members of the oiHdr member are valid at editing time +// +#ifdef OI +#undef OI +#endif + +#ifdef __cplusplus +class OI { +public: +#else +typedef struct OI { +#endif + ObjInfoHeader oiHdr; // Header + LPTSTR oiName; // Name + LPOC oiOC; // ObjectsCommon + + DWORD oiFileOffset; + DWORD oiLoadFlags; + WORD oiLoadCount; + WORD oiCount; + +#ifdef HWABETA + LPBYTE oiExtEffect; + CEffectEx* oiExtEffectEx; // Pour backdrops, faut trouver un système plus efficace (banque d'effets pour les backdrops) +#endif // HWABETA + +#ifdef __cplusplus +}; +#else +} OI; +#endif +typedef OI *LPOI; +typedef OI* fpObjInfo; + +// Runtime only +#ifdef RUN_TIME + +/////////////////////////////////////////////// +// +// Added backdrop objects +// +typedef struct bkd2 { + + WORD loHnd; // 0 + WORD oiHnd; // 0 + int x; + int y; + WORD img; + WORD colMode; + WORD nLayer; + WORD obstacleType; + npSpr pSpr[4]; + DWORD inkEffect; + DWORD inkEffectParam; + +} bkd2; +typedef bkd2 *LPBKD2; + +#define MAX_BKD2 (curFrame.m_maxObjects) + +/////////////////////////////////////////////// +// +// Layer at runtime +// +typedef struct RunFrameLayer +{ + // Name + LPTSTR pName; // Name + + // Offset + int x; // Current offset + int y; + int dx; // Offset to apply to the next refresh + int dy; + + // Added backdrops + int m_nBkd2Count; + LPBKD2 m_pBkd2; + + // Ladders + int m_nLadderMax; + int m_nLadders; + LPRECT m_pLadders; + + // Z-order max index for dynamic objects + int m_nZOrderMax; + + // Permanent data (EditFrameLayer) + DWORD dwOptions; // Options + float xCoef; + float yCoef; + DWORD nBkdLOs; // Number of backdrop objects + DWORD nFirstLOIndex; // Index of first backdrop object in LO table + + // EditFrameLayerEffect +#ifdef HWABETA + DWORD dwEffect; + LPARAM dwEffectParam; // CEffectEx si extended +#endif // HWABETA + + // Backup for restart + DWORD backUp_dwOptions; + float backUp_xCoef; + float backUp_yCoef; + DWORD backUp_nBkdLOs; + DWORD backUp_nFirstLOIndex; + +#ifdef HWABETA +// DWORD backUp_dwEffect; // A voir +// LPARAM backUp_dwEffectParam; +#endif // HWABETA + +} RunFrameLayer; + +// Object transition data +typedef struct objTransInfo { + + CTransition* m_pTrans; // Transition object + cSurface* m_SfSave; // Background surface + cSurface* m_SfDisplay; // Working surface + cSurface* m_Sf1; // Source surface + cSurface* m_Sf2; // Destination surface + BOOL m_fadeOut; // fade type + BOOL m_fill1withbackground; // source = background (opaque mode) + BOOL m_fill2withbackground; // dest = background (opaque mode) + BOOL m_saved; // m_SfSave has been updated + int m_xsave; + int m_ysave; + int m_cxsave; + int m_cysave; +#ifdef HWABETA + BOOL m_bStepDrawBlit; // Use StepDrawBlit instead of StepDraw +#endif + +} objTransInfo; +typedef objTransInfo * LPOBJTRANSINFO; + +////////////////////////////////////////////////////////////////////////////// +// +// Frame at runtime +// + +#define MAX_TEMPSTRING 16 +#define IPHONEOPT_JOYSTICK_FIRE1 0x0001 +#define IPHONEOPT_JOYSTICK_FIRE2 0x0002 +#define IPHONEOPT_JOYSTICK_LEFTHAND 0x0004 +#define IPHONEFOPT_MULTITOUCH 0x0008 +#define IPHONEFOPT_SCREENLOCKING 0x0010 +#define IPHONEFOPT_IPHONEFRAMEIAD 0x0020 +#define JOYSTICK_NONE 0x0000 +#define JOYSTICK_TOUCH 0x0001 +#define JOYSTICK_ACCELEROMETER 0x0002 +#define JOYSTICK_EXT 0x0003 + + +#ifdef __cplusplus +class CRunFrame { +public: +#else +typedef struct CRunFrame { +#endif + + // Header + FrameHeader m_hdr; + + // Name + LPTSTR m_name; + + // Palette + LPLOGPALETTE m_palette; + + // Background surface + cSurface* m_pSurface; + + // Coordinates of top-level pixel in edit window + int m_leX; + int m_leY; + int m_leLastScrlX; + int m_leLastScrlY; + + // Layers + int m_nLayers; + RunFrameLayer* m_pLayers; + + // Virtual rectangle + RECT m_leVirtualRect; + + // Instances of frame objects + int m_loMaxIndex; + int m_loMaxHandle; + LPWORD m_lo_handle_to_index; + LPLO m_los; + + // Variables for enumeration functions + int m_loFranIndex; + int m_oiFranIndex; + + // Remap table or palette handle for sub-application + LPBYTE m_remapTable; + + // Transitions + LPBYTE m_fadeIn; + LPBYTE m_fadeOut; + cSurface* m_pFadeInSurface1; + cSurface* m_pFadeInSurface2; + CTransition* m_pTrans; + + // Exit code + DWORD m_levelQuit; + + // Events + int m_rhOK; // TRUE when the events are initialized + LPRH m_rhPtr; // Pointer to RunHeader + LPEVG m_eventPrograms; + DWORD m_free[MAX_EVENTPROGRAMS-1]; + LPOIL m_oiList; + LPVOID m_free0; + LPWORD m_qualToOiList; + LPWORD m_qualOilPtr; // Ne pas liberer! + LPWORD m_qualOilPtr2; // Ne pas liberer! + OINUM* m_limitBuffer; + LPDWORD m_listPointers; + LPDWORD m_eventPointers; + LPQLOAD m_qualifiers; + short m_nQualifiers; + + short m_nConditions[NUMBEROF_SYSTEMTYPES+OBJ_LAST]; + DWORD m_free2[MAX_EVENTPROGRAMS]; + WORD m_wJoystick; + WORD m_wIPhoneOptions; + LPBYTE m_swapBuffers; + DWORD m_objectList; + LPBYTE m_destroyList; + int m_free3; + int m_nPlayers; + int m_nPlayersReal; + int m_level_loop_state; + int m_startLeX; + int m_startLeY; + short m_maxObjects; + short m_maxOI; + LPOBL m_oblEnum; + int m_oblEnumCpt; + BOOL m_eventsBranched; + BOOL m_fade; + DWORD m_fadeTimerDelta; + DWORD m_fadeVblDelta; + DWORD m_pasteMask; + + int m_nCurTempString; + LPTSTR m_pTempString[MAX_TEMPSTRING]; // not used + + // Other + cSurface* m_pSaveSurface; + int m_leEditWinWidth; + int m_leEditWinHeight; + DWORD m_dwColMaskBits; + LPTSTR m_demoFilePath; + WORD m_wRandomSeed; + WORD m_wFree; + DWORD m_dwMvtTimerBase; + +#ifdef HWABETA + LPBYTE m_pLayerEffects; + + // Frame effect + FrameEffect* m_pEffect; // Frame effect (chunk data, contains effect index & param used in blit) + CEffectEx* m_pEffectEx; // Current effect + bool m_bFrameEffectChanged; // Frame effect has been modified + bool m_bAlwaysUseSecondarySurface; // This frame always use a secondary surface + + // Secondary surface (render target used if background or frame effects) + cSurface* m_pSecondarySurface; + + // List of sub-app surfaces to refresh at the end in D3D full screen mode + CPList* m_pSurfacedSubApps; +#endif + +#ifdef __cplusplus +}; +#else +} CRunFrame; +#endif +typedef CRunFrame *fpRunFrame; + +//////////////////////// +// +// Binary files +// +#ifdef __cplusplus +class CBinaryFile { +public: + CBinaryFile() { m_path[0] = 0; m_pTempPath = NULL; m_fileSize = m_fileOffset = 0; m_tempCount = 0; } + ~CBinaryFile() { if ( m_pTempPath != NULL ) { _tremove(m_pTempPath); free(m_pTempPath); m_pTempPath = NULL; m_tempCount = 0; } } + +public: + TCHAR m_path[_MAX_PATH]; // path stored in ccn file + LPTSTR m_pTempPath; // path in temporary folder, if any + DWORD m_fileSize; // file size + DWORD m_fileOffset; // file offset in EXE/CCN file + long m_tempCount; // usage count +}; +#endif // __cplusplus + +////////////////////////////////////////////////////////////////////////////// +// +// Application +// + +#define ARF_MENUINIT 0x0001 +#define ARF_MENUIMAGESLOADED 0x0002 // menu images have been loaded into memory +#define ARF_INGAMELOOP 0x0004 +#define ARF_PAUSEDBEFOREMODALLOOP 0x0008 + +#ifdef __cplusplus +class CRunApp { +public: +#else +typedef struct CRunApp { +#endif + + // Application info + AppMiniHeader m_miniHdr; // Version + AppHeader m_hdr; // General info + LPTSTR m_name; // Name of the application + LPTSTR m_appFileName; // filename (temporary file in editor mode) + LPTSTR m_editorFileName; // filename of original .mfa file + LPTSTR m_copyright; // copyright + LPTSTR m_aboutText; // text to display in the About box + + // File infos + LPTSTR m_targetFileName; // filename of original CCN/EXE file + LPTSTR m_tempPath; // Temporary directory for external files + HFILE m_file; // File handle + DWORD m_startOffset; + + // Help file + LPTSTR m_doc; // Help file pathname + + // Icon + LPBYTE m_icon16x16x8; // = LPBITMAPINFOHEADER + HICON m_hIcon16x16x8; // Small icon for the main window + + // Menu + HMENU m_hRunMenu; // Menu + LPBYTE m_accels; // Accelerators + LPTSTR m_pMenuTexts; // Menu texts (for ownerdraw menu) + LPBYTE m_pMenuImages; // Images index used in the menu + MenuHdr* m_pMenu; + + // Frame offsets + int m_frameMaxIndex; // Max. number of frames + int m_frameMaxHandle; // Max. frame handle + LPWORD m_frame_handle_to_index; // Handle -> index table + LPDWORD m_frameOffset; // Frame offsets in the file + + // Frame passwords + LPTSTR * m_framePasswords; // Table of frame passwords + + // Extensions + int m_nbKpx; // Number of extensions + fpKpxFunc m_kpxTab; // Function table 1 + fpkpdt m_kpxDataTable; // Function table 2 + + // Movement Extensions + int m_nbMvx; // Number of extensions + MvxFnc* m_mvxTable; // DLL info + + // Elements + LPTSTR m_eltFileName[MAX_TABREF]; // Element banks + HFILE m_hfElt[MAX_TABREF]; + + DWORD m_eltBaseOff; + WORD m_nbEltOff[MAX_TABREF]; // Sizes of file offset tables + LPDWORD m_adTabEltOff[MAX_TABREF]; // File offsets of bank elements + + WORD m_nbEltMemToDisk[MAX_TABREF]; // Size of elt cross-ref tables + LPWORD m_EltMemToDisk[MAX_TABREF]; // Element memory index -> element disk index + LPWORD m_EltDiskToMem[MAX_TABREF]; // Element disk index -> memory index + + WORD m_tabNbCpt[MAX_TABREF]; // Sizes of usage count tables + LPLONG m_tabAdCpt[MAX_TABREF]; // Usage count tables of bank elements + + // Binary files + #ifdef STAND_ALONE + CTypedPList m_binaryFiles; // Embeded files + #else + UINT m_binaryFiles[8]; + #endif + + // Temporary images + UINT m_nImagesTemp; // List of temporary images (used by Replace Color action) + LPBYTE m_pImagesTemp; + + // Frame objects + int m_oiMaxIndex; + int m_oiMaxHandle; + LPWORD m_oi_handle_to_index; + LPOI * m_ois; + int m_oiFranIndex; // for enumerating + int m_oiExtFranIndex; // for enumerating + + // Sub-application + #ifndef __cplusplus + #define CRunApp void + #endif + CRunApp* m_pParentApp; // Parent application + #ifndef __cplusplus + #undef CRunApp + #endif + LPVOID m_pSubAppObject; // LPRS + DWORD m_dwSubAppOptions; // Sub-app options + BOOL m_bSubAppIsVisible; // Sub-app visibility + HICON m_hSubAppIcon; // Sub-app icon + int m_cx; // Subapp: valid if stretch + int m_cy; + + // DLL infos + npAppli m_idAppli; // App object in DLL + int m_nDepth; // Screen depth + cSurface* m_protoLogScreen; // Surface prototype + + // Edit window + HWND m_hEditWin; // Edit Window handle + npWin m_idEditWin; // Edit Window identifier + + // Current frame + CRunFrame* m_Frame; // Pointer to current frame + + // Run-time status + int m_bResizeTimer; + int m_refTime; + int m_appRunningState; + int m_startFrame; + int m_nextFrame; + int m_nCurrentFrame; + BOOL m_bWakeUp; + WORD m_oldFlags; + WORD m_appRunFlags; + BOOL m_bPlayFromMsgProc; + + // Debugger + CDebugger* m_pDebugger; + + // Full Screen + int m_depthFullScreen; + WINDOWPLACEMENT m_sWndPlacement; // Window position backup + int m_oldCxMax; // Window size backup + int m_oldCyMax; + cSurface* m_pFullScreenSurface; + + // Global data + BOOL m_bSharePlayerCtrls; // Sub-app: TRUE if shares player controls + BOOL m_bShareLives; // Sub-app: TRUE if shares lives + BOOL m_bShareScores; // Sub-app: TRUE if shares scores + BOOL m_bShareGlobalValues; // Sub-app: TRUE if shares global values + BOOL m_bShareGlobalStrings; // Sub-app: TRUE if shares global strings + + // Players + fpPlayerCtrls m_pPlayerCtrls; + LPLONG m_pLives; + LPLONG m_pScores; + + // Global values (warning: not valid if sub-app and global values are shared) + LPBYTE m_pGlobalValuesInit; + int m_nGlobalValues; // Number of global values + CValue* m_pGlobalValues; // Global values + LPBYTE m_pFree; // No longer used + LPBYTE m_pGlobalValueNames; + + // Global strings (warning: not valid if sub-app and global values are shared) + LPBYTE m_pGlobalStringInit; // Default global string values + int m_nGlobalStrings; // Number of global strings + LPTSTR* m_pGlobalString; // Pointers to global strings + LPBYTE m_pGlobalStringNames; + + // Global objects + LPBYTE m_AdGO; // Global objects data + + // FRANCOIS + short m_NConditions[NUMBEROF_SYSTEMTYPES+KPX_BASE-1]; + + // External sound files + LPTSTR m_pExtMusicFile; + LPTSTR m_pExtSampleFile[32]; // External sample file per channel + + // New Build 243 + int m_nInModalLoopCount; + LPTSTR m_pPlayerNames; + DWORD m_dwColorCache; + + // New Build 245 + LPBYTE m_pVtz4Opt; // not used + DWORD m_dwFree; // not used + + // Application load + LPTSTR m_pLoadFilename; + DWORD m_saveVersion; + BOOL m_bLoading; + + // Bluray + LPVOID m_pBROpt; + + // Build info + AppHeader2* m_pHdr2; + + // Code page +#ifdef _UNICODE + DWORD m_dwCodePage; + bool m_bUnicodeAppFile; +#endif + + // Effects +#ifdef HWABETA + LPBYTE m_pEffects; // effects used in the application + cSurface* m_pOldSecondarySurface; // secondary surface of the last frame, used in transitions + bool m_bAlwaysUseSecondarySurface; // at least one frame has a transition => always use a secondary surface in all the frames + bool m_bShowWindowedMenu; // to show menu after switch from full screen to windowed mode + int m_nSubAppShowCount; // to show the child window otherwise it's not displayed... +#endif // HWABETA + +#ifdef __cplusplus +}; +#else +} CRunApp; +#endif +typedef CRunApp* fpRunApp; + +#endif // RUN_TIME + +#ifndef __cplusplus +#undef cSurface +#undef CTransition +#undef CDebugger +#endif + +#endif // _cncinc_h diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 58ace64..11f5d83 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -1,893 +1,833 @@ -#include "Common.h" - -Edif::SDK * SDK; - -TCHAR Edif::LanguageCode[3]; - -bool Edif::IsEdittime; -bool Edif::ExternalJSON; - -HMENU Edif::ActionMenu, Edif::ConditionMenu, Edif::ExpressionMenu; - -short ReadParameterType(const char * Text) -{ - if(!_stricmp(Text, "Text") || !_stricmp(Text, "String")) - return PARAM_EXPSTRING; - - if(!_stricmp(Text, "Filename") || !_stricmp(Text, "File")) - return PARAM_FILENAME; - - if(!_stricmp(Text, "Float")) - return PARAM_EXPRESSION; - - if(!_stricmp(Text, "Integer")) - return PARAM_EXPRESSION; - - if(!_stricmp(Text, "Object")) - return PARAM_OBJECT; - - if(!_stricmp(Text, "Position")) - return PARAM_POSITION; - - if(!_stricmp(Text, "Create")) - return PARAM_CREATE; - - if(!_stricmp(Text, "SysCreate")) - return PARAM_SYSCREATE; - - if(!_stricmp(Text, "Animation")) - return PARAM_ANIMATION; - - if(!_stricmp(Text, "Nop")) - return PARAM_NOP; - - if(!_stricmp(Text, "Player")) - return PARAM_PLAYER; - - if(!_stricmp(Text, "Every")) - return PARAM_EVERY; - - if(!_stricmp(Text, "Key")) - return PARAM_KEY; - - if(!_stricmp(Text, "Speed")) - return PARAM_SPEED; - - if(!_stricmp(Text, "JoyDirection")) - return PARAM_JOYDIRECTION; - - if(!_stricmp(Text, "Shoot")) - return PARAM_SHOOT; - - if(!_stricmp(Text, "Zone")) - return PARAM_ZONE; - - if(!_stricmp(Text, "Comparison")) - return PARAM_COMPARAISON; - - if(!_stricmp(Text, "StringComparison")) - return PARAM_CMPSTRING; - - if(!_stricmp(Text, "Colour") || !_stricmp(Text, "Color")) - return PARAM_COLOUR; - - if(!_stricmp(Text, "Frame")) - return PARAM_FRAME; - - if(!_stricmp(Text, "SampleLoop")) - return PARAM_SAMLOOP; - - if(!_stricmp(Text, "MusicLoop")) - return PARAM_MUSLOOP; - - if(!_stricmp(Text, "NewDirection")) - return PARAM_NEWDIRECTION; - - if(!_stricmp(Text, "TextNumber")) - return PARAM_TEXTNUMBER; - - if(!_stricmp(Text, "Click")) - return PARAM_CLICK; - - if(!_stricmp(Text, "Program")) - return PARAM_PROGRAM; - - if(!_strnicmp(Text, "Custom", 6)) - return PARAM_EXTBASE+atoi(Text+6); - - return 0; -} - -short ReadExpressionParameterType(const char * Text) -{ - if(!_stricmp(Text, "Text") || !_stricmp(Text, "String")) - return EXPPARAM_STRING; - - if(!_stricmp(Text, "Float")) - return EXPPARAM_LONG; - - if(!_stricmp(Text, "Integer")) - return EXPPARAM_LONG; - - return 0; -} - -void Edif::Init(mv * _far mV, LPEDATA edPtr) -{ - IsEdittime = mV->mvHMainWin != 0; - - mvInvalidateObject(mV, edPtr); -} - -void Edif::Free(mv * _far mV) -{ - delete ::SDK; - ::SDK = NULL; -} - -void Edif::Free(LPEDATA edPtr) -{ -} - -int Edif::Init(mv _far * mV) -{ - _tcscpy (LanguageCode, _T ("EN")); - - // Get pathname of MMF2 - LPTSTR mmfname = (LPTSTR)calloc(_MAX_PATH, sizeof(TCHAR)); - if ( mmfname != NULL ) - { - // Load resources - GetModuleFileName (NULL, mmfname, _MAX_PATH); - HINSTANCE hRes = LoadLibraryEx(mmfname, NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE); - if ( hRes != NULL ) - { - // Load string 720, contains the language code - TCHAR langCode[20]; - LoadString(hRes, 720, langCode, 20); - - int nCode = _ttoi(langCode); - switch (nCode) { - case 0x40C: - _tcscpy (LanguageCode, _T ("FR")); - break; - case 0x411: - _tcscpy (LanguageCode, _T ("JP")); - break; - } - - // Free resources - FreeLibrary(hRes); - } - free(mmfname); - } - - // Get JSON file - char * JSON; - size_t JSON_Size; - - int result = Edif::GetDependency (JSON, JSON_Size, _T("json"), IDR_EDIF_JSON); - - if (result == Edif::DependencyNotFound) - { - TCHAR temp [MAX_PATH]; - GetModuleFileName (hInstLib, temp, sizeof(temp)/sizeof(TCHAR)); - LPTSTR filetitle = _tcsrchr(temp, _T('\\')); - if ( filetitle != NULL ) - _tcscpy(temp, filetitle); - else - temp[0] = 0; - _tcscat(temp, _T(" - Error")); - - MessageBox(0, _T("JSON file not found on disk or in MFX resources"), temp, 0); - return -1; // error, init failed - } - - Edif::ExternalJSON = (result == Edif::DependencyWasFile); - - char * copy = (char *) malloc (JSON_Size + 1); - memcpy (copy, JSON, JSON_Size); - copy [JSON_Size] = 0; - if ( result != Edif::DependencyWasResource ) - free(JSON); - - char json_error [256]; - - json_settings settings; - memset (&settings, 0, sizeof (settings)); - - // settings.settings = json_setting_permissive_commas; - - json_value * json = json_parse_ex (&settings, copy, json_error); - - if (!json) - { - MessageBoxA(0, json_error, "Error parsing JSON", 0); - return -1; - } - - ::SDK = new Edif::SDK(mV, *json); - return 0; // no error -} - -Edif::SDK::SDK(mv * mV, json_value &_json) : json (_json) -{ - this->mV = mV; - -#ifndef RUN_ONLY - Icon = new cSurface; - if(mV->mvImgFilterMgr) - { - char * IconData; - size_t IconSize; - - int result = Edif::GetDependency (IconData, IconSize, _T("png"), IDR_EDIF_ICON); - if (result != Edif::DependencyNotFound) - { - CInputMemFile * File = CInputMemFile::NewInstance (); - File->Create ((LPBYTE)IconData, IconSize); - - DWORD PNG = FILTERID_PNG; - ImportImageFromInputFile(mV->mvImgFilterMgr, File, Icon, &PNG, 0); - - File->Delete(); - - if(!Icon->HasAlpha()) - Icon->SetTransparentColor(RGB(255, 0, 255)); - if ( result != Edif::DependencyWasResource ) - free(IconData); - } - } -#endif // RUN_ONLY - - const json_value &Actions = json["Actions"]; - const json_value &Conditions = json["Conditions"]; - const json_value &Expressions = json["Expressions"]; - - ActionJumps = new void * [Actions.u.array.length + 1]; - ConditionJumps = new void * [Conditions.u.array.length + 1]; - ExpressionJumps = new void * [Expressions.u.array.length + 1]; - - ActionJumps [Actions.u.array.length] = 0; - ConditionJumps [Conditions.u.array.length] = 0; - ExpressionJumps [Expressions.u.array.length] = 0; - - for(unsigned int i = 0; i < Actions.u.array.length; ++ i) - { - const json_value &Action = Actions[i]; - - ActionJumps [i] = (void *) Edif::Action; - - ActionFunctions.push_back(0); - - int ActionID = Edif::ActionID(i); - - ActionInfos.push_back(ActionID); // Menu ID - ActionInfos.push_back(ActionID); // String ID - ActionInfos.push_back(i); // Code - - ActionInfos.push_back(0); // Flags - - const json_value &Parameters = Action["Parameters"]; - - ActionInfos.push_back(Parameters.u.array.length); - - { short IsFloat = 0; - - for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) - { - const json_value &Parameter = Parameters[i]; - - const char * Type; - - if(Parameter.type == json_object) - Type = Parameter["Type"]; - else - Type = Parameter[0]; - - ActionInfos.push_back(ReadParameterType(Type)); - - if(!_stricmp(Type, "Float")) - IsFloat |= 1 << i; - } - - ActionFloatFlags.push_back(IsFloat); - } - - for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) - ActionInfos.push_back(0); - } - - for(unsigned int i = 0; i < Conditions.u.array.length; ++ i) - { - const json_value &Condition = Conditions[i]; - - ConditionJumps [i] = (void *) Edif::Condition; - - ConditionFunctions.push_back(0); - - int ConditionID = Edif::ConditionID(i); - - ConditionInfos.push_back(ConditionID); - ConditionInfos.push_back(ConditionID); - ConditionInfos.push_back(i); - - ConditionInfos.push_back(((bool) Condition["Triggered"]) ? 0 : (EVFLAGS_ALWAYS | EVFLAGS_NOTABLE)); - - const json_value &Parameters = Condition["Parameters"]; - - ConditionInfos.push_back(Parameters.u.array.length); - - { short IsFloat = 0; - - for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) - { - const json_value &Parameter = Parameters[i]; - - const char * Type; - - if(Parameter.type == json_object) - Type = Parameter["Type"]; - else - Type = Parameter[0]; - - ConditionInfos.push_back(ReadParameterType(Type)); - - if(!_stricmp(Type, "Float")) - IsFloat |= 1 << i; - } - - ConditionFloatFlags.push_back(IsFloat); - } - - for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) - ConditionInfos.push_back(0); - } - - for(unsigned int i = 0; i < Expressions.u.array.length; ++ i) - { - const json_value &Expression = Expressions[i]; - - ExpressionJumps [i] = (void *) Edif::Expression; - - ExpressionFunctions.push_back(0); - - if(!_stricmp(Expression["Returns"], "Integer")) - ExpressionTypes.push_back(0); - else if(!_stricmp(Expression["Returns"], "Float")) - ExpressionTypes.push_back(1); - else if(!_stricmp(Expression["Returns"], "Text") || !_stricmp(Expression["Returns"], "String")) - ExpressionTypes.push_back(2); - else - ExpressionTypes.push_back(0); - - int ExpressionID = Edif::ExpressionID(i); - - ExpressionInfos.push_back(ExpressionID); - ExpressionInfos.push_back(ExpressionID); - ExpressionInfos.push_back(i); - - { short FlagsValue = 0; - - if(ExpressionTypes.back() == 1) - FlagsValue |= EXPFLAG_DOUBLE; - - if(ExpressionTypes.back() == 2) - FlagsValue |= EXPFLAG_STRING; - - ExpressionInfos.push_back(FlagsValue); - } - - const json_value &Parameters = Expression["Parameters"]; - - ExpressionInfos.push_back(Parameters.u.array.length); - - { short IsFloat = 0; - - for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) - { - const json_value &Parameter = Parameters[i]; - - const char * Type; - - if(Parameter.type == json_object) - Type = Parameter["Type"]; - else - Type = Parameter[0]; - - ExpressionInfos.push_back(ReadExpressionParameterType(Type)); - - if(!_stricmp(Type, "Float")) - IsFloat |= 1 << i; - } - - ExpressionFloatFlags.push_back(IsFloat); - } - - for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) - ExpressionInfos.push_back(0); - } - - ActionMenu = LoadMenuJSON(Edif::ActionID(0), json["ActionMenu"]); - ConditionMenu = LoadMenuJSON(Edif::ConditionID(0), json["ConditionMenu"]); - ExpressionMenu = LoadMenuJSON(Edif::ExpressionID(0), json["ExpressionMenu"]); -} - -Edif::SDK::~SDK() -{ - json_value_free (&json); - - delete [] ActionJumps; - delete [] ConditionJumps; - delete [] ExpressionJumps; - - delete Icon; -} - -int ActionOrCondition(vector &FloatFlags, LPEVENTINFOS2 Info, void * Function, int ID, LPRDATA rdPtr, long param1, long param2) -{ - int * Parameters; - int ParameterCount; - - { Info = GetEventInformations(Info, ID); - - ParameterCount = Info->infos.nParams; - Parameters = (int *) alloca(sizeof(int) * ParameterCount); - - for(int i = 0; i < ParameterCount; ++ i) - { - switch(EVINFO2_PARAM(Info, i)) - { - case PARAM_EXPRESSION: - - if((FloatFlags[ID] & (1 << i)) != 0) - { - Parameters[i] = CNC_GetFloatParameter(rdPtr); - break; - } - - Parameters[i] = CNC_GetIntParameter(rdPtr); - break; - - case PARAM_EXPSTRING: - case PARAM_FILENAME: - - Parameters[i] = CNC_GetStringParameter(rdPtr); - break; - - default: - - Parameters[i] = CNC_GetParameter(rdPtr); - break; - } - } - } - - void * Extension = rdPtr->pExtension; - - int Result; - - __asm - { - pushad - - mov ecx, ParameterCount - - cmp ecx, 0 - je CallNow - - mov edx, Parameters - - mov ebx, ecx - shl ebx, 2 - - add edx, ebx - sub edx, 4 - - PushLoop: - - push [edx] - sub edx, 4 - - dec ecx - - cmp ecx, 0 - jne PushLoop - - CallNow: - - mov ecx, Extension - call Function - - mov Result, eax - - popad - } - - return Result; -} - -HMENU Edif::LoadMenuJSON(int BaseID, const json_value &Source, HMENU Parent) -{ - if(!Parent) - Parent = CreateMenu(); - - for(unsigned int i = 0; i < Source.u.array.length; ++ i) - { - const json_value &MenuItem = Source[i]; - - if(MenuItem.type == json_string) - { - if(!_stricmp(MenuItem, "Separator")) - { - AppendMenu(Parent, MF_BYPOSITION | MF_SEPARATOR, 0, 0); - continue; - } - - continue; - } - - if(MenuItem[0].type == json_string && MenuItem[1].type == json_array) - { - HMENU SubMenu = CreatePopupMenu(); - LoadMenuJSON(BaseID, MenuItem, SubMenu); - - TCHAR* str = ConvertString(MenuItem[0]); - AppendMenu(Parent, MF_BYPOSITION | MF_STRING | MF_POPUP, (UINT) SubMenu, str); - FreeString(str); - - continue; - } - - unsigned int ItemOffset = 0; - - int ID = BaseID + (int) MenuItem[ItemOffset].u.integer; - TCHAR * Text = ConvertString(MenuItem[ItemOffset + 1]); - bool Disabled = MenuItem.u.array.length > (ItemOffset + 2) ? ((bool) MenuItem[ItemOffset + 2]) != 0 : false; - - AppendMenu(Parent, Disabled ? MF_GRAYED | MF_UNCHECKED | MF_BYPOSITION | MF_STRING - : MF_BYPOSITION | MF_STRING, ID, Text); - - FreeString(Text); - } - - return Parent; -} - -long __stdcall Edif::Condition(LPRDATA rdPtr, long param1, long param2) -{ - int ID = rdPtr->rHo.hoEventNumber; - - rdPtr->pExtension->Runtime.param1 = param1; - rdPtr->pExtension->Runtime.param2 = param2; - - void * Function = ::SDK->ConditionFunctions[ID]; - - if(!Function) - return rdPtr->pExtension->Condition(ID, rdPtr, param1, param2); - - int Result = ActionOrCondition(::SDK->ConditionFloatFlags, (LPEVENTINFOS2) &::SDK->ConditionInfos[0], - Function, ID, rdPtr, param1, param2); - - return *(char *) &Result; -} - -short __stdcall Edif::Action(LPRDATA rdPtr, long param1, long param2) -{ - /* int ID = rdPtr->rHo.hoAdRunHeader->rh4.rh4ActionStart->evtNum; */ - int ID = rdPtr->rHo.hoEventNumber; - - rdPtr->pExtension->Runtime.param1 = param1; - rdPtr->pExtension->Runtime.param2 = param2; - - void * Function = ::SDK->ActionFunctions[ID]; - - if(!Function) - { - rdPtr->pExtension->Action(ID, rdPtr, param1, param2); - return 0; - } - - ActionOrCondition(::SDK->ActionFloatFlags, (LPEVENTINFOS2) &::SDK->ActionInfos[0], - Function, ID, rdPtr, param1, param2); - - return 0; -} - - -long __stdcall Edif::Expression(LPRDATA rdPtr, long param) -{ - int ID = rdPtr->rHo.hoEventNumber; - - rdPtr->pExtension->Runtime.param1 = param; - rdPtr->pExtension->Runtime.param2 = 0; - - int * Parameters; - int ParameterCount; - - void * Function = ::SDK->ExpressionFunctions[ID]; - - if(!Function) - return rdPtr->pExtension->Expression(ID, rdPtr, param); - - { LPEVENTINFOS2 Infos = GetEventInformations((LPEVENTINFOS2) &::SDK->ExpressionInfos[0], ID); - - ParameterCount = Infos->infos.nParams; - Parameters = (int *) alloca(sizeof(int) * ParameterCount); - - for(int i = 0; i < ParameterCount; ++ i) - { - switch(EVINFO2_PARAM(Infos, i)) - { - case EXPPARAM_STRING: - - if(!i) - { - Parameters[i] = CNC_GetFirstExpressionParameter(rdPtr, param, TYPE_STRING); - break; - } - - Parameters[i] = CNC_GetNextExpressionParameter(rdPtr, param, TYPE_STRING); - break; - - case EXPPARAM_LONG: - - int Type = ((::SDK->ExpressionFloatFlags[ID] & (1 << i)) != 0) ? TYPE_FLOAT : TYPE_LONG; - - if(!i) - { - Parameters[i] = CNC_GetFirstExpressionParameter(rdPtr, param, Type); - break; - } - - Parameters[i] = CNC_GetNextExpressionParameter(rdPtr, param, Type); - break; - } - } - } - - void * Extension = rdPtr->pExtension; - - int Result; - int ExpressionType = ::SDK->ExpressionTypes[ID]; - - __asm - { - pushad - - mov ecx, ParameterCount - - cmp ecx, 0 - je CallNow - - mov edx, Parameters - - mov ebx, ecx - shl ebx, 2 - - add edx, ebx - sub edx, 4 - - PushLoop: - - push [edx] - sub edx, 4 - - dec ecx - - cmp ecx, 0 - jne PushLoop - - CallNow: - - mov ecx, Extension - call Function - - mov ecx, ExpressionType; - - cmp ecx, 1 - jne NotFloat - - fstp Result - jmp End - - NotFloat: - - mov Result, eax - - End: - - popad - } - - switch(ExpressionType) - { - case 1: // Float - { - rdPtr->rHo.hoFlags |= HOF_FLOAT; - break; - } - - case 2: // String - { - rdPtr->rHo.hoFlags |= HOF_STRING; - break; - } - }; - - return Result; -} - -int Edif::GetDependency (char *& Buffer, size_t &Size, const TCHAR * FileExtension, int Resource) -{ - TCHAR Filename [MAX_PATH]; - GetSiblingPath (Filename, FileExtension); - - Buffer = NULL; - if (*Filename) - { - FILE * File = NULL; - int error = _tfopen_s(&File, Filename, _T("rb")); - - if (!File) - return DependencyNotFound; - - fseek (File, 0, SEEK_END); - Size = ftell (File); - fseek (File, 0, SEEK_SET); - - Buffer = (char *) malloc (Size + 1); - Buffer [Size] = 0; - - fread (Buffer, 1, Size, File); - - fclose (File); - - return DependencyWasFile; - } - - if (!Resource) - return DependencyNotFound; - - HRSRC res = FindResource (hInstLib, MAKEINTRESOURCE (Resource), _T("EDIF")); - - if (!res) - return DependencyNotFound; - - Size = SizeofResource (hInstLib, res); - Buffer = (char *) LockResource (LoadResource (hInstLib, res)); - - return DependencyWasResource; -} - -static void GetSiblingPath (TCHAR * Buffer, const TCHAR * FileExtension) -{ - TCHAR temp [MAX_PATH]; - - GetModuleFileName (hInstLib, temp, sizeof(temp)/sizeof(TCHAR)); - - TCHAR * Filename = temp + _tcslen(temp) - 1; - - while(*Filename != '.') - -- Filename; - - _tcscpy(++ Filename, FileExtension); - - Filename = Filename + _tcslen(Filename) - 1; - - while(*Filename != '\\' && *Filename != '/') - -- Filename; - - ++ Filename; - - // Is the file in the directory of the MFX? (if so, use this pathname) - TCHAR FullFilename [MAX_PATH]; - _tcscpy(FullFilename, temp); - if(GetFileAttributes(FullFilename) == 0xFFFFFFFF) - { - // No => editor - TCHAR ExecutablePath [MAX_PATH]; - GetModuleFileName (GetModuleHandle (0), ExecutablePath, sizeof(ExecutablePath)/sizeof(TCHAR)); - - { TCHAR * Iterator = ExecutablePath + _tcslen(ExecutablePath) - 1; - - while(*Iterator != '\\' && *Iterator != '/') - -- Iterator; - - *Iterator = 0; - } - - // Same path as the executable? - _stprintf_s(FullFilename, sizeof(ExecutablePath)/sizeof(TCHAR), _T("%s/%s"), ExecutablePath, Filename); - if(GetFileAttributes(FullFilename) == 0xFFFFFFFF) - { - // No => try Data/Runtime - _stprintf_s(FullFilename, sizeof(ExecutablePath)/sizeof(TCHAR), _T("%s/Data/Runtime/%s"), ExecutablePath, Filename); - if(GetFileAttributes(FullFilename) == 0xFFFFFFFF) - { - // No => try .. (maybe we're in the Unicode or HWA folder) - _stprintf_s(FullFilename, sizeof(ExecutablePath)/sizeof(TCHAR), _T("%s/../%s"), ExecutablePath, Filename); - if(GetFileAttributes(FullFilename) == 0xFFFFFFFF) - { - *Buffer = 0; - return; - } - } - } - } - - _tcscpy(Buffer, FullFilename); -} - -void Edif::GetSiblingPath (TCHAR * Buffer, const TCHAR * FileExtension) -{ - TCHAR * Extension = (TCHAR *) - alloca ((_tcslen (FileExtension) + _tcslen (LanguageCode) + 2) * sizeof(TCHAR)); - - _tcscpy (Extension, LanguageCode); - _tcscat (Extension, _T (".")); - _tcscat (Extension, FileExtension); - - ::GetSiblingPath (Buffer, Extension); - - if (*Buffer) - return; - - ::GetSiblingPath (Buffer, FileExtension); -} - -#ifdef _UNICODE -WCHAR* Edif::ConvertString(const char* utf8String) -{ - size_t Length = MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, 0, 0); - if ( Length == 0 ) - Length = 1; - WCHAR* tstr = (WCHAR*)calloc(Length, sizeof(WCHAR)); - MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, tstr, Length); - return tstr; -} - -WCHAR* Edif::ConvertAndCopyString(WCHAR* tstr, const char* utf8String, int maxLength) -{ - MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, tstr, maxLength); - return tstr; -} -#else -char* Edif::ConvertString(const char* utf8String) -{ - // Convert string to Unicode - size_t Length = MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, 0, 0); - if ( Length == 0 ) - Length = 1; - WCHAR* wstr = (WCHAR*)calloc(Length, sizeof(WCHAR)); - MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, wstr, Length); - - // Convert Unicode string using current user code page - int len2 = WideCharToMultiByte(CP_ACP, 0, wstr, -1, 0, 0, NULL, NULL); - if ( len2 == 0 ) - len2 = 1; - char* str = (char*)calloc(len2, sizeof(char)); - WideCharToMultiByte(CP_ACP, 0, wstr, -1, str, len2, NULL, NULL); - free(wstr); - - return str; -} - -char* Edif::ConvertAndCopyString(char* str, const char* utf8String, int maxLength) -{ - // MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, tstr, maxLength); - - // Convert string to Unicode - size_t Length = MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, 0, 0); - if ( Length == 0 ) - Length = 1; - WCHAR* wstr = (WCHAR*)calloc(Length, sizeof(WCHAR)); - MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, wstr, Length); - - // Convert Unicode string using current user code page - WideCharToMultiByte(CP_ACP, 0, wstr, -1, str, maxLength, NULL, NULL); - free(wstr); - - return str; -} -#endif // _UNICODE +#include "Common.h" + +Edif::SDK * SDK; + +TCHAR Edif::LanguageCode[3]; + +bool Edif::IsEdittime; +bool Edif::ExternalJSON; + +HMENU Edif::ActionMenu, Edif::ConditionMenu, Edif::ExpressionMenu; + +short ReadParameterType(const char * Text) +{ + if(!_stricmp(Text, "Text") || !_stricmp(Text, "String")) return PARAM_EXPSTRING; + if(!_stricmp(Text, "Filename") || !_stricmp(Text, "File")) return PARAM_FILENAME; + if(!_stricmp(Text, "Float")) return PARAM_EXPRESSION; + if(!_stricmp(Text, "Integer")) return PARAM_EXPRESSION; + if(!_stricmp(Text, "Object")) return PARAM_OBJECT; + if(!_stricmp(Text, "Position")) return PARAM_POSITION; + if(!_stricmp(Text, "Create")) return PARAM_CREATE; + if(!_stricmp(Text, "SysCreate")) return PARAM_SYSCREATE; + if(!_stricmp(Text, "Animation")) return PARAM_ANIMATION; + if(!_stricmp(Text, "Nothing")) return PARAM_NOP; + if(!_stricmp(Text, "Player")) return PARAM_PLAYER; + if(!_stricmp(Text, "Every")) return PARAM_EVERY; + if(!_stricmp(Text, "Key")) return PARAM_KEY; + if(!_stricmp(Text, "Speed")) return PARAM_SPEED; + if(!_stricmp(Text, "JoyDirection")) return PARAM_JOYDIRECTION; + if(!_stricmp(Text, "Shoot")) return PARAM_SHOOT; + if(!_stricmp(Text, "Zone")) return PARAM_ZONE; + if(!_stricmp(Text, "Comparison")) return PARAM_COMPARAISON; + if(!_stricmp(Text, "StringComparison")) return PARAM_CMPSTRING; + if(!_stricmp(Text, "Colour") || !_stricmp(Text, "Color")) return PARAM_COLOUR; + if(!_stricmp(Text, "Frame")) return PARAM_FRAME; + if(!_stricmp(Text, "SampleLoop")) return PARAM_SAMLOOP; + if(!_stricmp(Text, "MusicLoop")) return PARAM_MUSLOOP; + if(!_stricmp(Text, "NewDirection")) return PARAM_NEWDIRECTION; + if(!_stricmp(Text, "TextNumber")) return PARAM_TEXTNUMBER; + if(!_stricmp(Text, "Click")) return PARAM_CLICK; + if(!_stricmp(Text, "Program")) return PARAM_PROGRAM; + if(!_strnicmp(Text, "Custom", 6)) return PARAM_EXTBASE+atoi(Text+6); + + return 0; +} + +short ReadExpressionParameterType(const char * Text) +{ + if(!_stricmp(Text, "Text") || !_stricmp(Text, "String")) return EXPPARAM_STRING; + if(!_stricmp(Text, "Float")) return EXPPARAM_LONG; + if(!_stricmp(Text, "Integer")) return EXPPARAM_LONG; + + return 0; +} + +void Edif::Init(mv * _far mV, LPEDATA edPtr) +{ + IsEdittime = mV->mvHMainWin != 0; + + mvInvalidateObject(mV, edPtr); +} + +void Edif::Free(mv * _far mV) +{ + delete ::SDK; + ::SDK = NULL; +} + +void Edif::Free(LPEDATA edPtr) +{ +} + +int Edif::Init(mv _far * mV) +{ + _tcscpy (LanguageCode, _T ("EN")); + + // Get pathname of MMF2 + LPTSTR mmfname = (LPTSTR)calloc(_MAX_PATH, sizeof(TCHAR)); + if ( mmfname != NULL ) + { + // Load resources + GetModuleFileName (NULL, mmfname, _MAX_PATH); + HINSTANCE hRes = LoadLibraryEx(mmfname, NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE); + if ( hRes != NULL ) + { + // Load string 720, contains the language code + TCHAR langCode[20]; + LoadString(hRes, 720, langCode, 20); + + int nCode = _ttoi(langCode); + switch (nCode) { + case 0x40C: + _tcscpy (LanguageCode, _T ("FR")); + break; + case 0x411: + _tcscpy (LanguageCode, _T ("JP")); + break; + } + + // Free resources + FreeLibrary(hRes); + } + free(mmfname); + } + + // Get JSON file + char * JSON; + size_t JSON_Size; + + int result = Edif::GetDependency (JSON, JSON_Size, _T("json"), IDR_EDIF_JSON); + + if (result == Edif::DependencyNotFound) + { + TCHAR temp [MAX_PATH]; + GetModuleFileName (hInstLib, temp, sizeof(temp)/sizeof(TCHAR)); + LPTSTR filetitle = _tcsrchr(temp, _T('\\')); + if ( filetitle != NULL ) + _tcscpy(temp, filetitle); + else + temp[0] = 0; + _tcscat(temp, _T(" - Error")); + + MessageBox(0, _T("JSON file not found on disk or in MFX resources"), temp, 0); + return -1; // error, init failed + } + + Edif::ExternalJSON = (result == Edif::DependencyWasFile); + + char * copy = (char *) malloc (JSON_Size + 1); + memcpy (copy, JSON, JSON_Size); + copy [JSON_Size] = 0; + if ( result != Edif::DependencyWasResource ) + free(JSON); + + char json_error [256]; + + json_settings settings; + memset (&settings, 0, sizeof (settings)); + + // settings.settings = json_setting_permissive_commas; + + json_value * json = json_parse_ex (&settings, copy, json_error); + + if (!json) + { + MessageBoxA(0, json_error, "Error parsing JSON", 0); + return -1; + } + + ::SDK = new Edif::SDK(mV, *json); + return 0; // no error +} + +Edif::SDK::SDK(mv * mV, json_value &_json) : json (_json) +{ + this->mV = mV; + +#ifndef RUN_ONLY + Icon = new cSurface; + if(mV->mvImgFilterMgr) + { + char * IconData; + size_t IconSize; + + int result = Edif::GetDependency (IconData, IconSize, _T("png"), IDR_EDIF_ICON); + if (result != Edif::DependencyNotFound) + { + CInputMemFile * File = CInputMemFile::NewInstance (); + File->Create ((LPBYTE)IconData, IconSize); + + DWORD PNG = FILTERID_PNG; + ImportImageFromInputFile(mV->mvImgFilterMgr, File, Icon, &PNG, 0); + + File->Delete(); + + if(!Icon->HasAlpha()) + Icon->SetTransparentColor(RGB(255, 0, 255)); + if ( result != Edif::DependencyWasResource ) + free(IconData); + } + } +#endif // RUN_ONLY + + const json_value &Actions = json["Actions"]; + const json_value &Conditions = json["Conditions"]; + const json_value &Expressions = json["Expressions"]; + + ActionJumps = new void * [Actions.u.array.length + 1]; + ConditionJumps = new void * [Conditions.u.array.length + 1]; + ExpressionJumps = new void * [Expressions.u.array.length + 1]; + + ActionJumps [Actions.u.array.length] = 0; + ConditionJumps [Conditions.u.array.length] = 0; + ExpressionJumps [Expressions.u.array.length] = 0; + + for(unsigned int i = 0; i < Actions.u.array.length; ++ i) + { + const json_value &Action = Actions[i]; + + ActionJumps [i] = (void *) Edif::Action; + + ActionFunctions.push_back(0); + + int ActionID = Edif::ActionID(i); + + ActionInfos.push_back(ActionID); // Menu ID + ActionInfos.push_back(ActionID); // String ID + ActionInfos.push_back(i); // Code + + ActionInfos.push_back(0); // Flags + + const json_value &Parameters = Action["Parameters"]; + + ActionInfos.push_back(Parameters.u.array.length); + + { short IsFloat = 0; + + for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) + { + const json_value &Parameter = Parameters[i]; + + const char * Type; + + if(Parameter.type == json_object) + Type = Parameter["Type"]; + else + Type = Parameter[0]; + + ActionInfos.push_back(ReadParameterType(Type)); + + if(!_stricmp(Type, "Float")) + IsFloat |= 1 << i; + } + + ActionFloatFlags.push_back(IsFloat); + } + + for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) + ActionInfos.push_back(0); + } + + for(unsigned int i = 0; i < Conditions.u.array.length; ++ i) + { + const json_value &Condition = Conditions[i]; + + ConditionJumps [i] = (void *) Edif::Condition; + + ConditionFunctions.push_back(0); + + int ConditionID = Edif::ConditionID(i); + + ConditionInfos.push_back(ConditionID); + ConditionInfos.push_back(ConditionID); + ConditionInfos.push_back(i); + + ConditionInfos.push_back(((bool) Condition["Triggered"]) ? 0 : (EVFLAGS_ALWAYS | EVFLAGS_NOTABLE)); + + const json_value &Parameters = Condition["Parameters"]; + + ConditionInfos.push_back(Parameters.u.array.length); + + { short IsFloat = 0; + + for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) + { + const json_value &Parameter = Parameters[i]; + + const char * Type; + + if(Parameter.type == json_object) + Type = Parameter["Type"]; + else + Type = Parameter[0]; + + ConditionInfos.push_back(ReadParameterType(Type)); + + if(!_stricmp(Type, "Float")) + IsFloat |= 1 << i; + } + + ConditionFloatFlags.push_back(IsFloat); + } + + for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) + ConditionInfos.push_back(0); + } + + for(unsigned int i = 0; i < Expressions.u.array.length; ++ i) + { + const json_value &Expression = Expressions[i]; + + ExpressionJumps [i] = (void *) Edif::Expression; + + ExpressionFunctions.push_back(0); + + if(!_stricmp(Expression["Returns"], "Integer")) + ExpressionTypes.push_back(0); + else if(!_stricmp(Expression["Returns"], "Float")) + ExpressionTypes.push_back(1); + else if(!_stricmp(Expression["Returns"], "Text") || !_stricmp(Expression["Returns"], "String")) + ExpressionTypes.push_back(2); + else + ExpressionTypes.push_back(0); + + int ExpressionID = Edif::ExpressionID(i); + + ExpressionInfos.push_back(ExpressionID); + ExpressionInfos.push_back(ExpressionID); + ExpressionInfos.push_back(i); + + { short FlagsValue = 0; + + if(ExpressionTypes.back() == 1) + FlagsValue |= EXPFLAG_DOUBLE; + + if(ExpressionTypes.back() == 2) + FlagsValue |= EXPFLAG_STRING; + + ExpressionInfos.push_back(FlagsValue); + } + + const json_value &Parameters = Expression["Parameters"]; + + ExpressionInfos.push_back(Parameters.u.array.length); + + { short IsFloat = 0; + + for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) + { + const json_value &Parameter = Parameters[i]; + + const char * Type; + + if(Parameter.type == json_object) + Type = Parameter["Type"]; + else + Type = Parameter[0]; + + ExpressionInfos.push_back(ReadExpressionParameterType(Type)); + + if(!_stricmp(Type, "Float")) + IsFloat |= 1 << i; + } + + ExpressionFloatFlags.push_back(IsFloat); + } + + for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) + ExpressionInfos.push_back(0); + } + + ActionMenu = LoadMenuJSON(Edif::ActionID(0), json["ActionMenu"]); + ConditionMenu = LoadMenuJSON(Edif::ConditionID(0), json["ConditionMenu"]); + ExpressionMenu = LoadMenuJSON(Edif::ExpressionID(0), json["ExpressionMenu"]); +} + +Edif::SDK::~SDK() +{ + json_value_free (&json); + + delete [] ActionJumps; + delete [] ConditionJumps; + delete [] ExpressionJumps; + + delete Icon; +} + +int ActionOrCondition(vector &FloatFlags, LPEVENTINFOS2 Info, void * Function, int ID, LPRDATA rdPtr, long param1, long param2) +{ + int * Parameters; + int ParameterCount; + + { Info = GetEventInformations(Info, ID); + + ParameterCount = Info->infos.nParams; + Parameters = (int *) alloca(sizeof(int) * ParameterCount); + + for(int i = 0; i < ParameterCount; ++ i) + { + switch(EVINFO2_PARAM(Info, i)) + { + case PARAM_EXPRESSION: + + if((FloatFlags[ID] & (1 << i)) != 0) + { + Parameters[i] = CNC_GetFloatParameter(rdPtr); + break; + } + + Parameters[i] = CNC_GetIntParameter(rdPtr); + break; + + case PARAM_EXPSTRING: + case PARAM_FILENAME: + + Parameters[i] = CNC_GetStringParameter(rdPtr); + break; + + default: + + Parameters[i] = CNC_GetParameter(rdPtr); + break; + } + } + } + + void * Extension = rdPtr->pExtension; + + int Result; + + __asm + { + pushad + + mov ecx, ParameterCount + + cmp ecx, 0 + je CallNow + + mov edx, Parameters + + mov ebx, ecx + shl ebx, 2 + + add edx, ebx + sub edx, 4 + + PushLoop: + + push [edx] + sub edx, 4 + + dec ecx + + cmp ecx, 0 + jne PushLoop + + CallNow: + + mov ecx, Extension + call Function + + mov Result, eax + + popad + } + + return Result; +} + +HMENU Edif::LoadMenuJSON(int BaseID, const json_value &Source, HMENU Parent) +{ + if(!Parent) + Parent = CreateMenu(); + + for(unsigned int i = 0; i < Source.u.array.length; ++ i) + { + const json_value &MenuItem = Source[i]; + + if(MenuItem.type == json_string) + { + if(!_stricmp(MenuItem, "Separator")) + { + AppendMenu(Parent, MF_BYPOSITION | MF_SEPARATOR, 0, 0); + continue; + } + + continue; + } + + if(MenuItem[0].type == json_string && MenuItem[1].type == json_array) + { + HMENU SubMenu = CreatePopupMenu(); + LoadMenuJSON(BaseID, MenuItem, SubMenu); + + TCHAR* str = ConvertString(MenuItem[0]); + AppendMenu(Parent, MF_BYPOSITION | MF_STRING | MF_POPUP, (UINT) SubMenu, str); + FreeString(str); + + continue; + } + + unsigned int ItemOffset = 0; + + int ID = BaseID + (int) MenuItem[ItemOffset].u.integer; + TCHAR * Text = ConvertString(MenuItem[ItemOffset + 1]); + bool Disabled = MenuItem.u.array.length > (ItemOffset + 2) ? ((bool) MenuItem[ItemOffset + 2]) != 0 : false; + + AppendMenu(Parent, Disabled ? MF_GRAYED | MF_UNCHECKED | MF_BYPOSITION | MF_STRING + : MF_BYPOSITION | MF_STRING, ID, Text); + + FreeString(Text); + } + + return Parent; +} + +long __stdcall Edif::Condition(LPRDATA rdPtr, long param1, long param2) +{ + int ID = rdPtr->rHo.hoEventNumber; + + rdPtr->pExtension->Runtime.param1 = param1; + rdPtr->pExtension->Runtime.param2 = param2; + + void * Function = ::SDK->ConditionFunctions[ID]; + + if(!Function) + return rdPtr->pExtension->Condition(ID, rdPtr, param1, param2); + + int Result = ActionOrCondition(::SDK->ConditionFloatFlags, (LPEVENTINFOS2) &::SDK->ConditionInfos[0], + Function, ID, rdPtr, param1, param2); + + return *(char *) &Result; +} + +short __stdcall Edif::Action(LPRDATA rdPtr, long param1, long param2) +{ + /* int ID = rdPtr->rHo.hoAdRunHeader->rh4.rh4ActionStart->evtNum; */ + int ID = rdPtr->rHo.hoEventNumber; + + rdPtr->pExtension->Runtime.param1 = param1; + rdPtr->pExtension->Runtime.param2 = param2; + + void * Function = ::SDK->ActionFunctions[ID]; + + if(!Function) + { + rdPtr->pExtension->Action(ID, rdPtr, param1, param2); + return 0; + } + + ActionOrCondition(::SDK->ActionFloatFlags, (LPEVENTINFOS2) &::SDK->ActionInfos[0], + Function, ID, rdPtr, param1, param2); + + return 0; +} + + +long __stdcall Edif::Expression(LPRDATA rdPtr, long param) +{ + int ID = rdPtr->rHo.hoEventNumber; + + rdPtr->pExtension->Runtime.param1 = param; + rdPtr->pExtension->Runtime.param2 = 0; + + int * Parameters; + int ParameterCount; + + void * Function = ::SDK->ExpressionFunctions[ID]; + + if(!Function) + return rdPtr->pExtension->Expression(ID, rdPtr, param); + + { LPEVENTINFOS2 Infos = GetEventInformations((LPEVENTINFOS2) &::SDK->ExpressionInfos[0], ID); + + ParameterCount = Infos->infos.nParams; + Parameters = (int *) alloca(sizeof(int) * ParameterCount); + + for(int i = 0; i < ParameterCount; ++ i) + { + switch(EVINFO2_PARAM(Infos, i)) + { + case EXPPARAM_STRING: + + if(!i) + { + Parameters[i] = CNC_GetFirstExpressionParameter(rdPtr, param, TYPE_STRING); + break; + } + + Parameters[i] = CNC_GetNextExpressionParameter(rdPtr, param, TYPE_STRING); + break; + + case EXPPARAM_LONG: + + int Type = ((::SDK->ExpressionFloatFlags[ID] & (1 << i)) != 0) ? TYPE_FLOAT : TYPE_LONG; + + if(!i) + { + Parameters[i] = CNC_GetFirstExpressionParameter(rdPtr, param, Type); + break; + } + + Parameters[i] = CNC_GetNextExpressionParameter(rdPtr, param, Type); + break; + } + } + } + + void * Extension = rdPtr->pExtension; + + int Result; + int ExpressionType = ::SDK->ExpressionTypes[ID]; + + __asm + { + pushad + + mov ecx, ParameterCount + + cmp ecx, 0 + je CallNow + + mov edx, Parameters + + mov ebx, ecx + shl ebx, 2 + + add edx, ebx + sub edx, 4 + + PushLoop: + + push [edx] + sub edx, 4 + + dec ecx + + cmp ecx, 0 + jne PushLoop + + CallNow: + + mov ecx, Extension + call Function + + mov ecx, ExpressionType; + + cmp ecx, 1 + jne NotFloat + + fstp Result + jmp End + + NotFloat: + + mov Result, eax + + End: + + popad + } + + switch(ExpressionType) + { + case 1: // Float + { + rdPtr->rHo.hoFlags |= HOF_FLOAT; + break; + } + + case 2: // String + { + rdPtr->rHo.hoFlags |= HOF_STRING; + break; + } + }; + + return Result; +} + +int Edif::GetDependency (char *& Buffer, size_t &Size, const TCHAR * FileExtension, int Resource) +{ + TCHAR Filename [MAX_PATH]; + GetSiblingPath (Filename, FileExtension); + + Buffer = NULL; + if (*Filename) + { + FILE * File = NULL; + int error = _tfopen_s(&File, Filename, _T("rb")); + + if (!File) + return DependencyNotFound; + + fseek (File, 0, SEEK_END); + Size = ftell (File); + fseek (File, 0, SEEK_SET); + + Buffer = (char *) malloc (Size + 1); + Buffer [Size] = 0; + + fread (Buffer, 1, Size, File); + + fclose (File); + + return DependencyWasFile; + } + + if (!Resource) + return DependencyNotFound; + + HRSRC res = FindResource (hInstLib, MAKEINTRESOURCE (Resource), _T("EDIF")); + + if (!res) + return DependencyNotFound; + + Size = SizeofResource (hInstLib, res); + Buffer = (char *) LockResource (LoadResource (hInstLib, res)); + + return DependencyWasResource; +} + +static void GetSiblingPath (TCHAR * Buffer, const TCHAR * FileExtension) +{ + TCHAR temp [MAX_PATH]; + + GetModuleFileName (hInstLib, temp, sizeof(temp)/sizeof(TCHAR)); + + TCHAR * Filename = temp + _tcslen(temp) - 1; + + while(*Filename != '.') + -- Filename; + + _tcscpy(++ Filename, FileExtension); + + Filename = Filename + _tcslen(Filename) - 1; + + while(*Filename != '\\' && *Filename != '/') + -- Filename; + + ++ Filename; + + // Is the file in the directory of the MFX? (if so, use this pathname) + TCHAR FullFilename [MAX_PATH]; + _tcscpy(FullFilename, temp); + if(GetFileAttributes(FullFilename) == 0xFFFFFFFF) + { + // No => editor + TCHAR ExecutablePath [MAX_PATH]; + GetModuleFileName (GetModuleHandle (0), ExecutablePath, sizeof(ExecutablePath)/sizeof(TCHAR)); + + { TCHAR * Iterator = ExecutablePath + _tcslen(ExecutablePath) - 1; + + while(*Iterator != '\\' && *Iterator != '/') + -- Iterator; + + *Iterator = 0; + } + + // Same path as the executable? + _stprintf_s(FullFilename, sizeof(ExecutablePath)/sizeof(TCHAR), _T("%s/%s"), ExecutablePath, Filename); + if(GetFileAttributes(FullFilename) == 0xFFFFFFFF) + { + // No => try Data/Runtime + _stprintf_s(FullFilename, sizeof(ExecutablePath)/sizeof(TCHAR), _T("%s/Data/Runtime/%s"), ExecutablePath, Filename); + if(GetFileAttributes(FullFilename) == 0xFFFFFFFF) + { + // No => try .. (maybe we're in the Unicode or HWA folder) + _stprintf_s(FullFilename, sizeof(ExecutablePath)/sizeof(TCHAR), _T("%s/../%s"), ExecutablePath, Filename); + if(GetFileAttributes(FullFilename) == 0xFFFFFFFF) + { + *Buffer = 0; + return; + } + } + } + } + + _tcscpy(Buffer, FullFilename); +} + +void Edif::GetSiblingPath (TCHAR * Buffer, const TCHAR * FileExtension) +{ + TCHAR * Extension = (TCHAR *) + alloca ((_tcslen (FileExtension) + _tcslen (LanguageCode) + 2) * sizeof(TCHAR)); + + _tcscpy (Extension, LanguageCode); + _tcscat (Extension, _T (".")); + _tcscat (Extension, FileExtension); + + ::GetSiblingPath (Buffer, Extension); + + if (*Buffer) + return; + + ::GetSiblingPath (Buffer, FileExtension); +} + +#ifdef _UNICODE +WCHAR* Edif::ConvertString(const char* utf8String) +{ + size_t Length = MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, 0, 0); + if ( Length == 0 ) + Length = 1; + WCHAR* tstr = (WCHAR*)calloc(Length, sizeof(WCHAR)); + MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, tstr, Length); + return tstr; +} + +WCHAR* Edif::ConvertAndCopyString(WCHAR* tstr, const char* utf8String, int maxLength) +{ + MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, tstr, maxLength); + return tstr; +} +#else +char* Edif::ConvertString(const char* utf8String) +{ + // Convert string to Unicode + size_t Length = MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, 0, 0); + if ( Length == 0 ) + Length = 1; + WCHAR* wstr = (WCHAR*)calloc(Length, sizeof(WCHAR)); + MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, wstr, Length); + + // Convert Unicode string using current user code page + int len2 = WideCharToMultiByte(CP_ACP, 0, wstr, -1, 0, 0, NULL, NULL); + if ( len2 == 0 ) + len2 = 1; + char* str = (char*)calloc(len2, sizeof(char)); + WideCharToMultiByte(CP_ACP, 0, wstr, -1, str, len2, NULL, NULL); + free(wstr); + + return str; +} + +char* Edif::ConvertAndCopyString(char* str, const char* utf8String, int maxLength) +{ + // MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, tstr, maxLength); + + // Convert string to Unicode + size_t Length = MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, 0, 0); + if ( Length == 0 ) + Length = 1; + WCHAR* wstr = (WCHAR*)calloc(Length, sizeof(WCHAR)); + MultiByteToWideChar(CP_UTF8, 0, utf8String, -1, wstr, Length); + + // Convert Unicode string using current user code page + WideCharToMultiByte(CP_ACP, 0, wstr, -1, str, maxLength, NULL, NULL); + free(wstr); + + return str; +} +#endif // _UNICODE From 96562ce763b33719c267f1362a49d6bad1a8a8cb Mon Sep 17 00:00:00 2001 From: LB Date: Tue, 23 Oct 2012 20:22:52 -0500 Subject: [PATCH 011/127] Fixed char/TCHAR inconsistency --- Extensions/Template/Extension.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extensions/Template/Extension.hpp b/Extensions/Template/Extension.hpp index 46be460..2d83ed9 100644 --- a/Extensions/Template/Extension.hpp +++ b/Extensions/Template/Extension.hpp @@ -114,7 +114,7 @@ class Extension //Expressions - Defined in Expressions.cpp int Add(int FirstNumber, int SecondNumber); - const char * HelloWorld(); + const TCHAR * HelloWorld(); short Handle(); //defined & documented in Extension.cpp From f8de7158870dc71eadeeafddb9c59d5ddadfa90b Mon Sep 17 00:00:00 2001 From: LB Date: Tue, 23 Oct 2012 20:32:23 -0500 Subject: [PATCH 012/127] Fix urf8String typo, reduce spacing in RD --- Inc/Edif.h | 544 ++++++++++++++++++++++++++--------------------------- 1 file changed, 272 insertions(+), 272 deletions(-) diff --git a/Inc/Edif.h b/Inc/Edif.h index ce80f5a..e43313e 100644 --- a/Inc/Edif.h +++ b/Inc/Edif.h @@ -1,272 +1,272 @@ -#pragma once - -#include "json.h" - -#include "ccxhdr.h" -#include "CfcFile.h" -#include "ImageFlt.h" -#include "ImgFlt.h" -#include "Surface.h" -#include "Cncf.h" -#include "Patch.h" - -#include -#include -#include -using namespace std; - -class Extension; - -#include "ObjectSelection.h" - -#if defined(MMFEXT) -#define IS_COMPATIBLE(v) (v->mvGetVersion != NULL && (v->mvGetVersion() & MMFBUILD_MASK) >= Extension::MinimumBuild && (v->mvGetVersion() & MMFVERSION_MASK) >= MMFVERSION_20 && ((v->mvGetVersion() & MMFVERFLAG_MASK) & MMFVERFLAG_HOME) == 0) -#elif defined(PROEXT) -#define IS_COMPATIBLE(v) (v->mvGetVersion != NULL && (v->mvGetVersion() & MMFBUILD_MASK) >= Extension::MinimumBuild && (v->mvGetVersion() & MMFVERSION_MASK) >= MMFVERSION_20 && ((v->mvGetVersion() & MMFVERFLAG_MASK) & MMFVERFLAG_PRO) != 0) -#else -#define IS_COMPATIBLE(v) (v->mvGetVersion != NULL && (v->mvGetVersion() & MMFBUILD_MASK) >= Extension::MinimumBuild && (v->mvGetVersion() & MMFVERSION_MASK) >= MMFVERSION_20) -#endif - -#define LinkAction(ID, Function) \ - SDK->ActionFunctions[ID] = Edif::MemberFunctionPointer(&Extension::Function); - -#define LinkCondition(ID, Function) \ - SDK->ConditionFunctions[ID] = Edif::MemberFunctionPointer(&Extension::Function); - -#define LinkExpression(ID, Function) \ - SDK->ExpressionFunctions[ID] = Edif::MemberFunctionPointer(&Extension::Function); - -extern HINSTANCE hInstLib; - -struct RD; typedef RD RUNDATA; typedef RUNDATA * LPRDATA; -struct SerializedED; typedef SerializedED EDITDATA; typedef EDITDATA * LPEDATA; - -LPEVENTINFOS2 GetEventInformations(LPEVENTINFOS2 eiPtr, short code); - -namespace Edif -{ - - class SDK - { - public: - - json_value &json; - - SDK (mv * mV, json_value &); - ~SDK (); - - vector ActionInfos; - vector ConditionInfos; - vector ExpressionInfos; - - void ** ActionJumps; - void ** ConditionJumps; - void ** ExpressionJumps; - - vector ActionFunctions; - vector ConditionFunctions; - vector ExpressionFunctions; - - vector ExpressionTypes; - - vector ActionFloatFlags; - vector ConditionFloatFlags; - vector ExpressionFloatFlags; - - unsigned char * FunctionMemory; - - mv* mV; - cSurface * Icon; - }; - - class Runtime - { - protected: - - LPRDATA rdPtr; - - public: - - long param1, param2; - - Runtime(LPRDATA _rdPtr); - ~Runtime(); - - void Rehandle(); - - void GenerateEvent(int EventID); - void PushEvent(int EventID); - - void * Allocate(size_t); - TCHAR * CopyString(const TCHAR *); - - void Pause(); - void Resume(); - - void Redisplay(); - void Redraw(); - LPRO LPROFromFixed(int fixedValue); - int FixedFromLPRO(LPRO object); - - void SetAngleOfObject(LPRO object, float acAngle); - - void SetPosition(int X, int Y); - CallTables* GetCallTables(); - void CallMovement(int ID, long Parameter); - - void Destroy(); - - void GetApplicationDrive(TCHAR * Buffer); - void GetApplicationDirectory(TCHAR * Buffer); - void GetApplicationPath(TCHAR * Buffer); - void GetApplicationName(TCHAR * Buffer); - void GetApplicationTempPath(TCHAR * Buffer); - - void ExecuteProgram(prgParam * Program); - - long EditInteger(EditDebugInfo *); - long EditText(EditDebugInfo *); - - bool IsHWA(); - bool IsUnicode(); - - event &CurrentEvent(); - - Riggs::ObjectSelection ObjectSelection; - - void WriteGlobal(const TCHAR * Name, void * Value); - void * ReadGlobal(const TCHAR * Name); - - #ifdef EdifUseJS - - JSContext * GetJSContext(); - - #endif - - }; - - extern bool ExternalJSON; - - void GetSiblingPath (TCHAR * Buffer, const TCHAR * Extension); - - const int DependencyNotFound = 0; - const int DependencyWasFile = 1; - const int DependencyWasResource = 2; - - int GetDependency (char *& Buffer, size_t &Size, const TCHAR * FileExtension, int Resource); - - TCHAR* ConvertString(const char* urf8String); - TCHAR* ConvertAndCopyString(TCHAR* tstr, const char* urf8String, int maxLength); - inline void FreeString(TCHAR* s) - { - free(s); - } - - extern TCHAR LanguageCode[3]; - extern bool IsEdittime; - - extern HMENU ActionMenu, ConditionMenu, ExpressionMenu; - - HMENU LoadMenuJSON (int BaseID, const json_value &Source, HMENU Parent = 0); - - int Init(mv _far * mV); - void Init(mv _far * mV, LPEDATA edPtr); - - void Free(mv _far * mV); - void Free(LPEDATA edPtr); - - long __stdcall Condition (LPRDATA rdPtr, long param1, long param2); - short __stdcall Action (LPRDATA rdPtr, long param1, long param2); - long __stdcall Expression (LPRDATA rdPtr, long param); - - inline int ActionID(int ID) - { - return 25000 + ID; - } - - inline int ConditionID(int ID) - { - return 26000 + ID; - } - - inline int ExpressionID(int ID) - { - return 27000 + ID; - } - - template inline void * MemberFunctionPointer(T Function) - { - T _Function = Function; - return *(void **) &_Function; - } -} - -extern Edif::SDK * SDK; - - -class Extension; - -/* RD - * This is the extension runtime data. - * Because all your runtime data is - * stored in your Extension class, this - * class is global to all extensions and - * should not be changed. Some functions - * will give you a pointer to this class, - * and from it you can get a pointer to - * your extension class' instance. - */ -struct RD -{ - headerObject rHo; //Main header - - char r //Placeholder for the optional structures - [ - sizeof(rCom)+ - sizeof(rMvt)+ - sizeof(rSpr)+ - sizeof(rVal) - ]; - //Pointers to the optional structures, null values mean that that OEFLAG was not specified. - rCom *rc; // Common structure for movements & animations - rMvt *rm; // Movements (OEFLAG_MOVEMENTS) - rSpr *rs; // Sprite (displayable objects) (OEFLAG_SPRITES) - rVal *rv; // Alterable values (OEFLAG_VALUES) - - Extension * pExtension; -}; - -/* SerializedED - * This is the editdata. The class - * name is a reminder - any data in - * here is fully serialized, ready - * to be written to a file on disk, - * such as the MFA or EXE file. It - * will also be this way when you - * get access to it in other runtimes. - * You should not change this class - * as the change will affect all other - * extensions as well. Instead, open - * EditData.hpp and read about how to - * implement the editdata there. - */ -struct SerializedED -{ - /* Header - * This required data member contains - * information about your extension for - * MMF2, such as the version number - * from Extension::Version. - */ - extHeader Header; - - /* data - * This is used as a pointer to - * the start of the serialized - * data. See the EditData class - * for more information. - */ - char data[1]; -}; - -#define MMF2Func WINAPI DLLExport +#pragma once + +#include "json.h" + +#include "ccxhdr.h" +#include "CfcFile.h" +#include "ImageFlt.h" +#include "ImgFlt.h" +#include "Surface.h" +#include "Cncf.h" +#include "Patch.h" + +#include +#include +#include +using namespace std; + +class Extension; + +#include "ObjectSelection.h" + +#if defined(MMFEXT) +#define IS_COMPATIBLE(v) (v->mvGetVersion != NULL && (v->mvGetVersion() & MMFBUILD_MASK) >= Extension::MinimumBuild && (v->mvGetVersion() & MMFVERSION_MASK) >= MMFVERSION_20 && ((v->mvGetVersion() & MMFVERFLAG_MASK) & MMFVERFLAG_HOME) == 0) +#elif defined(PROEXT) +#define IS_COMPATIBLE(v) (v->mvGetVersion != NULL && (v->mvGetVersion() & MMFBUILD_MASK) >= Extension::MinimumBuild && (v->mvGetVersion() & MMFVERSION_MASK) >= MMFVERSION_20 && ((v->mvGetVersion() & MMFVERFLAG_MASK) & MMFVERFLAG_PRO) != 0) +#else +#define IS_COMPATIBLE(v) (v->mvGetVersion != NULL && (v->mvGetVersion() & MMFBUILD_MASK) >= Extension::MinimumBuild && (v->mvGetVersion() & MMFVERSION_MASK) >= MMFVERSION_20) +#endif + +#define LinkAction(ID, Function) \ + SDK->ActionFunctions[ID] = Edif::MemberFunctionPointer(&Extension::Function); + +#define LinkCondition(ID, Function) \ + SDK->ConditionFunctions[ID] = Edif::MemberFunctionPointer(&Extension::Function); + +#define LinkExpression(ID, Function) \ + SDK->ExpressionFunctions[ID] = Edif::MemberFunctionPointer(&Extension::Function); + +extern HINSTANCE hInstLib; + +struct RD; typedef RD RUNDATA; typedef RUNDATA * LPRDATA; +struct SerializedED; typedef SerializedED EDITDATA; typedef EDITDATA * LPEDATA; + +LPEVENTINFOS2 GetEventInformations(LPEVENTINFOS2 eiPtr, short code); + +namespace Edif +{ + + class SDK + { + public: + + json_value &json; + + SDK (mv * mV, json_value &); + ~SDK (); + + vector ActionInfos; + vector ConditionInfos; + vector ExpressionInfos; + + void ** ActionJumps; + void ** ConditionJumps; + void ** ExpressionJumps; + + vector ActionFunctions; + vector ConditionFunctions; + vector ExpressionFunctions; + + vector ExpressionTypes; + + vector ActionFloatFlags; + vector ConditionFloatFlags; + vector ExpressionFloatFlags; + + unsigned char * FunctionMemory; + + mv* mV; + cSurface * Icon; + }; + + class Runtime + { + protected: + + LPRDATA rdPtr; + + public: + + long param1, param2; + + Runtime(LPRDATA _rdPtr); + ~Runtime(); + + void Rehandle(); + + void GenerateEvent(int EventID); + void PushEvent(int EventID); + + void * Allocate(size_t); + TCHAR * CopyString(const TCHAR *); + + void Pause(); + void Resume(); + + void Redisplay(); + void Redraw(); + LPRO LPROFromFixed(int fixedValue); + int FixedFromLPRO(LPRO object); + + void SetAngleOfObject(LPRO object, float acAngle); + + void SetPosition(int X, int Y); + CallTables* GetCallTables(); + void CallMovement(int ID, long Parameter); + + void Destroy(); + + void GetApplicationDrive(TCHAR * Buffer); + void GetApplicationDirectory(TCHAR * Buffer); + void GetApplicationPath(TCHAR * Buffer); + void GetApplicationName(TCHAR * Buffer); + void GetApplicationTempPath(TCHAR * Buffer); + + void ExecuteProgram(prgParam * Program); + + long EditInteger(EditDebugInfo *); + long EditText(EditDebugInfo *); + + bool IsHWA(); + bool IsUnicode(); + + event &CurrentEvent(); + + Riggs::ObjectSelection ObjectSelection; + + void WriteGlobal(const TCHAR * Name, void * Value); + void * ReadGlobal(const TCHAR * Name); + + #ifdef EdifUseJS + + JSContext * GetJSContext(); + + #endif + + }; + + extern bool ExternalJSON; + + void GetSiblingPath (TCHAR * Buffer, const TCHAR * Extension); + + const int DependencyNotFound = 0; + const int DependencyWasFile = 1; + const int DependencyWasResource = 2; + + int GetDependency (char *& Buffer, size_t &Size, const TCHAR * FileExtension, int Resource); + + TCHAR* ConvertString(const char* utf8String); + TCHAR* ConvertAndCopyString(TCHAR* tstr, const char* utf8String, int maxLength); + inline void FreeString(TCHAR* s) + { + free(s); + } + + extern TCHAR LanguageCode[3]; + extern bool IsEdittime; + + extern HMENU ActionMenu, ConditionMenu, ExpressionMenu; + + HMENU LoadMenuJSON (int BaseID, const json_value &Source, HMENU Parent = 0); + + int Init(mv _far * mV); + void Init(mv _far * mV, LPEDATA edPtr); + + void Free(mv _far * mV); + void Free(LPEDATA edPtr); + + long __stdcall Condition (LPRDATA rdPtr, long param1, long param2); + short __stdcall Action (LPRDATA rdPtr, long param1, long param2); + long __stdcall Expression (LPRDATA rdPtr, long param); + + inline int ActionID(int ID) + { + return 25000 + ID; + } + + inline int ConditionID(int ID) + { + return 26000 + ID; + } + + inline int ExpressionID(int ID) + { + return 27000 + ID; + } + + template inline void * MemberFunctionPointer(T Function) + { + T _Function = Function; + return *(void **) &_Function; + } +} + +extern Edif::SDK * SDK; + + +class Extension; + +/* RD + * This is the extension runtime data. + * Because all your runtime data is + * stored in your Extension class, this + * class is global to all extensions and + * should not be changed. Some functions + * will give you a pointer to this class, + * and from it you can get a pointer to + * your extension class' instance. + */ +struct RD +{ + headerObject rHo; //Main header + + char r //Placeholder for the optional structures + [ + sizeof(rCom)+ + sizeof(rMvt)+ + sizeof(rSpr)+ + sizeof(rVal) + ]; + //Pointers to the optional structures, null values mean that that OEFLAG was not specified. + rCom *rc; // Common structure for movements & animations + rMvt *rm; // Movements (OEFLAG_MOVEMENTS) + rSpr *rs; // Sprite (displayable objects) (OEFLAG_SPRITES) + rVal *rv; // Alterable values (OEFLAG_VALUES) + + Extension * pExtension; +}; + +/* SerializedED + * This is the editdata. The class + * name is a reminder - any data in + * here is fully serialized, ready + * to be written to a file on disk, + * such as the MFA or EXE file. It + * will also be this way when you + * get access to it in other runtimes. + * You should not change this class + * as the change will affect all other + * extensions as well. Instead, open + * EditData.hpp and read about how to + * implement the editdata there. + */ +struct SerializedED +{ + /* Header + * This required data member contains + * information about your extension for + * MMF2, such as the version number + * from Extension::Version. + */ + extHeader Header; + + /* data + * This is used as a pointer to + * the start of the serialized + * data. See the EditData class + * for more information. + */ + char data[1]; +}; + +#define MMF2Func WINAPI DLLExport From 5c0d3631676f496a7b9ffb39dab8bf1588e351e5 Mon Sep 17 00:00:00 2001 From: LB Date: Wed, 24 Oct 2012 01:04:55 -0500 Subject: [PATCH 013/127] Show MessageBox when MFX is still "Template.mfx" I did this one without access to any compiler - will have to check if it works later. --- Lib/Edif.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 11f5d83..92f8442 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -53,10 +53,22 @@ short ReadExpressionParameterType(const char * Text) } void Edif::Init(mv * _far mV, LPEDATA edPtr) -{ +{ IsEdittime = mV->mvHMainWin != 0; mvInvalidateObject(mV, edPtr); + + TCHAR MFXPath[_MAX_PATH]; + GetModuleFileName(hInstLib, MFXPath, _MAX_PATH); + TCHAR MFXName[_MAX_FNAME]; + _tsplitpath(MFXPath, 0, 0, MFXName, 0); + if(_tcscmp(MFXName, _T("Template")) == 0) + { + MessageBox(0, _T("You forgot to change the MFX filename" + "in the project settings!\nChange the" + "output path in the linker options for" + "each build configuration."), _T("EDIF extension named Template.mfx"), MB_OK); + } } void Edif::Free(mv * _far mV) From d8dcdb62efb72c1fff46bf4b2e7fe89c34408087 Mon Sep 17 00:00:00 2001 From: LB Date: Wed, 24 Oct 2012 01:14:16 -0500 Subject: [PATCH 014/127] Fix spacing in message --- Lib/Edif.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 92f8442..acb2025 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -65,9 +65,9 @@ void Edif::Init(mv * _far mV, LPEDATA edPtr) if(_tcscmp(MFXName, _T("Template")) == 0) { MessageBox(0, _T("You forgot to change the MFX filename" - "in the project settings!\nChange the" - "output path in the linker options for" - "each build configuration."), _T("EDIF extension named Template.mfx"), MB_OK); + " in the project settings!\nChange the" + " output path in the linker options for" + " each build configuration."), _T("EDIF extension named Template.mfx"), MB_OK); } } From 49b32be83e9a7b96feb425f41385d94a16e62df5 Mon Sep 17 00:00:00 2001 From: LB Date: Wed, 24 Oct 2012 01:15:25 -0500 Subject: [PATCH 015/127] GitHib being a spazz --- .gitignore | 326 +-- Extensions/AutoInstall.bat | 88 +- Extensions/Template/CustomParams.cpp | 216 +- Extensions/Template/Debugger.cpp | 282 +-- Extensions/Template/Edittime.cpp | 594 ++--- Extensions/Template/Ext.def | 236 +- Extensions/Template/Ext.json | 142 +- Extensions/Template/Ext.rc | 312 +-- Extensions/Template/General.cpp | 330 +-- Extensions/Template/Properties.cpp | 584 ++--- Extensions/Template/Runtime.cpp | 364 +-- Extensions/Template/Text.cpp | 126 +- Extensions/Template/TextProps.cpp | 232 +- Extensions/Template/resource.h | 36 +- Inc/CfcFile.h | 586 ++--- Inc/Cncy.h | 3266 +++++++++++++------------- Inc/Cnpdll.h | 2288 +++++++++--------- Inc/ImageFlt.h | 412 ++-- Inc/ObjectSelection.h | 286 +-- Inc/Props.h | 2190 ++++++++--------- Inc/Surface.h | 1394 +++++------ Inc/json.h | 384 +-- Lib/Edif.Edittime.cpp | 702 +++--- Lib/Edif.General.cpp | 406 ++-- Lib/Edif.Runtime.cpp | 554 ++--- Lib/ObjectSelection.cpp | 298 +-- Lib/json.c | 1484 ++++++------ 27 files changed, 9059 insertions(+), 9059 deletions(-) diff --git a/.gitignore b/.gitignore index d2fcacd..5ebd21a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,163 +1,163 @@ -################# -## Eclipse -################# - -*.pydevproject -.project -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.classpath -.settings/ -.loadpath - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# PDT-specific -.buildpath - - -################# -## Visual Studio -################# - -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.sln.docstates - -# Build results -[Dd]ebug/ -[Rr]elease/ -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.vspscc -.builds -*.dotCover - -## TODO: If you have NuGet Package Restore enabled, uncomment this -#packages/ - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf - -# Visual Studio profiler -*.psess -*.vsp - -# ReSharper is a .NET coding add-in -_ReSharper* - -# Installshield output folder -[Ee]xpress - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish - -# Others -[Bb]in -[Oo]bj -sql -TestResults -*.Cache -ClientBin -stylecop.* -~$* -*.dbmdl -Generated_Code #added for RIA/Silverlight projects - -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML - - - -############ -## Windows -############ - -# Windows image file caches -Thumbs.db - -# Folder config file -Desktop.ini - - -############# -## Python -############# - -*.py[co] - -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox - -#Translations -*.mo - -#Mr Developer -.mr.developer.cfg - -# Mac crap -.DS_Store +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Rr]elease/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.vspscc +.builds +*.dotCover + +## TODO: If you have NuGet Package Restore enabled, uncomment this +#packages/ + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp + +# ReSharper is a .NET coding add-in +_ReSharper* + +# Installshield output folder +[Ee]xpress + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish + +# Others +[Bb]in +[Oo]bj +sql +TestResults +*.Cache +ClientBin +stylecop.* +~$* +*.dbmdl +Generated_Code #added for RIA/Silverlight projects + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML + + + +############ +## Windows +############ + +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg + +# Mac crap +.DS_Store diff --git a/Extensions/AutoInstall.bat b/Extensions/AutoInstall.bat index 9bffb35..2f57cc3 100644 --- a/Extensions/AutoInstall.bat +++ b/Extensions/AutoInstall.bat @@ -1,44 +1,44 @@ -echo MFX File: %1 -echo MFX Destination: %2 - -:mfd -set status=ERROR -for /F "tokens=*" %%A in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Clickteam\Multimedia Fusion Developer 2\Settings" /v "ProPath"') do set status=%%A -set status=%status:~0,5% -if %status%==ERROR goto nmfd - -for /F "tokens=3* delims= " %%A in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Clickteam\Multimedia Fusion Developer 2\Settings" /v "ProPath" ^| find "REG_SZ"') do set mmfpath=%%A %%B - -echo MMF2 Dev Path: %mmfpath% - -copy /y "%1" "%mmfpath%%2" - -set mmfpath= -set status= - -goto mfs - -:nmfd -echo You don't have MMF2 Developer :( - -:mfs -set status=ERROR -for /F "tokens=1 delims=:" %%A in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Clickteam\Multimedia Fusion 2\Settings" /v "StdPath"') do set status=%%A -set status=%status:~0,5% -if %status%==ERROR goto nmfs - -for /F "tokens=3* delims= " %%A in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Clickteam\Multimedia Fusion 2\Settings" /v "StdPath" ^| find "REG_SZ"') do set mmfpath=%%A %%B - -echo MMF2 Std Path: %mmfpath% - -copy /y "%1" "%mmfpath%%2" - -set mmfpath= -set status= - -goto end - -:nmfs -echo You don't have MMF2 Standard - -:end +echo MFX File: %1 +echo MFX Destination: %2 + +:mfd +set status=ERROR +for /F "tokens=*" %%A in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Clickteam\Multimedia Fusion Developer 2\Settings" /v "ProPath"') do set status=%%A +set status=%status:~0,5% +if %status%==ERROR goto nmfd + +for /F "tokens=3* delims= " %%A in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Clickteam\Multimedia Fusion Developer 2\Settings" /v "ProPath" ^| find "REG_SZ"') do set mmfpath=%%A %%B + +echo MMF2 Dev Path: %mmfpath% + +copy /y "%1" "%mmfpath%%2" + +set mmfpath= +set status= + +goto mfs + +:nmfd +echo You don't have MMF2 Developer :( + +:mfs +set status=ERROR +for /F "tokens=1 delims=:" %%A in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Clickteam\Multimedia Fusion 2\Settings" /v "StdPath"') do set status=%%A +set status=%status:~0,5% +if %status%==ERROR goto nmfs + +for /F "tokens=3* delims= " %%A in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Clickteam\Multimedia Fusion 2\Settings" /v "StdPath" ^| find "REG_SZ"') do set mmfpath=%%A %%B + +echo MMF2 Std Path: %mmfpath% + +copy /y "%1" "%mmfpath%%2" + +set mmfpath= +set status= + +goto end + +:nmfs +echo You don't have MMF2 Standard + +:end diff --git a/Extensions/Template/CustomParams.cpp b/Extensions/Template/CustomParams.cpp index 238bc0a..c32bad6 100644 --- a/Extensions/Template/CustomParams.cpp +++ b/Extensions/Template/CustomParams.cpp @@ -1,108 +1,108 @@ -/* CustomParams.cpp - * Just as with all the other SDKs, EDIF - * supports the creation and use of custom, - * you-defined parameters. Your own dialog, - * your own display string, your own sense - * of control. Read the MMF2SDK Help file - * for more information. To use custom - * parameters with EDIF, the parameter type - * must be "Custom" or "Custom#" where # is - * the number of the custom parameter. - * Functions defined here: - * InitParameter - * EditParameter - * GetParameterString - */ - -#include "Common.h" - -/* InitParameter - * Like with the editdata, this data will - * be written as-is to disk and later read - * back. The most you can store is defined - * by PARAM_EXTMAXSIZE, which currently is - * 512 bytes. Use them wisely! - */ -void MMF2Func InitParameter(mv *mV, short ID, paramExt *ParamData) -{ -#ifndef RUN_ONLY - //store data in ParamData->pextData - //store the size of the data in ParamData->pextSize -#endif -} - -// Example of custom parameter setup proc -// -------------------------------------- -/* -#ifndef RUN_ONLY -BOOL CALLBACK SetupProc(HWND hDlg, UINT msgType, WPARAM wParam, LPARAM lParam) -{ - paramExt* pExt; - - switch (msgType) - { - case WM_INITDIALOG: // Init dialog - - // Save edptr - SetWindowLong(hDlg, DWL_USER, lParam); - pExt=(paramExt*)lParam; - - SetDlgItemText(hDlg, IDC_EDIT, pExt->pextData); - return TRUE; - - case WM_COMMAND: // Command - - // Retrieve edptr - pExt = (paramExt *)GetWindowLong(hDlg, DWL_USER); - - switch (wmCommandID) - { - case IDOK: // Exit - GetDlgItemText(hDlg, IDC_EDIT, pExt->pextData, 500); - pExt->pextSize=sizeof(paramExt)+strlen(pExt->pextData)+1; - EndDialog(hDlg, TRUE); - return TRUE; - - default: - break; - } - break; - - default: - break; - } - return FALSE; -} -#endif -*/ - -/* EditParameter - * This is where you actually bring up - * the dialog and take input from - * the user and store it. - */ -void MMF2Func EditParameter(mv _far *mV, short code, paramExt* pExt) -{ -#ifndef RUN_ONLY - // Example - // ------- - // DialogBoxParam(hInstLib, MAKEINTRESOURCE(DB_TRYPARAM), mV->mvHEditWin, SetupProc, (LPARAM)(LPBYTE)pExt); -#endif -} - -/* GetParameterString - * This is where you give MMF2 the display - * string for your custom parameter. Remember, - * this is the display for ONE PARAMETER. It - * will appear amongst all the other parameter - * displays depending on the A/C's display - * string. - */ -void MMF2Func GetParameterString(mv _far *mV, short code, paramExt* pExt, LPSTR pDest, short size) -{ -#ifndef RUN_ONLY - // Example - // ------- - // wsprintf(pDest, "Super parameter %s", pExt->pextData); -#endif -} +/* CustomParams.cpp + * Just as with all the other SDKs, EDIF + * supports the creation and use of custom, + * you-defined parameters. Your own dialog, + * your own display string, your own sense + * of control. Read the MMF2SDK Help file + * for more information. To use custom + * parameters with EDIF, the parameter type + * must be "Custom" or "Custom#" where # is + * the number of the custom parameter. + * Functions defined here: + * InitParameter + * EditParameter + * GetParameterString + */ + +#include "Common.h" + +/* InitParameter + * Like with the editdata, this data will + * be written as-is to disk and later read + * back. The most you can store is defined + * by PARAM_EXTMAXSIZE, which currently is + * 512 bytes. Use them wisely! + */ +void MMF2Func InitParameter(mv *mV, short ID, paramExt *ParamData) +{ +#ifndef RUN_ONLY + //store data in ParamData->pextData + //store the size of the data in ParamData->pextSize +#endif +} + +// Example of custom parameter setup proc +// -------------------------------------- +/* +#ifndef RUN_ONLY +BOOL CALLBACK SetupProc(HWND hDlg, UINT msgType, WPARAM wParam, LPARAM lParam) +{ + paramExt* pExt; + + switch (msgType) + { + case WM_INITDIALOG: // Init dialog + + // Save edptr + SetWindowLong(hDlg, DWL_USER, lParam); + pExt=(paramExt*)lParam; + + SetDlgItemText(hDlg, IDC_EDIT, pExt->pextData); + return TRUE; + + case WM_COMMAND: // Command + + // Retrieve edptr + pExt = (paramExt *)GetWindowLong(hDlg, DWL_USER); + + switch (wmCommandID) + { + case IDOK: // Exit + GetDlgItemText(hDlg, IDC_EDIT, pExt->pextData, 500); + pExt->pextSize=sizeof(paramExt)+strlen(pExt->pextData)+1; + EndDialog(hDlg, TRUE); + return TRUE; + + default: + break; + } + break; + + default: + break; + } + return FALSE; +} +#endif +*/ + +/* EditParameter + * This is where you actually bring up + * the dialog and take input from + * the user and store it. + */ +void MMF2Func EditParameter(mv _far *mV, short code, paramExt* pExt) +{ +#ifndef RUN_ONLY + // Example + // ------- + // DialogBoxParam(hInstLib, MAKEINTRESOURCE(DB_TRYPARAM), mV->mvHEditWin, SetupProc, (LPARAM)(LPBYTE)pExt); +#endif +} + +/* GetParameterString + * This is where you give MMF2 the display + * string for your custom parameter. Remember, + * this is the display for ONE PARAMETER. It + * will appear amongst all the other parameter + * displays depending on the A/C's display + * string. + */ +void MMF2Func GetParameterString(mv _far *mV, short code, paramExt* pExt, LPSTR pDest, short size) +{ +#ifndef RUN_ONLY + // Example + // ------- + // wsprintf(pDest, "Super parameter %s", pExt->pextData); +#endif +} diff --git a/Extensions/Template/Debugger.cpp b/Extensions/Template/Debugger.cpp index f3f943b..53b6cbd 100644 --- a/Extensions/Template/Debugger.cpp +++ b/Extensions/Template/Debugger.cpp @@ -1,141 +1,141 @@ -/* Debugger.cpp - * Here you will be able to interact - * with the MMF2 debugger (that thing - * in the top left when you run your - * MFA from MMF2). You can add your own - * fields of your choice to your object's - * debugger tree. - * Functions defined here: - * GetDebugTree - * GetDebugItem - * EditDebugItem - */ - -#include "Common.h" - -#ifndef RUN_ONLY //The debugger is only available when running from MMF2, which uses the Edittime MFX - -/* DB - * This is the namespace the debugger identifiers - * are stored in. It keeps them out of the global - * namespace and it helps with intellisense. - */ -namespace DB -{ - /* - * The debugger identitifers. - */ - enum - { -// MyString, -// MyInt, - }; -} - -/* DebugTree - * The list of items to be displayed - * in the debugger tree. - */ -WORD DebugTree[] = -{ -// DB::MyString|DB_EDITABLE, -// DB::MyInt|DB_EDITABLE, -// DB::SomethingThatIDontWantTheUserToBeAbleToEditAtRuntime, - DB_END -}; - -#endif - -/* GetDerbugTree - * Plain and simple, just return the debug - * tree pointer from above. If you really - * want to you can create the debug tree - * dynamically and return that, but you'll - * need to store the pointer in your extension - * class every time so that you can release - * the memory in your extension class' destructor. - */ -LPWORD MMF2Func GetDebugTree(RD *rd) -{ -#ifndef RUN_ONLY - return DebugTree; -#endif - return NULL; -} - -/* GetDebugItem - * With respect to DB_BUFFERSIZE, give - * MMF2 the string to display in the - * debugger. You must include both the - * name and the value in the string, - * or any format you want. - */ -void MMF2Func GetDebugItem(LPSTR Buffer, RD *rd, int ID) -{ -#ifndef RUN_ONLY -// char temp[DB_BUFFERSIZE]; -// switch (ID) -// { -// case DB::MyString: -// { -// LoadString(hInstLib, IDS_CURRENTSTRING, temp, DB_BUFFERSIZE); -// wsprintf(pBuffer, temp, rdPtr->text); -// break; -// } -// case DB::MyInt: -// { -// LoadString(hInstLib, IDS_CURRENTVALUE, temp, DB_BUFFERSIZE); -// wsprintf(pBuffer, temp, rdPtr->value); -// break; -// } -// } -#endif -} - -/* EditDebugItem - * When the user chooses to edit an - * editable debug item, this function - * is called. You can use the RFUNCTIONs - * provided by MMF2 to do simple text and - * number edits, or you can do whatever you - * want, such as creating a dialog that lets - * the user enter more sophisticated input to - * the debug item, or simply display more info. - */ -void MMF2Func EditDebugItem(RD *rd, int ID) -{ -#ifndef RUN_ONLY -/* - switch(ID) - { - case DB::MyString: - { - EditDebugInfo dbi; - char buffer[256]; - - dbi.pText=buffer; - dbi.lText=TEXT_MAX; - dbi.pTitle=NULL; - - strcpy(buffer, rdPtr->text); - long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITTEXT, 0, (LPARAM)&dbi); - if (ret) - strcpy(rdPtr->text, dbi.pText); - } - break; - case DB::MyInt: - { - EditDebugInfo dbi; - - dbi.value=rdPtr->value; - dbi.pTitle=NULL; - - long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITINT, 0, (LPARAM)&dbi); - if (ret) - rdPtr->value=dbi.value; - } - break; - } -*/ -#endif -} +/* Debugger.cpp + * Here you will be able to interact + * with the MMF2 debugger (that thing + * in the top left when you run your + * MFA from MMF2). You can add your own + * fields of your choice to your object's + * debugger tree. + * Functions defined here: + * GetDebugTree + * GetDebugItem + * EditDebugItem + */ + +#include "Common.h" + +#ifndef RUN_ONLY //The debugger is only available when running from MMF2, which uses the Edittime MFX + +/* DB + * This is the namespace the debugger identifiers + * are stored in. It keeps them out of the global + * namespace and it helps with intellisense. + */ +namespace DB +{ + /* + * The debugger identitifers. + */ + enum + { +// MyString, +// MyInt, + }; +} + +/* DebugTree + * The list of items to be displayed + * in the debugger tree. + */ +WORD DebugTree[] = +{ +// DB::MyString|DB_EDITABLE, +// DB::MyInt|DB_EDITABLE, +// DB::SomethingThatIDontWantTheUserToBeAbleToEditAtRuntime, + DB_END +}; + +#endif + +/* GetDerbugTree + * Plain and simple, just return the debug + * tree pointer from above. If you really + * want to you can create the debug tree + * dynamically and return that, but you'll + * need to store the pointer in your extension + * class every time so that you can release + * the memory in your extension class' destructor. + */ +LPWORD MMF2Func GetDebugTree(RD *rd) +{ +#ifndef RUN_ONLY + return DebugTree; +#endif + return NULL; +} + +/* GetDebugItem + * With respect to DB_BUFFERSIZE, give + * MMF2 the string to display in the + * debugger. You must include both the + * name and the value in the string, + * or any format you want. + */ +void MMF2Func GetDebugItem(LPSTR Buffer, RD *rd, int ID) +{ +#ifndef RUN_ONLY +// char temp[DB_BUFFERSIZE]; +// switch (ID) +// { +// case DB::MyString: +// { +// LoadString(hInstLib, IDS_CURRENTSTRING, temp, DB_BUFFERSIZE); +// wsprintf(pBuffer, temp, rdPtr->text); +// break; +// } +// case DB::MyInt: +// { +// LoadString(hInstLib, IDS_CURRENTVALUE, temp, DB_BUFFERSIZE); +// wsprintf(pBuffer, temp, rdPtr->value); +// break; +// } +// } +#endif +} + +/* EditDebugItem + * When the user chooses to edit an + * editable debug item, this function + * is called. You can use the RFUNCTIONs + * provided by MMF2 to do simple text and + * number edits, or you can do whatever you + * want, such as creating a dialog that lets + * the user enter more sophisticated input to + * the debug item, or simply display more info. + */ +void MMF2Func EditDebugItem(RD *rd, int ID) +{ +#ifndef RUN_ONLY +/* + switch(ID) + { + case DB::MyString: + { + EditDebugInfo dbi; + char buffer[256]; + + dbi.pText=buffer; + dbi.lText=TEXT_MAX; + dbi.pTitle=NULL; + + strcpy(buffer, rdPtr->text); + long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITTEXT, 0, (LPARAM)&dbi); + if (ret) + strcpy(rdPtr->text, dbi.pText); + } + break; + case DB::MyInt: + { + EditDebugInfo dbi; + + dbi.value=rdPtr->value; + dbi.pTitle=NULL; + + long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITINT, 0, (LPARAM)&dbi); + if (ret) + rdPtr->value=dbi.value; + } + break; + } +*/ +#endif +} diff --git a/Extensions/Template/Edittime.cpp b/Extensions/Template/Edittime.cpp index 295492c..fd39b6a 100644 --- a/Extensions/Template/Edittime.cpp +++ b/Extensions/Template/Edittime.cpp @@ -1,297 +1,297 @@ -/* Edittime.cpp - * This file contains functions for the - * New Object dialog and the Frame Editor. - * For properties, see Properties.cpp. For - * custom parameters, see CustomParams.cpp. - * For text properties, see TextProps.cpp. - * Functions defined here: - * MakeIconEx - * UsesFile - * CreateFromFile - * CreateObject - * EditObject - * SetEditSize - * PutObject - * RemoveObject - * CloneObject - * GetObjectRect - * EditorDisplay - * IsTransparent - * PrepareToWriteObject - * GetFilters - */ - -#include "Common.h" - -/* CreateObject - * This is the first time you have - * access to the editdata, so it - * needs to be initialized with - * default values. Just be aware - * that if the user chooses to - * create your object from a file, - * CreateFromFile will be called - * instead of this function. - */ -int MMF2Func CreateObject(mv *mV, LO *lo, SerializedED *SED) -{ -#ifndef RUN_ONLY - if(IS_COMPATIBLE(mV)) //Make sure MMF2 hasn't changed in a way that makes your extension incompatible - { - Edif::Init(mV, SED); - - EditData().Serialize(mV, SED); //create & store the default editdata - - return 0; - } -#endif - return -1; -} - -/* MakeIconEx - * Lets you draw the icon dynamically - * by drawing into the Icon surface. The - * current example just uses the - * Icon.png from the resources. - */ -int MMF2Func MakeIconEx(mv *mV, cSurface *Icon, LPTSTR Name, OI *oi, SerializedED *SED) -{ -#ifndef RUN_ONLY - Icon->Delete(); - Icon->Clone(*SDK->Icon); - Icon->SetTransparentColor(RGB(255, 0, 255)); - return 0; -#endif - return -1; -} - -/* UsesFile - * When the user chooses "Create From - * File", MMF2 asks each extension if - * it supports being created from that - * file. Here you should investigate - * the file and see if your extension - * can be created from it in the - * CreateFromFile function below. You - * can simply check the file extension, - * for example. - */ -BOOL MMF2Func UsesFile(mv *mV, LPTSTR FileName) -{ -#ifndef RUN_ONLY - if(IS_COMPATIBLE(mV)) //check for compatibility, since you can't return an error from CreateFromFile - { -// char ext[_MAX_EXT]; -// _tsplitpath(FileName, 0, 0, 0, ext); -// if(stdtstring(".iherebydeclarethatthisfilecontainsmyintmystringandmyarray") == ext) -// { -// return TRUE; -// } - } -#endif - return FALSE; -} - -/* CreateFromFile - * If the user decides to create your object - * from the file you said you were OK with - * above, this is where you take that file - * and actually create your object from it. - * The CreateObject function up above will - * not have executed, so you need to initialize - * the editdata just as you would in CreateObject. - */ -void MMF2Func CreateFromFile(mv *mV, LPTSTR FileName, SerializedED *SED) -{ -#ifndef RUN_ONLY - Edif::Init(mV, SED); - - EditData ed; //default EditData -// std::ifstream in (FileName); -// EditData::MyArray_t::size_type MyArray_size; -// in >> ed.MyString >> ed.MyInt >> MyArray_size; -// ed.MyArray.clear(); -// for(EditData::MyArray_t::size_type i = 0; i < MyArray_size; ++i) -// { -// ed.MyArray.push_back(0); -// in >> ed.MyArray.back(); -// } - ed.Serialize(mV, SED); -#endif -} - -/* PutObject - * Each time a duplicate is made of your - * object, MMF2 calls this function to - * let you know. You still share the same - * editdata, the difference is the - * LevelObject pointer and the number of - * duplicates. - */ -void MMF2Func PutObject(mv *mV, LO *lo, SerializedED *SED, ushort NDup) -{ -#ifndef RUN_ONLY - if(NDup == 1) //is this the first object being created? - { - //You can put common code to both - //CreateObject and CreateFromFile - //as this function will execute - //after either one. - } -#endif -} - -/* RemoveObject - * Just the opposite of the above, when - * the user removes an instance of your - * object. This also functions as a - * DestroyObject function of sorts when - * NDup == 1. - */ -void MMF2Func RemoveObject(mv *mV, LO *lo, SerializedED *SED, ushort NDup) -{ -#ifndef RUN_ONLY - if(NDup == 1) //is this the last object being removed? - { - Edif::Free(SED); - // - } -#endif -} - -/* CloneObject - * When the user makes a clone of your object - * (not just another instance), MMF2 copies the - * contents of the editdata and then lets you - * know that the editdata in question is in - * new hands. Here you can 'fix' anything that - * might be caused by directly copying the - * editdata, though you should never have - * any problems like that in the first place. - */ -void MMF2Func CloneObject(mv *mV, OI *oi, SerializedED *SED) -{ -#ifndef RUN_ONLY - // -#endif -} - -/* EditObject - * If the user double-clicks your object icon - * or chooses the Edit option from a context - * menu, this function is called. This is useful - * as a que to bring up an animation editor for - * animations in your object. Return TRUE if - * changes were made to the editdata, and FALSE - * otherwise. - */ -BOOL MMF2Func EditObject (mv *mV, OI *oi, LO *lo, SerializedED *SED) -{ -#ifndef RUN_ONLY - // -#endif - return FALSE; -} - -/* SetEditSize - * If your object is resizeable, MMF2 calls this - * to let you know that the user has just requested - * a resize of the object. You can take the new - * size as is, or if it reminds you too much of - * 500 page essays you can limit the size to whatever - * you want. If you uncomment this function, make - * sure you also uncomment it in Ext.def. The - * presence of this function tells MMF2 that your - * object can be resized; otherwise it can't. - */ -/*BOOL MMF2Func SetEditSize(mv *mV, SerializedED *SED, int x, int y) -{ -#ifndef RUN_ONLY - EditData ed (SED); - ed.Width = x; - ed.Height = y; - ed.Serialize(mV, SED); - return TRUE; -#endif - return FALSE; -}*/ - -/* GetObjectRect - * MMF2 wants to know from time to time how much - * space your object is taking up on the frame - * editor. Currently this just gives the size of - * your Icon.png, but you can change it to parallel - * with the SetEditSize function above. - */ -void MMF2Func GetObjectRect(mv *mV, RECT *rect, LO *lo, SerializedED *SED) -{ -#ifndef RUN_ONLY - rect->right = rect->left + SDK->Icon->GetWidth(); - rect->bottom = rect->top + SDK->Icon->GetHeight(); -#endif -} - - -/* EditorDisplay - * This function does the work of drawing your - * object on the frame editor. In this example, - * the Icon.png file is simply drawn to the - * frame, but you can change this to draw - * anything you want. - */ -void MMF2Func EditorDisplay(mv *mV, OI *oi, LO *lo, SerializedED *SED, RECT *rect) -{ -#ifndef RUN_ONLY - cSurface *Surface = WinGetSurface(int(mV->mvIdEditWin)); //get access to the frame editor surface - if(!Surface) return; //failure - SDK->Icon->Blit(*Surface, rect->left, rect->top, BMODE_TRANSP, BOP_COPY, 0); //copy the icon onto the frame editor surface -#endif -} - - -/* IsTransparent - * MMF2 calls this to ask if the mouse pointer - * is over a transparent part of your object. - * Don't ask why this isn't called "IsOpaque", - * just accept that it isn't and move on. If the - * given coordinates are over an opaque part of - * your object, return TRUE, otherwise return - * FALSE. (Protip: MMF2 calls this function a - * LOT. Don't put a MessageBox function in here - * or any other kind of debug function.) - */ -extern "C" BOOL MMF2Func IsTransparent(mv *mV, LO *lo, SerializedED *SED, int x, int y) -{ -#ifndef RUN_ONLY - // -#endif - return FALSE; -} - -/* PrepareToWriteObject (DEPRECATED) - * Just before MMF2 writes the editdata to the MFA, - * it calls this function to let you clean up - * a temporary copy of the editdata. Because you - * intelligently designed your EditData::Serialize - * function to always save cleaned data anyway, - * this function is useless. - */ -void MMF2Func PrepareToWriteObject(mv *, SerializedED *, OI *){} - -/* GetFilters - * When the MFA filters are set to Automatic, MMF2 - * asks your extension if it uses filters or not. - * If you use any of either kind of filters, return - * TRUE for that kind. - */ -BOOL MMF2Func GetFilters(mv *mV, SerializedED *SED, DWORD Flags, void *) -{ -#ifndef RUN_ONLY - //If your extension uses image filters -// if((dwFlags & GETFILTERS_IMAGES) != 0) return TRUE; - - //If your extension uses sound filters -// if((dwFlags & GETFILTERS_SOUNDS) != 0) return TRUE; -#endif - return FALSE; -} +/* Edittime.cpp + * This file contains functions for the + * New Object dialog and the Frame Editor. + * For properties, see Properties.cpp. For + * custom parameters, see CustomParams.cpp. + * For text properties, see TextProps.cpp. + * Functions defined here: + * MakeIconEx + * UsesFile + * CreateFromFile + * CreateObject + * EditObject + * SetEditSize + * PutObject + * RemoveObject + * CloneObject + * GetObjectRect + * EditorDisplay + * IsTransparent + * PrepareToWriteObject + * GetFilters + */ + +#include "Common.h" + +/* CreateObject + * This is the first time you have + * access to the editdata, so it + * needs to be initialized with + * default values. Just be aware + * that if the user chooses to + * create your object from a file, + * CreateFromFile will be called + * instead of this function. + */ +int MMF2Func CreateObject(mv *mV, LO *lo, SerializedED *SED) +{ +#ifndef RUN_ONLY + if(IS_COMPATIBLE(mV)) //Make sure MMF2 hasn't changed in a way that makes your extension incompatible + { + Edif::Init(mV, SED); + + EditData().Serialize(mV, SED); //create & store the default editdata + + return 0; + } +#endif + return -1; +} + +/* MakeIconEx + * Lets you draw the icon dynamically + * by drawing into the Icon surface. The + * current example just uses the + * Icon.png from the resources. + */ +int MMF2Func MakeIconEx(mv *mV, cSurface *Icon, LPTSTR Name, OI *oi, SerializedED *SED) +{ +#ifndef RUN_ONLY + Icon->Delete(); + Icon->Clone(*SDK->Icon); + Icon->SetTransparentColor(RGB(255, 0, 255)); + return 0; +#endif + return -1; +} + +/* UsesFile + * When the user chooses "Create From + * File", MMF2 asks each extension if + * it supports being created from that + * file. Here you should investigate + * the file and see if your extension + * can be created from it in the + * CreateFromFile function below. You + * can simply check the file extension, + * for example. + */ +BOOL MMF2Func UsesFile(mv *mV, LPTSTR FileName) +{ +#ifndef RUN_ONLY + if(IS_COMPATIBLE(mV)) //check for compatibility, since you can't return an error from CreateFromFile + { +// char ext[_MAX_EXT]; +// _tsplitpath(FileName, 0, 0, 0, ext); +// if(stdtstring(".iherebydeclarethatthisfilecontainsmyintmystringandmyarray") == ext) +// { +// return TRUE; +// } + } +#endif + return FALSE; +} + +/* CreateFromFile + * If the user decides to create your object + * from the file you said you were OK with + * above, this is where you take that file + * and actually create your object from it. + * The CreateObject function up above will + * not have executed, so you need to initialize + * the editdata just as you would in CreateObject. + */ +void MMF2Func CreateFromFile(mv *mV, LPTSTR FileName, SerializedED *SED) +{ +#ifndef RUN_ONLY + Edif::Init(mV, SED); + + EditData ed; //default EditData +// std::ifstream in (FileName); +// EditData::MyArray_t::size_type MyArray_size; +// in >> ed.MyString >> ed.MyInt >> MyArray_size; +// ed.MyArray.clear(); +// for(EditData::MyArray_t::size_type i = 0; i < MyArray_size; ++i) +// { +// ed.MyArray.push_back(0); +// in >> ed.MyArray.back(); +// } + ed.Serialize(mV, SED); +#endif +} + +/* PutObject + * Each time a duplicate is made of your + * object, MMF2 calls this function to + * let you know. You still share the same + * editdata, the difference is the + * LevelObject pointer and the number of + * duplicates. + */ +void MMF2Func PutObject(mv *mV, LO *lo, SerializedED *SED, ushort NDup) +{ +#ifndef RUN_ONLY + if(NDup == 1) //is this the first object being created? + { + //You can put common code to both + //CreateObject and CreateFromFile + //as this function will execute + //after either one. + } +#endif +} + +/* RemoveObject + * Just the opposite of the above, when + * the user removes an instance of your + * object. This also functions as a + * DestroyObject function of sorts when + * NDup == 1. + */ +void MMF2Func RemoveObject(mv *mV, LO *lo, SerializedED *SED, ushort NDup) +{ +#ifndef RUN_ONLY + if(NDup == 1) //is this the last object being removed? + { + Edif::Free(SED); + // + } +#endif +} + +/* CloneObject + * When the user makes a clone of your object + * (not just another instance), MMF2 copies the + * contents of the editdata and then lets you + * know that the editdata in question is in + * new hands. Here you can 'fix' anything that + * might be caused by directly copying the + * editdata, though you should never have + * any problems like that in the first place. + */ +void MMF2Func CloneObject(mv *mV, OI *oi, SerializedED *SED) +{ +#ifndef RUN_ONLY + // +#endif +} + +/* EditObject + * If the user double-clicks your object icon + * or chooses the Edit option from a context + * menu, this function is called. This is useful + * as a que to bring up an animation editor for + * animations in your object. Return TRUE if + * changes were made to the editdata, and FALSE + * otherwise. + */ +BOOL MMF2Func EditObject (mv *mV, OI *oi, LO *lo, SerializedED *SED) +{ +#ifndef RUN_ONLY + // +#endif + return FALSE; +} + +/* SetEditSize + * If your object is resizeable, MMF2 calls this + * to let you know that the user has just requested + * a resize of the object. You can take the new + * size as is, or if it reminds you too much of + * 500 page essays you can limit the size to whatever + * you want. If you uncomment this function, make + * sure you also uncomment it in Ext.def. The + * presence of this function tells MMF2 that your + * object can be resized; otherwise it can't. + */ +/*BOOL MMF2Func SetEditSize(mv *mV, SerializedED *SED, int x, int y) +{ +#ifndef RUN_ONLY + EditData ed (SED); + ed.Width = x; + ed.Height = y; + ed.Serialize(mV, SED); + return TRUE; +#endif + return FALSE; +}*/ + +/* GetObjectRect + * MMF2 wants to know from time to time how much + * space your object is taking up on the frame + * editor. Currently this just gives the size of + * your Icon.png, but you can change it to parallel + * with the SetEditSize function above. + */ +void MMF2Func GetObjectRect(mv *mV, RECT *rect, LO *lo, SerializedED *SED) +{ +#ifndef RUN_ONLY + rect->right = rect->left + SDK->Icon->GetWidth(); + rect->bottom = rect->top + SDK->Icon->GetHeight(); +#endif +} + + +/* EditorDisplay + * This function does the work of drawing your + * object on the frame editor. In this example, + * the Icon.png file is simply drawn to the + * frame, but you can change this to draw + * anything you want. + */ +void MMF2Func EditorDisplay(mv *mV, OI *oi, LO *lo, SerializedED *SED, RECT *rect) +{ +#ifndef RUN_ONLY + cSurface *Surface = WinGetSurface(int(mV->mvIdEditWin)); //get access to the frame editor surface + if(!Surface) return; //failure + SDK->Icon->Blit(*Surface, rect->left, rect->top, BMODE_TRANSP, BOP_COPY, 0); //copy the icon onto the frame editor surface +#endif +} + + +/* IsTransparent + * MMF2 calls this to ask if the mouse pointer + * is over a transparent part of your object. + * Don't ask why this isn't called "IsOpaque", + * just accept that it isn't and move on. If the + * given coordinates are over an opaque part of + * your object, return TRUE, otherwise return + * FALSE. (Protip: MMF2 calls this function a + * LOT. Don't put a MessageBox function in here + * or any other kind of debug function.) + */ +extern "C" BOOL MMF2Func IsTransparent(mv *mV, LO *lo, SerializedED *SED, int x, int y) +{ +#ifndef RUN_ONLY + // +#endif + return FALSE; +} + +/* PrepareToWriteObject (DEPRECATED) + * Just before MMF2 writes the editdata to the MFA, + * it calls this function to let you clean up + * a temporary copy of the editdata. Because you + * intelligently designed your EditData::Serialize + * function to always save cleaned data anyway, + * this function is useless. + */ +void MMF2Func PrepareToWriteObject(mv *, SerializedED *, OI *){} + +/* GetFilters + * When the MFA filters are set to Automatic, MMF2 + * asks your extension if it uses filters or not. + * If you use any of either kind of filters, return + * TRUE for that kind. + */ +BOOL MMF2Func GetFilters(mv *mV, SerializedED *SED, DWORD Flags, void *) +{ +#ifndef RUN_ONLY + //If your extension uses image filters +// if((dwFlags & GETFILTERS_IMAGES) != 0) return TRUE; + + //If your extension uses sound filters +// if((dwFlags & GETFILTERS_SOUNDS) != 0) return TRUE; +#endif + return FALSE; +} diff --git a/Extensions/Template/Ext.def b/Extensions/Template/Ext.def index b6615f8..7849232 100644 --- a/Extensions/Template/Ext.def +++ b/Extensions/Template/Ext.def @@ -1,118 +1,118 @@ -; Ext.def -; This is how the linker knows -; which functions to export and -; what names and ordinals the -; exported functions should -; have. If you implemented a -; function that was commented -; out, remove the semicolon comment -; before it in this file. -; - -EXPORTS - GetInfos @2 - LoadObject @6 - UnloadObject @7 - PutObject @8 - RemoveObject @9 - MakeIconEx @11 - - CreateObject @14 - GetHelpFileName @16 - EditObject @18 - GetObjectRect @19 - EditorDisplay @20 - IsTransparent @21 - PrepareToWriteObject @22 - UpdateFileNames @23 -; EnumElts @24 - Initialize=InitExtension @25 - Free=FreeExtension @26 -; ExportTexts @27 -; ImportTexts @28 -; GetSubType @29 - UsesFile @30 - CreateFromFile @31 - DuplicateObject=CloneObject @32 - GetObjInfos @36 - - GetTextCaps @37 - GetTextAlignment @38 - SetTextAlignment @39 - GetTextFont @40 - SetTextFont @41 - GetTextClr @42 - SetTextClr @43 - - GetDependencies @44 - GetFilters @45 - -; conditionsTable @47 -; actionsTable @48 -; expressionsTable @49 - - CreateRunObject @50 - DestroyRunObject @51 - HandleRunObject @52 - DisplayRunObject @53 - PauseRunObject @57 - ContinueRunObject @58 - GetRunObjectInfos @59 - - GetConditionMenu @60 - GetActionMenu @61 - GetExpressionMenu @62 - GetConditionCodeFromMenu @63 - GetActionCodeFromMenu @64 - GetExpressionCodeFromMenu @65 - GetConditionString @66 - GetActionString @67 - GetExpressionString @68 - InitParameter @69 - EditParameter @70 - GetParameterString @71 - GetConditionTitle @72 - GetActionTitle @73 - GetExpressionTitle @74 - GetConditionInfos @75 - GetActionInfos @76 - GetExpressionInfos @77 - UpdateEditStructure @78 - GetRunObjectDataSize @80 -; SaveBackground @81 -; RestoreBackground @82 -; KillBackground @83 -; WindowProc @84 - StartApp @85 - EndApp @86 - StartFrame @87 - EndFrame @88 - GetExpressionParam @89 - -; GetRunObjectSurface @90 -; GetRunObjectCollisionMask @91 - -; GetRunObjectFont @92 -; SetRunObjectFont @93 -; GetRunObjectTextColor @94 -; SetRunObjectTextColor @95 - -; SetEditSize @99 - GetProperties @100 - ReleaseProperties @101 - GetPropValue @102 - SetPropValue @103 - IsPropEnabled @104 - GetPropCheck @105 - SetPropCheck @106 - GetPropCreateParam @107 - ReleasePropCreateParam @108 - EditProp @109 - GetDebugTree @110 - GetDebugItem @111 - EditDebugItem @112 - - SaveRunObject @113 - LoadRunObject @114 - - PrepareFlexBuild @115 +; Ext.def +; This is how the linker knows +; which functions to export and +; what names and ordinals the +; exported functions should +; have. If you implemented a +; function that was commented +; out, remove the semicolon comment +; before it in this file. +; + +EXPORTS + GetInfos @2 + LoadObject @6 + UnloadObject @7 + PutObject @8 + RemoveObject @9 + MakeIconEx @11 + + CreateObject @14 + GetHelpFileName @16 + EditObject @18 + GetObjectRect @19 + EditorDisplay @20 + IsTransparent @21 + PrepareToWriteObject @22 + UpdateFileNames @23 +; EnumElts @24 + Initialize=InitExtension @25 + Free=FreeExtension @26 +; ExportTexts @27 +; ImportTexts @28 +; GetSubType @29 + UsesFile @30 + CreateFromFile @31 + DuplicateObject=CloneObject @32 + GetObjInfos @36 + + GetTextCaps @37 + GetTextAlignment @38 + SetTextAlignment @39 + GetTextFont @40 + SetTextFont @41 + GetTextClr @42 + SetTextClr @43 + + GetDependencies @44 + GetFilters @45 + +; conditionsTable @47 +; actionsTable @48 +; expressionsTable @49 + + CreateRunObject @50 + DestroyRunObject @51 + HandleRunObject @52 + DisplayRunObject @53 + PauseRunObject @57 + ContinueRunObject @58 + GetRunObjectInfos @59 + + GetConditionMenu @60 + GetActionMenu @61 + GetExpressionMenu @62 + GetConditionCodeFromMenu @63 + GetActionCodeFromMenu @64 + GetExpressionCodeFromMenu @65 + GetConditionString @66 + GetActionString @67 + GetExpressionString @68 + InitParameter @69 + EditParameter @70 + GetParameterString @71 + GetConditionTitle @72 + GetActionTitle @73 + GetExpressionTitle @74 + GetConditionInfos @75 + GetActionInfos @76 + GetExpressionInfos @77 + UpdateEditStructure @78 + GetRunObjectDataSize @80 +; SaveBackground @81 +; RestoreBackground @82 +; KillBackground @83 +; WindowProc @84 + StartApp @85 + EndApp @86 + StartFrame @87 + EndFrame @88 + GetExpressionParam @89 + +; GetRunObjectSurface @90 +; GetRunObjectCollisionMask @91 + +; GetRunObjectFont @92 +; SetRunObjectFont @93 +; GetRunObjectTextColor @94 +; SetRunObjectTextColor @95 + +; SetEditSize @99 + GetProperties @100 + ReleaseProperties @101 + GetPropValue @102 + SetPropValue @103 + IsPropEnabled @104 + GetPropCheck @105 + SetPropCheck @106 + GetPropCreateParam @107 + ReleasePropCreateParam @108 + EditProp @109 + GetDebugTree @110 + GetDebugItem @111 + EditDebugItem @112 + + SaveRunObject @113 + LoadRunObject @114 + + PrepareFlexBuild @115 diff --git a/Extensions/Template/Ext.json b/Extensions/Template/Ext.json index 2e28227..4756556 100644 --- a/Extensions/Template/Ext.json +++ b/Extensions/Template/Ext.json @@ -1,72 +1,72 @@ -{ - "About": - { - "Name": "EDIF Template Object", - "Author": "Your Name", - "Copyright": "Copyright © 2012 Your Name", - "Comment": "A sentence or two to describe your extension,\nwith up to four lines of text.", - "URL": "http://www.example.com/", - "Help": "Help/My New EDIF Extension/Help.chm", - "Identifier": "X&pl" - }, - - "ActionMenu": - [ - "Separator", - [0, "Action Example"], - "Separator", - ["Sub Menu", - [1, "Second Action Example"] - ], - "Separator" - ], - "ConditionMenu": - [ - "Separator", - [0, "Are two numbers equal?"] - ], - "ExpressionMenu": - [ - "Separator", - [0, "Add two numbers"], - [1, "Hello world"], - "Separator" - ], - - "Actions": - [ - { "Title": "Action Example with parameter %0", - "Parameters": - [ - ["Integer", "Example Parameter"] - ] - }, - { "Title": "Second Action Example" - } - ], - "Conditions": - [ - { "Title": "%o: Are %0 and %1 equal?", - "Parameters": - [ - ["Integer", "First number"], - ["Integer", "Second number"] - ], - "Triggered": false - } - ], - "Expressions": - [ - { "Title": "Add(", - "Returns": "Integer", - "Parameters": - [ - ["Integer", "First number"], - ["Integer", "Second number"] - ] - }, - { "Title": "HelloWorld$(", - "Returns": "Text" - } - ] +{ + "About": + { + "Name": "EDIF Template Object", + "Author": "Your Name", + "Copyright": "Copyright © 2012 Your Name", + "Comment": "A sentence or two to describe your extension,\nwith up to four lines of text.", + "URL": "http://www.example.com/", + "Help": "Help/My New EDIF Extension/Help.chm", + "Identifier": "X&pl" + }, + + "ActionMenu": + [ + "Separator", + [0, "Action Example"], + "Separator", + ["Sub Menu", + [1, "Second Action Example"] + ], + "Separator" + ], + "ConditionMenu": + [ + "Separator", + [0, "Are two numbers equal?"] + ], + "ExpressionMenu": + [ + "Separator", + [0, "Add two numbers"], + [1, "Hello world"], + "Separator" + ], + + "Actions": + [ + { "Title": "Action Example with parameter %0", + "Parameters": + [ + ["Integer", "Example Parameter"] + ] + }, + { "Title": "Second Action Example" + } + ], + "Conditions": + [ + { "Title": "%o: Are %0 and %1 equal?", + "Parameters": + [ + ["Integer", "First number"], + ["Integer", "Second number"] + ], + "Triggered": false + } + ], + "Expressions": + [ + { "Title": "Add(", + "Returns": "Integer", + "Parameters": + [ + ["Integer", "First number"], + ["Integer", "Second number"] + ] + }, + { "Title": "HelloWorld$(", + "Returns": "Text" + } + ] } \ No newline at end of file diff --git a/Extensions/Template/Ext.rc b/Extensions/Template/Ext.rc index 8dd4b8f..5d6f17e 100644 --- a/Extensions/Template/Ext.rc +++ b/Extensions/Template/Ext.rc @@ -1,156 +1,156 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "..\..\Inc\ccx.h" -#define APSTUDIO_HIDDEN_SYMBOLS -#include "windows.h" -#undef APSTUDIO_HIDDEN_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -1 VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x0L -#ifdef _DEBUG - FILEFLAGS 0x21L -#else - FILEFLAGS 0x20L -#endif - FILEOS 0x10001L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "Clickteam" - VALUE "FileDescription", "Edif Object" - VALUE "FileVersion", "2.00" - VALUE "InternalName", "EdifExt" - VALUE "LegalCopyright", "Copyright © 2012 Clickteam" - VALUE "OriginalFilename", "EdifExt.mfx" - VALUE "ProductVersion", "1, 0, 0, 1" - VALUE "SpecialBuild", "00000001" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// RCDATA -// - -KPX_MAGICNUMBER RCDATA -BEGIN - 0x2516, 0x5908 -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""..\\..\\Inc\\ccx.h""\r\n" - "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""windows.h""\r\n" - "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - KPX_MARK "MF2" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.K.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// EDIF -// - -#if defined(APSTUDIO_INVOKED) || defined(EDITOR) -#if defined(APSTUDIO_INVOKED) -IDR_EDIF_ICON$(EDITOR) EDIF "Icon.png" -#else -IDR_EDIF_ICON EDIF "Icon.png" -#endif -#endif -IDR_EDIF_JSON EDIF "Ext.json" -#endif // English (U.K.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "..\..\Inc\ccx.h" +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +1 VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x0L +#ifdef _DEBUG + FILEFLAGS 0x21L +#else + FILEFLAGS 0x20L +#endif + FILEOS 0x10001L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "Clickteam" + VALUE "FileDescription", "Edif Object" + VALUE "FileVersion", "2.00" + VALUE "InternalName", "EdifExt" + VALUE "LegalCopyright", "Copyright © 2012 Clickteam" + VALUE "OriginalFilename", "EdifExt.mfx" + VALUE "ProductVersion", "1, 0, 0, 1" + VALUE "SpecialBuild", "00000001" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// RCDATA +// + +KPX_MAGICNUMBER RCDATA +BEGIN + 0x2516, 0x5908 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""..\\..\\Inc\\ccx.h""\r\n" + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + KPX_MARK "MF2" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.K.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// EDIF +// + +#if defined(APSTUDIO_INVOKED) || defined(EDITOR) +#if defined(APSTUDIO_INVOKED) +IDR_EDIF_ICON$(EDITOR) EDIF "Icon.png" +#else +IDR_EDIF_ICON EDIF "Icon.png" +#endif +#endif +IDR_EDIF_JSON EDIF "Ext.json" +#endif // English (U.K.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Extensions/Template/General.cpp b/Extensions/Template/General.cpp index 19ab147..23e405e 100644 --- a/Extensions/Template/General.cpp +++ b/Extensions/Template/General.cpp @@ -1,165 +1,165 @@ -/* General.cpp - * Contains functions common to both edittime and runtime. - * Functions defined here: - * DllMain - * InitExtension - * FreeExtension - * LoadObject - * UnloadObject - * UpdateEditStrucrure - * UpdateFileNames - * EnumElts - */ - -#include "Common.h" - -/* hInstLib - * This is the HINSTANCE for your extension's DLL. - * It is set by DllMain and used later for anything - * that requires it, such as some Windows API - * functions and some internal EDIF code. You - * shouldn't change its value, ever. - */ -HINSTANCE hInstLib; - -/* DllMain - * This is a required function for Windows DLLs. You - * should not need to edit this function - if you do, - * refer to MSDN for information. - */ -BOOL WINAPI DllMain(HINSTANCE DLL, DWORD Reason, LPVOID) -{ - switch (Reason) - { - case DLL_PROCESS_ATTACH: //DLL is attaching to the address space of the current process. - { - hInstLib = DLL; //Store HINSTANCE - break; - } - case DLL_THREAD_ATTACH: //A new thread is being created in the current process. - { - // - break; - } - case DLL_THREAD_DETACH: //A thread is exiting cleanly. - { - // - break; - } - case DLL_PROCESS_DETACH: //The calling process is detaching the DLL from its address space. - { - // - break; - } - } - return TRUE; -} - - - -/* InitExtension - * MMF2 calls this before anything else when it loads your - * extension. This includes during the splash screen, in which - * case "Quiet" is true. This is where you should initialize - * global information for either edittime or runtime. Be aware, - * though, that at edittime, multiple open MFAs with your - * extension will share the same global information. You can - * use mV->mvEditApp to tell apart different MFAs from each - * other. If an error occurs during this function, return - * -1 and MMF2 will not load your extension. - */ -int MMF2Func InitExtension(mv *mV, int Quiet) -{ - return Edif::Init(mV); -} - -/* FreeExtension - * Called just before MMF2 unloads your extension. You - * should release any memory you allocated above in - * the InitializeExtension function. You should always - * return a value of 0. - */ -int MMF2Func FreeExtension(mv *mV) -{ - // - Edif::Free(mV); - return 0; -} - - -/* LoadObject - * This is called at both edittime and runtime when MMF2 - * loads each unique instance of your object. (Each one - * with a different name, not each instance of the same - * one). Not much needs to be done here. - */ -int MMF2Func LoadObject(mv *mV, LPCSTR FileName, SerializedED *SED, int) -{ - Edif::Init(mV, SED); - return 0; -} - -/* UnloadObject - * new is to delete as LoadObject is to this functon. - * If you initialized stuff above, deinitialize it here. - */ -void MMF2Func UnloadObject(mv *mV, SerializedED *SED, int) -{ - // -} - -/* UpdateEditStructure (DEPRECATED) - * This is called when MMF2 notices that your - * extension has a newer version number than - * the one in the header of the SerializedED. - * Thankfully, however, we don't need this - * function at all - the EditData class is - * as smart as you programmed it to be and - * it changes the size dynamically rather - * than statically. So, you can safely - * ignore this function all together. - * (It would be a pain to write anyway - - * see the MMF2SDK help for an example) - */ -HGLOBAL MMF2Func UpdateEditStructure(mv *mV, SerializedED *OldSED) -{ - return 0; -} - -/* UpdateFileNames - * When the application is moved to a new directory, - * MMF2 asks your extension to ensure that its file - * paths are moving with it. Just call Update for - * each file path - you will need to create buffers - * of size MAX_PATH if you use C++ strings for - * the paths. - */ -void MMF2Func UpdateFileNames(mv *mV, LPSTR appName, SerializedED *SED, void (WINAPI *Update)(LPSTR, LPSTR)) -{ - // -} - -/* EnumElts - * That whacky function that MMF2 uses to enumerate all the - * animation frames associated with your object, because MMF2 - * is nice enough to deal with them for you so you can't-er, - * don't have to. Refer to the MMF2SDK Help file for - * information on how not to misuse this function. - * You must also uncomment the entry in the Ext.def - * file if you uncomment this function. - */ -/*int MMF2Func EnumElts (mv *mV, SerializedED *SED, ENUMELTPROC enumProc, ENUMELTPROC undoProc, LPARAM lp1, LPARAM lp2) -{ - int error = 0; - - //Replace wImgIdx with the name of the WORD variable you create within the edit structure - - //Enum images - if((error = enumProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2)) != 0) - { - //Undo enum images - undoProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2); - } - - return error; -}*/ +/* General.cpp + * Contains functions common to both edittime and runtime. + * Functions defined here: + * DllMain + * InitExtension + * FreeExtension + * LoadObject + * UnloadObject + * UpdateEditStrucrure + * UpdateFileNames + * EnumElts + */ + +#include "Common.h" + +/* hInstLib + * This is the HINSTANCE for your extension's DLL. + * It is set by DllMain and used later for anything + * that requires it, such as some Windows API + * functions and some internal EDIF code. You + * shouldn't change its value, ever. + */ +HINSTANCE hInstLib; + +/* DllMain + * This is a required function for Windows DLLs. You + * should not need to edit this function - if you do, + * refer to MSDN for information. + */ +BOOL WINAPI DllMain(HINSTANCE DLL, DWORD Reason, LPVOID) +{ + switch (Reason) + { + case DLL_PROCESS_ATTACH: //DLL is attaching to the address space of the current process. + { + hInstLib = DLL; //Store HINSTANCE + break; + } + case DLL_THREAD_ATTACH: //A new thread is being created in the current process. + { + // + break; + } + case DLL_THREAD_DETACH: //A thread is exiting cleanly. + { + // + break; + } + case DLL_PROCESS_DETACH: //The calling process is detaching the DLL from its address space. + { + // + break; + } + } + return TRUE; +} + + + +/* InitExtension + * MMF2 calls this before anything else when it loads your + * extension. This includes during the splash screen, in which + * case "Quiet" is true. This is where you should initialize + * global information for either edittime or runtime. Be aware, + * though, that at edittime, multiple open MFAs with your + * extension will share the same global information. You can + * use mV->mvEditApp to tell apart different MFAs from each + * other. If an error occurs during this function, return + * -1 and MMF2 will not load your extension. + */ +int MMF2Func InitExtension(mv *mV, int Quiet) +{ + return Edif::Init(mV); +} + +/* FreeExtension + * Called just before MMF2 unloads your extension. You + * should release any memory you allocated above in + * the InitializeExtension function. You should always + * return a value of 0. + */ +int MMF2Func FreeExtension(mv *mV) +{ + // + Edif::Free(mV); + return 0; +} + + +/* LoadObject + * This is called at both edittime and runtime when MMF2 + * loads each unique instance of your object. (Each one + * with a different name, not each instance of the same + * one). Not much needs to be done here. + */ +int MMF2Func LoadObject(mv *mV, LPCSTR FileName, SerializedED *SED, int) +{ + Edif::Init(mV, SED); + return 0; +} + +/* UnloadObject + * new is to delete as LoadObject is to this functon. + * If you initialized stuff above, deinitialize it here. + */ +void MMF2Func UnloadObject(mv *mV, SerializedED *SED, int) +{ + // +} + +/* UpdateEditStructure (DEPRECATED) + * This is called when MMF2 notices that your + * extension has a newer version number than + * the one in the header of the SerializedED. + * Thankfully, however, we don't need this + * function at all - the EditData class is + * as smart as you programmed it to be and + * it changes the size dynamically rather + * than statically. So, you can safely + * ignore this function all together. + * (It would be a pain to write anyway - + * see the MMF2SDK help for an example) + */ +HGLOBAL MMF2Func UpdateEditStructure(mv *mV, SerializedED *OldSED) +{ + return 0; +} + +/* UpdateFileNames + * When the application is moved to a new directory, + * MMF2 asks your extension to ensure that its file + * paths are moving with it. Just call Update for + * each file path - you will need to create buffers + * of size MAX_PATH if you use C++ strings for + * the paths. + */ +void MMF2Func UpdateFileNames(mv *mV, LPSTR appName, SerializedED *SED, void (WINAPI *Update)(LPSTR, LPSTR)) +{ + // +} + +/* EnumElts + * That whacky function that MMF2 uses to enumerate all the + * animation frames associated with your object, because MMF2 + * is nice enough to deal with them for you so you can't-er, + * don't have to. Refer to the MMF2SDK Help file for + * information on how not to misuse this function. + * You must also uncomment the entry in the Ext.def + * file if you uncomment this function. + */ +/*int MMF2Func EnumElts (mv *mV, SerializedED *SED, ENUMELTPROC enumProc, ENUMELTPROC undoProc, LPARAM lp1, LPARAM lp2) +{ + int error = 0; + + //Replace wImgIdx with the name of the WORD variable you create within the edit structure + + //Enum images + if((error = enumProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2)) != 0) + { + //Undo enum images + undoProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2); + } + + return error; +}*/ diff --git a/Extensions/Template/Properties.cpp b/Extensions/Template/Properties.cpp index 3e2e3a7..a29e0c5 100644 --- a/Extensions/Template/Properties.cpp +++ b/Extensions/Template/Properties.cpp @@ -1,292 +1,292 @@ -/* Properties.cpp - * In this file you will define the edittime - * properties for your extension. By default - * only a version number is displayed. - * Functions defined here: - * GetProperties - * ReleaseProperties - * GetPropCreateParam - * ReleasePropCreateParam - * GetPropValue - * SetPropValue - * GetPropCheck - * SetPropCheck - * EditProp - * IsPropEnabled - */ - -#include "Common.h" - -#ifndef RUN_ONLY - -/* Prop - * This is the namespace the property identifiers - * are stored in. It keeps them out of the global - * namespace and it helps with intellisense. - */ -namespace Prop -{ - /* - * The property identitifers. - */ - enum - { - zNOT_USED = PROPID_EXTITEM_CUSTOM_FIRST, - Version, - //MyString, - //MyInt, - }; -} - -PropData Properties[] = //See the MMF2SDK help file for information on PropData_ macros. -{ - PropData_StaticString(Prop::Version, (UINT_PTR)"Version #", (UINT_PTR)"This is the current version of the EDIF Template object."), - //PropData_EditMultiLine(Prop::MyString, (UINT_PTR)"My String", (UINT_PTR)"The contents of my string."), - //PropData_EditNumber(Prop::MyInt, (UINT_PTR)"My Integer", (UINT_PTR)"The value of my integer."), - PropData_End() -}; - -#endif - -/* GetProperties - * Here, you choose what proeprties to insert - * into which tabs. Lots of dynamic things can - * be done in here, such as dynamically - * generating the properties based on the - * number of stored values in the editdata. - */ -BOOL MMF2Func GetProperties(mv *mV, SerializedED *SED, BOOL MasterItem) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - //ed.stuff; - mvInsertProps(mV, SED, Properties, PROPID_TAB_GENERAL, TRUE); - //if you changed ed: - //ed.Serialize(mV, SED); - return TRUE; -#endif - return FALSE; -} - -/* ReleaseProperties - * If you dynamically allocated memory for - * property arrays in GetProperties, release - * that memory in this function. - */ -void MMF2Func ReleaseProperties(mv *mV, SerializedED *SED, BOOL MasterItem) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - //ed.stuff; - // - //if you changed ed: - //ed.Serialize(mV, SED); -#endif -} - -/* GetPropCreateParam - * A convenience function if you use the - * hard-coded Properties array above. Allows - * you to dynamically create e.g. combo - * lists and other things that have - * additional parameters for their - * properties. However if you dynamically - * allocated everything in GetProperties, - * this function is useless. - */ -LPARAM MMF2Func GetPropCreateParam(mv *mV, SerializedED *SED, UINT PropID) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - //ed.stuff; - //return (LPARAM)TheParameter; - //if you changed ed: - //ed.Serialize(mV, SED); -#endif - return NULL; -} - -/* ReleasePropCreateParam - * If you found a useful way to use the - * above function and you dynamically - * allocated memory, release it here. - */ -void MMF2Func ReleasePropCreateParam(mv *mV, SerializedED *SED, UINT PropID, LPARAM lParam) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - //ed.stuff; - //MyAwesomeMemoryFreeingFunction(lParam); - //if you changed ed: - //ed.Serialize(mV, SED); -#endif -} - -/* GetPropValue - * This is where you return the display - * values for the properties you defined. - * Refer to the MMF2SDK Help file for - * information on what to return for - * each kind of property. - */ -void *MMF2Func GetPropValue(mv *mV, SerializedED *SED, UINT PropID) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - switch(PropID) - { - case Prop::Version: - { - return new CPropDataValue("Default.EDIF.Template.0"); - } - //case Prop::MyString: - // { - // return new CPropDataValue(ed.MyString.c_str()); - // } - //case Prop::MyInt: - // { - // return new CPropDWordValue(ed.MyInt); - // } - } - //if you changed ed: - //ed.Serialize(mV, SED); -#endif - return NULL; -} - -/* SetPropValue - * The user has just finished entering their - * 500 page essay into your MyString field. - * MMF2 isn't so kind as to save that for them, - * so it entrusts it with you. Store it! - */ -void MMF2Func SetPropValue(mv *mV, SerializedED *SED, UINT PropID, CPropValue *PropVal) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - //switch(PropID) - //{ - //case PropData::MyString: - // { - // ed.MyString = (LPSTR)((CPropDataValue*)PropVal)->m_pData; - // break; - // } - //case PropData::MyInt: - // { - // ed.MyInt = (CPropDWordValue*)PropVal)->m_dwValue; - // break; - // } - //} - //since you changed ed: - //ed.Serialize(mV, SED); - - //You may want to have your object redrawn in the - //frame editor after the modifications; in this - //case, just call this function: - //mvInvalidateObject(mV, SED); -#endif -} - -/* GetPropCheck - * There are checkbox properties, and - * there are properties that have their - * own checkbox as an option. This is - * where you tell MMF2 whether those - * boxes are ticked or not. - */ -BOOL MMF2Func GetPropCheck(mv *mV, SerializedED *SED, UINT PropID) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - //switch(PropID) - //{ - //case Prop::MyCheckBoxPropertyOrPropertyThatHasTheCheckboxOptionSet: - // { - // return ed.WhetherOrNotThatPropertyOfMineIsTicked ? TRUE : FALSE; - // } - //} - //if you changed ed: - //ed.Serialize(mV, SED); -#endif - return FALSE; -} - -/* SetPropCheck - * The user has painstakingly moved the - * mouse cursor over the checkbox and - * expended the immense effort required - * to click the mouse and toggle the - * state of the tickbox. Don't let their - * effort be all for naught! - */ -void MMF2Func SetPropCheck(mv *mV, SerializedED *SED, UINT PropID, BOOL Ticked) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - //switch(PropID) - //{ - //case Prop::MyCheckBoxPropertyOrPropertyThatHasTheCheckboxOptionSet: - // { - // ed.WhetherOrNotThatPropertyOfMineIsTicked = Ticked != FALSE ? true : false; - // } - //} - //since you changed ed: - //ed.Serialize(mV, SED); -#endif -} - -/* EditProp - * If you use a button proeprty or a - * property that has a button, then - * you would be impolite to ignore - * the user when the click on that - * button. Here is where you respond - * to that button press e.g. with - * a dialog. - */ -BOOL MMF2Func EditProp(mv *mV, SerializedED *SED, UINT PropID) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - //switch(PropID) - //{ - //case Prop::MyButtonPropertyOrPropertyThatHasAButtonWithIt: - // { - // // - // break; - // } - //} - //if you changed ed: - //ed.Serialize(mV, SED); -#endif - return FALSE; -} - -/* IsPropEnabled - * Let's say you're tired of having to deal - * with the user's various 500 page essays, - * tickbox toggles, and button clicks. Here, - * you can simply disable a property by - * returning FALSE for that property. - */ -BOOL MMF2Func IsPropEnabled(mv *mV, SerializedED *SED, UINT PropID) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - switch(PropID) - { - case Prop::Version: - { - return FALSE; //Makes the version proeprty greyed out - } - //case Prop::MyString: //intentional\\ - //case Prop::MyInt: //fallthrough\\ - // { - // return TRUE; //allows the user to interact with these proeprties - // } - } - //if you changed ed: - //ed.Serialize(mV, SED); -#endif - return FALSE; -} +/* Properties.cpp + * In this file you will define the edittime + * properties for your extension. By default + * only a version number is displayed. + * Functions defined here: + * GetProperties + * ReleaseProperties + * GetPropCreateParam + * ReleasePropCreateParam + * GetPropValue + * SetPropValue + * GetPropCheck + * SetPropCheck + * EditProp + * IsPropEnabled + */ + +#include "Common.h" + +#ifndef RUN_ONLY + +/* Prop + * This is the namespace the property identifiers + * are stored in. It keeps them out of the global + * namespace and it helps with intellisense. + */ +namespace Prop +{ + /* + * The property identitifers. + */ + enum + { + zNOT_USED = PROPID_EXTITEM_CUSTOM_FIRST, + Version, + //MyString, + //MyInt, + }; +} + +PropData Properties[] = //See the MMF2SDK help file for information on PropData_ macros. +{ + PropData_StaticString(Prop::Version, (UINT_PTR)"Version #", (UINT_PTR)"This is the current version of the EDIF Template object."), + //PropData_EditMultiLine(Prop::MyString, (UINT_PTR)"My String", (UINT_PTR)"The contents of my string."), + //PropData_EditNumber(Prop::MyInt, (UINT_PTR)"My Integer", (UINT_PTR)"The value of my integer."), + PropData_End() +}; + +#endif + +/* GetProperties + * Here, you choose what proeprties to insert + * into which tabs. Lots of dynamic things can + * be done in here, such as dynamically + * generating the properties based on the + * number of stored values in the editdata. + */ +BOOL MMF2Func GetProperties(mv *mV, SerializedED *SED, BOOL MasterItem) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //ed.stuff; + mvInsertProps(mV, SED, Properties, PROPID_TAB_GENERAL, TRUE); + //if you changed ed: + //ed.Serialize(mV, SED); + return TRUE; +#endif + return FALSE; +} + +/* ReleaseProperties + * If you dynamically allocated memory for + * property arrays in GetProperties, release + * that memory in this function. + */ +void MMF2Func ReleaseProperties(mv *mV, SerializedED *SED, BOOL MasterItem) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //ed.stuff; + // + //if you changed ed: + //ed.Serialize(mV, SED); +#endif +} + +/* GetPropCreateParam + * A convenience function if you use the + * hard-coded Properties array above. Allows + * you to dynamically create e.g. combo + * lists and other things that have + * additional parameters for their + * properties. However if you dynamically + * allocated everything in GetProperties, + * this function is useless. + */ +LPARAM MMF2Func GetPropCreateParam(mv *mV, SerializedED *SED, UINT PropID) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //ed.stuff; + //return (LPARAM)TheParameter; + //if you changed ed: + //ed.Serialize(mV, SED); +#endif + return NULL; +} + +/* ReleasePropCreateParam + * If you found a useful way to use the + * above function and you dynamically + * allocated memory, release it here. + */ +void MMF2Func ReleasePropCreateParam(mv *mV, SerializedED *SED, UINT PropID, LPARAM lParam) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //ed.stuff; + //MyAwesomeMemoryFreeingFunction(lParam); + //if you changed ed: + //ed.Serialize(mV, SED); +#endif +} + +/* GetPropValue + * This is where you return the display + * values for the properties you defined. + * Refer to the MMF2SDK Help file for + * information on what to return for + * each kind of property. + */ +void *MMF2Func GetPropValue(mv *mV, SerializedED *SED, UINT PropID) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + switch(PropID) + { + case Prop::Version: + { + return new CPropDataValue("Default.EDIF.Template.0"); + } + //case Prop::MyString: + // { + // return new CPropDataValue(ed.MyString.c_str()); + // } + //case Prop::MyInt: + // { + // return new CPropDWordValue(ed.MyInt); + // } + } + //if you changed ed: + //ed.Serialize(mV, SED); +#endif + return NULL; +} + +/* SetPropValue + * The user has just finished entering their + * 500 page essay into your MyString field. + * MMF2 isn't so kind as to save that for them, + * so it entrusts it with you. Store it! + */ +void MMF2Func SetPropValue(mv *mV, SerializedED *SED, UINT PropID, CPropValue *PropVal) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //switch(PropID) + //{ + //case PropData::MyString: + // { + // ed.MyString = (LPSTR)((CPropDataValue*)PropVal)->m_pData; + // break; + // } + //case PropData::MyInt: + // { + // ed.MyInt = (CPropDWordValue*)PropVal)->m_dwValue; + // break; + // } + //} + //since you changed ed: + //ed.Serialize(mV, SED); + + //You may want to have your object redrawn in the + //frame editor after the modifications; in this + //case, just call this function: + //mvInvalidateObject(mV, SED); +#endif +} + +/* GetPropCheck + * There are checkbox properties, and + * there are properties that have their + * own checkbox as an option. This is + * where you tell MMF2 whether those + * boxes are ticked or not. + */ +BOOL MMF2Func GetPropCheck(mv *mV, SerializedED *SED, UINT PropID) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //switch(PropID) + //{ + //case Prop::MyCheckBoxPropertyOrPropertyThatHasTheCheckboxOptionSet: + // { + // return ed.WhetherOrNotThatPropertyOfMineIsTicked ? TRUE : FALSE; + // } + //} + //if you changed ed: + //ed.Serialize(mV, SED); +#endif + return FALSE; +} + +/* SetPropCheck + * The user has painstakingly moved the + * mouse cursor over the checkbox and + * expended the immense effort required + * to click the mouse and toggle the + * state of the tickbox. Don't let their + * effort be all for naught! + */ +void MMF2Func SetPropCheck(mv *mV, SerializedED *SED, UINT PropID, BOOL Ticked) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //switch(PropID) + //{ + //case Prop::MyCheckBoxPropertyOrPropertyThatHasTheCheckboxOptionSet: + // { + // ed.WhetherOrNotThatPropertyOfMineIsTicked = Ticked != FALSE ? true : false; + // } + //} + //since you changed ed: + //ed.Serialize(mV, SED); +#endif +} + +/* EditProp + * If you use a button proeprty or a + * property that has a button, then + * you would be impolite to ignore + * the user when the click on that + * button. Here is where you respond + * to that button press e.g. with + * a dialog. + */ +BOOL MMF2Func EditProp(mv *mV, SerializedED *SED, UINT PropID) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //switch(PropID) + //{ + //case Prop::MyButtonPropertyOrPropertyThatHasAButtonWithIt: + // { + // // + // break; + // } + //} + //if you changed ed: + //ed.Serialize(mV, SED); +#endif + return FALSE; +} + +/* IsPropEnabled + * Let's say you're tired of having to deal + * with the user's various 500 page essays, + * tickbox toggles, and button clicks. Here, + * you can simply disable a property by + * returning FALSE for that property. + */ +BOOL MMF2Func IsPropEnabled(mv *mV, SerializedED *SED, UINT PropID) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + switch(PropID) + { + case Prop::Version: + { + return FALSE; //Makes the version proeprty greyed out + } + //case Prop::MyString: //intentional\\ + //case Prop::MyInt: //fallthrough\\ + // { + // return TRUE; //allows the user to interact with these proeprties + // } + } + //if you changed ed: + //ed.Serialize(mV, SED); +#endif + return FALSE; +} diff --git a/Extensions/Template/Runtime.cpp b/Extensions/Template/Runtime.cpp index 15dfcb9..db911d5 100644 --- a/Extensions/Template/Runtime.cpp +++ b/Extensions/Template/Runtime.cpp @@ -1,182 +1,182 @@ -/* Runtime.cpp - * This file contains general runtime functions - * that aren't part of the Extension class. - * Functions defined here: - * GetRunObjectSurface - * GetRunObjectCollisionMask - * StartApp - * EndApp - * StartFrame - * EndFrame - * WindowProc - */ - -#include "Common.h" - -/* GetRunObjectSurface - * Implement this function instead of - * Extension::Display if your extension - * supports ink effects and transitions. - * You can support ink effects in - * DisplayRunObject too, but this is - * done automatically if you implement - * GetRunObjectSurface (MMF2 applies the - * ink effects to the surface). Don't - * forget to enable the function in the - * .def file if you uncomment & implement - * this function. - */ -/*cSurface* MMF2Func GetRunObjectSurface(RD *rd) -{ - return NULL; -}*/ - -/* GetRunObjectCollisionMask - * Implement this function if your extension - * supports fine collision detection - * (OEPREFS_FINECOLLISIONS), rr if it's a - * background object and you want Obstacle - * properties for this object. You should - * return NULL if the object is not transparent. - * Don't forget to enable the function in the - * .def file if you uncomment & implement this - * function. - */ -/*LPSMASK MMF2Func GetRunObjectCollisionMask(RD *rd, LPARAM lParam) -{ - // Typical example for active objects - // ---------------------------------- - // Opaque? collide with box - if ( (rdPtr->rs.rsEffect & EFFECTFLAG_TRANSPARENT) == 0 ) // Note: only if your object has the OEPREFS_INKEFFECTS option - return NULL; - - // Transparent? Create mask - LPSMASK pMask = rdPtr->m_pColMask; - if ( pMask == NULL ) - { - if ( rdPtr->m_pSurface != NULL ) - { - DWORD dwMaskSize = rdPtr->m_pSurface->CreateMask(NULL, lParam); - if ( dwMaskSize != 0 ) - { - pMask = (LPSMASK)calloc(dwMaskSize, 1); - if ( pMask != NULL ) - { - rdPtr->m_pSurface->CreateMask(pMask, lParam); - rdPtr->m_pColMask = pMask; - } - } - } - } - - //Note: for active objects, lParam is always the same. - //For background objects (OEFLAG_BACKGROUND), lParam maybe be different if the user uses your object - //as obstacle and as platform. In this case, you should store 2 collision masks - //in your data: one if lParam is 0 and another one if lParam is different from 0. - - return pMask; -}*/ - -/* StartApp - * Called when the application initially - * starts or when it restarts (EndApp will - * NOT be called beforehand in the case - * of a restart). This is useful if you - * need to store global data across - * frames. - */ -void MMF2Func StartApp(mv *mV, CRunApp *App) -{ - // -} - -/* EndApp - * Called when the application is ending - * and about to close. This is NOT called - * in the event of a Restart Application - * action. You can release any memory you - * aqquired above in StartApp. - */ -void MMF2Func EndApp(mv *mV, CRunApp *App) -{ - // -} - -/* StartFrame - * Called at the start of a frame. If you - * store global data above, you should make - * a copy of it so that it may be restored - * when the frame restarts. This function is - * also called when the frame restarts. - * EndFrame is NOT called when the frame - * restarts. - */ -void MMF2Func StartFrame(mv *mV, CRunApp *App, int FrameIndex) -{ - // -} - -/* EndFrame - * Called when the frame ends. MMF2 - * does NOT call this function in the - * event of a "Restart Frame" action. - */ -void MMF2Func EndFrame(mv *mV, CRunApp *App, int FrameIndex) -{ - // -} - - -// ============================================================================ -// -// WINDOWPROC (interception of messages sent to hMainWin and hEditWin) -// -// Do not forget to enable the WindowProc function in the .def file if you implement it -// -// ============================================================================ -/* -// Get the pointer to the object's data from its window handle -// Note: the object's window must have been subclassed with a -// callRunTimeFunction(rdPtr, RFUNCTION_SUBCLASSWINDOW, 0, 0); -// See the documentation and the Simple Control example for more info. -// -LPRDATA GetRdPtr(HWND hwnd, LPRH rhPtr) -{ - return (LPRDATA)GetProp(hwnd, (LPCSTR)rhPtr->rh4.rh4AtomRd); -} - -// Called from the window proc of hMainWin and hEditWin. -// You can intercept the messages and/or tell the main proc to ignore them. -// -LRESULT CALLBACK DLLExport WindowProc(LPRH rhPtr, HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) -{ - LPRDATA rdPtr = NULL; - - switch (nMsg) { - - // Example - case WM_CTLCOLORSTATIC: - { - // Get the handle of the control - HWND hWndControl = (HWND)lParam; - - // Get a pointer to the RUNDATA structure (see GetRdptr function above for more info) - rdPtr = GetRdPtr(hWndControl, rhPtr); - - // Check if the rdPtr pointer is valid and points to an object created with this extension - if ( rdPtr == NULL || rdPtr->rHo.hoIdentifier != IDENTIFIER ) - break; - - // OK, intercept the message - HDC hDC = (HDC)wParam; - SetBkColor(hDC, rdPtr->backColor); - SetTextColor(hDC, rdPtr->fontColor); - rhPtr->rh4.rh4KpxReturn = (long)rdPtr->hBackBrush; - return REFLAG_MSGRETURNVALUE; - } - break; - } - - return 0; -} -*/ +/* Runtime.cpp + * This file contains general runtime functions + * that aren't part of the Extension class. + * Functions defined here: + * GetRunObjectSurface + * GetRunObjectCollisionMask + * StartApp + * EndApp + * StartFrame + * EndFrame + * WindowProc + */ + +#include "Common.h" + +/* GetRunObjectSurface + * Implement this function instead of + * Extension::Display if your extension + * supports ink effects and transitions. + * You can support ink effects in + * DisplayRunObject too, but this is + * done automatically if you implement + * GetRunObjectSurface (MMF2 applies the + * ink effects to the surface). Don't + * forget to enable the function in the + * .def file if you uncomment & implement + * this function. + */ +/*cSurface* MMF2Func GetRunObjectSurface(RD *rd) +{ + return NULL; +}*/ + +/* GetRunObjectCollisionMask + * Implement this function if your extension + * supports fine collision detection + * (OEPREFS_FINECOLLISIONS), rr if it's a + * background object and you want Obstacle + * properties for this object. You should + * return NULL if the object is not transparent. + * Don't forget to enable the function in the + * .def file if you uncomment & implement this + * function. + */ +/*LPSMASK MMF2Func GetRunObjectCollisionMask(RD *rd, LPARAM lParam) +{ + // Typical example for active objects + // ---------------------------------- + // Opaque? collide with box + if ( (rdPtr->rs.rsEffect & EFFECTFLAG_TRANSPARENT) == 0 ) // Note: only if your object has the OEPREFS_INKEFFECTS option + return NULL; + + // Transparent? Create mask + LPSMASK pMask = rdPtr->m_pColMask; + if ( pMask == NULL ) + { + if ( rdPtr->m_pSurface != NULL ) + { + DWORD dwMaskSize = rdPtr->m_pSurface->CreateMask(NULL, lParam); + if ( dwMaskSize != 0 ) + { + pMask = (LPSMASK)calloc(dwMaskSize, 1); + if ( pMask != NULL ) + { + rdPtr->m_pSurface->CreateMask(pMask, lParam); + rdPtr->m_pColMask = pMask; + } + } + } + } + + //Note: for active objects, lParam is always the same. + //For background objects (OEFLAG_BACKGROUND), lParam maybe be different if the user uses your object + //as obstacle and as platform. In this case, you should store 2 collision masks + //in your data: one if lParam is 0 and another one if lParam is different from 0. + + return pMask; +}*/ + +/* StartApp + * Called when the application initially + * starts or when it restarts (EndApp will + * NOT be called beforehand in the case + * of a restart). This is useful if you + * need to store global data across + * frames. + */ +void MMF2Func StartApp(mv *mV, CRunApp *App) +{ + // +} + +/* EndApp + * Called when the application is ending + * and about to close. This is NOT called + * in the event of a Restart Application + * action. You can release any memory you + * aqquired above in StartApp. + */ +void MMF2Func EndApp(mv *mV, CRunApp *App) +{ + // +} + +/* StartFrame + * Called at the start of a frame. If you + * store global data above, you should make + * a copy of it so that it may be restored + * when the frame restarts. This function is + * also called when the frame restarts. + * EndFrame is NOT called when the frame + * restarts. + */ +void MMF2Func StartFrame(mv *mV, CRunApp *App, int FrameIndex) +{ + // +} + +/* EndFrame + * Called when the frame ends. MMF2 + * does NOT call this function in the + * event of a "Restart Frame" action. + */ +void MMF2Func EndFrame(mv *mV, CRunApp *App, int FrameIndex) +{ + // +} + + +// ============================================================================ +// +// WINDOWPROC (interception of messages sent to hMainWin and hEditWin) +// +// Do not forget to enable the WindowProc function in the .def file if you implement it +// +// ============================================================================ +/* +// Get the pointer to the object's data from its window handle +// Note: the object's window must have been subclassed with a +// callRunTimeFunction(rdPtr, RFUNCTION_SUBCLASSWINDOW, 0, 0); +// See the documentation and the Simple Control example for more info. +// +LPRDATA GetRdPtr(HWND hwnd, LPRH rhPtr) +{ + return (LPRDATA)GetProp(hwnd, (LPCSTR)rhPtr->rh4.rh4AtomRd); +} + +// Called from the window proc of hMainWin and hEditWin. +// You can intercept the messages and/or tell the main proc to ignore them. +// +LRESULT CALLBACK DLLExport WindowProc(LPRH rhPtr, HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) +{ + LPRDATA rdPtr = NULL; + + switch (nMsg) { + + // Example + case WM_CTLCOLORSTATIC: + { + // Get the handle of the control + HWND hWndControl = (HWND)lParam; + + // Get a pointer to the RUNDATA structure (see GetRdptr function above for more info) + rdPtr = GetRdPtr(hWndControl, rhPtr); + + // Check if the rdPtr pointer is valid and points to an object created with this extension + if ( rdPtr == NULL || rdPtr->rHo.hoIdentifier != IDENTIFIER ) + break; + + // OK, intercept the message + HDC hDC = (HDC)wParam; + SetBkColor(hDC, rdPtr->backColor); + SetTextColor(hDC, rdPtr->fontColor); + rhPtr->rh4.rh4KpxReturn = (long)rdPtr->hBackBrush; + return REFLAG_MSGRETURNVALUE; + } + break; + } + + return 0; +} +*/ diff --git a/Extensions/Template/Text.cpp b/Extensions/Template/Text.cpp index c753dcd..a224b17 100644 --- a/Extensions/Template/Text.cpp +++ b/Extensions/Template/Text.cpp @@ -1,63 +1,63 @@ -/* Text.cpp - * If you define the OEFLAG_TEXT flag, - * then this file is for you. Here you - * will deal with text at runtime similarly - * to how you dealt with it at edittime. - * By default all functions are commented - * out, if you implement them (and you - * should implement them in an all-or- - * nothing fashion), then you need to - * uncomment them in Ext.def as well. - * Functions defined here: - * GetRunObjectFont - * SetRunObjectFont - * GetRunObjectTextColor - * SetRunObjectTextColor - */ - -#include "Common.h" - -/* GetRunObjectFont - * Copy the current font into the Lf parameter. - */ -/*void MMF2Func GetRunObjectFont(RD *rd, LOGFONT *Lf) -{ - //GetObject(rd->pExtension->MyHFont, sizeof(LOGFONT), Lf); -}*/ - -/* SetRunObjectFont - * Store the font set by the user. Some - * action needs to be taken when rect is - * not null - read the MMF2SDK Help file - * for more information. - */ -/*void MMF2Func SetRunObjectFont(RD *rd, LOGFONT *Lf, RECT *rect) -{ -// Extension &ext = *(rd->pExtension); -// HFONT HFont = CreateFontIndirect(Lf); -// if(hFont != NULL) -// { -// if(ext.MyHFont != 0) DeleteObject(ext.MyHFont); -// ext.MyHFont = HFont; -// SendMessage(ext.MyHWindow, WM_SETFONT, WPARAM(ext.MyHFont), FALSE); -// } -}*/ - -/* GetRunObjectTextColor - * Plain and simple, return the color - * of the text. - */ -/*COLORREF MMF2Func GetRunObjectTextColor(RD *rd) -{ - return 0; -}*/ - -/* SetRunObjectTextColor - * Store the new color of the text - * and force and update on your window. - */ -/*void MMF2Func SetRunObjectTextColor(RD *rd, COLORREF color) -{ -// rd->pExtension->MyTextColor = color; -// InvalidateRect(rd->pExtension->MyHWindow, NULL, TRUE); -}*/ +/* Text.cpp + * If you define the OEFLAG_TEXT flag, + * then this file is for you. Here you + * will deal with text at runtime similarly + * to how you dealt with it at edittime. + * By default all functions are commented + * out, if you implement them (and you + * should implement them in an all-or- + * nothing fashion), then you need to + * uncomment them in Ext.def as well. + * Functions defined here: + * GetRunObjectFont + * SetRunObjectFont + * GetRunObjectTextColor + * SetRunObjectTextColor + */ + +#include "Common.h" + +/* GetRunObjectFont + * Copy the current font into the Lf parameter. + */ +/*void MMF2Func GetRunObjectFont(RD *rd, LOGFONT *Lf) +{ + //GetObject(rd->pExtension->MyHFont, sizeof(LOGFONT), Lf); +}*/ + +/* SetRunObjectFont + * Store the font set by the user. Some + * action needs to be taken when rect is + * not null - read the MMF2SDK Help file + * for more information. + */ +/*void MMF2Func SetRunObjectFont(RD *rd, LOGFONT *Lf, RECT *rect) +{ +// Extension &ext = *(rd->pExtension); +// HFONT HFont = CreateFontIndirect(Lf); +// if(hFont != NULL) +// { +// if(ext.MyHFont != 0) DeleteObject(ext.MyHFont); +// ext.MyHFont = HFont; +// SendMessage(ext.MyHWindow, WM_SETFONT, WPARAM(ext.MyHFont), FALSE); +// } +}*/ + +/* GetRunObjectTextColor + * Plain and simple, return the color + * of the text. + */ +/*COLORREF MMF2Func GetRunObjectTextColor(RD *rd) +{ + return 0; +}*/ + +/* SetRunObjectTextColor + * Store the new color of the text + * and force and update on your window. + */ +/*void MMF2Func SetRunObjectTextColor(RD *rd, COLORREF color) +{ +// rd->pExtension->MyTextColor = color; +// InvalidateRect(rd->pExtension->MyHWindow, NULL, TRUE); +}*/ diff --git a/Extensions/Template/TextProps.cpp b/Extensions/Template/TextProps.cpp index 1505e32..d8ef389 100644 --- a/Extensions/Template/TextProps.cpp +++ b/Extensions/Template/TextProps.cpp @@ -1,116 +1,116 @@ -/* TextProps.cpp - * If you plan on allowing MMF2 to manage - * your extension's text display properties - * for you, this is the file to look into. - * Functions defined here: - * GetTextCaps - * GetTextFont - * SetTextFont - * GetTextClr - * SetTextClr - * GetTextAlignment - * SetTextAlignment - */ - -#include "Common.h" - -/* GetTextCaps - * Return the text capabilities - * of your extension at edittime. - */ -DWORD MMF2Func GetTextCaps(mv *mV, SerializedED *SED) -{ -#ifndef RUN_ONLY -// return TEXT_ALIGN_LEFT|TEXT_ALIGN_HCENTER|TEXT_ALIGN_RIGHT -// |TEXT_ALIGN_TOP|TEXT_ALIGN_VCENTER|TEXT_ALIGN_BOTTOM -// |TEXT_FONT|TEXT_COLOR; -#endif - return 0; -} - -/* GetTextFont - * Return the font used by your extension. - */ -BOOL MMF2Func GetTextFont(mv *mV, SerializedED *SED, LOGFONT *lf, LPTSTR, UINT) -{ -#ifndef RUN_ONLY - // - return TRUE; -#endif - return FALSE; -} - -/* SetTextFont - * Changes the font used by your extension. - */ -BOOL MMF2Func SetTextFont(mv *mV, SerializedED *SED, LOGFONT *lf, LPCSTR) -{ -#ifndef RUN_ONLY - // - return TRUE; -#endif - return FALSE; -} - -/* GetTextClr - * Return the RGB color value of the text color. - */ -COLORREF MMF2Func GetTextClr(mv *mV, SerializedED *SED) -{ -#ifndef RUN_ONLY - // - return 200<<8; //green -#endif - return 0; -} - -/* SetTextClr - * Sets the color of the text. - */ -void MMF2Func SetTextClr(mv *mV, SerializedED *SED, COLORREF Color) -{ -#ifndef RUN_ONLY - // -#endif -} - -/* GetTextAlignment - * Return the alignment of the text. - */ -DWORD MMF2Func GetTextAlignment(mv *mV, SerializedED *SED) -{ -#ifndef RUN_ONLY -// DWORD dw = 0; - -// if((ed.Flags & ALIGN_LEFT) != 0) dw |= TEXT_ALIGN_LEFT; -// if((ed.Flags & ALIGN_HCENTER) != 0) dw |= TEXT_ALIGN_HCENTER; -// if((ed.Flags & ALIGN_RIGHT) != 0) dw |= TEXT_ALIGN_RIGHT; - -// if((ed.Flags & ALIGN_TOP) != 0) dw |= TEXT_ALIGN_TOP; -// if((ed.Flags & ALIGN_VCENTER) != 0) dw |= TEXT_ALIGN_VCENTER; -// if((ed.Flags & ALIGN_BOTTOM) != 0) dw |= TEXT_ALIGN_BOTTOM; - -// return dw; -#endif - return 0; -} - -/* SetTextAlignment - * Sets the alignment of the text. - */ -void MMF2Func SetTextAlignment(mv *mV, SerializedED *SED, DWORD AlignFlags) -{ -#ifndef RUN_ONLY -// DWORD dw = ed.Flags; - -// if((AlignFlags & TEXT_ALIGN_LEFT) != 0) dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_LEFT; -// if((AlignFlags & TEXT_ALIGN_HCENTER)!= 0) dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_HCENTER; -// if((AlignFlags & TEXT_ALIGN_RIGHT) != 0) dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_RIGHT; - -// if((AlignFlags & TEXT_ALIGN_TOP) != 0) dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_TOP; -// if((AlignFlags & TEXT_ALIGN_VCENTER)!= 0) dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_VCENTER; -// if((AlignFlags & TEXT_ALIGN_BOTTOM) != 0) dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_BOTTOM; - -// edFlags = dw; -#endif -} +/* TextProps.cpp + * If you plan on allowing MMF2 to manage + * your extension's text display properties + * for you, this is the file to look into. + * Functions defined here: + * GetTextCaps + * GetTextFont + * SetTextFont + * GetTextClr + * SetTextClr + * GetTextAlignment + * SetTextAlignment + */ + +#include "Common.h" + +/* GetTextCaps + * Return the text capabilities + * of your extension at edittime. + */ +DWORD MMF2Func GetTextCaps(mv *mV, SerializedED *SED) +{ +#ifndef RUN_ONLY +// return TEXT_ALIGN_LEFT|TEXT_ALIGN_HCENTER|TEXT_ALIGN_RIGHT +// |TEXT_ALIGN_TOP|TEXT_ALIGN_VCENTER|TEXT_ALIGN_BOTTOM +// |TEXT_FONT|TEXT_COLOR; +#endif + return 0; +} + +/* GetTextFont + * Return the font used by your extension. + */ +BOOL MMF2Func GetTextFont(mv *mV, SerializedED *SED, LOGFONT *lf, LPTSTR, UINT) +{ +#ifndef RUN_ONLY + // + return TRUE; +#endif + return FALSE; +} + +/* SetTextFont + * Changes the font used by your extension. + */ +BOOL MMF2Func SetTextFont(mv *mV, SerializedED *SED, LOGFONT *lf, LPCSTR) +{ +#ifndef RUN_ONLY + // + return TRUE; +#endif + return FALSE; +} + +/* GetTextClr + * Return the RGB color value of the text color. + */ +COLORREF MMF2Func GetTextClr(mv *mV, SerializedED *SED) +{ +#ifndef RUN_ONLY + // + return 200<<8; //green +#endif + return 0; +} + +/* SetTextClr + * Sets the color of the text. + */ +void MMF2Func SetTextClr(mv *mV, SerializedED *SED, COLORREF Color) +{ +#ifndef RUN_ONLY + // +#endif +} + +/* GetTextAlignment + * Return the alignment of the text. + */ +DWORD MMF2Func GetTextAlignment(mv *mV, SerializedED *SED) +{ +#ifndef RUN_ONLY +// DWORD dw = 0; + +// if((ed.Flags & ALIGN_LEFT) != 0) dw |= TEXT_ALIGN_LEFT; +// if((ed.Flags & ALIGN_HCENTER) != 0) dw |= TEXT_ALIGN_HCENTER; +// if((ed.Flags & ALIGN_RIGHT) != 0) dw |= TEXT_ALIGN_RIGHT; + +// if((ed.Flags & ALIGN_TOP) != 0) dw |= TEXT_ALIGN_TOP; +// if((ed.Flags & ALIGN_VCENTER) != 0) dw |= TEXT_ALIGN_VCENTER; +// if((ed.Flags & ALIGN_BOTTOM) != 0) dw |= TEXT_ALIGN_BOTTOM; + +// return dw; +#endif + return 0; +} + +/* SetTextAlignment + * Sets the alignment of the text. + */ +void MMF2Func SetTextAlignment(mv *mV, SerializedED *SED, DWORD AlignFlags) +{ +#ifndef RUN_ONLY +// DWORD dw = ed.Flags; + +// if((AlignFlags & TEXT_ALIGN_LEFT) != 0) dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_LEFT; +// if((AlignFlags & TEXT_ALIGN_HCENTER)!= 0) dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_HCENTER; +// if((AlignFlags & TEXT_ALIGN_RIGHT) != 0) dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_RIGHT; + +// if((AlignFlags & TEXT_ALIGN_TOP) != 0) dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_TOP; +// if((AlignFlags & TEXT_ALIGN_VCENTER)!= 0) dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_VCENTER; +// if((AlignFlags & TEXT_ALIGN_BOTTOM) != 0) dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_BOTTOM; + +// edFlags = dw; +#endif +} diff --git a/Extensions/Template/resource.h b/Extensions/Template/resource.h index 252a0a4..ca96268 100644 --- a/Extensions/Template/resource.h +++ b/Extensions/Template/resource.h @@ -1,18 +1,18 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Ext.rc -// -#define IDR_EDIF_ICON 101 -#define IDR_EDIF_JSON 102 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by Ext.rc +// +#define IDR_EDIF_ICON 101 +#define IDR_EDIF_JSON 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Inc/CfcFile.h b/Inc/CfcFile.h index cd30d7a..662db3d 100644 --- a/Inc/CfcFile.h +++ b/Inc/CfcFile.h @@ -1,293 +1,293 @@ - -#ifndef _BFile_h -#define _BFile_h - -#ifndef LPLPVOID -typedef LPVOID FAR *LPLPVOID; -#endif - -#include "CfcError.h" -#include "StdDefs.h" - -#ifndef OF_READ -#define OF_READ 0x00000000 -#define OF_WRITE 0x00000001 -#define OF_READWRITE 0x00000002 -#define OF_SHARE_COMPAT 0x00000000 -#define OF_SHARE_EXCLUSIVE 0x00000010 -#define OF_SHARE_DENY_WRITE 0x00000020 -#define OF_SHARE_DENY_READ 0x00000030 -#define OF_SHARE_DENY_NONE 0x00000040 -#endif - -STDDLL_API HFILE WINAPI File_OpenA(LPCSTR fname, int mode); -STDDLL_API HFILE WINAPI File_CreateA(LPCSTR fname); -STDDLL_API int WINAPI File_Read (HFILE hf, LPVOID buf, DWORD len); -STDDLL_API int WINAPI File_ReadAndCount (HFILE hf, LPVOID buf, DWORD len); -STDDLL_API int WINAPI File_ReadShortIntelData (HFILE hf, LPLPVOID pBuf); -STDDLL_API int WINAPI File_ReadShortIntelString (HFILE hf, LPLPVOID pBuf); -STDDLL_API int WINAPI File_ReadLongIntelData (HFILE hf, LPLPVOID pBuf); -STDDLL_API int WINAPI File_Write (HFILE hf, LPVOID buf, DWORD len); -STDDLL_API DWORD WINAPI File_GetPosition (HFILE hf); -STDDLL_API DWORD WINAPI File_SeekBegin (HFILE hf, long pos); -STDDLL_API DWORD WINAPI File_SeekCurrent (HFILE hf, long pos); -STDDLL_API DWORD WINAPI File_SeekEnd (HFILE hf, long pos); -STDDLL_API long WINAPI File_GetLength ( HFILE hf ); -STDDLL_API void WINAPI File_Close(HFILE hf); -STDDLL_API BOOL WINAPI File_ExistA(LPCSTR pName); - -STDDLL_API HFILE WINAPI File_OpenW(LPCWSTR fname, int mode); -STDDLL_API HFILE WINAPI File_CreateW(LPCWSTR fname); -STDDLL_API BOOL WINAPI File_ExistW(LPCWSTR pName); - -#ifdef _UNICODE -#define File_Open File_OpenW -#define File_Create File_CreateW -#define File_Exist File_ExistW -#else -#define File_Open File_OpenA -#define File_Create File_CreateA -#define File_Exist File_ExistA -#endif - -#ifndef _MAC -#define File_ReadIntelWord(h,p,l) File_Read(h,p,l) -#define File_ReadIntelDWord(h,p,l) File_Read(h,p,l) -#else -int File_ReadIntelWord(HFILE hf, LPVOID buf, DWORD len); -int File_ReadIntelDWord(HFILE hf, LPVOID buf, DWORD len); -#endif - -// Input file - abstract class -class FAR STDDLL_API CInputFile -{ - public: - virtual ~CInputFile() {}; - - virtual void Delete(); - - virtual int Read(LPBYTE dest, DWORD lsize) = 0; - virtual int Read (LPBYTE dest, DWORD lsize, LPDWORD pRead) = 0; - virtual int ReadByte(LPBYTE dest) = 0; - virtual int ReadIntelWord(LPWORD dest); - virtual int ReadIntelDWord(LPDWORD dest); - virtual int ReadMacWord(LPWORD dest); - virtual int ReadMacDWord(LPDWORD dest); - virtual int ReadIntelFloat(PFLOAT dest); - virtual int ReadMacFloat(PFLOAT dest); - virtual int ReadIntelWordArray(LPWORD dest, int count); - virtual int ReadIntelDWordArray(LPDWORD dest, int count); - virtual int ReadIntelFloatArray(PFLOAT dest, int count); - virtual int ReadMacWordArray(LPWORD dest, int count); - virtual int ReadMacDWordArray(LPDWORD dest, int count); - virtual int ReadMacFloatArray(PFLOAT dest, int count); - - virtual long GetPosition() = 0; - virtual long GetLength() = 0; - virtual long Seek(long pos, int method) = 0; - - virtual int Attach(HANDLE hnd) = 0; - virtual HANDLE Detach() = 0; - - virtual LPBYTE GetBuffer(UINT nSize); - virtual void FreeBuffer(LPBYTE buf); - - virtual LPSTR GetFileNameA() = 0; - virtual LPWSTR GetFileNameW() = 0; - - #ifdef _CFCFILE_UNICODE_DEFS - #if defined(_UNICODE) - #define GetFileName GetFileNameW - #else - #define GetFileName GetFileNameA - #endif - #endif -}; -typedef CInputFile FAR * LPINPUTFILE; - -// Bufferized input file -class FAR STDDLL_API CInputBufFile : public CInputFile -{ - public: - CInputBufFile(); - virtual ~CInputBufFile(); - - static CInputBufFile* NewInstance(); - - int Create(HFILE hf); - int Create(HFILE hf, DWORD dwOffset, DWORD dwSize); - int Create(LPCSTR filename); - int Create(LPCSTR filename, DWORD dwOffset, DWORD dwSize); - int Create(LPCWSTR filename); - int Create(LPCWSTR filename, DWORD dwOffset, DWORD dwSize); - - virtual int Read(LPBYTE dest, DWORD lsize); - virtual int Read (LPBYTE dest, DWORD lsize, LPDWORD pRead); - virtual int ReadByte(LPBYTE dest); -// virtual int ReadWord(LPWORD dest); -// virtual int ReadDWord(LPDWORD dest); - virtual long GetPosition(); - virtual long GetLength(); - virtual long Seek(long pos, int method); - - virtual int Attach(HANDLE hnd); - virtual HANDLE Detach(); - -// virtual LPBYTE GetBuffer(UINT nSize); -// virtual void FreeBuffer(LPBYTE buf); - - virtual LPSTR GetFileNameA(); - virtual LPWSTR GetFileNameW(); - - protected: - int Attach(HANDLE hnd, DWORD dwOffset, DWORD dwSize); - private: - HFILE m_hf; - DWORD m_curpos; - LPBYTE m_buffer; - LPBYTE m_bufcurr; - DWORD m_remains; - LPWSTR m_fnameW; - LPSTR m_fnameA; - - DWORD m_startOffset; - DWORD m_length; -}; -typedef CInputBufFile FAR * LPINPUTBUFFILE; - -#define BUFFILE_BUFFER_SIZE 16384 - -// Memory input file -class FAR STDDLL_API CInputMemFile : public CInputFile -{ - public: - CInputMemFile(); - virtual ~CInputMemFile(); - - static CInputMemFile* NewInstance(); - - int Create(LPBYTE buffer, DWORD lsize); - int Create(DWORD lsize); - LPBYTE GetMemBuffer(); - - virtual int Read(LPBYTE dest, DWORD lsize); - virtual int Read (LPBYTE dest, DWORD lsize, LPDWORD pRead); - virtual int ReadByte(LPBYTE dest); -// virtual int ReadWord(LPWORD dest); -// virtual int ReadDWord(LPDWORD dest); - virtual long GetPosition(); - virtual long GetLength(); - virtual long Seek(long pos, int method); - - virtual int Attach(HANDLE hnd); - virtual HANDLE Detach(); - - virtual LPBYTE GetBuffer(UINT nSize); - virtual void FreeBuffer(LPBYTE buf); - - virtual LPSTR GetFileNameA() { return NULL; } - virtual LPWSTR GetFileNameW() { return NULL; } - - private: - LPBYTE m_buffer; - LPBYTE m_bufcurr; - DWORD m_curpos; - DWORD m_remains; - BOOL m_bAutoDelete; -}; -typedef CInputMemFile FAR * LPINPUTMEMFILE; - -// Output file: base class -class STDDLL_API COutputFile -{ - public: - COutputFile() {}; - virtual ~COutputFile() {}; - -// virtual int WriteByte(BYTE b) = 0; -// virtual int WriteWord(WORD b) = 0; - - int WriteIntelWord(LPWORD pw); - int WriteIntelDWord(LPDWORD pdw); - int WriteIntelFloat(PFLOAT dest); - int WriteMacWord(LPWORD pw); - int WriteMacDWord(LPDWORD pdw); - - virtual int Write(LPBYTE pb, UINT sz) = 0; - virtual int Flush() = 0; - virtual DWORD GetLength() = 0; - - virtual long GetPosition() = 0; - virtual long Seek(long pos, int method) = 0; - - virtual LPSTR GetFileNameA() = 0; - virtual LPWSTR GetFileNameW() = 0; -}; -typedef COutputFile FAR * LPOUTPUTFILE; - -// Memory output file -class STDDLL_API COutputMemFile : public COutputFile -{ - public: - COutputMemFile(); - virtual ~COutputMemFile(); - - int Create(UINT nBlockSize = 512); - int Create(LPBYTE buffer, DWORD nBufferSize = 0x7FFFFFF); - LPBYTE GetBuffer(); - LPBYTE DetachBuffer(); - static void FreeBuffer(LPBYTE pBuffer); // car il faut libérer à l'interieur de la DLL - - virtual int Write(LPBYTE pb, UINT sz); - virtual int Flush(); - virtual DWORD GetLength(); - - virtual long GetPosition(); - virtual long Seek(long pos, int method); - - virtual LPSTR GetFileNameA() { return NULL; } - virtual LPWSTR GetFileNameW() { return NULL; } - - private: - LPBYTE m_buffer; - LPBYTE m_curptr; - DWORD m_totalsize; - DWORD m_cursize; - DWORD m_blocksize; - BOOL m_bReallocable; -}; - -// Bufferized output file -class STDDLL_API COutputBufFile : public COutputFile -{ - public: - COutputBufFile(); - virtual ~COutputBufFile(); - - int Create(HFILE hf, UINT nBufferSize = 4096); - int Create(LPCSTR fname, UINT nBufferSize = 4096); - int Create(LPCWSTR fname, UINT nBufferSize = 4096); - - virtual int Write(LPBYTE pb, UINT sz); - virtual int Flush(); - virtual DWORD GetLength(); - - virtual long GetPosition(); - virtual long Seek(long pos, int method); - - virtual LPSTR GetFileNameA(); - virtual LPWSTR GetFileNameW(); - - private: - HFILE m_hf; - LPWSTR m_fnameW; - LPBYTE m_buffer; - LPBYTE m_curptr; - DWORD m_cursize; - DWORD m_buffersize; - BOOL m_bBuffered; - LPSTR m_fnameA; -}; - -#endif // _BFile_h - + +#ifndef _BFile_h +#define _BFile_h + +#ifndef LPLPVOID +typedef LPVOID FAR *LPLPVOID; +#endif + +#include "CfcError.h" +#include "StdDefs.h" + +#ifndef OF_READ +#define OF_READ 0x00000000 +#define OF_WRITE 0x00000001 +#define OF_READWRITE 0x00000002 +#define OF_SHARE_COMPAT 0x00000000 +#define OF_SHARE_EXCLUSIVE 0x00000010 +#define OF_SHARE_DENY_WRITE 0x00000020 +#define OF_SHARE_DENY_READ 0x00000030 +#define OF_SHARE_DENY_NONE 0x00000040 +#endif + +STDDLL_API HFILE WINAPI File_OpenA(LPCSTR fname, int mode); +STDDLL_API HFILE WINAPI File_CreateA(LPCSTR fname); +STDDLL_API int WINAPI File_Read (HFILE hf, LPVOID buf, DWORD len); +STDDLL_API int WINAPI File_ReadAndCount (HFILE hf, LPVOID buf, DWORD len); +STDDLL_API int WINAPI File_ReadShortIntelData (HFILE hf, LPLPVOID pBuf); +STDDLL_API int WINAPI File_ReadShortIntelString (HFILE hf, LPLPVOID pBuf); +STDDLL_API int WINAPI File_ReadLongIntelData (HFILE hf, LPLPVOID pBuf); +STDDLL_API int WINAPI File_Write (HFILE hf, LPVOID buf, DWORD len); +STDDLL_API DWORD WINAPI File_GetPosition (HFILE hf); +STDDLL_API DWORD WINAPI File_SeekBegin (HFILE hf, long pos); +STDDLL_API DWORD WINAPI File_SeekCurrent (HFILE hf, long pos); +STDDLL_API DWORD WINAPI File_SeekEnd (HFILE hf, long pos); +STDDLL_API long WINAPI File_GetLength ( HFILE hf ); +STDDLL_API void WINAPI File_Close(HFILE hf); +STDDLL_API BOOL WINAPI File_ExistA(LPCSTR pName); + +STDDLL_API HFILE WINAPI File_OpenW(LPCWSTR fname, int mode); +STDDLL_API HFILE WINAPI File_CreateW(LPCWSTR fname); +STDDLL_API BOOL WINAPI File_ExistW(LPCWSTR pName); + +#ifdef _UNICODE +#define File_Open File_OpenW +#define File_Create File_CreateW +#define File_Exist File_ExistW +#else +#define File_Open File_OpenA +#define File_Create File_CreateA +#define File_Exist File_ExistA +#endif + +#ifndef _MAC +#define File_ReadIntelWord(h,p,l) File_Read(h,p,l) +#define File_ReadIntelDWord(h,p,l) File_Read(h,p,l) +#else +int File_ReadIntelWord(HFILE hf, LPVOID buf, DWORD len); +int File_ReadIntelDWord(HFILE hf, LPVOID buf, DWORD len); +#endif + +// Input file - abstract class +class FAR STDDLL_API CInputFile +{ + public: + virtual ~CInputFile() {}; + + virtual void Delete(); + + virtual int Read(LPBYTE dest, DWORD lsize) = 0; + virtual int Read (LPBYTE dest, DWORD lsize, LPDWORD pRead) = 0; + virtual int ReadByte(LPBYTE dest) = 0; + virtual int ReadIntelWord(LPWORD dest); + virtual int ReadIntelDWord(LPDWORD dest); + virtual int ReadMacWord(LPWORD dest); + virtual int ReadMacDWord(LPDWORD dest); + virtual int ReadIntelFloat(PFLOAT dest); + virtual int ReadMacFloat(PFLOAT dest); + virtual int ReadIntelWordArray(LPWORD dest, int count); + virtual int ReadIntelDWordArray(LPDWORD dest, int count); + virtual int ReadIntelFloatArray(PFLOAT dest, int count); + virtual int ReadMacWordArray(LPWORD dest, int count); + virtual int ReadMacDWordArray(LPDWORD dest, int count); + virtual int ReadMacFloatArray(PFLOAT dest, int count); + + virtual long GetPosition() = 0; + virtual long GetLength() = 0; + virtual long Seek(long pos, int method) = 0; + + virtual int Attach(HANDLE hnd) = 0; + virtual HANDLE Detach() = 0; + + virtual LPBYTE GetBuffer(UINT nSize); + virtual void FreeBuffer(LPBYTE buf); + + virtual LPSTR GetFileNameA() = 0; + virtual LPWSTR GetFileNameW() = 0; + + #ifdef _CFCFILE_UNICODE_DEFS + #if defined(_UNICODE) + #define GetFileName GetFileNameW + #else + #define GetFileName GetFileNameA + #endif + #endif +}; +typedef CInputFile FAR * LPINPUTFILE; + +// Bufferized input file +class FAR STDDLL_API CInputBufFile : public CInputFile +{ + public: + CInputBufFile(); + virtual ~CInputBufFile(); + + static CInputBufFile* NewInstance(); + + int Create(HFILE hf); + int Create(HFILE hf, DWORD dwOffset, DWORD dwSize); + int Create(LPCSTR filename); + int Create(LPCSTR filename, DWORD dwOffset, DWORD dwSize); + int Create(LPCWSTR filename); + int Create(LPCWSTR filename, DWORD dwOffset, DWORD dwSize); + + virtual int Read(LPBYTE dest, DWORD lsize); + virtual int Read (LPBYTE dest, DWORD lsize, LPDWORD pRead); + virtual int ReadByte(LPBYTE dest); +// virtual int ReadWord(LPWORD dest); +// virtual int ReadDWord(LPDWORD dest); + virtual long GetPosition(); + virtual long GetLength(); + virtual long Seek(long pos, int method); + + virtual int Attach(HANDLE hnd); + virtual HANDLE Detach(); + +// virtual LPBYTE GetBuffer(UINT nSize); +// virtual void FreeBuffer(LPBYTE buf); + + virtual LPSTR GetFileNameA(); + virtual LPWSTR GetFileNameW(); + + protected: + int Attach(HANDLE hnd, DWORD dwOffset, DWORD dwSize); + private: + HFILE m_hf; + DWORD m_curpos; + LPBYTE m_buffer; + LPBYTE m_bufcurr; + DWORD m_remains; + LPWSTR m_fnameW; + LPSTR m_fnameA; + + DWORD m_startOffset; + DWORD m_length; +}; +typedef CInputBufFile FAR * LPINPUTBUFFILE; + +#define BUFFILE_BUFFER_SIZE 16384 + +// Memory input file +class FAR STDDLL_API CInputMemFile : public CInputFile +{ + public: + CInputMemFile(); + virtual ~CInputMemFile(); + + static CInputMemFile* NewInstance(); + + int Create(LPBYTE buffer, DWORD lsize); + int Create(DWORD lsize); + LPBYTE GetMemBuffer(); + + virtual int Read(LPBYTE dest, DWORD lsize); + virtual int Read (LPBYTE dest, DWORD lsize, LPDWORD pRead); + virtual int ReadByte(LPBYTE dest); +// virtual int ReadWord(LPWORD dest); +// virtual int ReadDWord(LPDWORD dest); + virtual long GetPosition(); + virtual long GetLength(); + virtual long Seek(long pos, int method); + + virtual int Attach(HANDLE hnd); + virtual HANDLE Detach(); + + virtual LPBYTE GetBuffer(UINT nSize); + virtual void FreeBuffer(LPBYTE buf); + + virtual LPSTR GetFileNameA() { return NULL; } + virtual LPWSTR GetFileNameW() { return NULL; } + + private: + LPBYTE m_buffer; + LPBYTE m_bufcurr; + DWORD m_curpos; + DWORD m_remains; + BOOL m_bAutoDelete; +}; +typedef CInputMemFile FAR * LPINPUTMEMFILE; + +// Output file: base class +class STDDLL_API COutputFile +{ + public: + COutputFile() {}; + virtual ~COutputFile() {}; + +// virtual int WriteByte(BYTE b) = 0; +// virtual int WriteWord(WORD b) = 0; + + int WriteIntelWord(LPWORD pw); + int WriteIntelDWord(LPDWORD pdw); + int WriteIntelFloat(PFLOAT dest); + int WriteMacWord(LPWORD pw); + int WriteMacDWord(LPDWORD pdw); + + virtual int Write(LPBYTE pb, UINT sz) = 0; + virtual int Flush() = 0; + virtual DWORD GetLength() = 0; + + virtual long GetPosition() = 0; + virtual long Seek(long pos, int method) = 0; + + virtual LPSTR GetFileNameA() = 0; + virtual LPWSTR GetFileNameW() = 0; +}; +typedef COutputFile FAR * LPOUTPUTFILE; + +// Memory output file +class STDDLL_API COutputMemFile : public COutputFile +{ + public: + COutputMemFile(); + virtual ~COutputMemFile(); + + int Create(UINT nBlockSize = 512); + int Create(LPBYTE buffer, DWORD nBufferSize = 0x7FFFFFF); + LPBYTE GetBuffer(); + LPBYTE DetachBuffer(); + static void FreeBuffer(LPBYTE pBuffer); // car il faut libérer à l'interieur de la DLL + + virtual int Write(LPBYTE pb, UINT sz); + virtual int Flush(); + virtual DWORD GetLength(); + + virtual long GetPosition(); + virtual long Seek(long pos, int method); + + virtual LPSTR GetFileNameA() { return NULL; } + virtual LPWSTR GetFileNameW() { return NULL; } + + private: + LPBYTE m_buffer; + LPBYTE m_curptr; + DWORD m_totalsize; + DWORD m_cursize; + DWORD m_blocksize; + BOOL m_bReallocable; +}; + +// Bufferized output file +class STDDLL_API COutputBufFile : public COutputFile +{ + public: + COutputBufFile(); + virtual ~COutputBufFile(); + + int Create(HFILE hf, UINT nBufferSize = 4096); + int Create(LPCSTR fname, UINT nBufferSize = 4096); + int Create(LPCWSTR fname, UINT nBufferSize = 4096); + + virtual int Write(LPBYTE pb, UINT sz); + virtual int Flush(); + virtual DWORD GetLength(); + + virtual long GetPosition(); + virtual long Seek(long pos, int method); + + virtual LPSTR GetFileNameA(); + virtual LPWSTR GetFileNameW(); + + private: + HFILE m_hf; + LPWSTR m_fnameW; + LPBYTE m_buffer; + LPBYTE m_curptr; + DWORD m_cursize; + DWORD m_buffersize; + BOOL m_bBuffered; + LPSTR m_fnameA; +}; + +#endif // _BFile_h + diff --git a/Inc/Cncy.h b/Inc/Cncy.h index c8513aa..dc0456a 100644 --- a/Inc/Cncy.h +++ b/Inc/Cncy.h @@ -1,1633 +1,1633 @@ - -#ifndef CNCY_H -#define CNCY_H - -#include "PictEdDefs.h" - -#ifdef __cplusplus -class cSurface; -class CImageFilterMgr; -class CSoundFilterMgr; -class CSoundManager; -class CRunApp; -class CRunFrame; -class CEditApp; -class CEditFrame; -class CMvt; -class CPropValue; -class OI; -class dllTrans; -class CValue; -#else -#define cSurface void -#define CImageFilterMgr void -#define CSoundFilterMgr void -#define CSoundManager void -#define CRunApp void -#define CRunFrame void -#define CEditApp void -#define CEditFrame void -#define CMvt void -#define CPropValue void -#define OI void -#define dllTrans void -struct CValue; -#endif -struct PropData; -struct RunHeader; - -// Force structure alignement -#ifndef _H2INC -#pragma pack( push, _pack_cncy_ ) -#pragma pack(2) -#endif - -#ifndef _H2INC - -// Object instance parent types -enum { - PARENT_NONE, - PARENT_FRAME, - PARENT_FRAMEITEM, - PARENT_QUALIFIER -}; - -// Proc definition -typedef void (WINAPI * UPDATEFILENAMEPROCA)(LPCSTR, LPSTR); -typedef void (WINAPI * UPDATEFILENAMEPROCW)(LPCWSTR, LPWSTR); -typedef void (WINAPI * UPDATEFILENAMEPROC)(LPCTSTR, LPTSTR); - -// Old object name size, still used in events -#ifndef OINAME_SIZE -#define OINAME_SIZE 24 -#endif // OINAME_SIZE - -// Obsolete -enum { - MODIF_SIZE, - MODIF_PLANE, - MODIF_FLAGS, - MODIF_PICTURE, - MODIF_HFRAN, - MODIF_BOX, - MODIF_TEXT, - MODIF_PREFS -}; -#define KPX_MODIF_BASE 1024 - -#endif // _H2INC - -// Standard objects -#define KPX_BASE 32 // Extensions -enum { - OBJ_BOX, - OBJ_BKD, - OBJ_SPR, - OBJ_TEXT, - OBJ_QUEST, - OBJ_SCORE, - OBJ_LIVES, - OBJ_COUNTER, - OBJ_RTF, - OBJ_CCA, - NB_SYSOBJ -}; - -// Menu header (v2) -typedef struct MenuHdr { - - DWORD mhHdrSize; // == sizeof(MenuHdr) - DWORD mhMenuOffset; // From start of MenuHdr - DWORD mhMenuSize; - DWORD mhAccelOffset; // From start of MenuHdr - DWORD mhAccelSize; - // Total data size = mhHdrSize + mhMenuSize + mhAccelSize -} MenuHdr; - -////////////////////////////////////////////////////////////////////////////// -// Application mini Header -// -typedef struct AppMiniHeader { - - union { - char gaType[4]; // "PAME" - DWORD gaDWType; - }; - WORD gaVersion; // Version number - WORD gaSubVersion; // Sub-version number - DWORD gaPrdVersion; // MMF version - DWORD gaPrdBuild; // MMF build number - -} AppMiniHeader; - -#define RUNTIME_DWTYPEA 'EMAP' -#define RUNTIME_DWTYPEW 'UMAP' -#define RUNTIME_DWTYPE_VTZA ' ZTV' -#define RUNTIME_DWTYPE_VTZW 'UZTV' - -#ifdef _UNICODE -#define RUNTIME_DWTYPE RUNTIME_DWTYPEW -#define RUNTIME_DWTYPE_VTZ RUNTIME_DWTYPE_VTZW -#else -#define RUNTIME_DWTYPE RUNTIME_DWTYPEA -#define RUNTIME_DWTYPE_VTZ RUNTIME_DWTYPE_VTZA -#endif -#define RUNTIME_VERSION_MMF1 0x0300 -#define RUNTIME_VERSION_MMF15 0x0301 -#define RUNTIME_VERSION_MMF2 0x0302 -#define RUNTIME_VERSION RUNTIME_VERSION_MMF2 - -////////////////////////////////////////////////////////////////////////////// -// Application full Header -// - -enum { - CTRLTYPE_MOUSE, // not used - CTRLTYPE_JOY1, - CTRLTYPE_JOY2, - CTRLTYPE_JOY3, - CTRLTYPE_JOY4, - CTRLTYPE_KEYBOARD, - MAX_CTRLTYPE -}; - -#define MAX_PLAYER 4 -#define MAX_KEY 8 -#define PLAYERNAME_SIZE 100 - -typedef struct PlayerCtrls { - - WORD pcCtrlType[MAX_PLAYER]; // Control type per player (0=mouse,1=joy1, 2=joy2, 3=keyb) - WORD pcCtrlKeys[MAX_PLAYER][MAX_KEY]; // Control keys per player - -} PlayerCtrls; -typedef PlayerCtrls* fpPlayerCtrls; - -typedef struct AppHeader { - - DWORD gaSize; // Structure size - WORD gaFlags; // Flags - WORD gaNewFlags; // New flags - WORD gaMode; // graphic mode - WORD gaOtherFlags; // Other Flags - short gaCxWin; // Window x-size - short gaCyWin; // Window y-size - DWORD gaScoreInit; // Initial score - DWORD gaLivesInit; // Initial number of lives - PlayerCtrls gaPlayerCtrls; - DWORD gaBorderColour; // Border colour - DWORD gaNbFrames; // Number of frames - DWORD gaFrameRate; // Number of frames per second - BYTE gaMDIWindowMenu; // Index of Window menu for MDI applications - BYTE gaFree[3]; - -} AppHeader; - -// gaFlags -#define GA_BORDERMAX 0x0001 -#define GA_NOHEADING 0x0002 -#define GA_PANIC 0x0004 -#define GA_SPEEDINDEPENDANT 0x0008 -#define GA_STRETCH 0x0010 -#define GA_LOADALLIMAGESATSTART 0x0020 -#define GA_LOADALLSOUNDSATSTART 0x0040 -#define GA_MENUHIDDEN 0x0080 -#define GA_MENUBAR 0x0100 -#define GA_MAXIMISE 0x0200 -#define GA_MIX 0x0400 -#define GA_FULLSCREENATSTART 0x0800 -#define GA_FULLSCREENSWITCH 0x1000 -#define GA_PROTECTED 0x2000 -#define GA_COPYRIGHT 0x4000 -#define GA_ONEFILE 0x8000 - -// gaNewFlags -#define GANF_SAMPLESOVERFRAMES 0x0001 -#define GANF_RELOCFILES 0x0002 -#define GANF_RUNFRAME 0x0004 -#define GANF_SAMPLESEVENIFNOTFOCUS 0x0008 - -// New in build 92 -#define GANF_NOMINIMIZEBOX 0x0010 -#define GANF_NOMAXIMIZEBOX 0x0020 -#define GANF_NOTHICKFRAME 0x0040 -#define GANF_DONOTCENTERFRAME 0x0080 - -// New in build 101 (MMF 1.5) -#define GANF_SCREENSAVER_NOAUTOSTOP 0x0100 -#define GANF_DISABLE_CLOSE 0x0200 - -// New in build 105 -#define GANF_HIDDENATSTART 0x0400 - -// New in build 110 -#define GANF_XPVISUALTHEMESUPPORT 0x0800 - -// New in MMF2 -#define GANF_VSYNC 0x1000 -#define GANF_RUNWHENMINIMIZED 0x2000 -#define GANF_MDI 0x4000 -#define GANF_RUNWHILERESIZING 0x8000 - -// Other flags -#define GAOF_DEBUGGERSHORTCUTS 0x0001 -#define GAOF_DDRAW 0x0002 -#define GAOF_DDRAWVRAM 0x0004 -#define GAOF_OBSOLETE 0x0008 -#define GAOF_AUTOIMGFLT 0x0010 -#define GAOF_AUTOSNDFLT 0x0020 -#define GAOF_ALLINONE 0x0040 -#define GAOF_SHOWDEBUGGER 0x0080 -#define GAOF_RESERVED_1 0x0100 -#define GAOF_RESERVED_2 0x0200 -#define GAOF_RESERVED_3 0x0400 -#define GAOF_RESERVED_4 0x0800 -#define GAOF_JAVASWING 0x1000 -#define GAOF_JAVAAPPLET 0x2000 -#define GAOF_D3D9 0x4000 -#define GAOF_D3D8 0x8000 - -// Optional header -typedef struct AppHeader2 { - - DWORD dwOptions; - DWORD dwBuildType; - DWORD dwBuildFlags; - WORD wScreenRatioTolerance; - WORD wScreenAngle; // 0 (no rotation/portrait), 1 (90 clockwise/landscape left), 2 (90 anticlockwise/landscape right), 3 (automatic portrait), 4 (automatic landscape), 5 (fully automatic) - DWORD dwUnused2; - -} AppHeader2; - -#define AH2OPT_KEEPSCREENRATIO 0x0001 -#define AH2OPT_FRAMETRANSITION 0x0002 // (HWA only) a frame has a transition -#define AH2OPT_RESAMPLESTRETCH 0x0004 // (HWA only) "resample when resizing" (works with "resize to fill window" option) -#define AH2OPT_GLOBALREFRESH 0x0008 // (Mobile) force global refresh -#define AH2OPT_MULTITASK 0x0010 // (iPhone) Multitask -#define AH2OPT_RTL 0x0020 // (Unicode) Right-to-left reading -#define AH2OPT_STATUSLINE 0x0040 // (iPhone/Android) Display status line -#define AH2OPT_RTLLAYOUT 0x0080 // (Unicode) Right-to-left layout -#define AH2OPT_ENABLEIAD 0x0100 // (iPhone) Enable iAd -#define AH2OPT_IADBOTTOM 0x0200 // (iPhone) Display ad at bottom -#define AH2OPT_AUTOEND 0x0400 // (Android) -#define AH2OPT_DISABLEBACKBUTTON 0x0800 // (Android) Disable Back button behavior -#define AH2OPT_ANTIALIASED 0x1000 // (iPhone) Smooth resizing on bigger screens -#define AH2OPT_CRASHREPORTING 0x2000 // (Android) Enable online crash reporting - -enum { - SCREENORIENTATION_PORTRAIT, - SCREENORIENTATION_LANDSCAPE_LEFT, - SCREENORIENTATION_LANDSCAPE_RIGHT, - SCREENORIENTATION_AUTO, - SCREENORIENTATION_LANDSCAPE_AUTO, - SCREENORIENTATION_PORTRAIT_AUTO, -}; - -#ifndef _H2INC - -// Build type values -enum { - BUILDTYPE_STANDALONE, - BUILDTYPE_SCREENSAVER, - BUILDTYPE_INTERNETAPP, - BUILDTYPE_JAVA, - BUILDTYPE_JAVASTANDALONE, - BUILDTYPE_JAVAAPPLET, - BUILDTYPE_JAVAWEBSTART, - BUILDTYPE_JAVAMOBILE, - BUILDTYPE_JAVABLURAY, - BUILDTYPE_JAVAMAC, - BUILDTYPE_FLASH, - BUILDTYPE_JAVABLACKBERRY, - BUILDTYPE_ANDROID, - BUILDTYPE_IPHONE, - BUILDTYPE_IPHONEDEVEL, - BUILDTYPE_IPHONEFINAL, - BUILDTYPE_XNA_WINDOWS_APP, - BUILDTYPE_MAC, - BUILDTYPE_XNA_WINDOWS, - BUILDTYPE_XNA_XBOX, - BUILDTYPE_XNA_PHONE, - BUILDTYPE_XNA_XBOX_APP, - BUILDTYPE_XNA_PHONE_APP, - BUILDTYPE_STDMAX, // end of standard build types -}; - -// Build flag values -#define BUILDFLAG_MAXCOMP 0x0001 -#define BUILDFLAG_COMPSND 0x0002 -#define BUILDFLAG_INCLUDEEXTFILES 0x0004 -#define BUILDFLAG_MANUALIMGFILTERS 0x0008 -#define BUILDFLAG_MANUALSNDFILTERS 0x0010 -#define BUILDFLAG_NOAUTOEXTRACT 0x0020 -#define BUILDFLAG_NOAPPLETCHECK 0x0040 -#define BUILDFLAG_TEST 0x0080 -#define BUILDFLAG_NOWARNINGS 0x0100 - -#endif - -////////////////////////////////////////////////////////////////////////////// -// Element of chunk Extensions -// -#ifndef _H2INC -typedef struct ExtDesc { - WORD extSize; - WORD extIndex; - DWORD extMagicNumber; -} ExtDesc; -typedef ExtDesc *LPEXTDESC; - -typedef struct ExtDesc2 { - WORD extSize; - WORD extIndex; - DWORD extMagicNumber; - DWORD extVersionLS; - DWORD extVersionMS; -} ExtDesc2; -typedef ExtDesc2 *LPEXTDESC2; -#endif - -////////////////////////////////////////////////////////////////////////////// -// Movement Extensions Chunk -// -typedef struct MvtExtDesc { - WORD extTotalSize; - WORD extHdrSize; - DWORD extBuild; -} MvtExtDesc; -typedef MvtExtDesc *LPMVTEXTDESC; - -////////////////////////////////////////////////////////////////////////////// -// Frame Header -// -typedef struct FrameHeader -{ - // Playfield - LONG leWidth; // Playfield width in pixels - LONG leHeight; // Playfield height in pixels - COLORREF leBackground; - - // Options - DWORD leFlags; - - -} FrameHeader; - -// leFlags -#define LEF_DISPLAYNAME 0x0001 -#define LEF_GRABDESKTOP 0x0002 -#define LEF_KEEPDISPLAY 0x0004 -//#define LEF_FADEIN 0x0008 -//#define LEF_FADEOUT 0x0010 -#define LEF_TOTALCOLMASK 0x0020 -#define LEF_PASSWORD 0x0040 -#define LEF_RESIZEATSTART 0x0100 -#define LEF_DONOTCENTER 0x0200 -#define LEF_FORCE_LOADONCALL 0x0400 -#define LEF_NOSURFACE 0x0800 -#define LEF_RESERVED_1 0x1000 -#define LEF_RESERVED_2 0x2000 -#define LEF_RECORDDEMO 0x4000 -#define LEF_TIMEDMVTS 0x8000 - -////////////////////////////////////////////////////////////////////////////// -// Layers -// - -#define FLOPT_XCOEF 0x0001 -#define FLOPT_YCOEF 0x0002 -#define FLOPT_NOSAVEBKD 0x0004 -#define FLOPT_WRAP_OBSOLETE 0x0008 -#define FLOPT_VISIBLE 0x0010 -#define FLOPT_WRAP_HORZ 0x0020 -#define FLOPT_WRAP_VERT 0x0040 -#define FLOPT_PREVIOUSEFFECT 0x0080 -#define FLOPT_REDRAW 0x000010000 -#define FLOPT_TOHIDE 0x000020000 -#define FLOPT_TOSHOW 0x000040000 - -typedef struct EditFrameLayer -{ - DWORD dwOptions; // Options - float xCoef; - float yCoef; - DWORD nBkdLOs; - DWORD nFirstLOIndex; - -} EditFrameLayer; - -typedef struct EditFrameLayerEffect { - - DWORD dwInkFx; - DWORD dwRGBA; - DWORD dwExtInkFxIdx; - DWORD nParams; - LPARAM paramData; // offset - -} EditFrameLayerEffect; - -// Effects -#ifdef HWABETA - -typedef struct EffectHdr { - DWORD dwEffectNameOffset; - DWORD dwEffectDataOffset; - DWORD dwEffectParamsOffset; - DWORD dwOptions; -} EffectHdr; - -#define EFFECTOPT_BKDTEXTUREMASK 0x000F - -typedef struct EffectParamsHdr { - DWORD dwNParams; - DWORD dwParamTypesOffset; - DWORD dwParamNamesOffset; -} EffectParamsHdr; - -typedef struct EffectRunData { - - DWORD erdEffectIndex; - DWORD erdNParams; -} EffectRunData; - -typedef struct FrameEffect { - - DWORD ffxInkEffect; - DWORD ffxInkEffectParam; -} FrameEffect; - -#endif - -////////////////////////////////////////////////////////////////////////////// -// ObjInfo/FrameItem Header -// -typedef struct ObjInfoHeader -{ - WORD oiHandle; - WORD oiType; - WORD oiFlags; // Memory flags - WORD oiReserved; // No longer used - DWORD oiInkEffect; // Ink effect - DWORD oiInkEffectParam; // Ink effect param - -} ObjInfoHeader; - -// oiFlags -#define OIF_LOADONCALL 0x0001 -#define OIF_DISCARDABLE 0x0002 -#define OIF_GLOBAL 0x0004 -#define OIF_RESERVED_1 0x0008 -#define OIF_GLOBAL_EDITOR_NOSYNC 0x0010 -#define OIF_GLOBAL_EDITOR_FORCESYNC 0x0020 - -////////////////////////////////////////////////////////////////////////////// -// LevObj/FrameItemInstance -// - -#ifndef _H2INC -#ifdef __cplusplus -class diskLO { -public: -#else -typedef struct diskLO { -#endif - WORD loHandle; // HLO - WORD loOiHandle; // HOI - LONG loX; // Coords - LONG loY; - WORD loParentType; // Parent type - WORD loOiParentHandle; // HOI Parent - WORD loLayer; // Layer - WORD loFree; // Not used -#ifdef __cplusplus -}; -#else -} diskLO; -#endif -typedef diskLO * fpDiskLO; -#endif - -////////////////////////////////////////////////////////////////////////////// -// -// ObjInfo/FrameItem ObjectsCommon -// - -// Obstacle types -enum { - OBSTACLE_NONE, - OBSTACLE_SOLID, - OBSTACLE_PLATFORM, - OBSTACLE_LADDER, - OBSTACLE_TRANSPARENT // for Add Backdrop -}; - -//////////////////////////////// -// Static object - ObjectsCommon -// -#ifndef _H2INC -typedef struct Static_OC { - - // Size - DWORD ocDWSize; - - // Obstacle type & collision mode - WORD ocObstacleType; - WORD ocColMode; // Collision mode (0 = fine, 1 = box) - - LONG ocCx; // Size - LONG ocCy; - -} Static_OC; -typedef Static_OC * LPStatic_OC; -#endif - -/////////////////////////////////////////////////////////////// -// Fill Type & shapes - Definitions -// - -#ifndef _H2INC -// Gradient -typedef struct GradientData { - COLORREF color1; - COLORREF color2; - DWORD vertical; -} GradientData; - -// Shapes -enum { - SHAPE_NONE=0, // Error - SHAPE_LINE, - SHAPE_RECTANGLE, - SHAPE_ELLIPSE -}; - -// Fill types -enum { - FILLTYPE_NONE, - FILLTYPE_SOLID, - FILLTYPE_GRADIENT, - FILLTYPE_MOTIF -}; - -// Line flags -#define LINEF_INVX 0x0001 -#define LINEF_INVY 0x0002 - -#endif - -/////////////////////////////////////////////////////////////// -// Fill Type - Part of FilledShape -// -#ifndef _H2INC - -#ifdef __cplusplus -class FillType_Data { -public: -#else -typedef struct FillType_Data { -#endif - WORD ocFillType; - union { - struct { - DWORD ocLineFlags; // Only for lines in non filled mode - }; - struct { - COLORREF ocColor; // Solid - }; - struct { - COLORREF ocColor1; // Gradient - COLORREF ocColor2; - DWORD ocGradientFlags; - }; - struct { - WORD ocImage; // Image - }; - }; -#ifdef __cplusplus -}; -#else -} FillType_Data; -#endif - -#endif - -/////////////////////////////////////////////////////////////// -// Filled Shape - Part of QuickBackdrop / Counter ObjectsCommon -// -#ifndef _H2INC - -#ifdef __cplusplus -class FilledShape_Data { -public: -#else -typedef struct FilledShape_Data { -#endif - WORD ocBorderSize; // Border - COLORREF ocBorderColor; - WORD ocShape; // Shape - FillType_Data ocFillData; // Fill Type infos -#ifdef __cplusplus -}; -#else -} FilledShape_Data; -#endif -typedef FilledShape_Data * LPFilledShape_Data; - -#endif - -///////////////////////////////// -// Quick backdrop - ObjectsCommon -// -#ifndef _H2INC - -typedef struct QuickBackdrop_OC { - - DWORD ocDWSize; - - WORD ocObstacleType; // Obstacle type - WORD ocColMode; // Collision mode (0 = fine, 1 = box) - - LONG ocCx; // Size - LONG ocCy; - - FilledShape_Data ocFilledShape; // Filled shape infos - -} QuickBackdrop_OC; -typedef QuickBackdrop_OC * LPQuickBackdrop_OC; - -#endif - -///////////////////////////////// -// Backdrop - ObjectsCommon -// -#ifndef _H2INC - -typedef struct Backdrop_OC { - - DWORD ocDWSize; - - WORD ocObstacleType; // Obstacle type - WORD ocColMode; // Collision mode (0 = fine, 1 = box) - - LONG ocCx; // Size - LONG ocCy; - - WORD ocImage; // Image - -} Backdrop_OC; -typedef Backdrop_OC * LPBackdrop_OC; - -#endif - -////////////////////////////////////////////////////////////////////////////// -// -// ObjInfo/FrameItem ObjectsCommon Data -// - -////////////////////////////////////////////////////////////////////////////// -// ImageSet -// - -#ifdef __cplusplus -class ImageSet_Data { -public: -#else -typedef struct ImageSet_Data { -#endif - WORD nbFrames; // Number of frames - // Followed by list of image handles (WORD[]) -#ifdef __cplusplus -}; -#else -} ImageSet_Data; -#endif -typedef ImageSet_Data * LPImageSet_Data; - -//////////////////////////////////////// -// Text - ocData -// -typedef struct otText { - - DWORD otDWSize; - LONG otCx; - LONG otCy; - DWORD otNumberOfText; // Paragraph number (> 1 if question object) - DWORD otStringOffset[1]; // String offsets - -} otText; -typedef otText * fpot; -#define sizeof_ot (sizeof(otText)-sizeof(DWORD)) - -typedef struct txString { - WORD tsFont; // Font - WORD tsFlags; // Flags - COLORREF tsColor; // Color - TCHAR tsChar[1]; -} txString; -typedef txString * fpts; -#define sizeof_ts 8 // (sizeof(txString)-1) - -#define TSF_LEFT 0x0000 // DT_LEFT -#define TSF_HCENTER 0x0001 // DT_CENTER -#define TSF_RIGHT 0x0002 // DT_RIGHT -#define TSF_VCENTER 0x0004 // DT_VCENTER -#define TSF_HALIGN 0x000F // DT_LEFT | DT_RIGHT | DT_CENTER | DT_VCENTER | DT_BOTTOM - -#define TSF_CORRECT 0x0100 -#define TSF_RELIEF 0x0200 -#define TSF_RTL 0x0400 - -//////////////////////////////////////// -// Scores, lives, counters -// -typedef struct CtAnim_Data { - - DWORD odDWSize; - LONG odCx; // Size: only lives & counters - LONG odCy; - WORD odPlayer; // Player: only score & lives - WORD odDisplayType; // CTA_xxx - WORD odDisplayFlags; // BARFLAG_INVERSE - WORD odFont; // Font - - // Followed by display data: -// union { -// ImageSet_Data odImages; -// FilledShape_Data odShape; -// }; - -} CtAnim_Data; -typedef CtAnim_Data * LPCtAnim_Data; - -// Display types -enum { - CTA_HIDDEN, - CTA_DIGITS, - CTA_VBAR, - CTA_HBAR, - CTA_ANIM, - CTA_TEXT, -}; - -// Display flags -#define CPTDISPFLAG_INTNDIGITS 0x000F // 0 = normal display, other value = pad with zeros or truncate -#define CPTDISPFLAG_FLOATNDIGITS 0x00F0 // add 1 to get the number of significant digits to display -#define CPTDISPFLAG_FLOATNDIGITS_SHIFT 4 -#define CPTDISPFLAG_FLOATNDECIMALS 0xF000 // number of digits to display after the decimal point -#define CPTDISPFLAG_FLOATNDECIMALS_SHIFT 12 -#define BARFLAG_INVERSE 0x0100 -#define CPTDISPFLAG_FLOAT_FORMAT 0x0200 // 1 to use the specified numbers of digits, 0 to use standard display (%g) -#define CPTDISPFLAG_FLOAT_USENDECIMALS 0x0400 // 1 to use the specified numbers of digits after the decimal point -#define CPTDISPFLAG_FLOAT_PADD 0x0800 // 1 to left padd with zeros - -// Counters images -enum { - COUNTER_IMAGE_0, - COUNTER_IMAGE_1, - COUNTER_IMAGE_2, - COUNTER_IMAGE_3, - COUNTER_IMAGE_4, - COUNTER_IMAGE_5, - COUNTER_IMAGE_6, - COUNTER_IMAGE_7, - COUNTER_IMAGE_8, - COUNTER_IMAGE_9, - COUNTER_IMAGE_SIGN_NEG, - COUNTER_IMAGE_SIGN_PLUS, - COUNTER_IMAGE_POINT, - COUNTER_IMAGE_EXP, - COUNTER_IMAGE_MAX -}; -#define V1_COUNTER_IMAGE_MAX (COUNTER_IMAGE_SIGN_NEG+1) - -//////////////////////////////////////// -// -// Objet RTF - ocData -// -#ifndef _H2INC - -typedef struct ocRTF { - - DWORD odDWSize; - DWORD odVersion; // 0 - DWORD odOptions; // Options - COLORREF odBackColor; // Background color - LONG odCx; // Size - LONG odCy; - -} ocRTF; -typedef ocRTF * LPOCRTF; - -//#define RTFOPT_TRANSPARENT 0x0001 // Transparent -//#define RTFOPT_VSLIDER 0x0002 // Display vertical slider if necessary -//#define RTFOPT_HSLIDER 0x0004 // Display horizontal slider if necessary - -#endif - -//////////////////////////////////////// -// -// Objet CCA - ocData -// -#ifndef _H2INC - -typedef struct ocCCA { - - DWORD odDWSize; - LONG odCx; // Size (ignored) - LONG odCy; - WORD odVersion; // 0 - WORD odNStartFrame; - DWORD odOptions; // Options - DWORD odIconOffset; // Icon offset - DWORD odFree; // Free - -} ocCCA; -typedef ocCCA * LPOCCCA; - -// Options -#define CCAF_SHARE_GLOBALVALUES 0x00000001 -#define CCAF_SHARE_LIVES 0x00000002 -#define CCAF_SHARE_SCORES 0x00000004 -#define CCAF_SHARE_WINATTRIB 0x00000008 -#define CCAF_STRETCH 0x00000010 -#define CCAF_POPUP 0x00000020 -#define CCAF_CAPTION 0x00000040 -#define CCAF_TOOLCAPTION 0x00000080 -#define CCAF_BORDER 0x00000100 -#define CCAF_WINRESIZE 0x00000200 -#define CCAF_SYSMENU 0x00000400 -#define CCAF_DISABLECLOSE 0x00000800 -#define CCAF_MODAL 0x00001000 -#define CCAF_DIALOGFRAME 0x00002000 -#define CCAF_INTERNAL 0x00004000 -#define CCAF_HIDEONCLOSE 0x00008000 -#define CCAF_CUSTOMSIZE 0x00010000 -#define CCAF_INTERNALABOUTBOX 0x00020000 -#define CCAF_CLIPSIBLINGS 0x00040000 -#define CCAF_SHARE_PLAYERCTRLS 0x00080000 -#define CCAF_MDICHILD 0x00100000 -#define CCAF_DOCKED 0x00200000 -#define CCAF_DOCKING_AREA 0x00C00000 -#define CCAF_DOCKED_LEFT 0x00000000 -#define CCAF_DOCKED_TOP 0x00400000 -#define CCAF_DOCKED_RIGHT 0x00800000 -#define CCAF_DOCKED_BOTTOM 0x00C00000 -#define CCAF_REOPEN 0x01000000 -#define CCAF_MDIRUNEVENIFNOTACTIVE 0x02000000 -#define CCAF_DISPLAYASSPRITE 0x04000000 - -#endif - -//////////////////////////////////////// -// -// Transition -// - -#ifndef _H2INC - -// Transition header -typedef struct TransitionHdr { - DWORD trDllID; // DLL id - DWORD trID; // Transition ID - DWORD trDuration; // Duration - DWORD trFlags; // From / to color / background - DWORD trColor; // Color -} TransitionHdr; - -// Transition run-time data -#ifdef __cplusplus -class Transition_Data { -public: -#else -typedef struct Transition_Data { -#endif - TransitionHdr trHdr; - DWORD trDllNameOffset; - DWORD trParamsOffset; - DWORD trParamsSize; - // Followed by DLL name & transition parameters -#ifdef __cplusplus -}; -#else -} Transition_Data; -#endif -typedef Transition_Data * LPTRANSITIONDATA; - -#define TRFLAG_COLOR 0x0001 -#define TRFLAG_UNICODE 0x0002 - -#endif - -// Text alignment flags -#define TEXT_ALIGN_LEFT 0x00000001 -#define TEXT_ALIGN_HCENTER 0x00000002 -#define TEXT_ALIGN_RIGHT 0x00000004 -#define TEXT_ALIGN_TOP 0x00000008 -#define TEXT_ALIGN_VCENTER 0x00000010 -#define TEXT_ALIGN_BOTTOM 0x00000020 - -// Right-to-left ordering -#define TEXT_RTL 0x00000100 - -// Text caps -#define TEXT_FONT 0x00010000 -#define TEXT_COLOR 0x00020000 -#define TEXT_COLOR16 0x00040000 - -////////////////////////////////////////////////////////////////////////////// -// -// Run-time Definitions -// - -#ifdef RUN_TIME - -#ifndef _H2INC -typedef short * LPSHORT; -typedef LPVOID * LPLPVOID; -#endif - -// Versions -#define KNPV1_VERSION 0x126 // First K&P version -#define CNCV1_VERSION 0x207 // Click & Create / The Games Factory -#define KNP_VERSION 0x300 - -// Internet Versions -#define FIRST_NETVERSION 0x001 // First vitalize version -#define CCN_NETVERSION 0x002 // CCN applications -#define MORECOMP_NETVERSION 0x003 // Short OIs, compression of levObjs, adpcm sounds, -#define CNC_NETVERSION 0x003 // Current Internet Version - -// Collision mask margins -#define COLMASK_XMARGIN 64 -#define COLMASK_YMARGIN 16 - -// Messages -#define UM_KNP_GETAPPID (WM_APP+7) // No longer used -#define UM_HVSCROLL (WM_APP+8) // No longer used - -// App IDs -#define APPID_KNC 0x3952 // No longer used -#define APPID_KNCSA 0x9172 // No longer used - -// Control IDs -#define ID_EDIT_WIN 300 // ID of edit window - -#endif // RUN_TIME - -// No longer used -#ifndef HFRAN -#define HFRAN LPBYTE -#endif - -// HLO -#define HLO WORD -#define HLO_ERROR ((HLO)-1) -typedef HLO * LPHLO; - -// Frame password size -#define PASSWORD_SIZE 9 - -// Cross-ref tables -enum { - IMG_TAB, - FONT_TAB, - SOUND_TAB, - MUSIC_TAB, - MAX_TABREF -}; - -#ifdef RUN_TIME - -// Preferences -#define PREF_MUSICON 0x4000 -#define PREF_SOUNDON 0x8000 - -// Frame handles -#define HCELL WORD -#define HCELL_ERROR ((WORD)-1) - -// Jump flags -#define MPJC_NOJUMP 0 -#define MPJC_DIAGO 1 -#define MPJC_BUTTON1 2 -#define MPJC_BUTTON2 3 - -// How to play (no longer used) -enum { - HTP_NO=0, - HTP_TXT, - HTP_WRI, - HTP_HLP -}; -#define NB_HTPTYPE 4 - -#endif // RUN_TIME - -// Versions -#define MMFVERSION_MASK 0xFFFF0000 -#define MMFBUILD_MASK 0x00000FFF // MMF build -#define MMFVERFLAG_MASK 0x0000F000 -#define MMFVERFLAG_HOME 0x00008000 // TGF -#define MMFVERFLAG_PRO 0x00004000 // MMF Pro -#define MMFVERFLAG_DEMO 0x00002000 // Demo -#define MMFVERFLAG_PLUGIN 0x00001000 // Plugin -#define MMFVERSION_15 0x01050000 // MMF 1.5 -#define MMFVERSION_20 0x02000000 // MMF 2.0 -#define MMF_CURRENTVERSION MMFVERSION_20 - -// Build numbers -#define MMF_BUILD_NONAME 203 -#define MMF_BUILD_MENUIMAGES 204 -#define MMF_BUILD_SUBAPPICON 205 -#define MMF_BUILD_WINMENUIDX 206 -#define MMF_BUILD_NOTUSED 207 -#define MMF_BUILD_ABOUTTEXT 208 -#define MMF_BUILD_FRAMEDPOS 209 -#define MMF_BUILD_TRSPCOLOR 210 -#define MMF_BUILD_211 211 -#define MMF_BUILD_DEMO 212 -#define MMF_BUILD_PREBETA_2 213 -#define MMF_BUILD_PREBETA_3 214 -#define MMF_BUILD_PREBETA_4 215 // First update Jason's book -#define MMF_BUILD_ALTVALUES 216 -#define MMF_BUILD_EDTCHUNKS 217 -#define MMF_BUILD_COUNTERTEXT 218 -#define MMF_BUILD_SDK 219 // Pre-SDK version -#define MMF_BUILD_SDK2 220 // Second SDK version -#define MMF_BUILD_MVTSDK2 221 // Second Mvt SDK version -#define MMF_BUILD_FIXCOLLISANDBEH 222 -#define MMF_BUILD_PROPFILTERS 223 -#define MMF_BUILD_MFXEXTS 224 -#define MMF_BUILD_LASTFRAMEOFFSET 225 -#define MMF_BUILD_EDUDEMOFEB06 226 -#define MMF_BUILD_GLBOBJBUG 227 -#define MMF_BUILD_IDTC 228 -#define MMF_BUILD_229 229 -#define MMF_BUILD_230 230 -#define MMF_BUILD_231 231 -#define MMF_BUILD_FIXQUALIF 232 -#define MMF_BUILD_233 233 -#define MMF_BUILD_234_TGFPR 234 -#define MMF_BUILD_235 235 -#define MMF_BUILD_236 236 -#define MMF_BUILD_237 237 -#define MMF_BUILD_238 238 -#define MMF_BUILD_239_CD 239 -#define MMF_BUILD_240_DEMO 240 -#define MMF_BUILD_241_SP1 241 -#define MMF_BUILD_242_SP2 242 -#define MMF_BUILD_243_SP3 243 -#define MMF_BUILD_244_SP4 244 -#define MMF_BUILD_245_SP5 245 -#define MMF_BUILD_246_SP6 246 -#define MMF_BUILD_247_SP7 247 -#define MMF_BUILD_248_JAVA 248 -#define MMF_BUILD_249_MOBILE_FLASH 249 -#define MMF_BUILD_250 250 -#define MMF_BUILD_251 251 -#define MMF_BUILD_252 252 -#define MMF_BUILD_253 253 -#define MMF_BUILD_254 254 -#define MMF_CURRENTBUILD MMF_BUILD_254 - -// MFA file format versions -#define MFA_BUILD_ALTSTR 1 // Alterable strings -#define MFA_BUILD_COUNTERTEXT 2 // Text mode in counters -#define MFA_BUILD_LASTFRAMEOFFSET 3 // Additional frame offset -#define MFA_BUILD_FIXQUALIF 4 // Fix in qualifiers + prd version -#ifdef _UNICODE -#define MFA_BUILD_LANGID 5 // Language ID -#define MFA_CURRENTBUILD MFA_BUILD_LANGID -#else -#define MFA_CURRENTBUILD MFA_BUILD_FIXQUALIF -#endif - -// Structures for picture editor -typedef struct EditSurfaceParamsA { - - DWORD m_dwSize; // sizeof(EditSurfaceParams) - LPSTR m_pWindowTitle; // Picture Editor title (NULL = default title) - cSurface* m_pSf; // Surface to edit - DWORD m_dwOptions; // Options, see PictEdDefs.h - DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) - DWORD m_dwFixedHeight;// Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) - POINT m_hotSpot; // Hot spot coordinates - POINT m_actionPoint; // Action point coordinates - -} EditSurfaceParamsA; -typedef EditSurfaceParamsA* LPEDITSURFACEPARAMSA; - -typedef struct EditSurfaceParamsW { - - DWORD m_dwSize; // sizeof(EditSurfaceParams) - LPWSTR m_pWindowTitle; // Picture Editor title (NULL = default title) - cSurface* m_pSf; // Surface to edit - DWORD m_dwOptions; // Options, see PictEdDefs.h - DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) - DWORD m_dwFixedHeight;// Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) - POINT m_hotSpot; // Hot spot coordinates - POINT m_actionPoint; // Action point coordinates - -} EditSurfaceParamsW; -typedef EditSurfaceParamsW* LPEDITSURFACEPARAMSW; - -#ifdef _UNICODE -#define EditSurfaceParams EditSurfaceParamsW -typedef EditSurfaceParamsW* LPEDITSURFACEPARAMS; -#else -#define EditSurfaceParams EditSurfaceParamsA -typedef EditSurfaceParamsA* LPEDITSURFACEPARAMS; -#endif - -typedef struct EditImageParamsA { - - DWORD m_dwSize; // sizeof(EditImageParams) - LPSTR m_pWindowTitle; // Picture Editor title (NULL = default title) - DWORD m_dwImage; // Image to edit - note: only the LOWORD is used in this version - DWORD m_dwOptions; // Options, see PictEdDefs.h - DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) - DWORD m_dwFixedHeight; // Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) - -} EditImageParamsA; -typedef EditImageParamsA* LPEDITIMAGEPARAMSA; - -typedef struct EditImageParamsW { - - DWORD m_dwSize; // sizeof(EditImageParams) - LPWSTR m_pWindowTitle; // Picture Editor title (NULL = default title) - DWORD m_dwImage; // Image to edit - note: only the LOWORD is used in this version - DWORD m_dwOptions; // Options, see PictEdDefs.h - DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) - DWORD m_dwFixedHeight; // Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) - -} EditImageParamsW; -typedef EditImageParamsW* LPEDITIMAGEPARAMSW; - -#ifdef _UNICODE -#define EditImageParams EditImageParamsW -typedef EditImageParamsW* LPEDITIMAGEPARAMS; -#else -#define EditImageParams EditImageParamsA -typedef EditImageParamsA* LPEDITIMAGEPARAMS; -#endif - -// Structure for image list editor -typedef struct EditAnimationParamsA { - - DWORD m_dwSize; // sizeof(EditAnimationParams) - LPSTR m_pWindowTitle; // Picture Editor title (NULL = default title) - int m_nImages; // Number of images in the list - int m_nMaxImages; // Maximum number of images in the list - int m_nStartIndex; // Index of first image to edit in the editor - LPWORD m_pImages; // Image list (one WORD per image) - LPSTR* m_pImageTitles; // Image titles (can be NULL) - DWORD m_dwOptions; // Options, see PictEdDefs.h - DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) - DWORD m_dwFixedHeight; // Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) - -} EditAnimationParamsA; -typedef EditAnimationParamsA* LPEDITANIMATIONPARAMSA; - -typedef struct EditAnimationParamsW { - - DWORD m_dwSize; // sizeof(EditAnimationParams) - LPWSTR m_pWindowTitle; // Picture Editor title (NULL = default title) - int m_nImages; // Number of images in the list - int m_nMaxImages; // Maximum number of images in the list - int m_nStartIndex; // Index of first image to edit in the editor - LPWORD m_pImages; // Image list (one WORD per image) - LPWSTR* m_pImageTitles; // Image titles (can be NULL) - DWORD m_dwOptions; // Options, see PictEdDefs.h - DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) - DWORD m_dwFixedHeight; // Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) - -} EditAnimationParamsW; -typedef EditAnimationParamsW* LPEDITANIMATIONPARAMSW; - -#ifdef _UNICODE -#define EditAnimationParams EditAnimationParamsW -typedef EditAnimationParamsW* LPEDITANIMATIONPARAMS; -#else -#define EditAnimationParams EditAnimationParamsA -typedef EditAnimationParamsA* LPEDITANIMATIONPARAMS; -#endif - -// Global variables structure -#ifdef __cplusplus -class mv { -public: -#else -typedef struct mv { -#endif - - // Common to editor and runtime - HINSTANCE mvHInst; // Application HINSTANCE - npAppli mvIdAppli; // Application object in DLL - npWin mvIdMainWin; // Main window object in DLL - npWin mvIdEditWin; // Child window object in DLL - HWND mvHMainWin; // Main window handle - HWND mvHEditWin; // Child window handle - HPALETTE mvHPal256; // 256 color palette - WORD mvAppMode; // Screen mode with flags - WORD mvScrMode; // Screen mode - DWORD mvEditDXDocToClient; // Edit time only: top-left coordinates - DWORD mvEditDYDocToClient; - CImageFilterMgr* mvImgFilterMgr; // Image filter manager - CSoundFilterMgr* mvSndFilterMgr; // Sound filter manager - CSoundManager* mvSndMgr; // Sound manager - - union { - CEditApp* mvEditApp; // Current application, edit time (not used) - CRunApp* mvRunApp; // Current application, runtime - }; - union { - CEditFrame* mvEditFrame; - CRunFrame* mvRunFrame; - }; - - // Runtime - #ifdef __cplusplus - RunHeader* mvRunHdr; // Current RunHeader - #else - LPVOID mvRunHdr; - #endif - DWORD mvPrefs; // Preferences (sound on/off) - LPTSTR subType; - BOOL mvFullScreen; // Full screen mode - LPTSTR mvMainAppFileName; // App filename - int mvAppListCount; - int mvAppListSize; - CRunApp** mvAppList; - int mvExtListCount; - int mvExtListSize; - LPTSTR * mvExtList; - int mvNbDllTrans; - dllTrans* mvDllTransList; - DWORD mvJoyCaps[32]; - HHOOK mvHMsgHook; - int mvModalLoop; - int mvModalSubAppCount; - LPVOID mvFree[5]; - - // Functions - //////////// - - // Editor: Open Help file - void (CALLBACK * mvHelpA) (LPCSTR pHelpFile, UINT nID, LPARAM lParam); - - // Editor: Get default font for object creation - BOOL (CALLBACK * mvGetDefaultFontA) (LPLOGFONTA plf, LPSTR pStyle, int cbSize); - - // Editor: Edit images and animations - BOOL (CALLBACK * mvEditSurfaceA) (LPVOID edPtr, LPEDITSURFACEPARAMSA pParams, HWND hParent); - BOOL (CALLBACK * mvEditImageA) (LPVOID edPtr, LPEDITIMAGEPARAMSA pParams, HWND hParent); - BOOL (CALLBACK * mvEditAnimationA) (LPVOID edPtr, LPEDITANIMATIONPARAMSA pParams, HWND hParent); - - // Runtime: Extension User data - LPVOID (CALLBACK * mvGetExtUserData) (CRunApp* pApp, HINSTANCE hInst); - LPVOID (CALLBACK * mvSetExtUserData) (CRunApp* pApp, HINSTANCE hInst, LPVOID pData); - - // Runtime: Register dialog box - void (CALLBACK * mvRegisterDialogBox) (HWND hDlg); - void (CALLBACK * mvUnregisterDialogBox) (HWND hDlg); - - // Runtime: Add surface as backdrop object - void (CALLBACK * mvAddBackdrop) (cSurface* pSf, int x, int y, DWORD dwInkEffect, DWORD dwInkEffectParam, int nObstacleType, int nLayer); - - // Runtime: Binary files - BOOL (CALLBACK * mvGetFileA)(LPCSTR pPath, LPSTR pFilePath, DWORD dwFlags); - void (CALLBACK * mvReleaseFileA)(LPCSTR pPath); - HANDLE (CALLBACK * mvOpenHFileA)(LPCSTR pPath, LPDWORD pDwSize, DWORD dwFlags); - void (CALLBACK * mvCloseHFile)(HANDLE hf); - - // Plugin: download file - int (CALLBACK * mvLoadNetFileA) (LPSTR pFilename); - - // Plugin: send command to Vitalize - int (CALLBACK * mvNetCommandA) (int, LPVOID, DWORD, LPVOID, DWORD); - - // Editor & Runtime: Returns the version of MMF or of the runtime - DWORD (CALLBACK * mvGetVersion) (); - - // Editor & Runtime: callback function for properties or other functions - #ifdef _cplusplus - LRESULT (CALLBACK * mvCallFunction) (LPVOID edPtr, int nFnc, LPARAM lParam1=0, LPARAM lParam2=0, LPARAM lParam3=0); - #else - LRESULT (CALLBACK * mvCallFunction) (LPVOID edPtr, int nFnc, LPARAM lParam1, LPARAM lParam2, LPARAM lParam3); - #endif - - // Editor: Open Help file (UNICODE) - void (CALLBACK * mvHelpW) (LPCWSTR pHelpFile, UINT nID, LPARAM lParam); - - // Editor: Get default font for object creation (UNICODE) - BOOL (CALLBACK * mvGetDefaultFontW) (LPLOGFONTW plf, LPWSTR pStyle, int cbSize); - - // Editor: Edit images and animations (UNICODE) - BOOL (CALLBACK * mvEditSurfaceW) (LPVOID edPtr, LPEDITSURFACEPARAMSW pParams, HWND hParent); - BOOL (CALLBACK * mvEditImageW) (LPVOID edPtr, LPEDITIMAGEPARAMSW pParams, HWND hParent); - BOOL (CALLBACK * mvEditAnimationW) (LPVOID edPtr, LPEDITANIMATIONPARAMSW pParams, HWND hParent); - - // Runtime: Binary files (UNICODE - BOOL (CALLBACK * mvGetFileW)(LPCWSTR pPath, LPWSTR pFilePath, DWORD dwFlags); - void (CALLBACK * mvReleaseFileW)(LPCWSTR pPath); - HANDLE (CALLBACK * mvOpenHFileW)(LPCWSTR pPath, LPDWORD pDwSize, DWORD dwFlags); - - // Plugin: download file - int (CALLBACK * mvLoadNetFileW) (LPWSTR pFilename); - - // Plugin: send command to Vitalize - int (CALLBACK * mvNetCommandW) (int, LPVOID, DWORD, LPVOID, DWORD); - - // Place-holder for next versions - LPVOID mvAdditionalFncs[6]; - -#ifdef __cplusplus -}; -#else -} mv; -#endif -typedef mv *LPMV; - -#ifdef _UNICODE -#define mvHelp mvHelpW -#define mvGetDefaultFont mvGetDefaultFontW -#define mvEditSurface mvEditSurfaceW -#define mvEditImage mvEditImageW -#define mvEditAnimation mvEditAnimationW -#define mvGetFile mvGetFileW -#define mvReleaseFile mvReleaseFileW -#define mvLoadNetFile mvLoadNetFileW -#define mvNetCommand mvNetCommandW -#define mvGetFile mvGetFileW -#define mvReleaseFile mvReleaseFileW -#define mvOpenHFile mvOpenHFileW -#else -#define mvHelp mvHelpA -#define mvGetDefaultFont mvGetDefaultFontA -#define mvEditSurface mvEditSurfaceA -#define mvEditImage mvEditImageA -#define mvEditAnimation mvEditAnimationA -#define mvGetFile mvGetFileA -#define mvReleaseFile mvReleaseFileA -#define mvLoadNetFile mvLoadNetFileA -#define mvNetCommand mvNetCommandA -#define mvGetFile mvGetFileA -#define mvReleaseFile mvReleaseFileA -#define mvOpenHFile mvOpenHFileA -#endif - -// Callback function identifiers for mvCallFunction -enum { - // Editor only - EF_INSERTPROPS=1, // Insert properties into Property window - EF_REMOVEPROP, // Remove property - EF_REMOVEPROPS, // Remove properties - EF_REFRESHPROP, // Refresh propery - EF_REALLOCEDITDATA, // Reallocate edPtr - EF_GETPROPVALUE, // Get object's property value - EF_GETAPPPROPVALUE, // Get application's property value - EF_GETFRAMEPROPVALUE, // Get frame's property value - EF_SETPROPVALUE, // Set object's property value - EF_SETAPPPROPVALUE, // Set application's property value - EF_SETFRAMEPROPVALUE, // Set frame's property value - EF_GETPROPCHECK, // Get object's property check state - EF_GETAPPPROPCHECK, // Get application's property check state - EF_GETFRAMEPROPCHECK, // Get frame's property check state - EF_SETPROPCHECK, // Set object's property check state - EF_SETAPPPROPCHECK, // Set application's property check state - EF_SETFRAMEPROPCHECK, // Set frame's property check state - EF_INVALIDATEOBJECT, // Refresh object in frame editor - EF_RECALCLAYOUT, // Recalc runtime layout (docking) - EF_GETNITEMS, // Get number of items - not yet implemented - EF_GETNEXTITEM, // Get next item - not yet implemented - EF_GETNINSTANCES, // Get number of item instances - not yet implemented - EF_GETNEXTINSTANCE, // Get next item instance - not yet implemented - - // Editor & runtime - EF_MALLOC=100, // Allocate memory - EF_CALLOC, // Allocate memory & set it to 0 - EF_REALLOC, // Re-allocate memory - EF_FREE, // Free memory - EF_GETSOUNDMGR, // Get sound manager - EF_CLOSESOUNDMGR, // Close sound manager - EF_ENTERMODALLOOP, // Reserved - EF_EXITMODALLOOP, // Reserved - EF_CREATEEFFECT, // Create effect (runtime only) - EF_DELETEEFFECT, // Delete effect (runtime only) - EF_CREATEIMAGEFROMFILEA,// Create image from file (runtime only) - EF_NEEDBACKGROUNDACCESS,// HWA : tell the frame the frame surface can be read (runtime only) - EF_ISHWA, // Returns TRUE if HWA version (editor and runtime) - EF_ISUNICODE, // Returns TRUE if the editor or runtime is in Unicode mode - EF_ISUNICODEAPP, // Returns TRUE if the application being loaded is a Unicode application - EF_GETAPPCODEPAGE, // Returns the code page of the application - EF_CREATEIMAGEFROMFILEW,// Create image from file (runtime only) -}; - -// 3rd parameter of EF_CREATEIMAGEFROMFILE -typedef struct CreateImageFromFileInfo { - int nSize; - int xHS; - int yHS; - int xAP; - int yAP; - COLORREF trspColor; -} CreateImageFromFileInfo; - - -// Callback function macros for mvCallFunction -#ifdef __cplusplus -__inline void mvInsertProps(LPMV mV, LPVOID edPtr, PropData* pProperties, UINT nInsertPropID, BOOL bAfter) \ - { mV->mvCallFunction(edPtr, EF_INSERTPROPS, (LPARAM)pProperties, (LPARAM)nInsertPropID, (LPARAM)bAfter); } - -__inline void mvRemoveProp(LPMV mV, LPVOID edPtr, UINT nPropID) \ - { mV->mvCallFunction(edPtr, EF_REMOVEPROP, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } - -__inline void mvRemoveProps(LPMV mV, LPVOID edPtr, PropData* pProperties) \ - { mV->mvCallFunction(edPtr, EF_REMOVEPROPS, (LPARAM)pProperties, (LPARAM)0, (LPARAM)0); } - -__inline void mvRefreshProp(LPMV mV, LPVOID edPtr, UINT nPropID, BOOL bReInit) \ - { mV->mvCallFunction(edPtr, EF_REFRESHPROP, (LPARAM)nPropID, (LPARAM)bReInit, (LPARAM)0); } - -__inline LPVOID mvReAllocEditData(LPMV mV, LPVOID edPtr, DWORD dwNewSize) \ - { return (LPVOID)mV->mvCallFunction(edPtr, EF_REALLOCEDITDATA, (LPARAM)edPtr, dwNewSize, 0); } - -__inline CPropValue* mvGetPropValue(LPMV mV, LPVOID edPtr, UINT nPropID) \ - { return (CPropValue*)mV->mvCallFunction(edPtr, EF_GETPROPVALUE, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } - -__inline CPropValue* mvGetAppPropValue(LPMV mV, LPVOID edPtr, UINT nPropID) \ - { return (CPropValue*)mV->mvCallFunction(edPtr, EF_GETAPPPROPVALUE, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } - -__inline CPropValue* mvGetFramePropValue(LPMV mV, LPVOID edPtr, UINT nPropID) \ - { return (CPropValue*)mV->mvCallFunction(edPtr, EF_GETFRAMEPROPVALUE, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } - -__inline void mvSetPropValue(LPMV mV, LPVOID edPtr, UINT nPropID, CPropValue* pValue) \ - { mV->mvCallFunction(edPtr, EF_SETPROPVALUE, (LPARAM)nPropID, (LPARAM)pValue, (LPARAM)0); } - -__inline void mvSetAppPropValue(LPMV mV, LPVOID edPtr, UINT nPropID, CPropValue* pValue) \ - { mV->mvCallFunction(edPtr, EF_SETAPPPROPVALUE, (LPARAM)nPropID, (LPARAM)pValue, (LPARAM)0); } - -__inline void mvSetFramePropValue(LPMV mV, LPVOID edPtr, UINT nPropID, CPropValue* pValue) \ - { mV->mvCallFunction(edPtr, EF_SETFRAMEPROPVALUE, (LPARAM)nPropID, (LPARAM)pValue, (LPARAM)0); } - -__inline UINT mvGetPropCheck(LPMV mV, LPVOID edPtr, UINT nPropID) \ - { return (UINT)mV->mvCallFunction(edPtr, EF_GETPROPCHECK, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } - -__inline UINT mvGetAppPropCheck(LPMV mV, LPVOID edPtr, UINT nPropID) \ - { return (UINT)mV->mvCallFunction(edPtr, EF_GETAPPPROPCHECK, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } - -__inline UINT mvGetFramePropCheck(LPMV mV, LPVOID edPtr, UINT nPropID) \ - { return (UINT)mV->mvCallFunction(edPtr, EF_GETFRAMEPROPCHECK, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } - -__inline void mvSetPropCheck(LPMV mV, LPVOID edPtr, UINT nPropID, UINT nCheck) \ - { mV->mvCallFunction(edPtr, EF_SETPROPCHECK, (LPARAM)nPropID, (LPARAM)nCheck, (LPARAM)0); } - -__inline void mvSetAppPropCheck(LPMV mV, LPVOID edPtr, UINT nPropID, UINT nCheck) \ - { mV->mvCallFunction(edPtr, EF_SETAPPPROPCHECK, (LPARAM)nPropID, (LPARAM)nCheck, (LPARAM)0); } - -__inline void mvSetFramePropCheck(LPMV mV, LPVOID edPtr, UINT nPropID, UINT nCheck) \ - { mV->mvCallFunction(edPtr, EF_SETFRAMEPROPCHECK, (LPARAM)nPropID, (LPARAM)nCheck, (LPARAM)0); } - -__inline void mvInvalidateObject(LPMV mV, LPVOID edPtr) \ - { mV->mvCallFunction(edPtr, EF_INVALIDATEOBJECT, (LPARAM)0, (LPARAM)0, (LPARAM)0); } - -__inline LPVOID mvMalloc(LPMV mV, int nSize) \ - { return (LPVOID)mV->mvCallFunction(NULL, EF_MALLOC, (LPARAM)nSize, (LPARAM)0, (LPARAM)0); } - -__inline LPVOID mvCalloc(LPMV mV, int nSize) \ - { return (LPVOID)mV->mvCallFunction(NULL, EF_CALLOC, (LPARAM)nSize, (LPARAM)0, (LPARAM)0); } - -__inline LPVOID mvReAlloc(LPMV mV, LPVOID ptr, int nNewSize) \ - { return (LPVOID)mV->mvCallFunction(NULL, EF_REALLOC, (LPARAM)ptr, (LPARAM)nNewSize, (LPARAM)0); } - -__inline void mvFree(LPMV mV, LPVOID ptr) \ - { mV->mvCallFunction(NULL, EF_FREE, (LPARAM)ptr, (LPARAM)0, (LPARAM)0); } - -__inline void mvRecalcLayout(LPMV mV) \ - { mV->mvCallFunction(NULL, EF_RECALCLAYOUT, (LPARAM)0, (LPARAM)0, (LPARAM)0); } - -__inline CSoundManager* mvGetSoundMgr(LPMV mV) \ - { mV->mvCallFunction(NULL, EF_GETSOUNDMGR, (LPARAM)0, (LPARAM)0, (LPARAM)0); } - -__inline void mvCloseSoundMgr(LPMV mV) \ - { mV->mvCallFunction(NULL, EF_CLOSESOUNDMGR, (LPARAM)0, (LPARAM)0, (LPARAM)0); } - -__inline int mvGetNItems(LPMV mV, LPVOID edPtr, LPCSTR extName) \ - { return mV->mvCallFunction(edPtr, EF_GETNITEMS, (LPARAM)extName, (LPARAM)0, (LPARAM)0); } - -__inline LPVOID mvGetFirstItem(LPMV mV, LPVOID edPtr, LPCSTR extName) \ - { return (LPVOID)mV->mvCallFunction(edPtr, EF_GETNEXTITEM, (LPARAM)extName, (LPARAM)0, (LPARAM)0); } - -__inline LPVOID mvGetNextItem(LPMV mV, LPVOID edPtr, LPVOID edPtr1, LPCSTR extName) \ - { return (LPVOID)mV->mvCallFunction(edPtr, EF_GETNEXTITEM, (LPARAM)edPtr1, (LPARAM)extName, (LPARAM)0); } - -#ifdef HWABETA - -__inline BOOL mvCreateEffect(LPMV mV, LPCSTR pEffectName, LPINT pEffect, LPARAM* pEffectParam) \ - { return (BOOL)mV->mvCallFunction(NULL, EF_CREATEEFFECT, (LPARAM)pEffectName, (LPARAM)pEffect, (LPARAM)pEffectParam); } - -__inline void mvDeleteEffect(LPMV mV, int nEffect, LPARAM lEffectParam) \ - { mV->mvCallFunction(NULL, EF_DELETEEFFECT, (LPARAM)nEffect, (LPARAM)lEffectParam, (LPARAM)0); } - -#endif // HWABETA - -__inline BOOL mvCreateImageFromFileA(LPMV mV, LPWORD pwImg, LPCSTR pFilename, CreateImageFromFileInfo* pInfo) \ - { return (BOOL)mV->mvCallFunction(NULL, EF_CREATEIMAGEFROMFILEA, (LPARAM)pwImg, (LPARAM)pFilename, (LPARAM)pInfo); } - -__inline BOOL mvCreateImageFromFileW(LPMV mV, LPWORD pwImg, LPCWSTR pFilename, CreateImageFromFileInfo* pInfo) \ - { return (BOOL)mV->mvCallFunction(NULL, EF_CREATEIMAGEFROMFILEW, (LPARAM)pwImg, (LPARAM)pFilename, (LPARAM)pInfo); } - -__inline LPVOID mvNeebBackgroundAccess(LPMV mV, CRunFrame* pFrame, BOOL bNeedAccess) \ - { return (LPVOID)mV->mvCallFunction(NULL, EF_NEEDBACKGROUNDACCESS, (LPARAM)pFrame, (LPARAM)bNeedAccess, (LPARAM)0); } - -__inline BOOL mvIsHWAVersion(LPMV mV) \ - { return mV->mvCallFunction(NULL, EF_ISHWA, (LPARAM)0, (LPARAM)0, (LPARAM)0); } - -__inline BOOL mvIsUnicodeVersion(LPMV mV) \ - { return mV->mvCallFunction(NULL, EF_ISUNICODE, (LPARAM)0, (LPARAM)0, (LPARAM)0); } - -__inline BOOL mvIsUnicodeApp(LPMV mV, LPVOID pApp) \ - { return mV->mvCallFunction(NULL, EF_ISUNICODEAPP, (LPARAM)pApp, (LPARAM)0, (LPARAM)0); } - -__inline int mvGetAppCodePage(LPMV mV, LPVOID pApp) \ - { return mV->mvCallFunction(NULL, EF_GETAPPCODEPAGE, (LPARAM)pApp, (LPARAM)0, (LPARAM)0); } - -#ifdef _UNICODE -#define mvCreateImageFromFile mvCreateImageFromFileW -#else -#define mvCreateImageFromFile mvCreateImageFromFileA -#endif - -#endif // __cplusplus - -// Options for OpenHFile -#define OHFF_LOCALFILE 0x0001 // Vitalize mode only: don't try to download file from server - -#ifdef RUN_TIME - -// EnumEltProc definition -typedef int (CALLBACK* ENUMELTPROC)(LPWORD, int, LPARAM, LPARAM); - -// Extension function table -typedef struct tagKpxFunc { - HINSTANCE kpxHInst; - LPTSTR kpxName; - LPTSTR kpxSubType; - LPVOID kpxUserData; - DWORD ( WINAPI * kpxGetInfos) (int); - int ( WINAPI * kpxLoadObject) (mv *, OI*, LPBYTE, int); - void ( WINAPI * kpxUnloadObject) (mv *, LPBYTE, int); - void ( WINAPI * kpxUpdateFileNames) (mv *, LPTSTR, LPBYTE, void (WINAPI * )(LPCTSTR, LPTSTR)); - short( WINAPI * kpxGetRunObjectInfos) (mv *, LPBYTE); - short( WINAPI * kpxWindowProc) (LPBYTE, HWND, UINT, WPARAM, LPARAM); - int ( WINAPI * kpxEnumElts) (mv *, LPBYTE, ENUMELTPROC, ENUMELTPROC, LPARAM, LPARAM); - int ( WINAPI * kpxLoadData) (mv *, OI*, LPBYTE, HFILE, DWORD); // Not used - int ( WINAPI * kpxUnloadData) (mv *, OI*, LPBYTE); // Not used - void ( WINAPI * kpxStartApp) (mv *, CRunApp*); - void ( WINAPI * kpxEndApp) (mv *, CRunApp*); - void ( WINAPI * kpxStartFrame) (mv *, CRunApp*, int); - void ( WINAPI * kpxEndFrame) (mv *, CRunApp*, int); - HGLOBAL ( WINAPI * kpxUpdateEditStructure) (mv *, LPVOID); -#if defined(VITALIZE) - BOOL bValidated; -#endif - BOOL bUnicode; -} kpxFunc; -typedef kpxFunc * fpKpxFunc; - -// Movement Extension -typedef struct MvxFnc { - HINSTANCE mvxHInst; - LPTSTR mvxFileTitle; - - CMvt* ( CALLBACK * mvxCreateMvt) (DWORD); - - #if defined(VITALIZE) - BOOL bValidated; - #endif -} MvxFnc; - -// Old 16/32 bit macros -#define ADDPTR32(p,l) p+=l; -#define SUBPTR32(p,l) p-=l; -#define INCPTR32(p) p++; - -#endif // RUN_TIME - -// Restore structure alignement -#ifndef _H2INC -#pragma pack( pop, _pack_cncy_ ) -#endif - -#ifndef __cplusplus -#undef CImageFilterMgr -#undef CSoundFilterMgr -#undef CSoundManager -#undef CRunApp -#undef CRunFrame -#undef CEditApp -#undef CEditFrame -#undef CMvt -#undef CPropValue -#endif - -#endif // CNCY_H + +#ifndef CNCY_H +#define CNCY_H + +#include "PictEdDefs.h" + +#ifdef __cplusplus +class cSurface; +class CImageFilterMgr; +class CSoundFilterMgr; +class CSoundManager; +class CRunApp; +class CRunFrame; +class CEditApp; +class CEditFrame; +class CMvt; +class CPropValue; +class OI; +class dllTrans; +class CValue; +#else +#define cSurface void +#define CImageFilterMgr void +#define CSoundFilterMgr void +#define CSoundManager void +#define CRunApp void +#define CRunFrame void +#define CEditApp void +#define CEditFrame void +#define CMvt void +#define CPropValue void +#define OI void +#define dllTrans void +struct CValue; +#endif +struct PropData; +struct RunHeader; + +// Force structure alignement +#ifndef _H2INC +#pragma pack( push, _pack_cncy_ ) +#pragma pack(2) +#endif + +#ifndef _H2INC + +// Object instance parent types +enum { + PARENT_NONE, + PARENT_FRAME, + PARENT_FRAMEITEM, + PARENT_QUALIFIER +}; + +// Proc definition +typedef void (WINAPI * UPDATEFILENAMEPROCA)(LPCSTR, LPSTR); +typedef void (WINAPI * UPDATEFILENAMEPROCW)(LPCWSTR, LPWSTR); +typedef void (WINAPI * UPDATEFILENAMEPROC)(LPCTSTR, LPTSTR); + +// Old object name size, still used in events +#ifndef OINAME_SIZE +#define OINAME_SIZE 24 +#endif // OINAME_SIZE + +// Obsolete +enum { + MODIF_SIZE, + MODIF_PLANE, + MODIF_FLAGS, + MODIF_PICTURE, + MODIF_HFRAN, + MODIF_BOX, + MODIF_TEXT, + MODIF_PREFS +}; +#define KPX_MODIF_BASE 1024 + +#endif // _H2INC + +// Standard objects +#define KPX_BASE 32 // Extensions +enum { + OBJ_BOX, + OBJ_BKD, + OBJ_SPR, + OBJ_TEXT, + OBJ_QUEST, + OBJ_SCORE, + OBJ_LIVES, + OBJ_COUNTER, + OBJ_RTF, + OBJ_CCA, + NB_SYSOBJ +}; + +// Menu header (v2) +typedef struct MenuHdr { + + DWORD mhHdrSize; // == sizeof(MenuHdr) + DWORD mhMenuOffset; // From start of MenuHdr + DWORD mhMenuSize; + DWORD mhAccelOffset; // From start of MenuHdr + DWORD mhAccelSize; + // Total data size = mhHdrSize + mhMenuSize + mhAccelSize +} MenuHdr; + +////////////////////////////////////////////////////////////////////////////// +// Application mini Header +// +typedef struct AppMiniHeader { + + union { + char gaType[4]; // "PAME" + DWORD gaDWType; + }; + WORD gaVersion; // Version number + WORD gaSubVersion; // Sub-version number + DWORD gaPrdVersion; // MMF version + DWORD gaPrdBuild; // MMF build number + +} AppMiniHeader; + +#define RUNTIME_DWTYPEA 'EMAP' +#define RUNTIME_DWTYPEW 'UMAP' +#define RUNTIME_DWTYPE_VTZA ' ZTV' +#define RUNTIME_DWTYPE_VTZW 'UZTV' + +#ifdef _UNICODE +#define RUNTIME_DWTYPE RUNTIME_DWTYPEW +#define RUNTIME_DWTYPE_VTZ RUNTIME_DWTYPE_VTZW +#else +#define RUNTIME_DWTYPE RUNTIME_DWTYPEA +#define RUNTIME_DWTYPE_VTZ RUNTIME_DWTYPE_VTZA +#endif +#define RUNTIME_VERSION_MMF1 0x0300 +#define RUNTIME_VERSION_MMF15 0x0301 +#define RUNTIME_VERSION_MMF2 0x0302 +#define RUNTIME_VERSION RUNTIME_VERSION_MMF2 + +////////////////////////////////////////////////////////////////////////////// +// Application full Header +// + +enum { + CTRLTYPE_MOUSE, // not used + CTRLTYPE_JOY1, + CTRLTYPE_JOY2, + CTRLTYPE_JOY3, + CTRLTYPE_JOY4, + CTRLTYPE_KEYBOARD, + MAX_CTRLTYPE +}; + +#define MAX_PLAYER 4 +#define MAX_KEY 8 +#define PLAYERNAME_SIZE 100 + +typedef struct PlayerCtrls { + + WORD pcCtrlType[MAX_PLAYER]; // Control type per player (0=mouse,1=joy1, 2=joy2, 3=keyb) + WORD pcCtrlKeys[MAX_PLAYER][MAX_KEY]; // Control keys per player + +} PlayerCtrls; +typedef PlayerCtrls* fpPlayerCtrls; + +typedef struct AppHeader { + + DWORD gaSize; // Structure size + WORD gaFlags; // Flags + WORD gaNewFlags; // New flags + WORD gaMode; // graphic mode + WORD gaOtherFlags; // Other Flags + short gaCxWin; // Window x-size + short gaCyWin; // Window y-size + DWORD gaScoreInit; // Initial score + DWORD gaLivesInit; // Initial number of lives + PlayerCtrls gaPlayerCtrls; + DWORD gaBorderColour; // Border colour + DWORD gaNbFrames; // Number of frames + DWORD gaFrameRate; // Number of frames per second + BYTE gaMDIWindowMenu; // Index of Window menu for MDI applications + BYTE gaFree[3]; + +} AppHeader; + +// gaFlags +#define GA_BORDERMAX 0x0001 +#define GA_NOHEADING 0x0002 +#define GA_PANIC 0x0004 +#define GA_SPEEDINDEPENDANT 0x0008 +#define GA_STRETCH 0x0010 +#define GA_LOADALLIMAGESATSTART 0x0020 +#define GA_LOADALLSOUNDSATSTART 0x0040 +#define GA_MENUHIDDEN 0x0080 +#define GA_MENUBAR 0x0100 +#define GA_MAXIMISE 0x0200 +#define GA_MIX 0x0400 +#define GA_FULLSCREENATSTART 0x0800 +#define GA_FULLSCREENSWITCH 0x1000 +#define GA_PROTECTED 0x2000 +#define GA_COPYRIGHT 0x4000 +#define GA_ONEFILE 0x8000 + +// gaNewFlags +#define GANF_SAMPLESOVERFRAMES 0x0001 +#define GANF_RELOCFILES 0x0002 +#define GANF_RUNFRAME 0x0004 +#define GANF_SAMPLESEVENIFNOTFOCUS 0x0008 + +// New in build 92 +#define GANF_NOMINIMIZEBOX 0x0010 +#define GANF_NOMAXIMIZEBOX 0x0020 +#define GANF_NOTHICKFRAME 0x0040 +#define GANF_DONOTCENTERFRAME 0x0080 + +// New in build 101 (MMF 1.5) +#define GANF_SCREENSAVER_NOAUTOSTOP 0x0100 +#define GANF_DISABLE_CLOSE 0x0200 + +// New in build 105 +#define GANF_HIDDENATSTART 0x0400 + +// New in build 110 +#define GANF_XPVISUALTHEMESUPPORT 0x0800 + +// New in MMF2 +#define GANF_VSYNC 0x1000 +#define GANF_RUNWHENMINIMIZED 0x2000 +#define GANF_MDI 0x4000 +#define GANF_RUNWHILERESIZING 0x8000 + +// Other flags +#define GAOF_DEBUGGERSHORTCUTS 0x0001 +#define GAOF_DDRAW 0x0002 +#define GAOF_DDRAWVRAM 0x0004 +#define GAOF_OBSOLETE 0x0008 +#define GAOF_AUTOIMGFLT 0x0010 +#define GAOF_AUTOSNDFLT 0x0020 +#define GAOF_ALLINONE 0x0040 +#define GAOF_SHOWDEBUGGER 0x0080 +#define GAOF_RESERVED_1 0x0100 +#define GAOF_RESERVED_2 0x0200 +#define GAOF_RESERVED_3 0x0400 +#define GAOF_RESERVED_4 0x0800 +#define GAOF_JAVASWING 0x1000 +#define GAOF_JAVAAPPLET 0x2000 +#define GAOF_D3D9 0x4000 +#define GAOF_D3D8 0x8000 + +// Optional header +typedef struct AppHeader2 { + + DWORD dwOptions; + DWORD dwBuildType; + DWORD dwBuildFlags; + WORD wScreenRatioTolerance; + WORD wScreenAngle; // 0 (no rotation/portrait), 1 (90 clockwise/landscape left), 2 (90 anticlockwise/landscape right), 3 (automatic portrait), 4 (automatic landscape), 5 (fully automatic) + DWORD dwUnused2; + +} AppHeader2; + +#define AH2OPT_KEEPSCREENRATIO 0x0001 +#define AH2OPT_FRAMETRANSITION 0x0002 // (HWA only) a frame has a transition +#define AH2OPT_RESAMPLESTRETCH 0x0004 // (HWA only) "resample when resizing" (works with "resize to fill window" option) +#define AH2OPT_GLOBALREFRESH 0x0008 // (Mobile) force global refresh +#define AH2OPT_MULTITASK 0x0010 // (iPhone) Multitask +#define AH2OPT_RTL 0x0020 // (Unicode) Right-to-left reading +#define AH2OPT_STATUSLINE 0x0040 // (iPhone/Android) Display status line +#define AH2OPT_RTLLAYOUT 0x0080 // (Unicode) Right-to-left layout +#define AH2OPT_ENABLEIAD 0x0100 // (iPhone) Enable iAd +#define AH2OPT_IADBOTTOM 0x0200 // (iPhone) Display ad at bottom +#define AH2OPT_AUTOEND 0x0400 // (Android) +#define AH2OPT_DISABLEBACKBUTTON 0x0800 // (Android) Disable Back button behavior +#define AH2OPT_ANTIALIASED 0x1000 // (iPhone) Smooth resizing on bigger screens +#define AH2OPT_CRASHREPORTING 0x2000 // (Android) Enable online crash reporting + +enum { + SCREENORIENTATION_PORTRAIT, + SCREENORIENTATION_LANDSCAPE_LEFT, + SCREENORIENTATION_LANDSCAPE_RIGHT, + SCREENORIENTATION_AUTO, + SCREENORIENTATION_LANDSCAPE_AUTO, + SCREENORIENTATION_PORTRAIT_AUTO, +}; + +#ifndef _H2INC + +// Build type values +enum { + BUILDTYPE_STANDALONE, + BUILDTYPE_SCREENSAVER, + BUILDTYPE_INTERNETAPP, + BUILDTYPE_JAVA, + BUILDTYPE_JAVASTANDALONE, + BUILDTYPE_JAVAAPPLET, + BUILDTYPE_JAVAWEBSTART, + BUILDTYPE_JAVAMOBILE, + BUILDTYPE_JAVABLURAY, + BUILDTYPE_JAVAMAC, + BUILDTYPE_FLASH, + BUILDTYPE_JAVABLACKBERRY, + BUILDTYPE_ANDROID, + BUILDTYPE_IPHONE, + BUILDTYPE_IPHONEDEVEL, + BUILDTYPE_IPHONEFINAL, + BUILDTYPE_XNA_WINDOWS_APP, + BUILDTYPE_MAC, + BUILDTYPE_XNA_WINDOWS, + BUILDTYPE_XNA_XBOX, + BUILDTYPE_XNA_PHONE, + BUILDTYPE_XNA_XBOX_APP, + BUILDTYPE_XNA_PHONE_APP, + BUILDTYPE_STDMAX, // end of standard build types +}; + +// Build flag values +#define BUILDFLAG_MAXCOMP 0x0001 +#define BUILDFLAG_COMPSND 0x0002 +#define BUILDFLAG_INCLUDEEXTFILES 0x0004 +#define BUILDFLAG_MANUALIMGFILTERS 0x0008 +#define BUILDFLAG_MANUALSNDFILTERS 0x0010 +#define BUILDFLAG_NOAUTOEXTRACT 0x0020 +#define BUILDFLAG_NOAPPLETCHECK 0x0040 +#define BUILDFLAG_TEST 0x0080 +#define BUILDFLAG_NOWARNINGS 0x0100 + +#endif + +////////////////////////////////////////////////////////////////////////////// +// Element of chunk Extensions +// +#ifndef _H2INC +typedef struct ExtDesc { + WORD extSize; + WORD extIndex; + DWORD extMagicNumber; +} ExtDesc; +typedef ExtDesc *LPEXTDESC; + +typedef struct ExtDesc2 { + WORD extSize; + WORD extIndex; + DWORD extMagicNumber; + DWORD extVersionLS; + DWORD extVersionMS; +} ExtDesc2; +typedef ExtDesc2 *LPEXTDESC2; +#endif + +////////////////////////////////////////////////////////////////////////////// +// Movement Extensions Chunk +// +typedef struct MvtExtDesc { + WORD extTotalSize; + WORD extHdrSize; + DWORD extBuild; +} MvtExtDesc; +typedef MvtExtDesc *LPMVTEXTDESC; + +////////////////////////////////////////////////////////////////////////////// +// Frame Header +// +typedef struct FrameHeader +{ + // Playfield + LONG leWidth; // Playfield width in pixels + LONG leHeight; // Playfield height in pixels + COLORREF leBackground; + + // Options + DWORD leFlags; + + +} FrameHeader; + +// leFlags +#define LEF_DISPLAYNAME 0x0001 +#define LEF_GRABDESKTOP 0x0002 +#define LEF_KEEPDISPLAY 0x0004 +//#define LEF_FADEIN 0x0008 +//#define LEF_FADEOUT 0x0010 +#define LEF_TOTALCOLMASK 0x0020 +#define LEF_PASSWORD 0x0040 +#define LEF_RESIZEATSTART 0x0100 +#define LEF_DONOTCENTER 0x0200 +#define LEF_FORCE_LOADONCALL 0x0400 +#define LEF_NOSURFACE 0x0800 +#define LEF_RESERVED_1 0x1000 +#define LEF_RESERVED_2 0x2000 +#define LEF_RECORDDEMO 0x4000 +#define LEF_TIMEDMVTS 0x8000 + +////////////////////////////////////////////////////////////////////////////// +// Layers +// + +#define FLOPT_XCOEF 0x0001 +#define FLOPT_YCOEF 0x0002 +#define FLOPT_NOSAVEBKD 0x0004 +#define FLOPT_WRAP_OBSOLETE 0x0008 +#define FLOPT_VISIBLE 0x0010 +#define FLOPT_WRAP_HORZ 0x0020 +#define FLOPT_WRAP_VERT 0x0040 +#define FLOPT_PREVIOUSEFFECT 0x0080 +#define FLOPT_REDRAW 0x000010000 +#define FLOPT_TOHIDE 0x000020000 +#define FLOPT_TOSHOW 0x000040000 + +typedef struct EditFrameLayer +{ + DWORD dwOptions; // Options + float xCoef; + float yCoef; + DWORD nBkdLOs; + DWORD nFirstLOIndex; + +} EditFrameLayer; + +typedef struct EditFrameLayerEffect { + + DWORD dwInkFx; + DWORD dwRGBA; + DWORD dwExtInkFxIdx; + DWORD nParams; + LPARAM paramData; // offset + +} EditFrameLayerEffect; + +// Effects +#ifdef HWABETA + +typedef struct EffectHdr { + DWORD dwEffectNameOffset; + DWORD dwEffectDataOffset; + DWORD dwEffectParamsOffset; + DWORD dwOptions; +} EffectHdr; + +#define EFFECTOPT_BKDTEXTUREMASK 0x000F + +typedef struct EffectParamsHdr { + DWORD dwNParams; + DWORD dwParamTypesOffset; + DWORD dwParamNamesOffset; +} EffectParamsHdr; + +typedef struct EffectRunData { + + DWORD erdEffectIndex; + DWORD erdNParams; +} EffectRunData; + +typedef struct FrameEffect { + + DWORD ffxInkEffect; + DWORD ffxInkEffectParam; +} FrameEffect; + +#endif + +////////////////////////////////////////////////////////////////////////////// +// ObjInfo/FrameItem Header +// +typedef struct ObjInfoHeader +{ + WORD oiHandle; + WORD oiType; + WORD oiFlags; // Memory flags + WORD oiReserved; // No longer used + DWORD oiInkEffect; // Ink effect + DWORD oiInkEffectParam; // Ink effect param + +} ObjInfoHeader; + +// oiFlags +#define OIF_LOADONCALL 0x0001 +#define OIF_DISCARDABLE 0x0002 +#define OIF_GLOBAL 0x0004 +#define OIF_RESERVED_1 0x0008 +#define OIF_GLOBAL_EDITOR_NOSYNC 0x0010 +#define OIF_GLOBAL_EDITOR_FORCESYNC 0x0020 + +////////////////////////////////////////////////////////////////////////////// +// LevObj/FrameItemInstance +// + +#ifndef _H2INC +#ifdef __cplusplus +class diskLO { +public: +#else +typedef struct diskLO { +#endif + WORD loHandle; // HLO + WORD loOiHandle; // HOI + LONG loX; // Coords + LONG loY; + WORD loParentType; // Parent type + WORD loOiParentHandle; // HOI Parent + WORD loLayer; // Layer + WORD loFree; // Not used +#ifdef __cplusplus +}; +#else +} diskLO; +#endif +typedef diskLO * fpDiskLO; +#endif + +////////////////////////////////////////////////////////////////////////////// +// +// ObjInfo/FrameItem ObjectsCommon +// + +// Obstacle types +enum { + OBSTACLE_NONE, + OBSTACLE_SOLID, + OBSTACLE_PLATFORM, + OBSTACLE_LADDER, + OBSTACLE_TRANSPARENT // for Add Backdrop +}; + +//////////////////////////////// +// Static object - ObjectsCommon +// +#ifndef _H2INC +typedef struct Static_OC { + + // Size + DWORD ocDWSize; + + // Obstacle type & collision mode + WORD ocObstacleType; + WORD ocColMode; // Collision mode (0 = fine, 1 = box) + + LONG ocCx; // Size + LONG ocCy; + +} Static_OC; +typedef Static_OC * LPStatic_OC; +#endif + +/////////////////////////////////////////////////////////////// +// Fill Type & shapes - Definitions +// + +#ifndef _H2INC +// Gradient +typedef struct GradientData { + COLORREF color1; + COLORREF color2; + DWORD vertical; +} GradientData; + +// Shapes +enum { + SHAPE_NONE=0, // Error + SHAPE_LINE, + SHAPE_RECTANGLE, + SHAPE_ELLIPSE +}; + +// Fill types +enum { + FILLTYPE_NONE, + FILLTYPE_SOLID, + FILLTYPE_GRADIENT, + FILLTYPE_MOTIF +}; + +// Line flags +#define LINEF_INVX 0x0001 +#define LINEF_INVY 0x0002 + +#endif + +/////////////////////////////////////////////////////////////// +// Fill Type - Part of FilledShape +// +#ifndef _H2INC + +#ifdef __cplusplus +class FillType_Data { +public: +#else +typedef struct FillType_Data { +#endif + WORD ocFillType; + union { + struct { + DWORD ocLineFlags; // Only for lines in non filled mode + }; + struct { + COLORREF ocColor; // Solid + }; + struct { + COLORREF ocColor1; // Gradient + COLORREF ocColor2; + DWORD ocGradientFlags; + }; + struct { + WORD ocImage; // Image + }; + }; +#ifdef __cplusplus +}; +#else +} FillType_Data; +#endif + +#endif + +/////////////////////////////////////////////////////////////// +// Filled Shape - Part of QuickBackdrop / Counter ObjectsCommon +// +#ifndef _H2INC + +#ifdef __cplusplus +class FilledShape_Data { +public: +#else +typedef struct FilledShape_Data { +#endif + WORD ocBorderSize; // Border + COLORREF ocBorderColor; + WORD ocShape; // Shape + FillType_Data ocFillData; // Fill Type infos +#ifdef __cplusplus +}; +#else +} FilledShape_Data; +#endif +typedef FilledShape_Data * LPFilledShape_Data; + +#endif + +///////////////////////////////// +// Quick backdrop - ObjectsCommon +// +#ifndef _H2INC + +typedef struct QuickBackdrop_OC { + + DWORD ocDWSize; + + WORD ocObstacleType; // Obstacle type + WORD ocColMode; // Collision mode (0 = fine, 1 = box) + + LONG ocCx; // Size + LONG ocCy; + + FilledShape_Data ocFilledShape; // Filled shape infos + +} QuickBackdrop_OC; +typedef QuickBackdrop_OC * LPQuickBackdrop_OC; + +#endif + +///////////////////////////////// +// Backdrop - ObjectsCommon +// +#ifndef _H2INC + +typedef struct Backdrop_OC { + + DWORD ocDWSize; + + WORD ocObstacleType; // Obstacle type + WORD ocColMode; // Collision mode (0 = fine, 1 = box) + + LONG ocCx; // Size + LONG ocCy; + + WORD ocImage; // Image + +} Backdrop_OC; +typedef Backdrop_OC * LPBackdrop_OC; + +#endif + +////////////////////////////////////////////////////////////////////////////// +// +// ObjInfo/FrameItem ObjectsCommon Data +// + +////////////////////////////////////////////////////////////////////////////// +// ImageSet +// + +#ifdef __cplusplus +class ImageSet_Data { +public: +#else +typedef struct ImageSet_Data { +#endif + WORD nbFrames; // Number of frames + // Followed by list of image handles (WORD[]) +#ifdef __cplusplus +}; +#else +} ImageSet_Data; +#endif +typedef ImageSet_Data * LPImageSet_Data; + +//////////////////////////////////////// +// Text - ocData +// +typedef struct otText { + + DWORD otDWSize; + LONG otCx; + LONG otCy; + DWORD otNumberOfText; // Paragraph number (> 1 if question object) + DWORD otStringOffset[1]; // String offsets + +} otText; +typedef otText * fpot; +#define sizeof_ot (sizeof(otText)-sizeof(DWORD)) + +typedef struct txString { + WORD tsFont; // Font + WORD tsFlags; // Flags + COLORREF tsColor; // Color + TCHAR tsChar[1]; +} txString; +typedef txString * fpts; +#define sizeof_ts 8 // (sizeof(txString)-1) + +#define TSF_LEFT 0x0000 // DT_LEFT +#define TSF_HCENTER 0x0001 // DT_CENTER +#define TSF_RIGHT 0x0002 // DT_RIGHT +#define TSF_VCENTER 0x0004 // DT_VCENTER +#define TSF_HALIGN 0x000F // DT_LEFT | DT_RIGHT | DT_CENTER | DT_VCENTER | DT_BOTTOM + +#define TSF_CORRECT 0x0100 +#define TSF_RELIEF 0x0200 +#define TSF_RTL 0x0400 + +//////////////////////////////////////// +// Scores, lives, counters +// +typedef struct CtAnim_Data { + + DWORD odDWSize; + LONG odCx; // Size: only lives & counters + LONG odCy; + WORD odPlayer; // Player: only score & lives + WORD odDisplayType; // CTA_xxx + WORD odDisplayFlags; // BARFLAG_INVERSE + WORD odFont; // Font + + // Followed by display data: +// union { +// ImageSet_Data odImages; +// FilledShape_Data odShape; +// }; + +} CtAnim_Data; +typedef CtAnim_Data * LPCtAnim_Data; + +// Display types +enum { + CTA_HIDDEN, + CTA_DIGITS, + CTA_VBAR, + CTA_HBAR, + CTA_ANIM, + CTA_TEXT, +}; + +// Display flags +#define CPTDISPFLAG_INTNDIGITS 0x000F // 0 = normal display, other value = pad with zeros or truncate +#define CPTDISPFLAG_FLOATNDIGITS 0x00F0 // add 1 to get the number of significant digits to display +#define CPTDISPFLAG_FLOATNDIGITS_SHIFT 4 +#define CPTDISPFLAG_FLOATNDECIMALS 0xF000 // number of digits to display after the decimal point +#define CPTDISPFLAG_FLOATNDECIMALS_SHIFT 12 +#define BARFLAG_INVERSE 0x0100 +#define CPTDISPFLAG_FLOAT_FORMAT 0x0200 // 1 to use the specified numbers of digits, 0 to use standard display (%g) +#define CPTDISPFLAG_FLOAT_USENDECIMALS 0x0400 // 1 to use the specified numbers of digits after the decimal point +#define CPTDISPFLAG_FLOAT_PADD 0x0800 // 1 to left padd with zeros + +// Counters images +enum { + COUNTER_IMAGE_0, + COUNTER_IMAGE_1, + COUNTER_IMAGE_2, + COUNTER_IMAGE_3, + COUNTER_IMAGE_4, + COUNTER_IMAGE_5, + COUNTER_IMAGE_6, + COUNTER_IMAGE_7, + COUNTER_IMAGE_8, + COUNTER_IMAGE_9, + COUNTER_IMAGE_SIGN_NEG, + COUNTER_IMAGE_SIGN_PLUS, + COUNTER_IMAGE_POINT, + COUNTER_IMAGE_EXP, + COUNTER_IMAGE_MAX +}; +#define V1_COUNTER_IMAGE_MAX (COUNTER_IMAGE_SIGN_NEG+1) + +//////////////////////////////////////// +// +// Objet RTF - ocData +// +#ifndef _H2INC + +typedef struct ocRTF { + + DWORD odDWSize; + DWORD odVersion; // 0 + DWORD odOptions; // Options + COLORREF odBackColor; // Background color + LONG odCx; // Size + LONG odCy; + +} ocRTF; +typedef ocRTF * LPOCRTF; + +//#define RTFOPT_TRANSPARENT 0x0001 // Transparent +//#define RTFOPT_VSLIDER 0x0002 // Display vertical slider if necessary +//#define RTFOPT_HSLIDER 0x0004 // Display horizontal slider if necessary + +#endif + +//////////////////////////////////////// +// +// Objet CCA - ocData +// +#ifndef _H2INC + +typedef struct ocCCA { + + DWORD odDWSize; + LONG odCx; // Size (ignored) + LONG odCy; + WORD odVersion; // 0 + WORD odNStartFrame; + DWORD odOptions; // Options + DWORD odIconOffset; // Icon offset + DWORD odFree; // Free + +} ocCCA; +typedef ocCCA * LPOCCCA; + +// Options +#define CCAF_SHARE_GLOBALVALUES 0x00000001 +#define CCAF_SHARE_LIVES 0x00000002 +#define CCAF_SHARE_SCORES 0x00000004 +#define CCAF_SHARE_WINATTRIB 0x00000008 +#define CCAF_STRETCH 0x00000010 +#define CCAF_POPUP 0x00000020 +#define CCAF_CAPTION 0x00000040 +#define CCAF_TOOLCAPTION 0x00000080 +#define CCAF_BORDER 0x00000100 +#define CCAF_WINRESIZE 0x00000200 +#define CCAF_SYSMENU 0x00000400 +#define CCAF_DISABLECLOSE 0x00000800 +#define CCAF_MODAL 0x00001000 +#define CCAF_DIALOGFRAME 0x00002000 +#define CCAF_INTERNAL 0x00004000 +#define CCAF_HIDEONCLOSE 0x00008000 +#define CCAF_CUSTOMSIZE 0x00010000 +#define CCAF_INTERNALABOUTBOX 0x00020000 +#define CCAF_CLIPSIBLINGS 0x00040000 +#define CCAF_SHARE_PLAYERCTRLS 0x00080000 +#define CCAF_MDICHILD 0x00100000 +#define CCAF_DOCKED 0x00200000 +#define CCAF_DOCKING_AREA 0x00C00000 +#define CCAF_DOCKED_LEFT 0x00000000 +#define CCAF_DOCKED_TOP 0x00400000 +#define CCAF_DOCKED_RIGHT 0x00800000 +#define CCAF_DOCKED_BOTTOM 0x00C00000 +#define CCAF_REOPEN 0x01000000 +#define CCAF_MDIRUNEVENIFNOTACTIVE 0x02000000 +#define CCAF_DISPLAYASSPRITE 0x04000000 + +#endif + +//////////////////////////////////////// +// +// Transition +// + +#ifndef _H2INC + +// Transition header +typedef struct TransitionHdr { + DWORD trDllID; // DLL id + DWORD trID; // Transition ID + DWORD trDuration; // Duration + DWORD trFlags; // From / to color / background + DWORD trColor; // Color +} TransitionHdr; + +// Transition run-time data +#ifdef __cplusplus +class Transition_Data { +public: +#else +typedef struct Transition_Data { +#endif + TransitionHdr trHdr; + DWORD trDllNameOffset; + DWORD trParamsOffset; + DWORD trParamsSize; + // Followed by DLL name & transition parameters +#ifdef __cplusplus +}; +#else +} Transition_Data; +#endif +typedef Transition_Data * LPTRANSITIONDATA; + +#define TRFLAG_COLOR 0x0001 +#define TRFLAG_UNICODE 0x0002 + +#endif + +// Text alignment flags +#define TEXT_ALIGN_LEFT 0x00000001 +#define TEXT_ALIGN_HCENTER 0x00000002 +#define TEXT_ALIGN_RIGHT 0x00000004 +#define TEXT_ALIGN_TOP 0x00000008 +#define TEXT_ALIGN_VCENTER 0x00000010 +#define TEXT_ALIGN_BOTTOM 0x00000020 + +// Right-to-left ordering +#define TEXT_RTL 0x00000100 + +// Text caps +#define TEXT_FONT 0x00010000 +#define TEXT_COLOR 0x00020000 +#define TEXT_COLOR16 0x00040000 + +////////////////////////////////////////////////////////////////////////////// +// +// Run-time Definitions +// + +#ifdef RUN_TIME + +#ifndef _H2INC +typedef short * LPSHORT; +typedef LPVOID * LPLPVOID; +#endif + +// Versions +#define KNPV1_VERSION 0x126 // First K&P version +#define CNCV1_VERSION 0x207 // Click & Create / The Games Factory +#define KNP_VERSION 0x300 + +// Internet Versions +#define FIRST_NETVERSION 0x001 // First vitalize version +#define CCN_NETVERSION 0x002 // CCN applications +#define MORECOMP_NETVERSION 0x003 // Short OIs, compression of levObjs, adpcm sounds, +#define CNC_NETVERSION 0x003 // Current Internet Version + +// Collision mask margins +#define COLMASK_XMARGIN 64 +#define COLMASK_YMARGIN 16 + +// Messages +#define UM_KNP_GETAPPID (WM_APP+7) // No longer used +#define UM_HVSCROLL (WM_APP+8) // No longer used + +// App IDs +#define APPID_KNC 0x3952 // No longer used +#define APPID_KNCSA 0x9172 // No longer used + +// Control IDs +#define ID_EDIT_WIN 300 // ID of edit window + +#endif // RUN_TIME + +// No longer used +#ifndef HFRAN +#define HFRAN LPBYTE +#endif + +// HLO +#define HLO WORD +#define HLO_ERROR ((HLO)-1) +typedef HLO * LPHLO; + +// Frame password size +#define PASSWORD_SIZE 9 + +// Cross-ref tables +enum { + IMG_TAB, + FONT_TAB, + SOUND_TAB, + MUSIC_TAB, + MAX_TABREF +}; + +#ifdef RUN_TIME + +// Preferences +#define PREF_MUSICON 0x4000 +#define PREF_SOUNDON 0x8000 + +// Frame handles +#define HCELL WORD +#define HCELL_ERROR ((WORD)-1) + +// Jump flags +#define MPJC_NOJUMP 0 +#define MPJC_DIAGO 1 +#define MPJC_BUTTON1 2 +#define MPJC_BUTTON2 3 + +// How to play (no longer used) +enum { + HTP_NO=0, + HTP_TXT, + HTP_WRI, + HTP_HLP +}; +#define NB_HTPTYPE 4 + +#endif // RUN_TIME + +// Versions +#define MMFVERSION_MASK 0xFFFF0000 +#define MMFBUILD_MASK 0x00000FFF // MMF build +#define MMFVERFLAG_MASK 0x0000F000 +#define MMFVERFLAG_HOME 0x00008000 // TGF +#define MMFVERFLAG_PRO 0x00004000 // MMF Pro +#define MMFVERFLAG_DEMO 0x00002000 // Demo +#define MMFVERFLAG_PLUGIN 0x00001000 // Plugin +#define MMFVERSION_15 0x01050000 // MMF 1.5 +#define MMFVERSION_20 0x02000000 // MMF 2.0 +#define MMF_CURRENTVERSION MMFVERSION_20 + +// Build numbers +#define MMF_BUILD_NONAME 203 +#define MMF_BUILD_MENUIMAGES 204 +#define MMF_BUILD_SUBAPPICON 205 +#define MMF_BUILD_WINMENUIDX 206 +#define MMF_BUILD_NOTUSED 207 +#define MMF_BUILD_ABOUTTEXT 208 +#define MMF_BUILD_FRAMEDPOS 209 +#define MMF_BUILD_TRSPCOLOR 210 +#define MMF_BUILD_211 211 +#define MMF_BUILD_DEMO 212 +#define MMF_BUILD_PREBETA_2 213 +#define MMF_BUILD_PREBETA_3 214 +#define MMF_BUILD_PREBETA_4 215 // First update Jason's book +#define MMF_BUILD_ALTVALUES 216 +#define MMF_BUILD_EDTCHUNKS 217 +#define MMF_BUILD_COUNTERTEXT 218 +#define MMF_BUILD_SDK 219 // Pre-SDK version +#define MMF_BUILD_SDK2 220 // Second SDK version +#define MMF_BUILD_MVTSDK2 221 // Second Mvt SDK version +#define MMF_BUILD_FIXCOLLISANDBEH 222 +#define MMF_BUILD_PROPFILTERS 223 +#define MMF_BUILD_MFXEXTS 224 +#define MMF_BUILD_LASTFRAMEOFFSET 225 +#define MMF_BUILD_EDUDEMOFEB06 226 +#define MMF_BUILD_GLBOBJBUG 227 +#define MMF_BUILD_IDTC 228 +#define MMF_BUILD_229 229 +#define MMF_BUILD_230 230 +#define MMF_BUILD_231 231 +#define MMF_BUILD_FIXQUALIF 232 +#define MMF_BUILD_233 233 +#define MMF_BUILD_234_TGFPR 234 +#define MMF_BUILD_235 235 +#define MMF_BUILD_236 236 +#define MMF_BUILD_237 237 +#define MMF_BUILD_238 238 +#define MMF_BUILD_239_CD 239 +#define MMF_BUILD_240_DEMO 240 +#define MMF_BUILD_241_SP1 241 +#define MMF_BUILD_242_SP2 242 +#define MMF_BUILD_243_SP3 243 +#define MMF_BUILD_244_SP4 244 +#define MMF_BUILD_245_SP5 245 +#define MMF_BUILD_246_SP6 246 +#define MMF_BUILD_247_SP7 247 +#define MMF_BUILD_248_JAVA 248 +#define MMF_BUILD_249_MOBILE_FLASH 249 +#define MMF_BUILD_250 250 +#define MMF_BUILD_251 251 +#define MMF_BUILD_252 252 +#define MMF_BUILD_253 253 +#define MMF_BUILD_254 254 +#define MMF_CURRENTBUILD MMF_BUILD_254 + +// MFA file format versions +#define MFA_BUILD_ALTSTR 1 // Alterable strings +#define MFA_BUILD_COUNTERTEXT 2 // Text mode in counters +#define MFA_BUILD_LASTFRAMEOFFSET 3 // Additional frame offset +#define MFA_BUILD_FIXQUALIF 4 // Fix in qualifiers + prd version +#ifdef _UNICODE +#define MFA_BUILD_LANGID 5 // Language ID +#define MFA_CURRENTBUILD MFA_BUILD_LANGID +#else +#define MFA_CURRENTBUILD MFA_BUILD_FIXQUALIF +#endif + +// Structures for picture editor +typedef struct EditSurfaceParamsA { + + DWORD m_dwSize; // sizeof(EditSurfaceParams) + LPSTR m_pWindowTitle; // Picture Editor title (NULL = default title) + cSurface* m_pSf; // Surface to edit + DWORD m_dwOptions; // Options, see PictEdDefs.h + DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) + DWORD m_dwFixedHeight;// Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) + POINT m_hotSpot; // Hot spot coordinates + POINT m_actionPoint; // Action point coordinates + +} EditSurfaceParamsA; +typedef EditSurfaceParamsA* LPEDITSURFACEPARAMSA; + +typedef struct EditSurfaceParamsW { + + DWORD m_dwSize; // sizeof(EditSurfaceParams) + LPWSTR m_pWindowTitle; // Picture Editor title (NULL = default title) + cSurface* m_pSf; // Surface to edit + DWORD m_dwOptions; // Options, see PictEdDefs.h + DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) + DWORD m_dwFixedHeight;// Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) + POINT m_hotSpot; // Hot spot coordinates + POINT m_actionPoint; // Action point coordinates + +} EditSurfaceParamsW; +typedef EditSurfaceParamsW* LPEDITSURFACEPARAMSW; + +#ifdef _UNICODE +#define EditSurfaceParams EditSurfaceParamsW +typedef EditSurfaceParamsW* LPEDITSURFACEPARAMS; +#else +#define EditSurfaceParams EditSurfaceParamsA +typedef EditSurfaceParamsA* LPEDITSURFACEPARAMS; +#endif + +typedef struct EditImageParamsA { + + DWORD m_dwSize; // sizeof(EditImageParams) + LPSTR m_pWindowTitle; // Picture Editor title (NULL = default title) + DWORD m_dwImage; // Image to edit - note: only the LOWORD is used in this version + DWORD m_dwOptions; // Options, see PictEdDefs.h + DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) + DWORD m_dwFixedHeight; // Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) + +} EditImageParamsA; +typedef EditImageParamsA* LPEDITIMAGEPARAMSA; + +typedef struct EditImageParamsW { + + DWORD m_dwSize; // sizeof(EditImageParams) + LPWSTR m_pWindowTitle; // Picture Editor title (NULL = default title) + DWORD m_dwImage; // Image to edit - note: only the LOWORD is used in this version + DWORD m_dwOptions; // Options, see PictEdDefs.h + DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) + DWORD m_dwFixedHeight; // Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) + +} EditImageParamsW; +typedef EditImageParamsW* LPEDITIMAGEPARAMSW; + +#ifdef _UNICODE +#define EditImageParams EditImageParamsW +typedef EditImageParamsW* LPEDITIMAGEPARAMS; +#else +#define EditImageParams EditImageParamsA +typedef EditImageParamsA* LPEDITIMAGEPARAMS; +#endif + +// Structure for image list editor +typedef struct EditAnimationParamsA { + + DWORD m_dwSize; // sizeof(EditAnimationParams) + LPSTR m_pWindowTitle; // Picture Editor title (NULL = default title) + int m_nImages; // Number of images in the list + int m_nMaxImages; // Maximum number of images in the list + int m_nStartIndex; // Index of first image to edit in the editor + LPWORD m_pImages; // Image list (one WORD per image) + LPSTR* m_pImageTitles; // Image titles (can be NULL) + DWORD m_dwOptions; // Options, see PictEdDefs.h + DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) + DWORD m_dwFixedHeight; // Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) + +} EditAnimationParamsA; +typedef EditAnimationParamsA* LPEDITANIMATIONPARAMSA; + +typedef struct EditAnimationParamsW { + + DWORD m_dwSize; // sizeof(EditAnimationParams) + LPWSTR m_pWindowTitle; // Picture Editor title (NULL = default title) + int m_nImages; // Number of images in the list + int m_nMaxImages; // Maximum number of images in the list + int m_nStartIndex; // Index of first image to edit in the editor + LPWORD m_pImages; // Image list (one WORD per image) + LPWSTR* m_pImageTitles; // Image titles (can be NULL) + DWORD m_dwOptions; // Options, see PictEdDefs.h + DWORD m_dwFixedWidth; // Default width or fixed width (if PICTEDOPT_FIXEDIMGSIZE is used) + DWORD m_dwFixedHeight; // Default height or fixed height (if PICTEDOPT_FIXEDIMGSIZE is used) + +} EditAnimationParamsW; +typedef EditAnimationParamsW* LPEDITANIMATIONPARAMSW; + +#ifdef _UNICODE +#define EditAnimationParams EditAnimationParamsW +typedef EditAnimationParamsW* LPEDITANIMATIONPARAMS; +#else +#define EditAnimationParams EditAnimationParamsA +typedef EditAnimationParamsA* LPEDITANIMATIONPARAMS; +#endif + +// Global variables structure +#ifdef __cplusplus +class mv { +public: +#else +typedef struct mv { +#endif + + // Common to editor and runtime + HINSTANCE mvHInst; // Application HINSTANCE + npAppli mvIdAppli; // Application object in DLL + npWin mvIdMainWin; // Main window object in DLL + npWin mvIdEditWin; // Child window object in DLL + HWND mvHMainWin; // Main window handle + HWND mvHEditWin; // Child window handle + HPALETTE mvHPal256; // 256 color palette + WORD mvAppMode; // Screen mode with flags + WORD mvScrMode; // Screen mode + DWORD mvEditDXDocToClient; // Edit time only: top-left coordinates + DWORD mvEditDYDocToClient; + CImageFilterMgr* mvImgFilterMgr; // Image filter manager + CSoundFilterMgr* mvSndFilterMgr; // Sound filter manager + CSoundManager* mvSndMgr; // Sound manager + + union { + CEditApp* mvEditApp; // Current application, edit time (not used) + CRunApp* mvRunApp; // Current application, runtime + }; + union { + CEditFrame* mvEditFrame; + CRunFrame* mvRunFrame; + }; + + // Runtime + #ifdef __cplusplus + RunHeader* mvRunHdr; // Current RunHeader + #else + LPVOID mvRunHdr; + #endif + DWORD mvPrefs; // Preferences (sound on/off) + LPTSTR subType; + BOOL mvFullScreen; // Full screen mode + LPTSTR mvMainAppFileName; // App filename + int mvAppListCount; + int mvAppListSize; + CRunApp** mvAppList; + int mvExtListCount; + int mvExtListSize; + LPTSTR * mvExtList; + int mvNbDllTrans; + dllTrans* mvDllTransList; + DWORD mvJoyCaps[32]; + HHOOK mvHMsgHook; + int mvModalLoop; + int mvModalSubAppCount; + LPVOID mvFree[5]; + + // Functions + //////////// + + // Editor: Open Help file + void (CALLBACK * mvHelpA) (LPCSTR pHelpFile, UINT nID, LPARAM lParam); + + // Editor: Get default font for object creation + BOOL (CALLBACK * mvGetDefaultFontA) (LPLOGFONTA plf, LPSTR pStyle, int cbSize); + + // Editor: Edit images and animations + BOOL (CALLBACK * mvEditSurfaceA) (LPVOID edPtr, LPEDITSURFACEPARAMSA pParams, HWND hParent); + BOOL (CALLBACK * mvEditImageA) (LPVOID edPtr, LPEDITIMAGEPARAMSA pParams, HWND hParent); + BOOL (CALLBACK * mvEditAnimationA) (LPVOID edPtr, LPEDITANIMATIONPARAMSA pParams, HWND hParent); + + // Runtime: Extension User data + LPVOID (CALLBACK * mvGetExtUserData) (CRunApp* pApp, HINSTANCE hInst); + LPVOID (CALLBACK * mvSetExtUserData) (CRunApp* pApp, HINSTANCE hInst, LPVOID pData); + + // Runtime: Register dialog box + void (CALLBACK * mvRegisterDialogBox) (HWND hDlg); + void (CALLBACK * mvUnregisterDialogBox) (HWND hDlg); + + // Runtime: Add surface as backdrop object + void (CALLBACK * mvAddBackdrop) (cSurface* pSf, int x, int y, DWORD dwInkEffect, DWORD dwInkEffectParam, int nObstacleType, int nLayer); + + // Runtime: Binary files + BOOL (CALLBACK * mvGetFileA)(LPCSTR pPath, LPSTR pFilePath, DWORD dwFlags); + void (CALLBACK * mvReleaseFileA)(LPCSTR pPath); + HANDLE (CALLBACK * mvOpenHFileA)(LPCSTR pPath, LPDWORD pDwSize, DWORD dwFlags); + void (CALLBACK * mvCloseHFile)(HANDLE hf); + + // Plugin: download file + int (CALLBACK * mvLoadNetFileA) (LPSTR pFilename); + + // Plugin: send command to Vitalize + int (CALLBACK * mvNetCommandA) (int, LPVOID, DWORD, LPVOID, DWORD); + + // Editor & Runtime: Returns the version of MMF or of the runtime + DWORD (CALLBACK * mvGetVersion) (); + + // Editor & Runtime: callback function for properties or other functions + #ifdef _cplusplus + LRESULT (CALLBACK * mvCallFunction) (LPVOID edPtr, int nFnc, LPARAM lParam1=0, LPARAM lParam2=0, LPARAM lParam3=0); + #else + LRESULT (CALLBACK * mvCallFunction) (LPVOID edPtr, int nFnc, LPARAM lParam1, LPARAM lParam2, LPARAM lParam3); + #endif + + // Editor: Open Help file (UNICODE) + void (CALLBACK * mvHelpW) (LPCWSTR pHelpFile, UINT nID, LPARAM lParam); + + // Editor: Get default font for object creation (UNICODE) + BOOL (CALLBACK * mvGetDefaultFontW) (LPLOGFONTW plf, LPWSTR pStyle, int cbSize); + + // Editor: Edit images and animations (UNICODE) + BOOL (CALLBACK * mvEditSurfaceW) (LPVOID edPtr, LPEDITSURFACEPARAMSW pParams, HWND hParent); + BOOL (CALLBACK * mvEditImageW) (LPVOID edPtr, LPEDITIMAGEPARAMSW pParams, HWND hParent); + BOOL (CALLBACK * mvEditAnimationW) (LPVOID edPtr, LPEDITANIMATIONPARAMSW pParams, HWND hParent); + + // Runtime: Binary files (UNICODE + BOOL (CALLBACK * mvGetFileW)(LPCWSTR pPath, LPWSTR pFilePath, DWORD dwFlags); + void (CALLBACK * mvReleaseFileW)(LPCWSTR pPath); + HANDLE (CALLBACK * mvOpenHFileW)(LPCWSTR pPath, LPDWORD pDwSize, DWORD dwFlags); + + // Plugin: download file + int (CALLBACK * mvLoadNetFileW) (LPWSTR pFilename); + + // Plugin: send command to Vitalize + int (CALLBACK * mvNetCommandW) (int, LPVOID, DWORD, LPVOID, DWORD); + + // Place-holder for next versions + LPVOID mvAdditionalFncs[6]; + +#ifdef __cplusplus +}; +#else +} mv; +#endif +typedef mv *LPMV; + +#ifdef _UNICODE +#define mvHelp mvHelpW +#define mvGetDefaultFont mvGetDefaultFontW +#define mvEditSurface mvEditSurfaceW +#define mvEditImage mvEditImageW +#define mvEditAnimation mvEditAnimationW +#define mvGetFile mvGetFileW +#define mvReleaseFile mvReleaseFileW +#define mvLoadNetFile mvLoadNetFileW +#define mvNetCommand mvNetCommandW +#define mvGetFile mvGetFileW +#define mvReleaseFile mvReleaseFileW +#define mvOpenHFile mvOpenHFileW +#else +#define mvHelp mvHelpA +#define mvGetDefaultFont mvGetDefaultFontA +#define mvEditSurface mvEditSurfaceA +#define mvEditImage mvEditImageA +#define mvEditAnimation mvEditAnimationA +#define mvGetFile mvGetFileA +#define mvReleaseFile mvReleaseFileA +#define mvLoadNetFile mvLoadNetFileA +#define mvNetCommand mvNetCommandA +#define mvGetFile mvGetFileA +#define mvReleaseFile mvReleaseFileA +#define mvOpenHFile mvOpenHFileA +#endif + +// Callback function identifiers for mvCallFunction +enum { + // Editor only + EF_INSERTPROPS=1, // Insert properties into Property window + EF_REMOVEPROP, // Remove property + EF_REMOVEPROPS, // Remove properties + EF_REFRESHPROP, // Refresh propery + EF_REALLOCEDITDATA, // Reallocate edPtr + EF_GETPROPVALUE, // Get object's property value + EF_GETAPPPROPVALUE, // Get application's property value + EF_GETFRAMEPROPVALUE, // Get frame's property value + EF_SETPROPVALUE, // Set object's property value + EF_SETAPPPROPVALUE, // Set application's property value + EF_SETFRAMEPROPVALUE, // Set frame's property value + EF_GETPROPCHECK, // Get object's property check state + EF_GETAPPPROPCHECK, // Get application's property check state + EF_GETFRAMEPROPCHECK, // Get frame's property check state + EF_SETPROPCHECK, // Set object's property check state + EF_SETAPPPROPCHECK, // Set application's property check state + EF_SETFRAMEPROPCHECK, // Set frame's property check state + EF_INVALIDATEOBJECT, // Refresh object in frame editor + EF_RECALCLAYOUT, // Recalc runtime layout (docking) + EF_GETNITEMS, // Get number of items - not yet implemented + EF_GETNEXTITEM, // Get next item - not yet implemented + EF_GETNINSTANCES, // Get number of item instances - not yet implemented + EF_GETNEXTINSTANCE, // Get next item instance - not yet implemented + + // Editor & runtime + EF_MALLOC=100, // Allocate memory + EF_CALLOC, // Allocate memory & set it to 0 + EF_REALLOC, // Re-allocate memory + EF_FREE, // Free memory + EF_GETSOUNDMGR, // Get sound manager + EF_CLOSESOUNDMGR, // Close sound manager + EF_ENTERMODALLOOP, // Reserved + EF_EXITMODALLOOP, // Reserved + EF_CREATEEFFECT, // Create effect (runtime only) + EF_DELETEEFFECT, // Delete effect (runtime only) + EF_CREATEIMAGEFROMFILEA,// Create image from file (runtime only) + EF_NEEDBACKGROUNDACCESS,// HWA : tell the frame the frame surface can be read (runtime only) + EF_ISHWA, // Returns TRUE if HWA version (editor and runtime) + EF_ISUNICODE, // Returns TRUE if the editor or runtime is in Unicode mode + EF_ISUNICODEAPP, // Returns TRUE if the application being loaded is a Unicode application + EF_GETAPPCODEPAGE, // Returns the code page of the application + EF_CREATEIMAGEFROMFILEW,// Create image from file (runtime only) +}; + +// 3rd parameter of EF_CREATEIMAGEFROMFILE +typedef struct CreateImageFromFileInfo { + int nSize; + int xHS; + int yHS; + int xAP; + int yAP; + COLORREF trspColor; +} CreateImageFromFileInfo; + + +// Callback function macros for mvCallFunction +#ifdef __cplusplus +__inline void mvInsertProps(LPMV mV, LPVOID edPtr, PropData* pProperties, UINT nInsertPropID, BOOL bAfter) \ + { mV->mvCallFunction(edPtr, EF_INSERTPROPS, (LPARAM)pProperties, (LPARAM)nInsertPropID, (LPARAM)bAfter); } + +__inline void mvRemoveProp(LPMV mV, LPVOID edPtr, UINT nPropID) \ + { mV->mvCallFunction(edPtr, EF_REMOVEPROP, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } + +__inline void mvRemoveProps(LPMV mV, LPVOID edPtr, PropData* pProperties) \ + { mV->mvCallFunction(edPtr, EF_REMOVEPROPS, (LPARAM)pProperties, (LPARAM)0, (LPARAM)0); } + +__inline void mvRefreshProp(LPMV mV, LPVOID edPtr, UINT nPropID, BOOL bReInit) \ + { mV->mvCallFunction(edPtr, EF_REFRESHPROP, (LPARAM)nPropID, (LPARAM)bReInit, (LPARAM)0); } + +__inline LPVOID mvReAllocEditData(LPMV mV, LPVOID edPtr, DWORD dwNewSize) \ + { return (LPVOID)mV->mvCallFunction(edPtr, EF_REALLOCEDITDATA, (LPARAM)edPtr, dwNewSize, 0); } + +__inline CPropValue* mvGetPropValue(LPMV mV, LPVOID edPtr, UINT nPropID) \ + { return (CPropValue*)mV->mvCallFunction(edPtr, EF_GETPROPVALUE, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } + +__inline CPropValue* mvGetAppPropValue(LPMV mV, LPVOID edPtr, UINT nPropID) \ + { return (CPropValue*)mV->mvCallFunction(edPtr, EF_GETAPPPROPVALUE, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } + +__inline CPropValue* mvGetFramePropValue(LPMV mV, LPVOID edPtr, UINT nPropID) \ + { return (CPropValue*)mV->mvCallFunction(edPtr, EF_GETFRAMEPROPVALUE, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } + +__inline void mvSetPropValue(LPMV mV, LPVOID edPtr, UINT nPropID, CPropValue* pValue) \ + { mV->mvCallFunction(edPtr, EF_SETPROPVALUE, (LPARAM)nPropID, (LPARAM)pValue, (LPARAM)0); } + +__inline void mvSetAppPropValue(LPMV mV, LPVOID edPtr, UINT nPropID, CPropValue* pValue) \ + { mV->mvCallFunction(edPtr, EF_SETAPPPROPVALUE, (LPARAM)nPropID, (LPARAM)pValue, (LPARAM)0); } + +__inline void mvSetFramePropValue(LPMV mV, LPVOID edPtr, UINT nPropID, CPropValue* pValue) \ + { mV->mvCallFunction(edPtr, EF_SETFRAMEPROPVALUE, (LPARAM)nPropID, (LPARAM)pValue, (LPARAM)0); } + +__inline UINT mvGetPropCheck(LPMV mV, LPVOID edPtr, UINT nPropID) \ + { return (UINT)mV->mvCallFunction(edPtr, EF_GETPROPCHECK, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } + +__inline UINT mvGetAppPropCheck(LPMV mV, LPVOID edPtr, UINT nPropID) \ + { return (UINT)mV->mvCallFunction(edPtr, EF_GETAPPPROPCHECK, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } + +__inline UINT mvGetFramePropCheck(LPMV mV, LPVOID edPtr, UINT nPropID) \ + { return (UINT)mV->mvCallFunction(edPtr, EF_GETFRAMEPROPCHECK, (LPARAM)nPropID, (LPARAM)0, (LPARAM)0); } + +__inline void mvSetPropCheck(LPMV mV, LPVOID edPtr, UINT nPropID, UINT nCheck) \ + { mV->mvCallFunction(edPtr, EF_SETPROPCHECK, (LPARAM)nPropID, (LPARAM)nCheck, (LPARAM)0); } + +__inline void mvSetAppPropCheck(LPMV mV, LPVOID edPtr, UINT nPropID, UINT nCheck) \ + { mV->mvCallFunction(edPtr, EF_SETAPPPROPCHECK, (LPARAM)nPropID, (LPARAM)nCheck, (LPARAM)0); } + +__inline void mvSetFramePropCheck(LPMV mV, LPVOID edPtr, UINT nPropID, UINT nCheck) \ + { mV->mvCallFunction(edPtr, EF_SETFRAMEPROPCHECK, (LPARAM)nPropID, (LPARAM)nCheck, (LPARAM)0); } + +__inline void mvInvalidateObject(LPMV mV, LPVOID edPtr) \ + { mV->mvCallFunction(edPtr, EF_INVALIDATEOBJECT, (LPARAM)0, (LPARAM)0, (LPARAM)0); } + +__inline LPVOID mvMalloc(LPMV mV, int nSize) \ + { return (LPVOID)mV->mvCallFunction(NULL, EF_MALLOC, (LPARAM)nSize, (LPARAM)0, (LPARAM)0); } + +__inline LPVOID mvCalloc(LPMV mV, int nSize) \ + { return (LPVOID)mV->mvCallFunction(NULL, EF_CALLOC, (LPARAM)nSize, (LPARAM)0, (LPARAM)0); } + +__inline LPVOID mvReAlloc(LPMV mV, LPVOID ptr, int nNewSize) \ + { return (LPVOID)mV->mvCallFunction(NULL, EF_REALLOC, (LPARAM)ptr, (LPARAM)nNewSize, (LPARAM)0); } + +__inline void mvFree(LPMV mV, LPVOID ptr) \ + { mV->mvCallFunction(NULL, EF_FREE, (LPARAM)ptr, (LPARAM)0, (LPARAM)0); } + +__inline void mvRecalcLayout(LPMV mV) \ + { mV->mvCallFunction(NULL, EF_RECALCLAYOUT, (LPARAM)0, (LPARAM)0, (LPARAM)0); } + +__inline CSoundManager* mvGetSoundMgr(LPMV mV) \ + { mV->mvCallFunction(NULL, EF_GETSOUNDMGR, (LPARAM)0, (LPARAM)0, (LPARAM)0); } + +__inline void mvCloseSoundMgr(LPMV mV) \ + { mV->mvCallFunction(NULL, EF_CLOSESOUNDMGR, (LPARAM)0, (LPARAM)0, (LPARAM)0); } + +__inline int mvGetNItems(LPMV mV, LPVOID edPtr, LPCSTR extName) \ + { return mV->mvCallFunction(edPtr, EF_GETNITEMS, (LPARAM)extName, (LPARAM)0, (LPARAM)0); } + +__inline LPVOID mvGetFirstItem(LPMV mV, LPVOID edPtr, LPCSTR extName) \ + { return (LPVOID)mV->mvCallFunction(edPtr, EF_GETNEXTITEM, (LPARAM)extName, (LPARAM)0, (LPARAM)0); } + +__inline LPVOID mvGetNextItem(LPMV mV, LPVOID edPtr, LPVOID edPtr1, LPCSTR extName) \ + { return (LPVOID)mV->mvCallFunction(edPtr, EF_GETNEXTITEM, (LPARAM)edPtr1, (LPARAM)extName, (LPARAM)0); } + +#ifdef HWABETA + +__inline BOOL mvCreateEffect(LPMV mV, LPCSTR pEffectName, LPINT pEffect, LPARAM* pEffectParam) \ + { return (BOOL)mV->mvCallFunction(NULL, EF_CREATEEFFECT, (LPARAM)pEffectName, (LPARAM)pEffect, (LPARAM)pEffectParam); } + +__inline void mvDeleteEffect(LPMV mV, int nEffect, LPARAM lEffectParam) \ + { mV->mvCallFunction(NULL, EF_DELETEEFFECT, (LPARAM)nEffect, (LPARAM)lEffectParam, (LPARAM)0); } + +#endif // HWABETA + +__inline BOOL mvCreateImageFromFileA(LPMV mV, LPWORD pwImg, LPCSTR pFilename, CreateImageFromFileInfo* pInfo) \ + { return (BOOL)mV->mvCallFunction(NULL, EF_CREATEIMAGEFROMFILEA, (LPARAM)pwImg, (LPARAM)pFilename, (LPARAM)pInfo); } + +__inline BOOL mvCreateImageFromFileW(LPMV mV, LPWORD pwImg, LPCWSTR pFilename, CreateImageFromFileInfo* pInfo) \ + { return (BOOL)mV->mvCallFunction(NULL, EF_CREATEIMAGEFROMFILEW, (LPARAM)pwImg, (LPARAM)pFilename, (LPARAM)pInfo); } + +__inline LPVOID mvNeebBackgroundAccess(LPMV mV, CRunFrame* pFrame, BOOL bNeedAccess) \ + { return (LPVOID)mV->mvCallFunction(NULL, EF_NEEDBACKGROUNDACCESS, (LPARAM)pFrame, (LPARAM)bNeedAccess, (LPARAM)0); } + +__inline BOOL mvIsHWAVersion(LPMV mV) \ + { return mV->mvCallFunction(NULL, EF_ISHWA, (LPARAM)0, (LPARAM)0, (LPARAM)0); } + +__inline BOOL mvIsUnicodeVersion(LPMV mV) \ + { return mV->mvCallFunction(NULL, EF_ISUNICODE, (LPARAM)0, (LPARAM)0, (LPARAM)0); } + +__inline BOOL mvIsUnicodeApp(LPMV mV, LPVOID pApp) \ + { return mV->mvCallFunction(NULL, EF_ISUNICODEAPP, (LPARAM)pApp, (LPARAM)0, (LPARAM)0); } + +__inline int mvGetAppCodePage(LPMV mV, LPVOID pApp) \ + { return mV->mvCallFunction(NULL, EF_GETAPPCODEPAGE, (LPARAM)pApp, (LPARAM)0, (LPARAM)0); } + +#ifdef _UNICODE +#define mvCreateImageFromFile mvCreateImageFromFileW +#else +#define mvCreateImageFromFile mvCreateImageFromFileA +#endif + +#endif // __cplusplus + +// Options for OpenHFile +#define OHFF_LOCALFILE 0x0001 // Vitalize mode only: don't try to download file from server + +#ifdef RUN_TIME + +// EnumEltProc definition +typedef int (CALLBACK* ENUMELTPROC)(LPWORD, int, LPARAM, LPARAM); + +// Extension function table +typedef struct tagKpxFunc { + HINSTANCE kpxHInst; + LPTSTR kpxName; + LPTSTR kpxSubType; + LPVOID kpxUserData; + DWORD ( WINAPI * kpxGetInfos) (int); + int ( WINAPI * kpxLoadObject) (mv *, OI*, LPBYTE, int); + void ( WINAPI * kpxUnloadObject) (mv *, LPBYTE, int); + void ( WINAPI * kpxUpdateFileNames) (mv *, LPTSTR, LPBYTE, void (WINAPI * )(LPCTSTR, LPTSTR)); + short( WINAPI * kpxGetRunObjectInfos) (mv *, LPBYTE); + short( WINAPI * kpxWindowProc) (LPBYTE, HWND, UINT, WPARAM, LPARAM); + int ( WINAPI * kpxEnumElts) (mv *, LPBYTE, ENUMELTPROC, ENUMELTPROC, LPARAM, LPARAM); + int ( WINAPI * kpxLoadData) (mv *, OI*, LPBYTE, HFILE, DWORD); // Not used + int ( WINAPI * kpxUnloadData) (mv *, OI*, LPBYTE); // Not used + void ( WINAPI * kpxStartApp) (mv *, CRunApp*); + void ( WINAPI * kpxEndApp) (mv *, CRunApp*); + void ( WINAPI * kpxStartFrame) (mv *, CRunApp*, int); + void ( WINAPI * kpxEndFrame) (mv *, CRunApp*, int); + HGLOBAL ( WINAPI * kpxUpdateEditStructure) (mv *, LPVOID); +#if defined(VITALIZE) + BOOL bValidated; +#endif + BOOL bUnicode; +} kpxFunc; +typedef kpxFunc * fpKpxFunc; + +// Movement Extension +typedef struct MvxFnc { + HINSTANCE mvxHInst; + LPTSTR mvxFileTitle; + + CMvt* ( CALLBACK * mvxCreateMvt) (DWORD); + + #if defined(VITALIZE) + BOOL bValidated; + #endif +} MvxFnc; + +// Old 16/32 bit macros +#define ADDPTR32(p,l) p+=l; +#define SUBPTR32(p,l) p-=l; +#define INCPTR32(p) p++; + +#endif // RUN_TIME + +// Restore structure alignement +#ifndef _H2INC +#pragma pack( pop, _pack_cncy_ ) +#endif + +#ifndef __cplusplus +#undef CImageFilterMgr +#undef CSoundFilterMgr +#undef CSoundManager +#undef CRunApp +#undef CRunFrame +#undef CEditApp +#undef CEditFrame +#undef CMvt +#undef CPropValue +#endif + +#endif // CNCY_H diff --git a/Inc/Cnpdll.h b/Inc/Cnpdll.h index dbbbc3f..8a7905a 100644 --- a/Inc/Cnpdll.h +++ b/Inc/Cnpdll.h @@ -1,1144 +1,1144 @@ -//----------------------------------------------// -// Constantes et structures // -//----------------------------------------------// - -#ifndef _cnpdll_h // Si deja inclus, ignorer -#define _cnpdll_h - -#ifndef PI -#define PI ((double)3.1415926535) -#endif - -#ifndef _H2INC -#ifdef WIN32 -#pragma pack(push, 2) -#else -#pragma pack(2) -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// Include files for H2Inc -#ifdef _H2INC - - #define NOATOM - #define NOMETAFILE 1 - #define NOMINMAX - #define NOMSG - #define NOOPENFILE - #define NOSCROLL - #define NOSOUND 1 - #define NOSYSMETRICS - #define NOTEXTMETRIC - #define NODBCS - #define NOSYSTEMPARAMSINFO - #define NOCOMM 1 - #define NOOEMRESOURCE - #define NOPROFILER 1 - #define NOMDI 1 - - #define MMNODRV 1 - #define MMNOSOUND 1 - #define MMNOAUX 1 - #define MMNOTIMER - #define MMNOMMSYSTEM 1 - - #pragma warning (disable:4010) - #ifdef WIN32 - # include "win32.h" - #endif - #include "empty.h" - -#endif // _H2INC - -#ifdef __cplusplus -class cSurface; -class cSurfaceImplementation; -struct sMask; -#else -#define cSurface void -#define cSurfaceImplementation void -#define sMask void -#endif - - -// Current build -#define MMFS2_CURRENT_BUILD 250 -#define MMFS2_BUILD_MASK 0x0000FFFF -#define MMFS2_BUILD_FLAG_UNICODE 0x00010000 // Unicode support -#define MMFS2_BUILD_FLAG_HWA 0x00020000 // HWA support - -// 2/4 characters -> WORD/DWORD -#ifndef MAC -#define WORDSTR(c1,c2) ((WORD)((WORD)c2<<8|(WORD)c1)) -#define DWORDSTR(c1,c2,c3,c4) ((DWORD)((DWORD)c4<<24|(DWORD)c3<<16|(DWORD)c2<<8|(DWORD)c1)) -#endif - - // Definitions differentes si WIN32 - -// ================== -// Win 32 -// ================== -#ifdef WIN32 - - #define _near - #define __near - #define _far - #define __far - #define _pascal _stdcall - #define __pascal __stdcall - - // Export - #define DLLExport - #ifdef _H2INC - #define DLLExport32 - #else - #ifdef IN_DLL - #define DLLExport32 __declspec(dllexport) - #else - #define DLLExport32 __declspec(dllimport) - #endif - #endif - #define _export - #define __export - - // User messages - #define WM_AMOA WM_APP - -#endif - - // Flags boites de dialogues (obsolete) - // ------------------------- -#define DL_MODAL 1 -#define DL_CENTER_WINDOW 2 -#define DL_CENTER_SCREEN 4 - - // Messages propres a KNP - // ---------------------- -#define WM_IT50 (WM_AMOA+123) -#define WM_NET_FIRST (WM_AMOA+174) // v2 -#define WM_NET_LAST (WM_AMOA+199) - -#define UM_KEYDOWN (WM_AMOA+5) -#define UM_PANIC (WM_AMOA+6) - -#define IT50_WPARAMID 0x2775 - - // Classes de fenetres - // ------------------- -#define PCS_DBL 0x0001 -#define PCS_SNG 0x0002 -#define PCS_SCR 0x0003 -#define PCS_CLASS 0x00FF - -#define PCSF_STRETCH 0x0100 // Stretch log to phys - -#define PCSF_MDIMAIN 0x1000 -#define PCSF_MDICHILD 0x2000 - - // Extra-bytes - // ----------- -#define KNP_WINDOWEXTRA 12 // (3 dwords) -#define KWL_FPWIN 0 // pointeur sur structure DLL fenetre -#define KWL_USER 4 // DWORD disponible pour utilisateur - - // Objects -#ifndef _dllpriv_h -#define Appli void -#define Win void -#define npAppli Appli * -#define npWin Win * -#endif - - // Identifiants errones - // -------------------- -#define NPSPR_ERROR 0 -#define HSPR_ERROR 0 - -enum { - WIN_MEMERR, - WIN_APPERR, - WIN_CREATERR -}; -enum { - CREATELOG_MEMERR=16, - CREATELOG_DCERR, - CREATELOG_BMPERR -}; -#define WIN_ERROR ((npWin)32) -//#define HWIN_ERROR ((HWIN)32) - -enum { - APPLI_MEMERR, - APPLI_TIMERR -}; -#define APPLI_ERROR ((npAppli)32) -//#define HAPPLI_ERROR ((HAPPLI)32) - -// Modes ecran -// ----------- -#define SM_DEFAULT 0x00 // Pour SetModeAppli: mode par défaut - -#define SM_1 0x01 // DDB or DIB -#define SM_4 0x02 // DDB or DIB -#define SM_8 0x03 // DDB or DIB -#define SM_24 0x04 // DDB or DIB -#define SM_4p 0x05 // DDB only -#define SM_15 0x06 // DDB only - -#define SM_16 (SM_15+1) -#define SM_32 (SM_16+1) -#define MAX_MODE SM_32 - -#define SM_D3D 0x10 -#define SM_DDRAW 0x20 // Flag "Direct Draw" -#define SM_VRAM 0x40 // Flag "Video RAM" -#define SM_D3D8 0x80 -#define SM_NOTDIB (SM_DDRAW | SM_VRAM) -#define SM_MASK 0x0F // Mask mode - -// Modes graphiques -#define GROP_NORMAL R2_COPYPEN -#define GROP_XOR R2_XORPEN - -// Modes collisions -#define CM_BOX 0 -#define CM_BITMAP 1 - -// Test collisions -#define CM_TEST_OBSTACLE 0 -#define CM_TEST_PLATFORM 1 - -// Masques de bits d'écriture des plans de collision -#define CM_OBSTACLE 0x0001 -#define CM_PLATFORM 0x0002 - -// Hauteur des plateformes -#define HEIGHT_PLATFORM 6 -#define GCMF_OBSTACLE 0x0000 -#define GCMF_PLATFORM 0x0001 - -// Flags pour GetImageSize -#define GIS_WITHMASK 0x8000 -#define GIS_EXACT 0x4000 - - // AddImage flags -#define AI_WITHMASK 0x0010 // L'image originale a un masque (si son mode en a un) -#define AI_COMPARE 0x0020 // Comparer l'image aux autres -#define AI_ACE 0x0080 // En mode >= 256 couleurs, compacter le sprite -#define AI_FLAGS 0x00F0 // Masque flags - -#define AI_NOCOMP 0x0000 -#define AI_RLE 0x0100 // Compactage type RLE -#define AI_RLEW 0x0200 // Compactage type RLEW -#define AI_RLET 0x0400 // Compactage type RLET -#define AI_LZX 0x0800 // Compactage type LZX -#define AI_ALPHA 0x1000 // The image contains an alpha channel -#define AI_ACECOMP 0x4000 // Compactage sprite type ACE -#define AI_MAC 0x8000 // Flag temporaire utilise par la version MAC (sur?) -#define AI_COMPMASK (IF_RLE | IF_RLEW | IF_RLET) - - // imgFlags -#define IF_NOCOMP 0x00 -#define IF_RLE 0x01 // Compactage type RLE -#define IF_RLEW 0x02 // Compactage type RLEW -#define IF_RLET 0x04 // Compactage type RLET -#define IF_LZX 0x08 // Compactage type LZX -#define IF_ALPHA 0x10 // The image contains an alpha channel -#define IF_ACE 0x40 // Compactage sprite type ACE -#define IF_MAC 0x80 // Flag temporaire utilise par la version MAC (sur?) -#define IF_COMPMASK (IF_RLE | IF_RLEW | IF_RLET) - - // PasteSprite flags -#define PSF_HOTSPOT 0x0001 // Take hot spot into account -#define PSF_NOTRANSP 0x0002 // Non transparent image... ignored in PasteSpriteEffect - - // Ink effects -enum { - EFFECT_NONE=0, - EFFECT_SEMITRANSP, - EFFECT_INVERTED, - EFFECT_XOR, - EFFECT_AND, - EFFECT_OR, - MAX_EFFECT -}; - -#define EFFECTFLAG_TRANSPARENT 0x10000000L -#define EFFECTFLAG_ANTIALIAS 0x20000000L -#define EFFECT_MASK 0xFFFF - - // AddSound flags -#define AS_COMPARE 0x00010000 // Compare to others -#define AS_MASK 0xFFFF0000 - - // PlaySound flags -#define PS_NORMAL 0x0000 // Nothing special -#define PS_UNINTER 0x0001 // Cannot be stopped by other sound except by other UNINTER_PRIO -#define PS_UNINTER_PRIO 0x0002 // Cannot be stopped -#define PS_LOOP 0x0010 // Loop, sLParam = loop number, 0 = continuous -#define PS_GLOBALFOCUS 0x0020 // Sound not stopped if the application loses the focus -#define PS_DSOUND 0x0100 // To play with Direct Sound - - // AddFont flags -#define AF_COMPARE 0x100 // Compare to others - - // WinPasteText flags -#define WPTF_CALCRECT 0x8000 -#define WPTF_WITHPREFIX 0x4000 - - - -// ======================================================================= -// Memory banks -// ======================================================================= -// Public: -// ------- - -// Types -enum { - BK_IMGS, // Image bank - BK_SNGS, // Sound bank - BK_COLMASKS, // Collision mask bank - BK_COLMASKS_PLATFORM, // Platform collision mask bank - BK_IMGTEXTURES, // Image textures - BK_FONTS, // Font bank - BK_MAX -}; - -// ======================================================================= -// Images -// ======================================================================= - -typedef struct Img -{ - DWORD imgCheckSum; - DWORD imgCount; - DWORD imgSize; - short imgWidth; - short imgHeight; - BYTE imgFormat; - BYTE imgFlags; - WORD imgNotUsed; - short imgXSpot; - short imgYSpot; - short imgXAction; - short imgYAction; - COLORREF imgTrspColor; -} Img; -typedef Img* npImg; -typedef Img* fpImg; - - -// ======================================================================= -// Sounds -// ======================================================================= - -typedef struct Sound -{ - DWORD snCheckSum; // Checksum (du son sans l'entete) - DWORD snCount; // Ref count - DWORD snSize; // Taille of datas (including name) - DWORD snFlags; // Type (SP_MIDI, SP_WAVE) + flags - DWORD snReserved; - DWORD snNameSize; -} Sound; -typedef Sound* fpSound; - - // Sound flags -#define SP_WAVE 0x0001 // Flags -#define SP_MIDI 0x0002 -#define SNDF_TYPEMASK 0x000F -#define SNDF_LOADONCALL 0x0010 -#define SNDF_PLAYFROMDISK 0x0020 -#define SNDF_FILE 0x0040 -#define SNDF_UNICODEFILE 0x0080 -#define SNDF_LOADED 0x1000 - -// ======================================================================= -// Fonts -// ======================================================================= - -#ifndef _H2INC - -// Structure Font -typedef struct FontW -{ - DWORD fnCheckSum; // Checksum (des images) - DWORD fnCount; // Compteur d'utilisations - DWORD fnSize; // Taille sans l'entete - LOGFONTW fnLf; // Header font (pour CreateFont si Windows font) -} FontW; -typedef FontW *npFontW; -typedef FontW *fpFontW; - -typedef struct FontA -{ - DWORD fnCheckSum; // Checksum (des images) - DWORD fnCount; // Compteur d'utilisations - DWORD fnSize; // Taille sans l'entete - LOGFONTA fnLf; // Header font (pour CreateFont si Windows font) -} FontA; -typedef FontA *npFontA; -typedef FontA *fpFontA; - -#ifdef _UNICODE -#define Font FontW -#define fpFont fpFontW -#else -#define Font FontA -#define fpFont fpFontA -#endif - -#endif // _H2INC - - // Font avec LOGFONT 16 bits pour version 32 bits - -typedef struct tagLOGFONT16 { - short lfHeight; - short lfWidth; - short lfEscapement; - short lfOrientation; - short lfWeight; - BYTE lfItalic; - BYTE lfUnderline; - BYTE lfStrikeOut; - BYTE lfCharSet; - BYTE lfOutPrecision; - BYTE lfClipPrecision; - BYTE lfQuality; - BYTE lfPitchAndFamily; - BYTE lfFaceName[LF_FACESIZE]; -} LOGFONT16; - - // Structures - // ---------- - - // Zone, box, rectangle -#ifndef _dllpriv_h -typedef struct tagBox -{ - short x1,y1,x2,y2; -} Box; -typedef Box *npBox; -typedef Box *fpBox; -#endif - - // Structure infos ecran -typedef struct tagSMI { - UINT totalBitCount; // I.e. 16 - UINT usedBitCount; // I.e. 15 - UINT mainMode; // SM_4, SM_8, SM_etc... avec flags SM_DDRAW - UINT subMode; // sous-mode - DWORD rMask; - DWORD gMask; - DWORD bMask; - UINT flags; -} screenModeInfos; - - // Objet fenetre -#define WF_SIZE 0x0001 // Flag "resize in progress" -#define WF_STRETCH 0x0002 // Flag "stretch log to phys" -#define WF_NOPAINT 0x0008 // No paint -#define WF_DONOTMERGEZONES 0x0010 // Do not merge new zones -#define WF_IDLE 0x0020 // Idle mode (GetMessage) -#define WF_IDLE50 0x0040 // Idle mode (GetMessage + IT50) -#define WF_IDLEFLAGS (WF_IDLE | WF_IDLE50) // Idle mode flags -#define WF_UNICODE 0x0080 // Flag "view zones" en mode debug -#define WF_SCR 0x0100 // Flag "Screen saver window" -#define WF_MDIMAIN 0x0200 // MDI Frame -#define WF_MDICLIENT 0x0400 // MDI Client -#define WF_MDICHILD 0x0800 // MDI Child -#define WF_OWNDC 0x1000 -#define WF_OWNDCLOG 0x2000 -#define WF_FULLSCREENX2 0x4000 -#define WF_DONOTDESTROY 0x8000 - -#define WF2_NOUPDATE 0x0001 -#define WF2_DIBFULLSCREEN 0x0002 -#define WF2_MMF15 0x0004 -#define WF2_VSYNC 0x0008 -#define WF2_NOBACKSURF 0x0010 - - // Objet application -#define APPF_ENDAPP 0x0001 // Internal -#define APPF_GLOBALSOUNDS 0x0004 - - // Objet sprite -#define SF_RAMBO 0x00000001 // flag "rentre dans tout le monde" -#define SF_RECALCSURF 0x00000002 // Recalc surface (if rotation or stretch) -#define SF_PRIVATE 0x00000004 // flag privé utilisé par le runtime pour la destruction des fade -#define SF_INACTIF 0x00000008 // flag "inactif" = reaffichage ssi intersection avec un autre -#define SF_TOHIDE 0x00000010 // flag "a cacher" -#define SF_TOKILL 0x00000020 // flag "a detruire" -#define SF_REAF 0x00000040 // flag "a reafficher" -#define SF_HIDDEN 0x00000080 // flag "cache" -#define SF_COLBOX 0x00000100 // flag "collisions en mode box" -#define SF_NOSAVE 0x00000200 // flag "do not save background" -#define SF_FILLBACK 0x00000400 // flag "fill background using a solid colour (sprAdrBack)" -#define SF_DISABLED 0x00000800 -#define SF_REAFINT 0x00001000 // Internal -#define SF_OWNERDRAW 0x00002000 // flag "owner draw" -#define SF_OWNERSAVE 0x00004000 // flag "owner save" -#define SF_FADE 0x00008000 // Private - -#define SF_OBSTACLE 0x00010000 // Obstacle -#define SF_PLATFORM 0x00020000 // Platform -#define SF_BACKGROUND 0x00080000 // Backdrop object - -#define SF_SCALE_RESAMPLE 0x00100000 // Resample when stretching -#define SF_ROTATE_ANTIA 0x00200000 // Antialiasing for rotations -#define SF_NOHOTSPOT 0x00400000 // No hot spot -#define SF_OWNERCOLMASK 0x00800000 // Owner-draw sprite supports collision masks - -#define SF_UPDATECOLLIST 0x10000000 - -// SpriteCol_TestPoint / SpriteCol_TestSprite -#define SCF_OBSTACLE 0x01 -#define SCF_PLATFORM 0x02 -#define SCF_EVENNOCOL 0x04 // Flag: returns even sprites that haven't the SF_RAMBO flag -#define SCF_BACKGROUND 0x08 // Flag: if 0, returns active sprites, otherwise returns background sprites -#define SCF_TESTFEET 0x10 // Test only the bottom of the sprite - -#define LAYER_ALL (-1) - -// GetFirst/Last/Next/PrevSprite -#define GS_BACKGROUND 0x0001 -#define GS_SAMELAYER 0x0002 - -// ActiveSprite -#define AS_DEACTIVATE 0x0000 // Desactive un sprite actif -#define AS_REDRAW 0x0001 // Reaffiche un sprite inactif -#define AS_ACTIVATE 0x0002 // Active un sprite inactif -#define AS_ENABLE 0x0004 -#define AS_DISABLE 0x0008 -#define AS_REDRAW_NOBKD 0x0011 -#define AS_REDRAW_RECT 0x0020 - -#define SSF_HIDE 0x0000 // Cacher un sprite -#define SSF_SHOW 0x0001 // Montrer un sprite - -// Ownerdraw sprites, callback function -enum { - SPRITE_DRAW, - SPRITE_RESTORE, - SPRITE_SAVE, - SPRITE_KILL, - SPRITE_GETCOLMASK, -}; - - // Objet libre -#ifndef _dllpriv_h -typedef struct tagObj -{ - UINT objSize; // Taille de l'objet: 0 = fin objets - UINT objPrevSize; // Taille objet precedent (0 = 1er objet) - UINT objType; // Type d'objet (1=vide,2=appli,3=fenetre,...) - UINT objPrev; // Adresse objet precedent de meme type (0 = first) - UINT objNext; // Adresse objet suivant de meme type (0 = last) -} Obj; -typedef Obj *npObj; -typedef Obj *fpObj; -#endif - -#ifndef _H2INC -#ifdef IN_DLL -class Spr; -#endif -#endif - -#define SPRCOLLISLIST - -#ifdef __cplusplus -class Spr -{ -public: -#else -typedef struct Spr -{ -#endif -#ifndef SPRLIST - Obj sprObj; -#endif - DWORD sprFlags; // Flags - WORD sprLayer; // Sprite plane (layer) - short sprAngle; // Angle - int sprZOrder; // Z-order value - - // Coordinates - int sprX; - int sprY; - - // Bounding box - int sprX1; - int sprY1; - int sprX2; - int sprY2; - - // New coordinates - int sprXnew; - int sprYnew; - - // New bounding box - int sprX1new; - int sprY1new; - int sprX2new; - int sprY2new; - - // Background bounding box - int sprX1z; - int sprY1z; - int sprX2z; - int sprY2z; - - // Scale & Angle - float sprScaleX; - float sprScaleY; - - // Temporary values for collisions - WORD sprTempImg; // TODO: use DWORD later? - short sprTempAngle; - float sprTempScaleX; - float sprTempScaleY; - - // Image or owner-draw routine - union { - struct { - DWORD sprImg; // Numero d'image - DWORD sprImgNew; // Nouvelle image - }; - LPARAM sprRout; // Ownerdraw callback routine - }; - - // Ink effect - DWORD sprEffect; // 0=normal, 1=semi-transparent, > 16 = routine - LPARAM sprEffectParam; // parametre effet (coef transparence, etc...) - - // Fill color (wipe with color mode) - COLORREF sprBackColor; - - // Surfaces - cSurfaceImplementation* sprBackSurf; // Background surface, if no general background surface - - cSurfaceImplementation* sprSf; // Surface (if stretched or rotated) - sMask* sprColMask; // Collision mask (if stretched or rotated) - - cSurfaceImplementation* sprTempSf; // Temp surface (if stretched or rotated) - sMask* sprTempColMask; // Temp collision mask (if stretched or rotated) - - // User data - LPARAM sprExtraInfo; - - // Colliding sprites -#ifndef _H2INC -#ifdef IN_DLL - CPTypeArray sprCollisList; // liste de sprites entrant en collisions -#else - int sprCollisList[2]; -#endif -#endif - -#ifdef __cplusplus -}; -#else -} Spr; -#endif -typedef Spr *npSpr; -typedef Spr *fpSpr; - - // Structure "taille d'une appli" -typedef struct tagAppSize { - DWORD asInternal; // Place occupee dans le segment DLL - DWORD asLogics; // Taille ecrans logiques - DWORD asColMasks; // Taille buffers de collision avec le decor - DWORD asImages; // Banque des images - DWORD asMasks; // Banque des masques de collision des images - DWORD asSounds; // Banque des sons - DWORD asFonts; // Banque des fonts - DWORD asSprites; // Buffers de sauvegarde des fonds des sprites -} appSize; -typedef appSize *fpas; - -#ifdef _H2INC -#define CREATESTRUCTA CREATESTRUCT -#define CREATESTRUCTW CREATESTRUCT -#endif - -// Structure pour WinOpenEx -typedef struct tagCWA { - DWORD cwSize; - CREATESTRUCTA cwCreateStruct; - int cwCxMax; - int cwCyMax; - HCURSOR cwHCursor; - union { - DWORD cwBackColor; - HBRUSH cwHBackBrush; - }; - int cwClsWin; - int cwWinFlags; -} CREATEWINA; - -typedef struct CREATEWINEXA { - DWORD cwSize; - CREATESTRUCTA cwCreateStruct; - int cwCxMax; - int cwCyMax; - HCURSOR cwHCursor; - union { - DWORD cwBackColor; - HBRUSH cwHBackBrush; - }; - int cwClsWin; - int cwWinFlags; - HWND cwHWnd; - LPARAM cwNotUsed; -} CREATEWINEXA; - -typedef struct tagCWW { - DWORD cwSize; - CREATESTRUCTW cwCreateStruct; - int cwCxMax; - int cwCyMax; - HCURSOR cwHCursor; - union { - DWORD cwBackColor; - HBRUSH cwHBackBrush; - }; - int cwClsWin; - int cwWinFlags; -} CREATEWINW; - -typedef struct CREATEWINEXW { - DWORD cwSize; - CREATESTRUCTW cwCreateStruct; - int cwCxMax; - int cwCyMax; - HCURSOR cwHCursor; - union { - DWORD cwBackColor; - HBRUSH cwHBackBrush; - }; - int cwClsWin; - int cwWinFlags; - HWND cwHWnd; - LPARAM cwNotUsed; -} CREATEWINEXW; - -#ifdef _UNICODE -#define CREATEWIN CREATEWINW -#define CREATEWINEX CREATEWINEXW -#else -#define CREATEWIN CREATEWINA -#define CREATEWINEX CREATEWINEXA -#endif - -// Structure for SaveRect -typedef struct saveRect { - LPBYTE pData; - RECT rc; -} saveRect; -typedef saveRect* fpSaveRect; - - -//------------------------------ -// Prototypes des fonctions KNPS -//------------------------------ - -#define DialOpen(hi,id,hp,pr,a,b,c,lp) DialogBoxParam(hi,id,hp,pr,lp) - -DLLExport32 DWORD WINAPI GetDLLVersion(); - - // Application - // ----------- -DLLExport32 npAppli WINAPI InitAppli (HINSTANCE, HPALETTE); -DLLExport32 DWORD WINAPI SetModeAppli (npAppli, int); -DLLExport32 int WINAPI LockBank (npAppli, int); -DLLExport32 int WINAPI UnlockBank (npAppli, int); -DLLExport32 int WINAPI PurgeBank (npAppli, int); -DLLExport32 void WINAPI KillBank (npAppli, int); -DLLExport32 int WINAPI Bank_GetEltCount (npAppli ptApp, UINT bkNum); -DLLExport32 LPVOID WINAPI Bank_GetEltAddr (npAppli ptApp, UINT bkNum, UINT eNum); - -DLLExport32 void WINAPI EndAppli (npAppli); - - // Windows, dialogues - // ------------------ -DLLExport32 npWin WINAPI WinOpenExA (npAppli, CREATEWINA *); -DLLExport32 npWin WINAPI WinOpenExW (npAppli, CREATEWINW *); -DLLExport32 npWin WINAPI SCRWinOpenA (npAppli, HWND); -DLLExport32 npWin WINAPI SCRWinOpenW (npAppli, HWND); -DLLExport32 void WINAPI WCDClose (npWin); -DLLExport32 HWND WINAPI WinGetHandle (npWin); -DLLExport32 HWND WINAPI WinGetMCHandle (npWin); -DLLExport32 HDC WINAPI WinGetHDC (npWin); -DLLExport32 HDC WINAPI WinGetHDCLog (npWin); -DLLExport32 void WINAPI WinReleaseHDC (npWin, HDC); -DLLExport32 void WINAPI WinReleaseHDCLog (npWin, HDC); -DLLExport32 void WINAPI WinGetLogRect (npWin, RECT *); -DLLExport32 npWin WINAPI WinSearch (HWND); - -DLLExport32 LRESULT CALLBACK DefMsgProcA (HWND hWin, UINT uMsg, WPARAM wParam, LPARAM lParam); -DLLExport32 LRESULT CALLBACK DefMsgProcW (HWND hWin, UINT uMsg, WPARAM wParam, LPARAM lParam); - -#ifdef _UNICODE -#define WinOpenEx WinOpenExW -#define SCRWinOpen SCRWinOpenW -#define DefMsgProc DefMsgProcW -#else -#define WinOpenEx WinOpenExA -#define SCRWinOpen SCRWinOpenA -#define DefMsgProc DefMsgProcA -#endif - - // Menus - // ----- -DLLExport32 HMENU WINAPI WinSetMenu (npWin, HMENU, HACCEL); -//DLLExport32 void WINAPI WinSetAccel (npWin, HACCEL); - - // Souris - // ------ -DLLExport32 HCURSOR WINAPI WinSetMouse (npWin, HCURSOR); -DLLExport32 void WINAPI WinStartWait (npWin); -DLLExport32 void WINAPI WinEndWait (npWin); - - // Events - // ------ -//DLLExport32 WORD WINAPI GetMsg (npWin, fpKm); -//DLLExport32 DWORD WINAPI GetIt50 (void); -//DLLExport32 DWORD WINAPI RazCptVbl (void); -//DLLExport32 DWORD WINAPI GetCptVbl (void); -//DLLExport32 void WINAPI EnableIt50 (npWin, int); - - // Graphics - // -------- -DLLExport32 void WINAPI WinClip (npWin, int, int, int, int); -DLLExport32 void WINAPI WinFillRect (npWin, int, int, int, int, DWORD); -DLLExport32 void WINAPI WinFillBr (npWin, int, int, int, int, HBRUSH); -DLLExport32 void WINAPI WinBox (npWin, fpBox); -DLLExport32 void WINAPI WinRect (npWin, RECT *); -DLLExport32 void WINAPI WinLine (npWin, POINT *, UINT); -DLLExport32 void WINAPI WinGrabDesktop (npWin); - -#ifndef IN_KPX -DLLExport32 int WINAPI StartFullScreen (npWin, int, int, int); -DLLExport32 int WINAPI EndFullScreen (); -#endif // IN_KPX - -DLLExport32 void WINAPI WinPaper (npWin, COLORREF); -DLLExport32 void WINAPI WinPen (npWin, COLORREF, int, int); -DLLExport32 void WINAPI WinGraphMode (npWin, int); - -#define WSP_NBSPRITES 1 -#define WSP_SETAPPFLAGS 2 -#define WSP_GETAPPFLAGS 4 -#define WSP_GETWINFLAGS2 9 -#define WSP_SETWINFLAGS2 10 -DLLExport32 BOOL WINAPI WinSetParam (npWin, int, UINT, DWORD); - - // Dibs - // ---- -DLLExport32 DWORD WINAPI InitDibHeader (npAppli, int, int, int, BITMAPINFO *); -DLLExport32 void WINAPI FillDib (BITMAPINFO *, COLORREF); -DLLExport32 DWORD WINAPI ImageToDib (npAppli, DWORD, DWORD, LPBYTE); -DLLExport32 DWORD WINAPI DibToImage (npAppli, fpImg, BITMAPINFOHEADER *); -DLLExport32 DWORD WINAPI DibToImageEx (npAppli, fpImg, BITMAPINFOHEADER *, COLORREF, DWORD); -DLLExport32 void WINAPI RemapDib (BITMAPINFO *, npAppli, LPBYTE); - - // Palette - // ------- -DLLExport32 HPALETTE WINAPI SetDefaultPalette256 (PALETTEENTRY *); -DLLExport32 void WINAPI SetPaletteAppli (npAppli, HPALETTE); -DLLExport32 int WINAPI GetPaletteAppli (LOGPALETTE *, int, npAppli); -DLLExport32 int WINAPI GetNearestIndex (npAppli, int, COLORREF); -DLLExport32 COLORREF WINAPI GetRGB (npAppli, int, int); -DLLExport32 int WINAPI GetOpaqueBlack (npAppli); - - // Font - // ---- -#ifndef _H2INC -DLLExport32 DWORD WINAPI AddFontA (npAppli, DWORD, fpFontA, LPDWORD, DWORD); -DLLExport32 DWORD WINAPI IncFontCount (npAppli, DWORD); -DLLExport32 long WINAPI DelFont (npAppli, DWORD); -DLLExport32 int WINAPI GetFontInfosA (npAppli, DWORD, fpFontA, LPDWORD); -DLLExport32 HFONT WINAPI WinCreateFont (npAppli, DWORD); -DLLExport32 int WINAPI WinPasteTextA (npWin, HFONT, RECT*, LPSTR, COLORREF, DWORD); - -DLLExport32 DWORD WINAPI AddFontW (npAppli ptApp, DWORD fType, fpFontW fntHdr, LPDWORD lpw, DWORD nbw); -DLLExport32 int WINAPI GetFontInfosW (npAppli ptApp, DWORD nFont, fpFontW fntHdr, LPDWORD lpw); -DLLExport32 int WINAPI WinPasteTextW (npWin, HFONT, RECT*, LPWSTR, COLORREF, DWORD); - - // Fonts - fonctions 32 bits utilisant des structures 16 bits -DLLExport32 void WINAPI LogFont16To32A ( LOGFONTA * lf32, LOGFONT16 * lf16 ); -DLLExport32 void WINAPI LogFont32To16A ( LOGFONT16 * lf16, LOGFONTA * lf32 ); -DLLExport32 HFONT WINAPI CreateFontIndirect16 ( LOGFONT16 * lFont ); - -DLLExport32 void WINAPI LogFont16To32W ( LOGFONTW * lf32, LOGFONT16 * lf16 ); -DLLExport32 void WINAPI LogFont32To16W ( LOGFONT16 * lf16, LOGFONTW * lf32 ); - -#ifdef _UNICODE -#define AddFont AddFontW -#define GetFontInfos GetFontInfosW -#define WinPasteText WinPasteTextW -#define LogFont16To32 LogFont16To32W -#define LogFont32To16 LogFont32To16W -#else -#define AddFont AddFontA -#define GetFontInfos GetFontInfosA -#define WinPasteText WinPasteTextA -#define LogFont16To32 LogFont16To32A -#define LogFont32To16 LogFont32To16A -#endif - -#endif // _H2INC - - - - // Images - // ------ -DLLExport32 void WINAPI PasteSprite (npWin, DWORD, int, int, DWORD); -DLLExport32 void WINAPI PasteSpriteEffect (npWin, DWORD, int, int, DWORD, DWORD, LPARAM); -DLLExport32 DWORD WINAPI AddImage (npAppli, WORD, WORD, short, short, short, short, COLORREF, DWORD, LPVOID, LPBYTE); -DLLExport32 DWORD WINAPI IncImageCount (npAppli, DWORD); -DLLExport32 int WINAPI IsImageEmpty (npAppli, DWORD); -DLLExport32 DWORD WINAPI GetImageBits (npAppli, DWORD, DWORD, LPBYTE); -DLLExport32 void WINAPI StretchImage (npAppli, DWORD, WORD, WORD, LPBYTE); -DLLExport32 long WINAPI DelImage (npAppli, DWORD); -DLLExport32 sMask* WINAPI AddMask (npAppli ptApp, DWORD iNum, UINT nFlags); -DLLExport32 long WINAPI DelMask (npAppli, DWORD); -DLLExport32 int WINAPI GetImageInfos (npAppli, DWORD, fpImg); -DLLExport32 int WINAPI GetImageInfoEx (npAppli pApp, DWORD nImage, int nAngle, float fScaleX, float fScaleY, fpImg pIfo); -DLLExport32 DWORD WINAPI GetImageSize (WORD, WORD, WORD); -DLLExport32 sMask* WINAPI GetImageMask (npAppli ptApp, DWORD dwImage, UINT nFlags); -DLLExport32 sMask* WINAPI CompleteSpriteColMask (npWin ptrWin, npSpr ptSpr, DWORD dwPSCFlags, UINT nWidth, UINT nHeight); -DLLExport32 DWORD WINAPI PrepareSpriteColMask (npWin ptrWin, npSpr ptSpr, DWORD newImg, int newX, int newY, int newAngle, float newScaleX, float newScaleY, RECT* prc, sMask** ppMask); - - // Sprites - // ------- -DLLExport32 npSpr WINAPI AddSprite (npWin ptrWin, int xSpr, int ySpr, DWORD iSpr, WORD wLayer, int nZOrder, DWORD backSpr, DWORD sFlags, LPARAM extraInfo); -DLLExport32 npSpr WINAPI AddOwnerDrawSprite (npWin ptrWin, int x1, int y1, int x2, int y2, WORD wLayer, int nZOrder, DWORD backSpr, DWORD sFlags, LPARAM extraInfo, LPARAM sprProc); -DLLExport32 npSpr WINAPI ModifSprite (npWin ptrWin, npSpr ptSpr, int xSpr, int ySpr, DWORD iSpr); -DLLExport32 npSpr WINAPI ModifSpriteEx (npWin ptrWin, npSpr ptSpr, int xSpr, int ySpr, DWORD iSpr, float fScaleX, float fScaleY, BOOL bResample, int nAngle, BOOL bAntiA); -DLLExport32 npSpr WINAPI ModifSpriteEffect (npWin ptrWin, npSpr ptSpr, DWORD effect, LPARAM effectParam); -DLLExport32 npSpr WINAPI ModifOwnerDrawSprite (npWin ptrWin, npSpr ptSprModif, int x1, int y1, int x2, int y2); -DLLExport32 void WINAPI ShowSprite (npWin, npSpr, int); -DLLExport32 void WINAPI ActiveSprite (npWin, npSpr, int); -DLLExport32 void WINAPI DelSprites (npWin); -DLLExport32 void WINAPI DelSprite (npWin, npSpr); -DLLExport32 void WINAPI DelSpriteFast (npWin, npSpr); -DLLExport32 LPARAM WINAPI GetSpriteExtra (npWin, npSpr); -DLLExport32 DWORD WINAPI GetSpriteFlags (npWin, npSpr); -DLLExport32 DWORD WINAPI SetSpriteFlags (npWin ptrWin, npSpr ptSpr, DWORD dwNewFlags); -DLLExport32 void WINAPI SpriteClear (npWin); -DLLExport32 void WINAPI SpriteDraw (npWin); -DLLExport32 void WINAPI SpriteUpdate (npWin); -DLLExport32 void WINAPI ScreenUpdate (npWin); - -DLLExport32 void WINAPI GetSpriteScale (npWin ptrWin, npSpr ptSpr, float* pScaleX, float* pScaleY, BOOL* pResample); -DLLExport32 void WINAPI SetSpriteScale (npWin ptrWin, npSpr ptSpr, float fScaleX, float fScaleY, BOOL bResample); -DLLExport32 int WINAPI GetSpriteAngle (npWin ptrWin, npSpr ptSpr, BOOL* pAntiA); -DLLExport32 void WINAPI SetSpriteAngle (npWin ptrWin, npSpr ptSpr, int nAngle, BOOL bAntiA); -DLLExport32 void WINAPI GetSpriteRect (npWin ptrWin, npSpr ptSpr, RECT* prc); -DLLExport32 void WINAPI MoveSpriteToFront(npWin ptrWin, npSpr pSpr); -DLLExport32 void WINAPI MoveSpriteToBack (npWin ptrWin, npSpr pSpr); -DLLExport32 void WINAPI MoveSpriteBefore (npWin ptrWin, npSpr pSprToMove, npSpr pSprDest); -DLLExport32 void WINAPI MoveSpriteAfter (npWin ptrWin, npSpr pSprToMove, npSpr pSprDest); -DLLExport32 BOOL WINAPI IsSpriteBefore (npWin ptrWin, npSpr pSpr, npSpr pSprDest); -DLLExport32 BOOL WINAPI IsSpriteAfter (npWin ptrWin, npSpr pSpr, npSpr pSprDest); -DLLExport32 void WINAPI SwapSprites (npWin ptrWin, npSpr sp1, npSpr sp2); -DLLExport32 int WINAPI GetSpriteLayer (npWin ptrWin, npSpr ptSpr); -DLLExport32 void WINAPI SetSpriteLayer (npWin ptrWin, npSpr ptSpr, int nLayer); -DLLExport32 sMask* WINAPI GetSpriteMask (npWin ptrWin, npSpr pSpr, UINT newImg, UINT nFlags); - -DLLExport32 npSpr WINAPI GetFirstSprite (npWin ptrWin, int nLayer, DWORD dwFlags); -DLLExport32 npSpr WINAPI GetNextSprite (npWin ptrWin, npSpr pSpr, DWORD dwFlags); -DLLExport32 npSpr WINAPI GetPrevSprite (npWin ptrWin, npSpr pSpr, DWORD dwFlags); -DLLExport32 npSpr WINAPI GetLastSprite (npWin ptrWin, int nLayer, DWORD dwFlags); - - // Sauvegarde / Restitution de zones - // --------------------------------- -DLLExport32 void WINAPI WinResetZones (npWin); -DLLExport32 void WINAPI WinAddZone (npWin, RECT *); -DLLExport32 void WINAPI WinAddCoord (npWin, int, int, int, int); -DLLExport32 int WINAPI SaveRect (npWin, fpSaveRect, int, int, int, int); -DLLExport32 void WINAPI RestoreRect (npWin, fpSaveRect); -DLLExport32 void WINAPI KillRect (fpSaveRect); -DLLExport32 UINT* WINAPI WinGetZones (npWin); -DLLExport32 void WINAPI WinEnableUpdate (npWin, int); - - // Collisions - // ---------- -DLLExport32 DWORD WINAPI SetSpriteColFlag (npWin, npSpr, DWORD); // UINT = SF_xxxx -DLLExport32 npSpr WINAPI SpriteCol_TestPoint (npWin, npSpr, int, int, int, DWORD); // Entre 1 pixel et les sprites sauf un -DLLExport32 npSpr WINAPI SpriteCol_TestRect (npWin, npSpr, int, int, int, int, int, DWORD); // Entre 1 rectangle et les sprites sauf un -DLLExport32 npSpr WINAPI SpriteCol_TestSprite (npWin ptrWin, npSpr ptSpr, DWORD newImg, int newX, int newY, int newAngle, float newScaleX, float newScaleY, int subHt, DWORD dwFlags); -DLLExport32 UINT WINAPI SpriteCol_TestSprite_All (npWin, npSpr, LPVOID*, DWORD, int, int, int, float, float, DWORD); -DLLExport32 int WINAPI WinSetColMode (npWin, WORD); // Mode BOX ou BITMAP - -DLLExport32 BOOL WINAPI ColMask_Create (npWin, UINT, UINT, DWORD); // Creation bitmap masque fond -DLLExport32 BOOL WINAPI ColMask_CreateEx (npWin, int, int, int, int, DWORD); -DLLExport32 void WINAPI ColMask_Kill (npWin); // Destruction masque fond -DLLExport32 void WINAPI ColMask_Fill (npWin, DWORD); // Init masque fond -DLLExport32 int WINAPI ColMask_FillRectangle (npWin, int, int, int, int, DWORD); -DLLExport32 void WINAPI ColMask_OrImage (npWin, DWORD, int, int, DWORD); -DLLExport32 void WINAPI ColMask_OrMask (npWin, sMask*, int, int, DWORD, DWORD); -DLLExport32 void WINAPI ColMask_OrPlatform (npWin, DWORD, int, int); -DLLExport32 void WINAPI ColMask_OrPlatformMask (npWin, sMask*, int, int); -DLLExport32 int WINAPI ColMask_Scroll (npWin, int, int, RECT *, RECT *); -DLLExport32 void WINAPI ColMask_SetOrigin (npWin, int, int); -DLLExport32 void WINAPI ColMask_ToLog (npWin ptrWin, UINT nPlane); -DLLExport32 void WINAPI ColMask_SetClip (npWin, RECT *); - -DLLExport32 BOOL WINAPI ColMask_TestPoint (npWin ptrWin, int x, int y, UINT nPlane); -DLLExport32 BOOL WINAPI ColMask_TestSprite (npWin ptrWin, npSpr pSpr, int newImg, int newX, int newY, int newAngle, float newScaleX, float newScaleY, int subHt, UINT nPlane); -DLLExport32 int WINAPI ColMask_TestRect (npWin, int, int, int, int, UINT nPlane); - -DLLExport32 BOOL WINAPI Mask_TestPoint (LPBYTE pMask, int x, int y, int nMaskWidth, int nMaskHeight); -DLLExport32 BOOL WINAPI Mask_TestMask (LPBYTE pMaskBits1, LPBYTE pMaskBits2, int x1Spr1, int y1Spr1, int wSpr1, int hSpr1, int x1Spr2, int y1Spr2, int wSpr2, int hSpr2); -DLLExport32 BOOL WINAPI Mask_TestRect (LPBYTE pMask, int nMaskWidth, int nMaskHeight, int x, int y, int nWidth, int nHeight); - - // Hooks - // ----- -DLLExport32 HHOOK WINAPI StartFilterHook (HWND); -DLLExport32 int WINAPI StopFilterHook (HHOOK); - - // Divers - // ------ -#define WavePerio() - - // New - // --- -DLLExport32 void WINAPI WinSetFlags (npWin, WORD); -DLLExport32 WORD WINAPI WinGetFlags (npWin); -DLLExport32 int WINAPI WinScroll (npWin, int, int, int, int, int, int); - -DLLExport32 int WINAPI EnumScreenModes (screenModeInfos *ptsfo, int maxModes, UINT flags); - - // V2 - // -- - -#define HCSPALETTE UINT - -DLLExport32 HCSPALETTE WINAPI AddPalette (LOGPALETTE* pLogPal); -DLLExport32 void WINAPI DelPalette (HCSPALETTE pCsPal); -DLLExport32 void WINAPI SetAppCSPalette (npAppli ptrApp, HPALETTE hpal, HCSPALETTE pCsPal); -DLLExport32 HCSPALETTE WINAPI GetAppCSPalette (npAppli ptrApp); - -// Sounds - -#ifdef __cplusplus -class CSoundManager; -DLLExport32 int WINAPI PlaySndA (CSoundManager* pSndMgr, npAppli ptApp, UINT sNum, HWND hWin, DWORD sFlags, DWORD sLParam, UINT nChannel); -DLLExport32 int WINAPI PlaySndW (CSoundManager* pSndMgr, npAppli ptApp, UINT sNum, HWND hWin, DWORD sFlags, DWORD sLParam, UINT nChannel); -#endif // __cplusplus - -DLLExport32 void WINAPI PauseSnd (npAppli ptApp, UINT sType, UINT sNum); -DLLExport32 void WINAPI PauseSndChannel (npAppli ptApp, UINT nChannel); -DLLExport32 void WINAPI ResumeSnd (npAppli ptApp, UINT sType, UINT sNum); -DLLExport32 void WINAPI ResumeSndChannel (npAppli ptApp, UINT nChannel); -DLLExport32 void WINAPI StopSnd (npAppli ptApp, UINT sType, UINT sNum); -DLLExport32 void WINAPI StopSndChannel (npAppli ptApp, UINT nChannel); -DLLExport32 int WINAPI IsSndPlaying (npAppli ptApp, UINT nSound); -DLLExport32 int WINAPI IsSndChannelPlaying (npAppli ptApp, UINT nChannel); -DLLExport32 int WINAPI IsSndPaused (npAppli ptApp, UINT nSound); -DLLExport32 int WINAPI IsSndChannelPaused (npAppli ptApp, UINT nChannel); -DLLExport32 void WINAPI SetSndMainVolume (npAppli ptApp, UINT sType, int nVolume); -DLLExport32 void WINAPI SetSndMainPan (npAppli ptApp, UINT sType, int nPan); -DLLExport32 int WINAPI GetSndMainVolume (npAppli ptApp, UINT sType); -DLLExport32 int WINAPI GetSndMainPan (npAppli ptApp, UINT sType); -DLLExport32 void WINAPI SetSndChannelVolume (npAppli ptApp, UINT nChannel, int nVolume); -DLLExport32 void WINAPI SetSndChannelPan (npAppli ptApp, UINT nChannel, int nPan); -DLLExport32 void WINAPI SetSndVolume (npAppli ptApp, UINT sType, UINT sNum, int nVolume); -DLLExport32 void WINAPI SetSndPan (npAppli ptApp, UINT sType, UINT sNum, int nPan); -DLLExport32 int WINAPI GetSndChannelVolume (npAppli ptApp, UINT nChannel); -DLLExport32 int WINAPI GetSndChannelPan (npAppli ptApp, UINT nChannel); -DLLExport32 int WINAPI GetSndVolume (npAppli ptApp, UINT sType, UINT sNum); -DLLExport32 int WINAPI GetSndPan (npAppli ptApp, UINT sType, UINT sNum); -DLLExport32 DWORD WINAPI GetSndChannelDuration (npAppli ptApp, UINT nChannel); -DLLExport32 DWORD WINAPI GetSndChannelPosition (npAppli ptApp, UINT nChannel); -DLLExport32 void WINAPI SetSndChannelPosition (npAppli ptApp, UINT nChannel, DWORD dwPosition); -DLLExport32 DWORD WINAPI GetSndDuration (npAppli ptApp, UINT sType, UINT sNum); -DLLExport32 DWORD WINAPI GetSndPosition (npAppli ptApp, UINT sType, UINT sNum); -DLLExport32 void WINAPI SetSndPosition (npAppli ptApp, UINT sType, UINT sNum, DWORD dwPosition); -DLLExport32 UINT WINAPI FindSndFromNameA(npAppli ptApp, UINT sType, LPCSTR pName); -DLLExport32 UINT WINAPI FindSndFromNameW(npAppli ptApp, UINT sType, LPCWSTR pName); -DLLExport32 int WINAPI GetSndChannel(npAppli ptApp, UINT sNum); - -DLLExport32 void WINAPI LockSndChannel (npAppli ptApp, UINT nChannel, BOOL bLock); -DLLExport32 void WINAPI SetSndChannelFreq (npAppli ptApp, UINT nChannel, DWORD dwFreq); -DLLExport32 void WINAPI SetSndFreq (npAppli ptApp, UINT sType, UINT sNum, DWORD dwFreq); -DLLExport32 DWORD WINAPI GetSndChannelFreq (npAppli ptApp, UINT nChannel); -DLLExport32 DWORD WINAPI GetSndFreq (npAppli ptApp, UINT sType, UINT sNum); - -DLLExport32 UINT WINAPI AddSoundA (npAppli, UINT, LPSTR, LPBYTE, DWORD); -DLLExport32 UINT WINAPI ReplaceSoundA (npAppli ptApp, UINT sFlags, UINT nSound, LPSTR fpName, LPBYTE lpData, DWORD dwDataSize); -DLLExport32 BOOL WINAPI SetSoundFlags (npAppli ptApp, UINT nSound, UINT sFlags); -DLLExport32 DWORD WINAPI IncSoundCount (npAppli, UINT); -DLLExport32 int WINAPI GetSoundInfoA (npAppli, UINT, fpSound); -DLLExport32 int WINAPI GetSoundNameA (npAppli, UINT, LPSTR, UINT); -DLLExport32 long WINAPI GetSoundData (npAppli, UINT, LPBYTE); -DLLExport32 LPBYTE WINAPI GetSoundDataPtr (npAppli, UINT); -DLLExport32 long WINAPI DelSound (npAppli, UINT); - -DLLExport32 UINT WINAPI AddSoundW (npAppli, UINT, LPWSTR, LPBYTE, DWORD); -DLLExport32 UINT WINAPI ReplaceSoundW (npAppli ptApp, UINT sFlags, UINT nSound, LPWSTR fpName, LPBYTE lpData, DWORD dwDataSize); -DLLExport32 int WINAPI GetSoundNameW (npAppli, UINT, LPWSTR, UINT); -DLLExport32 int WINAPI GetSoundInfoW (npAppli, UINT, fpSound); - -#ifdef _UNICODE -#define AddSound AddSoundW -#define ReplaceSound ReplaceSoundW -#define GetSoundName GetSoundNameW -#define GetSoundInfo GetSoundInfoW -#define FindSndFromName FindSndFromNameW -#define PlaySnd PlaySndW -#else -#define AddSound AddSoundA -#define ReplaceSound ReplaceSoundA -#define GetSoundName GetSoundNameA -#define GetSoundInfo GetSoundInfoA -#define FindSndFromName FindSndFromNameA -#define PlaySnd PlaySndA -#endif - -DLLExport32 int WINAPI WaveSetChannels (npAppli ptApp, int nChannels); - -#ifdef __cplusplus -} -#endif - -#ifndef _H2INC -enum { - LOCKIMAGE_READBLITONLY, - LOCKIMAGE_ALLREADACCESS, - LOCKIMAGE_HWACOMPATIBLE -}; - -#ifdef __cplusplus -DLLExport32 BOOL WINAPI WinAttachSurface (int idWin, cSurface * cs); -DLLExport32 void WINAPI WinDetachSurface (int idWin); - -DLLExport32 BOOL WINAPI LockImageSurface (LPVOID, DWORD hImage, cSurface &cs, int flags=LOCKIMAGE_READBLITONLY); -DLLExport32 void WINAPI UnlockImageSurface (cSurface &cs); - -// Get window surface (logical screen) -enum { - WSURF_LOGSCREEN, - WSURF_BACKSAVE -}; -DLLExport32 cSurface * WINAPI WinGetSurface (int idWin, int surfID=WSURF_LOGSCREEN); -#endif // __cplusplus -#endif // !defined(_H2INC) - -#ifndef _H2INC -#ifdef WIN32 -#pragma pack(pop) -#else -#pragma pack() -#endif -#endif - -#endif // _cnpdll_h +//----------------------------------------------// +// Constantes et structures // +//----------------------------------------------// + +#ifndef _cnpdll_h // Si deja inclus, ignorer +#define _cnpdll_h + +#ifndef PI +#define PI ((double)3.1415926535) +#endif + +#ifndef _H2INC +#ifdef WIN32 +#pragma pack(push, 2) +#else +#pragma pack(2) +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// Include files for H2Inc +#ifdef _H2INC + + #define NOATOM + #define NOMETAFILE 1 + #define NOMINMAX + #define NOMSG + #define NOOPENFILE + #define NOSCROLL + #define NOSOUND 1 + #define NOSYSMETRICS + #define NOTEXTMETRIC + #define NODBCS + #define NOSYSTEMPARAMSINFO + #define NOCOMM 1 + #define NOOEMRESOURCE + #define NOPROFILER 1 + #define NOMDI 1 + + #define MMNODRV 1 + #define MMNOSOUND 1 + #define MMNOAUX 1 + #define MMNOTIMER + #define MMNOMMSYSTEM 1 + + #pragma warning (disable:4010) + #ifdef WIN32 + # include "win32.h" + #endif + #include "empty.h" + +#endif // _H2INC + +#ifdef __cplusplus +class cSurface; +class cSurfaceImplementation; +struct sMask; +#else +#define cSurface void +#define cSurfaceImplementation void +#define sMask void +#endif + + +// Current build +#define MMFS2_CURRENT_BUILD 250 +#define MMFS2_BUILD_MASK 0x0000FFFF +#define MMFS2_BUILD_FLAG_UNICODE 0x00010000 // Unicode support +#define MMFS2_BUILD_FLAG_HWA 0x00020000 // HWA support + +// 2/4 characters -> WORD/DWORD +#ifndef MAC +#define WORDSTR(c1,c2) ((WORD)((WORD)c2<<8|(WORD)c1)) +#define DWORDSTR(c1,c2,c3,c4) ((DWORD)((DWORD)c4<<24|(DWORD)c3<<16|(DWORD)c2<<8|(DWORD)c1)) +#endif + + // Definitions differentes si WIN32 + +// ================== +// Win 32 +// ================== +#ifdef WIN32 + + #define _near + #define __near + #define _far + #define __far + #define _pascal _stdcall + #define __pascal __stdcall + + // Export + #define DLLExport + #ifdef _H2INC + #define DLLExport32 + #else + #ifdef IN_DLL + #define DLLExport32 __declspec(dllexport) + #else + #define DLLExport32 __declspec(dllimport) + #endif + #endif + #define _export + #define __export + + // User messages + #define WM_AMOA WM_APP + +#endif + + // Flags boites de dialogues (obsolete) + // ------------------------- +#define DL_MODAL 1 +#define DL_CENTER_WINDOW 2 +#define DL_CENTER_SCREEN 4 + + // Messages propres a KNP + // ---------------------- +#define WM_IT50 (WM_AMOA+123) +#define WM_NET_FIRST (WM_AMOA+174) // v2 +#define WM_NET_LAST (WM_AMOA+199) + +#define UM_KEYDOWN (WM_AMOA+5) +#define UM_PANIC (WM_AMOA+6) + +#define IT50_WPARAMID 0x2775 + + // Classes de fenetres + // ------------------- +#define PCS_DBL 0x0001 +#define PCS_SNG 0x0002 +#define PCS_SCR 0x0003 +#define PCS_CLASS 0x00FF + +#define PCSF_STRETCH 0x0100 // Stretch log to phys + +#define PCSF_MDIMAIN 0x1000 +#define PCSF_MDICHILD 0x2000 + + // Extra-bytes + // ----------- +#define KNP_WINDOWEXTRA 12 // (3 dwords) +#define KWL_FPWIN 0 // pointeur sur structure DLL fenetre +#define KWL_USER 4 // DWORD disponible pour utilisateur + + // Objects +#ifndef _dllpriv_h +#define Appli void +#define Win void +#define npAppli Appli * +#define npWin Win * +#endif + + // Identifiants errones + // -------------------- +#define NPSPR_ERROR 0 +#define HSPR_ERROR 0 + +enum { + WIN_MEMERR, + WIN_APPERR, + WIN_CREATERR +}; +enum { + CREATELOG_MEMERR=16, + CREATELOG_DCERR, + CREATELOG_BMPERR +}; +#define WIN_ERROR ((npWin)32) +//#define HWIN_ERROR ((HWIN)32) + +enum { + APPLI_MEMERR, + APPLI_TIMERR +}; +#define APPLI_ERROR ((npAppli)32) +//#define HAPPLI_ERROR ((HAPPLI)32) + +// Modes ecran +// ----------- +#define SM_DEFAULT 0x00 // Pour SetModeAppli: mode par défaut + +#define SM_1 0x01 // DDB or DIB +#define SM_4 0x02 // DDB or DIB +#define SM_8 0x03 // DDB or DIB +#define SM_24 0x04 // DDB or DIB +#define SM_4p 0x05 // DDB only +#define SM_15 0x06 // DDB only + +#define SM_16 (SM_15+1) +#define SM_32 (SM_16+1) +#define MAX_MODE SM_32 + +#define SM_D3D 0x10 +#define SM_DDRAW 0x20 // Flag "Direct Draw" +#define SM_VRAM 0x40 // Flag "Video RAM" +#define SM_D3D8 0x80 +#define SM_NOTDIB (SM_DDRAW | SM_VRAM) +#define SM_MASK 0x0F // Mask mode + +// Modes graphiques +#define GROP_NORMAL R2_COPYPEN +#define GROP_XOR R2_XORPEN + +// Modes collisions +#define CM_BOX 0 +#define CM_BITMAP 1 + +// Test collisions +#define CM_TEST_OBSTACLE 0 +#define CM_TEST_PLATFORM 1 + +// Masques de bits d'écriture des plans de collision +#define CM_OBSTACLE 0x0001 +#define CM_PLATFORM 0x0002 + +// Hauteur des plateformes +#define HEIGHT_PLATFORM 6 +#define GCMF_OBSTACLE 0x0000 +#define GCMF_PLATFORM 0x0001 + +// Flags pour GetImageSize +#define GIS_WITHMASK 0x8000 +#define GIS_EXACT 0x4000 + + // AddImage flags +#define AI_WITHMASK 0x0010 // L'image originale a un masque (si son mode en a un) +#define AI_COMPARE 0x0020 // Comparer l'image aux autres +#define AI_ACE 0x0080 // En mode >= 256 couleurs, compacter le sprite +#define AI_FLAGS 0x00F0 // Masque flags + +#define AI_NOCOMP 0x0000 +#define AI_RLE 0x0100 // Compactage type RLE +#define AI_RLEW 0x0200 // Compactage type RLEW +#define AI_RLET 0x0400 // Compactage type RLET +#define AI_LZX 0x0800 // Compactage type LZX +#define AI_ALPHA 0x1000 // The image contains an alpha channel +#define AI_ACECOMP 0x4000 // Compactage sprite type ACE +#define AI_MAC 0x8000 // Flag temporaire utilise par la version MAC (sur?) +#define AI_COMPMASK (IF_RLE | IF_RLEW | IF_RLET) + + // imgFlags +#define IF_NOCOMP 0x00 +#define IF_RLE 0x01 // Compactage type RLE +#define IF_RLEW 0x02 // Compactage type RLEW +#define IF_RLET 0x04 // Compactage type RLET +#define IF_LZX 0x08 // Compactage type LZX +#define IF_ALPHA 0x10 // The image contains an alpha channel +#define IF_ACE 0x40 // Compactage sprite type ACE +#define IF_MAC 0x80 // Flag temporaire utilise par la version MAC (sur?) +#define IF_COMPMASK (IF_RLE | IF_RLEW | IF_RLET) + + // PasteSprite flags +#define PSF_HOTSPOT 0x0001 // Take hot spot into account +#define PSF_NOTRANSP 0x0002 // Non transparent image... ignored in PasteSpriteEffect + + // Ink effects +enum { + EFFECT_NONE=0, + EFFECT_SEMITRANSP, + EFFECT_INVERTED, + EFFECT_XOR, + EFFECT_AND, + EFFECT_OR, + MAX_EFFECT +}; + +#define EFFECTFLAG_TRANSPARENT 0x10000000L +#define EFFECTFLAG_ANTIALIAS 0x20000000L +#define EFFECT_MASK 0xFFFF + + // AddSound flags +#define AS_COMPARE 0x00010000 // Compare to others +#define AS_MASK 0xFFFF0000 + + // PlaySound flags +#define PS_NORMAL 0x0000 // Nothing special +#define PS_UNINTER 0x0001 // Cannot be stopped by other sound except by other UNINTER_PRIO +#define PS_UNINTER_PRIO 0x0002 // Cannot be stopped +#define PS_LOOP 0x0010 // Loop, sLParam = loop number, 0 = continuous +#define PS_GLOBALFOCUS 0x0020 // Sound not stopped if the application loses the focus +#define PS_DSOUND 0x0100 // To play with Direct Sound + + // AddFont flags +#define AF_COMPARE 0x100 // Compare to others + + // WinPasteText flags +#define WPTF_CALCRECT 0x8000 +#define WPTF_WITHPREFIX 0x4000 + + + +// ======================================================================= +// Memory banks +// ======================================================================= +// Public: +// ------- + +// Types +enum { + BK_IMGS, // Image bank + BK_SNGS, // Sound bank + BK_COLMASKS, // Collision mask bank + BK_COLMASKS_PLATFORM, // Platform collision mask bank + BK_IMGTEXTURES, // Image textures + BK_FONTS, // Font bank + BK_MAX +}; + +// ======================================================================= +// Images +// ======================================================================= + +typedef struct Img +{ + DWORD imgCheckSum; + DWORD imgCount; + DWORD imgSize; + short imgWidth; + short imgHeight; + BYTE imgFormat; + BYTE imgFlags; + WORD imgNotUsed; + short imgXSpot; + short imgYSpot; + short imgXAction; + short imgYAction; + COLORREF imgTrspColor; +} Img; +typedef Img* npImg; +typedef Img* fpImg; + + +// ======================================================================= +// Sounds +// ======================================================================= + +typedef struct Sound +{ + DWORD snCheckSum; // Checksum (du son sans l'entete) + DWORD snCount; // Ref count + DWORD snSize; // Taille of datas (including name) + DWORD snFlags; // Type (SP_MIDI, SP_WAVE) + flags + DWORD snReserved; + DWORD snNameSize; +} Sound; +typedef Sound* fpSound; + + // Sound flags +#define SP_WAVE 0x0001 // Flags +#define SP_MIDI 0x0002 +#define SNDF_TYPEMASK 0x000F +#define SNDF_LOADONCALL 0x0010 +#define SNDF_PLAYFROMDISK 0x0020 +#define SNDF_FILE 0x0040 +#define SNDF_UNICODEFILE 0x0080 +#define SNDF_LOADED 0x1000 + +// ======================================================================= +// Fonts +// ======================================================================= + +#ifndef _H2INC + +// Structure Font +typedef struct FontW +{ + DWORD fnCheckSum; // Checksum (des images) + DWORD fnCount; // Compteur d'utilisations + DWORD fnSize; // Taille sans l'entete + LOGFONTW fnLf; // Header font (pour CreateFont si Windows font) +} FontW; +typedef FontW *npFontW; +typedef FontW *fpFontW; + +typedef struct FontA +{ + DWORD fnCheckSum; // Checksum (des images) + DWORD fnCount; // Compteur d'utilisations + DWORD fnSize; // Taille sans l'entete + LOGFONTA fnLf; // Header font (pour CreateFont si Windows font) +} FontA; +typedef FontA *npFontA; +typedef FontA *fpFontA; + +#ifdef _UNICODE +#define Font FontW +#define fpFont fpFontW +#else +#define Font FontA +#define fpFont fpFontA +#endif + +#endif // _H2INC + + // Font avec LOGFONT 16 bits pour version 32 bits + +typedef struct tagLOGFONT16 { + short lfHeight; + short lfWidth; + short lfEscapement; + short lfOrientation; + short lfWeight; + BYTE lfItalic; + BYTE lfUnderline; + BYTE lfStrikeOut; + BYTE lfCharSet; + BYTE lfOutPrecision; + BYTE lfClipPrecision; + BYTE lfQuality; + BYTE lfPitchAndFamily; + BYTE lfFaceName[LF_FACESIZE]; +} LOGFONT16; + + // Structures + // ---------- + + // Zone, box, rectangle +#ifndef _dllpriv_h +typedef struct tagBox +{ + short x1,y1,x2,y2; +} Box; +typedef Box *npBox; +typedef Box *fpBox; +#endif + + // Structure infos ecran +typedef struct tagSMI { + UINT totalBitCount; // I.e. 16 + UINT usedBitCount; // I.e. 15 + UINT mainMode; // SM_4, SM_8, SM_etc... avec flags SM_DDRAW + UINT subMode; // sous-mode + DWORD rMask; + DWORD gMask; + DWORD bMask; + UINT flags; +} screenModeInfos; + + // Objet fenetre +#define WF_SIZE 0x0001 // Flag "resize in progress" +#define WF_STRETCH 0x0002 // Flag "stretch log to phys" +#define WF_NOPAINT 0x0008 // No paint +#define WF_DONOTMERGEZONES 0x0010 // Do not merge new zones +#define WF_IDLE 0x0020 // Idle mode (GetMessage) +#define WF_IDLE50 0x0040 // Idle mode (GetMessage + IT50) +#define WF_IDLEFLAGS (WF_IDLE | WF_IDLE50) // Idle mode flags +#define WF_UNICODE 0x0080 // Flag "view zones" en mode debug +#define WF_SCR 0x0100 // Flag "Screen saver window" +#define WF_MDIMAIN 0x0200 // MDI Frame +#define WF_MDICLIENT 0x0400 // MDI Client +#define WF_MDICHILD 0x0800 // MDI Child +#define WF_OWNDC 0x1000 +#define WF_OWNDCLOG 0x2000 +#define WF_FULLSCREENX2 0x4000 +#define WF_DONOTDESTROY 0x8000 + +#define WF2_NOUPDATE 0x0001 +#define WF2_DIBFULLSCREEN 0x0002 +#define WF2_MMF15 0x0004 +#define WF2_VSYNC 0x0008 +#define WF2_NOBACKSURF 0x0010 + + // Objet application +#define APPF_ENDAPP 0x0001 // Internal +#define APPF_GLOBALSOUNDS 0x0004 + + // Objet sprite +#define SF_RAMBO 0x00000001 // flag "rentre dans tout le monde" +#define SF_RECALCSURF 0x00000002 // Recalc surface (if rotation or stretch) +#define SF_PRIVATE 0x00000004 // flag privé utilisé par le runtime pour la destruction des fade +#define SF_INACTIF 0x00000008 // flag "inactif" = reaffichage ssi intersection avec un autre +#define SF_TOHIDE 0x00000010 // flag "a cacher" +#define SF_TOKILL 0x00000020 // flag "a detruire" +#define SF_REAF 0x00000040 // flag "a reafficher" +#define SF_HIDDEN 0x00000080 // flag "cache" +#define SF_COLBOX 0x00000100 // flag "collisions en mode box" +#define SF_NOSAVE 0x00000200 // flag "do not save background" +#define SF_FILLBACK 0x00000400 // flag "fill background using a solid colour (sprAdrBack)" +#define SF_DISABLED 0x00000800 +#define SF_REAFINT 0x00001000 // Internal +#define SF_OWNERDRAW 0x00002000 // flag "owner draw" +#define SF_OWNERSAVE 0x00004000 // flag "owner save" +#define SF_FADE 0x00008000 // Private + +#define SF_OBSTACLE 0x00010000 // Obstacle +#define SF_PLATFORM 0x00020000 // Platform +#define SF_BACKGROUND 0x00080000 // Backdrop object + +#define SF_SCALE_RESAMPLE 0x00100000 // Resample when stretching +#define SF_ROTATE_ANTIA 0x00200000 // Antialiasing for rotations +#define SF_NOHOTSPOT 0x00400000 // No hot spot +#define SF_OWNERCOLMASK 0x00800000 // Owner-draw sprite supports collision masks + +#define SF_UPDATECOLLIST 0x10000000 + +// SpriteCol_TestPoint / SpriteCol_TestSprite +#define SCF_OBSTACLE 0x01 +#define SCF_PLATFORM 0x02 +#define SCF_EVENNOCOL 0x04 // Flag: returns even sprites that haven't the SF_RAMBO flag +#define SCF_BACKGROUND 0x08 // Flag: if 0, returns active sprites, otherwise returns background sprites +#define SCF_TESTFEET 0x10 // Test only the bottom of the sprite + +#define LAYER_ALL (-1) + +// GetFirst/Last/Next/PrevSprite +#define GS_BACKGROUND 0x0001 +#define GS_SAMELAYER 0x0002 + +// ActiveSprite +#define AS_DEACTIVATE 0x0000 // Desactive un sprite actif +#define AS_REDRAW 0x0001 // Reaffiche un sprite inactif +#define AS_ACTIVATE 0x0002 // Active un sprite inactif +#define AS_ENABLE 0x0004 +#define AS_DISABLE 0x0008 +#define AS_REDRAW_NOBKD 0x0011 +#define AS_REDRAW_RECT 0x0020 + +#define SSF_HIDE 0x0000 // Cacher un sprite +#define SSF_SHOW 0x0001 // Montrer un sprite + +// Ownerdraw sprites, callback function +enum { + SPRITE_DRAW, + SPRITE_RESTORE, + SPRITE_SAVE, + SPRITE_KILL, + SPRITE_GETCOLMASK, +}; + + // Objet libre +#ifndef _dllpriv_h +typedef struct tagObj +{ + UINT objSize; // Taille de l'objet: 0 = fin objets + UINT objPrevSize; // Taille objet precedent (0 = 1er objet) + UINT objType; // Type d'objet (1=vide,2=appli,3=fenetre,...) + UINT objPrev; // Adresse objet precedent de meme type (0 = first) + UINT objNext; // Adresse objet suivant de meme type (0 = last) +} Obj; +typedef Obj *npObj; +typedef Obj *fpObj; +#endif + +#ifndef _H2INC +#ifdef IN_DLL +class Spr; +#endif +#endif + +#define SPRCOLLISLIST + +#ifdef __cplusplus +class Spr +{ +public: +#else +typedef struct Spr +{ +#endif +#ifndef SPRLIST + Obj sprObj; +#endif + DWORD sprFlags; // Flags + WORD sprLayer; // Sprite plane (layer) + short sprAngle; // Angle + int sprZOrder; // Z-order value + + // Coordinates + int sprX; + int sprY; + + // Bounding box + int sprX1; + int sprY1; + int sprX2; + int sprY2; + + // New coordinates + int sprXnew; + int sprYnew; + + // New bounding box + int sprX1new; + int sprY1new; + int sprX2new; + int sprY2new; + + // Background bounding box + int sprX1z; + int sprY1z; + int sprX2z; + int sprY2z; + + // Scale & Angle + float sprScaleX; + float sprScaleY; + + // Temporary values for collisions + WORD sprTempImg; // TODO: use DWORD later? + short sprTempAngle; + float sprTempScaleX; + float sprTempScaleY; + + // Image or owner-draw routine + union { + struct { + DWORD sprImg; // Numero d'image + DWORD sprImgNew; // Nouvelle image + }; + LPARAM sprRout; // Ownerdraw callback routine + }; + + // Ink effect + DWORD sprEffect; // 0=normal, 1=semi-transparent, > 16 = routine + LPARAM sprEffectParam; // parametre effet (coef transparence, etc...) + + // Fill color (wipe with color mode) + COLORREF sprBackColor; + + // Surfaces + cSurfaceImplementation* sprBackSurf; // Background surface, if no general background surface + + cSurfaceImplementation* sprSf; // Surface (if stretched or rotated) + sMask* sprColMask; // Collision mask (if stretched or rotated) + + cSurfaceImplementation* sprTempSf; // Temp surface (if stretched or rotated) + sMask* sprTempColMask; // Temp collision mask (if stretched or rotated) + + // User data + LPARAM sprExtraInfo; + + // Colliding sprites +#ifndef _H2INC +#ifdef IN_DLL + CPTypeArray sprCollisList; // liste de sprites entrant en collisions +#else + int sprCollisList[2]; +#endif +#endif + +#ifdef __cplusplus +}; +#else +} Spr; +#endif +typedef Spr *npSpr; +typedef Spr *fpSpr; + + // Structure "taille d'une appli" +typedef struct tagAppSize { + DWORD asInternal; // Place occupee dans le segment DLL + DWORD asLogics; // Taille ecrans logiques + DWORD asColMasks; // Taille buffers de collision avec le decor + DWORD asImages; // Banque des images + DWORD asMasks; // Banque des masques de collision des images + DWORD asSounds; // Banque des sons + DWORD asFonts; // Banque des fonts + DWORD asSprites; // Buffers de sauvegarde des fonds des sprites +} appSize; +typedef appSize *fpas; + +#ifdef _H2INC +#define CREATESTRUCTA CREATESTRUCT +#define CREATESTRUCTW CREATESTRUCT +#endif + +// Structure pour WinOpenEx +typedef struct tagCWA { + DWORD cwSize; + CREATESTRUCTA cwCreateStruct; + int cwCxMax; + int cwCyMax; + HCURSOR cwHCursor; + union { + DWORD cwBackColor; + HBRUSH cwHBackBrush; + }; + int cwClsWin; + int cwWinFlags; +} CREATEWINA; + +typedef struct CREATEWINEXA { + DWORD cwSize; + CREATESTRUCTA cwCreateStruct; + int cwCxMax; + int cwCyMax; + HCURSOR cwHCursor; + union { + DWORD cwBackColor; + HBRUSH cwHBackBrush; + }; + int cwClsWin; + int cwWinFlags; + HWND cwHWnd; + LPARAM cwNotUsed; +} CREATEWINEXA; + +typedef struct tagCWW { + DWORD cwSize; + CREATESTRUCTW cwCreateStruct; + int cwCxMax; + int cwCyMax; + HCURSOR cwHCursor; + union { + DWORD cwBackColor; + HBRUSH cwHBackBrush; + }; + int cwClsWin; + int cwWinFlags; +} CREATEWINW; + +typedef struct CREATEWINEXW { + DWORD cwSize; + CREATESTRUCTW cwCreateStruct; + int cwCxMax; + int cwCyMax; + HCURSOR cwHCursor; + union { + DWORD cwBackColor; + HBRUSH cwHBackBrush; + }; + int cwClsWin; + int cwWinFlags; + HWND cwHWnd; + LPARAM cwNotUsed; +} CREATEWINEXW; + +#ifdef _UNICODE +#define CREATEWIN CREATEWINW +#define CREATEWINEX CREATEWINEXW +#else +#define CREATEWIN CREATEWINA +#define CREATEWINEX CREATEWINEXA +#endif + +// Structure for SaveRect +typedef struct saveRect { + LPBYTE pData; + RECT rc; +} saveRect; +typedef saveRect* fpSaveRect; + + +//------------------------------ +// Prototypes des fonctions KNPS +//------------------------------ + +#define DialOpen(hi,id,hp,pr,a,b,c,lp) DialogBoxParam(hi,id,hp,pr,lp) + +DLLExport32 DWORD WINAPI GetDLLVersion(); + + // Application + // ----------- +DLLExport32 npAppli WINAPI InitAppli (HINSTANCE, HPALETTE); +DLLExport32 DWORD WINAPI SetModeAppli (npAppli, int); +DLLExport32 int WINAPI LockBank (npAppli, int); +DLLExport32 int WINAPI UnlockBank (npAppli, int); +DLLExport32 int WINAPI PurgeBank (npAppli, int); +DLLExport32 void WINAPI KillBank (npAppli, int); +DLLExport32 int WINAPI Bank_GetEltCount (npAppli ptApp, UINT bkNum); +DLLExport32 LPVOID WINAPI Bank_GetEltAddr (npAppli ptApp, UINT bkNum, UINT eNum); + +DLLExport32 void WINAPI EndAppli (npAppli); + + // Windows, dialogues + // ------------------ +DLLExport32 npWin WINAPI WinOpenExA (npAppli, CREATEWINA *); +DLLExport32 npWin WINAPI WinOpenExW (npAppli, CREATEWINW *); +DLLExport32 npWin WINAPI SCRWinOpenA (npAppli, HWND); +DLLExport32 npWin WINAPI SCRWinOpenW (npAppli, HWND); +DLLExport32 void WINAPI WCDClose (npWin); +DLLExport32 HWND WINAPI WinGetHandle (npWin); +DLLExport32 HWND WINAPI WinGetMCHandle (npWin); +DLLExport32 HDC WINAPI WinGetHDC (npWin); +DLLExport32 HDC WINAPI WinGetHDCLog (npWin); +DLLExport32 void WINAPI WinReleaseHDC (npWin, HDC); +DLLExport32 void WINAPI WinReleaseHDCLog (npWin, HDC); +DLLExport32 void WINAPI WinGetLogRect (npWin, RECT *); +DLLExport32 npWin WINAPI WinSearch (HWND); + +DLLExport32 LRESULT CALLBACK DefMsgProcA (HWND hWin, UINT uMsg, WPARAM wParam, LPARAM lParam); +DLLExport32 LRESULT CALLBACK DefMsgProcW (HWND hWin, UINT uMsg, WPARAM wParam, LPARAM lParam); + +#ifdef _UNICODE +#define WinOpenEx WinOpenExW +#define SCRWinOpen SCRWinOpenW +#define DefMsgProc DefMsgProcW +#else +#define WinOpenEx WinOpenExA +#define SCRWinOpen SCRWinOpenA +#define DefMsgProc DefMsgProcA +#endif + + // Menus + // ----- +DLLExport32 HMENU WINAPI WinSetMenu (npWin, HMENU, HACCEL); +//DLLExport32 void WINAPI WinSetAccel (npWin, HACCEL); + + // Souris + // ------ +DLLExport32 HCURSOR WINAPI WinSetMouse (npWin, HCURSOR); +DLLExport32 void WINAPI WinStartWait (npWin); +DLLExport32 void WINAPI WinEndWait (npWin); + + // Events + // ------ +//DLLExport32 WORD WINAPI GetMsg (npWin, fpKm); +//DLLExport32 DWORD WINAPI GetIt50 (void); +//DLLExport32 DWORD WINAPI RazCptVbl (void); +//DLLExport32 DWORD WINAPI GetCptVbl (void); +//DLLExport32 void WINAPI EnableIt50 (npWin, int); + + // Graphics + // -------- +DLLExport32 void WINAPI WinClip (npWin, int, int, int, int); +DLLExport32 void WINAPI WinFillRect (npWin, int, int, int, int, DWORD); +DLLExport32 void WINAPI WinFillBr (npWin, int, int, int, int, HBRUSH); +DLLExport32 void WINAPI WinBox (npWin, fpBox); +DLLExport32 void WINAPI WinRect (npWin, RECT *); +DLLExport32 void WINAPI WinLine (npWin, POINT *, UINT); +DLLExport32 void WINAPI WinGrabDesktop (npWin); + +#ifndef IN_KPX +DLLExport32 int WINAPI StartFullScreen (npWin, int, int, int); +DLLExport32 int WINAPI EndFullScreen (); +#endif // IN_KPX + +DLLExport32 void WINAPI WinPaper (npWin, COLORREF); +DLLExport32 void WINAPI WinPen (npWin, COLORREF, int, int); +DLLExport32 void WINAPI WinGraphMode (npWin, int); + +#define WSP_NBSPRITES 1 +#define WSP_SETAPPFLAGS 2 +#define WSP_GETAPPFLAGS 4 +#define WSP_GETWINFLAGS2 9 +#define WSP_SETWINFLAGS2 10 +DLLExport32 BOOL WINAPI WinSetParam (npWin, int, UINT, DWORD); + + // Dibs + // ---- +DLLExport32 DWORD WINAPI InitDibHeader (npAppli, int, int, int, BITMAPINFO *); +DLLExport32 void WINAPI FillDib (BITMAPINFO *, COLORREF); +DLLExport32 DWORD WINAPI ImageToDib (npAppli, DWORD, DWORD, LPBYTE); +DLLExport32 DWORD WINAPI DibToImage (npAppli, fpImg, BITMAPINFOHEADER *); +DLLExport32 DWORD WINAPI DibToImageEx (npAppli, fpImg, BITMAPINFOHEADER *, COLORREF, DWORD); +DLLExport32 void WINAPI RemapDib (BITMAPINFO *, npAppli, LPBYTE); + + // Palette + // ------- +DLLExport32 HPALETTE WINAPI SetDefaultPalette256 (PALETTEENTRY *); +DLLExport32 void WINAPI SetPaletteAppli (npAppli, HPALETTE); +DLLExport32 int WINAPI GetPaletteAppli (LOGPALETTE *, int, npAppli); +DLLExport32 int WINAPI GetNearestIndex (npAppli, int, COLORREF); +DLLExport32 COLORREF WINAPI GetRGB (npAppli, int, int); +DLLExport32 int WINAPI GetOpaqueBlack (npAppli); + + // Font + // ---- +#ifndef _H2INC +DLLExport32 DWORD WINAPI AddFontA (npAppli, DWORD, fpFontA, LPDWORD, DWORD); +DLLExport32 DWORD WINAPI IncFontCount (npAppli, DWORD); +DLLExport32 long WINAPI DelFont (npAppli, DWORD); +DLLExport32 int WINAPI GetFontInfosA (npAppli, DWORD, fpFontA, LPDWORD); +DLLExport32 HFONT WINAPI WinCreateFont (npAppli, DWORD); +DLLExport32 int WINAPI WinPasteTextA (npWin, HFONT, RECT*, LPSTR, COLORREF, DWORD); + +DLLExport32 DWORD WINAPI AddFontW (npAppli ptApp, DWORD fType, fpFontW fntHdr, LPDWORD lpw, DWORD nbw); +DLLExport32 int WINAPI GetFontInfosW (npAppli ptApp, DWORD nFont, fpFontW fntHdr, LPDWORD lpw); +DLLExport32 int WINAPI WinPasteTextW (npWin, HFONT, RECT*, LPWSTR, COLORREF, DWORD); + + // Fonts - fonctions 32 bits utilisant des structures 16 bits +DLLExport32 void WINAPI LogFont16To32A ( LOGFONTA * lf32, LOGFONT16 * lf16 ); +DLLExport32 void WINAPI LogFont32To16A ( LOGFONT16 * lf16, LOGFONTA * lf32 ); +DLLExport32 HFONT WINAPI CreateFontIndirect16 ( LOGFONT16 * lFont ); + +DLLExport32 void WINAPI LogFont16To32W ( LOGFONTW * lf32, LOGFONT16 * lf16 ); +DLLExport32 void WINAPI LogFont32To16W ( LOGFONT16 * lf16, LOGFONTW * lf32 ); + +#ifdef _UNICODE +#define AddFont AddFontW +#define GetFontInfos GetFontInfosW +#define WinPasteText WinPasteTextW +#define LogFont16To32 LogFont16To32W +#define LogFont32To16 LogFont32To16W +#else +#define AddFont AddFontA +#define GetFontInfos GetFontInfosA +#define WinPasteText WinPasteTextA +#define LogFont16To32 LogFont16To32A +#define LogFont32To16 LogFont32To16A +#endif + +#endif // _H2INC + + + + // Images + // ------ +DLLExport32 void WINAPI PasteSprite (npWin, DWORD, int, int, DWORD); +DLLExport32 void WINAPI PasteSpriteEffect (npWin, DWORD, int, int, DWORD, DWORD, LPARAM); +DLLExport32 DWORD WINAPI AddImage (npAppli, WORD, WORD, short, short, short, short, COLORREF, DWORD, LPVOID, LPBYTE); +DLLExport32 DWORD WINAPI IncImageCount (npAppli, DWORD); +DLLExport32 int WINAPI IsImageEmpty (npAppli, DWORD); +DLLExport32 DWORD WINAPI GetImageBits (npAppli, DWORD, DWORD, LPBYTE); +DLLExport32 void WINAPI StretchImage (npAppli, DWORD, WORD, WORD, LPBYTE); +DLLExport32 long WINAPI DelImage (npAppli, DWORD); +DLLExport32 sMask* WINAPI AddMask (npAppli ptApp, DWORD iNum, UINT nFlags); +DLLExport32 long WINAPI DelMask (npAppli, DWORD); +DLLExport32 int WINAPI GetImageInfos (npAppli, DWORD, fpImg); +DLLExport32 int WINAPI GetImageInfoEx (npAppli pApp, DWORD nImage, int nAngle, float fScaleX, float fScaleY, fpImg pIfo); +DLLExport32 DWORD WINAPI GetImageSize (WORD, WORD, WORD); +DLLExport32 sMask* WINAPI GetImageMask (npAppli ptApp, DWORD dwImage, UINT nFlags); +DLLExport32 sMask* WINAPI CompleteSpriteColMask (npWin ptrWin, npSpr ptSpr, DWORD dwPSCFlags, UINT nWidth, UINT nHeight); +DLLExport32 DWORD WINAPI PrepareSpriteColMask (npWin ptrWin, npSpr ptSpr, DWORD newImg, int newX, int newY, int newAngle, float newScaleX, float newScaleY, RECT* prc, sMask** ppMask); + + // Sprites + // ------- +DLLExport32 npSpr WINAPI AddSprite (npWin ptrWin, int xSpr, int ySpr, DWORD iSpr, WORD wLayer, int nZOrder, DWORD backSpr, DWORD sFlags, LPARAM extraInfo); +DLLExport32 npSpr WINAPI AddOwnerDrawSprite (npWin ptrWin, int x1, int y1, int x2, int y2, WORD wLayer, int nZOrder, DWORD backSpr, DWORD sFlags, LPARAM extraInfo, LPARAM sprProc); +DLLExport32 npSpr WINAPI ModifSprite (npWin ptrWin, npSpr ptSpr, int xSpr, int ySpr, DWORD iSpr); +DLLExport32 npSpr WINAPI ModifSpriteEx (npWin ptrWin, npSpr ptSpr, int xSpr, int ySpr, DWORD iSpr, float fScaleX, float fScaleY, BOOL bResample, int nAngle, BOOL bAntiA); +DLLExport32 npSpr WINAPI ModifSpriteEffect (npWin ptrWin, npSpr ptSpr, DWORD effect, LPARAM effectParam); +DLLExport32 npSpr WINAPI ModifOwnerDrawSprite (npWin ptrWin, npSpr ptSprModif, int x1, int y1, int x2, int y2); +DLLExport32 void WINAPI ShowSprite (npWin, npSpr, int); +DLLExport32 void WINAPI ActiveSprite (npWin, npSpr, int); +DLLExport32 void WINAPI DelSprites (npWin); +DLLExport32 void WINAPI DelSprite (npWin, npSpr); +DLLExport32 void WINAPI DelSpriteFast (npWin, npSpr); +DLLExport32 LPARAM WINAPI GetSpriteExtra (npWin, npSpr); +DLLExport32 DWORD WINAPI GetSpriteFlags (npWin, npSpr); +DLLExport32 DWORD WINAPI SetSpriteFlags (npWin ptrWin, npSpr ptSpr, DWORD dwNewFlags); +DLLExport32 void WINAPI SpriteClear (npWin); +DLLExport32 void WINAPI SpriteDraw (npWin); +DLLExport32 void WINAPI SpriteUpdate (npWin); +DLLExport32 void WINAPI ScreenUpdate (npWin); + +DLLExport32 void WINAPI GetSpriteScale (npWin ptrWin, npSpr ptSpr, float* pScaleX, float* pScaleY, BOOL* pResample); +DLLExport32 void WINAPI SetSpriteScale (npWin ptrWin, npSpr ptSpr, float fScaleX, float fScaleY, BOOL bResample); +DLLExport32 int WINAPI GetSpriteAngle (npWin ptrWin, npSpr ptSpr, BOOL* pAntiA); +DLLExport32 void WINAPI SetSpriteAngle (npWin ptrWin, npSpr ptSpr, int nAngle, BOOL bAntiA); +DLLExport32 void WINAPI GetSpriteRect (npWin ptrWin, npSpr ptSpr, RECT* prc); +DLLExport32 void WINAPI MoveSpriteToFront(npWin ptrWin, npSpr pSpr); +DLLExport32 void WINAPI MoveSpriteToBack (npWin ptrWin, npSpr pSpr); +DLLExport32 void WINAPI MoveSpriteBefore (npWin ptrWin, npSpr pSprToMove, npSpr pSprDest); +DLLExport32 void WINAPI MoveSpriteAfter (npWin ptrWin, npSpr pSprToMove, npSpr pSprDest); +DLLExport32 BOOL WINAPI IsSpriteBefore (npWin ptrWin, npSpr pSpr, npSpr pSprDest); +DLLExport32 BOOL WINAPI IsSpriteAfter (npWin ptrWin, npSpr pSpr, npSpr pSprDest); +DLLExport32 void WINAPI SwapSprites (npWin ptrWin, npSpr sp1, npSpr sp2); +DLLExport32 int WINAPI GetSpriteLayer (npWin ptrWin, npSpr ptSpr); +DLLExport32 void WINAPI SetSpriteLayer (npWin ptrWin, npSpr ptSpr, int nLayer); +DLLExport32 sMask* WINAPI GetSpriteMask (npWin ptrWin, npSpr pSpr, UINT newImg, UINT nFlags); + +DLLExport32 npSpr WINAPI GetFirstSprite (npWin ptrWin, int nLayer, DWORD dwFlags); +DLLExport32 npSpr WINAPI GetNextSprite (npWin ptrWin, npSpr pSpr, DWORD dwFlags); +DLLExport32 npSpr WINAPI GetPrevSprite (npWin ptrWin, npSpr pSpr, DWORD dwFlags); +DLLExport32 npSpr WINAPI GetLastSprite (npWin ptrWin, int nLayer, DWORD dwFlags); + + // Sauvegarde / Restitution de zones + // --------------------------------- +DLLExport32 void WINAPI WinResetZones (npWin); +DLLExport32 void WINAPI WinAddZone (npWin, RECT *); +DLLExport32 void WINAPI WinAddCoord (npWin, int, int, int, int); +DLLExport32 int WINAPI SaveRect (npWin, fpSaveRect, int, int, int, int); +DLLExport32 void WINAPI RestoreRect (npWin, fpSaveRect); +DLLExport32 void WINAPI KillRect (fpSaveRect); +DLLExport32 UINT* WINAPI WinGetZones (npWin); +DLLExport32 void WINAPI WinEnableUpdate (npWin, int); + + // Collisions + // ---------- +DLLExport32 DWORD WINAPI SetSpriteColFlag (npWin, npSpr, DWORD); // UINT = SF_xxxx +DLLExport32 npSpr WINAPI SpriteCol_TestPoint (npWin, npSpr, int, int, int, DWORD); // Entre 1 pixel et les sprites sauf un +DLLExport32 npSpr WINAPI SpriteCol_TestRect (npWin, npSpr, int, int, int, int, int, DWORD); // Entre 1 rectangle et les sprites sauf un +DLLExport32 npSpr WINAPI SpriteCol_TestSprite (npWin ptrWin, npSpr ptSpr, DWORD newImg, int newX, int newY, int newAngle, float newScaleX, float newScaleY, int subHt, DWORD dwFlags); +DLLExport32 UINT WINAPI SpriteCol_TestSprite_All (npWin, npSpr, LPVOID*, DWORD, int, int, int, float, float, DWORD); +DLLExport32 int WINAPI WinSetColMode (npWin, WORD); // Mode BOX ou BITMAP + +DLLExport32 BOOL WINAPI ColMask_Create (npWin, UINT, UINT, DWORD); // Creation bitmap masque fond +DLLExport32 BOOL WINAPI ColMask_CreateEx (npWin, int, int, int, int, DWORD); +DLLExport32 void WINAPI ColMask_Kill (npWin); // Destruction masque fond +DLLExport32 void WINAPI ColMask_Fill (npWin, DWORD); // Init masque fond +DLLExport32 int WINAPI ColMask_FillRectangle (npWin, int, int, int, int, DWORD); +DLLExport32 void WINAPI ColMask_OrImage (npWin, DWORD, int, int, DWORD); +DLLExport32 void WINAPI ColMask_OrMask (npWin, sMask*, int, int, DWORD, DWORD); +DLLExport32 void WINAPI ColMask_OrPlatform (npWin, DWORD, int, int); +DLLExport32 void WINAPI ColMask_OrPlatformMask (npWin, sMask*, int, int); +DLLExport32 int WINAPI ColMask_Scroll (npWin, int, int, RECT *, RECT *); +DLLExport32 void WINAPI ColMask_SetOrigin (npWin, int, int); +DLLExport32 void WINAPI ColMask_ToLog (npWin ptrWin, UINT nPlane); +DLLExport32 void WINAPI ColMask_SetClip (npWin, RECT *); + +DLLExport32 BOOL WINAPI ColMask_TestPoint (npWin ptrWin, int x, int y, UINT nPlane); +DLLExport32 BOOL WINAPI ColMask_TestSprite (npWin ptrWin, npSpr pSpr, int newImg, int newX, int newY, int newAngle, float newScaleX, float newScaleY, int subHt, UINT nPlane); +DLLExport32 int WINAPI ColMask_TestRect (npWin, int, int, int, int, UINT nPlane); + +DLLExport32 BOOL WINAPI Mask_TestPoint (LPBYTE pMask, int x, int y, int nMaskWidth, int nMaskHeight); +DLLExport32 BOOL WINAPI Mask_TestMask (LPBYTE pMaskBits1, LPBYTE pMaskBits2, int x1Spr1, int y1Spr1, int wSpr1, int hSpr1, int x1Spr2, int y1Spr2, int wSpr2, int hSpr2); +DLLExport32 BOOL WINAPI Mask_TestRect (LPBYTE pMask, int nMaskWidth, int nMaskHeight, int x, int y, int nWidth, int nHeight); + + // Hooks + // ----- +DLLExport32 HHOOK WINAPI StartFilterHook (HWND); +DLLExport32 int WINAPI StopFilterHook (HHOOK); + + // Divers + // ------ +#define WavePerio() + + // New + // --- +DLLExport32 void WINAPI WinSetFlags (npWin, WORD); +DLLExport32 WORD WINAPI WinGetFlags (npWin); +DLLExport32 int WINAPI WinScroll (npWin, int, int, int, int, int, int); + +DLLExport32 int WINAPI EnumScreenModes (screenModeInfos *ptsfo, int maxModes, UINT flags); + + // V2 + // -- + +#define HCSPALETTE UINT + +DLLExport32 HCSPALETTE WINAPI AddPalette (LOGPALETTE* pLogPal); +DLLExport32 void WINAPI DelPalette (HCSPALETTE pCsPal); +DLLExport32 void WINAPI SetAppCSPalette (npAppli ptrApp, HPALETTE hpal, HCSPALETTE pCsPal); +DLLExport32 HCSPALETTE WINAPI GetAppCSPalette (npAppli ptrApp); + +// Sounds + +#ifdef __cplusplus +class CSoundManager; +DLLExport32 int WINAPI PlaySndA (CSoundManager* pSndMgr, npAppli ptApp, UINT sNum, HWND hWin, DWORD sFlags, DWORD sLParam, UINT nChannel); +DLLExport32 int WINAPI PlaySndW (CSoundManager* pSndMgr, npAppli ptApp, UINT sNum, HWND hWin, DWORD sFlags, DWORD sLParam, UINT nChannel); +#endif // __cplusplus + +DLLExport32 void WINAPI PauseSnd (npAppli ptApp, UINT sType, UINT sNum); +DLLExport32 void WINAPI PauseSndChannel (npAppli ptApp, UINT nChannel); +DLLExport32 void WINAPI ResumeSnd (npAppli ptApp, UINT sType, UINT sNum); +DLLExport32 void WINAPI ResumeSndChannel (npAppli ptApp, UINT nChannel); +DLLExport32 void WINAPI StopSnd (npAppli ptApp, UINT sType, UINT sNum); +DLLExport32 void WINAPI StopSndChannel (npAppli ptApp, UINT nChannel); +DLLExport32 int WINAPI IsSndPlaying (npAppli ptApp, UINT nSound); +DLLExport32 int WINAPI IsSndChannelPlaying (npAppli ptApp, UINT nChannel); +DLLExport32 int WINAPI IsSndPaused (npAppli ptApp, UINT nSound); +DLLExport32 int WINAPI IsSndChannelPaused (npAppli ptApp, UINT nChannel); +DLLExport32 void WINAPI SetSndMainVolume (npAppli ptApp, UINT sType, int nVolume); +DLLExport32 void WINAPI SetSndMainPan (npAppli ptApp, UINT sType, int nPan); +DLLExport32 int WINAPI GetSndMainVolume (npAppli ptApp, UINT sType); +DLLExport32 int WINAPI GetSndMainPan (npAppli ptApp, UINT sType); +DLLExport32 void WINAPI SetSndChannelVolume (npAppli ptApp, UINT nChannel, int nVolume); +DLLExport32 void WINAPI SetSndChannelPan (npAppli ptApp, UINT nChannel, int nPan); +DLLExport32 void WINAPI SetSndVolume (npAppli ptApp, UINT sType, UINT sNum, int nVolume); +DLLExport32 void WINAPI SetSndPan (npAppli ptApp, UINT sType, UINT sNum, int nPan); +DLLExport32 int WINAPI GetSndChannelVolume (npAppli ptApp, UINT nChannel); +DLLExport32 int WINAPI GetSndChannelPan (npAppli ptApp, UINT nChannel); +DLLExport32 int WINAPI GetSndVolume (npAppli ptApp, UINT sType, UINT sNum); +DLLExport32 int WINAPI GetSndPan (npAppli ptApp, UINT sType, UINT sNum); +DLLExport32 DWORD WINAPI GetSndChannelDuration (npAppli ptApp, UINT nChannel); +DLLExport32 DWORD WINAPI GetSndChannelPosition (npAppli ptApp, UINT nChannel); +DLLExport32 void WINAPI SetSndChannelPosition (npAppli ptApp, UINT nChannel, DWORD dwPosition); +DLLExport32 DWORD WINAPI GetSndDuration (npAppli ptApp, UINT sType, UINT sNum); +DLLExport32 DWORD WINAPI GetSndPosition (npAppli ptApp, UINT sType, UINT sNum); +DLLExport32 void WINAPI SetSndPosition (npAppli ptApp, UINT sType, UINT sNum, DWORD dwPosition); +DLLExport32 UINT WINAPI FindSndFromNameA(npAppli ptApp, UINT sType, LPCSTR pName); +DLLExport32 UINT WINAPI FindSndFromNameW(npAppli ptApp, UINT sType, LPCWSTR pName); +DLLExport32 int WINAPI GetSndChannel(npAppli ptApp, UINT sNum); + +DLLExport32 void WINAPI LockSndChannel (npAppli ptApp, UINT nChannel, BOOL bLock); +DLLExport32 void WINAPI SetSndChannelFreq (npAppli ptApp, UINT nChannel, DWORD dwFreq); +DLLExport32 void WINAPI SetSndFreq (npAppli ptApp, UINT sType, UINT sNum, DWORD dwFreq); +DLLExport32 DWORD WINAPI GetSndChannelFreq (npAppli ptApp, UINT nChannel); +DLLExport32 DWORD WINAPI GetSndFreq (npAppli ptApp, UINT sType, UINT sNum); + +DLLExport32 UINT WINAPI AddSoundA (npAppli, UINT, LPSTR, LPBYTE, DWORD); +DLLExport32 UINT WINAPI ReplaceSoundA (npAppli ptApp, UINT sFlags, UINT nSound, LPSTR fpName, LPBYTE lpData, DWORD dwDataSize); +DLLExport32 BOOL WINAPI SetSoundFlags (npAppli ptApp, UINT nSound, UINT sFlags); +DLLExport32 DWORD WINAPI IncSoundCount (npAppli, UINT); +DLLExport32 int WINAPI GetSoundInfoA (npAppli, UINT, fpSound); +DLLExport32 int WINAPI GetSoundNameA (npAppli, UINT, LPSTR, UINT); +DLLExport32 long WINAPI GetSoundData (npAppli, UINT, LPBYTE); +DLLExport32 LPBYTE WINAPI GetSoundDataPtr (npAppli, UINT); +DLLExport32 long WINAPI DelSound (npAppli, UINT); + +DLLExport32 UINT WINAPI AddSoundW (npAppli, UINT, LPWSTR, LPBYTE, DWORD); +DLLExport32 UINT WINAPI ReplaceSoundW (npAppli ptApp, UINT sFlags, UINT nSound, LPWSTR fpName, LPBYTE lpData, DWORD dwDataSize); +DLLExport32 int WINAPI GetSoundNameW (npAppli, UINT, LPWSTR, UINT); +DLLExport32 int WINAPI GetSoundInfoW (npAppli, UINT, fpSound); + +#ifdef _UNICODE +#define AddSound AddSoundW +#define ReplaceSound ReplaceSoundW +#define GetSoundName GetSoundNameW +#define GetSoundInfo GetSoundInfoW +#define FindSndFromName FindSndFromNameW +#define PlaySnd PlaySndW +#else +#define AddSound AddSoundA +#define ReplaceSound ReplaceSoundA +#define GetSoundName GetSoundNameA +#define GetSoundInfo GetSoundInfoA +#define FindSndFromName FindSndFromNameA +#define PlaySnd PlaySndA +#endif + +DLLExport32 int WINAPI WaveSetChannels (npAppli ptApp, int nChannels); + +#ifdef __cplusplus +} +#endif + +#ifndef _H2INC +enum { + LOCKIMAGE_READBLITONLY, + LOCKIMAGE_ALLREADACCESS, + LOCKIMAGE_HWACOMPATIBLE +}; + +#ifdef __cplusplus +DLLExport32 BOOL WINAPI WinAttachSurface (int idWin, cSurface * cs); +DLLExport32 void WINAPI WinDetachSurface (int idWin); + +DLLExport32 BOOL WINAPI LockImageSurface (LPVOID, DWORD hImage, cSurface &cs, int flags=LOCKIMAGE_READBLITONLY); +DLLExport32 void WINAPI UnlockImageSurface (cSurface &cs); + +// Get window surface (logical screen) +enum { + WSURF_LOGSCREEN, + WSURF_BACKSAVE +}; +DLLExport32 cSurface * WINAPI WinGetSurface (int idWin, int surfID=WSURF_LOGSCREEN); +#endif // __cplusplus +#endif // !defined(_H2INC) + +#ifndef _H2INC +#ifdef WIN32 +#pragma pack(pop) +#else +#pragma pack() +#endif +#endif + +#endif // _cnpdll_h diff --git a/Inc/ImageFlt.h b/Inc/ImageFlt.h index a44df2d..e9170b8 100644 --- a/Inc/ImageFlt.h +++ b/Inc/ImageFlt.h @@ -1,206 +1,206 @@ - -#ifndef _ImageFlt_h -#define _ImageFlt_h - -#include "FilterMgr.h" -#include "ImgFltDefs.h" - -////////////////////////////////////// -// Forwards - -class CImageFilter; -class CImageFilterMgr; -class CFilterImpl; -class CInputFile; -class COutputFile; -class CFilterImpl; - -////////////////////////////////////// -// Error codes - -enum { - IF_OK=0, - IF_NOTENOUGHMEM, - IF_CANNOTOPENFILE, - IF_CANNOTCREATEFILE, - IF_CANNOTWRITEFILE, - IF_UNKNOWNFORMAT, - IF_UNSUPPORTEDFORMAT, - IF_NOFILESPECIFIED, - IF_NOTSUPPORTED, - IF_NOTOPEN, - IF_UNSUPPORTEDDEPTH, - IF_INVALIDFILE, - IF_LESSTHAN256COLOR, - IF_INCORRECTDIMENSIONS, - IF_BADPARAMETER, - IF_UNINITIALIZEDFILTER, - IF_INVALIDPALETTE, - IF_ALREADYOPEN, - IF_ENDOFFILE, - IF_NOTANIMATIONFILTER, - IF_UNKNOWNERROR, -}; - -// Filter color caps -#define FLTCOLORCAPS_1 0x0001 -#define FLTCOLORCAPS_4 0x0002 -#define FLTCOLORCAPS_8 0x0004 -#define FLTCOLORCAPS_15 0x0008 -#define FLTCOLORCAPS_16 0x0010 -#define FLTCOLORCAPS_24 0x0020 -#define FLTCOLORCAPS_32 0x0040 - -// Filter type -#define FLTTYPE_IMAGES 0x0001 -#define FLTTYPE_ANIMATIONS 0x0002 - -// Compression -#define COMPRESSION_DEFAULT (-1) -#define COMPRESSION_MIN 0 -#define COMPRESSION_MAX 100 - -// SaveAnimation flags -#define SAVEANIMFLAG_SEPARATEFRAMES 0x00000001 - -// Progress proc -typedef BOOL (CALLBACK * PROGRESSPROC) (int p); - - -////////////////////////////////////////////////////////////////////////////// -// -// Image Filter Manager -// - -class IMGFLTMGR_API CImageFilterMgr : public CFilterMgr -{ -// Public -public: - CImageFilterMgr (); - virtual ~CImageFilterMgr(); - - static CImageFilterMgr* CreateInstance(); - - // Initialize - void Initialize(LPCSTR pFilterPath, DWORD dwFlags); - void Initialize(LPCWSTR pFilterPath, DWORD dwFlags); - virtual void Free(); - - // Filter infos - BOOL DoesFilterSupportImages(int nIndex); - BOOL DoesFilterSupportAnimations(int nIndex); - - // Data -protected: - friend class CImageFilter; -}; - -////////////////////////////////////////////////////////////////////////////// -// -// Image Filter -// -class IMGFLTMGR_API CImageFilter -{ -public: - // Constructeur / destructeur - CImageFilter(CImageFilterMgr* pMgr); - ~CImageFilter(); - - // Customisation - BOOL UseSpecificFilterIndex(int index); - BOOL UseSpecificFilterID(DWORD dwID); - - // Save customization - void SetCompressionLevel(int nLevel=-1); // 0 -> 100 - - // Picture - int Open(LPCSTR fileName); - int Open(LPCWSTR fileName); - int Open(CInputFile* pf); - int PrepareLoading(int width, int height, int depth, LPLOGPALETTE pPal); - int Load(LPBYTE pData, int width, int height, int pitch, int depth=0, LPLOGPALETTE pPal=NULL, LPBYTE pAlpha=NULL, int nAlphaPitch=0); - int Save(LPCSTR fileName, LPBYTE pData, int nWidth, int nHeight, int nDepth, int nPitch, LPLOGPALETTE pPal, LPBYTE pAlpha=NULL, int nAlphaPitch=0); - int Save(LPCWSTR fileName, LPBYTE pData, int nWidth, int nHeight, int nDepth, int nPitch, LPLOGPALETTE pPal, LPBYTE pAlpha=NULL, int nAlphaPitch=0); - void Close(); - int GetWidth(); - int GetHeight(); - int GetPitch(); - int GetDepth(); - DWORD GetDataSize(); - LPLOGPALETTE GetPalette(); - BOOL GetTransparentColor(COLORREF* pTranspColor); - BOOL ContainsAlphaChannel(); - - // Load animation - BOOL IsAnimation(); - int GetNumberOfFrames(); - int GetCurrentFrame(); - int GetFrameDelay(int frameIndex=-1); - DWORD GetAnimDuration(); - LPBYTE GetUserInfo(); - DWORD GetUserInfoSize(); - - void Restart(); - int GoToImage(LPBYTE pData, int pitch, int n); - void GetUpdateRect(LPRECT pRc); - int GetLoopCount(); - int GetLoopFrame(); - - // Save animation - int CreateAnimation(LPCSTR fname, int width, int height, int depth, - int nFrames, int msFrameDuration, - int nLoopCount = 1, int nLoopFrame = 0, - LPBYTE pUserInfo = NULL, DWORD dwUserInfoSize = 0); - int CreateAnimation(LPCWSTR fname, int width, int height, int depth, - int nFrames, int msFrameDuration, - int nLoopCount = 1, int nLoopFrame = 0, - LPBYTE pUserInfo = NULL, DWORD dwUserInfoSize = 0); - int CreateAnimation(COutputFile* pfout, int width, int height, int depth, - int nFrames, int msFrameDuration, - int nLoopCount = 1, int nLoopFrame = 0, - LPBYTE pUserInfo = NULL, DWORD dwUserInfoSize = 0); - int SaveAnimationFrame(LPBYTE pData, int width, int height, int pitch, int depth, LPLOGPALETTE pPal, LPBYTE pAlpha, int nAlphaPitch, int msFrameDuration, DWORD dwFlags); - int SaveAnimationFrame(LPBYTE pData, LPBYTE pPrevData, int width, int height, int pitch, int depth, LPLOGPALETTE pPal, LPBYTE pAlpha, LPBYTE pPrevAlpha, int nAlphaPitch, int msFrameDuration, DWORD dwFlags); - void AddPreviousFrameDuration(int msFrameDuration); - DWORD GetCurrentSaveAnimSize(); - - // File handling - void SetProgressCallBack(PROGRESSPROC pProc); - - // Filter info - DWORD GetFilterID(); - LPCSTR GetFilterNameA(); - int GetFilterIndex(); - DWORD GetFilterColorCaps(); - BOOL CanSave(); - BOOL CanSaveAnim(); - LPCWSTR GetFilterNameW(); - -protected: - int ReadHeader(); - - // Data -protected: - - // Image filter manager - CImageFilterMgr* m_pMgr; - - // Input - CInputFile* m_pfin; // Input file - BOOL m_bAutoDeletePfin; - BOOL m_bPrepared; - - // Output - COutputFile* m_pfout; // Output file - BOOL m_bAutoDeletePfout; - LPBYTE m_prevBuf; - - // Progress callback - PROGRESSPROC m_pProgressProc; - - // Filter implementation - CFilterImpl* m_pFilterImpl; -}; -typedef CImageFilter * LPIMAGEFILTER; - -#endif // _ImageFlt_h + +#ifndef _ImageFlt_h +#define _ImageFlt_h + +#include "FilterMgr.h" +#include "ImgFltDefs.h" + +////////////////////////////////////// +// Forwards + +class CImageFilter; +class CImageFilterMgr; +class CFilterImpl; +class CInputFile; +class COutputFile; +class CFilterImpl; + +////////////////////////////////////// +// Error codes + +enum { + IF_OK=0, + IF_NOTENOUGHMEM, + IF_CANNOTOPENFILE, + IF_CANNOTCREATEFILE, + IF_CANNOTWRITEFILE, + IF_UNKNOWNFORMAT, + IF_UNSUPPORTEDFORMAT, + IF_NOFILESPECIFIED, + IF_NOTSUPPORTED, + IF_NOTOPEN, + IF_UNSUPPORTEDDEPTH, + IF_INVALIDFILE, + IF_LESSTHAN256COLOR, + IF_INCORRECTDIMENSIONS, + IF_BADPARAMETER, + IF_UNINITIALIZEDFILTER, + IF_INVALIDPALETTE, + IF_ALREADYOPEN, + IF_ENDOFFILE, + IF_NOTANIMATIONFILTER, + IF_UNKNOWNERROR, +}; + +// Filter color caps +#define FLTCOLORCAPS_1 0x0001 +#define FLTCOLORCAPS_4 0x0002 +#define FLTCOLORCAPS_8 0x0004 +#define FLTCOLORCAPS_15 0x0008 +#define FLTCOLORCAPS_16 0x0010 +#define FLTCOLORCAPS_24 0x0020 +#define FLTCOLORCAPS_32 0x0040 + +// Filter type +#define FLTTYPE_IMAGES 0x0001 +#define FLTTYPE_ANIMATIONS 0x0002 + +// Compression +#define COMPRESSION_DEFAULT (-1) +#define COMPRESSION_MIN 0 +#define COMPRESSION_MAX 100 + +// SaveAnimation flags +#define SAVEANIMFLAG_SEPARATEFRAMES 0x00000001 + +// Progress proc +typedef BOOL (CALLBACK * PROGRESSPROC) (int p); + + +////////////////////////////////////////////////////////////////////////////// +// +// Image Filter Manager +// + +class IMGFLTMGR_API CImageFilterMgr : public CFilterMgr +{ +// Public +public: + CImageFilterMgr (); + virtual ~CImageFilterMgr(); + + static CImageFilterMgr* CreateInstance(); + + // Initialize + void Initialize(LPCSTR pFilterPath, DWORD dwFlags); + void Initialize(LPCWSTR pFilterPath, DWORD dwFlags); + virtual void Free(); + + // Filter infos + BOOL DoesFilterSupportImages(int nIndex); + BOOL DoesFilterSupportAnimations(int nIndex); + + // Data +protected: + friend class CImageFilter; +}; + +////////////////////////////////////////////////////////////////////////////// +// +// Image Filter +// +class IMGFLTMGR_API CImageFilter +{ +public: + // Constructeur / destructeur + CImageFilter(CImageFilterMgr* pMgr); + ~CImageFilter(); + + // Customisation + BOOL UseSpecificFilterIndex(int index); + BOOL UseSpecificFilterID(DWORD dwID); + + // Save customization + void SetCompressionLevel(int nLevel=-1); // 0 -> 100 + + // Picture + int Open(LPCSTR fileName); + int Open(LPCWSTR fileName); + int Open(CInputFile* pf); + int PrepareLoading(int width, int height, int depth, LPLOGPALETTE pPal); + int Load(LPBYTE pData, int width, int height, int pitch, int depth=0, LPLOGPALETTE pPal=NULL, LPBYTE pAlpha=NULL, int nAlphaPitch=0); + int Save(LPCSTR fileName, LPBYTE pData, int nWidth, int nHeight, int nDepth, int nPitch, LPLOGPALETTE pPal, LPBYTE pAlpha=NULL, int nAlphaPitch=0); + int Save(LPCWSTR fileName, LPBYTE pData, int nWidth, int nHeight, int nDepth, int nPitch, LPLOGPALETTE pPal, LPBYTE pAlpha=NULL, int nAlphaPitch=0); + void Close(); + int GetWidth(); + int GetHeight(); + int GetPitch(); + int GetDepth(); + DWORD GetDataSize(); + LPLOGPALETTE GetPalette(); + BOOL GetTransparentColor(COLORREF* pTranspColor); + BOOL ContainsAlphaChannel(); + + // Load animation + BOOL IsAnimation(); + int GetNumberOfFrames(); + int GetCurrentFrame(); + int GetFrameDelay(int frameIndex=-1); + DWORD GetAnimDuration(); + LPBYTE GetUserInfo(); + DWORD GetUserInfoSize(); + + void Restart(); + int GoToImage(LPBYTE pData, int pitch, int n); + void GetUpdateRect(LPRECT pRc); + int GetLoopCount(); + int GetLoopFrame(); + + // Save animation + int CreateAnimation(LPCSTR fname, int width, int height, int depth, + int nFrames, int msFrameDuration, + int nLoopCount = 1, int nLoopFrame = 0, + LPBYTE pUserInfo = NULL, DWORD dwUserInfoSize = 0); + int CreateAnimation(LPCWSTR fname, int width, int height, int depth, + int nFrames, int msFrameDuration, + int nLoopCount = 1, int nLoopFrame = 0, + LPBYTE pUserInfo = NULL, DWORD dwUserInfoSize = 0); + int CreateAnimation(COutputFile* pfout, int width, int height, int depth, + int nFrames, int msFrameDuration, + int nLoopCount = 1, int nLoopFrame = 0, + LPBYTE pUserInfo = NULL, DWORD dwUserInfoSize = 0); + int SaveAnimationFrame(LPBYTE pData, int width, int height, int pitch, int depth, LPLOGPALETTE pPal, LPBYTE pAlpha, int nAlphaPitch, int msFrameDuration, DWORD dwFlags); + int SaveAnimationFrame(LPBYTE pData, LPBYTE pPrevData, int width, int height, int pitch, int depth, LPLOGPALETTE pPal, LPBYTE pAlpha, LPBYTE pPrevAlpha, int nAlphaPitch, int msFrameDuration, DWORD dwFlags); + void AddPreviousFrameDuration(int msFrameDuration); + DWORD GetCurrentSaveAnimSize(); + + // File handling + void SetProgressCallBack(PROGRESSPROC pProc); + + // Filter info + DWORD GetFilterID(); + LPCSTR GetFilterNameA(); + int GetFilterIndex(); + DWORD GetFilterColorCaps(); + BOOL CanSave(); + BOOL CanSaveAnim(); + LPCWSTR GetFilterNameW(); + +protected: + int ReadHeader(); + + // Data +protected: + + // Image filter manager + CImageFilterMgr* m_pMgr; + + // Input + CInputFile* m_pfin; // Input file + BOOL m_bAutoDeletePfin; + BOOL m_bPrepared; + + // Output + COutputFile* m_pfout; // Output file + BOOL m_bAutoDeletePfout; + LPBYTE m_prevBuf; + + // Progress callback + PROGRESSPROC m_pProgressProc; + + // Filter implementation + CFilterImpl* m_pFilterImpl; +}; +typedef CImageFilter * LPIMAGEFILTER; + +#endif // _ImageFlt_h diff --git a/Inc/ObjectSelection.h b/Inc/ObjectSelection.h index 1783ef2..a071ade 100644 --- a/Inc/ObjectSelection.h +++ b/Inc/ObjectSelection.h @@ -1,144 +1,144 @@ - -// By Anders Riggelsen (Andos) -// http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=214148&gonew=1 - -// These files do not match up with the originals - modified for Edif (callbacks inside the extension class, etc..) - -#if !defined(OBJECTSELECTION) -#define OBJECTSELECTION - -#if !defined(EF_ISHWA) -#define EF_ISHWA 112 -#endif -#if !defined(EF_ISUNICODE) -#define EF_ISUNICODE 113 -#endif - -namespace Riggs -{ - class ObjectSelection - { - public: - - Extension * pExtension; - - ObjectSelection(LPRH rhPtr); - - void SelectAll(short Oi); - void SelectNone(short Oi); - void SelectOneObject(LPRO object); - void SelectObjects(short Oi, LPRO* objects, int count); - bool ObjectIsOfType(LPRO object, short Oi); - int GetNumberOfSelected(short Oi); - - template bool FilterObjects(short Oi, bool negate, T filterFunction) - { - if(Oi & 0x8000) - return FilterQualifierObjects(Oi & 0x7FFF, negate, filterFunction) ^ negate; - else - return FilterNonQualifierObjects(Oi, negate, filterFunction) ^ negate; - } - - protected: - - LPRH rhPtr; - LPOBL ObjectList; - LPOIL OiList; - LPQOI QualToOiList; - int oiListItemSize; - - LPOIL GetOILFromOI(short Oi); - - template bool DoCallback(void * Class, T Function, LPRO Parameter) - { - T _Function = Function; - void * FunctionPointer = *(void **) &_Function; - - int Result; - - __asm - { - pushad - - mov ecx, Class - - push Parameter - call FunctionPointer - add esp, 4 - - mov Result, eax - - popad - }; - - return (*(char *) &Result) != 0; - } - - template bool FilterQualifierObjects(short Oi, bool negate, T filterFunction) - { - LPQOI CurrentQualToOiStart = (LPQOI)((char*)QualToOiList + Oi); - LPQOI CurrentQualToOi = CurrentQualToOiStart; - - bool hasSelected = false; - - while(CurrentQualToOi->qoiOiList >= 0) - { - LPOIL CurrentOi = GetOILFromOI(CurrentQualToOi->qoiOiList); - hasSelected |= FilterNonQualifierObjects(CurrentOi->oilOi, negate, filterFunction); - CurrentQualToOi = (LPQOI)((char*)CurrentQualToOi + 4); - } - return hasSelected; - } - - template bool FilterNonQualifierObjects(short Oi, bool negate, T filterFunction) - { - LPOIL pObjectInfo = GetOILFromOI(Oi); - bool hasSelected = false; - - if(pObjectInfo->oilEventCount != rhPtr->rh2.rh2EventCount) - SelectAll(Oi); //The SOL is invalid, must reset. - - //If SOL is empty - if(pObjectInfo->oilNumOfSelected <= 0) - return false; - - int firstSelected = -1; - int count = 0; - int current = pObjectInfo->oilListSelected; - LPHO previous = NULL; - - while(current >= 0) - { - LPHO pObject = ObjectList[current].oblOffset; - bool useObject = DoCallback((void *) pExtension, filterFunction, (LPRO)pObject); - - if(negate) - useObject = !useObject; - - hasSelected |= useObject; - - if(useObject) - { - if(firstSelected == -1) - firstSelected = current; - - if(previous != NULL) - previous->hoNextSelected = current; - - previous = pObject; - count++; - } - current = pObject->hoNextSelected; - } - if(previous != NULL) - previous->hoNextSelected = -1; - - pObjectInfo->oilListSelected = firstSelected; - pObjectInfo->oilNumOfSelected = count; - - return hasSelected; - } - }; -} - + +// By Anders Riggelsen (Andos) +// http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=214148&gonew=1 + +// These files do not match up with the originals - modified for Edif (callbacks inside the extension class, etc..) + +#if !defined(OBJECTSELECTION) +#define OBJECTSELECTION + +#if !defined(EF_ISHWA) +#define EF_ISHWA 112 +#endif +#if !defined(EF_ISUNICODE) +#define EF_ISUNICODE 113 +#endif + +namespace Riggs +{ + class ObjectSelection + { + public: + + Extension * pExtension; + + ObjectSelection(LPRH rhPtr); + + void SelectAll(short Oi); + void SelectNone(short Oi); + void SelectOneObject(LPRO object); + void SelectObjects(short Oi, LPRO* objects, int count); + bool ObjectIsOfType(LPRO object, short Oi); + int GetNumberOfSelected(short Oi); + + template bool FilterObjects(short Oi, bool negate, T filterFunction) + { + if(Oi & 0x8000) + return FilterQualifierObjects(Oi & 0x7FFF, negate, filterFunction) ^ negate; + else + return FilterNonQualifierObjects(Oi, negate, filterFunction) ^ negate; + } + + protected: + + LPRH rhPtr; + LPOBL ObjectList; + LPOIL OiList; + LPQOI QualToOiList; + int oiListItemSize; + + LPOIL GetOILFromOI(short Oi); + + template bool DoCallback(void * Class, T Function, LPRO Parameter) + { + T _Function = Function; + void * FunctionPointer = *(void **) &_Function; + + int Result; + + __asm + { + pushad + + mov ecx, Class + + push Parameter + call FunctionPointer + add esp, 4 + + mov Result, eax + + popad + }; + + return (*(char *) &Result) != 0; + } + + template bool FilterQualifierObjects(short Oi, bool negate, T filterFunction) + { + LPQOI CurrentQualToOiStart = (LPQOI)((char*)QualToOiList + Oi); + LPQOI CurrentQualToOi = CurrentQualToOiStart; + + bool hasSelected = false; + + while(CurrentQualToOi->qoiOiList >= 0) + { + LPOIL CurrentOi = GetOILFromOI(CurrentQualToOi->qoiOiList); + hasSelected |= FilterNonQualifierObjects(CurrentOi->oilOi, negate, filterFunction); + CurrentQualToOi = (LPQOI)((char*)CurrentQualToOi + 4); + } + return hasSelected; + } + + template bool FilterNonQualifierObjects(short Oi, bool negate, T filterFunction) + { + LPOIL pObjectInfo = GetOILFromOI(Oi); + bool hasSelected = false; + + if(pObjectInfo->oilEventCount != rhPtr->rh2.rh2EventCount) + SelectAll(Oi); //The SOL is invalid, must reset. + + //If SOL is empty + if(pObjectInfo->oilNumOfSelected <= 0) + return false; + + int firstSelected = -1; + int count = 0; + int current = pObjectInfo->oilListSelected; + LPHO previous = NULL; + + while(current >= 0) + { + LPHO pObject = ObjectList[current].oblOffset; + bool useObject = DoCallback((void *) pExtension, filterFunction, (LPRO)pObject); + + if(negate) + useObject = !useObject; + + hasSelected |= useObject; + + if(useObject) + { + if(firstSelected == -1) + firstSelected = current; + + if(previous != NULL) + previous->hoNextSelected = current; + + previous = pObject; + count++; + } + current = pObject->hoNextSelected; + } + if(previous != NULL) + previous->hoNextSelected = -1; + + pObjectInfo->oilListSelected = firstSelected; + pObjectInfo->oilNumOfSelected = count; + + return hasSelected; + } + }; +} + #endif // !defined(OBJECTSELECTION) \ No newline at end of file diff --git a/Inc/Props.h b/Inc/Props.h index 52fb467..fee0ae1 100644 --- a/Inc/Props.h +++ b/Inc/Props.h @@ -1,1095 +1,1095 @@ -// Property definitions - -#ifndef MMF2_Props_h -#define MMF2_Props_h - -/////////////////////////////////////////////////////// -// -// Property data - used in property definition tables -// -typedef struct PropData -{ - int dwID; // Identifier - UINT_PTR sName; // Name = ID of the property name in the resources, or LPCSTR - UINT_PTR sInfo; // Info = ID of the property description in the resources, or LPCSTR - UINT_PTR lType; // Property type, or pointer to CPropItem (custom properties) - DWORD dwOptions; // Options (check box, bold, etc) - LPARAM lCreateParam; // Parameter -} PropData; - -#ifdef __cplusplus - -/////////////////////////////////////////////////////// -// -// Property values - used to set or get property values -// -class CPropValue; - -////////////// -// Base class -////////////// - -/** - * Property Value. - * This class is the base class of the classes that contain the values of editable properties. - * CPropValue objects allow to communicate values between the property window and the object data. - * This is a pure virtual class. - */ -class CPropValue -{ -protected: - virtual ~CPropValue() {} -public: - CPropValue() {} - - virtual void Delete() = 0; - virtual CPropValue* CreateCopy() = 0; - virtual BOOL IsEqual(CPropValue* value) = 0; - virtual DWORD GetClassID() = 0; -}; - -////////////// -// Int -////////////// - -/** - * Integer Property Value. - */ -class CPropIntValue : public CPropValue -{ -protected: - virtual ~CPropIntValue() {} -public: - CPropIntValue() { m_nValue = 0; } - CPropIntValue(int nValue) { m_nValue = nValue; } - - virtual void Delete() { delete this; } - virtual CPropValue* CreateCopy() { return new CPropIntValue(m_nValue); } - virtual BOOL IsEqual(CPropValue* value) { return (m_nValue == ((CPropIntValue*)value)->m_nValue); } - virtual DWORD GetClassID() { return 'INT '; } - -public: - int m_nValue; -}; - -////////////// -// DWORD -////////////// -// -/** - * DWORD Property Value. - */ -class CPropDWordValue : public CPropValue -{ -protected: - virtual ~CPropDWordValue() {} -public: - CPropDWordValue() { m_dwValue = 0L; } - CPropDWordValue(DWORD dwValue) { m_dwValue = dwValue; } - - virtual void Delete() { delete this; } - virtual CPropValue* CreateCopy() { return new CPropDWordValue(m_dwValue); } - virtual BOOL IsEqual(CPropValue* value) { return (m_dwValue == ((CPropDWordValue*)value)->m_dwValue); } - virtual DWORD GetClassID() { return 'DWRD'; } - -public: - DWORD m_dwValue; -}; - -////////////// -// Float -////////////// -// -/** - * Float Property Value. - */ -class CPropFloatValue : public CPropValue -{ -protected: - virtual ~CPropFloatValue() {} -public: - CPropFloatValue() { m_fValue = 0.0f; } - CPropFloatValue(float fValue) { m_fValue = fValue; } - - virtual void Delete() { delete this; } - virtual CPropValue* CreateCopy() { return new CPropFloatValue(m_fValue); } - virtual BOOL IsEqual(CPropValue* value) { return (m_fValue == ((CPropFloatValue*)value)->m_fValue); } - virtual DWORD GetClassID() { return 'FLOT'; } - -public: - float m_fValue; -}; - -////////////// -// Double -////////////// -// -/** - * Double Property Value. - */ -class CPropDoubleValue : public CPropValue -{ -protected: - virtual ~CPropDoubleValue() {} -public: - CPropDoubleValue() { m_dValue = 0.0; } - CPropDoubleValue(double dValue) { m_dValue = dValue; } - - virtual void Delete() { delete this; } - virtual CPropValue* CreateCopy() { return new CPropDoubleValue(m_dValue); } - virtual BOOL IsEqual(CPropValue* value) { return (m_dValue == ((CPropDoubleValue*)value)->m_dValue); } - virtual DWORD GetClassID() { return 'DBLE'; } - -public: - double m_dValue; -}; - -////////////// -// Size -////////////// -// -/** - * Size Property Value. - * Width and height, integer values. - */ -class CPropSizeValue : public CPropValue -{ -protected: - virtual ~CPropSizeValue() {} -public: - CPropSizeValue() { m_cx = m_cy = 0L; } - CPropSizeValue(int cx, int cy) { m_cx = cx; m_cy = cy; } - - virtual void Delete() { delete this; } - virtual CPropValue* CreateCopy() { return new CPropSizeValue(m_cx, m_cy); } - virtual BOOL IsEqual(CPropValue* value) { return (m_cx == ((CPropSizeValue*)value)->m_cx && m_cy == ((CPropSizeValue*)value)->m_cy); } - virtual DWORD GetClassID() { return 'SIZE'; } - -public: - int m_cx; - int m_cy; -}; - -////////////// -// Int64 -////////////// -// -/** - * Large Integer Property Value. - */ -class CPropInt64Value : public CPropValue -{ -protected: - virtual ~CPropInt64Value() {} -public: - CPropInt64Value() { m_nValue = 0; } - CPropInt64Value(__int64 nValue) { m_nValue = nValue; } - - virtual void Delete() { delete this; } - virtual CPropValue* CreateCopy() { return new CPropInt64Value(m_nValue); } - virtual BOOL IsEqual(CPropValue* value) { return (m_nValue == ((CPropInt64Value*)value)->m_nValue); } - virtual DWORD GetClassID() { return 'INT2'; } - -public: - __int64 m_nValue; -}; - -////////////// -// Pointer -////////////// -// -/** - * Pointer Property Value. - */ -class CPropPtrValue : public CPropValue -{ -protected: - virtual ~CPropPtrValue() {} -public: - CPropPtrValue() { m_ptr = NULL; } - CPropPtrValue(LPVOID ptr) { m_ptr = ptr; } - - virtual void Delete() { delete this; } - virtual CPropValue* CreateCopy() { return new CPropPtrValue(m_ptr); } - virtual BOOL IsEqual(CPropValue* value) { return (m_ptr == ((CPropPtrValue*)value)->m_ptr); } - virtual DWORD GetClassID() { return 'LPTR'; } - -public: - LPVOID m_ptr; -}; - -////////////// -// Buffer -////////////// -// -/** - * Buffer Property Value. - */ -class CPropDataValue : public CPropValue -{ -protected: - virtual ~CPropDataValue() {} -public: - CPropDataValue() { m_dwDataSize = 0L; m_pData = 0; } - CPropDataValue(DWORD dwDataSize, LPBYTE pData) { - m_dwDataSize = dwDataSize; - m_pData = NULL; - if ( dwDataSize != 0 ) - { - m_pData = (LPBYTE)malloc(dwDataSize); - if ( m_pData != NULL ) - { - if ( pData != NULL ) - memcpy(m_pData, pData, dwDataSize); - } - else - m_dwDataSize = 0; - } - } - CPropDataValue(LPCSTR pStr) { - m_dwDataSize = 0; - m_pData = NULL; - if ( pStr == NULL ) - return; - m_pData = (LPBYTE)_strdup(pStr); - m_dwDataSize = strlen((LPCSTR)m_pData)+1; - }; - - virtual void Delete() { free(m_pData); m_pData = NULL; m_dwDataSize = 0; delete this; } - virtual CPropValue* CreateCopy() { return new CPropDataValue(m_dwDataSize, m_pData); } - virtual BOOL IsEqual(CPropValue* value) { - if ( m_dwDataSize != ((CPropDataValue*)value)->m_dwDataSize ) - return FALSE; - if ( m_dwDataSize == 0 ) - return TRUE; - if ( m_pData == NULL || ((CPropDataValue*)value)->m_pData == NULL ) - return FALSE; - return (memcmp(m_pData, ((CPropDataValue*)value)->m_pData, m_dwDataSize) == 0); - } - virtual DWORD GetClassID() { return 'DATA'; } - -public: - DWORD m_dwDataSize; - LPBYTE m_pData; -}; - -///////////////// -// String (ANSI) -///////////////// -// -/** - * ANSI string Property Value. - */ -class CPropAStringValue : public CPropValue -{ -protected: - virtual ~CPropAStringValue() {} -public: - CPropAStringValue() { m_pStr = _strdup(""); m_unused = 0; } - CPropAStringValue(LPCSTR pStr) { - if ( pStr == NULL ) - m_pStr = _strdup(""); - else - m_pStr = _strdup(pStr); - m_unused = 0; - } - CPropAStringValue(LPCWSTR pWStr) { - if ( pWStr == NULL ) - m_pStr = _strdup(""); - else - { - // m_pStr = _strdup(pStr); - int lg = wcslen(pWStr); - m_pStr = (LPSTR)calloc(lg+1, 1); // TODO : change that if we use something else than CP_ACP - WideCharToMultiByte(CP_ACP, 0, pWStr, lg, m_pStr, lg, NULL, NULL); - m_pStr[lg] = 0; - } - m_unused = 0; - } - CPropAStringValue(int nStringSize) { - if ( nStringSize > 0 ) - m_pStr = (LPSTR)calloc(nStringSize+1, 1); - else - m_pStr = _strdup(""); - } - LPCSTR GetString() { - return m_pStr; - } - virtual void Delete() { free(m_pStr); m_pStr = NULL; delete this; } - virtual CPropValue* CreateCopy() { return new CPropAStringValue(m_pStr); } - virtual BOOL IsEqual(CPropValue* value) { - if ( m_pStr == NULL || ((CPropAStringValue*)value)->m_pStr == NULL ) - return (m_pStr == ((CPropAStringValue*)value)->m_pStr); - return (strcmp(m_pStr, ((CPropAStringValue*)value)->m_pStr) == 0); - } - virtual DWORD GetClassID() { return 'STRA'; } - -public: - DWORD m_unused; // for compatibility with Data property - LPSTR m_pStr; -}; - -/////////////////// -// String (UNICODE) -/////////////////// -// -/** - * Unicode string Property Value. - */ -class CPropWStringValue : public CPropValue -{ -protected: - virtual ~CPropWStringValue() {} -public: - CPropWStringValue() { m_pWStr = _wcsdup(L""); m_unused = 0; } - CPropWStringValue(LPCWSTR pWStr) { - if ( pWStr == NULL ) - m_pWStr = _wcsdup(L""); - else - m_pWStr = _wcsdup(pWStr); - m_unused = 0; - } - CPropWStringValue(LPCSTR pStr) { - if ( pStr == NULL ) - m_pWStr = _wcsdup(L""); - else - { - // m_pStr = _strdup(pStr); - int lg = strlen(pStr); - m_pWStr = (LPWSTR)calloc(lg+1, sizeof(wchar_t)); - MultiByteToWideChar(CP_ACP, 0, pStr, lg, m_pWStr, lg); - m_pWStr[lg] = 0; - } - m_unused = 0; - } - CPropWStringValue(int nStringSize) { - if ( nStringSize > 0 ) - m_pWStr = (LPWSTR)calloc(nStringSize+1, sizeof(wchar_t)); - else - m_pWStr = _wcsdup(L""); - } - LPCWSTR GetString() { - return m_pWStr; - } - virtual void Delete() { free(m_pWStr); m_pWStr = NULL; delete this; } - virtual CPropValue* CreateCopy() { return new CPropWStringValue(m_pWStr); } - virtual BOOL IsEqual(CPropValue* value) { - if ( m_pWStr == NULL || ((CPropWStringValue*)value)->m_pWStr == NULL ) - return (m_pWStr == ((CPropWStringValue*)value)->m_pWStr); - return (wcscmp(m_pWStr, ((CPropWStringValue*)value)->m_pWStr) == 0); - } - virtual DWORD GetClassID() { return 'STRW'; } - -public: - DWORD m_unused; // for compatibility with Data property - LPWSTR m_pWStr; -}; - -////////////////////////////////////////////////////////////////// -// String (ANSI or UNICODE, depending on preprocessor definitions) -////////////////////////////////////////////////////////////////// -#ifdef _UNICODE -#define CPropStringValue CPropWStringValue -#else -#define CPropStringValue CPropAStringValue -#endif - - -////////////////// -// Custom property -////////////////// -/** - * Custom property. - * This class allows to define a new type of property control. - * Derived classes must implement the methods to draw, activate, deactivate the control, - * as well as the methods to get and set values. - */ -class CCustomProp -{ -public: - CCustomProp() {} - - virtual void Initialize(HINSTANCE hInst, LPARAM lCreateParam, BOOL bReInit) {} - virtual void Delete() { delete this; } - - virtual void Draw(HDC hDC, LPRECT pRc, HFONT hFont, COLORREF textColor) {} - virtual CPropValue* GetPropValue() { return NULL; } - virtual void SetPropValue(CPropValue* pValue) {} - - virtual void Activate(HWND hParent, LPRECT pRc, HFONT hFont) {} - virtual void Deactivate() {} - virtual void Refresh() {} - virtual void Move(LPRECT pRc) {} - virtual BOOL UpdateData() { return FALSE; } - -protected: - virtual ~CCustomProp() {} -}; - -typedef CCustomProp* (CALLBACK* CP_CREATEINSTANCE)(); - -typedef struct CustomPropCreateStruct { - - CP_CREATEINSTANCE m_pCreateCustomPropFnc; - LPARAM m_lCreateParam; - -} CustomPropCreateStruct; - -// Notification Codes for custom properties -#define PWN_FIRST (0U-2000U) - -// Tells property window to validate the property item -// => the property window gets the property value from the property item -// and applies it to the other selected items -#define PWN_VALIDATECUSTOMITEM (PWN_FIRST-1) - -// Parameter structure for the PWN_VALIDATECUSTOMITEM notification message -typedef struct _NMPROPWND -{ - NMHDR hdr; - CCustomProp* pCP; -} NMPROPWND, *PNMPROPWND, FAR *LPNMPROPWND; - -// Example: -// -// NMPROPWND nmp; -// UINT id = (UINT)IDC_CUSTOMITEM; // identifier of the control that sends the notification message, if any -// nmp.hdr.code = PWN_VALIDATECUSTOMITEM; -// nmp.hdr.hwndFrom = m_hWnd; // hWnd of the control that sends the notification message, if any -// nmp.hdr.idFrom = id; -// nmp.pCP = this; // CCustomProp* -// -// // Edit property -// if ( OnEdit() ) -// { -// // Notify parent -// ::SendMessage(hParent, WM_NOTIFY, (WPARAM)id, (LPARAM)&nmp); -// } - -// Internal symbol used by MMF, not important -#define IDC_CUSTOMITEM 1500 - -#endif // __cplusplus - -//////////////////////////////////////////////// -// -// Property types -// - -/** - * List of property types. - */ -enum { - PROPTYPE_STATIC = 1, //! Simple static text - PROPTYPE_FOLDER, //! Folder - PROPTYPE_FOLDER_END, //! Folder End - PROPTYPE_EDITBUTTON, //! Edit button, param1 = button text, or NULL if Edit - PROPTYPE_EDIT_STRING, //! Edit box for strings, parameter = max length - PROPTYPE_EDIT_NUMBER, //! Edit box for numbers, parameters = min value, max value - PROPTYPE_COMBOBOX, //! Combo box, parameters = list of strings, options (sorted, etc) - PROPTYPE_SIZE, //! Size - PROPTYPE_COLOR, //! Color - PROPTYPE_LEFTCHECKBOX, //! Checkbox - PROPTYPE_SLIDEREDIT, //! Edit + Slider - PROPTYPE_SPINEDIT, //! Edit + Spin - PROPTYPE_DIRCTRL, //! Direction Selector - PROPTYPE_GROUP, //! Group - PROPTYPE_LISTBTN, //! Internal, do not use - PROPTYPE_FILENAME, //! Edit box + browse file button, parameter = FilenameCreateParam - PROPTYPE_FONT, //! Font dialog box - PROPTYPE_CUSTOM, //! Custom property - PROPTYPE_PICTUREFILENAME, //! Edit box + browse image file button - PROPTYPE_COMBOBOXBTN, //! Combo box, parameters = list of strings, options (sorted, etc) - PROPTYPE_EDIT_FLOAT, //! Edit box for floating point numbers, parameters = min value, max value, options (signed, float, spin) - PROPTYPE_EDIT_MULTILINE, //! Edit box for multiline texts, no parameter - PROPTYPE_IMAGELIST, //! Image list - PROPTYPE_ICONCOMBOBOX, //! Combo box with icons - PROPTYPE_URLBUTTON, //! URL button - PROPTYPE_DIRECTORYNAME, //! Directory pathname - PROPTYPE_SPINEDITFLOAT, //! Edit + Spin, value = floating point number -}; - -/////////////////// -// Property options -/////////////////// -// -#define PROPOPT_NIL 0x00000000 -#define PROPOPT_CHECKBOX 0x00000001 // Left check box -#define PROPOPT_BOLD 0x00000002 // Name must be displayed in bold characters -#define PROPOPT_PARAMREQUIRED 0x00000004 // A non-null parameter must be provided -#define PROPOPT_REMOVABLE 0x00000008 // The property can be deleted by the user -#define PROPOPT_RENAMABLE 0x00000010 // The property can be renamed by the user -#define PROPOPT_MOVABLE 0x00000020 // The property can be moved by the user (list only) -#define PROPOPT_LIST 0x00000040 // The property is a list -#define PROPOPT_SINGLESEL 0x00000080 // This property is not displayed in multi-selection mode - -// Property-specific options -#define PROPOPT_EDIT_PASSWORD 0x00010000 // For Edit String property -#define PROPOPT_EDIT_LOWERCASE 0x00020000 // For Edit String property -#define PROPOPT_EDIT_UPPERCASE 0x00040000 // For Edit String property - -// Internal, not used by extensions -#define PROPID_ROOT 0 - -///////////////////////////// -// Property definition macros -///////////////////////////// -// -#define PropData_Folder(id,name,info) {id,name,info,PROPTYPE_FOLDER,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_Folder_End() {-1,0,0,PROPTYPE_FOLDER_END,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_Group(id,name,info) {id,name,info,PROPTYPE_GROUP,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_StaticString(id,name,info) {id,name,info,PROPTYPE_STATIC,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_StaticString_Opt(id,name,info,opt) {id,name,info,PROPTYPE_STATIC,opt,(LPARAM)NULL} -#define PropData_StaticString_List(id,name,info) {id,name,info,PROPTYPE_STATIC,PROPOPT_LIST,(LPARAM)NULL} -#define PropData_EditString(id,name,info) {id,name,info,PROPTYPE_EDIT_STRING,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_EditString_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_STRING,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_EditString_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_STRING,opt,(LPARAM)NULL} -#define PropData_EditNumber(id,name,info) {id,name,info,PROPTYPE_EDIT_NUMBER,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_EditNumber_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_NUMBER,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_EditNumber_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_NUMBER,opt,(LPARAM)NULL} -#define PropData_EditFloat(id,name,info) {id,name,info,PROPTYPE_EDIT_FLOAT,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_EditFloat_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_FLOAT,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_EditFloat_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_FLOAT,opt,(LPARAM)NULL} -#define PropData_EditMultiLine(id,name,info) {id,name,info,PROPTYPE_EDIT_MULTILINE,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_EditMultiLine_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_MULTILINE,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_EditMultiLine_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_MULTILINE,opt,(LPARAM)NULL} -#define PropData_SliderEdit(id,name,info,minmax) {id,name,info,PROPTYPE_SLIDEREDIT,PROPOPT_PARAMREQUIRED,(LPARAM)minmax} -#define PropData_SliderEdit_Check(id,name,info,minmax) {id,name,info,PROPTYPE_SLIDEREDIT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmax} -#define PropData_SliderEdit_Opt(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SLIDEREDIT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmax} -#define PropData_SpinEdit(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDIT,PROPOPT_PARAMREQUIRED,(LPARAM)minmax} -#define PropData_SpinEdit_Check(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDIT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmax} -#define PropData_SpinEdit_Opt(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SPINEDIT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmax} -#define PropData_Button(id,name,info,text) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_NIL, (LPARAM)text} -#define PropData_Button_Check(id,name,info,text) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_CHECKBOX,(LPARAM)text} -#define PropData_Button_Opt(id,name,info,opt,text) {id,name,info,PROPTYPE_EDITBUTTON,opt,(LPARAM)text} -#define PropData_EditButton(id,name,info) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_NIL, (LPARAM)NULL} -#define PropData_EditButton_Check(id,name,info) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_EditButton_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDITBUTTON,opt,(LPARAM)NULL} -#define PropData_Size(id,name,info,tab) {id,name,info,PROPTYPE_SIZE,PROPOPT_PARAMREQUIRED,(LPARAM)tab} -#define PropData_Size_Check(id,name,info,tab) {id,name,info,PROPTYPE_SIZE,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)tab} -#define PropData_Size_Opt(id,name,info,opt,tab) {id,name,info,PROPTYPE_SIZE,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)tab} -#define PropData_Color(id,name,info) {id,name,info,PROPTYPE_COLOR,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_Color_Check(id,name,info) {id,name,info,PROPTYPE_COLOR,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_Color_Opt(id,name,info,opt) {id,name,info,PROPTYPE_COLOR,opt,(LPARAM)NULL} -#define PropData_ComboBox(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOX,PROPOPT_PARAMREQUIRED,(LPARAM)list} -#define PropData_ComboBox_Check(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOX,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} -#define PropData_ComboBox_Opt(id,name,info,opt,list) {id,name,info,PROPTYPE_COMBOBOX,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} -#define PropData_CheckBox(id,name,info) {id,name,info,PROPTYPE_LEFTCHECKBOX,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_CheckBox_Opt(id,name,info,opt) {id,name,info,PROPTYPE_LEFTCHECKBOX,(PROPOPT_CHECKBOX|opt),(LPARAM)NULL} -#define PropData_DirCtrl(id,name,info,param) {id,name,info,PROPTYPE_DIRCTRL,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_DirCtrl_Check(id,name,info,param) {id,name,info,PROPTYPE_DIRCTRL,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_DirCtrl_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_DIRCTRL,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_Filename(id,name,info,param) {id,name,info,PROPTYPE_FILENAME,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_Filename_Check(id,name,info,param) {id,name,info,PROPTYPE_FILENAME,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_Filename_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_FILENAME,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_PictureFilename(id,name,info,param) {id,name,info,PROPTYPE_PICTUREFILENAME,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_PictureFilename_Check(id,name,info,param) {id,name,info,PROPTYPE_PICTUREFILENAME,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_PictureFilename_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_PICTUREFILENAME,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_Font(id,name,info,param) {id,name,info,PROPTYPE_FONT,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_Font_Check(id,name,info,param) {id,name,info,PROPTYPE_FONT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_Font_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_FONT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_Custom(id,name,info,param) {id,name,info,PROPTYPE_CUSTOM,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_Custom_Check(id,name,info,param) {id,name,info,PROPTYPE_CUSTOM,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_Custom_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_CUSTOM,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_ComboBoxBtn(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOXBTN,PROPOPT_PARAMREQUIRED,(LPARAM)list} -#define PropData_ComboBoxBtn_Check(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOXBTN,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} -#define PropData_ComboBoxBtn_Opt(id,name,info,opt,list) {id,name,info,PROPTYPE_COMBOBOXBTN,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} -#define PropData_ImageList(id,name,info) {id,name,info,PROPTYPE_IMAGELIST,0,NULL} -#define PropData_ImageList_Check(id,name,info) {id,name,info,PROPTYPE_IMAGELIST,PROPOPT_CHECKBOX,NULL} -#define PropData_ImageList_Opt(id,name,info,opt) {id,name,info,PROPTYPE_IMAGELIST,opt,NULL} -#define PropData_IconComboBox(id,name,info,list) {id,name,info,PROPTYPE_ICONCOMBOBOX,PROPOPT_PARAMREQUIRED,(LPARAM)list} -#define PropData_IconComboBox_Check(id,name,info,list) {id,name,info,PROPTYPE_ICONCOMBOBOX,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} -#define PropData_IconComboBox_Opt(id,name,info,opt,list) {id,name,info,PROPTYPE_ICONCOMBOBOX,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} -#define PropData_URLButton(id,name,info,url) {id,name,info,PROPTYPE_URLBUTTON,PROPOPT_PARAMREQUIRED, (LPARAM)url} -#define PropData_URLButton_Check(id,name,info,url) {id,name,info,PROPTYPE_URLBUTTON,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)url} -#define PropData_URLButton_Opt(id,name,info,opt,url) {id,name,info,PROPTYPE_URLBUTTON,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)url} -#define PropData_DirectoryName(id,name,info,param) {id,name,info,PROPTYPE_DIRECTORYNAME,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_DirectoryName_Check(id,name,info,param) {id,name,info,PROPTYPE_DIRECTORYNAME,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_DirectoryName_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_DIRECTORYNAME,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_SpinEditFloat(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT,PROPOPT_PARAMREQUIRED,(LPARAM)minmaxdelta} -#define PropData_SpinEditFloat_Check(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmaxdelta} -#define PropData_SpinEditFloat_Opt(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmaxdelta} -#define PropData_End() {0} - -///////////////////////////////// -// Property definition parameters -///////////////////////////////// - -// Parameter for slider & spin property items -typedef struct { - int nMinValue; // Minimum value (note: cannot be less than -32768 for SpinEdit property) - int nMaxValue; // Maximum value (note: cannot be greater than 32767 for SpinEdit property) -} MinMaxParam; -typedef MinMaxParam* LPMINMAXPARAM; - -// Parameter for floating point slider & spin property items -typedef struct { - float fMinValue; // Minimum value (e.g. 0.0f) - float fMaxValue; // Maximum value (e.g. 1.0f) - float fDelta; // Delta value (e.g. 0.01f) -} MinMaxFloatParam; -typedef MinMaxFloatParam* LPMINMAXFLOATPARAM; - -// Direction Control Styles -enum -{ - DCS_NOBORDER = 0, // No border - DCS_FLAT = 1, // Flat - DCS_3D = 2, // 3D - DCS_SLIDER = 4, // Slider to change the number of directions - DCS_EMPTY = 8, // ??? should affect the appearance of direction spots... - DCS_SETALL_BTNS = 16, // "Select All" and "Reset" buttons -}; - -// Initialization structure for direction property -typedef struct { - BOOL bMultiSel; // TRUE for multi-selection - int numDirs; // Number of directions: 4,8,16,32 - DWORD style; // Style DCS_NOBORDER, DCS_FLAT, DCS_3D, [DCS_SLIDER,] DCS_EMPTY, DCS_SETALL_BTNS -} DirCtrlCreateParam; - -// Direction Property Value -typedef struct { - int selDir; // Direction index, single selection mode - DWORD selDir32; // 32-bit direction mask, multi-selection mode - int numDirs; // Number of directions (4, 8, 16 or 32) - int reserved; // Not used -} PropDirValue; - -// Initialization structure for file selector property -typedef struct { - LPCSTR extFilter; // Filter string for GetOpenFilename dialog (for example "All Files (*.*)|*.*|") - DWORD options; // Options for GetOpenFilename dialog (OFN_FILEMUSTEXIST, OFN_PATHMUSTEXIST, OFN_HIDEREADONLY, etc.) -} FilenameCreateParam; - -//////////////////////////////////////////////// -// -// MMF property identifier -// - -////////// -// Tab IDs -////////// -// -enum { - PROPID_TAB_GENERAL=1, - PROPID_TAB_DISPLAY, - PROPID_TAB_WINDOW, - PROPID_TAB_SIZEPOS, - PROPID_TAB_TEXTOPT, - PROPID_TAB_MOVEMENT, - PROPID_TAB_RUNOPT, - PROPID_TAB_VALUES, - PROPID_TAB_EVENTS, - PROPID_TAB_ABOUT, - PROPID_TAB_BLURAY, - PROPID_TAB_IPHONE, - PROPID_TAB_ANDROID, - PROPID_TAB_XNA, - PROPID_TAB_MAC, - PROPID_TAB_CUSTOM1 = 18, - PROPID_TAB_CUSTOM2, - PROPTAB_MAX // 20 -}; - -/////////////// -// Property IDs -////////// -// -// If you need them, you can retrieve, set or refresh -// standard properties with the mvSetPropValue, etc. macros -// and the following identifiers. -// - -// Objects -enum { - PROPID_ITEM_FIRST = 20, - PROPID_ITEM_NAME, - PROPID_ITEM_ICON, - PROPID_ITEM_HELP, - PROPID_ITEM_LAST, - - PROPID_FII_FIRST = 180, - PROPID_FII_POS, // Those properties are not available if the frame editor is not open - PROPID_FII_X, - PROPID_FII_Y, - PROPID_FII_SIZE, - PROPID_FII_CX, - PROPID_FII_CY, - PROPID_FII_ROT, - PROPID_FII_ANGLE, - PROPID_FII_LAST, - - PROPID_FITEM_FIRST=200, - PROPID_FITEM_INKFXFOLDER, - PROPID_FITEM_TRANSPARENT, - PROPID_FITEM_INKFX, - PROPID_FITEM_INKFXPARAM, - PROPID_FITEM_ANTIA, - PROPID_FITEM_MEMORYFOLDER, - PROPID_FITEM_GLOBAL, - PROPID_FITEM_LOADONCALL, - PROPID_FITEM_OPTIONS, - PROPID_FITEM_RGBCOEF, - PROPID_FITEM_BLENDCOEF, - PROPID_FITEM_IMAGECOMPRESSION, - PROPID_FITEM_GLOBAL_EDITORSYNCHRO, - PROPID_FITEM_LAST=249, - - PROPID_DYNITEM_FIRST=250, - - PROPID_DYNITEM_TRANSITIONS=250, - PROPID_DYNITEM_FADEIN, - PROPID_DYNITEM_FADEOUT, - PROPID_DYNITEM_OBSTACLE, - PROPID_DYNITEM_OBSTACLETYPE, - PROPID_DYNITEM_AUTOROTATEGROUP, - PROPID_DYNITEM_AUTOROTATE, - - PROPID_MVT_FIRST=300, - PROPID_DYNITEM_MVTFOLDER, - PROPID_DYNITEM_MVTLIST, - PROPID_DYNITEM_MVTTYPE, - PROPID_DYNITEM_INITDIR, - PROPID_DYNITEM_TRYMVT, - PROPID_DYNITEM_SPEEDFOLDER, - PROPID_DYNITEM_SPEED, - PROPID_DYNITEM_DECEL, - PROPID_DYNITEM_ACCEL, - PROPID_DYNITEM_MOVEATSTART, - PROPID_DYNITEM_BOUNCEFOLDER, - PROPID_DYNITEM_NANGLES, - PROPID_DYNITEM_RANDOMIZER, - PROPID_DYNITEM_SECURITY, - PROPID_DYNITEM_EDITMVT, - PROPID_DYNITEM_PLAYER, - PROPID_DYNITEM_DIRS, - PROPID_DYNITEM_ENABLEREVERSE, - PROPID_DYNITEM_ROTATION, - PROPID_DYNITEM_ROTSPEED, - PROPID_DYNITEM_JUMP, - PROPID_DYNITEM_GRAVITY, - PROPID_DYNITEM_JUMPSTRENGTH, - PROPID_DYNITEM_JUMPCONTROL, - PROPID_DYNITEM_MVTHELP, - PROPID_DYNITEM_8DIR_STICKOBST, - PROPID_MVT_LAST, - - PROPID_DYNITEM_ALTVALUES_GROUP=350, - PROPID_DYNITEM_ALTSTRINGS_GROUP, - PROPID_DYNITEM_QUALIF, - PROPID_DYNITEM_DISPLAY, - PROPID_DYNITEM_VISIBLEATSTART, - PROPID_DYNITEM_DISPLAYASBKD, - PROPID_DYNITEM_BKDFOLDER, - PROPID_DYNITEM_SAVEBKD, - PROPID_DYNITEM_WIPEWITHCOLOR, - PROPID_DYNITEM_CREATEBEFOREFADEIN, - PROPID_DYNITEM_SCROLLING, - PROPID_DYNITEM_FOLLOWFRAME, - PROPID_DYNITEM_DESTROYIFTOOFAR, - PROPID_DYNITEM_INACTIVATEIFTOOFAR, - PROPID_DYNITEM_COLLISIONS, - PROPID_DYNITEM_FINECOLL, - PROPID_DYNITEM_BEHAVIOR_HDR, - PROPID_DYNITEM_BEHAVIOR_END, - PROPID_DYNITEM_CREATE, - PROPID_DYNITEM_CREATEATSTART, - PROPID_DYNITEM_BACKCOLOROPACITY, - - PROPID_TEXT_FIRST=380, - PROPID_TEXT_FONT, - PROPID_TEXT_FACENAME, - PROPID_TEXT_SIZE, - PROPID_TEXT_BOLD, - PROPID_TEXT_ITALIC, - PROPID_TEXT_UNDERLINE, - PROPID_TEXT_STRIKEOUT, - PROPID_TEXT_COLOR, - PROPID_TEXT_ALIGNGROUP, - PROPID_TEXT_HALIGN, - PROPID_TEXT_VALIGN, - PROPID_TEXT_RTL, - PROPID_TEXT_LAST, - - PROPID_DYNITEM_LAST, - - PROPID_EXTITEM_FIRST=400, - PROPID_EXTITEM_EDIT, - PROPID_EXTITEM_ABOUT, - PROPID_EXTITEM_NAME, - PROPID_EXTITEM_AUTHOR, - PROPID_EXTITEM_COPYRIGHT, - PROPID_EXTITEM_COMMENT, - PROPID_EXTITEM_WEBSITE, - PROPID_EXTITEM_FILENAME, - PROPID_EXTITEM_LAST, - - PROPID_DYNITEM_ALTVALUE_FIRST=0x50000, - PROPID_DYNITEM_ALTVALUE_LAST =0x50019, - - PROPID_DYNITEM_ALTSTRING_FIRST=0x50800, - PROPID_DYNITEM_ALTSTRING_LAST =0x50809, - - PROPID_DYNITEM_BEHAVIOR_FIRST=0x51000, - PROPID_DYNITEM_BEHAVIOR_LAST =0x51FFF, - - PROPID_MVTEXT_FIRST=0x52000, - PROPID_MVTEXT_LAST =0x52FFF, - - PROPID_FADE_PARAM_FIRST=0x53000, - PROPID_FADE_PARAM_LAST =0x53FFF, - - PROPID_FITEM_FXPARAM_FIRST=0x54000, - PROPID_FITEM_FXPARAM_LAST=0x54FFF, - - // Extensions must use property identifiers between PROPID_EXTITEM_CUSTOM_FIRST and PROPID_EXTITEM_CUSTOM_LAST - PROPID_EXTITEM_CUSTOM_FIRST=0x80000, - PROPID_EXTITEM_CUSTOM_LAST =0xFFFFF, -}; - -// Application -enum { - PROPID_APP_FIRST = 50, - PROPID_APP_ABOUT, - PROPID_APP_AUTHOR, - PROPID_APP_DESCRIPTION, - PROPID_APP_COPYRIGHT, - PROPID_APP_COMPANY, - PROPID_APP_FILEVERSION, - PROPID_APP_ICON, - PROPID_APP_WINDOWSIZE, - PROPID_APP_WINDOWBACKGROUNDCOLOR, - PROPID_APP_WINDOWSTYLE, - PROPID_APP_HEADING, - PROPID_APP_HEADINGMAX, - PROPID_APP_MENU, - PROPID_APP_MENUBAR, - PROPID_APP_MENUBOOTUP, - PROPID_APP_NOMINIMIZEBOX, - PROPID_APP_NOMAXIMIZEBOX, - PROPID_APP_NOTHICKFRAME, - PROPID_APP_MAXIMIZEDONBOOTUP, - PROPID_APP_HIDDENATSTART, - PROPID_APP_DISABLECLOSE, - PROPID_APP_OPTIONS, - PROPID_APP_FULLSCREEN, - PROPID_APP_FULLSWITCH, - PROPID_APP_RESIZETOWINDOWSIZE, - PROPID_APP_DONOTCENTERFRAME, - PROPID_APP_MACHINEINDEP, - PROPID_APP_SCREENSAVER_NOAUTOSTOP, - PROPID_APP_SOUNDOPT, - PROPID_APP_MULTISAMPLE, - PROPID_APP_SOUNDSOVERFRAMES, - PROPID_APP_SAMPLESEVENIFNOTFOCUS, - PROPID_APP_DISPOPT, - PROPID_APP_DISPLAYMODE, - PROPID_APP_ENABLEVISUALTHEMES, - PROPID_APP_PLAYERS, - PROPID_APP_INITSCORE, - PROPID_APP_INITLIVES, - PROPID_APP_FILENAME, - PROPID_APP_HELP, - PROPID_APP_HELPFILE, - PROPID_APP_PLAYERCTRLS, - PROPID_APP_VTZ, - PROPID_APP_VTZPREVIEWFILE, - PROPID_APP_GLOBALVALUE_GROUP, - PROPID_APP_GLOBALSTRING_GROUP, - PROPID_APP_GLOBALEVENTS, - PROPID_APP_BUILD, - PROPID_APP_BUILDTYPE, - PROPID_APP_INSTALLSETTINGS, - PROPID_APP_BUILDFILE, - PROPID_APP_BUILDOPT, - PROPID_APP_COMPLEVEL, - PROPID_APP_COMPSND, - PROPID_APP_ALLINONE, - PROPID_APP_FRAMERATE, - PROPID_APP_VSYNC, - PROPID_APP_RUNWHENMINIMIZED, - PROPID_APP_RUNOPTGROUP, - PROPID_APP_RUNCMDLINE, - PROPID_APP_MDI, - PROPID_APP_WINMENUIDX, - PROPID_APP_ABOUTTEXT, - PROPID_APP_RUNWHILERESIZING, - PROPID_APP_DEBUGGERSHORTCUTS, - PROPID_APP_GRAPHICS, - PROPID_APP_GRAPHICMODE, - PROPID_APP_IMAGEFILTERS, - PROPID_APP_SOUNDFILTERS, - PROPID_APP_SHOWDEBUGGER, - PROPID_APP_COMPRUNTIME, - PROPID_APP_DONOTSHAREDATA, - PROPID_APP_VTZONLYFROMURL, - PROPID_APP_VTZENABLESCRIPT, - PROPID_APP_VISTAOPT, - PROPID_APP_EXECLEVEL, - PROPID_APP_VTZONLY, - PROPID_APP_BUILDJARURL, - PROPID_APP_WNDTRANSP, - PROPID_APP_BRBUILDDIR, - PROPID_APP_LOADANIM_GROUP, - PROPID_APP_LOADANIM_IMAGE, - PROPID_APP_LOADANIM_NIMAGES, - PROPID_APP_BRBUILDFILE, - PROPID_APP_BRUSEMOSAIC, - PROPID_APP_BRGRAPHICSINJAR, - PROPID_APP_BRSIGNED, - PROPID_APP_BRORGID, - PROPID_APP_BRAPPID, - PROPID_APP_BRSGACT, - PROPID_APP_BRSGKEYSTORE, - PROPID_APP_BRSGKEYSTOREPW, - PROPID_APP_BRSGKEY, - PROPID_APP_BRSGKEYPW, - PROPID_APP_BRBACKSURFACE, - PROPID_APP_BRGRAPHICS_GROUP, - PROPID_APP_BRSIGNING_GROUP, - PROPID_APP_BRLOADOPTIONS_GROUP, - PROPID_APP_BRLOADALLIMAGESATSTART, - PROPID_APP_BRLOADALLSOUNDSATSTART, - PROPID_APP_BRSOUNDS_GROUP, - PROPID_APP_BREXTERNALSOUNDS, - PROPID_APP_BUILDDIR, - PROPID_APP_FULLSCREENGROUP, - PROPID_APP_KEEPSCREENRATIO, - PROPID_APP_SCREENRATIOTOLERANCE, - PROPID_APP_BRBUILDDIR2, - PROPID_APP_RESAMPLESTRETCH, - PROPID_APP_GLOBALREFRESH, - PROPID_APP_FLASH_MOCHIADS_GROUP, - PROPID_APP_FLASH_MOCHIADS, - PROPID_APP_FLASH_MOCHIADS_GAMEID, - PROPID_APP_FLASH_MOCHIADS_START, - PROPID_APP_FLASH_MOCHIADS_END, - PROPID_APP_LANGUAGE, - PROPID_APP_SCREENROTATION, - PROPID_APP_FLASH_PRELOADER_GROUP, - PROPID_APP_FLASH_PRELOADER, - PROPID_APP_FLASH_PRELOADER_FILENAME, - PROPID_APP_FLASH_PRELOADER_PGB_X, - PROPID_APP_FLASH_PRELOADER_PGB_Y, - PROPID_APP_FLASH_PRELOADER_PGB_RADIUS, - PROPID_APP_FLASH_PRELOADER_PGB_THICKNESS, - PROPID_APP_FLASH_PRELOADER_PGB_COLOR, - PROPID_APP_FLASH_PRELOADER_BACK_COLOR, - PROPID_APP_MP3_GROUP, - PROPID_APP_MP3_FORCEFREQ, - PROPID_APP_MP3_BITRATE, - PROPID_APP_MP3_ENCODER, - PROPID_APP_FLASH_MOCHIADS_SIGNUP, - PROPID_APP_FLASH_PRELOADERTYPE, - PROPID_APP_FLASH_EMBEDDEDFONTS_GROUP, - PROPID_APP_FLASH_EMBEDDEDFONTS, - PROPID_APP_IPHONE_GROUP, - PROPID_APP_IPHONE_ORIENTATION, - PROPID_APP_RTL, - PROPID_APP_IPHONEBUNDLEID, - PROPID_APP_IPHONETEXTURECOMPRESSION, - PROPID_APP_IPHONEMULTITASK, - PROPID_APP_IPHONEIMAGES_GROUP, - PROPID_APP_IPHONEAPPICON_IPHONE, - PROPID_APP_IPHONELAUNCHIMAGE_IPHONE, - PROPID_APP_IPHONEITUNEARTWORK, - PROPID_APP_ANDROIDKEYSTORE, - PROPID_APP_ANDROIDKEYNAME, - PROPID_APP_ANDROIDRELEASE, - PROPID_APP_ANDROIDPACKAGENAME, - PROPID_APP_ANDROIDIMAGES_GROUP, - PROPID_APP_ANDROIDLAUNCHERICON, - PROPID_APP_ANDROIDMENUICON, - PROPID_APP_ANDROIDTESTMODE, - PROPID_APP_ANDROIDEMULATORS, - PROPID_APP_IPHONESTATUSLINE, - PROPID_APP_RTLLAYOUT, - PROPID_APP_IPHONEIAD_GROUP, - PROPID_APP_IPHONEENABLEIAD, - PROPID_APP_IPHONEIADBOTTOM, - PROPID_APP_OPTIONAL_MODULES, - PROPID_APP_ANDROIDVERSION, - PROPID_APP_IPHONEBUNDLEVERSION, - PROPID_APP_IPHONETARGETDEVICE, - PROPID_APP_IPHONEARCHITECTURE, - PROPID_APP_IPHONEAPPICON_IPAD, - PROPID_APP_IPHONELAUNCHIMAGE_IPAD, - PROPID_APP_XNAPROJECTPATH, - PROPID_APP_XNAPROJECTNAME, - PROPID_APP_XNASTATUSLINE, - PROPID_APP_XNAFONT_GROUP, - PROPID_APP_XNAFONT_FIRSTCHAR, - PROPID_APP_XNAFONT_LASTCHAR, - PROPID_APP_JOYSTICKIMAGES, - PROPID_APP_ANDROIDSTATUSLINE, - PROPID_APP_BUILDTYPE_REAL, - PROPID_APP_ANDROID_PERMS, - PROPID_APP_ANDROIDDISABLEBACKBUTTON, - PROPID_APP_IPHONEANTIALIAS, - PROPID_APP_ANDROID_AUTOEND, - PROPID_APP_ANDROIDCRASHREPORTING, - PROPID_APP_FLASH_TARGETPLAYER, - PROPID_APP_BUILDWARNINGS, - PROPID_APP_XNAADS, - PROPID_APP_XNAPUBCENTERID, - PROPID_APP_LAST, - - PROPID_APP_ANDROID_PERM_FIRST = 90001, - PROPID_APP_ANDROID_PERM_LAST = 90105, - - PROPID_APP_GLOBALVALUE_FIRST = 100000, - PROPID_APP_GLOBALVALUE_LAST = 199998, - - PROPID_APP_GLOBALSTRING_FIRST = 200000, - PROPID_APP_GLOBALSTRING_LAST = 299998, - -}; - -// Frame -enum { - PROPID_FRAME_FIRST = 100, - PROPID_FRAME_FRAME, - PROPID_FRAME_SIZE, - PROPID_FRAME_BACKGROUNDCOLOR, - PROPID_FRAME_PALETTE, - PROPID_FRAME_RUNOPT, - PROPID_FRAME_GRABDESKTOP, - PROPID_FRAME_KEEPDISPLAY, - PROPID_FRAME_TOTALCOLMASK, - PROPID_FRAME_FRAMETITLEINCAPTION, - PROPID_FRAME_RESIZETOSCREENSIZE, - PROPID_FRAME_FORCELOADONCALL, - PROPID_FRAME_NOBJECTS, - PROPID_FRAME_PASSWORD, - PROPID_FRAME_TRANSITIONS, - PROPID_FRAME_FADEIN, - PROPID_FRAME_FADEOUT, - PROPID_FRAME_NOSURFACE, - PROPID_FRAME_SCRSETUP, - PROPID_FRAME_VIRTUALRIGHT, - PROPID_FRAME_VIRTUALBOTTOM, - PROPID_FRAME_DEMO, - PROPID_FRAME_DEMOFILENAME, - PROPID_FRAME_RECORD, - PROPID_FRAME_RANDOMSEED, - PROPID_FRAME_WNDTRANSP, - PROPID_FRAME_KEYRELEASETIME, - PROPID_FRAME_TIMEDMVTS, - PROPID_FRAME_TIMEDMVTSBASE, - PROPID_FRAME_FLASH_MOCHIADS_INTER, - PROPID_FRAME_GLOBALEVENTS, - PROPID_FRAME_IPHONE_JOYSTICK_GROUP, - PROPID_FRAME_IPHONE_JOYSTICK_TYPE, - PROPID_FRAME_IPHONE_JOYSTICK_FIRE1, - PROPID_FRAME_IPHONE_JOYSTICK_FIRE2, - PROPID_FRAME_IPHONE_JOYSTICK_LEFTHAND, - PROPID_FRAME_IPHONE_GROUP, - PROPID_FRAME_IPHONE_TOUCHMODE, - PROPID_FRAME_DISABLEIDLETIMER, - PROPID_FRAME_IPHONEIAD_GROUP, - PROPID_FRAME_IPHONEIAD, - PROPID_FRAME_LAST, -}; - -#endif // MMF2_Props_h +// Property definitions + +#ifndef MMF2_Props_h +#define MMF2_Props_h + +/////////////////////////////////////////////////////// +// +// Property data - used in property definition tables +// +typedef struct PropData +{ + int dwID; // Identifier + UINT_PTR sName; // Name = ID of the property name in the resources, or LPCSTR + UINT_PTR sInfo; // Info = ID of the property description in the resources, or LPCSTR + UINT_PTR lType; // Property type, or pointer to CPropItem (custom properties) + DWORD dwOptions; // Options (check box, bold, etc) + LPARAM lCreateParam; // Parameter +} PropData; + +#ifdef __cplusplus + +/////////////////////////////////////////////////////// +// +// Property values - used to set or get property values +// +class CPropValue; + +////////////// +// Base class +////////////// + +/** + * Property Value. + * This class is the base class of the classes that contain the values of editable properties. + * CPropValue objects allow to communicate values between the property window and the object data. + * This is a pure virtual class. + */ +class CPropValue +{ +protected: + virtual ~CPropValue() {} +public: + CPropValue() {} + + virtual void Delete() = 0; + virtual CPropValue* CreateCopy() = 0; + virtual BOOL IsEqual(CPropValue* value) = 0; + virtual DWORD GetClassID() = 0; +}; + +////////////// +// Int +////////////// + +/** + * Integer Property Value. + */ +class CPropIntValue : public CPropValue +{ +protected: + virtual ~CPropIntValue() {} +public: + CPropIntValue() { m_nValue = 0; } + CPropIntValue(int nValue) { m_nValue = nValue; } + + virtual void Delete() { delete this; } + virtual CPropValue* CreateCopy() { return new CPropIntValue(m_nValue); } + virtual BOOL IsEqual(CPropValue* value) { return (m_nValue == ((CPropIntValue*)value)->m_nValue); } + virtual DWORD GetClassID() { return 'INT '; } + +public: + int m_nValue; +}; + +////////////// +// DWORD +////////////// +// +/** + * DWORD Property Value. + */ +class CPropDWordValue : public CPropValue +{ +protected: + virtual ~CPropDWordValue() {} +public: + CPropDWordValue() { m_dwValue = 0L; } + CPropDWordValue(DWORD dwValue) { m_dwValue = dwValue; } + + virtual void Delete() { delete this; } + virtual CPropValue* CreateCopy() { return new CPropDWordValue(m_dwValue); } + virtual BOOL IsEqual(CPropValue* value) { return (m_dwValue == ((CPropDWordValue*)value)->m_dwValue); } + virtual DWORD GetClassID() { return 'DWRD'; } + +public: + DWORD m_dwValue; +}; + +////////////// +// Float +////////////// +// +/** + * Float Property Value. + */ +class CPropFloatValue : public CPropValue +{ +protected: + virtual ~CPropFloatValue() {} +public: + CPropFloatValue() { m_fValue = 0.0f; } + CPropFloatValue(float fValue) { m_fValue = fValue; } + + virtual void Delete() { delete this; } + virtual CPropValue* CreateCopy() { return new CPropFloatValue(m_fValue); } + virtual BOOL IsEqual(CPropValue* value) { return (m_fValue == ((CPropFloatValue*)value)->m_fValue); } + virtual DWORD GetClassID() { return 'FLOT'; } + +public: + float m_fValue; +}; + +////////////// +// Double +////////////// +// +/** + * Double Property Value. + */ +class CPropDoubleValue : public CPropValue +{ +protected: + virtual ~CPropDoubleValue() {} +public: + CPropDoubleValue() { m_dValue = 0.0; } + CPropDoubleValue(double dValue) { m_dValue = dValue; } + + virtual void Delete() { delete this; } + virtual CPropValue* CreateCopy() { return new CPropDoubleValue(m_dValue); } + virtual BOOL IsEqual(CPropValue* value) { return (m_dValue == ((CPropDoubleValue*)value)->m_dValue); } + virtual DWORD GetClassID() { return 'DBLE'; } + +public: + double m_dValue; +}; + +////////////// +// Size +////////////// +// +/** + * Size Property Value. + * Width and height, integer values. + */ +class CPropSizeValue : public CPropValue +{ +protected: + virtual ~CPropSizeValue() {} +public: + CPropSizeValue() { m_cx = m_cy = 0L; } + CPropSizeValue(int cx, int cy) { m_cx = cx; m_cy = cy; } + + virtual void Delete() { delete this; } + virtual CPropValue* CreateCopy() { return new CPropSizeValue(m_cx, m_cy); } + virtual BOOL IsEqual(CPropValue* value) { return (m_cx == ((CPropSizeValue*)value)->m_cx && m_cy == ((CPropSizeValue*)value)->m_cy); } + virtual DWORD GetClassID() { return 'SIZE'; } + +public: + int m_cx; + int m_cy; +}; + +////////////// +// Int64 +////////////// +// +/** + * Large Integer Property Value. + */ +class CPropInt64Value : public CPropValue +{ +protected: + virtual ~CPropInt64Value() {} +public: + CPropInt64Value() { m_nValue = 0; } + CPropInt64Value(__int64 nValue) { m_nValue = nValue; } + + virtual void Delete() { delete this; } + virtual CPropValue* CreateCopy() { return new CPropInt64Value(m_nValue); } + virtual BOOL IsEqual(CPropValue* value) { return (m_nValue == ((CPropInt64Value*)value)->m_nValue); } + virtual DWORD GetClassID() { return 'INT2'; } + +public: + __int64 m_nValue; +}; + +////////////// +// Pointer +////////////// +// +/** + * Pointer Property Value. + */ +class CPropPtrValue : public CPropValue +{ +protected: + virtual ~CPropPtrValue() {} +public: + CPropPtrValue() { m_ptr = NULL; } + CPropPtrValue(LPVOID ptr) { m_ptr = ptr; } + + virtual void Delete() { delete this; } + virtual CPropValue* CreateCopy() { return new CPropPtrValue(m_ptr); } + virtual BOOL IsEqual(CPropValue* value) { return (m_ptr == ((CPropPtrValue*)value)->m_ptr); } + virtual DWORD GetClassID() { return 'LPTR'; } + +public: + LPVOID m_ptr; +}; + +////////////// +// Buffer +////////////// +// +/** + * Buffer Property Value. + */ +class CPropDataValue : public CPropValue +{ +protected: + virtual ~CPropDataValue() {} +public: + CPropDataValue() { m_dwDataSize = 0L; m_pData = 0; } + CPropDataValue(DWORD dwDataSize, LPBYTE pData) { + m_dwDataSize = dwDataSize; + m_pData = NULL; + if ( dwDataSize != 0 ) + { + m_pData = (LPBYTE)malloc(dwDataSize); + if ( m_pData != NULL ) + { + if ( pData != NULL ) + memcpy(m_pData, pData, dwDataSize); + } + else + m_dwDataSize = 0; + } + } + CPropDataValue(LPCSTR pStr) { + m_dwDataSize = 0; + m_pData = NULL; + if ( pStr == NULL ) + return; + m_pData = (LPBYTE)_strdup(pStr); + m_dwDataSize = strlen((LPCSTR)m_pData)+1; + }; + + virtual void Delete() { free(m_pData); m_pData = NULL; m_dwDataSize = 0; delete this; } + virtual CPropValue* CreateCopy() { return new CPropDataValue(m_dwDataSize, m_pData); } + virtual BOOL IsEqual(CPropValue* value) { + if ( m_dwDataSize != ((CPropDataValue*)value)->m_dwDataSize ) + return FALSE; + if ( m_dwDataSize == 0 ) + return TRUE; + if ( m_pData == NULL || ((CPropDataValue*)value)->m_pData == NULL ) + return FALSE; + return (memcmp(m_pData, ((CPropDataValue*)value)->m_pData, m_dwDataSize) == 0); + } + virtual DWORD GetClassID() { return 'DATA'; } + +public: + DWORD m_dwDataSize; + LPBYTE m_pData; +}; + +///////////////// +// String (ANSI) +///////////////// +// +/** + * ANSI string Property Value. + */ +class CPropAStringValue : public CPropValue +{ +protected: + virtual ~CPropAStringValue() {} +public: + CPropAStringValue() { m_pStr = _strdup(""); m_unused = 0; } + CPropAStringValue(LPCSTR pStr) { + if ( pStr == NULL ) + m_pStr = _strdup(""); + else + m_pStr = _strdup(pStr); + m_unused = 0; + } + CPropAStringValue(LPCWSTR pWStr) { + if ( pWStr == NULL ) + m_pStr = _strdup(""); + else + { + // m_pStr = _strdup(pStr); + int lg = wcslen(pWStr); + m_pStr = (LPSTR)calloc(lg+1, 1); // TODO : change that if we use something else than CP_ACP + WideCharToMultiByte(CP_ACP, 0, pWStr, lg, m_pStr, lg, NULL, NULL); + m_pStr[lg] = 0; + } + m_unused = 0; + } + CPropAStringValue(int nStringSize) { + if ( nStringSize > 0 ) + m_pStr = (LPSTR)calloc(nStringSize+1, 1); + else + m_pStr = _strdup(""); + } + LPCSTR GetString() { + return m_pStr; + } + virtual void Delete() { free(m_pStr); m_pStr = NULL; delete this; } + virtual CPropValue* CreateCopy() { return new CPropAStringValue(m_pStr); } + virtual BOOL IsEqual(CPropValue* value) { + if ( m_pStr == NULL || ((CPropAStringValue*)value)->m_pStr == NULL ) + return (m_pStr == ((CPropAStringValue*)value)->m_pStr); + return (strcmp(m_pStr, ((CPropAStringValue*)value)->m_pStr) == 0); + } + virtual DWORD GetClassID() { return 'STRA'; } + +public: + DWORD m_unused; // for compatibility with Data property + LPSTR m_pStr; +}; + +/////////////////// +// String (UNICODE) +/////////////////// +// +/** + * Unicode string Property Value. + */ +class CPropWStringValue : public CPropValue +{ +protected: + virtual ~CPropWStringValue() {} +public: + CPropWStringValue() { m_pWStr = _wcsdup(L""); m_unused = 0; } + CPropWStringValue(LPCWSTR pWStr) { + if ( pWStr == NULL ) + m_pWStr = _wcsdup(L""); + else + m_pWStr = _wcsdup(pWStr); + m_unused = 0; + } + CPropWStringValue(LPCSTR pStr) { + if ( pStr == NULL ) + m_pWStr = _wcsdup(L""); + else + { + // m_pStr = _strdup(pStr); + int lg = strlen(pStr); + m_pWStr = (LPWSTR)calloc(lg+1, sizeof(wchar_t)); + MultiByteToWideChar(CP_ACP, 0, pStr, lg, m_pWStr, lg); + m_pWStr[lg] = 0; + } + m_unused = 0; + } + CPropWStringValue(int nStringSize) { + if ( nStringSize > 0 ) + m_pWStr = (LPWSTR)calloc(nStringSize+1, sizeof(wchar_t)); + else + m_pWStr = _wcsdup(L""); + } + LPCWSTR GetString() { + return m_pWStr; + } + virtual void Delete() { free(m_pWStr); m_pWStr = NULL; delete this; } + virtual CPropValue* CreateCopy() { return new CPropWStringValue(m_pWStr); } + virtual BOOL IsEqual(CPropValue* value) { + if ( m_pWStr == NULL || ((CPropWStringValue*)value)->m_pWStr == NULL ) + return (m_pWStr == ((CPropWStringValue*)value)->m_pWStr); + return (wcscmp(m_pWStr, ((CPropWStringValue*)value)->m_pWStr) == 0); + } + virtual DWORD GetClassID() { return 'STRW'; } + +public: + DWORD m_unused; // for compatibility with Data property + LPWSTR m_pWStr; +}; + +////////////////////////////////////////////////////////////////// +// String (ANSI or UNICODE, depending on preprocessor definitions) +////////////////////////////////////////////////////////////////// +#ifdef _UNICODE +#define CPropStringValue CPropWStringValue +#else +#define CPropStringValue CPropAStringValue +#endif + + +////////////////// +// Custom property +////////////////// +/** + * Custom property. + * This class allows to define a new type of property control. + * Derived classes must implement the methods to draw, activate, deactivate the control, + * as well as the methods to get and set values. + */ +class CCustomProp +{ +public: + CCustomProp() {} + + virtual void Initialize(HINSTANCE hInst, LPARAM lCreateParam, BOOL bReInit) {} + virtual void Delete() { delete this; } + + virtual void Draw(HDC hDC, LPRECT pRc, HFONT hFont, COLORREF textColor) {} + virtual CPropValue* GetPropValue() { return NULL; } + virtual void SetPropValue(CPropValue* pValue) {} + + virtual void Activate(HWND hParent, LPRECT pRc, HFONT hFont) {} + virtual void Deactivate() {} + virtual void Refresh() {} + virtual void Move(LPRECT pRc) {} + virtual BOOL UpdateData() { return FALSE; } + +protected: + virtual ~CCustomProp() {} +}; + +typedef CCustomProp* (CALLBACK* CP_CREATEINSTANCE)(); + +typedef struct CustomPropCreateStruct { + + CP_CREATEINSTANCE m_pCreateCustomPropFnc; + LPARAM m_lCreateParam; + +} CustomPropCreateStruct; + +// Notification Codes for custom properties +#define PWN_FIRST (0U-2000U) + +// Tells property window to validate the property item +// => the property window gets the property value from the property item +// and applies it to the other selected items +#define PWN_VALIDATECUSTOMITEM (PWN_FIRST-1) + +// Parameter structure for the PWN_VALIDATECUSTOMITEM notification message +typedef struct _NMPROPWND +{ + NMHDR hdr; + CCustomProp* pCP; +} NMPROPWND, *PNMPROPWND, FAR *LPNMPROPWND; + +// Example: +// +// NMPROPWND nmp; +// UINT id = (UINT)IDC_CUSTOMITEM; // identifier of the control that sends the notification message, if any +// nmp.hdr.code = PWN_VALIDATECUSTOMITEM; +// nmp.hdr.hwndFrom = m_hWnd; // hWnd of the control that sends the notification message, if any +// nmp.hdr.idFrom = id; +// nmp.pCP = this; // CCustomProp* +// +// // Edit property +// if ( OnEdit() ) +// { +// // Notify parent +// ::SendMessage(hParent, WM_NOTIFY, (WPARAM)id, (LPARAM)&nmp); +// } + +// Internal symbol used by MMF, not important +#define IDC_CUSTOMITEM 1500 + +#endif // __cplusplus + +//////////////////////////////////////////////// +// +// Property types +// + +/** + * List of property types. + */ +enum { + PROPTYPE_STATIC = 1, //! Simple static text + PROPTYPE_FOLDER, //! Folder + PROPTYPE_FOLDER_END, //! Folder End + PROPTYPE_EDITBUTTON, //! Edit button, param1 = button text, or NULL if Edit + PROPTYPE_EDIT_STRING, //! Edit box for strings, parameter = max length + PROPTYPE_EDIT_NUMBER, //! Edit box for numbers, parameters = min value, max value + PROPTYPE_COMBOBOX, //! Combo box, parameters = list of strings, options (sorted, etc) + PROPTYPE_SIZE, //! Size + PROPTYPE_COLOR, //! Color + PROPTYPE_LEFTCHECKBOX, //! Checkbox + PROPTYPE_SLIDEREDIT, //! Edit + Slider + PROPTYPE_SPINEDIT, //! Edit + Spin + PROPTYPE_DIRCTRL, //! Direction Selector + PROPTYPE_GROUP, //! Group + PROPTYPE_LISTBTN, //! Internal, do not use + PROPTYPE_FILENAME, //! Edit box + browse file button, parameter = FilenameCreateParam + PROPTYPE_FONT, //! Font dialog box + PROPTYPE_CUSTOM, //! Custom property + PROPTYPE_PICTUREFILENAME, //! Edit box + browse image file button + PROPTYPE_COMBOBOXBTN, //! Combo box, parameters = list of strings, options (sorted, etc) + PROPTYPE_EDIT_FLOAT, //! Edit box for floating point numbers, parameters = min value, max value, options (signed, float, spin) + PROPTYPE_EDIT_MULTILINE, //! Edit box for multiline texts, no parameter + PROPTYPE_IMAGELIST, //! Image list + PROPTYPE_ICONCOMBOBOX, //! Combo box with icons + PROPTYPE_URLBUTTON, //! URL button + PROPTYPE_DIRECTORYNAME, //! Directory pathname + PROPTYPE_SPINEDITFLOAT, //! Edit + Spin, value = floating point number +}; + +/////////////////// +// Property options +/////////////////// +// +#define PROPOPT_NIL 0x00000000 +#define PROPOPT_CHECKBOX 0x00000001 // Left check box +#define PROPOPT_BOLD 0x00000002 // Name must be displayed in bold characters +#define PROPOPT_PARAMREQUIRED 0x00000004 // A non-null parameter must be provided +#define PROPOPT_REMOVABLE 0x00000008 // The property can be deleted by the user +#define PROPOPT_RENAMABLE 0x00000010 // The property can be renamed by the user +#define PROPOPT_MOVABLE 0x00000020 // The property can be moved by the user (list only) +#define PROPOPT_LIST 0x00000040 // The property is a list +#define PROPOPT_SINGLESEL 0x00000080 // This property is not displayed in multi-selection mode + +// Property-specific options +#define PROPOPT_EDIT_PASSWORD 0x00010000 // For Edit String property +#define PROPOPT_EDIT_LOWERCASE 0x00020000 // For Edit String property +#define PROPOPT_EDIT_UPPERCASE 0x00040000 // For Edit String property + +// Internal, not used by extensions +#define PROPID_ROOT 0 + +///////////////////////////// +// Property definition macros +///////////////////////////// +// +#define PropData_Folder(id,name,info) {id,name,info,PROPTYPE_FOLDER,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_Folder_End() {-1,0,0,PROPTYPE_FOLDER_END,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_Group(id,name,info) {id,name,info,PROPTYPE_GROUP,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_StaticString(id,name,info) {id,name,info,PROPTYPE_STATIC,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_StaticString_Opt(id,name,info,opt) {id,name,info,PROPTYPE_STATIC,opt,(LPARAM)NULL} +#define PropData_StaticString_List(id,name,info) {id,name,info,PROPTYPE_STATIC,PROPOPT_LIST,(LPARAM)NULL} +#define PropData_EditString(id,name,info) {id,name,info,PROPTYPE_EDIT_STRING,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_EditString_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_STRING,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditString_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_STRING,opt,(LPARAM)NULL} +#define PropData_EditNumber(id,name,info) {id,name,info,PROPTYPE_EDIT_NUMBER,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_EditNumber_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_NUMBER,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditNumber_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_NUMBER,opt,(LPARAM)NULL} +#define PropData_EditFloat(id,name,info) {id,name,info,PROPTYPE_EDIT_FLOAT,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_EditFloat_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_FLOAT,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditFloat_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_FLOAT,opt,(LPARAM)NULL} +#define PropData_EditMultiLine(id,name,info) {id,name,info,PROPTYPE_EDIT_MULTILINE,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_EditMultiLine_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_MULTILINE,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditMultiLine_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_MULTILINE,opt,(LPARAM)NULL} +#define PropData_SliderEdit(id,name,info,minmax) {id,name,info,PROPTYPE_SLIDEREDIT,PROPOPT_PARAMREQUIRED,(LPARAM)minmax} +#define PropData_SliderEdit_Check(id,name,info,minmax) {id,name,info,PROPTYPE_SLIDEREDIT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmax} +#define PropData_SliderEdit_Opt(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SLIDEREDIT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmax} +#define PropData_SpinEdit(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDIT,PROPOPT_PARAMREQUIRED,(LPARAM)minmax} +#define PropData_SpinEdit_Check(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDIT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmax} +#define PropData_SpinEdit_Opt(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SPINEDIT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmax} +#define PropData_Button(id,name,info,text) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_NIL, (LPARAM)text} +#define PropData_Button_Check(id,name,info,text) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_CHECKBOX,(LPARAM)text} +#define PropData_Button_Opt(id,name,info,opt,text) {id,name,info,PROPTYPE_EDITBUTTON,opt,(LPARAM)text} +#define PropData_EditButton(id,name,info) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_NIL, (LPARAM)NULL} +#define PropData_EditButton_Check(id,name,info) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditButton_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDITBUTTON,opt,(LPARAM)NULL} +#define PropData_Size(id,name,info,tab) {id,name,info,PROPTYPE_SIZE,PROPOPT_PARAMREQUIRED,(LPARAM)tab} +#define PropData_Size_Check(id,name,info,tab) {id,name,info,PROPTYPE_SIZE,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)tab} +#define PropData_Size_Opt(id,name,info,opt,tab) {id,name,info,PROPTYPE_SIZE,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)tab} +#define PropData_Color(id,name,info) {id,name,info,PROPTYPE_COLOR,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_Color_Check(id,name,info) {id,name,info,PROPTYPE_COLOR,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_Color_Opt(id,name,info,opt) {id,name,info,PROPTYPE_COLOR,opt,(LPARAM)NULL} +#define PropData_ComboBox(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOX,PROPOPT_PARAMREQUIRED,(LPARAM)list} +#define PropData_ComboBox_Check(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOX,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} +#define PropData_ComboBox_Opt(id,name,info,opt,list) {id,name,info,PROPTYPE_COMBOBOX,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} +#define PropData_CheckBox(id,name,info) {id,name,info,PROPTYPE_LEFTCHECKBOX,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_CheckBox_Opt(id,name,info,opt) {id,name,info,PROPTYPE_LEFTCHECKBOX,(PROPOPT_CHECKBOX|opt),(LPARAM)NULL} +#define PropData_DirCtrl(id,name,info,param) {id,name,info,PROPTYPE_DIRCTRL,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_DirCtrl_Check(id,name,info,param) {id,name,info,PROPTYPE_DIRCTRL,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_DirCtrl_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_DIRCTRL,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_Filename(id,name,info,param) {id,name,info,PROPTYPE_FILENAME,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_Filename_Check(id,name,info,param) {id,name,info,PROPTYPE_FILENAME,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_Filename_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_FILENAME,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_PictureFilename(id,name,info,param) {id,name,info,PROPTYPE_PICTUREFILENAME,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_PictureFilename_Check(id,name,info,param) {id,name,info,PROPTYPE_PICTUREFILENAME,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_PictureFilename_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_PICTUREFILENAME,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_Font(id,name,info,param) {id,name,info,PROPTYPE_FONT,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_Font_Check(id,name,info,param) {id,name,info,PROPTYPE_FONT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_Font_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_FONT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_Custom(id,name,info,param) {id,name,info,PROPTYPE_CUSTOM,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_Custom_Check(id,name,info,param) {id,name,info,PROPTYPE_CUSTOM,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_Custom_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_CUSTOM,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_ComboBoxBtn(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOXBTN,PROPOPT_PARAMREQUIRED,(LPARAM)list} +#define PropData_ComboBoxBtn_Check(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOXBTN,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} +#define PropData_ComboBoxBtn_Opt(id,name,info,opt,list) {id,name,info,PROPTYPE_COMBOBOXBTN,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} +#define PropData_ImageList(id,name,info) {id,name,info,PROPTYPE_IMAGELIST,0,NULL} +#define PropData_ImageList_Check(id,name,info) {id,name,info,PROPTYPE_IMAGELIST,PROPOPT_CHECKBOX,NULL} +#define PropData_ImageList_Opt(id,name,info,opt) {id,name,info,PROPTYPE_IMAGELIST,opt,NULL} +#define PropData_IconComboBox(id,name,info,list) {id,name,info,PROPTYPE_ICONCOMBOBOX,PROPOPT_PARAMREQUIRED,(LPARAM)list} +#define PropData_IconComboBox_Check(id,name,info,list) {id,name,info,PROPTYPE_ICONCOMBOBOX,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} +#define PropData_IconComboBox_Opt(id,name,info,opt,list) {id,name,info,PROPTYPE_ICONCOMBOBOX,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} +#define PropData_URLButton(id,name,info,url) {id,name,info,PROPTYPE_URLBUTTON,PROPOPT_PARAMREQUIRED, (LPARAM)url} +#define PropData_URLButton_Check(id,name,info,url) {id,name,info,PROPTYPE_URLBUTTON,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)url} +#define PropData_URLButton_Opt(id,name,info,opt,url) {id,name,info,PROPTYPE_URLBUTTON,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)url} +#define PropData_DirectoryName(id,name,info,param) {id,name,info,PROPTYPE_DIRECTORYNAME,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_DirectoryName_Check(id,name,info,param) {id,name,info,PROPTYPE_DIRECTORYNAME,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_DirectoryName_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_DIRECTORYNAME,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_SpinEditFloat(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT,PROPOPT_PARAMREQUIRED,(LPARAM)minmaxdelta} +#define PropData_SpinEditFloat_Check(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmaxdelta} +#define PropData_SpinEditFloat_Opt(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmaxdelta} +#define PropData_End() {0} + +///////////////////////////////// +// Property definition parameters +///////////////////////////////// + +// Parameter for slider & spin property items +typedef struct { + int nMinValue; // Minimum value (note: cannot be less than -32768 for SpinEdit property) + int nMaxValue; // Maximum value (note: cannot be greater than 32767 for SpinEdit property) +} MinMaxParam; +typedef MinMaxParam* LPMINMAXPARAM; + +// Parameter for floating point slider & spin property items +typedef struct { + float fMinValue; // Minimum value (e.g. 0.0f) + float fMaxValue; // Maximum value (e.g. 1.0f) + float fDelta; // Delta value (e.g. 0.01f) +} MinMaxFloatParam; +typedef MinMaxFloatParam* LPMINMAXFLOATPARAM; + +// Direction Control Styles +enum +{ + DCS_NOBORDER = 0, // No border + DCS_FLAT = 1, // Flat + DCS_3D = 2, // 3D + DCS_SLIDER = 4, // Slider to change the number of directions + DCS_EMPTY = 8, // ??? should affect the appearance of direction spots... + DCS_SETALL_BTNS = 16, // "Select All" and "Reset" buttons +}; + +// Initialization structure for direction property +typedef struct { + BOOL bMultiSel; // TRUE for multi-selection + int numDirs; // Number of directions: 4,8,16,32 + DWORD style; // Style DCS_NOBORDER, DCS_FLAT, DCS_3D, [DCS_SLIDER,] DCS_EMPTY, DCS_SETALL_BTNS +} DirCtrlCreateParam; + +// Direction Property Value +typedef struct { + int selDir; // Direction index, single selection mode + DWORD selDir32; // 32-bit direction mask, multi-selection mode + int numDirs; // Number of directions (4, 8, 16 or 32) + int reserved; // Not used +} PropDirValue; + +// Initialization structure for file selector property +typedef struct { + LPCSTR extFilter; // Filter string for GetOpenFilename dialog (for example "All Files (*.*)|*.*|") + DWORD options; // Options for GetOpenFilename dialog (OFN_FILEMUSTEXIST, OFN_PATHMUSTEXIST, OFN_HIDEREADONLY, etc.) +} FilenameCreateParam; + +//////////////////////////////////////////////// +// +// MMF property identifier +// + +////////// +// Tab IDs +////////// +// +enum { + PROPID_TAB_GENERAL=1, + PROPID_TAB_DISPLAY, + PROPID_TAB_WINDOW, + PROPID_TAB_SIZEPOS, + PROPID_TAB_TEXTOPT, + PROPID_TAB_MOVEMENT, + PROPID_TAB_RUNOPT, + PROPID_TAB_VALUES, + PROPID_TAB_EVENTS, + PROPID_TAB_ABOUT, + PROPID_TAB_BLURAY, + PROPID_TAB_IPHONE, + PROPID_TAB_ANDROID, + PROPID_TAB_XNA, + PROPID_TAB_MAC, + PROPID_TAB_CUSTOM1 = 18, + PROPID_TAB_CUSTOM2, + PROPTAB_MAX // 20 +}; + +/////////////// +// Property IDs +////////// +// +// If you need them, you can retrieve, set or refresh +// standard properties with the mvSetPropValue, etc. macros +// and the following identifiers. +// + +// Objects +enum { + PROPID_ITEM_FIRST = 20, + PROPID_ITEM_NAME, + PROPID_ITEM_ICON, + PROPID_ITEM_HELP, + PROPID_ITEM_LAST, + + PROPID_FII_FIRST = 180, + PROPID_FII_POS, // Those properties are not available if the frame editor is not open + PROPID_FII_X, + PROPID_FII_Y, + PROPID_FII_SIZE, + PROPID_FII_CX, + PROPID_FII_CY, + PROPID_FII_ROT, + PROPID_FII_ANGLE, + PROPID_FII_LAST, + + PROPID_FITEM_FIRST=200, + PROPID_FITEM_INKFXFOLDER, + PROPID_FITEM_TRANSPARENT, + PROPID_FITEM_INKFX, + PROPID_FITEM_INKFXPARAM, + PROPID_FITEM_ANTIA, + PROPID_FITEM_MEMORYFOLDER, + PROPID_FITEM_GLOBAL, + PROPID_FITEM_LOADONCALL, + PROPID_FITEM_OPTIONS, + PROPID_FITEM_RGBCOEF, + PROPID_FITEM_BLENDCOEF, + PROPID_FITEM_IMAGECOMPRESSION, + PROPID_FITEM_GLOBAL_EDITORSYNCHRO, + PROPID_FITEM_LAST=249, + + PROPID_DYNITEM_FIRST=250, + + PROPID_DYNITEM_TRANSITIONS=250, + PROPID_DYNITEM_FADEIN, + PROPID_DYNITEM_FADEOUT, + PROPID_DYNITEM_OBSTACLE, + PROPID_DYNITEM_OBSTACLETYPE, + PROPID_DYNITEM_AUTOROTATEGROUP, + PROPID_DYNITEM_AUTOROTATE, + + PROPID_MVT_FIRST=300, + PROPID_DYNITEM_MVTFOLDER, + PROPID_DYNITEM_MVTLIST, + PROPID_DYNITEM_MVTTYPE, + PROPID_DYNITEM_INITDIR, + PROPID_DYNITEM_TRYMVT, + PROPID_DYNITEM_SPEEDFOLDER, + PROPID_DYNITEM_SPEED, + PROPID_DYNITEM_DECEL, + PROPID_DYNITEM_ACCEL, + PROPID_DYNITEM_MOVEATSTART, + PROPID_DYNITEM_BOUNCEFOLDER, + PROPID_DYNITEM_NANGLES, + PROPID_DYNITEM_RANDOMIZER, + PROPID_DYNITEM_SECURITY, + PROPID_DYNITEM_EDITMVT, + PROPID_DYNITEM_PLAYER, + PROPID_DYNITEM_DIRS, + PROPID_DYNITEM_ENABLEREVERSE, + PROPID_DYNITEM_ROTATION, + PROPID_DYNITEM_ROTSPEED, + PROPID_DYNITEM_JUMP, + PROPID_DYNITEM_GRAVITY, + PROPID_DYNITEM_JUMPSTRENGTH, + PROPID_DYNITEM_JUMPCONTROL, + PROPID_DYNITEM_MVTHELP, + PROPID_DYNITEM_8DIR_STICKOBST, + PROPID_MVT_LAST, + + PROPID_DYNITEM_ALTVALUES_GROUP=350, + PROPID_DYNITEM_ALTSTRINGS_GROUP, + PROPID_DYNITEM_QUALIF, + PROPID_DYNITEM_DISPLAY, + PROPID_DYNITEM_VISIBLEATSTART, + PROPID_DYNITEM_DISPLAYASBKD, + PROPID_DYNITEM_BKDFOLDER, + PROPID_DYNITEM_SAVEBKD, + PROPID_DYNITEM_WIPEWITHCOLOR, + PROPID_DYNITEM_CREATEBEFOREFADEIN, + PROPID_DYNITEM_SCROLLING, + PROPID_DYNITEM_FOLLOWFRAME, + PROPID_DYNITEM_DESTROYIFTOOFAR, + PROPID_DYNITEM_INACTIVATEIFTOOFAR, + PROPID_DYNITEM_COLLISIONS, + PROPID_DYNITEM_FINECOLL, + PROPID_DYNITEM_BEHAVIOR_HDR, + PROPID_DYNITEM_BEHAVIOR_END, + PROPID_DYNITEM_CREATE, + PROPID_DYNITEM_CREATEATSTART, + PROPID_DYNITEM_BACKCOLOROPACITY, + + PROPID_TEXT_FIRST=380, + PROPID_TEXT_FONT, + PROPID_TEXT_FACENAME, + PROPID_TEXT_SIZE, + PROPID_TEXT_BOLD, + PROPID_TEXT_ITALIC, + PROPID_TEXT_UNDERLINE, + PROPID_TEXT_STRIKEOUT, + PROPID_TEXT_COLOR, + PROPID_TEXT_ALIGNGROUP, + PROPID_TEXT_HALIGN, + PROPID_TEXT_VALIGN, + PROPID_TEXT_RTL, + PROPID_TEXT_LAST, + + PROPID_DYNITEM_LAST, + + PROPID_EXTITEM_FIRST=400, + PROPID_EXTITEM_EDIT, + PROPID_EXTITEM_ABOUT, + PROPID_EXTITEM_NAME, + PROPID_EXTITEM_AUTHOR, + PROPID_EXTITEM_COPYRIGHT, + PROPID_EXTITEM_COMMENT, + PROPID_EXTITEM_WEBSITE, + PROPID_EXTITEM_FILENAME, + PROPID_EXTITEM_LAST, + + PROPID_DYNITEM_ALTVALUE_FIRST=0x50000, + PROPID_DYNITEM_ALTVALUE_LAST =0x50019, + + PROPID_DYNITEM_ALTSTRING_FIRST=0x50800, + PROPID_DYNITEM_ALTSTRING_LAST =0x50809, + + PROPID_DYNITEM_BEHAVIOR_FIRST=0x51000, + PROPID_DYNITEM_BEHAVIOR_LAST =0x51FFF, + + PROPID_MVTEXT_FIRST=0x52000, + PROPID_MVTEXT_LAST =0x52FFF, + + PROPID_FADE_PARAM_FIRST=0x53000, + PROPID_FADE_PARAM_LAST =0x53FFF, + + PROPID_FITEM_FXPARAM_FIRST=0x54000, + PROPID_FITEM_FXPARAM_LAST=0x54FFF, + + // Extensions must use property identifiers between PROPID_EXTITEM_CUSTOM_FIRST and PROPID_EXTITEM_CUSTOM_LAST + PROPID_EXTITEM_CUSTOM_FIRST=0x80000, + PROPID_EXTITEM_CUSTOM_LAST =0xFFFFF, +}; + +// Application +enum { + PROPID_APP_FIRST = 50, + PROPID_APP_ABOUT, + PROPID_APP_AUTHOR, + PROPID_APP_DESCRIPTION, + PROPID_APP_COPYRIGHT, + PROPID_APP_COMPANY, + PROPID_APP_FILEVERSION, + PROPID_APP_ICON, + PROPID_APP_WINDOWSIZE, + PROPID_APP_WINDOWBACKGROUNDCOLOR, + PROPID_APP_WINDOWSTYLE, + PROPID_APP_HEADING, + PROPID_APP_HEADINGMAX, + PROPID_APP_MENU, + PROPID_APP_MENUBAR, + PROPID_APP_MENUBOOTUP, + PROPID_APP_NOMINIMIZEBOX, + PROPID_APP_NOMAXIMIZEBOX, + PROPID_APP_NOTHICKFRAME, + PROPID_APP_MAXIMIZEDONBOOTUP, + PROPID_APP_HIDDENATSTART, + PROPID_APP_DISABLECLOSE, + PROPID_APP_OPTIONS, + PROPID_APP_FULLSCREEN, + PROPID_APP_FULLSWITCH, + PROPID_APP_RESIZETOWINDOWSIZE, + PROPID_APP_DONOTCENTERFRAME, + PROPID_APP_MACHINEINDEP, + PROPID_APP_SCREENSAVER_NOAUTOSTOP, + PROPID_APP_SOUNDOPT, + PROPID_APP_MULTISAMPLE, + PROPID_APP_SOUNDSOVERFRAMES, + PROPID_APP_SAMPLESEVENIFNOTFOCUS, + PROPID_APP_DISPOPT, + PROPID_APP_DISPLAYMODE, + PROPID_APP_ENABLEVISUALTHEMES, + PROPID_APP_PLAYERS, + PROPID_APP_INITSCORE, + PROPID_APP_INITLIVES, + PROPID_APP_FILENAME, + PROPID_APP_HELP, + PROPID_APP_HELPFILE, + PROPID_APP_PLAYERCTRLS, + PROPID_APP_VTZ, + PROPID_APP_VTZPREVIEWFILE, + PROPID_APP_GLOBALVALUE_GROUP, + PROPID_APP_GLOBALSTRING_GROUP, + PROPID_APP_GLOBALEVENTS, + PROPID_APP_BUILD, + PROPID_APP_BUILDTYPE, + PROPID_APP_INSTALLSETTINGS, + PROPID_APP_BUILDFILE, + PROPID_APP_BUILDOPT, + PROPID_APP_COMPLEVEL, + PROPID_APP_COMPSND, + PROPID_APP_ALLINONE, + PROPID_APP_FRAMERATE, + PROPID_APP_VSYNC, + PROPID_APP_RUNWHENMINIMIZED, + PROPID_APP_RUNOPTGROUP, + PROPID_APP_RUNCMDLINE, + PROPID_APP_MDI, + PROPID_APP_WINMENUIDX, + PROPID_APP_ABOUTTEXT, + PROPID_APP_RUNWHILERESIZING, + PROPID_APP_DEBUGGERSHORTCUTS, + PROPID_APP_GRAPHICS, + PROPID_APP_GRAPHICMODE, + PROPID_APP_IMAGEFILTERS, + PROPID_APP_SOUNDFILTERS, + PROPID_APP_SHOWDEBUGGER, + PROPID_APP_COMPRUNTIME, + PROPID_APP_DONOTSHAREDATA, + PROPID_APP_VTZONLYFROMURL, + PROPID_APP_VTZENABLESCRIPT, + PROPID_APP_VISTAOPT, + PROPID_APP_EXECLEVEL, + PROPID_APP_VTZONLY, + PROPID_APP_BUILDJARURL, + PROPID_APP_WNDTRANSP, + PROPID_APP_BRBUILDDIR, + PROPID_APP_LOADANIM_GROUP, + PROPID_APP_LOADANIM_IMAGE, + PROPID_APP_LOADANIM_NIMAGES, + PROPID_APP_BRBUILDFILE, + PROPID_APP_BRUSEMOSAIC, + PROPID_APP_BRGRAPHICSINJAR, + PROPID_APP_BRSIGNED, + PROPID_APP_BRORGID, + PROPID_APP_BRAPPID, + PROPID_APP_BRSGACT, + PROPID_APP_BRSGKEYSTORE, + PROPID_APP_BRSGKEYSTOREPW, + PROPID_APP_BRSGKEY, + PROPID_APP_BRSGKEYPW, + PROPID_APP_BRBACKSURFACE, + PROPID_APP_BRGRAPHICS_GROUP, + PROPID_APP_BRSIGNING_GROUP, + PROPID_APP_BRLOADOPTIONS_GROUP, + PROPID_APP_BRLOADALLIMAGESATSTART, + PROPID_APP_BRLOADALLSOUNDSATSTART, + PROPID_APP_BRSOUNDS_GROUP, + PROPID_APP_BREXTERNALSOUNDS, + PROPID_APP_BUILDDIR, + PROPID_APP_FULLSCREENGROUP, + PROPID_APP_KEEPSCREENRATIO, + PROPID_APP_SCREENRATIOTOLERANCE, + PROPID_APP_BRBUILDDIR2, + PROPID_APP_RESAMPLESTRETCH, + PROPID_APP_GLOBALREFRESH, + PROPID_APP_FLASH_MOCHIADS_GROUP, + PROPID_APP_FLASH_MOCHIADS, + PROPID_APP_FLASH_MOCHIADS_GAMEID, + PROPID_APP_FLASH_MOCHIADS_START, + PROPID_APP_FLASH_MOCHIADS_END, + PROPID_APP_LANGUAGE, + PROPID_APP_SCREENROTATION, + PROPID_APP_FLASH_PRELOADER_GROUP, + PROPID_APP_FLASH_PRELOADER, + PROPID_APP_FLASH_PRELOADER_FILENAME, + PROPID_APP_FLASH_PRELOADER_PGB_X, + PROPID_APP_FLASH_PRELOADER_PGB_Y, + PROPID_APP_FLASH_PRELOADER_PGB_RADIUS, + PROPID_APP_FLASH_PRELOADER_PGB_THICKNESS, + PROPID_APP_FLASH_PRELOADER_PGB_COLOR, + PROPID_APP_FLASH_PRELOADER_BACK_COLOR, + PROPID_APP_MP3_GROUP, + PROPID_APP_MP3_FORCEFREQ, + PROPID_APP_MP3_BITRATE, + PROPID_APP_MP3_ENCODER, + PROPID_APP_FLASH_MOCHIADS_SIGNUP, + PROPID_APP_FLASH_PRELOADERTYPE, + PROPID_APP_FLASH_EMBEDDEDFONTS_GROUP, + PROPID_APP_FLASH_EMBEDDEDFONTS, + PROPID_APP_IPHONE_GROUP, + PROPID_APP_IPHONE_ORIENTATION, + PROPID_APP_RTL, + PROPID_APP_IPHONEBUNDLEID, + PROPID_APP_IPHONETEXTURECOMPRESSION, + PROPID_APP_IPHONEMULTITASK, + PROPID_APP_IPHONEIMAGES_GROUP, + PROPID_APP_IPHONEAPPICON_IPHONE, + PROPID_APP_IPHONELAUNCHIMAGE_IPHONE, + PROPID_APP_IPHONEITUNEARTWORK, + PROPID_APP_ANDROIDKEYSTORE, + PROPID_APP_ANDROIDKEYNAME, + PROPID_APP_ANDROIDRELEASE, + PROPID_APP_ANDROIDPACKAGENAME, + PROPID_APP_ANDROIDIMAGES_GROUP, + PROPID_APP_ANDROIDLAUNCHERICON, + PROPID_APP_ANDROIDMENUICON, + PROPID_APP_ANDROIDTESTMODE, + PROPID_APP_ANDROIDEMULATORS, + PROPID_APP_IPHONESTATUSLINE, + PROPID_APP_RTLLAYOUT, + PROPID_APP_IPHONEIAD_GROUP, + PROPID_APP_IPHONEENABLEIAD, + PROPID_APP_IPHONEIADBOTTOM, + PROPID_APP_OPTIONAL_MODULES, + PROPID_APP_ANDROIDVERSION, + PROPID_APP_IPHONEBUNDLEVERSION, + PROPID_APP_IPHONETARGETDEVICE, + PROPID_APP_IPHONEARCHITECTURE, + PROPID_APP_IPHONEAPPICON_IPAD, + PROPID_APP_IPHONELAUNCHIMAGE_IPAD, + PROPID_APP_XNAPROJECTPATH, + PROPID_APP_XNAPROJECTNAME, + PROPID_APP_XNASTATUSLINE, + PROPID_APP_XNAFONT_GROUP, + PROPID_APP_XNAFONT_FIRSTCHAR, + PROPID_APP_XNAFONT_LASTCHAR, + PROPID_APP_JOYSTICKIMAGES, + PROPID_APP_ANDROIDSTATUSLINE, + PROPID_APP_BUILDTYPE_REAL, + PROPID_APP_ANDROID_PERMS, + PROPID_APP_ANDROIDDISABLEBACKBUTTON, + PROPID_APP_IPHONEANTIALIAS, + PROPID_APP_ANDROID_AUTOEND, + PROPID_APP_ANDROIDCRASHREPORTING, + PROPID_APP_FLASH_TARGETPLAYER, + PROPID_APP_BUILDWARNINGS, + PROPID_APP_XNAADS, + PROPID_APP_XNAPUBCENTERID, + PROPID_APP_LAST, + + PROPID_APP_ANDROID_PERM_FIRST = 90001, + PROPID_APP_ANDROID_PERM_LAST = 90105, + + PROPID_APP_GLOBALVALUE_FIRST = 100000, + PROPID_APP_GLOBALVALUE_LAST = 199998, + + PROPID_APP_GLOBALSTRING_FIRST = 200000, + PROPID_APP_GLOBALSTRING_LAST = 299998, + +}; + +// Frame +enum { + PROPID_FRAME_FIRST = 100, + PROPID_FRAME_FRAME, + PROPID_FRAME_SIZE, + PROPID_FRAME_BACKGROUNDCOLOR, + PROPID_FRAME_PALETTE, + PROPID_FRAME_RUNOPT, + PROPID_FRAME_GRABDESKTOP, + PROPID_FRAME_KEEPDISPLAY, + PROPID_FRAME_TOTALCOLMASK, + PROPID_FRAME_FRAMETITLEINCAPTION, + PROPID_FRAME_RESIZETOSCREENSIZE, + PROPID_FRAME_FORCELOADONCALL, + PROPID_FRAME_NOBJECTS, + PROPID_FRAME_PASSWORD, + PROPID_FRAME_TRANSITIONS, + PROPID_FRAME_FADEIN, + PROPID_FRAME_FADEOUT, + PROPID_FRAME_NOSURFACE, + PROPID_FRAME_SCRSETUP, + PROPID_FRAME_VIRTUALRIGHT, + PROPID_FRAME_VIRTUALBOTTOM, + PROPID_FRAME_DEMO, + PROPID_FRAME_DEMOFILENAME, + PROPID_FRAME_RECORD, + PROPID_FRAME_RANDOMSEED, + PROPID_FRAME_WNDTRANSP, + PROPID_FRAME_KEYRELEASETIME, + PROPID_FRAME_TIMEDMVTS, + PROPID_FRAME_TIMEDMVTSBASE, + PROPID_FRAME_FLASH_MOCHIADS_INTER, + PROPID_FRAME_GLOBALEVENTS, + PROPID_FRAME_IPHONE_JOYSTICK_GROUP, + PROPID_FRAME_IPHONE_JOYSTICK_TYPE, + PROPID_FRAME_IPHONE_JOYSTICK_FIRE1, + PROPID_FRAME_IPHONE_JOYSTICK_FIRE2, + PROPID_FRAME_IPHONE_JOYSTICK_LEFTHAND, + PROPID_FRAME_IPHONE_GROUP, + PROPID_FRAME_IPHONE_TOUCHMODE, + PROPID_FRAME_DISABLEIDLETIMER, + PROPID_FRAME_IPHONEIAD_GROUP, + PROPID_FRAME_IPHONEIAD, + PROPID_FRAME_LAST, +}; + +#endif // MMF2_Props_h diff --git a/Inc/Surface.h b/Inc/Surface.h index 29e8a64..3ad4780 100644 --- a/Inc/Surface.h +++ b/Inc/Surface.h @@ -1,697 +1,697 @@ -////////////////////////////////////////////////////////////////////////////// -// -// cSurface class -// - -#ifndef _Surface_h -#define _Surface_h - -#include "Fill.h" -#include "Palet.h" -#include "SurfaceDefs.h" - -// Convention : SfSrc.FilterBlit(SfDest, MyCallBack, param) -// ========== will call MyCallBack(pixelDest, pixelSrc, param) - -typedef COLORREF (CALLBACK * FILTERBLITPROC)(COLORREF, COLORREF, DWORD); -typedef COLORREF (CALLBACK * MATRIXFILTERBLITPROC)(COLORREF FAR *, COLORREF FAR *, DWORD); - -// Display mode -typedef struct DisplayMode { - int mcx; - int mcy; - int mDepth; -// int mNearestBitCount; -// int mDriver; -} DisplayMode; - -typedef BOOL (CALLBACK * LPENUMSCREENMODESPROC)(DisplayMode*, LPVOID); - -#ifdef HWABETA -// Lost device callback function -typedef void (CALLBACK * LOSTDEVICECALLBACKPROC)(cSurface*, LPARAM); -#endif - -// System colors -#ifndef COLOR_GRADIENTINACTIVECAPTION -#define COLOR_GRADIENTINACTIVECAPTION 28 -#endif - -// Forwards -class FAR cSurface; -class FAR cSurfaceImplementation; -class FAR CFillData; -class FAR CInputFile; - -// Types -typedef cSurface FAR * LPSURFACE; - -// Blit modes -typedef enum { - BMODE_OPAQUE, - BMODE_TRANSP, - BMODE_MAX -} BlitMode; - -// Blit operations -typedef enum { - BOP_COPY, // None - BOP_BLEND, // dest = ((dest * coef) + (src * (128-coef)))/128 - BOP_INVERT, // dest = src XOR 0xFFFFFF - BOP_XOR, // dest = src XOR dest - BOP_AND, // dest = src AND dest - BOP_OR, // dest = src OR dest - BOP_BLEND_REPLACETRANSP, // dest = ((dest * coef) + ((src==transp)?replace:src * (128-coef)))/128 - BOP_DWROP, - BOP_ANDNOT, - BOP_ADD, - BOP_MONO, - BOP_SUB, - BOP_BLEND_DONTREPLACECOLOR, - BOP_EFFECTEX, - BOP_MAX, - BOP_MASK = 0xFFF, - BOP_RGBAFILTER = 0x1000, -} BlitOp; - -#define ALPHATOSEMITRANSP(a) ((a==0) ? 128:(255-a)/2) -#define SEMITRANSPTOALPHA(s) ((s==128) ? 0:(255-s*2)) - -typedef DWORD RGBAREF; -#define COLORREFATORGBA(c,a) ((c & 0x00FFFFFF) | (a << 24)) - -// Surface capabilities -typedef enum -{ - // Capabilities - SC_GETPIXEL, - SC_SETPIXEL, - SC_FILL, - SC_DRAW, - SC_ROTATE, - SC_STRETCH, - SC_MAX -} SurfaceCap; - -// SetPalette actions -typedef enum -{ - SPA_NONE, // Just update palette - SPA_REMAPSURFACE, // remap current surface pixels to new palette - SPA_MAX -} SetPaletteAction; - -// Surface types -enum -{ - ST_MEMORY, // Buffer only - ST_MEMORYWITHDC, // Buffer + DC (i.e. DIBSection, DDRAW surface, etc... - ST_MEMORYWITHPERMANENTDC, // Buffer + permanent DC (i.e. DIBDC) - ST_DDRAW_SYSTEMMEMORY, // Surface Direct Draw en mémoire systeme - ST_HWA_SCREEN, // Screen surface in HWA mode - ST_HWA_RTTEXTURE, // Render target texture in HWA mode - ST_HWA_ROUTEXTURE, // HWA texture created in video memory, unmanaged (lost when device is lost) - ST_HWA_ROMTEXTURE, // HWA texture created in video memory, managed (automatically reloaded when the device is lost) - ST_MAX -}; - -// Drivers for memory + DC surfaces -enum -{ - SD_DIB, // DIB (standard driver: DIBSection) - SD_WING, // WinG - SD_DDRAW, // Direct Draw - SD_BITMAP, // Win 3.1 bitmap - SD_3DFX, // 3DFX - SD_D3D9, // Direct3D9 - SD_D3D8, // Direct3D8 - SD_MAX -}; - -typedef enum // Warning, bit mask, not enumeration! -{ - LI_NONE=0x0000, - LI_REMAP=0x0001, - LI_CHANGESURFACEDEPTH=0x0002, - LI_DONOTNORMALIZEPALETTE = 0x0004 // do not normalize palette -} LIFlags; - -typedef enum -{ - SI_NONE=0x0000, - SI_ONLYHEADER=0x0001, - SI_SAVEALPHA=0x0002 -} SIFlags; - -enum { - LBF_DONOTCHANGESURFACEDEPTH = 0x0001 -}; - -// Blilt options -enum { - BLTF_ANTIA = 0x0001, // Anti-aliasing - BLTF_COPYALPHA = 0x0002, // Copy alpha channel to destination alpha channel instead of applying it -#ifdef HWABETA - BLTF_SAFESRC = 0x0010, - BLTF_TILE = 0x0020 -#endif -}; - -// Stretch & BlitEx options -enum { - STRF_RESAMPLE = 0x0001, // Resample bitmap - STRF_RESAMPLE_TRANSP = 0x0002, // Resample bitmap, but doesn't resample the transparent color - STRF_COPYALPHA = 0x0004, // Copy (stretch) alpha channel to destination alpha channel instead of applying it -#ifdef HWABETA - STRF_SAFESRC = 0x0010, - STRF_TILE = 0x0020 -#endif -}; - - -// Transparent monochrome mask for collisions -typedef struct sMask -{ - int mkSize; - int mkWidth; - int mkHeight; - UINT mkWidthBytes; - int mkXSpot; - int mkYSpot; - DWORD mkFlags; - RECT mkRect; -} sMask; -typedef sMask *LPSMASK; - -#define SCMF_FULL 0x0000 -#define SCMF_PLATFORM 0x0001 - -#ifndef PI -#define PI ((double)3.141592653589) -#endif - -// Allocate/Free surface -SURFACES_API LPSURFACE WINAPI NewSurface(); -SURFACES_API void WINAPI DeleteSurface(LPSURFACE pSurf); - -// Get surface prototype -SURFACES_API BOOL WINAPI GetSurfacePrototype (LPSURFACE FAR *proto, int depth, int st, int drv); - -// DIB -SURFACES_API DWORD WINAPI GetDIBHeaderSize(int depth); -SURFACES_API DWORD WINAPI GetDIBWidthBytes ( int width, int depth ); -SURFACES_API DWORD WINAPI GetDIBSize ( int width, int height, int depth ); -SURFACES_API LPBYTE WINAPI GetDIBBitmap ( LPBITMAPINFO pBmi ); - -// cSurface class -class SURFACES_API cSurface -{ - public: - // ====================== - // Creation / Destruction - // ====================== - cSurface(); - ~cSurface(); - - // Init - static void InitializeSurfaces(); - static void FreeSurfaces(); -#ifdef HWABETA - static void FreeExternalModules(); -#endif - - // Operators - cSurface FAR & operator= (const cSurface FAR & source); - - // Create surface implementation from surface prototype - void Create (int width, int height, LPSURFACE prototype); - - // Create pure DC surface from DC - void Create (HDC hDC); - - // Create pure DC surface from a window - void Create (HWND hWnd, BOOL IncludeFrame); - - // Create screen surface (fullscreen mode) - BOOL CreateScreenSurface(); - BOOL IsScreenSurface(); - - // Valid? - BOOL IsValid (); - - // Get driver & type - int GetType(); - int GetDriver(); - DWORD GetDriverInfo(LPVOID pInfo); - - // Clone surface (= create with same size + Blit) - void Clone (const cSurface FAR & pSrcSurface, int newW = -1, int newH = -1); - - // Delete surface implementation (before to create another one) - void Delete(); - - // ====================== - // Error codes - // ====================== - int GetLastError(void); - - // ====================== - // Surface info - // ====================== - int GetWidth(void) const; - int GetHeight(void) const; - int GetDepth(void) const; - BOOL GetInfo(int FAR & width, int FAR & height, int FAR & depth) const; - - // ====================== - // Surface coordinate management - // ====================== - - void SetOrigin(int x, int y); - void SetOrigin(POINT c); - - void GetOrigin(POINT FAR &pt); - void GetOrigin(int FAR & x, int FAR & y); - - void OffsetOrigin(int dx, int dy); - void OffsetOrigin(POINT delta); - - // ====================== - // Raster operations - // ====================== - LPBYTE LockBuffer(); - void UnlockBuffer(LPBYTE spBuffer); - int GetPitch() const; - - // ====================== - // Double-buffer handling - // ====================== - void SetCurrentDevice(); - int BeginRendering(BOOL bClear, RGBAREF dwRgba); - int EndRendering(); - BOOL UpdateScreen(); -#ifdef HWABETA - cSurface* GetRenderTargetSurface(); - void ReleaseRenderTargetSurface(cSurface* psf); - void Flush(BOOL bMax); - void SetZBuffer(float z2D); -#endif - - // ====================== - // Device context for graphic operations - // ====================== - HDC GetDC(void); - void ReleaseDC(HDC dc); - void AttachWindow (HWND hWnd); - - // ====================== - // Clipping - // ====================== - void GetClipRect(int FAR & x, int FAR & y, int FAR & w, int FAR & h); - void SetClipRect(int x, int y, int w, int h); - void ClearClipRect(void); - - // ====================== - // LoadImage (DIB format) / SaveImage (DIB format) - // ====================== - #undef LoadImage - - BOOL LoadImageA (HFILE hf, DWORD lsize, LIFlags loadFlags = LI_NONE); - BOOL LoadImageA (LPCSTR fileName, LIFlags loadFlags = LI_NONE); -#ifdef _WINDOWS - BOOL LoadImageA (HINSTANCE hInst, int bmpID, LIFlags loadFlags = LI_NONE); -#endif // _WINDOWS - BOOL LoadImageA (LPBITMAPINFO pBmi, LPBYTE pBits = NULL, LIFlags loadFlags = LI_NONE); - - BOOL LoadImageW (HFILE hf, DWORD lsize, LIFlags loadFlags = LI_NONE); - BOOL LoadImageW (LPCWSTR fileName, LIFlags loadFlags = LI_NONE); -#ifdef _WINDOWS - BOOL LoadImageW (HINSTANCE hInst, int bmpID, LIFlags loadFlags = LI_NONE); -#endif // _WINDOWS - BOOL LoadImageW (LPBITMAPINFO pBmi, LPBYTE pBits = NULL, LIFlags loadFlags = LI_NONE); - - #ifdef _UNICODE - #define LoadImage LoadImageW - #else - #define LoadImage LoadImageA - #endif - - BOOL SaveImage (HFILE hf, SIFlags saveFlags = SI_NONE); - BOOL SaveImage (LPCSTR fileName, SIFlags saveFlags = SI_NONE); - BOOL SaveImage (LPCWSTR fileName, SIFlags saveFlags = SI_NONE); - BOOL SaveImage (LPBITMAPINFO pBmi, LPBYTE pBits, SIFlags saveFlags = SI_NONE); - - DWORD GetDIBSize (); - - // ====================== - // Pixel functions - // ====================== - // Set pixel - void SetPixel(int x, int y, COLORREF c); - void SetPixel(int x, int y, BYTE R, BYTE G, BYTE B); - void SetPixel(int x, int y, int index); - - // Faster: assume clipping is done, the origin is at (0,0) and the surface is locked - void SetPixelFast(int x, int y, COLORREF c); - void SetPixelFast8(int x, int y, int index); - - // Get pixel - BOOL GetPixel(int x, int y, COLORREF FAR & c) const; - BOOL GetPixel(int x, int y, BYTE FAR & R, BYTE FAR & G, BYTE FAR & B) const; - BOOL GetPixel(int x, int y, int FAR & index) const; - - // Faster: assume clipping is done, the origin is at (0,0) and the surface is locked - COLORREF GetPixelFast(int x, int y); - int GetPixelFast8(int x, int y); - - // ====================== - // Blit functions - // ====================== - // Blit surface to surface - BOOL Blit(cSurface FAR & dest) const; - - BOOL Blit(cSurface FAR & dest, int destX, int destY, - BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, - DWORD dwBlitFlags = 0) const; - - // Blit rectangle to surface - BOOL Blit(cSurface FAR & dest, int destX, int destY, - int srcX, int srcY, int srcWidth, int srcHeight, - BlitMode bm /*= BMODE_OPAQUE*/, BlitOp bo = BOP_COPY, LPARAM param = 0, - DWORD dwBlitFlags = 0) const; - - // Extended blit : can do stretch & rotate at the same time - // Only implemented in 3D mode -#ifdef HWABETA - BOOL BlitEx(cSurface FAR & dest, float dX, float dY, float fScaleX, float fScaleY, - int sX, int sY, int sW, int sH, LPPOINT pCenter, float fAngle, - BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, DWORD dwFlags = 0) const; -#endif - // Scrolling - BOOL Scroll (int xDest, int yDest, int xSrc, int ySrc, int width, int height); - - // Blit via callback - BOOL FilterBlit (cSurface FAR & dest, int destX, int destY, - int srcX, int srcY, int srcWidth, int srcHeight, - BlitMode bm, FILTERBLITPROC fbProc, LPARAM lUserParam) const; - - BOOL FilterBlit (cSurface FAR & dest, FILTERBLITPROC fbProc, - LPARAM lUserParam, BlitMode bm = BMODE_OPAQUE) const; - - // Matrix blit via callback - BOOL MatrixFilterBlit (cSurface FAR & dest, int destX, int destY, - int srcX, int srcY, int srcWidth, int srcHeight, - int mWidth, int mHeight, int mDXCenter, int mDYCenter, - MATRIXFILTERBLITPROC fbProc, LPARAM lUserParam) const; - - // Stretch surface to surface - BOOL Stretch(cSurface FAR & dest, DWORD dwFlags = 0) const; - - // Stretch surface to rectangle - BOOL Stretch(cSurface FAR & dest, int destX, int destY, int destWidth, int destHeight, - BlitMode bm /*= BMODE_OPAQUE*/, BlitOp bo = BOP_COPY, LPARAM param = 0, DWORD dwFlags = 0) const; - - // Stretch rectangle to rectangle - BOOL Stretch(cSurface FAR & dest, int destX, int destY, int destWidth, int destHeight, - int srcX, int srcY, int srcWidth, int srcHeight, - BlitMode bm /*= BMODE_OPAQUE*/, BlitOp bo = BOP_COPY, LPARAM param = 0, DWORD dwFlags = 0) const; - - // Revert surface horizontally - BOOL ReverseX(); - - // Revert rectangle horizontally - BOOL ReverseX(int x, int y, int width, int height); - - // Revert surface vertically - BOOL ReverseY(); - - // Revert rectangle vertically - BOOL ReverseY(int x, int y, int width, int height); - - // Remove empty borders - BOOL GetMinimizeRect(RECT FAR*); - BOOL Minimize(); - BOOL Minimize(RECT FAR* r); - - // ============================= - // Blit from screen or memory DC - // ============================= - - static BOOL CaptureDC(HDC srcDC,HDC dstDC,LONG srcX,LONG srcY,LONG dstX,LONG dstY,LONG srcWidth,LONG srcHeight,LONG dstWidth,LONG dstHeight,BOOL bFlushMessage,BOOL bKeepRatio); - - // ====================== - // Fill - // ====================== - - // Fill surface - BOOL Fill(COLORREF c); - BOOL Fill(CFillData FAR * fd); - BOOL Fill(int index); - BOOL Fill(int R, int G, int B); - - // Fill block - BOOL Fill(int x, int y, int w, int h, COLORREF c); - BOOL Fill(int x, int y, int w, int h, CFillData FAR * fd); - BOOL Fill(int x, int y, int w, int h, int index); - BOOL Fill(int x, int y, int w, int h, int R, int G, int B); -#ifdef HWABETA - BOOL Fill(int x, int y, int w, int h, COLORREF* pColors, DWORD dwFlags); -#endif - - // ====================== - // Geometric Primitives - // ====================== - - // 1. Simple routines : call GDI with Surface DC - // ============================================= - - BOOL Ellipse(int left, int top, int right, int bottom, int thickness = 1, COLORREF crOutl = BLACK); - - BOOL Ellipse(int left, int top, int right, int bottom, COLORREF crFill, int thickness /*= 0*/, - COLORREF crOutl /*= BLACK*/, BOOL Fill = TRUE); - - BOOL Rectangle(int left, int top, int right, int bottom, int thickness = 1, COLORREF crOutl = BLACK); - - BOOL Rectangle(int left, int top, int right, int bottom, COLORREF crFill, int thickness /*= 0*/, - COLORREF crOutl /*= BLACK*/, BOOL bFill = TRUE); - - BOOL Polygon(LPPOINT pts, int nPts, int thickness = 1, COLORREF crOutl = BLACK); - - BOOL Polygon(LPPOINT pts, int nPts, COLORREF crFill, int thickness = 0, - COLORREF crOutl = BLACK, BOOL bFill = TRUE); - - BOOL Line(int x1, int y1, int x2, int y2, int thickness = 1, COLORREF crOutl = BLACK); - - // 2. More complex but slower (variable opacity, anti-alias, custom filling, ...) - // ============================================================================== - - BOOL Ellipse(int left, int top, int right, int bottom, int thickness, CFillData FAR * fdOutl, BOOL AntiA = FALSE, - BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - BOOL Ellipse(int left, int top, int right, int bottom, CFillData FAR * fdFill, - BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - BOOL Ellipse(int left, int top, int right, int bottom, CFillData FAR * fdFill, int thickness, CFillData FAR * fdOutl, - BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, BOOL Fill = TRUE); - - BOOL Rectangle(int left, int top, int right, int bottom, int thickness, CFillData FAR * fdOutl, BOOL AntiA = FALSE, - BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - BOOL Rectangle(int left, int top, int right, int bottom, CFillData FAR * fdFill, - BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - BOOL Rectangle(int left, int top, int right, int bottom, CFillData FAR * fdFill, int thickness, CFillData FAR * fdOutl, - BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, BOOL Fill = TRUE); - - BOOL Polygon(LPPOINT pts, int nPts, int thickness, CFillData FAR * fdOutl, BOOL AntiA = FALSE, - BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - BOOL Polygon(LPPOINT pts, int nPts, CFillData FAR * fdFill, - BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - BOOL Polygon(LPPOINT pts, int nPts, CFillData FAR * fdFill, int thickness, CFillData FAR * fdOutl, - BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, BOOL Fill = TRUE); - - BOOL Line(int x1, int y1, int x2, int y2, int thickness, CFillData FAR * fdOutl, BOOL AntiA, - BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - // Filled Primitives - - BOOL FloodFill(int x, int y, int FAR & left, int FAR & top, int FAR & right, int FAR & bottom, COLORREF crFill, BOOL AntiA = FALSE, - int tol = 0, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - BOOL FloodFill(int x, int y, COLORREF crFill, BOOL AntiA = FALSE, int tol = 0, - BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); - - // ====================== - // Rotation - // ====================== - // Rotate surface - BOOL Rotate(cSurface FAR& dest, double a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); // radian - BOOL Rotate(cSurface FAR& dest, int a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); // degree - BOOL Rotate90(cSurface FAR& dest, BOOL b270); - - // Create rotated surface - BOOL CreateRotatedSurface (cSurface FAR& ps, double a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); - BOOL CreateRotatedSurface (cSurface FAR& ps, int a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); - -#ifdef HWABETA - static void GetSizeOfRotatedRect (int FAR *pWidth, int FAR *pHeight, float angle); -#else - static void GetSizeOfRotatedRect (int FAR *pWidth, int FAR *pHeight, int angle); -#endif - - // ====================== - // Text - // ====================== - -#undef TextOut - - int TextOutA(LPCSTR text, DWORD dwCharCount,int x,int y,DWORD alignMode,LPRECT pClipRc, COLORREF color=0, HFONT hFnt=(HFONT)NULL, BlitMode bm=BMODE_TRANSP, BlitOp=BOP_COPY, LPARAM param=0, int AntiA=0); - int TextOutW(LPCWSTR text, DWORD dwCharCount,int x,int y,DWORD alignMode,LPRECT pClipRc, COLORREF color=0, HFONT hFnt=(HFONT)NULL, BlitMode bm=BMODE_TRANSP, BlitOp=BOP_COPY, LPARAM param=0, int AntiA=0); - -#ifdef _UNICODE -#define TextOut TextOutW -#else -#define TextOut TextOutA -#endif - -#undef DrawText - - int DrawTextA(LPCSTR text, DWORD dwCharCount,LPRECT pRc, DWORD dtflags, COLORREF color=0, HFONT hFnt=(HFONT)NULL, - BlitMode bm=BMODE_TRANSP, BlitOp bo=BOP_COPY, LPARAM param=0, int AntiA=0,DWORD dwLeftMargin=0,DWORD dwRightMargin=0,DWORD dwTabSize=8); - int DrawTextW(LPCWSTR text, DWORD dwCharCount,LPRECT pRc, DWORD dtflags, COLORREF color=0, HFONT hFnt=(HFONT)NULL, - BlitMode bm=BMODE_TRANSP, BlitOp bo=BOP_COPY, LPARAM param=0, int AntiA=0,DWORD dwLeftMargin=0,DWORD dwRightMargin=0,DWORD dwTabSize=8); - -#ifdef _UNICODE -#define DrawText DrawTextW -#else -#define DrawText DrawTextA -#endif - - // ====================== - // Color / Palette functions - // ====================== - // Is transparent - BOOL IsTransparent(); - - // Replace color - BOOL ReplaceColor (COLORREF newColor, COLORREF oldColor); - - // Test collision fine entre deux surfaces - BOOL IsColliding(cSurface FAR & dest, int xDest, int yDest, int xSrc, int ySrc, int rcWidth, int rcHeight); - - // Create icon - HICON CreateIcon(int iconWidth, int iconHeight, COLORREF transpColor,POINT *pHotSpot); - - // Palette support - BOOL Indexed(void); - - BOOL SetPalette(LPLOGPALETTE palette, SetPaletteAction action=SPA_NONE); - BOOL SetPalette (LPCSPALETTE pCsPal, SetPaletteAction action=SPA_NONE); - BOOL SetPalette (cSurface FAR& src, SetPaletteAction action=SPA_NONE); - BOOL SetPalette(HPALETTE palette, SetPaletteAction action=SPA_NONE); - - void Remap(cSurface FAR& src); - void Remap(LPBYTE remapTable); - - LPCSPALETTE GetPalette(); - UINT GetPaletteEntries(LPPALETTEENTRY paletteEntry, int index, int nbColors); - - int GetNearestColorIndex(COLORREF rgb); - COLORREF GetRGB(int index); - int GetOpaqueBlackIndex(); - - // ====================== - // Full screen - // ====================== - void EnumScreenModes(LPENUMSCREENMODESPROC pProc, LPVOID lParam); - BOOL SetScreenMode(HWND hWnd, int width, int height, int depth); - void RestoreWindowedMode(HWND hWnd); - void CopyScreenModeInfo(cSurface* pSrc); - -#ifdef HWABETA - BOOL SetAutoVSync(int nAutoVSync); -#endif - BOOL WaitForVBlank(); - - // System colors - static COLORREF GetSysColor(int colorIndex); - static void OnSysColorChange(); - - // Transparent color - void SetTransparentColor(COLORREF rgb); - COLORREF GetTransparentColor(); - int GetTransparentColorIndex(); - - // Alpha channel - BOOL HasAlpha(); - LPBYTE LockAlpha(); - void UnlockAlpha(); - int GetAlphaPitch(); - void CreateAlpha(); - void SetAlpha(LPBYTE pAlpha, int nPitch); - void AttachAlpha(LPBYTE pAlpha, int nPitch); - LPBYTE DetachAlpha(LPLONG pPitch); - cSurface* GetAlphaSurface(); - void ReleaseAlphaSurface(cSurface* pAlphaSf); - - // Transparent monochrome mask - DWORD CreateMask(LPSMASK pMask, UINT dwFlags); - - // Lost device callback -#ifdef HWABETA - void OnLostDevice(); - void AddLostDeviceCallBack(LOSTDEVICECALLBACKPROC pCallback, LPARAM lUserParam); - void RemoveLostDeviceCallBack(LOSTDEVICECALLBACKPROC pCallback, LPARAM lUserParam); -#endif - - // Friend functions - // ---------------- - SURFACES_API friend cSurfaceImplementation FAR * WINAPI GetSurfaceImplementation(cSurface FAR &cs); - SURFACES_API friend void WINAPI SetSurfaceImplementation(cSurface FAR &cs, cSurfaceImplementation FAR *psi); - - protected: -#ifdef _WINDOWS - static void BuildSysColorTable(); -#endif // _WINDOWS - - // Clipping - //---------- - HRGN SetDrawClip(HDC hDC); - void RestoreDrawClip(HDC hDC,HRGN hOldClipRgn); - - // Private functions - // ----------------- - private: - BOOL LoadPicture (CInputFile FAR * pFile, DWORD bitmapSize, LIFlags loadFlags); - BOOL LoadDIB (LPBITMAPINFO pBmi, LPBYTE pBits, LIFlags loadFlags); - - // Private data - // ------------ - private: - cSurfaceImplementation FAR *m_actual; - POINT origin; - - // System colors - static BOOL m_bSysColorTab; - static COLORREF m_sysColorTab[COLOR_GRADIENTINACTIVECAPTION+1]; - - protected: - int m_error; // Est-ce qu'on doit toujours garder ça? -}; - -// maximum opacity -#define OP_MAX 128 // 100 - -#ifdef __cplusplus -extern "C" { -#endif - - SURFACES_API BOOL WINAPI BuildRemapTable (LPBYTE, LOGPALETTE FAR *, LOGPALETTE FAR *, WORD); - -#ifdef __cplusplus -} -#endif - -#endif // _Surface_h +////////////////////////////////////////////////////////////////////////////// +// +// cSurface class +// + +#ifndef _Surface_h +#define _Surface_h + +#include "Fill.h" +#include "Palet.h" +#include "SurfaceDefs.h" + +// Convention : SfSrc.FilterBlit(SfDest, MyCallBack, param) +// ========== will call MyCallBack(pixelDest, pixelSrc, param) + +typedef COLORREF (CALLBACK * FILTERBLITPROC)(COLORREF, COLORREF, DWORD); +typedef COLORREF (CALLBACK * MATRIXFILTERBLITPROC)(COLORREF FAR *, COLORREF FAR *, DWORD); + +// Display mode +typedef struct DisplayMode { + int mcx; + int mcy; + int mDepth; +// int mNearestBitCount; +// int mDriver; +} DisplayMode; + +typedef BOOL (CALLBACK * LPENUMSCREENMODESPROC)(DisplayMode*, LPVOID); + +#ifdef HWABETA +// Lost device callback function +typedef void (CALLBACK * LOSTDEVICECALLBACKPROC)(cSurface*, LPARAM); +#endif + +// System colors +#ifndef COLOR_GRADIENTINACTIVECAPTION +#define COLOR_GRADIENTINACTIVECAPTION 28 +#endif + +// Forwards +class FAR cSurface; +class FAR cSurfaceImplementation; +class FAR CFillData; +class FAR CInputFile; + +// Types +typedef cSurface FAR * LPSURFACE; + +// Blit modes +typedef enum { + BMODE_OPAQUE, + BMODE_TRANSP, + BMODE_MAX +} BlitMode; + +// Blit operations +typedef enum { + BOP_COPY, // None + BOP_BLEND, // dest = ((dest * coef) + (src * (128-coef)))/128 + BOP_INVERT, // dest = src XOR 0xFFFFFF + BOP_XOR, // dest = src XOR dest + BOP_AND, // dest = src AND dest + BOP_OR, // dest = src OR dest + BOP_BLEND_REPLACETRANSP, // dest = ((dest * coef) + ((src==transp)?replace:src * (128-coef)))/128 + BOP_DWROP, + BOP_ANDNOT, + BOP_ADD, + BOP_MONO, + BOP_SUB, + BOP_BLEND_DONTREPLACECOLOR, + BOP_EFFECTEX, + BOP_MAX, + BOP_MASK = 0xFFF, + BOP_RGBAFILTER = 0x1000, +} BlitOp; + +#define ALPHATOSEMITRANSP(a) ((a==0) ? 128:(255-a)/2) +#define SEMITRANSPTOALPHA(s) ((s==128) ? 0:(255-s*2)) + +typedef DWORD RGBAREF; +#define COLORREFATORGBA(c,a) ((c & 0x00FFFFFF) | (a << 24)) + +// Surface capabilities +typedef enum +{ + // Capabilities + SC_GETPIXEL, + SC_SETPIXEL, + SC_FILL, + SC_DRAW, + SC_ROTATE, + SC_STRETCH, + SC_MAX +} SurfaceCap; + +// SetPalette actions +typedef enum +{ + SPA_NONE, // Just update palette + SPA_REMAPSURFACE, // remap current surface pixels to new palette + SPA_MAX +} SetPaletteAction; + +// Surface types +enum +{ + ST_MEMORY, // Buffer only + ST_MEMORYWITHDC, // Buffer + DC (i.e. DIBSection, DDRAW surface, etc... + ST_MEMORYWITHPERMANENTDC, // Buffer + permanent DC (i.e. DIBDC) + ST_DDRAW_SYSTEMMEMORY, // Surface Direct Draw en mémoire systeme + ST_HWA_SCREEN, // Screen surface in HWA mode + ST_HWA_RTTEXTURE, // Render target texture in HWA mode + ST_HWA_ROUTEXTURE, // HWA texture created in video memory, unmanaged (lost when device is lost) + ST_HWA_ROMTEXTURE, // HWA texture created in video memory, managed (automatically reloaded when the device is lost) + ST_MAX +}; + +// Drivers for memory + DC surfaces +enum +{ + SD_DIB, // DIB (standard driver: DIBSection) + SD_WING, // WinG + SD_DDRAW, // Direct Draw + SD_BITMAP, // Win 3.1 bitmap + SD_3DFX, // 3DFX + SD_D3D9, // Direct3D9 + SD_D3D8, // Direct3D8 + SD_MAX +}; + +typedef enum // Warning, bit mask, not enumeration! +{ + LI_NONE=0x0000, + LI_REMAP=0x0001, + LI_CHANGESURFACEDEPTH=0x0002, + LI_DONOTNORMALIZEPALETTE = 0x0004 // do not normalize palette +} LIFlags; + +typedef enum +{ + SI_NONE=0x0000, + SI_ONLYHEADER=0x0001, + SI_SAVEALPHA=0x0002 +} SIFlags; + +enum { + LBF_DONOTCHANGESURFACEDEPTH = 0x0001 +}; + +// Blilt options +enum { + BLTF_ANTIA = 0x0001, // Anti-aliasing + BLTF_COPYALPHA = 0x0002, // Copy alpha channel to destination alpha channel instead of applying it +#ifdef HWABETA + BLTF_SAFESRC = 0x0010, + BLTF_TILE = 0x0020 +#endif +}; + +// Stretch & BlitEx options +enum { + STRF_RESAMPLE = 0x0001, // Resample bitmap + STRF_RESAMPLE_TRANSP = 0x0002, // Resample bitmap, but doesn't resample the transparent color + STRF_COPYALPHA = 0x0004, // Copy (stretch) alpha channel to destination alpha channel instead of applying it +#ifdef HWABETA + STRF_SAFESRC = 0x0010, + STRF_TILE = 0x0020 +#endif +}; + + +// Transparent monochrome mask for collisions +typedef struct sMask +{ + int mkSize; + int mkWidth; + int mkHeight; + UINT mkWidthBytes; + int mkXSpot; + int mkYSpot; + DWORD mkFlags; + RECT mkRect; +} sMask; +typedef sMask *LPSMASK; + +#define SCMF_FULL 0x0000 +#define SCMF_PLATFORM 0x0001 + +#ifndef PI +#define PI ((double)3.141592653589) +#endif + +// Allocate/Free surface +SURFACES_API LPSURFACE WINAPI NewSurface(); +SURFACES_API void WINAPI DeleteSurface(LPSURFACE pSurf); + +// Get surface prototype +SURFACES_API BOOL WINAPI GetSurfacePrototype (LPSURFACE FAR *proto, int depth, int st, int drv); + +// DIB +SURFACES_API DWORD WINAPI GetDIBHeaderSize(int depth); +SURFACES_API DWORD WINAPI GetDIBWidthBytes ( int width, int depth ); +SURFACES_API DWORD WINAPI GetDIBSize ( int width, int height, int depth ); +SURFACES_API LPBYTE WINAPI GetDIBBitmap ( LPBITMAPINFO pBmi ); + +// cSurface class +class SURFACES_API cSurface +{ + public: + // ====================== + // Creation / Destruction + // ====================== + cSurface(); + ~cSurface(); + + // Init + static void InitializeSurfaces(); + static void FreeSurfaces(); +#ifdef HWABETA + static void FreeExternalModules(); +#endif + + // Operators + cSurface FAR & operator= (const cSurface FAR & source); + + // Create surface implementation from surface prototype + void Create (int width, int height, LPSURFACE prototype); + + // Create pure DC surface from DC + void Create (HDC hDC); + + // Create pure DC surface from a window + void Create (HWND hWnd, BOOL IncludeFrame); + + // Create screen surface (fullscreen mode) + BOOL CreateScreenSurface(); + BOOL IsScreenSurface(); + + // Valid? + BOOL IsValid (); + + // Get driver & type + int GetType(); + int GetDriver(); + DWORD GetDriverInfo(LPVOID pInfo); + + // Clone surface (= create with same size + Blit) + void Clone (const cSurface FAR & pSrcSurface, int newW = -1, int newH = -1); + + // Delete surface implementation (before to create another one) + void Delete(); + + // ====================== + // Error codes + // ====================== + int GetLastError(void); + + // ====================== + // Surface info + // ====================== + int GetWidth(void) const; + int GetHeight(void) const; + int GetDepth(void) const; + BOOL GetInfo(int FAR & width, int FAR & height, int FAR & depth) const; + + // ====================== + // Surface coordinate management + // ====================== + + void SetOrigin(int x, int y); + void SetOrigin(POINT c); + + void GetOrigin(POINT FAR &pt); + void GetOrigin(int FAR & x, int FAR & y); + + void OffsetOrigin(int dx, int dy); + void OffsetOrigin(POINT delta); + + // ====================== + // Raster operations + // ====================== + LPBYTE LockBuffer(); + void UnlockBuffer(LPBYTE spBuffer); + int GetPitch() const; + + // ====================== + // Double-buffer handling + // ====================== + void SetCurrentDevice(); + int BeginRendering(BOOL bClear, RGBAREF dwRgba); + int EndRendering(); + BOOL UpdateScreen(); +#ifdef HWABETA + cSurface* GetRenderTargetSurface(); + void ReleaseRenderTargetSurface(cSurface* psf); + void Flush(BOOL bMax); + void SetZBuffer(float z2D); +#endif + + // ====================== + // Device context for graphic operations + // ====================== + HDC GetDC(void); + void ReleaseDC(HDC dc); + void AttachWindow (HWND hWnd); + + // ====================== + // Clipping + // ====================== + void GetClipRect(int FAR & x, int FAR & y, int FAR & w, int FAR & h); + void SetClipRect(int x, int y, int w, int h); + void ClearClipRect(void); + + // ====================== + // LoadImage (DIB format) / SaveImage (DIB format) + // ====================== + #undef LoadImage + + BOOL LoadImageA (HFILE hf, DWORD lsize, LIFlags loadFlags = LI_NONE); + BOOL LoadImageA (LPCSTR fileName, LIFlags loadFlags = LI_NONE); +#ifdef _WINDOWS + BOOL LoadImageA (HINSTANCE hInst, int bmpID, LIFlags loadFlags = LI_NONE); +#endif // _WINDOWS + BOOL LoadImageA (LPBITMAPINFO pBmi, LPBYTE pBits = NULL, LIFlags loadFlags = LI_NONE); + + BOOL LoadImageW (HFILE hf, DWORD lsize, LIFlags loadFlags = LI_NONE); + BOOL LoadImageW (LPCWSTR fileName, LIFlags loadFlags = LI_NONE); +#ifdef _WINDOWS + BOOL LoadImageW (HINSTANCE hInst, int bmpID, LIFlags loadFlags = LI_NONE); +#endif // _WINDOWS + BOOL LoadImageW (LPBITMAPINFO pBmi, LPBYTE pBits = NULL, LIFlags loadFlags = LI_NONE); + + #ifdef _UNICODE + #define LoadImage LoadImageW + #else + #define LoadImage LoadImageA + #endif + + BOOL SaveImage (HFILE hf, SIFlags saveFlags = SI_NONE); + BOOL SaveImage (LPCSTR fileName, SIFlags saveFlags = SI_NONE); + BOOL SaveImage (LPCWSTR fileName, SIFlags saveFlags = SI_NONE); + BOOL SaveImage (LPBITMAPINFO pBmi, LPBYTE pBits, SIFlags saveFlags = SI_NONE); + + DWORD GetDIBSize (); + + // ====================== + // Pixel functions + // ====================== + // Set pixel + void SetPixel(int x, int y, COLORREF c); + void SetPixel(int x, int y, BYTE R, BYTE G, BYTE B); + void SetPixel(int x, int y, int index); + + // Faster: assume clipping is done, the origin is at (0,0) and the surface is locked + void SetPixelFast(int x, int y, COLORREF c); + void SetPixelFast8(int x, int y, int index); + + // Get pixel + BOOL GetPixel(int x, int y, COLORREF FAR & c) const; + BOOL GetPixel(int x, int y, BYTE FAR & R, BYTE FAR & G, BYTE FAR & B) const; + BOOL GetPixel(int x, int y, int FAR & index) const; + + // Faster: assume clipping is done, the origin is at (0,0) and the surface is locked + COLORREF GetPixelFast(int x, int y); + int GetPixelFast8(int x, int y); + + // ====================== + // Blit functions + // ====================== + // Blit surface to surface + BOOL Blit(cSurface FAR & dest) const; + + BOOL Blit(cSurface FAR & dest, int destX, int destY, + BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, + DWORD dwBlitFlags = 0) const; + + // Blit rectangle to surface + BOOL Blit(cSurface FAR & dest, int destX, int destY, + int srcX, int srcY, int srcWidth, int srcHeight, + BlitMode bm /*= BMODE_OPAQUE*/, BlitOp bo = BOP_COPY, LPARAM param = 0, + DWORD dwBlitFlags = 0) const; + + // Extended blit : can do stretch & rotate at the same time + // Only implemented in 3D mode +#ifdef HWABETA + BOOL BlitEx(cSurface FAR & dest, float dX, float dY, float fScaleX, float fScaleY, + int sX, int sY, int sW, int sH, LPPOINT pCenter, float fAngle, + BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, DWORD dwFlags = 0) const; +#endif + // Scrolling + BOOL Scroll (int xDest, int yDest, int xSrc, int ySrc, int width, int height); + + // Blit via callback + BOOL FilterBlit (cSurface FAR & dest, int destX, int destY, + int srcX, int srcY, int srcWidth, int srcHeight, + BlitMode bm, FILTERBLITPROC fbProc, LPARAM lUserParam) const; + + BOOL FilterBlit (cSurface FAR & dest, FILTERBLITPROC fbProc, + LPARAM lUserParam, BlitMode bm = BMODE_OPAQUE) const; + + // Matrix blit via callback + BOOL MatrixFilterBlit (cSurface FAR & dest, int destX, int destY, + int srcX, int srcY, int srcWidth, int srcHeight, + int mWidth, int mHeight, int mDXCenter, int mDYCenter, + MATRIXFILTERBLITPROC fbProc, LPARAM lUserParam) const; + + // Stretch surface to surface + BOOL Stretch(cSurface FAR & dest, DWORD dwFlags = 0) const; + + // Stretch surface to rectangle + BOOL Stretch(cSurface FAR & dest, int destX, int destY, int destWidth, int destHeight, + BlitMode bm /*= BMODE_OPAQUE*/, BlitOp bo = BOP_COPY, LPARAM param = 0, DWORD dwFlags = 0) const; + + // Stretch rectangle to rectangle + BOOL Stretch(cSurface FAR & dest, int destX, int destY, int destWidth, int destHeight, + int srcX, int srcY, int srcWidth, int srcHeight, + BlitMode bm /*= BMODE_OPAQUE*/, BlitOp bo = BOP_COPY, LPARAM param = 0, DWORD dwFlags = 0) const; + + // Revert surface horizontally + BOOL ReverseX(); + + // Revert rectangle horizontally + BOOL ReverseX(int x, int y, int width, int height); + + // Revert surface vertically + BOOL ReverseY(); + + // Revert rectangle vertically + BOOL ReverseY(int x, int y, int width, int height); + + // Remove empty borders + BOOL GetMinimizeRect(RECT FAR*); + BOOL Minimize(); + BOOL Minimize(RECT FAR* r); + + // ============================= + // Blit from screen or memory DC + // ============================= + + static BOOL CaptureDC(HDC srcDC,HDC dstDC,LONG srcX,LONG srcY,LONG dstX,LONG dstY,LONG srcWidth,LONG srcHeight,LONG dstWidth,LONG dstHeight,BOOL bFlushMessage,BOOL bKeepRatio); + + // ====================== + // Fill + // ====================== + + // Fill surface + BOOL Fill(COLORREF c); + BOOL Fill(CFillData FAR * fd); + BOOL Fill(int index); + BOOL Fill(int R, int G, int B); + + // Fill block + BOOL Fill(int x, int y, int w, int h, COLORREF c); + BOOL Fill(int x, int y, int w, int h, CFillData FAR * fd); + BOOL Fill(int x, int y, int w, int h, int index); + BOOL Fill(int x, int y, int w, int h, int R, int G, int B); +#ifdef HWABETA + BOOL Fill(int x, int y, int w, int h, COLORREF* pColors, DWORD dwFlags); +#endif + + // ====================== + // Geometric Primitives + // ====================== + + // 1. Simple routines : call GDI with Surface DC + // ============================================= + + BOOL Ellipse(int left, int top, int right, int bottom, int thickness = 1, COLORREF crOutl = BLACK); + + BOOL Ellipse(int left, int top, int right, int bottom, COLORREF crFill, int thickness /*= 0*/, + COLORREF crOutl /*= BLACK*/, BOOL Fill = TRUE); + + BOOL Rectangle(int left, int top, int right, int bottom, int thickness = 1, COLORREF crOutl = BLACK); + + BOOL Rectangle(int left, int top, int right, int bottom, COLORREF crFill, int thickness /*= 0*/, + COLORREF crOutl /*= BLACK*/, BOOL bFill = TRUE); + + BOOL Polygon(LPPOINT pts, int nPts, int thickness = 1, COLORREF crOutl = BLACK); + + BOOL Polygon(LPPOINT pts, int nPts, COLORREF crFill, int thickness = 0, + COLORREF crOutl = BLACK, BOOL bFill = TRUE); + + BOOL Line(int x1, int y1, int x2, int y2, int thickness = 1, COLORREF crOutl = BLACK); + + // 2. More complex but slower (variable opacity, anti-alias, custom filling, ...) + // ============================================================================== + + BOOL Ellipse(int left, int top, int right, int bottom, int thickness, CFillData FAR * fdOutl, BOOL AntiA = FALSE, + BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + BOOL Ellipse(int left, int top, int right, int bottom, CFillData FAR * fdFill, + BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + BOOL Ellipse(int left, int top, int right, int bottom, CFillData FAR * fdFill, int thickness, CFillData FAR * fdOutl, + BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, BOOL Fill = TRUE); + + BOOL Rectangle(int left, int top, int right, int bottom, int thickness, CFillData FAR * fdOutl, BOOL AntiA = FALSE, + BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + BOOL Rectangle(int left, int top, int right, int bottom, CFillData FAR * fdFill, + BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + BOOL Rectangle(int left, int top, int right, int bottom, CFillData FAR * fdFill, int thickness, CFillData FAR * fdOutl, + BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, BOOL Fill = TRUE); + + BOOL Polygon(LPPOINT pts, int nPts, int thickness, CFillData FAR * fdOutl, BOOL AntiA = FALSE, + BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + BOOL Polygon(LPPOINT pts, int nPts, CFillData FAR * fdFill, + BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + BOOL Polygon(LPPOINT pts, int nPts, CFillData FAR * fdFill, int thickness, CFillData FAR * fdOutl, + BOOL AntiA = FALSE, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, BOOL Fill = TRUE); + + BOOL Line(int x1, int y1, int x2, int y2, int thickness, CFillData FAR * fdOutl, BOOL AntiA, + BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + // Filled Primitives + + BOOL FloodFill(int x, int y, int FAR & left, int FAR & top, int FAR & right, int FAR & bottom, COLORREF crFill, BOOL AntiA = FALSE, + int tol = 0, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + BOOL FloodFill(int x, int y, COLORREF crFill, BOOL AntiA = FALSE, int tol = 0, + BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0); + + // ====================== + // Rotation + // ====================== + // Rotate surface + BOOL Rotate(cSurface FAR& dest, double a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); // radian + BOOL Rotate(cSurface FAR& dest, int a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); // degree + BOOL Rotate90(cSurface FAR& dest, BOOL b270); + + // Create rotated surface + BOOL CreateRotatedSurface (cSurface FAR& ps, double a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); + BOOL CreateRotatedSurface (cSurface FAR& ps, int a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); + +#ifdef HWABETA + static void GetSizeOfRotatedRect (int FAR *pWidth, int FAR *pHeight, float angle); +#else + static void GetSizeOfRotatedRect (int FAR *pWidth, int FAR *pHeight, int angle); +#endif + + // ====================== + // Text + // ====================== + +#undef TextOut + + int TextOutA(LPCSTR text, DWORD dwCharCount,int x,int y,DWORD alignMode,LPRECT pClipRc, COLORREF color=0, HFONT hFnt=(HFONT)NULL, BlitMode bm=BMODE_TRANSP, BlitOp=BOP_COPY, LPARAM param=0, int AntiA=0); + int TextOutW(LPCWSTR text, DWORD dwCharCount,int x,int y,DWORD alignMode,LPRECT pClipRc, COLORREF color=0, HFONT hFnt=(HFONT)NULL, BlitMode bm=BMODE_TRANSP, BlitOp=BOP_COPY, LPARAM param=0, int AntiA=0); + +#ifdef _UNICODE +#define TextOut TextOutW +#else +#define TextOut TextOutA +#endif + +#undef DrawText + + int DrawTextA(LPCSTR text, DWORD dwCharCount,LPRECT pRc, DWORD dtflags, COLORREF color=0, HFONT hFnt=(HFONT)NULL, + BlitMode bm=BMODE_TRANSP, BlitOp bo=BOP_COPY, LPARAM param=0, int AntiA=0,DWORD dwLeftMargin=0,DWORD dwRightMargin=0,DWORD dwTabSize=8); + int DrawTextW(LPCWSTR text, DWORD dwCharCount,LPRECT pRc, DWORD dtflags, COLORREF color=0, HFONT hFnt=(HFONT)NULL, + BlitMode bm=BMODE_TRANSP, BlitOp bo=BOP_COPY, LPARAM param=0, int AntiA=0,DWORD dwLeftMargin=0,DWORD dwRightMargin=0,DWORD dwTabSize=8); + +#ifdef _UNICODE +#define DrawText DrawTextW +#else +#define DrawText DrawTextA +#endif + + // ====================== + // Color / Palette functions + // ====================== + // Is transparent + BOOL IsTransparent(); + + // Replace color + BOOL ReplaceColor (COLORREF newColor, COLORREF oldColor); + + // Test collision fine entre deux surfaces + BOOL IsColliding(cSurface FAR & dest, int xDest, int yDest, int xSrc, int ySrc, int rcWidth, int rcHeight); + + // Create icon + HICON CreateIcon(int iconWidth, int iconHeight, COLORREF transpColor,POINT *pHotSpot); + + // Palette support + BOOL Indexed(void); + + BOOL SetPalette(LPLOGPALETTE palette, SetPaletteAction action=SPA_NONE); + BOOL SetPalette (LPCSPALETTE pCsPal, SetPaletteAction action=SPA_NONE); + BOOL SetPalette (cSurface FAR& src, SetPaletteAction action=SPA_NONE); + BOOL SetPalette(HPALETTE palette, SetPaletteAction action=SPA_NONE); + + void Remap(cSurface FAR& src); + void Remap(LPBYTE remapTable); + + LPCSPALETTE GetPalette(); + UINT GetPaletteEntries(LPPALETTEENTRY paletteEntry, int index, int nbColors); + + int GetNearestColorIndex(COLORREF rgb); + COLORREF GetRGB(int index); + int GetOpaqueBlackIndex(); + + // ====================== + // Full screen + // ====================== + void EnumScreenModes(LPENUMSCREENMODESPROC pProc, LPVOID lParam); + BOOL SetScreenMode(HWND hWnd, int width, int height, int depth); + void RestoreWindowedMode(HWND hWnd); + void CopyScreenModeInfo(cSurface* pSrc); + +#ifdef HWABETA + BOOL SetAutoVSync(int nAutoVSync); +#endif + BOOL WaitForVBlank(); + + // System colors + static COLORREF GetSysColor(int colorIndex); + static void OnSysColorChange(); + + // Transparent color + void SetTransparentColor(COLORREF rgb); + COLORREF GetTransparentColor(); + int GetTransparentColorIndex(); + + // Alpha channel + BOOL HasAlpha(); + LPBYTE LockAlpha(); + void UnlockAlpha(); + int GetAlphaPitch(); + void CreateAlpha(); + void SetAlpha(LPBYTE pAlpha, int nPitch); + void AttachAlpha(LPBYTE pAlpha, int nPitch); + LPBYTE DetachAlpha(LPLONG pPitch); + cSurface* GetAlphaSurface(); + void ReleaseAlphaSurface(cSurface* pAlphaSf); + + // Transparent monochrome mask + DWORD CreateMask(LPSMASK pMask, UINT dwFlags); + + // Lost device callback +#ifdef HWABETA + void OnLostDevice(); + void AddLostDeviceCallBack(LOSTDEVICECALLBACKPROC pCallback, LPARAM lUserParam); + void RemoveLostDeviceCallBack(LOSTDEVICECALLBACKPROC pCallback, LPARAM lUserParam); +#endif + + // Friend functions + // ---------------- + SURFACES_API friend cSurfaceImplementation FAR * WINAPI GetSurfaceImplementation(cSurface FAR &cs); + SURFACES_API friend void WINAPI SetSurfaceImplementation(cSurface FAR &cs, cSurfaceImplementation FAR *psi); + + protected: +#ifdef _WINDOWS + static void BuildSysColorTable(); +#endif // _WINDOWS + + // Clipping + //---------- + HRGN SetDrawClip(HDC hDC); + void RestoreDrawClip(HDC hDC,HRGN hOldClipRgn); + + // Private functions + // ----------------- + private: + BOOL LoadPicture (CInputFile FAR * pFile, DWORD bitmapSize, LIFlags loadFlags); + BOOL LoadDIB (LPBITMAPINFO pBmi, LPBYTE pBits, LIFlags loadFlags); + + // Private data + // ------------ + private: + cSurfaceImplementation FAR *m_actual; + POINT origin; + + // System colors + static BOOL m_bSysColorTab; + static COLORREF m_sysColorTab[COLOR_GRADIENTINACTIVECAPTION+1]; + + protected: + int m_error; // Est-ce qu'on doit toujours garder ça? +}; + +// maximum opacity +#define OP_MAX 128 // 100 + +#ifdef __cplusplus +extern "C" { +#endif + + SURFACES_API BOOL WINAPI BuildRemapTable (LPBYTE, LOGPALETTE FAR *, LOGPALETTE FAR *, WORD); + +#ifdef __cplusplus +} +#endif + +#endif // _Surface_h diff --git a/Inc/json.h b/Inc/json.h index b700ac5..1ef0fb4 100644 --- a/Inc/json.h +++ b/Inc/json.h @@ -1,192 +1,192 @@ - -/* vim: set et ts=3 sw=3 ft=c: - * - * Copyright (C) 2012 James McLaughlin et al. All rights reserved. - * https://github.com/udp/json-parser - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _JSON_H -#define _JSON_H - -#ifndef json_char - #define json_char char -#endif - -#ifdef __cplusplus - - #include - - extern "C" - { - -#endif - -typedef struct -{ - unsigned long max_memory; - int settings; - -} json_settings; - -#define json_relaxed_commas 1 - -typedef enum -{ - json_none, - json_object, - json_array, - json_integer, - json_double, - json_string, - json_boolean, - json_null - -} json_type; - -extern const struct _json_value json_value_none; - -typedef struct _json_value -{ - struct _json_value * parent; - - json_type type; - - union - { - int boolean; - long integer; - double dbl; - - struct - { - unsigned int length; - json_char * ptr; /* null terminated */ - - } string; - - struct - { - unsigned int length; - - struct - { - json_char * name; - struct _json_value * value; - - } * values; - - } object; - - struct - { - unsigned int length; - struct _json_value ** values; - - } array; - - } u; - - union - { - struct _json_value * next_alloc; - void * object_mem; - - } _reserved; - - - /* Some C++ operator sugar */ - - #ifdef __cplusplus - - public: - - inline _json_value () - { memset (this, 0, sizeof (_json_value)); - } - - inline const struct _json_value &operator [] (int index) const - { - if (type != json_array || index < 0 - || ((unsigned int) index) >= u.array.length) - { - return json_value_none; - } - - return *u.array.values [index]; - } - - inline const struct _json_value &operator [] (const char * index) const - { - if (type != json_object) - return json_value_none; - - for (unsigned int i = 0; i < u.object.length; ++ i) - if (!strcmp (u.object.values [i].name, index)) - return *u.object.values [i].value; - - return json_value_none; - } - - inline operator const char * () const - { - switch (type) - { - case json_string: - return u.string.ptr; - - default: - return ""; - }; - } - - inline operator long () const - { return u.integer; - } - - inline operator bool () const - { return u.boolean != 0; - } - - #endif - -} json_value; - -json_value * json_parse - (const json_char * json); - -json_value * json_parse_ex - (json_settings * settings, const json_char * json, char * error); - -void json_value_free (json_value *); - - -#ifdef __cplusplus - } /* extern "C" */ -#endif - -#endif - - + +/* vim: set et ts=3 sw=3 ft=c: + * + * Copyright (C) 2012 James McLaughlin et al. All rights reserved. + * https://github.com/udp/json-parser + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _JSON_H +#define _JSON_H + +#ifndef json_char + #define json_char char +#endif + +#ifdef __cplusplus + + #include + + extern "C" + { + +#endif + +typedef struct +{ + unsigned long max_memory; + int settings; + +} json_settings; + +#define json_relaxed_commas 1 + +typedef enum +{ + json_none, + json_object, + json_array, + json_integer, + json_double, + json_string, + json_boolean, + json_null + +} json_type; + +extern const struct _json_value json_value_none; + +typedef struct _json_value +{ + struct _json_value * parent; + + json_type type; + + union + { + int boolean; + long integer; + double dbl; + + struct + { + unsigned int length; + json_char * ptr; /* null terminated */ + + } string; + + struct + { + unsigned int length; + + struct + { + json_char * name; + struct _json_value * value; + + } * values; + + } object; + + struct + { + unsigned int length; + struct _json_value ** values; + + } array; + + } u; + + union + { + struct _json_value * next_alloc; + void * object_mem; + + } _reserved; + + + /* Some C++ operator sugar */ + + #ifdef __cplusplus + + public: + + inline _json_value () + { memset (this, 0, sizeof (_json_value)); + } + + inline const struct _json_value &operator [] (int index) const + { + if (type != json_array || index < 0 + || ((unsigned int) index) >= u.array.length) + { + return json_value_none; + } + + return *u.array.values [index]; + } + + inline const struct _json_value &operator [] (const char * index) const + { + if (type != json_object) + return json_value_none; + + for (unsigned int i = 0; i < u.object.length; ++ i) + if (!strcmp (u.object.values [i].name, index)) + return *u.object.values [i].value; + + return json_value_none; + } + + inline operator const char * () const + { + switch (type) + { + case json_string: + return u.string.ptr; + + default: + return ""; + }; + } + + inline operator long () const + { return u.integer; + } + + inline operator bool () const + { return u.boolean != 0; + } + + #endif + +} json_value; + +json_value * json_parse + (const json_char * json); + +json_value * json_parse_ex + (json_settings * settings, const json_char * json, char * error); + +void json_value_free (json_value *); + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif + + diff --git a/Lib/Edif.Edittime.cpp b/Lib/Edif.Edittime.cpp index 7468907..3c63934 100644 --- a/Lib/Edif.Edittime.cpp +++ b/Lib/Edif.Edittime.cpp @@ -1,351 +1,351 @@ - -#include "Common.h" - -void WINAPI DLLExport GetObjInfos (mv _far *mV, void *, LPTSTR ObjName, LPTSTR ObjAuthor, - LPTSTR ObjCopyright, LPTSTR ObjComment, LPTSTR ObjHttp) -{ -#ifndef RUN_ONLY - - const json_value &Properties = SDK->json["About"]; - - Edif::ConvertAndCopyString(ObjAuthor, Properties["Author"], MAX_PATH); - Edif::ConvertAndCopyString(ObjCopyright,Properties["Copyright"],MAX_PATH); - Edif::ConvertAndCopyString(ObjComment, Properties["Comment"], MAX_PATH); - Edif::ConvertAndCopyString(ObjHttp, Properties["URL"], MAX_PATH); - Edif::ConvertAndCopyString(ObjName, Properties["Name"], MAX_PATH); - - -#endif // !defined(RUN_ONLY) -} - -LPCTSTR WINAPI GetHelpFileName() -{ -#ifndef RUN_ONLY - // Return a file without path if your help file can be loaded by the MMF help file. -// return "MyExt.chm"; - - // Or return the path of your file, relatively to the MMF directory - // if your file is not loaded by the MMF help file. - static TCHAR TempString[MAX_PATH]; // used by GetHelpFileName() - return Edif::ConvertAndCopyString(TempString, SDK->json["About"]["Help"], MAX_PATH); -#else - return NULL; -#endif // !defined(RUN_ONLY) -} - -void WINAPI DLLExport GetConditionTitle(mv _far *mV, short code, short param, LPTSTR strBuf, short maxLen) -{ -#ifndef RUN_ONLY - - if(!IS_COMPATIBLE(mV)) - return; - - const json_value &Parameter = SDK->json["Conditions"][code]["Parameters"][param]; - - if(Parameter.type == json_object) - Edif::ConvertAndCopyString(strBuf, Parameter["Title"], maxLen); - else - Edif::ConvertAndCopyString(strBuf, Parameter[1], maxLen); - -#endif // !defined(RUN_ONLY) -} - -void WINAPI DLLExport GetActionTitle(mv _far *mV, short code, short param, LPTSTR strBuf, short maxLen) -{ -#ifndef RUN_ONLY - - if(!IS_COMPATIBLE(mV)) - return; - - const json_value &Parameter = SDK->json["Actions"][code]["Parameters"][param]; - - if(Parameter.type == json_object) - Edif::ConvertAndCopyString(strBuf, Parameter["Title"], maxLen); - else - Edif::ConvertAndCopyString(strBuf, Parameter[1], maxLen); - -#endif // !defined(RUN_ONLY) -} - - -void WINAPI DLLExport GetExpressionParam(mv _far *mV, short code, short param, LPTSTR strBuf, short maxLen) -{ -#ifndef RUN_ONLY - - if(!IS_COMPATIBLE(mV)) - return; - - const json_value &Parameter = SDK->json["Expressions"][code]["Parameters"][param]; - - if(Parameter.type == json_object) - Edif::ConvertAndCopyString(strBuf, Parameter["Title"], maxLen); - else - Edif::ConvertAndCopyString(strBuf, Parameter[1], maxLen); - - -#endif // !defined(RUN_ONLY) -} - - -void WINAPI DLLExport GetExpressionTitle(mv _far *mV, short code, LPTSTR strBuf, short maxLen) -{ -#ifndef RUN_ONLY - - if(!IS_COMPATIBLE(mV)) - return; - - Edif::ConvertAndCopyString(strBuf, SDK->json["Expressions"][code]["Title"], maxLen); - -#endif // !defined(RUN_ONLY) -} - -void WINAPI DLLExport GetConditionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) -{ -#ifndef RUN_ONLY - - if(!IS_COMPATIBLE(mV)) - return; - - Edif::ConvertAndCopyString(strPtr, SDK->json["Conditions"][code]["Title"], maxLen); - -#endif // !defined(RUN_ONLY) -} - -void WINAPI DLLExport GetActionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) -{ -#ifndef RUN_ONLY - - if(!IS_COMPATIBLE(mV)) - return; - - Edif::ConvertAndCopyString(strPtr, SDK->json["Actions"][code]["Title"], maxLen); - -#endif // !defined(RUN_ONLY) -} - -void WINAPI DLLExport GetExpressionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) -{ -#ifndef RUN_ONLY - - if(!IS_COMPATIBLE(mV)) - return; - - Edif::ConvertAndCopyString(strPtr, SDK->json["Expressions"][code]["Title"], maxLen); - -#endif // !defined(RUN_ONLY) -} - -LPINFOEVENTSV2 WINAPI DLLExport GetConditionInfos(mv _far *mV, short code) -{ -#ifndef RUN_ONLY - - if(IS_COMPATIBLE(mV)) - return &GetEventInformations((LPEVENTINFOS2) &SDK->ConditionInfos[0], code)->infos; - -#endif // !defined(RUN_ONLY) - return NULL; -} - -LPINFOEVENTSV2 WINAPI DLLExport GetActionInfos(mv _far *mV, short code) -{ -#ifndef RUN_ONLY - - if(IS_COMPATIBLE(mV)) - return &GetEventInformations((LPEVENTINFOS2) &SDK->ActionInfos[0], code)->infos; - -#endif // !defined(RUN_ONLY) - return NULL; -} - -LPINFOEVENTSV2 WINAPI DLLExport GetExpressionInfos(mv _far *mV, short code) -{ -#ifndef RUN_ONLY - - if(IS_COMPATIBLE(mV)) - return &GetEventInformations((LPEVENTINFOS2) &SDK->ExpressionInfos[0], code)->infos; - -#endif // !defined(RUN_ONLY) - return NULL; -} - -short WINAPI DLLExport GetConditionCodeFromMenu(mv _far *mV, short menuId) -{ -#ifndef RUN_ONLY - - return menuId - Edif::ConditionID(0); - -#endif // !defined(RUN_ONLY) - return -1; -} - -short WINAPI DLLExport GetActionCodeFromMenu(mv _far *mV, short menuId) -{ -#ifndef RUN_ONLY - - return menuId - Edif::ActionID(0); - -#endif // !defined(RUN_ONLY) - return -1; -} - -short WINAPI DLLExport GetExpressionCodeFromMenu(mv _far *mV, short menuId) -{ -#ifndef RUN_ONLY - - return menuId - Edif::ExpressionID(0); - -#endif // !defined(RUN_ONLY) - return -1; -} - -void menucpy(HMENU hTargetMenu, HMENU hSourceMenu) -{ -#ifndef RUN_ONLY - int n, id, nMn; - LPTSTR strBuf; - HMENU hSubMenu; - - nMn = GetMenuItemCount(hSourceMenu); - strBuf = (LPTSTR)calloc(80, sizeof(TCHAR)); - for (n = 0; n < nMn; n++) - { - if (0 == (id = GetMenuItemID(hSourceMenu, n))) - AppendMenu(hTargetMenu, MF_SEPARATOR, 0, 0L); - else - { - GetMenuString(hSourceMenu, n, strBuf, 80, MF_BYPOSITION); - if (id != -1) - AppendMenu(hTargetMenu, GetMenuState(hSourceMenu, n, MF_BYPOSITION), id, strBuf); - else - { - hSubMenu = CreatePopupMenu(); - AppendMenu(hTargetMenu, MF_POPUP | MF_STRING, (uint)hSubMenu, strBuf); - menucpy(hSubMenu, GetSubMenu(hSourceMenu, n)); - } - } - } - free(strBuf); -#endif -} - -HMENU WINAPI DLLExport GetConditionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA edPtr) -{ -#ifndef RUN_ONLY - // Check compatibility - if ( IS_COMPATIBLE(mV) ) - { - HMENU Menu = CreatePopupMenu(); - menucpy(Menu, Edif::ConditionMenu); - return Menu; - } -#endif // !defined(RUN_ONLY) - return NULL; -} - -HMENU WINAPI DLLExport GetActionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA edPtr) -{ -#ifndef RUN_ONLY - // Check compatibility - if ( IS_COMPATIBLE(mV) ) - { - HMENU Menu = CreatePopupMenu(); - menucpy(Menu, Edif::ActionMenu); - return Menu; - } -#endif // !defined(RUN_ONLY) - return NULL; -} - -HMENU WINAPI DLLExport GetExpressionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA edPtr) -{ -#ifndef RUN_ONLY - // Check compatibility - if ( IS_COMPATIBLE(mV) ) - { - HMENU Menu = CreatePopupMenu(); - menucpy(Menu, Edif::ExpressionMenu); - return Menu; - } -#endif // !defined(RUN_ONLY) - return NULL; -} - -#ifdef _UNICODE -#define _tstring wstring -#else -#define _tstring string -#endif - -void AddDirectory(_tstring &From, _tstring &To) -{ - HANDLE FileHandle; - WIN32_FIND_DATA Filejson; - - _tstring SearchString; - - SearchString += From; - SearchString += _T("*.*"); - - FileHandle = FindFirstFile(SearchString.c_str(), &Filejson); - - if(FileHandle == INVALID_HANDLE_VALUE) - return; - - do - { - if(*Filejson.cFileName == '.') - continue; - - if((Filejson.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) - { - _tstring OldPath; - - OldPath += From; - OldPath += Filejson.cFileName; - OldPath += _T("\\"); - - _tstring NewPath; - - NewPath += To; - NewPath += Filejson.cFileName; - NewPath += _T("\\"); - - CreateDirectory(NewPath.c_str(), 0); - AddDirectory(OldPath, NewPath); - - continue; - } - - CopyFile((From + Filejson.cFileName).c_str(), (To + Filejson.cFileName).c_str(), FALSE); - - } while(FindNextFile(FileHandle, &Filejson)); - - FindClose(FileHandle); -} - -void WINAPI PrepareFlexBuild(LPMV pMV, LPEDATA edPtr, LPCWSTR wTempFolder) -{ -#if !defined(RUN_ONLY) - - TCHAR FlashFolderPath[MAX_PATH]; - Edif::GetSiblingPath(FlashFolderPath, _T("Flash")); - - if (!*FlashFolderPath) - return; - - LPTSTR TempFolder; - -#ifdef _UNICODE - TempFolder = (LPTSTR)wTempFolder; -#else - { size_t Length = WideCharToMultiByte(CP_ACP, 0, wTempFolder, -1, 0, 0, 0, 0); - TempFolder = (LPSTR) alloca(Length + 1); - - WideCharToMultiByte(CP_ACP, 0, wTempFolder, -1, TempFolder, Length, 0, 0); - } -#endif - - AddDirectory(((_tstring) FlashFolderPath + _T("\\")), (_tstring) TempFolder); - -#endif // !defined(RUN_ONLY) -} + +#include "Common.h" + +void WINAPI DLLExport GetObjInfos (mv _far *mV, void *, LPTSTR ObjName, LPTSTR ObjAuthor, + LPTSTR ObjCopyright, LPTSTR ObjComment, LPTSTR ObjHttp) +{ +#ifndef RUN_ONLY + + const json_value &Properties = SDK->json["About"]; + + Edif::ConvertAndCopyString(ObjAuthor, Properties["Author"], MAX_PATH); + Edif::ConvertAndCopyString(ObjCopyright,Properties["Copyright"],MAX_PATH); + Edif::ConvertAndCopyString(ObjComment, Properties["Comment"], MAX_PATH); + Edif::ConvertAndCopyString(ObjHttp, Properties["URL"], MAX_PATH); + Edif::ConvertAndCopyString(ObjName, Properties["Name"], MAX_PATH); + + +#endif // !defined(RUN_ONLY) +} + +LPCTSTR WINAPI GetHelpFileName() +{ +#ifndef RUN_ONLY + // Return a file without path if your help file can be loaded by the MMF help file. +// return "MyExt.chm"; + + // Or return the path of your file, relatively to the MMF directory + // if your file is not loaded by the MMF help file. + static TCHAR TempString[MAX_PATH]; // used by GetHelpFileName() + return Edif::ConvertAndCopyString(TempString, SDK->json["About"]["Help"], MAX_PATH); +#else + return NULL; +#endif // !defined(RUN_ONLY) +} + +void WINAPI DLLExport GetConditionTitle(mv _far *mV, short code, short param, LPTSTR strBuf, short maxLen) +{ +#ifndef RUN_ONLY + + if(!IS_COMPATIBLE(mV)) + return; + + const json_value &Parameter = SDK->json["Conditions"][code]["Parameters"][param]; + + if(Parameter.type == json_object) + Edif::ConvertAndCopyString(strBuf, Parameter["Title"], maxLen); + else + Edif::ConvertAndCopyString(strBuf, Parameter[1], maxLen); + +#endif // !defined(RUN_ONLY) +} + +void WINAPI DLLExport GetActionTitle(mv _far *mV, short code, short param, LPTSTR strBuf, short maxLen) +{ +#ifndef RUN_ONLY + + if(!IS_COMPATIBLE(mV)) + return; + + const json_value &Parameter = SDK->json["Actions"][code]["Parameters"][param]; + + if(Parameter.type == json_object) + Edif::ConvertAndCopyString(strBuf, Parameter["Title"], maxLen); + else + Edif::ConvertAndCopyString(strBuf, Parameter[1], maxLen); + +#endif // !defined(RUN_ONLY) +} + + +void WINAPI DLLExport GetExpressionParam(mv _far *mV, short code, short param, LPTSTR strBuf, short maxLen) +{ +#ifndef RUN_ONLY + + if(!IS_COMPATIBLE(mV)) + return; + + const json_value &Parameter = SDK->json["Expressions"][code]["Parameters"][param]; + + if(Parameter.type == json_object) + Edif::ConvertAndCopyString(strBuf, Parameter["Title"], maxLen); + else + Edif::ConvertAndCopyString(strBuf, Parameter[1], maxLen); + + +#endif // !defined(RUN_ONLY) +} + + +void WINAPI DLLExport GetExpressionTitle(mv _far *mV, short code, LPTSTR strBuf, short maxLen) +{ +#ifndef RUN_ONLY + + if(!IS_COMPATIBLE(mV)) + return; + + Edif::ConvertAndCopyString(strBuf, SDK->json["Expressions"][code]["Title"], maxLen); + +#endif // !defined(RUN_ONLY) +} + +void WINAPI DLLExport GetConditionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) +{ +#ifndef RUN_ONLY + + if(!IS_COMPATIBLE(mV)) + return; + + Edif::ConvertAndCopyString(strPtr, SDK->json["Conditions"][code]["Title"], maxLen); + +#endif // !defined(RUN_ONLY) +} + +void WINAPI DLLExport GetActionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) +{ +#ifndef RUN_ONLY + + if(!IS_COMPATIBLE(mV)) + return; + + Edif::ConvertAndCopyString(strPtr, SDK->json["Actions"][code]["Title"], maxLen); + +#endif // !defined(RUN_ONLY) +} + +void WINAPI DLLExport GetExpressionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) +{ +#ifndef RUN_ONLY + + if(!IS_COMPATIBLE(mV)) + return; + + Edif::ConvertAndCopyString(strPtr, SDK->json["Expressions"][code]["Title"], maxLen); + +#endif // !defined(RUN_ONLY) +} + +LPINFOEVENTSV2 WINAPI DLLExport GetConditionInfos(mv _far *mV, short code) +{ +#ifndef RUN_ONLY + + if(IS_COMPATIBLE(mV)) + return &GetEventInformations((LPEVENTINFOS2) &SDK->ConditionInfos[0], code)->infos; + +#endif // !defined(RUN_ONLY) + return NULL; +} + +LPINFOEVENTSV2 WINAPI DLLExport GetActionInfos(mv _far *mV, short code) +{ +#ifndef RUN_ONLY + + if(IS_COMPATIBLE(mV)) + return &GetEventInformations((LPEVENTINFOS2) &SDK->ActionInfos[0], code)->infos; + +#endif // !defined(RUN_ONLY) + return NULL; +} + +LPINFOEVENTSV2 WINAPI DLLExport GetExpressionInfos(mv _far *mV, short code) +{ +#ifndef RUN_ONLY + + if(IS_COMPATIBLE(mV)) + return &GetEventInformations((LPEVENTINFOS2) &SDK->ExpressionInfos[0], code)->infos; + +#endif // !defined(RUN_ONLY) + return NULL; +} + +short WINAPI DLLExport GetConditionCodeFromMenu(mv _far *mV, short menuId) +{ +#ifndef RUN_ONLY + + return menuId - Edif::ConditionID(0); + +#endif // !defined(RUN_ONLY) + return -1; +} + +short WINAPI DLLExport GetActionCodeFromMenu(mv _far *mV, short menuId) +{ +#ifndef RUN_ONLY + + return menuId - Edif::ActionID(0); + +#endif // !defined(RUN_ONLY) + return -1; +} + +short WINAPI DLLExport GetExpressionCodeFromMenu(mv _far *mV, short menuId) +{ +#ifndef RUN_ONLY + + return menuId - Edif::ExpressionID(0); + +#endif // !defined(RUN_ONLY) + return -1; +} + +void menucpy(HMENU hTargetMenu, HMENU hSourceMenu) +{ +#ifndef RUN_ONLY + int n, id, nMn; + LPTSTR strBuf; + HMENU hSubMenu; + + nMn = GetMenuItemCount(hSourceMenu); + strBuf = (LPTSTR)calloc(80, sizeof(TCHAR)); + for (n = 0; n < nMn; n++) + { + if (0 == (id = GetMenuItemID(hSourceMenu, n))) + AppendMenu(hTargetMenu, MF_SEPARATOR, 0, 0L); + else + { + GetMenuString(hSourceMenu, n, strBuf, 80, MF_BYPOSITION); + if (id != -1) + AppendMenu(hTargetMenu, GetMenuState(hSourceMenu, n, MF_BYPOSITION), id, strBuf); + else + { + hSubMenu = CreatePopupMenu(); + AppendMenu(hTargetMenu, MF_POPUP | MF_STRING, (uint)hSubMenu, strBuf); + menucpy(hSubMenu, GetSubMenu(hSourceMenu, n)); + } + } + } + free(strBuf); +#endif +} + +HMENU WINAPI DLLExport GetConditionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA edPtr) +{ +#ifndef RUN_ONLY + // Check compatibility + if ( IS_COMPATIBLE(mV) ) + { + HMENU Menu = CreatePopupMenu(); + menucpy(Menu, Edif::ConditionMenu); + return Menu; + } +#endif // !defined(RUN_ONLY) + return NULL; +} + +HMENU WINAPI DLLExport GetActionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA edPtr) +{ +#ifndef RUN_ONLY + // Check compatibility + if ( IS_COMPATIBLE(mV) ) + { + HMENU Menu = CreatePopupMenu(); + menucpy(Menu, Edif::ActionMenu); + return Menu; + } +#endif // !defined(RUN_ONLY) + return NULL; +} + +HMENU WINAPI DLLExport GetExpressionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA edPtr) +{ +#ifndef RUN_ONLY + // Check compatibility + if ( IS_COMPATIBLE(mV) ) + { + HMENU Menu = CreatePopupMenu(); + menucpy(Menu, Edif::ExpressionMenu); + return Menu; + } +#endif // !defined(RUN_ONLY) + return NULL; +} + +#ifdef _UNICODE +#define _tstring wstring +#else +#define _tstring string +#endif + +void AddDirectory(_tstring &From, _tstring &To) +{ + HANDLE FileHandle; + WIN32_FIND_DATA Filejson; + + _tstring SearchString; + + SearchString += From; + SearchString += _T("*.*"); + + FileHandle = FindFirstFile(SearchString.c_str(), &Filejson); + + if(FileHandle == INVALID_HANDLE_VALUE) + return; + + do + { + if(*Filejson.cFileName == '.') + continue; + + if((Filejson.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) + { + _tstring OldPath; + + OldPath += From; + OldPath += Filejson.cFileName; + OldPath += _T("\\"); + + _tstring NewPath; + + NewPath += To; + NewPath += Filejson.cFileName; + NewPath += _T("\\"); + + CreateDirectory(NewPath.c_str(), 0); + AddDirectory(OldPath, NewPath); + + continue; + } + + CopyFile((From + Filejson.cFileName).c_str(), (To + Filejson.cFileName).c_str(), FALSE); + + } while(FindNextFile(FileHandle, &Filejson)); + + FindClose(FileHandle); +} + +void WINAPI PrepareFlexBuild(LPMV pMV, LPEDATA edPtr, LPCWSTR wTempFolder) +{ +#if !defined(RUN_ONLY) + + TCHAR FlashFolderPath[MAX_PATH]; + Edif::GetSiblingPath(FlashFolderPath, _T("Flash")); + + if (!*FlashFolderPath) + return; + + LPTSTR TempFolder; + +#ifdef _UNICODE + TempFolder = (LPTSTR)wTempFolder; +#else + { size_t Length = WideCharToMultiByte(CP_ACP, 0, wTempFolder, -1, 0, 0, 0, 0); + TempFolder = (LPSTR) alloca(Length + 1); + + WideCharToMultiByte(CP_ACP, 0, wTempFolder, -1, TempFolder, Length, 0, 0); + } +#endif + + AddDirectory(((_tstring) FlashFolderPath + _T("\\")), (_tstring) TempFolder); + +#endif // !defined(RUN_ONLY) +} diff --git a/Lib/Edif.General.cpp b/Lib/Edif.General.cpp index 0faa17d..c694baf 100644 --- a/Lib/Edif.General.cpp +++ b/Lib/Edif.General.cpp @@ -1,203 +1,203 @@ -#include "Common.h" - -LPCTSTR * Dependencies = 0; - -LPCTSTR * WINAPI DLLExport GetDependencies() -{ - if(!Dependencies) - { - const json_value &DependenciesJSON = SDK->json["About"]["Dependencies"]; - - Dependencies = new LPCTSTR [DependenciesJSON.u.array.length + 2]; - - int Offset = 0; - - if (Edif::ExternalJSON) - { - TCHAR * JSONFilename = (TCHAR *)malloc(MAX_PATH * sizeof(TCHAR)); - - GetModuleFileName (hInstLib, JSONFilename, MAX_PATH); - - TCHAR * Iterator = JSONFilename + _tcslen(JSONFilename) - 1; - - while(*Iterator != '.') - -- Iterator; - - _tcscpy(++ Iterator, _T("json")); - - Iterator = JSONFilename + _tcslen(JSONFilename) - 1; - - while(*Iterator != '\\' && *Iterator != '/') - -- Iterator; - - Dependencies [Offset ++] = ++ Iterator; - } - - unsigned int i = 0; - - for(; i < DependenciesJSON.u.array.length; ++ i) - { - TCHAR* tstr = Edif::ConvertString(DependenciesJSON[i]); - Dependencies[Offset + i] = tstr; - //Edif::FreeString(tstr); - } - - Dependencies[Offset + i] = 0; - } - - return Dependencies; -} - -short WINAPI DLLExport GetRunObjectInfos(mv _far *mV, fpKpxRunInfos infoPtr) -{ - infoPtr->conditions = &SDK->ConditionJumps[0]; - infoPtr->actions = &SDK->ActionJumps[0]; - infoPtr->expressions = &SDK->ExpressionJumps[0]; - - infoPtr->numOfConditions = SDK->json["Conditions"].u.array.length; - infoPtr->numOfActions = SDK->json["Actions"].u.array.length; - infoPtr->numOfExpressions = SDK->json["Expressions"].u.array.length; - - infoPtr->editDataSize = sizeof(EDITDATA); - - infoPtr->windowProcPriority = Extension::WindowProcPriority; - - infoPtr->editFlags = Extension::OEFLAGS; - infoPtr->editPrefs = Extension::OEPREFS; - - memcpy(&infoPtr->identifier, SDK->json["About"]["Identifier"], 4); - - infoPtr->version = Extension::Version; - - return TRUE; -} - -extern "C" -{ - DWORD WINAPI DLLExport GetInfos(int info) - { - - switch (info) - { - case KGI_VERSION: - return EXT_VERSION2; - - case KGI_PLUGIN: - return EXT_PLUGIN_VERSION1; - - case KGI_PRODUCT: - - #ifdef PROEXT - return PRODUCT_VERSION_DEV; - #endif - - #ifdef TGFEXT - return PRODUCT_VERSION_HOME; - #endif - - return PRODUCT_VERSION_STANDARD; - - case KGI_BUILD: - return Extension::MinimumBuild; - - case KGI_UNICODE: - - #ifdef _UNICODE - return TRUE; - #else - return FALSE; - #endif - - default: - return 0; - } - } -} - -short WINAPI DLLExport CreateRunObject(LPRDATA rdPtr, LPEDATA edPtr, fpcob cobPtr) -{ - /* Global to all extensions! Use the constructor of your Extension class (Extension.cpp) instead! */ - - rdPtr->rc = 0; - rdPtr->rm = 0; - rdPtr->rs = 0; - rdPtr->rv = 0; - unsigned off = 0; - if(Extension::OEFLAGS & OEFLAG_MOVEMENTS - || Extension::OEFLAGS & OEFLAG_SPRITES) - { - rdPtr->rc = (rCom *)(rdPtr->r + off); - off += sizeof(rCom); - } - if(Extension::OEFLAGS & OEFLAG_MOVEMENTS) - { - rdPtr->rm = (rMvt *)(rdPtr->r + off); - off += sizeof(rMvt); - } - if(Extension::OEFLAGS & OEFLAG_SPRITES) - { - rdPtr->rs = (rSpr *)(rdPtr->r + off); - off += sizeof(rSpr); - } - if(Extension::OEFLAGS & OEFLAG_VALUES) - { - rdPtr->rv = (rVal *)(rdPtr->r + off); - } - rdPtr->pExtension = new Extension(rdPtr, edPtr, cobPtr); - rdPtr->pExtension->Runtime.ObjectSelection.pExtension = rdPtr->pExtension; - - return 0; -} - - -/* Don't touch any of these, they're global to all extensions! See Extension.cpp */ - -short WINAPI DLLExport DestroyRunObject(LPRDATA rdPtr, long fast) -{ - delete rdPtr->pExtension; - - return 0; -} - -short WINAPI DLLExport HandleRunObject(LPRDATA rdPtr) -{ - return rdPtr->pExtension->Handle(); -} - -short WINAPI DLLExport DisplayRunObject(LPRDATA rdPtr) -{ - return rdPtr->pExtension->Display(); -} - -ushort WINAPI DLLExport GetRunObjectDataSize(fprh rhPtr, LPEDATA edPtr) -{ - return(sizeof(RUNDATA)); -} - -short WINAPI DLLExport PauseRunObject(LPRDATA rdPtr) -{ - return rdPtr->pExtension->Pause(); -} - -short WINAPI DLLExport ContinueRunObject(LPRDATA rdPtr) -{ - return rdPtr->pExtension->Continue(); -} - -BOOL WINAPI SaveRunObject(LPRDATA rdPtr, HANDLE hf) -{ - return rdPtr->pExtension->Save(hf) ? TRUE : FALSE; -} - -BOOL WINAPI LoadRunObject(LPRDATA rdPtr, HANDLE hf) -{ - return rdPtr->pExtension->Load(hf) ? TRUE : FALSE; -} - -LPEVENTINFOS2 GetEventInformations(LPEVENTINFOS2 eiPtr, short code) -{ - while(eiPtr->infos.code != code) - eiPtr = EVINFO2_NEXT(eiPtr); - - return eiPtr; -} +#include "Common.h" + +LPCTSTR * Dependencies = 0; + +LPCTSTR * WINAPI DLLExport GetDependencies() +{ + if(!Dependencies) + { + const json_value &DependenciesJSON = SDK->json["About"]["Dependencies"]; + + Dependencies = new LPCTSTR [DependenciesJSON.u.array.length + 2]; + + int Offset = 0; + + if (Edif::ExternalJSON) + { + TCHAR * JSONFilename = (TCHAR *)malloc(MAX_PATH * sizeof(TCHAR)); + + GetModuleFileName (hInstLib, JSONFilename, MAX_PATH); + + TCHAR * Iterator = JSONFilename + _tcslen(JSONFilename) - 1; + + while(*Iterator != '.') + -- Iterator; + + _tcscpy(++ Iterator, _T("json")); + + Iterator = JSONFilename + _tcslen(JSONFilename) - 1; + + while(*Iterator != '\\' && *Iterator != '/') + -- Iterator; + + Dependencies [Offset ++] = ++ Iterator; + } + + unsigned int i = 0; + + for(; i < DependenciesJSON.u.array.length; ++ i) + { + TCHAR* tstr = Edif::ConvertString(DependenciesJSON[i]); + Dependencies[Offset + i] = tstr; + //Edif::FreeString(tstr); + } + + Dependencies[Offset + i] = 0; + } + + return Dependencies; +} + +short WINAPI DLLExport GetRunObjectInfos(mv _far *mV, fpKpxRunInfos infoPtr) +{ + infoPtr->conditions = &SDK->ConditionJumps[0]; + infoPtr->actions = &SDK->ActionJumps[0]; + infoPtr->expressions = &SDK->ExpressionJumps[0]; + + infoPtr->numOfConditions = SDK->json["Conditions"].u.array.length; + infoPtr->numOfActions = SDK->json["Actions"].u.array.length; + infoPtr->numOfExpressions = SDK->json["Expressions"].u.array.length; + + infoPtr->editDataSize = sizeof(EDITDATA); + + infoPtr->windowProcPriority = Extension::WindowProcPriority; + + infoPtr->editFlags = Extension::OEFLAGS; + infoPtr->editPrefs = Extension::OEPREFS; + + memcpy(&infoPtr->identifier, SDK->json["About"]["Identifier"], 4); + + infoPtr->version = Extension::Version; + + return TRUE; +} + +extern "C" +{ + DWORD WINAPI DLLExport GetInfos(int info) + { + + switch (info) + { + case KGI_VERSION: + return EXT_VERSION2; + + case KGI_PLUGIN: + return EXT_PLUGIN_VERSION1; + + case KGI_PRODUCT: + + #ifdef PROEXT + return PRODUCT_VERSION_DEV; + #endif + + #ifdef TGFEXT + return PRODUCT_VERSION_HOME; + #endif + + return PRODUCT_VERSION_STANDARD; + + case KGI_BUILD: + return Extension::MinimumBuild; + + case KGI_UNICODE: + + #ifdef _UNICODE + return TRUE; + #else + return FALSE; + #endif + + default: + return 0; + } + } +} + +short WINAPI DLLExport CreateRunObject(LPRDATA rdPtr, LPEDATA edPtr, fpcob cobPtr) +{ + /* Global to all extensions! Use the constructor of your Extension class (Extension.cpp) instead! */ + + rdPtr->rc = 0; + rdPtr->rm = 0; + rdPtr->rs = 0; + rdPtr->rv = 0; + unsigned off = 0; + if(Extension::OEFLAGS & OEFLAG_MOVEMENTS + || Extension::OEFLAGS & OEFLAG_SPRITES) + { + rdPtr->rc = (rCom *)(rdPtr->r + off); + off += sizeof(rCom); + } + if(Extension::OEFLAGS & OEFLAG_MOVEMENTS) + { + rdPtr->rm = (rMvt *)(rdPtr->r + off); + off += sizeof(rMvt); + } + if(Extension::OEFLAGS & OEFLAG_SPRITES) + { + rdPtr->rs = (rSpr *)(rdPtr->r + off); + off += sizeof(rSpr); + } + if(Extension::OEFLAGS & OEFLAG_VALUES) + { + rdPtr->rv = (rVal *)(rdPtr->r + off); + } + rdPtr->pExtension = new Extension(rdPtr, edPtr, cobPtr); + rdPtr->pExtension->Runtime.ObjectSelection.pExtension = rdPtr->pExtension; + + return 0; +} + + +/* Don't touch any of these, they're global to all extensions! See Extension.cpp */ + +short WINAPI DLLExport DestroyRunObject(LPRDATA rdPtr, long fast) +{ + delete rdPtr->pExtension; + + return 0; +} + +short WINAPI DLLExport HandleRunObject(LPRDATA rdPtr) +{ + return rdPtr->pExtension->Handle(); +} + +short WINAPI DLLExport DisplayRunObject(LPRDATA rdPtr) +{ + return rdPtr->pExtension->Display(); +} + +ushort WINAPI DLLExport GetRunObjectDataSize(fprh rhPtr, LPEDATA edPtr) +{ + return(sizeof(RUNDATA)); +} + +short WINAPI DLLExport PauseRunObject(LPRDATA rdPtr) +{ + return rdPtr->pExtension->Pause(); +} + +short WINAPI DLLExport ContinueRunObject(LPRDATA rdPtr) +{ + return rdPtr->pExtension->Continue(); +} + +BOOL WINAPI SaveRunObject(LPRDATA rdPtr, HANDLE hf) +{ + return rdPtr->pExtension->Save(hf) ? TRUE : FALSE; +} + +BOOL WINAPI LoadRunObject(LPRDATA rdPtr, HANDLE hf) +{ + return rdPtr->pExtension->Load(hf) ? TRUE : FALSE; +} + +LPEVENTINFOS2 GetEventInformations(LPEVENTINFOS2 eiPtr, short code) +{ + while(eiPtr->infos.code != code) + eiPtr = EVINFO2_NEXT(eiPtr); + + return eiPtr; +} diff --git a/Lib/Edif.Runtime.cpp b/Lib/Edif.Runtime.cpp index c3f74b5..854d95c 100644 --- a/Lib/Edif.Runtime.cpp +++ b/Lib/Edif.Runtime.cpp @@ -1,277 +1,277 @@ -#include "Common.h" - -Edif::Runtime::Runtime(LPRDATA _rdPtr) : rdPtr(_rdPtr), ObjectSelection(_rdPtr->rHo.hoAdRunHeader) -{ -} - -Edif::Runtime::~Runtime() -{ -} - -void Edif::Runtime::Rehandle() -{ - callRunTimeFunction(rdPtr, RFUNCTION_REHANDLE, 0, 0); -} - -void Edif::Runtime::GenerateEvent(int EventID) -{ - callRunTimeFunction(rdPtr, RFUNCTION_GENERATEEVENT, EventID, 0); -} - -void Edif::Runtime::PushEvent(int EventID) -{ - callRunTimeFunction(rdPtr, RFUNCTION_PUSHEVENT, EventID, 0); -} - -void * Edif::Runtime::Allocate(size_t Size) -{ - return (void *) callRunTimeFunction(rdPtr, RFUNCTION_GETSTRINGSPACE_EX, 0, Size * sizeof(TCHAR)); -} - -TCHAR * Edif::Runtime::CopyString(const TCHAR * String) -{ - TCHAR * New = (TCHAR *) Allocate(_tcslen(String) + 1); - _tcscpy(New, String); - - return New; -} - -void Edif::Runtime::Pause() -{ - callRunTimeFunction(rdPtr, RFUNCTION_PAUSE, 0, 0); -} - -void Edif::Runtime::Resume() -{ - callRunTimeFunction(rdPtr, RFUNCTION_CONTINUE, 0, 0); -} - -void Edif::Runtime::Redisplay() -{ - callRunTimeFunction(rdPtr, RFUNCTION_REDISPLAY, 0, 0); -} - -void Edif::Runtime::GetApplicationDrive(TCHAR * Buffer) -{ - callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_DRIVE, (long) Buffer); -} - -void Edif::Runtime::GetApplicationDirectory(TCHAR * Buffer) -{ - callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_DIR, (long) Buffer); -} - -void Edif::Runtime::GetApplicationPath(TCHAR * Buffer) -{ - callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_PATH, (long) Buffer); -} - -void Edif::Runtime::GetApplicationName(TCHAR * Buffer) -{ - callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_APPNAME, (long) Buffer); -} - -void Edif::Runtime::GetApplicationTempPath(TCHAR * Buffer) -{ - callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_TEMPPATH, (long) Buffer); -} - -void Edif::Runtime::Redraw() -{ - callRunTimeFunction(rdPtr, RFUNCTION_REDRAW, 0, 0); -} - -void Edif::Runtime::Destroy() -{ - callRunTimeFunction(rdPtr, RFUNCTION_DESTROY, 0, 0); -} - -void Edif::Runtime::ExecuteProgram(prgParam * Program) -{ - callRunTimeFunction(rdPtr, RFUNCTION_EXECPROGRAM, 0, (long) Program); -} - -long Edif::Runtime::EditInteger(EditDebugInfo * EDI) -{ - return callRunTimeFunction(rdPtr, RFUNCTION_EDITINT, 0, (long) EDI); -} - -long Edif::Runtime::EditText(EditDebugInfo * EDI) -{ - return callRunTimeFunction(rdPtr, RFUNCTION_EDITTEXT, 0, (long) EDI); -} - -void Edif::Runtime::CallMovement(int ID, long Parameter) -{ - callRunTimeFunction(rdPtr, RFUNCTION_CALLMOVEMENT, ID, Parameter); -} - -void Edif::Runtime::SetPosition(int X, int Y) -{ - callRunTimeFunction(rdPtr, RFUNCTION_SETPOSITION, X, Y); -} - -CallTables* Edif::Runtime::GetCallTables() -{ - return (CallTables*)callRunTimeFunction(rdPtr, RFUNCTION_GETCALLTABLES, 0, 0); -} - -bool Edif::Runtime::IsHWA() -{ - return rdPtr->rHo.hoAdRunHeader->rh4.rh4Mv->mvCallFunction(NULL, 112, 0, 0, 0) == 1; -} - -bool Edif::Runtime::IsUnicode() -{ - return rdPtr->rHo.hoAdRunHeader->rh4.rh4Mv->mvCallFunction(NULL, 113, 0, 0, 0) == 1; -} - -event &Edif::Runtime::CurrentEvent() -{ - return *(event *) (((char *) param1) - CND_SIZE); -} - -LPRO Edif::Runtime::LPROFromFixed(int fixedvalue) -{ - LPOBL objList = rdPtr->rHo.hoAdRunHeader->rhObjectList; - int index = 0x0000FFFF & fixedvalue; - - if (index < 0 || index >= rdPtr->rHo.hoAdRunHeader->rhMaxObjects) - return NULL; - - LPRO theObject = (LPRO)objList[0x0000FFFF & fixedvalue].oblOffset; - - if (theObject == NULL) - return NULL; - else if (FixedFromLPRO(theObject) != fixedvalue) - return NULL; - - return theObject; -} - -int Edif::Runtime::FixedFromLPRO(LPRO object) -{ - if(object != NULL) - return (object->roHo.hoCreationId << 16) + object->roHo.hoNumber; - return 0; -} - -void Edif::Runtime::SetAngleOfObject(LPRO object, float acAngle) -{ - if(object == NULL) - return; - - if(IsHWA()) - memcpy(&object->roc.rcAngle, (int*)&acAngle, sizeof(int)); - else - object->roc.rcAngle = (int)acAngle; - -} - -extern HINSTANCE hInstLib; - -struct EdifGlobal -{ - TCHAR Name[256]; - void * Value; - - EdifGlobal * Next; -}; - -void Edif::Runtime::WriteGlobal(const TCHAR * Name, void * Value) -{ - LPRH rhPtr = rdPtr->rHo.hoAdRunHeader; - - while(rhPtr->rhApp->m_pParentApp) - rhPtr = rhPtr->rhApp->m_pParentApp->m_Frame->m_rhPtr; - - EdifGlobal * Global = (EdifGlobal *) rhPtr->rh4.rh4Mv->mvGetExtUserData(rhPtr->rhApp, hInstLib); - - if(!Global) - { - Global = new EdifGlobal; - - _tcscpy(Global->Name, Name); - Global->Value = Value; - - Global->Next = 0; - - rhPtr->rh4.rh4Mv->mvSetExtUserData(rhPtr->rhApp, hInstLib, Global); - - return; - } - - while(Global) - { - if(!_tcsicmp(Global->Name, Name)) - { - Global->Value = Value; - return; - } - - if(!Global->Next) - break; - - Global = Global->Next; - } - - Global->Next = new EdifGlobal; - Global = Global->Next; - - _tcscpy(Global->Name, Name); - - Global->Value = Value; - Global->Next = 0; -} - -void * Edif::Runtime::ReadGlobal(const TCHAR * Name) -{ - LPRH rhPtr = rdPtr->rHo.hoAdRunHeader; - - while(rhPtr->rhApp->m_pParentApp) - rhPtr = rhPtr->rhApp->m_pParentApp->m_Frame->m_rhPtr; - - EdifGlobal * Global = (EdifGlobal *) rhPtr->rh4.rh4Mv->mvGetExtUserData(rhPtr->rhApp, hInstLib); - - while(Global) - { - if(!_tcsicmp(Global->Name, Name)) - return Global->Value; - - Global = Global->Next; - } - - return 0; -} - -#ifdef EdifUseJS - - /* Breaking versions of Edif should change these so that newer extensions don't - try to work with an older JS context. */ - - const char * const ContextName = "JSContext-V1"; - - - JSContext * Edif::Runtime::GetJSContext() - { - JSContext * Context = ReadGlobal(ContextName); - - if(!Context) - { - Context = JS_NewContext(JS_NewRuntime(8 * 1024 * 1024), 8192); - - JS_SetOptions(Context, JSOPTION_VAROBJFIX | JSOPTION_JIT | JSOPTION_METHODJIT | JSOPTION_NO_SCRIPT_RVAL); - JS_SetVersion(Context, JSVERSION_LATEST); - - JSObject * Global = JS_NewGlobalObject(context, &GlobalClass); - - JS_SetGlobalObject (Context, Global); - JS_InitStandardClasses(Context, Global); - - WriteGlobal(ContextName, Context); - } - - return Context; - } - -#endif +#include "Common.h" + +Edif::Runtime::Runtime(LPRDATA _rdPtr) : rdPtr(_rdPtr), ObjectSelection(_rdPtr->rHo.hoAdRunHeader) +{ +} + +Edif::Runtime::~Runtime() +{ +} + +void Edif::Runtime::Rehandle() +{ + callRunTimeFunction(rdPtr, RFUNCTION_REHANDLE, 0, 0); +} + +void Edif::Runtime::GenerateEvent(int EventID) +{ + callRunTimeFunction(rdPtr, RFUNCTION_GENERATEEVENT, EventID, 0); +} + +void Edif::Runtime::PushEvent(int EventID) +{ + callRunTimeFunction(rdPtr, RFUNCTION_PUSHEVENT, EventID, 0); +} + +void * Edif::Runtime::Allocate(size_t Size) +{ + return (void *) callRunTimeFunction(rdPtr, RFUNCTION_GETSTRINGSPACE_EX, 0, Size * sizeof(TCHAR)); +} + +TCHAR * Edif::Runtime::CopyString(const TCHAR * String) +{ + TCHAR * New = (TCHAR *) Allocate(_tcslen(String) + 1); + _tcscpy(New, String); + + return New; +} + +void Edif::Runtime::Pause() +{ + callRunTimeFunction(rdPtr, RFUNCTION_PAUSE, 0, 0); +} + +void Edif::Runtime::Resume() +{ + callRunTimeFunction(rdPtr, RFUNCTION_CONTINUE, 0, 0); +} + +void Edif::Runtime::Redisplay() +{ + callRunTimeFunction(rdPtr, RFUNCTION_REDISPLAY, 0, 0); +} + +void Edif::Runtime::GetApplicationDrive(TCHAR * Buffer) +{ + callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_DRIVE, (long) Buffer); +} + +void Edif::Runtime::GetApplicationDirectory(TCHAR * Buffer) +{ + callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_DIR, (long) Buffer); +} + +void Edif::Runtime::GetApplicationPath(TCHAR * Buffer) +{ + callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_PATH, (long) Buffer); +} + +void Edif::Runtime::GetApplicationName(TCHAR * Buffer) +{ + callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_APPNAME, (long) Buffer); +} + +void Edif::Runtime::GetApplicationTempPath(TCHAR * Buffer) +{ + callRunTimeFunction(rdPtr, RFUNCTION_GETFILEINFOS, FILEINFO_TEMPPATH, (long) Buffer); +} + +void Edif::Runtime::Redraw() +{ + callRunTimeFunction(rdPtr, RFUNCTION_REDRAW, 0, 0); +} + +void Edif::Runtime::Destroy() +{ + callRunTimeFunction(rdPtr, RFUNCTION_DESTROY, 0, 0); +} + +void Edif::Runtime::ExecuteProgram(prgParam * Program) +{ + callRunTimeFunction(rdPtr, RFUNCTION_EXECPROGRAM, 0, (long) Program); +} + +long Edif::Runtime::EditInteger(EditDebugInfo * EDI) +{ + return callRunTimeFunction(rdPtr, RFUNCTION_EDITINT, 0, (long) EDI); +} + +long Edif::Runtime::EditText(EditDebugInfo * EDI) +{ + return callRunTimeFunction(rdPtr, RFUNCTION_EDITTEXT, 0, (long) EDI); +} + +void Edif::Runtime::CallMovement(int ID, long Parameter) +{ + callRunTimeFunction(rdPtr, RFUNCTION_CALLMOVEMENT, ID, Parameter); +} + +void Edif::Runtime::SetPosition(int X, int Y) +{ + callRunTimeFunction(rdPtr, RFUNCTION_SETPOSITION, X, Y); +} + +CallTables* Edif::Runtime::GetCallTables() +{ + return (CallTables*)callRunTimeFunction(rdPtr, RFUNCTION_GETCALLTABLES, 0, 0); +} + +bool Edif::Runtime::IsHWA() +{ + return rdPtr->rHo.hoAdRunHeader->rh4.rh4Mv->mvCallFunction(NULL, 112, 0, 0, 0) == 1; +} + +bool Edif::Runtime::IsUnicode() +{ + return rdPtr->rHo.hoAdRunHeader->rh4.rh4Mv->mvCallFunction(NULL, 113, 0, 0, 0) == 1; +} + +event &Edif::Runtime::CurrentEvent() +{ + return *(event *) (((char *) param1) - CND_SIZE); +} + +LPRO Edif::Runtime::LPROFromFixed(int fixedvalue) +{ + LPOBL objList = rdPtr->rHo.hoAdRunHeader->rhObjectList; + int index = 0x0000FFFF & fixedvalue; + + if (index < 0 || index >= rdPtr->rHo.hoAdRunHeader->rhMaxObjects) + return NULL; + + LPRO theObject = (LPRO)objList[0x0000FFFF & fixedvalue].oblOffset; + + if (theObject == NULL) + return NULL; + else if (FixedFromLPRO(theObject) != fixedvalue) + return NULL; + + return theObject; +} + +int Edif::Runtime::FixedFromLPRO(LPRO object) +{ + if(object != NULL) + return (object->roHo.hoCreationId << 16) + object->roHo.hoNumber; + return 0; +} + +void Edif::Runtime::SetAngleOfObject(LPRO object, float acAngle) +{ + if(object == NULL) + return; + + if(IsHWA()) + memcpy(&object->roc.rcAngle, (int*)&acAngle, sizeof(int)); + else + object->roc.rcAngle = (int)acAngle; + +} + +extern HINSTANCE hInstLib; + +struct EdifGlobal +{ + TCHAR Name[256]; + void * Value; + + EdifGlobal * Next; +}; + +void Edif::Runtime::WriteGlobal(const TCHAR * Name, void * Value) +{ + LPRH rhPtr = rdPtr->rHo.hoAdRunHeader; + + while(rhPtr->rhApp->m_pParentApp) + rhPtr = rhPtr->rhApp->m_pParentApp->m_Frame->m_rhPtr; + + EdifGlobal * Global = (EdifGlobal *) rhPtr->rh4.rh4Mv->mvGetExtUserData(rhPtr->rhApp, hInstLib); + + if(!Global) + { + Global = new EdifGlobal; + + _tcscpy(Global->Name, Name); + Global->Value = Value; + + Global->Next = 0; + + rhPtr->rh4.rh4Mv->mvSetExtUserData(rhPtr->rhApp, hInstLib, Global); + + return; + } + + while(Global) + { + if(!_tcsicmp(Global->Name, Name)) + { + Global->Value = Value; + return; + } + + if(!Global->Next) + break; + + Global = Global->Next; + } + + Global->Next = new EdifGlobal; + Global = Global->Next; + + _tcscpy(Global->Name, Name); + + Global->Value = Value; + Global->Next = 0; +} + +void * Edif::Runtime::ReadGlobal(const TCHAR * Name) +{ + LPRH rhPtr = rdPtr->rHo.hoAdRunHeader; + + while(rhPtr->rhApp->m_pParentApp) + rhPtr = rhPtr->rhApp->m_pParentApp->m_Frame->m_rhPtr; + + EdifGlobal * Global = (EdifGlobal *) rhPtr->rh4.rh4Mv->mvGetExtUserData(rhPtr->rhApp, hInstLib); + + while(Global) + { + if(!_tcsicmp(Global->Name, Name)) + return Global->Value; + + Global = Global->Next; + } + + return 0; +} + +#ifdef EdifUseJS + + /* Breaking versions of Edif should change these so that newer extensions don't + try to work with an older JS context. */ + + const char * const ContextName = "JSContext-V1"; + + + JSContext * Edif::Runtime::GetJSContext() + { + JSContext * Context = ReadGlobal(ContextName); + + if(!Context) + { + Context = JS_NewContext(JS_NewRuntime(8 * 1024 * 1024), 8192); + + JS_SetOptions(Context, JSOPTION_VAROBJFIX | JSOPTION_JIT | JSOPTION_METHODJIT | JSOPTION_NO_SCRIPT_RVAL); + JS_SetVersion(Context, JSVERSION_LATEST); + + JSObject * Global = JS_NewGlobalObject(context, &GlobalClass); + + JS_SetGlobalObject (Context, Global); + JS_InitStandardClasses(Context, Global); + + WriteGlobal(ContextName, Context); + } + + return Context; + } + +#endif diff --git a/Lib/ObjectSelection.cpp b/Lib/ObjectSelection.cpp index 4b48248..3cdad96 100644 --- a/Lib/ObjectSelection.cpp +++ b/Lib/ObjectSelection.cpp @@ -1,149 +1,149 @@ - -// By Anders Riggelsen (Andos) -// http://community.clickteam.com/showthread.php?t=61672 - -// These files do not match up with the originals - modified for Edif (callbacks inside the extension class, etc..) - -#include "Common.h" - -Riggs::ObjectSelection::ObjectSelection(LPRH rhPtr) -{ - this->rhPtr = rhPtr; - this->ObjectList = rhPtr->rhObjectList; //get a pointer to the mmf object list - this->OiList = rhPtr->rhOiList; //get a pointer to the mmf object info list - this->QualToOiList = rhPtr->rhQualToOiList; //get a pointer to the mmf qualifier to Oi list - oiListItemSize = sizeof(objInfoList); - -//Only add the sizes to the runtime structures if they weren't compiled directly for those runtimes -#ifndef UNICODE - if ( rhPtr->rh4.rh4Mv->mvCallFunction(NULL, EF_ISUNICODE, 0, 0, 0) ) - oiListItemSize += 24; -#endif -#ifndef HWABETA - if ( rhPtr->rh4.rh4Mv->mvCallFunction(NULL, EF_ISHWA, 0, 0, 0) ) - oiListItemSize += sizeof(LPVOID); -#endif -} - -//Selects *all* objects of the given object-type -void Riggs::ObjectSelection::SelectAll(short Oi) -{ - const LPOIL pObjectInfo = GetOILFromOI(Oi); - - pObjectInfo->oilNumOfSelected = pObjectInfo->oilNObjects; - pObjectInfo->oilListSelected = pObjectInfo->oilObject; - pObjectInfo->oilEventCount = rhPtr->rh2.rh2EventCount; - - int i = pObjectInfo->oilObject; - while(i >= 0) - { - LPHO pObject = ObjectList[i].oblOffset; - pObject->hoNextSelected = pObject->hoNumNext; - i = pObject->hoNumNext; - } -} - -//Resets all objects of the given object-type -void Riggs::ObjectSelection::SelectNone(short Oi) -{ - LPOIL pObjectInfo = GetOILFromOI(Oi); - - pObjectInfo->oilNumOfSelected = 0; - pObjectInfo->oilListSelected = -1; - pObjectInfo->oilEventCount = rhPtr->rh2.rh2EventCount; -} - -//Resets the SOL and inserts only one given object -void Riggs::ObjectSelection::SelectOneObject(LPRO object) -{ - LPOIL pObjectInfo = GetOILFromOI(object->roHo.hoOi); - - pObjectInfo->oilNumOfSelected = 1; - pObjectInfo->oilEventCount = rhPtr->rh2.rh2EventCount; - pObjectInfo->oilListSelected = object->roHo.hoNumber; - ObjectList[object->roHo.hoNumber].oblOffset->hoNextSelected = -1; -} - -//Resets the SOL and inserts the given list of objects -void Riggs::ObjectSelection::SelectObjects(short Oi, LPRO* objects, int count) -{ - if(count <= 0) - return; - - LPOIL pObjectInfo = GetOILFromOI(Oi); - - pObjectInfo->oilNumOfSelected = count; - pObjectInfo->oilEventCount = rhPtr->rh2.rh2EventCount; - - short prevNumber = objects[0]->roHo.hoNumber; - pObjectInfo->oilListSelected = prevNumber; - - for(int i=1; iroHo.hoNumber; - ObjectList[prevNumber].oblOffset->hoNextSelected = currentNumber; - prevNumber = currentNumber; - } - ObjectList[prevNumber].oblOffset->hoNextSelected = -1; -} - -//Return the number of selected objects for the given object-type -int Riggs::ObjectSelection::GetNumberOfSelected(short Oi) -{ - if(Oi & 0x8000) - { - Oi &= 0x7FFF; //Mask out the qualifier part - int numberSelected = 0; - - LPQOI CurrentQualToOiStart = (LPQOI)((char*)QualToOiList + Oi); - LPQOI CurrentQualToOi = CurrentQualToOiStart; - - while(CurrentQualToOi->qoiOiList >= 0) - { - LPOIL CurrentOi = GetOILFromOI(CurrentQualToOi->qoiOiList); - numberSelected += CurrentOi->oilNumOfSelected; - CurrentQualToOi = (LPQOI)((char*)CurrentQualToOi + 4); - } - return numberSelected; - } - else - { - LPOIL pObjectInfo = GetOILFromOI(Oi); - return pObjectInfo->oilNumOfSelected; - } -} - -bool Riggs::ObjectSelection::ObjectIsOfType(LPRO object, short Oi) -{ - if(Oi & 0x8000) - { - Oi &= 0x7FFF; //Mask out the qualifier part - LPQOI CurrentQualToOiStart = (LPQOI)((char*)QualToOiList + Oi); - LPQOI CurrentQualToOi = CurrentQualToOiStart; - - while(CurrentQualToOi->qoiOiList >= 0) - { - LPOIL CurrentOi = GetOILFromOI(CurrentQualToOi->qoiOiList); - if(CurrentOi->oilOi == object->roHo.hoOi) - return true; - CurrentQualToOi = (LPQOI)((char*)CurrentQualToOi + 4); - } - return false; - } - else - return (object->roHo.hoOi == Oi); -} - - -//Returns the object-info structure from a given object-type -LPOIL Riggs::ObjectSelection::GetOILFromOI(short Oi) -{ - for(int i=0; irhNumberOi; ++i) - { - LPOIL oil = (LPOIL)(((char*)OiList) + oiListItemSize*i); - if(oil->oilOi == Oi) - return oil; - } - return NULL; -} - + +// By Anders Riggelsen (Andos) +// http://community.clickteam.com/showthread.php?t=61672 + +// These files do not match up with the originals - modified for Edif (callbacks inside the extension class, etc..) + +#include "Common.h" + +Riggs::ObjectSelection::ObjectSelection(LPRH rhPtr) +{ + this->rhPtr = rhPtr; + this->ObjectList = rhPtr->rhObjectList; //get a pointer to the mmf object list + this->OiList = rhPtr->rhOiList; //get a pointer to the mmf object info list + this->QualToOiList = rhPtr->rhQualToOiList; //get a pointer to the mmf qualifier to Oi list + oiListItemSize = sizeof(objInfoList); + +//Only add the sizes to the runtime structures if they weren't compiled directly for those runtimes +#ifndef UNICODE + if ( rhPtr->rh4.rh4Mv->mvCallFunction(NULL, EF_ISUNICODE, 0, 0, 0) ) + oiListItemSize += 24; +#endif +#ifndef HWABETA + if ( rhPtr->rh4.rh4Mv->mvCallFunction(NULL, EF_ISHWA, 0, 0, 0) ) + oiListItemSize += sizeof(LPVOID); +#endif +} + +//Selects *all* objects of the given object-type +void Riggs::ObjectSelection::SelectAll(short Oi) +{ + const LPOIL pObjectInfo = GetOILFromOI(Oi); + + pObjectInfo->oilNumOfSelected = pObjectInfo->oilNObjects; + pObjectInfo->oilListSelected = pObjectInfo->oilObject; + pObjectInfo->oilEventCount = rhPtr->rh2.rh2EventCount; + + int i = pObjectInfo->oilObject; + while(i >= 0) + { + LPHO pObject = ObjectList[i].oblOffset; + pObject->hoNextSelected = pObject->hoNumNext; + i = pObject->hoNumNext; + } +} + +//Resets all objects of the given object-type +void Riggs::ObjectSelection::SelectNone(short Oi) +{ + LPOIL pObjectInfo = GetOILFromOI(Oi); + + pObjectInfo->oilNumOfSelected = 0; + pObjectInfo->oilListSelected = -1; + pObjectInfo->oilEventCount = rhPtr->rh2.rh2EventCount; +} + +//Resets the SOL and inserts only one given object +void Riggs::ObjectSelection::SelectOneObject(LPRO object) +{ + LPOIL pObjectInfo = GetOILFromOI(object->roHo.hoOi); + + pObjectInfo->oilNumOfSelected = 1; + pObjectInfo->oilEventCount = rhPtr->rh2.rh2EventCount; + pObjectInfo->oilListSelected = object->roHo.hoNumber; + ObjectList[object->roHo.hoNumber].oblOffset->hoNextSelected = -1; +} + +//Resets the SOL and inserts the given list of objects +void Riggs::ObjectSelection::SelectObjects(short Oi, LPRO* objects, int count) +{ + if(count <= 0) + return; + + LPOIL pObjectInfo = GetOILFromOI(Oi); + + pObjectInfo->oilNumOfSelected = count; + pObjectInfo->oilEventCount = rhPtr->rh2.rh2EventCount; + + short prevNumber = objects[0]->roHo.hoNumber; + pObjectInfo->oilListSelected = prevNumber; + + for(int i=1; iroHo.hoNumber; + ObjectList[prevNumber].oblOffset->hoNextSelected = currentNumber; + prevNumber = currentNumber; + } + ObjectList[prevNumber].oblOffset->hoNextSelected = -1; +} + +//Return the number of selected objects for the given object-type +int Riggs::ObjectSelection::GetNumberOfSelected(short Oi) +{ + if(Oi & 0x8000) + { + Oi &= 0x7FFF; //Mask out the qualifier part + int numberSelected = 0; + + LPQOI CurrentQualToOiStart = (LPQOI)((char*)QualToOiList + Oi); + LPQOI CurrentQualToOi = CurrentQualToOiStart; + + while(CurrentQualToOi->qoiOiList >= 0) + { + LPOIL CurrentOi = GetOILFromOI(CurrentQualToOi->qoiOiList); + numberSelected += CurrentOi->oilNumOfSelected; + CurrentQualToOi = (LPQOI)((char*)CurrentQualToOi + 4); + } + return numberSelected; + } + else + { + LPOIL pObjectInfo = GetOILFromOI(Oi); + return pObjectInfo->oilNumOfSelected; + } +} + +bool Riggs::ObjectSelection::ObjectIsOfType(LPRO object, short Oi) +{ + if(Oi & 0x8000) + { + Oi &= 0x7FFF; //Mask out the qualifier part + LPQOI CurrentQualToOiStart = (LPQOI)((char*)QualToOiList + Oi); + LPQOI CurrentQualToOi = CurrentQualToOiStart; + + while(CurrentQualToOi->qoiOiList >= 0) + { + LPOIL CurrentOi = GetOILFromOI(CurrentQualToOi->qoiOiList); + if(CurrentOi->oilOi == object->roHo.hoOi) + return true; + CurrentQualToOi = (LPQOI)((char*)CurrentQualToOi + 4); + } + return false; + } + else + return (object->roHo.hoOi == Oi); +} + + +//Returns the object-info structure from a given object-type +LPOIL Riggs::ObjectSelection::GetOILFromOI(short Oi) +{ + for(int i=0; irhNumberOi; ++i) + { + LPOIL oil = (LPOIL)(((char*)OiList) + oiListItemSize*i); + if(oil->oilOi == Oi) + return oil; + } + return NULL; +} + diff --git a/Lib/json.c b/Lib/json.c index 5977952..c19ded7 100644 --- a/Lib/json.c +++ b/Lib/json.c @@ -1,742 +1,742 @@ - -/* vim: set et ts=3 sw=3 ft=c: - * - * Copyright (C) 2012 James McLaughlin et al. All rights reserved. - * https://github.com/udp/json-parser - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "json.h" - -#ifdef _MSC_VER - #ifndef _CRT_SECURE_NO_WARNINGS - #define _CRT_SECURE_NO_WARNINGS - #endif -#endif - -#ifdef __cplusplus - const struct _json_value json_value_none; /* zero-d by ctor */ -#else - const struct _json_value json_value_none = { 0 }; -#endif - -#include -#include -#include -#include - -typedef unsigned short json_uchar; - -static unsigned char hex_value (json_char c) -{ - if (c >= 'A' && c <= 'F') - return (c - 'A') + 10; - - if (c >= 'a' && c <= 'f') - return (c - 'a') + 10; - - if (c >= '0' && c <= '9') - return c - '0'; - - return 0xFF; -} - -typedef struct -{ - json_settings settings; - int first_pass; - - unsigned long used_memory; - - unsigned int uint_max; - unsigned long ulong_max; - -} json_state; - -static void * json_alloc (json_state * state, unsigned long size, int zero) -{ - void * mem; - - if ((state->ulong_max - state->used_memory) < size) - return 0; - - if (state->settings.max_memory - && (state->used_memory += size) > state->settings.max_memory) - { - return 0; - } - - if (! (mem = zero ? calloc (size, 1) : malloc (size))) - return 0; - - return mem; -} - -static int new_value - (json_state * state, json_value ** top, json_value ** root, json_value ** alloc, json_type type) -{ - json_value * value; - int values_size; - - if (!state->first_pass) - { - value = *top = *alloc; - *alloc = (*alloc)->_reserved.next_alloc; - - if (!*root) - *root = value; - - switch (value->type) - { - case json_array: - - if (! (value->u.array.values = (json_value **) json_alloc - (state, value->u.array.length * sizeof (json_value *), 0)) ) - { - return 0; - } - - break; - - case json_object: - - values_size = sizeof (*value->u.object.values) * value->u.object.length; - - if (! ((*(void **) &value->u.object.values) = json_alloc - (state, values_size + ((unsigned long) value->u.object.values), 0)) ) - { - return 0; - } - - value->_reserved.object_mem = (*(char **) &value->u.object.values) + values_size; - - break; - - case json_string: - - if (! (value->u.string.ptr = (json_char *) json_alloc - (state, (value->u.string.length + 1) * sizeof (json_char), 0)) ) - { - return 0; - } - - break; - - default: - break; - }; - - value->u.array.length = 0; - - return 1; - } - - value = (json_value *) json_alloc (state, sizeof (json_value), 1); - - if (!value) - return 0; - - if (!*root) - *root = value; - - value->type = type; - value->parent = *top; - - if (*alloc) - (*alloc)->_reserved.next_alloc = value; - - *alloc = *top = value; - - return 1; -} - -#define e_off \ - ((int) (i - cur_line_begin)) - -#define whitespace \ - case '\n': ++ cur_line; cur_line_begin = i; \ - case ' ': case '\t': case '\r' - -#define string_add(b) \ - do { if (!state.first_pass) string [string_length] = b; ++ string_length; } while (0); - -const static int - flag_next = 1, flag_reproc = 2, flag_need_comma = 4, flag_seek_value = 8, flag_exponent = 16, - flag_got_exponent_sign = 32, flag_escaped = 64, flag_string = 128, flag_need_colon = 256, - flag_done = 512; - -json_value * json_parse_ex (json_settings * settings, const json_char * json, char * error_buf) -{ - json_char error [128]; - unsigned int cur_line; - const json_char * cur_line_begin, * i; - json_value * top, * root, * alloc = 0; - json_state state; - int flags; - - error[0] = '\0'; - - memset (&state, 0, sizeof (json_state)); - memcpy (&state.settings, settings, sizeof (json_settings)); - - memset (&state.uint_max, 0xFF, sizeof (state.uint_max)); - memset (&state.ulong_max, 0xFF, sizeof (state.ulong_max)); - - state.uint_max -= 8; /* limit of how much can be added before next check */ - state.ulong_max -= 8; - - for (state.first_pass = 1; state.first_pass >= 0; -- state.first_pass) - { - json_uchar uchar; - unsigned char uc_b1, uc_b2, uc_b3, uc_b4; - json_char * string; - unsigned int string_length; - - top = root = 0; - flags = flag_seek_value; - - cur_line = 1; - cur_line_begin = json; - - for (i = json ;; ++ i) - { - json_char b = *i; - - if (flags & flag_done) - { - if (!b) - break; - - switch (b) - { - whitespace: - continue; - - default: - sprintf (error, "%d:%d: Trailing garbage: `%c`", cur_line, e_off, b); - goto e_failed; - }; - } - - if (flags & flag_string) - { - if (!b) - { sprintf (error, "Unexpected EOF in string (at %d:%d)", cur_line, e_off); - goto e_failed; - } - - if (string_length > state.uint_max) - goto e_overflow; - - if (flags & flag_escaped) - { - flags &= ~ flag_escaped; - - switch (b) - { - case 'b': string_add ('\b'); break; - case 'f': string_add ('\f'); break; - case 'n': string_add ('\n'); break; - case 'r': string_add ('\r'); break; - case 't': string_add ('\t'); break; - case 'u': - - if ((uc_b1 = hex_value (*++ i)) == 0xFF || (uc_b2 = hex_value (*++ i)) == 0xFF - || (uc_b3 = hex_value (*++ i)) == 0xFF || (uc_b4 = hex_value (*++ i)) == 0xFF) - { - sprintf (error, "Invalid character value `%c` (at %d:%d)", b, cur_line, e_off); - goto e_failed; - } - - uc_b1 = uc_b1 * 16 + uc_b2; - uc_b2 = uc_b3 * 16 + uc_b4; - - uchar = ((json_char) uc_b1) * 256 + uc_b2; - - if (sizeof (json_char) >= sizeof (json_uchar) || (uc_b1 == 0 && uc_b2 <= 0x7F)) - { - string_add ((json_char) uchar); - break; - } - - if (uchar <= 0x7FF) - { - if (state.first_pass) - string_length += 2; - else - { string [string_length ++] = 0xC0 | ((uc_b2 & 0xC0) >> 6) | ((uc_b1 & 0x3) << 3); - string [string_length ++] = 0x80 | (uc_b2 & 0x3F); - } - - break; - } - - if (state.first_pass) - string_length += 3; - else - { string [string_length ++] = 0xE0 | ((uc_b1 & 0xF0) >> 4); - string [string_length ++] = 0x80 | ((uc_b1 & 0xF) << 2) | ((uc_b2 & 0xC0) >> 6); - string [string_length ++] = 0x80 | (uc_b2 & 0x3F); - } - - break; - - default: - string_add (b); - }; - - continue; - } - - if (b == '\\') - { - flags |= flag_escaped; - continue; - } - - if (b == '"') - { - if (!state.first_pass) - string [string_length] = 0; - - flags &= ~ flag_string; - string = 0; - - switch (top->type) - { - case json_string: - - top->u.string.length = string_length; - flags |= flag_next; - - break; - - case json_object: - - if (state.first_pass) - (*(json_char **) &top->u.object.values) += string_length + 1; - else - { - top->u.object.values [top->u.object.length].name - = (json_char *) top->_reserved.object_mem; - - (*(json_char **) &top->_reserved.object_mem) += string_length + 1; - } - - flags |= flag_seek_value | flag_need_colon; - continue; - - default: - break; - }; - } - else - { - string_add (b); - continue; - } - } - - if (flags & flag_seek_value) - { - switch (b) - { - whitespace: - continue; - - case ']': - - if (top->type == json_array) - flags = (flags & ~ (flag_need_comma | flag_seek_value)) | flag_next; - else if (!state.settings.settings & json_relaxed_commas) - { sprintf (error, "%d:%d: Unexpected ]", cur_line, e_off); - goto e_failed; - } - - break; - - default: - - if (flags & flag_need_comma) - { - if (b == ',') - { flags &= ~ flag_need_comma; - continue; - } - else - { sprintf (error, "%d:%d: Expected , before %c", cur_line, e_off, b); - goto e_failed; - } - } - - if (flags & flag_need_colon) - { - if (b == ':') - { flags &= ~ flag_need_colon; - continue; - } - else - { sprintf (error, "%d:%d: Expected : before %c", cur_line, e_off, b); - goto e_failed; - } - } - - flags &= ~ flag_seek_value; - - switch (b) - { - case '{': - - if (!new_value (&state, &top, &root, &alloc, json_object)) - goto e_alloc_failure; - - continue; - - case '[': - - if (!new_value (&state, &top, &root, &alloc, json_array)) - goto e_alloc_failure; - - flags |= flag_seek_value; - continue; - - case '"': - - if (!new_value (&state, &top, &root, &alloc, json_string)) - goto e_alloc_failure; - - flags |= flag_string; - - string = top->u.string.ptr; - string_length = 0; - - continue; - - case 't': - - if (*(++ i) != 'r' || *(++ i) != 'u' || *(++ i) != 'e') - goto e_unknown_value; - - if (!new_value (&state, &top, &root, &alloc, json_boolean)) - goto e_alloc_failure; - - top->u.boolean = 1; - - flags |= flag_next; - break; - - case 'f': - - if (*(++ i) != 'a' || *(++ i) != 'l' || *(++ i) != 's' || *(++ i) != 'e') - goto e_unknown_value; - - if (!new_value (&state, &top, &root, &alloc, json_boolean)) - goto e_alloc_failure; - - flags |= flag_next; - break; - - case 'n': - - if (*(++ i) != 'u' || *(++ i) != 'l' || *(++ i) != 'l') - goto e_unknown_value; - - if (!new_value (&state, &top, &root, &alloc, json_null)) - goto e_alloc_failure; - - flags |= flag_next; - break; - - default: - - if (isdigit (b) || b == '-') - { - if (!new_value (&state, &top, &root, &alloc, json_integer)) - goto e_alloc_failure; - - flags &= ~ (flag_exponent | flag_got_exponent_sign); - - if (state.first_pass) - continue; - - if (top->type == json_double) - top->u.dbl = strtod (i, (json_char **) &i); - else - top->u.integer = strtol (i, (json_char **) &i, 10); - - flags |= flag_next | flag_reproc; - } - else - { sprintf (error, "%d:%d: Unexpected %c when seeking value", cur_line, e_off, b); - goto e_failed; - } - }; - }; - } - else - { - switch (top->type) - { - case json_object: - - switch (b) - { - whitespace: - continue; - - case '"': - - if (flags & flag_need_comma && (!state.settings.settings & json_relaxed_commas)) - { - sprintf (error, "%d:%d: Expected , before \"", cur_line, e_off); - goto e_failed; - } - - flags |= flag_string; - - string = (json_char *) top->_reserved.object_mem; - string_length = 0; - - break; - - case '}': - - flags = (flags & ~ flag_need_comma) | flag_next; - break; - - case ',': - - if (flags & flag_need_comma) - { - flags &= ~ flag_need_comma; - break; - } - - default: - - sprintf (error, "%d:%d: Unexpected `%c` in object", cur_line, e_off, b); - goto e_failed; - }; - - break; - - case json_integer: - case json_double: - - if (isdigit (b)) - continue; - - if (b == 'e' || b == 'E') - { - if (!(flags & flag_exponent)) - { - flags |= flag_exponent; - top->type = json_double; - - continue; - } - } - else if (b == '+' || b == '-') - { - if (flags & flag_exponent && !(flags & flag_got_exponent_sign)) - { - flags |= flag_got_exponent_sign; - continue; - } - } - else if (b == '.' && top->type == json_integer) - { - top->type = json_double; - continue; - } - - flags |= flag_next | flag_reproc; - break; - - default: - break; - }; - } - - if (flags & flag_reproc) - { - flags &= ~ flag_reproc; - -- i; - } - - if (flags & flag_next) - { - flags = (flags & ~ flag_next) | flag_need_comma; - - if (!top->parent) - { - /* root value done */ - - flags |= flag_done; - continue; - } - - if (top->parent->type == json_array) - flags |= flag_seek_value; - - if (!state.first_pass) - { - json_value * parent = top->parent; - - switch (parent->type) - { - case json_object: - - parent->u.object.values - [parent->u.object.length].value = top; - - break; - - case json_array: - - parent->u.array.values - [parent->u.array.length] = top; - - break; - - default: - break; - }; - } - - if ( (++ top->parent->u.array.length) > state.uint_max) - goto e_overflow; - - top = top->parent; - - continue; - } - } - - alloc = root; - } - - return root; - -e_unknown_value: - - sprintf (error, "%d:%d: Unknown value", cur_line, e_off); - goto e_failed; - -e_alloc_failure: - - strcpy (error, "Memory allocation failure"); - goto e_failed; - -e_overflow: - - sprintf (error, "%d:%d: Too long (caught overflow)", cur_line, e_off); - goto e_failed; - -e_failed: - - if (error_buf) - { - if (*error) - strcpy (error_buf, error); - else - strcpy (error_buf, "Unknown error"); - } - - if (state.first_pass) - alloc = root; - - while (alloc) - { - top = alloc->_reserved.next_alloc; - free (alloc); - alloc = top; - } - - if (!state.first_pass) - json_value_free (root); - - return 0; -} - -json_value * json_parse (const json_char * json) -{ - json_settings settings; - memset (&settings, 0, sizeof (json_settings)); - - return json_parse_ex (&settings, json, 0); -} - -void json_value_free (json_value * value) -{ - json_value * cur_value; - - if (!value) - return; - - value->parent = 0; - - while (value) - { - switch (value->type) - { - case json_array: - - if (!value->u.array.length) - { - free (value->u.array.values); - break; - } - - value = value->u.array.values [-- value->u.array.length]; - continue; - - case json_object: - - if (!value->u.object.length) - { - free (value->u.object.values); - break; - } - - value = value->u.object.values [-- value->u.object.length].value; - continue; - - case json_string: - - free (value->u.string.ptr); - break; - - default: - break; - }; - - cur_value = value; - value = value->parent; - free (cur_value); - } -} - - + +/* vim: set et ts=3 sw=3 ft=c: + * + * Copyright (C) 2012 James McLaughlin et al. All rights reserved. + * https://github.com/udp/json-parser + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "json.h" + +#ifdef _MSC_VER + #ifndef _CRT_SECURE_NO_WARNINGS + #define _CRT_SECURE_NO_WARNINGS + #endif +#endif + +#ifdef __cplusplus + const struct _json_value json_value_none; /* zero-d by ctor */ +#else + const struct _json_value json_value_none = { 0 }; +#endif + +#include +#include +#include +#include + +typedef unsigned short json_uchar; + +static unsigned char hex_value (json_char c) +{ + if (c >= 'A' && c <= 'F') + return (c - 'A') + 10; + + if (c >= 'a' && c <= 'f') + return (c - 'a') + 10; + + if (c >= '0' && c <= '9') + return c - '0'; + + return 0xFF; +} + +typedef struct +{ + json_settings settings; + int first_pass; + + unsigned long used_memory; + + unsigned int uint_max; + unsigned long ulong_max; + +} json_state; + +static void * json_alloc (json_state * state, unsigned long size, int zero) +{ + void * mem; + + if ((state->ulong_max - state->used_memory) < size) + return 0; + + if (state->settings.max_memory + && (state->used_memory += size) > state->settings.max_memory) + { + return 0; + } + + if (! (mem = zero ? calloc (size, 1) : malloc (size))) + return 0; + + return mem; +} + +static int new_value + (json_state * state, json_value ** top, json_value ** root, json_value ** alloc, json_type type) +{ + json_value * value; + int values_size; + + if (!state->first_pass) + { + value = *top = *alloc; + *alloc = (*alloc)->_reserved.next_alloc; + + if (!*root) + *root = value; + + switch (value->type) + { + case json_array: + + if (! (value->u.array.values = (json_value **) json_alloc + (state, value->u.array.length * sizeof (json_value *), 0)) ) + { + return 0; + } + + break; + + case json_object: + + values_size = sizeof (*value->u.object.values) * value->u.object.length; + + if (! ((*(void **) &value->u.object.values) = json_alloc + (state, values_size + ((unsigned long) value->u.object.values), 0)) ) + { + return 0; + } + + value->_reserved.object_mem = (*(char **) &value->u.object.values) + values_size; + + break; + + case json_string: + + if (! (value->u.string.ptr = (json_char *) json_alloc + (state, (value->u.string.length + 1) * sizeof (json_char), 0)) ) + { + return 0; + } + + break; + + default: + break; + }; + + value->u.array.length = 0; + + return 1; + } + + value = (json_value *) json_alloc (state, sizeof (json_value), 1); + + if (!value) + return 0; + + if (!*root) + *root = value; + + value->type = type; + value->parent = *top; + + if (*alloc) + (*alloc)->_reserved.next_alloc = value; + + *alloc = *top = value; + + return 1; +} + +#define e_off \ + ((int) (i - cur_line_begin)) + +#define whitespace \ + case '\n': ++ cur_line; cur_line_begin = i; \ + case ' ': case '\t': case '\r' + +#define string_add(b) \ + do { if (!state.first_pass) string [string_length] = b; ++ string_length; } while (0); + +const static int + flag_next = 1, flag_reproc = 2, flag_need_comma = 4, flag_seek_value = 8, flag_exponent = 16, + flag_got_exponent_sign = 32, flag_escaped = 64, flag_string = 128, flag_need_colon = 256, + flag_done = 512; + +json_value * json_parse_ex (json_settings * settings, const json_char * json, char * error_buf) +{ + json_char error [128]; + unsigned int cur_line; + const json_char * cur_line_begin, * i; + json_value * top, * root, * alloc = 0; + json_state state; + int flags; + + error[0] = '\0'; + + memset (&state, 0, sizeof (json_state)); + memcpy (&state.settings, settings, sizeof (json_settings)); + + memset (&state.uint_max, 0xFF, sizeof (state.uint_max)); + memset (&state.ulong_max, 0xFF, sizeof (state.ulong_max)); + + state.uint_max -= 8; /* limit of how much can be added before next check */ + state.ulong_max -= 8; + + for (state.first_pass = 1; state.first_pass >= 0; -- state.first_pass) + { + json_uchar uchar; + unsigned char uc_b1, uc_b2, uc_b3, uc_b4; + json_char * string; + unsigned int string_length; + + top = root = 0; + flags = flag_seek_value; + + cur_line = 1; + cur_line_begin = json; + + for (i = json ;; ++ i) + { + json_char b = *i; + + if (flags & flag_done) + { + if (!b) + break; + + switch (b) + { + whitespace: + continue; + + default: + sprintf (error, "%d:%d: Trailing garbage: `%c`", cur_line, e_off, b); + goto e_failed; + }; + } + + if (flags & flag_string) + { + if (!b) + { sprintf (error, "Unexpected EOF in string (at %d:%d)", cur_line, e_off); + goto e_failed; + } + + if (string_length > state.uint_max) + goto e_overflow; + + if (flags & flag_escaped) + { + flags &= ~ flag_escaped; + + switch (b) + { + case 'b': string_add ('\b'); break; + case 'f': string_add ('\f'); break; + case 'n': string_add ('\n'); break; + case 'r': string_add ('\r'); break; + case 't': string_add ('\t'); break; + case 'u': + + if ((uc_b1 = hex_value (*++ i)) == 0xFF || (uc_b2 = hex_value (*++ i)) == 0xFF + || (uc_b3 = hex_value (*++ i)) == 0xFF || (uc_b4 = hex_value (*++ i)) == 0xFF) + { + sprintf (error, "Invalid character value `%c` (at %d:%d)", b, cur_line, e_off); + goto e_failed; + } + + uc_b1 = uc_b1 * 16 + uc_b2; + uc_b2 = uc_b3 * 16 + uc_b4; + + uchar = ((json_char) uc_b1) * 256 + uc_b2; + + if (sizeof (json_char) >= sizeof (json_uchar) || (uc_b1 == 0 && uc_b2 <= 0x7F)) + { + string_add ((json_char) uchar); + break; + } + + if (uchar <= 0x7FF) + { + if (state.first_pass) + string_length += 2; + else + { string [string_length ++] = 0xC0 | ((uc_b2 & 0xC0) >> 6) | ((uc_b1 & 0x3) << 3); + string [string_length ++] = 0x80 | (uc_b2 & 0x3F); + } + + break; + } + + if (state.first_pass) + string_length += 3; + else + { string [string_length ++] = 0xE0 | ((uc_b1 & 0xF0) >> 4); + string [string_length ++] = 0x80 | ((uc_b1 & 0xF) << 2) | ((uc_b2 & 0xC0) >> 6); + string [string_length ++] = 0x80 | (uc_b2 & 0x3F); + } + + break; + + default: + string_add (b); + }; + + continue; + } + + if (b == '\\') + { + flags |= flag_escaped; + continue; + } + + if (b == '"') + { + if (!state.first_pass) + string [string_length] = 0; + + flags &= ~ flag_string; + string = 0; + + switch (top->type) + { + case json_string: + + top->u.string.length = string_length; + flags |= flag_next; + + break; + + case json_object: + + if (state.first_pass) + (*(json_char **) &top->u.object.values) += string_length + 1; + else + { + top->u.object.values [top->u.object.length].name + = (json_char *) top->_reserved.object_mem; + + (*(json_char **) &top->_reserved.object_mem) += string_length + 1; + } + + flags |= flag_seek_value | flag_need_colon; + continue; + + default: + break; + }; + } + else + { + string_add (b); + continue; + } + } + + if (flags & flag_seek_value) + { + switch (b) + { + whitespace: + continue; + + case ']': + + if (top->type == json_array) + flags = (flags & ~ (flag_need_comma | flag_seek_value)) | flag_next; + else if (!state.settings.settings & json_relaxed_commas) + { sprintf (error, "%d:%d: Unexpected ]", cur_line, e_off); + goto e_failed; + } + + break; + + default: + + if (flags & flag_need_comma) + { + if (b == ',') + { flags &= ~ flag_need_comma; + continue; + } + else + { sprintf (error, "%d:%d: Expected , before %c", cur_line, e_off, b); + goto e_failed; + } + } + + if (flags & flag_need_colon) + { + if (b == ':') + { flags &= ~ flag_need_colon; + continue; + } + else + { sprintf (error, "%d:%d: Expected : before %c", cur_line, e_off, b); + goto e_failed; + } + } + + flags &= ~ flag_seek_value; + + switch (b) + { + case '{': + + if (!new_value (&state, &top, &root, &alloc, json_object)) + goto e_alloc_failure; + + continue; + + case '[': + + if (!new_value (&state, &top, &root, &alloc, json_array)) + goto e_alloc_failure; + + flags |= flag_seek_value; + continue; + + case '"': + + if (!new_value (&state, &top, &root, &alloc, json_string)) + goto e_alloc_failure; + + flags |= flag_string; + + string = top->u.string.ptr; + string_length = 0; + + continue; + + case 't': + + if (*(++ i) != 'r' || *(++ i) != 'u' || *(++ i) != 'e') + goto e_unknown_value; + + if (!new_value (&state, &top, &root, &alloc, json_boolean)) + goto e_alloc_failure; + + top->u.boolean = 1; + + flags |= flag_next; + break; + + case 'f': + + if (*(++ i) != 'a' || *(++ i) != 'l' || *(++ i) != 's' || *(++ i) != 'e') + goto e_unknown_value; + + if (!new_value (&state, &top, &root, &alloc, json_boolean)) + goto e_alloc_failure; + + flags |= flag_next; + break; + + case 'n': + + if (*(++ i) != 'u' || *(++ i) != 'l' || *(++ i) != 'l') + goto e_unknown_value; + + if (!new_value (&state, &top, &root, &alloc, json_null)) + goto e_alloc_failure; + + flags |= flag_next; + break; + + default: + + if (isdigit (b) || b == '-') + { + if (!new_value (&state, &top, &root, &alloc, json_integer)) + goto e_alloc_failure; + + flags &= ~ (flag_exponent | flag_got_exponent_sign); + + if (state.first_pass) + continue; + + if (top->type == json_double) + top->u.dbl = strtod (i, (json_char **) &i); + else + top->u.integer = strtol (i, (json_char **) &i, 10); + + flags |= flag_next | flag_reproc; + } + else + { sprintf (error, "%d:%d: Unexpected %c when seeking value", cur_line, e_off, b); + goto e_failed; + } + }; + }; + } + else + { + switch (top->type) + { + case json_object: + + switch (b) + { + whitespace: + continue; + + case '"': + + if (flags & flag_need_comma && (!state.settings.settings & json_relaxed_commas)) + { + sprintf (error, "%d:%d: Expected , before \"", cur_line, e_off); + goto e_failed; + } + + flags |= flag_string; + + string = (json_char *) top->_reserved.object_mem; + string_length = 0; + + break; + + case '}': + + flags = (flags & ~ flag_need_comma) | flag_next; + break; + + case ',': + + if (flags & flag_need_comma) + { + flags &= ~ flag_need_comma; + break; + } + + default: + + sprintf (error, "%d:%d: Unexpected `%c` in object", cur_line, e_off, b); + goto e_failed; + }; + + break; + + case json_integer: + case json_double: + + if (isdigit (b)) + continue; + + if (b == 'e' || b == 'E') + { + if (!(flags & flag_exponent)) + { + flags |= flag_exponent; + top->type = json_double; + + continue; + } + } + else if (b == '+' || b == '-') + { + if (flags & flag_exponent && !(flags & flag_got_exponent_sign)) + { + flags |= flag_got_exponent_sign; + continue; + } + } + else if (b == '.' && top->type == json_integer) + { + top->type = json_double; + continue; + } + + flags |= flag_next | flag_reproc; + break; + + default: + break; + }; + } + + if (flags & flag_reproc) + { + flags &= ~ flag_reproc; + -- i; + } + + if (flags & flag_next) + { + flags = (flags & ~ flag_next) | flag_need_comma; + + if (!top->parent) + { + /* root value done */ + + flags |= flag_done; + continue; + } + + if (top->parent->type == json_array) + flags |= flag_seek_value; + + if (!state.first_pass) + { + json_value * parent = top->parent; + + switch (parent->type) + { + case json_object: + + parent->u.object.values + [parent->u.object.length].value = top; + + break; + + case json_array: + + parent->u.array.values + [parent->u.array.length] = top; + + break; + + default: + break; + }; + } + + if ( (++ top->parent->u.array.length) > state.uint_max) + goto e_overflow; + + top = top->parent; + + continue; + } + } + + alloc = root; + } + + return root; + +e_unknown_value: + + sprintf (error, "%d:%d: Unknown value", cur_line, e_off); + goto e_failed; + +e_alloc_failure: + + strcpy (error, "Memory allocation failure"); + goto e_failed; + +e_overflow: + + sprintf (error, "%d:%d: Too long (caught overflow)", cur_line, e_off); + goto e_failed; + +e_failed: + + if (error_buf) + { + if (*error) + strcpy (error_buf, error); + else + strcpy (error_buf, "Unknown error"); + } + + if (state.first_pass) + alloc = root; + + while (alloc) + { + top = alloc->_reserved.next_alloc; + free (alloc); + alloc = top; + } + + if (!state.first_pass) + json_value_free (root); + + return 0; +} + +json_value * json_parse (const json_char * json) +{ + json_settings settings; + memset (&settings, 0, sizeof (json_settings)); + + return json_parse_ex (&settings, json, 0); +} + +void json_value_free (json_value * value) +{ + json_value * cur_value; + + if (!value) + return; + + value->parent = 0; + + while (value) + { + switch (value->type) + { + case json_array: + + if (!value->u.array.length) + { + free (value->u.array.values); + break; + } + + value = value->u.array.values [-- value->u.array.length]; + continue; + + case json_object: + + if (!value->u.object.length) + { + free (value->u.object.values); + break; + } + + value = value->u.object.values [-- value->u.object.length].value; + continue; + + case json_string: + + free (value->u.string.ptr); + break; + + default: + break; + }; + + cur_value = value; + value = value->parent; + free (cur_value); + } +} + + From f661976106d91d400703726e0a96a56ce973451c Mon Sep 17 00:00:00 2001 From: LB Date: Wed, 24 Oct 2012 20:30:13 -0500 Subject: [PATCH 016/127] Fix Command-Line Warning D9007 --- Extensions/Template/Template.vcproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index 814f349..f8c9b5d 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -53,7 +53,7 @@ AdditionalIncludeDirectories="..\..\Inc, .\" PreprocessorDefinitions="COXSDK, IN_EXT_VERSION2, _CRT_SECURE_NO_WARNINGS, _CRT_SECURE_NO_DEPRECATE, _WINDOWS,EDITOR" StringPooling="true" - MinimalRebuild="true" + MinimalRebuild="false" ExceptionHandling="1" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -256,7 +256,7 @@ AdditionalIncludeDirectories="..\..\Inc, .\" PreprocessorDefinitions="HWABETA,COXSDK, IN_EXT_VERSION2, _CRT_SECURE_NO_WARNINGS, _CRT_SECURE_NO_DEPRECATE, _WINDOWS,RUN_ONLY" StringPooling="true" - MinimalRebuild="true" + MinimalRebuild="false" ExceptionHandling="1" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -460,7 +460,7 @@ AdditionalIncludeDirectories="..\..\Inc, .\" PreprocessorDefinitions="COXSDK, IN_EXT_VERSION2, _CRT_SECURE_NO_WARNINGS, _CRT_SECURE_NO_DEPRECATE, _WINDOWS,EDITOR" StringPooling="true" - MinimalRebuild="true" + MinimalRebuild="false" ExceptionHandling="1" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -563,7 +563,7 @@ AdditionalIncludeDirectories="..\..\Inc, .\" PreprocessorDefinitions="COXSDK, IN_EXT_VERSION2, _CRT_SECURE_NO_WARNINGS, _CRT_SECURE_NO_DEPRECATE, _WINDOWS,RUN_ONLY" StringPooling="true" - MinimalRebuild="true" + MinimalRebuild="false" ExceptionHandling="1" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -767,7 +767,7 @@ AdditionalIncludeDirectories="..\..\Inc, .\" PreprocessorDefinitions="HWABETA,COXSDK, IN_EXT_VERSION2, _CRT_SECURE_NO_WARNINGS, _CRT_SECURE_NO_DEPRECATE, _WINDOWS,EDITOR" StringPooling="true" - MinimalRebuild="true" + MinimalRebuild="false" ExceptionHandling="1" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -869,7 +869,7 @@ AdditionalIncludeDirectories="..\..\Inc, .\" PreprocessorDefinitions="COXSDK, IN_EXT_VERSION2, _CRT_SECURE_NO_WARNINGS, _CRT_SECURE_NO_DEPRECATE, _WINDOWS,RUN_ONLY" StringPooling="true" - MinimalRebuild="true" + MinimalRebuild="false" ExceptionHandling="1" RuntimeLibrary="0" EnableFunctionLevelLinking="true" From 8787547861a8bae1bfbfd2e5f19c2af383a8ef95 Mon Sep 17 00:00:00 2001 From: LB Date: Wed, 24 Oct 2012 21:01:39 -0500 Subject: [PATCH 017/127] Make it 9 times easier to change the ext filename BuildSettings.vsprops applies to all build configurations and currently defines the MFX_Name macro (default "Template.mfx"), which can be changed in this one file to reflect among all the build configurations. --- Extensions/Template/BuildSettings.vsprops | 12 +++++++ Extensions/Template/Template.vcproj | 40 +++++++++++++---------- 2 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 Extensions/Template/BuildSettings.vsprops diff --git a/Extensions/Template/BuildSettings.vsprops b/Extensions/Template/BuildSettings.vsprops new file mode 100644 index 0000000..4e0f2a1 --- /dev/null +++ b/Extensions/Template/BuildSettings.vsprops @@ -0,0 +1,12 @@ + + + + diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index f8c9b5d..737063f 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -20,7 +20,7 @@ OutputDirectory=".\ReleaseEditor" IntermediateDirectory=".\ReleaseEditor" ConfigurationType="2" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + InheritedPropertySheets=".\BuildSettings.vsprops" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" CharacterSet="0" @@ -80,7 +80,7 @@ @@ -283,7 +283,7 @@ @@ -896,7 +896,7 @@ + + From 12c9527f0d825aa5271e629646d25dd7d6a52d65 Mon Sep 17 00:00:00 2001 From: LB Date: Wed, 24 Oct 2012 21:39:04 -0500 Subject: [PATCH 018/127] Adjust Template.mfx message, put ObjSel in Riggs The message displayed when inserting an EDIF extension named Template.mfx now includes proper instructions for renaming the MFX. In the project tree view, ObjectSelection.h/.cpp are in a Riggs folder now (based on the namespace they are in). --- Extensions/Template/Template.vcproj | 20 ++++++++++++-------- Lib/Edif.cpp | 7 ++++--- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index 737063f..dde7549 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -1512,14 +1512,6 @@ RelativePath="..\..\Inc\ImgFlt.h" > - - - - @@ -1592,6 +1584,18 @@ + + + + + + diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index acb2025..6b01977 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -65,9 +65,10 @@ void Edif::Init(mv * _far mV, LPEDATA edPtr) if(_tcscmp(MFXName, _T("Template")) == 0) { MessageBox(0, _T("You forgot to change the MFX filename" - " in the project settings!\nChange the" - " output path in the linker options for" - " each build configuration."), _T("EDIF extension named Template.mfx"), MB_OK); + " in BuildSettings.vsprops!\nChange the" + " \"Template.mfx\" filename to whatever" + " filename you want (spaces/underscores" + " only, please)."), _T("EDIF extension named Template.mfx"), MB_OK); } } From 16bbf6af0d6104cfd08d0595bc7d37878c3c38e3 Mon Sep 17 00:00:00 2001 From: LB Date: Thu, 25 Oct 2012 07:57:07 -0500 Subject: [PATCH 019/127] Exclude filename check from runtime MFX --- Lib/Edif.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 6b01977..0f35fc3 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -58,6 +58,7 @@ void Edif::Init(mv * _far mV, LPEDATA edPtr) mvInvalidateObject(mV, edPtr); +#ifndef RUN_ONLY TCHAR MFXPath[_MAX_PATH]; GetModuleFileName(hInstLib, MFXPath, _MAX_PATH); TCHAR MFXName[_MAX_FNAME]; @@ -70,6 +71,7 @@ void Edif::Init(mv * _far mV, LPEDATA edPtr) " filename you want (spaces/underscores" " only, please)."), _T("EDIF extension named Template.mfx"), MB_OK); } +#endif } void Edif::Free(mv * _far mV) From 098dff25ae9430e46ca973697d89506662148eb1 Mon Sep 17 00:00:00 2001 From: LB Date: Sat, 27 Oct 2012 21:12:57 -0500 Subject: [PATCH 020/127] "when the click" -> "when they click" --- Extensions/Template/Properties.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extensions/Template/Properties.cpp b/Extensions/Template/Properties.cpp index a29e0c5..96490c6 100644 --- a/Extensions/Template/Properties.cpp +++ b/Extensions/Template/Properties.cpp @@ -239,7 +239,7 @@ void MMF2Func SetPropCheck(mv *mV, SerializedED *SED, UINT PropID, BOOL Ticked) * If you use a button proeprty or a * property that has a button, then * you would be impolite to ignore - * the user when the click on that + * the user when they click on that * button. Here is where you respond * to that button press e.g. with * a dialog. From bbf2286dc434154451c0c64f2108ee31c8467b8d Mon Sep 17 00:00:00 2001 From: LB Date: Sun, 28 Oct 2012 12:47:46 -0500 Subject: [PATCH 021/127] hInstLib is already declared in Edif.h --- Lib/Edif.Runtime.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Lib/Edif.Runtime.cpp b/Lib/Edif.Runtime.cpp index 854d95c..52c966a 100644 --- a/Lib/Edif.Runtime.cpp +++ b/Lib/Edif.Runtime.cpp @@ -168,8 +168,6 @@ void Edif::Runtime::SetAngleOfObject(LPRO object, float acAngle) } -extern HINSTANCE hInstLib; - struct EdifGlobal { TCHAR Name[256]; From 88ae24e1cb6b32ce4fb0e0cd8041dfb6799118f9 Mon Sep 17 00:00:00 2001 From: LB Date: Sun, 28 Oct 2012 18:02:03 -0500 Subject: [PATCH 022/127] Update json-parser I need to find a way to have it be automated... --- Inc/json.h | 144 ++++---- Lib/json.c | 1046 ++++++++++++++++++++++++++++------------------------ 2 files changed, 638 insertions(+), 552 deletions(-) diff --git a/Inc/json.h b/Inc/json.h index 1ef0fb4..cbddc69 100644 --- a/Inc/json.h +++ b/Inc/json.h @@ -76,43 +76,43 @@ typedef struct _json_value union { - int boolean; - long integer; - double dbl; + int boolean; + long integer; + double dbl; - struct - { - unsigned int length; - json_char * ptr; /* null terminated */ + struct + { + unsigned int length; + json_char * ptr; /* null terminated */ - } string; + } string; - struct - { - unsigned int length; + struct + { + unsigned int length; - struct - { - json_char * name; - struct _json_value * value; + struct + { + json_char * name; + struct _json_value * value; - } * values; + } * values; - } object; + } object; - struct - { - unsigned int length; - struct _json_value ** values; + struct + { + unsigned int length; + struct _json_value ** values; - } array; + } array; } u; union { - struct _json_value * next_alloc; - void * object_mem; + struct _json_value * next_alloc; + void * object_mem; } _reserved; @@ -121,54 +121,54 @@ typedef struct _json_value #ifdef __cplusplus - public: - - inline _json_value () - { memset (this, 0, sizeof (_json_value)); - } - - inline const struct _json_value &operator [] (int index) const - { - if (type != json_array || index < 0 - || ((unsigned int) index) >= u.array.length) - { - return json_value_none; - } - - return *u.array.values [index]; - } - - inline const struct _json_value &operator [] (const char * index) const - { - if (type != json_object) - return json_value_none; - - for (unsigned int i = 0; i < u.object.length; ++ i) - if (!strcmp (u.object.values [i].name, index)) - return *u.object.values [i].value; - - return json_value_none; - } - - inline operator const char * () const - { - switch (type) - { - case json_string: - return u.string.ptr; - - default: - return ""; - }; - } - - inline operator long () const - { return u.integer; - } - - inline operator bool () const - { return u.boolean != 0; - } + public: + + inline _json_value () + { memset (this, 0, sizeof (_json_value)); + } + + inline const struct _json_value &operator [] (int index) const + { + if (type != json_array || index < 0 + || ((unsigned int) index) >= u.array.length) + { + return json_value_none; + } + + return *u.array.values [index]; + } + + inline const struct _json_value &operator [] (const char * index) const + { + if (type != json_object) + return json_value_none; + + for (unsigned int i = 0; i < u.object.length; ++ i) + if (!strcmp (u.object.values [i].name, index)) + return *u.object.values [i].value; + + return json_value_none; + } + + inline operator const char * () const + { + switch (type) + { + case json_string: + return u.string.ptr; + + default: + return ""; + }; + } + + inline operator long () const + { return u.integer; + } + + inline operator bool () const + { return u.boolean != 0; + } #endif diff --git a/Lib/json.c b/Lib/json.c index c19ded7..55b7e38 100644 --- a/Lib/json.c +++ b/Lib/json.c @@ -32,7 +32,7 @@ #ifdef _MSC_VER #ifndef _CRT_SECURE_NO_WARNINGS - #define _CRT_SECURE_NO_WARNINGS + #define _CRT_SECURE_NO_WARNINGS #endif #endif @@ -46,19 +46,20 @@ #include #include #include +#include typedef unsigned short json_uchar; static unsigned char hex_value (json_char c) { if (c >= 'A' && c <= 'F') - return (c - 'A') + 10; + return (c - 'A') + 10; if (c >= 'a' && c <= 'f') - return (c - 'a') + 10; + return (c - 'a') + 10; if (c >= '0' && c <= '9') - return c - '0'; + return c - '0'; return 0xFF; } @@ -80,16 +81,16 @@ static void * json_alloc (json_state * state, unsigned long size, int zero) void * mem; if ((state->ulong_max - state->used_memory) < size) - return 0; + return 0; if (state->settings.max_memory - && (state->used_memory += size) > state->settings.max_memory) + && (state->used_memory += size) > state->settings.max_memory) { - return 0; + return 0; } if (! (mem = zero ? calloc (size, 1) : malloc (size))) - return 0; + return 0; return mem; } @@ -102,70 +103,71 @@ static int new_value if (!state->first_pass) { - value = *top = *alloc; - *alloc = (*alloc)->_reserved.next_alloc; + value = *top = *alloc; + *alloc = (*alloc)->_reserved.next_alloc; - if (!*root) - *root = value; + if (!*root) + *root = value; - switch (value->type) - { - case json_array: + switch (value->type) + { + case json_array: - if (! (value->u.array.values = (json_value **) json_alloc - (state, value->u.array.length * sizeof (json_value *), 0)) ) - { - return 0; - } + if (! (value->u.array.values = (json_value **) json_alloc + (state, value->u.array.length * sizeof (json_value *), 0)) ) + { + return 0; + } - break; + value->u.array.length = 0; + break; - case json_object: + case json_object: - values_size = sizeof (*value->u.object.values) * value->u.object.length; + values_size = sizeof (*value->u.object.values) * value->u.object.length; - if (! ((*(void **) &value->u.object.values) = json_alloc - (state, values_size + ((unsigned long) value->u.object.values), 0)) ) - { - return 0; - } + if (! ((*(void **) &value->u.object.values) = json_alloc + (state, values_size + ((unsigned long) value->u.object.values), 0)) ) + { + return 0; + } - value->_reserved.object_mem = (*(char **) &value->u.object.values) + values_size; + value->_reserved.object_mem = (*(char **) &value->u.object.values) + values_size; - break; + value->u.object.length = 0; + break; - case json_string: + case json_string: - if (! (value->u.string.ptr = (json_char *) json_alloc - (state, (value->u.string.length + 1) * sizeof (json_char), 0)) ) - { - return 0; - } + if (! (value->u.string.ptr = (json_char *) json_alloc + (state, (value->u.string.length + 1) * sizeof (json_char), 0)) ) + { + return 0; + } - break; + value->u.string.length = 0; + break; - default: - break; - }; + default: + break; + }; - value->u.array.length = 0; - - return 1; + return 1; } value = (json_value *) json_alloc (state, sizeof (json_value), 1); if (!value) - return 0; + return 0; if (!*root) - *root = value; + *root = value; value->type = type; value->parent = *top; if (*alloc) - (*alloc)->_reserved.next_alloc = value; + (*alloc)->_reserved.next_alloc = value; *alloc = *top = value; @@ -183,9 +185,10 @@ static int new_value do { if (!state.first_pass) string [string_length] = b; ++ string_length; } while (0); const static int - flag_next = 1, flag_reproc = 2, flag_need_comma = 4, flag_seek_value = 8, flag_exponent = 16, - flag_got_exponent_sign = 32, flag_escaped = 64, flag_string = 128, flag_need_colon = 256, - flag_done = 512; + flag_next = 1, flag_reproc = 2, flag_need_comma = 4, flag_seek_value = 8, + flag_escaped = 16, flag_string = 32, flag_need_colon = 64, flag_done = 128, + flag_num_negative = 256, flag_num_e = 512, flag_num_e_got_sign = 1024, + flag_num_e_negative = 2048; json_value * json_parse_ex (json_settings * settings, const json_char * json, char * error_buf) { @@ -195,6 +198,7 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch json_value * top, * root, * alloc = 0; json_state state; int flags; + long num_digits, num_fraction, num_e; error[0] = '\0'; @@ -209,433 +213,516 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch for (state.first_pass = 1; state.first_pass >= 0; -- state.first_pass) { - json_uchar uchar; - unsigned char uc_b1, uc_b2, uc_b3, uc_b4; - json_char * string; - unsigned int string_length; - - top = root = 0; - flags = flag_seek_value; - - cur_line = 1; - cur_line_begin = json; - - for (i = json ;; ++ i) - { - json_char b = *i; - - if (flags & flag_done) - { - if (!b) - break; - - switch (b) - { - whitespace: - continue; - - default: - sprintf (error, "%d:%d: Trailing garbage: `%c`", cur_line, e_off, b); - goto e_failed; - }; - } - - if (flags & flag_string) - { - if (!b) - { sprintf (error, "Unexpected EOF in string (at %d:%d)", cur_line, e_off); - goto e_failed; - } - - if (string_length > state.uint_max) - goto e_overflow; - - if (flags & flag_escaped) - { - flags &= ~ flag_escaped; - - switch (b) - { - case 'b': string_add ('\b'); break; - case 'f': string_add ('\f'); break; - case 'n': string_add ('\n'); break; - case 'r': string_add ('\r'); break; - case 't': string_add ('\t'); break; - case 'u': - - if ((uc_b1 = hex_value (*++ i)) == 0xFF || (uc_b2 = hex_value (*++ i)) == 0xFF - || (uc_b3 = hex_value (*++ i)) == 0xFF || (uc_b4 = hex_value (*++ i)) == 0xFF) - { - sprintf (error, "Invalid character value `%c` (at %d:%d)", b, cur_line, e_off); - goto e_failed; - } - - uc_b1 = uc_b1 * 16 + uc_b2; - uc_b2 = uc_b3 * 16 + uc_b4; - - uchar = ((json_char) uc_b1) * 256 + uc_b2; - - if (sizeof (json_char) >= sizeof (json_uchar) || (uc_b1 == 0 && uc_b2 <= 0x7F)) - { - string_add ((json_char) uchar); - break; - } - - if (uchar <= 0x7FF) - { - if (state.first_pass) - string_length += 2; - else - { string [string_length ++] = 0xC0 | ((uc_b2 & 0xC0) >> 6) | ((uc_b1 & 0x3) << 3); - string [string_length ++] = 0x80 | (uc_b2 & 0x3F); - } - - break; - } - - if (state.first_pass) - string_length += 3; - else - { string [string_length ++] = 0xE0 | ((uc_b1 & 0xF0) >> 4); - string [string_length ++] = 0x80 | ((uc_b1 & 0xF) << 2) | ((uc_b2 & 0xC0) >> 6); - string [string_length ++] = 0x80 | (uc_b2 & 0x3F); - } - - break; - - default: - string_add (b); - }; - - continue; - } - - if (b == '\\') - { - flags |= flag_escaped; - continue; - } - - if (b == '"') - { - if (!state.first_pass) - string [string_length] = 0; - - flags &= ~ flag_string; - string = 0; - - switch (top->type) - { - case json_string: - - top->u.string.length = string_length; - flags |= flag_next; - - break; - - case json_object: - - if (state.first_pass) - (*(json_char **) &top->u.object.values) += string_length + 1; - else - { - top->u.object.values [top->u.object.length].name - = (json_char *) top->_reserved.object_mem; - - (*(json_char **) &top->_reserved.object_mem) += string_length + 1; - } - - flags |= flag_seek_value | flag_need_colon; - continue; - - default: - break; - }; - } - else - { - string_add (b); - continue; - } - } - - if (flags & flag_seek_value) - { - switch (b) - { - whitespace: - continue; - - case ']': - - if (top->type == json_array) - flags = (flags & ~ (flag_need_comma | flag_seek_value)) | flag_next; - else if (!state.settings.settings & json_relaxed_commas) - { sprintf (error, "%d:%d: Unexpected ]", cur_line, e_off); - goto e_failed; - } - - break; - - default: - - if (flags & flag_need_comma) - { - if (b == ',') - { flags &= ~ flag_need_comma; - continue; - } - else - { sprintf (error, "%d:%d: Expected , before %c", cur_line, e_off, b); - goto e_failed; - } - } - - if (flags & flag_need_colon) - { - if (b == ':') - { flags &= ~ flag_need_colon; - continue; - } - else - { sprintf (error, "%d:%d: Expected : before %c", cur_line, e_off, b); - goto e_failed; - } - } - - flags &= ~ flag_seek_value; - - switch (b) - { - case '{': - - if (!new_value (&state, &top, &root, &alloc, json_object)) - goto e_alloc_failure; - - continue; + json_uchar uchar; + unsigned char uc_b1, uc_b2, uc_b3, uc_b4; + json_char * string; + unsigned int string_length; + + top = root = 0; + flags = flag_seek_value; + + cur_line = 1; + cur_line_begin = json; + + for (i = json ;; ++ i) + { + json_char b = *i; + + if (flags & flag_done) + { + if (!b) + break; + + switch (b) + { + whitespace: + continue; + + default: + sprintf (error, "%d:%d: Trailing garbage: `%c`", cur_line, e_off, b); + goto e_failed; + }; + } + + if (flags & flag_string) + { + if (!b) + { sprintf (error, "Unexpected EOF in string (at %d:%d)", cur_line, e_off); + goto e_failed; + } + + if (string_length > state.uint_max) + goto e_overflow; + + if (flags & flag_escaped) + { + flags &= ~ flag_escaped; + + switch (b) + { + case 'b': string_add ('\b'); break; + case 'f': string_add ('\f'); break; + case 'n': string_add ('\n'); break; + case 'r': string_add ('\r'); break; + case 't': string_add ('\t'); break; + case 'u': + + if ((uc_b1 = hex_value (*++ i)) == 0xFF || (uc_b2 = hex_value (*++ i)) == 0xFF + || (uc_b3 = hex_value (*++ i)) == 0xFF || (uc_b4 = hex_value (*++ i)) == 0xFF) + { + sprintf (error, "Invalid character value `%c` (at %d:%d)", b, cur_line, e_off); + goto e_failed; + } + + uc_b1 = uc_b1 * 16 + uc_b2; + uc_b2 = uc_b3 * 16 + uc_b4; + + uchar = ((json_char) uc_b1) * 256 + uc_b2; + + if (sizeof (json_char) >= sizeof (json_uchar) || (uc_b1 == 0 && uc_b2 <= 0x7F)) + { + string_add ((json_char) uchar); + break; + } + + if (uchar <= 0x7FF) + { + if (state.first_pass) + string_length += 2; + else + { string [string_length ++] = 0xC0 | ((uc_b2 & 0xC0) >> 6) | ((uc_b1 & 0x3) << 3); + string [string_length ++] = 0x80 | (uc_b2 & 0x3F); + } + + break; + } + + if (state.first_pass) + string_length += 3; + else + { string [string_length ++] = 0xE0 | ((uc_b1 & 0xF0) >> 4); + string [string_length ++] = 0x80 | ((uc_b1 & 0xF) << 2) | ((uc_b2 & 0xC0) >> 6); + string [string_length ++] = 0x80 | (uc_b2 & 0x3F); + } + + break; + + default: + string_add (b); + }; + + continue; + } + + if (b == '\\') + { + flags |= flag_escaped; + continue; + } + + if (b == '"') + { + if (!state.first_pass) + string [string_length] = 0; + + flags &= ~ flag_string; + string = 0; + + switch (top->type) + { + case json_string: + + top->u.string.length = string_length; + flags |= flag_next; + + break; + + case json_object: + + if (state.first_pass) + (*(json_char **) &top->u.object.values) += string_length + 1; + else + { + top->u.object.values [top->u.object.length].name + = (json_char *) top->_reserved.object_mem; + + (*(json_char **) &top->_reserved.object_mem) += string_length + 1; + } + + flags |= flag_seek_value | flag_need_colon; + continue; + + default: + break; + }; + } + else + { + string_add (b); + continue; + } + } - case '[': + if (flags & flag_seek_value) + { + switch (b) + { + whitespace: + continue; - if (!new_value (&state, &top, &root, &alloc, json_array)) - goto e_alloc_failure; + case ']': - flags |= flag_seek_value; - continue; + if (top->type == json_array) + flags = (flags & ~ (flag_need_comma | flag_seek_value)) | flag_next; + else if (!state.settings.settings & json_relaxed_commas) + { sprintf (error, "%d:%d: Unexpected ]", cur_line, e_off); + goto e_failed; + } - case '"': + break; - if (!new_value (&state, &top, &root, &alloc, json_string)) - goto e_alloc_failure; + default: - flags |= flag_string; + if (flags & flag_need_comma) + { + if (b == ',') + { flags &= ~ flag_need_comma; + continue; + } + else + { sprintf (error, "%d:%d: Expected , before %c", cur_line, e_off, b); + goto e_failed; + } + } - string = top->u.string.ptr; - string_length = 0; + if (flags & flag_need_colon) + { + if (b == ':') + { flags &= ~ flag_need_colon; + continue; + } + else + { sprintf (error, "%d:%d: Expected : before %c", cur_line, e_off, b); + goto e_failed; + } + } - continue; + flags &= ~ flag_seek_value; - case 't': + switch (b) + { + case '{': - if (*(++ i) != 'r' || *(++ i) != 'u' || *(++ i) != 'e') - goto e_unknown_value; + if (!new_value (&state, &top, &root, &alloc, json_object)) + goto e_alloc_failure; - if (!new_value (&state, &top, &root, &alloc, json_boolean)) - goto e_alloc_failure; + continue; - top->u.boolean = 1; + case '[': - flags |= flag_next; - break; + if (!new_value (&state, &top, &root, &alloc, json_array)) + goto e_alloc_failure; + + flags |= flag_seek_value; + continue; + + case '"': - case 'f': + if (!new_value (&state, &top, &root, &alloc, json_string)) + goto e_alloc_failure; + + flags |= flag_string; + + string = top->u.string.ptr; + string_length = 0; + + continue; + + case 't': + + if (*(++ i) != 'r' || *(++ i) != 'u' || *(++ i) != 'e') + goto e_unknown_value; + + if (!new_value (&state, &top, &root, &alloc, json_boolean)) + goto e_alloc_failure; - if (*(++ i) != 'a' || *(++ i) != 'l' || *(++ i) != 's' || *(++ i) != 'e') - goto e_unknown_value; + top->u.boolean = 1; - if (!new_value (&state, &top, &root, &alloc, json_boolean)) - goto e_alloc_failure; + flags |= flag_next; + break; + + case 'f': + + if (*(++ i) != 'a' || *(++ i) != 'l' || *(++ i) != 's' || *(++ i) != 'e') + goto e_unknown_value; - flags |= flag_next; - break; + if (!new_value (&state, &top, &root, &alloc, json_boolean)) + goto e_alloc_failure; - case 'n': + flags |= flag_next; + break; - if (*(++ i) != 'u' || *(++ i) != 'l' || *(++ i) != 'l') - goto e_unknown_value; + case 'n': - if (!new_value (&state, &top, &root, &alloc, json_null)) - goto e_alloc_failure; + if (*(++ i) != 'u' || *(++ i) != 'l' || *(++ i) != 'l') + goto e_unknown_value; - flags |= flag_next; - break; + if (!new_value (&state, &top, &root, &alloc, json_null)) + goto e_alloc_failure; - default: + flags |= flag_next; + break; - if (isdigit (b) || b == '-') - { - if (!new_value (&state, &top, &root, &alloc, json_integer)) - goto e_alloc_failure; + default: - flags &= ~ (flag_exponent | flag_got_exponent_sign); + if (isdigit (b) || b == '-') + { + if (!new_value (&state, &top, &root, &alloc, json_integer)) + goto e_alloc_failure; - if (state.first_pass) - continue; + if (!state.first_pass) + { + while (isdigit (b) || b == '+' || b == '-' + || b == 'e' || b == 'E' || b == '.') + { + b = *++ i; + } - if (top->type == json_double) - top->u.dbl = strtod (i, (json_char **) &i); - else - top->u.integer = strtol (i, (json_char **) &i, 10); + flags |= flag_next | flag_reproc; + break; + } - flags |= flag_next | flag_reproc; - } - else - { sprintf (error, "%d:%d: Unexpected %c when seeking value", cur_line, e_off, b); - goto e_failed; - } - }; - }; - } - else - { - switch (top->type) - { - case json_object: - - switch (b) - { - whitespace: - continue; + flags &= ~ (flag_num_negative | flag_num_e | + flag_num_e_got_sign | flag_num_e_negative); - case '"': + num_digits = 0; + num_fraction = 0; + num_e = 0; - if (flags & flag_need_comma && (!state.settings.settings & json_relaxed_commas)) - { - sprintf (error, "%d:%d: Expected , before \"", cur_line, e_off); - goto e_failed; - } + if (b != '-') + { + flags |= flag_reproc; + break; + } - flags |= flag_string; + flags |= flag_num_negative; + continue; + } + else + { sprintf (error, "%d:%d: Unexpected %c when seeking value", cur_line, e_off, b); + goto e_failed; + } + }; + }; + } + else + { + switch (top->type) + { + case json_object: + + switch (b) + { + whitespace: + continue; - string = (json_char *) top->_reserved.object_mem; - string_length = 0; + case '"': - break; - - case '}': + if (flags & flag_need_comma && (!state.settings.settings & json_relaxed_commas)) + { + sprintf (error, "%d:%d: Expected , before \"", cur_line, e_off); + goto e_failed; + } + + flags |= flag_string; + + string = (json_char *) top->_reserved.object_mem; + string_length = 0; + + break; + + case '}': + + flags = (flags & ~ flag_need_comma) | flag_next; + break; + + case ',': + + if (flags & flag_need_comma) + { + flags &= ~ flag_need_comma; + break; + } + + default: + + sprintf (error, "%d:%d: Unexpected `%c` in object", cur_line, e_off, b); + goto e_failed; + }; + + break; + + case json_integer: + case json_double: + + if (isdigit (b)) + { + ++ num_digits; + + if (top->type == json_integer) + { + top->u.integer = (top->u.integer * 10) + (b - '0'); + continue; + } + + if (flags & flag_num_e) + { + flags |= flag_num_e_got_sign; + num_e = (num_e * 10) + (b - '0'); + continue; + } + + num_fraction = (num_fraction * 10) + (b - '0'); + continue; + } + + if (b == '+' || b == '-') + { + if ( (flags & flag_num_e) && !(flags & flag_num_e_got_sign)) + { + flags |= flag_num_e_got_sign; + + if (b == '-') + flags |= flag_num_e_negative; + + continue; + } + } + else if (b == '.' && top->type == json_integer) + { + if (!num_digits) + { sprintf (error, "%d:%d: Expected digit before `.`", cur_line, e_off); + goto e_failed; + } + + top->type = json_double; + top->u.dbl = top->u.integer; + + num_digits = 0; + continue; + } + + if (! (flags & flag_num_e)) + { + if (top->type == json_double) + { + if (!num_digits) + { sprintf (error, "%d:%d: Expected digit after `.`", cur_line, e_off); + goto e_failed; + } + + top->u.dbl += ((double) num_fraction) / (pow (10, num_digits)); + + num_digits = 0; + } + + if (b == 'e' || b == 'E') + { + flags |= flag_num_e; + + if (top->type == json_integer) + { + top->type = json_double; + top->u.dbl = top->u.integer; + } + + num_digits = 0; + + continue; + } + } + else + { + if (!num_digits) + { sprintf (error, "%d:%d: Expected digit after `e`", cur_line, e_off); + goto e_failed; + } + + top->u.dbl *= pow (10, flags & flag_num_e_negative ? - num_e : num_e); + } + + if (flags & flag_num_negative) + { + if (top->type == json_integer) + top->u.integer = - top->u.integer; + else + top->u.dbl = - top->u.dbl; + } + + flags |= flag_next | flag_reproc; + break; + + default: + break; + }; + } + + if (flags & flag_reproc) + { + flags &= ~ flag_reproc; + -- i; + } + + if (flags & flag_next) + { + flags = (flags & ~ flag_next) | flag_need_comma; + + if (!top->parent) + { + /* root value done */ + + flags |= flag_done; + continue; + } + + if (top->parent->type == json_array) + flags |= flag_seek_value; + + if (!state.first_pass) + { + json_value * parent = top->parent; + + switch (parent->type) + { + case json_object: + + parent->u.object.values + [parent->u.object.length].value = top; + + break; + + case json_array: + + parent->u.array.values + [parent->u.array.length] = top; + + break; + + default: + break; + }; + } + + if ( (++ top->parent->u.array.length) > state.uint_max) + goto e_overflow; + + top = top->parent; - flags = (flags & ~ flag_need_comma) | flag_next; - break; + continue; + } + } - case ',': - - if (flags & flag_need_comma) - { - flags &= ~ flag_need_comma; - break; - } - - default: - - sprintf (error, "%d:%d: Unexpected `%c` in object", cur_line, e_off, b); - goto e_failed; - }; - - break; - - case json_integer: - case json_double: - - if (isdigit (b)) - continue; - - if (b == 'e' || b == 'E') - { - if (!(flags & flag_exponent)) - { - flags |= flag_exponent; - top->type = json_double; - - continue; - } - } - else if (b == '+' || b == '-') - { - if (flags & flag_exponent && !(flags & flag_got_exponent_sign)) - { - flags |= flag_got_exponent_sign; - continue; - } - } - else if (b == '.' && top->type == json_integer) - { - top->type = json_double; - continue; - } - - flags |= flag_next | flag_reproc; - break; - - default: - break; - }; - } - - if (flags & flag_reproc) - { - flags &= ~ flag_reproc; - -- i; - } - - if (flags & flag_next) - { - flags = (flags & ~ flag_next) | flag_need_comma; - - if (!top->parent) - { - /* root value done */ - - flags |= flag_done; - continue; - } - - if (top->parent->type == json_array) - flags |= flag_seek_value; - - if (!state.first_pass) - { - json_value * parent = top->parent; - - switch (parent->type) - { - case json_object: - - parent->u.object.values - [parent->u.object.length].value = top; - - break; - - case json_array: - - parent->u.array.values - [parent->u.array.length] = top; - - break; - - default: - break; - }; - } - - if ( (++ top->parent->u.array.length) > state.uint_max) - goto e_overflow; - - top = top->parent; - - continue; - } - } - - alloc = root; + alloc = root; } return root; @@ -659,24 +746,24 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch if (error_buf) { - if (*error) - strcpy (error_buf, error); - else - strcpy (error_buf, "Unknown error"); + if (*error) + strcpy (error_buf, error); + else + strcpy (error_buf, "Unknown error"); } if (state.first_pass) - alloc = root; + alloc = root; while (alloc) { - top = alloc->_reserved.next_alloc; - free (alloc); - alloc = top; + top = alloc->_reserved.next_alloc; + free (alloc); + alloc = top; } if (!state.first_pass) - json_value_free (root); + json_value_free (root); return 0; } @@ -694,49 +781,48 @@ void json_value_free (json_value * value) json_value * cur_value; if (!value) - return; + return; value->parent = 0; while (value) { - switch (value->type) - { - case json_array: + switch (value->type) + { + case json_array: - if (!value->u.array.length) - { - free (value->u.array.values); - break; - } + if (!value->u.array.length) + { + free (value->u.array.values); + break; + } - value = value->u.array.values [-- value->u.array.length]; - continue; + value = value->u.array.values [-- value->u.array.length]; + continue; - case json_object: + case json_object: - if (!value->u.object.length) - { - free (value->u.object.values); - break; - } + if (!value->u.object.length) + { + free (value->u.object.values); + break; + } - value = value->u.object.values [-- value->u.object.length].value; - continue; + value = value->u.object.values [-- value->u.object.length].value; + continue; - case json_string: + case json_string: - free (value->u.string.ptr); - break; + free (value->u.string.ptr); + break; - default: - break; - }; + default: + break; + }; - cur_value = value; - value = value->parent; - free (cur_value); + cur_value = value; + value = value->parent; + free (cur_value); } } - From 14ac685b4430ee626b4caf10eb5aa75a3e737c84 Mon Sep 17 00:00:00 2001 From: LB Date: Sun, 28 Oct 2012 18:21:30 -0500 Subject: [PATCH 023/127] Add link to Tutorials on wiki --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 722312f..e50e8ee 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Extension Development Is Fun -Edif is an alternate extension development SDK for Multimedia Fusion 2, in which your extension is a true C++ class, with a JSON file (optionally external) to describe it. We recommend that you [check out the wiki](./windows-edif/wiki/). If you're new to EDIF, read the [Getting Started](./windows-edif/wiki/Getting-started) page. +Edif is an alternate extension development SDK for Multimedia Fusion 2, in which your extension is a true C++ class, with a JSON file (optionally external) to describe it. We recommend that you [check out the wiki](Home). If you're new to EDIF, read the [Getting started](Getting started) page. There are also some [Tutorials](Tutorials). From 2262b6a07499c130388b96c8bb53d2c7bef3341b Mon Sep 17 00:00:00 2001 From: LB Date: Sun, 28 Oct 2012 18:23:26 -0500 Subject: [PATCH 024/127] Fix links to point to wiki --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e50e8ee..56c09d8 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Extension Development Is Fun -Edif is an alternate extension development SDK for Multimedia Fusion 2, in which your extension is a true C++ class, with a JSON file (optionally external) to describe it. We recommend that you [check out the wiki](Home). If you're new to EDIF, read the [Getting started](Getting started) page. There are also some [Tutorials](Tutorials). +Edif is an alternate extension development SDK for Multimedia Fusion 2, in which your extension is a true C++ class, with a JSON file (optionally external) to describe it. We recommend that you [check out the wiki](./windows-edif/wiki/). If you're new to EDIF, read the [Getting started](./windows-edif/wiki/Getting-started) page. There are also some [Tutorials](./windows-edif/wiki/Tutorials). From 8d14a24fde94b20bd5acc27ba996acd490b17719 Mon Sep 17 00:00:00 2001 From: LB Date: Mon, 29 Oct 2012 20:06:57 -0500 Subject: [PATCH 025/127] Update to latest json parser --- Lib/json.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/Lib/json.c b/Lib/json.c index 55b7e38..3190509 100644 --- a/Lib/json.c +++ b/Lib/json.c @@ -184,11 +184,11 @@ static int new_value #define string_add(b) \ do { if (!state.first_pass) string [string_length] = b; ++ string_length; } while (0); -const static int +const static long flag_next = 1, flag_reproc = 2, flag_need_comma = 4, flag_seek_value = 8, flag_escaped = 16, flag_string = 32, flag_need_colon = 64, flag_done = 128, - flag_num_negative = 256, flag_num_e = 512, flag_num_e_got_sign = 1024, - flag_num_e_negative = 2048; + flag_num_negative = 256, flag_num_zero = 512, flag_num_e = 1024, + flag_num_e_got_sign = 2048, flag_num_e_negative = 4096; json_value * json_parse_ex (json_settings * settings, const json_char * json, char * error_buf) { @@ -197,7 +197,7 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch const json_char * cur_line_begin, * i; json_value * top, * root, * alloc = 0; json_state state; - int flags; + long flags; long num_digits, num_fraction, num_e; error[0] = '\0'; @@ -493,7 +493,8 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch } flags &= ~ (flag_num_negative | flag_num_e | - flag_num_e_got_sign | flag_num_e_negative); + flag_num_e_got_sign | flag_num_e_negative | + flag_num_zero); num_digits = 0; num_fraction = 0; @@ -569,16 +570,24 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch { ++ num_digits; - if (top->type == json_integer) + if (top->type == json_integer || flags & flag_num_e) { - top->u.integer = (top->u.integer * 10) + (b - '0'); - continue; - } + if (flags & flag_num_zero) + { sprintf (error, "%d:%d: Unexpected `0` before `%c`", cur_line, e_off, b); + goto e_failed; + } - if (flags & flag_num_e) - { - flags |= flag_num_e_got_sign; - num_e = (num_e * 10) + (b - '0'); + if (num_digits == 1 && b == '0') + flags |= flag_num_zero; + + if (flags & flag_num_e) + { + flags |= flag_num_e_got_sign; + num_e = (num_e * 10) + (b - '0'); + continue; + } + + top->u.integer = (top->u.integer * 10) + (b - '0'); continue; } @@ -622,8 +631,6 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch } top->u.dbl += ((double) num_fraction) / (pow (10, num_digits)); - - num_digits = 0; } if (b == 'e' || b == 'E') @@ -637,6 +644,7 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch } num_digits = 0; + flags &= ~ flag_num_zero; continue; } From 2e7122feacad600ee7f88b313e812b0e8b865694 Mon Sep 17 00:00:00 2001 From: LB Date: Tue, 30 Oct 2012 08:39:21 -0500 Subject: [PATCH 026/127] Correct CT Forum Thread URL --- Inc/ObjectSelection.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Inc/ObjectSelection.h b/Inc/ObjectSelection.h index a071ade..5141d1d 100644 --- a/Inc/ObjectSelection.h +++ b/Inc/ObjectSelection.h @@ -1,6 +1,5 @@ - // By Anders Riggelsen (Andos) -// http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=214148&gonew=1 +// http://community.clickteam.com/showthread.php?t=61672 // These files do not match up with the originals - modified for Edif (callbacks inside the extension class, etc..) From 206fd8704d4578a664bdf07b87a1a6415092a194 Mon Sep 17 00:00:00 2001 From: LB Date: Fri, 2 Nov 2012 21:05:14 -0500 Subject: [PATCH 027/127] Make all configs compile, del using namespace std --- Inc/Edif.h | 22 ++++++++++------------ Lib/Edif.Edittime.cpp | 2 +- Lib/Edif.Runtime.cpp | 2 +- Lib/Edif.cpp | 11 ++++++----- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/Inc/Edif.h b/Inc/Edif.h index e43313e..08ac681 100644 --- a/Inc/Edif.h +++ b/Inc/Edif.h @@ -11,9 +11,7 @@ #include "Patch.h" #include -#include #include -using namespace std; class Extension; @@ -55,23 +53,23 @@ namespace Edif SDK (mv * mV, json_value &); ~SDK (); - vector ActionInfos; - vector ConditionInfos; - vector ExpressionInfos; + std::vector ActionInfos; + std::vector ConditionInfos; + std::vector ExpressionInfos; void ** ActionJumps; void ** ConditionJumps; void ** ExpressionJumps; - vector ActionFunctions; - vector ConditionFunctions; - vector ExpressionFunctions; + std::vector ActionFunctions; + std::vector ConditionFunctions; + std::vector ExpressionFunctions; - vector ExpressionTypes; + std::vector ExpressionTypes; - vector ActionFloatFlags; - vector ConditionFloatFlags; - vector ExpressionFloatFlags; + std::vector ActionFloatFlags; + std::vector ConditionFloatFlags; + std::vector ExpressionFloatFlags; unsigned char * FunctionMemory; diff --git a/Lib/Edif.Edittime.cpp b/Lib/Edif.Edittime.cpp index 3c63934..9b722f4 100644 --- a/Lib/Edif.Edittime.cpp +++ b/Lib/Edif.Edittime.cpp @@ -1,5 +1,5 @@ - #include "Common.h" +using namespace std; void WINAPI DLLExport GetObjInfos (mv _far *mV, void *, LPTSTR ObjName, LPTSTR ObjAuthor, LPTSTR ObjCopyright, LPTSTR ObjComment, LPTSTR ObjHttp) diff --git a/Lib/Edif.Runtime.cpp b/Lib/Edif.Runtime.cpp index 52c966a..77e1507 100644 --- a/Lib/Edif.Runtime.cpp +++ b/Lib/Edif.Runtime.cpp @@ -164,7 +164,7 @@ void Edif::Runtime::SetAngleOfObject(LPRO object, float acAngle) if(IsHWA()) memcpy(&object->roc.rcAngle, (int*)&acAngle, sizeof(int)); else - object->roc.rcAngle = (int)acAngle; + object->roc.rcAngle = (ANGLETYPE)acAngle; } diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 0f35fc3..56665f3 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -1,4 +1,5 @@ #include "Common.h" +using namespace std; Edif::SDK * SDK; @@ -65,11 +66,11 @@ void Edif::Init(mv * _far mV, LPEDATA edPtr) _tsplitpath(MFXPath, 0, 0, MFXName, 0); if(_tcscmp(MFXName, _T("Template")) == 0) { - MessageBox(0, _T("You forgot to change the MFX filename" - " in BuildSettings.vsprops!\nChange the" - " \"Template.mfx\" filename to whatever" - " filename you want (spaces/underscores" - " only, please)."), _T("EDIF extension named Template.mfx"), MB_OK); + MessageBox(0, _T("You forgot to change the MFX filename ") + _T("in BuildSettings.vsprops!\nChange the ") + _T("\"Template.mfx\" filename to whatever ") + _T("filename you want (spaces/underscores ") + _T("only, please)."), _T("EDIF extension named Template.mfx"), MB_OK); } #endif } From 5a0a0292ff340b90101656064c0636760c8eda26 Mon Sep 17 00:00:00 2001 From: LB Date: Fri, 2 Nov 2012 21:16:30 -0500 Subject: [PATCH 028/127] Fix typo ("spaces"->"letters") --- Lib/Edif.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 56665f3..22df6b3 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -69,8 +69,8 @@ void Edif::Init(mv * _far mV, LPEDATA edPtr) MessageBox(0, _T("You forgot to change the MFX filename ") _T("in BuildSettings.vsprops!\nChange the ") _T("\"Template.mfx\" filename to whatever ") - _T("filename you want (spaces/underscores ") - _T("only, please)."), _T("EDIF extension named Template.mfx"), MB_OK); + _T("filename you want (letters/underscores") + _T(" only, please)."), _T("EDIF extension named Template.mfx"), MB_OK); } #endif } From b83d78eeaaaa353fd13fa09a8625482a3e5dee63 Mon Sep 17 00:00:00 2001 From: LB Date: Fri, 2 Nov 2012 21:36:58 -0500 Subject: [PATCH 029/127] Made Template.mfx dialog more helpful It shows the name of the extension from the JSON in the dialog titlebar. --- Lib/Edif.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 22df6b3..0f7d9f0 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -66,11 +66,15 @@ void Edif::Init(mv * _far mV, LPEDATA edPtr) _tsplitpath(MFXPath, 0, 0, MFXName, 0); if(_tcscmp(MFXName, _T("Template")) == 0) { + TCHAR *extname; MessageBox(0, _T("You forgot to change the MFX filename ") _T("in BuildSettings.vsprops!\nChange the ") _T("\"Template.mfx\" filename to whatever ") _T("filename you want (letters/underscores") - _T(" only, please)."), _T("EDIF extension named Template.mfx"), MB_OK); + _T(" only, please)."), + (_T("\"")+std::basic_string(extname = ConvertString(::SDK->json["About"]["Name"])) + +_T("\" named Template.mfx - EDIF")).c_str(), MB_OK); + FreeString(extname); } #endif } From 2dcff22b677b743d30090f1e8ea620125dfa5f1c Mon Sep 17 00:00:00 2001 From: LB Date: Fri, 2 Nov 2012 23:47:21 -0500 Subject: [PATCH 030/127] Group MMF2 SDK files in project tree, fix old bug --- Extensions/Template/Template.vcproj | 206 +++++++++++++++------------- Inc/Cncy.h | 2 +- 2 files changed, 112 insertions(+), 96 deletions(-) diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index dde7549..568e594 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -1456,98 +1456,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1583,18 +1491,126 @@ > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Inc/Cncy.h b/Inc/Cncy.h index dc0456a..d67d643 100644 --- a/Inc/Cncy.h +++ b/Inc/Cncy.h @@ -1310,7 +1310,7 @@ typedef struct mv { DWORD (CALLBACK * mvGetVersion) (); // Editor & Runtime: callback function for properties or other functions - #ifdef _cplusplus + #ifdef __cplusplus LRESULT (CALLBACK * mvCallFunction) (LPVOID edPtr, int nFnc, LPARAM lParam1=0, LPARAM lParam2=0, LPARAM lParam3=0); #else LRESULT (CALLBACK * mvCallFunction) (LPVOID edPtr, int nFnc, LPARAM lParam1, LPARAM lParam2, LPARAM lParam3); From 8b80d3a2193e72a46415007e85e8241542059114 Mon Sep 17 00:00:00 2001 From: LB Date: Sun, 4 Nov 2012 12:38:46 -0600 Subject: [PATCH 031/127] Undo fix (actually doesn't compile) --- Inc/Cncy.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Inc/Cncy.h b/Inc/Cncy.h index d67d643..b5a2151 100644 --- a/Inc/Cncy.h +++ b/Inc/Cncy.h @@ -1,4 +1,3 @@ - #ifndef CNCY_H #define CNCY_H @@ -1310,11 +1309,11 @@ typedef struct mv { DWORD (CALLBACK * mvGetVersion) (); // Editor & Runtime: callback function for properties or other functions - #ifdef __cplusplus - LRESULT (CALLBACK * mvCallFunction) (LPVOID edPtr, int nFnc, LPARAM lParam1=0, LPARAM lParam2=0, LPARAM lParam3=0); - #else +// #ifdef __cplusplus +// LRESULT (CALLBACK * mvCallFunction) (LPVOID edPtr, int nFnc, LPARAM lParam1=0, LPARAM lParam2=0, LPARAM lParam3=0); +// #else LRESULT (CALLBACK * mvCallFunction) (LPVOID edPtr, int nFnc, LPARAM lParam1, LPARAM lParam2, LPARAM lParam3); - #endif +// #endif // Editor: Open Help file (UNICODE) void (CALLBACK * mvHelpW) (LPCWSTR pHelpFile, UINT nID, LPARAM lParam); From ee386f95a0fb74a1682569951c76944b9c0a8d0d Mon Sep 17 00:00:00 2001 From: LB Date: Sun, 4 Nov 2012 17:32:28 -0600 Subject: [PATCH 032/127] Add static Read/WriteGlobal funcs, add examples These are for use with StartApp/EndApp/StartFrame/EndFrame, as shown in the examples. This actually makes it possible to use Global Data correctly. --- Extensions/Template/Runtime.cpp | 19 +++++++++++++++---- Inc/Edif.h | 2 ++ Lib/Edif.Runtime.cpp | 30 ++++++++++++++++++++---------- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/Extensions/Template/Runtime.cpp b/Extensions/Template/Runtime.cpp index db911d5..125bdb3 100644 --- a/Extensions/Template/Runtime.cpp +++ b/Extensions/Template/Runtime.cpp @@ -87,7 +87,8 @@ */ void MMF2Func StartApp(mv *mV, CRunApp *App) { - // +// delete (MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data"); +// Edif::Runtime::WriteGlobal(mV, App, "My Global Data", new MyGlobalData()); } /* EndApp @@ -99,7 +100,7 @@ void MMF2Func StartApp(mv *mV, CRunApp *App) */ void MMF2Func EndApp(mv *mV, CRunApp *App) { - // +// delete (MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data"); } /* StartFrame @@ -113,7 +114,17 @@ void MMF2Func EndApp(mv *mV, CRunApp *App) */ void MMF2Func StartFrame(mv *mV, CRunApp *App, int FrameIndex) { - // +// if(!Edif::Runtime::ReadGlobal(mV, App, "My Global Data Backup")) //first time on this frame +// { +// Edif::Runtime::WriteGlobal(mV, App, "My Global Data Backup", +// new MyGlobalData(*(MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data"))); //copy +// } +// else //frame restarting, restore initial global data +// { +// delete (MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data"); +// Edif::Runtime::WriteGlobal(mV, App, "My Global Data", +// new MyGlobalData(*(MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data Backup"))); //copy +// } } /* EndFrame @@ -123,7 +134,7 @@ void MMF2Func StartFrame(mv *mV, CRunApp *App, int FrameIndex) */ void MMF2Func EndFrame(mv *mV, CRunApp *App, int FrameIndex) { - // +// delete (MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data Backup"); } diff --git a/Inc/Edif.h b/Inc/Edif.h index 08ac681..9653cd1 100644 --- a/Inc/Edif.h +++ b/Inc/Edif.h @@ -134,6 +134,8 @@ namespace Edif void WriteGlobal(const TCHAR * Name, void * Value); void * ReadGlobal(const TCHAR * Name); + static void WriteGlobal(mv * mV, CRunApp * App, const TCHAR * Name, void * Value); + static void * ReadGlobal(mv * mV, CRunApp * App, const TCHAR * Name); #ifdef EdifUseJS diff --git a/Lib/Edif.Runtime.cpp b/Lib/Edif.Runtime.cpp index 77e1507..41c8947 100644 --- a/Lib/Edif.Runtime.cpp +++ b/Lib/Edif.Runtime.cpp @@ -176,14 +176,9 @@ struct EdifGlobal EdifGlobal * Next; }; -void Edif::Runtime::WriteGlobal(const TCHAR * Name, void * Value) +void Edif::Runtime::WriteGlobal(mv * mV, CRunApp * App, const TCHAR * Name, void * Value) { - LPRH rhPtr = rdPtr->rHo.hoAdRunHeader; - - while(rhPtr->rhApp->m_pParentApp) - rhPtr = rhPtr->rhApp->m_pParentApp->m_Frame->m_rhPtr; - - EdifGlobal * Global = (EdifGlobal *) rhPtr->rh4.rh4Mv->mvGetExtUserData(rhPtr->rhApp, hInstLib); + EdifGlobal * Global = (EdifGlobal *) mV->mvGetExtUserData(App, hInstLib); if(!Global) { @@ -194,7 +189,7 @@ void Edif::Runtime::WriteGlobal(const TCHAR * Name, void * Value) Global->Next = 0; - rhPtr->rh4.rh4Mv->mvSetExtUserData(rhPtr->rhApp, hInstLib, Global); + mV->mvSetExtUserData(App, hInstLib, Global); return; } @@ -222,14 +217,19 @@ void Edif::Runtime::WriteGlobal(const TCHAR * Name, void * Value) Global->Next = 0; } -void * Edif::Runtime::ReadGlobal(const TCHAR * Name) +void Edif::Runtime::WriteGlobal(const TCHAR * Name, void * Value) { LPRH rhPtr = rdPtr->rHo.hoAdRunHeader; while(rhPtr->rhApp->m_pParentApp) rhPtr = rhPtr->rhApp->m_pParentApp->m_Frame->m_rhPtr; - EdifGlobal * Global = (EdifGlobal *) rhPtr->rh4.rh4Mv->mvGetExtUserData(rhPtr->rhApp, hInstLib); + WriteGlobal(rhPtr->rh4.rh4Mv, rhPtr->rhApp, Name, Value); +} + +void * Edif::Runtime::ReadGlobal(mv * mV, CRunApp * App, const TCHAR * Name) +{ + EdifGlobal * Global = (EdifGlobal *) mV->mvGetExtUserData(App, hInstLib); while(Global) { @@ -242,6 +242,16 @@ void * Edif::Runtime::ReadGlobal(const TCHAR * Name) return 0; } +void * Edif::Runtime::ReadGlobal(const TCHAR * Name) +{ + LPRH rhPtr = rdPtr->rHo.hoAdRunHeader; + + while(rhPtr->rhApp->m_pParentApp) + rhPtr = rhPtr->rhApp->m_pParentApp->m_Frame->m_rhPtr; + + return ReadGlobal(rhPtr->rh4.rh4Mv, rhPtr->rhApp, Name); +} + #ifdef EdifUseJS /* Breaking versions of Edif should change these so that newer extensions don't From 2d806d457d163e955f667a18b8f4979821b9aba5 Mon Sep 17 00:00:00 2001 From: LB Date: Sun, 4 Nov 2012 17:58:27 -0600 Subject: [PATCH 033/127] Ignore build & built files from template --- .gitignore | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.gitignore b/.gitignore index 5ebd21a..3e8dd22 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,15 @@ +# Template project built files +Extensions/Template/MFX/ +Extensions/Template/Debug HWA/ +Extensions/Template/DebugUnicode/ +Extensions/Template/Edittime HWA/ +Extensions/Template/ReleaseEditor/ +Extensions/Template/ReleaseEditorUnicode/ +Extensions/Template/ReleaseRuntime/ +Extensions/Template/ReleaseRuntimeUnicode/ +Extensions/Template/Runtime HWA/ + + ################# ## Eclipse ################# From 7c02e5e5d552b5abf0df720a5c43bdbb68c86cc0 Mon Sep 17 00:00:00 2001 From: LB Date: Sun, 4 Nov 2012 19:13:58 -0600 Subject: [PATCH 034/127] Minor Unicode fix --- Extensions/Template/Extension.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extensions/Template/Extension.cpp b/Extensions/Template/Extension.cpp index 46e7f56..8988773 100644 --- a/Extensions/Template/Extension.cpp +++ b/Extensions/Template/Extension.cpp @@ -185,6 +185,6 @@ long Extension::Condition(int ID, RD *rd, long param1, long param2) long Extension::Expression(int ID, RD *rd, long param) { - return long(""); //so that unlinked expressions that return strings won't crash + return long(_T("")); //so that unlinked expressions that return strings won't crash } From d0208291028444165563be8be2aaa9c0cf092c7c Mon Sep 17 00:00:00 2001 From: LB Date: Sun, 4 Nov 2012 21:49:48 -0600 Subject: [PATCH 035/127] Fix dangling pointer crashes in example --- Extensions/Template/Runtime.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Extensions/Template/Runtime.cpp b/Extensions/Template/Runtime.cpp index 125bdb3..f060dda 100644 --- a/Extensions/Template/Runtime.cpp +++ b/Extensions/Template/Runtime.cpp @@ -101,6 +101,7 @@ void MMF2Func StartApp(mv *mV, CRunApp *App) void MMF2Func EndApp(mv *mV, CRunApp *App) { // delete (MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data"); +// Edif::Runtime:WriteGlobal(mV, App, "My Global Data", 0); //clear dangling pointer } /* StartFrame @@ -135,6 +136,7 @@ void MMF2Func StartFrame(mv *mV, CRunApp *App, int FrameIndex) void MMF2Func EndFrame(mv *mV, CRunApp *App, int FrameIndex) { // delete (MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data Backup"); +// Edif::Runtime:WriteGlobal(mV, App, "My Global Data Backup", 0); //clear dangling pointer } From 363ca52c0e0450329a9247bcc8e8fc1060f8d5a0 Mon Sep 17 00:00:00 2001 From: LB Date: Mon, 5 Nov 2012 15:28:57 -0600 Subject: [PATCH 036/127] Fix outdated comment --- Lib/Edif.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 0f7d9f0..c7364bf 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -156,7 +156,7 @@ int Edif::Init(mv _far * mV) json_settings settings; memset (&settings, 0, sizeof (settings)); - // settings.settings = json_setting_permissive_commas; +// settings.settings = json_relaxed_commas; json_value * json = json_parse_ex (&settings, copy, json_error); From 5bde1f3ec38bc89167452edefe7078c3d2e20a5c Mon Sep 17 00:00:00 2001 From: LB Date: Mon, 5 Nov 2012 18:51:13 -0600 Subject: [PATCH 037/127] Add per-ext support for relaxed commas in json --- Extensions/Template/Common.h | 3 +++ Lib/Edif.cpp | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Extensions/Template/Common.h b/Extensions/Template/Common.h index 0d926a5..ea20fc2 100644 --- a/Extensions/Template/Common.h +++ b/Extensions/Template/Common.h @@ -17,6 +17,9 @@ #define MMFEXT //MMF2, MMF2 Dev // #define PROEXT //MMF2 Dev only +//Define this if you want legacy comma-less JSON support +// #define UsingJsonWithoutCommas + #include "Edif.h" #include "Resource.h" diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index c7364bf..29267ac 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -156,7 +156,9 @@ int Edif::Init(mv _far * mV) json_settings settings; memset (&settings, 0, sizeof (settings)); -// settings.settings = json_relaxed_commas; +#ifdef UsingJsonWithoutCommas + settings.settings |= json_relaxed_commas; +#endif json_value * json = json_parse_ex (&settings, copy, json_error); From e4031b6037978d945758777900c2a19036e6f5ad Mon Sep 17 00:00:00 2001 From: LB Date: Mon, 5 Nov 2012 19:39:52 -0600 Subject: [PATCH 038/127] Add support for comparison params in conditions --- Lib/Edif.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 29267ac..ceab55b 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -234,7 +234,7 @@ Edif::SDK::SDK(mv * mV, json_value &_json) : json (_json) ActionInfos.push_back(Parameters.u.array.length); - { short IsFloat = 0; + { short IsFloat = 0; for(unsigned int i = 0; i < Parameters.u.array.length; ++ i) { @@ -531,7 +531,7 @@ long __stdcall Edif::Condition(LPRDATA rdPtr, long param1, long param2) int Result = ActionOrCondition(::SDK->ConditionFloatFlags, (LPEVENTINFOS2) &::SDK->ConditionInfos[0], Function, ID, rdPtr, param1, param2); - return *(char *) &Result; + return Result; } short __stdcall Edif::Action(LPRDATA rdPtr, long param1, long param2) From 1a46993542f37bffa09a5be09050f52c3b7a3ba6 Mon Sep 17 00:00:00 2001 From: LB Date: Mon, 5 Nov 2012 20:02:55 -0600 Subject: [PATCH 039/127] Add example of disabled menu item to Ext.json --- Extensions/Template/Ext.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Extensions/Template/Ext.json b/Extensions/Template/Ext.json index 4756556..6153cdb 100644 --- a/Extensions/Template/Ext.json +++ b/Extensions/Template/Ext.json @@ -18,6 +18,8 @@ ["Sub Menu", [1, "Second Action Example"] ], + "Separator", + [0, "A Disabled Menu Item", true], "Separator" ], "ConditionMenu": From 6a09d946e8469a943e02a163bd83795b776c10da Mon Sep 17 00:00:00 2001 From: LB Date: Mon, 5 Nov 2012 22:38:19 -0600 Subject: [PATCH 040/127] misc cleanup --- Lib/Edif.Edittime.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Lib/Edif.Edittime.cpp b/Lib/Edif.Edittime.cpp index 9b722f4..5d31af3 100644 --- a/Lib/Edif.Edittime.cpp +++ b/Lib/Edif.Edittime.cpp @@ -21,16 +21,13 @@ void WINAPI DLLExport GetObjInfos (mv _far *mV, void *, LPTSTR ObjName, LPTSTR O LPCTSTR WINAPI GetHelpFileName() { #ifndef RUN_ONLY - // Return a file without path if your help file can be loaded by the MMF help file. -// return "MyExt.chm"; - // Or return the path of your file, relatively to the MMF directory - // if your file is not loaded by the MMF help file. - static TCHAR TempString[MAX_PATH]; // used by GetHelpFileName() + static TCHAR TempString[MAX_PATH]; return Edif::ConvertAndCopyString(TempString, SDK->json["About"]["Help"], MAX_PATH); -#else - return NULL; + #endif // !defined(RUN_ONLY) + + return NULL; } void WINAPI DLLExport GetConditionTitle(mv _far *mV, short code, short param, LPTSTR strBuf, short maxLen) From 3eecdc0ebec3de4174ffce288a6cfa2be84afd3a Mon Sep 17 00:00:00 2001 From: LB Date: Fri, 9 Nov 2012 20:33:06 -0600 Subject: [PATCH 041/127] Prepare for submodulization --- Extensions/Template/Template.vcproj | 4 ++-- {Lib => json-parser}/json.c | 0 {Inc => json-parser}/json.h | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename {Lib => json-parser}/json.c (100%) rename {Inc => json-parser}/json.h (100%) diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index 568e594..127409a 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -1483,11 +1483,11 @@ Name="json" > diff --git a/Lib/json.c b/json-parser/json.c similarity index 100% rename from Lib/json.c rename to json-parser/json.c diff --git a/Inc/json.h b/json-parser/json.h similarity index 100% rename from Inc/json.h rename to json-parser/json.h From 68ff0f5d98e0d1f5f83180b2116c9e46420b7509 Mon Sep 17 00:00:00 2001 From: LB Date: Fri, 9 Nov 2012 20:38:25 -0600 Subject: [PATCH 042/127] more prep --- json-parser/json.c | 836 --------------------------------------------- json-parser/json.h | 192 ----------- 2 files changed, 1028 deletions(-) delete mode 100644 json-parser/json.c delete mode 100644 json-parser/json.h diff --git a/json-parser/json.c b/json-parser/json.c deleted file mode 100644 index 3190509..0000000 --- a/json-parser/json.c +++ /dev/null @@ -1,836 +0,0 @@ - -/* vim: set et ts=3 sw=3 ft=c: - * - * Copyright (C) 2012 James McLaughlin et al. All rights reserved. - * https://github.com/udp/json-parser - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "json.h" - -#ifdef _MSC_VER - #ifndef _CRT_SECURE_NO_WARNINGS - #define _CRT_SECURE_NO_WARNINGS - #endif -#endif - -#ifdef __cplusplus - const struct _json_value json_value_none; /* zero-d by ctor */ -#else - const struct _json_value json_value_none = { 0 }; -#endif - -#include -#include -#include -#include -#include - -typedef unsigned short json_uchar; - -static unsigned char hex_value (json_char c) -{ - if (c >= 'A' && c <= 'F') - return (c - 'A') + 10; - - if (c >= 'a' && c <= 'f') - return (c - 'a') + 10; - - if (c >= '0' && c <= '9') - return c - '0'; - - return 0xFF; -} - -typedef struct -{ - json_settings settings; - int first_pass; - - unsigned long used_memory; - - unsigned int uint_max; - unsigned long ulong_max; - -} json_state; - -static void * json_alloc (json_state * state, unsigned long size, int zero) -{ - void * mem; - - if ((state->ulong_max - state->used_memory) < size) - return 0; - - if (state->settings.max_memory - && (state->used_memory += size) > state->settings.max_memory) - { - return 0; - } - - if (! (mem = zero ? calloc (size, 1) : malloc (size))) - return 0; - - return mem; -} - -static int new_value - (json_state * state, json_value ** top, json_value ** root, json_value ** alloc, json_type type) -{ - json_value * value; - int values_size; - - if (!state->first_pass) - { - value = *top = *alloc; - *alloc = (*alloc)->_reserved.next_alloc; - - if (!*root) - *root = value; - - switch (value->type) - { - case json_array: - - if (! (value->u.array.values = (json_value **) json_alloc - (state, value->u.array.length * sizeof (json_value *), 0)) ) - { - return 0; - } - - value->u.array.length = 0; - break; - - case json_object: - - values_size = sizeof (*value->u.object.values) * value->u.object.length; - - if (! ((*(void **) &value->u.object.values) = json_alloc - (state, values_size + ((unsigned long) value->u.object.values), 0)) ) - { - return 0; - } - - value->_reserved.object_mem = (*(char **) &value->u.object.values) + values_size; - - value->u.object.length = 0; - break; - - case json_string: - - if (! (value->u.string.ptr = (json_char *) json_alloc - (state, (value->u.string.length + 1) * sizeof (json_char), 0)) ) - { - return 0; - } - - value->u.string.length = 0; - break; - - default: - break; - }; - - return 1; - } - - value = (json_value *) json_alloc (state, sizeof (json_value), 1); - - if (!value) - return 0; - - if (!*root) - *root = value; - - value->type = type; - value->parent = *top; - - if (*alloc) - (*alloc)->_reserved.next_alloc = value; - - *alloc = *top = value; - - return 1; -} - -#define e_off \ - ((int) (i - cur_line_begin)) - -#define whitespace \ - case '\n': ++ cur_line; cur_line_begin = i; \ - case ' ': case '\t': case '\r' - -#define string_add(b) \ - do { if (!state.first_pass) string [string_length] = b; ++ string_length; } while (0); - -const static long - flag_next = 1, flag_reproc = 2, flag_need_comma = 4, flag_seek_value = 8, - flag_escaped = 16, flag_string = 32, flag_need_colon = 64, flag_done = 128, - flag_num_negative = 256, flag_num_zero = 512, flag_num_e = 1024, - flag_num_e_got_sign = 2048, flag_num_e_negative = 4096; - -json_value * json_parse_ex (json_settings * settings, const json_char * json, char * error_buf) -{ - json_char error [128]; - unsigned int cur_line; - const json_char * cur_line_begin, * i; - json_value * top, * root, * alloc = 0; - json_state state; - long flags; - long num_digits, num_fraction, num_e; - - error[0] = '\0'; - - memset (&state, 0, sizeof (json_state)); - memcpy (&state.settings, settings, sizeof (json_settings)); - - memset (&state.uint_max, 0xFF, sizeof (state.uint_max)); - memset (&state.ulong_max, 0xFF, sizeof (state.ulong_max)); - - state.uint_max -= 8; /* limit of how much can be added before next check */ - state.ulong_max -= 8; - - for (state.first_pass = 1; state.first_pass >= 0; -- state.first_pass) - { - json_uchar uchar; - unsigned char uc_b1, uc_b2, uc_b3, uc_b4; - json_char * string; - unsigned int string_length; - - top = root = 0; - flags = flag_seek_value; - - cur_line = 1; - cur_line_begin = json; - - for (i = json ;; ++ i) - { - json_char b = *i; - - if (flags & flag_done) - { - if (!b) - break; - - switch (b) - { - whitespace: - continue; - - default: - sprintf (error, "%d:%d: Trailing garbage: `%c`", cur_line, e_off, b); - goto e_failed; - }; - } - - if (flags & flag_string) - { - if (!b) - { sprintf (error, "Unexpected EOF in string (at %d:%d)", cur_line, e_off); - goto e_failed; - } - - if (string_length > state.uint_max) - goto e_overflow; - - if (flags & flag_escaped) - { - flags &= ~ flag_escaped; - - switch (b) - { - case 'b': string_add ('\b'); break; - case 'f': string_add ('\f'); break; - case 'n': string_add ('\n'); break; - case 'r': string_add ('\r'); break; - case 't': string_add ('\t'); break; - case 'u': - - if ((uc_b1 = hex_value (*++ i)) == 0xFF || (uc_b2 = hex_value (*++ i)) == 0xFF - || (uc_b3 = hex_value (*++ i)) == 0xFF || (uc_b4 = hex_value (*++ i)) == 0xFF) - { - sprintf (error, "Invalid character value `%c` (at %d:%d)", b, cur_line, e_off); - goto e_failed; - } - - uc_b1 = uc_b1 * 16 + uc_b2; - uc_b2 = uc_b3 * 16 + uc_b4; - - uchar = ((json_char) uc_b1) * 256 + uc_b2; - - if (sizeof (json_char) >= sizeof (json_uchar) || (uc_b1 == 0 && uc_b2 <= 0x7F)) - { - string_add ((json_char) uchar); - break; - } - - if (uchar <= 0x7FF) - { - if (state.first_pass) - string_length += 2; - else - { string [string_length ++] = 0xC0 | ((uc_b2 & 0xC0) >> 6) | ((uc_b1 & 0x3) << 3); - string [string_length ++] = 0x80 | (uc_b2 & 0x3F); - } - - break; - } - - if (state.first_pass) - string_length += 3; - else - { string [string_length ++] = 0xE0 | ((uc_b1 & 0xF0) >> 4); - string [string_length ++] = 0x80 | ((uc_b1 & 0xF) << 2) | ((uc_b2 & 0xC0) >> 6); - string [string_length ++] = 0x80 | (uc_b2 & 0x3F); - } - - break; - - default: - string_add (b); - }; - - continue; - } - - if (b == '\\') - { - flags |= flag_escaped; - continue; - } - - if (b == '"') - { - if (!state.first_pass) - string [string_length] = 0; - - flags &= ~ flag_string; - string = 0; - - switch (top->type) - { - case json_string: - - top->u.string.length = string_length; - flags |= flag_next; - - break; - - case json_object: - - if (state.first_pass) - (*(json_char **) &top->u.object.values) += string_length + 1; - else - { - top->u.object.values [top->u.object.length].name - = (json_char *) top->_reserved.object_mem; - - (*(json_char **) &top->_reserved.object_mem) += string_length + 1; - } - - flags |= flag_seek_value | flag_need_colon; - continue; - - default: - break; - }; - } - else - { - string_add (b); - continue; - } - } - - if (flags & flag_seek_value) - { - switch (b) - { - whitespace: - continue; - - case ']': - - if (top->type == json_array) - flags = (flags & ~ (flag_need_comma | flag_seek_value)) | flag_next; - else if (!state.settings.settings & json_relaxed_commas) - { sprintf (error, "%d:%d: Unexpected ]", cur_line, e_off); - goto e_failed; - } - - break; - - default: - - if (flags & flag_need_comma) - { - if (b == ',') - { flags &= ~ flag_need_comma; - continue; - } - else - { sprintf (error, "%d:%d: Expected , before %c", cur_line, e_off, b); - goto e_failed; - } - } - - if (flags & flag_need_colon) - { - if (b == ':') - { flags &= ~ flag_need_colon; - continue; - } - else - { sprintf (error, "%d:%d: Expected : before %c", cur_line, e_off, b); - goto e_failed; - } - } - - flags &= ~ flag_seek_value; - - switch (b) - { - case '{': - - if (!new_value (&state, &top, &root, &alloc, json_object)) - goto e_alloc_failure; - - continue; - - case '[': - - if (!new_value (&state, &top, &root, &alloc, json_array)) - goto e_alloc_failure; - - flags |= flag_seek_value; - continue; - - case '"': - - if (!new_value (&state, &top, &root, &alloc, json_string)) - goto e_alloc_failure; - - flags |= flag_string; - - string = top->u.string.ptr; - string_length = 0; - - continue; - - case 't': - - if (*(++ i) != 'r' || *(++ i) != 'u' || *(++ i) != 'e') - goto e_unknown_value; - - if (!new_value (&state, &top, &root, &alloc, json_boolean)) - goto e_alloc_failure; - - top->u.boolean = 1; - - flags |= flag_next; - break; - - case 'f': - - if (*(++ i) != 'a' || *(++ i) != 'l' || *(++ i) != 's' || *(++ i) != 'e') - goto e_unknown_value; - - if (!new_value (&state, &top, &root, &alloc, json_boolean)) - goto e_alloc_failure; - - flags |= flag_next; - break; - - case 'n': - - if (*(++ i) != 'u' || *(++ i) != 'l' || *(++ i) != 'l') - goto e_unknown_value; - - if (!new_value (&state, &top, &root, &alloc, json_null)) - goto e_alloc_failure; - - flags |= flag_next; - break; - - default: - - if (isdigit (b) || b == '-') - { - if (!new_value (&state, &top, &root, &alloc, json_integer)) - goto e_alloc_failure; - - if (!state.first_pass) - { - while (isdigit (b) || b == '+' || b == '-' - || b == 'e' || b == 'E' || b == '.') - { - b = *++ i; - } - - flags |= flag_next | flag_reproc; - break; - } - - flags &= ~ (flag_num_negative | flag_num_e | - flag_num_e_got_sign | flag_num_e_negative | - flag_num_zero); - - num_digits = 0; - num_fraction = 0; - num_e = 0; - - if (b != '-') - { - flags |= flag_reproc; - break; - } - - flags |= flag_num_negative; - continue; - } - else - { sprintf (error, "%d:%d: Unexpected %c when seeking value", cur_line, e_off, b); - goto e_failed; - } - }; - }; - } - else - { - switch (top->type) - { - case json_object: - - switch (b) - { - whitespace: - continue; - - case '"': - - if (flags & flag_need_comma && (!state.settings.settings & json_relaxed_commas)) - { - sprintf (error, "%d:%d: Expected , before \"", cur_line, e_off); - goto e_failed; - } - - flags |= flag_string; - - string = (json_char *) top->_reserved.object_mem; - string_length = 0; - - break; - - case '}': - - flags = (flags & ~ flag_need_comma) | flag_next; - break; - - case ',': - - if (flags & flag_need_comma) - { - flags &= ~ flag_need_comma; - break; - } - - default: - - sprintf (error, "%d:%d: Unexpected `%c` in object", cur_line, e_off, b); - goto e_failed; - }; - - break; - - case json_integer: - case json_double: - - if (isdigit (b)) - { - ++ num_digits; - - if (top->type == json_integer || flags & flag_num_e) - { - if (flags & flag_num_zero) - { sprintf (error, "%d:%d: Unexpected `0` before `%c`", cur_line, e_off, b); - goto e_failed; - } - - if (num_digits == 1 && b == '0') - flags |= flag_num_zero; - - if (flags & flag_num_e) - { - flags |= flag_num_e_got_sign; - num_e = (num_e * 10) + (b - '0'); - continue; - } - - top->u.integer = (top->u.integer * 10) + (b - '0'); - continue; - } - - num_fraction = (num_fraction * 10) + (b - '0'); - continue; - } - - if (b == '+' || b == '-') - { - if ( (flags & flag_num_e) && !(flags & flag_num_e_got_sign)) - { - flags |= flag_num_e_got_sign; - - if (b == '-') - flags |= flag_num_e_negative; - - continue; - } - } - else if (b == '.' && top->type == json_integer) - { - if (!num_digits) - { sprintf (error, "%d:%d: Expected digit before `.`", cur_line, e_off); - goto e_failed; - } - - top->type = json_double; - top->u.dbl = top->u.integer; - - num_digits = 0; - continue; - } - - if (! (flags & flag_num_e)) - { - if (top->type == json_double) - { - if (!num_digits) - { sprintf (error, "%d:%d: Expected digit after `.`", cur_line, e_off); - goto e_failed; - } - - top->u.dbl += ((double) num_fraction) / (pow (10, num_digits)); - } - - if (b == 'e' || b == 'E') - { - flags |= flag_num_e; - - if (top->type == json_integer) - { - top->type = json_double; - top->u.dbl = top->u.integer; - } - - num_digits = 0; - flags &= ~ flag_num_zero; - - continue; - } - } - else - { - if (!num_digits) - { sprintf (error, "%d:%d: Expected digit after `e`", cur_line, e_off); - goto e_failed; - } - - top->u.dbl *= pow (10, flags & flag_num_e_negative ? - num_e : num_e); - } - - if (flags & flag_num_negative) - { - if (top->type == json_integer) - top->u.integer = - top->u.integer; - else - top->u.dbl = - top->u.dbl; - } - - flags |= flag_next | flag_reproc; - break; - - default: - break; - }; - } - - if (flags & flag_reproc) - { - flags &= ~ flag_reproc; - -- i; - } - - if (flags & flag_next) - { - flags = (flags & ~ flag_next) | flag_need_comma; - - if (!top->parent) - { - /* root value done */ - - flags |= flag_done; - continue; - } - - if (top->parent->type == json_array) - flags |= flag_seek_value; - - if (!state.first_pass) - { - json_value * parent = top->parent; - - switch (parent->type) - { - case json_object: - - parent->u.object.values - [parent->u.object.length].value = top; - - break; - - case json_array: - - parent->u.array.values - [parent->u.array.length] = top; - - break; - - default: - break; - }; - } - - if ( (++ top->parent->u.array.length) > state.uint_max) - goto e_overflow; - - top = top->parent; - - continue; - } - } - - alloc = root; - } - - return root; - -e_unknown_value: - - sprintf (error, "%d:%d: Unknown value", cur_line, e_off); - goto e_failed; - -e_alloc_failure: - - strcpy (error, "Memory allocation failure"); - goto e_failed; - -e_overflow: - - sprintf (error, "%d:%d: Too long (caught overflow)", cur_line, e_off); - goto e_failed; - -e_failed: - - if (error_buf) - { - if (*error) - strcpy (error_buf, error); - else - strcpy (error_buf, "Unknown error"); - } - - if (state.first_pass) - alloc = root; - - while (alloc) - { - top = alloc->_reserved.next_alloc; - free (alloc); - alloc = top; - } - - if (!state.first_pass) - json_value_free (root); - - return 0; -} - -json_value * json_parse (const json_char * json) -{ - json_settings settings; - memset (&settings, 0, sizeof (json_settings)); - - return json_parse_ex (&settings, json, 0); -} - -void json_value_free (json_value * value) -{ - json_value * cur_value; - - if (!value) - return; - - value->parent = 0; - - while (value) - { - switch (value->type) - { - case json_array: - - if (!value->u.array.length) - { - free (value->u.array.values); - break; - } - - value = value->u.array.values [-- value->u.array.length]; - continue; - - case json_object: - - if (!value->u.object.length) - { - free (value->u.object.values); - break; - } - - value = value->u.object.values [-- value->u.object.length].value; - continue; - - case json_string: - - free (value->u.string.ptr); - break; - - default: - break; - }; - - cur_value = value; - value = value->parent; - free (cur_value); - } -} - diff --git a/json-parser/json.h b/json-parser/json.h deleted file mode 100644 index cbddc69..0000000 --- a/json-parser/json.h +++ /dev/null @@ -1,192 +0,0 @@ - -/* vim: set et ts=3 sw=3 ft=c: - * - * Copyright (C) 2012 James McLaughlin et al. All rights reserved. - * https://github.com/udp/json-parser - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _JSON_H -#define _JSON_H - -#ifndef json_char - #define json_char char -#endif - -#ifdef __cplusplus - - #include - - extern "C" - { - -#endif - -typedef struct -{ - unsigned long max_memory; - int settings; - -} json_settings; - -#define json_relaxed_commas 1 - -typedef enum -{ - json_none, - json_object, - json_array, - json_integer, - json_double, - json_string, - json_boolean, - json_null - -} json_type; - -extern const struct _json_value json_value_none; - -typedef struct _json_value -{ - struct _json_value * parent; - - json_type type; - - union - { - int boolean; - long integer; - double dbl; - - struct - { - unsigned int length; - json_char * ptr; /* null terminated */ - - } string; - - struct - { - unsigned int length; - - struct - { - json_char * name; - struct _json_value * value; - - } * values; - - } object; - - struct - { - unsigned int length; - struct _json_value ** values; - - } array; - - } u; - - union - { - struct _json_value * next_alloc; - void * object_mem; - - } _reserved; - - - /* Some C++ operator sugar */ - - #ifdef __cplusplus - - public: - - inline _json_value () - { memset (this, 0, sizeof (_json_value)); - } - - inline const struct _json_value &operator [] (int index) const - { - if (type != json_array || index < 0 - || ((unsigned int) index) >= u.array.length) - { - return json_value_none; - } - - return *u.array.values [index]; - } - - inline const struct _json_value &operator [] (const char * index) const - { - if (type != json_object) - return json_value_none; - - for (unsigned int i = 0; i < u.object.length; ++ i) - if (!strcmp (u.object.values [i].name, index)) - return *u.object.values [i].value; - - return json_value_none; - } - - inline operator const char * () const - { - switch (type) - { - case json_string: - return u.string.ptr; - - default: - return ""; - }; - } - - inline operator long () const - { return u.integer; - } - - inline operator bool () const - { return u.boolean != 0; - } - - #endif - -} json_value; - -json_value * json_parse - (const json_char * json); - -json_value * json_parse_ex - (json_settings * settings, const json_char * json, char * error); - -void json_value_free (json_value *); - - -#ifdef __cplusplus - } /* extern "C" */ -#endif - -#endif - - From 8dcc86a72c37b71a23af3e0d677e5872e042402c Mon Sep 17 00:00:00 2001 From: LB Date: Fri, 9 Nov 2012 20:42:16 -0600 Subject: [PATCH 043/127] Convert to json-parser submodule --- .gitmodules | 3 +++ json-parser | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 json-parser diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..d76c3c4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "json-parser"] + path = json-parser + url = git://github.com/udp/json-parser.git diff --git a/json-parser b/json-parser new file mode 160000 index 0000000..0d4be4b --- /dev/null +++ b/json-parser @@ -0,0 +1 @@ +Subproject commit 0d4be4bffb17eb8b3c47e497f5a129254cc955ca From 45aa8beb2d7a3c1657d91a6875d5f7f7a8d78638 Mon Sep 17 00:00:00 2001 From: LB Date: Fri, 9 Nov 2012 20:53:40 -0600 Subject: [PATCH 044/127] Finish submodulizing json-parser --- Extensions/Template/Template.vcproj | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index 127409a..cf86003 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -50,7 +50,7 @@ Name="VCCLCompilerTool" Optimization="1" InlineFunctionExpansion="1" - AdditionalIncludeDirectories="..\..\Inc, .\" + AdditionalIncludeDirectories="..\..\Inc;.\;"..\..\json-parser\"" PreprocessorDefinitions="COXSDK, IN_EXT_VERSION2, _CRT_SECURE_NO_WARNINGS, _CRT_SECURE_NO_DEPRECATE, _WINDOWS,EDITOR" StringPooling="true" MinimalRebuild="false" @@ -152,7 +152,7 @@ Date: Fri, 9 Nov 2012 21:25:27 -0600 Subject: [PATCH 045/127] git LF normalization --- Inc/Patch.h | 140 ++++++++++++++++++++++++++-------------------------- 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/Inc/Patch.h b/Inc/Patch.h index 050b8fa..57bfe6c 100644 --- a/Inc/Patch.h +++ b/Inc/Patch.h @@ -1,70 +1,70 @@ - -class MemoryLock -{ -protected: - - DWORD OldProtect; - - void * Address; - size_t Size; - -public: - - const char * Error; - - inline MemoryLock(void * Address, size_t Size) - { - Error = 0; - - this->Address = Address; - this->Size = Size; - - if(!VirtualProtectEx(GetCurrentProcess(), Address, Size, PAGE_EXECUTE_READWRITE, &OldProtect)) - { - Error = "Failed to change memory protection"; - return; - } - } - - inline ~MemoryLock() - { - if(Error) - return; - - DWORD Unused; - VirtualProtectEx(GetCurrentProcess(), Address, Size, OldProtect, &Unused); - } - - -}; - -class Patch -{ -public: - - const char * Error; - - inline Patch(void * Address, const char * Old, const char * New, size_t Size) - { - Error = 0; - - { MemoryLock Lock(Address, Size); - - if(Lock.Error) - { - Error = Lock.Error; - return; - } - - if(memcmp(Address, Old, Size)) - { - Error = "Old memory isn't as expected - wrong version?"; - return; - } - - memcpy(Address, New, Size); - } - } - -}; - + +class MemoryLock +{ +protected: + + DWORD OldProtect; + + void * Address; + size_t Size; + +public: + + const char * Error; + + inline MemoryLock(void * Address, size_t Size) + { + Error = 0; + + this->Address = Address; + this->Size = Size; + + if(!VirtualProtectEx(GetCurrentProcess(), Address, Size, PAGE_EXECUTE_READWRITE, &OldProtect)) + { + Error = "Failed to change memory protection"; + return; + } + } + + inline ~MemoryLock() + { + if(Error) + return; + + DWORD Unused; + VirtualProtectEx(GetCurrentProcess(), Address, Size, OldProtect, &Unused); + } + + +}; + +class Patch +{ +public: + + const char * Error; + + inline Patch(void * Address, const char * Old, const char * New, size_t Size) + { + Error = 0; + + { MemoryLock Lock(Address, Size); + + if(Lock.Error) + { + Error = Lock.Error; + return; + } + + if(memcmp(Address, Old, Size)) + { + Error = "Old memory isn't as expected - wrong version?"; + return; + } + + memcpy(Address, New, Size); + } + } + +}; + From caedd9d0a9579c7e11c5ea1b192ff0b4d06cb8c0 Mon Sep 17 00:00:00 2001 From: LB Date: Fri, 9 Nov 2012 21:41:50 -0600 Subject: [PATCH 046/127] Make more convenient for users --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3e8dd22..982c2f9 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,9 @@ Extensions/Template/ReleaseEditorUnicode/ Extensions/Template/ReleaseRuntime/ Extensions/Template/ReleaseRuntimeUnicode/ Extensions/Template/Runtime HWA/ - +# Users' extensions if they cloned the repo +!Extensions/Template/ +!Extensions/AutoInstall.bat ################# ## Eclipse From 0119b3557d88735c8d08f9565c2807023e937611 Mon Sep 17 00:00:00 2001 From: LB Date: Fri, 9 Nov 2012 21:44:09 -0600 Subject: [PATCH 047/127] Revert "Make more convenient for users" This reverts commit caedd9d0a9579c7e11c5ea1b192ff0b4d06cb8c0. --- .gitignore | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 982c2f9..3e8dd22 100644 --- a/.gitignore +++ b/.gitignore @@ -8,9 +8,7 @@ Extensions/Template/ReleaseEditorUnicode/ Extensions/Template/ReleaseRuntime/ Extensions/Template/ReleaseRuntimeUnicode/ Extensions/Template/Runtime HWA/ -# Users' extensions if they cloned the repo -!Extensions/Template/ -!Extensions/AutoInstall.bat + ################# ## Eclipse From b0b5c1042c80ece8c4399cd91d5a434c781f716a Mon Sep 17 00:00:00 2001 From: LB Date: Mon, 3 Dec 2012 19:50:55 -0600 Subject: [PATCH 048/127] Update json-parser --- json-parser | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json-parser b/json-parser index 0d4be4b..b1645ee 160000 --- a/json-parser +++ b/json-parser @@ -1 +1 @@ -Subproject commit 0d4be4bffb17eb8b3c47e497f5a129254cc955ca +Subproject commit b1645ee04ddf16ae99b379530add566994f9cce8 From 2f61e4fab551c013cc2624d27a0f14ad16f24e0a Mon Sep 17 00:00:00 2001 From: LB Date: Wed, 12 Dec 2012 19:01:35 -0600 Subject: [PATCH 049/127] Update json-parser --- json-parser | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json-parser b/json-parser index b1645ee..7c11174 160000 --- a/json-parser +++ b/json-parser @@ -1 +1 @@ -Subproject commit b1645ee04ddf16ae99b379530add566994f9cce8 +Subproject commit 7c11174012d60d60a76bbffa429dd4c618c6f71e From 09435b2e83762979513ec835e0713a230ff26507 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Fri, 28 Dec 2012 20:18:00 -0600 Subject: [PATCH 050/127] Fix issue with spaces in project path --- Extensions/Template/Template.vcproj | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index cf86003..2423044 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -115,7 +115,7 @@ /> From 891e0e762b1b4e9a3c452234f3350ee2764fb8b5 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 20 Jan 2013 16:17:03 -0600 Subject: [PATCH 051/127] Update json-parser --- json-parser | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json-parser b/json-parser index 7c11174..5666d81 160000 --- a/json-parser +++ b/json-parser @@ -1 +1 @@ -Subproject commit 7c11174012d60d60a76bbffa429dd4c618c6f71e +Subproject commit 5666d814d5d9b69009d7d514459be690bd8e3ea0 From 864880f9521c0d40d93113ed3775c45c186b280b Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 2 Feb 2013 15:23:04 -0600 Subject: [PATCH 052/127] Fix typo --- Extensions/Template/Properties.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Extensions/Template/Properties.cpp b/Extensions/Template/Properties.cpp index 96490c6..79ba0c2 100644 --- a/Extensions/Template/Properties.cpp +++ b/Extensions/Template/Properties.cpp @@ -166,12 +166,12 @@ void MMF2Func SetPropValue(mv *mV, SerializedED *SED, UINT PropID, CPropValue *P //EditData ed (SED); //switch(PropID) //{ - //case PropData::MyString: + //case Prop::MyString: // { // ed.MyString = (LPSTR)((CPropDataValue*)PropVal)->m_pData; // break; // } - //case PropData::MyInt: + //case Prop::MyInt: // { // ed.MyInt = (CPropDWordValue*)PropVal)->m_dwValue; // break; From 65d676b5fc78c1dfcf5ab6612554fa3ebdd77c46 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Mon, 11 Feb 2013 00:05:45 -0600 Subject: [PATCH 053/127] Revert json-parser submodulization (too many issues) --- .gitmodules | 3 - Extensions/Template/Template.vcproj | 22 +- Inc/json.h | 222 ++++++++ Lib/json.c | 838 ++++++++++++++++++++++++++++ json-parser | 1 - 5 files changed, 1071 insertions(+), 15 deletions(-) delete mode 100644 .gitmodules create mode 100644 Inc/json.h create mode 100644 Lib/json.c delete mode 160000 json-parser diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index d76c3c4..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "json-parser"] - path = json-parser - url = git://github.com/udp/json-parser.git diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index 2423044..4683e32 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -50,7 +50,7 @@ Name="VCCLCompilerTool" Optimization="1" InlineFunctionExpansion="1" - AdditionalIncludeDirectories="..\..\Inc;.\;"..\..\json-parser\"" + AdditionalIncludeDirectories="..\..\Inc;.\;" PreprocessorDefinitions="COXSDK, IN_EXT_VERSION2, _CRT_SECURE_NO_WARNINGS, _CRT_SECURE_NO_DEPRECATE, _WINDOWS,EDITOR" StringPooling="true" MinimalRebuild="false" @@ -152,7 +152,7 @@ diff --git a/Inc/json.h b/Inc/json.h new file mode 100644 index 0000000..f0d10d1 --- /dev/null +++ b/Inc/json.h @@ -0,0 +1,222 @@ + +/* vim: set et ts=3 sw=3 ft=c: + * + * Copyright (C) 2012 James McLaughlin et al. All rights reserved. + * https://github.com/udp/json-parser + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _JSON_H +#define _JSON_H + +#ifndef json_char + #define json_char char +#endif + +#ifdef __cplusplus + + #include + + extern "C" + { + +#endif + +typedef struct +{ + unsigned long max_memory; + int settings; + +} json_settings; + +#define json_relaxed_commas 1 + +typedef enum +{ + json_none, + json_object, + json_array, + json_integer, + json_double, + json_string, + json_boolean, + json_null + +} json_type; + +extern const struct _json_value json_value_none; + +typedef struct _json_value +{ + struct _json_value * parent; + + json_type type; + + union + { + int boolean; + long integer; + double dbl; + + struct + { + unsigned int length; + json_char * ptr; /* null terminated */ + + } string; + + struct + { + unsigned int length; + + struct + { + json_char * name; + struct _json_value * value; + + } * values; + + } object; + + struct + { + unsigned int length; + struct _json_value ** values; + + } array; + + } u; + + union + { + struct _json_value * next_alloc; + void * object_mem; + + } _reserved; + + + /* Some C++ operator sugar */ + + #ifdef __cplusplus + + public: + + inline _json_value () + { memset (this, 0, sizeof (_json_value)); + } + + inline const struct _json_value &operator [] (int index) const + { + if (type != json_array || index < 0 + || ((unsigned int) index) >= u.array.length) + { + return json_value_none; + } + + return *u.array.values [index]; + } + + inline const struct _json_value &operator [] (const char * index) const + { + if (type != json_object) + return json_value_none; + + for (unsigned int i = 0; i < u.object.length; ++ i) + if (!strcmp (u.object.values [i].name, index)) + return *u.object.values [i].value; + + return json_value_none; + } + + inline operator const char * () const + { + switch (type) + { + case json_string: + return u.string.ptr; + + default: + return ""; + }; + } + + inline operator long () const + { + switch (type) + { + case json_integer: + return u.integer; + + case json_double: + return (long) u.dbl; + + default: + return 0; + }; + } + + inline operator bool () const + { + if (type != json_boolean) + return false; + + return u.boolean != 0; + } + + inline operator double () const + { + switch (type) + { + case json_integer: + return u.integer; + + case json_double: + return u.dbl; + + default: + return 0; + }; + } + + #endif + +} json_value; + +json_value * json_parse + (const json_char * json); + +json_value * json_parse_ex + (json_settings * settings, const json_char * json, char * error); + +void json_value_free (json_value *); + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif + + diff --git a/Lib/json.c b/Lib/json.c new file mode 100644 index 0000000..fd9c59f --- /dev/null +++ b/Lib/json.c @@ -0,0 +1,838 @@ + +/* vim: set et ts=3 sw=3 ft=c: + * + * Copyright (C) 2012 James McLaughlin et al. All rights reserved. + * https://github.com/udp/json-parser + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "json.h" + +#ifdef _MSC_VER + #ifndef _CRT_SECURE_NO_WARNINGS + #define _CRT_SECURE_NO_WARNINGS + #endif +#endif + +#ifdef __cplusplus + const struct _json_value json_value_none; /* zero-d by ctor */ +#else + const struct _json_value json_value_none = { 0 }; +#endif + +#include +#include +#include +#include +#include + +typedef unsigned short json_uchar; + +static unsigned char hex_value (json_char c) +{ + if (c >= 'A' && c <= 'F') + return (c - 'A') + 10; + + if (c >= 'a' && c <= 'f') + return (c - 'a') + 10; + + if (c >= '0' && c <= '9') + return c - '0'; + + return 0xFF; +} + +typedef struct +{ + json_settings settings; + int first_pass; + + unsigned long used_memory; + + unsigned int uint_max; + unsigned long ulong_max; + +} json_state; + +static void * json_alloc (json_state * state, unsigned long size, int zero) +{ + void * mem; + + if ((state->ulong_max - state->used_memory) < size) + return 0; + + if (state->settings.max_memory + && (state->used_memory += size) > state->settings.max_memory) + { + return 0; + } + + if (! (mem = zero ? calloc (size, 1) : malloc (size))) + return 0; + + return mem; +} + +static int new_value + (json_state * state, json_value ** top, json_value ** root, json_value ** alloc, json_type type) +{ + json_value * value; + int values_size; + + if (!state->first_pass) + { + value = *top = *alloc; + *alloc = (*alloc)->_reserved.next_alloc; + + if (!*root) + *root = value; + + switch (value->type) + { + case json_array: + + if (! (value->u.array.values = (json_value **) json_alloc + (state, value->u.array.length * sizeof (json_value *), 0)) ) + { + return 0; + } + + value->u.array.length = 0; + break; + + case json_object: + + values_size = sizeof (*value->u.object.values) * value->u.object.length; + + if (! ((*(void **) &value->u.object.values) = json_alloc + (state, values_size + ((unsigned long) value->u.object.values), 0)) ) + { + return 0; + } + + value->_reserved.object_mem = (*(char **) &value->u.object.values) + values_size; + + value->u.object.length = 0; + break; + + case json_string: + + if (! (value->u.string.ptr = (json_char *) json_alloc + (state, (value->u.string.length + 1) * sizeof (json_char), 0)) ) + { + return 0; + } + + value->u.string.length = 0; + break; + + default: + break; + }; + + return 1; + } + + value = (json_value *) json_alloc (state, sizeof (json_value), 1); + + if (!value) + return 0; + + if (!*root) + *root = value; + + value->type = type; + value->parent = *top; + + if (*alloc) + (*alloc)->_reserved.next_alloc = value; + + *alloc = *top = value; + + return 1; +} + +#define e_off \ + ((int) (i - cur_line_begin)) + +#define whitespace \ + case '\n': ++ cur_line; cur_line_begin = i; \ + case ' ': case '\t': case '\r' + +#define string_add(b) \ + do { if (!state.first_pass) string [string_length] = b; ++ string_length; } while (0); + +const static long + flag_next = 1, flag_reproc = 2, flag_need_comma = 4, flag_seek_value = 8, + flag_escaped = 16, flag_string = 32, flag_need_colon = 64, flag_done = 128, + flag_num_negative = 256, flag_num_zero = 512, flag_num_e = 1024, + flag_num_e_got_sign = 2048, flag_num_e_negative = 4096; + +json_value * json_parse_ex (json_settings * settings, const json_char * json, char * error_buf) +{ + json_char error [128]; + unsigned int cur_line; + const json_char * cur_line_begin, * i; + json_value * top, * root, * alloc = 0; + json_state state; + long flags; + long num_digits, num_fraction, num_e; + + error[0] = '\0'; + + memset (&state, 0, sizeof (json_state)); + memcpy (&state.settings, settings, sizeof (json_settings)); + + memset (&state.uint_max, 0xFF, sizeof (state.uint_max)); + memset (&state.ulong_max, 0xFF, sizeof (state.ulong_max)); + + state.uint_max -= 8; /* limit of how much can be added before next check */ + state.ulong_max -= 8; + + for (state.first_pass = 1; state.first_pass >= 0; -- state.first_pass) + { + json_uchar uchar; + unsigned char uc_b1, uc_b2, uc_b3, uc_b4; + json_char * string; + unsigned int string_length; + + top = root = 0; + flags = flag_seek_value; + + cur_line = 1; + cur_line_begin = json; + + for (i = json ;; ++ i) + { + json_char b = *i; + + if (flags & flag_done) + { + if (!b) + break; + + switch (b) + { + whitespace: + continue; + + default: + sprintf (error, "%d:%d: Trailing garbage: `%c`", cur_line, e_off, b); + goto e_failed; + }; + } + + if (flags & flag_string) + { + if (!b) + { sprintf (error, "Unexpected EOF in string (at %d:%d)", cur_line, e_off); + goto e_failed; + } + + if (string_length > state.uint_max) + goto e_overflow; + + if (flags & flag_escaped) + { + flags &= ~ flag_escaped; + + switch (b) + { + case 'b': string_add ('\b'); break; + case 'f': string_add ('\f'); break; + case 'n': string_add ('\n'); break; + case 'r': string_add ('\r'); break; + case 't': string_add ('\t'); break; + case 'u': + + if ((uc_b1 = hex_value (*++ i)) == 0xFF || (uc_b2 = hex_value (*++ i)) == 0xFF + || (uc_b3 = hex_value (*++ i)) == 0xFF || (uc_b4 = hex_value (*++ i)) == 0xFF) + { + sprintf (error, "Invalid character value `%c` (at %d:%d)", b, cur_line, e_off); + goto e_failed; + } + + uc_b1 = uc_b1 * 16 + uc_b2; + uc_b2 = uc_b3 * 16 + uc_b4; + + uchar = ((json_char) uc_b1) * 256 + uc_b2; + + if (sizeof (json_char) >= sizeof (json_uchar) || (uc_b1 == 0 && uc_b2 <= 0x7F)) + { + string_add ((json_char) uchar); + break; + } + + if (uchar <= 0x7FF) + { + if (state.first_pass) + string_length += 2; + else + { string [string_length ++] = 0xC0 | ((uc_b2 & 0xC0) >> 6) | ((uc_b1 & 0x7) << 2); + string [string_length ++] = 0x80 | (uc_b2 & 0x3F); + } + + break; + } + + if (state.first_pass) + string_length += 3; + else + { string [string_length ++] = 0xE0 | ((uc_b1 & 0xF0) >> 4); + string [string_length ++] = 0x80 | ((uc_b1 & 0xF) << 2) | ((uc_b2 & 0xC0) >> 6); + string [string_length ++] = 0x80 | (uc_b2 & 0x3F); + } + + break; + + default: + string_add (b); + }; + + continue; + } + + if (b == '\\') + { + flags |= flag_escaped; + continue; + } + + if (b == '"') + { + if (!state.first_pass) + string [string_length] = 0; + + flags &= ~ flag_string; + string = 0; + + switch (top->type) + { + case json_string: + + top->u.string.length = string_length; + flags |= flag_next; + + break; + + case json_object: + + if (state.first_pass) + (*(json_char **) &top->u.object.values) += string_length + 1; + else + { + top->u.object.values [top->u.object.length].name + = (json_char *) top->_reserved.object_mem; + + (*(json_char **) &top->_reserved.object_mem) += string_length + 1; + } + + flags |= flag_seek_value | flag_need_colon; + continue; + + default: + break; + }; + } + else + { + string_add (b); + continue; + } + } + + if (flags & flag_seek_value) + { + switch (b) + { + whitespace: + continue; + + case ']': + + if (top->type == json_array) + flags = (flags & ~ (flag_need_comma | flag_seek_value)) | flag_next; + else if (!state.settings.settings & json_relaxed_commas) + { sprintf (error, "%d:%d: Unexpected ]", cur_line, e_off); + goto e_failed; + } + + break; + + default: + + if (flags & flag_need_comma) + { + if (b == ',') + { flags &= ~ flag_need_comma; + continue; + } + else + { sprintf (error, "%d:%d: Expected , before %c", cur_line, e_off, b); + goto e_failed; + } + } + + if (flags & flag_need_colon) + { + if (b == ':') + { flags &= ~ flag_need_colon; + continue; + } + else + { sprintf (error, "%d:%d: Expected : before %c", cur_line, e_off, b); + goto e_failed; + } + } + + flags &= ~ flag_seek_value; + + switch (b) + { + case '{': + + if (!new_value (&state, &top, &root, &alloc, json_object)) + goto e_alloc_failure; + + continue; + + case '[': + + if (!new_value (&state, &top, &root, &alloc, json_array)) + goto e_alloc_failure; + + flags |= flag_seek_value; + continue; + + case '"': + + if (!new_value (&state, &top, &root, &alloc, json_string)) + goto e_alloc_failure; + + flags |= flag_string; + + string = top->u.string.ptr; + string_length = 0; + + continue; + + case 't': + + if (*(++ i) != 'r' || *(++ i) != 'u' || *(++ i) != 'e') + goto e_unknown_value; + + if (!new_value (&state, &top, &root, &alloc, json_boolean)) + goto e_alloc_failure; + + top->u.boolean = 1; + + flags |= flag_next; + break; + + case 'f': + + if (*(++ i) != 'a' || *(++ i) != 'l' || *(++ i) != 's' || *(++ i) != 'e') + goto e_unknown_value; + + if (!new_value (&state, &top, &root, &alloc, json_boolean)) + goto e_alloc_failure; + + flags |= flag_next; + break; + + case 'n': + + if (*(++ i) != 'u' || *(++ i) != 'l' || *(++ i) != 'l') + goto e_unknown_value; + + if (!new_value (&state, &top, &root, &alloc, json_null)) + goto e_alloc_failure; + + flags |= flag_next; + break; + + default: + + if (isdigit (b) || b == '-') + { + if (!new_value (&state, &top, &root, &alloc, json_integer)) + goto e_alloc_failure; + + if (!state.first_pass) + { + while (isdigit (b) || b == '+' || b == '-' + || b == 'e' || b == 'E' || b == '.') + { + b = *++ i; + } + + flags |= flag_next | flag_reproc; + break; + } + + flags &= ~ (flag_num_negative | flag_num_e | + flag_num_e_got_sign | flag_num_e_negative | + flag_num_zero); + + num_digits = 0; + num_fraction = 0; + num_e = 0; + + if (b != '-') + { + flags |= flag_reproc; + break; + } + + flags |= flag_num_negative; + continue; + } + else + { sprintf (error, "%d:%d: Unexpected %c when seeking value", cur_line, e_off, b); + goto e_failed; + } + }; + }; + } + else + { + switch (top->type) + { + case json_object: + + switch (b) + { + whitespace: + continue; + + case '"': + + if (flags & flag_need_comma && (!state.settings.settings & json_relaxed_commas)) + { + sprintf (error, "%d:%d: Expected , before \"", cur_line, e_off); + goto e_failed; + } + + flags |= flag_string; + + string = (json_char *) top->_reserved.object_mem; + string_length = 0; + + break; + + case '}': + + flags = (flags & ~ flag_need_comma) | flag_next; + break; + + case ',': + + if (flags & flag_need_comma) + { + flags &= ~ flag_need_comma; + break; + } + + default: + + sprintf (error, "%d:%d: Unexpected `%c` in object", cur_line, e_off, b); + goto e_failed; + }; + + break; + + case json_integer: + case json_double: + + if (isdigit (b)) + { + ++ num_digits; + + if (top->type == json_integer || flags & flag_num_e) + { + if (! (flags & flag_num_e)) + { + if (flags & flag_num_zero) + { sprintf (error, "%d:%d: Unexpected `0` before `%c`", cur_line, e_off, b); + goto e_failed; + } + + if (num_digits == 1 && b == '0') + flags |= flag_num_zero; + } + else + { + flags |= flag_num_e_got_sign; + num_e = (num_e * 10) + (b - '0'); + continue; + } + + top->u.integer = (top->u.integer * 10) + (b - '0'); + continue; + } + + num_fraction = (num_fraction * 10) + (b - '0'); + continue; + } + + if (b == '+' || b == '-') + { + if ( (flags & flag_num_e) && !(flags & flag_num_e_got_sign)) + { + flags |= flag_num_e_got_sign; + + if (b == '-') + flags |= flag_num_e_negative; + + continue; + } + } + else if (b == '.' && top->type == json_integer) + { + if (!num_digits) + { sprintf (error, "%d:%d: Expected digit before `.`", cur_line, e_off); + goto e_failed; + } + + top->type = json_double; + top->u.dbl = top->u.integer; + + num_digits = 0; + continue; + } + + if (! (flags & flag_num_e)) + { + if (top->type == json_double) + { + if (!num_digits) + { sprintf (error, "%d:%d: Expected digit after `.`", cur_line, e_off); + goto e_failed; + } + + top->u.dbl += ((double) num_fraction) / (pow (10, (double) num_digits)); + } + + if (b == 'e' || b == 'E') + { + flags |= flag_num_e; + + if (top->type == json_integer) + { + top->type = json_double; + top->u.dbl = top->u.integer; + } + + num_digits = 0; + flags &= ~ flag_num_zero; + + continue; + } + } + else + { + if (!num_digits) + { sprintf (error, "%d:%d: Expected digit after `e`", cur_line, e_off); + goto e_failed; + } + + top->u.dbl *= pow (10, (double) (flags & flag_num_e_negative ? - num_e : num_e)); + } + + if (flags & flag_num_negative) + { + if (top->type == json_integer) + top->u.integer = - top->u.integer; + else + top->u.dbl = - top->u.dbl; + } + + flags |= flag_next | flag_reproc; + break; + + default: + break; + }; + } + + if (flags & flag_reproc) + { + flags &= ~ flag_reproc; + -- i; + } + + if (flags & flag_next) + { + flags = (flags & ~ flag_next) | flag_need_comma; + + if (!top->parent) + { + /* root value done */ + + flags |= flag_done; + continue; + } + + if (top->parent->type == json_array) + flags |= flag_seek_value; + + if (!state.first_pass) + { + json_value * parent = top->parent; + + switch (parent->type) + { + case json_object: + + parent->u.object.values + [parent->u.object.length].value = top; + + break; + + case json_array: + + parent->u.array.values + [parent->u.array.length] = top; + + break; + + default: + break; + }; + } + + if ( (++ top->parent->u.array.length) > state.uint_max) + goto e_overflow; + + top = top->parent; + + continue; + } + } + + alloc = root; + } + + return root; + +e_unknown_value: + + sprintf (error, "%d:%d: Unknown value", cur_line, e_off); + goto e_failed; + +e_alloc_failure: + + strcpy (error, "Memory allocation failure"); + goto e_failed; + +e_overflow: + + sprintf (error, "%d:%d: Too long (caught overflow)", cur_line, e_off); + goto e_failed; + +e_failed: + + if (error_buf) + { + if (*error) + strcpy (error_buf, error); + else + strcpy (error_buf, "Unknown error"); + } + + if (state.first_pass) + alloc = root; + + while (alloc) + { + top = alloc->_reserved.next_alloc; + free (alloc); + alloc = top; + } + + if (!state.first_pass) + json_value_free (root); + + return 0; +} + +json_value * json_parse (const json_char * json) +{ + json_settings settings; + memset (&settings, 0, sizeof (json_settings)); + + return json_parse_ex (&settings, json, 0); +} + +void json_value_free (json_value * value) +{ + json_value * cur_value; + + if (!value) + return; + + value->parent = 0; + + while (value) + { + switch (value->type) + { + case json_array: + + if (!value->u.array.length) + { + free (value->u.array.values); + break; + } + + value = value->u.array.values [-- value->u.array.length]; + continue; + + case json_object: + + if (!value->u.object.length) + { + free (value->u.object.values); + break; + } + + value = value->u.object.values [-- value->u.object.length].value; + continue; + + case json_string: + + free (value->u.string.ptr); + break; + + default: + break; + }; + + cur_value = value; + value = value->parent; + free (cur_value); + } +} + diff --git a/json-parser b/json-parser deleted file mode 160000 index 5666d81..0000000 --- a/json-parser +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5666d814d5d9b69009d7d514459be690bd8e3ea0 From 33658318ea9a9f66fa34f69ce0d7dc96716599c8 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Tue, 19 Mar 2013 18:37:47 -0500 Subject: [PATCH 054/127] Update json-parser --- Inc/json.h | 17 +++++++++++++---- Lib/json.c | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Inc/json.h b/Inc/json.h index f0d10d1..0822527 100644 --- a/Inc/json.h +++ b/Inc/json.h @@ -35,6 +35,15 @@ #define json_char char #endif +#ifndef json_int_t + #ifndef _WIN32 + #include + #define json_int_t int64_t + #else + #define json_int_t __int64 + #endif +#endif + #ifdef __cplusplus #include @@ -77,7 +86,7 @@ typedef struct _json_value union { int boolean; - long integer; + json_int_t integer; double dbl; struct @@ -162,7 +171,7 @@ typedef struct _json_value }; } - inline operator long () const + inline operator json_int_t () const { switch (type) { @@ -170,7 +179,7 @@ typedef struct _json_value return u.integer; case json_double: - return (long) u.dbl; + return (json_int_t) u.dbl; default: return 0; @@ -190,7 +199,7 @@ typedef struct _json_value switch (type) { case json_integer: - return u.integer; + return (double) u.integer; case json_double: return u.dbl; diff --git a/Lib/json.c b/Lib/json.c index fd9c59f..eeaac50 100644 --- a/Lib/json.c +++ b/Lib/json.c @@ -617,7 +617,7 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch } top->type = json_double; - top->u.dbl = top->u.integer; + top->u.dbl = (double) top->u.integer; num_digits = 0; continue; @@ -642,7 +642,7 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch if (top->type == json_integer) { top->type = json_double; - top->u.dbl = top->u.integer; + top->u.dbl = (double) top->u.integer; } num_digits = 0; From df4bdf2a833980f966a969a34314007fda6aaffd Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 31 Mar 2013 14:30:12 -0500 Subject: [PATCH 055/127] Add EDIStream --- Extensions/Template/Template.vcproj | 4 ++ Inc/EDStream.hpp | 64 +++++++++++++++++++++++++++++ Inc/Edif.h | 2 + 3 files changed, 70 insertions(+) create mode 100644 Inc/EDStream.hpp diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index 4683e32..744bd9b 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -1479,6 +1479,10 @@ RelativePath="..\..\Lib\Edif.Runtime.cpp" > + + diff --git a/Inc/EDStream.hpp b/Inc/EDStream.hpp new file mode 100644 index 0000000..08b5eac --- /dev/null +++ b/Inc/EDStream.hpp @@ -0,0 +1,64 @@ +#ifndef __EditDataStream_HeaderPlusPlus__ +#define __EditDataStream_HeaderPlusPlus__ + +#include +#include +#include +#include + +struct EDIStream : std::basic_istream +{ + struct Buf : std::basic_streambuf + { + Buf(SerializedED const&SED, std::size_t putback = 8) : pb(putback), b(putback) + { + b.reserve(pb + SED.Header.extSize); + for(std::size_t i = 0; i < SED.Header.extSize; ++i) + { + b.push_back(SED.data[i]); + } + setg(&b.front(), &b.front() + pb, &b.front() + b.size()); + } + virtual ~Buf() + { + } + + private: + std::size_t pb; + std::vector b; + + virtual int_type underflow() + { + if(gptr() < egptr()) + { + return traits_type::to_int_type(*gptr()); + } + return traits_type::eof(); + } + + Buf(Buf const&); + Buf &operator=(Buf const&); + }; + + EDIStream(SerializedED const*SED) : b(*SED), std::basic_istream(&b) + { + } + virtual ~EDIStream() + { + } + +private: + Buf b; + + EDIStream(EDIStream const&); + EDIStream &operator=(EDIStream const&); +}; + +//struct EDOStream : std::basic_ostream +//{ +// struct Buf : std::basic_streambuf +// { +// }; +//}; + +#endif diff --git a/Inc/Edif.h b/Inc/Edif.h index 9653cd1..4b467dc 100644 --- a/Inc/Edif.h +++ b/Inc/Edif.h @@ -269,4 +269,6 @@ struct SerializedED char data[1]; }; +#include "EDStream.hpp" + #define MMF2Func WINAPI DLLExport From 8c35d007b5888c42cd46bbfe49b4d706ccf07170 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 31 Mar 2013 20:52:14 -0500 Subject: [PATCH 056/127] Add EDOStream EDIStream and EDOStream are both still untested! --- Inc/EDStream.hpp | 61 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 7 deletions(-) diff --git a/Inc/EDStream.hpp b/Inc/EDStream.hpp index 08b5eac..0beb418 100644 --- a/Inc/EDStream.hpp +++ b/Inc/EDStream.hpp @@ -25,7 +25,7 @@ struct EDIStream : std::basic_istream private: std::size_t pb; - std::vector b; + std::vector b; virtual int_type underflow() { @@ -54,11 +54,58 @@ struct EDIStream : std::basic_istream EDIStream &operator=(EDIStream const&); }; -//struct EDOStream : std::basic_ostream -//{ -// struct Buf : std::basic_streambuf -// { -// }; -//}; +struct EDOStream : std::basic_ostream +{ + struct Buf : std::basic_streambuf + { + Buf(mv *mV, SerializedED *&SED) : mV(mV), SED(SED) + { + setp(&b.front(), &b.front()); + } + + private: + mv *mV; + SerializedED *&SED; + std::vector b; + + virtual int_type overflow(int_type ch) + { + if(ch != traits_type::eof()) + { + b.push_back(char_type(ch)); + setp(&b.front(), &b.back()+1, &b.back()+1); + } + return traits_type::eof(); + } + virtual int sync() + { + std::size_t size = (&b.back() + 1) - &b.front(); + SerializedED *t = (SerializedED *)mvReAllocEditData(mV, SED, sizeof(SerializedED)+size); + if(t) + { + SED = t; + memcpy(&SED->data, &b.front(), size); + return 0; + } + return -1; + } + + Buf(Buf const&); + Buf &operator=(Buf const&); + }; + + EDOStream(mv *mV, SerializedED *&SED) : b(mV, SED), std::basic_ostream(&b) + { + } + virtual ~EDOStream() + { + } + +private: + Buf b; + + EDOStream(EDOStream const&); + EDOStream &operator=(EDOStream const&); +}; #endif From 76cb3b024923bda12c61898fbb4f29bf5c3fa128 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 31 Mar 2013 20:57:47 -0500 Subject: [PATCH 057/127] Add warning --- Inc/EDStream.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Inc/EDStream.hpp b/Inc/EDStream.hpp index 0beb418..b53fd1b 100644 --- a/Inc/EDStream.hpp +++ b/Inc/EDStream.hpp @@ -1,3 +1,7 @@ +/* Note: + * This is not an independent header! + */ + #ifndef __EditDataStream_HeaderPlusPlus__ #define __EditDataStream_HeaderPlusPlus__ From 1eb2fd0d868e047f4cc95cd4ded4ea78ea8a5388 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 31 Mar 2013 20:59:40 -0500 Subject: [PATCH 058/127] Add missing explicit destructor --- Inc/EDStream.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Inc/EDStream.hpp b/Inc/EDStream.hpp index b53fd1b..1d4d60f 100644 --- a/Inc/EDStream.hpp +++ b/Inc/EDStream.hpp @@ -66,6 +66,9 @@ struct EDOStream : std::basic_ostream { setp(&b.front(), &b.front()); } + virtual ~Buf() + { + } private: mv *mV; From fe44dfd863b63c63c799fa8652b6b98c3130802c Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Fri, 5 Apr 2013 21:34:01 -0500 Subject: [PATCH 059/127] Fix gitignore to only track Template --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 3e8dd22..fa3983e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ # Template project built files +Extensions/ +!Extensions/Template/ Extensions/Template/MFX/ Extensions/Template/Debug HWA/ Extensions/Template/DebugUnicode/ From 74fbe50ad7c9b0be640cd171bb861bc77c1fefd0 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Mon, 8 Apr 2013 22:45:48 -0500 Subject: [PATCH 060/127] Fix gitignore to only track Template --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 3e8dd22..fa3983e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ # Template project built files +Extensions/ +!Extensions/Template/ Extensions/Template/MFX/ Extensions/Template/Debug HWA/ Extensions/Template/DebugUnicode/ From ac0d06d406f84dfff469d690201109430d4424b8 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Tue, 9 Apr 2013 16:14:13 -0500 Subject: [PATCH 061/127] Rename high-level template project --- .gitignore | 16 +- Extensions/Template/.gitignore | 116 ------------ Extensions/TemplatePlusPlus/.gitignore | 175 ++++++++++++++++++ .../Actions.cpp | 0 .../{Template => TemplatePlusPlus}/Common.h | 0 .../Conditions.cpp | 0 .../CustomParams.cpp | 0 .../Debugger.cpp | 0 .../EditData.hpp | 0 .../Edittime.cpp | 0 .../Expressions.cpp | 0 .../{Template => TemplatePlusPlus}/Ext.def | 0 .../{Template => TemplatePlusPlus}/Ext.json | 0 .../{Template => TemplatePlusPlus}/Ext.rc | 0 .../Extension.cpp | 0 .../Extension.hpp | 0 .../General.cpp | 0 .../{Template => TemplatePlusPlus}/Icon.png | Bin .../Properties.cpp | 0 .../Runtime.cpp | 0 .../Template.sln | 0 .../Template.vcproj | 0 .../{Template => TemplatePlusPlus}/Text.cpp | 0 .../TextProps.cpp | 0 .../{Template => TemplatePlusPlus}/resource.h | 0 25 files changed, 179 insertions(+), 128 deletions(-) delete mode 100644 Extensions/Template/.gitignore create mode 100644 Extensions/TemplatePlusPlus/.gitignore rename Extensions/{Template => TemplatePlusPlus}/Actions.cpp (100%) rename Extensions/{Template => TemplatePlusPlus}/Common.h (100%) rename Extensions/{Template => TemplatePlusPlus}/Conditions.cpp (100%) rename Extensions/{Template => TemplatePlusPlus}/CustomParams.cpp (100%) rename Extensions/{Template => TemplatePlusPlus}/Debugger.cpp (100%) rename Extensions/{Template => TemplatePlusPlus}/EditData.hpp (100%) rename Extensions/{Template => TemplatePlusPlus}/Edittime.cpp (100%) rename Extensions/{Template => TemplatePlusPlus}/Expressions.cpp (100%) rename Extensions/{Template => TemplatePlusPlus}/Ext.def (100%) rename Extensions/{Template => TemplatePlusPlus}/Ext.json (100%) rename Extensions/{Template => TemplatePlusPlus}/Ext.rc (100%) rename Extensions/{Template => TemplatePlusPlus}/Extension.cpp (100%) rename Extensions/{Template => TemplatePlusPlus}/Extension.hpp (100%) rename Extensions/{Template => TemplatePlusPlus}/General.cpp (100%) rename Extensions/{Template => TemplatePlusPlus}/Icon.png (100%) rename Extensions/{Template => TemplatePlusPlus}/Properties.cpp (100%) rename Extensions/{Template => TemplatePlusPlus}/Runtime.cpp (100%) rename Extensions/{Template => TemplatePlusPlus}/Template.sln (100%) rename Extensions/{Template => TemplatePlusPlus}/Template.vcproj (100%) rename Extensions/{Template => TemplatePlusPlus}/Text.cpp (100%) rename Extensions/{Template => TemplatePlusPlus}/TextProps.cpp (100%) rename Extensions/{Template => TemplatePlusPlus}/resource.h (100%) diff --git a/.gitignore b/.gitignore index fa3983e..35b6b43 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,7 @@ -# Template project built files -Extensions/ -!Extensions/Template/ -Extensions/Template/MFX/ -Extensions/Template/Debug HWA/ -Extensions/Template/DebugUnicode/ -Extensions/Template/Edittime HWA/ -Extensions/Template/ReleaseEditor/ -Extensions/Template/ReleaseEditorUnicode/ -Extensions/Template/ReleaseRuntime/ -Extensions/Template/ReleaseRuntimeUnicode/ -Extensions/Template/Runtime HWA/ +# Only keep template projects +/Extensions/ +!/Extensions/Template/ +!/Extensions/TemplatePlusPlus/ ################# diff --git a/Extensions/Template/.gitignore b/Extensions/Template/.gitignore deleted file mode 100644 index a85b118..0000000 --- a/Extensions/Template/.gitignore +++ /dev/null @@ -1,116 +0,0 @@ -#Ignore MFX builds -MFX/ - -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.sln.docstates - -# Build results - -[Dd]ebug*/ -[Rr]elease*/ -Run_Only*/ -[Rr]untime*/ -[Ee]dittime*/ - -build/ - - -[Tt]est[Rr]esult -[Bb]uild[Ll]og.* - -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.vspscc -*.vssscc -.builds - -*.pidb - -*.log -*.scc -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf - -# Visual Studio profiler -*.psess -*.vsp - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ - -*.[Rr]e[Ss]harper - -# NCrunch -*.ncrunch* -.*crunch*.local.xml - -# Installshield output folder -[Ee]xpress - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish - -# Publish Web Output -*.Publish.xml - -# Others -[Bb]in -[Oo]bj -sql -TestResults -[Tt]est[Rr]esult* -*.Cache -ClientBin -[Ss]tyle[Cc]op.* -~$* -*.dbmdl - -*.[Pp]ublish.xml - -Generated_Code #added for RIA/Silverlight projects - -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML - -# NuGet -packages/ - - diff --git a/Extensions/TemplatePlusPlus/.gitignore b/Extensions/TemplatePlusPlus/.gitignore new file mode 100644 index 0000000..5fda6e4 --- /dev/null +++ b/Extensions/TemplatePlusPlus/.gitignore @@ -0,0 +1,175 @@ +# Template project built files +MFX/ +Debug HWA/ +DebugUnicode/ +Edittime HWA/ +ReleaseEditor/ +ReleaseEditorUnicode/ +ReleaseRuntime/ +ReleaseRuntimeUnicode/ +Runtime HWA/ + + +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Rr]elease/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.vspscc +.builds +*.dotCover + +## TODO: If you have NuGet Package Restore enabled, uncomment this +#packages/ + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp + +# ReSharper is a .NET coding add-in +_ReSharper* + +# Installshield output folder +[Ee]xpress + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish + +# Others +[Bb]in +[Oo]bj +sql +TestResults +*.Cache +ClientBin +stylecop.* +~$* +*.dbmdl +Generated_Code #added for RIA/Silverlight projects + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML + + + +############ +## Windows +############ + +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg + +# Mac crap +.DS_Store diff --git a/Extensions/Template/Actions.cpp b/Extensions/TemplatePlusPlus/Actions.cpp similarity index 100% rename from Extensions/Template/Actions.cpp rename to Extensions/TemplatePlusPlus/Actions.cpp diff --git a/Extensions/Template/Common.h b/Extensions/TemplatePlusPlus/Common.h similarity index 100% rename from Extensions/Template/Common.h rename to Extensions/TemplatePlusPlus/Common.h diff --git a/Extensions/Template/Conditions.cpp b/Extensions/TemplatePlusPlus/Conditions.cpp similarity index 100% rename from Extensions/Template/Conditions.cpp rename to Extensions/TemplatePlusPlus/Conditions.cpp diff --git a/Extensions/Template/CustomParams.cpp b/Extensions/TemplatePlusPlus/CustomParams.cpp similarity index 100% rename from Extensions/Template/CustomParams.cpp rename to Extensions/TemplatePlusPlus/CustomParams.cpp diff --git a/Extensions/Template/Debugger.cpp b/Extensions/TemplatePlusPlus/Debugger.cpp similarity index 100% rename from Extensions/Template/Debugger.cpp rename to Extensions/TemplatePlusPlus/Debugger.cpp diff --git a/Extensions/Template/EditData.hpp b/Extensions/TemplatePlusPlus/EditData.hpp similarity index 100% rename from Extensions/Template/EditData.hpp rename to Extensions/TemplatePlusPlus/EditData.hpp diff --git a/Extensions/Template/Edittime.cpp b/Extensions/TemplatePlusPlus/Edittime.cpp similarity index 100% rename from Extensions/Template/Edittime.cpp rename to Extensions/TemplatePlusPlus/Edittime.cpp diff --git a/Extensions/Template/Expressions.cpp b/Extensions/TemplatePlusPlus/Expressions.cpp similarity index 100% rename from Extensions/Template/Expressions.cpp rename to Extensions/TemplatePlusPlus/Expressions.cpp diff --git a/Extensions/Template/Ext.def b/Extensions/TemplatePlusPlus/Ext.def similarity index 100% rename from Extensions/Template/Ext.def rename to Extensions/TemplatePlusPlus/Ext.def diff --git a/Extensions/Template/Ext.json b/Extensions/TemplatePlusPlus/Ext.json similarity index 100% rename from Extensions/Template/Ext.json rename to Extensions/TemplatePlusPlus/Ext.json diff --git a/Extensions/Template/Ext.rc b/Extensions/TemplatePlusPlus/Ext.rc similarity index 100% rename from Extensions/Template/Ext.rc rename to Extensions/TemplatePlusPlus/Ext.rc diff --git a/Extensions/Template/Extension.cpp b/Extensions/TemplatePlusPlus/Extension.cpp similarity index 100% rename from Extensions/Template/Extension.cpp rename to Extensions/TemplatePlusPlus/Extension.cpp diff --git a/Extensions/Template/Extension.hpp b/Extensions/TemplatePlusPlus/Extension.hpp similarity index 100% rename from Extensions/Template/Extension.hpp rename to Extensions/TemplatePlusPlus/Extension.hpp diff --git a/Extensions/Template/General.cpp b/Extensions/TemplatePlusPlus/General.cpp similarity index 100% rename from Extensions/Template/General.cpp rename to Extensions/TemplatePlusPlus/General.cpp diff --git a/Extensions/Template/Icon.png b/Extensions/TemplatePlusPlus/Icon.png similarity index 100% rename from Extensions/Template/Icon.png rename to Extensions/TemplatePlusPlus/Icon.png diff --git a/Extensions/Template/Properties.cpp b/Extensions/TemplatePlusPlus/Properties.cpp similarity index 100% rename from Extensions/Template/Properties.cpp rename to Extensions/TemplatePlusPlus/Properties.cpp diff --git a/Extensions/Template/Runtime.cpp b/Extensions/TemplatePlusPlus/Runtime.cpp similarity index 100% rename from Extensions/Template/Runtime.cpp rename to Extensions/TemplatePlusPlus/Runtime.cpp diff --git a/Extensions/Template/Template.sln b/Extensions/TemplatePlusPlus/Template.sln similarity index 100% rename from Extensions/Template/Template.sln rename to Extensions/TemplatePlusPlus/Template.sln diff --git a/Extensions/Template/Template.vcproj b/Extensions/TemplatePlusPlus/Template.vcproj similarity index 100% rename from Extensions/Template/Template.vcproj rename to Extensions/TemplatePlusPlus/Template.vcproj diff --git a/Extensions/Template/Text.cpp b/Extensions/TemplatePlusPlus/Text.cpp similarity index 100% rename from Extensions/Template/Text.cpp rename to Extensions/TemplatePlusPlus/Text.cpp diff --git a/Extensions/Template/TextProps.cpp b/Extensions/TemplatePlusPlus/TextProps.cpp similarity index 100% rename from Extensions/Template/TextProps.cpp rename to Extensions/TemplatePlusPlus/TextProps.cpp diff --git a/Extensions/Template/resource.h b/Extensions/TemplatePlusPlus/resource.h similarity index 100% rename from Extensions/Template/resource.h rename to Extensions/TemplatePlusPlus/resource.h From 44d1a935dba99366b08f4e6925385951952b8d42 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Fri, 12 Apr 2013 17:24:50 -0500 Subject: [PATCH 062/127] Update Template.mfx warning message Now instructs to update project name rather than the now nonexistant Buildettings.vsprops --- Extensions/TemplatePlusPlus/Extension.hpp | 2 +- Lib/Edif.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Extensions/TemplatePlusPlus/Extension.hpp b/Extensions/TemplatePlusPlus/Extension.hpp index 2d83ed9..ea46464 100644 --- a/Extensions/TemplatePlusPlus/Extension.hpp +++ b/Extensions/TemplatePlusPlus/Extension.hpp @@ -47,7 +47,7 @@ class Extension * version of MMF2 to get access to some * new SDK feature. */ - static const int MinimumBuild = 255; + static const int MinimumBuild = 257; /* Version * This is the version of your extension diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index ceab55b..d20dcd7 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -68,10 +68,10 @@ void Edif::Init(mv * _far mV, LPEDATA edPtr) { TCHAR *extname; MessageBox(0, _T("You forgot to change the MFX filename ") - _T("in BuildSettings.vsprops!\nChange the ") - _T("\"Template.mfx\" filename to whatever ") + _T("via the SDK Project name!\nChange the ") + _T("\"Template\" project name to whatever ") _T("filename you want (letters/underscores") - _T(" only, please)."), + _T(" only) The .mfx will be added for you."), (_T("\"")+std::basic_string(extname = ConvertString(::SDK->json["About"]["Name"])) +_T("\" named Template.mfx - EDIF")).c_str(), MB_OK); FreeString(extname); From 7061a329933d16c3ee42130082c0450e0316f97c Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 13 Apr 2013 08:51:14 -0500 Subject: [PATCH 063/127] Add back original EDIF template project --- Extensions/Template/Actions.cpp | 10 + Extensions/Template/Common.h | 23 + Extensions/Template/Conditions.cpp | 9 + Extensions/Template/Edittime.cpp | 799 ++++++++++++++ Extensions/Template/Expressions.cpp | 12 + Extensions/Template/Ext.def | 110 ++ Extensions/Template/Ext.json | 91 ++ Extensions/Template/Ext.rc | 156 +++ Extensions/Template/Extension.cpp | 160 +++ Extensions/Template/Extension.h | 83 ++ Extensions/Template/General.cpp | 165 +++ Extensions/Template/Icon.png | Bin 0 -> 4524 bytes Extensions/Template/Runtime.cpp | 394 +++++++ Extensions/Template/Template.sln | 41 + Extensions/Template/Template.vcproj | 1560 +++++++++++++++++++++++++++ Extensions/Template/resource.h | 18 + 16 files changed, 3631 insertions(+) create mode 100644 Extensions/Template/Actions.cpp create mode 100644 Extensions/Template/Common.h create mode 100644 Extensions/Template/Conditions.cpp create mode 100644 Extensions/Template/Edittime.cpp create mode 100644 Extensions/Template/Expressions.cpp create mode 100644 Extensions/Template/Ext.def create mode 100644 Extensions/Template/Ext.json create mode 100644 Extensions/Template/Ext.rc create mode 100644 Extensions/Template/Extension.cpp create mode 100644 Extensions/Template/Extension.h create mode 100644 Extensions/Template/General.cpp create mode 100644 Extensions/Template/Icon.png create mode 100644 Extensions/Template/Runtime.cpp create mode 100644 Extensions/Template/Template.sln create mode 100644 Extensions/Template/Template.vcproj create mode 100644 Extensions/Template/resource.h diff --git a/Extensions/Template/Actions.cpp b/Extensions/Template/Actions.cpp new file mode 100644 index 0000000..e798f4c --- /dev/null +++ b/Extensions/Template/Actions.cpp @@ -0,0 +1,10 @@ + +#include "Common.h" + +void Extension::ActionExample(int ExampleParameter) +{ +} + +void Extension::SecondActionExample() +{ +} diff --git a/Extensions/Template/Common.h b/Extensions/Template/Common.h new file mode 100644 index 0000000..95add92 --- /dev/null +++ b/Extensions/Template/Common.h @@ -0,0 +1,23 @@ +#pragma once + +// #define TGFEXT // TGF2, MMF2, MMF2 Dev + #define MMFEXT // MMF2, MMF2 Dev +// #define PROEXT // MMF2 Dev only + +#include "Edif.h" +#include "Resource.h" + +// edPtr : Used at edittime and saved in the MFA/CCN/EXE files + +struct EDITDATA +{ + // Header - required + extHeader eHeader; + + // Object's data +// short swidth; +// short sheight; + +}; + +#include "Extension.h" diff --git a/Extensions/Template/Conditions.cpp b/Extensions/Template/Conditions.cpp new file mode 100644 index 0000000..00f3a10 --- /dev/null +++ b/Extensions/Template/Conditions.cpp @@ -0,0 +1,9 @@ + +#include "Common.h" + +bool Extension::AreTwoNumbersEqual(int First, int Second) +{ + return First == Second; +} + + diff --git a/Extensions/Template/Edittime.cpp b/Extensions/Template/Edittime.cpp new file mode 100644 index 0000000..ce41fa8 --- /dev/null +++ b/Extensions/Template/Edittime.cpp @@ -0,0 +1,799 @@ + +// ============================================================================ +// +// This file contains routines that are handled only during the Edittime, +// under the Frame and Event editors. +// +// Including creating, display, and setting up your object. +// +// ============================================================================ + +#include "Common.h" + +#if !defined(RUN_ONLY) + +// PROPERTIES ///////////////////////////////////////////////////////////////// + +// Property identifiers +enum { + PROPID_SETTINGS = PROPID_EXTITEM_CUSTOM_FIRST, + +// Example +// ------- +// PROPID_TEXTTITLE, +// PROPID_TEXT, +// PROPID_CHECK, +// PROPID_COMBO, +// PROPID_COLOR, + +}; + +// Example of content of the PROPID_COMBO combo box +//LPCSTR ComboList[] = { +// 0, // reserved +// MAKEINTRESOURCE(IDS_FIRSTOPTION), +// MAKEINTRESOURCE(IDS_SECONDOPTION), +// MAKEINTRESOURCE(IDS_THIRDOPTION), +// NULL +//}; + +// Property definitions +// +// Type, ID, Text, Text of Info box [, Options, Init Param] +// +PropData Properties[] = { + +// Example +// ------- +// PropData_Group (PROPID_TEXTTITLE, IDS_PROP_TEXTTITLE, IDS_PROP_TEXTTITLE), +// PropData_EditString (PROPID_TEXT, IDS_PROP_TEXT, IDS_PROP_TEXT_INFO), +// PropData_CheckBox (PROPID_CHECK, IDS_PROP_CHECK, IDS_PROP_CHECK_INFO), +// PropData_ComboBox (PROPID_COMBO, IDS_PROP_COMBO, IDS_PROP_COMBO, ComboList), +// PropData_Color (PROPID_COLOR, IDS_PROP_COLOR, IDS_PROP_COLOR_INFO), + + + // End of table (required) + PropData_End() +}; + + +#endif // !defined(RUN_ONLY) + + +// ============================================================================ +// +// ROUTINES USED UNDER FRAME EDITOR +// +// ============================================================================ + + +// -------------------- +// MakeIcon +// -------------------- +// Called once object is created or modified, just after setup. +// Also called before showing the "Insert an object" dialog if your object +// has no icon resource + +int WINAPI DLLExport MakeIconEx ( mv _far *mV, cSurface* pIconSf, LPTSTR lpName, fpObjInfo oiPtr, LPEDATA edPtr ) +{ +#ifndef RUN_ONLY + + pIconSf->Delete(); + pIconSf->Clone(*SDK->Icon); + + pIconSf->SetTransparentColor(RGB(255, 0, 255)); + +#endif // !defined(RUN_ONLY) + return 0; +} + + +// -------------------- +// CreateObject +// -------------------- +// Called when you choose "Create new object". It should display the setup box +// and initialize everything in the datazone. + +int WINAPI DLLExport CreateObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr) +{ +#ifndef RUN_ONLY + + // Check compatibility + if ( IS_COMPATIBLE(mV) ) + { + Edif::Init(mV, edPtr); + + // Set default object settings +// edPtr->swidth = 48; +// edPtr->sheight = 48; + + return 0; + } +#endif // !defined(RUN_ONLY) + + // Error + return -1; +} + +// -------------------- +// EditObject +// -------------------- +// Called when the user selects the Edit command in the object's popup menu +// +BOOL WINAPI EditObject (mv _far *mV, fpObjInfo oiPtr, fpLevObj loPtr, LPEDATA edPtr) +{ +#ifndef RUN_ONLY + // Check compatibility + if ( IS_COMPATIBLE(mV) ) + { + + } +#endif // !defined(RUN_ONLY) + return FALSE; +} + +// -------------------- +// SetEditSize +// -------------------- +// Called when the object has been resized +// +// Note: remove the comments if your object can be resized (and remove the comments in the .def file) +/* +BOOL WINAPI SetEditSize(LPMV mv, LPEDATA edPtr, int cx, int cy) +{ +#ifndef RUN_ONLY + edPtr->swidth = cx; + edPtr->sheight = cy; +#endif // !defined(RUN_ONLY) + return TRUE; // OK +} +*/ + +// -------------------- +// PutObject +// -------------------- +// Called when each individual object is dropped in the frame. +// +void WINAPI DLLExport PutObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr, ushort cpt) +{ +#ifndef RUN_ONLY +#endif // !defined(RUN_ONLY) +} + +// -------------------- +// RemoveObject +// -------------------- +// Called when each individual object is removed from the frame. +// +void WINAPI DLLExport RemoveObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr, ushort cpt) +{ +#ifndef RUN_ONLY + // Is the last object removed? + if (0 == cpt) + { + Edif::Free(edPtr); + + // Do whatever necessary to remove our data + } +#endif // !defined(RUN_ONLY) +} + +// -------------------- +// DuplicateObject +// -------------------- +// Called when an object is created from another one (note: should be called CloneObject instead...) +// +void WINAPI DLLExport DuplicateObject(mv __far *mV, fpObjInfo oiPtr, LPEDATA edPtr) +{ +#ifndef RUN_ONLY +#endif // !defined(RUN_ONLY) +} + +// -------------------- +// GetObjectRect +// -------------------- +// Returns the size of the rectangle of the object in the frame editor. +// +void WINAPI DLLExport GetObjectRect(mv _far *mV, RECT FAR *rc, fpLevObj loPtr, LPEDATA edPtr) +{ +#ifndef RUN_ONLY + rc->right = rc->left + SDK->Icon->GetWidth(); // edPtr->swidth; + rc->bottom = rc->top + SDK->Icon->GetHeight(); // edPtr->sheight; +#endif // !defined(RUN_ONLY) + return; +} + + +// -------------------- +// EditorDisplay +// -------------------- +// Displays the object under the frame editor +// + +void WINAPI DLLExport EditorDisplay(mv _far *mV, fpObjInfo oiPtr, fpLevObj loPtr, LPEDATA edPtr, RECT FAR *rc) +{ +#ifndef RUN_ONLY + + LPSURFACE Surface = WinGetSurface((int) mV->mvIdEditWin); + + if(!Surface) + return; + + SDK->Icon->Blit(*Surface, rc->left, rc->top, BMODE_TRANSP, BOP_COPY, 0); + +#endif // !defined(RUN_ONLY) +} + + +// -------------------- +// IsTransparent +// -------------------- +// This routine tells MMF2 if the mouse pointer is over a transparent zone of the object. +// + +extern "C" BOOL WINAPI DLLExport IsTransparent(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr, int dx, int dy) +{ +#ifndef RUN_ONLY + // Write your code here +#endif // !defined(RUN_ONLY) + return FALSE; +} + +// -------------------- +// PrepareToWriteObject +// -------------------- +// Just before writing the datazone when saving the application, MMF2 calls this routine. +// +void WINAPI DLLExport PrepareToWriteObject(mv _far *mV, LPEDATA edPtr, fpObjInfo adoi) +{ +#ifndef RUN_ONLY + + // Write your code here +#endif // !defined(RUN_ONLY) +} + +// -------------------- +// GetFilters +// -------------------- + +BOOL WINAPI GetFilters(LPMV mV, LPEDATA edPtr, DWORD dwFlags, LPVOID pReserved) +{ +#ifndef RUN_ONLY + // If your extension uses image filters +// if ( (dwFlags & GETFILTERS_IMAGES) != 0 ) +// return TRUE; + + // If your extension uses sound filters +// if ( (dwFlags & GETFILTERS_SOUNDS) != 0 ) +// return TRUE; +#endif // RUN_ONLY + return FALSE; +} + +// -------------------- +// UsesFile +// -------------------- +// Triggers when a file is dropped onto the frame +// Return TRUE if you can create an object from the given file +// +BOOL WINAPI DLLExport UsesFile (LPMV mV, LPTSTR fileName) +{ + BOOL r = FALSE; +#ifndef RUN_ONLY + + // Example: return TRUE if file extension is ".txt" +/* + LPSTR ext, npath; + + if ( fileName != NULL ) + { + if ( (ext=(LPSTR)malloc(_MAX_EXT)) != NULL ) + { + if ( (npath=(LPSTR)malloc(_MAX_PATH)) != NULL ) + { + strcpy(npath, fileName); + _splitpath(npath, NULL, NULL, NULL, ext); + if ( _stricmp(ext, ".txt") == 0 ) + r = TRUE; + free(npath); + } + free(ext); + } + } */ +#endif // !defined(RUN_ONLY) + return r; +} + + +// -------------------- +// CreateFromFile +// -------------------- +// Creates a new object from file +// +void WINAPI DLLExport CreateFromFile (LPMV mV, LPTSTR fileName, LPEDATA edPtr) +{ +#ifndef RUN_ONLY + // Initialize your extension data from the given file +// edPtr->swidth = 48; +// edPtr->sheight = 48; + + // Example: store the filename + // strcpy(edPtr->myFileName, fileName); +#endif // !defined(RUN_ONLY) +} + +// ============================================================================ +// +// PROPERTIES +// +// ============================================================================ + +// -------------------- +// GetProperties +// -------------------- +// Inserts properties into the properties of the object. +// +BOOL WINAPI DLLExport GetProperties(LPMV mV, LPEDATA edPtr, BOOL bMasterItem) +{ +#ifndef RUN_ONLY + mvInsertProps(mV, edPtr, Properties, PROPID_TAB_GENERAL, TRUE); +#endif // !defined(RUN_ONLY) + + // OK + return TRUE; +} + +// -------------------- +// ReleaseProperties +// -------------------- +// Called when the properties are removed from the property window. +// +void WINAPI DLLExport ReleaseProperties(LPMV mV, LPEDATA edPtr, BOOL bMasterItem) +{ +#ifndef RUN_ONLY + // Write your code here +#endif // !defined(RUN_ONLY) +} + +// -------------------- +// GetPropCreateParam +// -------------------- +// Called when a property is initialized and its creation parameter is NULL (in the PropData). +// Allows you, for example, to change the content of a combobox property according to specific settings in the EDITDATA structure. +// +LPARAM WINAPI DLLExport GetPropCreateParam(LPMV mV, LPEDATA edPtr, UINT nPropID) +{ +#ifndef RUN_ONLY + // Example + // ------- +// if ( nPropID == PROPID_COMBO ) +// { +// switch (edPtr->sType) +// { +// case TYPE1: +// return (LPARAM)ComboList1; +// case TYPE2: +// return (LPARAM)ComboList2; +// } +// } +#endif // !defined(RUN_ONLY) + return NULL; +} + +// ---------------------- +// ReleasePropCreateParam +// ---------------------- +// Called after a property has been initialized. +// Allows you, for example, to free memory allocated in GetPropCreateParam. +// +void WINAPI DLLExport ReleasePropCreateParam(LPMV mV, LPEDATA edPtr, UINT nPropID, LPARAM lParam) +{ +#ifndef RUN_ONLY +#endif // !defined(RUN_ONLY) +} + +// -------------------- +// GetPropValue +// -------------------- +// Returns the value of properties that have a value. +// Note: see GetPropCheck for checkbox properties +// +LPVOID WINAPI DLLExport GetPropValue(LPMV mV, LPEDATA edPtr, UINT nPropID) +{ +#ifndef RUN_ONLY + // Example + // ------- +// switch (nPropID) { +// +// // Returns a color. +// case PROPID_COLOR: +// return new CPropDWordValue(edPtr->dwColor); +// +// // Returns a string +// case PROPID_TEXT: +// return new CPropDataValue(&edPtr->szText[0]); +// +// // Returns the value of the combo box +// case PROPID_COMBO: +// return new CPropDWordValue(edPtr->nComboIndex); +// } + +#endif // !defined(RUN_ONLY) + return NULL; +} + +// -------------------- +// GetPropCheck +// -------------------- +// Returns the checked state of properties that have a check box. +// +BOOL WINAPI DLLExport GetPropCheck(LPMV mV, LPEDATA edPtr, UINT nPropID) +{ +#ifndef RUN_ONLY + // Example + // ------- +// switch (nPropID) { +// +// // Return 0 (unchecked) or 1 (checked) +// case PROPID_CHECK: +// return edPtr->nCheck; +// } + +#endif // !defined(RUN_ONLY) + return 0; // Unchecked +} + +// -------------------- +// SetPropValue +// -------------------- +// This routine is called by MMF after a property has been modified. +// +void WINAPI DLLExport SetPropValue(LPMV mV, LPEDATA edPtr, UINT nPropID, LPVOID lParam) +{ +#ifndef RUN_ONLY + // Gets the pointer to the CPropValue structure + CPropValue* pValue = (CPropValue*)lParam; + + // Example + // ------- +// switch (nPropID) { +// +// case PROPID_COMBO: +// // Simply grab the value +// edPtr->nComboIndex = ((CPropDWordValue*)pValue)->m_dwValue; +// break; + +// case PROPID_COLOR: +// // Here too, gets the value +// edPtr->dwColor = ((CPropDWordValue*)pValue)->m_dwValue; +// break; + +// case PROPID_TEXT: +// { +// // Gets the string +// LPSTR pStr = (LPSTR)((CPropDataValue*)pValue)->m_pData; +// +// // You can simply poke the string if your EDITDATA structure has a fixed size, +// // or have an adaptive size of structure like below +// +// // If the length is different +// if (strlen(pStr)!=strlen(edPtr->text)) +// { +// // Asks MMF to reallocate the structure with the new size +// LPEDATA pNewPtr = (LPEDATA)mvReAllocEditData(mV, edPtr, sizeof(EDITDATA)+strlen(pStr)); +// +// // If reallocation worked +// if (pNewPtr!=NULL) +// { +// // Copy the string +// edPtr=pNewPtr; +// strcpy(edPtr->text, pStr); +// } +// } +// else +// { +// // Same size : simply copy +// strcpy(edPtr->text, pStr); +// } +// } +// break; +// } + + // You may want to have your object redrawn in the frame editor after the modifications, + // in this case, just call this function + // mvInvalidateObject(mV, edPtr); + +#endif // !defined(RUN_ONLY) +} + +// -------------------- +// SetPropCheck +// -------------------- +// This routine is called by MMF when the user modifies a checkbox in the properties. +// +void WINAPI DLLExport SetPropCheck(LPMV mV, LPEDATA edPtr, UINT nPropID, BOOL nCheck) +{ +#ifndef RUN_ONLY + // Example + // ------- +// switch (nPropID) +// { +// case PROPID_CHECK: +// edPtr->nCheck = nCheck; +// mvInvalidateObject(mV, edPtr); +// mvRefreshProp(mV, edPtr, PROPID_COMBO, TRUE); +// break; +// } +#endif // !defined(RUN_ONLY) +} + +// -------------------- +// EditProp +// -------------------- +// This routine is called when the user clicks the button of a Button or EditButton property. +// +BOOL WINAPI DLLExport EditProp(LPMV mV, LPEDATA edPtr, UINT nPropID) +{ +#ifndef RUN_ONLY + + // Example + // ------- +/* + if (nPropID==PROPID_EDITCONTENT) + { + if ( EditObject(mV, NULL, NULL, edPtr) ) + return TRUE; + } +*/ + +#endif // !defined(RUN_ONLY) + return FALSE; +} + +// -------------------- +// IsPropEnabled +// -------------------- +// This routine returns the enabled state of a property. +// +BOOL WINAPI IsPropEnabled(LPMV mV, LPEDATA edPtr, UINT nPropID) +{ +#ifndef RUN_ONLY + // Example + // ------- +/* + switch (nPropID) { + + case PROPID_CHECK: + return (edPtr->nComboIndex != 0); + } +*/ +#endif // !defined(RUN_ONLY) + return TRUE; +} + + +// ============================================================================ +// +// TEXT PROPERTIES +// +// ============================================================================ + +// -------------------- +// GetTextCaps +// -------------------- +// Return the text capabilities of the object under the frame editor. +// +DWORD WINAPI DLLExport GetTextCaps(mv _far *mV, LPEDATA edPtr) +{ + return 0; // (TEXT_ALIGN_LEFT|TEXT_ALIGN_HCENTER|TEXT_ALIGN_RIGHT|TEXT_ALIGN_TOP|TEXT_ALIGN_VCENTER|TEXT_ALIGN_BOTTOM|TEXT_FONT|TEXT_COLOR); +} + +// -------------------- +// GetTextFont +// -------------------- +// Return the font used the object. +// Note: the pStyle and cbSize parameters are obsolete and passed for compatibility reasons only. +// +BOOL WINAPI DLLExport GetTextFont(mv _far *mV, LPEDATA edPtr, LPLOGFONT plf, LPTSTR pStyle, UINT cbSize) +{ +#if !defined(RUN_ONLY) + // Example: copy LOGFONT structure from EDITDATA + // memcpy(plf, &edPtr->m_lf, sizeof(LOGFONT)); +#endif // !defined(RUN_ONLY) + + return TRUE; +} + +// -------------------- +// SetTextFont +// -------------------- +// Change the font used the object. +// Note: the pStyle parameter is obsolete and passed for compatibility reasons only. +// +BOOL WINAPI DLLExport SetTextFont(mv _far *mV, LPEDATA edPtr, LPLOGFONT plf, LPCSTR pStyle) +{ +#if !defined(RUN_ONLY) + // Example: copy LOGFONT structure to EDITDATA + // memcpy(&edPtr->m_lf, plf, sizeof(LOGFONT)); +#endif // !defined(RUN_ONLY) + + return TRUE; +} + +// -------------------- +// GetTextClr +// -------------------- +// Get the text color of the object. +// +COLORREF WINAPI DLLExport GetTextClr(mv _far *mV, LPEDATA edPtr) +{ + // Example + return 0; // edPtr->fontColor; +} + +// -------------------- +// SetTextClr +// -------------------- +// Set the text color of the object. +// +void WINAPI DLLExport SetTextClr(mv _far *mV, LPEDATA edPtr, COLORREF color) +{ + // Example + //edPtr->fontColor = color; +} + +// -------------------- +// GetTextAlignment +// -------------------- +// Get the text alignment of the object. +// +DWORD WINAPI DLLExport GetTextAlignment(mv _far *mV, LPEDATA edPtr) +{ + DWORD dw = 0; +#if !defined(RUN_ONLY) + // Example + // ------- +/* if ( (edPtr->eData.dwFlags & ALIGN_LEFT) != 0 ) + dw |= TEXT_ALIGN_LEFT; + if ( (edPtr->eData.dwFlags & ALIGN_HCENTER) != 0 ) + dw |= TEXT_ALIGN_HCENTER; + if ( (edPtr->eData.dwFlags & ALIGN_RIGHT) != 0 ) + dw |= TEXT_ALIGN_RIGHT; + if ( (edPtr->eData.dwFlags & ALIGN_TOP) != 0 ) + dw |= TEXT_ALIGN_TOP; + if ( (edPtr->eData.dwFlags & ALIGN_VCENTER) != 0 ) + dw |= TEXT_ALIGN_VCENTER; + if ( (edPtr->eData.dwFlags & ALIGN_BOTTOM) != 0 ) + dw |= TEXT_ALIGN_BOTTOM; +*/ +#endif // !defined(RUN_ONLY) + return dw; +} + +// -------------------- +// SetTextAlignment +// -------------------- +// Set the text alignment of the object. +// +void WINAPI DLLExport SetTextAlignment(mv _far *mV, LPEDATA edPtr, DWORD dwAlignFlags) +{ +#if !defined(RUN_ONLY) + // Example + // ------- +/* DWORD dw = edPtr->eData.dwFlags; + + if ( (dwAlignFlags & TEXT_ALIGN_LEFT) != 0 ) + dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_LEFT; + if ( (dwAlignFlags & TEXT_ALIGN_HCENTER) != 0 ) + dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_HCENTER; + if ( (dwAlignFlags & TEXT_ALIGN_RIGHT) != 0 ) + dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_RIGHT; + + if ( (dwAlignFlags & TEXT_ALIGN_TOP) != 0 ) + dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_TOP; + if ( (dwAlignFlags & TEXT_ALIGN_VCENTER) != 0 ) + dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_VCENTER; + if ( (dwAlignFlags & TEXT_ALIGN_BOTTOM) != 0 ) + dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_BOTTOM; + + edPtr->eData.dwFlags = dw; +*/ +#endif // !defined(RUN_ONLY) +} + + +// ---------------------------------------------------------- +// Custom Parameters +// ---------------------------------------------------------- + +// -------------------- +// InitParameter +// -------------------- +// Initialize the parameter. +// +void WINAPI InitParameter(mv _far *mV, short code, paramExt* pExt) +{ +#if !defined(RUN_ONLY) + // Example + // ------- + // strcpy(&pExt->pextData[0], "Parameter Test"); + // pExt->pextSize = sizeof(paramExt) + strlen(pExt->pextData)+1; +#endif // !defined(RUN_ONLY) +} + +// Example of custom parameter setup proc +// -------------------------------------- +/* +#if !defined(RUN_ONLY) +BOOL CALLBACK DLLExport SetupProc(HWND hDlg, UINT msgType, WPARAM wParam, LPARAM lParam) +{ + paramExt* pExt; + + switch (msgType) + { + case WM_INITDIALOG: // Init dialog + + // Save edptr + SetWindowLong(hDlg, DWL_USER, lParam); + pExt=(paramExt*)lParam; + + SetDlgItemText(hDlg, IDC_EDIT, pExt->pextData); + return TRUE; + + case WM_COMMAND: // Command + + // Retrieve edptr + pExt = (paramExt *)GetWindowLong(hDlg, DWL_USER); + + switch (wmCommandID) + { + case IDOK: // Exit + GetDlgItemText(hDlg, IDC_EDIT, pExt->pextData, 500); + pExt->pextSize=sizeof(paramExt)+strlen(pExt->pextData)+1; + EndDialog(hDlg, TRUE); + return TRUE; + + default: + break; + } + break; + + default: + break; + } + return FALSE; +} +#endif // !defined(RUN_ONLY) +*/ + +// -------------------- +// EditParameter +// -------------------- +// Edit the parameter. +// +void WINAPI EditParameter(mv _far *mV, short code, paramExt* pExt) +{ +#if !defined(RUN_ONLY) + + // Example + // ------- + // DialogBoxParam(hInstLib, MAKEINTRESOURCE(DB_TRYPARAM), mV->mvHEditWin, SetupProc, (LPARAM)(LPBYTE)pExt); + +#endif // !defined(RUN_ONLY) +} + +// -------------------- +// GetParameterString +// -------------------- +// Initialize the parameter. +// +void WINAPI GetParameterString(mv _far *mV, short code, paramExt* pExt, LPSTR pDest, short size) +{ +#if !defined(RUN_ONLY) + + // Example + // ------- + // wsprintf(pDest, "Super parameter %s", pExt->pextData); + +#endif // !defined(RUN_ONLY) +} diff --git a/Extensions/Template/Expressions.cpp b/Extensions/Template/Expressions.cpp new file mode 100644 index 0000000..6ddc908 --- /dev/null +++ b/Extensions/Template/Expressions.cpp @@ -0,0 +1,12 @@ + +#include "Common.h" + +int Extension::Add(int First, int Second) +{ + return First + Second; +} + +const char * Extension::HelloWorld() +{ + return "Hello world!"; +} \ No newline at end of file diff --git a/Extensions/Template/Ext.def b/Extensions/Template/Ext.def new file mode 100644 index 0000000..9c45d91 --- /dev/null +++ b/Extensions/Template/Ext.def @@ -0,0 +1,110 @@ + +EXPORTS + GetInfos @2 + LoadObject @6 + UnloadObject @7 + PutObject @8 + RemoveObject @9 + MakeIconEx @11 + + CreateObject @14 + GetHelpFileName @16 + EditObject @18 + GetObjectRect @19 + EditorDisplay @20 + IsTransparent @21 + PrepareToWriteObject @22 + UpdateFileNames @23 +; EnumElts @24 + Initialize @25 + Free @26 +; ExportTexts @27 +; ImportTexts @28 +; GetSubType @29 + UsesFile @30 + CreateFromFile @31 + DuplicateObject @32 + GetObjInfos @36 + + GetTextCaps @37 + GetTextAlignment @38 + SetTextAlignment @39 + GetTextFont @40 + SetTextFont @41 + GetTextClr @42 + SetTextClr @43 + + GetDependencies @44 + GetFilters @45 + +; conditionsTable @47 +; actionsTable @48 +; expressionsTable @49 + + CreateRunObject @50 + DestroyRunObject @51 + HandleRunObject @52 + DisplayRunObject @53 + PauseRunObject @57 + ContinueRunObject @58 + GetRunObjectInfos @59 + + GetConditionMenu @60 + GetActionMenu @61 + GetExpressionMenu @62 + GetConditionCodeFromMenu @63 + GetActionCodeFromMenu @64 + GetExpressionCodeFromMenu @65 + GetConditionString @66 + GetActionString @67 + GetExpressionString @68 + InitParameter @69 + EditParameter @70 + GetParameterString @71 + GetConditionTitle @72 + GetActionTitle @73 + GetExpressionTitle @74 + GetConditionInfos @75 + GetActionInfos @76 + GetExpressionInfos @77 + UpdateEditStructure @78 + GetRunObjectDataSize @80 +; SaveBackground @81 +; RestoreBackground @82 +; KillBackground @83 +; WindowProc @84 + StartApp @85 + EndApp @86 + StartFrame @87 + EndFrame @88 + GetExpressionParam @89 + +; GetRunObjectSurface @90 +; GetRunObjectCollisionMask @91 + +; GetRunObjectFont @92 +; SetRunObjectFont @93 +; GetRunObjectTextColor @94 +; SetRunObjectTextColor @95 + +; SetEditSize @99 + GetProperties @100 + ReleaseProperties @101 + GetPropValue @102 + SetPropValue @103 + IsPropEnabled @104 + GetPropCheck @105 + SetPropCheck @106 + GetPropCreateParam @107 + ReleasePropCreateParam @108 + EditProp @109 + GetDebugTree @110 + GetDebugItem @111 + EditDebugItem @112 + + SaveRunObject @113 + LoadRunObject @114 + + PrepareFlexBuild @115 + + \ No newline at end of file diff --git a/Extensions/Template/Ext.json b/Extensions/Template/Ext.json new file mode 100644 index 0000000..6f11221 --- /dev/null +++ b/Extensions/Template/Ext.json @@ -0,0 +1,91 @@ +{ + "About": { + "Name": "Example object", + "Author": "Your Name", + "Copyright": "Copyright (C) 2013 Your Name", + "Comment": "A sentence or two to describe your extension", + "URL": "http://www.example.com", + "Help": "Help/Example.chm", + "Identifier": "EXMP" + }, + "ActionMenu": [ + [ + 0, + "Action Example" + ], + "Separator", + [ + "Sub Menu", + [ + 1, + "Second Action Example" + ] + ] + ], + "ConditionMenu": [ + [ + 0, + "Are two numbers equal?" + ] + ], + "ExpressionMenu": [ + [ + 0, + "Add two numbers" + ], + [ + 1, + "Hello world" + ] + ], + "Actions": [ + { + "Title": "Action Example with parameter %0", + "Parameters": [ + [ + "Integer", + "Example Parameter" + ] + ] + }, + { + "Title": "Second Action Example" + } + ], + "Conditions": [ + { + "Title": "%o : Are %0 and %1 equal?", + "Parameters": [ + [ + "Integer", + "First number" + ], + [ + "Integer", + "Second number" + ] + ], + "Triggered": false + } + ], + "Expressions": [ + { + "Title": "Add(", + "Returns": "Integer", + "Parameters": [ + [ + "Integer", + "First number" + ], + [ + "Integer", + "Second number" + ] + ] + }, + { + "Title": "HelloWorld$(", + "Returns": "Text" + } + ] +} diff --git a/Extensions/Template/Ext.rc b/Extensions/Template/Ext.rc new file mode 100644 index 0000000..c4b5941 --- /dev/null +++ b/Extensions/Template/Ext.rc @@ -0,0 +1,156 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "..\..\Inc\ccx.h" +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +1 VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x0L +#ifdef _DEBUG + FILEFLAGS 0x21L +#else + FILEFLAGS 0x20L +#endif + FILEOS 0x10001L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "Clickteam" + VALUE "FileDescription", "Edif Object" + VALUE "FileVersion", "2.00" + VALUE "InternalName", "EdifExt" + VALUE "LegalCopyright", "Copyright © 2012 Clickteam" + VALUE "OriginalFilename", "EdifExt.mfx" + VALUE "ProductVersion", "1, 0, 0, 1" + VALUE "SpecialBuild", "00000001" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// RCDATA +// + +KPX_MAGICNUMBER RCDATA +BEGIN + 0x2516, 0x5908 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""..\\..\\Inc\\ccx.h""\r\n" + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + KPX_MARK "MF2" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.K.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// EDIF +// + +#if defined(APSTUDIO_INVOKED) || defined(EDITOR) +#if defined(APSTUDIO_INVOKED) +IDR_EDIF_ICON$(EDITOR) EDIF "Icon.png" +#else +IDR_EDIF_ICON EDIF "Icon.png" +#endif +#endif +IDR_EDIF_JSON EDIF "Ext.json" +#endif // English (U.K.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Extensions/Template/Extension.cpp b/Extensions/Template/Extension.cpp new file mode 100644 index 0000000..287df33 --- /dev/null +++ b/Extensions/Template/Extension.cpp @@ -0,0 +1,160 @@ + +#include "Common.h" + + +/// +/// EXTENSION CONSTRUCTOR/DESTRUCTOR +/// + +Extension::Extension(LPRDATA _rdPtr, LPEDATA edPtr, fpcob cobPtr) + : rdPtr(_rdPtr), rhPtr(_rdPtr->rHo.hoAdRunHeader), Runtime(_rdPtr) +{ + /* + Link all your action/condition/expression functions to their IDs to match the + IDs in the JSON here + */ + + LinkAction(0, ActionExample); + LinkAction(1, SecondActionExample); + + LinkCondition(0, AreTwoNumbersEqual); + + LinkExpression(0, Add); + LinkExpression(1, HelloWorld); + + + /* + This is where you'd do anything you'd do in CreateRunObject in the original SDK + + It's the only place you'll get access to edPtr at runtime, so you should transfer + anything from edPtr to the extension class here. + + */ + + + +} + +Extension::~Extension() +{ + /* + This is where you'd do anything you'd do in DestroyRunObject in the original SDK. + (except calling destructors and other such atrocities, because that's automatic in Edif) + */ + + + +} + + +short Extension::Handle() +{ + /* + If your extension will draw to the MMF window you should first + check if anything about its display has changed : + + if (rdPtr->roc.rcChanged) + return REFLAG_DISPLAY; + else + return 0; + + You will also need to make sure you change this flag yourself + to 1 whenever you want to redraw your object + + If your extension won't draw to the window, but it still needs + to do something every MMF loop use : + + return 0; + + If you don't need to do something every loop, use : + + return REFLAG_ONESHOT; + + This doesn't mean this function can never run again. If you want MMF + to handle your object again (causing this code to run) use this function: + + Runtime.Rehandle(); + + At the end of the loop this code will run + + */ + + // Will not be called next loop + return REFLAG_ONESHOT; +} + + +short Extension::Display() +{ + /* + If you return REFLAG_DISPLAY in Handle() this routine will run. + */ + + // Ok + return 0; +} + +short Extension::Pause() +{ + + // Ok + return 0; +} + +short Extension::Continue() +{ + + // Ok + return 0; +} + +bool Extension::Save(HANDLE File) +{ + bool OK = false; + + #ifndef VITALIZE + + // Save the object's data here + + OK = true; + + #endif + + return OK; +} + +bool Extension::Load(HANDLE File) +{ + bool OK = false; + + #ifndef VITALIZE + + // Load the object's data here + + OK = true; + + #endif + + return OK; +} + + +// These are called if there's no function linked to an ID + +void Extension::Action(int ID, LPRDATA rdPtr, long param1, long param2) +{ + +} + +long Extension::Condition(int ID, LPRDATA rdPtr, long param1, long param2) +{ + + return false; +} + +long Extension::Expression(int ID, LPRDATA rdPtr, long param) +{ + + return 0; +} + diff --git a/Extensions/Template/Extension.h b/Extensions/Template/Extension.h new file mode 100644 index 0000000..c3fee2e --- /dev/null +++ b/Extensions/Template/Extension.h @@ -0,0 +1,83 @@ + +class Extension +{ +public: + + LPRDATA rdPtr; + LPRH rhPtr; + + Edif::Runtime Runtime; + + static const int MinimumBuild = 251; + static const int Version = 1; + + static const int OEFLAGS = 0; + static const int OEPREFS = 0; + + static const int WindowProcPriority = 100; + + Extension(LPRDATA rdPtr, LPEDATA edPtr, fpcob cobPtr); + ~Extension(); + + + /* Add any data you want to store in your extension to this class + (eg. what you'd normally store in rdPtr) + + Unlike rdPtr, you can store real C++ objects with constructors + and destructors, without having to call them manually or store + a pointer. + */ + + // int MyVariable; + + + + + /* Add your actions, conditions and expressions as real class member + functions here. The arguments (and return type for expressions) must + match EXACTLY what you defined in the JSON. + + Remember to link the actions, conditions and expressions to their + numeric IDs in the class constructor (Extension.cpp) + */ + + /// Actions + + void ActionExample(int ExampleParameter); + void SecondActionExample(); + + /// Conditions + + bool AreTwoNumbersEqual(int FirstNumber, int SecondNumber); + + /// Expressions + + int Add(int FirstNumber, int SecondNumber); + const char * HelloWorld(); + + + + /* These are called if there's no function linked to an ID */ + + void Action(int ID, LPRDATA rdPtr, long param1, long param2); + long Condition(int ID, LPRDATA rdPtr, long param1, long param2); + long Expression(int ID, LPRDATA rdPtr, long param); + + + + + /* These replace the functions like HandleRunObject that used to be + implemented in Runtime.cpp. They work exactly the same, but they're + inside the extension class. + */ + + short Handle(); + short Display(); + + short Pause(); + short Continue(); + + bool Save(HANDLE File); + bool Load(HANDLE File); + +}; \ No newline at end of file diff --git a/Extensions/Template/General.cpp b/Extensions/Template/General.cpp new file mode 100644 index 0000000..41f53af --- /dev/null +++ b/Extensions/Template/General.cpp @@ -0,0 +1,165 @@ + +// ============================================================================ +// +// The following routines are used internally by MMF, and should not need to +// be modified. +// +// +// ============================================================================ + +#include "Common.h" + +HINSTANCE hInstLib; + +// ============================================================================ +// +// LIBRARY ENTRY & QUIT POINTS +// +// ============================================================================ + +// ----------------- +// Entry points +// ----------------- +// Usually you do not need to do any initialization here: you will prefer to +// do them in "Initialize" found in Edittime.cpp +BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) +{ + switch (dwReason) + { + // DLL is attaching to the address space of the current process. + case DLL_PROCESS_ATTACH: + + hInstLib = hDLL; // Store HINSTANCE + break; + + // A new thread is being created in the current process. + case DLL_THREAD_ATTACH: + break; + + // A thread is exiting cleanly. + case DLL_THREAD_DETACH: + break; + + // The calling process is detaching the DLL from its address space. + case DLL_PROCESS_DETACH: + break; + } + + return TRUE; +} + + + +// ----------------- +// Initialize +// ----------------- +// Where you want to do COLD-START initialization. +// Called when the extension is loaded into memory. +// +extern "C" int WINAPI DLLExport Initialize(mv _far *mV, int quiet) +{ + return Edif::Init(mV); + + + // No error + return 0; +} + +// ----------------- +// Free +// ----------------- +// Where you want to kill and initialized data opened in the above routine +// Called just before freeing the DLL. +// +extern "C" int WINAPI DLLExport Free(mv _far *mV) +{ + Edif::Free(mV); + + // No error + return 0; +} + +// ============================================================================ +// +// GENERAL INFO +// +// ============================================================================ + + +// ----------------- +// LoadObject +// ----------------- +// Routine called for each object when the object is read from the MFA file (edit time) +// or from the CCN or EXE file (run time). +// You can load data here, reserve memory etc... +// +int WINAPI DLLExport LoadObject(mv _far *mV, LPCSTR fileName, LPEDATA edPtr, int reserved) +{ + Edif::Init(mV, edPtr); + + + return 0; +} + +// ----------------- +// UnloadObject +// ----------------- +// The counterpart of the above routine: called just before the object is +// deleted from the frame. +// +void WINAPI DLLExport UnloadObject(mv _far *mV, LPEDATA edPtr, int reserved) +{ +} + +// -------------------- +// UpdateEditStructure +// -------------------- +// For you to update your object structure to newer versions +// Called at both edit time and run time +// +HGLOBAL WINAPI DLLExport UpdateEditStructure(mv __far *mV, void __far * OldEdPtr) +{ + // We do nothing here + return 0; +} + +// -------------------- +// UpdateFileNames +// -------------------- +// If you store file names in your datazone, they have to be relocated when the +// application is moved to a different directory: this routine does it. +// Called at edit time and run time. +// +// Call lpfnUpdate to update your file pathname (refer to the documentation) +// +void WINAPI DLLExport UpdateFileNames(mv _far *mV, LPSTR appName, LPEDATA edPtr, void (WINAPI * lpfnUpdate)(LPSTR, LPSTR)) +{ +} + +// --------------------- +// EnumElts +// --------------------- +// +// Uncomment this function if you need to store an image in the image bank. +// +// Note: do not forget to enable the function in the .def file +// if you remove the comments below. +// +/* +int WINAPI DLLExport EnumElts (mv __far *mV, LPEDATA edPtr, ENUMELTPROC enumProc, ENUMELTPROC undoProc, LPARAM lp1, LPARAM lp2) +{ + int error = 0; + + // Replace wImgIdx with the name of the WORD variable you create within the edit structure + + // Enum images + if ( (error = enumProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2)) != 0 ) + { + // Undo enum images + undoProc (&edPtr->wImgIdx, IMG_TAB, lp1, lp2); + } + + return error; +} +*/ + diff --git a/Extensions/Template/Icon.png b/Extensions/Template/Icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cc945e99d44d5cc99d69c46c7ced70e21878c3a1 GIT binary patch literal 4524 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.rsEffect & EFFECTFLAG_TRANSPARENT) == 0 ) // Note: only if your object has the OEPREFS_INKEFFECTS option + return NULL; + + // Transparent? Create mask + LPSMASK pMask = rdPtr->m_pColMask; + if ( pMask == NULL ) + { + if ( rdPtr->m_pSurface != NULL ) + { + DWORD dwMaskSize = rdPtr->m_pSurface->CreateMask(NULL, lParam); + if ( dwMaskSize != 0 ) + { + pMask = (LPSMASK)calloc(dwMaskSize, 1); + if ( pMask != NULL ) + { + rdPtr->m_pSurface->CreateMask(pMask, lParam); + rdPtr->m_pColMask = pMask; + } + } + } + } + + // Note: for active objects, lParam is always the same. + // For background objects (OEFLAG_BACKGROUND), lParam maybe be different if the user uses your object + // as obstacle and as platform. In this case, you should store 2 collision masks + // in your data: one if lParam is 0 and another one if lParam is different from 0. + + return pMask; +} +*/ + + +// ============================================================================ +// +// START APP / END APP / START FRAME / END FRAME routines +// +// ============================================================================ + +// ------------------- +// StartApp +// ------------------- +// Called when the application starts or restarts. +// Useful for storing global data +// +void WINAPI DLLExport StartApp(mv _far *mV, CRunApp* pApp) +{ + // Example + // ------- + // Delete global data (if restarts application) +// CMyData* pData = (CMyData*)mV->mvGetExtUserData(pApp, hInstLib); +// if ( pData != NULL ) +// { +// delete pData; +// mV->mvSetExtUserData(pApp, hInstLib, NULL); +// } +} + +// ------------------- +// EndApp +// ------------------- +// Called when the application ends. +// +void WINAPI DLLExport EndApp(mv _far *mV, CRunApp* pApp) +{ + // Example + // ------- + // Delete global data +// CMyData* pData = (CMyData*)mV->mvGetExtUserData(pApp, hInstLib); +// if ( pData != NULL ) +// { +// delete pData; +// mV->mvSetExtUserData(pApp, hInstLib, NULL); +// } +} + +// ------------------- +// StartFrame +// ------------------- +// Called when the frame starts or restarts. +// +void WINAPI DLLExport StartFrame(mv _far *mV, DWORD dwReserved, int nFrameIndex) +{ +} + +// ------------------- +// EndFrame +// ------------------- +// Called when the frame ends. +// +void WINAPI DLLExport EndFrame(mv _far *mV, DWORD dwReserved, int nFrameIndex) +{ +} + +// ============================================================================ +// +// TEXT ROUTINES (if OEFLAG_TEXT) +// +// ============================================================================ + +// ------------------- +// GetRunObjectFont +// ------------------- +// Return the font used by the object. +// +/* + + // Note: do not forget to enable the functions in the .def file + // if you remove the comments below. + +void WINAPI GetRunObjectFont(LPRDATA rdPtr, LOGFONT* pLf) +{ + // Example + // ------- + // GetObject(rdPtr->m_hFont, sizeof(LOGFONT), pLf); +} + +// ------------------- +// SetRunObjectFont +// ------------------- +// Change the font used by the object. +// +void WINAPI SetRunObjectFont(LPRDATA rdPtr, LOGFONT* pLf, RECT* pRc) +{ + // Example + // ------- +// HFONT hFont = CreateFontIndirect(pLf); +// if ( hFont != NULL ) +// { +// if (rdPtr->m_hFont!=0) +// DeleteObject(rdPtr->m_hFont); +// rdPtr->m_hFont = hFont; +// SendMessage(rdPtr->m_hWnd, WM_SETFONT, (WPARAM)rdPtr->m_hFont, FALSE); +// } + +} + +// --------------------- +// GetRunObjectTextColor +// --------------------- +// Return the text color of the object. +// +COLORREF WINAPI GetRunObjectTextColor(LPRDATA rdPtr) +{ + // Example + // ------- + return 0; // rdPtr->m_dwColor; +} + +// --------------------- +// SetRunObjectTextColor +// --------------------- +// Change the text color of the object. +// +void WINAPI SetRunObjectTextColor(LPRDATA rdPtr, COLORREF rgb) +{ + // Example + // ------- + rdPtr->m_dwColor = rgb; + InvalidateRect(rdPtr->m_hWnd, NULL, TRUE); +} +*/ + + +// ============================================================================ +// +// WINDOWPROC (interception of messages sent to hMainWin and hEditWin) +// +// Do not forget to enable the WindowProc function in the .def file if you implement it +// +// ============================================================================ +/* +// Get the pointer to the object's data from its window handle +// Note: the object's window must have been subclassed with a +// callRunTimeFunction(rdPtr, RFUNCTION_SUBCLASSWINDOW, 0, 0); +// See the documentation and the Simple Control example for more info. +// +LPRDATA GetRdPtr(HWND hwnd, LPRH rhPtr) +{ + return (LPRDATA)GetProp(hwnd, (LPCSTR)rhPtr->rh4.rh4AtomRd); +} + +// Called from the window proc of hMainWin and hEditWin. +// You can intercept the messages and/or tell the main proc to ignore them. +// +LRESULT CALLBACK DLLExport WindowProc(LPRH rhPtr, HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) +{ + LPRDATA rdPtr = NULL; + + switch (nMsg) { + + // Example + case WM_CTLCOLORSTATIC: + { + // Get the handle of the control + HWND hWndControl = (HWND)lParam; + + // Get a pointer to the RUNDATA structure (see GetRdptr function above for more info) + rdPtr = GetRdPtr(hWndControl, rhPtr); + + // Check if the rdPtr pointer is valid and points to an object created with this extension + if ( rdPtr == NULL || rdPtr->rHo.hoIdentifier != IDENTIFIER ) + break; + + // OK, intercept the message + HDC hDC = (HDC)wParam; + SetBkColor(hDC, rdPtr->backColor); + SetTextColor(hDC, rdPtr->fontColor); + rhPtr->rh4.rh4KpxReturn = (long)rdPtr->hBackBrush; + return REFLAG_MSGRETURNVALUE; + } + break; + } + + return 0; +} +*/ + +// ============================================================================ +// +// DEBUGGER ROUTINES +// +// ============================================================================ + +// ----------------- +// GetDebugTree +// ----------------- +// This routine returns the address of the debugger tree +// +LPWORD WINAPI DLLExport GetDebugTree(LPRDATA rdPtr) +{ +#if !defined(RUN_ONLY) + return DebugTree; +#else + return NULL; +#endif // !defined(RUN_ONLY) +} + +// ----------------- +// GetDebugItem +// ----------------- +// This routine returns the text of a given item. +// +void WINAPI DLLExport GetDebugItem(LPSTR pBuffer, LPRDATA rdPtr, int id) +{ +#if !defined(RUN_ONLY) + + // Example + // ------- +/* + char temp[DB_BUFFERSIZE]; + + switch (id) + { + case DB_CURRENTSTRING: + LoadString(hInstLib, IDS_CURRENTSTRING, temp, DB_BUFFERSIZE); + wsprintf(pBuffer, temp, rdPtr->text); + break; + case DB_CURRENTVALUE: + LoadString(hInstLib, IDS_CURRENTVALUE, temp, DB_BUFFERSIZE); + wsprintf(pBuffer, temp, rdPtr->value); + break; + case DB_CURRENTCHECK: + LoadString(hInstLib, IDS_CURRENTCHECK, temp, DB_BUFFERSIZE); + if (rdPtr->check) + wsprintf(pBuffer, temp, "TRUE"); + else + wsprintf(pBuffer, temp, "FALSE"); + break; + case DB_CURRENTCOMBO: + LoadString(hInstLib, IDS_CURRENTCOMBO, temp, DB_BUFFERSIZE); + wsprintf(pBuffer, temp, rdPtr->combo); + break; + } +*/ + +#endif // !defined(RUN_ONLY) +} + +// ----------------- +// EditDebugItem +// ----------------- +// This routine allows to edit editable items. +// +void WINAPI DLLExport EditDebugItem(LPRDATA rdPtr, int id) +{ +#if !defined(RUN_ONLY) + + // Example + // ------- +/* + switch (id) + { + case DB_CURRENTSTRING: + { + EditDebugInfo dbi; + char buffer[256]; + + dbi.pText=buffer; + dbi.lText=TEXT_MAX; + dbi.pTitle=NULL; + + strcpy(buffer, rdPtr->text); + long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITTEXT, 0, (LPARAM)&dbi); + if (ret) + strcpy(rdPtr->text, dbi.pText); + } + break; + case DB_CURRENTVALUE: + { + EditDebugInfo dbi; + + dbi.value=rdPtr->value; + dbi.pTitle=NULL; + + long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITINT, 0, (LPARAM)&dbi); + if (ret) + rdPtr->value=dbi.value; + } + break; + } +*/ +#endif // !defined(RUN_ONLY) +} + + diff --git a/Extensions/Template/Template.sln b/Extensions/Template/Template.sln new file mode 100644 index 0000000..9c29735 --- /dev/null +++ b/Extensions/Template/Template.sln @@ -0,0 +1,41 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template", "Template.vcproj", "{3BCB4C73-71F6-43B6-803D-41411F92652A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug HWA|Win32 = Debug HWA|Win32 + Debug Unicode|Win32 = Debug Unicode|Win32 + Debug|Win32 = Debug|Win32 + Edittime HWA|Win32 = Edittime HWA|Win32 + Edittime Unicode|Win32 = Edittime Unicode|Win32 + Edittime|Win32 = Edittime|Win32 + Runtime HWA|Win32 = Runtime HWA|Win32 + Runtime Unicode|Win32 = Runtime Unicode|Win32 + Runtime|Win32 = Runtime|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Win32.ActiveCfg = Debug HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Win32.Build.0 = Debug HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Win32.ActiveCfg = Debug|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Win32.Build.0 = Debug|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Win32.ActiveCfg = Edittime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Win32.Build.0 = Edittime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Win32.ActiveCfg = Edittime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Win32.Build.0 = Edittime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Win32.ActiveCfg = Edittime|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Win32.Build.0 = Edittime|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Win32.ActiveCfg = Runtime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Win32.Build.0 = Runtime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Win32.ActiveCfg = Runtime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Win32.Build.0 = Runtime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Win32.ActiveCfg = Runtime|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Win32.Build.0 = Runtime|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj new file mode 100644 index 0000000..237afab --- /dev/null +++ b/Extensions/Template/Template.vcproj @@ -0,0 +1,1560 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Extensions/Template/resource.h b/Extensions/Template/resource.h new file mode 100644 index 0000000..2b0d9f0 --- /dev/null +++ b/Extensions/Template/resource.h @@ -0,0 +1,18 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by Ext.rc +// +#define IDR_EDIF_ICON 101 +#define IDR_EDIF_JSON 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif From 59272bd25177ce36f3c930d4893feefc80f4181a Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 13 Apr 2013 18:05:26 -0500 Subject: [PATCH 064/127] Move EDStream in project tree --- Extensions/TemplatePlusPlus/Template.vcproj | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/Extensions/TemplatePlusPlus/Template.vcproj b/Extensions/TemplatePlusPlus/Template.vcproj index fa271cb..f96a3ad 100644 --- a/Extensions/TemplatePlusPlus/Template.vcproj +++ b/Extensions/TemplatePlusPlus/Template.vcproj @@ -20,7 +20,6 @@ OutputDirectory=".\ReleaseEditor" IntermediateDirectory=".\ReleaseEditor" ConfigurationType="2" - InheritedPropertySheets="" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" CharacterSet="0" @@ -123,7 +122,6 @@ OutputDirectory=".\Debug" IntermediateDirectory=".\Debug" ConfigurationType="2" - InheritedPropertySheets="" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" CharacterSet="0" @@ -224,7 +222,6 @@ OutputDirectory=".\ReleaseRuntime" IntermediateDirectory=".\ReleaseRuntime" ConfigurationType="2" - InheritedPropertySheets="" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" > @@ -326,7 +323,6 @@ OutputDirectory=".\DebugUnicode" IntermediateDirectory=".\DebugUnicode" ConfigurationType="2" - InheritedPropertySheets="" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" CharacterSet="1" @@ -427,7 +423,6 @@ OutputDirectory=".\ReleaseEditorUnicode" IntermediateDirectory=".\ReleaseEditorUnicode" ConfigurationType="2" - InheritedPropertySheets="" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" CharacterSet="1" @@ -530,7 +525,6 @@ OutputDirectory=".\ReleaseRuntimeUnicode" IntermediateDirectory=".\ReleaseRuntimeUnicode" ConfigurationType="2" - InheritedPropertySheets="" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" CharacterSet="1" @@ -633,7 +627,6 @@ OutputDirectory="$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)" ConfigurationType="2" - InheritedPropertySheets="" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" CharacterSet="0" @@ -734,7 +727,6 @@ OutputDirectory="$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)" ConfigurationType="2" - InheritedPropertySheets="" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" CharacterSet="0" @@ -837,7 +829,6 @@ OutputDirectory="$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)" ConfigurationType="2" - InheritedPropertySheets="" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" > @@ -1452,6 +1443,10 @@ + + @@ -1475,10 +1470,6 @@ RelativePath="..\..\Lib\Edif.Runtime.cpp" > - - From c56459681048e8dd1ce1452ca609d29fa1347545 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 13 Apr 2013 21:11:25 -0500 Subject: [PATCH 065/127] Integrate EDStream --- Extensions/TemplatePlusPlus/EditData.hpp | 89 +++++++++--------------- Inc/EDStream.hpp | 38 +++++++++- Lib/Edif.General.cpp | 4 +- 3 files changed, 71 insertions(+), 60 deletions(-) diff --git a/Extensions/TemplatePlusPlus/EditData.hpp b/Extensions/TemplatePlusPlus/EditData.hpp index 08997fd..3d4b4c5 100644 --- a/Extensions/TemplatePlusPlus/EditData.hpp +++ b/Extensions/TemplatePlusPlus/EditData.hpp @@ -15,10 +15,10 @@ struct EditData /* MyString, MyInt, MyArray_t, MyArray * Example data */ - //stdtstring MyString; - //int MyInt; - //typedef std::vector MyArray_t; - //MyArray_t MyArray; +// stdtstring MyString; +// int MyInt; +// typedef std::vector MyArray_t; +// MyArray_t MyArray; /* * This is where you provide default values for @@ -26,7 +26,7 @@ struct EditData * when your extension is first created and * default values are needed. */ - EditData() // : MyString("Hello, world!"), MyInt(1337) + EditData() // : MyString(_T("Hello, world!")), MyInt(1337) { //MyArray.push_back(3.1415926f); } @@ -50,9 +50,9 @@ struct EditData */ EditData &operator=(const EditData &from) { - //MyString = from.MyString; - //MyInt = from.MyInt; - //MyArray = from.MyArray; +// MyString = from.MyString; +// MyInt = from.MyInt; +// MyArray = from.MyArray; } #ifndef RUN_ONLY @@ -64,42 +64,17 @@ struct EditData */ bool Serialize(mv *mV, SerializedED *&SED) const { - //First, figure out how much space is needed - unsigned size = 0; - //size += (MyString.length()+1) * sizeof(stdtstring::value_type); - //size += sizeof(MyInt); - //size += sizeof(MyArray_t::size_type); - //size += MyArray.size() * sizeof(MyArray_t::value_type); + //Create an instance of EDOStream, a helper class + EDOStream os (mV, SED); - //Then, ask MMF2 to provide this space for us in the SerializedED - { - SerializedED *t = (SerializedED *)mvReAllocEditData(mV, SED, sizeof(SerializedED)+size); - if(t) //if it worked - { - SED = t; - //Since SED is a pointer passed by reference, - //it will update outside this function so that - //the calling code keeps a valid pointer to - //the SerializedED. - } - else return false; //could not allocate space - } - - //Now, the crazy-looking part: serialize the data - char *p = (char *)(&SED->data); //put the pointer at the beginning of the space MMF2 gave us - //Perform the copy: Advance the pointer: - //_tcscpy(p, MyString.c_str()); p += (MyString.length()+1) * sizeof(stdtstring::value_type); - //memcpy(p, &MyInt, sizeof(MyInt)); p += sizeof(MyInt); - //MyArray_t::size_type MyArray_size = MyArray.size(); - //memcpy(p, &MyArray_size, sizeof(MyArray_size)); p += sizeof(MyArray_size); - //for(MyArray_t::size_type i = 0; i < MyArray_size; ++i) - //{ - //memcpy(p, &MyArray[i], sizeof(MyArray_t::value_type)); p += sizeof(MyArray_t::value_type); - //} - //If you get tired of retyping the size stuff from above, you can always store - //the sizes in variables or make macros for them. + //Write the data you need to save in binary format + //(you can use text format, but binary is recommended) +// os.write_string(MyString); //works for c-strings too +// os.write_value(MyInt); //only works for primitives! +// os.write_value(MyArray.size()); //need to know how many to load later +// os.write_sequence(MyArray.begin(), MyArray.end()); //works for c-style arrays too - //Done! + //That's it! EDOStream automatically stores the data in your extension's editdata return true; //return false in the event of an error } #endif @@ -116,22 +91,22 @@ struct EditData */ EditData(SerializedED *SED) { - if(SED->Header.extVersion == 0) + if(SED->Header.extVersion == 0) //older version { //code to update from an older version } - else if(SED->Header.extVersion == 1) + else if(SED->Header.extVersion == 1) //current version { - //We have to do some crazy stuff again! - char *p = (char *)(&SED->data); - //Load the data: Advance the pointer: - //MyString = p; /*std::string is smart enough for this*/ p += (MyString.length()+1) * sizeof(stdtstring::value_type); - //MyInt = *(int *)p; p += sizeof(MyInt); - //MyArray_t::size_type MyArray_size = *(MyArray_t::size_type *)p; p += sizeof(MyArray_size); - //for(MyArray_t::size_type i = 0; i < MyArray_size; ++i) - //{ - //MyArray.push_back(*(MyArray_t::value_type *)p); p += sizeof(MyArray_t::value_type); - //} + //Create an instance of EDIStream, a helper class + EDIStream is (SED); + //Read back the data in the same format that you stored it above +// MyString = is.read_string(); +// MyInt = is.read_value(); //need to specify the type here +// MyArray_t::size_type MyArray_size = is.read_value(); +// for(MyArray_t::size_type i = 0; i < MyArray_size; ++i) +// { +// MyArray.push_back(is.read_value()); +// } } else //the version is newer than current { @@ -139,9 +114,9 @@ struct EditData //future self was smart enough to keep the data in //the same format with new data at the end, or //make an error dialog and load some default data. - //MessageBox(NULL, _T("The MFA you are trying to load was saved" - // "with a newer version of this extension."), - // _T("Error Loading My Extension"), MB_OK); +// MessageBox(NULL, _T("The MFA you are trying to load was saved") +// _T("with a newer version of this extension."), +// _T("Error Loading My Extension"), MB_OK); } } diff --git a/Inc/EDStream.hpp b/Inc/EDStream.hpp index 1d4d60f..723d708 100644 --- a/Inc/EDStream.hpp +++ b/Inc/EDStream.hpp @@ -9,6 +9,7 @@ #include #include #include +#include struct EDIStream : std::basic_istream { @@ -51,6 +52,20 @@ struct EDIStream : std::basic_istream { } + template + T read_value() + { + T t = T(); + this->read(reinterpret_cast(&t), sizeof(T)); + return t; + } + std::basic_string read_string() + { + std::basic_string s; + std::getline(*this, s, _T('\0')); + return s; + } + private: Buf b; @@ -64,7 +79,7 @@ struct EDOStream : std::basic_ostream { Buf(mv *mV, SerializedED *&SED) : mV(mV), SED(SED) { - setp(&b.front(), &b.front()); + setp(0, 0); } virtual ~Buf() { @@ -108,6 +123,27 @@ struct EDOStream : std::basic_ostream { } + template + EDOStream &write_value(T t) + { + this->write(reinterpret_cast(&t), sizeof(T)); + return *this; + } + EDOStream &write_string(std::basic_string const&s) + { + *this << s << std::ends; + return *this; + } + template + EDOStream &write_sequence(ForwardIterator first, ForwardIterator pastlast) + { + for(; first != pastlast; ++first) + { + this->write(reinterpret_cast(&*first), sizeof(*first)); + } + return *this; + } + private: Buf b; diff --git a/Lib/Edif.General.cpp b/Lib/Edif.General.cpp index c694baf..c520203 100644 --- a/Lib/Edif.General.cpp +++ b/Lib/Edif.General.cpp @@ -66,9 +66,9 @@ short WINAPI DLLExport GetRunObjectInfos(mv _far *mV, fpKpxRunInfos infoPtr) infoPtr->editPrefs = Extension::OEPREFS; memcpy(&infoPtr->identifier, SDK->json["About"]["Identifier"], 4); - + infoPtr->version = Extension::Version; - + return TRUE; } From 59bb25302677ad37a66a331397a7f103b98a4334 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Fri, 26 Apr 2013 00:11:58 -0500 Subject: [PATCH 066/127] Update json-parser --- Inc/json.h | 29 ++++++++++++++---- Lib/Edif.cpp | 2 +- Lib/json.c | 83 ++++++++++++++++++++++++++++++++-------------------- 3 files changed, 76 insertions(+), 38 deletions(-) diff --git a/Inc/json.h b/Inc/json.h index 0822527..a38c65c 100644 --- a/Inc/json.h +++ b/Inc/json.h @@ -36,7 +36,7 @@ #endif #ifndef json_int_t - #ifndef _WIN32 + #ifndef _MSC_VER #include #define json_int_t int64_t #else @@ -44,6 +44,8 @@ #endif #endif +#include + #ifdef __cplusplus #include @@ -58,6 +60,14 @@ typedef struct unsigned long max_memory; int settings; + /* Custom allocator support (leave null to use malloc/free) + */ + + void * (* mem_alloc) (size_t, int zero, void * user_data); + void (* mem_free) (void *, void * user_data); + + void * user_data; /* will be passed to mem_alloc and mem_free */ + } json_settings; #define json_relaxed_commas 1 @@ -213,15 +223,24 @@ typedef struct _json_value } json_value; -json_value * json_parse - (const json_char * json); +json_value * json_parse (const json_char * json, + size_t length); -json_value * json_parse_ex - (json_settings * settings, const json_char * json, char * error); +json_value * json_parse_ex (json_settings * settings, + const json_char * json, + size_t length, + char * error); void json_value_free (json_value *); +/* Not usually necessary, unless you used a custom mem_alloc and now want to + * use a custom mem_free. + */ +void json_value_free_ex (json_settings * settings, + json_value *); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index d20dcd7..585b7db 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -160,7 +160,7 @@ int Edif::Init(mv _far * mV) settings.settings |= json_relaxed_commas; #endif - json_value * json = json_parse_ex (&settings, copy, json_error); + json_value * json = json_parse_ex (&settings, copy, JSON_Size, json_error); if (!json) { diff --git a/Lib/json.c b/Lib/json.c index eeaac50..72be88f 100644 --- a/Lib/json.c +++ b/Lib/json.c @@ -42,7 +42,6 @@ const struct _json_value json_value_none = { 0 }; #endif -#include #include #include #include @@ -66,20 +65,28 @@ static unsigned char hex_value (json_char c) typedef struct { - json_settings settings; - int first_pass; - unsigned long used_memory; unsigned int uint_max; unsigned long ulong_max; + json_settings settings; + int first_pass; + } json_state; -static void * json_alloc (json_state * state, unsigned long size, int zero) +static void * default_alloc (size_t size, int zero, void * user_data) { - void * mem; + return zero ? calloc (size, 1) : malloc (size); +} + +static void default_free (void * ptr, void * user_data) +{ + free (ptr); +} +static void * json_alloc (json_state * state, unsigned long size, int zero) +{ if ((state->ulong_max - state->used_memory) < size) return 0; @@ -89,10 +96,7 @@ static void * json_alloc (json_state * state, unsigned long size, int zero) return 0; } - if (! (mem = zero ? calloc (size, 1) : malloc (size))) - return 0; - - return mem; + return state->settings.mem_alloc (size, zero, state->settings.user_data); } static int new_value @@ -190,21 +194,31 @@ const static long flag_num_negative = 256, flag_num_zero = 512, flag_num_e = 1024, flag_num_e_got_sign = 2048, flag_num_e_negative = 4096; -json_value * json_parse_ex (json_settings * settings, const json_char * json, char * error_buf) +json_value * json_parse_ex (json_settings * settings, + const json_char * json, + size_t length, + char * error_buf) { json_char error [128]; unsigned int cur_line; - const json_char * cur_line_begin, * i; + const json_char * cur_line_begin, * i, * end; json_value * top, * root, * alloc = 0; - json_state state; + json_state state = { 0 }; long flags; - long num_digits, num_fraction, num_e; + long num_digits, num_e; + json_int_t num_fraction; error[0] = '\0'; + end = (json + length); - memset (&state, 0, sizeof (json_state)); memcpy (&state.settings, settings, sizeof (json_settings)); + if (!state.settings.mem_alloc) + state.settings.mem_alloc = default_alloc; + + if (!state.settings.mem_free) + state.settings.mem_free = default_free; + memset (&state.uint_max, 0xFF, sizeof (state.uint_max)); memset (&state.ulong_max, 0xFF, sizeof (state.ulong_max)); @@ -226,8 +240,8 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch for (i = json ;; ++ i) { - json_char b = *i; - + json_char b = (i == end ? 0 : *i); + if (flags & flag_done) { if (!b) @@ -440,7 +454,7 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch case 't': - if (*(++ i) != 'r' || *(++ i) != 'u' || *(++ i) != 'e') + if ((end - i) < 3 || *(++ i) != 'r' || *(++ i) != 'u' || *(++ i) != 'e') goto e_unknown_value; if (!new_value (&state, &top, &root, &alloc, json_boolean)) @@ -453,7 +467,7 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch case 'f': - if (*(++ i) != 'a' || *(++ i) != 'l' || *(++ i) != 's' || *(++ i) != 'e') + if ((end - i) < 4 || *(++ i) != 'a' || *(++ i) != 'l' || *(++ i) != 's' || *(++ i) != 'e') goto e_unknown_value; if (!new_value (&state, &top, &root, &alloc, json_boolean)) @@ -464,7 +478,7 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch case 'n': - if (*(++ i) != 'u' || *(++ i) != 'l' || *(++ i) != 'l') + if ((end - i) < 3 || *(++ i) != 'u' || *(++ i) != 'l' || *(++ i) != 'l') goto e_unknown_value; if (!new_value (&state, &top, &root, &alloc, json_null)) @@ -768,25 +782,23 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch while (alloc) { top = alloc->_reserved.next_alloc; - free (alloc); + state.settings.mem_free (alloc, state.settings.user_data); alloc = top; } if (!state.first_pass) - json_value_free (root); + json_value_free_ex (&state.settings, root); return 0; } -json_value * json_parse (const json_char * json) +json_value * json_parse (const json_char * json, size_t length) { - json_settings settings; - memset (&settings, 0, sizeof (json_settings)); - - return json_parse_ex (&settings, json, 0); + json_settings settings = { 0 }; + return json_parse_ex (&settings, json, length, 0); } -void json_value_free (json_value * value) +void json_value_free_ex (json_settings * settings, json_value * value) { json_value * cur_value; @@ -803,7 +815,7 @@ void json_value_free (json_value * value) if (!value->u.array.length) { - free (value->u.array.values); + settings->mem_free (value->u.array.values, settings->user_data); break; } @@ -814,7 +826,7 @@ void json_value_free (json_value * value) if (!value->u.object.length) { - free (value->u.object.values); + settings->mem_free (value->u.object.values, settings->user_data); break; } @@ -823,7 +835,7 @@ void json_value_free (json_value * value) case json_string: - free (value->u.string.ptr); + settings->mem_free (value->u.string.ptr, settings->user_data); break; default: @@ -832,7 +844,14 @@ void json_value_free (json_value * value) cur_value = value; value = value->parent; - free (cur_value); + settings->mem_free (cur_value, settings->user_data); } } +void json_value_free (json_value * value) +{ + json_settings settings = { 0 }; + settings.mem_free = default_free; + json_value_free_ex (&settings, value); +} + From 39c5da92f26032e491d5ac5f7d40ab92efbd8017 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Fri, 10 May 2013 12:08:52 -0500 Subject: [PATCH 067/127] Rename power template project Template is just the basic EDIF template, TemplatePlus is the template, and TemplatePlusPlus will be a very high-level template with lots of abstraction --- .../{TemplatePlusPlus => TemplatePlus}/.gitignore | 0 .../{TemplatePlusPlus => TemplatePlus}/Actions.cpp | 0 .../{TemplatePlusPlus => TemplatePlus}/Common.h | 0 .../Conditions.cpp | 0 .../CustomParams.cpp | 0 .../{TemplatePlusPlus => TemplatePlus}/Debugger.cpp | 0 .../{TemplatePlusPlus => TemplatePlus}/EditData.hpp | 0 .../{TemplatePlusPlus => TemplatePlus}/Edittime.cpp | 0 .../Expressions.cpp | 0 .../{TemplatePlusPlus => TemplatePlus}/Ext.def | 0 .../{TemplatePlusPlus => TemplatePlus}/Ext.json | 0 .../{TemplatePlusPlus => TemplatePlus}/Ext.rc | 0 .../Extension.cpp | 0 .../Extension.hpp | 0 .../{TemplatePlusPlus => TemplatePlus}/General.cpp | 0 .../{TemplatePlusPlus => TemplatePlus}/Icon.png | Bin .../Properties.cpp | 0 .../{TemplatePlusPlus => TemplatePlus}/Runtime.cpp | 0 .../{TemplatePlusPlus => TemplatePlus}/Template.sln | 0 .../Template.vcproj | 0 .../{TemplatePlusPlus => TemplatePlus}/Text.cpp | 0 .../TextProps.cpp | 0 .../{TemplatePlusPlus => TemplatePlus}/resource.h | 0 23 files changed, 0 insertions(+), 0 deletions(-) rename Extensions/{TemplatePlusPlus => TemplatePlus}/.gitignore (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Actions.cpp (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Common.h (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Conditions.cpp (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/CustomParams.cpp (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Debugger.cpp (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/EditData.hpp (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Edittime.cpp (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Expressions.cpp (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Ext.def (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Ext.json (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Ext.rc (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Extension.cpp (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Extension.hpp (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/General.cpp (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Icon.png (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Properties.cpp (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Runtime.cpp (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Template.sln (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Template.vcproj (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/Text.cpp (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/TextProps.cpp (100%) rename Extensions/{TemplatePlusPlus => TemplatePlus}/resource.h (100%) diff --git a/Extensions/TemplatePlusPlus/.gitignore b/Extensions/TemplatePlus/.gitignore similarity index 100% rename from Extensions/TemplatePlusPlus/.gitignore rename to Extensions/TemplatePlus/.gitignore diff --git a/Extensions/TemplatePlusPlus/Actions.cpp b/Extensions/TemplatePlus/Actions.cpp similarity index 100% rename from Extensions/TemplatePlusPlus/Actions.cpp rename to Extensions/TemplatePlus/Actions.cpp diff --git a/Extensions/TemplatePlusPlus/Common.h b/Extensions/TemplatePlus/Common.h similarity index 100% rename from Extensions/TemplatePlusPlus/Common.h rename to Extensions/TemplatePlus/Common.h diff --git a/Extensions/TemplatePlusPlus/Conditions.cpp b/Extensions/TemplatePlus/Conditions.cpp similarity index 100% rename from Extensions/TemplatePlusPlus/Conditions.cpp rename to Extensions/TemplatePlus/Conditions.cpp diff --git a/Extensions/TemplatePlusPlus/CustomParams.cpp b/Extensions/TemplatePlus/CustomParams.cpp similarity index 100% rename from Extensions/TemplatePlusPlus/CustomParams.cpp rename to Extensions/TemplatePlus/CustomParams.cpp diff --git a/Extensions/TemplatePlusPlus/Debugger.cpp b/Extensions/TemplatePlus/Debugger.cpp similarity index 100% rename from Extensions/TemplatePlusPlus/Debugger.cpp rename to Extensions/TemplatePlus/Debugger.cpp diff --git a/Extensions/TemplatePlusPlus/EditData.hpp b/Extensions/TemplatePlus/EditData.hpp similarity index 100% rename from Extensions/TemplatePlusPlus/EditData.hpp rename to Extensions/TemplatePlus/EditData.hpp diff --git a/Extensions/TemplatePlusPlus/Edittime.cpp b/Extensions/TemplatePlus/Edittime.cpp similarity index 100% rename from Extensions/TemplatePlusPlus/Edittime.cpp rename to Extensions/TemplatePlus/Edittime.cpp diff --git a/Extensions/TemplatePlusPlus/Expressions.cpp b/Extensions/TemplatePlus/Expressions.cpp similarity index 100% rename from Extensions/TemplatePlusPlus/Expressions.cpp rename to Extensions/TemplatePlus/Expressions.cpp diff --git a/Extensions/TemplatePlusPlus/Ext.def b/Extensions/TemplatePlus/Ext.def similarity index 100% rename from Extensions/TemplatePlusPlus/Ext.def rename to Extensions/TemplatePlus/Ext.def diff --git a/Extensions/TemplatePlusPlus/Ext.json b/Extensions/TemplatePlus/Ext.json similarity index 100% rename from Extensions/TemplatePlusPlus/Ext.json rename to Extensions/TemplatePlus/Ext.json diff --git a/Extensions/TemplatePlusPlus/Ext.rc b/Extensions/TemplatePlus/Ext.rc similarity index 100% rename from Extensions/TemplatePlusPlus/Ext.rc rename to Extensions/TemplatePlus/Ext.rc diff --git a/Extensions/TemplatePlusPlus/Extension.cpp b/Extensions/TemplatePlus/Extension.cpp similarity index 100% rename from Extensions/TemplatePlusPlus/Extension.cpp rename to Extensions/TemplatePlus/Extension.cpp diff --git a/Extensions/TemplatePlusPlus/Extension.hpp b/Extensions/TemplatePlus/Extension.hpp similarity index 100% rename from Extensions/TemplatePlusPlus/Extension.hpp rename to Extensions/TemplatePlus/Extension.hpp diff --git a/Extensions/TemplatePlusPlus/General.cpp b/Extensions/TemplatePlus/General.cpp similarity index 100% rename from Extensions/TemplatePlusPlus/General.cpp rename to Extensions/TemplatePlus/General.cpp diff --git a/Extensions/TemplatePlusPlus/Icon.png b/Extensions/TemplatePlus/Icon.png similarity index 100% rename from Extensions/TemplatePlusPlus/Icon.png rename to Extensions/TemplatePlus/Icon.png diff --git a/Extensions/TemplatePlusPlus/Properties.cpp b/Extensions/TemplatePlus/Properties.cpp similarity index 100% rename from Extensions/TemplatePlusPlus/Properties.cpp rename to Extensions/TemplatePlus/Properties.cpp diff --git a/Extensions/TemplatePlusPlus/Runtime.cpp b/Extensions/TemplatePlus/Runtime.cpp similarity index 100% rename from Extensions/TemplatePlusPlus/Runtime.cpp rename to Extensions/TemplatePlus/Runtime.cpp diff --git a/Extensions/TemplatePlusPlus/Template.sln b/Extensions/TemplatePlus/Template.sln similarity index 100% rename from Extensions/TemplatePlusPlus/Template.sln rename to Extensions/TemplatePlus/Template.sln diff --git a/Extensions/TemplatePlusPlus/Template.vcproj b/Extensions/TemplatePlus/Template.vcproj similarity index 100% rename from Extensions/TemplatePlusPlus/Template.vcproj rename to Extensions/TemplatePlus/Template.vcproj diff --git a/Extensions/TemplatePlusPlus/Text.cpp b/Extensions/TemplatePlus/Text.cpp similarity index 100% rename from Extensions/TemplatePlusPlus/Text.cpp rename to Extensions/TemplatePlus/Text.cpp diff --git a/Extensions/TemplatePlusPlus/TextProps.cpp b/Extensions/TemplatePlus/TextProps.cpp similarity index 100% rename from Extensions/TemplatePlusPlus/TextProps.cpp rename to Extensions/TemplatePlus/TextProps.cpp diff --git a/Extensions/TemplatePlusPlus/resource.h b/Extensions/TemplatePlus/resource.h similarity index 100% rename from Extensions/TemplatePlusPlus/resource.h rename to Extensions/TemplatePlus/resource.h From 2dc07bf125e49f1703e8c4b60565b3db1d97b2e8 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Fri, 10 May 2013 12:28:20 -0500 Subject: [PATCH 068/127] Update gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 35b6b43..59460a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ # Only keep template projects /Extensions/ !/Extensions/Template/ +!/Extensions/TemplatePlus/ !/Extensions/TemplatePlusPlus/ +!/Extensions/AutoInstall.bat ################# From f29492ee251ef5a029fb1f15babcc0af58469380 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Fri, 10 May 2013 12:30:15 -0500 Subject: [PATCH 069/127] Copy TemplatePlus to TemplatePlusPlus --- Extensions/Template/.gitignore | 175 ++ Extensions/TemplatePlusPlus/Actions.cpp | 17 + Extensions/TemplatePlusPlus/Common.h | 39 + Extensions/TemplatePlusPlus/Conditions.cpp | 14 + Extensions/TemplatePlusPlus/CustomParams.cpp | 108 ++ Extensions/TemplatePlusPlus/Debugger.cpp | 141 ++ Extensions/TemplatePlusPlus/EditData.hpp | 131 ++ Extensions/TemplatePlusPlus/Edittime.cpp | 297 ++++ Extensions/TemplatePlusPlus/Expressions.cpp | 20 + Extensions/TemplatePlusPlus/Ext.def | 118 ++ Extensions/TemplatePlusPlus/Ext.json | 74 + Extensions/TemplatePlusPlus/Ext.rc | 156 ++ Extensions/TemplatePlusPlus/Extension.cpp | 190 +++ Extensions/TemplatePlusPlus/Extension.hpp | 133 ++ Extensions/TemplatePlusPlus/General.cpp | 165 ++ Extensions/TemplatePlusPlus/Icon.png | Bin 0 -> 4524 bytes Extensions/TemplatePlusPlus/Properties.cpp | 292 ++++ Extensions/TemplatePlusPlus/Runtime.cpp | 195 +++ Extensions/TemplatePlusPlus/Template.sln | 41 + Extensions/TemplatePlusPlus/Template.vcproj | 1610 ++++++++++++++++++ Extensions/TemplatePlusPlus/Text.cpp | 63 + Extensions/TemplatePlusPlus/TextProps.cpp | 116 ++ Extensions/TemplatePlusPlus/resource.h | 18 + 23 files changed, 4113 insertions(+) create mode 100644 Extensions/Template/.gitignore create mode 100644 Extensions/TemplatePlusPlus/Actions.cpp create mode 100644 Extensions/TemplatePlusPlus/Common.h create mode 100644 Extensions/TemplatePlusPlus/Conditions.cpp create mode 100644 Extensions/TemplatePlusPlus/CustomParams.cpp create mode 100644 Extensions/TemplatePlusPlus/Debugger.cpp create mode 100644 Extensions/TemplatePlusPlus/EditData.hpp create mode 100644 Extensions/TemplatePlusPlus/Edittime.cpp create mode 100644 Extensions/TemplatePlusPlus/Expressions.cpp create mode 100644 Extensions/TemplatePlusPlus/Ext.def create mode 100644 Extensions/TemplatePlusPlus/Ext.json create mode 100644 Extensions/TemplatePlusPlus/Ext.rc create mode 100644 Extensions/TemplatePlusPlus/Extension.cpp create mode 100644 Extensions/TemplatePlusPlus/Extension.hpp create mode 100644 Extensions/TemplatePlusPlus/General.cpp create mode 100644 Extensions/TemplatePlusPlus/Icon.png create mode 100644 Extensions/TemplatePlusPlus/Properties.cpp create mode 100644 Extensions/TemplatePlusPlus/Runtime.cpp create mode 100644 Extensions/TemplatePlusPlus/Template.sln create mode 100644 Extensions/TemplatePlusPlus/Template.vcproj create mode 100644 Extensions/TemplatePlusPlus/Text.cpp create mode 100644 Extensions/TemplatePlusPlus/TextProps.cpp create mode 100644 Extensions/TemplatePlusPlus/resource.h diff --git a/Extensions/Template/.gitignore b/Extensions/Template/.gitignore new file mode 100644 index 0000000..5fda6e4 --- /dev/null +++ b/Extensions/Template/.gitignore @@ -0,0 +1,175 @@ +# Template project built files +MFX/ +Debug HWA/ +DebugUnicode/ +Edittime HWA/ +ReleaseEditor/ +ReleaseEditorUnicode/ +ReleaseRuntime/ +ReleaseRuntimeUnicode/ +Runtime HWA/ + + +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Rr]elease/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.vspscc +.builds +*.dotCover + +## TODO: If you have NuGet Package Restore enabled, uncomment this +#packages/ + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp + +# ReSharper is a .NET coding add-in +_ReSharper* + +# Installshield output folder +[Ee]xpress + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish + +# Others +[Bb]in +[Oo]bj +sql +TestResults +*.Cache +ClientBin +stylecop.* +~$* +*.dbmdl +Generated_Code #added for RIA/Silverlight projects + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML + + + +############ +## Windows +############ + +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg + +# Mac crap +.DS_Store diff --git a/Extensions/TemplatePlusPlus/Actions.cpp b/Extensions/TemplatePlusPlus/Actions.cpp new file mode 100644 index 0000000..4e38040 --- /dev/null +++ b/Extensions/TemplatePlusPlus/Actions.cpp @@ -0,0 +1,17 @@ +/* Actions.cpp + * This is where you should define the + * behavior of your actions. Make sure + * the parameters match those in the JSON + * exactly! Double check Extension.h + * as well. + */ + +#include "Common.h" + +void Extension::ActionExample(int ExampleParameter) +{ +} + +void Extension::SecondActionExample() +{ +} diff --git a/Extensions/TemplatePlusPlus/Common.h b/Extensions/TemplatePlusPlus/Common.h new file mode 100644 index 0000000..ea20fc2 --- /dev/null +++ b/Extensions/TemplatePlusPlus/Common.h @@ -0,0 +1,39 @@ +/* Common.h + * This is the common header file included + * by almost all other *.cpp files in + * the project. Anything that gets put or + * included in here will be available to you + * everywhere else. You shouldn't need to + * change anything in this file except + * to include headers that you want and + * to change the edition of MMF2 you want + * to support. + */ + +#pragma once + +//Only define one of these at once: +// #define TGFEXT //TGF2, MMF2, MMF2 Dev + #define MMFEXT //MMF2, MMF2 Dev +// #define PROEXT //MMF2 Dev only + +//Define this if you want legacy comma-less JSON support +// #define UsingJsonWithoutCommas + +#include "Edif.h" +#include "Resource.h" + +//#include +//#include "YourHeader.hpp" + +/* stdtstring + * A std::string that knows if you're using + * unicode or not. (Protip: strings passed + * to your extension A/C/Es still need to be + * const TCHAR *, and the same goes for strings + * returned from expressions and conditions). + */ +typedef std::basic_string stdtstring; + +#include "EditData.hpp" +#include "Extension.hpp" diff --git a/Extensions/TemplatePlusPlus/Conditions.cpp b/Extensions/TemplatePlusPlus/Conditions.cpp new file mode 100644 index 0000000..41b2b7b --- /dev/null +++ b/Extensions/TemplatePlusPlus/Conditions.cpp @@ -0,0 +1,14 @@ +/* Conditions.cpp + * This is where you should define the + * behavior of your conditions. Make sure + * the parameters and return types match those + * in the JSON exactly! Double check Extension.h + * as well. + */ + +#include "Common.h" + +bool Extension::AreTwoNumbersEqual(int First, int Second) +{ + return First == Second; +} diff --git a/Extensions/TemplatePlusPlus/CustomParams.cpp b/Extensions/TemplatePlusPlus/CustomParams.cpp new file mode 100644 index 0000000..c32bad6 --- /dev/null +++ b/Extensions/TemplatePlusPlus/CustomParams.cpp @@ -0,0 +1,108 @@ +/* CustomParams.cpp + * Just as with all the other SDKs, EDIF + * supports the creation and use of custom, + * you-defined parameters. Your own dialog, + * your own display string, your own sense + * of control. Read the MMF2SDK Help file + * for more information. To use custom + * parameters with EDIF, the parameter type + * must be "Custom" or "Custom#" where # is + * the number of the custom parameter. + * Functions defined here: + * InitParameter + * EditParameter + * GetParameterString + */ + +#include "Common.h" + +/* InitParameter + * Like with the editdata, this data will + * be written as-is to disk and later read + * back. The most you can store is defined + * by PARAM_EXTMAXSIZE, which currently is + * 512 bytes. Use them wisely! + */ +void MMF2Func InitParameter(mv *mV, short ID, paramExt *ParamData) +{ +#ifndef RUN_ONLY + //store data in ParamData->pextData + //store the size of the data in ParamData->pextSize +#endif +} + +// Example of custom parameter setup proc +// -------------------------------------- +/* +#ifndef RUN_ONLY +BOOL CALLBACK SetupProc(HWND hDlg, UINT msgType, WPARAM wParam, LPARAM lParam) +{ + paramExt* pExt; + + switch (msgType) + { + case WM_INITDIALOG: // Init dialog + + // Save edptr + SetWindowLong(hDlg, DWL_USER, lParam); + pExt=(paramExt*)lParam; + + SetDlgItemText(hDlg, IDC_EDIT, pExt->pextData); + return TRUE; + + case WM_COMMAND: // Command + + // Retrieve edptr + pExt = (paramExt *)GetWindowLong(hDlg, DWL_USER); + + switch (wmCommandID) + { + case IDOK: // Exit + GetDlgItemText(hDlg, IDC_EDIT, pExt->pextData, 500); + pExt->pextSize=sizeof(paramExt)+strlen(pExt->pextData)+1; + EndDialog(hDlg, TRUE); + return TRUE; + + default: + break; + } + break; + + default: + break; + } + return FALSE; +} +#endif +*/ + +/* EditParameter + * This is where you actually bring up + * the dialog and take input from + * the user and store it. + */ +void MMF2Func EditParameter(mv _far *mV, short code, paramExt* pExt) +{ +#ifndef RUN_ONLY + // Example + // ------- + // DialogBoxParam(hInstLib, MAKEINTRESOURCE(DB_TRYPARAM), mV->mvHEditWin, SetupProc, (LPARAM)(LPBYTE)pExt); +#endif +} + +/* GetParameterString + * This is where you give MMF2 the display + * string for your custom parameter. Remember, + * this is the display for ONE PARAMETER. It + * will appear amongst all the other parameter + * displays depending on the A/C's display + * string. + */ +void MMF2Func GetParameterString(mv _far *mV, short code, paramExt* pExt, LPSTR pDest, short size) +{ +#ifndef RUN_ONLY + // Example + // ------- + // wsprintf(pDest, "Super parameter %s", pExt->pextData); +#endif +} diff --git a/Extensions/TemplatePlusPlus/Debugger.cpp b/Extensions/TemplatePlusPlus/Debugger.cpp new file mode 100644 index 0000000..53b6cbd --- /dev/null +++ b/Extensions/TemplatePlusPlus/Debugger.cpp @@ -0,0 +1,141 @@ +/* Debugger.cpp + * Here you will be able to interact + * with the MMF2 debugger (that thing + * in the top left when you run your + * MFA from MMF2). You can add your own + * fields of your choice to your object's + * debugger tree. + * Functions defined here: + * GetDebugTree + * GetDebugItem + * EditDebugItem + */ + +#include "Common.h" + +#ifndef RUN_ONLY //The debugger is only available when running from MMF2, which uses the Edittime MFX + +/* DB + * This is the namespace the debugger identifiers + * are stored in. It keeps them out of the global + * namespace and it helps with intellisense. + */ +namespace DB +{ + /* + * The debugger identitifers. + */ + enum + { +// MyString, +// MyInt, + }; +} + +/* DebugTree + * The list of items to be displayed + * in the debugger tree. + */ +WORD DebugTree[] = +{ +// DB::MyString|DB_EDITABLE, +// DB::MyInt|DB_EDITABLE, +// DB::SomethingThatIDontWantTheUserToBeAbleToEditAtRuntime, + DB_END +}; + +#endif + +/* GetDerbugTree + * Plain and simple, just return the debug + * tree pointer from above. If you really + * want to you can create the debug tree + * dynamically and return that, but you'll + * need to store the pointer in your extension + * class every time so that you can release + * the memory in your extension class' destructor. + */ +LPWORD MMF2Func GetDebugTree(RD *rd) +{ +#ifndef RUN_ONLY + return DebugTree; +#endif + return NULL; +} + +/* GetDebugItem + * With respect to DB_BUFFERSIZE, give + * MMF2 the string to display in the + * debugger. You must include both the + * name and the value in the string, + * or any format you want. + */ +void MMF2Func GetDebugItem(LPSTR Buffer, RD *rd, int ID) +{ +#ifndef RUN_ONLY +// char temp[DB_BUFFERSIZE]; +// switch (ID) +// { +// case DB::MyString: +// { +// LoadString(hInstLib, IDS_CURRENTSTRING, temp, DB_BUFFERSIZE); +// wsprintf(pBuffer, temp, rdPtr->text); +// break; +// } +// case DB::MyInt: +// { +// LoadString(hInstLib, IDS_CURRENTVALUE, temp, DB_BUFFERSIZE); +// wsprintf(pBuffer, temp, rdPtr->value); +// break; +// } +// } +#endif +} + +/* EditDebugItem + * When the user chooses to edit an + * editable debug item, this function + * is called. You can use the RFUNCTIONs + * provided by MMF2 to do simple text and + * number edits, or you can do whatever you + * want, such as creating a dialog that lets + * the user enter more sophisticated input to + * the debug item, or simply display more info. + */ +void MMF2Func EditDebugItem(RD *rd, int ID) +{ +#ifndef RUN_ONLY +/* + switch(ID) + { + case DB::MyString: + { + EditDebugInfo dbi; + char buffer[256]; + + dbi.pText=buffer; + dbi.lText=TEXT_MAX; + dbi.pTitle=NULL; + + strcpy(buffer, rdPtr->text); + long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITTEXT, 0, (LPARAM)&dbi); + if (ret) + strcpy(rdPtr->text, dbi.pText); + } + break; + case DB::MyInt: + { + EditDebugInfo dbi; + + dbi.value=rdPtr->value; + dbi.pTitle=NULL; + + long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITINT, 0, (LPARAM)&dbi); + if (ret) + rdPtr->value=dbi.value; + } + break; + } +*/ +#endif +} diff --git a/Extensions/TemplatePlusPlus/EditData.hpp b/Extensions/TemplatePlusPlus/EditData.hpp new file mode 100644 index 0000000..3d4b4c5 --- /dev/null +++ b/Extensions/TemplatePlusPlus/EditData.hpp @@ -0,0 +1,131 @@ +/* EditData.hpp + * This is where you control what data + * you want to have at edittime. You + * are responsible for serializing and + * deserializing (saving/loading) the + * data to/from the SerializedED structure + * as if it were a file on the hard drive. + * It doesn't need to be efficient; this + * is just at edittime and once at the + * start of the runtime. + */ + +struct EditData +{ + /* MyString, MyInt, MyArray_t, MyArray + * Example data + */ +// stdtstring MyString; +// int MyInt; +// typedef std::vector MyArray_t; +// MyArray_t MyArray; + + /* + * This is where you provide default values for + * your editdata. This constructor is used + * when your extension is first created and + * default values are needed. + */ + EditData() // : MyString(_T("Hello, world!")), MyInt(1337) + { + //MyArray.push_back(3.1415926f); + } + + /* + * As a convenience in other parts of your code, + * you should copy data from another instance + * of the EditData class. Make sure you deep-copy + * dynamically allocated memory e.g. with pointers. + */ + EditData(const EditData &from) // : MyString(from.MyString), MyInt(from.MyInt), MyArray(from.MyArray) + { + // + } + + /* operator= + * This is essentially the same as the copy + * constructor above, except you are working + * with an instance that is already + * constructed. + */ + EditData &operator=(const EditData &from) + { +// MyString = from.MyString; +// MyInt = from.MyInt; +// MyArray = from.MyArray; + } + +#ifndef RUN_ONLY + /* Serialize + * This is where you need to "write" data + * to SerializedED like a file. Make sure + * you can read the data back in the + * constructor below! + */ + bool Serialize(mv *mV, SerializedED *&SED) const + { + //Create an instance of EDOStream, a helper class + EDOStream os (mV, SED); + + //Write the data you need to save in binary format + //(you can use text format, but binary is recommended) +// os.write_string(MyString); //works for c-strings too +// os.write_value(MyInt); //only works for primitives! +// os.write_value(MyArray.size()); //need to know how many to load later +// os.write_sequence(MyArray.begin(), MyArray.end()); //works for c-style arrays too + + //That's it! EDOStream automatically stores the data in your extension's editdata + return true; //return false in the event of an error + } +#endif + + /* + * This is the primary constructor for the + * EditData class. Here you will have to + * "read" SerializedED like a file and + * load back everything that gets saved + * above in Serialize. Make sure you check + * the version information first, this + * constructor is used to update from + * older versions of your editdata as well. + */ + EditData(SerializedED *SED) + { + if(SED->Header.extVersion == 0) //older version + { + //code to update from an older version + } + else if(SED->Header.extVersion == 1) //current version + { + //Create an instance of EDIStream, a helper class + EDIStream is (SED); + //Read back the data in the same format that you stored it above +// MyString = is.read_string(); +// MyInt = is.read_value(); //need to specify the type here +// MyArray_t::size_type MyArray_size = is.read_value(); +// for(MyArray_t::size_type i = 0; i < MyArray_size; ++i) +// { +// MyArray.push_back(is.read_value()); +// } + } + else //the version is newer than current + { + //Either try to load the data anyway assuming your + //future self was smart enough to keep the data in + //the same format with new data at the end, or + //make an error dialog and load some default data. +// MessageBox(NULL, _T("The MFA you are trying to load was saved") +// _T("with a newer version of this extension."), +// _T("Error Loading My Extension"), MB_OK); + } + } + + /* + * If you grabbed any memory e.g. with new, + * make sure to e.g. delete it in here. + */ + ~EditData() + { + // + } +}; diff --git a/Extensions/TemplatePlusPlus/Edittime.cpp b/Extensions/TemplatePlusPlus/Edittime.cpp new file mode 100644 index 0000000..fd39b6a --- /dev/null +++ b/Extensions/TemplatePlusPlus/Edittime.cpp @@ -0,0 +1,297 @@ +/* Edittime.cpp + * This file contains functions for the + * New Object dialog and the Frame Editor. + * For properties, see Properties.cpp. For + * custom parameters, see CustomParams.cpp. + * For text properties, see TextProps.cpp. + * Functions defined here: + * MakeIconEx + * UsesFile + * CreateFromFile + * CreateObject + * EditObject + * SetEditSize + * PutObject + * RemoveObject + * CloneObject + * GetObjectRect + * EditorDisplay + * IsTransparent + * PrepareToWriteObject + * GetFilters + */ + +#include "Common.h" + +/* CreateObject + * This is the first time you have + * access to the editdata, so it + * needs to be initialized with + * default values. Just be aware + * that if the user chooses to + * create your object from a file, + * CreateFromFile will be called + * instead of this function. + */ +int MMF2Func CreateObject(mv *mV, LO *lo, SerializedED *SED) +{ +#ifndef RUN_ONLY + if(IS_COMPATIBLE(mV)) //Make sure MMF2 hasn't changed in a way that makes your extension incompatible + { + Edif::Init(mV, SED); + + EditData().Serialize(mV, SED); //create & store the default editdata + + return 0; + } +#endif + return -1; +} + +/* MakeIconEx + * Lets you draw the icon dynamically + * by drawing into the Icon surface. The + * current example just uses the + * Icon.png from the resources. + */ +int MMF2Func MakeIconEx(mv *mV, cSurface *Icon, LPTSTR Name, OI *oi, SerializedED *SED) +{ +#ifndef RUN_ONLY + Icon->Delete(); + Icon->Clone(*SDK->Icon); + Icon->SetTransparentColor(RGB(255, 0, 255)); + return 0; +#endif + return -1; +} + +/* UsesFile + * When the user chooses "Create From + * File", MMF2 asks each extension if + * it supports being created from that + * file. Here you should investigate + * the file and see if your extension + * can be created from it in the + * CreateFromFile function below. You + * can simply check the file extension, + * for example. + */ +BOOL MMF2Func UsesFile(mv *mV, LPTSTR FileName) +{ +#ifndef RUN_ONLY + if(IS_COMPATIBLE(mV)) //check for compatibility, since you can't return an error from CreateFromFile + { +// char ext[_MAX_EXT]; +// _tsplitpath(FileName, 0, 0, 0, ext); +// if(stdtstring(".iherebydeclarethatthisfilecontainsmyintmystringandmyarray") == ext) +// { +// return TRUE; +// } + } +#endif + return FALSE; +} + +/* CreateFromFile + * If the user decides to create your object + * from the file you said you were OK with + * above, this is where you take that file + * and actually create your object from it. + * The CreateObject function up above will + * not have executed, so you need to initialize + * the editdata just as you would in CreateObject. + */ +void MMF2Func CreateFromFile(mv *mV, LPTSTR FileName, SerializedED *SED) +{ +#ifndef RUN_ONLY + Edif::Init(mV, SED); + + EditData ed; //default EditData +// std::ifstream in (FileName); +// EditData::MyArray_t::size_type MyArray_size; +// in >> ed.MyString >> ed.MyInt >> MyArray_size; +// ed.MyArray.clear(); +// for(EditData::MyArray_t::size_type i = 0; i < MyArray_size; ++i) +// { +// ed.MyArray.push_back(0); +// in >> ed.MyArray.back(); +// } + ed.Serialize(mV, SED); +#endif +} + +/* PutObject + * Each time a duplicate is made of your + * object, MMF2 calls this function to + * let you know. You still share the same + * editdata, the difference is the + * LevelObject pointer and the number of + * duplicates. + */ +void MMF2Func PutObject(mv *mV, LO *lo, SerializedED *SED, ushort NDup) +{ +#ifndef RUN_ONLY + if(NDup == 1) //is this the first object being created? + { + //You can put common code to both + //CreateObject and CreateFromFile + //as this function will execute + //after either one. + } +#endif +} + +/* RemoveObject + * Just the opposite of the above, when + * the user removes an instance of your + * object. This also functions as a + * DestroyObject function of sorts when + * NDup == 1. + */ +void MMF2Func RemoveObject(mv *mV, LO *lo, SerializedED *SED, ushort NDup) +{ +#ifndef RUN_ONLY + if(NDup == 1) //is this the last object being removed? + { + Edif::Free(SED); + // + } +#endif +} + +/* CloneObject + * When the user makes a clone of your object + * (not just another instance), MMF2 copies the + * contents of the editdata and then lets you + * know that the editdata in question is in + * new hands. Here you can 'fix' anything that + * might be caused by directly copying the + * editdata, though you should never have + * any problems like that in the first place. + */ +void MMF2Func CloneObject(mv *mV, OI *oi, SerializedED *SED) +{ +#ifndef RUN_ONLY + // +#endif +} + +/* EditObject + * If the user double-clicks your object icon + * or chooses the Edit option from a context + * menu, this function is called. This is useful + * as a que to bring up an animation editor for + * animations in your object. Return TRUE if + * changes were made to the editdata, and FALSE + * otherwise. + */ +BOOL MMF2Func EditObject (mv *mV, OI *oi, LO *lo, SerializedED *SED) +{ +#ifndef RUN_ONLY + // +#endif + return FALSE; +} + +/* SetEditSize + * If your object is resizeable, MMF2 calls this + * to let you know that the user has just requested + * a resize of the object. You can take the new + * size as is, or if it reminds you too much of + * 500 page essays you can limit the size to whatever + * you want. If you uncomment this function, make + * sure you also uncomment it in Ext.def. The + * presence of this function tells MMF2 that your + * object can be resized; otherwise it can't. + */ +/*BOOL MMF2Func SetEditSize(mv *mV, SerializedED *SED, int x, int y) +{ +#ifndef RUN_ONLY + EditData ed (SED); + ed.Width = x; + ed.Height = y; + ed.Serialize(mV, SED); + return TRUE; +#endif + return FALSE; +}*/ + +/* GetObjectRect + * MMF2 wants to know from time to time how much + * space your object is taking up on the frame + * editor. Currently this just gives the size of + * your Icon.png, but you can change it to parallel + * with the SetEditSize function above. + */ +void MMF2Func GetObjectRect(mv *mV, RECT *rect, LO *lo, SerializedED *SED) +{ +#ifndef RUN_ONLY + rect->right = rect->left + SDK->Icon->GetWidth(); + rect->bottom = rect->top + SDK->Icon->GetHeight(); +#endif +} + + +/* EditorDisplay + * This function does the work of drawing your + * object on the frame editor. In this example, + * the Icon.png file is simply drawn to the + * frame, but you can change this to draw + * anything you want. + */ +void MMF2Func EditorDisplay(mv *mV, OI *oi, LO *lo, SerializedED *SED, RECT *rect) +{ +#ifndef RUN_ONLY + cSurface *Surface = WinGetSurface(int(mV->mvIdEditWin)); //get access to the frame editor surface + if(!Surface) return; //failure + SDK->Icon->Blit(*Surface, rect->left, rect->top, BMODE_TRANSP, BOP_COPY, 0); //copy the icon onto the frame editor surface +#endif +} + + +/* IsTransparent + * MMF2 calls this to ask if the mouse pointer + * is over a transparent part of your object. + * Don't ask why this isn't called "IsOpaque", + * just accept that it isn't and move on. If the + * given coordinates are over an opaque part of + * your object, return TRUE, otherwise return + * FALSE. (Protip: MMF2 calls this function a + * LOT. Don't put a MessageBox function in here + * or any other kind of debug function.) + */ +extern "C" BOOL MMF2Func IsTransparent(mv *mV, LO *lo, SerializedED *SED, int x, int y) +{ +#ifndef RUN_ONLY + // +#endif + return FALSE; +} + +/* PrepareToWriteObject (DEPRECATED) + * Just before MMF2 writes the editdata to the MFA, + * it calls this function to let you clean up + * a temporary copy of the editdata. Because you + * intelligently designed your EditData::Serialize + * function to always save cleaned data anyway, + * this function is useless. + */ +void MMF2Func PrepareToWriteObject(mv *, SerializedED *, OI *){} + +/* GetFilters + * When the MFA filters are set to Automatic, MMF2 + * asks your extension if it uses filters or not. + * If you use any of either kind of filters, return + * TRUE for that kind. + */ +BOOL MMF2Func GetFilters(mv *mV, SerializedED *SED, DWORD Flags, void *) +{ +#ifndef RUN_ONLY + //If your extension uses image filters +// if((dwFlags & GETFILTERS_IMAGES) != 0) return TRUE; + + //If your extension uses sound filters +// if((dwFlags & GETFILTERS_SOUNDS) != 0) return TRUE; +#endif + return FALSE; +} diff --git a/Extensions/TemplatePlusPlus/Expressions.cpp b/Extensions/TemplatePlusPlus/Expressions.cpp new file mode 100644 index 0000000..65a6afa --- /dev/null +++ b/Extensions/TemplatePlusPlus/Expressions.cpp @@ -0,0 +1,20 @@ +/* Expressions.cpp + * This is where you should define the + * behavior of your expressions. Make sure + * the parameters and return types match those + * in the JSON exactly! Double check Extension.h + * as well. + */ + +#include "Common.h" + +int Extension::Add(int First, int Second) +{ + return First + Second; +} + +const TCHAR *Extension::HelloWorld() +{ + return _T("Hello world!"); + //return Runtime.CopyString(MyString.c_str()); //for stdtstrings +} diff --git a/Extensions/TemplatePlusPlus/Ext.def b/Extensions/TemplatePlusPlus/Ext.def new file mode 100644 index 0000000..7849232 --- /dev/null +++ b/Extensions/TemplatePlusPlus/Ext.def @@ -0,0 +1,118 @@ +; Ext.def +; This is how the linker knows +; which functions to export and +; what names and ordinals the +; exported functions should +; have. If you implemented a +; function that was commented +; out, remove the semicolon comment +; before it in this file. +; + +EXPORTS + GetInfos @2 + LoadObject @6 + UnloadObject @7 + PutObject @8 + RemoveObject @9 + MakeIconEx @11 + + CreateObject @14 + GetHelpFileName @16 + EditObject @18 + GetObjectRect @19 + EditorDisplay @20 + IsTransparent @21 + PrepareToWriteObject @22 + UpdateFileNames @23 +; EnumElts @24 + Initialize=InitExtension @25 + Free=FreeExtension @26 +; ExportTexts @27 +; ImportTexts @28 +; GetSubType @29 + UsesFile @30 + CreateFromFile @31 + DuplicateObject=CloneObject @32 + GetObjInfos @36 + + GetTextCaps @37 + GetTextAlignment @38 + SetTextAlignment @39 + GetTextFont @40 + SetTextFont @41 + GetTextClr @42 + SetTextClr @43 + + GetDependencies @44 + GetFilters @45 + +; conditionsTable @47 +; actionsTable @48 +; expressionsTable @49 + + CreateRunObject @50 + DestroyRunObject @51 + HandleRunObject @52 + DisplayRunObject @53 + PauseRunObject @57 + ContinueRunObject @58 + GetRunObjectInfos @59 + + GetConditionMenu @60 + GetActionMenu @61 + GetExpressionMenu @62 + GetConditionCodeFromMenu @63 + GetActionCodeFromMenu @64 + GetExpressionCodeFromMenu @65 + GetConditionString @66 + GetActionString @67 + GetExpressionString @68 + InitParameter @69 + EditParameter @70 + GetParameterString @71 + GetConditionTitle @72 + GetActionTitle @73 + GetExpressionTitle @74 + GetConditionInfos @75 + GetActionInfos @76 + GetExpressionInfos @77 + UpdateEditStructure @78 + GetRunObjectDataSize @80 +; SaveBackground @81 +; RestoreBackground @82 +; KillBackground @83 +; WindowProc @84 + StartApp @85 + EndApp @86 + StartFrame @87 + EndFrame @88 + GetExpressionParam @89 + +; GetRunObjectSurface @90 +; GetRunObjectCollisionMask @91 + +; GetRunObjectFont @92 +; SetRunObjectFont @93 +; GetRunObjectTextColor @94 +; SetRunObjectTextColor @95 + +; SetEditSize @99 + GetProperties @100 + ReleaseProperties @101 + GetPropValue @102 + SetPropValue @103 + IsPropEnabled @104 + GetPropCheck @105 + SetPropCheck @106 + GetPropCreateParam @107 + ReleasePropCreateParam @108 + EditProp @109 + GetDebugTree @110 + GetDebugItem @111 + EditDebugItem @112 + + SaveRunObject @113 + LoadRunObject @114 + + PrepareFlexBuild @115 diff --git a/Extensions/TemplatePlusPlus/Ext.json b/Extensions/TemplatePlusPlus/Ext.json new file mode 100644 index 0000000..cc2b218 --- /dev/null +++ b/Extensions/TemplatePlusPlus/Ext.json @@ -0,0 +1,74 @@ +{ + "About": + { + "Name": "EDIF Template Object", + "Author": "Your Name", + "Copyright": "Copyright © 2013 Your Name", + "Comment": "A sentence or two to describe your extension,\nwith up to four lines of text.", + "URL": "http://www.example.com/", + "Help": "Help/My New EDIF Extension/Help.chm", + "Identifier": "X&pl" + }, + + "ActionMenu": + [ + "Separator", + [0, "Action Example"], + "Separator", + ["Sub Menu", + [1, "Second Action Example"] + ], + "Separator", + [0, "A Disabled Menu Item", true], + "Separator" + ], + "ConditionMenu": + [ + "Separator", + [0, "Are two numbers equal?"] + ], + "ExpressionMenu": + [ + "Separator", + [0, "Add two numbers"], + [1, "Hello world"], + "Separator" + ], + + "Actions": + [ + { "Title": "Action Example with parameter %0", + "Parameters": + [ + ["Integer", "Example Parameter"] + ] + }, + { "Title": "Second Action Example" + } + ], + "Conditions": + [ + { "Title": "%o: Are %0 and %1 equal?", + "Parameters": + [ + ["Integer", "First number"], + ["Integer", "Second number"] + ], + "Triggered": false + } + ], + "Expressions": + [ + { "Title": "Add(", + "Returns": "Integer", + "Parameters": + [ + ["Integer", "First number"], + ["Integer", "Second number"] + ] + }, + { "Title": "HelloWorld$(", + "Returns": "Text" + } + ] +} diff --git a/Extensions/TemplatePlusPlus/Ext.rc b/Extensions/TemplatePlusPlus/Ext.rc new file mode 100644 index 0000000..5d6f17e --- /dev/null +++ b/Extensions/TemplatePlusPlus/Ext.rc @@ -0,0 +1,156 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "..\..\Inc\ccx.h" +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +1 VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x0L +#ifdef _DEBUG + FILEFLAGS 0x21L +#else + FILEFLAGS 0x20L +#endif + FILEOS 0x10001L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "Clickteam" + VALUE "FileDescription", "Edif Object" + VALUE "FileVersion", "2.00" + VALUE "InternalName", "EdifExt" + VALUE "LegalCopyright", "Copyright © 2012 Clickteam" + VALUE "OriginalFilename", "EdifExt.mfx" + VALUE "ProductVersion", "1, 0, 0, 1" + VALUE "SpecialBuild", "00000001" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// RCDATA +// + +KPX_MAGICNUMBER RCDATA +BEGIN + 0x2516, 0x5908 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""..\\..\\Inc\\ccx.h""\r\n" + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + KPX_MARK "MF2" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.K.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// EDIF +// + +#if defined(APSTUDIO_INVOKED) || defined(EDITOR) +#if defined(APSTUDIO_INVOKED) +IDR_EDIF_ICON$(EDITOR) EDIF "Icon.png" +#else +IDR_EDIF_ICON EDIF "Icon.png" +#endif +#endif +IDR_EDIF_JSON EDIF "Ext.json" +#endif // English (U.K.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Extensions/TemplatePlusPlus/Extension.cpp b/Extensions/TemplatePlusPlus/Extension.cpp new file mode 100644 index 0000000..8988773 --- /dev/null +++ b/Extensions/TemplatePlusPlus/Extension.cpp @@ -0,0 +1,190 @@ +/* Extension.cpp + * This file contains the definitions for + * your extension's general runtime functions, + * such as the constructor and destructor, + * handling routines, etc. + * Functions defined here: + * Extension::Extension + * Extension::~Extension + * Extension::Handle + * Extension::Display + * Extension::Pause + * Extension::Continue + * Extension::Save + * Extension::Load + * Extension::Action <--| + * Extension::Condition <--|- not what you think! + * Extension::Expression <--| + */ + +#include "Common.h" + +/* + * This is your extension's constructor, which + * is the replacement for the old CreateRunObject + * function. You don't need to manually call + * constructors or pointlessly initialize + * pointers with dynamic memory. Just link + * your A/C/Es, perform initialization steps, and + * you're good to go. + */ +Extension::Extension(RD *rd, SerializedED *SED, createObjectInfo *COB) : rd(rd), rh(rd->rHo.hoAdRunHeader), Runtime(rd) +{ + //Link all your action/condition/expression functions + //to their IDs to match the IDs in the JSON here. + LinkAction(0, ActionExample); + LinkAction(1, SecondActionExample); + + LinkCondition(0, AreTwoNumbersEqual); + + LinkExpression(0, Add); + LinkExpression(1, HelloWorld); + + + //This is where you'd do anything you'd do in CreateRunObject in the original SDK. + //It's the only place you'll get access to the editdata at runtime, so you should + //transfer anything from the editdata to the extension class here. For example: +// EditData ed (SED); +// MyString = ed.MyString; +// MyInt = ed.MyInt; +// MyArray = ed.MyArray; + + // +} + +/* + * This is your extension's destructor, the + * replacement for DestroyRunObject. No calling + * destructors manually or deallocating pointless + * dynamic memory - in most cases this function + * won't need any code written. + */ +Extension::~Extension() +{ + // +} + +/* Handle + * MMF2 calls this function to let your extension + * "live" - if you want, you can have MMF2 call this + * every frame. This is where you'd, for instance, + * simulate physics or move an object. This is + * the analagous function to the old HandleRunObject. + */ +short Extension::Handle() +{ + /* + If your extension will draw to the MMF window you should first + check if anything about its display has changed : + + if (rd->roc.rcChanged) return REFLAG_DISPLAY; + else return 0; + + You will also need to make sure you change this flag yourself + to 1 whenever you want to redraw your object + + If your extension won't draw to the window, but it still needs + to do something every MMF2 loop use: + + return 0; + + If you don't need to do something every loop, use : + + return REFLAG_ONESHOT; + + This doesn't mean this function can never run again. If you want MMF2 + to handle your object again (causing this code to run) use this function: + + Runtime.Rehandle(); + + At the end of the event loop this code will run. + + */ + + //Will not be called next loop + return REFLAG_ONESHOT; +} + +/* Display + * This is the analagous function to + * DisplayRunObject. If you return + * REFLAG_DISPLAY in Handle() this + * routine will run. If you want MMF2 + * to apply ink effects for you, then + * implement GetRunObjectSurface in + * Runtime.cpp instead. + */ +short Extension::Display() +{ + return 0; +} + +/* Pause + * If your extension plays sound, for + * example, then MMF2 calls this to + * let you know to pause the music, + * usually by another extension's request + * or by the player pausing the applcation. + */ +short Extension::Pause() +{ + return 0; +} + +/* Continue + * Opposite to the above, MMF2 lets + * you know that the silence is over; + * your extension may live again. + */ +short Extension::Continue() +{ + return 0; +} + +/* Save + * When the user uses the Save + * Frame Position action, you need + * so serialize your runtime data to + * the File given. It is a Windows + * file handle, but you can use some + * of MMF2's built-in functions for + * writing files. Check the MMF2SDK + * Help file for more information. + */ +bool Extension::Save(HANDLE File) +{ + return true; +} + +/* Load + * As opposed to above, here you need to + * restore your extension's runtime state + * from the given file. Only read what you + * wrote! + */ +bool Extension::Load(HANDLE File) +{ + return true; +} + + +/* Action, Condition, Expression + * These are called if there's no function linked + * to an ID. You may want to put MessageBox calls + * to let you know that the ID is unlinked, or you + * may just want to use unlinked A/C/Es as a feature. + */ +void Extension::Action(int ID, RD *rd, long param1, long param2) +{ +} + +long Extension::Condition(int ID, RD *rd, long param1, long param2) +{ + return false; //hopefully StringComparison (PARAM_CMPSTRING) is not used, or this may crash +} + +long Extension::Expression(int ID, RD *rd, long param) +{ + return long(_T("")); //so that unlinked expressions that return strings won't crash +} + diff --git a/Extensions/TemplatePlusPlus/Extension.hpp b/Extensions/TemplatePlusPlus/Extension.hpp new file mode 100644 index 0000000..ea46464 --- /dev/null +++ b/Extensions/TemplatePlusPlus/Extension.hpp @@ -0,0 +1,133 @@ +/* Extension.h + * This is where you define your extension + * class. Runtime variables and function + * declarations go in here; A/C/E function + * definitions go in their respective .cpp + * files, other function definitions go in + * Extension.cpp. This header is included + * at the bottom of Common.h, so you have + * access to everything included by it. + */ + +class Extension +{ +public: + /* rd + * This is a pointer to the classic + * RunData structure. Some things still + * have to be stored there for MMF2's + * sake, so you need to have acces to + * that data. You should not modify + * the rundata structure, however, + * as it is global to all extensions. + */ + RD *rd; + + /* rh + * This is a pointer to the RunHeader + * structure, which contains some + * application information. + */ + RunHeader *rh; + + /* Runtime + * This is EDIF's compendium of useful + * functions for every day life as an + * extension. You can trigger immediate + * events, read and write global data, + * etc. See the EDIF wiki for more + * information. + */ + Edif::Runtime Runtime; + + /* MinimumBuild + * Always set this to the latest build + * of MMF2 that has been released, unless + * you need to set it higher for a beta + * version of MMF2 to get access to some + * new SDK feature. + */ + static const int MinimumBuild = 257; + + /* Version + * This is the version of your extension + * that is stored in the editdata. You should + * only change this when your editdata structure + * changes, not just when you have a new version + * of your extension with new features. + */ + static const int Version = 1; + + /* OEFLAGS, OEPREFS + * These are settings for your extension + * that tell MMF2 how to treat your extension + * and what behaviors and responsibilities + * to add. Check the MMF2SDK Help file for + * more detailed information on the flags you + * can set and what they implicate. + */ + static const int OEFLAGS = OEFLAG_VALUES|OEFLAG_RUNBEFOREFADEIN|OEFLAG_NEVERKILL; + static const int OEPREFS = 0; + + /* WindowProcPriority + * If your extension creates a Window + * and implements the WindowProc function, + * this is the priority for that stuff. + */ + static const int WindowProcPriority = 100; + + Extension(RD *rd, SerializedED *SED, createObjectInfo *COB); //defined & documented in Extension.cpp + ~Extension(); //defined & documented in Extension.cpp + + + /* Add any data you want to store in your + * extension to this class (eg. what you'd + * normally store in the rundata). Unlike + * other SDKs, you can store real C++ + * objects with constructors and destructors, + * without having to call them manually or + * store a pointer. + */ + + //stdtstring MyString; + //int MyInt; + //std::vector MyArray; + + + /* Add your actions, conditions, and expressions + * as real class member functions here. The arguments + * (and return types for expressions/conditions) + * must match EXACTLY what you defined in the JSON. + * As a handy tip, all parameters will be either + * a pointer, an int, or a float (each only 4 bytes) + * and the same applies to return types. Remember to + * link the actions, conditions and expressions to their + * numeric IDs in the class constructor in Extension.cpp. + */ + + //Actions - Defined in Actions.cpp + void ActionExample(int ExampleParameter); + void SecondActionExample(); + + //Conditions - Defined in Conditions.cpp + bool AreTwoNumbersEqual(int FirstNumber, int SecondNumber); + + //Expressions - Defined in Expressions.cpp + int Add(int FirstNumber, int SecondNumber); + const TCHAR * HelloWorld(); + + + short Handle(); //defined & documented in Extension.cpp + short Display(); //defined & documented in Extension.cpp + + short Pause(); //defined & documented in Extension.cpp + short Continue(); //defined & documented in Extension.cpp + + bool Save(HANDLE File); //defined & documented in Extension.cpp + bool Load(HANDLE File); //defined & documented in Extension.cpp + + //defined & documented in Extension.cpp + void Action(int ID, RD *rd, long param1, long param2); + long Condition(int ID, RD *rd, long param1, long param2); + long Expression(int ID, RD *rd, long param); +}; diff --git a/Extensions/TemplatePlusPlus/General.cpp b/Extensions/TemplatePlusPlus/General.cpp new file mode 100644 index 0000000..23e405e --- /dev/null +++ b/Extensions/TemplatePlusPlus/General.cpp @@ -0,0 +1,165 @@ +/* General.cpp + * Contains functions common to both edittime and runtime. + * Functions defined here: + * DllMain + * InitExtension + * FreeExtension + * LoadObject + * UnloadObject + * UpdateEditStrucrure + * UpdateFileNames + * EnumElts + */ + +#include "Common.h" + +/* hInstLib + * This is the HINSTANCE for your extension's DLL. + * It is set by DllMain and used later for anything + * that requires it, such as some Windows API + * functions and some internal EDIF code. You + * shouldn't change its value, ever. + */ +HINSTANCE hInstLib; + +/* DllMain + * This is a required function for Windows DLLs. You + * should not need to edit this function - if you do, + * refer to MSDN for information. + */ +BOOL WINAPI DllMain(HINSTANCE DLL, DWORD Reason, LPVOID) +{ + switch (Reason) + { + case DLL_PROCESS_ATTACH: //DLL is attaching to the address space of the current process. + { + hInstLib = DLL; //Store HINSTANCE + break; + } + case DLL_THREAD_ATTACH: //A new thread is being created in the current process. + { + // + break; + } + case DLL_THREAD_DETACH: //A thread is exiting cleanly. + { + // + break; + } + case DLL_PROCESS_DETACH: //The calling process is detaching the DLL from its address space. + { + // + break; + } + } + return TRUE; +} + + + +/* InitExtension + * MMF2 calls this before anything else when it loads your + * extension. This includes during the splash screen, in which + * case "Quiet" is true. This is where you should initialize + * global information for either edittime or runtime. Be aware, + * though, that at edittime, multiple open MFAs with your + * extension will share the same global information. You can + * use mV->mvEditApp to tell apart different MFAs from each + * other. If an error occurs during this function, return + * -1 and MMF2 will not load your extension. + */ +int MMF2Func InitExtension(mv *mV, int Quiet) +{ + return Edif::Init(mV); +} + +/* FreeExtension + * Called just before MMF2 unloads your extension. You + * should release any memory you allocated above in + * the InitializeExtension function. You should always + * return a value of 0. + */ +int MMF2Func FreeExtension(mv *mV) +{ + // + Edif::Free(mV); + return 0; +} + + +/* LoadObject + * This is called at both edittime and runtime when MMF2 + * loads each unique instance of your object. (Each one + * with a different name, not each instance of the same + * one). Not much needs to be done here. + */ +int MMF2Func LoadObject(mv *mV, LPCSTR FileName, SerializedED *SED, int) +{ + Edif::Init(mV, SED); + return 0; +} + +/* UnloadObject + * new is to delete as LoadObject is to this functon. + * If you initialized stuff above, deinitialize it here. + */ +void MMF2Func UnloadObject(mv *mV, SerializedED *SED, int) +{ + // +} + +/* UpdateEditStructure (DEPRECATED) + * This is called when MMF2 notices that your + * extension has a newer version number than + * the one in the header of the SerializedED. + * Thankfully, however, we don't need this + * function at all - the EditData class is + * as smart as you programmed it to be and + * it changes the size dynamically rather + * than statically. So, you can safely + * ignore this function all together. + * (It would be a pain to write anyway - + * see the MMF2SDK help for an example) + */ +HGLOBAL MMF2Func UpdateEditStructure(mv *mV, SerializedED *OldSED) +{ + return 0; +} + +/* UpdateFileNames + * When the application is moved to a new directory, + * MMF2 asks your extension to ensure that its file + * paths are moving with it. Just call Update for + * each file path - you will need to create buffers + * of size MAX_PATH if you use C++ strings for + * the paths. + */ +void MMF2Func UpdateFileNames(mv *mV, LPSTR appName, SerializedED *SED, void (WINAPI *Update)(LPSTR, LPSTR)) +{ + // +} + +/* EnumElts + * That whacky function that MMF2 uses to enumerate all the + * animation frames associated with your object, because MMF2 + * is nice enough to deal with them for you so you can't-er, + * don't have to. Refer to the MMF2SDK Help file for + * information on how not to misuse this function. + * You must also uncomment the entry in the Ext.def + * file if you uncomment this function. + */ +/*int MMF2Func EnumElts (mv *mV, SerializedED *SED, ENUMELTPROC enumProc, ENUMELTPROC undoProc, LPARAM lp1, LPARAM lp2) +{ + int error = 0; + + //Replace wImgIdx with the name of the WORD variable you create within the edit structure + + //Enum images + if((error = enumProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2)) != 0) + { + //Undo enum images + undoProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2); + } + + return error; +}*/ diff --git a/Extensions/TemplatePlusPlus/Icon.png b/Extensions/TemplatePlusPlus/Icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cc945e99d44d5cc99d69c46c7ced70e21878c3a1 GIT binary patch literal 4524 zcmV;d5mWAoP)Oz@Z0f2-7z;ux~O9+4z06=<WDR*FRcSTFz- zW=q650N5=6FiBTtNC2?60Km==3$g$R3;-}uh=nNt1bYBr$Ri_o0EC$U6h`t_Jn<{8 z5a%iY0C<_QJh>z}MS)ugEpZ1|S1ukX&Pf+56gFW3VVXcL!g-k)GJ!M?;PcD?0HBc- z5#WRK{dmp}uFlRjj{U%*%WZ25jX z{P*?XzTzZ-GF^d31o+^>%=Ap99M6&ogks$0k4OBs3;+Bb(;~!4V!2o<6ys46agIcq zjPo+3B8fthDa9qy|77CdEc*jK-!%ZRYCZvbku9iQV*~a}ClFY4z~c7+0P?$U!PF=S z1Au6Q;m>#f??3%Vpd|o+W=WE9003S@Bra6Svp>fO002awfhw>;8}z{#EWidF!3EsG z3;bXU&9EIRU@z1_9W=mEXoiz;4lcq~xDGvV5BgyU zp1~-*fe8db$Osc*A=-!mVv1NJjtCc-h4>-CNCXm#Bp}I%6j35eku^v$Qi@a{RY)E3 zJ#qp$hg?Rwkvqr$GJ^buyhkyVfwECO)C{#lxu`c9ghrwZ&}4KmnvWKso6vH!8a<3Q zq36)6Xb;+tK10Vaz~~qUGsJ8#F2=(`u{bOVlVi)VBCHIn#u~6ztOL7=^<&SmcLWlF zMZgI*1b0FpVIDz9SWH+>*hr`#93(Um+6gxa1B6k+CnA%mOSC4s5&6UzVlpv@SV$}* z))J2sFA#f(L&P^E5{W}HC%KRUNwK6<(h|}}(r!{C=`5+6G)NjFlgZj-YqAG9lq?`C z$c5yc>d>VnA`E_*3F2Qp##d8RZb=H01_mm@+|Cqnc9PsG(F5HIG_C zt)aG3uTh7n6Et<2In9F>NlT@zqLtGcXcuVrX|L#Xx)I%#9!{6gSJKPrN9dR61N3(c z4Tcqi$B1Vr8Jidf7-t!G7_XR2rWwr)$3XQ?}=hpK0&Z&W{| zep&sA23f;Q!%st`QJ}G3cbou<7-yIK2z4nfCCCtN2-XOGSWo##{8Q{ATurxr~;I`ytDs%xbip}RzP zziy}Qn4Z2~fSycmr`~zJ=lUFdFa1>gZThG6M+{g7vkW8#+YHVaJjFF}Z#*3@$J_By zLtVo_L#1JrVVB{Ak-5=4qt!-@Mh}c>#$4kh<88)m#-k<%CLtzEP3leVno>={htGUuD;o7bD)w_sX$S}eAxwzy?UvgBH(S?;#HZiQMoS*2K2 zT3xe7t(~nU*1N5{rxB;QPLocnp4Ml>u<^FZwyC!nu;thW+pe~4wtZn|Vi#w(#jeBd zlf9FDx_yoPJqHbk*$%56S{;6Kv~mM9!g3B(KJ}#RZ#@)!hR|78Dq|Iq-afF%KE1Brn_fm;Im z_u$xr8UFki1L{Ox>G0o)(&RAZ;=|I=wN2l97;cLaHH6leTB-XXa*h%dBOEvi`+x zi?=Txl?TadvyiL>SuF~-LZ;|cS}4~l2eM~nS7yJ>iOM;atDY;(?aZ^v+mJV$@1Ote z62cPUlD4IWOIIx&SmwQ~YB{nzae3Pc;}r!fhE@iwJh+OsDs9zItL;~pu715HdQEGA zUct(O!LkCy1<%NCg+}G`0PgpNm-?d@-hMgNe6^V+j6x$b<6@S<$+<4_1hi}Ti zncS4LsjI}fWY1>OX6feMEuLErma3QLmkw?X+1j)X-&VBk_4Y;EFPF_I+q;9dL%E~B zJh;4Nr^(LEJ3myURP{Rblsw%57T)g973R8o)DE9*xN#~;4_o$q%o z4K@u`jhx2fBXC4{U8Qn{*%*B$Ge=nny$HAYq{=vy|sI0 z_vss+H_qMky?OB#|JK!>IX&II^LlUh#rO5!7TtbwC;iULyV-Xq?ybB}ykGP{?LpZ? z-G|jbTmIbG@7#ZCz;~eY(cDM(28Dyq{*m>M4?_iynUBkc4TkHUI6gT!;y-fz>HMcd z&t%Ugo)`Y2{>!cx7B7DI)$7;J(U{Spm-3gBzioV_{p!H$8L!*M!p0uH$#^p{Ui4P` z?ZJ24cOCDe-w#jZd?0@)|7iKK^;6KN`;!@ylm7$*nDhK&GcDTy000JJOGiWi{{a60 z|De66lK=n!32;bRa{vGf6951U69E94oEQKA00(qQO+^RW2>}r?1l?6hv;Y7G-bqA3 zR9M5smtBlqRTam7YoD+CJ=1$>J8dl@B@7je`XD3_g8CxH_&|bBYT^Si(HPPgA~A~i z(Eu?*A_@ASC?O4C#Sf%l(^^Wb)7lS43pEs`oqi0xoid%db9?9Bdp`Er%ZHg_3oWz? zxRRZ{&N}Pt^H4(C9!z#CsgmIB`f8Vji8 zTyRkZk@@+|6-D0a-f7*pZl?ln!P!Sub%Owb=XsBb$gKd@>UmB<{sZTKxWuoO5s3 z^^Aux2B!|^6l*ik94CgqjOWrx6;XFrmSy(?))$dPRbLg6A7jjSPV|iY@@B`ff+fbI zTn;H!LQtXI%L#m+QnffAKAO{N_s}e*5(=pbmVm)(2zg4s+oRL5)FNfg^B%3lPzu=B z>m`pa#Det}&cs-24_C{@&o<{w{nCcfPhBliu9bPIJ;2%#!@gF?C$1ReNH64jTXS|z z8lE|zeD327%C&%vhkT-Pg~la|xa;|x=Z+YvrGVATQYN~-e)U@?^c-d2I-d?yxb1C=Zh=3VRZ=#k>0(%Ku%yp%*Hs5pYl8}SJfQA066Dz-}klK z?LKRa*`7Mze0N(#sTEkfC}Q2N4nO~M8;B^DB1#1x{D9kUUe1B36o@F5LcBr&zgVKv zx7@#}&14UDpD4&m^`3J%XBF!FG(*BcQL zw{Yxd16UAhr_gconqZTJl#3rn@YiJAD^6j&=}*ZYR37l-5>}g%d#@C@}nQQdKacr zx%=~(UbEzsoa!sXLx#XJyn52d<&IU09hFiB{g_tYqY!$8KD2uC|NR$!-Qd_vLT_&N zj$_A;J>>g-Zmm5FfOqDDa}MA4)j2meIJii>F#2TklrOhk-{J$8%n@o2-^45(NEjOE z6X+adbD%NBASUo)MEjHn`}}HTP&dC4Nocas@$vDyfUa{cd-Ij$y;9G~d zmVWwpCmiaejvKF>L~Vjdf@%yJ12ISfCPl=ek|III!Ko5={BecWiYil6uYaS{ncG(^ z785&v&7MW(T-hoL!yK5IZnb_=ufXsAS$9WgiYmnn^)tjv!AlX}Lg0`<(ZC^*gHU+z zZ!0tmLt}0JOtX3XxpKMe`u)B;S9UrV0FpG#E0s!qCv3;#oXLn0`w;)UVETgl61%TknB3L zM5r$0vJhlp5Q2t4V0h&3m%Dn^BT3?iXJ=<$@;pz^ld;|&0N}zfbj@aSBu#q1C`1vD zY#(;c3!n&61d5;wybPf0N3YbQGYu2^Ozz&j`=?P9X|-C--mXA+I{>6x(=+!1uV+~n&(6;BUjqOL!>|X8 zzdm*HN42uy={>7us$GNfym1ZZjKde?uh^E{2?Ah}KV4ZXJoz{Ox0Nrjk2Xx1d z9qT=lj?Tq{Y}z}lROXFK1rD89tUF&>rHg9t^8Wqz0db*FuoqIJnF}c*8;wQ=%#4kV ztsSg7HthJA9+_N>)PT_Fx-Hic1_jgUbRQoZ8{5`sG}1VZ-Ma;V>FH_LXf)j3y)SO< z_WI8h3z2zp>$OS&w!L_jj34`;6e8Q%xpU`(Ksr4=onB~_>RqT}zu(UR*KW7Rue$1r zTbonM3ybR=p5A(`QzB_LC+-;?9sR?=z<^DXB!AZdhzL;>nO3Vcy=v8m>X$SIuA7)# zcGig(|8ljYcCYm&>|-{cj&oO(wg&CC2kS4jef6 zec(j5+wEU$qhKyZx!G(I$8iiy9X@eet+xc&6}SF^kTODf29zptXZ?>she)P z>3X2FeED+oei^4!Dj6Ue8XBqt#Y&|TzVBV_@bIv_PtELmOaBJl#5-wtt + * The property identitifers. + */ + enum + { + zNOT_USED = PROPID_EXTITEM_CUSTOM_FIRST, + Version, + //MyString, + //MyInt, + }; +} + +PropData Properties[] = //See the MMF2SDK help file for information on PropData_ macros. +{ + PropData_StaticString(Prop::Version, (UINT_PTR)"Version #", (UINT_PTR)"This is the current version of the EDIF Template object."), + //PropData_EditMultiLine(Prop::MyString, (UINT_PTR)"My String", (UINT_PTR)"The contents of my string."), + //PropData_EditNumber(Prop::MyInt, (UINT_PTR)"My Integer", (UINT_PTR)"The value of my integer."), + PropData_End() +}; + +#endif + +/* GetProperties + * Here, you choose what proeprties to insert + * into which tabs. Lots of dynamic things can + * be done in here, such as dynamically + * generating the properties based on the + * number of stored values in the editdata. + */ +BOOL MMF2Func GetProperties(mv *mV, SerializedED *SED, BOOL MasterItem) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //ed.stuff; + mvInsertProps(mV, SED, Properties, PROPID_TAB_GENERAL, TRUE); + //if you changed ed: + //ed.Serialize(mV, SED); + return TRUE; +#endif + return FALSE; +} + +/* ReleaseProperties + * If you dynamically allocated memory for + * property arrays in GetProperties, release + * that memory in this function. + */ +void MMF2Func ReleaseProperties(mv *mV, SerializedED *SED, BOOL MasterItem) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //ed.stuff; + // + //if you changed ed: + //ed.Serialize(mV, SED); +#endif +} + +/* GetPropCreateParam + * A convenience function if you use the + * hard-coded Properties array above. Allows + * you to dynamically create e.g. combo + * lists and other things that have + * additional parameters for their + * properties. However if you dynamically + * allocated everything in GetProperties, + * this function is useless. + */ +LPARAM MMF2Func GetPropCreateParam(mv *mV, SerializedED *SED, UINT PropID) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //ed.stuff; + //return (LPARAM)TheParameter; + //if you changed ed: + //ed.Serialize(mV, SED); +#endif + return NULL; +} + +/* ReleasePropCreateParam + * If you found a useful way to use the + * above function and you dynamically + * allocated memory, release it here. + */ +void MMF2Func ReleasePropCreateParam(mv *mV, SerializedED *SED, UINT PropID, LPARAM lParam) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //ed.stuff; + //MyAwesomeMemoryFreeingFunction(lParam); + //if you changed ed: + //ed.Serialize(mV, SED); +#endif +} + +/* GetPropValue + * This is where you return the display + * values for the properties you defined. + * Refer to the MMF2SDK Help file for + * information on what to return for + * each kind of property. + */ +void *MMF2Func GetPropValue(mv *mV, SerializedED *SED, UINT PropID) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + switch(PropID) + { + case Prop::Version: + { + return new CPropDataValue("Default.EDIF.Template.0"); + } + //case Prop::MyString: + // { + // return new CPropDataValue(ed.MyString.c_str()); + // } + //case Prop::MyInt: + // { + // return new CPropDWordValue(ed.MyInt); + // } + } + //if you changed ed: + //ed.Serialize(mV, SED); +#endif + return NULL; +} + +/* SetPropValue + * The user has just finished entering their + * 500 page essay into your MyString field. + * MMF2 isn't so kind as to save that for them, + * so it entrusts it with you. Store it! + */ +void MMF2Func SetPropValue(mv *mV, SerializedED *SED, UINT PropID, CPropValue *PropVal) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //switch(PropID) + //{ + //case Prop::MyString: + // { + // ed.MyString = (LPSTR)((CPropDataValue*)PropVal)->m_pData; + // break; + // } + //case Prop::MyInt: + // { + // ed.MyInt = (CPropDWordValue*)PropVal)->m_dwValue; + // break; + // } + //} + //since you changed ed: + //ed.Serialize(mV, SED); + + //You may want to have your object redrawn in the + //frame editor after the modifications; in this + //case, just call this function: + //mvInvalidateObject(mV, SED); +#endif +} + +/* GetPropCheck + * There are checkbox properties, and + * there are properties that have their + * own checkbox as an option. This is + * where you tell MMF2 whether those + * boxes are ticked or not. + */ +BOOL MMF2Func GetPropCheck(mv *mV, SerializedED *SED, UINT PropID) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //switch(PropID) + //{ + //case Prop::MyCheckBoxPropertyOrPropertyThatHasTheCheckboxOptionSet: + // { + // return ed.WhetherOrNotThatPropertyOfMineIsTicked ? TRUE : FALSE; + // } + //} + //if you changed ed: + //ed.Serialize(mV, SED); +#endif + return FALSE; +} + +/* SetPropCheck + * The user has painstakingly moved the + * mouse cursor over the checkbox and + * expended the immense effort required + * to click the mouse and toggle the + * state of the tickbox. Don't let their + * effort be all for naught! + */ +void MMF2Func SetPropCheck(mv *mV, SerializedED *SED, UINT PropID, BOOL Ticked) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //switch(PropID) + //{ + //case Prop::MyCheckBoxPropertyOrPropertyThatHasTheCheckboxOptionSet: + // { + // ed.WhetherOrNotThatPropertyOfMineIsTicked = Ticked != FALSE ? true : false; + // } + //} + //since you changed ed: + //ed.Serialize(mV, SED); +#endif +} + +/* EditProp + * If you use a button proeprty or a + * property that has a button, then + * you would be impolite to ignore + * the user when they click on that + * button. Here is where you respond + * to that button press e.g. with + * a dialog. + */ +BOOL MMF2Func EditProp(mv *mV, SerializedED *SED, UINT PropID) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + //switch(PropID) + //{ + //case Prop::MyButtonPropertyOrPropertyThatHasAButtonWithIt: + // { + // // + // break; + // } + //} + //if you changed ed: + //ed.Serialize(mV, SED); +#endif + return FALSE; +} + +/* IsPropEnabled + * Let's say you're tired of having to deal + * with the user's various 500 page essays, + * tickbox toggles, and button clicks. Here, + * you can simply disable a property by + * returning FALSE for that property. + */ +BOOL MMF2Func IsPropEnabled(mv *mV, SerializedED *SED, UINT PropID) +{ +#ifndef RUN_ONLY + //EditData ed (SED); + switch(PropID) + { + case Prop::Version: + { + return FALSE; //Makes the version proeprty greyed out + } + //case Prop::MyString: //intentional\\ + //case Prop::MyInt: //fallthrough\\ + // { + // return TRUE; //allows the user to interact with these proeprties + // } + } + //if you changed ed: + //ed.Serialize(mV, SED); +#endif + return FALSE; +} diff --git a/Extensions/TemplatePlusPlus/Runtime.cpp b/Extensions/TemplatePlusPlus/Runtime.cpp new file mode 100644 index 0000000..f060dda --- /dev/null +++ b/Extensions/TemplatePlusPlus/Runtime.cpp @@ -0,0 +1,195 @@ +/* Runtime.cpp + * This file contains general runtime functions + * that aren't part of the Extension class. + * Functions defined here: + * GetRunObjectSurface + * GetRunObjectCollisionMask + * StartApp + * EndApp + * StartFrame + * EndFrame + * WindowProc + */ + +#include "Common.h" + +/* GetRunObjectSurface + * Implement this function instead of + * Extension::Display if your extension + * supports ink effects and transitions. + * You can support ink effects in + * DisplayRunObject too, but this is + * done automatically if you implement + * GetRunObjectSurface (MMF2 applies the + * ink effects to the surface). Don't + * forget to enable the function in the + * .def file if you uncomment & implement + * this function. + */ +/*cSurface* MMF2Func GetRunObjectSurface(RD *rd) +{ + return NULL; +}*/ + +/* GetRunObjectCollisionMask + * Implement this function if your extension + * supports fine collision detection + * (OEPREFS_FINECOLLISIONS), rr if it's a + * background object and you want Obstacle + * properties for this object. You should + * return NULL if the object is not transparent. + * Don't forget to enable the function in the + * .def file if you uncomment & implement this + * function. + */ +/*LPSMASK MMF2Func GetRunObjectCollisionMask(RD *rd, LPARAM lParam) +{ + // Typical example for active objects + // ---------------------------------- + // Opaque? collide with box + if ( (rdPtr->rs.rsEffect & EFFECTFLAG_TRANSPARENT) == 0 ) // Note: only if your object has the OEPREFS_INKEFFECTS option + return NULL; + + // Transparent? Create mask + LPSMASK pMask = rdPtr->m_pColMask; + if ( pMask == NULL ) + { + if ( rdPtr->m_pSurface != NULL ) + { + DWORD dwMaskSize = rdPtr->m_pSurface->CreateMask(NULL, lParam); + if ( dwMaskSize != 0 ) + { + pMask = (LPSMASK)calloc(dwMaskSize, 1); + if ( pMask != NULL ) + { + rdPtr->m_pSurface->CreateMask(pMask, lParam); + rdPtr->m_pColMask = pMask; + } + } + } + } + + //Note: for active objects, lParam is always the same. + //For background objects (OEFLAG_BACKGROUND), lParam maybe be different if the user uses your object + //as obstacle and as platform. In this case, you should store 2 collision masks + //in your data: one if lParam is 0 and another one if lParam is different from 0. + + return pMask; +}*/ + +/* StartApp + * Called when the application initially + * starts or when it restarts (EndApp will + * NOT be called beforehand in the case + * of a restart). This is useful if you + * need to store global data across + * frames. + */ +void MMF2Func StartApp(mv *mV, CRunApp *App) +{ +// delete (MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data"); +// Edif::Runtime::WriteGlobal(mV, App, "My Global Data", new MyGlobalData()); +} + +/* EndApp + * Called when the application is ending + * and about to close. This is NOT called + * in the event of a Restart Application + * action. You can release any memory you + * aqquired above in StartApp. + */ +void MMF2Func EndApp(mv *mV, CRunApp *App) +{ +// delete (MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data"); +// Edif::Runtime:WriteGlobal(mV, App, "My Global Data", 0); //clear dangling pointer +} + +/* StartFrame + * Called at the start of a frame. If you + * store global data above, you should make + * a copy of it so that it may be restored + * when the frame restarts. This function is + * also called when the frame restarts. + * EndFrame is NOT called when the frame + * restarts. + */ +void MMF2Func StartFrame(mv *mV, CRunApp *App, int FrameIndex) +{ +// if(!Edif::Runtime::ReadGlobal(mV, App, "My Global Data Backup")) //first time on this frame +// { +// Edif::Runtime::WriteGlobal(mV, App, "My Global Data Backup", +// new MyGlobalData(*(MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data"))); //copy +// } +// else //frame restarting, restore initial global data +// { +// delete (MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data"); +// Edif::Runtime::WriteGlobal(mV, App, "My Global Data", +// new MyGlobalData(*(MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data Backup"))); //copy +// } +} + +/* EndFrame + * Called when the frame ends. MMF2 + * does NOT call this function in the + * event of a "Restart Frame" action. + */ +void MMF2Func EndFrame(mv *mV, CRunApp *App, int FrameIndex) +{ +// delete (MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data Backup"); +// Edif::Runtime:WriteGlobal(mV, App, "My Global Data Backup", 0); //clear dangling pointer +} + + +// ============================================================================ +// +// WINDOWPROC (interception of messages sent to hMainWin and hEditWin) +// +// Do not forget to enable the WindowProc function in the .def file if you implement it +// +// ============================================================================ +/* +// Get the pointer to the object's data from its window handle +// Note: the object's window must have been subclassed with a +// callRunTimeFunction(rdPtr, RFUNCTION_SUBCLASSWINDOW, 0, 0); +// See the documentation and the Simple Control example for more info. +// +LPRDATA GetRdPtr(HWND hwnd, LPRH rhPtr) +{ + return (LPRDATA)GetProp(hwnd, (LPCSTR)rhPtr->rh4.rh4AtomRd); +} + +// Called from the window proc of hMainWin and hEditWin. +// You can intercept the messages and/or tell the main proc to ignore them. +// +LRESULT CALLBACK DLLExport WindowProc(LPRH rhPtr, HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) +{ + LPRDATA rdPtr = NULL; + + switch (nMsg) { + + // Example + case WM_CTLCOLORSTATIC: + { + // Get the handle of the control + HWND hWndControl = (HWND)lParam; + + // Get a pointer to the RUNDATA structure (see GetRdptr function above for more info) + rdPtr = GetRdPtr(hWndControl, rhPtr); + + // Check if the rdPtr pointer is valid and points to an object created with this extension + if ( rdPtr == NULL || rdPtr->rHo.hoIdentifier != IDENTIFIER ) + break; + + // OK, intercept the message + HDC hDC = (HDC)wParam; + SetBkColor(hDC, rdPtr->backColor); + SetTextColor(hDC, rdPtr->fontColor); + rhPtr->rh4.rh4KpxReturn = (long)rdPtr->hBackBrush; + return REFLAG_MSGRETURNVALUE; + } + break; + } + + return 0; +} +*/ diff --git a/Extensions/TemplatePlusPlus/Template.sln b/Extensions/TemplatePlusPlus/Template.sln new file mode 100644 index 0000000..9c29735 --- /dev/null +++ b/Extensions/TemplatePlusPlus/Template.sln @@ -0,0 +1,41 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template", "Template.vcproj", "{3BCB4C73-71F6-43B6-803D-41411F92652A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug HWA|Win32 = Debug HWA|Win32 + Debug Unicode|Win32 = Debug Unicode|Win32 + Debug|Win32 = Debug|Win32 + Edittime HWA|Win32 = Edittime HWA|Win32 + Edittime Unicode|Win32 = Edittime Unicode|Win32 + Edittime|Win32 = Edittime|Win32 + Runtime HWA|Win32 = Runtime HWA|Win32 + Runtime Unicode|Win32 = Runtime Unicode|Win32 + Runtime|Win32 = Runtime|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Win32.ActiveCfg = Debug HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Win32.Build.0 = Debug HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Win32.ActiveCfg = Debug|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Win32.Build.0 = Debug|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Win32.ActiveCfg = Edittime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Win32.Build.0 = Edittime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Win32.ActiveCfg = Edittime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Win32.Build.0 = Edittime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Win32.ActiveCfg = Edittime|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Win32.Build.0 = Edittime|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Win32.ActiveCfg = Runtime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Win32.Build.0 = Runtime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Win32.ActiveCfg = Runtime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Win32.Build.0 = Runtime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Win32.ActiveCfg = Runtime|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Win32.Build.0 = Runtime|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Extensions/TemplatePlusPlus/Template.vcproj b/Extensions/TemplatePlusPlus/Template.vcproj new file mode 100644 index 0000000..f96a3ad --- /dev/null +++ b/Extensions/TemplatePlusPlus/Template.vcproj @@ -0,0 +1,1610 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Extensions/TemplatePlusPlus/Text.cpp b/Extensions/TemplatePlusPlus/Text.cpp new file mode 100644 index 0000000..a224b17 --- /dev/null +++ b/Extensions/TemplatePlusPlus/Text.cpp @@ -0,0 +1,63 @@ +/* Text.cpp + * If you define the OEFLAG_TEXT flag, + * then this file is for you. Here you + * will deal with text at runtime similarly + * to how you dealt with it at edittime. + * By default all functions are commented + * out, if you implement them (and you + * should implement them in an all-or- + * nothing fashion), then you need to + * uncomment them in Ext.def as well. + * Functions defined here: + * GetRunObjectFont + * SetRunObjectFont + * GetRunObjectTextColor + * SetRunObjectTextColor + */ + +#include "Common.h" + +/* GetRunObjectFont + * Copy the current font into the Lf parameter. + */ +/*void MMF2Func GetRunObjectFont(RD *rd, LOGFONT *Lf) +{ + //GetObject(rd->pExtension->MyHFont, sizeof(LOGFONT), Lf); +}*/ + +/* SetRunObjectFont + * Store the font set by the user. Some + * action needs to be taken when rect is + * not null - read the MMF2SDK Help file + * for more information. + */ +/*void MMF2Func SetRunObjectFont(RD *rd, LOGFONT *Lf, RECT *rect) +{ +// Extension &ext = *(rd->pExtension); +// HFONT HFont = CreateFontIndirect(Lf); +// if(hFont != NULL) +// { +// if(ext.MyHFont != 0) DeleteObject(ext.MyHFont); +// ext.MyHFont = HFont; +// SendMessage(ext.MyHWindow, WM_SETFONT, WPARAM(ext.MyHFont), FALSE); +// } +}*/ + +/* GetRunObjectTextColor + * Plain and simple, return the color + * of the text. + */ +/*COLORREF MMF2Func GetRunObjectTextColor(RD *rd) +{ + return 0; +}*/ + +/* SetRunObjectTextColor + * Store the new color of the text + * and force and update on your window. + */ +/*void MMF2Func SetRunObjectTextColor(RD *rd, COLORREF color) +{ +// rd->pExtension->MyTextColor = color; +// InvalidateRect(rd->pExtension->MyHWindow, NULL, TRUE); +}*/ diff --git a/Extensions/TemplatePlusPlus/TextProps.cpp b/Extensions/TemplatePlusPlus/TextProps.cpp new file mode 100644 index 0000000..d8ef389 --- /dev/null +++ b/Extensions/TemplatePlusPlus/TextProps.cpp @@ -0,0 +1,116 @@ +/* TextProps.cpp + * If you plan on allowing MMF2 to manage + * your extension's text display properties + * for you, this is the file to look into. + * Functions defined here: + * GetTextCaps + * GetTextFont + * SetTextFont + * GetTextClr + * SetTextClr + * GetTextAlignment + * SetTextAlignment + */ + +#include "Common.h" + +/* GetTextCaps + * Return the text capabilities + * of your extension at edittime. + */ +DWORD MMF2Func GetTextCaps(mv *mV, SerializedED *SED) +{ +#ifndef RUN_ONLY +// return TEXT_ALIGN_LEFT|TEXT_ALIGN_HCENTER|TEXT_ALIGN_RIGHT +// |TEXT_ALIGN_TOP|TEXT_ALIGN_VCENTER|TEXT_ALIGN_BOTTOM +// |TEXT_FONT|TEXT_COLOR; +#endif + return 0; +} + +/* GetTextFont + * Return the font used by your extension. + */ +BOOL MMF2Func GetTextFont(mv *mV, SerializedED *SED, LOGFONT *lf, LPTSTR, UINT) +{ +#ifndef RUN_ONLY + // + return TRUE; +#endif + return FALSE; +} + +/* SetTextFont + * Changes the font used by your extension. + */ +BOOL MMF2Func SetTextFont(mv *mV, SerializedED *SED, LOGFONT *lf, LPCSTR) +{ +#ifndef RUN_ONLY + // + return TRUE; +#endif + return FALSE; +} + +/* GetTextClr + * Return the RGB color value of the text color. + */ +COLORREF MMF2Func GetTextClr(mv *mV, SerializedED *SED) +{ +#ifndef RUN_ONLY + // + return 200<<8; //green +#endif + return 0; +} + +/* SetTextClr + * Sets the color of the text. + */ +void MMF2Func SetTextClr(mv *mV, SerializedED *SED, COLORREF Color) +{ +#ifndef RUN_ONLY + // +#endif +} + +/* GetTextAlignment + * Return the alignment of the text. + */ +DWORD MMF2Func GetTextAlignment(mv *mV, SerializedED *SED) +{ +#ifndef RUN_ONLY +// DWORD dw = 0; + +// if((ed.Flags & ALIGN_LEFT) != 0) dw |= TEXT_ALIGN_LEFT; +// if((ed.Flags & ALIGN_HCENTER) != 0) dw |= TEXT_ALIGN_HCENTER; +// if((ed.Flags & ALIGN_RIGHT) != 0) dw |= TEXT_ALIGN_RIGHT; + +// if((ed.Flags & ALIGN_TOP) != 0) dw |= TEXT_ALIGN_TOP; +// if((ed.Flags & ALIGN_VCENTER) != 0) dw |= TEXT_ALIGN_VCENTER; +// if((ed.Flags & ALIGN_BOTTOM) != 0) dw |= TEXT_ALIGN_BOTTOM; + +// return dw; +#endif + return 0; +} + +/* SetTextAlignment + * Sets the alignment of the text. + */ +void MMF2Func SetTextAlignment(mv *mV, SerializedED *SED, DWORD AlignFlags) +{ +#ifndef RUN_ONLY +// DWORD dw = ed.Flags; + +// if((AlignFlags & TEXT_ALIGN_LEFT) != 0) dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_LEFT; +// if((AlignFlags & TEXT_ALIGN_HCENTER)!= 0) dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_HCENTER; +// if((AlignFlags & TEXT_ALIGN_RIGHT) != 0) dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_RIGHT; + +// if((AlignFlags & TEXT_ALIGN_TOP) != 0) dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_TOP; +// if((AlignFlags & TEXT_ALIGN_VCENTER)!= 0) dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_VCENTER; +// if((AlignFlags & TEXT_ALIGN_BOTTOM) != 0) dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_BOTTOM; + +// edFlags = dw; +#endif +} diff --git a/Extensions/TemplatePlusPlus/resource.h b/Extensions/TemplatePlusPlus/resource.h new file mode 100644 index 0000000..ca96268 --- /dev/null +++ b/Extensions/TemplatePlusPlus/resource.h @@ -0,0 +1,18 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by Ext.rc +// +#define IDR_EDIF_ICON 101 +#define IDR_EDIF_JSON 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif From 2bfb4a83679886cf4a9388342cb87a93223b789f Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Fri, 10 May 2013 12:36:45 -0500 Subject: [PATCH 070/127] Add readme for template projects --- .gitignore | 1 + Extensions/README.md | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 Extensions/README.md diff --git a/.gitignore b/.gitignore index 59460a7..2de7d01 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ !/Extensions/TemplatePlus/ !/Extensions/TemplatePlusPlus/ !/Extensions/AutoInstall.bat +!/Extensions/README.md ################# diff --git a/Extensions/README.md b/Extensions/README.md new file mode 100644 index 0000000..044fa2f --- /dev/null +++ b/Extensions/README.md @@ -0,0 +1,10 @@ +Extension Templates +=================== + +This folder is where your extensions will stay. There are three template projects to choose from - pick one, copy it, and rename it to start a new extension. + +**Template** is the classic EDIF template project with a similar layout to rSDK (besides the A/C/Es of course). + +**TemplatePlus** is a slighly higher-level project with better organization and some more abstraction for tedious tasks such as the Edit Data. Most functions still resemble those of rSDK. + +**TemplatePlusPlus** is a very high-level project with abstraction and classes everywhere - there is almost no resemblence to the rSDK template project. From d7d27bb028b0134d485b1c27c92f7a83cfeb6fa2 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Fri, 10 May 2013 12:48:02 -0500 Subject: [PATCH 071/127] Fix copyright symbol --- Extensions/Template/Ext.json | 161 ++++++++++++--------------- Extensions/TemplatePlus/Ext.json | 2 +- Extensions/TemplatePlusPlus/Ext.json | 2 +- 3 files changed, 74 insertions(+), 91 deletions(-) diff --git a/Extensions/Template/Ext.json b/Extensions/Template/Ext.json index 6f11221..c323313 100644 --- a/Extensions/Template/Ext.json +++ b/Extensions/Template/Ext.json @@ -1,91 +1,74 @@ { - "About": { - "Name": "Example object", - "Author": "Your Name", - "Copyright": "Copyright (C) 2013 Your Name", - "Comment": "A sentence or two to describe your extension", - "URL": "http://www.example.com", - "Help": "Help/Example.chm", - "Identifier": "EXMP" - }, - "ActionMenu": [ - [ - 0, - "Action Example" - ], - "Separator", - [ - "Sub Menu", - [ - 1, - "Second Action Example" - ] - ] - ], - "ConditionMenu": [ - [ - 0, - "Are two numbers equal?" - ] - ], - "ExpressionMenu": [ - [ - 0, - "Add two numbers" - ], - [ - 1, - "Hello world" - ] - ], - "Actions": [ - { - "Title": "Action Example with parameter %0", - "Parameters": [ - [ - "Integer", - "Example Parameter" - ] - ] - }, - { - "Title": "Second Action Example" - } - ], - "Conditions": [ - { - "Title": "%o : Are %0 and %1 equal?", - "Parameters": [ - [ - "Integer", - "First number" - ], - [ - "Integer", - "Second number" - ] - ], - "Triggered": false - } - ], - "Expressions": [ - { - "Title": "Add(", - "Returns": "Integer", - "Parameters": [ - [ - "Integer", - "First number" - ], - [ - "Integer", - "Second number" - ] - ] - }, - { - "Title": "HelloWorld$(", - "Returns": "Text" - } - ] + "About": + { + "Name": "EDIF Template Object", + "Author": "Your Name", + "Copyright": "Copyright © 2013 Your Name", + "Comment": "A sentence or two to describe your extension,\nwith up to four lines of text.", + "URL": "http://www.example.com/", + "Help": "Help/My New EDIF Extension/Help.chm", + "Identifier": "X&pl" + }, + + "ActionMenu": + [ + "Separator", + [0, "Action Example"], + "Separator", + ["Sub Menu", + [1, "Second Action Example"] + ], + "Separator", + [0, "A Disabled Menu Item", true], + "Separator" + ], + "ConditionMenu": + [ + "Separator", + [0, "Are two numbers equal?"] + ], + "ExpressionMenu": + [ + "Separator", + [0, "Add two numbers"], + [1, "Hello world"], + "Separator" + ], + + "Actions": + [ + { "Title": "Action Example with parameter %0", + "Parameters": + [ + ["Integer", "Example Parameter"] + ] + }, + { "Title": "Second Action Example" + } + ], + "Conditions": + [ + { "Title": "%o: Are %0 and %1 equal?", + "Parameters": + [ + ["Integer", "First number"], + ["Integer", "Second number"] + ], + "Triggered": false + } + ], + "Expressions": + [ + { "Title": "Add(", + "Returns": "Integer", + "Parameters": + [ + ["Integer", "First number"], + ["Integer", "Second number"] + ] + }, + { "Title": "HelloWorld$(", + "Returns": "Text" + } + ] } diff --git a/Extensions/TemplatePlus/Ext.json b/Extensions/TemplatePlus/Ext.json index cc2b218..c323313 100644 --- a/Extensions/TemplatePlus/Ext.json +++ b/Extensions/TemplatePlus/Ext.json @@ -3,7 +3,7 @@ { "Name": "EDIF Template Object", "Author": "Your Name", - "Copyright": "Copyright © 2013 Your Name", + "Copyright": "Copyright © 2013 Your Name", "Comment": "A sentence or two to describe your extension,\nwith up to four lines of text.", "URL": "http://www.example.com/", "Help": "Help/My New EDIF Extension/Help.chm", diff --git a/Extensions/TemplatePlusPlus/Ext.json b/Extensions/TemplatePlusPlus/Ext.json index cc2b218..c323313 100644 --- a/Extensions/TemplatePlusPlus/Ext.json +++ b/Extensions/TemplatePlusPlus/Ext.json @@ -3,7 +3,7 @@ { "Name": "EDIF Template Object", "Author": "Your Name", - "Copyright": "Copyright © 2013 Your Name", + "Copyright": "Copyright © 2013 Your Name", "Comment": "A sentence or two to describe your extension,\nwith up to four lines of text.", "URL": "http://www.example.com/", "Help": "Help/My New EDIF Extension/Help.chm", From 992ebaa41c4e13cd44a757253d8b135456f8312d Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Tue, 14 May 2013 20:42:02 -0400 Subject: [PATCH 072/127] Add Pre- and Post-Injection for RunData Define the macro and the relevant `struct` in `Common.h` before the `#include "Edif.h"` --- Inc/Edif.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Inc/Edif.h b/Inc/Edif.h index 4b467dc..417d3f8 100644 --- a/Inc/Edif.h +++ b/Inc/Edif.h @@ -227,6 +227,11 @@ struct RD sizeof(rSpr)+ sizeof(rVal) ]; + +#ifdef RunDataPreInject + PreInjectRD pre; +#endif + //Pointers to the optional structures, null values mean that that OEFLAG was not specified. rCom *rc; // Common structure for movements & animations rMvt *rm; // Movements (OEFLAG_MOVEMENTS) @@ -234,6 +239,12 @@ struct RD rVal *rv; // Alterable values (OEFLAG_VALUES) Extension * pExtension; + + void *ReservedForFutureUseByTheEdifSdk; + +#ifdef RunDataPostInject + PostInjectRD post; +#endif }; /* SerializedED From 33db44846c54e5a678b456fd9c126da107479408 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 14 Jul 2013 07:01:18 -0500 Subject: [PATCH 073/127] Fix garbage value being returned with optimizations enabled --- Lib/Edif.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 585b7db..a04b22b 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -390,6 +390,7 @@ int ActionOrCondition(vector &FloatFlags, LPEVENTINFOS2 Info, void * Func { int * Parameters; int ParameterCount; + bool Cast = true; { Info = GetEventInformations(Info, ID); @@ -417,6 +418,12 @@ int ActionOrCondition(vector &FloatFlags, LPEVENTINFOS2 Info, void * Func Parameters[i] = CNC_GetStringParameter(rdPtr); break; + case PARAM_COMPARAISON: //int must be returned + case PARAM_CMPSTRING: //char * must be returned + + Cast = false; + break; + default: Parameters[i] = CNC_GetParameter(rdPtr); @@ -466,7 +473,7 @@ int ActionOrCondition(vector &FloatFlags, LPEVENTINFOS2 Info, void * Func popad } - return Result; + return Cast ? (char)Result : Result; } HMENU Edif::LoadMenuJSON(int BaseID, const json_value &Source, HMENU Parent) From b43cef3a05aa70509b2a321443c7f499600e3107 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 31 Aug 2013 23:32:24 -0500 Subject: [PATCH 074/127] Update json-parser --- Inc/json.h | 18 ++++++++++++++++ Lib/json.c | 62 ++++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 62 insertions(+), 18 deletions(-) diff --git a/Inc/json.h b/Inc/json.h index a38c65c..1a85d18 100644 --- a/Inc/json.h +++ b/Inc/json.h @@ -117,6 +117,15 @@ typedef struct _json_value } * values; + #if defined(__cplusplus) && __cplusplus >= 201103L + decltype(values) begin () const + { return values; + } + decltype(values) end () const + { return values + length; + } + #endif + } object; struct @@ -124,6 +133,15 @@ typedef struct _json_value unsigned int length; struct _json_value ** values; + #if defined(__cplusplus) && __cplusplus >= 201103L + decltype(values) begin () const + { return values; + } + decltype(values) end () const + { return values + length; + } + #endif + } array; } u; diff --git a/Lib/json.c b/Lib/json.c index 72be88f..afc1a72 100644 --- a/Lib/json.c +++ b/Lib/json.c @@ -1,4 +1,3 @@ - /* vim: set et ts=3 sw=3 ft=c: * * Copyright (C) 2012 James McLaughlin et al. All rights reserved. @@ -51,16 +50,18 @@ typedef unsigned short json_uchar; static unsigned char hex_value (json_char c) { - if (c >= 'A' && c <= 'F') - return (c - 'A') + 10; - - if (c >= 'a' && c <= 'f') - return (c - 'a') + 10; - - if (c >= '0' && c <= '9') + if (isdigit(c)) return c - '0'; - return 0xFF; + switch (c) { + case 'a': case 'A': return 0x0A; + case 'b': case 'B': return 0x0B; + case 'c': case 'C': return 0x0C; + case 'd': case 'D': return 0x0D; + case 'e': case 'E': return 0x0E; + case 'f': case 'F': return 0x0F; + default: return 0xFF; + } } typedef struct @@ -189,10 +190,19 @@ static int new_value do { if (!state.first_pass) string [string_length] = b; ++ string_length; } while (0); const static long - flag_next = 1, flag_reproc = 2, flag_need_comma = 4, flag_seek_value = 8, - flag_escaped = 16, flag_string = 32, flag_need_colon = 64, flag_done = 128, - flag_num_negative = 256, flag_num_zero = 512, flag_num_e = 1024, - flag_num_e_got_sign = 2048, flag_num_e_negative = 4096; + flag_next = 1 << 0, + flag_reproc = 1 << 1, + flag_need_comma = 1 << 2, + flag_seek_value = 1 << 3, + flag_escaped = 1 << 4, + flag_string = 1 << 5, + flag_need_colon = 1 << 6, + flag_done = 1 << 7, + flag_num_negative = 1 << 8, + flag_num_zero = 1 << 9, + flag_num_e = 1 << 10, + flag_num_e_got_sign = 1 << 11, + flag_num_e_negative = 1 << 12; json_value * json_parse_ex (json_settings * settings, const json_char * json, @@ -205,8 +215,18 @@ json_value * json_parse_ex (json_settings * settings, json_value * top, * root, * alloc = 0; json_state state = { 0 }; long flags; - long num_digits, num_e; - json_int_t num_fraction; + long num_digits = 0, num_e = 0; + json_int_t num_fraction = 0; + + /* Skip UTF-8 BOM + */ + if (length >= 3 && json [0] == 0xEF + && json [1] == 0xBB + && json [2] == 0xBF) + { + json += 3; + length -= 3; + } error[0] = '\0'; end = (json + length); @@ -229,8 +249,8 @@ json_value * json_parse_ex (json_settings * settings, { json_uchar uchar; unsigned char uc_b1, uc_b2, uc_b3, uc_b4; - json_char * string; - unsigned int string_length; + json_char * string = 0; + unsigned int string_length = 0; top = root = 0; flags = flag_seek_value; @@ -499,7 +519,13 @@ json_value * json_parse_ex (json_settings * settings, while (isdigit (b) || b == '+' || b == '-' || b == 'e' || b == 'E' || b == '.') { - b = *++ i; + if ( (++ i) == end) + { + b = 0; + break; + } + + b = *i; } flags |= flag_next | flag_reproc; From 38b39e04aaf56775408a5615ac1042e0c63a1ca7 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Tue, 5 Nov 2013 21:33:23 -0600 Subject: [PATCH 075/127] Add basic CMakeLists.txt (incomplete) --- Extensions/Template/CMakeLists.txt | 87 ++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Extensions/Template/CMakeLists.txt diff --git a/Extensions/Template/CMakeLists.txt b/Extensions/Template/CMakeLists.txt new file mode 100644 index 0000000..4eda83a --- /dev/null +++ b/Extensions/Template/CMakeLists.txt @@ -0,0 +1,87 @@ + +cmake_minimum_required(VERSION 2.8.11) + +project(EXTENSION) + +set(EXT_NAME Template) + +#Grab source & header files +file(GLOB EXTENSION_SOURCES "./*.c*") +file(GLOB EXTENSION_HEADERS "./*.h*") +file(GLOB SDK_SOURCES "../../Lib/*.c*") +file(GLOB SDK_HEADERS "../../Inc/*.h*") +set(EXTENSION_SOURCES ${EXTENSION_SOURCES} ${SDK_SOURCES}) +set(EXTENSION_HEADERS ${EXTENSION_HEADERS} ${SDK_HEADERS}) +include_directories("../../Inc/" "./") +link_directories("./" "../../Lib/") + +#Fix VC++ options +if(MSVC) + message(STATUS "Note: Building with MSVC (recommended)") + foreach(flag + CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + if(${flag} MATCHES "/MD") + string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}") + endif() + endforeach() +endif() + +list(APPEND EXT_MFX_TYPE "Plain") +list(APPEND EXT_MFX_TYPE "HWA") +list(APPEND EXT_MFX_TYPE "Unicode") +list(APPEND EXT_BUILD_TYPE "Debug") +list(APPEND EXT_BUILD_TYPE "Release") +list(APPEND EXT_BUILD_TYPE "RunOnly") + +foreach(curr_mfx_t ${EXT_MFX_TYPE}) + foreach(curr_build_t ${EXT_BUILD_TYPE}) + set(curr_name ${curr_mfx_t}${curr_build_t}) + + add_library(${curr_name} SHARED ${EXTENSION_SOURCES}) + + set(curr_defs "_WINDLL;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS") + + if(curr_build_t STREQUAL "Release") + set(out_dir "./MFX/Extensions/") + list(APPEND curr_defs "EDITOR") + + elseif(curr_build_t STREQUAL "RunOnly") + set(out_dir "./MFX/Data/Runtime/") + list(APPEND curr_defs "RUN_ONLY") + + else() + set(out_dir "./MFX_Debug/Extensions/") + list(APPEND curr_defs "EDITOR;DEBUG;_DEBUG") + endif() + + set(curr_libs "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib") + + if(curr_mfx_t STREQUAL "HWA") + set(out_dir "${out_dir}HWA/") + set(curr_libs "${curr_libs} mmfs2hwa.lib") + list(APPEND curr_defs "HWABETA") + + elseif(curr_mfx_t STREQUAL "Unicode") + set(out_dir "${out_dir}Unicode/") + set(curr_libs "${curr_libs} mmfs2u.lib") + list(APPEND curr_defs "_UNICODE;UNICODE") + + else() + set(curr_libs "${curr_libs} mmfs2.lib") + endif() + + set(curr_link "") + if(MSVC) + set(curr_link "/DLL /MANIFEST:NO /DEF:\"${CMAKE_SOURCE_DIR}/Ext.def\" /MACHINE:X86") + endif() + + target_link_libraries(${curr_name} ${curr_libs}) + SET_TARGET_PROPERTIES(${curr_mfx_t}${curr_build_t} PROPERTIES + LIBRARY_OUTPUT_NAME ${EXT_NAME}.mfx + LIBRARY_OUTPUT_DIRECTORY ${out_dir} + COMPILE_DEFINITIONS "${curr_defs}" + LINK_FLAGS ${curr_link} + ) + endforeach() +endforeach() From cba81828913180771327737c262084f4a43683b4 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Thu, 7 Nov 2013 14:59:09 -0600 Subject: [PATCH 076/127] Fix unquoted arguments --- Extensions/Template/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Extensions/Template/CMakeLists.txt b/Extensions/Template/CMakeLists.txt index 4eda83a..21482ed 100644 --- a/Extensions/Template/CMakeLists.txt +++ b/Extensions/Template/CMakeLists.txt @@ -70,7 +70,7 @@ foreach(curr_mfx_t ${EXT_MFX_TYPE}) else() set(curr_libs "${curr_libs} mmfs2.lib") endif() - + set(curr_link "") if(MSVC) set(curr_link "/DLL /MANIFEST:NO /DEF:\"${CMAKE_SOURCE_DIR}/Ext.def\" /MACHINE:X86") @@ -78,10 +78,10 @@ foreach(curr_mfx_t ${EXT_MFX_TYPE}) target_link_libraries(${curr_name} ${curr_libs}) SET_TARGET_PROPERTIES(${curr_mfx_t}${curr_build_t} PROPERTIES - LIBRARY_OUTPUT_NAME ${EXT_NAME}.mfx - LIBRARY_OUTPUT_DIRECTORY ${out_dir} + LIBRARY_OUTPUT_NAME "${EXT_NAME}.mfx" + LIBRARY_OUTPUT_DIRECTORY "${out_dir}" COMPILE_DEFINITIONS "${curr_defs}" - LINK_FLAGS ${curr_link} + LINK_FLAGS "${curr_link}" ) endforeach() endforeach() From a8a9cdd0f010a105465f93120f9ad9625c064774 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Mon, 11 Nov 2013 15:52:29 -0600 Subject: [PATCH 077/127] Fix MinGW ACE calling --- Lib/Edif.cpp | 164 +++++++++++++++++++++++++-------------------------- 1 file changed, 80 insertions(+), 84 deletions(-) diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 28df1a2..3796357 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -386,6 +386,15 @@ Edif::SDK::~SDK() delete Icon; } +#ifdef __MINGW32__ +template +std::int32_t CallExtMFP(Extension &ext, void *f, Args... args) +{ + std::int32_t (Extension::*mfp)(Args...) = *reinterpret_cast(&f); + return (ext.*mfp)(args...); +} +#endif + int ActionOrCondition(vector &FloatFlags, LPEVENTINFOS2 Info, void * Function, int ID, LPRDATA rdPtr, long param1, long param2) { int * Parameters; @@ -474,42 +483,28 @@ int ActionOrCondition(vector &FloatFlags, LPEVENTINFOS2 Info, void * Func popad } #else - __asm__ - ( - "pushad;" - - "mov ecx, ParameterCount;" - - "cmp ecx, 0;" - "je CallNow;" - - "mov edx, Parameters;" - - "mov ebx, ecx;" - "shl ebx, 2;" - - "add edx, ebx;" - "sub edx, 4;" - - "PushLoop:" - - "push [edx];" - "sub edx, 4;" - - "dec ecx;" - - "cmp ecx, 0;" - "jne PushLoop;" - - "CallNow:" - - "mov ecx, Extension;" - "call Function;" - - "mov Result, eax;" - - "popad;" - ); + int *P = Parameters; + switch(ParameterCount) + { + case 0: Result = CallExtMFP(*(rdPtr->pExtension), Function); + case 1: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0]); + case 2: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1]); + case 3: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2]); + case 4: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3]); + case 5: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4]); + case 6: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5]); + case 7: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6]); + case 8: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7]); + case 9: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8]); + case 10: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9]); + case 11: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10]); + case 12: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11]); + case 13: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12]); + case 14: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13]); + case 15: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13], P[14]); + case 16: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13], P[14], P[15]); + //Since MMF2 doesn't fully support >16 parameters, they aren't supported here either + } #endif return Cast ? (char)Result : Result; @@ -709,54 +704,55 @@ long __stdcall Edif::Expression(LPRDATA rdPtr, long param) popad } #else - __asm__ - ( - "pushad;" - - "mov ecx, ParameterCount;" - - "cmp ecx, 0;" - "je CallNow2;" - - "mov edx, Parameters;" - - "mov ebx, ecx;" - "shl ebx, 2;" - - "add edx, ebx;" - "sub edx, 4;" - - "PushLoop2:" - - "push [edx];" - "sub edx, 4;" - - "dec ecx;" - - "cmp ecx, 0;" - "jne PushLoop2;" - - "CallNow2:" - - "mov ecx, Extension;" - "call Function;" - - "mov ecx, ExpressionType;" - - "cmp ecx, 1;" - "jne NotFloat;" - - "fstp Result;" - "jmp End;" - - "NotFloat:" - - "mov Result, eax;" - - "End:" - - "popad;" - ); + int *P = Parameters; + if(ExpressionType == 1) //float + { + switch(ParameterCount) + { + case 0: Result = CallExtMFP(*(rdPtr->pExtension), Function); + case 1: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0]); + case 2: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1]); + case 3: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2]); + case 4: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3]); + case 5: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4]); + case 6: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5]); + case 7: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6]); + case 8: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7]); + case 9: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8]); + case 10: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9]); + case 11: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10]); + case 12: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11]); + case 13: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12]); + case 14: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13]); + case 15: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13], P[14]); + case 16: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13], P[14], P[15]); + //Since MMF2 doesn't fully support >16 parameters, they aren't supported here either + } + } + else + { + switch(ParameterCount) + { + case 0: Result = CallExtMFP(*(rdPtr->pExtension), Function); + case 1: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0]); + case 2: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1]); + case 3: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2]); + case 4: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3]); + case 5: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4]); + case 6: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5]); + case 7: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6]); + case 8: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7]); + case 9: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8]); + case 10: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9]); + case 11: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10]); + case 12: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11]); + case 13: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12]); + case 14: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13]); + case 15: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13], P[14]); + case 16: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13], P[14], P[15]); + //Since MMF2 doesn't fully support >16 parameters, they aren't supported here either + } + } #endif switch(ExpressionType) From 1e29fb59709cfb9d4a5847126a8adef7f1dddef2 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Mon, 3 Mar 2014 14:23:50 -0600 Subject: [PATCH 078/127] Update json-parser, partially fix double SDK init in F2.5 --- Inc/json.h | 9 ++-- Lib/Edif.cpp | 7 ++- Lib/json.c | 123 +++++++++++++++++++++++++++++++++++++++------------ 3 files changed, 106 insertions(+), 33 deletions(-) diff --git a/Inc/json.h b/Inc/json.h index 1a85d18..cf9f0dd 100644 --- a/Inc/json.h +++ b/Inc/json.h @@ -1,7 +1,7 @@ -/* vim: set et ts=3 sw=3 ft=c: +/* vim: set et ts=3 sw=3 sts=3 ft=c: * - * Copyright (C) 2012 James McLaughlin et al. All rights reserved. + * Copyright (C) 2012, 2013, 2014 James McLaughlin et al. All rights reserved. * https://github.com/udp/json-parser * * Redistribution and use in source and binary forms, with or without @@ -70,7 +70,7 @@ typedef struct } json_settings; -#define json_relaxed_commas 1 +#define json_enable_comments 0x01 typedef enum { @@ -113,6 +113,8 @@ typedef struct _json_value struct { json_char * name; + unsigned int name_length; + struct _json_value * value; } * values; @@ -244,6 +246,7 @@ typedef struct _json_value json_value * json_parse (const json_char * json, size_t length); +#define json_error_max 128 json_value * json_parse_ex (json_settings * settings, const json_char * json, size_t length, diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 3796357..0a18ef2 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -1,7 +1,7 @@ #include "Common.h" using namespace std; -Edif::SDK * SDK; +Edif::SDK * SDK = 0; TCHAR Edif::LanguageCode[3]; @@ -168,7 +168,10 @@ int Edif::Init(mv _far * mV) return -1; } - ::SDK = new Edif::SDK(mV, *json); + if(!::SDK) + { + ::SDK = new Edif::SDK(mV, *json); + } return 0; // no error } diff --git a/Lib/json.c b/Lib/json.c index afc1a72..8ce0205 100644 --- a/Lib/json.c +++ b/Lib/json.c @@ -1,6 +1,6 @@ -/* vim: set et ts=3 sw=3 ft=c: +/* vim: set et ts=3 sw=3 sts=3 ft=c: * - * Copyright (C) 2012 James McLaughlin et al. All rights reserved. + * Copyright (C) 2012, 2013, 2014 James McLaughlin et al. All rights reserved. * https://github.com/udp/json-parser * * Redistribution and use in source and binary forms, with or without @@ -78,7 +78,7 @@ typedef struct static void * default_alloc (size_t size, int zero, void * user_data) { - return zero ? calloc (size, 1) : malloc (size); + return zero ? calloc (1, size) : malloc (size); } static void default_free (void * ptr, void * user_data) @@ -189,7 +189,7 @@ static int new_value #define string_add(b) \ do { if (!state.first_pass) string [string_length] = b; ++ string_length; } while (0); -const static long +static const long flag_next = 1 << 0, flag_reproc = 1 << 1, flag_need_comma = 1 << 2, @@ -202,14 +202,16 @@ const static long flag_num_zero = 1 << 9, flag_num_e = 1 << 10, flag_num_e_got_sign = 1 << 11, - flag_num_e_negative = 1 << 12; + flag_num_e_negative = 1 << 12, + flag_line_comment = 1 << 13, + flag_block_comment = 1 << 14; json_value * json_parse_ex (json_settings * settings, const json_char * json, size_t length, char * error_buf) { - json_char error [128]; + json_char error [json_error_max]; unsigned int cur_line; const json_char * cur_line_begin, * i, * end; json_value * top, * root, * alloc = 0; @@ -220,9 +222,9 @@ json_value * json_parse_ex (json_settings * settings, /* Skip UTF-8 BOM */ - if (length >= 3 && json [0] == 0xEF - && json [1] == 0xBB - && json [2] == 0xBF) + if (length >= 3 && ((unsigned char) json [0]) == 0xEF + && ((unsigned char) json [1]) == 0xBB + && ((unsigned char) json [2]) == 0xBF) { json += 3; length -= 3; @@ -262,22 +264,6 @@ json_value * json_parse_ex (json_settings * settings, { json_char b = (i == end ? 0 : *i); - if (flags & flag_done) - { - if (!b) - break; - - switch (b) - { - whitespace: - continue; - - default: - sprintf (error, "%d:%d: Trailing garbage: `%c`", cur_line, e_off, b); - goto e_failed; - }; - } - if (flags & flag_string) { if (!b) @@ -301,7 +287,8 @@ json_value * json_parse_ex (json_settings * settings, case 't': string_add ('\t'); break; case 'u': - if ((uc_b1 = hex_value (*++ i)) == 0xFF || (uc_b2 = hex_value (*++ i)) == 0xFF + if (end - i < 4 || + (uc_b1 = hex_value (*++ i)) == 0xFF || (uc_b2 = hex_value (*++ i)) == 0xFF || (uc_b3 = hex_value (*++ i)) == 0xFF || (uc_b4 = hex_value (*++ i)) == 0xFF) { sprintf (error, "Invalid character value `%c` (at %d:%d)", b, cur_line, e_off); @@ -380,6 +367,9 @@ json_value * json_parse_ex (json_settings * settings, top->u.object.values [top->u.object.length].name = (json_char *) top->_reserved.object_mem; + top->u.object.values [top->u.object.length].name_length + = string_length; + (*(json_char **) &top->_reserved.object_mem) += string_length + 1; } @@ -397,6 +387,83 @@ json_value * json_parse_ex (json_settings * settings, } } + if (state.settings.settings & json_enable_comments) + { + if (flags & (flag_line_comment | flag_block_comment)) + { + if (flags & flag_line_comment) + { + if (b == '\r' || b == '\n' || !b) + { + flags &= ~ flag_line_comment; + -- i; /* so null can be reproc'd */ + } + + continue; + } + + if (flags & flag_block_comment) + { + if (!b) + { sprintf (error, "%d:%d: Unexpected EOF in block comment", cur_line, e_off); + goto e_failed; + } + + if (b == '*' && i < (end - 1) && i [1] == '/') + { + flags &= ~ flag_block_comment; + ++ i; /* skip closing sequence */ + } + + continue; + } + } + else if (b == '/') + { + if (! (flags & (flag_seek_value | flag_done)) && top->type != json_object) + { + sprintf (error, "%d:%d: Comment not allowed here", cur_line, e_off); + goto e_failed; + } + + if (++ i == end) + { sprintf (error, "%d:%d: EOF unexpected", cur_line, e_off); + goto e_failed; + } + + switch (b = *i) + { + case '/': + flags |= flag_line_comment; + continue; + + case '*': + flags |= flag_block_comment; + continue; + + default: + sprintf (error, "%d:%d: Unexpected `%c` in comment opening sequence", cur_line, e_off, b); + goto e_failed; + }; + } + } + + if (flags & flag_done) + { + if (!b) + break; + + switch (b) + { + whitespace: + continue; + + default: + sprintf (error, "%d:%d: Trailing garbage: `%c`", cur_line, e_off, b); + goto e_failed; + }; + } + if (flags & flag_seek_value) { switch (b) @@ -408,7 +475,7 @@ json_value * json_parse_ex (json_settings * settings, if (top->type == json_array) flags = (flags & ~ (flag_need_comma | flag_seek_value)) | flag_next; - else if (!state.settings.settings & json_relaxed_commas) + else { sprintf (error, "%d:%d: Unexpected ]", cur_line, e_off); goto e_failed; } @@ -569,7 +636,7 @@ json_value * json_parse_ex (json_settings * settings, case '"': - if (flags & flag_need_comma && (!state.settings.settings & json_relaxed_commas)) + if (flags & flag_need_comma) { sprintf (error, "%d:%d: Expected , before \"", cur_line, e_off); goto e_failed; From 9bf769c2111b01e61837fe5603ae3dbb390a2f1e Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 15 Mar 2014 19:59:09 -0500 Subject: [PATCH 079/127] Workaround for double init/free calls --- Lib/Edif.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 0a18ef2..7ad57b3 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -80,9 +80,7 @@ void Edif::Init(mv * _far mV, LPEDATA edPtr) } void Edif::Free(mv * _far mV) -{ - delete ::SDK; - ::SDK = NULL; +{ } void Edif::Free(LPEDATA edPtr) @@ -168,10 +166,8 @@ int Edif::Init(mv _far * mV) return -1; } - if(!::SDK) - { - ::SDK = new Edif::SDK(mV, *json); - } + static Edif::SDK gSDK (mV, *json); + ::SDK = &gSDK; return 0; // no error } From 9721dd213547a371f8defb0a2064b444b3534f1d Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 15 Mar 2014 21:09:35 -0500 Subject: [PATCH 080/127] Update values returned to Fusion --- Lib/Edif.General.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/Edif.General.cpp b/Lib/Edif.General.cpp index c520203..6d95c79 100644 --- a/Lib/Edif.General.cpp +++ b/Lib/Edif.General.cpp @@ -80,10 +80,10 @@ extern "C" switch (info) { case KGI_VERSION: - return EXT_VERSION2; + return EXT_VERSION3; case KGI_PLUGIN: - return EXT_PLUGIN_VERSION1; + return EXT_PLUGIN_VERSION2; case KGI_PRODUCT: From b7f07be1a27dbfa2f081b3e13bacbf1ab376945b Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 15 Mar 2014 21:13:42 -0500 Subject: [PATCH 081/127] Update AutoInstall.bat for Fusion 2.5 --- Extensions/AutoInstall.bat | 42 +++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/Extensions/AutoInstall.bat b/Extensions/AutoInstall.bat index 9bffb35..dc19e5e 100644 --- a/Extensions/AutoInstall.bat +++ b/Extensions/AutoInstall.bat @@ -36,9 +36,49 @@ copy /y "%1" "%mmfpath%%2" set mmfpath= set status= -goto end +goto cfd :nmfs echo You don't have MMF2 Standard +:cfd +set status=ERROR +for /F "tokens=1 delims=:" %%A in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Clickteam\Fusion Developer 2.5\Settings" /v "InstallPath"') do set status=%%A +set status=%status:~0,5% +if %status%==ERROR goto ncfd + +for /F "tokens=3* delims= " %%A in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Clickteam\Fusion Developer 2.5\Settings" /v "InstallPath" ^| find "REG_SZ"') do set mmfpath=%%A %%B + +echo CTF2.5 Dev Path: %mmfpath% + +copy /y "%1" "%mmfpath%%2" + +set mmfpath= +set status= + +goto cfs + +:ncfd +echo You don't have CTF2.5 Developer :( + +:cfs +set status=ERROR +for /F "tokens=1 delims=:" %%A in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Clickteam\Fusion 2.5\Settings" /v "InstallPath"') do set status=%%A +set status=%status:~0,5% +if %status%==ERROR goto ncfs + +for /F "tokens=3* delims= " %%A in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Clickteam\Fusion 2.5\Settings" /v "InstallPath" ^| find "REG_SZ"') do set mmfpath=%%A %%B + +echo CTF2.5 Std Path: %mmfpath% + +copy /y "%1" "%mmfpath%%2" + +set mmfpath= +set status= + +goto end + +:ncfs +echo You don't have CTF2.5 Standard + :end From 246ca305efb1362cc03dc4f0d6ee1ec4633e016c Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 15 Mar 2014 22:32:22 -0500 Subject: [PATCH 082/127] Remove TemplatePlusPlus --- Extensions/TemplatePlusPlus/Actions.cpp | 17 - Extensions/TemplatePlusPlus/CMakeLists.txt | 97 -- Extensions/TemplatePlusPlus/Common.h | 39 - Extensions/TemplatePlusPlus/Conditions.cpp | 14 - Extensions/TemplatePlusPlus/CustomParams.cpp | 108 -- Extensions/TemplatePlusPlus/Debugger.cpp | 141 -- Extensions/TemplatePlusPlus/EditData.hpp | 131 -- Extensions/TemplatePlusPlus/Edittime.cpp | 297 ---- Extensions/TemplatePlusPlus/Expressions.cpp | 20 - Extensions/TemplatePlusPlus/Ext.def | 118 -- Extensions/TemplatePlusPlus/Ext.json | 74 - Extensions/TemplatePlusPlus/Ext.rc | 156 -- Extensions/TemplatePlusPlus/Extension.cpp | 190 --- Extensions/TemplatePlusPlus/Extension.hpp | 133 -- Extensions/TemplatePlusPlus/General.cpp | 165 -- Extensions/TemplatePlusPlus/Icon.png | Bin 4524 -> 0 bytes Extensions/TemplatePlusPlus/Properties.cpp | 292 ---- Extensions/TemplatePlusPlus/Runtime.cpp | 195 --- Extensions/TemplatePlusPlus/Template.sln | 41 - Extensions/TemplatePlusPlus/Template.vcproj | 1610 ------------------ Extensions/TemplatePlusPlus/Text.cpp | 63 - Extensions/TemplatePlusPlus/TextProps.cpp | 116 -- Extensions/TemplatePlusPlus/resource.h | 18 - 23 files changed, 4035 deletions(-) delete mode 100644 Extensions/TemplatePlusPlus/Actions.cpp delete mode 100644 Extensions/TemplatePlusPlus/CMakeLists.txt delete mode 100644 Extensions/TemplatePlusPlus/Common.h delete mode 100644 Extensions/TemplatePlusPlus/Conditions.cpp delete mode 100644 Extensions/TemplatePlusPlus/CustomParams.cpp delete mode 100644 Extensions/TemplatePlusPlus/Debugger.cpp delete mode 100644 Extensions/TemplatePlusPlus/EditData.hpp delete mode 100644 Extensions/TemplatePlusPlus/Edittime.cpp delete mode 100644 Extensions/TemplatePlusPlus/Expressions.cpp delete mode 100644 Extensions/TemplatePlusPlus/Ext.def delete mode 100644 Extensions/TemplatePlusPlus/Ext.json delete mode 100644 Extensions/TemplatePlusPlus/Ext.rc delete mode 100644 Extensions/TemplatePlusPlus/Extension.cpp delete mode 100644 Extensions/TemplatePlusPlus/Extension.hpp delete mode 100644 Extensions/TemplatePlusPlus/General.cpp delete mode 100644 Extensions/TemplatePlusPlus/Icon.png delete mode 100644 Extensions/TemplatePlusPlus/Properties.cpp delete mode 100644 Extensions/TemplatePlusPlus/Runtime.cpp delete mode 100644 Extensions/TemplatePlusPlus/Template.sln delete mode 100644 Extensions/TemplatePlusPlus/Template.vcproj delete mode 100644 Extensions/TemplatePlusPlus/Text.cpp delete mode 100644 Extensions/TemplatePlusPlus/TextProps.cpp delete mode 100644 Extensions/TemplatePlusPlus/resource.h diff --git a/Extensions/TemplatePlusPlus/Actions.cpp b/Extensions/TemplatePlusPlus/Actions.cpp deleted file mode 100644 index 4e38040..0000000 --- a/Extensions/TemplatePlusPlus/Actions.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/* Actions.cpp - * This is where you should define the - * behavior of your actions. Make sure - * the parameters match those in the JSON - * exactly! Double check Extension.h - * as well. - */ - -#include "Common.h" - -void Extension::ActionExample(int ExampleParameter) -{ -} - -void Extension::SecondActionExample() -{ -} diff --git a/Extensions/TemplatePlusPlus/CMakeLists.txt b/Extensions/TemplatePlusPlus/CMakeLists.txt deleted file mode 100644 index 94b7432..0000000 --- a/Extensions/TemplatePlusPlus/CMakeLists.txt +++ /dev/null @@ -1,97 +0,0 @@ - -cmake_minimum_required(VERSION 2.8.11) - -project(EXTENSION) - -set(EXT_NAME Template) - -#Grab source & header files -file(GLOB EXTENSION_SOURCES "./*.c*") -file(GLOB EXTENSION_HEADERS "./*.h*") -file(GLOB SDK_SOURCES "../../Lib/*.c*") -file(GLOB SDK_HEADERS "../../Inc/*.h*") -set(EXTENSION_SOURCES ${EXTENSION_SOURCES} ${SDK_SOURCES}) -set(EXTENSION_HEADERS ${EXTENSION_HEADERS} ${SDK_HEADERS}) -include_directories("../../Inc/" "./") -link_directories("./" "../../Lib/") - -#Fix VC++ options -if(MSVC) - message(STATUS "Note: Building with MSVC (recommended)") - foreach(flag - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - if(${flag} MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}") - endif() - endforeach() -endif() - -#Fix settings for MinGW -set(lib_ext ".lib") -if(MINGW) - set(CMAKE_CXX_FLAGS "-std=c++11 -masm=intel ${CMAKE_CXX_FLAGS} -Wno-multichar") - set(lib_ext "") -endif() - -list(APPEND EXT_MFX_TYPE "Plain") -list(APPEND EXT_MFX_TYPE "HWA") -list(APPEND EXT_MFX_TYPE "Unicode") -list(APPEND EXT_BUILD_TYPE "Debug") -list(APPEND EXT_BUILD_TYPE "Release") -list(APPEND EXT_BUILD_TYPE "RunOnly") - -foreach(curr_mfx_t ${EXT_MFX_TYPE}) - foreach(curr_build_t ${EXT_BUILD_TYPE}) - set(curr_name ${curr_mfx_t}${curr_build_t}) - - add_library(${curr_name} SHARED ${EXTENSION_SOURCES}) - - set(curr_defs "_WINDLL;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS") - - if(curr_build_t STREQUAL "Release") - set(out_dir "./MFX/Extensions/") - list(APPEND curr_defs "EDITOR") - - elseif(curr_build_t STREQUAL "RunOnly") - set(out_dir "./MFX/Data/Runtime/") - list(APPEND curr_defs "RUN_ONLY") - - else() - set(out_dir "./MFX_Debug/Extensions/") - list(APPEND curr_defs "EDITOR;DEBUG;_DEBUG") - endif() - - set(curr_libs "kernel32${lib_ext}") - if(MSVC) - set(curr_libs "${curr_libs} user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib") - endif() - - if(curr_mfx_t STREQUAL "HWA") - set(out_dir "${out_dir}HWA/") - set(curr_libs "${curr_libs} mmfs2hwa${lib_ext}") - list(APPEND curr_defs "HWABETA") - - elseif(curr_mfx_t STREQUAL "Unicode") - set(out_dir "${out_dir}Unicode/") - set(curr_libs "${curr_libs} mmfs2u${lib_ext}") - list(APPEND curr_defs "_UNICODE;UNICODE") - - else() - set(curr_libs "${curr_libs} mmfs2${lib_ext}") - endif() - - set(curr_link "") - if(MSVC) - set(curr_link "/DLL /MANIFEST:NO /DEF:\"${CMAKE_SOURCE_DIR}/Ext.def\" /MACHINE:X86") - endif() - - target_link_libraries(${curr_name} ${curr_libs}) - SET_TARGET_PROPERTIES(${curr_mfx_t}${curr_build_t} PROPERTIES - LIBRARY_OUTPUT_NAME "${EXT_NAME}.mfx" - LIBRARY_OUTPUT_DIRECTORY "${out_dir}" - COMPILE_DEFINITIONS "${curr_defs}" - LINK_FLAGS "${curr_link}" - ) - endforeach() -endforeach() diff --git a/Extensions/TemplatePlusPlus/Common.h b/Extensions/TemplatePlusPlus/Common.h deleted file mode 100644 index ea20fc2..0000000 --- a/Extensions/TemplatePlusPlus/Common.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Common.h - * This is the common header file included - * by almost all other *.cpp files in - * the project. Anything that gets put or - * included in here will be available to you - * everywhere else. You shouldn't need to - * change anything in this file except - * to include headers that you want and - * to change the edition of MMF2 you want - * to support. - */ - -#pragma once - -//Only define one of these at once: -// #define TGFEXT //TGF2, MMF2, MMF2 Dev - #define MMFEXT //MMF2, MMF2 Dev -// #define PROEXT //MMF2 Dev only - -//Define this if you want legacy comma-less JSON support -// #define UsingJsonWithoutCommas - -#include "Edif.h" -#include "Resource.h" - -//#include -//#include "YourHeader.hpp" - -/* stdtstring - * A std::string that knows if you're using - * unicode or not. (Protip: strings passed - * to your extension A/C/Es still need to be - * const TCHAR *, and the same goes for strings - * returned from expressions and conditions). - */ -typedef std::basic_string stdtstring; - -#include "EditData.hpp" -#include "Extension.hpp" diff --git a/Extensions/TemplatePlusPlus/Conditions.cpp b/Extensions/TemplatePlusPlus/Conditions.cpp deleted file mode 100644 index 41b2b7b..0000000 --- a/Extensions/TemplatePlusPlus/Conditions.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/* Conditions.cpp - * This is where you should define the - * behavior of your conditions. Make sure - * the parameters and return types match those - * in the JSON exactly! Double check Extension.h - * as well. - */ - -#include "Common.h" - -bool Extension::AreTwoNumbersEqual(int First, int Second) -{ - return First == Second; -} diff --git a/Extensions/TemplatePlusPlus/CustomParams.cpp b/Extensions/TemplatePlusPlus/CustomParams.cpp deleted file mode 100644 index c32bad6..0000000 --- a/Extensions/TemplatePlusPlus/CustomParams.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* CustomParams.cpp - * Just as with all the other SDKs, EDIF - * supports the creation and use of custom, - * you-defined parameters. Your own dialog, - * your own display string, your own sense - * of control. Read the MMF2SDK Help file - * for more information. To use custom - * parameters with EDIF, the parameter type - * must be "Custom" or "Custom#" where # is - * the number of the custom parameter. - * Functions defined here: - * InitParameter - * EditParameter - * GetParameterString - */ - -#include "Common.h" - -/* InitParameter - * Like with the editdata, this data will - * be written as-is to disk and later read - * back. The most you can store is defined - * by PARAM_EXTMAXSIZE, which currently is - * 512 bytes. Use them wisely! - */ -void MMF2Func InitParameter(mv *mV, short ID, paramExt *ParamData) -{ -#ifndef RUN_ONLY - //store data in ParamData->pextData - //store the size of the data in ParamData->pextSize -#endif -} - -// Example of custom parameter setup proc -// -------------------------------------- -/* -#ifndef RUN_ONLY -BOOL CALLBACK SetupProc(HWND hDlg, UINT msgType, WPARAM wParam, LPARAM lParam) -{ - paramExt* pExt; - - switch (msgType) - { - case WM_INITDIALOG: // Init dialog - - // Save edptr - SetWindowLong(hDlg, DWL_USER, lParam); - pExt=(paramExt*)lParam; - - SetDlgItemText(hDlg, IDC_EDIT, pExt->pextData); - return TRUE; - - case WM_COMMAND: // Command - - // Retrieve edptr - pExt = (paramExt *)GetWindowLong(hDlg, DWL_USER); - - switch (wmCommandID) - { - case IDOK: // Exit - GetDlgItemText(hDlg, IDC_EDIT, pExt->pextData, 500); - pExt->pextSize=sizeof(paramExt)+strlen(pExt->pextData)+1; - EndDialog(hDlg, TRUE); - return TRUE; - - default: - break; - } - break; - - default: - break; - } - return FALSE; -} -#endif -*/ - -/* EditParameter - * This is where you actually bring up - * the dialog and take input from - * the user and store it. - */ -void MMF2Func EditParameter(mv _far *mV, short code, paramExt* pExt) -{ -#ifndef RUN_ONLY - // Example - // ------- - // DialogBoxParam(hInstLib, MAKEINTRESOURCE(DB_TRYPARAM), mV->mvHEditWin, SetupProc, (LPARAM)(LPBYTE)pExt); -#endif -} - -/* GetParameterString - * This is where you give MMF2 the display - * string for your custom parameter. Remember, - * this is the display for ONE PARAMETER. It - * will appear amongst all the other parameter - * displays depending on the A/C's display - * string. - */ -void MMF2Func GetParameterString(mv _far *mV, short code, paramExt* pExt, LPSTR pDest, short size) -{ -#ifndef RUN_ONLY - // Example - // ------- - // wsprintf(pDest, "Super parameter %s", pExt->pextData); -#endif -} diff --git a/Extensions/TemplatePlusPlus/Debugger.cpp b/Extensions/TemplatePlusPlus/Debugger.cpp deleted file mode 100644 index 53b6cbd..0000000 --- a/Extensions/TemplatePlusPlus/Debugger.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* Debugger.cpp - * Here you will be able to interact - * with the MMF2 debugger (that thing - * in the top left when you run your - * MFA from MMF2). You can add your own - * fields of your choice to your object's - * debugger tree. - * Functions defined here: - * GetDebugTree - * GetDebugItem - * EditDebugItem - */ - -#include "Common.h" - -#ifndef RUN_ONLY //The debugger is only available when running from MMF2, which uses the Edittime MFX - -/* DB - * This is the namespace the debugger identifiers - * are stored in. It keeps them out of the global - * namespace and it helps with intellisense. - */ -namespace DB -{ - /* - * The debugger identitifers. - */ - enum - { -// MyString, -// MyInt, - }; -} - -/* DebugTree - * The list of items to be displayed - * in the debugger tree. - */ -WORD DebugTree[] = -{ -// DB::MyString|DB_EDITABLE, -// DB::MyInt|DB_EDITABLE, -// DB::SomethingThatIDontWantTheUserToBeAbleToEditAtRuntime, - DB_END -}; - -#endif - -/* GetDerbugTree - * Plain and simple, just return the debug - * tree pointer from above. If you really - * want to you can create the debug tree - * dynamically and return that, but you'll - * need to store the pointer in your extension - * class every time so that you can release - * the memory in your extension class' destructor. - */ -LPWORD MMF2Func GetDebugTree(RD *rd) -{ -#ifndef RUN_ONLY - return DebugTree; -#endif - return NULL; -} - -/* GetDebugItem - * With respect to DB_BUFFERSIZE, give - * MMF2 the string to display in the - * debugger. You must include both the - * name and the value in the string, - * or any format you want. - */ -void MMF2Func GetDebugItem(LPSTR Buffer, RD *rd, int ID) -{ -#ifndef RUN_ONLY -// char temp[DB_BUFFERSIZE]; -// switch (ID) -// { -// case DB::MyString: -// { -// LoadString(hInstLib, IDS_CURRENTSTRING, temp, DB_BUFFERSIZE); -// wsprintf(pBuffer, temp, rdPtr->text); -// break; -// } -// case DB::MyInt: -// { -// LoadString(hInstLib, IDS_CURRENTVALUE, temp, DB_BUFFERSIZE); -// wsprintf(pBuffer, temp, rdPtr->value); -// break; -// } -// } -#endif -} - -/* EditDebugItem - * When the user chooses to edit an - * editable debug item, this function - * is called. You can use the RFUNCTIONs - * provided by MMF2 to do simple text and - * number edits, or you can do whatever you - * want, such as creating a dialog that lets - * the user enter more sophisticated input to - * the debug item, or simply display more info. - */ -void MMF2Func EditDebugItem(RD *rd, int ID) -{ -#ifndef RUN_ONLY -/* - switch(ID) - { - case DB::MyString: - { - EditDebugInfo dbi; - char buffer[256]; - - dbi.pText=buffer; - dbi.lText=TEXT_MAX; - dbi.pTitle=NULL; - - strcpy(buffer, rdPtr->text); - long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITTEXT, 0, (LPARAM)&dbi); - if (ret) - strcpy(rdPtr->text, dbi.pText); - } - break; - case DB::MyInt: - { - EditDebugInfo dbi; - - dbi.value=rdPtr->value; - dbi.pTitle=NULL; - - long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITINT, 0, (LPARAM)&dbi); - if (ret) - rdPtr->value=dbi.value; - } - break; - } -*/ -#endif -} diff --git a/Extensions/TemplatePlusPlus/EditData.hpp b/Extensions/TemplatePlusPlus/EditData.hpp deleted file mode 100644 index 3d4b4c5..0000000 --- a/Extensions/TemplatePlusPlus/EditData.hpp +++ /dev/null @@ -1,131 +0,0 @@ -/* EditData.hpp - * This is where you control what data - * you want to have at edittime. You - * are responsible for serializing and - * deserializing (saving/loading) the - * data to/from the SerializedED structure - * as if it were a file on the hard drive. - * It doesn't need to be efficient; this - * is just at edittime and once at the - * start of the runtime. - */ - -struct EditData -{ - /* MyString, MyInt, MyArray_t, MyArray - * Example data - */ -// stdtstring MyString; -// int MyInt; -// typedef std::vector MyArray_t; -// MyArray_t MyArray; - - /* - * This is where you provide default values for - * your editdata. This constructor is used - * when your extension is first created and - * default values are needed. - */ - EditData() // : MyString(_T("Hello, world!")), MyInt(1337) - { - //MyArray.push_back(3.1415926f); - } - - /* - * As a convenience in other parts of your code, - * you should copy data from another instance - * of the EditData class. Make sure you deep-copy - * dynamically allocated memory e.g. with pointers. - */ - EditData(const EditData &from) // : MyString(from.MyString), MyInt(from.MyInt), MyArray(from.MyArray) - { - // - } - - /* operator= - * This is essentially the same as the copy - * constructor above, except you are working - * with an instance that is already - * constructed. - */ - EditData &operator=(const EditData &from) - { -// MyString = from.MyString; -// MyInt = from.MyInt; -// MyArray = from.MyArray; - } - -#ifndef RUN_ONLY - /* Serialize - * This is where you need to "write" data - * to SerializedED like a file. Make sure - * you can read the data back in the - * constructor below! - */ - bool Serialize(mv *mV, SerializedED *&SED) const - { - //Create an instance of EDOStream, a helper class - EDOStream os (mV, SED); - - //Write the data you need to save in binary format - //(you can use text format, but binary is recommended) -// os.write_string(MyString); //works for c-strings too -// os.write_value(MyInt); //only works for primitives! -// os.write_value(MyArray.size()); //need to know how many to load later -// os.write_sequence(MyArray.begin(), MyArray.end()); //works for c-style arrays too - - //That's it! EDOStream automatically stores the data in your extension's editdata - return true; //return false in the event of an error - } -#endif - - /* - * This is the primary constructor for the - * EditData class. Here you will have to - * "read" SerializedED like a file and - * load back everything that gets saved - * above in Serialize. Make sure you check - * the version information first, this - * constructor is used to update from - * older versions of your editdata as well. - */ - EditData(SerializedED *SED) - { - if(SED->Header.extVersion == 0) //older version - { - //code to update from an older version - } - else if(SED->Header.extVersion == 1) //current version - { - //Create an instance of EDIStream, a helper class - EDIStream is (SED); - //Read back the data in the same format that you stored it above -// MyString = is.read_string(); -// MyInt = is.read_value(); //need to specify the type here -// MyArray_t::size_type MyArray_size = is.read_value(); -// for(MyArray_t::size_type i = 0; i < MyArray_size; ++i) -// { -// MyArray.push_back(is.read_value()); -// } - } - else //the version is newer than current - { - //Either try to load the data anyway assuming your - //future self was smart enough to keep the data in - //the same format with new data at the end, or - //make an error dialog and load some default data. -// MessageBox(NULL, _T("The MFA you are trying to load was saved") -// _T("with a newer version of this extension."), -// _T("Error Loading My Extension"), MB_OK); - } - } - - /* - * If you grabbed any memory e.g. with new, - * make sure to e.g. delete it in here. - */ - ~EditData() - { - // - } -}; diff --git a/Extensions/TemplatePlusPlus/Edittime.cpp b/Extensions/TemplatePlusPlus/Edittime.cpp deleted file mode 100644 index fd39b6a..0000000 --- a/Extensions/TemplatePlusPlus/Edittime.cpp +++ /dev/null @@ -1,297 +0,0 @@ -/* Edittime.cpp - * This file contains functions for the - * New Object dialog and the Frame Editor. - * For properties, see Properties.cpp. For - * custom parameters, see CustomParams.cpp. - * For text properties, see TextProps.cpp. - * Functions defined here: - * MakeIconEx - * UsesFile - * CreateFromFile - * CreateObject - * EditObject - * SetEditSize - * PutObject - * RemoveObject - * CloneObject - * GetObjectRect - * EditorDisplay - * IsTransparent - * PrepareToWriteObject - * GetFilters - */ - -#include "Common.h" - -/* CreateObject - * This is the first time you have - * access to the editdata, so it - * needs to be initialized with - * default values. Just be aware - * that if the user chooses to - * create your object from a file, - * CreateFromFile will be called - * instead of this function. - */ -int MMF2Func CreateObject(mv *mV, LO *lo, SerializedED *SED) -{ -#ifndef RUN_ONLY - if(IS_COMPATIBLE(mV)) //Make sure MMF2 hasn't changed in a way that makes your extension incompatible - { - Edif::Init(mV, SED); - - EditData().Serialize(mV, SED); //create & store the default editdata - - return 0; - } -#endif - return -1; -} - -/* MakeIconEx - * Lets you draw the icon dynamically - * by drawing into the Icon surface. The - * current example just uses the - * Icon.png from the resources. - */ -int MMF2Func MakeIconEx(mv *mV, cSurface *Icon, LPTSTR Name, OI *oi, SerializedED *SED) -{ -#ifndef RUN_ONLY - Icon->Delete(); - Icon->Clone(*SDK->Icon); - Icon->SetTransparentColor(RGB(255, 0, 255)); - return 0; -#endif - return -1; -} - -/* UsesFile - * When the user chooses "Create From - * File", MMF2 asks each extension if - * it supports being created from that - * file. Here you should investigate - * the file and see if your extension - * can be created from it in the - * CreateFromFile function below. You - * can simply check the file extension, - * for example. - */ -BOOL MMF2Func UsesFile(mv *mV, LPTSTR FileName) -{ -#ifndef RUN_ONLY - if(IS_COMPATIBLE(mV)) //check for compatibility, since you can't return an error from CreateFromFile - { -// char ext[_MAX_EXT]; -// _tsplitpath(FileName, 0, 0, 0, ext); -// if(stdtstring(".iherebydeclarethatthisfilecontainsmyintmystringandmyarray") == ext) -// { -// return TRUE; -// } - } -#endif - return FALSE; -} - -/* CreateFromFile - * If the user decides to create your object - * from the file you said you were OK with - * above, this is where you take that file - * and actually create your object from it. - * The CreateObject function up above will - * not have executed, so you need to initialize - * the editdata just as you would in CreateObject. - */ -void MMF2Func CreateFromFile(mv *mV, LPTSTR FileName, SerializedED *SED) -{ -#ifndef RUN_ONLY - Edif::Init(mV, SED); - - EditData ed; //default EditData -// std::ifstream in (FileName); -// EditData::MyArray_t::size_type MyArray_size; -// in >> ed.MyString >> ed.MyInt >> MyArray_size; -// ed.MyArray.clear(); -// for(EditData::MyArray_t::size_type i = 0; i < MyArray_size; ++i) -// { -// ed.MyArray.push_back(0); -// in >> ed.MyArray.back(); -// } - ed.Serialize(mV, SED); -#endif -} - -/* PutObject - * Each time a duplicate is made of your - * object, MMF2 calls this function to - * let you know. You still share the same - * editdata, the difference is the - * LevelObject pointer and the number of - * duplicates. - */ -void MMF2Func PutObject(mv *mV, LO *lo, SerializedED *SED, ushort NDup) -{ -#ifndef RUN_ONLY - if(NDup == 1) //is this the first object being created? - { - //You can put common code to both - //CreateObject and CreateFromFile - //as this function will execute - //after either one. - } -#endif -} - -/* RemoveObject - * Just the opposite of the above, when - * the user removes an instance of your - * object. This also functions as a - * DestroyObject function of sorts when - * NDup == 1. - */ -void MMF2Func RemoveObject(mv *mV, LO *lo, SerializedED *SED, ushort NDup) -{ -#ifndef RUN_ONLY - if(NDup == 1) //is this the last object being removed? - { - Edif::Free(SED); - // - } -#endif -} - -/* CloneObject - * When the user makes a clone of your object - * (not just another instance), MMF2 copies the - * contents of the editdata and then lets you - * know that the editdata in question is in - * new hands. Here you can 'fix' anything that - * might be caused by directly copying the - * editdata, though you should never have - * any problems like that in the first place. - */ -void MMF2Func CloneObject(mv *mV, OI *oi, SerializedED *SED) -{ -#ifndef RUN_ONLY - // -#endif -} - -/* EditObject - * If the user double-clicks your object icon - * or chooses the Edit option from a context - * menu, this function is called. This is useful - * as a que to bring up an animation editor for - * animations in your object. Return TRUE if - * changes were made to the editdata, and FALSE - * otherwise. - */ -BOOL MMF2Func EditObject (mv *mV, OI *oi, LO *lo, SerializedED *SED) -{ -#ifndef RUN_ONLY - // -#endif - return FALSE; -} - -/* SetEditSize - * If your object is resizeable, MMF2 calls this - * to let you know that the user has just requested - * a resize of the object. You can take the new - * size as is, or if it reminds you too much of - * 500 page essays you can limit the size to whatever - * you want. If you uncomment this function, make - * sure you also uncomment it in Ext.def. The - * presence of this function tells MMF2 that your - * object can be resized; otherwise it can't. - */ -/*BOOL MMF2Func SetEditSize(mv *mV, SerializedED *SED, int x, int y) -{ -#ifndef RUN_ONLY - EditData ed (SED); - ed.Width = x; - ed.Height = y; - ed.Serialize(mV, SED); - return TRUE; -#endif - return FALSE; -}*/ - -/* GetObjectRect - * MMF2 wants to know from time to time how much - * space your object is taking up on the frame - * editor. Currently this just gives the size of - * your Icon.png, but you can change it to parallel - * with the SetEditSize function above. - */ -void MMF2Func GetObjectRect(mv *mV, RECT *rect, LO *lo, SerializedED *SED) -{ -#ifndef RUN_ONLY - rect->right = rect->left + SDK->Icon->GetWidth(); - rect->bottom = rect->top + SDK->Icon->GetHeight(); -#endif -} - - -/* EditorDisplay - * This function does the work of drawing your - * object on the frame editor. In this example, - * the Icon.png file is simply drawn to the - * frame, but you can change this to draw - * anything you want. - */ -void MMF2Func EditorDisplay(mv *mV, OI *oi, LO *lo, SerializedED *SED, RECT *rect) -{ -#ifndef RUN_ONLY - cSurface *Surface = WinGetSurface(int(mV->mvIdEditWin)); //get access to the frame editor surface - if(!Surface) return; //failure - SDK->Icon->Blit(*Surface, rect->left, rect->top, BMODE_TRANSP, BOP_COPY, 0); //copy the icon onto the frame editor surface -#endif -} - - -/* IsTransparent - * MMF2 calls this to ask if the mouse pointer - * is over a transparent part of your object. - * Don't ask why this isn't called "IsOpaque", - * just accept that it isn't and move on. If the - * given coordinates are over an opaque part of - * your object, return TRUE, otherwise return - * FALSE. (Protip: MMF2 calls this function a - * LOT. Don't put a MessageBox function in here - * or any other kind of debug function.) - */ -extern "C" BOOL MMF2Func IsTransparent(mv *mV, LO *lo, SerializedED *SED, int x, int y) -{ -#ifndef RUN_ONLY - // -#endif - return FALSE; -} - -/* PrepareToWriteObject (DEPRECATED) - * Just before MMF2 writes the editdata to the MFA, - * it calls this function to let you clean up - * a temporary copy of the editdata. Because you - * intelligently designed your EditData::Serialize - * function to always save cleaned data anyway, - * this function is useless. - */ -void MMF2Func PrepareToWriteObject(mv *, SerializedED *, OI *){} - -/* GetFilters - * When the MFA filters are set to Automatic, MMF2 - * asks your extension if it uses filters or not. - * If you use any of either kind of filters, return - * TRUE for that kind. - */ -BOOL MMF2Func GetFilters(mv *mV, SerializedED *SED, DWORD Flags, void *) -{ -#ifndef RUN_ONLY - //If your extension uses image filters -// if((dwFlags & GETFILTERS_IMAGES) != 0) return TRUE; - - //If your extension uses sound filters -// if((dwFlags & GETFILTERS_SOUNDS) != 0) return TRUE; -#endif - return FALSE; -} diff --git a/Extensions/TemplatePlusPlus/Expressions.cpp b/Extensions/TemplatePlusPlus/Expressions.cpp deleted file mode 100644 index 65a6afa..0000000 --- a/Extensions/TemplatePlusPlus/Expressions.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/* Expressions.cpp - * This is where you should define the - * behavior of your expressions. Make sure - * the parameters and return types match those - * in the JSON exactly! Double check Extension.h - * as well. - */ - -#include "Common.h" - -int Extension::Add(int First, int Second) -{ - return First + Second; -} - -const TCHAR *Extension::HelloWorld() -{ - return _T("Hello world!"); - //return Runtime.CopyString(MyString.c_str()); //for stdtstrings -} diff --git a/Extensions/TemplatePlusPlus/Ext.def b/Extensions/TemplatePlusPlus/Ext.def deleted file mode 100644 index 7849232..0000000 --- a/Extensions/TemplatePlusPlus/Ext.def +++ /dev/null @@ -1,118 +0,0 @@ -; Ext.def -; This is how the linker knows -; which functions to export and -; what names and ordinals the -; exported functions should -; have. If you implemented a -; function that was commented -; out, remove the semicolon comment -; before it in this file. -; - -EXPORTS - GetInfos @2 - LoadObject @6 - UnloadObject @7 - PutObject @8 - RemoveObject @9 - MakeIconEx @11 - - CreateObject @14 - GetHelpFileName @16 - EditObject @18 - GetObjectRect @19 - EditorDisplay @20 - IsTransparent @21 - PrepareToWriteObject @22 - UpdateFileNames @23 -; EnumElts @24 - Initialize=InitExtension @25 - Free=FreeExtension @26 -; ExportTexts @27 -; ImportTexts @28 -; GetSubType @29 - UsesFile @30 - CreateFromFile @31 - DuplicateObject=CloneObject @32 - GetObjInfos @36 - - GetTextCaps @37 - GetTextAlignment @38 - SetTextAlignment @39 - GetTextFont @40 - SetTextFont @41 - GetTextClr @42 - SetTextClr @43 - - GetDependencies @44 - GetFilters @45 - -; conditionsTable @47 -; actionsTable @48 -; expressionsTable @49 - - CreateRunObject @50 - DestroyRunObject @51 - HandleRunObject @52 - DisplayRunObject @53 - PauseRunObject @57 - ContinueRunObject @58 - GetRunObjectInfos @59 - - GetConditionMenu @60 - GetActionMenu @61 - GetExpressionMenu @62 - GetConditionCodeFromMenu @63 - GetActionCodeFromMenu @64 - GetExpressionCodeFromMenu @65 - GetConditionString @66 - GetActionString @67 - GetExpressionString @68 - InitParameter @69 - EditParameter @70 - GetParameterString @71 - GetConditionTitle @72 - GetActionTitle @73 - GetExpressionTitle @74 - GetConditionInfos @75 - GetActionInfos @76 - GetExpressionInfos @77 - UpdateEditStructure @78 - GetRunObjectDataSize @80 -; SaveBackground @81 -; RestoreBackground @82 -; KillBackground @83 -; WindowProc @84 - StartApp @85 - EndApp @86 - StartFrame @87 - EndFrame @88 - GetExpressionParam @89 - -; GetRunObjectSurface @90 -; GetRunObjectCollisionMask @91 - -; GetRunObjectFont @92 -; SetRunObjectFont @93 -; GetRunObjectTextColor @94 -; SetRunObjectTextColor @95 - -; SetEditSize @99 - GetProperties @100 - ReleaseProperties @101 - GetPropValue @102 - SetPropValue @103 - IsPropEnabled @104 - GetPropCheck @105 - SetPropCheck @106 - GetPropCreateParam @107 - ReleasePropCreateParam @108 - EditProp @109 - GetDebugTree @110 - GetDebugItem @111 - EditDebugItem @112 - - SaveRunObject @113 - LoadRunObject @114 - - PrepareFlexBuild @115 diff --git a/Extensions/TemplatePlusPlus/Ext.json b/Extensions/TemplatePlusPlus/Ext.json deleted file mode 100644 index c323313..0000000 --- a/Extensions/TemplatePlusPlus/Ext.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "About": - { - "Name": "EDIF Template Object", - "Author": "Your Name", - "Copyright": "Copyright © 2013 Your Name", - "Comment": "A sentence or two to describe your extension,\nwith up to four lines of text.", - "URL": "http://www.example.com/", - "Help": "Help/My New EDIF Extension/Help.chm", - "Identifier": "X&pl" - }, - - "ActionMenu": - [ - "Separator", - [0, "Action Example"], - "Separator", - ["Sub Menu", - [1, "Second Action Example"] - ], - "Separator", - [0, "A Disabled Menu Item", true], - "Separator" - ], - "ConditionMenu": - [ - "Separator", - [0, "Are two numbers equal?"] - ], - "ExpressionMenu": - [ - "Separator", - [0, "Add two numbers"], - [1, "Hello world"], - "Separator" - ], - - "Actions": - [ - { "Title": "Action Example with parameter %0", - "Parameters": - [ - ["Integer", "Example Parameter"] - ] - }, - { "Title": "Second Action Example" - } - ], - "Conditions": - [ - { "Title": "%o: Are %0 and %1 equal?", - "Parameters": - [ - ["Integer", "First number"], - ["Integer", "Second number"] - ], - "Triggered": false - } - ], - "Expressions": - [ - { "Title": "Add(", - "Returns": "Integer", - "Parameters": - [ - ["Integer", "First number"], - ["Integer", "Second number"] - ] - }, - { "Title": "HelloWorld$(", - "Returns": "Text" - } - ] -} diff --git a/Extensions/TemplatePlusPlus/Ext.rc b/Extensions/TemplatePlusPlus/Ext.rc deleted file mode 100644 index 5d6f17e..0000000 --- a/Extensions/TemplatePlusPlus/Ext.rc +++ /dev/null @@ -1,156 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "..\..\Inc\ccx.h" -#define APSTUDIO_HIDDEN_SYMBOLS -#include "windows.h" -#undef APSTUDIO_HIDDEN_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -1 VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x0L -#ifdef _DEBUG - FILEFLAGS 0x21L -#else - FILEFLAGS 0x20L -#endif - FILEOS 0x10001L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "Clickteam" - VALUE "FileDescription", "Edif Object" - VALUE "FileVersion", "2.00" - VALUE "InternalName", "EdifExt" - VALUE "LegalCopyright", "Copyright © 2012 Clickteam" - VALUE "OriginalFilename", "EdifExt.mfx" - VALUE "ProductVersion", "1, 0, 0, 1" - VALUE "SpecialBuild", "00000001" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// RCDATA -// - -KPX_MAGICNUMBER RCDATA -BEGIN - 0x2516, 0x5908 -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""..\\..\\Inc\\ccx.h""\r\n" - "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""windows.h""\r\n" - "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - KPX_MARK "MF2" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.K.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// EDIF -// - -#if defined(APSTUDIO_INVOKED) || defined(EDITOR) -#if defined(APSTUDIO_INVOKED) -IDR_EDIF_ICON$(EDITOR) EDIF "Icon.png" -#else -IDR_EDIF_ICON EDIF "Icon.png" -#endif -#endif -IDR_EDIF_JSON EDIF "Ext.json" -#endif // English (U.K.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/Extensions/TemplatePlusPlus/Extension.cpp b/Extensions/TemplatePlusPlus/Extension.cpp deleted file mode 100644 index 8988773..0000000 --- a/Extensions/TemplatePlusPlus/Extension.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/* Extension.cpp - * This file contains the definitions for - * your extension's general runtime functions, - * such as the constructor and destructor, - * handling routines, etc. - * Functions defined here: - * Extension::Extension - * Extension::~Extension - * Extension::Handle - * Extension::Display - * Extension::Pause - * Extension::Continue - * Extension::Save - * Extension::Load - * Extension::Action <--| - * Extension::Condition <--|- not what you think! - * Extension::Expression <--| - */ - -#include "Common.h" - -/* - * This is your extension's constructor, which - * is the replacement for the old CreateRunObject - * function. You don't need to manually call - * constructors or pointlessly initialize - * pointers with dynamic memory. Just link - * your A/C/Es, perform initialization steps, and - * you're good to go. - */ -Extension::Extension(RD *rd, SerializedED *SED, createObjectInfo *COB) : rd(rd), rh(rd->rHo.hoAdRunHeader), Runtime(rd) -{ - //Link all your action/condition/expression functions - //to their IDs to match the IDs in the JSON here. - LinkAction(0, ActionExample); - LinkAction(1, SecondActionExample); - - LinkCondition(0, AreTwoNumbersEqual); - - LinkExpression(0, Add); - LinkExpression(1, HelloWorld); - - - //This is where you'd do anything you'd do in CreateRunObject in the original SDK. - //It's the only place you'll get access to the editdata at runtime, so you should - //transfer anything from the editdata to the extension class here. For example: -// EditData ed (SED); -// MyString = ed.MyString; -// MyInt = ed.MyInt; -// MyArray = ed.MyArray; - - // -} - -/* - * This is your extension's destructor, the - * replacement for DestroyRunObject. No calling - * destructors manually or deallocating pointless - * dynamic memory - in most cases this function - * won't need any code written. - */ -Extension::~Extension() -{ - // -} - -/* Handle - * MMF2 calls this function to let your extension - * "live" - if you want, you can have MMF2 call this - * every frame. This is where you'd, for instance, - * simulate physics or move an object. This is - * the analagous function to the old HandleRunObject. - */ -short Extension::Handle() -{ - /* - If your extension will draw to the MMF window you should first - check if anything about its display has changed : - - if (rd->roc.rcChanged) return REFLAG_DISPLAY; - else return 0; - - You will also need to make sure you change this flag yourself - to 1 whenever you want to redraw your object - - If your extension won't draw to the window, but it still needs - to do something every MMF2 loop use: - - return 0; - - If you don't need to do something every loop, use : - - return REFLAG_ONESHOT; - - This doesn't mean this function can never run again. If you want MMF2 - to handle your object again (causing this code to run) use this function: - - Runtime.Rehandle(); - - At the end of the event loop this code will run. - - */ - - //Will not be called next loop - return REFLAG_ONESHOT; -} - -/* Display - * This is the analagous function to - * DisplayRunObject. If you return - * REFLAG_DISPLAY in Handle() this - * routine will run. If you want MMF2 - * to apply ink effects for you, then - * implement GetRunObjectSurface in - * Runtime.cpp instead. - */ -short Extension::Display() -{ - return 0; -} - -/* Pause - * If your extension plays sound, for - * example, then MMF2 calls this to - * let you know to pause the music, - * usually by another extension's request - * or by the player pausing the applcation. - */ -short Extension::Pause() -{ - return 0; -} - -/* Continue - * Opposite to the above, MMF2 lets - * you know that the silence is over; - * your extension may live again. - */ -short Extension::Continue() -{ - return 0; -} - -/* Save - * When the user uses the Save - * Frame Position action, you need - * so serialize your runtime data to - * the File given. It is a Windows - * file handle, but you can use some - * of MMF2's built-in functions for - * writing files. Check the MMF2SDK - * Help file for more information. - */ -bool Extension::Save(HANDLE File) -{ - return true; -} - -/* Load - * As opposed to above, here you need to - * restore your extension's runtime state - * from the given file. Only read what you - * wrote! - */ -bool Extension::Load(HANDLE File) -{ - return true; -} - - -/* Action, Condition, Expression - * These are called if there's no function linked - * to an ID. You may want to put MessageBox calls - * to let you know that the ID is unlinked, or you - * may just want to use unlinked A/C/Es as a feature. - */ -void Extension::Action(int ID, RD *rd, long param1, long param2) -{ -} - -long Extension::Condition(int ID, RD *rd, long param1, long param2) -{ - return false; //hopefully StringComparison (PARAM_CMPSTRING) is not used, or this may crash -} - -long Extension::Expression(int ID, RD *rd, long param) -{ - return long(_T("")); //so that unlinked expressions that return strings won't crash -} - diff --git a/Extensions/TemplatePlusPlus/Extension.hpp b/Extensions/TemplatePlusPlus/Extension.hpp deleted file mode 100644 index ea46464..0000000 --- a/Extensions/TemplatePlusPlus/Extension.hpp +++ /dev/null @@ -1,133 +0,0 @@ -/* Extension.h - * This is where you define your extension - * class. Runtime variables and function - * declarations go in here; A/C/E function - * definitions go in their respective .cpp - * files, other function definitions go in - * Extension.cpp. This header is included - * at the bottom of Common.h, so you have - * access to everything included by it. - */ - -class Extension -{ -public: - /* rd - * This is a pointer to the classic - * RunData structure. Some things still - * have to be stored there for MMF2's - * sake, so you need to have acces to - * that data. You should not modify - * the rundata structure, however, - * as it is global to all extensions. - */ - RD *rd; - - /* rh - * This is a pointer to the RunHeader - * structure, which contains some - * application information. - */ - RunHeader *rh; - - /* Runtime - * This is EDIF's compendium of useful - * functions for every day life as an - * extension. You can trigger immediate - * events, read and write global data, - * etc. See the EDIF wiki for more - * information. - */ - Edif::Runtime Runtime; - - /* MinimumBuild - * Always set this to the latest build - * of MMF2 that has been released, unless - * you need to set it higher for a beta - * version of MMF2 to get access to some - * new SDK feature. - */ - static const int MinimumBuild = 257; - - /* Version - * This is the version of your extension - * that is stored in the editdata. You should - * only change this when your editdata structure - * changes, not just when you have a new version - * of your extension with new features. - */ - static const int Version = 1; - - /* OEFLAGS, OEPREFS - * These are settings for your extension - * that tell MMF2 how to treat your extension - * and what behaviors and responsibilities - * to add. Check the MMF2SDK Help file for - * more detailed information on the flags you - * can set and what they implicate. - */ - static const int OEFLAGS = OEFLAG_VALUES|OEFLAG_RUNBEFOREFADEIN|OEFLAG_NEVERKILL; - static const int OEPREFS = 0; - - /* WindowProcPriority - * If your extension creates a Window - * and implements the WindowProc function, - * this is the priority for that stuff. - */ - static const int WindowProcPriority = 100; - - Extension(RD *rd, SerializedED *SED, createObjectInfo *COB); //defined & documented in Extension.cpp - ~Extension(); //defined & documented in Extension.cpp - - - /* Add any data you want to store in your - * extension to this class (eg. what you'd - * normally store in the rundata). Unlike - * other SDKs, you can store real C++ - * objects with constructors and destructors, - * without having to call them manually or - * store a pointer. - */ - - //stdtstring MyString; - //int MyInt; - //std::vector MyArray; - - - /* Add your actions, conditions, and expressions - * as real class member functions here. The arguments - * (and return types for expressions/conditions) - * must match EXACTLY what you defined in the JSON. - * As a handy tip, all parameters will be either - * a pointer, an int, or a float (each only 4 bytes) - * and the same applies to return types. Remember to - * link the actions, conditions and expressions to their - * numeric IDs in the class constructor in Extension.cpp. - */ - - //Actions - Defined in Actions.cpp - void ActionExample(int ExampleParameter); - void SecondActionExample(); - - //Conditions - Defined in Conditions.cpp - bool AreTwoNumbersEqual(int FirstNumber, int SecondNumber); - - //Expressions - Defined in Expressions.cpp - int Add(int FirstNumber, int SecondNumber); - const TCHAR * HelloWorld(); - - - short Handle(); //defined & documented in Extension.cpp - short Display(); //defined & documented in Extension.cpp - - short Pause(); //defined & documented in Extension.cpp - short Continue(); //defined & documented in Extension.cpp - - bool Save(HANDLE File); //defined & documented in Extension.cpp - bool Load(HANDLE File); //defined & documented in Extension.cpp - - //defined & documented in Extension.cpp - void Action(int ID, RD *rd, long param1, long param2); - long Condition(int ID, RD *rd, long param1, long param2); - long Expression(int ID, RD *rd, long param); -}; diff --git a/Extensions/TemplatePlusPlus/General.cpp b/Extensions/TemplatePlusPlus/General.cpp deleted file mode 100644 index 23e405e..0000000 --- a/Extensions/TemplatePlusPlus/General.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* General.cpp - * Contains functions common to both edittime and runtime. - * Functions defined here: - * DllMain - * InitExtension - * FreeExtension - * LoadObject - * UnloadObject - * UpdateEditStrucrure - * UpdateFileNames - * EnumElts - */ - -#include "Common.h" - -/* hInstLib - * This is the HINSTANCE for your extension's DLL. - * It is set by DllMain and used later for anything - * that requires it, such as some Windows API - * functions and some internal EDIF code. You - * shouldn't change its value, ever. - */ -HINSTANCE hInstLib; - -/* DllMain - * This is a required function for Windows DLLs. You - * should not need to edit this function - if you do, - * refer to MSDN for information. - */ -BOOL WINAPI DllMain(HINSTANCE DLL, DWORD Reason, LPVOID) -{ - switch (Reason) - { - case DLL_PROCESS_ATTACH: //DLL is attaching to the address space of the current process. - { - hInstLib = DLL; //Store HINSTANCE - break; - } - case DLL_THREAD_ATTACH: //A new thread is being created in the current process. - { - // - break; - } - case DLL_THREAD_DETACH: //A thread is exiting cleanly. - { - // - break; - } - case DLL_PROCESS_DETACH: //The calling process is detaching the DLL from its address space. - { - // - break; - } - } - return TRUE; -} - - - -/* InitExtension - * MMF2 calls this before anything else when it loads your - * extension. This includes during the splash screen, in which - * case "Quiet" is true. This is where you should initialize - * global information for either edittime or runtime. Be aware, - * though, that at edittime, multiple open MFAs with your - * extension will share the same global information. You can - * use mV->mvEditApp to tell apart different MFAs from each - * other. If an error occurs during this function, return - * -1 and MMF2 will not load your extension. - */ -int MMF2Func InitExtension(mv *mV, int Quiet) -{ - return Edif::Init(mV); -} - -/* FreeExtension - * Called just before MMF2 unloads your extension. You - * should release any memory you allocated above in - * the InitializeExtension function. You should always - * return a value of 0. - */ -int MMF2Func FreeExtension(mv *mV) -{ - // - Edif::Free(mV); - return 0; -} - - -/* LoadObject - * This is called at both edittime and runtime when MMF2 - * loads each unique instance of your object. (Each one - * with a different name, not each instance of the same - * one). Not much needs to be done here. - */ -int MMF2Func LoadObject(mv *mV, LPCSTR FileName, SerializedED *SED, int) -{ - Edif::Init(mV, SED); - return 0; -} - -/* UnloadObject - * new is to delete as LoadObject is to this functon. - * If you initialized stuff above, deinitialize it here. - */ -void MMF2Func UnloadObject(mv *mV, SerializedED *SED, int) -{ - // -} - -/* UpdateEditStructure (DEPRECATED) - * This is called when MMF2 notices that your - * extension has a newer version number than - * the one in the header of the SerializedED. - * Thankfully, however, we don't need this - * function at all - the EditData class is - * as smart as you programmed it to be and - * it changes the size dynamically rather - * than statically. So, you can safely - * ignore this function all together. - * (It would be a pain to write anyway - - * see the MMF2SDK help for an example) - */ -HGLOBAL MMF2Func UpdateEditStructure(mv *mV, SerializedED *OldSED) -{ - return 0; -} - -/* UpdateFileNames - * When the application is moved to a new directory, - * MMF2 asks your extension to ensure that its file - * paths are moving with it. Just call Update for - * each file path - you will need to create buffers - * of size MAX_PATH if you use C++ strings for - * the paths. - */ -void MMF2Func UpdateFileNames(mv *mV, LPSTR appName, SerializedED *SED, void (WINAPI *Update)(LPSTR, LPSTR)) -{ - // -} - -/* EnumElts - * That whacky function that MMF2 uses to enumerate all the - * animation frames associated with your object, because MMF2 - * is nice enough to deal with them for you so you can't-er, - * don't have to. Refer to the MMF2SDK Help file for - * information on how not to misuse this function. - * You must also uncomment the entry in the Ext.def - * file if you uncomment this function. - */ -/*int MMF2Func EnumElts (mv *mV, SerializedED *SED, ENUMELTPROC enumProc, ENUMELTPROC undoProc, LPARAM lp1, LPARAM lp2) -{ - int error = 0; - - //Replace wImgIdx with the name of the WORD variable you create within the edit structure - - //Enum images - if((error = enumProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2)) != 0) - { - //Undo enum images - undoProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2); - } - - return error; -}*/ diff --git a/Extensions/TemplatePlusPlus/Icon.png b/Extensions/TemplatePlusPlus/Icon.png deleted file mode 100644 index cc945e99d44d5cc99d69c46c7ced70e21878c3a1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4524 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 - * The property identitifers. - */ - enum - { - zNOT_USED = PROPID_EXTITEM_CUSTOM_FIRST, - Version, - //MyString, - //MyInt, - }; -} - -PropData Properties[] = //See the MMF2SDK help file for information on PropData_ macros. -{ - PropData_StaticString(Prop::Version, (UINT_PTR)"Version #", (UINT_PTR)"This is the current version of the EDIF Template object."), - //PropData_EditMultiLine(Prop::MyString, (UINT_PTR)"My String", (UINT_PTR)"The contents of my string."), - //PropData_EditNumber(Prop::MyInt, (UINT_PTR)"My Integer", (UINT_PTR)"The value of my integer."), - PropData_End() -}; - -#endif - -/* GetProperties - * Here, you choose what proeprties to insert - * into which tabs. Lots of dynamic things can - * be done in here, such as dynamically - * generating the properties based on the - * number of stored values in the editdata. - */ -BOOL MMF2Func GetProperties(mv *mV, SerializedED *SED, BOOL MasterItem) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - //ed.stuff; - mvInsertProps(mV, SED, Properties, PROPID_TAB_GENERAL, TRUE); - //if you changed ed: - //ed.Serialize(mV, SED); - return TRUE; -#endif - return FALSE; -} - -/* ReleaseProperties - * If you dynamically allocated memory for - * property arrays in GetProperties, release - * that memory in this function. - */ -void MMF2Func ReleaseProperties(mv *mV, SerializedED *SED, BOOL MasterItem) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - //ed.stuff; - // - //if you changed ed: - //ed.Serialize(mV, SED); -#endif -} - -/* GetPropCreateParam - * A convenience function if you use the - * hard-coded Properties array above. Allows - * you to dynamically create e.g. combo - * lists and other things that have - * additional parameters for their - * properties. However if you dynamically - * allocated everything in GetProperties, - * this function is useless. - */ -LPARAM MMF2Func GetPropCreateParam(mv *mV, SerializedED *SED, UINT PropID) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - //ed.stuff; - //return (LPARAM)TheParameter; - //if you changed ed: - //ed.Serialize(mV, SED); -#endif - return 0; -} - -/* ReleasePropCreateParam - * If you found a useful way to use the - * above function and you dynamically - * allocated memory, release it here. - */ -void MMF2Func ReleasePropCreateParam(mv *mV, SerializedED *SED, UINT PropID, LPARAM lParam) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - //ed.stuff; - //MyAwesomeMemoryFreeingFunction(lParam); - //if you changed ed: - //ed.Serialize(mV, SED); -#endif -} - -/* GetPropValue - * This is where you return the display - * values for the properties you defined. - * Refer to the MMF2SDK Help file for - * information on what to return for - * each kind of property. - */ -void *MMF2Func GetPropValue(mv *mV, SerializedED *SED, UINT PropID) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - switch(PropID) - { - case Prop::Version: - { - return new CPropDataValue("Default.EDIF.Template.0"); - } - //case Prop::MyString: - // { - // return new CPropDataValue(ed.MyString.c_str()); - // } - //case Prop::MyInt: - // { - // return new CPropDWordValue(ed.MyInt); - // } - } - //if you changed ed: - //ed.Serialize(mV, SED); -#endif - return NULL; -} - -/* SetPropValue - * The user has just finished entering their - * 500 page essay into your MyString field. - * MMF2 isn't so kind as to save that for them, - * so it entrusts it with you. Store it! - */ -void MMF2Func SetPropValue(mv *mV, SerializedED *SED, UINT PropID, CPropValue *PropVal) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - //switch(PropID) - //{ - //case Prop::MyString: - // { - // ed.MyString = (LPSTR)((CPropDataValue*)PropVal)->m_pData; - // break; - // } - //case Prop::MyInt: - // { - // ed.MyInt = (CPropDWordValue*)PropVal)->m_dwValue; - // break; - // } - //} - //since you changed ed: - //ed.Serialize(mV, SED); - - //You may want to have your object redrawn in the - //frame editor after the modifications; in this - //case, just call this function: - //mvInvalidateObject(mV, SED); -#endif -} - -/* GetPropCheck - * There are checkbox properties, and - * there are properties that have their - * own checkbox as an option. This is - * where you tell MMF2 whether those - * boxes are ticked or not. - */ -BOOL MMF2Func GetPropCheck(mv *mV, SerializedED *SED, UINT PropID) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - //switch(PropID) - //{ - //case Prop::MyCheckBoxPropertyOrPropertyThatHasTheCheckboxOptionSet: - // { - // return ed.WhetherOrNotThatPropertyOfMineIsTicked ? TRUE : FALSE; - // } - //} - //if you changed ed: - //ed.Serialize(mV, SED); -#endif - return FALSE; -} - -/* SetPropCheck - * The user has painstakingly moved the - * mouse cursor over the checkbox and - * expended the immense effort required - * to click the mouse and toggle the - * state of the tickbox. Don't let their - * effort be all for naught! - */ -void MMF2Func SetPropCheck(mv *mV, SerializedED *SED, UINT PropID, BOOL Ticked) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - //switch(PropID) - //{ - //case Prop::MyCheckBoxPropertyOrPropertyThatHasTheCheckboxOptionSet: - // { - // ed.WhetherOrNotThatPropertyOfMineIsTicked = Ticked != FALSE ? true : false; - // } - //} - //since you changed ed: - //ed.Serialize(mV, SED); -#endif -} - -/* EditProp - * If you use a button proeprty or a - * property that has a button, then - * you would be impolite to ignore - * the user when they click on that - * button. Here is where you respond - * to that button press e.g. with - * a dialog. - */ -BOOL MMF2Func EditProp(mv *mV, SerializedED *SED, UINT PropID) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - //switch(PropID) - //{ - //case Prop::MyButtonPropertyOrPropertyThatHasAButtonWithIt: - // { - // // - // break; - // } - //} - //if you changed ed: - //ed.Serialize(mV, SED); -#endif - return FALSE; -} - -/* IsPropEnabled - * Let's say you're tired of having to deal - * with the user's various 500 page essays, - * tickbox toggles, and button clicks. Here, - * you can simply disable a property by - * returning FALSE for that property. - */ -BOOL MMF2Func IsPropEnabled(mv *mV, SerializedED *SED, UINT PropID) -{ -#ifndef RUN_ONLY - //EditData ed (SED); - switch(PropID) - { - case Prop::Version: - { - return FALSE; //Makes the version proeprty greyed out - } - //case Prop::MyString: //intentional\\ - //case Prop::MyInt: //fallthrough\\ - // { - // return TRUE; //allows the user to interact with these proeprties - // } - } - //if you changed ed: - //ed.Serialize(mV, SED); -#endif - return FALSE; -} diff --git a/Extensions/TemplatePlusPlus/Runtime.cpp b/Extensions/TemplatePlusPlus/Runtime.cpp deleted file mode 100644 index f060dda..0000000 --- a/Extensions/TemplatePlusPlus/Runtime.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/* Runtime.cpp - * This file contains general runtime functions - * that aren't part of the Extension class. - * Functions defined here: - * GetRunObjectSurface - * GetRunObjectCollisionMask - * StartApp - * EndApp - * StartFrame - * EndFrame - * WindowProc - */ - -#include "Common.h" - -/* GetRunObjectSurface - * Implement this function instead of - * Extension::Display if your extension - * supports ink effects and transitions. - * You can support ink effects in - * DisplayRunObject too, but this is - * done automatically if you implement - * GetRunObjectSurface (MMF2 applies the - * ink effects to the surface). Don't - * forget to enable the function in the - * .def file if you uncomment & implement - * this function. - */ -/*cSurface* MMF2Func GetRunObjectSurface(RD *rd) -{ - return NULL; -}*/ - -/* GetRunObjectCollisionMask - * Implement this function if your extension - * supports fine collision detection - * (OEPREFS_FINECOLLISIONS), rr if it's a - * background object and you want Obstacle - * properties for this object. You should - * return NULL if the object is not transparent. - * Don't forget to enable the function in the - * .def file if you uncomment & implement this - * function. - */ -/*LPSMASK MMF2Func GetRunObjectCollisionMask(RD *rd, LPARAM lParam) -{ - // Typical example for active objects - // ---------------------------------- - // Opaque? collide with box - if ( (rdPtr->rs.rsEffect & EFFECTFLAG_TRANSPARENT) == 0 ) // Note: only if your object has the OEPREFS_INKEFFECTS option - return NULL; - - // Transparent? Create mask - LPSMASK pMask = rdPtr->m_pColMask; - if ( pMask == NULL ) - { - if ( rdPtr->m_pSurface != NULL ) - { - DWORD dwMaskSize = rdPtr->m_pSurface->CreateMask(NULL, lParam); - if ( dwMaskSize != 0 ) - { - pMask = (LPSMASK)calloc(dwMaskSize, 1); - if ( pMask != NULL ) - { - rdPtr->m_pSurface->CreateMask(pMask, lParam); - rdPtr->m_pColMask = pMask; - } - } - } - } - - //Note: for active objects, lParam is always the same. - //For background objects (OEFLAG_BACKGROUND), lParam maybe be different if the user uses your object - //as obstacle and as platform. In this case, you should store 2 collision masks - //in your data: one if lParam is 0 and another one if lParam is different from 0. - - return pMask; -}*/ - -/* StartApp - * Called when the application initially - * starts or when it restarts (EndApp will - * NOT be called beforehand in the case - * of a restart). This is useful if you - * need to store global data across - * frames. - */ -void MMF2Func StartApp(mv *mV, CRunApp *App) -{ -// delete (MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data"); -// Edif::Runtime::WriteGlobal(mV, App, "My Global Data", new MyGlobalData()); -} - -/* EndApp - * Called when the application is ending - * and about to close. This is NOT called - * in the event of a Restart Application - * action. You can release any memory you - * aqquired above in StartApp. - */ -void MMF2Func EndApp(mv *mV, CRunApp *App) -{ -// delete (MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data"); -// Edif::Runtime:WriteGlobal(mV, App, "My Global Data", 0); //clear dangling pointer -} - -/* StartFrame - * Called at the start of a frame. If you - * store global data above, you should make - * a copy of it so that it may be restored - * when the frame restarts. This function is - * also called when the frame restarts. - * EndFrame is NOT called when the frame - * restarts. - */ -void MMF2Func StartFrame(mv *mV, CRunApp *App, int FrameIndex) -{ -// if(!Edif::Runtime::ReadGlobal(mV, App, "My Global Data Backup")) //first time on this frame -// { -// Edif::Runtime::WriteGlobal(mV, App, "My Global Data Backup", -// new MyGlobalData(*(MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data"))); //copy -// } -// else //frame restarting, restore initial global data -// { -// delete (MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data"); -// Edif::Runtime::WriteGlobal(mV, App, "My Global Data", -// new MyGlobalData(*(MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data Backup"))); //copy -// } -} - -/* EndFrame - * Called when the frame ends. MMF2 - * does NOT call this function in the - * event of a "Restart Frame" action. - */ -void MMF2Func EndFrame(mv *mV, CRunApp *App, int FrameIndex) -{ -// delete (MyGlobalData *)Edif::Runtime::ReadGlobal(mV, App, "My Global Data Backup"); -// Edif::Runtime:WriteGlobal(mV, App, "My Global Data Backup", 0); //clear dangling pointer -} - - -// ============================================================================ -// -// WINDOWPROC (interception of messages sent to hMainWin and hEditWin) -// -// Do not forget to enable the WindowProc function in the .def file if you implement it -// -// ============================================================================ -/* -// Get the pointer to the object's data from its window handle -// Note: the object's window must have been subclassed with a -// callRunTimeFunction(rdPtr, RFUNCTION_SUBCLASSWINDOW, 0, 0); -// See the documentation and the Simple Control example for more info. -// -LPRDATA GetRdPtr(HWND hwnd, LPRH rhPtr) -{ - return (LPRDATA)GetProp(hwnd, (LPCSTR)rhPtr->rh4.rh4AtomRd); -} - -// Called from the window proc of hMainWin and hEditWin. -// You can intercept the messages and/or tell the main proc to ignore them. -// -LRESULT CALLBACK DLLExport WindowProc(LPRH rhPtr, HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) -{ - LPRDATA rdPtr = NULL; - - switch (nMsg) { - - // Example - case WM_CTLCOLORSTATIC: - { - // Get the handle of the control - HWND hWndControl = (HWND)lParam; - - // Get a pointer to the RUNDATA structure (see GetRdptr function above for more info) - rdPtr = GetRdPtr(hWndControl, rhPtr); - - // Check if the rdPtr pointer is valid and points to an object created with this extension - if ( rdPtr == NULL || rdPtr->rHo.hoIdentifier != IDENTIFIER ) - break; - - // OK, intercept the message - HDC hDC = (HDC)wParam; - SetBkColor(hDC, rdPtr->backColor); - SetTextColor(hDC, rdPtr->fontColor); - rhPtr->rh4.rh4KpxReturn = (long)rdPtr->hBackBrush; - return REFLAG_MSGRETURNVALUE; - } - break; - } - - return 0; -} -*/ diff --git a/Extensions/TemplatePlusPlus/Template.sln b/Extensions/TemplatePlusPlus/Template.sln deleted file mode 100644 index 9c29735..0000000 --- a/Extensions/TemplatePlusPlus/Template.sln +++ /dev/null @@ -1,41 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template", "Template.vcproj", "{3BCB4C73-71F6-43B6-803D-41411F92652A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug HWA|Win32 = Debug HWA|Win32 - Debug Unicode|Win32 = Debug Unicode|Win32 - Debug|Win32 = Debug|Win32 - Edittime HWA|Win32 = Edittime HWA|Win32 - Edittime Unicode|Win32 = Edittime Unicode|Win32 - Edittime|Win32 = Edittime|Win32 - Runtime HWA|Win32 = Runtime HWA|Win32 - Runtime Unicode|Win32 = Runtime Unicode|Win32 - Runtime|Win32 = Runtime|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Win32.ActiveCfg = Debug HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Win32.Build.0 = Debug HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Win32.ActiveCfg = Debug|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Win32.Build.0 = Debug|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Win32.ActiveCfg = Edittime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Win32.Build.0 = Edittime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Win32.ActiveCfg = Edittime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Win32.Build.0 = Edittime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Win32.ActiveCfg = Edittime|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Win32.Build.0 = Edittime|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Win32.ActiveCfg = Runtime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Win32.Build.0 = Runtime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Win32.ActiveCfg = Runtime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Win32.Build.0 = Runtime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Win32.ActiveCfg = Runtime|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Win32.Build.0 = Runtime|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Extensions/TemplatePlusPlus/Template.vcproj b/Extensions/TemplatePlusPlus/Template.vcproj deleted file mode 100644 index f96a3ad..0000000 --- a/Extensions/TemplatePlusPlus/Template.vcproj +++ /dev/null @@ -1,1610 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Extensions/TemplatePlusPlus/Text.cpp b/Extensions/TemplatePlusPlus/Text.cpp deleted file mode 100644 index a224b17..0000000 --- a/Extensions/TemplatePlusPlus/Text.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* Text.cpp - * If you define the OEFLAG_TEXT flag, - * then this file is for you. Here you - * will deal with text at runtime similarly - * to how you dealt with it at edittime. - * By default all functions are commented - * out, if you implement them (and you - * should implement them in an all-or- - * nothing fashion), then you need to - * uncomment them in Ext.def as well. - * Functions defined here: - * GetRunObjectFont - * SetRunObjectFont - * GetRunObjectTextColor - * SetRunObjectTextColor - */ - -#include "Common.h" - -/* GetRunObjectFont - * Copy the current font into the Lf parameter. - */ -/*void MMF2Func GetRunObjectFont(RD *rd, LOGFONT *Lf) -{ - //GetObject(rd->pExtension->MyHFont, sizeof(LOGFONT), Lf); -}*/ - -/* SetRunObjectFont - * Store the font set by the user. Some - * action needs to be taken when rect is - * not null - read the MMF2SDK Help file - * for more information. - */ -/*void MMF2Func SetRunObjectFont(RD *rd, LOGFONT *Lf, RECT *rect) -{ -// Extension &ext = *(rd->pExtension); -// HFONT HFont = CreateFontIndirect(Lf); -// if(hFont != NULL) -// { -// if(ext.MyHFont != 0) DeleteObject(ext.MyHFont); -// ext.MyHFont = HFont; -// SendMessage(ext.MyHWindow, WM_SETFONT, WPARAM(ext.MyHFont), FALSE); -// } -}*/ - -/* GetRunObjectTextColor - * Plain and simple, return the color - * of the text. - */ -/*COLORREF MMF2Func GetRunObjectTextColor(RD *rd) -{ - return 0; -}*/ - -/* SetRunObjectTextColor - * Store the new color of the text - * and force and update on your window. - */ -/*void MMF2Func SetRunObjectTextColor(RD *rd, COLORREF color) -{ -// rd->pExtension->MyTextColor = color; -// InvalidateRect(rd->pExtension->MyHWindow, NULL, TRUE); -}*/ diff --git a/Extensions/TemplatePlusPlus/TextProps.cpp b/Extensions/TemplatePlusPlus/TextProps.cpp deleted file mode 100644 index d8ef389..0000000 --- a/Extensions/TemplatePlusPlus/TextProps.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* TextProps.cpp - * If you plan on allowing MMF2 to manage - * your extension's text display properties - * for you, this is the file to look into. - * Functions defined here: - * GetTextCaps - * GetTextFont - * SetTextFont - * GetTextClr - * SetTextClr - * GetTextAlignment - * SetTextAlignment - */ - -#include "Common.h" - -/* GetTextCaps - * Return the text capabilities - * of your extension at edittime. - */ -DWORD MMF2Func GetTextCaps(mv *mV, SerializedED *SED) -{ -#ifndef RUN_ONLY -// return TEXT_ALIGN_LEFT|TEXT_ALIGN_HCENTER|TEXT_ALIGN_RIGHT -// |TEXT_ALIGN_TOP|TEXT_ALIGN_VCENTER|TEXT_ALIGN_BOTTOM -// |TEXT_FONT|TEXT_COLOR; -#endif - return 0; -} - -/* GetTextFont - * Return the font used by your extension. - */ -BOOL MMF2Func GetTextFont(mv *mV, SerializedED *SED, LOGFONT *lf, LPTSTR, UINT) -{ -#ifndef RUN_ONLY - // - return TRUE; -#endif - return FALSE; -} - -/* SetTextFont - * Changes the font used by your extension. - */ -BOOL MMF2Func SetTextFont(mv *mV, SerializedED *SED, LOGFONT *lf, LPCSTR) -{ -#ifndef RUN_ONLY - // - return TRUE; -#endif - return FALSE; -} - -/* GetTextClr - * Return the RGB color value of the text color. - */ -COLORREF MMF2Func GetTextClr(mv *mV, SerializedED *SED) -{ -#ifndef RUN_ONLY - // - return 200<<8; //green -#endif - return 0; -} - -/* SetTextClr - * Sets the color of the text. - */ -void MMF2Func SetTextClr(mv *mV, SerializedED *SED, COLORREF Color) -{ -#ifndef RUN_ONLY - // -#endif -} - -/* GetTextAlignment - * Return the alignment of the text. - */ -DWORD MMF2Func GetTextAlignment(mv *mV, SerializedED *SED) -{ -#ifndef RUN_ONLY -// DWORD dw = 0; - -// if((ed.Flags & ALIGN_LEFT) != 0) dw |= TEXT_ALIGN_LEFT; -// if((ed.Flags & ALIGN_HCENTER) != 0) dw |= TEXT_ALIGN_HCENTER; -// if((ed.Flags & ALIGN_RIGHT) != 0) dw |= TEXT_ALIGN_RIGHT; - -// if((ed.Flags & ALIGN_TOP) != 0) dw |= TEXT_ALIGN_TOP; -// if((ed.Flags & ALIGN_VCENTER) != 0) dw |= TEXT_ALIGN_VCENTER; -// if((ed.Flags & ALIGN_BOTTOM) != 0) dw |= TEXT_ALIGN_BOTTOM; - -// return dw; -#endif - return 0; -} - -/* SetTextAlignment - * Sets the alignment of the text. - */ -void MMF2Func SetTextAlignment(mv *mV, SerializedED *SED, DWORD AlignFlags) -{ -#ifndef RUN_ONLY -// DWORD dw = ed.Flags; - -// if((AlignFlags & TEXT_ALIGN_LEFT) != 0) dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_LEFT; -// if((AlignFlags & TEXT_ALIGN_HCENTER)!= 0) dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_HCENTER; -// if((AlignFlags & TEXT_ALIGN_RIGHT) != 0) dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_RIGHT; - -// if((AlignFlags & TEXT_ALIGN_TOP) != 0) dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_TOP; -// if((AlignFlags & TEXT_ALIGN_VCENTER)!= 0) dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_VCENTER; -// if((AlignFlags & TEXT_ALIGN_BOTTOM) != 0) dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_BOTTOM; - -// edFlags = dw; -#endif -} diff --git a/Extensions/TemplatePlusPlus/resource.h b/Extensions/TemplatePlusPlus/resource.h deleted file mode 100644 index ca96268..0000000 --- a/Extensions/TemplatePlusPlus/resource.h +++ /dev/null @@ -1,18 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Ext.rc -// -#define IDR_EDIF_ICON 101 -#define IDR_EDIF_JSON 102 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif From e1b9189d6b173274515dc74508eb974e65aec2b5 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 15 Mar 2014 22:47:58 -0500 Subject: [PATCH 083/127] Update readmes --- Extensions/README.md | 4 +--- README.md | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Extensions/README.md b/Extensions/README.md index 044fa2f..3af904a 100644 --- a/Extensions/README.md +++ b/Extensions/README.md @@ -5,6 +5,4 @@ This folder is where your extensions will stay. There are three template project **Template** is the classic EDIF template project with a similar layout to rSDK (besides the A/C/Es of course). -**TemplatePlus** is a slighly higher-level project with better organization and some more abstraction for tedious tasks such as the Edit Data. Most functions still resemble those of rSDK. - -**TemplatePlusPlus** is a very high-level project with abstraction and classes everywhere - there is almost no resemblence to the rSDK template project. +**TemplatePlus** is a slightly higher-level project with better organization and some more abstraction for tedious tasks such as the Edit Data. Most functions still resemble those of rSDK. diff --git a/README.md b/README.md index 56c09d8..aa04ede 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Extension Development Is Fun -Edif is an alternate extension development SDK for Multimedia Fusion 2, in which your extension is a true C++ class, with a JSON file (optionally external) to describe it. We recommend that you [check out the wiki](./windows-edif/wiki/). If you're new to EDIF, read the [Getting started](./windows-edif/wiki/Getting-started) page. There are also some [Tutorials](./windows-edif/wiki/Tutorials). +Edif is an alternate extension development SDK for Multimedia Fusion 2 and Fusion 2.5, in which your extension is a true C++ class, with a JSON file (optionally external) to describe it. We recommend that you [check out the wiki](./windows-edif/wiki/). If you're new to EDIF, read the [Getting started](./windows-edif/wiki/Getting-started) page. There are also some [Tutorials](./windows-edif/wiki/Tutorials). From 4fb250743d52aeaa2eb4b7c25f30ee19ce9e0860 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 15 Mar 2014 22:48:48 -0500 Subject: [PATCH 084/127] Update Fusion headers with F2.5 SDK --- Inc/Ccxhdr.h | 14 +- Inc/CfcFile.h | 16 +- Inc/Cncf.h | 942 ++++++++++++++++++++++++++++-------------------- Inc/Cncy.h | 136 +++++-- Inc/Cnpdll.h | 222 ++++++++---- Inc/FilterMgr.h | 2 - Inc/ImageFlt.h | 2 +- Inc/ImgFlt.h | 40 +- Inc/Mvt.h | 11 +- Inc/Props.h | 660 ++++++++++++++++++++++++++------- Inc/Surface.h | 67 +--- Inc/WinMacro.h | 2 +- Inc/cncr.h | 57 +-- Lib/mmfs2.lib | Bin 229544 -> 322530 bytes 14 files changed, 1433 insertions(+), 738 deletions(-) diff --git a/Inc/Ccxhdr.h b/Inc/Ccxhdr.h index 082dbaa..6581fa7 100644 --- a/Inc/Ccxhdr.h +++ b/Inc/Ccxhdr.h @@ -12,21 +12,13 @@ #pragma comment(linker,"/RELEASE") -#ifdef _MERGE_DATA_ // Not set by default -#ifdef _MERGE_RDATA_ -#pragma comment(linker,"/merge:.rdata=.data") -#endif // _MERGE_RDATA_ -#pragma comment(linker,"/merge:.text=.data") -#pragma comment(linker,"/merge:.reloc=.data") -#pragma comment(linker,"/ignore:4078") -#endif // _MERGE_DATA_ - #if _MSC_VER >= 1000 // Slightly slower loading time under Windows 9x, but may save some Kb #pragma comment(linker,"/opt:nowin98") #endif // _MSC_VER >= 1000 #endif // NDEBUG #endif // COMPILE_SMALL + // end of z33z stuff // MAIN INCLUDES @@ -47,14 +39,14 @@ #include #include #include +#include #include #include -#if !defined(_LINUX) && !defined(__MINGW32__) +#ifndef _LINUX #include #else #include #endif -#include #if !defined(ASSERT) #ifdef _DEBUG diff --git a/Inc/CfcFile.h b/Inc/CfcFile.h index 662db3d..5e9faeb 100644 --- a/Inc/CfcFile.h +++ b/Inc/CfcFile.h @@ -10,14 +10,14 @@ typedef LPVOID FAR *LPLPVOID; #include "StdDefs.h" #ifndef OF_READ -#define OF_READ 0x00000000 -#define OF_WRITE 0x00000001 -#define OF_READWRITE 0x00000002 -#define OF_SHARE_COMPAT 0x00000000 -#define OF_SHARE_EXCLUSIVE 0x00000010 -#define OF_SHARE_DENY_WRITE 0x00000020 -#define OF_SHARE_DENY_READ 0x00000030 -#define OF_SHARE_DENY_NONE 0x00000040 +#define OF_READ 0x00000000 +#define OF_WRITE 0x00000001 +#define OF_READWRITE 0x00000002 +#define OF_SHARE_COMPAT 0x00000000 +#define OF_SHARE_EXCLUSIVE 0x00000010 +#define OF_SHARE_DENY_WRITE 0x00000020 +#define OF_SHARE_DENY_READ 0x00000030 +#define OF_SHARE_DENY_NONE 0x00000040 #endif STDDLL_API HFILE WINAPI File_OpenA(LPCSTR fname, int mode); diff --git a/Inc/Cncf.h b/Inc/Cncf.h index 215f4d5..d6d36a6 100644 --- a/Inc/Cncf.h +++ b/Inc/Cncf.h @@ -231,8 +231,8 @@ typedef struct tagCT { long ctMini; // Minimal value long ctMaxi; // Maximal value } counter; -typedef counter * fpct; -typedef counter * fpCounter; +typedef counter * fpct; +typedef counter * fpCounter; ////////////////////////////////////////////////////////////////////////////// // @@ -552,20 +552,20 @@ typedef event * LPEVT; #define ACT_SIZE 14 // Definition of conditions / actions flags -#define EVFLAGS_REPEAT 0x01 -#define EVFLAGS_DONE 0x02 -#define EVFLAGS_DEFAULT 0x04 -#define EVFLAGS_DONEBEFOREFADEIN 0x08 -#define EVFLAGS_NOTDONEINSTART 0x10 -#define EVFLAGS_ALWAYS 0x20 -#define EVFLAGS_BAD 0x40 -#define EVFLAGS_BADOBJECT 0x80 -#define EVFLAGS_DEFAULTMASK (EVFLAGS_ALWAYS+EVFLAGS_REPEAT+EVFLAGS_DEFAULT+EVFLAGS_DONEBEFOREFADEIN+EVFLAGS_NOTDONEINSTART) -#define ACTFLAGS_REPEAT 0x0001 +#define EVFLAGS_REPEAT 0x01 +#define EVFLAGS_DONE 0x02 +#define EVFLAGS_DEFAULT 0x04 +#define EVFLAGS_DONEBEFOREFADEIN 0x08 +#define EVFLAGS_NOTDONEINSTART 0x10 +#define EVFLAGS_ALWAYS 0x20 +#define EVFLAGS_BAD 0x40 +#define EVFLAGS_BADOBJECT 0x80 +#define EVFLAGS_DEFAULTMASK (EVFLAGS_ALWAYS+EVFLAGS_REPEAT+EVFLAGS_DEFAULT+EVFLAGS_DONEBEFOREFADEIN+EVFLAGS_NOTDONEINSTART) +#define ACTFLAGS_REPEAT 0x0001 // For flags II -// ------------- +// ------------- #define EVFLAG2_NOT 0x0001 #define EVFLAG2_NOTABLE 0x0002 #define EVFLAGS_NOTABLE (EVFLAG2_NOTABLE<<8) @@ -575,7 +575,7 @@ typedef event * LPEVT; #define EVFLAG2_MASK (EVFLAG2_NOT|EVFLAG2_NOTABLE|EVFLAGS_MONITORABLE) // MACRO: Returns the code for an extension -#define EXTCONDITIONNUM(i) (-((short)(i>>16))-1) +#define EXTCONDITIONNUM(i) (-((short)(i>>16))-1) #define EXTACTIONNUM(i) ((short)(i>>16)) // PARAM Structure @@ -634,7 +634,7 @@ typedef eventParam * fpevp; #define EXPL_PLUS 0x00020000 #define EXPL_MOINS 0x00040000 #define EXPL_MULT 0x00060000 -#define EXPL_DIV 0x00080000 +#define EXPL_DIV 0x00080000 #define EXPL_MOD 0x000A0000 #define EXPL_POW 0x000C0000 #define EXPL_AND 0x000E0000 @@ -763,7 +763,7 @@ typedef expressionV1 * LPEXPV1; // Information structure // ---------------------------------------------- -typedef struct tagEVO { +typedef struct tagEVO { short evoConditions; // Conditions short evoActions; // Actions short evoExpressions; // Expressions @@ -780,7 +780,7 @@ typedef eventInfosOffsets * LPEVO; // ---------------------------------------------------------- #define TYPE_DIRECTION -127 #define TYPE_QUALIFIER -126 -#define NUMBEROF_SYSTEMTYPES 7 +#define NUMBEROF_SYSTEMTYPES 7 #define OBJ_PLAYER -7 #define OBJ_KEYBOARD -6 #define OBJ_CREATE -5 @@ -791,11 +791,66 @@ typedef eventInfosOffsets * LPEVO; #define OBJ_FIRST_C_OBJECT 8 #define OBJ_LAST NB_SYSOBJ +#ifndef COXSDK +// FAST LOOP ACCELERATION +/////////////////////////////////////////////////////////////// +class CPosStartLoop +{ +public: + CPosStartLoop(LPEVP pEvp, LPTSTR pName) + { + m_pEvp = pEvp; + m_name = (LPTSTR)malloc((_tcslen(pName) + 1) * sizeof(TCHAR)); + _tcscpy(m_name, pName); + } + ~CPosStartLoop() + { + free(m_name); + } + LPEVP m_pEvp; + LPTSTR m_name; +}; +class CPosOnLoop +{ +public: + enum + { + POL_STEP = 4 + }; + LPDWORD m_deltas; + int m_length; + int m_position; + LPTSTR m_name; + BOOL m_bOR; + CPosOnLoop(LPTSTR pName) + { + m_name = pName; + m_length = 1; + m_deltas = (LPDWORD)malloc( (m_length * 2 + 1 )* sizeof(DWORD)); + m_position = 0; + m_bOR = FALSE; + } + ~CPosOnLoop() + { + free(m_deltas); + } + void AddOnLoop(DWORD delta1, BOOL delta2) + { + if (m_position == m_length) + { + m_length += POL_STEP; + m_deltas = (LPDWORD)realloc(m_deltas, (m_length *2 + 1) * sizeof(DWORD)); + } + m_deltas[m_position * 2] = delta1; + m_deltas[m_position * 2 + 1] = delta2; + m_position++; + m_deltas[m_position * 2] = 0xFFFFFFFF; + } +}; - - +#endif // ------------------------------------------------------------ @@ -819,6 +874,8 @@ typedef eventInfosOffsets * LPEVO; #define OEFLAG_NEVERKILL 0x2000 #define OEFLAG_NEVERSLEEP 0x4000 #define OEFLAG_MANUALSLEEP 0x8000 +#define OEFLAG_FAKESPRITE 0x40000 +#define OEFLAG_FAKECOLLISIONS 0x80000 #define OEFLAG_TEXT 0x10000 #define OEFLAG_DONTCREATEATSTART 0x20000 @@ -861,6 +918,8 @@ typedef eventInfosOffsets * LPEVO; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //#define OBJ_SYSTEM -1 //-1&255=255 +#define CND_ELSEIF ((-27<<8)|255) +#define CNDL_ELSEIF ((-27<<16)|65535) #define CND_CHANCE ((-26<<8)|255) #define CND_ORLOGICAL ((-25<<8)|255) #define CNDL_ORLOGICAL ((-25<<16)|65535) @@ -931,6 +990,7 @@ typedef eventInfosOffsets * LPEVO; #define ACTL_MENUSHOW ((12<<16)|65535) #define ACT_MENUHIDE ((13<<8)|255) #define ACTL_MENUHIDE ((13<<16)|65535) +#define ACTL_STARTLOOP ((14<<16)|65535) #define ACT_STARTLOOP ((14<<8)|255) #define ACT_STOPLOOP ((15<<8)|255) #define ACT_SETLOOPINDEX ((16<<8)|255) @@ -950,6 +1010,7 @@ typedef eventInfosOffsets * LPEVO; #define EXPL_LONG ((0<<16)|65535) #define EXP_RANDOM ((1<<8)|255) #define EXPL_RANDOM ((1<<16)|65535) +#define EXPNUM_RANDOM 1 #define EXP_VARGLO ((2<<8)|255) #define EXPL_VARGLO ((2<<16)|65535) #define EXP_STRING ((3<<8)|255) @@ -1067,6 +1128,10 @@ typedef eventInfosOffsets * LPEVO; #define EXPL_ZERO ((60<<16)|65535) #define EXP_EMPTY ((61<<8)|255) #define EXPL_EMPTY ((61<<16)|65535) +#define EXP_DISTANCE ((62<<8)|255) +#define EXP_ANGLE ((63<<8)|255) +#define EXP_RANGE ((64<<8)|255) +#define EXP_RANDOMRANGE ((65<<8)|255) #define EXP_PARENTH1 ((-1<<8)|255) #define EXPL_PARENTH1 ((-1<<16)|65535) @@ -1079,83 +1144,83 @@ typedef eventInfosOffsets * LPEVO; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // #define TYPE_SPEAKER -2 //(TYPE_SPEAKER&255)=254 -#define CND_SPCHANNELPAUSED ((-9<<8)|254) -#define CNDL_SPCHANNELPAUSED ((-9<<16)|65534) -#define CND_NOSPCHANNELPLAYING ((-8<<8)|254) -#define CNDL_NOSPCHANNELPLAYING ((-8<<16)|65534) -#define CND_MUSPAUSED ((-7<<8)|254) -#define CND_SPSAMPAUSED ((-6<<8)|254) -#define CNDL_SPSAMPAUSED ((-6<<16)|65534) -#define CND_MUSICENDS ((-5<<8)|254) -#define CNDL_MUSICENDS ((-5<<16)|65534) -#define CND_NOMUSPLAYING ((-4<<8)|254) -#define CNDL_NOMUSPLAYING ((-4<<16)|65534) -#define CND_NOSAMPLAYING ((-3<<8)|254) -#define CNDL_NOSAMPLAYING ((-3<<16)|65534) -#define CND_NOSPMUSPLAYING ((-2<<8)|254) -#define CND_NOSPSAMPLAYING ((-1<<8)|254) -#define CNDL_NOSPSAMPLAYING ((-1<<16)|65534) -#define ACT_PLAYSAMPLE ((0<<8)|254) -#define ACTL_PLAYSAMPLE ((0<<16)|65534) -#define ACT_STOPSAMPLE ((1<<8)|254) -#define ACTL_STOPSAMPLE ((1<<16)|65534) -#define ACT_PLAYMUSIC ((2<<8)|254) -#define ACTL_PLAYMUSIC ((2<<16)|65534) -#define ACT_STOPMUSIC ((3<<8)|254) -#define ACTL_STOPMUSIC ((3<<16)|65534) -#define ACT_PLAYLOOPSAMPLE ((4<<8)|254) -#define ACTL_PLAYLOOPSAMPLE ((4<<16)|65534) -#define ACT_PLAYLOOPMUSIC ((5<<8)|254) -#define ACT_STOPSPESAMPLE ((6<<8)|254) -#define ACTL_STOPSPESAMPLE ((6<<16)|65534) -#define ACT_PAUSESAMPLE ((7<<8)|254) -#define ACTL_PAUSESAMPLE ((7<<16)|65534) -#define ACT_RESUMESAMPLE ((8<<8)|254) -#define ACTL_RESUMESAMPLE ((8<<16)|65534) -#define ACT_PAUSEMUSIC ((9<<8)|254) -#define ACT_RESUMEMUSIC ((10<<8)|254) -#define ACT_PLAYCHANNEL ((11<<8)|254) -#define ACTL_PLAYCHANNEL ((11<<16)|65534) -#define ACT_PLAYLOOPCHANNEL ((12<<8)|254) -#define ACTL_PLAYLOOPCHANNEL ((12<<16)|65534) -#define ACT_PAUSECHANNEL ((13<<8)|254) -#define ACTL_PAUSECHANNEL ((13<<16)|65534) -#define ACT_RESUMECHANNEL ((14<<8)|254) -#define ACTL_RESUMECHANNEL ((14<<16)|65534) -#define ACT_STOPCHANNEL ((15<<8)|254) -#define ACTL_STOPCHANNEL ((15<<16)|65534) -#define ACT_SETCHANNELPOS ((16<<8)|254) -#define ACTL_SETCHANNELPOS ((16<<16)|65534) -#define ACT_SETCHANNELVOL ((17<<8)|254) -#define ACTL_SETCHANNELVOL ((17<<16)|65534) -#define ACT_SETCHANNELPAN ((18<<8)|254) -#define ACTL_SETCHANNELPAN ((18<<16)|65534) -#define ACT_SETSAMPLEPOS ((19<<8)|254) -#define ACTL_SETSAMPLEPOS ((19<<16)|65534) -#define ACT_SETSAMPLEMAINVOL ((20<<8)|254) -#define ACTL_SETSAMPLEMAINVOL ((20<<16)|65534) -#define ACT_SETSAMPLEVOL ((21<<8)|254) -#define ACTL_SETSAMPLEVOL ((21<<16)|65534) -#define ACT_SETSAMPLEMALNPAN ((22<<8)|254) -#define ACTL_SETSAMPLEMALNPAN ((22<<16)|65534) -#define ACT_SETSAMPLEPAN ((23<<8)|254) -#define ACTL_SETSAMPLEPAN ((23<<16)|65534) -#define ACT_PAUSEALLCHANNELS ((24<<8)|254) -#define ACTL_PAUSEALLCHANNELS ((24<<16)|65534) -#define ACT_RESUMEALLCHANNELS ((25<<8)|254) -#define ACTL_RESUMEALLCHANNELS ((25<<16)|65534) -#define ACT_PLAYMUSICFILE ((26<<8)|254) -#define ACT_PLAYLOOPMUSICFILE ((27<<8)|254) -#define ACT_PLAYFILECHANNEL ((28<<8)|254) -#define ACTL_PLAYFILECHANNEL ((28<<16)|65534) +#define CND_SPCHANNELPAUSED ((-9<<8)|254) +#define CNDL_SPCHANNELPAUSED ((-9<<16)|65534) +#define CND_NOSPCHANNELPLAYING ((-8<<8)|254) +#define CNDL_NOSPCHANNELPLAYING ((-8<<16)|65534) +#define CND_MUSPAUSED ((-7<<8)|254) +#define CND_SPSAMPAUSED ((-6<<8)|254) +#define CNDL_SPSAMPAUSED ((-6<<16)|65534) +#define CND_MUSICENDS ((-5<<8)|254) +#define CNDL_MUSICENDS ((-5<<16)|65534) +#define CND_NOMUSPLAYING ((-4<<8)|254) +#define CNDL_NOMUSPLAYING ((-4<<16)|65534) +#define CND_NOSAMPLAYING ((-3<<8)|254) +#define CNDL_NOSAMPLAYING ((-3<<16)|65534) +#define CND_NOSPMUSPLAYING ((-2<<8)|254) +#define CND_NOSPSAMPLAYING ((-1<<8)|254) +#define CNDL_NOSPSAMPLAYING ((-1<<16)|65534) +#define ACT_PLAYSAMPLE ((0<<8)|254) +#define ACTL_PLAYSAMPLE ((0<<16)|65534) +#define ACT_STOPSAMPLE ((1<<8)|254) +#define ACTL_STOPSAMPLE ((1<<16)|65534) +#define ACT_PLAYMUSIC ((2<<8)|254) +#define ACTL_PLAYMUSIC ((2<<16)|65534) +#define ACT_STOPMUSIC ((3<<8)|254) +#define ACTL_STOPMUSIC ((3<<16)|65534) +#define ACT_PLAYLOOPSAMPLE ((4<<8)|254) +#define ACTL_PLAYLOOPSAMPLE ((4<<16)|65534) +#define ACT_PLAYLOOPMUSIC ((5<<8)|254) +#define ACT_STOPSPESAMPLE ((6<<8)|254) +#define ACTL_STOPSPESAMPLE ((6<<16)|65534) +#define ACT_PAUSESAMPLE ((7<<8)|254) +#define ACTL_PAUSESAMPLE ((7<<16)|65534) +#define ACT_RESUMESAMPLE ((8<<8)|254) +#define ACTL_RESUMESAMPLE ((8<<16)|65534) +#define ACT_PAUSEMUSIC ((9<<8)|254) +#define ACT_RESUMEMUSIC ((10<<8)|254) +#define ACT_PLAYCHANNEL ((11<<8)|254) +#define ACTL_PLAYCHANNEL ((11<<16)|65534) +#define ACT_PLAYLOOPCHANNEL ((12<<8)|254) +#define ACTL_PLAYLOOPCHANNEL ((12<<16)|65534) +#define ACT_PAUSECHANNEL ((13<<8)|254) +#define ACTL_PAUSECHANNEL ((13<<16)|65534) +#define ACT_RESUMECHANNEL ((14<<8)|254) +#define ACTL_RESUMECHANNEL ((14<<16)|65534) +#define ACT_STOPCHANNEL ((15<<8)|254) +#define ACTL_STOPCHANNEL ((15<<16)|65534) +#define ACT_SETCHANNELPOS ((16<<8)|254) +#define ACTL_SETCHANNELPOS ((16<<16)|65534) +#define ACT_SETCHANNELVOL ((17<<8)|254) +#define ACTL_SETCHANNELVOL ((17<<16)|65534) +#define ACT_SETCHANNELPAN ((18<<8)|254) +#define ACTL_SETCHANNELPAN ((18<<16)|65534) +#define ACT_SETSAMPLEPOS ((19<<8)|254) +#define ACTL_SETSAMPLEPOS ((19<<16)|65534) +#define ACT_SETSAMPLEMAINVOL ((20<<8)|254) +#define ACTL_SETSAMPLEMAINVOL ((20<<16)|65534) +#define ACT_SETSAMPLEVOL ((21<<8)|254) +#define ACTL_SETSAMPLEVOL ((21<<16)|65534) +#define ACT_SETSAMPLEMALNPAN ((22<<8)|254) +#define ACTL_SETSAMPLEMALNPAN ((22<<16)|65534) +#define ACT_SETSAMPLEPAN ((23<<8)|254) +#define ACTL_SETSAMPLEPAN ((23<<16)|65534) +#define ACT_PAUSEALLCHANNELS ((24<<8)|254) +#define ACTL_PAUSEALLCHANNELS ((24<<16)|65534) +#define ACT_RESUMEALLCHANNELS ((25<<8)|254) +#define ACTL_RESUMEALLCHANNELS ((25<<16)|65534) +#define ACT_PLAYMUSICFILE ((26<<8)|254) +#define ACT_PLAYLOOPMUSICFILE ((27<<8)|254) +#define ACT_PLAYFILECHANNEL ((28<<8)|254) +#define ACTL_PLAYFILECHANNEL ((28<<16)|65534) #define ACT_PLAYLOOPFILECHANNEL ((29<<8)|254) #define ACTL_PLAYLOOPFILECHANNEL ((29<<16)|65534) -#define ACT_LOCKCHANNEL ((30<<8)|254) +#define ACT_LOCKCHANNEL ((30<<8)|254) #define ACTL_LOCKCHANNEL ((30<<16)|65534) -#define ACT_UNLOCKCHANNEL ((31<<8)|254) -#define ACTL_UNLOCKCHANNEL ((31<<16)|65534) -#define ACT_SETCHANNELFREQ ((32<<8)|254) -#define ACT_SETSAMPLEFREQ ((33<<8)|254) +#define ACT_UNLOCKCHANNEL ((31<<8)|254) +#define ACTL_UNLOCKCHANNEL ((31<<16)|65534) +#define ACT_SETCHANNELFREQ ((32<<8)|254) +#define ACT_SETSAMPLEFREQ ((33<<8)|254) #define EXP_GETSAMPLEMAINVOL ((0<<8)|254) #define EXP_GETSAMPLEVOL ((1<<8)|254) @@ -1179,106 +1244,115 @@ typedef eventInfosOffsets * LPEVO; //#define TYPE_GAME -3 //(TYPE_GAME&255)=253 -#define CND_FRAMESAVED ((-10<<8)|253) -#define CND_FRAMELOADED ((-9<<8)|253) -#define CNDL_ENDOFPAUSE ((-8<<16)|65533) -#define CND_ENDOFPAUSE ((-8<<8)|253) -#define CND_ISVSYNCON ((-7<<8)|253) -#define CND_ISLADDER ((-6<<8)|253) -#define CND_ISOBSTACLE ((-5<<8)|253) -#define CND_QUITAPPLICATION ((-4<<8)|253) +#define CND_FRAMESAVED ((-10<<8)|253) +#define CND_FRAMELOADED ((-9<<8)|253) +#define CNDL_ENDOFPAUSE ((-8<<16)|65533) +#define CND_ENDOFPAUSE ((-8<<8)|253) +#define CND_ISVSYNCON ((-7<<8)|253) +#define CND_ISLADDER ((-6<<8)|253) +#define CND_ISOBSTACLE ((-5<<8)|253) +#define CND_QUITAPPLICATION ((-4<<8)|253) #define CNDL_QUITAPPLICATION ((-4<<16)|65533) -#define CND_LEVEL ((-3<<8)|253) -#define CND_END ((-2<<8)|253) -#define CNDL_END ((-2<<16)|65533) -#define CND_START ((-1<<8)|253) -#define CNDL_START ((-1<<16)|65533) - -#define ACT_NEXTLEVEL ((0<<8)|253) -#define ACTL_NEXTLEVEL ((0<<16)|65533) -#define ACT_PREVLEVEL ((1<<8)|253) -#define ACTL_PREVLEVEL ((1<<16)|65533) -#define ACT_GOLEVEL ((2<<8)|253) -#define ACTL_GOLEVEL ((2<<16)|65533) -#define ACT_PAUSE ((3<<8)|253) -#define ACT_ENDGAME ((4<<8)|253) -#define ACTL_ENDGAME ((4<<16)|65533) -#define ACT_RESTARTGAME ((5<<8)|253) -#define ACTL_RESTARTGAME ((5<<16)|65533) -#define ACT_RESTARTLEVEL ((6<<8)|253) -#define ACT_CDISPLAY ((7<<8)|253) -#define ACT_CDISPLAYX ((8<<8)|253) -#define ACT_CDISPLAYY ((9<<8)|253) -#define ACT_LOADGAME ((10<<8)|253) -#define ACT_SAVEGAME ((11<<8)|253) -#define ACT_CLS ((12<<8)|253) -#define ACT_CLEARZONE ((13<<8)|253) -#define ACT_FULLSCREENMODE ((14<<8)|253) -#define ACT_WINDOWEDMODE ((15<<8)|253) -#define ACT_SETFRAMERATE ((16<<8)|253) -#define ACT_PAUSEKEY ((17<<8)|253) -#define ACT_PAUSEANYKEY ((18<<8)|253) -#define ACT_SETVSYNCON ((19<<8)|253) -#define ACT_SETVSYNCOFF ((20<<8)|253) -#define ACT_SETVIRTUALWIDTH ((21<<8)|253) -#define ACT_SETVIRTUALHEIGHT ((22<<8)|253) -#define ACT_SETFRAMEBDKCOLOR ((23<<8)|253) -#define ACT_DELCREATEDBKDAT ((24<<8)|253) -#define ACT_DELALLCREATEDBKD ((25<<8)|253) -#define ACT_SETFRAMEWIDTH ((26<<8)|253) -#define ACT_SETFRAMEHEIGHT ((27<<8)|253) -#define ACT_SAVEFRAME ((28<<8)|253) -#define ACT_LOADFRAME ((29<<8)|253) -#define ACT_LOADAPPLICATION ((30<<8)|253) -#define ACT_PLAYDEMO ((31<<8)|253) -#define ACT_SETFRAMEEFFECT ((32<<8)|253) -#define ACT_SETFRAMEEFFECTPARAM ((33<<8)|253) +#define CND_LEVEL ((-3<<8)|253) +#define CND_END ((-2<<8)|253) +#define CNDL_END ((-2<<16)|65533) +#define CND_START ((-1<<8)|253) +#define CNDL_START ((-1<<16)|65533) + +#define ACT_NEXTLEVEL ((0<<8)|253) +#define ACTL_NEXTLEVEL ((0<<16)|65533) +#define ACT_PREVLEVEL ((1<<8)|253) +#define ACTL_PREVLEVEL ((1<<16)|65533) +#define ACT_GOLEVEL ((2<<8)|253) +#define ACTL_GOLEVEL ((2<<16)|65533) +#define ACT_PAUSE ((3<<8)|253) +#define ACT_ENDGAME ((4<<8)|253) +#define ACTL_ENDGAME ((4<<16)|65533) +#define ACT_RESTARTGAME ((5<<8)|253) +#define ACTL_RESTARTGAME ((5<<16)|65533) +#define ACT_RESTARTLEVEL ((6<<8)|253) +#define ACT_CDISPLAY ((7<<8)|253) +#define ACT_CDISPLAYX ((8<<8)|253) +#define ACT_CDISPLAYY ((9<<8)|253) +#define ACT_LOADGAME ((10<<8)|253) +#define ACT_SAVEGAME ((11<<8)|253) +#define ACT_CLS ((12<<8)|253) +#define ACT_CLEARZONE ((13<<8)|253) +#define ACT_FULLSCREENMODE ((14<<8)|253) +#define ACT_WINDOWEDMODE ((15<<8)|253) +#define ACT_SETFRAMERATE ((16<<8)|253) +#define ACT_PAUSEKEY ((17<<8)|253) +#define ACT_PAUSEANYKEY ((18<<8)|253) +#define ACT_SETVSYNCON ((19<<8)|253) +#define ACT_SETVSYNCOFF ((20<<8)|253) +#define ACT_SETVIRTUALWIDTH ((21<<8)|253) +#define ACT_SETVIRTUALHEIGHT ((22<<8)|253) +#define ACT_SETFRAMEBDKCOLOR ((23<<8)|253) +#define ACT_DELCREATEDBKDAT ((24<<8)|253) +#define ACT_DELALLCREATEDBKD ((25<<8)|253) +#define ACT_SETFRAMEWIDTH ((26<<8)|253) +#define ACT_SETFRAMEHEIGHT ((27<<8)|253) +#define ACT_SAVEFRAME ((28<<8)|253) +#define ACT_LOADFRAME ((29<<8)|253) +#define ACT_LOADAPPLICATION ((30<<8)|253) +#define ACT_PLAYDEMO ((31<<8)|253) +#define ACT_SETFRAMEEFFECT ((32<<8)|253) +#define ACT_SETFRAMEEFFECTPARAM ((33<<8)|253) #define ACT_SETFRAMEEFFECTPARAMTEXTURE ((34<<8)|253) -#define ACT_SETFRAMEALPHACOEF ((35<<8)|253) -#define ACT_SETFRAMERGBCOEF ((36<<8)|253) - -#define EXP_GAMLEVEL ((0<<8)|253) -#define EXP_GAMNPLAYER ((1<<8)|253) -#define EXP_PLAYXLEFT ((2<<8)|253) -#define EXP_PLAYXRIGHT ((3<<8)|253) -#define EXP_PLAYYTOP ((4<<8)|253) -#define EXP_PLAYYBOTTOM ((5<<8)|253) -#define EXP_PLAYWIDTH ((6<<8)|253) -#define EXP_PLAYHEIGHT ((7<<8)|253) -#define EXP_GAMLEVELNEW ((8<<8)|253) -#define EXP_GETCOLLISIONMASK ((9<<8)|253) -#define EXP_FRAMERATE ((10<<8)|253) -#define EXP_GETVIRTUALWIDTH ((11<<8)|253) -#define EXP_GETVIRTUALHEIGHT ((12<<8)|253) -#define EXP_GETFRAMEBKDCOLOR ((13<<8)|253) -#define EXP_GRAPHICMODE ((14<<8)|253) -#define EXP_PIXELSHADERVERSION ((15<<8)|253) -#define EXP_FRAMEALPHACOEF ((16<<8)|253) -#define EXP_FRAMERGBCOEF ((17<<8)|253) +#define ACTL_SETFRAMEEFFECTPARAMTEXTURE ((34<<16)|65533) +#define ACT_SETFRAMEALPHACOEF ((35<<8)|253) +#define ACT_SETFRAMERGBCOEF ((36<<8)|253) + +#define EXP_GAMLEVEL ((0<<8)|253) +#define EXP_GAMNPLAYER ((1<<8)|253) +#define EXP_PLAYXLEFT ((2<<8)|253) +#define EXP_PLAYXRIGHT ((3<<8)|253) +#define EXP_PLAYYTOP ((4<<8)|253) +#define EXP_PLAYYBOTTOM ((5<<8)|253) +#define EXP_PLAYWIDTH ((6<<8)|253) +#define EXP_PLAYHEIGHT ((7<<8)|253) +#define EXP_GAMLEVELNEW ((8<<8)|253) +#define EXP_GETCOLLISIONMASK ((9<<8)|253) +#define EXP_FRAMERATE ((10<<8)|253) +#define EXP_GETVIRTUALWIDTH ((11<<8)|253) +#define EXP_GETVIRTUALHEIGHT ((12<<8)|253) +#define EXP_GETFRAMEBKDCOLOR ((13<<8)|253) +#define EXP_GRAPHICMODE ((14<<8)|253) +#define EXP_PIXELSHADERVERSION ((15<<8)|253) +#define EXP_FRAMEALPHACOEF ((16<<8)|253) +#define EXP_FRAMERGBCOEF ((17<<8)|253) #define EXP_FRAMEEFFECTPARAM ((18<<8)|253) // TIMER Conditions / Actions // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define CND_TIMEOUT ((-5<<8)|(OBJ_TIMER&255)) -#define CND_EVERY ((-4<<8)|(OBJ_TIMER&255)) -#define CNDL_EVERY ((-4<<16)|(OBJ_TIMER&0xFFFF)) -#define CND_TIMER ((-3<<8)|(OBJ_TIMER&255)) -#define CNDL_TIMER ((-3<<16)|(OBJ_TIMER&0xFFFF)) -#define CND_TIMERINF ((-2<<8)|(OBJ_TIMER&255)) -#define CNDL_TIMERINF ((-2<<16)|(OBJ_TIMER&0xFFFF)) -#define CND_TIMERSUP ((-1<<8)|(OBJ_TIMER&255)) -#define CNDL_TIMERSUP ((-1<<16)|(OBJ_TIMER&0xFFFF)) -#define ACT_SETTIMER ((0<<8)|(OBJ_TIMER&255)) +#define CND_EVERY2 ((-8<<8)|(OBJ_TIMER&255)) +#define CND_TIMEREQUALS ((-7<<8)|(OBJ_TIMER&255)) +#define CND_ONEVENT ((-6<<8)|(OBJ_TIMER&255)) +#define CND_TIMEOUT ((-5<<8)|(OBJ_TIMER&255)) +#define CND_EVERY ((-4<<8)|(OBJ_TIMER&255)) +#define CNDL_EVERY ((-4<<16)|(OBJ_TIMER&0xFFFF)) +#define CND_TIMER ((-3<<8)|(OBJ_TIMER&255)) +#define CNDL_TIMER ((-3<<16)|(OBJ_TIMER&0xFFFF)) +#define CND_TIMERINF ((-2<<8)|(OBJ_TIMER&255)) +#define CNDL_TIMERINF ((-2<<16)|(OBJ_TIMER&0xFFFF)) +#define CND_TIMERSUP ((-1<<8)|(OBJ_TIMER&255)) +#define CNDL_TIMERSUP ((-1<<16)|(OBJ_TIMER&0xFFFF)) +#define ACT_SETTIMER ((0<<8)|(OBJ_TIMER&255)) +#define ACT_EVENTAFTER ((1<<8)|(OBJ_TIMER&255)) +#define ACT_NEVENTSAFTER ((2<<8)|(OBJ_TIMER&255)) +#define ACT_SETTIMER ((0<<8)|(OBJ_TIMER&255)) #define EXP_TIMVALUE ((0<<8)|(OBJ_TIMER&255)) #define EXP_TIMCENT ((1<<8)|(OBJ_TIMER&255)) #define EXP_TIMSECONDS ((2<<8)|(OBJ_TIMER&255)) #define EXP_TIMHOURS ((3<<8)|(OBJ_TIMER&255)) #define EXP_TIMMINITS ((4<<8)|(OBJ_TIMER&255)) -#define NUM_EVERY -4 -#define NUM_TIMER -3 -#define NUM_TIMERINF -2 -#define NUM_TIMERSUP -1 +#define EXP_EVENTAFTER ((5<<8)|(OBJ_TIMER&255)) +#define NUM_ONEVENT -6 +#define NUM_EVERY -4 +#define NUM_TIMER -3 +#define NUM_TIMERINF -2 +#define NUM_TIMERSUP -1 // KEYBOARD Conditions / Actions // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1286,27 +1360,27 @@ typedef eventInfosOffsets * LPEVO; #define CND_ONMOUSEWHEELDOWN ((-12<<8)|(OBJ_KEYBOARD&255)) #define CNDL_ONMOUSEWHEELUP ((-11<<16)|(OBJ_KEYBOARD&0xFFFF)) #define CND_ONMOUSEWHEELUP ((-11<<8)|(OBJ_KEYBOARD&255)) -#define CND_MOUSEON ((-10<<8)|(OBJ_KEYBOARD&255)) -#define CND_ANYKEY ((-9<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_ANYKEY ((-9<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_MKEYDEPRESSED ((-8<<8)|(OBJ_KEYBOARD&255)) -#define CND_MCLICKONOBJECT ((-7<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_MCLICKONOBJECT ((-7<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_MCLICKINZONE ((-6<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_MCLICKINZONE ((-6<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_MCLICK ((-5<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_MCLICK ((-5<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_MONOBJECT ((-4<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_MONOBJECT ((-4<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define CND_MINZONE ((-3<<8)|(OBJ_KEYBOARD&255)) -#define CND_KBKEYDEPRESSED ((-2<<8)|(OBJ_KEYBOARD&255)) -#define CND_KBPRESSKEY ((-1<<8)|(OBJ_KEYBOARD&255)) -#define CNDL_KBPRESSKEY ((-1<<16)|(OBJ_KEYBOARD&0xFFFF)) -#define ACT_HIDECURSOR ((0<<8)|(OBJ_KEYBOARD&255)) -#define ACT_SHOWCURSOR ((1<<8)|(OBJ_KEYBOARD&255)) -#define EXP_XMOUSE ((0<<8)|(OBJ_KEYBOARD&255)) -#define EXP_YMOUSE ((1<<8)|(OBJ_KEYBOARD&255)) -#define EXP_MOUSEWHEELDELTA ((2<<8)|(OBJ_KEYBOARD&255)) +#define CND_MOUSEON ((-10<<8)|(OBJ_KEYBOARD&255)) +#define CND_ANYKEY ((-9<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_ANYKEY ((-9<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_MKEYDEPRESSED ((-8<<8)|(OBJ_KEYBOARD&255)) +#define CND_MCLICKONOBJECT ((-7<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_MCLICKONOBJECT ((-7<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_MCLICKINZONE ((-6<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_MCLICKINZONE ((-6<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_MCLICK ((-5<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_MCLICK ((-5<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_MONOBJECT ((-4<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_MONOBJECT ((-4<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define CND_MINZONE ((-3<<8)|(OBJ_KEYBOARD&255)) +#define CND_KBKEYDEPRESSED ((-2<<8)|(OBJ_KEYBOARD&255)) +#define CND_KBPRESSKEY ((-1<<8)|(OBJ_KEYBOARD&255)) +#define CNDL_KBPRESSKEY ((-1<<16)|(OBJ_KEYBOARD&0xFFFF)) +#define ACT_HIDECURSOR ((0<<8)|(OBJ_KEYBOARD&255)) +#define ACT_SHOWCURSOR ((1<<8)|(OBJ_KEYBOARD&255)) +#define EXP_XMOUSE ((0<<8)|(OBJ_KEYBOARD&255)) +#define EXP_YMOUSE ((1<<8)|(OBJ_KEYBOARD&255)) +#define EXP_MOUSEWHEELDELTA ((2<<8)|(OBJ_KEYBOARD&255)) // PLAYERS Conditions / Actions @@ -1316,20 +1390,20 @@ typedef eventInfosOffsets * LPEVO; #define CNDL_NOMORELIVE ((-5<<16)|(OBJ_PLAYER&0xFFFF)) #define CND_JOYPRESSED ((-4<<8)|(OBJ_PLAYER&255)) #define CNDL_JOYPRESSED ((-4<<16)|(OBJ_PLAYER&0xFFFF)) -#define CND_LIVE ((-3<<8)|(OBJ_PLAYER&255)) -#define CND_SCORE ((-2<<8)|(OBJ_PLAYER&255)) +#define CND_LIVE ((-3<<8)|(OBJ_PLAYER&255)) +#define CND_SCORE ((-2<<8)|(OBJ_PLAYER&255)) #define CND_PLAYERPLAYING ((-1<<8)|(OBJ_PLAYER&255)) #define ACT_SETSCORE ((0<<8)|(OBJ_PLAYER&255)) -#define ACT_SETLIVES ((1<<8)|(OBJ_PLAYER&255)) -#define ACT_NOINPUT ((2<<8)|(OBJ_PLAYER&255)) -#define ACT_RESTINPUT ((3<<8)|(OBJ_PLAYER&255)) +#define ACT_SETLIVES ((1<<8)|(OBJ_PLAYER&255)) +#define ACT_NOINPUT ((2<<8)|(OBJ_PLAYER&255)) +#define ACT_RESTINPUT ((3<<8)|(OBJ_PLAYER&255)) #define ACT_ADDSCORE ((4<<8)|(OBJ_PLAYER&255)) -#define ACT_ADDLIVES ((5<<8)|(OBJ_PLAYER&255)) +#define ACT_ADDLIVES ((5<<8)|(OBJ_PLAYER&255)) #define ACT_SUBSCORE ((6<<8)|(OBJ_PLAYER&255)) -#define ACT_SUBLIVES ((7<<8)|(OBJ_PLAYER&255)) +#define ACT_SUBLIVES ((7<<8)|(OBJ_PLAYER&255)) #define ACT_SETINPUT ((8<<8)|(OBJ_PLAYER&255)) -#define ACT_SETINPUTKEY ((9<<8)|(OBJ_PLAYER&255)) +#define ACT_SETINPUTKEY ((9<<8)|(OBJ_PLAYER&255)) #define ACT_SETPLAYERNAME ((10<<8)|(OBJ_PLAYER&255)) #define EXP_PLASCORE ((0<<8)|(OBJ_PLAYER&255)) @@ -1341,35 +1415,37 @@ typedef eventInfosOffsets * LPEVO; // CREATE Conditions / Actions // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define CND_CHOOSEALLINLINE ((-23<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEFLAGRESET ((-22<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEFLAGSET ((-21<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEVALUE ((-20<<8)|(OBJ_CREATE&255)) -#define CND_PICKFROMID ((-19<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEALLINZONE ((-18<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEALL ((-17<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEZONE ((-16<<8)|(OBJ_CREATE&255)) -#define CND_NUMOFALLOBJECT ((-15<<8)|(OBJ_CREATE&255)) -#define CND_NUMOFALLZONE ((-14<<8)|(OBJ_CREATE&255)) -#define CND_NOMOREALLZONE ((-13<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEALLINLINE ((-23<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEFLAGRESET ((-22<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEFLAGSET ((-21<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEVALUE ((-20<<8)|(OBJ_CREATE&255)) +#define CND_PICKFROMID ((-19<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEALLINZONE ((-18<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEALL ((-17<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEZONE ((-16<<8)|(OBJ_CREATE&255)) +#define CND_NUMOFALLOBJECT ((-15<<8)|(OBJ_CREATE&255)) +#define CND_NUMOFALLZONE ((-14<<8)|(OBJ_CREATE&255)) +#define CND_NOMOREALLZONE ((-13<<8)|(OBJ_CREATE&255)) #define CND_CHOOSEFLAGRESET_OLD ((-12<<8)|(OBJ_CREATE&255)) #define CND_CHOOSEFLAGSET_OLD ((-11<<8)|(OBJ_CREATE&255)) //... #define CND_CHOOSEVALUE_OLD ((-8<<8)|(OBJ_CREATE&255)) #define CND_PICKFROMID_OLD ((-7<<8)|(OBJ_CREATE&255)) #define CND_CHOOSEALLINZONE_OLD ((-6<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEALL_OLD ((-5<<8)|(OBJ_CREATE&255)) -#define CND_CHOOSEZONE_OLD ((-4<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEALL_OLD ((-5<<8)|(OBJ_CREATE&255)) +#define CND_CHOOSEZONE_OLD ((-4<<8)|(OBJ_CREATE&255)) #define CND_NUMOFALLOBJECT_OLD ((-3<<8)|(OBJ_CREATE&255)) -#define CND_NUMOFALLZONE_OLD ((-2<<8)|(OBJ_CREATE&255)) +#define CND_NUMOFALLZONE_OLD ((-2<<8)|(OBJ_CREATE&255)) #define CND_NOMOREALLZONE_OLD ((-1<<8)|(OBJ_CREATE&255)) +#define ACT_CREATEBYNAME ((1<<8)|(OBJ_CREATE&255)) +#define ACTL_CREATEBYNAME ((1<<16)|(OBJ_CREATE&0xFFFF)) #define ACT_CREATE ((0<<8)|(OBJ_CREATE&255)) #define EXP_CRENUMBERALL ((0<<8)|(OBJ_CREATE&255)) -#define NUM_END -2 -#define NUM_START -1 +#define NUM_END -2 +#define NUM_START -1 #endif - + // BALL Movements // ~~~~~~~~~~~~~~~~~~~~~~~~~ typedef struct tagMB { @@ -1385,7 +1461,7 @@ typedef MoveBall * LPMOVEBALL; // MOUSE movement // ~~~~~~~~~~~~~~~~~~~~~~~~~ typedef struct tagMM { - short mmDx; + short mmDx; short mmFx; short mmDy; short mmFy; @@ -1546,12 +1622,13 @@ typedef struct tagMV { } Movement; typedef Movement * LPMOVEMENT; -#ifndef IN_KPX - + // COMMON CONDITIONS FOR NORMAL OBJECTS ////////////////////////////////////////// #define EVENTS_EXTBASE 80 +#define CND_EXTONLOOP (-41<<8) +#define CNDL_EXTONLOOP (-41<<16) #define CND_EXTISSTRIKEOUT (-40<<8) #define CND_EXTISUNDERLINE (-39<<8) #define CND_EXTISITALIC (-38<<8) @@ -1573,125 +1650,141 @@ typedef Movement * LPMOVEMENT; #define CND_EXTCMPVARFIXED (-26<<8) #define CND_EXTFLAGSET (-25<<8) #define CND_EXTFLAGRESET (-24<<8) -#define CND_EXTISCOLBACK (-23<<8) -#define CND_EXTNEARBORDERS (-22<<8) -#define CND_EXTENDPATH (-21<<8) -#define CNDL_EXTENDPATH (-21<<16) -#define CND_EXTPATHNODE (-20<<8) -#define CNDL_EXTPATHNODE (-20<<16) -#define CND_EXTCMPACC (-19<<8) -#define CND_EXTCMPDEC (-18<<8) -#define CND_EXTCMPX (-17<<8) -#define CND_EXTCMPY (-16<<8) -#define CND_EXTCMPSPEED (-15<<8) -#define CND_EXTCOLLISION (-14<<8) -#define CNDL_EXTCOLLISION (-14<<16) -#define CND_EXTCOLBACK (-13<<8) -#define CNDL_EXTCOLBACK (-13<<16) -#define CND_EXTOUTPLAYFIELD (-12<<8) -#define CNDL_EXTOUTPLAYFIELD (-12<<16) -#define CND_EXTINPLAYFIELD (-11<<8) -#define CNDL_EXTINPLAYFIELD (-11<<16) -#define CND_EXTISOUT (-10<<8) -#define CNDL_EXTISOUT (-10<<16) -#define CND_EXTISIN (-9 <<8) -#define CNDL_EXTISIN (-9 <<16) -#define CND_EXTFACING (-8 <<8) -#define CND_EXTSTOPPED (-7 <<8) -#define CND_EXTBOUNCING (-6 <<8) -#define CND_EXTREVERSED (-5 <<8) -#define CND_EXTISCOLLIDING (-4 <<8) -#define CNDL_EXTISCOLLIDING (-4 <<16) -#define CND_EXTANIMPLAYING (-3 <<8) -#define CND_EXTANIMENDOF (-2 <<8) -#define CNDL_EXTANIMENDOF (-2 <<16) -#define CND_EXTCMPFRAME (-1 <<8) - -#define ACT_EXTSETPOS (1 <<8) -#define ACT_EXTSETX (2 <<8) -#define ACT_EXTSETY (3 <<8) -#define ACT_EXTSTOP (4 <<8) -#define ACTL_EXTSTOP (4 <<16) -#define ACT_EXTSTART (5 <<8) -#define ACT_EXTSPEED (6 <<8) -#define ACT_EXTMAXSPEED (7 <<8) -#define ACT_EXTWRAP (8 <<8) -#define ACTL_EXTWRAP (8 <<16) -#define ACT_EXTBOUNCE (9 <<8) -#define ACTL_EXTBOUNCE (9 <<16) -#define ACT_EXTREVERSE (10<<8) -#define ACT_EXTNEXTMOVE (11<<8) -#define ACT_EXTPREVMOVE (12<<8) -#define ACT_EXTSELMOVE (13<<8) -#define ACT_EXTLOOKAT (14<<8) -#define ACT_EXTSTOPANIM (15<<8) -#define ACT_EXTSTARTANIM (16<<8) -#define ACT_EXTFORCEANIM (17<<8) -#define ACT_EXTFORCEDIR (18<<8) -#define ACT_EXTFORCESPEED (19<<8) -#define ACTL_EXTFORCESPEED (19<<16) -#define ACT_EXTRESTANIM (20<<8) -#define ACT_EXTRESTDIR (21<<8) -#define ACT_EXTRESTSPEED (22<<8) -#define ACT_EXTSETDIR (23<<8) -#define ACT_EXTDESTROY (24<<8) -#define ACT_EXTSHUFFLE (25<<8) -#define ACTL_EXTSHUFFLE (25<<16) -#define ACT_EXTHIDE (26<<8) -#define ACT_EXTSHOW (27<<8) -#define ACT_EXTDISPLAYDURING (28<<8) -#define ACT_EXTSHOOT (29<<8) -#define ACTL_EXTSHOOT (29<<16) -#define ACT_EXTSHOOTTOWARD (30<<8) -#define ACTL_EXTSHOOTTOWARD (30<<16) -#define ACT_EXTSETVAR (31<<8) -#define ACTL_EXTSETVAR (31<<16) -#define ACT_EXTADDVAR (32<<8) -#define ACTL_EXTADDVAR (32<<16) -#define ACT_EXTSUBVAR (33<<8) -#define ACTL_EXTSUBVAR (33<<16) -#define ACT_EXTDISPATCHVAR (34<<8) -#define ACTL_EXTDISPATCHVAR (34<<16) -#define ACT_EXTSETFLAG (35<<8) -#define ACT_EXTCLRFLAG (36<<8) -#define ACT_EXTCHGFLAG (37<<8) -#define ACT_EXTINKEFFECT (38<<8) -#define ACT_EXTSETSEMITRANSPARENCY (39<<8) -#define ACT_EXTFORCEFRAME (40<<8) -#define ACT_EXTRESTFRAME (41<<8) -#define ACT_EXTSETACCELERATION (42<<8) -#define ACT_EXTSETDECELERATION (43<<8) -#define ACT_EXTSETROTATINGSPEED (44<<8) -#define ACT_EXTSETDIRECTIONS (45<<8) -#define ACT_EXTBRANCHNODE (46<<8) -#define ACT_EXTSETGRAVITY (47<<8) -#define ACT_EXTGOTONODE (48<<8) -#define ACT_EXTSETVARSTRING (49<<8) -#define ACTL_EXTSETVARSTRING (49<<16) -#define ACT_EXTSETFONTNAME (50<<8) -#define ACT_EXTSETFONTSIZE (51<<8) -#define ACT_EXTSETBOLD (52<<8) -#define ACT_EXTSETITALIC (53<<8) -#define ACT_EXTSETUNDERLINE (54<<8) -#define ACT_EXTSETSRIKEOUT (55<<8) -#define ACT_EXTSETTEXTCOLOR (56<<8) -#define ACT_EXTSPRFRONT (57<<8) -#define ACT_EXTSPRBACK (58<<8) -#define ACT_EXTMOVEBEFORE (59<<8) -#define ACT_EXTMOVEAFTER (60<<8) -#define ACT_EXTMOVETOLAYER (61<<8) -#define ACT_EXTADDTODEBUGGER (62<<8) -#define ACT_EXTSETEFFECT (63<<8) -#define ACT_EXTSETEFFECTPARAM (64<<8) -#define ACT_EXTSETALPHACOEF (65<<8) -#define ACT_EXTSETRGBCOEF (66<<8) -#define ACT_EXTSETEFFECTPARAMTEXTURE (67<<8) - -#define EXP_EXTYSPR ( 1<<8) -#define EXP_EXTISPR ( 2<<8) -#define EXP_EXTSPEED ( 3<<8) -#define EXP_EXTACC ( 4<<8) -#define EXP_EXTDEC ( 5<<8) +#define CND_EXTISCOLBACK (-23<<8) +#define CNDL_EXTISCOLBACK (-23<<16) +#define CND_EXTNEARBORDERS (-22<<8) +#define CND_EXTENDPATH (-21<<8) +#define CNDL_EXTENDPATH (-21<<16) +#define CND_EXTPATHNODE (-20<<8) +#define CNDL_EXTPATHNODE (-20<<16) +#define CND_EXTCMPACC (-19<<8) +#define CND_EXTCMPDEC (-18<<8) +#define CND_EXTCMPX (-17<<8) +#define CND_EXTCMPY (-16<<8) +#define CND_EXTCMPSPEED (-15<<8) +#define CND_EXTCOLLISION (-14<<8) +#define CNDL_EXTCOLLISION (-14<<16) +#define CND_EXTCOLBACK (-13<<8) +#define CNDL_EXTCOLBACK (-13<<16) +#define CND_EXTOUTPLAYFIELD (-12<<8) +#define CNDL_EXTOUTPLAYFIELD (-12<<16) +#define CND_EXTINPLAYFIELD (-11<<8) +#define CNDL_EXTINPLAYFIELD (-11<<16) +#define CND_EXTISOUT (-10<<8) +#define CNDL_EXTISOUT (-10<<16) +#define CND_EXTISIN (-9 <<8) +#define CNDL_EXTISIN (-9 <<16) +#define CND_EXTFACING (-8 <<8) +#define CND_EXTSTOPPED (-7 <<8) +#define CND_EXTBOUNCING (-6 <<8) +#define CND_EXTREVERSED (-5 <<8) +#define CND_EXTISCOLLIDING (-4 <<8) +#define CNDL_EXTISCOLLIDING (-4 <<16) +#define CND_EXTANIMPLAYING (-3 <<8) +#define CND_EXTANIMENDOF (-2 <<8) +#define CNDL_EXTANIMENDOF (-2 <<16) +#define CND_EXTCMPFRAME (-1 <<8) + +#define ACT_EXTSETPOS (1 <<8) +#define ACT_EXTSETX (2 <<8) +#define ACT_EXTSETY (3 <<8) +#define ACT_EXTSTOP (4 <<8) +#define ACTL_EXTSTOP (4 <<16) +#define ACT_EXTSTART (5 <<8) +#define ACT_EXTSPEED (6 <<8) +#define ACT_EXTMAXSPEED (7 <<8) +#define ACT_EXTWRAP (8 <<8) +#define ACTL_EXTWRAP (8 <<16) +#define ACT_EXTBOUNCE (9 <<8) +#define ACTL_EXTBOUNCE (9 <<16) +#define ACT_EXTREVERSE (10<<8) +#define ACT_EXTNEXTMOVE (11<<8) +#define ACT_EXTPREVMOVE (12<<8) +#define ACT_EXTSELMOVE (13<<8) +#define ACT_EXTLOOKAT (14<<8) +#define ACT_EXTSTOPANIM (15<<8) +#define ACT_EXTSTARTANIM (16<<8) +#define ACT_EXTFORCEANIM (17<<8) +#define ACT_EXTFORCEDIR (18<<8) +#define ACT_EXTFORCESPEED (19<<8) +#define ACTL_EXTFORCESPEED (19<<16) +#define ACT_EXTRESTANIM (20<<8) +#define ACT_EXTRESTDIR (21<<8) +#define ACT_EXTRESTSPEED (22<<8) +#define ACT_EXTSETDIR (23<<8) +#define ACT_EXTDESTROY (24<<8) +#define ACT_EXTSHUFFLE (25<<8) +#define ACTL_EXTSHUFFLE (25<<16) +#define ACT_EXTHIDE (26<<8) +#define ACT_EXTSHOW (27<<8) +#define ACT_EXTDISPLAYDURING (28<<8) +#define ACT_EXTSHOOT (29<<8) +#define ACTL_EXTSHOOT (29<<16) +#define ACT_EXTSHOOTTOWARD (30<<8) +#define ACTL_EXTSHOOTTOWARD (30<<16) +#define ACT_EXTSETVAR (31<<8) +#define ACTL_EXTSETVAR (31<<16) +#define ACT_EXTADDVAR (32<<8) +#define ACTL_EXTADDVAR (32<<16) +#define ACT_EXTSUBVAR (33<<8) +#define ACTL_EXTSUBVAR (33<<16) +#define ACT_EXTDISPATCHVAR (34<<8) +#define ACTL_EXTDISPATCHVAR (34<<16) +#define ACT_EXTSETFLAG (35<<8) +#define ACT_EXTCLRFLAG (36<<8) +#define ACT_EXTCHGFLAG (37<<8) +#define ACT_EXTINKEFFECT (38<<8) +#define ACT_EXTSETSEMITRANSPARENCY (39<<8) +#define ACT_EXTFORCEFRAME (40<<8) +#define ACT_EXTRESTFRAME (41<<8) +#define ACT_EXTSETACCELERATION (42<<8) +#define ACT_EXTSETDECELERATION (43<<8) +#define ACT_EXTSETROTATINGSPEED (44<<8) +#define ACT_EXTSETDIRECTIONS (45<<8) +#define ACT_EXTBRANCHNODE (46<<8) +#define ACT_EXTSETGRAVITY (47<<8) +#define ACT_EXTGOTONODE (48<<8) +#define ACT_EXTSETVARSTRING (49<<8) +#define ACTL_EXTSETVARSTRING (49<<16) +#define ACT_EXTSETFONTNAME (50<<8) +#define ACT_EXTSETFONTSIZE (51<<8) +#define ACT_EXTSETBOLD (52<<8) +#define ACT_EXTSETITALIC (53<<8) +#define ACT_EXTSETUNDERLINE (54<<8) +#define ACT_EXTSETSRIKEOUT (55<<8) +#define ACT_EXTSETTEXTCOLOR (56<<8) +#define ACT_EXTSPRFRONT (57<<8) +#define ACT_EXTSPRBACK (58<<8) +#define ACT_EXTMOVEBEFORE (59<<8) +#define ACT_EXTMOVEAFTER (60<<8) +#define ACT_EXTMOVETOLAYER (61<<8) +#define ACT_EXTADDTODEBUGGER (62<<8) +#define ACT_EXTSETEFFECT (63<<8) +#define ACT_EXTSETEFFECTPARAM (64<<8) +#define ACT_EXTSETALPHACOEF (65<<8) +#define ACT_EXTSETRGBCOEF (66<<8) +#define ACT_EXTSETEFFECTPARAMTEXTURE (67<<8) +#define ACTL_EXTSETEFFECTPARAMTEXTURE (67<<16) +#define ACT_EXTSETFRICTION (68<<8) +#define ACT_EXTSETELASTICITY (69<<8) +#define ACT_EXTAPPLYIMPULSE (70<<8) +#define ACT_EXTAPPLYANGULARIMPULSE (71<<8) +#define ACT_EXTAPPLYFORCE (72<<8) +#define ACT_EXTAPPLYTORQUE (73<<8) +#define ACT_EXTSETLINEARVELOCITY (74<<8) +#define ACT_EXTSETANGULARVELOCITY (75<<8) +#define ACT_EXTFOREACH (76<<8) +#define ACT_EXTFOREACH2 (77<<8) +#define ACT_EXTSTOPFORCE (78<<8) +#define ACT_EXTSTOPTORQUE (79<<8) +#define ACT_EXTSETDENSITY (80<<8) // NOT USED IN PHYSCS ACTI0N MENU +#define ACT_EXTSETGRAVITYSCALE (81<<8) // NOT USED IN PHYSCS ACTI0N MENU + +#define EXP_EXTYSPR ( 1<<8) +#define EXP_EXTISPR ( 2<<8) +#define EXP_EXTSPEED ( 3<<8) +#define EXP_EXTACC ( 4<<8) +#define EXP_EXTDEC ( 5<<8) #define EXP_EXTDIR ( 6<<8) #define EXP_EXTXLEFT ( 7<<8) #define EXP_EXTXRIGHT ( 8<<8) @@ -1720,13 +1813,25 @@ typedef Movement * LPMOVEMENT; #define EXP_EXTEFFECTPARAM (29<<8) #define EXP_EXTVARBYINDEX (30<<8) #define EXP_EXTVARSTRINGBYINDEX (31<<8) +#define EXP_EXTDISTANCE (32<<8) +#define EXP_EXTANGLE (33<<8) +#define EXP_EXTLOOPINDEX (34<<8) +#define EXP_EXTGETFRICTION (35<<8) +#define EXP_EXTGETRESTITUTION (36<<8) +#define EXP_EXTGETDENSITY (37<<8) +#define EXP_EXTGETVELOCITY (38<<8) +#define EXP_EXTGETANGLE (39<<8) +#define EXP_EXTWIDTH (40<<8) +#define EXP_EXTHEIGHT (41<<8) + +#ifndef IN_KPX // TEXT Conditions / Actions //////////////////////////////////////////// #define ACT_STRDESTROY (( (EVENTS_EXTBASE+0)<<8)|3) #define ACT_STRDISPLAY (( (EVENTS_EXTBASE+1)<<8)|3) #define ACT_STRDISPLAYDURING (( (EVENTS_EXTBASE+2)<<8)|3) -#define ACT_STRSETCOLOUR (( (EVENTS_EXTBASE+3)<<8)|3) +#define ACT_STRSETCOLOUR (( (EVENTS_EXTBASE+3)<<8)|3) #define ACT_STRSET (( (EVENTS_EXTBASE+4)<<8)|3) #define ACT_STRPREV (( (EVENTS_EXTBASE+5)<<8)|3) #define ACT_STRNEXT (( (EVENTS_EXTBASE+6)<<8)|3) @@ -1777,11 +1882,11 @@ typedef Movement * LPMOVEMENT; /////////////////////////////////////////////// #define CND_QEQUAL (((-EVENTS_EXTBASE-3)<<8)|4) #define CNDL_QEQUAL (((-EVENTS_EXTBASE-3)<<16)|4) -#define CND_QFALSE (((-EVENTS_EXTBASE-2)<<8)|4) -#define CNDL_QFALSE (((-EVENTS_EXTBASE-2)<<16)|4) -#define CND_QEXACT (((-EVENTS_EXTBASE-1)<<8)|4) -#define CNDL_QEXACT (((-EVENTS_EXTBASE-1)<<16)|4) -#define ACT_QASK (( (EVENTS_EXTBASE+0)<<8)|4) +#define CND_QFALSE (((-EVENTS_EXTBASE-2)<<8)|4) +#define CNDL_QFALSE (((-EVENTS_EXTBASE-2)<<16)|4) +#define CND_QEXACT (((-EVENTS_EXTBASE-1)<<8)|4) +#define CNDL_QEXACT (((-EVENTS_EXTBASE-1)<<16)|4) +#define ACT_QASK (( (EVENTS_EXTBASE+0)<<8)|4) // Formatted text Conditions / actions / expressions @@ -1875,6 +1980,8 @@ typedef Movement * LPMOVEMENT; #define ACT_CCASETGLOBALSTRING (((EVENTS_EXTBASE+10)<<8)|(OBJ_CCA&0x00FF)) #define ACT_CCAPAUSEAPP (((EVENTS_EXTBASE+11)<<8)|(OBJ_CCA&0x00FF)) #define ACT_CCARESUMEAPP (((EVENTS_EXTBASE+12)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCASETWIDTH (((EVENTS_EXTBASE+13)<<8)|(OBJ_CCA&0x00FF)) +#define ACT_CCASETHEIGHT (((EVENTS_EXTBASE+14)<<8)|(OBJ_CCA&0x00FF)) #define EXP_CCAGETFRAMENUMBER (((EVENTS_EXTBASE+0)<<8)|(OBJ_CCA&0x00FF)) #define EXP_CCAGETGLOBALVALUE (((EVENTS_EXTBASE+1)<<8)|(OBJ_CCA&0x00FF)) #define EXP_CCAGETGLOBALSTRING (((EVENTS_EXTBASE+2)<<8)|(OBJ_CCA&0x00FF)) @@ -1922,9 +2029,9 @@ typedef Movement * LPMOVEMENT; #define PS_INT 4 // -------------------------------- Sample -#define MAX_SOUNDNAME 64 -#define PSOUNDFLAG_UNINTERRUPTABLE 0x0001 -#define PSOUNDFLAG_BAD 0x0002 +#define MAX_SOUNDNAME 64 +#define PSOUNDFLAG_UNINTERRUPTABLE 0x0001 +#define PSOUNDFLAG_BAD 0x0002 #define PSOUNDFLAG_IPHONE_AUDIOPLAYER 0x0004 #define PSOUNDFLAG_IPHONE_OPENAL 0x0008 @@ -2053,7 +2160,7 @@ typedef ShootParam * LPSHT; // -------------------------------- Playfield Zone #define PARAM_ZONE 19 #define PS_ZNE 8 - + // -------------------------------- System object position // W- Direction #define PARAM_SYSCREATE 21 @@ -2132,7 +2239,7 @@ typedef prgParamW * LPPRGW; #define LPPRG LPPRGA #endif -#define PRGFLAGS_WAIT 0x0001 +#define PRGFLAGS_WAIT 0x0001 #define PRGFLAGS_HIDE 0x0002 // -------------------------------- Global variable number @@ -2373,6 +2480,18 @@ typedef prgParam2 * LPPRG2; #define PS_EFFECT 2 // B name of the effect +// -------------------------------- Character encoding for reading text files +#define PARAM_CHAR_ENCODING_INPUT 65 +#define PS_CHAR_ENCODING_INPUT 6 +typedef struct { + WORD wCharEncoding; + DWORD dwUnusedParam; +} charEncodingParam; + +// -------------------------------- Character encoding for saving text files +#define PARAM_CHAR_ENCODING_OUTPUT 66 +#define PS_CHAR_ENCODING_OUTPUT 6 + // STRUCTURE FOR FAST LOOPS /////////////////////////////////////////////////////////////////////// @@ -2588,6 +2707,21 @@ typedef struct #define EditDebugInfo EditDebugInfoA #endif +typedef struct tagTimerEvent +{ + void* next; + int type; + LPTSTR name; + UINT timer; + UINT timerNext; + UINT timerPosition; + int loops; + int index; +}TimerEvent; +typedef TimerEvent* LPTIMEREVENT; +#define TIMEREVENTTYPE_ONESHOT 0 +#define TIMEREVENTTYPE_REPEAT 1 + /////////////////////////////////////////////////////////////////////// // // RUNTIME BUFFER @@ -2657,7 +2791,7 @@ typedef struct tagRH2 { int rh2PauseCompteur; DWORD rh2PauseTimer; UINT rh2PauseVbl; - FARPROC rh2LoopTraceProc; // Debugging routine + FARPROC rh2LoopTraceProc; // Debugging routine FARPROC rh2EventTraceProc; } runHeader2; @@ -2746,12 +2880,15 @@ typedef struct tagKPXLIB { #define RFUNCTION_CALLMOVEMENT 22 #define RFUNCTION_SETPOSITION 23 #define RFUNCTION_GETCALLTABLES 24 - -#define CNC_GetParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0xFFFFFFFF, 0) -#define CNC_GetIntParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0, 0) -#define CNC_GetStringParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0xFFFFFFFF, 0) -#define CNC_GetFloatParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 2, 0) -#define CNC_GetFloatValue(rdPtr, par) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAMFLOAT, par, 0) +#define RFUNCTION_GENERATECOMMONEVENT 25 +#define RFUNCTION_RANDOM 26 +#define RFUNCTION_ADDCURRENTOBJECT 27 + +#define CNC_GetParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0xFFFFFFFF, 0) +#define CNC_GetIntParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0, 0) +#define CNC_GetStringParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 0xFFFFFFFF, 0) +#define CNC_GetFloatParameter(rdPtr) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM, 2, 0) +#define CNC_GetFloatValue(rdPtr, par) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAMFLOAT, par, 0) #define CNC_GetFirstExpressionParameter(rdPtr, lParam, wParam) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM1, wParam, lParam) #define CNC_GetNextExpressionParameter(rdPtr, lParam, wParam) callRunTimeFunction(rdPtr, RFUNCTION_GETPARAM2, wParam, lParam) @@ -2828,8 +2965,15 @@ typedef struct tagRH4 { double rh4MvtTimerCoef; CIPhoneJoystick* rh4IPhoneJoystick; CIPhoneAd* rh4IPhoneAd; - char rh4QuitString[32]; // FREE!!!! GREAT! - + void* rh4Box2DBase; + short rh4Box2DSearched; + void* rh4ForEachs; + void* rh4CurrentForEach; + void* rh4CurrentForEach2; + void* rh4TimerEvents; + void* rh4PosOnLoop; + short rh4ComplexOnLoop; + char rh4QuitString[4]; // FREE!!!! GREAT! DWORD rh4PickFlags0; // 00-31 DWORD rh4PickFlags1; // 31-63 @@ -2871,10 +3015,10 @@ typedef struct tagRH4 { mv * rh4Mv; // Yves's data HCURSOR rh4OldCursor; // Old cursor for Show / HideMouse in Vitalize! mode headerObject* rh4_2ndObject; // Collision object address - short rh4_2ndObjectNumber; // Number for collisions + short rh4_2ndObjectNumber; // Number for collisions short rh4FirstQuickDisplay; // Quick-display object list int rh4WindowDeltaX; // For scrolling - int rh4WindowDeltaY; + int rh4WindowDeltaY; UINT rh4TimeOut; // For time-out! int rh4MouseXCenter; // To correct CROSOFT bugs! int rh4MouseYCenter; // To correct CROSOFT bugs! @@ -2944,7 +3088,7 @@ typedef struct RunHeader { int rhNObjects; int rhMaxObjects; - DWORD rhFree0; + DWORD rhFree0; DWORD rhFree1; DWORD rhFree2; DWORD rhFree3; @@ -2991,7 +3135,7 @@ typedef struct RunHeader { short rhFree4; // Alignment long rhCurParam[2]; short rhCurObjectNumber; // Object number - short rh1stObjectNumber; // Number, for collisions + short rh1stObjectNumber; // Number, for collisions long rhOiListPtr; // OI list enumeration short rhObListNext; // Branch label @@ -3041,7 +3185,7 @@ typedef struct headerObject { short hoNextSelected; // Selected object list!!! DO NOT CHANGE POSITION!!! int hoSize; // Structure size - LPRH hoAdRunHeader; // Run-header address + LPRH hoAdRunHeader; // Run-header address #ifdef __cplusplus headerObject* hoAddress; #else @@ -3072,7 +3216,7 @@ typedef struct headerObject { struct { int hoCalculX; // Low weight value - int hoX; // X coordinate + int hoX; // X coordinate int hoCalculY; // Low weight value int hoY; // Y coordinate }; @@ -3125,7 +3269,6 @@ typedef headerObject* LPHO; #define HOF_FLOAT 0x4000 #define HOF_STRING 0x8000 - // -------------------------------------- // Object's movement structure // -------------------------------------- @@ -3231,6 +3374,8 @@ typedef struct tagRM { { int MBul_Wait; LPHO MBul_ShootObject; + void* MBul_Body; + void* MBul_MBase; }; struct { @@ -3350,11 +3495,7 @@ typedef rVal * LPRVAL; // Objects animation and movement structure // ----------------------------------------------- #if !defined(ANGLETYPE) -#if defined(HWABETA) #define ANGLETYPE float -#else -#define ANGLETYPE int -#endif #endif typedef void (* RCROUTINE)(LPHO); typedef struct tagRCOM { @@ -3381,7 +3522,7 @@ typedef struct tagRCOM { BOOL rcChanged; // Flag: modified object BOOL rcCheckCollides; // For static objects - int rcOldX; // Previous coordinates + int rcOldX; // Previous coordinates int rcOldY; int rcOldImage; ANGLETYPE rcOldAngle; @@ -3518,7 +3659,7 @@ typedef struct objInfoList { int oilNumOfSelected; // Number of selected objects DWORD oilOEFlags; // Object's flags short oilLimitFlags; // Movement limitation flags - short oilLimitList; // Pointer to limitation list + short oilLimitList; // Pointer to limitation list short oilOIFlags; // Objects preferences short oilOCFlags2; // Objects preferences II long oilInkEffect; // Ink effect @@ -3682,13 +3823,13 @@ typedef struct kpj { #endif CREATERUNOBJECT_PROC CreateRunObject; DESTROYRUNOBJECT_PROC DestroyRunObject; - HANDLERUNOBJECT_PROC HandleRunObject; + HANDLERUNOBJECT_PROC HandleRunObject; DISPLAYRUNOBJECT_PROC DisplayRunObject; GETRUNOBJECTSURFACE_PROC GetRunObjectSurface; - REINITRUNOBJECT_PROC ReInitRunObject; - PAUSERUNOBJECT_PROC PauseRunObject; + REINITRUNOBJECT_PROC ReInitRunObject; + PAUSERUNOBJECT_PROC PauseRunObject; CONTINUERUNOBJECT_PROC ContinueRunObject; - PREPARETOSAVE_PROC PrepareToSave; + PREPARETOSAVE_PROC PrepareToSave; PREPARETOSAVE_PROC PrepareToSave2; GETRUNDATASIZE_PROC GetRunObjectDataSize; SAVEBACKGROUND_PROC SaveBackground; @@ -3716,7 +3857,7 @@ typedef struct kpj { #else } kpj; #endif -typedef kpj * LPKPJ; +typedef kpj * LPKPJ; #define KPJ_SHIFT 7 #define KPJ_SIZE 0x80 @@ -3788,7 +3929,7 @@ typedef struct tagCallTables #ifdef RUN_TIME #define OINUM_ERROR -1 - #define B2L(a,b,c,d) ((DWORD)(((DWORD)((unsigned char)(d))<<24)|((DWORD)((unsigned char)(c))<<16)|((DWORD)((unsigned char)(b))<<8)|(DWORD)((unsigned char)(a)))) + #define B2L(a,b,c,d) ((DWORD)(((DWORD)((unsigned char)(d))<<24)|((DWORD)((unsigned char)(c))<<16)|((DWORD)((unsigned char)(b))<<8)|(DWORD)((unsigned char)(a)))) // Pour la routine GetFileInfos #define FILEINFO_DRIVE 1 @@ -3802,11 +3943,11 @@ typedef struct tagCallTables // MACRO: returns first param #define EVTPARAMS(p) ((LPEVP)(p->evtCode<0 ? (LPBYTE)p+CND_SIZE : (LPBYTE)p+ACT_SIZE )) // MACRO: returns the extension condition code - #define EXTCONDITIONNUM(i) (-((short)(i>>16))-1) + #define EXTCONDITIONNUM(i) (-((short)(i>>16))-1) #define EXTACTIONNUM(i) ((short)(i>>16)) #define KPXNAME_SIZE 60 - #define BADNAME_SIZE (OINAME_SIZE+KPXNAME_SIZE+8) + #define BADNAME_SIZE (OINAME_SIZE+KPXNAME_SIZE+8) // Extensions // ---------- @@ -3882,6 +4023,7 @@ typedef struct tagCallTables #undef pev typedef struct pev { #endif + pev* pevNext; long pevCode; PEV_ROUTINE pevRoutine; long pevParam; @@ -3903,6 +4045,22 @@ typedef struct tagCallTables } qualifierLoad; typedef qualifierLoad * LPQLOAD; +#define STEPFOREACH 10 +typedef struct tagForEach +{ + void* next; + int length; + OINUM oi; + int index; + LPTSTR name; + int number; + BOOL stop; + BOOL toDelete; + LPHO objects[STEPFOREACH]; +}ForEach; +typedef ForEach* LPFOREACH; + + #endif // RUN_TIME #ifndef __cplusplus @@ -3916,10 +4074,10 @@ typedef struct tagCallTables //#undef CValue #undef CRunApp #undef CRunFrame -#endif +#endif; // Restores structure alignment... -#ifndef _H2INC +#ifndef _H2INC #pragma pack( pop, _pack_cncf_ ) #endif diff --git a/Inc/Cncy.h b/Inc/Cncy.h index b5a2151..56996c9 100644 --- a/Inc/Cncy.h +++ b/Inc/Cncy.h @@ -1,3 +1,4 @@ + #ifndef CNCY_H #define CNCY_H @@ -36,12 +37,12 @@ struct PropData; struct RunHeader; // Force structure alignement -#ifndef _H2INC +#ifndef _H2INC #pragma pack( push, _pack_cncy_ ) #pragma pack(2) #endif -#ifndef _H2INC +#ifndef _H2INC // Object instance parent types enum { @@ -230,8 +231,8 @@ typedef struct AppHeader { // Other flags #define GAOF_DEBUGGERSHORTCUTS 0x0001 -#define GAOF_DDRAW 0x0002 -#define GAOF_DDRAWVRAM 0x0004 +//#define GAOF_DDRAW 0x0002 +//#define GAOF_DDRAWVRAM 0x0004 #define GAOF_OBSOLETE 0x0008 #define GAOF_AUTOIMGFLT 0x0010 #define GAOF_AUTOSNDFLT 0x0020 @@ -254,7 +255,8 @@ typedef struct AppHeader2 { DWORD dwBuildFlags; WORD wScreenRatioTolerance; WORD wScreenAngle; // 0 (no rotation/portrait), 1 (90 clockwise/landscape left), 2 (90 anticlockwise/landscape right), 3 (automatic portrait), 4 (automatic landscape), 5 (fully automatic) - DWORD dwUnused2; + WORD iPhoneDisplayOption; + WORD wUnused; } AppHeader2; @@ -272,6 +274,16 @@ typedef struct AppHeader2 { #define AH2OPT_DISABLEBACKBUTTON 0x0800 // (Android) Disable Back button behavior #define AH2OPT_ANTIALIASED 0x1000 // (iPhone) Smooth resizing on bigger screens #define AH2OPT_CRASHREPORTING 0x2000 // (Android) Enable online crash reporting +#define AH2OPT_REQUIREGPU 0x4000 // (Android) Application requires a GPU +#define AH2OPT_KEEPRESOURCESBETWEENFRAMES 0x8000 // (HTML5) Keep resources between frames +#define AH2OPT_WEBGL 0x10000 // (HTML5) WebGL +#define AH2OPT_OPENGL1 0x10000 // (Android) Open GL 1.1 +#define AH2OPT_RESERVED 0x20000 // (Android) for future use +#define AH2OPT_NOSCREENBORDERS 0x40000 // (Android) No screen borders when KeepScreenRatio is selected (note: will be implemented in other exporters later) +#define AH2OPT_SYSTEMFONT 0x80000 // (Android) Use system font in text objects +#define AH2OPT_RUNEVENIFNOTFOCUS 0x100000 // (HTML5) Run even if not focus +#define AH2OPT_KEYBOVERAPPWINDOW 0x200000 // (Android) Display keyboard over app window +#define AH2OPT_OUYA 0x400000 // (Android) OUYA application enum { SCREENORIENTATION_PORTRAIT, @@ -282,7 +294,7 @@ enum { SCREENORIENTATION_PORTRAIT_AUTO, }; -#ifndef _H2INC +#ifndef _H2INC // Build type values enum { @@ -309,7 +321,14 @@ enum { BUILDTYPE_XNA_PHONE, BUILDTYPE_XNA_XBOX_APP, BUILDTYPE_XNA_PHONE_APP, - BUILDTYPE_STDMAX, // end of standard build types + BUILDTYPE_HTML5, + BUILDTYPE_VITA, + BUILDTYPE_VITADEVEL, + BUILDTYPE_VITAFINAL, // no longer used + BUILDTYPE_HTML5DEVEL, + BUILDTYPE_HTML5FINAL, + BUILDTYPE_OUYA, + BUILDTYPE_MAX, // end of standard build types }; // Build flag values @@ -323,12 +342,38 @@ enum { #define BUILDFLAG_TEST 0x0080 #define BUILDFLAG_NOWARNINGS 0x0100 +// Bluray options +#define BRFLAGS_DISPLAYLOADANIM 0x0001 +#define BRFLAGS_GRAPHICSNOTINJAR 0x0002 +#define BRFLAGS_BACKSURFACE 0x0004 +#define BRFLAGS_EXTERNALSOUNDS 0x0008 + +#define BRLOADANIM_NIMAGES_DEFAULT 4 + +typedef struct BlurayAppOptions { + + DWORD dwOpacity; + DWORD dwFlags; + DWORD dwLoadAnimNImages; + WORD wLoadAnimImage; + WORD wReserved; + +} BlurayAppOptions; +typedef BlurayAppOptions *LPPLURAYAPPOPTIONS; + +typedef struct BlurayFrameOptions { + + DWORD dwOpacity; + DWORD dwKeyReleaseTimeOut; + +} BlurayFrameOptions; +typedef BlurayFrameOptions *LPPLURAYFRAMEOPTIONS; #endif ////////////////////////////////////////////////////////////////////////////// // Element of chunk Extensions // -#ifndef _H2INC +#ifndef _H2INC typedef struct ExtDesc { WORD extSize; WORD extIndex; @@ -483,7 +528,7 @@ typedef struct ObjInfoHeader // LevObj/FrameItemInstance // -#ifndef _H2INC +#ifndef _H2INC #ifdef __cplusplus class diskLO { public: @@ -523,7 +568,7 @@ enum { //////////////////////////////// // Static object - ObjectsCommon // -#ifndef _H2INC +#ifndef _H2INC typedef struct Static_OC { // Size @@ -544,7 +589,7 @@ typedef Static_OC * LPStatic_OC; // Fill Type & shapes - Definitions // -#ifndef _H2INC +#ifndef _H2INC // Gradient typedef struct GradientData { COLORREF color1; @@ -577,7 +622,7 @@ enum { /////////////////////////////////////////////////////////////// // Fill Type - Part of FilledShape // -#ifndef _H2INC +#ifndef _H2INC #ifdef __cplusplus class FillType_Data { @@ -613,7 +658,7 @@ typedef struct FillType_Data { /////////////////////////////////////////////////////////////// // Filled Shape - Part of QuickBackdrop / Counter ObjectsCommon // -#ifndef _H2INC +#ifndef _H2INC #ifdef __cplusplus class FilledShape_Data { @@ -637,7 +682,7 @@ typedef FilledShape_Data * LPFilledShape_Data; ///////////////////////////////// // Quick backdrop - ObjectsCommon // -#ifndef _H2INC +#ifndef _H2INC typedef struct QuickBackdrop_OC { @@ -659,7 +704,7 @@ typedef QuickBackdrop_OC * LPQuickBackdrop_OC; ///////////////////////////////// // Backdrop - ObjectsCommon // -#ifndef _H2INC +#ifndef _H2INC typedef struct Backdrop_OC { @@ -803,7 +848,7 @@ enum { // // Objet RTF - ocData // -#ifndef _H2INC +#ifndef _H2INC typedef struct ocRTF { @@ -827,7 +872,7 @@ typedef ocRTF * LPOCRTF; // // Objet CCA - ocData // -#ifndef _H2INC +#ifndef _H2INC typedef struct ocCCA { @@ -882,7 +927,7 @@ typedef ocCCA * LPOCCCA; // Transition // -#ifndef _H2INC +#ifndef _H2INC // Transition header typedef struct TransitionHdr { @@ -1028,11 +1073,12 @@ enum { #define MMFVERFLAG_MASK 0x0000F000 #define MMFVERFLAG_HOME 0x00008000 // TGF #define MMFVERFLAG_PRO 0x00004000 // MMF Pro -#define MMFVERFLAG_DEMO 0x00002000 // Demo +#define MMFVERFLAG_ATX 0x00002000 // Not used #define MMFVERFLAG_PLUGIN 0x00001000 // Plugin #define MMFVERSION_15 0x01050000 // MMF 1.5 #define MMFVERSION_20 0x02000000 // MMF 2.0 -#define MMF_CURRENTVERSION MMFVERSION_20 +#define MMFVERSION_25 0x02050000 // MMF 2.5 +#define MMF_CURRENTVERSION MMFVERSION_25 // Build numbers #define MMF_BUILD_NONAME 203 @@ -1087,19 +1133,20 @@ enum { #define MMF_BUILD_252 252 #define MMF_BUILD_253 253 #define MMF_BUILD_254 254 -#define MMF_CURRENTBUILD MMF_BUILD_254 +#define MMF_BUILD_255 255 +#define MMF_BUILD_256 256 +#define MMF_BUILD_257 257 +#define MMF_BUILD_MMF25 280 +#define MMF_CURRENTBUILD MMF_BUILD_MMF25 // MFA file format versions #define MFA_BUILD_ALTSTR 1 // Alterable strings #define MFA_BUILD_COUNTERTEXT 2 // Text mode in counters #define MFA_BUILD_LASTFRAMEOFFSET 3 // Additional frame offset #define MFA_BUILD_FIXQUALIF 4 // Fix in qualifiers + prd version -#ifdef _UNICODE #define MFA_BUILD_LANGID 5 // Language ID -#define MFA_CURRENTBUILD MFA_BUILD_LANGID -#else -#define MFA_CURRENTBUILD MFA_BUILD_FIXQUALIF -#endif +#define MFA_BUILD_MMF25 6 // MMF 2.5 +#define MFA_CURRENTBUILD MFA_BUILD_MMF25 // Structures for picture editor typedef struct EditSurfaceParamsA { @@ -1266,7 +1313,9 @@ typedef struct mv { HHOOK mvHMsgHook; int mvModalLoop; int mvModalSubAppCount; - LPVOID mvFree[5]; + UINT mvLanguageID; + LPCWSTR mvModuleTextsPathname; + LPVOID mvFree[3]; // Functions //////////// @@ -1309,11 +1358,11 @@ typedef struct mv { DWORD (CALLBACK * mvGetVersion) (); // Editor & Runtime: callback function for properties or other functions -// #ifdef __cplusplus -// LRESULT (CALLBACK * mvCallFunction) (LPVOID edPtr, int nFnc, LPARAM lParam1=0, LPARAM lParam2=0, LPARAM lParam3=0); -// #else + #ifdef _cplusplus + LRESULT (CALLBACK * mvCallFunction) (LPVOID edPtr, int nFnc, LPARAM lParam1=0, LPARAM lParam2=0, LPARAM lParam3=0); + #else LRESULT (CALLBACK * mvCallFunction) (LPVOID edPtr, int nFnc, LPARAM lParam1, LPARAM lParam2, LPARAM lParam3); -// #endif + #endif // Editor: Open Help file (UNICODE) void (CALLBACK * mvHelpW) (LPCWSTR pHelpFile, UINT nID, LPARAM lParam); @@ -1420,6 +1469,8 @@ enum { EF_ISUNICODEAPP, // Returns TRUE if the application being loaded is a Unicode application EF_GETAPPCODEPAGE, // Returns the code page of the application EF_CREATEIMAGEFROMFILEW,// Create image from file (runtime only) + EF_LOADTEXT, + EF_SAVETEXT, }; // 3rd parameter of EF_CREATEIMAGEFROMFILE @@ -1521,7 +1572,7 @@ __inline LPVOID mvGetNextItem(LPMV mV, LPVOID edPtr, LPVOID edPtr1, LPCSTR extNa #ifdef HWABETA -__inline BOOL mvCreateEffect(LPMV mV, LPCSTR pEffectName, LPINT pEffect, LPARAM* pEffectParam) \ +__inline BOOL mvCreateEffect(LPMV mV, LPCTSTR pEffectName, LPINT pEffect, LPARAM* pEffectParam) \ { return (BOOL)mV->mvCallFunction(NULL, EF_CREATEEFFECT, (LPARAM)pEffectName, (LPARAM)pEffect, (LPARAM)pEffectParam); } __inline void mvDeleteEffect(LPMV mV, int nEffect, LPARAM lEffectParam) \ @@ -1550,12 +1601,30 @@ __inline BOOL mvIsUnicodeApp(LPMV mV, LPVOID pApp) \ __inline int mvGetAppCodePage(LPMV mV, LPVOID pApp) \ { return mV->mvCallFunction(NULL, EF_GETAPPCODEPAGE, (LPARAM)pApp, (LPARAM)0, (LPARAM)0); } +__inline LPWSTR mvLoadTextFile(LPMV mV, LPCWSTR fname, UINT encoding, BOOL bBinaryFile) \ + { return (LPWSTR)mV->mvCallFunction(NULL, EF_LOADTEXT, (LPARAM)fname, (LPARAM)encoding, (LPARAM)bBinaryFile); } + +__inline int mvSaveTextFile(LPMV mV, LPCWSTR fname, LPCWSTR text, UINT encoding) \ + { return (int)mV->mvCallFunction(NULL, EF_SAVETEXT, (LPARAM)fname, (LPARAM)text, (LPARAM)encoding); } + #ifdef _UNICODE #define mvCreateImageFromFile mvCreateImageFromFileW #else #define mvCreateImageFromFile mvCreateImageFromFileA #endif +enum { + CHARENC_ANSI, + CHARENC_UTF8_W_BOM, + CHARENC_UTF8_WO_BOM, + CHARENC_UTF16_W_BOM, + CHARENC_UTF16_WO_BOM, + CHARENC_UTF16B_W_BOM, + CHARENC_UTF16B_WO_BOM, + CHARENC_MAX, +}; +#define CHARENC_DEFAULT ((UINT)-1) + #endif // __cplusplus // Options for OpenHFile @@ -1599,6 +1668,7 @@ typedef struct MvxFnc { LPTSTR mvxFileTitle; CMvt* ( CALLBACK * mvxCreateMvt) (DWORD); + void ( CALLBACK * mvxGetMvtName)(int nMvt, LPTSTR pName, int cbSize); #if defined(VITALIZE) BOOL bValidated; @@ -1613,7 +1683,7 @@ typedef struct MvxFnc { #endif // RUN_TIME // Restore structure alignement -#ifndef _H2INC +#ifndef _H2INC #pragma pack( pop, _pack_cncy_ ) #endif diff --git a/Inc/Cnpdll.h b/Inc/Cnpdll.h index 25a53b0..063e231 100644 --- a/Inc/Cnpdll.h +++ b/Inc/Cnpdll.h @@ -1,12 +1,12 @@ //----------------------------------------------// -// Constantes et structures // +// Constantes et structures // //----------------------------------------------// #ifndef _cnpdll_h // Si deja inclus, ignorer #define _cnpdll_h #ifndef PI -#define PI ((double)3.1415926535) +#define PI ((double)3.1415926535) #endif #ifndef _H2INC @@ -22,7 +22,7 @@ extern "C" { #endif // Include files for H2Inc -#ifdef _H2INC +#ifdef _H2INC #define NOATOM #define NOMETAFILE 1 @@ -66,7 +66,7 @@ struct sMask; // Current build -#define MMFS2_CURRENT_BUILD 250 +#define MMFS2_CURRENT_BUILD 280 #define MMFS2_BUILD_MASK 0x0000FFFF #define MMFS2_BUILD_FLAG_UNICODE 0x00010000 // Unicode support #define MMFS2_BUILD_FLAG_HWA 0x00020000 // HWA support @@ -77,6 +77,9 @@ struct sMask; #define DWORDSTR(c1,c2,c3,c4) ((DWORD)((DWORD)c4<<24|(DWORD)c3<<16|(DWORD)c2<<8|(DWORD)c1)) #endif +#define ANGLEFLOAT +#define ANGLETYPE float // int + // Definitions differentes si WIN32 // ================== @@ -88,9 +91,7 @@ struct sMask; #define __near #define _far #define __far - #ifndef __MINGW32__ #define _pascal _stdcall - #endif #define __pascal __stdcall // Export @@ -114,9 +115,9 @@ struct sMask; // Flags boites de dialogues (obsolete) // ------------------------- -#define DL_MODAL 1 -#define DL_CENTER_WINDOW 2 -#define DL_CENTER_SCREEN 4 +#define DL_MODAL 1 +#define DL_CENTER_WINDOW 2 +#define DL_CENTER_SCREEN 4 // Messages propres a KNP // ---------------------- @@ -157,8 +158,8 @@ struct sMask; // Identifiants errones // -------------------- -#define NPSPR_ERROR 0 -#define HSPR_ERROR 0 +#define NPSPR_ERROR 0 +#define HSPR_ERROR 0 enum { WIN_MEMERR, @@ -196,18 +197,18 @@ enum { #define MAX_MODE SM_32 #define SM_D3D 0x10 -#define SM_DDRAW 0x20 // Flag "Direct Draw" -#define SM_VRAM 0x40 // Flag "Video RAM" +//#define SM_DDRAW 0x20 // Flag "Direct Draw" +//#define SM_VRAM 0x40 // Flag "Video RAM" #define SM_D3D8 0x80 #define SM_NOTDIB (SM_DDRAW | SM_VRAM) #define SM_MASK 0x0F // Mask mode // Modes graphiques #define GROP_NORMAL R2_COPYPEN -#define GROP_XOR R2_XORPEN +#define GROP_XOR R2_XORPEN // Modes collisions -#define CM_BOX 0 +#define CM_BOX 0 #define CM_BITMAP 1 // Test collisions @@ -220,11 +221,13 @@ enum { // Hauteur des plateformes #define HEIGHT_PLATFORM 6 -#define GCMF_OBSTACLE 0x0000 -#define GCMF_PLATFORM 0x0001 +#define GCMF_OBSTACLE 0x0000 +#define GCMF_PLATFORM 0x0001 +#define GCMF_TYPEMASK 0x0FFF +#define GCMF_NOROTATEORSTRETCH 0x1000 // Flags pour GetImageSize -#define GIS_WITHMASK 0x8000 +#define GIS_WITHMASK 0x8000 #define GIS_EXACT 0x4000 // AddImage flags @@ -286,7 +289,7 @@ enum { #define PS_DSOUND 0x0100 // To play with Direct Sound // AddFont flags -#define AF_COMPARE 0x100 // Compare to others +#define AF_COMPARE 0x100 // Compare to others // WinPasteText flags #define WPTF_CALCRECT 0x8000 @@ -351,7 +354,7 @@ typedef struct Sound typedef Sound* fpSound; // Sound flags -#define SP_WAVE 0x0001 // Flags +#define SP_WAVE 0x0001 // Flags #define SP_MIDI 0x0002 #define SNDF_TYPEMASK 0x000F #define SNDF_LOADONCALL 0x0010 @@ -369,9 +372,9 @@ typedef Sound* fpSound; // Structure Font typedef struct FontW { - DWORD fnCheckSum; // Checksum (des images) - DWORD fnCount; // Compteur d'utilisations - DWORD fnSize; // Taille sans l'entete + DWORD fnCheckSum; // Checksum (des images) + DWORD fnCount; // Compteur d'utilisations + DWORD fnSize; // Taille sans l'entete LOGFONTW fnLf; // Header font (pour CreateFont si Windows font) } FontW; typedef FontW *npFontW; @@ -379,9 +382,9 @@ typedef FontW *fpFontW; typedef struct FontA { - DWORD fnCheckSum; // Checksum (des images) - DWORD fnCount; // Compteur d'utilisations - DWORD fnSize; // Taille sans l'entete + DWORD fnCheckSum; // Checksum (des images) + DWORD fnCount; // Compteur d'utilisations + DWORD fnSize; // Taille sans l'entete LOGFONTA fnLf; // Header font (pour CreateFont si Windows font) } FontA; typedef FontA *npFontA; @@ -433,7 +436,7 @@ typedef Box *fpBox; typedef struct tagSMI { UINT totalBitCount; // I.e. 16 UINT usedBitCount; // I.e. 15 - UINT mainMode; // SM_4, SM_8, SM_etc... avec flags SM_DDRAW + UINT mainMode; // SM_4, SM_8, SM_etc... avec flags SM_D3D, etc UINT subMode; // sous-mode DWORD rMask; DWORD gMask; @@ -470,7 +473,7 @@ typedef struct tagSMI { #define APPF_GLOBALSOUNDS 0x0004 // Objet sprite -#define SF_RAMBO 0x00000001 // flag "rentre dans tout le monde" +#define SF_RAMBO 0x00000001 // flag "rentre dans tout le monde" #define SF_RECALCSURF 0x00000002 // Recalc surface (if rotation or stretch) #define SF_PRIVATE 0x00000004 // flag privé utilisé par le runtime pour la destruction des fade #define SF_INACTIF 0x00000008 // flag "inactif" = reaffichage ssi intersection avec un autre @@ -497,6 +500,7 @@ typedef struct tagSMI { #define SF_OWNERCOLMASK 0x00800000 // Owner-draw sprite supports collision masks #define SF_UPDATECOLLIST 0x10000000 +#define SF_HWA 0x20000000 // SpriteCol_TestPoint / SpriteCol_TestSprite #define SCF_OBSTACLE 0x01 @@ -504,6 +508,7 @@ typedef struct tagSMI { #define SCF_EVENNOCOL 0x04 // Flag: returns even sprites that haven't the SF_RAMBO flag #define SCF_BACKGROUND 0x08 // Flag: if 0, returns active sprites, otherwise returns background sprites #define SCF_TESTFEET 0x10 // Test only the bottom of the sprite +#define SCF_TESTLIST 0x20 #define LAYER_ALL (-1) @@ -536,11 +541,11 @@ enum { #ifndef _dllpriv_h typedef struct tagObj { - UINT objSize; // Taille de l'objet: 0 = fin objets - UINT objPrevSize; // Taille objet precedent (0 = 1er objet) - UINT objType; // Type d'objet (1=vide,2=appli,3=fenetre,...) - UINT objPrev; // Adresse objet precedent de meme type (0 = first) - UINT objNext; // Adresse objet suivant de meme type (0 = last) + UINT objSize; // Taille de l'objet: 0 = fin objets + UINT objPrevSize; // Taille objet precedent (0 = 1er objet) + UINT objType; // Type d'objet (1=vide,2=appli,3=fenetre,...) + UINT objPrev; // Adresse objet precedent de meme type (0 = first) + UINT objNext; // Adresse objet suivant de meme type (0 = last) } Obj; typedef Obj *npObj; typedef Obj *fpObj; @@ -562,18 +567,29 @@ class Spr typedef struct Spr { #endif -#ifndef SPRLIST - Obj sprObj; -#endif + #ifndef SPRLIST + Obj sprObj; + #endif DWORD sprFlags; // Flags WORD sprLayer; // Sprite plane (layer) - short sprAngle; // Angle + WORD sprUnused; // Angle (Int format) .. int sprZOrder; // Z-order value // Coordinates int sprX; int sprY; + // Hot spot and dimensions + int sprHotSpotX; // TODO: mettre en commentaires ceux qui ne sont pas utilisés + int sprHotSpotY; + int sprWidth; + int sprHeight; + + // Scale & Angle + float sprScaleX; + float sprScaleY; + ANGLETYPE sprAngle; + // Bounding box int sprX1; int sprY1; @@ -584,6 +600,17 @@ typedef struct Spr int sprXnew; int sprYnew; + // New hot spot and dimensions + int sprHotSpotXnew; + int sprHotSpotYnew; + int sprWidthNew; + int sprHeightNew; + + // New scale & angle + float sprScaleXnew; + float sprScaleYnew; + ANGLETYPE sprAngleNew; + // New bounding box int sprX1new; int sprY1new; @@ -597,20 +624,20 @@ typedef struct Spr int sprY2z; // Scale & Angle - float sprScaleX; - float sprScaleY; +// float sprScaleX; +// float sprScaleY; // Temporary values for collisions - WORD sprTempImg; // TODO: use DWORD later? - short sprTempAngle; - float sprTempScaleX; - float sprTempScaleY; +// WORD sprTempImg; // TODO: use DWORD later? +// short sprTempAngleInt; +// float sprTempScaleX; +// float sprTempScaleY; // Image or owner-draw routine union { struct { - DWORD sprImg; // Numero d'image - DWORD sprImgNew; // Nouvelle image + DWORD sprImg; // Numero d'image + DWORD sprImgNew; // Nouvelle image }; LPARAM sprRout; // Ownerdraw callback routine }; @@ -626,10 +653,10 @@ typedef struct Spr cSurfaceImplementation* sprBackSurf; // Background surface, if no general background surface cSurfaceImplementation* sprSf; // Surface (if stretched or rotated) - sMask* sprColMask; // Collision mask (if stretched or rotated) +// sMask* sprColMask; // Collision mask (if stretched or rotated) - cSurfaceImplementation* sprTempSf; // Temp surface (if stretched or rotated) - sMask* sprTempColMask; // Temp collision mask (if stretched or rotated) +// cSurfaceImplementation* sprTempSf; // Temp surface (if stretched or rotated) +// sMask* sprTempColMask; // Temp collision mask (if stretched or rotated) // User data LPARAM sprExtraInfo; @@ -651,6 +678,7 @@ typedef struct Spr typedef Spr *npSpr; typedef Spr *fpSpr; + // Structure "taille d'une appli" typedef struct tagAppSize { DWORD asInternal; // Place occupee dans le segment DLL @@ -798,14 +826,14 @@ DLLExport32 LRESULT CALLBACK DefMsgProcW (HWND hWin, UINT uMsg, WPARAM wParam, L // Menus // ----- -DLLExport32 HMENU WINAPI WinSetMenu (npWin, HMENU, HACCEL); -//DLLExport32 void WINAPI WinSetAccel (npWin, HACCEL); +DLLExport32 HMENU WINAPI WinSetMenu (npWin, HMENU, HACCEL); +//DLLExport32 void WINAPI WinSetAccel (npWin, HACCEL); // Souris // ------ -DLLExport32 HCURSOR WINAPI WinSetMouse (npWin, HCURSOR); -DLLExport32 void WINAPI WinStartWait (npWin); -DLLExport32 void WINAPI WinEndWait (npWin); +DLLExport32 HCURSOR WINAPI WinSetMouse (npWin, HCURSOR); +DLLExport32 void WINAPI WinStartWait (npWin); +DLLExport32 void WINAPI WinEndWait (npWin); // Events // ------ @@ -912,18 +940,19 @@ DLLExport32 long WINAPI DelImage (npAppli, DWORD); DLLExport32 sMask* WINAPI AddMask (npAppli ptApp, DWORD iNum, UINT nFlags); DLLExport32 long WINAPI DelMask (npAppli, DWORD); DLLExport32 int WINAPI GetImageInfos (npAppli, DWORD, fpImg); -DLLExport32 int WINAPI GetImageInfoEx (npAppli pApp, DWORD nImage, int nAngle, float fScaleX, float fScaleY, fpImg pIfo); +DLLExport32 int WINAPI GetImageInfoEx (npAppli pApp, DWORD nImage, ANGLETYPE nAngle, float fScaleX, float fScaleY, fpImg pIfo); DLLExport32 DWORD WINAPI GetImageSize (WORD, WORD, WORD); DLLExport32 sMask* WINAPI GetImageMask (npAppli ptApp, DWORD dwImage, UINT nFlags); DLLExport32 sMask* WINAPI CompleteSpriteColMask (npWin ptrWin, npSpr ptSpr, DWORD dwPSCFlags, UINT nWidth, UINT nHeight); -DLLExport32 DWORD WINAPI PrepareSpriteColMask (npWin ptrWin, npSpr ptSpr, DWORD newImg, int newX, int newY, int newAngle, float newScaleX, float newScaleY, RECT* prc, sMask** ppMask); +DLLExport32 DWORD WINAPI PrepareSpriteColMask (npWin ptrWin, npSpr ptSpr, DWORD newImg, int newX, int newY, ANGLETYPE newAngle, float newScaleX, float newScaleY, RECT* prc, sMask** ppMask); +DLLExport32 void WINAPI DelImageTexture (npAppli ptApp, DWORD iNum); // Sprites // ------- DLLExport32 npSpr WINAPI AddSprite (npWin ptrWin, int xSpr, int ySpr, DWORD iSpr, WORD wLayer, int nZOrder, DWORD backSpr, DWORD sFlags, LPARAM extraInfo); DLLExport32 npSpr WINAPI AddOwnerDrawSprite (npWin ptrWin, int x1, int y1, int x2, int y2, WORD wLayer, int nZOrder, DWORD backSpr, DWORD sFlags, LPARAM extraInfo, LPARAM sprProc); DLLExport32 npSpr WINAPI ModifSprite (npWin ptrWin, npSpr ptSpr, int xSpr, int ySpr, DWORD iSpr); -DLLExport32 npSpr WINAPI ModifSpriteEx (npWin ptrWin, npSpr ptSpr, int xSpr, int ySpr, DWORD iSpr, float fScaleX, float fScaleY, BOOL bResample, int nAngle, BOOL bAntiA); +DLLExport32 npSpr WINAPI ModifSpriteEx (npWin ptrWin, npSpr ptSpr, int xSpr, int ySpr, DWORD iSpr, float fScaleX, float fScaleY, BOOL bResample, ANGLETYPE nAngle, BOOL bAntiA); DLLExport32 npSpr WINAPI ModifSpriteEffect (npWin ptrWin, npSpr ptSpr, DWORD effect, LPARAM effectParam); DLLExport32 npSpr WINAPI ModifOwnerDrawSprite (npWin ptrWin, npSpr ptSprModif, int x1, int y1, int x2, int y2); DLLExport32 void WINAPI ShowSprite (npWin, npSpr, int); @@ -941,9 +970,10 @@ DLLExport32 void WINAPI ScreenUpdate (npWin); DLLExport32 void WINAPI GetSpriteScale (npWin ptrWin, npSpr ptSpr, float* pScaleX, float* pScaleY, BOOL* pResample); DLLExport32 void WINAPI SetSpriteScale (npWin ptrWin, npSpr ptSpr, float fScaleX, float fScaleY, BOOL bResample); -DLLExport32 int WINAPI GetSpriteAngle (npWin ptrWin, npSpr ptSpr, BOOL* pAntiA); -DLLExport32 void WINAPI SetSpriteAngle (npWin ptrWin, npSpr ptSpr, int nAngle, BOOL bAntiA); +DLLExport32 ANGLETYPE WINAPI GetSpriteAngle (npWin ptrWin, npSpr ptSpr, BOOL* pAntiA); +DLLExport32 void WINAPI SetSpriteAngle (npWin ptrWin, npSpr ptSpr, ANGLETYPE nAngle, BOOL bAntiA); DLLExport32 void WINAPI GetSpriteRect (npWin ptrWin, npSpr ptSpr, RECT* prc); +DLLExport32 void WINAPI GetSpriteRectNew (npWin ptrWin, npSpr ptSpr, RECT* prc); DLLExport32 void WINAPI MoveSpriteToFront(npWin ptrWin, npSpr pSpr); DLLExport32 void WINAPI MoveSpriteToBack (npWin ptrWin, npSpr pSpr); DLLExport32 void WINAPI MoveSpriteBefore (npWin ptrWin, npSpr pSprToMove, npSpr pSprDest); @@ -976,17 +1006,17 @@ DLLExport32 void WINAPI WinEnableUpdate (npWin, int); DLLExport32 DWORD WINAPI SetSpriteColFlag (npWin, npSpr, DWORD); // UINT = SF_xxxx DLLExport32 npSpr WINAPI SpriteCol_TestPoint (npWin, npSpr, int, int, int, DWORD); // Entre 1 pixel et les sprites sauf un DLLExport32 npSpr WINAPI SpriteCol_TestRect (npWin, npSpr, int, int, int, int, int, DWORD); // Entre 1 rectangle et les sprites sauf un -DLLExport32 npSpr WINAPI SpriteCol_TestSprite (npWin ptrWin, npSpr ptSpr, DWORD newImg, int newX, int newY, int newAngle, float newScaleX, float newScaleY, int subHt, DWORD dwFlags); -DLLExport32 UINT WINAPI SpriteCol_TestSprite_All (npWin, npSpr, LPVOID*, DWORD, int, int, int, float, float, DWORD); -DLLExport32 int WINAPI WinSetColMode (npWin, WORD); // Mode BOX ou BITMAP +DLLExport32 npSpr WINAPI SpriteCol_TestSprite (npWin ptrWin, npSpr ptSpr, DWORD newImg, int newX, int newY, ANGLETYPE newAngle, float newScaleX, float newScaleY, int subHt, DWORD dwFlags); +DLLExport32 UINT WINAPI SpriteCol_TestSprite_All (npWin, npSpr, LPVOID*, DWORD, int, int, ANGLETYPE, float, float, DWORD); +DLLExport32 int WINAPI WinSetColMode (npWin, WORD); // Mode BOX ou BITMAP DLLExport32 BOOL WINAPI ColMask_Create (npWin, UINT, UINT, DWORD); // Creation bitmap masque fond DLLExport32 BOOL WINAPI ColMask_CreateEx (npWin, int, int, int, int, DWORD); -DLLExport32 void WINAPI ColMask_Kill (npWin); // Destruction masque fond -DLLExport32 void WINAPI ColMask_Fill (npWin, DWORD); // Init masque fond -DLLExport32 int WINAPI ColMask_FillRectangle (npWin, int, int, int, int, DWORD); +DLLExport32 void WINAPI ColMask_Kill (npWin); // Destruction masque fond +DLLExport32 void WINAPI ColMask_Fill (npWin, DWORD); // Init masque fond +DLLExport32 int WINAPI ColMask_FillRectangle (npWin, int, int, int, int, DWORD); DLLExport32 void WINAPI ColMask_OrImage (npWin, DWORD, int, int, DWORD); -DLLExport32 void WINAPI ColMask_OrMask (npWin, sMask*, int, int, DWORD, DWORD); +DLLExport32 void WINAPI ColMask_OrMask (npWin, sMask*, int, int, DWORD, DWORD); DLLExport32 void WINAPI ColMask_OrPlatform (npWin, DWORD, int, int); DLLExport32 void WINAPI ColMask_OrPlatformMask (npWin, sMask*, int, int); DLLExport32 int WINAPI ColMask_Scroll (npWin, int, int, RECT *, RECT *); @@ -995,8 +1025,8 @@ DLLExport32 void WINAPI ColMask_ToLog (npWin ptrWin, UINT nPlane); DLLExport32 void WINAPI ColMask_SetClip (npWin, RECT *); DLLExport32 BOOL WINAPI ColMask_TestPoint (npWin ptrWin, int x, int y, UINT nPlane); -DLLExport32 BOOL WINAPI ColMask_TestSprite (npWin ptrWin, npSpr pSpr, int newImg, int newX, int newY, int newAngle, float newScaleX, float newScaleY, int subHt, UINT nPlane); -DLLExport32 int WINAPI ColMask_TestRect (npWin, int, int, int, int, UINT nPlane); +DLLExport32 BOOL WINAPI ColMask_TestSprite (npWin ptrWin, npSpr pSpr, int newImg, int newX, int newY, ANGLETYPE newAngle, float newScaleX, float newScaleY, int subHt, UINT nPlane); +DLLExport32 int WINAPI ColMask_TestRect (npWin, int, int, int, int, UINT nPlane); DLLExport32 BOOL WINAPI Mask_TestPoint (LPBYTE pMask, int x, int y, int nMaskWidth, int nMaskHeight); DLLExport32 BOOL WINAPI Mask_TestMask (LPBYTE pMaskBits1, LPBYTE pMaskBits2, int x1Spr1, int y1Spr1, int wSpr1, int hSpr1, int x1Spr2, int y1Spr2, int wSpr2, int hSpr2); @@ -1029,6 +1059,9 @@ DLLExport32 void WINAPI DelPalette (HCSPALETTE pCsPal); DLLExport32 void WINAPI SetAppCSPalette (npAppli ptrApp, HPALETTE hpal, HCSPALETTE pCsPal); DLLExport32 HCSPALETTE WINAPI GetAppCSPalette (npAppli ptrApp); + // HWA +DLLExport32 void WINAPI WinSizeChanged ( npWin ptrWin ); + // Sounds #ifdef __cplusplus @@ -1075,20 +1108,21 @@ DLLExport32 void WINAPI SetSndFreq (npAppli ptApp, UINT sType, UINT sNum, DWORD DLLExport32 DWORD WINAPI GetSndChannelFreq (npAppli ptApp, UINT nChannel); DLLExport32 DWORD WINAPI GetSndFreq (npAppli ptApp, UINT sType, UINT sNum); -DLLExport32 UINT WINAPI AddSoundA (npAppli, UINT, LPSTR, LPBYTE, DWORD); +DLLExport32 UINT WINAPI AddSoundA (npAppli, UINT, LPSTR, LPBYTE, DWORD); DLLExport32 UINT WINAPI ReplaceSoundA (npAppli ptApp, UINT sFlags, UINT nSound, LPSTR fpName, LPBYTE lpData, DWORD dwDataSize); DLLExport32 BOOL WINAPI SetSoundFlags (npAppli ptApp, UINT nSound, UINT sFlags); DLLExport32 DWORD WINAPI IncSoundCount (npAppli, UINT); -DLLExport32 int WINAPI GetSoundInfoA (npAppli, UINT, fpSound); +DLLExport32 int WINAPI GetSoundInfoA (npAppli, UINT, fpSound); DLLExport32 int WINAPI GetSoundNameA (npAppli, UINT, LPSTR, UINT); DLLExport32 long WINAPI GetSoundData (npAppli, UINT, LPBYTE); DLLExport32 LPBYTE WINAPI GetSoundDataPtr (npAppli, UINT); DLLExport32 long WINAPI DelSound (npAppli, UINT); -DLLExport32 UINT WINAPI AddSoundW (npAppli, UINT, LPWSTR, LPBYTE, DWORD); +DLLExport32 int WINAPI WaveSetChannels (npAppli ptApp, int nChannels); +DLLExport32 UINT WINAPI AddSoundW (npAppli, UINT, LPWSTR, LPBYTE, DWORD); DLLExport32 UINT WINAPI ReplaceSoundW (npAppli ptApp, UINT sFlags, UINT nSound, LPWSTR fpName, LPBYTE lpData, DWORD dwDataSize); DLLExport32 int WINAPI GetSoundNameW (npAppli, UINT, LPWSTR, UINT); -DLLExport32 int WINAPI GetSoundInfoW (npAppli, UINT, fpSound); +DLLExport32 int WINAPI GetSoundInfoW (npAppli, UINT, fpSound); #ifdef _UNICODE #define AddSound AddSoundW @@ -1106,7 +1140,50 @@ DLLExport32 int WINAPI GetSoundInfoW (npAppli, UINT, fpSound); #define PlaySnd PlaySndA #endif -DLLExport32 int WINAPI WaveSetChannels (npAppli ptApp, int nChannels); +// Layer functions +// Layer +#ifdef __cplusplus +class WinLayer +{ +public: +#else +typedef struct WinLayer +{ +#endif + // Structure size + DWORD layerSize; + + // Effect + DWORD layerEffect; + LPARAM layerEffectParam; + + // Options + DWORD dwLayerOptions; + + // Scale & angle + float xScale; + float yScale; + float scale; // not used for display + float angle; + + // Hotspot + POINT hotSpot; + + // Destination point + POINT destPoint; + +#ifdef __cplusplus +}; +#else +} WinLayer; +#endif + +// Layer options +#define WLF_PREVIOUSEFFECT 1 + +DLLExport32 void WINAPI WinCreateLayers (npWin ptrWin, int nLayers); +DLLExport32 void WINAPI WinSetLayerEffect (npWin ptrWin, int nLayer, DWORD dwEffect, LPARAM dwEffectParam, DWORD dwOptions); +DLLExport32 WinLayer* WINAPI WinGetLayerAt (npWin ptrWin, int nLayer); #ifdef __cplusplus } @@ -1132,6 +1209,7 @@ enum { WSURF_BACKSAVE }; DLLExport32 cSurface * WINAPI WinGetSurface (int idWin, int surfID=WSURF_LOGSCREEN); +DLLExport32 void WINAPI WinSetCurrent (int idWin); #endif // __cplusplus #endif // !defined(_H2INC) diff --git a/Inc/FilterMgr.h b/Inc/FilterMgr.h index 57a488a..c265eb7 100644 --- a/Inc/FilterMgr.h +++ b/Inc/FilterMgr.h @@ -17,8 +17,6 @@ class CInputFile; // Filter Manager base class // -#define FILTERID_PNG DWORDSTR('P','N','G',' ') - // Filter Manager class STDDLL_API CFilterMgr { diff --git a/Inc/ImageFlt.h b/Inc/ImageFlt.h index e9170b8..607bd0d 100644 --- a/Inc/ImageFlt.h +++ b/Inc/ImageFlt.h @@ -104,7 +104,7 @@ class IMGFLTMGR_API CImageFilter public: // Constructeur / destructeur CImageFilter(CImageFilterMgr* pMgr); - ~CImageFilter(); + ~CImageFilter(); // Customisation BOOL UseSpecificFilterIndex(int index); diff --git a/Inc/ImgFlt.h b/Inc/ImgFlt.h index 574459d..4197528 100644 --- a/Inc/ImgFlt.h +++ b/Inc/ImgFlt.h @@ -4,24 +4,22 @@ // Image filters #define IMPORT_IMAGE_USESURFACEDEPTH 0x0001 #define IMPORT_IMAGE_USESURFACEPALETTE 0x0002 + #define IMPORT_IMAGE_FIRSTPIXELTRANSP 0x0004 #define IMPORT_IMAGE_OPAQUE 0x0008 -DLLExport32 BOOL WINAPI ImportImageFromInputFile(CImageFilterMgr* pImgMgr, CInputFile* pf, cSurface* psf, LPDWORD pDWFilterID, DWORD dwFlags); -DLLExport32 BOOL WINAPI GetNextAnimationFrame(CImageFilterMgr* pImgMgr, cSurface* psf, CImageFilter* pFilter); -DLLExport32 void WINAPI EndAnimationImport(CImageFilterMgr* pImgMgr, CImageFilter* pFilter); -DLLExport32 BOOL WINAPI ExportNextFrame(CImageFilterMgr* pImgMgr, cSurface* psf, CImageFilter* pFilter, int msFrameDuration); -DLLExport32 void WINAPI EndAnimationExport(CImageFilterMgr* pImgMgr, CImageFilter* pFilter); - -#ifdef _UNICODE - DLLExport32 BOOL WINAPI ImportImageA(CImageFilterMgr* pImgMgr, LPCSTR fileName, cSurface* psf, LPDWORD pDWFilterID, DWORD dwFlags); +DLLExport32 BOOL WINAPI ImportImageFromInputFile(CImageFilterMgr* pImgMgr, CInputFile* pf, cSurface* psf, LPDWORD pDWFilterID, DWORD dwFlags); DLLExport32 BOOL WINAPI CanImportImageA(CImageFilterMgr* pImgMgr, LPCSTR fileName); DLLExport32 BOOL WINAPI ImportPaletteA(CImageFilterMgr* pImgMgr, LPCSTR fileName, LPLOGPALETTE pPal); DLLExport32 BOOL WINAPI ExportImageA(CImageFilterMgr* pImgMgr, LPCSTR pFileName, cSurface* psf, DWORD dwFilterID); DLLExport32 BOOL WINAPI CanImportAnimationA(CImageFilterMgr* pImgMgr, LPCSTR fileName, BOOL* bNeedConversion); DLLExport32 BOOL WINAPI BeginAnimationImportA(CImageFilterMgr* pImgMgr, LPCSTR pFileName, cSurface* psf, CImageFilter* pFilter, DWORD dwFlags); +DLLExport32 BOOL WINAPI GetNextAnimationFrame(CImageFilterMgr* pImgMgr, cSurface* psf, CImageFilter* pFilter); +DLLExport32 void WINAPI EndAnimationImport(CImageFilterMgr* pImgMgr, CImageFilter* pFilter); DLLExport32 BOOL WINAPI BeginAnimationExportA(CImageFilterMgr* pImgMgr, LPCSTR pFileName, cSurface* psf, CImageFilter* pFilter, int nFrames, int msFrameDuration, int nLoopCount, int nLoopFrame); +DLLExport32 BOOL WINAPI ExportNextFrame(CImageFilterMgr* pImgMgr, cSurface* psf, CImageFilter* pFilter, int msFrameDuration); +DLLExport32 void WINAPI EndAnimationExport(CImageFilterMgr* pImgMgr, CImageFilter* pFilter); DLLExport32 BOOL WINAPI ImportImageW(CImageFilterMgr* pImgMgr, LPCWSTR fileName, cSurface* psf, LPDWORD pDWFilterID, DWORD dwFlags); DLLExport32 BOOL WINAPI CanImportImageW(CImageFilterMgr* pImgMgr, LPCWSTR fileName); @@ -31,6 +29,7 @@ DLLExport32 BOOL WINAPI CanImportAnimationW(CImageFilterMgr* pImgMgr, LPCWSTR fi DLLExport32 BOOL WINAPI BeginAnimationImportW(CImageFilterMgr* pImgMgr, LPCWSTR pFileName, cSurface* psf, CImageFilter* pFilter, DWORD dwFlags); DLLExport32 BOOL WINAPI BeginAnimationExportW(CImageFilterMgr* pImgMgr, LPCWSTR pFileName, cSurface* psf, CImageFilter* pFilter, int nFrames, int msFrameDuration, int nLoopCount, int nLoopFrame); +#ifdef _UNICODE #define ImportImage ImportImageW #define CanImportImage CanImportImageW #define ImportPalette ImportPaletteW @@ -38,25 +37,14 @@ DLLExport32 BOOL WINAPI BeginAnimationExportW(CImageFilterMgr* pImgMgr, LPCWSTR #define CanImportAnimation CanImportAnimationW #define BeginAnimationImport BeginAnimationImportW #define BeginAnimationExport BeginAnimationExportW - #else - -DLLExport32 BOOL WINAPI ImportImage(CImageFilterMgr* pImgMgr, LPCSTR fileName, cSurface* psf, LPDWORD pDWFilterID, DWORD dwFlags); -DLLExport32 BOOL WINAPI CanImportImage(CImageFilterMgr* pImgMgr, LPCSTR fileName); -DLLExport32 BOOL WINAPI ImportPalette(CImageFilterMgr* pImgMgr, LPCSTR fileName, LPLOGPALETTE pPal); -DLLExport32 BOOL WINAPI ExportImage(CImageFilterMgr* pImgMgr, LPCSTR pFileName, cSurface* psf, DWORD dwFilterID); -DLLExport32 BOOL WINAPI CanImportAnimation(CImageFilterMgr* pImgMgr, LPCSTR fileName, BOOL* bNeedConversion); -DLLExport32 BOOL WINAPI BeginAnimationImport(CImageFilterMgr* pImgMgr, LPCSTR pFileName, cSurface* psf, CImageFilter* pFilter, DWORD dwFlags); -DLLExport32 BOOL WINAPI BeginAnimationExport(CImageFilterMgr* pImgMgr, LPCSTR pFileName, cSurface* psf, CImageFilter* pFilter, int nFrames, int msFrameDuration, int nLoopCount, int nLoopFrame); - -#define ImportImageA ImportImage -#define CanImportImageA CanImportImage -#define ImportPaletteA ImportPalette -#define ExportImageA ExportImage -#define CanImportAnimationA CanImportAnimation -#define BeginAnimationImportA BeginAnimationImport -#define BeginAnimationExportA BeginAnimationExport - +#define ImportImage ImportImageA +#define CanImportImage CanImportImageA +#define ImportPalette ImportPaletteA +#define ExportImage ExportImageA +#define CanImportAnimation CanImportAnimationA +#define BeginAnimationImport BeginAnimationImportA +#define BeginAnimationExport BeginAnimationExportA #endif // Picture selector diff --git a/Inc/Mvt.h b/Inc/Mvt.h index 1685210..4348df8 100644 --- a/Inc/Mvt.h +++ b/Inc/Mvt.h @@ -128,6 +128,7 @@ typedef CMvt * LPMVT; // #define RUNMVT_VERSION_1 0x0001 +#define RUNMVT_VERSION_2 0x0002 // GetDir + Debugger functions /** * Movement Data at runtime. @@ -149,7 +150,7 @@ class CRunMvt { virtual void Delete(void) { delete this; } // Version - virtual int GetVersion() { return RUNMVT_VERSION_1; } + virtual int GetVersion() { return RUNMVT_VERSION_2; } virtual BOOL Move(LPHO pHo) { return FALSE; } virtual void SetPosition(LPHO pHo, int x, int y) {} @@ -175,6 +176,14 @@ class CRunMvt { virtual int GetDeceleration(LPHO hoPtr) {return 0;} virtual int GetGravity(LPHO hoPtr) {return 0;} + // Version 2 + virtual int GetDir(LPHO hoPtr) {return 0;} + + // Debugger + virtual LPWORD GetDebugTree() { return NULL; } + virtual void GetDebugItem(LPTSTR pBuffer, int id) {} + virtual void EditDebugItem(int id) {} + // End of public interface ////////////////////////// diff --git a/Inc/Props.h b/Inc/Props.h index fee0ae1..15b1165 100644 --- a/Inc/Props.h +++ b/Inc/Props.h @@ -10,8 +10,8 @@ typedef struct PropData { int dwID; // Identifier - UINT_PTR sName; // Name = ID of the property name in the resources, or LPCSTR - UINT_PTR sInfo; // Info = ID of the property description in the resources, or LPCSTR + UINT_PTR sName; // Name = ID of the property name in the resources, or LPCSTR / LPCTSTR + UINT_PTR sInfo; // Info = ID of the property description in the resources, or LPCSTR / LPCTSTR UINT_PTR lType; // Property type, or pointer to CPropItem (custom properties) DWORD dwOptions; // Options (check box, bold, etc) LPARAM lCreateParam; // Parameter @@ -293,16 +293,14 @@ class CPropAStringValue : public CPropValue m_pStr = _strdup(pStr); m_unused = 0; } - CPropAStringValue(LPCWSTR pWStr) { + CPropAStringValue(LPCWSTR pWStr, UINT codePage = CP_ACP) { if ( pWStr == NULL ) m_pStr = _strdup(""); else { - // m_pStr = _strdup(pStr); - int lg = wcslen(pWStr); - m_pStr = (LPSTR)calloc(lg+1, 1); // TODO : change that if we use something else than CP_ACP - WideCharToMultiByte(CP_ACP, 0, pWStr, lg, m_pStr, lg, NULL, NULL); - m_pStr[lg] = 0; + int lg = WideCharToMultiByte(codePage, 0, pWStr, -1, 0, 0, NULL, NULL); + m_pStr = (LPSTR)calloc(lg+1, 1); // +1 = security if lg = 0 for some reason + WideCharToMultiByte(codePage, 0, pWStr, -1, m_pStr, lg, NULL, NULL); } m_unused = 0; } @@ -349,16 +347,14 @@ class CPropWStringValue : public CPropValue m_pWStr = _wcsdup(pWStr); m_unused = 0; } - CPropWStringValue(LPCSTR pStr) { + CPropWStringValue(LPCSTR pStr, UINT codePage = CP_ACP) { if ( pStr == NULL ) m_pWStr = _wcsdup(L""); else { - // m_pStr = _strdup(pStr); - int lg = strlen(pStr); - m_pWStr = (LPWSTR)calloc(lg+1, sizeof(wchar_t)); - MultiByteToWideChar(CP_ACP, 0, pStr, lg, m_pWStr, lg); - m_pWStr[lg] = 0; + int lg = MultiByteToWideChar(codePage, 0, pStr, -1, 0, 0); + m_pWStr = (LPWSTR)calloc(lg+1, sizeof(wchar_t)); // +1 = security if lg = 0 for some reason + MultiByteToWideChar(codePage, 0, pStr, -1, m_pWStr, lg); } m_unused = 0; } @@ -440,13 +436,13 @@ typedef struct CustomPropCreateStruct { // Tells property window to validate the property item // => the property window gets the property value from the property item -// and applies it to the other selected items +// and applies it to the other selected items #define PWN_VALIDATECUSTOMITEM (PWN_FIRST-1) // Parameter structure for the PWN_VALIDATECUSTOMITEM notification message typedef struct _NMPROPWND { - NMHDR hdr; + NMHDR hdr; CCustomProp* pCP; } NMPROPWND, *PNMPROPWND, FAR *LPNMPROPWND; @@ -480,35 +476,125 @@ typedef struct _NMPROPWND * List of property types. */ enum { - PROPTYPE_STATIC = 1, //! Simple static text - PROPTYPE_FOLDER, //! Folder - PROPTYPE_FOLDER_END, //! Folder End - PROPTYPE_EDITBUTTON, //! Edit button, param1 = button text, or NULL if Edit - PROPTYPE_EDIT_STRING, //! Edit box for strings, parameter = max length - PROPTYPE_EDIT_NUMBER, //! Edit box for numbers, parameters = min value, max value - PROPTYPE_COMBOBOX, //! Combo box, parameters = list of strings, options (sorted, etc) - PROPTYPE_SIZE, //! Size - PROPTYPE_COLOR, //! Color - PROPTYPE_LEFTCHECKBOX, //! Checkbox - PROPTYPE_SLIDEREDIT, //! Edit + Slider - PROPTYPE_SPINEDIT, //! Edit + Spin - PROPTYPE_DIRCTRL, //! Direction Selector - PROPTYPE_GROUP, //! Group - PROPTYPE_LISTBTN, //! Internal, do not use - PROPTYPE_FILENAME, //! Edit box + browse file button, parameter = FilenameCreateParam - PROPTYPE_FONT, //! Font dialog box - PROPTYPE_CUSTOM, //! Custom property - PROPTYPE_PICTUREFILENAME, //! Edit box + browse image file button - PROPTYPE_COMBOBOXBTN, //! Combo box, parameters = list of strings, options (sorted, etc) - PROPTYPE_EDIT_FLOAT, //! Edit box for floating point numbers, parameters = min value, max value, options (signed, float, spin) - PROPTYPE_EDIT_MULTILINE, //! Edit box for multiline texts, no parameter - PROPTYPE_IMAGELIST, //! Image list - PROPTYPE_ICONCOMBOBOX, //! Combo box with icons - PROPTYPE_URLBUTTON, //! URL button - PROPTYPE_DIRECTORYNAME, //! Directory pathname - PROPTYPE_SPINEDITFLOAT, //! Edit + Spin, value = floating point number + PROPTYPE_STATIC_A = 1, //! Simple static text + PROPTYPE_FOLDER_A, //! Folder + PROPTYPE_FOLDER_END_A, //! Folder End + PROPTYPE_EDITBUTTON_A, //! Edit button, param1 = button text, or NULL if Edit + PROPTYPE_EDIT_STRING_A, //! Edit box for strings, parameter = max length + PROPTYPE_EDIT_NUMBER_A, //! Edit box for numbers, parameters = min value, max value + PROPTYPE_COMBOBOX_A, //! Combo box, parameters = list of strings, options (sorted, etc) + PROPTYPE_SIZE_A, //! Size + PROPTYPE_COLOR_A, //! Color + PROPTYPE_LEFTCHECKBOX_A, //! Checkbox + PROPTYPE_SLIDEREDIT_A, //! Edit + Slider + PROPTYPE_SPINEDIT_A, //! Edit + Spin + PROPTYPE_DIRCTRL_A, //! Direction Selector + PROPTYPE_GROUP_A, //! Group + PROPTYPE_LISTBTN_A, //! Internal, do not use + PROPTYPE_FILENAME_A, //! Edit box + browse file button, parameter = FilenameCreateParam + PROPTYPE_FONT_A, //! Font dialog box + PROPTYPE_CUSTOM_A, //! Custom property + PROPTYPE_PICTUREFILENAME_A, //! Edit box + browse image file button + PROPTYPE_COMBOBOXBTN_A, //! Combo box, parameters = list of strings, options (sorted, etc) + PROPTYPE_EDIT_FLOAT_A, //! Edit box for floating point numbers, parameters = min value, max value, options (signed, float, spin) + PROPTYPE_EDIT_MULTILINE_A, //! Edit box for multiline texts, no parameter + PROPTYPE_IMAGELIST_A, //! Image list + PROPTYPE_ICONCOMBOBOX_A, //! Combo box with icons + PROPTYPE_URLBUTTON_A, //! URL button + PROPTYPE_DIRECTORYNAME_A, //! Directory pathname + PROPTYPE_SPINEDITFLOAT_A, //! Edit + Spin, value = floating point number + + PROPTYPE_STATIC_W = 1001, //! Simple static text + PROPTYPE_FOLDER_W, //! Folder + PROPTYPE_FOLDER_END_W, //! Folder End + PROPTYPE_EDITBUTTON_W, //! Edit button, param1 = button text, or NULL if Edit + PROPTYPE_EDIT_STRING_W, //! Edit box for strings, parameter = max length + PROPTYPE_EDIT_NUMBER_W, //! Edit box for numbers, parameters = min value, max value + PROPTYPE_COMBOBOX_W, //! Combo box, parameters = list of strings, options (sorted, etc) + PROPTYPE_SIZE_W, //! Size + PROPTYPE_COLOR_W, //! Color + PROPTYPE_LEFTCHECKBOX_W, //! Checkbox + PROPTYPE_SLIDEREDIT_W, //! Edit + Slider + PROPTYPE_SPINEDIT_W, //! Edit + Spin + PROPTYPE_DIRCTRL_W, //! Direction Selector + PROPTYPE_GROUP_W, //! Group + PROPTYPE_LISTBTN_W, //! Internal, do not use + PROPTYPE_FILENAME_W, //! Edit box + browse file button, parameter = FilenameCreateParam + PROPTYPE_FONT_W, //! Font dialog box + PROPTYPE_CUSTOM_W, //! Custom property + PROPTYPE_PICTUREFILENAME_W, //! Edit box + browse image file button + PROPTYPE_COMBOBOXBTN_W, //! Combo box, parameters = list of strings, options (sorted, etc) + PROPTYPE_EDIT_FLOAT_W, //! Edit box for floating point numbers, parameters = min value, max value, options (signed, float, spin) + PROPTYPE_EDIT_MULTILINE_W, //! Edit box for multiline texts, no parameter + PROPTYPE_IMAGELIST_W, //! Image list + PROPTYPE_ICONCOMBOBOX_W, //! Combo box with icons + PROPTYPE_URLBUTTON_W, //! URL button + PROPTYPE_DIRECTORYNAME_W, //! Directory pathname + PROPTYPE_SPINEDITFLOAT_W, //! Edit + Spin, value = floating point number }; +#ifdef _UNICODE + +#define PROPTYPE_STATIC PROPTYPE_STATIC_W +#define PROPTYPE_FOLDER PROPTYPE_FOLDER_W +#define PROPTYPE_FOLDER_END PROPTYPE_FOLDER_END_W +#define PROPTYPE_EDITBUTTON PROPTYPE_EDITBUTTON_W +#define PROPTYPE_EDIT_STRING PROPTYPE_EDIT_STRING_W +#define PROPTYPE_EDIT_NUMBER PROPTYPE_EDIT_NUMBER_W +#define PROPTYPE_COMBOBOX PROPTYPE_COMBOBOX_W +#define PROPTYPE_SIZE PROPTYPE_SIZE_W +#define PROPTYPE_COLOR PROPTYPE_COLOR_W +#define PROPTYPE_LEFTCHECKBOX PROPTYPE_LEFTCHECKBOX_W +#define PROPTYPE_SLIDEREDIT PROPTYPE_SLIDEREDIT_W +#define PROPTYPE_SPINEDIT PROPTYPE_SPINEDIT_W +#define PROPTYPE_DIRCTRL PROPTYPE_DIRCTRL_W +#define PROPTYPE_GROUP PROPTYPE_GROUP_W +#define PROPTYPE_LISTBTN PROPTYPE_LISTBTN_W +#define PROPTYPE_FILENAME PROPTYPE_FILENAME_W +#define PROPTYPE_FONT PROPTYPE_FONT_W +#define PROPTYPE_CUSTOM PROPTYPE_CUSTOM_W +#define PROPTYPE_PICTUREFILENAME PROPTYPE_PICTUREFILENAME_W +#define PROPTYPE_COMBOBOXBTN PROPTYPE_COMBOBOXBTN_W +#define PROPTYPE_EDIT_FLOAT PROPTYPE_EDIT_FLOAT_W +#define PROPTYPE_EDIT_MULTILINE PROPTYPE_EDIT_MULTILINE_W +#define PROPTYPE_IMAGELIST PROPTYPE_IMAGELIST_W +#define PROPTYPE_ICONCOMBOBOX PROPTYPE_ICONCOMBOBOX_W +#define PROPTYPE_URLBUTTON PROPTYPE_URLBUTTON_W +#define PROPTYPE_DIRECTORYNAME PROPTYPE_DIRECTORYNAME_W +#define PROPTYPE_SPINEDITFLOAT PROPTYPE_SPINEDITFLOAT_W + +#else + +#define PROPTYPE_STATIC PROPTYPE_STATIC_A +#define PROPTYPE_FOLDER PROPTYPE_FOLDER_A +#define PROPTYPE_FOLDER_END PROPTYPE_FOLDER_END_A +#define PROPTYPE_EDITBUTTON PROPTYPE_EDITBUTTON_A +#define PROPTYPE_EDIT_STRING PROPTYPE_EDIT_STRING_A +#define PROPTYPE_EDIT_NUMBER PROPTYPE_EDIT_NUMBER_A +#define PROPTYPE_COMBOBOX PROPTYPE_COMBOBOX_A +#define PROPTYPE_SIZE PROPTYPE_SIZE_A +#define PROPTYPE_COLOR PROPTYPE_COLOR_A +#define PROPTYPE_LEFTCHECKBOX PROPTYPE_LEFTCHECKBOX_A +#define PROPTYPE_SLIDEREDIT PROPTYPE_SLIDEREDIT_A +#define PROPTYPE_SPINEDIT PROPTYPE_SPINEDIT_A +#define PROPTYPE_DIRCTRL PROPTYPE_DIRCTRL_A +#define PROPTYPE_GROUP PROPTYPE_GROUP_A +#define PROPTYPE_LISTBTN PROPTYPE_LISTBTN_A +#define PROPTYPE_FILENAME PROPTYPE_FILENAME_A +#define PROPTYPE_FONT PROPTYPE_FONT_A +#define PROPTYPE_CUSTOM PROPTYPE_CUSTOM_A +#define PROPTYPE_PICTUREFILENAME PROPTYPE_PICTUREFILENAME_A +#define PROPTYPE_COMBOBOXBTN PROPTYPE_COMBOBOXBTN_A +#define PROPTYPE_EDIT_FLOAT PROPTYPE_EDIT_FLOAT_A +#define PROPTYPE_EDIT_MULTILINE PROPTYPE_EDIT_MULTILINE_A +#define PROPTYPE_IMAGELIST PROPTYPE_IMAGELIST_A +#define PROPTYPE_ICONCOMBOBOX PROPTYPE_ICONCOMBOBOX_A +#define PROPTYPE_URLBUTTON PROPTYPE_URLBUTTON_A +#define PROPTYPE_DIRECTORYNAME PROPTYPE_DIRECTORYNAME_A +#define PROPTYPE_SPINEDITFLOAT PROPTYPE_SPINEDITFLOAT_A + +#endif + /////////////////// // Property options /////////////////// @@ -528,6 +614,8 @@ enum { #define PROPOPT_EDIT_LOWERCASE 0x00020000 // For Edit String property #define PROPOPT_EDIT_UPPERCASE 0x00040000 // For Edit String property +#define PROPOPT_COMBO_SORT 0x00010000 // For Combo / Icon Combo properties + // Internal, not used by extensions #define PROPID_ROOT 0 @@ -535,82 +623,315 @@ enum { // Property definition macros ///////////////////////////// // -#define PropData_Folder(id,name,info) {id,name,info,PROPTYPE_FOLDER,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_Folder_End() {-1,0,0,PROPTYPE_FOLDER_END,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_Group(id,name,info) {id,name,info,PROPTYPE_GROUP,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_StaticString(id,name,info) {id,name,info,PROPTYPE_STATIC,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_StaticString_Opt(id,name,info,opt) {id,name,info,PROPTYPE_STATIC,opt,(LPARAM)NULL} -#define PropData_StaticString_List(id,name,info) {id,name,info,PROPTYPE_STATIC,PROPOPT_LIST,(LPARAM)NULL} -#define PropData_EditString(id,name,info) {id,name,info,PROPTYPE_EDIT_STRING,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_EditString_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_STRING,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_EditString_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_STRING,opt,(LPARAM)NULL} -#define PropData_EditNumber(id,name,info) {id,name,info,PROPTYPE_EDIT_NUMBER,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_EditNumber_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_NUMBER,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_EditNumber_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_NUMBER,opt,(LPARAM)NULL} -#define PropData_EditFloat(id,name,info) {id,name,info,PROPTYPE_EDIT_FLOAT,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_EditFloat_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_FLOAT,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_EditFloat_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_FLOAT,opt,(LPARAM)NULL} -#define PropData_EditMultiLine(id,name,info) {id,name,info,PROPTYPE_EDIT_MULTILINE,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_EditMultiLine_Check(id,name,info) {id,name,info,PROPTYPE_EDIT_MULTILINE,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_EditMultiLine_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_MULTILINE,opt,(LPARAM)NULL} -#define PropData_SliderEdit(id,name,info,minmax) {id,name,info,PROPTYPE_SLIDEREDIT,PROPOPT_PARAMREQUIRED,(LPARAM)minmax} -#define PropData_SliderEdit_Check(id,name,info,minmax) {id,name,info,PROPTYPE_SLIDEREDIT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmax} -#define PropData_SliderEdit_Opt(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SLIDEREDIT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmax} -#define PropData_SpinEdit(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDIT,PROPOPT_PARAMREQUIRED,(LPARAM)minmax} -#define PropData_SpinEdit_Check(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDIT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmax} -#define PropData_SpinEdit_Opt(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SPINEDIT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmax} -#define PropData_Button(id,name,info,text) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_NIL, (LPARAM)text} -#define PropData_Button_Check(id,name,info,text) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_CHECKBOX,(LPARAM)text} -#define PropData_Button_Opt(id,name,info,opt,text) {id,name,info,PROPTYPE_EDITBUTTON,opt,(LPARAM)text} -#define PropData_EditButton(id,name,info) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_NIL, (LPARAM)NULL} -#define PropData_EditButton_Check(id,name,info) {id,name,info,PROPTYPE_EDITBUTTON,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_EditButton_Opt(id,name,info,opt) {id,name,info,PROPTYPE_EDITBUTTON,opt,(LPARAM)NULL} -#define PropData_Size(id,name,info,tab) {id,name,info,PROPTYPE_SIZE,PROPOPT_PARAMREQUIRED,(LPARAM)tab} -#define PropData_Size_Check(id,name,info,tab) {id,name,info,PROPTYPE_SIZE,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)tab} -#define PropData_Size_Opt(id,name,info,opt,tab) {id,name,info,PROPTYPE_SIZE,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)tab} -#define PropData_Color(id,name,info) {id,name,info,PROPTYPE_COLOR,PROPOPT_NIL,(LPARAM)NULL} -#define PropData_Color_Check(id,name,info) {id,name,info,PROPTYPE_COLOR,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_Color_Opt(id,name,info,opt) {id,name,info,PROPTYPE_COLOR,opt,(LPARAM)NULL} -#define PropData_ComboBox(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOX,PROPOPT_PARAMREQUIRED,(LPARAM)list} -#define PropData_ComboBox_Check(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOX,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} -#define PropData_ComboBox_Opt(id,name,info,opt,list) {id,name,info,PROPTYPE_COMBOBOX,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} -#define PropData_CheckBox(id,name,info) {id,name,info,PROPTYPE_LEFTCHECKBOX,PROPOPT_CHECKBOX,(LPARAM)NULL} -#define PropData_CheckBox_Opt(id,name,info,opt) {id,name,info,PROPTYPE_LEFTCHECKBOX,(PROPOPT_CHECKBOX|opt),(LPARAM)NULL} -#define PropData_DirCtrl(id,name,info,param) {id,name,info,PROPTYPE_DIRCTRL,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_DirCtrl_Check(id,name,info,param) {id,name,info,PROPTYPE_DIRCTRL,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_DirCtrl_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_DIRCTRL,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_Filename(id,name,info,param) {id,name,info,PROPTYPE_FILENAME,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_Filename_Check(id,name,info,param) {id,name,info,PROPTYPE_FILENAME,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_Filename_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_FILENAME,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_PictureFilename(id,name,info,param) {id,name,info,PROPTYPE_PICTUREFILENAME,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_PictureFilename_Check(id,name,info,param) {id,name,info,PROPTYPE_PICTUREFILENAME,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_PictureFilename_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_PICTUREFILENAME,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_Font(id,name,info,param) {id,name,info,PROPTYPE_FONT,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_Font_Check(id,name,info,param) {id,name,info,PROPTYPE_FONT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_Font_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_FONT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_Custom(id,name,info,param) {id,name,info,PROPTYPE_CUSTOM,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_Custom_Check(id,name,info,param) {id,name,info,PROPTYPE_CUSTOM,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_Custom_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_CUSTOM,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_ComboBoxBtn(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOXBTN,PROPOPT_PARAMREQUIRED,(LPARAM)list} -#define PropData_ComboBoxBtn_Check(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOXBTN,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} -#define PropData_ComboBoxBtn_Opt(id,name,info,opt,list) {id,name,info,PROPTYPE_COMBOBOXBTN,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} -#define PropData_ImageList(id,name,info) {id,name,info,PROPTYPE_IMAGELIST,0,NULL} -#define PropData_ImageList_Check(id,name,info) {id,name,info,PROPTYPE_IMAGELIST,PROPOPT_CHECKBOX,NULL} -#define PropData_ImageList_Opt(id,name,info,opt) {id,name,info,PROPTYPE_IMAGELIST,opt,NULL} -#define PropData_IconComboBox(id,name,info,list) {id,name,info,PROPTYPE_ICONCOMBOBOX,PROPOPT_PARAMREQUIRED,(LPARAM)list} -#define PropData_IconComboBox_Check(id,name,info,list) {id,name,info,PROPTYPE_ICONCOMBOBOX,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} -#define PropData_IconComboBox_Opt(id,name,info,opt,list) {id,name,info,PROPTYPE_ICONCOMBOBOX,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} -#define PropData_URLButton(id,name,info,url) {id,name,info,PROPTYPE_URLBUTTON,PROPOPT_PARAMREQUIRED, (LPARAM)url} -#define PropData_URLButton_Check(id,name,info,url) {id,name,info,PROPTYPE_URLBUTTON,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)url} -#define PropData_URLButton_Opt(id,name,info,opt,url) {id,name,info,PROPTYPE_URLBUTTON,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)url} -#define PropData_DirectoryName(id,name,info,param) {id,name,info,PROPTYPE_DIRECTORYNAME,PROPOPT_PARAMREQUIRED,(LPARAM)param} -#define PropData_DirectoryName_Check(id,name,info,param) {id,name,info,PROPTYPE_DIRECTORYNAME,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} -#define PropData_DirectoryName_Opt(id,name,info,opt,param) {id,name,info,PROPTYPE_DIRECTORYNAME,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} -#define PropData_SpinEditFloat(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT,PROPOPT_PARAMREQUIRED,(LPARAM)minmaxdelta} -#define PropData_SpinEditFloat_Check(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmaxdelta} -#define PropData_SpinEditFloat_Opt(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmaxdelta} #define PropData_End() {0} +#define PropData_Folder_A(id,name,info) {id,name,info,PROPTYPE_FOLDER_A,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_Folder_End_A() {-1,0,0,PROPTYPE_FOLDER_END_A,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_Group_A(id,name,info) {id,name,info,PROPTYPE_GROUP_A,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_StaticString_A(id,name,info) {id,name,info,PROPTYPE_STATIC_A,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_StaticString_Opt_A(id,name,info,opt) {id,name,info,PROPTYPE_STATIC_A,opt,(LPARAM)NULL} +#define PropData_StaticString_List_A(id,name,info) {id,name,info,PROPTYPE_STATIC_A,PROPOPT_LIST,(LPARAM)NULL} +#define PropData_EditString_A(id,name,info) {id,name,info,PROPTYPE_EDIT_STRING_A,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_EditString_Check_A(id,name,info) {id,name,info,PROPTYPE_EDIT_STRING_A,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditString_Opt_A(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_STRING_A,opt,(LPARAM)NULL} +#define PropData_EditNumber_A(id,name,info) {id,name,info,PROPTYPE_EDIT_NUMBER_A,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_EditNumber_Check_A(id,name,info) {id,name,info,PROPTYPE_EDIT_NUMBER_A,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditNumber_Opt_A(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_NUMBER_A,opt,(LPARAM)NULL} +#define PropData_EditFloat_A(id,name,info) {id,name,info,PROPTYPE_EDIT_FLOAT_A,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_EditFloat_Check_A(id,name,info) {id,name,info,PROPTYPE_EDIT_FLOAT_A,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditFloat_Opt_A(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_FLOAT_A,opt,(LPARAM)NULL} +#define PropData_EditMultiLine_A(id,name,info) {id,name,info,PROPTYPE_EDIT_MULTILINE_A,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_EditMultiLine_Check_A(id,name,info) {id,name,info,PROPTYPE_EDIT_MULTILINE_A,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditMultiLine_Opt_A(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_MULTILINE_A,opt,(LPARAM)NULL} +#define PropData_SliderEdit_A(id,name,info,minmax) {id,name,info,PROPTYPE_SLIDEREDIT_A,PROPOPT_PARAMREQUIRED,(LPARAM)minmax} +#define PropData_SliderEdit_Check_A(id,name,info,minmax) {id,name,info,PROPTYPE_SLIDEREDIT_A,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmax} +#define PropData_SliderEdit_Opt_A(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SLIDEREDIT_A,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmax} +#define PropData_SpinEdit_A(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDIT_A,PROPOPT_PARAMREQUIRED,(LPARAM)minmax} +#define PropData_SpinEdit_Check_A(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDIT_A,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmax} +#define PropData_SpinEdit_Opt_A(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SPINEDIT_A,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmax} +#define PropData_Button_A(id,name,info,text) {id,name,info,PROPTYPE_EDITBUTTON_A,PROPOPT_NIL, (LPARAM)text} +#define PropData_Button_Check_A(id,name,info,text) {id,name,info,PROPTYPE_EDITBUTTON_A,PROPOPT_CHECKBOX,(LPARAM)text} +#define PropData_Button_Opt_A(id,name,info,opt,text) {id,name,info,PROPTYPE_EDITBUTTON_A,opt,(LPARAM)text} +#define PropData_EditButton_A(id,name,info) {id,name,info,PROPTYPE_EDITBUTTON_A,PROPOPT_NIL, (LPARAM)NULL} +#define PropData_EditButton_Check_A(id,name,info) {id,name,info,PROPTYPE_EDITBUTTON_A,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditButton_Opt_A(id,name,info,opt) {id,name,info,PROPTYPE_EDITBUTTON_A,opt,(LPARAM)NULL} +#define PropData_Size_A(id,name,info,tab) {id,name,info,PROPTYPE_SIZE_A,PROPOPT_PARAMREQUIRED,(LPARAM)tab} +#define PropData_Size_Check_A(id,name,info,tab) {id,name,info,PROPTYPE_SIZE_A,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)tab} +#define PropData_Size_Opt_A(id,name,info,opt,tab) {id,name,info,PROPTYPE_SIZE_A,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)tab} +#define PropData_Color_A(id,name,info) {id,name,info,PROPTYPE_COLOR_A,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_Color_Check_A(id,name,info) {id,name,info,PROPTYPE_COLOR_A,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_Color_Opt_A(id,name,info,opt) {id,name,info,PROPTYPE_COLOR_A,opt,(LPARAM)NULL} +#define PropData_ComboBox_A(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOX_A,PROPOPT_PARAMREQUIRED,(LPARAM)list} +#define PropData_ComboBox_Check_A(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOX_A,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} +#define PropData_ComboBox_Opt_A(id,name,info,opt,list) {id,name,info,PROPTYPE_COMBOBOX_A,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} +#define PropData_CheckBox_A(id,name,info) {id,name,info,PROPTYPE_LEFTCHECKBOX_A,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_CheckBox_Opt_A(id,name,info,opt) {id,name,info,PROPTYPE_LEFTCHECKBOX_A,(PROPOPT_CHECKBOX|opt),(LPARAM)NULL} +#define PropData_DirCtrl_A(id,name,info,param) {id,name,info,PROPTYPE_DIRCTRL_A,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_DirCtrl_Check_A(id,name,info,param) {id,name,info,PROPTYPE_DIRCTRL_A,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_DirCtrl_Opt_A(id,name,info,opt,param) {id,name,info,PROPTYPE_DIRCTRL_A,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_Filename_A(id,name,info,param) {id,name,info,PROPTYPE_FILENAME_A,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_Filename_Check_A(id,name,info,param) {id,name,info,PROPTYPE_FILENAME_A,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_Filename_Opt_A(id,name,info,opt,param) {id,name,info,PROPTYPE_FILENAME_A,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_PictureFilename_A(id,name,info,param) {id,name,info,PROPTYPE_PICTUREFILENAME_A,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_PictureFilename_Check_A(id,name,info,param) {id,name,info,PROPTYPE_PICTUREFILENAME_A,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_PictureFilename_Opt_A(id,name,info,opt,param) {id,name,info,PROPTYPE_PICTUREFILENAME_A,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_Font_A(id,name,info,param) {id,name,info,PROPTYPE_FONT_A,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_Font_Check_A(id,name,info,param) {id,name,info,PROPTYPE_FONT_A,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_Font_Opt_A(id,name,info,opt,param) {id,name,info,PROPTYPE_FONT_A,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_Custom_A(id,name,info,param) {id,name,info,PROPTYPE_CUSTOM_A,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_Custom_Check_A(id,name,info,param) {id,name,info,PROPTYPE_CUSTOM_A,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_Custom_Opt_A(id,name,info,opt,param) {id,name,info,PROPTYPE_CUSTOM_A,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_ComboBoxBtn_A(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOXBTN_A,PROPOPT_PARAMREQUIRED,(LPARAM)list} +#define PropData_ComboBoxBtn_Check_A(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOXBTN_A,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} +#define PropData_ComboBoxBtn_Opt_A(id,name,info,opt,list) {id,name,info,PROPTYPE_COMBOBOXBTN_A,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} +#define PropData_ImageList_A(id,name,info) {id,name,info,PROPTYPE_IMAGELIST_A,0,NULL} +#define PropData_ImageList_Check_A(id,name,info) {id,name,info,PROPTYPE_IMAGELIST_A,PROPOPT_CHECKBOX,NULL} +#define PropData_ImageList_Opt_A(id,name,info,opt) {id,name,info,PROPTYPE_IMAGELIST_A,opt,NULL} +#define PropData_IconComboBox_A(id,name,info,list) {id,name,info,PROPTYPE_ICONCOMBOBOX_A,PROPOPT_PARAMREQUIRED,(LPARAM)list} +#define PropData_IconComboBox_Check_A(id,name,info,list) {id,name,info,PROPTYPE_ICONCOMBOBOX_A,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} +#define PropData_IconComboBox_Opt_A(id,name,info,opt,list) {id,name,info,PROPTYPE_ICONCOMBOBOX_A,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} +#define PropData_URLButton_A(id,name,info,url) {id,name,info,PROPTYPE_URLBUTTON_A,PROPOPT_PARAMREQUIRED, (LPARAM)url} +#define PropData_URLButton_Check_A(id,name,info,url) {id,name,info,PROPTYPE_URLBUTTON_A,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)url} +#define PropData_URLButton_Opt_A(id,name,info,opt,url) {id,name,info,PROPTYPE_URLBUTTON_A,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)url} +#define PropData_DirectoryName_A(id,name,info,param) {id,name,info,PROPTYPE_DIRECTORYNAME_A,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_DirectoryName_Check_A(id,name,info,param) {id,name,info,PROPTYPE_DIRECTORYNAME_A,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_DirectoryName_Opt_A(id,name,info,opt,param) {id,name,info,PROPTYPE_DIRECTORYNAME_A,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_SpinEditFloat_A(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT_A,PROPOPT_PARAMREQUIRED,(LPARAM)minmaxdelta} +#define PropData_SpinEditFloat_Check_A(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT_A,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmaxdelta} +#define PropData_SpinEditFloat_Opt_A(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT_A,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmaxdelta} + + +#define PropData_Folder_W(id,name,info) {id,name,info,PROPTYPE_FOLDER_W,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_Folder_End_W() {-1,0,0,PROPTYPE_FOLDER_END_W,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_Group_W(id,name,info) {id,name,info,PROPTYPE_GROUP_W,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_StaticString_W(id,name,info) {id,name,info,PROPTYPE_STATIC_W,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_StaticString_Opt_W(id,name,info,opt) {id,name,info,PROPTYPE_STATIC_W,opt,(LPARAM)NULL} +#define PropData_StaticString_List_W(id,name,info) {id,name,info,PROPTYPE_STATIC_W,PROPOPT_LIST,(LPARAM)NULL} +#define PropData_EditString_W(id,name,info) {id,name,info,PROPTYPE_EDIT_STRING_W,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_EditString_Check_W(id,name,info) {id,name,info,PROPTYPE_EDIT_STRING_W,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditString_Opt_W(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_STRING_W,opt,(LPARAM)NULL} +#define PropData_EditNumber_W(id,name,info) {id,name,info,PROPTYPE_EDIT_NUMBER_W,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_EditNumber_Check_W(id,name,info) {id,name,info,PROPTYPE_EDIT_NUMBER_W,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditNumber_Opt_W(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_NUMBER_W,opt,(LPARAM)NULL} +#define PropData_EditFloat_W(id,name,info) {id,name,info,PROPTYPE_EDIT_FLOAT_W,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_EditFloat_Check_W(id,name,info) {id,name,info,PROPTYPE_EDIT_FLOAT_W,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditFloat_Opt_W(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_FLOAT_W,opt,(LPARAM)NULL} +#define PropData_EditMultiLine_W(id,name,info) {id,name,info,PROPTYPE_EDIT_MULTILINE_W,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_EditMultiLine_Check_W(id,name,info) {id,name,info,PROPTYPE_EDIT_MULTILINE_W,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditMultiLine_Opt_W(id,name,info,opt) {id,name,info,PROPTYPE_EDIT_MULTILINE_W,opt,(LPARAM)NULL} +#define PropData_SliderEdit_W(id,name,info,minmax) {id,name,info,PROPTYPE_SLIDEREDIT_W,PROPOPT_PARAMREQUIRED,(LPARAM)minmax} +#define PropData_SliderEdit_Check_W(id,name,info,minmax) {id,name,info,PROPTYPE_SLIDEREDIT_W,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmax} +#define PropData_SliderEdit_Opt_W(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SLIDEREDIT_W,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmax} +#define PropData_SpinEdit_W(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDIT_W,PROPOPT_PARAMREQUIRED,(LPARAM)minmax} +#define PropData_SpinEdit_Check_W(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDIT_W,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmax} +#define PropData_SpinEdit_Opt_W(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SPINEDIT_W,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmax} +#define PropData_Button_W(id,name,info,text) {id,name,info,PROPTYPE_EDITBUTTON_W,PROPOPT_NIL, (LPARAM)text} +#define PropData_Button_Check_W(id,name,info,text) {id,name,info,PROPTYPE_EDITBUTTON_W,PROPOPT_CHECKBOX,(LPARAM)text} +#define PropData_Button_Opt_W(id,name,info,opt,text) {id,name,info,PROPTYPE_EDITBUTTON_W,opt,(LPARAM)text} +#define PropData_EditButton_W(id,name,info) {id,name,info,PROPTYPE_EDITBUTTON_W,PROPOPT_NIL, (LPARAM)NULL} +#define PropData_EditButton_Check_W(id,name,info) {id,name,info,PROPTYPE_EDITBUTTON_W,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_EditButton_Opt_W(id,name,info,opt) {id,name,info,PROPTYPE_EDITBUTTON_W,opt,(LPARAM)NULL} +#define PropData_Size_W(id,name,info,tab) {id,name,info,PROPTYPE_SIZE_W,PROPOPT_PARAMREQUIRED,(LPARAM)tab} +#define PropData_Size_Check_W(id,name,info,tab) {id,name,info,PROPTYPE_SIZE_W,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)tab} +#define PropData_Size_Opt_W(id,name,info,opt,tab) {id,name,info,PROPTYPE_SIZE_W,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)tab} +#define PropData_Color_W(id,name,info) {id,name,info,PROPTYPE_COLOR_W,PROPOPT_NIL,(LPARAM)NULL} +#define PropData_Color_Check_W(id,name,info) {id,name,info,PROPTYPE_COLOR_W,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_Color_Opt_W(id,name,info,opt) {id,name,info,PROPTYPE_COLOR_W,opt,(LPARAM)NULL} +#define PropData_ComboBox_W(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOX_W,PROPOPT_PARAMREQUIRED,(LPARAM)list} +#define PropData_ComboBox_Check_W(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOX_W,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} +#define PropData_ComboBox_Opt_W(id,name,info,opt,list) {id,name,info,PROPTYPE_COMBOBOX_W,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} +#define PropData_CheckBox_W(id,name,info) {id,name,info,PROPTYPE_LEFTCHECKBOX_W,PROPOPT_CHECKBOX,(LPARAM)NULL} +#define PropData_CheckBox_Opt_W(id,name,info,opt) {id,name,info,PROPTYPE_LEFTCHECKBOX_W,(PROPOPT_CHECKBOX|opt),(LPARAM)NULL} +#define PropData_DirCtrl_W(id,name,info,param) {id,name,info,PROPTYPE_DIRCTRL_W,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_DirCtrl_Check_W(id,name,info,param) {id,name,info,PROPTYPE_DIRCTRL_W,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_DirCtrl_Opt_W(id,name,info,opt,param) {id,name,info,PROPTYPE_DIRCTRL_W,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_Filename_W(id,name,info,param) {id,name,info,PROPTYPE_FILENAME_W,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_Filename_Check_W(id,name,info,param) {id,name,info,PROPTYPE_FILENAME_W,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_Filename_Opt_W(id,name,info,opt,param) {id,name,info,PROPTYPE_FILENAME_W,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_PictureFilename_W(id,name,info,param) {id,name,info,PROPTYPE_PICTUREFILENAME_W,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_PictureFilename_Check_W(id,name,info,param) {id,name,info,PROPTYPE_PICTUREFILENAME_W,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_PictureFilename_Opt_W(id,name,info,opt,param) {id,name,info,PROPTYPE_PICTUREFILENAME_W,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_Font_W(id,name,info,param) {id,name,info,PROPTYPE_FONT_W,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_Font_Check_W(id,name,info,param) {id,name,info,PROPTYPE_FONT_W,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_Font_Opt_W(id,name,info,opt,param) {id,name,info,PROPTYPE_FONT_W,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_Custom_W(id,name,info,param) {id,name,info,PROPTYPE_CUSTOM_W,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_Custom_Check_W(id,name,info,param) {id,name,info,PROPTYPE_CUSTOM_W,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_Custom_Opt_W(id,name,info,opt,param) {id,name,info,PROPTYPE_CUSTOM_W,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_ComboBoxBtn_W(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOXBTN_W,PROPOPT_PARAMREQUIRED,(LPARAM)list} +#define PropData_ComboBoxBtn_Check_W(id,name,info,list) {id,name,info,PROPTYPE_COMBOBOXBTN_W,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} +#define PropData_ComboBoxBtn_Opt_W(id,name,info,opt,list) {id,name,info,PROPTYPE_COMBOBOXBTN_W,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} +#define PropData_ImageList_W(id,name,info) {id,name,info,PROPTYPE_IMAGELIST_W,0,NULL} +#define PropData_ImageList_Check_W(id,name,info) {id,name,info,PROPTYPE_IMAGELIST_W,PROPOPT_CHECKBOX,NULL} +#define PropData_ImageList_Opt_W(id,name,info,opt) {id,name,info,PROPTYPE_IMAGELIST_W,opt,NULL} +#define PropData_IconComboBox_W(id,name,info,list) {id,name,info,PROPTYPE_ICONCOMBOBOX_W,PROPOPT_PARAMREQUIRED,(LPARAM)list} +#define PropData_IconComboBox_Check_W(id,name,info,list) {id,name,info,PROPTYPE_ICONCOMBOBOX_W,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)list} +#define PropData_IconComboBox_Opt_W(id,name,info,opt,list) {id,name,info,PROPTYPE_ICONCOMBOBOX_W,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)list} +#define PropData_URLButton_W(id,name,info,url) {id,name,info,PROPTYPE_URLBUTTON_W,PROPOPT_PARAMREQUIRED, (LPARAM)url} +#define PropData_URLButton_Check_W(id,name,info,url) {id,name,info,PROPTYPE_URLBUTTON_W,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)url} +#define PropData_URLButton_Opt_W(id,name,info,opt,url) {id,name,info,PROPTYPE_URLBUTTON_W,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)url} +#define PropData_DirectoryName_W(id,name,info,param) {id,name,info,PROPTYPE_DIRECTORYNAME_W,PROPOPT_PARAMREQUIRED,(LPARAM)param} +#define PropData_DirectoryName_Check_W(id,name,info,param) {id,name,info,PROPTYPE_DIRECTORYNAME_W,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)param} +#define PropData_DirectoryName_Opt_W(id,name,info,opt,param) {id,name,info,PROPTYPE_DIRECTORYNAME_W,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)param} +#define PropData_SpinEditFloat_W(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT_W,PROPOPT_PARAMREQUIRED,(LPARAM)minmaxdelta} +#define PropData_SpinEditFloat_Check_W(id,name,info,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT_W,(PROPOPT_PARAMREQUIRED|PROPOPT_CHECKBOX),(LPARAM)minmaxdelta} +#define PropData_SpinEditFloat_Opt_W(id,name,info,opt,minmax) {id,name,info,PROPTYPE_SPINEDITFLOAT_W,(PROPOPT_PARAMREQUIRED|opt),(LPARAM)minmaxdelta} + +#ifdef _UNICODE + +#define PropData_Folder PropData_Folder_W +#define PropData_Folder_End PropData_Folder_End_W +#define PropData_Group PropData_Group_W +#define PropData_StaticString PropData_StaticString_W +#define PropData_StaticString_Opt PropData_StaticString_Opt_W +#define PropData_StaticString_List PropData_StaticString_List_W +#define PropData_EditString PropData_EditString_W +#define PropData_EditString_Check PropData_EditString_Check_W +#define PropData_EditString_Opt PropData_EditString_Opt_W +#define PropData_EditNumber PropData_EditNumber_W +#define PropData_EditNumber_Check PropData_EditNumber_Check_W +#define PropData_EditNumber_Opt PropData_EditNumber_Opt_W +#define PropData_EditFloat PropData_EditFloat_W +#define PropData_EditFloat_Check PropData_EditFloat_Check_W +#define PropData_EditFloat_Opt PropData_EditFloat_Opt_W +#define PropData_EditMultiLine PropData_EditMultiLine_W +#define PropData_EditMultiLine_Check PropData_EditMultiLine_Check_W +#define PropData_EditMultiLine_Opt PropData_EditMultiLine_Opt_W +#define PropData_SliderEdit PropData_SliderEdit_W +#define PropData_SliderEdit_Check PropData_SliderEdit_Check_W +#define PropData_SliderEdit_Opt PropData_SliderEdit_Opt_W +#define PropData_SpinEdit PropData_SpinEdit_W +#define PropData_SpinEdit_Check PropData_SpinEdit_Check_W +#define PropData_SpinEdit_Opt PropData_SpinEdit_Opt_W +#define PropData_Button PropData_Button_W +#define PropData_Button_Check PropData_Button_Check_W +#define PropData_Button_Opt PropData_Button_Opt_W +#define PropData_EditButton PropData_EditButton_W +#define PropData_EditButton_Check PropData_EditButton_Check_W +#define PropData_EditButton_Opt PropData_EditButton_Opt_W +#define PropData_Size PropData_Size_W +#define PropData_Size_Check PropData_Size_Check_W +#define PropData_Size_Opt PropData_Size_Opt_W +#define PropData_Color PropData_Color_W +#define PropData_Color_Check PropData_Color_Check_W +#define PropData_Color_Opt PropData_Color_Opt_W +#define PropData_ComboBox PropData_ComboBox_W +#define PropData_ComboBox_Check PropData_ComboBox_Check_W +#define PropData_ComboBox_Opt PropData_ComboBox_Opt_W +#define PropData_CheckBox PropData_CheckBox_W +#define PropData_CheckBox_Opt PropData_CheckBox_Opt_W +#define PropData_DirCtrl PropData_DirCtrl_W +#define PropData_DirCtrl_Check PropData_DirCtrl_Check_W +#define PropData_DirCtrl_Opt PropData_DirCtrl_Opt_W +#define PropData_Filename PropData_Filename_W +#define PropData_Filename_Check PropData_Filename_Check_W +#define PropData_Filename_Opt PropData_Filename_Opt_W +#define PropData_PictureFilename PropData_PictureFilename_W +#define PropData_PictureFilename_Check PropData_PictureFilename_Check_W +#define PropData_PictureFilename_Opt PropData_PictureFilename_Opt_W +#define PropData_Font PropData_Font_W +#define PropData_Font_Check PropData_Font_Check_W +#define PropData_Font_Opt PropData_Font_Opt_W +#define PropData_Custom PropData_Custom_W +#define PropData_Custom_Check PropData_Custom_Check_W +#define PropData_Custom_Opt PropData_Custom_Opt_W +#define PropData_ComboBoxBtn PropData_ComboBoxBtn_W +#define PropData_ComboBoxBtn_Check PropData_ComboBoxBtn_Check_W +#define PropData_ComboBoxBtn_Opt PropData_ComboBoxBtn_Opt_W +#define PropData_ImageList PropData_ImageList_W +#define PropData_ImageList_Check PropData_ImageList_Check_W +#define PropData_ImageList_Opt PropData_ImageList_Opt_W +#define PropData_IconComboBox PropData_IconComboBox_W +#define PropData_IconComboBox_Check PropData_IconComboBox_Check_W +#define PropData_IconComboBox_Opt PropData_IconComboBox_Opt_W +#define PropData_URLButton PropData_URLButton_W +#define PropData_URLButton_Check PropData_URLButton_Check_W +#define PropData_URLButton_Opt PropData_URLButton_Opt_W +#define PropData_DirectoryName PropData_DirectoryName_W +#define PropData_DirectoryName_Check PropData_DirectoryName_Check_W +#define PropData_DirectoryName_Opt PropData_DirectoryName_Opt_W +#define PropData_SpinEditFloat PropData_SpinEditFloat_W +#define PropData_SpinEditFloat_Check PropData_SpinEditFloat_Check_W +#define PropData_SpinEditFloat_Opt PropData_SpinEditFloat_Opt_W + +#else + +#define PropData_Folder PropData_Folder_A +#define PropData_Folder_End PropData_Folder_End_A +#define PropData_Group PropData_Group_A +#define PropData_StaticString PropData_StaticString_A +#define PropData_StaticString_Opt PropData_StaticString_Opt_A +#define PropData_StaticString_List PropData_StaticString_List_A +#define PropData_EditString PropData_EditString_A +#define PropData_EditString_Check PropData_EditString_Check_A +#define PropData_EditString_Opt PropData_EditString_Opt_A +#define PropData_EditNumber PropData_EditNumber_A +#define PropData_EditNumber_Check PropData_EditNumber_Check_A +#define PropData_EditNumber_Opt PropData_EditNumber_Opt_A +#define PropData_EditFloat PropData_EditFloat_A +#define PropData_EditFloat_Check PropData_EditFloat_Check_A +#define PropData_EditFloat_Opt PropData_EditFloat_Opt_A +#define PropData_EditMultiLine PropData_EditMultiLine_A +#define PropData_EditMultiLine_Check PropData_EditMultiLine_Check_A +#define PropData_EditMultiLine_Opt PropData_EditMultiLine_Opt_A +#define PropData_SliderEdit PropData_SliderEdit_A +#define PropData_SliderEdit_Check PropData_SliderEdit_Check_A +#define PropData_SliderEdit_Opt PropData_SliderEdit_Opt_A +#define PropData_SpinEdit PropData_SpinEdit_A +#define PropData_SpinEdit_Check PropData_SpinEdit_Check_A +#define PropData_SpinEdit_Opt PropData_SpinEdit_Opt_A +#define PropData_Button PropData_Button_A +#define PropData_Button_Check PropData_Button_Check_A +#define PropData_Button_Opt PropData_Button_Opt_A +#define PropData_EditButton PropData_EditButton_A +#define PropData_EditButton_Check PropData_EditButton_Check_A +#define PropData_EditButton_Opt PropData_EditButton_Opt_A +#define PropData_Size PropData_Size_A +#define PropData_Size_Check PropData_Size_Check_A +#define PropData_Size_Opt PropData_Size_Opt_A +#define PropData_Color PropData_Color_A +#define PropData_Color_Check PropData_Color_Check_A +#define PropData_Color_Opt PropData_Color_Opt_A +#define PropData_ComboBox PropData_ComboBox_A +#define PropData_ComboBox_Check PropData_ComboBox_Check_A +#define PropData_ComboBox_Opt PropData_ComboBox_Opt_A +#define PropData_CheckBox PropData_CheckBox_A +#define PropData_CheckBox_Opt PropData_CheckBox_Opt_A +#define PropData_DirCtrl PropData_DirCtrl_A +#define PropData_DirCtrl_Check PropData_DirCtrl_Check_A +#define PropData_DirCtrl_Opt PropData_DirCtrl_Opt_A +#define PropData_Filename PropData_Filename_A +#define PropData_Filename_Check PropData_Filename_Check_A +#define PropData_Filename_Opt PropData_Filename_Opt_A +#define PropData_PictureFilename PropData_PictureFilename_A +#define PropData_PictureFilename_Check PropData_PictureFilename_Check_A +#define PropData_PictureFilename_Opt PropData_PictureFilename_Opt_A +#define PropData_Font PropData_Font_A +#define PropData_Font_Check PropData_Font_Check_A +#define PropData_Font_Opt PropData_Font_Opt_A +#define PropData_Custom PropData_Custom_A +#define PropData_Custom_Check PropData_Custom_Check_A +#define PropData_Custom_Opt PropData_Custom_Opt_A +#define PropData_ComboBoxBtn PropData_ComboBoxBtn_A +#define PropData_ComboBoxBtn_Check PropData_ComboBoxBtn_Check_A +#define PropData_ComboBoxBtn_Opt PropData_ComboBoxBtn_Opt_A +#define PropData_ImageList PropData_ImageList_A +#define PropData_ImageList_Check PropData_ImageList_Check_A +#define PropData_ImageList_Opt PropData_ImageList_Opt_A +#define PropData_IconComboBox PropData_IconComboBox_A +#define PropData_IconComboBox_Check PropData_IconComboBox_Check_A +#define PropData_IconComboBox_Opt PropData_IconComboBox_Opt_A +#define PropData_URLButton PropData_URLButton_A +#define PropData_URLButton_Check PropData_URLButton_Check_A +#define PropData_URLButton_Opt PropData_URLButton_Opt_A +#define PropData_DirectoryName PropData_DirectoryName_A +#define PropData_DirectoryName_Check PropData_DirectoryName_Check_A +#define PropData_DirectoryName_Opt PropData_DirectoryName_Opt_A +#define PropData_SpinEditFloat PropData_SpinEditFloat_A +#define PropData_SpinEditFloat_Check PropData_SpinEditFloat_Check_A +#define PropData_SpinEditFloat_Opt PropData_SpinEditFloat_Opt_A + +#endif // _UNICODE + ///////////////////////////////// // Property definition parameters ///////////////////////////////// @@ -660,7 +981,18 @@ typedef struct { typedef struct { LPCSTR extFilter; // Filter string for GetOpenFilename dialog (for example "All Files (*.*)|*.*|") DWORD options; // Options for GetOpenFilename dialog (OFN_FILEMUSTEXIST, OFN_PATHMUSTEXIST, OFN_HIDEREADONLY, etc.) -} FilenameCreateParam; +} FilenameCreateParamA; + +typedef struct { + LPCWSTR extFilter; // Filter string for GetOpenFilename dialog (for example "All Files (*.*)|*.*|") + DWORD options; // Options for GetOpenFilename dialog (OFN_FILEMUSTEXIST, OFN_PATHMUSTEXIST, OFN_HIDEREADONLY, etc.) +} FilenameCreateParamW; + +#ifdef _UNICODE +#define FilenameCreateParam FilenameCreateParamW +#else +#define FilenameCreateParam FilenameCreateParamA +#endif //////////////////////////////////////////////// // @@ -687,6 +1019,8 @@ enum { PROPID_TAB_ANDROID, PROPID_TAB_XNA, PROPID_TAB_MAC, + PROPID_TAB_HTML5, + PROPID_TAB_VITA, PROPID_TAB_CUSTOM1 = 18, PROPID_TAB_CUSTOM2, PROPTAB_MAX // 20 @@ -1009,14 +1343,14 @@ enum { PROPID_APP_IPHONEENABLEIAD, PROPID_APP_IPHONEIADBOTTOM, PROPID_APP_OPTIONAL_MODULES, - PROPID_APP_ANDROIDVERSION, + PROPID_APP_ANDROIDVERSION_MIN, PROPID_APP_IPHONEBUNDLEVERSION, PROPID_APP_IPHONETARGETDEVICE, PROPID_APP_IPHONEARCHITECTURE, PROPID_APP_IPHONEAPPICON_IPAD, PROPID_APP_IPHONELAUNCHIMAGE_IPAD, - PROPID_APP_XNAPROJECTPATH, - PROPID_APP_XNAPROJECTNAME, + PROPID_APP_PROJECTPATH, + PROPID_APP_PROJECTNAME, PROPID_APP_XNASTATUSLINE, PROPID_APP_XNAFONT_GROUP, PROPID_APP_XNAFONT_FIRSTCHAR, @@ -1033,6 +1367,74 @@ enum { PROPID_APP_BUILDWARNINGS, PROPID_APP_XNAADS, PROPID_APP_XNAPUBCENTERID, + PROPID_APP_XNAABOUT, + PROPID_APP_XNAAPPTITLE, + PROPID_APP_XNADESCRIPTION, + PROPID_APP_XNACOMPANY, + PROPID_APP_XNAPRODUCT, + PROPID_APP_XNACOPYRIGHT, + PROPID_APP_XNATRADEMARK, + PROPID_APP_XNAASSEMBLYVERSION, + PROPID_APP_XNAFILEVERSION, + PROPID_APP_XNAGAMETHUMBNAIL, + PROPID_APP_XNABACKGROUNDIMAGE, + PROPID_APP_ANDROIDKEYPASSWORD, + PROPID_APP_ANDROIDVERSIONING_GROUP, + PROPID_APP_ANDROIDVERSIONCODE, + PROPID_APP_ANDROIDVERSIONSTRING, + PROPID_APP_XNALANGUAGE, + PROPID_APP_ANDROIDKEYSTOREPASSWORD, + PROPID_APP_ANDROIDADMOB_GROUP, + PROPID_APP_ANDROIDENABLEAD, + PROPID_APP_ANDROIDADBOTTOM, + PROPID_APP_ANDROIDADMOBID, + PROPID_APP_ANDROIDTESTDEVICEID, + PROPID_APP_ANDROIDREQUIREGPU, + PROPID_APP_ANDROIDANTIALIAS, + PROPID_APP_ANDROIDLARGESOUNDDURATION, + PROPID_APP_HTML5USEMOSAIC, + PROPID_APP_HTML5KEEPRESOURCES, + PROPID_APP_VITAINPUT, + PROPID_APP_VITAACCELS, + PROPID_APP_VITATOUCHSCREEN, + PROPID_APP_VITAGAMEPAD, + PROPID_APP_VITAMEMORY, + PROPID_APP_VITARESHEAP, + PROPID_APP_VITAMNGHEAP, + PROPID_APP_XNAUSEMOSAIC, + PROPID_APP_ANDROIDGLMODE, + PROPID_APP_HTML5WEBGL, + PROPID_APP_ALLOWSCREENBORDERS, + PROPID_APP_IPHONEDISPLAY, + PROPID_APP_IPHONELAUNCHIMAGE_LANDSCAPE_IPAD, + PROPID_APP_HTML5_PRELOADER_GROUP, + PROPID_APP_HTML5_PRELOADER, + PROPID_APP_HTML5_PRELOADER_FILENAME, + PROPID_APP_HTML5_PRELOADER_PGB_X, + PROPID_APP_HTML5_PRELOADER_PGB_Y, + PROPID_APP_HTML5_PRELOADER_PGB_RADIUS, + PROPID_APP_HTML5_PRELOADER_PGB_THICKNESS, + PROPID_APP_HTML5_PRELOADER_PGB_COLOR, + PROPID_APP_HTML5_PRELOADER_BACK_COLOR, + PROPID_APP_HTML5_PRELOADERTYPE, + PROPID_APP_HTML5_PRELOADER_FRAMENUM, + PROPID_APP_IPHONELAUNCHIMAGE_IPHONE5, + PROPID_APP_ANDROIDDISPLAY, + PROPID_APP_ANDROIDSYSTEMFONT, + PROPID_APP_ANDROIDMENU, + PROPID_APP_ANDROIDVERSION_TARGET, + PROPID_APP_HTML5RUNEVENIFNOTFOCUS, + PROPID_APP_HTML5_GENERATEHTMLFILE, + PROPID_APP_HTML5_ALLOWOFFLINE, + PROPID_APP_HTML5_MEDIAFOLDER, + PROPID_APP_HTML5_SRCFOLDER, + PROPID_APP_ANDROIDKEYBOVERAPPWINDOW, + PROPID_APP_ANDROIDOUYA_GROUP, + PROPID_APP_ANDROIDOUYA_CATEGORY, + PROPID_APP_ANDROIDTESTING_GROUP, + PROPID_APP_ANDROIDRELEASE_GROUP, + PROPID_APP_ANDROIDDISPOPT, + PROPID_APP_HTML5_PRELOADER_ERASEBKD, PROPID_APP_LAST, PROPID_APP_ANDROID_PERM_FIRST = 90001, @@ -1089,6 +1491,22 @@ enum { PROPID_FRAME_DISABLEIDLETIMER, PROPID_FRAME_IPHONEIAD_GROUP, PROPID_FRAME_IPHONEIAD, + PROPID_FRAME_ANDROID_JOYSTICK_GROUP, + PROPID_FRAME_ANDROID_JOYSTICK_TYPE, + PROPID_FRAME_ANDROID_JOYSTICK_FIRE1, + PROPID_FRAME_ANDROID_JOYSTICK_FIRE2, + PROPID_FRAME_ANDROID_JOYSTICK_LEFTHAND, + PROPID_FRAME_ANDROIDAD_GROUP, + PROPID_FRAME_ANDROIDAD, + PROPID_FRAME_ANDROIDADBOTTOM, + PROPID_FRAME_ANDROIDADOVERFRAME, + PROPID_FRAME_VITA_JOYSTICK_TYPE, + PROPID_FRAME_HTML5_DISPLAYPRELOADER, + PROPID_FRAME_HTML5_JOYSTICK_GROUP, + PROPID_FRAME_HTML5_JOYSTICK_TYPE, + PROPID_FRAME_HTML5_JOYSTICK_FIRE1, + PROPID_FRAME_HTML5_JOYSTICK_FIRE2, + PROPID_FRAME_HTML5_JOYSTICK_LEFTHAND, PROPID_FRAME_LAST, }; diff --git a/Inc/Surface.h b/Inc/Surface.h index 6d55498..066d680 100644 --- a/Inc/Surface.h +++ b/Inc/Surface.h @@ -27,23 +27,8 @@ typedef struct DisplayMode { typedef BOOL (CALLBACK * LPENUMSCREENMODESPROC)(DisplayMode*, LPVOID); -#ifdef HWABETA // Lost device callback function typedef void (CALLBACK * LOSTDEVICECALLBACKPROC)(cSurface*, LPARAM); -#endif - -// Direct3D surface information (Call cSurface::GetDriverInfo) -typedef struct D3DSURFINFO { - DWORD m_lSize; - int m_nD3DVersion; // 8 or 9 - LPVOID m_pD3D; // LPDIRECT3D8 or LPDIRECT3D9 - LPVOID m_pD3DDevice; // LPDIRECT3DDEVICE8 or LPDIRECT3DDEVICE9 - LPVOID m_pD3DTexture; // LPDIRECT3DTEXTURE8 or LPDIRECT3DTEXTURE9 - int m_dwPixelShaderVersion; - int m_dwVertexShaderVersion; // not used - int m_dwMaxTextureWidth; - int m_dwMaxTextureHeight; - } D3DSURFINFO; // System colors #ifndef COLOR_GRADIENTINACTIVECAPTION @@ -84,7 +69,7 @@ typedef enum { BOP_EFFECTEX, BOP_MAX, BOP_MASK = 0xFFF, - BOP_RGBAFILTER = 0x1000, // Same as RGB coefficient & Blend coefficient in MMF. BGRA format (highest byte is alpha) + BOP_RGBAFILTER = 0x1000, } BlitOp; #define ALPHATOSEMITRANSP(a) ((a==0) ? 128:(255-a)/2) @@ -120,11 +105,11 @@ enum ST_MEMORY, // Buffer only ST_MEMORYWITHDC, // Buffer + DC (i.e. DIBSection, DDRAW surface, etc... ST_MEMORYWITHPERMANENTDC, // Buffer + permanent DC (i.e. DIBDC) - ST_DDRAW_SYSTEMMEMORY, // Surface Direct Draw Surface in system memory + ST_DDRAW_SYSTEMMEMORY, // Surface Direct Draw en mémoire systeme ST_HWA_SCREEN, // Screen surface in HWA mode - ST_HWA_RTTEXTURE, // Render target texture in HWA mode. Fast writing, can be used as viewport surface - ST_HWA_ROUTEXTURE, // HWA texture created in video memory, unmanaged (lost when device is lost). Slow writing, should be treated read-only - ST_HWA_ROMTEXTURE, // HWA texture created in video memory, managed (automatically reloaded when the device is lost). Slow writing, should be treated read-only + ST_HWA_RTTEXTURE, // Render target texture in HWA mode + ST_HWA_ROUTEXTURE, // HWA texture created in video memory, unmanaged (lost when device is lost) + ST_HWA_ROMTEXTURE, // HWA texture created in video memory, managed (automatically reloaded when the device is lost) ST_MAX }; @@ -163,11 +148,9 @@ enum { // Blilt options enum { BLTF_ANTIA = 0x0001, // Anti-aliasing - BLTF_COPYALPHA = 0x0002, // Copy alpha channel to destination alpha channel instead of applying it (Note: Do not use in HWA mode) -#ifdef HWABETA + BLTF_COPYALPHA = 0x0002, // Copy alpha channel to destination alpha channel instead of applying it BLTF_SAFESRC = 0x0010, BLTF_TILE = 0x0020 -#endif }; // Stretch & BlitEx options @@ -175,10 +158,8 @@ enum { STRF_RESAMPLE = 0x0001, // Resample bitmap STRF_RESAMPLE_TRANSP = 0x0002, // Resample bitmap, but doesn't resample the transparent color STRF_COPYALPHA = 0x0004, // Copy (stretch) alpha channel to destination alpha channel instead of applying it -#ifdef HWABETA STRF_SAFESRC = 0x0010, STRF_TILE = 0x0020 -#endif }; @@ -200,7 +181,7 @@ typedef sMask *LPSMASK; #define SCMF_PLATFORM 0x0001 #ifndef PI -#define PI ((double)3.141592653589) +#define PI ((double)3.141592653589) #endif // Allocate/Free surface @@ -229,9 +210,7 @@ class SURFACES_API cSurface // Init static void InitializeSurfaces(); static void FreeSurfaces(); -#ifdef HWABETA static void FreeExternalModules(); -#endif // Operators cSurface FAR & operator= (const cSurface FAR & source); @@ -269,7 +248,7 @@ class SURFACES_API cSurface int GetLastError(void); // ====================== - // Surface info + // Surface info // ====================== int GetWidth(void) const; int GetHeight(void) const; @@ -277,7 +256,7 @@ class SURFACES_API cSurface BOOL GetInfo(int FAR & width, int FAR & height, int FAR & depth) const; // ====================== - // Surface coordinate management + // Surface coordinate management // ====================== void SetOrigin(int x, int y); @@ -290,7 +269,7 @@ class SURFACES_API cSurface void OffsetOrigin(POINT delta); // ====================== - // Raster operations + // Raster operations // ====================== LPBYTE LockBuffer(); void UnlockBuffer(LPBYTE spBuffer); @@ -303,22 +282,20 @@ class SURFACES_API cSurface int BeginRendering(BOOL bClear, RGBAREF dwRgba); int EndRendering(); BOOL UpdateScreen(); -#ifdef HWABETA cSurface* GetRenderTargetSurface(); void ReleaseRenderTargetSurface(cSurface* psf); void Flush(BOOL bMax); void SetZBuffer(float z2D); -#endif // ====================== - // Device context for graphic operations + // Device context for graphic operations // ====================== HDC GetDC(void); void ReleaseDC(HDC dc); void AttachWindow (HWND hWnd); // ====================== - // Clipping + // Clipping // ====================== void GetClipRect(int FAR & x, int FAR & y, int FAR & w, int FAR & h); void SetClipRect(int x, int y, int w, int h); @@ -383,6 +360,8 @@ class SURFACES_API cSurface // Blit surface to surface BOOL Blit(cSurface FAR & dest) const; + // New MMF 2.5 : HIBYTE(dwBlitFlags) = blend coefficient + BOOL Blit(cSurface FAR & dest, int destX, int destY, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, DWORD dwBlitFlags = 0) const; @@ -395,11 +374,10 @@ class SURFACES_API cSurface // Extended blit : can do stretch & rotate at the same time // Only implemented in 3D mode -#ifdef HWABETA BOOL BlitEx(cSurface FAR & dest, float dX, float dY, float fScaleX, float fScaleY, int sX, int sY, int sW, int sH, LPPOINT pCenter, float fAngle, BlitMode bm = BMODE_OPAQUE, BlitOp bo = BOP_COPY, LPARAM param = 0, DWORD dwFlags = 0) const; -#endif + // Scrolling BOOL Scroll (int xDest, int yDest, int xSrc, int ySrc, int width, int height); @@ -467,9 +445,7 @@ class SURFACES_API cSurface BOOL Fill(int x, int y, int w, int h, CFillData FAR * fd); BOOL Fill(int x, int y, int w, int h, int index); BOOL Fill(int x, int y, int w, int h, int R, int G, int B); -#ifdef HWABETA BOOL Fill(int x, int y, int w, int h, COLORREF* pColors, DWORD dwFlags); -#endif // ====================== // Geometric Primitives @@ -548,11 +524,7 @@ class SURFACES_API cSurface BOOL CreateRotatedSurface (cSurface FAR& ps, double a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); BOOL CreateRotatedSurface (cSurface FAR& ps, int a, BOOL bAA, COLORREF clrFill = 0L, BOOL bTransp=TRUE); -#ifdef HWABETA static void GetSizeOfRotatedRect (int FAR *pWidth, int FAR *pHeight, float angle); -#else - static void GetSizeOfRotatedRect (int FAR *pWidth, int FAR *pHeight, int angle); -#endif // ====================== // Text @@ -597,7 +569,7 @@ class SURFACES_API cSurface // Create icon HICON CreateIcon(int iconWidth, int iconHeight, COLORREF transpColor,POINT *pHotSpot); - // Palette support + // Palette support BOOL Indexed(void); BOOL SetPalette(LPLOGPALETTE palette, SetPaletteAction action=SPA_NONE); @@ -623,9 +595,7 @@ class SURFACES_API cSurface void RestoreWindowedMode(HWND hWnd); void CopyScreenModeInfo(cSurface* pSrc); -#ifdef HWABETA BOOL SetAutoVSync(int nAutoVSync); -#endif BOOL WaitForVBlank(); // System colors @@ -636,6 +606,7 @@ class SURFACES_API cSurface void SetTransparentColor(COLORREF rgb); COLORREF GetTransparentColor(); int GetTransparentColorIndex(); +// void SetOpaque(BOOL bOpaque); // Alpha channel BOOL HasAlpha(); @@ -650,14 +621,12 @@ class SURFACES_API cSurface void ReleaseAlphaSurface(cSurface* pAlphaSf); // Transparent monochrome mask - DWORD CreateMask(LPSMASK pMask, UINT dwFlags); + DWORD CreateMask(LPSMASK pMask, UINT dwFlags); // Lost device callback -#ifdef HWABETA void OnLostDevice(); void AddLostDeviceCallBack(LOSTDEVICECALLBACKPROC pCallback, LPARAM lUserParam); void RemoveLostDeviceCallBack(LOSTDEVICECALLBACKPROC pCallback, LPARAM lUserParam); -#endif // Friend functions // ---------------- diff --git a/Inc/WinMacro.h b/Inc/WinMacro.h index 82c50d5..02aa31f 100644 --- a/Inc/WinMacro.h +++ b/Inc/WinMacro.h @@ -9,7 +9,7 @@ #ifdef WIN32 // Fonctions C -#ifndef _fmemcpy +#ifndef _fmalloc #define _fmemcpy(a, b, c) memcpy(a, b, c) #define _fmemccpy(a,b,c,d) _memccpy(a,b,c,d); #define _fmemmove(a, b, c) memmove(a, b, c) diff --git a/Inc/cncr.h b/Inc/cncr.h index 6b87bda..3c09e0c 100644 --- a/Inc/cncr.h +++ b/Inc/cncr.h @@ -14,6 +14,7 @@ class CRunApp; class CEffectEx; class CPList; #endif +class CPArray; #else #define cSurface void #define CTransition void @@ -22,6 +23,7 @@ class CPList; #define CEffectEx void #define CPList void #endif +#define CPArray void #endif ////////////////////////////////////////////////////////////////////////////// @@ -175,6 +177,10 @@ typedef struct RunFrameLayer LPARAM dwEffectParam; // CEffectEx si extended #endif // HWABETA + // LO index lists per zone + // /zone : offset 1st index, # indexes + CPArray* m_loZones; + // Backup for restart DWORD backUp_dwOptions; float backUp_xCoef; @@ -182,11 +188,6 @@ typedef struct RunFrameLayer DWORD backUp_nBkdLOs; DWORD backUp_nFirstLOIndex; -#ifdef HWABETA -// DWORD backUp_dwEffect; // A voir -// LPARAM backUp_dwEffectParam; -#endif // HWABETA - } RunFrameLayer; // Object transition data @@ -217,17 +218,17 @@ typedef objTransInfo * LPOBJTRANSINFO; // Frame at runtime // -#define MAX_TEMPSTRING 16 -#define IPHONEOPT_JOYSTICK_FIRE1 0x0001 -#define IPHONEOPT_JOYSTICK_FIRE2 0x0002 -#define IPHONEOPT_JOYSTICK_LEFTHAND 0x0004 -#define IPHONEFOPT_MULTITOUCH 0x0008 -#define IPHONEFOPT_SCREENLOCKING 0x0010 -#define IPHONEFOPT_IPHONEFRAMEIAD 0x0020 -#define JOYSTICK_NONE 0x0000 -#define JOYSTICK_TOUCH 0x0001 -#define JOYSTICK_ACCELEROMETER 0x0002 -#define JOYSTICK_EXT 0x0003 +#define MAX_TEMPSTRING 16 +#define IPHONEOPT_JOYSTICK_FIRE1 0x0001 +#define IPHONEOPT_JOYSTICK_FIRE2 0x0002 +#define IPHONEOPT_JOYSTICK_LEFTHAND 0x0004 +#define IPHONEFOPT_MULTITOUCH 0x0008 +#define IPHONEFOPT_SCREENLOCKING 0x0010 +#define IPHONEFOPT_IPHONEFRAMEIAD 0x0020 +#define JOYSTICK_NONE 0x0000 +#define JOYSTICK_TOUCH 0x0001 +#define JOYSTICK_ACCELEROMETER 0x0002 +#define JOYSTICK_EXT 0x0003 #ifdef __cplusplus @@ -328,7 +329,7 @@ typedef struct CRunFrame { LPTSTR m_pTempString[MAX_TEMPSTRING]; // not used // Other - cSurface* m_pSaveSurface; + LPVOID m_pfree; // cSurface* m_pSaveSurface; int m_leEditWinWidth; int m_leEditWinHeight; DWORD m_dwColMaskBits; @@ -351,6 +352,18 @@ typedef struct CRunFrame { // List of sub-app surfaces to refresh at the end in D3D full screen mode CPList* m_pSurfacedSubApps; + + // Scale & angle + float m_xScale; + float m_yScale; + float m_scale; // not used for display + float m_angle; + + // Hotspot + POINT m_hotSpot; + + // Destination point + POINT m_destPoint; #endif #ifdef __cplusplus @@ -437,7 +450,7 @@ typedef struct CRunApp { // Extensions int m_nbKpx; // Number of extensions fpKpxFunc m_kpxTab; // Function table 1 - fpkpdt m_kpxDataTable; // Function table 2 + fpkpdt m_kpxDataTable; // Function table 2 // Movement Extensions int m_nbMvx; // Number of extensions @@ -576,16 +589,14 @@ typedef struct CRunApp { BOOL m_bLoading; // Bluray - LPVOID m_pBROpt; + LPPLURAYAPPOPTIONS m_pBROpt; // Build info AppHeader2* m_pHdr2; // Code page -#ifdef _UNICODE DWORD m_dwCodePage; bool m_bUnicodeAppFile; -#endif // Effects #ifdef HWABETA @@ -596,6 +607,10 @@ typedef struct CRunApp { int m_nSubAppShowCount; // to show the child window otherwise it's not displayed... #endif // HWABETA + // Character encoding + DWORD m_charEncodingInput; + DWORD m_charEncodingOutput; + #ifdef __cplusplus }; #else diff --git a/Lib/mmfs2.lib b/Lib/mmfs2.lib index c3279abae049a2f482bbebbe576a20fac3e341b3..b5866fb6e7973cc20941a5b9e3b7f2e2def7d54b 100644 GIT binary patch literal 322530 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 delta 43943 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 ewCL&5HBp(#DWiw=8<8 Date: Sat, 15 Mar 2014 22:54:31 -0500 Subject: [PATCH 085/127] Update json-parser --- Lib/json.c | 52 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/Lib/json.c b/Lib/json.c index 8ce0205..9264c3f 100644 --- a/Lib/json.c +++ b/Lib/json.c @@ -46,7 +46,7 @@ #include #include -typedef unsigned short json_uchar; +typedef unsigned int json_uchar; static unsigned char hex_value (json_char c) { @@ -295,12 +295,29 @@ json_value * json_parse_ex (json_settings * settings, goto e_failed; } - uc_b1 = uc_b1 * 16 + uc_b2; - uc_b2 = uc_b3 * 16 + uc_b4; + uc_b1 = (uc_b1 << 4) | uc_b2; + uc_b2 = (uc_b3 << 4) | uc_b4; + uchar = (uc_b1 << 8) | uc_b2; - uchar = ((json_char) uc_b1) * 256 + uc_b2; + if ((uchar & 0xF800) == 0xD800) { + json_uchar uchar2; + + if (end - i < 6 || (*++ i) != '\\' || (*++ i) != 'u' || + (uc_b1 = hex_value (*++ i)) == 0xFF || (uc_b2 = hex_value (*++ i)) == 0xFF + || (uc_b3 = hex_value (*++ i)) == 0xFF || (uc_b4 = hex_value (*++ i)) == 0xFF) + { + sprintf (error, "Invalid character value `%c` (at %d:%d)", b, cur_line, e_off); + goto e_failed; + } - if (sizeof (json_char) >= sizeof (json_uchar) || (uc_b1 == 0 && uc_b2 <= 0x7F)) + uc_b1 = (uc_b1 << 4) | uc_b2; + uc_b2 = (uc_b3 << 4) | uc_b4; + uchar2 = (uc_b1 << 8) | uc_b2; + + uchar = 0x010000 | ((uchar & 0x3FF) << 10) | (uchar2 & 0x3FF); + } + + if (sizeof (json_char) >= sizeof (json_uchar) || (uchar <= 0x7F)) { string_add ((json_char) uchar); break; @@ -311,19 +328,32 @@ json_value * json_parse_ex (json_settings * settings, if (state.first_pass) string_length += 2; else - { string [string_length ++] = 0xC0 | ((uc_b2 & 0xC0) >> 6) | ((uc_b1 & 0x7) << 2); - string [string_length ++] = 0x80 | (uc_b2 & 0x3F); + { string [string_length ++] = 0xC0 | (uchar >> 6); + string [string_length ++] = 0x80 | (uchar & 0x3F); } break; } + if (uchar <= 0xFFFF) { + if (state.first_pass) + string_length += 3; + else + { string [string_length ++] = 0xE0 | (uchar >> 12); + string [string_length ++] = 0x80 | ((uchar >> 6) & 0x3F); + string [string_length ++] = 0x80 | (uchar & 0x3F); + } + + break; + } + if (state.first_pass) - string_length += 3; + string_length += 4; else - { string [string_length ++] = 0xE0 | ((uc_b1 & 0xF0) >> 4); - string [string_length ++] = 0x80 | ((uc_b1 & 0xF) << 2) | ((uc_b2 & 0xC0) >> 6); - string [string_length ++] = 0x80 | (uc_b2 & 0x3F); + { string [string_length ++] = 0xF0 | (uchar >> 18); + string [string_length ++] = 0x80 | ((uchar >> 12) & 0x3F); + string [string_length ++] = 0x80 | ((uchar >> 6) & 0x3F); + string [string_length ++] = 0x80 | (uchar & 0x3F); } break; From 819e4d9ae338307ba2ca8d794f19dc317e4008c8 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 15 Mar 2014 23:14:03 -0500 Subject: [PATCH 086/127] Make template project trees more similar --- .../Template/{Extension.h => Extension.hpp} | 0 Extensions/Template/Template.vcproj | 663 +++++++++--------- Extensions/TemplatePlus/Template.vcproj | 2 +- 3 files changed, 344 insertions(+), 321 deletions(-) rename Extensions/Template/{Extension.h => Extension.hpp} (100%) diff --git a/Extensions/Template/Extension.h b/Extensions/Template/Extension.hpp similarity index 100% rename from Extensions/Template/Extension.h rename to Extensions/Template/Extension.hpp diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index 237afab..09f176e 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -1,7 +1,7 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1298,260 +1368,213 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - diff --git a/Extensions/TemplatePlus/Template.vcproj b/Extensions/TemplatePlus/Template.vcproj index f96a3ad..f5b08c3 100644 --- a/Extensions/TemplatePlus/Template.vcproj +++ b/Extensions/TemplatePlus/Template.vcproj @@ -1496,7 +1496,7 @@ Date: Sun, 16 Mar 2014 00:05:17 -0500 Subject: [PATCH 087/127] Update plain template extension files and Common.h --- Extensions/Template/Actions.cpp | 7 + Extensions/Template/Common.h | 64 +++++-- Extensions/Template/Conditions.cpp | 11 +- Extensions/Template/Edittime.cpp | 20 +- Extensions/Template/Expressions.cpp | 16 +- Extensions/Template/Extension.cpp | 231 ++++++++++++++---------- Extensions/Template/Extension.hpp | 208 +++++++++++++-------- Extensions/Template/General.cpp | 20 +- Extensions/Template/Runtime.cpp | 4 +- Extensions/TemplatePlus/Common.h | 9 +- Extensions/TemplatePlus/Expressions.cpp | 2 +- Extensions/TemplatePlus/Extension.cpp | 37 ++-- Extensions/TemplatePlus/Extension.hpp | 16 +- Inc/Edif.h | 17 +- Lib/Edif.cpp | 4 +- 15 files changed, 405 insertions(+), 261 deletions(-) diff --git a/Extensions/Template/Actions.cpp b/Extensions/Template/Actions.cpp index e798f4c..4e38040 100644 --- a/Extensions/Template/Actions.cpp +++ b/Extensions/Template/Actions.cpp @@ -1,3 +1,10 @@ +/* Actions.cpp + * This is where you should define the + * behavior of your actions. Make sure + * the parameters match those in the JSON + * exactly! Double check Extension.h + * as well. + */ #include "Common.h" diff --git a/Extensions/Template/Common.h b/Extensions/Template/Common.h index 95add92..7cf1173 100644 --- a/Extensions/Template/Common.h +++ b/Extensions/Template/Common.h @@ -1,23 +1,61 @@ +/* Common.h + * This is the common header file included + * by almost all other *.cpp files in + * the project. Anything that gets put or + * included in here will be available to you + * everywhere else. You shouldn't need to + * change anything in this file except + * to include headers that you want and + * to change the edition of MMF2 you want + * to support. + */ + #pragma once -// #define TGFEXT // TGF2, MMF2, MMF2 Dev - #define MMFEXT // MMF2, MMF2 Dev -// #define PROEXT // MMF2 Dev only +//Only define one of these at once: +// #define TGFEXT //TGF2.0, MMF2.0, CTF2.5, MMF2.0 Dev, CTF2.5 Dev + #define MMFEXT // MMF2.0, CTF2.5, MMF2.0 Dev, CTF2.5 Dev +// #define PROEXT // MMF2.0 Dev, CTF2.5 Dev + +#define EDIF_PLAIN_EDITDATA +#include "Edif.h" +#include "Resource.h" -#include "Edif.h" -#include "Resource.h" +//#include +//#include "YourHeader.hpp" -// edPtr : Used at edittime and saved in the MFA/CCN/EXE files +/* stdtstring + * A std::string that knows if you're using + * unicode or not. (Protip: strings passed + * to your extension A/C/Es still need to be + * const TCHAR *, and the same goes for strings + * returned from expressions and conditions). + */ +typedef std::basic_string stdtstring; +/* EDITDATA + * This is the editdata. Be careful, any data + * in here is fully serialized, ready to be + * written to a file on disk, such as the + * MFA or EXE file. It will also be this way + * when you get access to it in other + * runtimes, so it has to be a flat format. + */ struct EDITDATA { - // Header - required - extHeader eHeader; - - // Object's data -// short swidth; -// short sheight; + /* Header + * This required data member contains + * information about your extension for + * MMF2, such as the version number + * from Extension::Version. + */ + extHeader Header; + /* + Here you put the flattened data members, + or you can use a dynamic approach like + TemplatePlus uses. + */ }; -#include "Extension.h" +#include "Extension.hpp" diff --git a/Extensions/Template/Conditions.cpp b/Extensions/Template/Conditions.cpp index 00f3a10..41b2b7b 100644 --- a/Extensions/Template/Conditions.cpp +++ b/Extensions/Template/Conditions.cpp @@ -1,9 +1,14 @@ +/* Conditions.cpp + * This is where you should define the + * behavior of your conditions. Make sure + * the parameters and return types match those + * in the JSON exactly! Double check Extension.h + * as well. + */ #include "Common.h" bool Extension::AreTwoNumbersEqual(int First, int Second) { - return First == Second; + return First == Second; } - - diff --git a/Extensions/Template/Edittime.cpp b/Extensions/Template/Edittime.cpp index ce41fa8..ec47496 100644 --- a/Extensions/Template/Edittime.cpp +++ b/Extensions/Template/Edittime.cpp @@ -78,13 +78,13 @@ int WINAPI DLLExport MakeIconEx ( mv _far *mV, cSurface* pIconSf, LPTSTR lpName, { #ifndef RUN_ONLY - pIconSf->Delete(); - pIconSf->Clone(*SDK->Icon); + pIconSf->Delete(); + pIconSf->Clone(*SDK->Icon); - pIconSf->SetTransparentColor(RGB(255, 0, 255)); + pIconSf->SetTransparentColor(RGB(255, 0, 255)); #endif // !defined(RUN_ONLY) - return 0; + return 0; } @@ -101,13 +101,13 @@ int WINAPI DLLExport CreateObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr) // Check compatibility if ( IS_COMPATIBLE(mV) ) { - Edif::Init(mV, edPtr); + Edif::Init(mV, edPtr); // Set default object settings // edPtr->swidth = 48; // edPtr->sheight = 48; - return 0; + return 0; } #endif // !defined(RUN_ONLY) @@ -169,9 +169,9 @@ void WINAPI DLLExport RemoveObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr, u { #ifndef RUN_ONLY // Is the last object removed? - if (0 == cpt) + if (0 == cpt) { - Edif::Free(edPtr); + Edif::Free(edPtr); // Do whatever necessary to remove our data } @@ -217,9 +217,9 @@ void WINAPI DLLExport EditorDisplay(mv _far *mV, fpObjInfo oiPtr, fpLevObj loPtr LPSURFACE Surface = WinGetSurface((int) mV->mvIdEditWin); if(!Surface) - return; + return; - SDK->Icon->Blit(*Surface, rc->left, rc->top, BMODE_TRANSP, BOP_COPY, 0); + SDK->Icon->Blit(*Surface, rc->left, rc->top, BMODE_TRANSP, BOP_COPY, 0); #endif // !defined(RUN_ONLY) } diff --git a/Extensions/Template/Expressions.cpp b/Extensions/Template/Expressions.cpp index 6ddc908..cad6ed0 100644 --- a/Extensions/Template/Expressions.cpp +++ b/Extensions/Template/Expressions.cpp @@ -1,12 +1,20 @@ +/* Expressions.cpp + * This is where you should define the + * behavior of your expressions. Make sure + * the parameters and return types match those + * in the JSON exactly! Double check Extension.h + * as well. + */ #include "Common.h" int Extension::Add(int First, int Second) { - return First + Second; + return First + Second; } -const char * Extension::HelloWorld() +TCHAR const * Extension::HelloWorld() { - return "Hello world!"; -} \ No newline at end of file + return _T("Hello world!"); + //return Runtime.CopyString(MyString.c_str()); //for stdtstrings +} diff --git a/Extensions/Template/Extension.cpp b/Extensions/Template/Extension.cpp index 287df33..bda30dc 100644 --- a/Extensions/Template/Extension.cpp +++ b/Extensions/Template/Extension.cpp @@ -1,160 +1,191 @@ +/* Extension.cpp + * This file contains the definitions for + * your extension's general runtime functions, + * such as the constructor and destructor, + * handling routines, etc. + * Functions defined here: + * Extension::Extension + * Extension::~Extension + * Extension::Handle + * Extension::Display + * Extension::Pause + * Extension::Continue + * Extension::Save + * Extension::Load + * Extension::Action <--| + * Extension::Condition <--|- not what you think! + * Extension::Expression <--| + */ #include "Common.h" - -/// -/// EXTENSION CONSTRUCTOR/DESTRUCTOR -/// - +/* + * This is your extension's constructor, which + * is the replacement for the old CreateRunObject + * function. You don't need to manually call + * constructors or pointlessly initialize + * pointers with dynamic memory. Just link + * your A/C/Es, perform initialization steps, and + * you're good to go. + */ Extension::Extension(LPRDATA _rdPtr, LPEDATA edPtr, fpcob cobPtr) - : rdPtr(_rdPtr), rhPtr(_rdPtr->rHo.hoAdRunHeader), Runtime(_rdPtr) +: rdPtr(_rdPtr) +, rhPtr(_rdPtr->rHo.hoAdRunHeader) +, Runtime(_rdPtr) { - /* - Link all your action/condition/expression functions to their IDs to match the - IDs in the JSON here - */ - - LinkAction(0, ActionExample); - LinkAction(1, SecondActionExample); - - LinkCondition(0, AreTwoNumbersEqual); + //Link all your action/condition/expression functions + //to their IDs to match the IDs in the JSON here. + LinkAction(0, ActionExample); + LinkAction(1, SecondActionExample); - LinkExpression(0, Add); - LinkExpression(1, HelloWorld); + LinkCondition(0, AreTwoNumbersEqual); + LinkExpression(0, Add); + LinkExpression(1, HelloWorld); - /* - This is where you'd do anything you'd do in CreateRunObject in the original SDK - It's the only place you'll get access to edPtr at runtime, so you should transfer - anything from edPtr to the extension class here. - - */ + //This is where you'd do anything you'd do in CreateRunObject in the original SDK. + //It's the only place you'll get access to the editdata at runtime, so you should + //transfer anything from the editdata to the extension class here. For example: +// EditData ed (SED); +// MyString = ed.MyString; +// MyInt = ed.MyInt; +// MyArray = ed.MyArray; - - + // } +/* + * This is your extension's destructor, the + * replacement for DestroyRunObject. No calling + * destructors manually or deallocating pointless + * dynamic memory - in most cases this function + * won't need any code written. + */ Extension::~Extension() { - /* - This is where you'd do anything you'd do in DestroyRunObject in the original SDK. - (except calling destructors and other such atrocities, because that's automatic in Edif) - */ - - - + // } - +/* Handle + * MMF2 calls this function to let your extension + * "live" - if you want, you can have MMF2 call this + * every frame. This is where you'd, for instance, + * simulate physics or move an object. This is + * the analagous function to the old HandleRunObject. + */ short Extension::Handle() { - /* - If your extension will draw to the MMF window you should first - check if anything about its display has changed : + /* + If your extension will draw to the MMF window you should first + check if anything about its display has changed : - if (rdPtr->roc.rcChanged) - return REFLAG_DISPLAY; - else - return 0; + if (rdPtr->roc.rcChanged) return REFLAG_DISPLAY; + else return 0; - You will also need to make sure you change this flag yourself - to 1 whenever you want to redraw your object - - If your extension won't draw to the window, but it still needs - to do something every MMF loop use : + You will also need to make sure you change this flag yourself + to 1 whenever you want to redraw your object - return 0; + If your extension won't draw to the window, but it still needs + to do something every MMF2 loop use: - If you don't need to do something every loop, use : + return 0; - return REFLAG_ONESHOT; + If you don't need to do something every loop, use : - This doesn't mean this function can never run again. If you want MMF - to handle your object again (causing this code to run) use this function: + return REFLAG_ONESHOT; - Runtime.Rehandle(); + This doesn't mean this function can never run again. If you want MMF2 + to handle your object again (causing this code to run) use this function: - At the end of the loop this code will run + Runtime.Rehandle(); - */ + At the end of the event loop this code will run. + */ - // Will not be called next loop + //Will not be called next loop return REFLAG_ONESHOT; } - +/* Display + * This is the analagous function to + * DisplayRunObject. If you return + * REFLAG_DISPLAY in Handle() this + * routine will run. If you want MMF2 + * to apply ink effects for you, then + * implement GetRunObjectSurface in + * Runtime.cpp instead. + */ short Extension::Display() { - /* - If you return REFLAG_DISPLAY in Handle() this routine will run. - */ - - // Ok - return 0; + return 0; } +/* Pause + * If your extension plays sound, for + * example, then MMF2 calls this to + * let you know to pause the music, + * usually by another extension's request + * or by the player pausing the applcation. + */ short Extension::Pause() { - - // Ok - return 0; + return 0; } +/* Continue + * Opposite to the above, MMF2 lets + * you know that the silence is over; + * your extension may live again. + */ short Extension::Continue() { - - // Ok - return 0; + return 0; } +/* Save + * When the user uses the Save + * Frame Position action, you need + * so serialize your runtime data to + * the File given. It is a Windows + * file handle, but you can use some + * of MMF2's built-in functions for + * writing files. Check the MMF2SDK + * Help file for more information. + */ bool Extension::Save(HANDLE File) { - bool OK = false; - - #ifndef VITALIZE - - // Save the object's data here - - OK = true; - - #endif - - return OK; + return true; } +/* Load + * As opposed to above, here you need to + * restore your extension's runtime state + * from the given file. Only read what you + * wrote! + */ bool Extension::Load(HANDLE File) { - bool OK = false; - - #ifndef VITALIZE - - // Load the object's data here - - OK = true; - - #endif - - return OK; + return true; } -// These are called if there's no function linked to an ID - -void Extension::Action(int ID, LPRDATA rdPtr, long param1, long param2) +/* Action, Condition, Expression + * These are called if there's no function linked + * to an ID. You may want to put MessageBox calls + * to let you know that the ID is unlinked, or you + * may just want to use unlinked A/C/Es as a feature. + */ +void Extension::Action(int ID, RD *rd, long param1, long param2) { - } -long Extension::Condition(int ID, LPRDATA rdPtr, long param1, long param2) +long Extension::Condition(int ID, RD *rd, long param1, long param2) { - - return false; + return false; //hopefully StringComparison (PARAM_CMPSTRING) is not used, or this may crash } -long Extension::Expression(int ID, LPRDATA rdPtr, long param) +long Extension::Expression(int ID, RD *rd, long param) { - - return 0; + return long(_T("")); //so that unlinked expressions that return strings won't crash } - diff --git a/Extensions/Template/Extension.hpp b/Extensions/Template/Extension.hpp index c3fee2e..1910b41 100644 --- a/Extensions/Template/Extension.hpp +++ b/Extensions/Template/Extension.hpp @@ -1,83 +1,133 @@ +/* Extension.h + * This is where you define your extension + * class. Runtime variables and function + * declarations go in here; A/C/E function + * definitions go in their respective .cpp + * files, other function definitions go in + * Extension.cpp. This header is included + * at the bottom of Common.h, so you have + * access to everything included by it. + */ class Extension { public: - - LPRDATA rdPtr; - LPRH rhPtr; - - Edif::Runtime Runtime; - - static const int MinimumBuild = 251; - static const int Version = 1; - - static const int OEFLAGS = 0; - static const int OEPREFS = 0; - - static const int WindowProcPriority = 100; - - Extension(LPRDATA rdPtr, LPEDATA edPtr, fpcob cobPtr); - ~Extension(); - - - /* Add any data you want to store in your extension to this class - (eg. what you'd normally store in rdPtr) - - Unlike rdPtr, you can store real C++ objects with constructors - and destructors, without having to call them manually or store - a pointer. - */ - - // int MyVariable; - - - - - /* Add your actions, conditions and expressions as real class member - functions here. The arguments (and return type for expressions) must - match EXACTLY what you defined in the JSON. - - Remember to link the actions, conditions and expressions to their - numeric IDs in the class constructor (Extension.cpp) - */ - - /// Actions - - void ActionExample(int ExampleParameter); - void SecondActionExample(); - - /// Conditions - - bool AreTwoNumbersEqual(int FirstNumber, int SecondNumber); - - /// Expressions - - int Add(int FirstNumber, int SecondNumber); - const char * HelloWorld(); - - - - /* These are called if there's no function linked to an ID */ - - void Action(int ID, LPRDATA rdPtr, long param1, long param2); - long Condition(int ID, LPRDATA rdPtr, long param1, long param2); - long Expression(int ID, LPRDATA rdPtr, long param); - - - - - /* These replace the functions like HandleRunObject that used to be - implemented in Runtime.cpp. They work exactly the same, but they're - inside the extension class. - */ - - short Handle(); - short Display(); - - short Pause(); - short Continue(); - - bool Save(HANDLE File); - bool Load(HANDLE File); - -}; \ No newline at end of file + /* rdPtr + * This is a pointer to the classic + * RunData structure. Some things still + * have to be stored there for MMF2's + * sake, so you need to have acces to + * that data. You should not modify + * the rundata structure, however, + * as it is global to all extensions. + */ + LPRDATA rdPtr; + + /* rhPtr + * This is a pointer to the RunHeader + * structure, which contains some + * application information. + */ + LPRH rhPtr; + + /* Runtime + * This is EDIF's compendium of useful + * functions for every day life as an + * extension. You can trigger immediate + * events, read and write global data, + * etc. See the EDIF wiki for more + * information. + */ + Edif::Runtime Runtime; + + /* MinimumBuild + * Always set this to the latest build + * of MMF2 that has been released, unless + * you need to set it higher for a beta + * version of MMF2 to get access to some + * new SDK feature. + */ + static const int MinimumBuild = 257; + + /* Version + * This is the version of your extension + * that is stored in the editdata. You should + * only change this when your editdata structure + * changes, not just when you have a new version + * of your extension with new features. + */ + static const int Version = 1; + + /* OEFLAGS, OEPREFS + * These are settings for your extension + * that tell MMF2 how to treat your extension + * and what behaviors and responsibilities + * to add. Check the MMF2SDK Help file for + * more detailed information on the flags you + * can set and what they implicate. + */ + static const int OEFLAGS = OEFLAG_VALUES|OEFLAG_RUNBEFOREFADEIN|OEFLAG_NEVERKILL; + static const int OEPREFS = 0; + + /* WindowProcPriority + * If your extension creates a Window + * and implements the WindowProc function, + * this is the priority for that stuff. + */ + static const int WindowProcPriority = 100; + + Extension(LPRDATA rdPtr, LPEDATA edPtr, fpcob cobPtr); //defined & documented in Extension.cpp + ~Extension(); //defined & documented in Extension.cpp + + + /* Add any data you want to store in your + * extension to this class (eg. what you'd + * normally store in the rundata). Unlike + * other SDKs, you can store real C++ + * objects with constructors and destructors, + * without having to call them manually or + * store a pointer. + */ + + //stdtstring MyString; + //int MyInt; + //std::vector MyArray; + + + /* Add your actions, conditions, and expressions + * as real class member functions here. The arguments + * (and return types for expressions/conditions) + * must match EXACTLY what you defined in the JSON. + * As a handy tip, all parameters will be either + * a pointer, an int, or a float (each only 4 bytes) + * and the same applies to return types. Remember to + * link the actions, conditions and expressions to their + * numeric IDs in the class constructor in Extension.cpp. + */ + + //Actions - Defined in Actions.cpp + void ActionExample(int ExampleParameter); + void SecondActionExample(); + + //Conditions - Defined in Conditions.cpp + bool AreTwoNumbersEqual(int FirstNumber, int SecondNumber); + + //Expressions - Defined in Expressions.cpp + int Add(int FirstNumber, int SecondNumber); + const TCHAR * HelloWorld(); + + + short Handle(); //defined & documented in Extension.cpp + short Display(); //defined & documented in Extension.cpp + + short Pause(); //defined & documented in Extension.cpp + short Continue(); //defined & documented in Extension.cpp + + bool Save(HANDLE File); //defined & documented in Extension.cpp + bool Load(HANDLE File); //defined & documented in Extension.cpp + + //defined & documented in Extension.cpp + void Action(int ID, RD *rd, long param1, long param2); + long Condition(int ID, RD *rd, long param1, long param2); + long Expression(int ID, RD *rd, long param); +}; diff --git a/Extensions/Template/General.cpp b/Extensions/Template/General.cpp index 41f53af..300c940 100644 --- a/Extensions/Template/General.cpp +++ b/Extensions/Template/General.cpp @@ -41,7 +41,7 @@ BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) break; // The calling process is detaching the DLL from its address space. - case DLL_PROCESS_DETACH: + case DLL_PROCESS_DETACH: break; } @@ -58,7 +58,7 @@ BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) // extern "C" int WINAPI DLLExport Initialize(mv _far *mV, int quiet) { - return Edif::Init(mV); + return Edif::Init(mV); // No error @@ -73,7 +73,7 @@ extern "C" int WINAPI DLLExport Initialize(mv _far *mV, int quiet) // extern "C" int WINAPI DLLExport Free(mv _far *mV) { - Edif::Free(mV); + Edif::Free(mV); // No error return 0; @@ -95,7 +95,7 @@ extern "C" int WINAPI DLLExport Free(mv _far *mV) // int WINAPI DLLExport LoadObject(mv _far *mV, LPCSTR fileName, LPEDATA edPtr, int reserved) { - Edif::Init(mV, edPtr); + Edif::Init(mV, edPtr); return 0; @@ -147,17 +147,17 @@ void WINAPI DLLExport UpdateFileNames(mv _far *mV, LPSTR appName, LPEDATA edPtr, // /* int WINAPI DLLExport EnumElts (mv __far *mV, LPEDATA edPtr, ENUMELTPROC enumProc, ENUMELTPROC undoProc, LPARAM lp1, LPARAM lp2) -{ +{ int error = 0; // Replace wImgIdx with the name of the WORD variable you create within the edit structure - - // Enum images + + // Enum images if ( (error = enumProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2)) != 0 ) { - // Undo enum images - undoProc (&edPtr->wImgIdx, IMG_TAB, lp1, lp2); - } + // Undo enum images + undoProc (&edPtr->wImgIdx, IMG_TAB, lp1, lp2); + } return error; } diff --git a/Extensions/Template/Runtime.cpp b/Extensions/Template/Runtime.cpp index 44a0d48..1c1695d 100644 --- a/Extensions/Template/Runtime.cpp +++ b/Extensions/Template/Runtime.cpp @@ -173,8 +173,8 @@ void WINAPI DLLExport EndFrame(mv _far *mV, DWORD dwReserved, int nFrameIndex) // /* - // Note: do not forget to enable the functions in the .def file - // if you remove the comments below. + // Note: do not forget to enable the functions in the .def file + // if you remove the comments below. void WINAPI GetRunObjectFont(LPRDATA rdPtr, LOGFONT* pLf) { diff --git a/Extensions/TemplatePlus/Common.h b/Extensions/TemplatePlus/Common.h index ea20fc2..24de0fe 100644 --- a/Extensions/TemplatePlus/Common.h +++ b/Extensions/TemplatePlus/Common.h @@ -13,12 +13,9 @@ #pragma once //Only define one of these at once: -// #define TGFEXT //TGF2, MMF2, MMF2 Dev - #define MMFEXT //MMF2, MMF2 Dev -// #define PROEXT //MMF2 Dev only - -//Define this if you want legacy comma-less JSON support -// #define UsingJsonWithoutCommas +// #define TGFEXT //TGF2.0, MMF2.0, CTF2.5, MMF2.0 Dev, CTF2.5 Dev + #define MMFEXT // MMF2.0, CTF2.5, MMF2.0 Dev, CTF2.5 Dev +// #define PROEXT // MMF2.0 Dev, CTF2.5 Dev #include "Edif.h" #include "Resource.h" diff --git a/Extensions/TemplatePlus/Expressions.cpp b/Extensions/TemplatePlus/Expressions.cpp index 65a6afa..cad6ed0 100644 --- a/Extensions/TemplatePlus/Expressions.cpp +++ b/Extensions/TemplatePlus/Expressions.cpp @@ -13,7 +13,7 @@ int Extension::Add(int First, int Second) return First + Second; } -const TCHAR *Extension::HelloWorld() +TCHAR const * Extension::HelloWorld() { return _T("Hello world!"); //return Runtime.CopyString(MyString.c_str()); //for stdtstrings diff --git a/Extensions/TemplatePlus/Extension.cpp b/Extensions/TemplatePlus/Extension.cpp index 8988773..a32768a 100644 --- a/Extensions/TemplatePlus/Extension.cpp +++ b/Extensions/TemplatePlus/Extension.cpp @@ -28,7 +28,10 @@ * your A/C/Es, perform initialization steps, and * you're good to go. */ -Extension::Extension(RD *rd, SerializedED *SED, createObjectInfo *COB) : rd(rd), rh(rd->rHo.hoAdRunHeader), Runtime(rd) +Extension::Extension(RD *rd, SerializedED *SED, createObjectInfo *COB) +: rd(rd) +, rh(rd->rHo.hoAdRunHeader) +, Runtime(rd) { //Link all your action/condition/expression functions //to their IDs to match the IDs in the JSON here. @@ -74,31 +77,30 @@ Extension::~Extension() short Extension::Handle() { /* - If your extension will draw to the MMF window you should first - check if anything about its display has changed : + If your extension will draw to the MMF window you should first + check if anything about its display has changed : - if (rd->roc.rcChanged) return REFLAG_DISPLAY; - else return 0; + if (rd->roc.rcChanged) return REFLAG_DISPLAY; + else return 0; - You will also need to make sure you change this flag yourself - to 1 whenever you want to redraw your object - - If your extension won't draw to the window, but it still needs - to do something every MMF2 loop use: + You will also need to make sure you change this flag yourself + to 1 whenever you want to redraw your object - return 0; + If your extension won't draw to the window, but it still needs + to do something every MMF2 loop use: - If you don't need to do something every loop, use : + return 0; - return REFLAG_ONESHOT; + If you don't need to do something every loop, use : - This doesn't mean this function can never run again. If you want MMF2 - to handle your object again (causing this code to run) use this function: + return REFLAG_ONESHOT; - Runtime.Rehandle(); + This doesn't mean this function can never run again. If you want MMF2 + to handle your object again (causing this code to run) use this function: - At the end of the event loop this code will run. + Runtime.Rehandle(); + At the end of the event loop this code will run. */ //Will not be called next loop @@ -187,4 +189,3 @@ long Extension::Expression(int ID, RD *rd, long param) { return long(_T("")); //so that unlinked expressions that return strings won't crash } - diff --git a/Extensions/TemplatePlus/Extension.hpp b/Extensions/TemplatePlus/Extension.hpp index ea46464..8661559 100644 --- a/Extensions/TemplatePlus/Extension.hpp +++ b/Extensions/TemplatePlus/Extension.hpp @@ -76,8 +76,8 @@ class Extension */ static const int WindowProcPriority = 100; - Extension(RD *rd, SerializedED *SED, createObjectInfo *COB); //defined & documented in Extension.cpp - ~Extension(); //defined & documented in Extension.cpp + Extension(RD *rd, SerializedED *SED, createObjectInfo *COB); //defined & documented in Extension.cpp + ~Extension(); //defined & documented in Extension.cpp /* Add any data you want to store in your @@ -117,14 +117,14 @@ class Extension const TCHAR * HelloWorld(); - short Handle(); //defined & documented in Extension.cpp - short Display(); //defined & documented in Extension.cpp + short Handle(); //defined & documented in Extension.cpp + short Display(); //defined & documented in Extension.cpp - short Pause(); //defined & documented in Extension.cpp - short Continue(); //defined & documented in Extension.cpp + short Pause(); //defined & documented in Extension.cpp + short Continue(); //defined & documented in Extension.cpp - bool Save(HANDLE File); //defined & documented in Extension.cpp - bool Load(HANDLE File); //defined & documented in Extension.cpp + bool Save(HANDLE File); //defined & documented in Extension.cpp + bool Load(HANDLE File); //defined & documented in Extension.cpp //defined & documented in Extension.cpp void Action(int ID, RD *rd, long param1, long param2); diff --git a/Inc/Edif.h b/Inc/Edif.h index c04f78e..8308a92 100644 --- a/Inc/Edif.h +++ b/Inc/Edif.h @@ -38,14 +38,22 @@ class Extension; extern HINSTANCE hInstLib; -struct RD; typedef RD RUNDATA; typedef RUNDATA * LPRDATA; -struct SerializedED; typedef SerializedED EDITDATA; typedef EDITDATA * LPEDATA; +struct RD; +typedef RD RUNDATA; +typedef RUNDATA * LPRDATA; +#ifndef EDIF_PLAIN_EDITDATA +struct SerializedED; +typedef SerializedED EDITDATA; +#else +struct EDITDATA; +typedef EDITDATA SerializedED; +#endif +typedef EDITDATA * LPEDATA; LPEVENTINFOS2 GetEventInformations(LPEVENTINFOS2 eiPtr, short code); namespace Edif { - class SDK { public: @@ -249,6 +257,7 @@ struct RD #endif }; +#ifndef EDIF_PLAIN_EDITDATA /* SerializedED * This is the editdata. The class * name is a reminder - any data in @@ -281,7 +290,7 @@ struct SerializedED */ char data[1]; }; - #include "EDStream.hpp" +#endif #define MMF2Func WINAPI DLLExport diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 7ad57b3..3accb3d 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -154,9 +154,7 @@ int Edif::Init(mv _far * mV) json_settings settings; memset (&settings, 0, sizeof (settings)); -#ifdef UsingJsonWithoutCommas - settings.settings |= json_relaxed_commas; -#endif + settings.settings |= json_enable_comments; json_value * json = json_parse_ex (&settings, copy, JSON_Size, json_error); From cd9f3467442e5418e2291fc67cc6b46b95c4ed85 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 16 Mar 2014 01:16:07 -0500 Subject: [PATCH 088/127] Start splitting F2.0 from F2.5 --- Extensions/Template/Template.sln | 55 ++++++++++++------------ Extensions/Template/Template.vcproj | 18 ++++---- Extensions/TemplatePlus/Template.sln | 55 ++++++++++++------------ Extensions/TemplatePlus/Template.vcproj | 18 ++++---- Lib/mmfs2.0.lib | Bin 0 -> 229544 bytes Lib/{mmfs2hwa.lib => mmfs2.0hwa.lib} | Bin Lib/{mmfs2u.lib => mmfs2.0u.lib} | Bin Lib/{mmfs2.lib => mmfs2.5.lib} | Bin 8 files changed, 72 insertions(+), 74 deletions(-) create mode 100644 Lib/mmfs2.0.lib rename Lib/{mmfs2hwa.lib => mmfs2.0hwa.lib} (100%) rename Lib/{mmfs2u.lib => mmfs2.0u.lib} (100%) rename Lib/{mmfs2.lib => mmfs2.5.lib} (100%) diff --git a/Extensions/Template/Template.sln b/Extensions/Template/Template.sln index 9c29735..224d791 100644 --- a/Extensions/Template/Template.sln +++ b/Extensions/Template/Template.sln @@ -1,39 +1,38 @@ - Microsoft Visual Studio Solution File, Format Version 10.00 # Visual C++ Express 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template", "Template.vcproj", "{3BCB4C73-71F6-43B6-803D-41411F92652A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug HWA|Win32 = Debug HWA|Win32 - Debug Unicode|Win32 = Debug Unicode|Win32 - Debug|Win32 = Debug|Win32 - Edittime HWA|Win32 = Edittime HWA|Win32 - Edittime Unicode|Win32 = Edittime Unicode|Win32 - Edittime|Win32 = Edittime|Win32 - Runtime HWA|Win32 = Runtime HWA|Win32 - Runtime Unicode|Win32 = Runtime Unicode|Win32 - Runtime|Win32 = Runtime|Win32 + Debug HWA|Fusion-2.x = Debug HWA|Fusion-2.x + Debug Unicode|Fusion-2.x = Debug Unicode|Fusion-2.x + Debug|Fusion-2.x = Debug|Fusion-2.x + Edittime HWA|Fusion-2.x = Edittime HWA|Fusion-2.x + Edittime Unicode|Fusion-2.x = Edittime Unicode|Fusion-2.x + Edittime|Fusion-2.x = Edittime|Fusion-2.x + Runtime HWA|Fusion-2.x = Runtime HWA|Fusion-2.x + Runtime Unicode|Fusion-2.x = Runtime Unicode|Fusion-2.x + Runtime|Fusion-2.x = Runtime|Fusion-2.x EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Win32.ActiveCfg = Debug HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Win32.Build.0 = Debug HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Win32.ActiveCfg = Debug|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Win32.Build.0 = Debug|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Win32.ActiveCfg = Edittime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Win32.Build.0 = Edittime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Win32.ActiveCfg = Edittime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Win32.Build.0 = Edittime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Win32.ActiveCfg = Edittime|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Win32.Build.0 = Edittime|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Win32.ActiveCfg = Runtime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Win32.Build.0 = Runtime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Win32.ActiveCfg = Runtime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Win32.Build.0 = Runtime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Win32.ActiveCfg = Runtime|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Win32.Build.0 = Runtime|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Fusion-2.x.ActiveCfg = Debug HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Fusion-2.x.Build.0 = Debug HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Fusion-2.x.ActiveCfg = Debug Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Fusion-2.x.Build.0 = Debug Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.ActiveCfg = Debug|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.Build.0 = Debug|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Fusion-2.x.ActiveCfg = Edittime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Fusion-2.x.Build.0 = Edittime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Fusion-2.x.ActiveCfg = Edittime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Fusion-2.x.Build.0 = Edittime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.ActiveCfg = Edittime|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.Build.0 = Edittime|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Fusion-2.x.ActiveCfg = Runtime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Fusion-2.x.Build.0 = Runtime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Fusion-2.x.ActiveCfg = Runtime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Fusion-2.x.Build.0 = Runtime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.ActiveCfg = Runtime|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.Build.0 = Runtime|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index 09f176e..0104b9c 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -79,7 +79,7 @@ /> ?a| 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�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 bD<|9SRyzYhTJ^rI5LO$9O|CZrbK3s{oQ4u0 literal 0 HcmV?d00001 diff --git a/Lib/mmfs2hwa.lib b/Lib/mmfs2.0hwa.lib similarity index 100% rename from Lib/mmfs2hwa.lib rename to Lib/mmfs2.0hwa.lib diff --git a/Lib/mmfs2u.lib b/Lib/mmfs2.0u.lib similarity index 100% rename from Lib/mmfs2u.lib rename to Lib/mmfs2.0u.lib diff --git a/Lib/mmfs2.lib b/Lib/mmfs2.5.lib similarity index 100% rename from Lib/mmfs2.lib rename to Lib/mmfs2.5.lib From 9a23d959a4f4d911bfd9d73096e96f8999d910a3 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 16 Mar 2014 01:41:35 -0500 Subject: [PATCH 089/127] Fully separate F2.0 and F2.5 configurations --- Extensions/Template/Template.sln | 49 +++--- Extensions/Template/Template.vcproj | 201 +++++++++++------------ Extensions/TemplatePlus/Template.sln | 49 +++--- Extensions/TemplatePlus/Template.vcproj | 205 ++++++++++++------------ 4 files changed, 248 insertions(+), 256 deletions(-) diff --git a/Extensions/Template/Template.sln b/Extensions/Template/Template.sln index 224d791..1fea0ad 100644 --- a/Extensions/Template/Template.sln +++ b/Extensions/Template/Template.sln @@ -4,35 +4,30 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template", "Template.vcproj EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug HWA|Fusion-2.x = Debug HWA|Fusion-2.x - Debug Unicode|Fusion-2.x = Debug Unicode|Fusion-2.x - Debug|Fusion-2.x = Debug|Fusion-2.x - Edittime HWA|Fusion-2.x = Edittime HWA|Fusion-2.x - Edittime Unicode|Fusion-2.x = Edittime Unicode|Fusion-2.x - Edittime|Fusion-2.x = Edittime|Fusion-2.x - Runtime HWA|Fusion-2.x = Runtime HWA|Fusion-2.x - Runtime Unicode|Fusion-2.x = Runtime Unicode|Fusion-2.x - Runtime|Fusion-2.x = Runtime|Fusion-2.x + F2.0 Debug Unicode|Fusion-2.x = F2.0 Debug Unicode|Fusion-2.x + F2.0 Debug|Fusion-2.x = F2.0 Debug|Fusion-2.x + F2.0 Edittime Unicode|Fusion-2.x = F2.0 Edittime Unicode|Fusion-2.x + F2.0 Edittime|Fusion-2.x = F2.0 Edittime|Fusion-2.x + F2.0 Runtime Unicode|Fusion-2.x = F2.0 Runtime Unicode|Fusion-2.x + F2.0 Runtime|Fusion-2.x = F2.0 Runtime|Fusion-2.x + F2.5 Debug|Fusion-2.x = F2.5 Debug|Fusion-2.x + F2.5 Edittime|Fusion-2.x = F2.5 Edittime|Fusion-2.x + F2.5 Runtime|Fusion-2.x = F2.5 Runtime|Fusion-2.x EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Fusion-2.x.ActiveCfg = Debug HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Fusion-2.x.Build.0 = Debug HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Fusion-2.x.ActiveCfg = Debug Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Fusion-2.x.Build.0 = Debug Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.ActiveCfg = Debug|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.Build.0 = Debug|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Fusion-2.x.ActiveCfg = Edittime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Fusion-2.x.Build.0 = Edittime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Fusion-2.x.ActiveCfg = Edittime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Fusion-2.x.Build.0 = Edittime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.ActiveCfg = Edittime|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.Build.0 = Edittime|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Fusion-2.x.ActiveCfg = Runtime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Fusion-2.x.Build.0 = Runtime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Fusion-2.x.ActiveCfg = Runtime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Fusion-2.x.Build.0 = Runtime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.ActiveCfg = Runtime|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.Build.0 = Runtime|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.0 Debug Unicode|Fusion-2.x.ActiveCfg = F2.0 Debug Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.0 Debug|Fusion-2.x.ActiveCfg = F2.0 Debug HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.0 Debug|Fusion-2.x.Build.0 = F2.0 Debug HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.0 Edittime Unicode|Fusion-2.x.ActiveCfg = F2.0 Edittime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.0 Edittime|Fusion-2.x.ActiveCfg = F2.0 Edittime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.0 Runtime Unicode|Fusion-2.x.ActiveCfg = F2.0 Runtime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.0 Runtime|Fusion-2.x.ActiveCfg = F2.0 Runtime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.5 Debug|Fusion-2.x.ActiveCfg = F2.5 Debug Combined|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.5 Debug|Fusion-2.x.Build.0 = F2.5 Debug Combined|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.5 Edittime|Fusion-2.x.ActiveCfg = F2.5 Edittime Combined|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.5 Edittime|Fusion-2.x.Build.0 = F2.5 Edittime Combined|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.5 Runtime|Fusion-2.x.ActiveCfg = F2.5 Runtime Combined|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.5 Runtime|Fusion-2.x.Build.0 = F2.5 Runtime Combined|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index 0104b9c..e926608 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -16,14 +16,14 @@ Date: Sun, 16 Mar 2014 02:01:52 -0500 Subject: [PATCH 090/127] Add back missing FILTERID_PNG --- Inc/FilterMgr.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Inc/FilterMgr.h b/Inc/FilterMgr.h index c265eb7..7fc1a66 100644 --- a/Inc/FilterMgr.h +++ b/Inc/FilterMgr.h @@ -17,6 +17,8 @@ class CInputFile; // Filter Manager base class // +#define FILTERID_PNG DWORDSTR('P','N','G',' ') + // Filter Manager class STDDLL_API CFilterMgr { From f04d82a2aaf742b5dfd6e94e0a5f2be2e17253bf Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 16 Mar 2014 03:01:14 -0500 Subject: [PATCH 091/127] Reduce number of configurations --- Extensions/Template/Template.sln | 39 +- Extensions/Template/Template.vcproj | 529 ++---------------------- Extensions/TemplatePlus/Template.sln | 40 +- Extensions/TemplatePlus/Template.vcproj | 518 ++--------------------- 4 files changed, 119 insertions(+), 1007 deletions(-) diff --git a/Extensions/Template/Template.sln b/Extensions/Template/Template.sln index 1fea0ad..2cd7e4c 100644 --- a/Extensions/Template/Template.sln +++ b/Extensions/Template/Template.sln @@ -4,30 +4,25 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template", "Template.vcproj EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - F2.0 Debug Unicode|Fusion-2.x = F2.0 Debug Unicode|Fusion-2.x - F2.0 Debug|Fusion-2.x = F2.0 Debug|Fusion-2.x - F2.0 Edittime Unicode|Fusion-2.x = F2.0 Edittime Unicode|Fusion-2.x - F2.0 Edittime|Fusion-2.x = F2.0 Edittime|Fusion-2.x - F2.0 Runtime Unicode|Fusion-2.x = F2.0 Runtime Unicode|Fusion-2.x - F2.0 Runtime|Fusion-2.x = F2.0 Runtime|Fusion-2.x - F2.5 Debug|Fusion-2.x = F2.5 Debug|Fusion-2.x - F2.5 Edittime|Fusion-2.x = F2.5 Edittime|Fusion-2.x - F2.5 Runtime|Fusion-2.x = F2.5 Runtime|Fusion-2.x + Debug Unicode|Fusion-2.x = Debug Unicode|Fusion-2.x + Debug|Fusion-2.x = Debug|Fusion-2.x + Edittime Unicode|Fusion-2.x = Edittime Unicode|Fusion-2.x + Edittime|Fusion-2.x = Edittime|Fusion-2.x + Runtime Unicode|Fusion-2.x = Runtime Unicode|Fusion-2.x + Runtime|Fusion-2.x = Runtime|Fusion-2.x EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.0 Debug Unicode|Fusion-2.x.ActiveCfg = F2.0 Debug Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.0 Debug|Fusion-2.x.ActiveCfg = F2.0 Debug HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.0 Debug|Fusion-2.x.Build.0 = F2.0 Debug HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.0 Edittime Unicode|Fusion-2.x.ActiveCfg = F2.0 Edittime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.0 Edittime|Fusion-2.x.ActiveCfg = F2.0 Edittime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.0 Runtime Unicode|Fusion-2.x.ActiveCfg = F2.0 Runtime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.0 Runtime|Fusion-2.x.ActiveCfg = F2.0 Runtime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.5 Debug|Fusion-2.x.ActiveCfg = F2.5 Debug Combined|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.5 Debug|Fusion-2.x.Build.0 = F2.5 Debug Combined|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.5 Edittime|Fusion-2.x.ActiveCfg = F2.5 Edittime Combined|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.5 Edittime|Fusion-2.x.Build.0 = F2.5 Edittime Combined|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.5 Runtime|Fusion-2.x.ActiveCfg = F2.5 Runtime Combined|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.F2.5 Runtime|Fusion-2.x.Build.0 = F2.5 Runtime Combined|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Fusion-2.x.ActiveCfg = Debug Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Fusion-2.x.Build.0 = Debug Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.ActiveCfg = Debug HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.Build.0 = Debug HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Fusion-2.x.ActiveCfg = Edittime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Fusion-2.x.Build.0 = Edittime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.ActiveCfg = Edittime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.Build.0 = Edittime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Fusion-2.x.ActiveCfg = Runtime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Fusion-2.x.Build.0 = Runtime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.ActiveCfg = Runtime HWA|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index e926608..a6d959b 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -16,7 +16,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Date: Sun, 16 Mar 2014 03:31:59 -0500 Subject: [PATCH 092/127] Clean up .def files --- Extensions/Template/Ext.def | 202 +++++++++++++++++--------------- Extensions/TemplatePlus/Ext.def | 190 +++++++++++++++--------------- 2 files changed, 200 insertions(+), 192 deletions(-) diff --git a/Extensions/Template/Ext.def b/Extensions/Template/Ext.def index 9c45d91..d7275e5 100644 --- a/Extensions/Template/Ext.def +++ b/Extensions/Template/Ext.def @@ -1,110 +1,118 @@ +; Ext.def +; This is how the linker knows +; which functions to export and +; what names and ordinals the +; exported functions should +; have. If you implemented a +; function that was commented +; out, remove the semicolon comment +; before it in this file. +; EXPORTS - GetInfos @2 - LoadObject @6 - UnloadObject @7 - PutObject @8 - RemoveObject @9 - MakeIconEx @11 + GetInfos @2 + LoadObject @6 + UnloadObject @7 + PutObject @8 + RemoveObject @9 + MakeIconEx @11 - CreateObject @14 - GetHelpFileName @16 - EditObject @18 - GetObjectRect @19 - EditorDisplay @20 - IsTransparent @21 - PrepareToWriteObject @22 - UpdateFileNames @23 -; EnumElts @24 - Initialize @25 - Free @26 -; ExportTexts @27 -; ImportTexts @28 -; GetSubType @29 - UsesFile @30 - CreateFromFile @31 - DuplicateObject @32 - GetObjInfos @36 + CreateObject @14 + GetHelpFileName @16 + EditObject @18 + GetObjectRect @19 + EditorDisplay @20 + IsTransparent @21 + PrepareToWriteObject @22 + UpdateFileNames @23 +; EnumElts @24 + Initialize @25 + Free @26 +; ExportTexts @27 +; ImportTexts @28 +; GetSubType @29 + UsesFile @30 + CreateFromFile @31 + DuplicateObject @32 + GetObjInfos @36 - GetTextCaps @37 - GetTextAlignment @38 - SetTextAlignment @39 - GetTextFont @40 - SetTextFont @41 - GetTextClr @42 - SetTextClr @43 + GetTextCaps @37 + GetTextAlignment @38 + SetTextAlignment @39 + GetTextFont @40 + SetTextFont @41 + GetTextClr @42 + SetTextClr @43 - GetDependencies @44 - GetFilters @45 + GetDependencies @44 + GetFilters @45 -; conditionsTable @47 -; actionsTable @48 -; expressionsTable @49 +; conditionsTable @47 +; actionsTable @48 +; expressionsTable @49 - CreateRunObject @50 - DestroyRunObject @51 - HandleRunObject @52 - DisplayRunObject @53 - PauseRunObject @57 - ContinueRunObject @58 - GetRunObjectInfos @59 + CreateRunObject @50 + DestroyRunObject @51 + HandleRunObject @52 + DisplayRunObject @53 + PauseRunObject @57 + ContinueRunObject @58 + GetRunObjectInfos @59 - GetConditionMenu @60 - GetActionMenu @61 - GetExpressionMenu @62 - GetConditionCodeFromMenu @63 - GetActionCodeFromMenu @64 - GetExpressionCodeFromMenu @65 - GetConditionString @66 - GetActionString @67 - GetExpressionString @68 - InitParameter @69 - EditParameter @70 - GetParameterString @71 - GetConditionTitle @72 - GetActionTitle @73 - GetExpressionTitle @74 - GetConditionInfos @75 - GetActionInfos @76 - GetExpressionInfos @77 - UpdateEditStructure @78 - GetRunObjectDataSize @80 -; SaveBackground @81 -; RestoreBackground @82 -; KillBackground @83 -; WindowProc @84 - StartApp @85 - EndApp @86 - StartFrame @87 - EndFrame @88 - GetExpressionParam @89 + GetConditionMenu @60 + GetActionMenu @61 + GetExpressionMenu @62 + GetConditionCodeFromMenu @63 + GetActionCodeFromMenu @64 + GetExpressionCodeFromMenu @65 + GetConditionString @66 + GetActionString @67 + GetExpressionString @68 + InitParameter @69 + EditParameter @70 + GetParameterString @71 + GetConditionTitle @72 + GetActionTitle @73 + GetExpressionTitle @74 + GetConditionInfos @75 + GetActionInfos @76 + GetExpressionInfos @77 + UpdateEditStructure @78 + GetRunObjectDataSize @80 +; SaveBackground @81 +; RestoreBackground @82 +; KillBackground @83 +; WindowProc @84 + StartApp @85 + EndApp @86 + StartFrame @87 + EndFrame @88 + GetExpressionParam @89 -; GetRunObjectSurface @90 -; GetRunObjectCollisionMask @91 +; GetRunObjectSurface @90 +; GetRunObjectCollisionMask @91 -; GetRunObjectFont @92 -; SetRunObjectFont @93 -; GetRunObjectTextColor @94 -; SetRunObjectTextColor @95 +; GetRunObjectFont @92 +; SetRunObjectFont @93 +; GetRunObjectTextColor @94 +; SetRunObjectTextColor @95 -; SetEditSize @99 - GetProperties @100 - ReleaseProperties @101 - GetPropValue @102 - SetPropValue @103 - IsPropEnabled @104 - GetPropCheck @105 - SetPropCheck @106 - GetPropCreateParam @107 - ReleasePropCreateParam @108 - EditProp @109 - GetDebugTree @110 - GetDebugItem @111 - EditDebugItem @112 +; SetEditSize @99 + GetProperties @100 + ReleaseProperties @101 + GetPropValue @102 + SetPropValue @103 + IsPropEnabled @104 + GetPropCheck @105 + SetPropCheck @106 + GetPropCreateParam @107 + ReleasePropCreateParam @108 + EditProp @109 + GetDebugTree @110 + GetDebugItem @111 + EditDebugItem @112 - SaveRunObject @113 - LoadRunObject @114 + SaveRunObject @113 + LoadRunObject @114 - PrepareFlexBuild @115 - - \ No newline at end of file + PrepareFlexBuild @115 diff --git a/Extensions/TemplatePlus/Ext.def b/Extensions/TemplatePlus/Ext.def index 7849232..9e654a0 100644 --- a/Extensions/TemplatePlus/Ext.def +++ b/Extensions/TemplatePlus/Ext.def @@ -10,109 +10,109 @@ ; EXPORTS - GetInfos @2 - LoadObject @6 - UnloadObject @7 - PutObject @8 - RemoveObject @9 - MakeIconEx @11 + GetInfos @2 + LoadObject @6 + UnloadObject @7 + PutObject @8 + RemoveObject @9 + MakeIconEx @11 - CreateObject @14 - GetHelpFileName @16 - EditObject @18 - GetObjectRect @19 - EditorDisplay @20 - IsTransparent @21 - PrepareToWriteObject @22 - UpdateFileNames @23 -; EnumElts @24 - Initialize=InitExtension @25 - Free=FreeExtension @26 -; ExportTexts @27 -; ImportTexts @28 -; GetSubType @29 - UsesFile @30 - CreateFromFile @31 - DuplicateObject=CloneObject @32 - GetObjInfos @36 + CreateObject @14 + GetHelpFileName @16 + EditObject @18 + GetObjectRect @19 + EditorDisplay @20 + IsTransparent @21 + PrepareToWriteObject @22 + UpdateFileNames @23 +; EnumElts @24 + Initialize=InitExtension @25 + Free=FreeExtension @26 +; ExportTexts @27 +; ImportTexts @28 +; GetSubType @29 + UsesFile @30 + CreateFromFile @31 + DuplicateObject=CloneObject @32 + GetObjInfos @36 - GetTextCaps @37 - GetTextAlignment @38 - SetTextAlignment @39 - GetTextFont @40 - SetTextFont @41 - GetTextClr @42 - SetTextClr @43 + GetTextCaps @37 + GetTextAlignment @38 + SetTextAlignment @39 + GetTextFont @40 + SetTextFont @41 + GetTextClr @42 + SetTextClr @43 - GetDependencies @44 - GetFilters @45 + GetDependencies @44 + GetFilters @45 -; conditionsTable @47 -; actionsTable @48 -; expressionsTable @49 +; conditionsTable @47 +; actionsTable @48 +; expressionsTable @49 - CreateRunObject @50 - DestroyRunObject @51 - HandleRunObject @52 - DisplayRunObject @53 - PauseRunObject @57 - ContinueRunObject @58 - GetRunObjectInfos @59 + CreateRunObject @50 + DestroyRunObject @51 + HandleRunObject @52 + DisplayRunObject @53 + PauseRunObject @57 + ContinueRunObject @58 + GetRunObjectInfos @59 - GetConditionMenu @60 - GetActionMenu @61 - GetExpressionMenu @62 - GetConditionCodeFromMenu @63 - GetActionCodeFromMenu @64 - GetExpressionCodeFromMenu @65 - GetConditionString @66 - GetActionString @67 - GetExpressionString @68 - InitParameter @69 - EditParameter @70 - GetParameterString @71 - GetConditionTitle @72 - GetActionTitle @73 - GetExpressionTitle @74 - GetConditionInfos @75 - GetActionInfos @76 - GetExpressionInfos @77 - UpdateEditStructure @78 - GetRunObjectDataSize @80 -; SaveBackground @81 -; RestoreBackground @82 -; KillBackground @83 -; WindowProc @84 - StartApp @85 - EndApp @86 - StartFrame @87 - EndFrame @88 - GetExpressionParam @89 + GetConditionMenu @60 + GetActionMenu @61 + GetExpressionMenu @62 + GetConditionCodeFromMenu @63 + GetActionCodeFromMenu @64 + GetExpressionCodeFromMenu @65 + GetConditionString @66 + GetActionString @67 + GetExpressionString @68 + InitParameter @69 + EditParameter @70 + GetParameterString @71 + GetConditionTitle @72 + GetActionTitle @73 + GetExpressionTitle @74 + GetConditionInfos @75 + GetActionInfos @76 + GetExpressionInfos @77 + UpdateEditStructure @78 + GetRunObjectDataSize @80 +; SaveBackground @81 +; RestoreBackground @82 +; KillBackground @83 +; WindowProc @84 + StartApp @85 + EndApp @86 + StartFrame @87 + EndFrame @88 + GetExpressionParam @89 -; GetRunObjectSurface @90 -; GetRunObjectCollisionMask @91 +; GetRunObjectSurface @90 +; GetRunObjectCollisionMask @91 -; GetRunObjectFont @92 -; SetRunObjectFont @93 -; GetRunObjectTextColor @94 -; SetRunObjectTextColor @95 +; GetRunObjectFont @92 +; SetRunObjectFont @93 +; GetRunObjectTextColor @94 +; SetRunObjectTextColor @95 -; SetEditSize @99 - GetProperties @100 - ReleaseProperties @101 - GetPropValue @102 - SetPropValue @103 - IsPropEnabled @104 - GetPropCheck @105 - SetPropCheck @106 - GetPropCreateParam @107 - ReleasePropCreateParam @108 - EditProp @109 - GetDebugTree @110 - GetDebugItem @111 - EditDebugItem @112 +; SetEditSize @99 + GetProperties @100 + ReleaseProperties @101 + GetPropValue @102 + SetPropValue @103 + IsPropEnabled @104 + GetPropCheck @105 + SetPropCheck @106 + GetPropCreateParam @107 + ReleasePropCreateParam @108 + EditProp @109 + GetDebugTree @110 + GetDebugItem @111 + EditDebugItem @112 - SaveRunObject @113 - LoadRunObject @114 + SaveRunObject @113 + LoadRunObject @114 - PrepareFlexBuild @115 + PrepareFlexBuild @115 From e3f2c118626ebf8fc66d8add1153043c42921032 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 16 Mar 2014 20:35:23 -0500 Subject: [PATCH 093/127] Clarify HWA build configs --- Extensions/Template/Template.sln | 16 ++++++++-------- Extensions/TemplatePlus/Template.sln | 18 +++++++++--------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Extensions/Template/Template.sln b/Extensions/Template/Template.sln index 2cd7e4c..ce5afdf 100644 --- a/Extensions/Template/Template.sln +++ b/Extensions/Template/Template.sln @@ -4,25 +4,25 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template", "Template.vcproj EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug HWA|Fusion-2.x = Debug HWA|Fusion-2.x Debug Unicode|Fusion-2.x = Debug Unicode|Fusion-2.x - Debug|Fusion-2.x = Debug|Fusion-2.x + Edittime HWA|Fusion-2.x = Edittime HWA|Fusion-2.x Edittime Unicode|Fusion-2.x = Edittime Unicode|Fusion-2.x - Edittime|Fusion-2.x = Edittime|Fusion-2.x + Runtime HWA|Fusion-2.x = Runtime HWA|Fusion-2.x Runtime Unicode|Fusion-2.x = Runtime Unicode|Fusion-2.x - Runtime|Fusion-2.x = Runtime|Fusion-2.x EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Fusion-2.x.ActiveCfg = Debug HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Fusion-2.x.Build.0 = Debug HWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Fusion-2.x.ActiveCfg = Debug Unicode|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Fusion-2.x.Build.0 = Debug Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.ActiveCfg = Debug HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.Build.0 = Debug HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Fusion-2.x.ActiveCfg = Edittime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Fusion-2.x.Build.0 = Edittime HWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Fusion-2.x.ActiveCfg = Edittime Unicode|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Fusion-2.x.Build.0 = Edittime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.ActiveCfg = Edittime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.Build.0 = Edittime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Fusion-2.x.ActiveCfg = Runtime HWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Fusion-2.x.ActiveCfg = Runtime Unicode|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Fusion-2.x.Build.0 = Runtime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.ActiveCfg = Runtime HWA|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Extensions/TemplatePlus/Template.sln b/Extensions/TemplatePlus/Template.sln index 9237171..852e265 100644 --- a/Extensions/TemplatePlus/Template.sln +++ b/Extensions/TemplatePlus/Template.sln @@ -4,26 +4,26 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template", "Template.vcproj EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug HWA|Fusion-2.x = Debug HWA|Fusion-2.x Debug Unicode|Fusion-2.x = Debug Unicode|Fusion-2.x - Debug|Fusion-2.x = Debug|Fusion-2.x + Edittime HWA|Fusion-2.x = Edittime HWA|Fusion-2.x Edittime Unicode|Fusion-2.x = Edittime Unicode|Fusion-2.x - Edittime|Fusion-2.x = Edittime|Fusion-2.x + Runtime HWA|Fusion-2.x = Runtime HWA|Fusion-2.x Runtime Unicode|Fusion-2.x = Runtime Unicode|Fusion-2.x - Runtime|Fusion-2.x = Runtime|Fusion-2.x EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Fusion-2.x.ActiveCfg = Debug HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Fusion-2.x.Build.0 = Debug HWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Fusion-2.x.ActiveCfg = Debug Unicode|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Fusion-2.x.Build.0 = Debug Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.ActiveCfg = Debug Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.Build.0 = Debug Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Fusion-2.x.ActiveCfg = Edittime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Fusion-2.x.Build.0 = Edittime HWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Fusion-2.x.ActiveCfg = Edittime Unicode|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Fusion-2.x.Build.0 = Edittime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.ActiveCfg = Edittime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.Build.0 = Edittime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Fusion-2.x.ActiveCfg = Runtime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Fusion-2.x.Build.0 = Runtime HWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Fusion-2.x.ActiveCfg = Runtime Unicode|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Fusion-2.x.Build.0 = Runtime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.ActiveCfg = Runtime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.Build.0 = Runtime HWA|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From a959f4f6dbb492b25c9a5aaf1ab81b2e594f8eb3 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 16 Mar 2014 20:46:30 -0500 Subject: [PATCH 094/127] Add non-HWA/Unicode build configs back for MMF2.0 --- Extensions/Template/Template.sln | 10 + Extensions/Template/Template.vcproj | 454 +++++++++++++++++++++++- Extensions/TemplatePlus/Template.sln | 9 + Extensions/TemplatePlus/Template.vcproj | 439 +++++++++++++++++++++++ 4 files changed, 906 insertions(+), 6 deletions(-) diff --git a/Extensions/Template/Template.sln b/Extensions/Template/Template.sln index ce5afdf..224d791 100644 --- a/Extensions/Template/Template.sln +++ b/Extensions/Template/Template.sln @@ -6,23 +6,33 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug HWA|Fusion-2.x = Debug HWA|Fusion-2.x Debug Unicode|Fusion-2.x = Debug Unicode|Fusion-2.x + Debug|Fusion-2.x = Debug|Fusion-2.x Edittime HWA|Fusion-2.x = Edittime HWA|Fusion-2.x Edittime Unicode|Fusion-2.x = Edittime Unicode|Fusion-2.x + Edittime|Fusion-2.x = Edittime|Fusion-2.x Runtime HWA|Fusion-2.x = Runtime HWA|Fusion-2.x Runtime Unicode|Fusion-2.x = Runtime Unicode|Fusion-2.x + Runtime|Fusion-2.x = Runtime|Fusion-2.x EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Fusion-2.x.ActiveCfg = Debug HWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Fusion-2.x.Build.0 = Debug HWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Fusion-2.x.ActiveCfg = Debug Unicode|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Fusion-2.x.Build.0 = Debug Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.ActiveCfg = Debug|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.Build.0 = Debug|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Fusion-2.x.ActiveCfg = Edittime HWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Fusion-2.x.Build.0 = Edittime HWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Fusion-2.x.ActiveCfg = Edittime Unicode|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Fusion-2.x.Build.0 = Edittime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.ActiveCfg = Edittime|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.Build.0 = Edittime|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Fusion-2.x.ActiveCfg = Runtime HWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Fusion-2.x.Build.0 = Runtime HWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Fusion-2.x.ActiveCfg = Runtime Unicode|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Fusion-2.x.Build.0 = Runtime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.ActiveCfg = Runtime|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.Build.0 = Runtime|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index a6d959b..df21d8d 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -113,7 +113,7 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -861,6 +1168,33 @@ PreprocessorDefinitions="" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -703,6 +1007,33 @@ PreprocessorDefinitions="" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Date: Sun, 16 Mar 2014 20:56:27 -0500 Subject: [PATCH 095/127] Update wiki links GitHub keeps changing how they work, so I've just hard-coded them. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aa04ede..0553f82 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Extension Development Is Fun -Edif is an alternate extension development SDK for Multimedia Fusion 2 and Fusion 2.5, in which your extension is a true C++ class, with a JSON file (optionally external) to describe it. We recommend that you [check out the wiki](./windows-edif/wiki/). If you're new to EDIF, read the [Getting started](./windows-edif/wiki/Getting-started) page. There are also some [Tutorials](./windows-edif/wiki/Tutorials). +Edif is an alternate extension development SDK for Multimedia Fusion 2 and ClickTeam Fusion 2.5, in which your extension is a true C++ class, with a JSON file (optionally external) to describe it. We recommend that you [check out the wiki](https://github.com/ClickteamLLC/windows-edif/wiki/). If you're new to EDIF, read the [Getting started](https://github.com/ClickteamLLC/windows-edif/wiki/Getting-started) page. There are also some [Tutorials](https://github.com/ClickteamLLC/windows-edif/wiki/Tutorials). From 01eb909cbf19b1f655523a11f86feae6c98b4b6b Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 16 Mar 2014 21:11:07 -0500 Subject: [PATCH 096/127] Update copyright year in template JSONs --- Extensions/Template/Ext.json | 2 +- Extensions/TemplatePlus/Ext.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Extensions/Template/Ext.json b/Extensions/Template/Ext.json index c323313..7aedc37 100644 --- a/Extensions/Template/Ext.json +++ b/Extensions/Template/Ext.json @@ -3,7 +3,7 @@ { "Name": "EDIF Template Object", "Author": "Your Name", - "Copyright": "Copyright © 2013 Your Name", + "Copyright": "Copyright © 2014 Your Name", "Comment": "A sentence or two to describe your extension,\nwith up to four lines of text.", "URL": "http://www.example.com/", "Help": "Help/My New EDIF Extension/Help.chm", diff --git a/Extensions/TemplatePlus/Ext.json b/Extensions/TemplatePlus/Ext.json index c323313..7aedc37 100644 --- a/Extensions/TemplatePlus/Ext.json +++ b/Extensions/TemplatePlus/Ext.json @@ -3,7 +3,7 @@ { "Name": "EDIF Template Object", "Author": "Your Name", - "Copyright": "Copyright © 2013 Your Name", + "Copyright": "Copyright © 2014 Your Name", "Comment": "A sentence or two to describe your extension,\nwith up to four lines of text.", "URL": "http://www.example.com/", "Help": "Help/My New EDIF Extension/Help.chm", From 83046a08447f48b0a9989d801e44914828b9048c Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 16 Mar 2014 21:18:44 -0500 Subject: [PATCH 097/127] Fix Unicode Properties in TemplatePlus --- Extensions/TemplatePlus/Properties.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Extensions/TemplatePlus/Properties.cpp b/Extensions/TemplatePlus/Properties.cpp index 18366f0..ebffd54 100644 --- a/Extensions/TemplatePlus/Properties.cpp +++ b/Extensions/TemplatePlus/Properties.cpp @@ -40,9 +40,9 @@ namespace Prop PropData Properties[] = //See the MMF2SDK help file for information on PropData_ macros. { - PropData_StaticString(Prop::Version, (UINT_PTR)"Version #", (UINT_PTR)"This is the current version of the EDIF Template object."), - //PropData_EditMultiLine(Prop::MyString, (UINT_PTR)"My String", (UINT_PTR)"The contents of my string."), - //PropData_EditNumber(Prop::MyInt, (UINT_PTR)"My Integer", (UINT_PTR)"The value of my integer."), + PropData_StaticString(Prop::Version, (UINT_PTR)_T("Version #"), (UINT_PTR)_T("This is the current version of the EDIF Template object.")), + //PropData_EditMultiLine(Prop::MyString, (UINT_PTR)_T("My String"), (UINT_PTR)_T("The contents of my string.")), + //PropData_EditNumber(Prop::MyInt, (UINT_PTR)_T("My Integer"), (UINT_PTR)_T("The value of my integer.")), PropData_End() }; @@ -137,11 +137,11 @@ void *MMF2Func GetPropValue(mv *mV, SerializedED *SED, UINT PropID) { case Prop::Version: { - return new CPropDataValue("Default.EDIF.Template.0"); + return new CPropStringValue(_T("Default.EDIF.Template.0")); } //case Prop::MyString: // { - // return new CPropDataValue(ed.MyString.c_str()); + // return new CPropStringValue(ed.MyString.c_str()); // } //case Prop::MyInt: // { @@ -168,7 +168,7 @@ void MMF2Func SetPropValue(mv *mV, SerializedED *SED, UINT PropID, CPropValue *P //{ //case Prop::MyString: // { - // ed.MyString = (LPSTR)((CPropDataValue*)PropVal)->m_pData; + // ed.MyString = ((CPropStringValue*)PropVal)->GetString(); // break; // } //case Prop::MyInt: From e50404c5c881df0f0b24995f3cb97e667541208f Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Tue, 25 Mar 2014 23:44:15 -0500 Subject: [PATCH 098/127] Fix non-HWA MFX path --- Extensions/Template/Template.vcproj | 6 +++--- Extensions/TemplatePlus/Template.vcproj | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj index df21d8d..ef9b0a8 100644 --- a/Extensions/Template/Template.vcproj +++ b/Extensions/Template/Template.vcproj @@ -691,7 +691,7 @@ Date: Wed, 3 Dec 2014 14:11:10 -0600 Subject: [PATCH 099/127] Update json-parser --- Inc/json.h | 30 +++++++--- Lib/json.c | 159 ++++++++++++++++++++++++++++++++--------------------- 2 files changed, 116 insertions(+), 73 deletions(-) diff --git a/Inc/json.h b/Inc/json.h index cf9f0dd..f6549ec 100644 --- a/Inc/json.h +++ b/Inc/json.h @@ -68,6 +68,8 @@ typedef struct void * user_data; /* will be passed to mem_alloc and mem_free */ + size_t value_extra; /* how much extra space to allocate for values? */ + } json_settings; #define json_enable_comments 0x01 @@ -86,6 +88,15 @@ typedef enum } json_type; extern const struct _json_value json_value_none; + +typedef struct _json_object_entry +{ + json_char * name; + unsigned int name_length; + + struct _json_value * value; + +} json_object_entry; typedef struct _json_value { @@ -110,14 +121,7 @@ typedef struct _json_value { unsigned int length; - struct - { - json_char * name; - unsigned int name_length; - - struct _json_value * value; - - } * values; + json_object_entry * values; #if defined(__cplusplus) && __cplusplus >= 201103L decltype(values) begin () const @@ -155,6 +159,14 @@ typedef struct _json_value } _reserved; + #ifdef JSON_TRACK_SOURCE + + /* Location of the value in the source JSON + */ + unsigned int line, col; + + #endif + /* Some C++ operator sugar */ @@ -242,7 +254,7 @@ typedef struct _json_value #endif } json_value; - + json_value * json_parse (const json_char * json, size_t length); diff --git a/Lib/json.c b/Lib/json.c index 9264c3f..6012bad 100644 --- a/Lib/json.c +++ b/Lib/json.c @@ -35,11 +35,7 @@ #endif #endif -#ifdef __cplusplus - const struct _json_value json_value_none; /* zero-d by ctor */ -#else - const struct _json_value json_value_none = { 0 }; -#endif +const struct _json_value json_value_none; #include #include @@ -74,6 +70,9 @@ typedef struct json_settings settings; int first_pass; + const json_char * ptr; + unsigned int cur_line, cur_col; + } json_state; static void * default_alloc (size_t size, int zero, void * user_data) @@ -100,8 +99,9 @@ static void * json_alloc (json_state * state, unsigned long size, int zero) return state->settings.mem_alloc (size, zero, state->settings.user_data); } -static int new_value - (json_state * state, json_value ** top, json_value ** root, json_value ** alloc, json_type type) +static int new_value (json_state * state, + json_value ** top, json_value ** root, json_value ** alloc, + json_type type) { json_value * value; int values_size; @@ -118,6 +118,9 @@ static int new_value { case json_array: + if (value->u.array.length == 0) + break; + if (! (value->u.array.values = (json_value **) json_alloc (state, value->u.array.length * sizeof (json_value *), 0)) ) { @@ -129,9 +132,12 @@ static int new_value case json_object: + if (value->u.object.length == 0) + break; + values_size = sizeof (*value->u.object.values) * value->u.object.length; - if (! ((*(void **) &value->u.object.values) = json_alloc + if (! (value->u.object.values = (json_object_entry *) json_alloc (state, values_size + ((unsigned long) value->u.object.values), 0)) ) { return 0; @@ -160,10 +166,11 @@ static int new_value return 1; } - value = (json_value *) json_alloc (state, sizeof (json_value), 1); - - if (!value) + if (! (value = (json_value *) json_alloc + (state, sizeof (json_value) + state->settings.value_extra, 1))) + { return 0; + } if (!*root) *root = value; @@ -171,6 +178,11 @@ static int new_value value->type = type; value->parent = *top; + #ifdef JSON_TRACK_SOURCE + value->line = state->cur_line; + value->col = state->cur_col; + #endif + if (*alloc) (*alloc)->_reserved.next_alloc = value; @@ -179,16 +191,16 @@ static int new_value return 1; } -#define e_off \ - ((int) (i - cur_line_begin)) - #define whitespace \ - case '\n': ++ cur_line; cur_line_begin = i; \ + case '\n': ++ state.cur_line; state.cur_col = 0; \ case ' ': case '\t': case '\r' #define string_add(b) \ do { if (!state.first_pass) string [string_length] = b; ++ string_length; } while (0); +#define line_and_col \ + state.cur_line, state.cur_col + static const long flag_next = 1 << 0, flag_reproc = 1 << 1, @@ -212,8 +224,7 @@ json_value * json_parse_ex (json_settings * settings, char * error_buf) { json_char error [json_error_max]; - unsigned int cur_line; - const json_char * cur_line_begin, * i, * end; + const json_char * end; json_value * top, * root, * alloc = 0; json_state state = { 0 }; long flags; @@ -257,17 +268,16 @@ json_value * json_parse_ex (json_settings * settings, top = root = 0; flags = flag_seek_value; - cur_line = 1; - cur_line_begin = json; + state.cur_line = 1; - for (i = json ;; ++ i) + for (state.ptr = json ;; ++ state.ptr) { - json_char b = (i == end ? 0 : *i); + json_char b = (state.ptr == end ? 0 : *state.ptr); if (flags & flag_string) { if (!b) - { sprintf (error, "Unexpected EOF in string (at %d:%d)", cur_line, e_off); + { sprintf (error, "Unexpected EOF in string (at %d:%d)", line_and_col); goto e_failed; } @@ -287,11 +297,13 @@ json_value * json_parse_ex (json_settings * settings, case 't': string_add ('\t'); break; case 'u': - if (end - i < 4 || - (uc_b1 = hex_value (*++ i)) == 0xFF || (uc_b2 = hex_value (*++ i)) == 0xFF - || (uc_b3 = hex_value (*++ i)) == 0xFF || (uc_b4 = hex_value (*++ i)) == 0xFF) + if (end - state.ptr < 4 || + (uc_b1 = hex_value (*++ state.ptr)) == 0xFF || + (uc_b2 = hex_value (*++ state.ptr)) == 0xFF || + (uc_b3 = hex_value (*++ state.ptr)) == 0xFF || + (uc_b4 = hex_value (*++ state.ptr)) == 0xFF) { - sprintf (error, "Invalid character value `%c` (at %d:%d)", b, cur_line, e_off); + sprintf (error, "Invalid character value `%c` (at %d:%d)", b, line_and_col); goto e_failed; } @@ -302,11 +314,13 @@ json_value * json_parse_ex (json_settings * settings, if ((uchar & 0xF800) == 0xD800) { json_uchar uchar2; - if (end - i < 6 || (*++ i) != '\\' || (*++ i) != 'u' || - (uc_b1 = hex_value (*++ i)) == 0xFF || (uc_b2 = hex_value (*++ i)) == 0xFF - || (uc_b3 = hex_value (*++ i)) == 0xFF || (uc_b4 = hex_value (*++ i)) == 0xFF) + if (end - state.ptr < 6 || (*++ state.ptr) != '\\' || (*++ state.ptr) != 'u' || + (uc_b1 = hex_value (*++ state.ptr)) == 0xFF || + (uc_b2 = hex_value (*++ state.ptr)) == 0xFF || + (uc_b3 = hex_value (*++ state.ptr)) == 0xFF || + (uc_b4 = hex_value (*++ state.ptr)) == 0xFF) { - sprintf (error, "Invalid character value `%c` (at %d:%d)", b, cur_line, e_off); + sprintf (error, "Invalid character value `%c` (at %d:%d)", b, line_and_col); goto e_failed; } @@ -426,7 +440,7 @@ json_value * json_parse_ex (json_settings * settings, if (b == '\r' || b == '\n' || !b) { flags &= ~ flag_line_comment; - -- i; /* so null can be reproc'd */ + -- state.ptr; /* so null can be reproc'd */ } continue; @@ -435,14 +449,14 @@ json_value * json_parse_ex (json_settings * settings, if (flags & flag_block_comment) { if (!b) - { sprintf (error, "%d:%d: Unexpected EOF in block comment", cur_line, e_off); + { sprintf (error, "%d:%d: Unexpected EOF in block comment", line_and_col); goto e_failed; } - if (b == '*' && i < (end - 1) && i [1] == '/') + if (b == '*' && state.ptr < (end - 1) && state.ptr [1] == '/') { flags &= ~ flag_block_comment; - ++ i; /* skip closing sequence */ + ++ state.ptr; /* skip closing sequence */ } continue; @@ -451,17 +465,16 @@ json_value * json_parse_ex (json_settings * settings, else if (b == '/') { if (! (flags & (flag_seek_value | flag_done)) && top->type != json_object) - { - sprintf (error, "%d:%d: Comment not allowed here", cur_line, e_off); + { sprintf (error, "%d:%d: Comment not allowed here", line_and_col); goto e_failed; } - if (++ i == end) - { sprintf (error, "%d:%d: EOF unexpected", cur_line, e_off); + if (++ state.ptr == end) + { sprintf (error, "%d:%d: EOF unexpected", line_and_col); goto e_failed; } - switch (b = *i) + switch (b = *state.ptr) { case '/': flags |= flag_line_comment; @@ -472,7 +485,7 @@ json_value * json_parse_ex (json_settings * settings, continue; default: - sprintf (error, "%d:%d: Unexpected `%c` in comment opening sequence", cur_line, e_off, b); + sprintf (error, "%d:%d: Unexpected `%c` in comment opening sequence", line_and_col, b); goto e_failed; }; } @@ -489,7 +502,10 @@ json_value * json_parse_ex (json_settings * settings, continue; default: - sprintf (error, "%d:%d: Trailing garbage: `%c`", cur_line, e_off, b); + + sprintf (error, "%d:%d: Trailing garbage: `%c`", + state.cur_line, state.cur_col, b); + goto e_failed; }; } @@ -503,10 +519,10 @@ json_value * json_parse_ex (json_settings * settings, case ']': - if (top->type == json_array) + if (top && top->type == json_array) flags = (flags & ~ (flag_need_comma | flag_seek_value)) | flag_next; else - { sprintf (error, "%d:%d: Unexpected ]", cur_line, e_off); + { sprintf (error, "%d:%d: Unexpected ]", line_and_col); goto e_failed; } @@ -521,7 +537,10 @@ json_value * json_parse_ex (json_settings * settings, continue; } else - { sprintf (error, "%d:%d: Expected , before %c", cur_line, e_off, b); + { + sprintf (error, "%d:%d: Expected , before %c", + state.cur_line, state.cur_col, b); + goto e_failed; } } @@ -533,7 +552,10 @@ json_value * json_parse_ex (json_settings * settings, continue; } else - { sprintf (error, "%d:%d: Expected : before %c", cur_line, e_off, b); + { + sprintf (error, "%d:%d: Expected : before %c", + state.cur_line, state.cur_col, b); + goto e_failed; } } @@ -571,8 +593,11 @@ json_value * json_parse_ex (json_settings * settings, case 't': - if ((end - i) < 3 || *(++ i) != 'r' || *(++ i) != 'u' || *(++ i) != 'e') + if ((end - state.ptr) < 3 || *(++ state.ptr) != 'r' || + *(++ state.ptr) != 'u' || *(++ state.ptr) != 'e') + { goto e_unknown_value; + } if (!new_value (&state, &top, &root, &alloc, json_boolean)) goto e_alloc_failure; @@ -584,8 +609,12 @@ json_value * json_parse_ex (json_settings * settings, case 'f': - if ((end - i) < 4 || *(++ i) != 'a' || *(++ i) != 'l' || *(++ i) != 's' || *(++ i) != 'e') + if ((end - state.ptr) < 4 || *(++ state.ptr) != 'a' || + *(++ state.ptr) != 'l' || *(++ state.ptr) != 's' || + *(++ state.ptr) != 'e') + { goto e_unknown_value; + } if (!new_value (&state, &top, &root, &alloc, json_boolean)) goto e_alloc_failure; @@ -595,8 +624,11 @@ json_value * json_parse_ex (json_settings * settings, case 'n': - if ((end - i) < 3 || *(++ i) != 'u' || *(++ i) != 'l' || *(++ i) != 'l') + if ((end - state.ptr) < 3 || *(++ state.ptr) != 'u' || + *(++ state.ptr) != 'l' || *(++ state.ptr) != 'l') + { goto e_unknown_value; + } if (!new_value (&state, &top, &root, &alloc, json_null)) goto e_alloc_failure; @@ -616,13 +648,13 @@ json_value * json_parse_ex (json_settings * settings, while (isdigit (b) || b == '+' || b == '-' || b == 'e' || b == 'E' || b == '.') { - if ( (++ i) == end) + if ( (++ state.ptr) == end) { b = 0; break; } - b = *i; + b = *state.ptr; } flags |= flag_next | flag_reproc; @@ -647,7 +679,7 @@ json_value * json_parse_ex (json_settings * settings, continue; } else - { sprintf (error, "%d:%d: Unexpected %c when seeking value", cur_line, e_off, b); + { sprintf (error, "%d:%d: Unexpected %c when seeking value", line_and_col, b); goto e_failed; } }; @@ -667,8 +699,7 @@ json_value * json_parse_ex (json_settings * settings, case '"': if (flags & flag_need_comma) - { - sprintf (error, "%d:%d: Expected , before \"", cur_line, e_off); + { sprintf (error, "%d:%d: Expected , before \"", line_and_col); goto e_failed; } @@ -693,8 +724,7 @@ json_value * json_parse_ex (json_settings * settings, } default: - - sprintf (error, "%d:%d: Unexpected `%c` in object", cur_line, e_off, b); + sprintf (error, "%d:%d: Unexpected `%c` in object", line_and_col, b); goto e_failed; }; @@ -712,7 +742,7 @@ json_value * json_parse_ex (json_settings * settings, if (! (flags & flag_num_e)) { if (flags & flag_num_zero) - { sprintf (error, "%d:%d: Unexpected `0` before `%c`", cur_line, e_off, b); + { sprintf (error, "%d:%d: Unexpected `0` before `%c`", line_and_col, b); goto e_failed; } @@ -749,7 +779,7 @@ json_value * json_parse_ex (json_settings * settings, else if (b == '.' && top->type == json_integer) { if (!num_digits) - { sprintf (error, "%d:%d: Expected digit before `.`", cur_line, e_off); + { sprintf (error, "%d:%d: Expected digit before `.`", line_and_col); goto e_failed; } @@ -765,11 +795,11 @@ json_value * json_parse_ex (json_settings * settings, if (top->type == json_double) { if (!num_digits) - { sprintf (error, "%d:%d: Expected digit after `.`", cur_line, e_off); + { sprintf (error, "%d:%d: Expected digit after `.`", line_and_col); goto e_failed; } - top->u.dbl += ((double) num_fraction) / (pow (10, (double) num_digits)); + top->u.dbl += ((double) num_fraction) / (pow (10.0, (double) num_digits)); } if (b == 'e' || b == 'E') @@ -791,11 +821,12 @@ json_value * json_parse_ex (json_settings * settings, else { if (!num_digits) - { sprintf (error, "%d:%d: Expected digit after `e`", cur_line, e_off); + { sprintf (error, "%d:%d: Expected digit after `e`", line_and_col); goto e_failed; } - top->u.dbl *= pow (10, (double) (flags & flag_num_e_negative ? - num_e : num_e)); + top->u.dbl *= pow (10.0, (double) + (flags & flag_num_e_negative ? - num_e : num_e)); } if (flags & flag_num_negative) @@ -817,7 +848,7 @@ json_value * json_parse_ex (json_settings * settings, if (flags & flag_reproc) { flags &= ~ flag_reproc; - -- i; + -- state.ptr; } if (flags & flag_next) @@ -876,7 +907,7 @@ json_value * json_parse_ex (json_settings * settings, e_unknown_value: - sprintf (error, "%d:%d: Unknown value", cur_line, e_off); + sprintf (error, "%d:%d: Unknown value", line_and_col); goto e_failed; e_alloc_failure: @@ -886,7 +917,7 @@ json_value * json_parse_ex (json_settings * settings, e_overflow: - sprintf (error, "%d:%d: Too long (caught overflow)", cur_line, e_off); + sprintf (error, "%d:%d: Too long (caught overflow)", line_and_col); goto e_failed; e_failed: From d22bd77a78c73b9fce3182df5bd19464248f7398 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Mon, 25 May 2015 18:02:40 -0500 Subject: [PATCH 100/127] Clarify that Unicode builds are HWA as well --- Extensions/TemplatePlus/Template.sln | 18 ++++++------- Extensions/TemplatePlus/Template.vcproj | 36 ++++++++++++------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Extensions/TemplatePlus/Template.sln b/Extensions/TemplatePlus/Template.sln index 224d791..18fe76f 100644 --- a/Extensions/TemplatePlus/Template.sln +++ b/Extensions/TemplatePlus/Template.sln @@ -5,32 +5,32 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug HWA|Fusion-2.x = Debug HWA|Fusion-2.x - Debug Unicode|Fusion-2.x = Debug Unicode|Fusion-2.x + Debug UnicodeHWA|Fusion-2.x = Debug UnicodeHWA|Fusion-2.x Debug|Fusion-2.x = Debug|Fusion-2.x Edittime HWA|Fusion-2.x = Edittime HWA|Fusion-2.x - Edittime Unicode|Fusion-2.x = Edittime Unicode|Fusion-2.x + Edittime UnicodeHWA|Fusion-2.x = Edittime UnicodeHWA|Fusion-2.x Edittime|Fusion-2.x = Edittime|Fusion-2.x Runtime HWA|Fusion-2.x = Runtime HWA|Fusion-2.x - Runtime Unicode|Fusion-2.x = Runtime Unicode|Fusion-2.x + Runtime UnicodeHWA|Fusion-2.x = Runtime UnicodeHWA|Fusion-2.x Runtime|Fusion-2.x = Runtime|Fusion-2.x EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Fusion-2.x.ActiveCfg = Debug HWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Fusion-2.x.Build.0 = Debug HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Fusion-2.x.ActiveCfg = Debug Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Fusion-2.x.Build.0 = Debug Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug UnicodeHWA|Fusion-2.x.ActiveCfg = Debug UnicodeHWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug UnicodeHWA|Fusion-2.x.Build.0 = Debug UnicodeHWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.ActiveCfg = Debug|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.Build.0 = Debug|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Fusion-2.x.ActiveCfg = Edittime HWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Fusion-2.x.Build.0 = Edittime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Fusion-2.x.ActiveCfg = Edittime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Fusion-2.x.Build.0 = Edittime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime UnicodeHWA|Fusion-2.x.ActiveCfg = Edittime UnicodeHWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime UnicodeHWA|Fusion-2.x.Build.0 = Edittime UnicodeHWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.ActiveCfg = Edittime|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.Build.0 = Edittime|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Fusion-2.x.ActiveCfg = Runtime HWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Fusion-2.x.Build.0 = Runtime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Fusion-2.x.ActiveCfg = Runtime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Fusion-2.x.Build.0 = Runtime Unicode|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime UnicodeHWA|Fusion-2.x.ActiveCfg = Runtime UnicodeHWA|Win32 + {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime UnicodeHWA|Fusion-2.x.Build.0 = Runtime UnicodeHWA|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.ActiveCfg = Runtime|Win32 {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.Build.0 = Runtime|Win32 EndGlobalSection diff --git a/Extensions/TemplatePlus/Template.vcproj b/Extensions/TemplatePlus/Template.vcproj index 90ee24c..3e326dc 100644 --- a/Extensions/TemplatePlus/Template.vcproj +++ b/Extensions/TemplatePlus/Template.vcproj @@ -16,7 +16,7 @@ Date: Tue, 14 Jul 2015 21:44:51 -0500 Subject: [PATCH 101/127] Add separator to end of condition menu --- Extensions/TemplatePlus/Ext.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Extensions/TemplatePlus/Ext.json b/Extensions/TemplatePlus/Ext.json index 7aedc37..8e07e5b 100644 --- a/Extensions/TemplatePlus/Ext.json +++ b/Extensions/TemplatePlus/Ext.json @@ -25,7 +25,8 @@ "ConditionMenu": [ "Separator", - [0, "Are two numbers equal?"] + [0, "Are two numbers equal?"], + "Separator" ], "ExpressionMenu": [ From ecb4926169c35ba3d8b653dddf38efb0c8d5a0af Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Tue, 14 Jul 2015 21:45:10 -0500 Subject: [PATCH 102/127] Allow numeric object identifiers too --- Lib/Edif.General.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Lib/Edif.General.cpp b/Lib/Edif.General.cpp index 6d95c79..47747c1 100644 --- a/Lib/Edif.General.cpp +++ b/Lib/Edif.General.cpp @@ -65,7 +65,21 @@ short WINAPI DLLExport GetRunObjectInfos(mv _far *mV, fpKpxRunInfos infoPtr) infoPtr->editFlags = Extension::OEFLAGS; infoPtr->editPrefs = Extension::OEPREFS; - memcpy(&infoPtr->identifier, SDK->json["About"]["Identifier"], 4); + json_value const &identifier = SDK->json["About"]["Identifier"]; + if(identifier.type == json_string) + { + memcpy(&infoPtr->identifier, identifier, 4); + } + else if(identifier.type == json_integer) + { + long id = static_cast(identifier.u.integer); + memcpy(&infoPtr->identifier, reinterpret_cast(&id), 4); + } + else + { + MessageBox(NULL, _T("Invalid Object Identifier!"), _T("EDIF Extension SDK"), MB_OK); + return FALSE; + } infoPtr->version = Extension::Version; From 69f02dda3ea329e160c8768581437a3d92652b61 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Tue, 14 Jul 2015 21:45:38 -0500 Subject: [PATCH 103/127] Allow intercepting menu selections --- Extensions/TemplatePlus/Edittime.cpp | 40 ++++++++++++++++++++++++++++ Lib/Edif.Edittime.cpp | 12 ++++++--- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/Extensions/TemplatePlus/Edittime.cpp b/Extensions/TemplatePlus/Edittime.cpp index fd39b6a..e48e81b 100644 --- a/Extensions/TemplatePlus/Edittime.cpp +++ b/Extensions/TemplatePlus/Edittime.cpp @@ -295,3 +295,43 @@ BOOL MMF2Func GetFilters(mv *mV, SerializedED *SED, DWORD Flags, void *) #endif return FALSE; } + +#ifndef RUN_ONLY + +/* InterceptActionSelection + * This function is called after the user has selected a + * menu item from the actions popup menu. You can show + * a dialog or allow the user to make a choice, and + * return a different ID to Fusion. Be aware, there + * is no way to cancel this operation. + */ +short InterceptActionSelection(mv *mV, short selectedId) +{ + return selectedId; +} + +/* InterceptActionSelection + * This function is called after the user has selected a + * menu item from the conditions popup menu. You can show + * a dialog or allow the user to make a choice, and + * return a different ID to Fusion. Be aware, there + * is no way to cancel this operation. + */ +short InterceptConditionSelection(mv *mV, short selectedId) +{ + return selectedId; +} + +/* InterceptActionSelection + * This function is called after the user has selected a + * menu item from the expressions popup menu. You can show + * a dialog or allow the user to make a choice, and + * return a different ID to Fusion. Be aware, there + * is no way to cancel this operation. + */ +short InterceptExpressionSelection(mv *mV, short selectedId) +{ + return selectedId; +} + +#endif diff --git a/Lib/Edif.Edittime.cpp b/Lib/Edif.Edittime.cpp index b68f1b7..fa9bd52 100644 --- a/Lib/Edif.Edittime.cpp +++ b/Lib/Edif.Edittime.cpp @@ -165,11 +165,17 @@ LPINFOEVENTSV2 WINAPI DLLExport GetExpressionInfos(mv _far *mV, short code) return NULL; } +#ifndef RUN_ONLY +short InterceptActionSelection(mv *mV, short selectedId); +short InterceptConditionSelection(mv *mV, short selectedId); +short InterceptExpressionSelection(mv *mV, short selectedId); +#endif + short WINAPI DLLExport GetConditionCodeFromMenu(mv _far *mV, short menuId) { #ifndef RUN_ONLY - return menuId - Edif::ConditionID(0); + return InterceptConditionSelection(mV, menuId - Edif::ConditionID(0)); #endif // !defined(RUN_ONLY) return -1; @@ -179,7 +185,7 @@ short WINAPI DLLExport GetActionCodeFromMenu(mv _far *mV, short menuId) { #ifndef RUN_ONLY - return menuId - Edif::ActionID(0); + return InterceptActionSelection(mV, menuId - Edif::ActionID(0)); #endif // !defined(RUN_ONLY) return -1; @@ -189,7 +195,7 @@ short WINAPI DLLExport GetExpressionCodeFromMenu(mv _far *mV, short menuId) { #ifndef RUN_ONLY - return menuId - Edif::ExpressionID(0); + return InterceptExpressionSelection(mV, menuId - Edif::ExpressionID(0)); #endif // !defined(RUN_ONLY) return -1; From b5f5341dbbaa46db99c590f90e1be4b7f7cde649 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Wed, 15 Jul 2015 08:49:27 -0500 Subject: [PATCH 104/127] Use PARAM_FILENAME2 instead of PARAM_FILENAME --- Lib/Edif.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 3de1ece..90e0bcc 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -13,7 +13,7 @@ HMENU Edif::ActionMenu, Edif::ConditionMenu, Edif::ExpressionMenu; short ReadParameterType(const char * Text) { if(!_stricmp(Text, "Text") || !_stricmp(Text, "String")) return PARAM_EXPSTRING; - if(!_stricmp(Text, "Filename") || !_stricmp(Text, "File")) return PARAM_FILENAME; + if(!_stricmp(Text, "Filename") || !_stricmp(Text, "File")) return PARAM_FILENAME2; if(!_stricmp(Text, "Float")) return PARAM_EXPRESSION; if(!_stricmp(Text, "Integer")) return PARAM_EXPRESSION; if(!_stricmp(Text, "Object")) return PARAM_OBJECT; From 8e0ffb3ab7233dc51b628e2f81b3d144380162f6 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 18 Jul 2015 23:10:29 -0500 Subject: [PATCH 105/127] Add A/C/E intercepting to the regular template too --- Extensions/Template/Edittime.cpp | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/Extensions/Template/Edittime.cpp b/Extensions/Template/Edittime.cpp index ec47496..9b08336 100644 --- a/Extensions/Template/Edittime.cpp +++ b/Extensions/Template/Edittime.cpp @@ -797,3 +797,43 @@ void WINAPI GetParameterString(mv _far *mV, short code, paramExt* pExt, LPSTR pD #endif // !defined(RUN_ONLY) } + +#ifndef RUN_ONLY + +/* InterceptActionSelection + * This function is called after the user has selected a + * menu item from the actions popup menu. You can show + * a dialog or allow the user to make a choice, and + * return a different ID to Fusion. Be aware, there + * is no way to cancel this operation. + */ +short InterceptActionSelection(mv *mV, short selectedId) +{ + return selectedId; +} + +/* InterceptActionSelection + * This function is called after the user has selected a + * menu item from the conditions popup menu. You can show + * a dialog or allow the user to make a choice, and + * return a different ID to Fusion. Be aware, there + * is no way to cancel this operation. + */ +short InterceptConditionSelection(mv *mV, short selectedId) +{ + return selectedId; +} + +/* InterceptActionSelection + * This function is called after the user has selected a + * menu item from the expressions popup menu. You can show + * a dialog or allow the user to make a choice, and + * return a different ID to Fusion. Be aware, there + * is no way to cancel this operation. + */ +short InterceptExpressionSelection(mv *mV, short selectedId) +{ + return selectedId; +} + +#endif From 0015518b49f27e29da2ba419b82b0cb15b8f59ed Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 18 Jul 2015 23:10:48 -0500 Subject: [PATCH 106/127] Update the TemplatePlus gitignore --- Extensions/TemplatePlus/.gitignore | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Extensions/TemplatePlus/.gitignore b/Extensions/TemplatePlus/.gitignore index 5fda6e4..c022959 100644 --- a/Extensions/TemplatePlus/.gitignore +++ b/Extensions/TemplatePlus/.gitignore @@ -1,13 +1,14 @@ # Template project built files MFX/ +Debug/ Debug HWA/ -DebugUnicode/ +Debug UnicodeHWA/ +Edittime/ Edittime HWA/ -ReleaseEditor/ -ReleaseEditorUnicode/ -ReleaseRuntime/ -ReleaseRuntimeUnicode/ +Edittime UnicodeHWA/ +Runtime/ Runtime HWA/ +Runtime UnicodeHWA/ ################# From 231179bc444d1ca6a34eb0847346ab317db882f2 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 18 Jul 2015 23:11:53 -0500 Subject: [PATCH 107/127] Update the ID for `PROPID_TAB_CUSTOM1` It keeps getting changed and I have to try random numbers until I find it. --- Inc/Props.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Inc/Props.h b/Inc/Props.h index 15b1165..a40ccc5 100644 --- a/Inc/Props.h +++ b/Inc/Props.h @@ -1021,9 +1021,9 @@ enum { PROPID_TAB_MAC, PROPID_TAB_HTML5, PROPID_TAB_VITA, - PROPID_TAB_CUSTOM1 = 18, - PROPID_TAB_CUSTOM2, - PROPTAB_MAX // 20 + PROPID_TAB_CUSTOM1 = 20, //TODO: keep updating this as Fusion updates + PROPID_TAB_CUSTOM2, //note: custom tabs are no longer supported in MMF2.0, only in CTF2.5 + PROPTAB_MAX }; /////////////// From 792450f25bf40f598266d6e3d8a252dc53ed67fd Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 18 Jul 2015 23:15:43 -0500 Subject: [PATCH 108/127] Finally fix EditData corruption I hate the C++ iostreams library. It is the worst designed library I have ever used and it never ceases to cause me pain. I have no idea why sync() never gets called. I have no idea why the tutorial I followed told me to return a failure code on success in overflow(). I have no idea why I thought it would still work properly with wide streams. But I do know this: I need to rip out this iostreams stuff next time I get a chance, and got with a simple vector buffer instead. Nobody needs the iostreams stuff. --- Inc/EDStream.hpp | 66 +++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/Inc/EDStream.hpp b/Inc/EDStream.hpp index 92bc7aa..a8d5b1f 100644 --- a/Inc/EDStream.hpp +++ b/Inc/EDStream.hpp @@ -11,14 +11,15 @@ #include #include -struct EDIStream : std::basic_istream +struct EDIStream : std::basic_istream { - struct Buf : std::basic_streambuf + struct Buf : std::basic_streambuf { Buf(SerializedED const&SED, std::size_t putback = 8) : pb(putback), b(putback) { - b.reserve(pb + SED.Header.extSize); - for(std::size_t i = 0; i < SED.Header.extSize; ++i) + std::size_t const edsize = SED.Header.extSize - sizeof(SerializedED); + b.reserve(pb + edsize); + for(std::size_t i = 0; i < edsize; ++i) { b.push_back(SED.data[i]); } @@ -45,7 +46,7 @@ struct EDIStream : std::basic_istream Buf &operator=(Buf const&); }; - EDIStream(SerializedED const*SED) : b(*SED), std::basic_istream(&b) + EDIStream(SerializedED const*SED) : b(*SED), std::basic_istream(&b) { } virtual ~EDIStream() @@ -56,13 +57,16 @@ struct EDIStream : std::basic_istream T read_value() { T t = T(); - this->read(reinterpret_cast(&t), sizeof(T)); + this->read(reinterpret_cast(&t), sizeof(T)); return t; } std::basic_string read_string() { std::basic_string s; - std::getline(*this, s, _T('\0')); + while(TCHAR c = read_value()) + { + s += c; + } return s; } @@ -73,9 +77,9 @@ struct EDIStream : std::basic_istream EDIStream &operator=(EDIStream const&); }; -struct EDOStream : std::basic_ostream +struct EDOStream : std::basic_ostream { - struct Buf : std::basic_streambuf + struct Buf : std::basic_streambuf { Buf(mv *mV, SerializedED *&SED) : mV(mV), SED(SED) { @@ -83,8 +87,22 @@ struct EDOStream : std::basic_ostream } virtual ~Buf() { + if(b.empty()) + { + return; + } + std::size_t size = (&b.back() + 1) - &b.front(); + SerializedED *t = (SerializedED *)mvReAllocEditData(mV, SED, sizeof(SerializedED)+size); + if(t) + { + SED = t; + memcpy(&(SED->data[0]), &b.front(), size); + } + else + { + MessageBox(NULL, _T("There isn't enough from to store the editdata!"), _T("EDIF Extension"), MB_ICONWARNING); + } } - private: mv *mV; SerializedED *&SED; @@ -95,29 +113,15 @@ struct EDOStream : std::basic_ostream if(ch != traits_type::eof()) { b.push_back(char_type(ch)); - setp(&b.front(), /*&b.back()+1, */&b.back()+1); - pbump((&b.back()+1)-(&b.front())); - } - return traits_type::eof(); - } - virtual int sync() - { - std::size_t size = (&b.back() + 1) - &b.front(); - SerializedED *t = (SerializedED *)mvReAllocEditData(mV, SED, sizeof(SerializedED)+size); - if(t) - { - SED = t; - memcpy(&SED->data, &b.front(), size); - return 0; } - return -1; + return 0; } Buf(Buf const&); Buf &operator=(Buf const&); }; - EDOStream(mv *mV, SerializedED *&SED) : b(mV, SED), std::basic_ostream(&b) + EDOStream(mv *mV, SerializedED *&SED) : b(mV, SED), std::basic_ostream(&b) { } virtual ~EDOStream() @@ -127,12 +131,16 @@ struct EDOStream : std::basic_ostream template EDOStream &write_value(T t) { - this->write(reinterpret_cast(&t), sizeof(T)); + this->write(reinterpret_cast(&t), sizeof(T)); return *this; } EDOStream &write_string(std::basic_string const&s) { - *this << s << std::ends; + for(std::basic_string::const_iterator it = s.begin(); it != s.end(); ++it) + { + write_value(*it); + } + write_value(TCHAR()); return *this; } template @@ -140,7 +148,7 @@ struct EDOStream : std::basic_ostream { for(; first != pastlast; ++first) { - this->write(reinterpret_cast(&*first), sizeof(*first)); + this->write(reinterpret_cast(&*first), sizeof(*first)); } return *this; } From 18ea937703ac0916fd583dedf8316f311112bfb6 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 18 Jul 2015 23:16:54 -0500 Subject: [PATCH 109/127] Make all conditions negatable (because why not?) --- Lib/Edif.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 90e0bcc..36c0ae6 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -271,7 +271,7 @@ Edif::SDK::SDK(mv * mV, json_value &_json) : json (_json) ConditionInfos.push_back(ConditionID); ConditionInfos.push_back(i); - ConditionInfos.push_back(((bool) Condition["Triggered"]) ? 0 : (EVFLAGS_ALWAYS | EVFLAGS_NOTABLE)); + ConditionInfos.push_back(((bool) Condition["Triggered"]) ? (EVFLAGS_NOTABLE) : (EVFLAGS_ALWAYS | EVFLAGS_NOTABLE)); const json_value &Parameters = Condition["Parameters"]; From 1f742b50efbb72b0c9a507eb6c5568a99e512b46 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Mon, 20 Jul 2015 21:18:23 -0500 Subject: [PATCH 110/127] Add VS2015 project for TemplatePlus --- Extensions/AutoInstall.bat | 11 +- Extensions/TemplatePlus/Edittime.cpp | 2 +- .../TemplatePlus/{resource.h => Resource.h} | 0 Extensions/TemplatePlus/Template2015.sln | 25 ++ Extensions/TemplatePlus/Template2015.vcxproj | 259 ++++++++++++++++++ 5 files changed, 292 insertions(+), 5 deletions(-) rename Extensions/TemplatePlus/{resource.h => Resource.h} (100%) create mode 100644 Extensions/TemplatePlus/Template2015.sln create mode 100644 Extensions/TemplatePlus/Template2015.vcxproj diff --git a/Extensions/AutoInstall.bat b/Extensions/AutoInstall.bat index 9deabe6..6101c81 100644 --- a/Extensions/AutoInstall.bat +++ b/Extensions/AutoInstall.bat @@ -9,7 +9,7 @@ if %status%==ERROR goto nmfd for /F "tokens=3* delims= " %%A in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Clickteam\Multimedia Fusion Developer 2\Settings" /v "ProPath" ^| find "REG_SZ"') do set mmfpath=%%A %%B -echo MMF2 Dev Path: %mmfpath% +echo MMF2.0 Dev Path: %mmfpath% copy /y "%1" "%mmfpath%%2" @@ -19,7 +19,7 @@ set status= goto mfs :nmfd -echo You don't have MMF2 Developer :( +echo You don't have MMF2.0 Developer :( :mfs set status=ERROR @@ -29,7 +29,7 @@ if %status%==ERROR goto nmfs for /F "tokens=3* delims= " %%A in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Clickteam\Multimedia Fusion 2\Settings" /v "StdPath" ^| find "REG_SZ"') do set mmfpath=%%A %%B -echo MMF2 Std Path: %mmfpath% +echo MMF2.0 Std Path: %mmfpath% copy /y "%1" "%mmfpath%%2" @@ -39,7 +39,7 @@ set status= goto cfd :nmfs -echo You don't have MMF2 Standard +echo You don't have MMF2.0 Standard :cfd set status=ERROR @@ -82,3 +82,6 @@ goto end echo You don't have CTF2.5 Standard :end + +(call ) +exit /b 0 diff --git a/Extensions/TemplatePlus/Edittime.cpp b/Extensions/TemplatePlus/Edittime.cpp index e48e81b..093bef3 100644 --- a/Extensions/TemplatePlus/Edittime.cpp +++ b/Extensions/TemplatePlus/Edittime.cpp @@ -54,7 +54,7 @@ int MMF2Func CreateObject(mv *mV, LO *lo, SerializedED *SED) * current example just uses the * Icon.png from the resources. */ -int MMF2Func MakeIconEx(mv *mV, cSurface *Icon, LPTSTR Name, OI *oi, SerializedED *SED) +extern "C" int MMF2Func MakeIconEx(mv *mV, cSurface *Icon, LPTSTR Name, OI *oi, SerializedED *SED) { #ifndef RUN_ONLY Icon->Delete(); diff --git a/Extensions/TemplatePlus/resource.h b/Extensions/TemplatePlus/Resource.h similarity index 100% rename from Extensions/TemplatePlus/resource.h rename to Extensions/TemplatePlus/Resource.h diff --git a/Extensions/TemplatePlus/Template2015.sln b/Extensions/TemplatePlus/Template2015.sln new file mode 100644 index 0000000..1a329fb --- /dev/null +++ b/Extensions/TemplatePlus/Template2015.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template", "Template2015.vcxproj", "{87325274-EF61-43D2-85A3-FF7CE13EDD69}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug UnicodeHWA|Fusion-2.5 = Debug UnicodeHWA|Fusion-2.5 + Edittime UnicodeHWA|Fusion-2.5 = Edittime UnicodeHWA|Fusion-2.5 + Runtime UnicodeHWA|Fusion-2.5 = Runtime UnicodeHWA|Fusion-2.5 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug UnicodeHWA|Fusion-2.5.ActiveCfg = Debug UnicodeHWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug UnicodeHWA|Fusion-2.5.Build.0 = Debug UnicodeHWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime UnicodeHWA|Fusion-2.5.ActiveCfg = Edittime UnicodeHWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime UnicodeHWA|Fusion-2.5.Build.0 = Edittime UnicodeHWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime UnicodeHWA|Fusion-2.5.ActiveCfg = Runtime UnicodeHWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime UnicodeHWA|Fusion-2.5.Build.0 = Runtime UnicodeHWA|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Extensions/TemplatePlus/Template2015.vcxproj b/Extensions/TemplatePlus/Template2015.vcxproj new file mode 100644 index 0000000..85eec3e --- /dev/null +++ b/Extensions/TemplatePlus/Template2015.vcxproj @@ -0,0 +1,259 @@ + + + + + Debug UnicodeHWA + Win32 + + + Edittime UnicodeHWA + Win32 + + + Runtime UnicodeHWA + Win32 + + + + {87325274-EF61-43D2-85A3-FF7CE13EDD69} + Template2015 + Template + 8.1 + + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + .mfx + false + C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset + true + $(ProjectDir)MFX\Extensions\Unicode\ + + + .mfx + false + $(ProjectDir)MFX\Extensions\Unicode\ + + + .mfx + false + $(ProjectDir)MFX\Data\Runtime\Unicode\ + + + + Level3 + Disabled + true + ..\..\Inc;.\; + DEBUG;EDITOR;HWABETA;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;%(PreprocessorDefinitions) + min;max;%(UndefinePreprocessorDefinitions) + true + Guard + true + true + CompileAsCpp + MultiThreadedDebug + true + + + true + $(ProjectDir)\MFX\Extensions\Unicode\$(ProjectName)$(TargetExt) + ..\..\lib\mmfs2.5.lib;%(AdditionalDependencies) + false + ./Ext.def + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).lib + false + + + ..\AutoInstall.bat "$(TargetPath)" \Extensions\Unicode 2> nul + Automatically installs the extension to Fusion once it is built. + + + + + Level3 + MaxSpeed + true + true + true + ..\..\Inc;.\; + EDITOR;HWABETA;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;%(PreprocessorDefinitions) + min;max;%(UndefinePreprocessorDefinitions) + true + Guard + true + true + CompileAsCpp + None + MultiThreaded + + + true + true + true + $(ProjectDir)\MFX\Extensions\Unicode\$(ProjectName)$(TargetExt) + ..\..\lib\mmfs2.5.lib;%(AdditionalDependencies) + false + ./Ext.def + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).lib + false + + + ..\AutoInstall.bat "$(TargetPath)" \Extensions\Unicode 2> nul + Automatically installs the extension to Fusion once it is built. + + + + + Level3 + MaxSpeed + true + true + true + ..\..\Inc;.\; + _NDEBUG;RUN_ONLY;HWABETA;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;%(PreprocessorDefinitions) + min;max;%(UndefinePreprocessorDefinitions) + true + Guard + true + true + CompileAsCpp + None + MultiThreaded + + + true + true + true + $(ProjectDir)MFX\Data\Runtime\Unicode\$(ProjectName)$(TargetExt) + ..\..\lib\mmfs2.5.lib;%(AdditionalDependencies) + false + ./Ext.def + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).lib + false + + + ..\AutoInstall.bat "$(TargetPath)" \Data\Runtime\Unicode 2> nul + Automatically installs the extension to Fusion once it is built. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 78afbf04b0d2913274bec6747940db7ca8fd2f5b Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Mon, 20 Jul 2015 21:30:49 -0500 Subject: [PATCH 111/127] Fix icon not being included --- Extensions/TemplatePlus/Edittime.cpp | 2 +- Extensions/TemplatePlus/Template.sln | 2 +- Extensions/TemplatePlus/Template2015.sln | 2 +- Extensions/TemplatePlus/Template2015.vcxproj | 6 ++++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Extensions/TemplatePlus/Edittime.cpp b/Extensions/TemplatePlus/Edittime.cpp index 093bef3..e48e81b 100644 --- a/Extensions/TemplatePlus/Edittime.cpp +++ b/Extensions/TemplatePlus/Edittime.cpp @@ -54,7 +54,7 @@ int MMF2Func CreateObject(mv *mV, LO *lo, SerializedED *SED) * current example just uses the * Icon.png from the resources. */ -extern "C" int MMF2Func MakeIconEx(mv *mV, cSurface *Icon, LPTSTR Name, OI *oi, SerializedED *SED) +int MMF2Func MakeIconEx(mv *mV, cSurface *Icon, LPTSTR Name, OI *oi, SerializedED *SED) { #ifndef RUN_ONLY Icon->Delete(); diff --git a/Extensions/TemplatePlus/Template.sln b/Extensions/TemplatePlus/Template.sln index 18fe76f..3f1cd1b 100644 --- a/Extensions/TemplatePlus/Template.sln +++ b/Extensions/TemplatePlus/Template.sln @@ -35,6 +35,6 @@ Global {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.Build.0 = Runtime|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE + HideSolutionNode = TRUE EndGlobalSection EndGlobal diff --git a/Extensions/TemplatePlus/Template2015.sln b/Extensions/TemplatePlus/Template2015.sln index 1a329fb..e4bcbe0 100644 --- a/Extensions/TemplatePlus/Template2015.sln +++ b/Extensions/TemplatePlus/Template2015.sln @@ -20,6 +20,6 @@ Global {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime UnicodeHWA|Fusion-2.5.Build.0 = Runtime UnicodeHWA|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE + HideSolutionNode = TRUE EndGlobalSection EndGlobal diff --git a/Extensions/TemplatePlus/Template2015.vcxproj b/Extensions/TemplatePlus/Template2015.vcxproj index 85eec3e..6fc4203 100644 --- a/Extensions/TemplatePlus/Template2015.vcxproj +++ b/Extensions/TemplatePlus/Template2015.vcxproj @@ -103,6 +103,9 @@ ..\AutoInstall.bat "$(TargetPath)" \Extensions\Unicode 2> nul Automatically installs the extension to Fusion once it is built. + + EDITOR;%(PreprocessorDefinitions) + @@ -138,6 +141,9 @@ ..\AutoInstall.bat "$(TargetPath)" \Extensions\Unicode 2> nul Automatically installs the extension to Fusion once it is built. + + EDITOR;%(PreprocessorDefinitions) + From 0a4985835adb523bc0d17173ff570bf9bd33e505 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Mon, 20 Jul 2015 21:49:15 -0500 Subject: [PATCH 112/127] Add vanilla Template2015 --- Extensions/Template/Template2015.sln | 25 ++ Extensions/Template/Template2015.vcxproj | 260 ++++++++++++++++++ .../Template/Template2015.vcxproj.filters | 224 +++++++++++++++ Extensions/TemplatePlus/Template2015.vcxproj | 1 + .../TemplatePlus/Template2015.vcxproj.filters | 251 +++++++++++++++++ 5 files changed, 761 insertions(+) create mode 100644 Extensions/Template/Template2015.sln create mode 100644 Extensions/Template/Template2015.vcxproj create mode 100644 Extensions/Template/Template2015.vcxproj.filters create mode 100644 Extensions/TemplatePlus/Template2015.vcxproj.filters diff --git a/Extensions/Template/Template2015.sln b/Extensions/Template/Template2015.sln new file mode 100644 index 0000000..e4bcbe0 --- /dev/null +++ b/Extensions/Template/Template2015.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template", "Template2015.vcxproj", "{87325274-EF61-43D2-85A3-FF7CE13EDD69}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug UnicodeHWA|Fusion-2.5 = Debug UnicodeHWA|Fusion-2.5 + Edittime UnicodeHWA|Fusion-2.5 = Edittime UnicodeHWA|Fusion-2.5 + Runtime UnicodeHWA|Fusion-2.5 = Runtime UnicodeHWA|Fusion-2.5 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug UnicodeHWA|Fusion-2.5.ActiveCfg = Debug UnicodeHWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug UnicodeHWA|Fusion-2.5.Build.0 = Debug UnicodeHWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime UnicodeHWA|Fusion-2.5.ActiveCfg = Edittime UnicodeHWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime UnicodeHWA|Fusion-2.5.Build.0 = Edittime UnicodeHWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime UnicodeHWA|Fusion-2.5.ActiveCfg = Runtime UnicodeHWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime UnicodeHWA|Fusion-2.5.Build.0 = Runtime UnicodeHWA|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = TRUE + EndGlobalSection +EndGlobal diff --git a/Extensions/Template/Template2015.vcxproj b/Extensions/Template/Template2015.vcxproj new file mode 100644 index 0000000..69fe54a --- /dev/null +++ b/Extensions/Template/Template2015.vcxproj @@ -0,0 +1,260 @@ + + + + + Debug UnicodeHWA + Win32 + + + Edittime UnicodeHWA + Win32 + + + Runtime UnicodeHWA + Win32 + + + + {87325274-EF61-43D2-85A3-FF7CE13EDD69} + Template2015 + Template + 8.1 + + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + .mfx + false + C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset + true + $(ProjectDir)MFX\Extensions\Unicode\ + + + .mfx + false + $(ProjectDir)MFX\Extensions\Unicode\ + + + .mfx + false + $(ProjectDir)MFX\Data\Runtime\Unicode\ + + + + Level3 + Disabled + true + ..\..\Inc;.\; + DEBUG;EDITOR;HWABETA;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;%(PreprocessorDefinitions) + min;max;%(UndefinePreprocessorDefinitions) + true + Guard + true + true + CompileAsCpp + MultiThreadedDebug + true + ProgramDatabase + + + true + $(ProjectDir)\MFX\Extensions\Unicode\$(ProjectName)$(TargetExt) + ..\..\lib\mmfs2.5.lib;%(AdditionalDependencies) + false + ./Ext.def + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).lib + false + + + ..\AutoInstall.bat "$(TargetPath)" \Extensions\Unicode 2> nul + Automatically installs the extension to Fusion once it is built. + + + EDITOR;%(PreprocessorDefinitions) + + + + + Level3 + MaxSpeed + true + true + true + ..\..\Inc;.\; + EDITOR;HWABETA;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;%(PreprocessorDefinitions) + min;max;%(UndefinePreprocessorDefinitions) + true + Guard + true + true + CompileAsCpp + None + MultiThreaded + + + true + true + true + $(ProjectDir)\MFX\Extensions\Unicode\$(ProjectName)$(TargetExt) + ..\..\lib\mmfs2.5.lib;%(AdditionalDependencies) + false + ./Ext.def + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).lib + false + + + ..\AutoInstall.bat "$(TargetPath)" \Extensions\Unicode 2> nul + Automatically installs the extension to Fusion once it is built. + + + EDITOR;%(PreprocessorDefinitions) + + + + + Level3 + MaxSpeed + true + true + true + ..\..\Inc;.\; + _NDEBUG;RUN_ONLY;HWABETA;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;%(PreprocessorDefinitions) + min;max;%(UndefinePreprocessorDefinitions) + true + Guard + true + true + CompileAsCpp + None + MultiThreaded + + + true + true + true + $(ProjectDir)MFX\Data\Runtime\Unicode\$(ProjectName)$(TargetExt) + ..\..\lib\mmfs2.5.lib;%(AdditionalDependencies) + false + ./Ext.def + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).lib + false + + + ..\AutoInstall.bat "$(TargetPath)" \Data\Runtime\Unicode 2> nul + Automatically installs the extension to Fusion once it is built. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Extensions/Template/Template2015.vcxproj.filters b/Extensions/Template/Template2015.vcxproj.filters new file mode 100644 index 0000000..b446d86 --- /dev/null +++ b/Extensions/Template/Template2015.vcxproj.filters @@ -0,0 +1,224 @@ + + + + + {2f2987a7-e80a-4858-ada9-cc257cdada00} + + + {187fb9d6-9e49-489c-b9e8-a933212aff49} + + + {343d78a4-26f2-421a-aaf4-60d9cd560080} + + + {cd4e03ba-2d8b-4bd6-a680-fb7550b15e72} + + + {61e65ed1-83c8-4a25-8f07-fec01e952a99} + + + {11227bd0-77c9-4d0c-8fec-69a9456c064f} + + + {e7feb950-1a6f-4ae0-bef7-6c7e2f50db95} + + + {aa6d4c30-b593-47da-80aa-802a1f1cef4d} + + + + + Global to All Extensions\Edif\json + + + Global to All Extensions\Edif\Riggs + + + Global to All Extensions\Edif + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions + + + This Extension\Resource Files + + + This Extension\The Extension Class + + + This Extension + + + + + Global to All Extensions\Edif\json + + + Global to All Extensions\Edif\Riggs + + + Global to All Extensions\Edif + + + Global to All Extensions\Edif + + + Global to All Extensions\Edif + + + Global to All Extensions\Edif + + + This Extension\The Extension Class + + + This Extension\The Extension Class + + + This Extension\The Extension Class + + + This Extension\The Extension Class + + + This Extension + + + This Extension + + + This Extension + + + + + Global to All Extensions\Fusion SDK + + + + + This Extension\Resource Files + + + This Extension + + + + + This Extension\Resource Files + + + + + This Extension\Resource Files + + + \ No newline at end of file diff --git a/Extensions/TemplatePlus/Template2015.vcxproj b/Extensions/TemplatePlus/Template2015.vcxproj index 6fc4203..fb19238 100644 --- a/Extensions/TemplatePlus/Template2015.vcxproj +++ b/Extensions/TemplatePlus/Template2015.vcxproj @@ -88,6 +88,7 @@ CompileAsCpp MultiThreadedDebug true + ProgramDatabase true diff --git a/Extensions/TemplatePlus/Template2015.vcxproj.filters b/Extensions/TemplatePlus/Template2015.vcxproj.filters new file mode 100644 index 0000000..468f3ad --- /dev/null +++ b/Extensions/TemplatePlus/Template2015.vcxproj.filters @@ -0,0 +1,251 @@ + + + + + {2f2987a7-e80a-4858-ada9-cc257cdada00} + + + {187fb9d6-9e49-489c-b9e8-a933212aff49} + + + {343d78a4-26f2-421a-aaf4-60d9cd560080} + + + {cd4e03ba-2d8b-4bd6-a680-fb7550b15e72} + + + {61e65ed1-83c8-4a25-8f07-fec01e952a99} + + + {11227bd0-77c9-4d0c-8fec-69a9456c064f} + + + {90bc3fe8-d446-4fdb-b429-be33a75f253c} + + + {5623edff-2f18-496b-acd6-3401edf475b7} + + + {e7feb950-1a6f-4ae0-bef7-6c7e2f50db95} + + + {a6e4a40f-2b93-4e5d-8d54-66a39bb084f3} + + + {aa6d4c30-b593-47da-80aa-802a1f1cef4d} + + + + + Global to All Extensions\Edif\json + + + Global to All Extensions\Edif\Riggs + + + Global to All Extensions\Edif + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions\Fusion SDK + + + Global to All Extensions + + + This Extension\Edittime + + + This Extension\General + + + This Extension\Resource Files + + + This Extension\The Extension Class + + + + + Global to All Extensions\Edif\json + + + Global to All Extensions\Edif\Riggs + + + Global to All Extensions\Edif + + + Global to All Extensions\Edif + + + Global to All Extensions\Edif + + + Global to All Extensions\Edif + + + This Extension\Edittime + + + This Extension\Edittime + + + This Extension\Edittime + + + This Extension\Edittime + + + This Extension\General + + + This Extension\Runtime + + + This Extension\Runtime + + + This Extension\Runtime + + + This Extension\The Extension Class + + + This Extension\The Extension Class + + + This Extension\The Extension Class + + + This Extension\The Extension Class + + + + + Global to All Extensions\Fusion SDK + + + + + This Extension\Resource Files + + + This Extension + + + + + This Extension\Resource Files + + + + + This Extension\Resource Files + + + \ No newline at end of file From f866c1a2b95bc83c73507f3601fe96941d62e927 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Mon, 20 Jul 2015 21:53:55 -0500 Subject: [PATCH 113/127] Oops, unhide solution nodes --- Extensions/Template/Template2015.sln | 2 +- Extensions/TemplatePlus/Template.sln | 2 +- Extensions/TemplatePlus/Template2015.sln | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Extensions/Template/Template2015.sln b/Extensions/Template/Template2015.sln index e4bcbe0..1a329fb 100644 --- a/Extensions/Template/Template2015.sln +++ b/Extensions/Template/Template2015.sln @@ -20,6 +20,6 @@ Global {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime UnicodeHWA|Fusion-2.5.Build.0 = Runtime UnicodeHWA|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = TRUE + HideSolutionNode = FALSE EndGlobalSection EndGlobal diff --git a/Extensions/TemplatePlus/Template.sln b/Extensions/TemplatePlus/Template.sln index 3f1cd1b..18fe76f 100644 --- a/Extensions/TemplatePlus/Template.sln +++ b/Extensions/TemplatePlus/Template.sln @@ -35,6 +35,6 @@ Global {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.Build.0 = Runtime|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = TRUE + HideSolutionNode = FALSE EndGlobalSection EndGlobal diff --git a/Extensions/TemplatePlus/Template2015.sln b/Extensions/TemplatePlus/Template2015.sln index e4bcbe0..1a329fb 100644 --- a/Extensions/TemplatePlus/Template2015.sln +++ b/Extensions/TemplatePlus/Template2015.sln @@ -20,6 +20,6 @@ Global {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime UnicodeHWA|Fusion-2.5.Build.0 = Runtime UnicodeHWA|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = TRUE + HideSolutionNode = FALSE EndGlobalSection EndGlobal From 09daac3c4123903ecc8f658ace3caa9660dd1c4b Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Tue, 21 Jul 2015 09:01:25 -0500 Subject: [PATCH 114/127] Try to reduce excess files in MFX folder --- Extensions/TemplatePlus/Template2015.vcxproj | 36 ++++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/Extensions/TemplatePlus/Template2015.vcxproj b/Extensions/TemplatePlus/Template2015.vcxproj index fb19238..84d1bb5 100644 --- a/Extensions/TemplatePlus/Template2015.vcxproj +++ b/Extensions/TemplatePlus/Template2015.vcxproj @@ -31,14 +31,14 @@ DynamicLibrary false v140 - true + FastLTCG Unicode DynamicLibrary false v140 - true + FastLTCG Unicode @@ -61,17 +61,20 @@ false C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset true - $(ProjectDir)MFX\Extensions\Unicode\ + $(ProjectDir)\MFX\Extensions\Unicode\ + false .mfx false - $(ProjectDir)MFX\Extensions\Unicode\ + $(ProjectDir)\MFX\Extensions\Unicode\ + false .mfx false $(ProjectDir)MFX\Data\Runtime\Unicode\ + false @@ -99,6 +102,7 @@ $(IntDir)$(TargetName).pdb $(IntDir)$(TargetName).lib false + $(IntDir)$(TargetName).pgd ..\AutoInstall.bat "$(TargetPath)" \Extensions\Unicode 2> nul @@ -107,6 +111,12 @@ EDITOR;%(PreprocessorDefinitions) + + $(IntDir)$(TargetName).xml + + + $(IntDir)$(TargetName).bsc + @@ -127,7 +137,7 @@ MultiThreaded - true + No true true $(ProjectDir)\MFX\Extensions\Unicode\$(ProjectName)$(TargetExt) @@ -137,6 +147,7 @@ $(IntDir)$(TargetName).pdb $(IntDir)$(TargetName).lib false + $(IntDir)$(TargetName).pgd ..\AutoInstall.bat "$(TargetPath)" \Extensions\Unicode 2> nul @@ -145,6 +156,12 @@ EDITOR;%(PreprocessorDefinitions) + + $(IntDir)$(TargetName).xml + + + $(IntDir)$(TargetName).bsc + @@ -165,7 +182,7 @@ MultiThreaded - true + No true true $(ProjectDir)MFX\Data\Runtime\Unicode\$(ProjectName)$(TargetExt) @@ -175,11 +192,18 @@ $(IntDir)$(TargetName).pdb $(IntDir)$(TargetName).lib false + $(IntDir)$(TargetName).pgd ..\AutoInstall.bat "$(TargetPath)" \Data\Runtime\Unicode 2> nul Automatically installs the extension to Fusion once it is built. + + $(IntDir)$(TargetName).xml + + + $(IntDir)$(TargetName).bsc + From 15624269b36222b2f60f8d946ed928c2b7dcb060 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Mon, 8 Feb 2016 11:53:25 -0600 Subject: [PATCH 115/127] Drop old templates --- Extensions/Template/.gitignore | 175 -- Extensions/Template/Actions.cpp | 17 - Extensions/Template/CMakeLists.txt | 97 - Extensions/Template/Common.h | 61 - Extensions/Template/Conditions.cpp | 14 - Extensions/Template/Edittime.cpp | 839 --------- Extensions/Template/Expressions.cpp | 20 - Extensions/Template/Ext.def | 118 -- Extensions/Template/Ext.json | 74 - Extensions/Template/Ext.rc | 156 -- Extensions/Template/Extension.cpp | 191 -- Extensions/Template/Extension.hpp | 133 -- Extensions/Template/General.cpp | 165 -- Extensions/Template/Icon.png | Bin 4524 -> 0 bytes Extensions/Template/Runtime.cpp | 394 ---- Extensions/Template/Template.sln | 40 - Extensions/Template/Template.vcproj | 1585 ---------------- Extensions/Template/Template2015.sln | 25 - Extensions/Template/Template2015.vcxproj | 260 --- .../Template/Template2015.vcxproj.filters | 224 --- Extensions/Template/resource.h | 18 - Extensions/TemplatePlus/CMakeLists.txt | 97 - Extensions/TemplatePlus/Template.sln | 40 - Extensions/TemplatePlus/Template.vcproj | 1612 ----------------- 24 files changed, 6355 deletions(-) delete mode 100644 Extensions/Template/.gitignore delete mode 100644 Extensions/Template/Actions.cpp delete mode 100644 Extensions/Template/CMakeLists.txt delete mode 100644 Extensions/Template/Common.h delete mode 100644 Extensions/Template/Conditions.cpp delete mode 100644 Extensions/Template/Edittime.cpp delete mode 100644 Extensions/Template/Expressions.cpp delete mode 100644 Extensions/Template/Ext.def delete mode 100644 Extensions/Template/Ext.json delete mode 100644 Extensions/Template/Ext.rc delete mode 100644 Extensions/Template/Extension.cpp delete mode 100644 Extensions/Template/Extension.hpp delete mode 100644 Extensions/Template/General.cpp delete mode 100644 Extensions/Template/Icon.png delete mode 100644 Extensions/Template/Runtime.cpp delete mode 100644 Extensions/Template/Template.sln delete mode 100644 Extensions/Template/Template.vcproj delete mode 100644 Extensions/Template/Template2015.sln delete mode 100644 Extensions/Template/Template2015.vcxproj delete mode 100644 Extensions/Template/Template2015.vcxproj.filters delete mode 100644 Extensions/Template/resource.h delete mode 100644 Extensions/TemplatePlus/CMakeLists.txt delete mode 100644 Extensions/TemplatePlus/Template.sln delete mode 100644 Extensions/TemplatePlus/Template.vcproj diff --git a/Extensions/Template/.gitignore b/Extensions/Template/.gitignore deleted file mode 100644 index 5fda6e4..0000000 --- a/Extensions/Template/.gitignore +++ /dev/null @@ -1,175 +0,0 @@ -# Template project built files -MFX/ -Debug HWA/ -DebugUnicode/ -Edittime HWA/ -ReleaseEditor/ -ReleaseEditorUnicode/ -ReleaseRuntime/ -ReleaseRuntimeUnicode/ -Runtime HWA/ - - -################# -## Eclipse -################# - -*.pydevproject -.project -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.classpath -.settings/ -.loadpath - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# PDT-specific -.buildpath - - -################# -## Visual Studio -################# - -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.sln.docstates - -# Build results -[Dd]ebug/ -[Rr]elease/ -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.vspscc -.builds -*.dotCover - -## TODO: If you have NuGet Package Restore enabled, uncomment this -#packages/ - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf - -# Visual Studio profiler -*.psess -*.vsp - -# ReSharper is a .NET coding add-in -_ReSharper* - -# Installshield output folder -[Ee]xpress - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish - -# Others -[Bb]in -[Oo]bj -sql -TestResults -*.Cache -ClientBin -stylecop.* -~$* -*.dbmdl -Generated_Code #added for RIA/Silverlight projects - -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML - - - -############ -## Windows -############ - -# Windows image file caches -Thumbs.db - -# Folder config file -Desktop.ini - - -############# -## Python -############# - -*.py[co] - -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox - -#Translations -*.mo - -#Mr Developer -.mr.developer.cfg - -# Mac crap -.DS_Store diff --git a/Extensions/Template/Actions.cpp b/Extensions/Template/Actions.cpp deleted file mode 100644 index 4e38040..0000000 --- a/Extensions/Template/Actions.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/* Actions.cpp - * This is where you should define the - * behavior of your actions. Make sure - * the parameters match those in the JSON - * exactly! Double check Extension.h - * as well. - */ - -#include "Common.h" - -void Extension::ActionExample(int ExampleParameter) -{ -} - -void Extension::SecondActionExample() -{ -} diff --git a/Extensions/Template/CMakeLists.txt b/Extensions/Template/CMakeLists.txt deleted file mode 100644 index 94b7432..0000000 --- a/Extensions/Template/CMakeLists.txt +++ /dev/null @@ -1,97 +0,0 @@ - -cmake_minimum_required(VERSION 2.8.11) - -project(EXTENSION) - -set(EXT_NAME Template) - -#Grab source & header files -file(GLOB EXTENSION_SOURCES "./*.c*") -file(GLOB EXTENSION_HEADERS "./*.h*") -file(GLOB SDK_SOURCES "../../Lib/*.c*") -file(GLOB SDK_HEADERS "../../Inc/*.h*") -set(EXTENSION_SOURCES ${EXTENSION_SOURCES} ${SDK_SOURCES}) -set(EXTENSION_HEADERS ${EXTENSION_HEADERS} ${SDK_HEADERS}) -include_directories("../../Inc/" "./") -link_directories("./" "../../Lib/") - -#Fix VC++ options -if(MSVC) - message(STATUS "Note: Building with MSVC (recommended)") - foreach(flag - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - if(${flag} MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}") - endif() - endforeach() -endif() - -#Fix settings for MinGW -set(lib_ext ".lib") -if(MINGW) - set(CMAKE_CXX_FLAGS "-std=c++11 -masm=intel ${CMAKE_CXX_FLAGS} -Wno-multichar") - set(lib_ext "") -endif() - -list(APPEND EXT_MFX_TYPE "Plain") -list(APPEND EXT_MFX_TYPE "HWA") -list(APPEND EXT_MFX_TYPE "Unicode") -list(APPEND EXT_BUILD_TYPE "Debug") -list(APPEND EXT_BUILD_TYPE "Release") -list(APPEND EXT_BUILD_TYPE "RunOnly") - -foreach(curr_mfx_t ${EXT_MFX_TYPE}) - foreach(curr_build_t ${EXT_BUILD_TYPE}) - set(curr_name ${curr_mfx_t}${curr_build_t}) - - add_library(${curr_name} SHARED ${EXTENSION_SOURCES}) - - set(curr_defs "_WINDLL;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS") - - if(curr_build_t STREQUAL "Release") - set(out_dir "./MFX/Extensions/") - list(APPEND curr_defs "EDITOR") - - elseif(curr_build_t STREQUAL "RunOnly") - set(out_dir "./MFX/Data/Runtime/") - list(APPEND curr_defs "RUN_ONLY") - - else() - set(out_dir "./MFX_Debug/Extensions/") - list(APPEND curr_defs "EDITOR;DEBUG;_DEBUG") - endif() - - set(curr_libs "kernel32${lib_ext}") - if(MSVC) - set(curr_libs "${curr_libs} user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib") - endif() - - if(curr_mfx_t STREQUAL "HWA") - set(out_dir "${out_dir}HWA/") - set(curr_libs "${curr_libs} mmfs2hwa${lib_ext}") - list(APPEND curr_defs "HWABETA") - - elseif(curr_mfx_t STREQUAL "Unicode") - set(out_dir "${out_dir}Unicode/") - set(curr_libs "${curr_libs} mmfs2u${lib_ext}") - list(APPEND curr_defs "_UNICODE;UNICODE") - - else() - set(curr_libs "${curr_libs} mmfs2${lib_ext}") - endif() - - set(curr_link "") - if(MSVC) - set(curr_link "/DLL /MANIFEST:NO /DEF:\"${CMAKE_SOURCE_DIR}/Ext.def\" /MACHINE:X86") - endif() - - target_link_libraries(${curr_name} ${curr_libs}) - SET_TARGET_PROPERTIES(${curr_mfx_t}${curr_build_t} PROPERTIES - LIBRARY_OUTPUT_NAME "${EXT_NAME}.mfx" - LIBRARY_OUTPUT_DIRECTORY "${out_dir}" - COMPILE_DEFINITIONS "${curr_defs}" - LINK_FLAGS "${curr_link}" - ) - endforeach() -endforeach() diff --git a/Extensions/Template/Common.h b/Extensions/Template/Common.h deleted file mode 100644 index 7cf1173..0000000 --- a/Extensions/Template/Common.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Common.h - * This is the common header file included - * by almost all other *.cpp files in - * the project. Anything that gets put or - * included in here will be available to you - * everywhere else. You shouldn't need to - * change anything in this file except - * to include headers that you want and - * to change the edition of MMF2 you want - * to support. - */ - -#pragma once - -//Only define one of these at once: -// #define TGFEXT //TGF2.0, MMF2.0, CTF2.5, MMF2.0 Dev, CTF2.5 Dev - #define MMFEXT // MMF2.0, CTF2.5, MMF2.0 Dev, CTF2.5 Dev -// #define PROEXT // MMF2.0 Dev, CTF2.5 Dev - -#define EDIF_PLAIN_EDITDATA -#include "Edif.h" -#include "Resource.h" - -//#include -//#include "YourHeader.hpp" - -/* stdtstring - * A std::string that knows if you're using - * unicode or not. (Protip: strings passed - * to your extension A/C/Es still need to be - * const TCHAR *, and the same goes for strings - * returned from expressions and conditions). - */ -typedef std::basic_string stdtstring; - -/* EDITDATA - * This is the editdata. Be careful, any data - * in here is fully serialized, ready to be - * written to a file on disk, such as the - * MFA or EXE file. It will also be this way - * when you get access to it in other - * runtimes, so it has to be a flat format. - */ -struct EDITDATA -{ - /* Header - * This required data member contains - * information about your extension for - * MMF2, such as the version number - * from Extension::Version. - */ - extHeader Header; - - /* - Here you put the flattened data members, - or you can use a dynamic approach like - TemplatePlus uses. - */ -}; - -#include "Extension.hpp" diff --git a/Extensions/Template/Conditions.cpp b/Extensions/Template/Conditions.cpp deleted file mode 100644 index 41b2b7b..0000000 --- a/Extensions/Template/Conditions.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/* Conditions.cpp - * This is where you should define the - * behavior of your conditions. Make sure - * the parameters and return types match those - * in the JSON exactly! Double check Extension.h - * as well. - */ - -#include "Common.h" - -bool Extension::AreTwoNumbersEqual(int First, int Second) -{ - return First == Second; -} diff --git a/Extensions/Template/Edittime.cpp b/Extensions/Template/Edittime.cpp deleted file mode 100644 index 9b08336..0000000 --- a/Extensions/Template/Edittime.cpp +++ /dev/null @@ -1,839 +0,0 @@ - -// ============================================================================ -// -// This file contains routines that are handled only during the Edittime, -// under the Frame and Event editors. -// -// Including creating, display, and setting up your object. -// -// ============================================================================ - -#include "Common.h" - -#if !defined(RUN_ONLY) - -// PROPERTIES ///////////////////////////////////////////////////////////////// - -// Property identifiers -enum { - PROPID_SETTINGS = PROPID_EXTITEM_CUSTOM_FIRST, - -// Example -// ------- -// PROPID_TEXTTITLE, -// PROPID_TEXT, -// PROPID_CHECK, -// PROPID_COMBO, -// PROPID_COLOR, - -}; - -// Example of content of the PROPID_COMBO combo box -//LPCSTR ComboList[] = { -// 0, // reserved -// MAKEINTRESOURCE(IDS_FIRSTOPTION), -// MAKEINTRESOURCE(IDS_SECONDOPTION), -// MAKEINTRESOURCE(IDS_THIRDOPTION), -// NULL -//}; - -// Property definitions -// -// Type, ID, Text, Text of Info box [, Options, Init Param] -// -PropData Properties[] = { - -// Example -// ------- -// PropData_Group (PROPID_TEXTTITLE, IDS_PROP_TEXTTITLE, IDS_PROP_TEXTTITLE), -// PropData_EditString (PROPID_TEXT, IDS_PROP_TEXT, IDS_PROP_TEXT_INFO), -// PropData_CheckBox (PROPID_CHECK, IDS_PROP_CHECK, IDS_PROP_CHECK_INFO), -// PropData_ComboBox (PROPID_COMBO, IDS_PROP_COMBO, IDS_PROP_COMBO, ComboList), -// PropData_Color (PROPID_COLOR, IDS_PROP_COLOR, IDS_PROP_COLOR_INFO), - - - // End of table (required) - PropData_End() -}; - - -#endif // !defined(RUN_ONLY) - - -// ============================================================================ -// -// ROUTINES USED UNDER FRAME EDITOR -// -// ============================================================================ - - -// -------------------- -// MakeIcon -// -------------------- -// Called once object is created or modified, just after setup. -// Also called before showing the "Insert an object" dialog if your object -// has no icon resource - -int WINAPI DLLExport MakeIconEx ( mv _far *mV, cSurface* pIconSf, LPTSTR lpName, fpObjInfo oiPtr, LPEDATA edPtr ) -{ -#ifndef RUN_ONLY - - pIconSf->Delete(); - pIconSf->Clone(*SDK->Icon); - - pIconSf->SetTransparentColor(RGB(255, 0, 255)); - -#endif // !defined(RUN_ONLY) - return 0; -} - - -// -------------------- -// CreateObject -// -------------------- -// Called when you choose "Create new object". It should display the setup box -// and initialize everything in the datazone. - -int WINAPI DLLExport CreateObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr) -{ -#ifndef RUN_ONLY - - // Check compatibility - if ( IS_COMPATIBLE(mV) ) - { - Edif::Init(mV, edPtr); - - // Set default object settings -// edPtr->swidth = 48; -// edPtr->sheight = 48; - - return 0; - } -#endif // !defined(RUN_ONLY) - - // Error - return -1; -} - -// -------------------- -// EditObject -// -------------------- -// Called when the user selects the Edit command in the object's popup menu -// -BOOL WINAPI EditObject (mv _far *mV, fpObjInfo oiPtr, fpLevObj loPtr, LPEDATA edPtr) -{ -#ifndef RUN_ONLY - // Check compatibility - if ( IS_COMPATIBLE(mV) ) - { - - } -#endif // !defined(RUN_ONLY) - return FALSE; -} - -// -------------------- -// SetEditSize -// -------------------- -// Called when the object has been resized -// -// Note: remove the comments if your object can be resized (and remove the comments in the .def file) -/* -BOOL WINAPI SetEditSize(LPMV mv, LPEDATA edPtr, int cx, int cy) -{ -#ifndef RUN_ONLY - edPtr->swidth = cx; - edPtr->sheight = cy; -#endif // !defined(RUN_ONLY) - return TRUE; // OK -} -*/ - -// -------------------- -// PutObject -// -------------------- -// Called when each individual object is dropped in the frame. -// -void WINAPI DLLExport PutObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr, ushort cpt) -{ -#ifndef RUN_ONLY -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// RemoveObject -// -------------------- -// Called when each individual object is removed from the frame. -// -void WINAPI DLLExport RemoveObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr, ushort cpt) -{ -#ifndef RUN_ONLY - // Is the last object removed? - if (0 == cpt) - { - Edif::Free(edPtr); - - // Do whatever necessary to remove our data - } -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// DuplicateObject -// -------------------- -// Called when an object is created from another one (note: should be called CloneObject instead...) -// -void WINAPI DLLExport DuplicateObject(mv __far *mV, fpObjInfo oiPtr, LPEDATA edPtr) -{ -#ifndef RUN_ONLY -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// GetObjectRect -// -------------------- -// Returns the size of the rectangle of the object in the frame editor. -// -void WINAPI DLLExport GetObjectRect(mv _far *mV, RECT FAR *rc, fpLevObj loPtr, LPEDATA edPtr) -{ -#ifndef RUN_ONLY - rc->right = rc->left + SDK->Icon->GetWidth(); // edPtr->swidth; - rc->bottom = rc->top + SDK->Icon->GetHeight(); // edPtr->sheight; -#endif // !defined(RUN_ONLY) - return; -} - - -// -------------------- -// EditorDisplay -// -------------------- -// Displays the object under the frame editor -// - -void WINAPI DLLExport EditorDisplay(mv _far *mV, fpObjInfo oiPtr, fpLevObj loPtr, LPEDATA edPtr, RECT FAR *rc) -{ -#ifndef RUN_ONLY - - LPSURFACE Surface = WinGetSurface((int) mV->mvIdEditWin); - - if(!Surface) - return; - - SDK->Icon->Blit(*Surface, rc->left, rc->top, BMODE_TRANSP, BOP_COPY, 0); - -#endif // !defined(RUN_ONLY) -} - - -// -------------------- -// IsTransparent -// -------------------- -// This routine tells MMF2 if the mouse pointer is over a transparent zone of the object. -// - -extern "C" BOOL WINAPI DLLExport IsTransparent(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr, int dx, int dy) -{ -#ifndef RUN_ONLY - // Write your code here -#endif // !defined(RUN_ONLY) - return FALSE; -} - -// -------------------- -// PrepareToWriteObject -// -------------------- -// Just before writing the datazone when saving the application, MMF2 calls this routine. -// -void WINAPI DLLExport PrepareToWriteObject(mv _far *mV, LPEDATA edPtr, fpObjInfo adoi) -{ -#ifndef RUN_ONLY - - // Write your code here -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// GetFilters -// -------------------- - -BOOL WINAPI GetFilters(LPMV mV, LPEDATA edPtr, DWORD dwFlags, LPVOID pReserved) -{ -#ifndef RUN_ONLY - // If your extension uses image filters -// if ( (dwFlags & GETFILTERS_IMAGES) != 0 ) -// return TRUE; - - // If your extension uses sound filters -// if ( (dwFlags & GETFILTERS_SOUNDS) != 0 ) -// return TRUE; -#endif // RUN_ONLY - return FALSE; -} - -// -------------------- -// UsesFile -// -------------------- -// Triggers when a file is dropped onto the frame -// Return TRUE if you can create an object from the given file -// -BOOL WINAPI DLLExport UsesFile (LPMV mV, LPTSTR fileName) -{ - BOOL r = FALSE; -#ifndef RUN_ONLY - - // Example: return TRUE if file extension is ".txt" -/* - LPSTR ext, npath; - - if ( fileName != NULL ) - { - if ( (ext=(LPSTR)malloc(_MAX_EXT)) != NULL ) - { - if ( (npath=(LPSTR)malloc(_MAX_PATH)) != NULL ) - { - strcpy(npath, fileName); - _splitpath(npath, NULL, NULL, NULL, ext); - if ( _stricmp(ext, ".txt") == 0 ) - r = TRUE; - free(npath); - } - free(ext); - } - } */ -#endif // !defined(RUN_ONLY) - return r; -} - - -// -------------------- -// CreateFromFile -// -------------------- -// Creates a new object from file -// -void WINAPI DLLExport CreateFromFile (LPMV mV, LPTSTR fileName, LPEDATA edPtr) -{ -#ifndef RUN_ONLY - // Initialize your extension data from the given file -// edPtr->swidth = 48; -// edPtr->sheight = 48; - - // Example: store the filename - // strcpy(edPtr->myFileName, fileName); -#endif // !defined(RUN_ONLY) -} - -// ============================================================================ -// -// PROPERTIES -// -// ============================================================================ - -// -------------------- -// GetProperties -// -------------------- -// Inserts properties into the properties of the object. -// -BOOL WINAPI DLLExport GetProperties(LPMV mV, LPEDATA edPtr, BOOL bMasterItem) -{ -#ifndef RUN_ONLY - mvInsertProps(mV, edPtr, Properties, PROPID_TAB_GENERAL, TRUE); -#endif // !defined(RUN_ONLY) - - // OK - return TRUE; -} - -// -------------------- -// ReleaseProperties -// -------------------- -// Called when the properties are removed from the property window. -// -void WINAPI DLLExport ReleaseProperties(LPMV mV, LPEDATA edPtr, BOOL bMasterItem) -{ -#ifndef RUN_ONLY - // Write your code here -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// GetPropCreateParam -// -------------------- -// Called when a property is initialized and its creation parameter is NULL (in the PropData). -// Allows you, for example, to change the content of a combobox property according to specific settings in the EDITDATA structure. -// -LPARAM WINAPI DLLExport GetPropCreateParam(LPMV mV, LPEDATA edPtr, UINT nPropID) -{ -#ifndef RUN_ONLY - // Example - // ------- -// if ( nPropID == PROPID_COMBO ) -// { -// switch (edPtr->sType) -// { -// case TYPE1: -// return (LPARAM)ComboList1; -// case TYPE2: -// return (LPARAM)ComboList2; -// } -// } -#endif // !defined(RUN_ONLY) - return NULL; -} - -// ---------------------- -// ReleasePropCreateParam -// ---------------------- -// Called after a property has been initialized. -// Allows you, for example, to free memory allocated in GetPropCreateParam. -// -void WINAPI DLLExport ReleasePropCreateParam(LPMV mV, LPEDATA edPtr, UINT nPropID, LPARAM lParam) -{ -#ifndef RUN_ONLY -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// GetPropValue -// -------------------- -// Returns the value of properties that have a value. -// Note: see GetPropCheck for checkbox properties -// -LPVOID WINAPI DLLExport GetPropValue(LPMV mV, LPEDATA edPtr, UINT nPropID) -{ -#ifndef RUN_ONLY - // Example - // ------- -// switch (nPropID) { -// -// // Returns a color. -// case PROPID_COLOR: -// return new CPropDWordValue(edPtr->dwColor); -// -// // Returns a string -// case PROPID_TEXT: -// return new CPropDataValue(&edPtr->szText[0]); -// -// // Returns the value of the combo box -// case PROPID_COMBO: -// return new CPropDWordValue(edPtr->nComboIndex); -// } - -#endif // !defined(RUN_ONLY) - return NULL; -} - -// -------------------- -// GetPropCheck -// -------------------- -// Returns the checked state of properties that have a check box. -// -BOOL WINAPI DLLExport GetPropCheck(LPMV mV, LPEDATA edPtr, UINT nPropID) -{ -#ifndef RUN_ONLY - // Example - // ------- -// switch (nPropID) { -// -// // Return 0 (unchecked) or 1 (checked) -// case PROPID_CHECK: -// return edPtr->nCheck; -// } - -#endif // !defined(RUN_ONLY) - return 0; // Unchecked -} - -// -------------------- -// SetPropValue -// -------------------- -// This routine is called by MMF after a property has been modified. -// -void WINAPI DLLExport SetPropValue(LPMV mV, LPEDATA edPtr, UINT nPropID, LPVOID lParam) -{ -#ifndef RUN_ONLY - // Gets the pointer to the CPropValue structure - CPropValue* pValue = (CPropValue*)lParam; - - // Example - // ------- -// switch (nPropID) { -// -// case PROPID_COMBO: -// // Simply grab the value -// edPtr->nComboIndex = ((CPropDWordValue*)pValue)->m_dwValue; -// break; - -// case PROPID_COLOR: -// // Here too, gets the value -// edPtr->dwColor = ((CPropDWordValue*)pValue)->m_dwValue; -// break; - -// case PROPID_TEXT: -// { -// // Gets the string -// LPSTR pStr = (LPSTR)((CPropDataValue*)pValue)->m_pData; -// -// // You can simply poke the string if your EDITDATA structure has a fixed size, -// // or have an adaptive size of structure like below -// -// // If the length is different -// if (strlen(pStr)!=strlen(edPtr->text)) -// { -// // Asks MMF to reallocate the structure with the new size -// LPEDATA pNewPtr = (LPEDATA)mvReAllocEditData(mV, edPtr, sizeof(EDITDATA)+strlen(pStr)); -// -// // If reallocation worked -// if (pNewPtr!=NULL) -// { -// // Copy the string -// edPtr=pNewPtr; -// strcpy(edPtr->text, pStr); -// } -// } -// else -// { -// // Same size : simply copy -// strcpy(edPtr->text, pStr); -// } -// } -// break; -// } - - // You may want to have your object redrawn in the frame editor after the modifications, - // in this case, just call this function - // mvInvalidateObject(mV, edPtr); - -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// SetPropCheck -// -------------------- -// This routine is called by MMF when the user modifies a checkbox in the properties. -// -void WINAPI DLLExport SetPropCheck(LPMV mV, LPEDATA edPtr, UINT nPropID, BOOL nCheck) -{ -#ifndef RUN_ONLY - // Example - // ------- -// switch (nPropID) -// { -// case PROPID_CHECK: -// edPtr->nCheck = nCheck; -// mvInvalidateObject(mV, edPtr); -// mvRefreshProp(mV, edPtr, PROPID_COMBO, TRUE); -// break; -// } -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// EditProp -// -------------------- -// This routine is called when the user clicks the button of a Button or EditButton property. -// -BOOL WINAPI DLLExport EditProp(LPMV mV, LPEDATA edPtr, UINT nPropID) -{ -#ifndef RUN_ONLY - - // Example - // ------- -/* - if (nPropID==PROPID_EDITCONTENT) - { - if ( EditObject(mV, NULL, NULL, edPtr) ) - return TRUE; - } -*/ - -#endif // !defined(RUN_ONLY) - return FALSE; -} - -// -------------------- -// IsPropEnabled -// -------------------- -// This routine returns the enabled state of a property. -// -BOOL WINAPI IsPropEnabled(LPMV mV, LPEDATA edPtr, UINT nPropID) -{ -#ifndef RUN_ONLY - // Example - // ------- -/* - switch (nPropID) { - - case PROPID_CHECK: - return (edPtr->nComboIndex != 0); - } -*/ -#endif // !defined(RUN_ONLY) - return TRUE; -} - - -// ============================================================================ -// -// TEXT PROPERTIES -// -// ============================================================================ - -// -------------------- -// GetTextCaps -// -------------------- -// Return the text capabilities of the object under the frame editor. -// -DWORD WINAPI DLLExport GetTextCaps(mv _far *mV, LPEDATA edPtr) -{ - return 0; // (TEXT_ALIGN_LEFT|TEXT_ALIGN_HCENTER|TEXT_ALIGN_RIGHT|TEXT_ALIGN_TOP|TEXT_ALIGN_VCENTER|TEXT_ALIGN_BOTTOM|TEXT_FONT|TEXT_COLOR); -} - -// -------------------- -// GetTextFont -// -------------------- -// Return the font used the object. -// Note: the pStyle and cbSize parameters are obsolete and passed for compatibility reasons only. -// -BOOL WINAPI DLLExport GetTextFont(mv _far *mV, LPEDATA edPtr, LPLOGFONT plf, LPTSTR pStyle, UINT cbSize) -{ -#if !defined(RUN_ONLY) - // Example: copy LOGFONT structure from EDITDATA - // memcpy(plf, &edPtr->m_lf, sizeof(LOGFONT)); -#endif // !defined(RUN_ONLY) - - return TRUE; -} - -// -------------------- -// SetTextFont -// -------------------- -// Change the font used the object. -// Note: the pStyle parameter is obsolete and passed for compatibility reasons only. -// -BOOL WINAPI DLLExport SetTextFont(mv _far *mV, LPEDATA edPtr, LPLOGFONT plf, LPCSTR pStyle) -{ -#if !defined(RUN_ONLY) - // Example: copy LOGFONT structure to EDITDATA - // memcpy(&edPtr->m_lf, plf, sizeof(LOGFONT)); -#endif // !defined(RUN_ONLY) - - return TRUE; -} - -// -------------------- -// GetTextClr -// -------------------- -// Get the text color of the object. -// -COLORREF WINAPI DLLExport GetTextClr(mv _far *mV, LPEDATA edPtr) -{ - // Example - return 0; // edPtr->fontColor; -} - -// -------------------- -// SetTextClr -// -------------------- -// Set the text color of the object. -// -void WINAPI DLLExport SetTextClr(mv _far *mV, LPEDATA edPtr, COLORREF color) -{ - // Example - //edPtr->fontColor = color; -} - -// -------------------- -// GetTextAlignment -// -------------------- -// Get the text alignment of the object. -// -DWORD WINAPI DLLExport GetTextAlignment(mv _far *mV, LPEDATA edPtr) -{ - DWORD dw = 0; -#if !defined(RUN_ONLY) - // Example - // ------- -/* if ( (edPtr->eData.dwFlags & ALIGN_LEFT) != 0 ) - dw |= TEXT_ALIGN_LEFT; - if ( (edPtr->eData.dwFlags & ALIGN_HCENTER) != 0 ) - dw |= TEXT_ALIGN_HCENTER; - if ( (edPtr->eData.dwFlags & ALIGN_RIGHT) != 0 ) - dw |= TEXT_ALIGN_RIGHT; - if ( (edPtr->eData.dwFlags & ALIGN_TOP) != 0 ) - dw |= TEXT_ALIGN_TOP; - if ( (edPtr->eData.dwFlags & ALIGN_VCENTER) != 0 ) - dw |= TEXT_ALIGN_VCENTER; - if ( (edPtr->eData.dwFlags & ALIGN_BOTTOM) != 0 ) - dw |= TEXT_ALIGN_BOTTOM; -*/ -#endif // !defined(RUN_ONLY) - return dw; -} - -// -------------------- -// SetTextAlignment -// -------------------- -// Set the text alignment of the object. -// -void WINAPI DLLExport SetTextAlignment(mv _far *mV, LPEDATA edPtr, DWORD dwAlignFlags) -{ -#if !defined(RUN_ONLY) - // Example - // ------- -/* DWORD dw = edPtr->eData.dwFlags; - - if ( (dwAlignFlags & TEXT_ALIGN_LEFT) != 0 ) - dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_LEFT; - if ( (dwAlignFlags & TEXT_ALIGN_HCENTER) != 0 ) - dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_HCENTER; - if ( (dwAlignFlags & TEXT_ALIGN_RIGHT) != 0 ) - dw = (dw & ~(ALIGN_LEFT|ALIGN_HCENTER|ALIGN_RIGHT)) | ALIGN_RIGHT; - - if ( (dwAlignFlags & TEXT_ALIGN_TOP) != 0 ) - dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_TOP; - if ( (dwAlignFlags & TEXT_ALIGN_VCENTER) != 0 ) - dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_VCENTER; - if ( (dwAlignFlags & TEXT_ALIGN_BOTTOM) != 0 ) - dw = (dw & ~(ALIGN_TOP|ALIGN_VCENTER|ALIGN_BOTTOM)) | ALIGN_BOTTOM; - - edPtr->eData.dwFlags = dw; -*/ -#endif // !defined(RUN_ONLY) -} - - -// ---------------------------------------------------------- -// Custom Parameters -// ---------------------------------------------------------- - -// -------------------- -// InitParameter -// -------------------- -// Initialize the parameter. -// -void WINAPI InitParameter(mv _far *mV, short code, paramExt* pExt) -{ -#if !defined(RUN_ONLY) - // Example - // ------- - // strcpy(&pExt->pextData[0], "Parameter Test"); - // pExt->pextSize = sizeof(paramExt) + strlen(pExt->pextData)+1; -#endif // !defined(RUN_ONLY) -} - -// Example of custom parameter setup proc -// -------------------------------------- -/* -#if !defined(RUN_ONLY) -BOOL CALLBACK DLLExport SetupProc(HWND hDlg, UINT msgType, WPARAM wParam, LPARAM lParam) -{ - paramExt* pExt; - - switch (msgType) - { - case WM_INITDIALOG: // Init dialog - - // Save edptr - SetWindowLong(hDlg, DWL_USER, lParam); - pExt=(paramExt*)lParam; - - SetDlgItemText(hDlg, IDC_EDIT, pExt->pextData); - return TRUE; - - case WM_COMMAND: // Command - - // Retrieve edptr - pExt = (paramExt *)GetWindowLong(hDlg, DWL_USER); - - switch (wmCommandID) - { - case IDOK: // Exit - GetDlgItemText(hDlg, IDC_EDIT, pExt->pextData, 500); - pExt->pextSize=sizeof(paramExt)+strlen(pExt->pextData)+1; - EndDialog(hDlg, TRUE); - return TRUE; - - default: - break; - } - break; - - default: - break; - } - return FALSE; -} -#endif // !defined(RUN_ONLY) -*/ - -// -------------------- -// EditParameter -// -------------------- -// Edit the parameter. -// -void WINAPI EditParameter(mv _far *mV, short code, paramExt* pExt) -{ -#if !defined(RUN_ONLY) - - // Example - // ------- - // DialogBoxParam(hInstLib, MAKEINTRESOURCE(DB_TRYPARAM), mV->mvHEditWin, SetupProc, (LPARAM)(LPBYTE)pExt); - -#endif // !defined(RUN_ONLY) -} - -// -------------------- -// GetParameterString -// -------------------- -// Initialize the parameter. -// -void WINAPI GetParameterString(mv _far *mV, short code, paramExt* pExt, LPSTR pDest, short size) -{ -#if !defined(RUN_ONLY) - - // Example - // ------- - // wsprintf(pDest, "Super parameter %s", pExt->pextData); - -#endif // !defined(RUN_ONLY) -} - -#ifndef RUN_ONLY - -/* InterceptActionSelection - * This function is called after the user has selected a - * menu item from the actions popup menu. You can show - * a dialog or allow the user to make a choice, and - * return a different ID to Fusion. Be aware, there - * is no way to cancel this operation. - */ -short InterceptActionSelection(mv *mV, short selectedId) -{ - return selectedId; -} - -/* InterceptActionSelection - * This function is called after the user has selected a - * menu item from the conditions popup menu. You can show - * a dialog or allow the user to make a choice, and - * return a different ID to Fusion. Be aware, there - * is no way to cancel this operation. - */ -short InterceptConditionSelection(mv *mV, short selectedId) -{ - return selectedId; -} - -/* InterceptActionSelection - * This function is called after the user has selected a - * menu item from the expressions popup menu. You can show - * a dialog or allow the user to make a choice, and - * return a different ID to Fusion. Be aware, there - * is no way to cancel this operation. - */ -short InterceptExpressionSelection(mv *mV, short selectedId) -{ - return selectedId; -} - -#endif diff --git a/Extensions/Template/Expressions.cpp b/Extensions/Template/Expressions.cpp deleted file mode 100644 index cad6ed0..0000000 --- a/Extensions/Template/Expressions.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/* Expressions.cpp - * This is where you should define the - * behavior of your expressions. Make sure - * the parameters and return types match those - * in the JSON exactly! Double check Extension.h - * as well. - */ - -#include "Common.h" - -int Extension::Add(int First, int Second) -{ - return First + Second; -} - -TCHAR const * Extension::HelloWorld() -{ - return _T("Hello world!"); - //return Runtime.CopyString(MyString.c_str()); //for stdtstrings -} diff --git a/Extensions/Template/Ext.def b/Extensions/Template/Ext.def deleted file mode 100644 index d7275e5..0000000 --- a/Extensions/Template/Ext.def +++ /dev/null @@ -1,118 +0,0 @@ -; Ext.def -; This is how the linker knows -; which functions to export and -; what names and ordinals the -; exported functions should -; have. If you implemented a -; function that was commented -; out, remove the semicolon comment -; before it in this file. -; - -EXPORTS - GetInfos @2 - LoadObject @6 - UnloadObject @7 - PutObject @8 - RemoveObject @9 - MakeIconEx @11 - - CreateObject @14 - GetHelpFileName @16 - EditObject @18 - GetObjectRect @19 - EditorDisplay @20 - IsTransparent @21 - PrepareToWriteObject @22 - UpdateFileNames @23 -; EnumElts @24 - Initialize @25 - Free @26 -; ExportTexts @27 -; ImportTexts @28 -; GetSubType @29 - UsesFile @30 - CreateFromFile @31 - DuplicateObject @32 - GetObjInfos @36 - - GetTextCaps @37 - GetTextAlignment @38 - SetTextAlignment @39 - GetTextFont @40 - SetTextFont @41 - GetTextClr @42 - SetTextClr @43 - - GetDependencies @44 - GetFilters @45 - -; conditionsTable @47 -; actionsTable @48 -; expressionsTable @49 - - CreateRunObject @50 - DestroyRunObject @51 - HandleRunObject @52 - DisplayRunObject @53 - PauseRunObject @57 - ContinueRunObject @58 - GetRunObjectInfos @59 - - GetConditionMenu @60 - GetActionMenu @61 - GetExpressionMenu @62 - GetConditionCodeFromMenu @63 - GetActionCodeFromMenu @64 - GetExpressionCodeFromMenu @65 - GetConditionString @66 - GetActionString @67 - GetExpressionString @68 - InitParameter @69 - EditParameter @70 - GetParameterString @71 - GetConditionTitle @72 - GetActionTitle @73 - GetExpressionTitle @74 - GetConditionInfos @75 - GetActionInfos @76 - GetExpressionInfos @77 - UpdateEditStructure @78 - GetRunObjectDataSize @80 -; SaveBackground @81 -; RestoreBackground @82 -; KillBackground @83 -; WindowProc @84 - StartApp @85 - EndApp @86 - StartFrame @87 - EndFrame @88 - GetExpressionParam @89 - -; GetRunObjectSurface @90 -; GetRunObjectCollisionMask @91 - -; GetRunObjectFont @92 -; SetRunObjectFont @93 -; GetRunObjectTextColor @94 -; SetRunObjectTextColor @95 - -; SetEditSize @99 - GetProperties @100 - ReleaseProperties @101 - GetPropValue @102 - SetPropValue @103 - IsPropEnabled @104 - GetPropCheck @105 - SetPropCheck @106 - GetPropCreateParam @107 - ReleasePropCreateParam @108 - EditProp @109 - GetDebugTree @110 - GetDebugItem @111 - EditDebugItem @112 - - SaveRunObject @113 - LoadRunObject @114 - - PrepareFlexBuild @115 diff --git a/Extensions/Template/Ext.json b/Extensions/Template/Ext.json deleted file mode 100644 index 7aedc37..0000000 --- a/Extensions/Template/Ext.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "About": - { - "Name": "EDIF Template Object", - "Author": "Your Name", - "Copyright": "Copyright © 2014 Your Name", - "Comment": "A sentence or two to describe your extension,\nwith up to four lines of text.", - "URL": "http://www.example.com/", - "Help": "Help/My New EDIF Extension/Help.chm", - "Identifier": "X&pl" - }, - - "ActionMenu": - [ - "Separator", - [0, "Action Example"], - "Separator", - ["Sub Menu", - [1, "Second Action Example"] - ], - "Separator", - [0, "A Disabled Menu Item", true], - "Separator" - ], - "ConditionMenu": - [ - "Separator", - [0, "Are two numbers equal?"] - ], - "ExpressionMenu": - [ - "Separator", - [0, "Add two numbers"], - [1, "Hello world"], - "Separator" - ], - - "Actions": - [ - { "Title": "Action Example with parameter %0", - "Parameters": - [ - ["Integer", "Example Parameter"] - ] - }, - { "Title": "Second Action Example" - } - ], - "Conditions": - [ - { "Title": "%o: Are %0 and %1 equal?", - "Parameters": - [ - ["Integer", "First number"], - ["Integer", "Second number"] - ], - "Triggered": false - } - ], - "Expressions": - [ - { "Title": "Add(", - "Returns": "Integer", - "Parameters": - [ - ["Integer", "First number"], - ["Integer", "Second number"] - ] - }, - { "Title": "HelloWorld$(", - "Returns": "Text" - } - ] -} diff --git a/Extensions/Template/Ext.rc b/Extensions/Template/Ext.rc deleted file mode 100644 index c4b5941..0000000 --- a/Extensions/Template/Ext.rc +++ /dev/null @@ -1,156 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "..\..\Inc\ccx.h" -#define APSTUDIO_HIDDEN_SYMBOLS -#include "windows.h" -#undef APSTUDIO_HIDDEN_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -1 VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x0L -#ifdef _DEBUG - FILEFLAGS 0x21L -#else - FILEFLAGS 0x20L -#endif - FILEOS 0x10001L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "Clickteam" - VALUE "FileDescription", "Edif Object" - VALUE "FileVersion", "2.00" - VALUE "InternalName", "EdifExt" - VALUE "LegalCopyright", "Copyright © 2012 Clickteam" - VALUE "OriginalFilename", "EdifExt.mfx" - VALUE "ProductVersion", "1, 0, 0, 1" - VALUE "SpecialBuild", "00000001" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// RCDATA -// - -KPX_MAGICNUMBER RCDATA -BEGIN - 0x2516, 0x5908 -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""..\\..\\Inc\\ccx.h""\r\n" - "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""windows.h""\r\n" - "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - KPX_MARK "MF2" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.K.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// EDIF -// - -#if defined(APSTUDIO_INVOKED) || defined(EDITOR) -#if defined(APSTUDIO_INVOKED) -IDR_EDIF_ICON$(EDITOR) EDIF "Icon.png" -#else -IDR_EDIF_ICON EDIF "Icon.png" -#endif -#endif -IDR_EDIF_JSON EDIF "Ext.json" -#endif // English (U.K.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/Extensions/Template/Extension.cpp b/Extensions/Template/Extension.cpp deleted file mode 100644 index bda30dc..0000000 --- a/Extensions/Template/Extension.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/* Extension.cpp - * This file contains the definitions for - * your extension's general runtime functions, - * such as the constructor and destructor, - * handling routines, etc. - * Functions defined here: - * Extension::Extension - * Extension::~Extension - * Extension::Handle - * Extension::Display - * Extension::Pause - * Extension::Continue - * Extension::Save - * Extension::Load - * Extension::Action <--| - * Extension::Condition <--|- not what you think! - * Extension::Expression <--| - */ - -#include "Common.h" - -/* - * This is your extension's constructor, which - * is the replacement for the old CreateRunObject - * function. You don't need to manually call - * constructors or pointlessly initialize - * pointers with dynamic memory. Just link - * your A/C/Es, perform initialization steps, and - * you're good to go. - */ -Extension::Extension(LPRDATA _rdPtr, LPEDATA edPtr, fpcob cobPtr) -: rdPtr(_rdPtr) -, rhPtr(_rdPtr->rHo.hoAdRunHeader) -, Runtime(_rdPtr) -{ - //Link all your action/condition/expression functions - //to their IDs to match the IDs in the JSON here. - LinkAction(0, ActionExample); - LinkAction(1, SecondActionExample); - - LinkCondition(0, AreTwoNumbersEqual); - - LinkExpression(0, Add); - LinkExpression(1, HelloWorld); - - - //This is where you'd do anything you'd do in CreateRunObject in the original SDK. - //It's the only place you'll get access to the editdata at runtime, so you should - //transfer anything from the editdata to the extension class here. For example: -// EditData ed (SED); -// MyString = ed.MyString; -// MyInt = ed.MyInt; -// MyArray = ed.MyArray; - - // -} - -/* - * This is your extension's destructor, the - * replacement for DestroyRunObject. No calling - * destructors manually or deallocating pointless - * dynamic memory - in most cases this function - * won't need any code written. - */ -Extension::~Extension() -{ - // -} - -/* Handle - * MMF2 calls this function to let your extension - * "live" - if you want, you can have MMF2 call this - * every frame. This is where you'd, for instance, - * simulate physics or move an object. This is - * the analagous function to the old HandleRunObject. - */ -short Extension::Handle() -{ - /* - If your extension will draw to the MMF window you should first - check if anything about its display has changed : - - if (rdPtr->roc.rcChanged) return REFLAG_DISPLAY; - else return 0; - - You will also need to make sure you change this flag yourself - to 1 whenever you want to redraw your object - - If your extension won't draw to the window, but it still needs - to do something every MMF2 loop use: - - return 0; - - If you don't need to do something every loop, use : - - return REFLAG_ONESHOT; - - This doesn't mean this function can never run again. If you want MMF2 - to handle your object again (causing this code to run) use this function: - - Runtime.Rehandle(); - - At the end of the event loop this code will run. - */ - - //Will not be called next loop - return REFLAG_ONESHOT; -} - -/* Display - * This is the analagous function to - * DisplayRunObject. If you return - * REFLAG_DISPLAY in Handle() this - * routine will run. If you want MMF2 - * to apply ink effects for you, then - * implement GetRunObjectSurface in - * Runtime.cpp instead. - */ -short Extension::Display() -{ - return 0; -} - -/* Pause - * If your extension plays sound, for - * example, then MMF2 calls this to - * let you know to pause the music, - * usually by another extension's request - * or by the player pausing the applcation. - */ -short Extension::Pause() -{ - return 0; -} - -/* Continue - * Opposite to the above, MMF2 lets - * you know that the silence is over; - * your extension may live again. - */ -short Extension::Continue() -{ - return 0; -} - -/* Save - * When the user uses the Save - * Frame Position action, you need - * so serialize your runtime data to - * the File given. It is a Windows - * file handle, but you can use some - * of MMF2's built-in functions for - * writing files. Check the MMF2SDK - * Help file for more information. - */ -bool Extension::Save(HANDLE File) -{ - return true; -} - -/* Load - * As opposed to above, here you need to - * restore your extension's runtime state - * from the given file. Only read what you - * wrote! - */ -bool Extension::Load(HANDLE File) -{ - return true; -} - - -/* Action, Condition, Expression - * These are called if there's no function linked - * to an ID. You may want to put MessageBox calls - * to let you know that the ID is unlinked, or you - * may just want to use unlinked A/C/Es as a feature. - */ -void Extension::Action(int ID, RD *rd, long param1, long param2) -{ -} - -long Extension::Condition(int ID, RD *rd, long param1, long param2) -{ - return false; //hopefully StringComparison (PARAM_CMPSTRING) is not used, or this may crash -} - -long Extension::Expression(int ID, RD *rd, long param) -{ - return long(_T("")); //so that unlinked expressions that return strings won't crash -} diff --git a/Extensions/Template/Extension.hpp b/Extensions/Template/Extension.hpp deleted file mode 100644 index 1910b41..0000000 --- a/Extensions/Template/Extension.hpp +++ /dev/null @@ -1,133 +0,0 @@ -/* Extension.h - * This is where you define your extension - * class. Runtime variables and function - * declarations go in here; A/C/E function - * definitions go in their respective .cpp - * files, other function definitions go in - * Extension.cpp. This header is included - * at the bottom of Common.h, so you have - * access to everything included by it. - */ - -class Extension -{ -public: - /* rdPtr - * This is a pointer to the classic - * RunData structure. Some things still - * have to be stored there for MMF2's - * sake, so you need to have acces to - * that data. You should not modify - * the rundata structure, however, - * as it is global to all extensions. - */ - LPRDATA rdPtr; - - /* rhPtr - * This is a pointer to the RunHeader - * structure, which contains some - * application information. - */ - LPRH rhPtr; - - /* Runtime - * This is EDIF's compendium of useful - * functions for every day life as an - * extension. You can trigger immediate - * events, read and write global data, - * etc. See the EDIF wiki for more - * information. - */ - Edif::Runtime Runtime; - - /* MinimumBuild - * Always set this to the latest build - * of MMF2 that has been released, unless - * you need to set it higher for a beta - * version of MMF2 to get access to some - * new SDK feature. - */ - static const int MinimumBuild = 257; - - /* Version - * This is the version of your extension - * that is stored in the editdata. You should - * only change this when your editdata structure - * changes, not just when you have a new version - * of your extension with new features. - */ - static const int Version = 1; - - /* OEFLAGS, OEPREFS - * These are settings for your extension - * that tell MMF2 how to treat your extension - * and what behaviors and responsibilities - * to add. Check the MMF2SDK Help file for - * more detailed information on the flags you - * can set and what they implicate. - */ - static const int OEFLAGS = OEFLAG_VALUES|OEFLAG_RUNBEFOREFADEIN|OEFLAG_NEVERKILL; - static const int OEPREFS = 0; - - /* WindowProcPriority - * If your extension creates a Window - * and implements the WindowProc function, - * this is the priority for that stuff. - */ - static const int WindowProcPriority = 100; - - Extension(LPRDATA rdPtr, LPEDATA edPtr, fpcob cobPtr); //defined & documented in Extension.cpp - ~Extension(); //defined & documented in Extension.cpp - - - /* Add any data you want to store in your - * extension to this class (eg. what you'd - * normally store in the rundata). Unlike - * other SDKs, you can store real C++ - * objects with constructors and destructors, - * without having to call them manually or - * store a pointer. - */ - - //stdtstring MyString; - //int MyInt; - //std::vector MyArray; - - - /* Add your actions, conditions, and expressions - * as real class member functions here. The arguments - * (and return types for expressions/conditions) - * must match EXACTLY what you defined in the JSON. - * As a handy tip, all parameters will be either - * a pointer, an int, or a float (each only 4 bytes) - * and the same applies to return types. Remember to - * link the actions, conditions and expressions to their - * numeric IDs in the class constructor in Extension.cpp. - */ - - //Actions - Defined in Actions.cpp - void ActionExample(int ExampleParameter); - void SecondActionExample(); - - //Conditions - Defined in Conditions.cpp - bool AreTwoNumbersEqual(int FirstNumber, int SecondNumber); - - //Expressions - Defined in Expressions.cpp - int Add(int FirstNumber, int SecondNumber); - const TCHAR * HelloWorld(); - - - short Handle(); //defined & documented in Extension.cpp - short Display(); //defined & documented in Extension.cpp - - short Pause(); //defined & documented in Extension.cpp - short Continue(); //defined & documented in Extension.cpp - - bool Save(HANDLE File); //defined & documented in Extension.cpp - bool Load(HANDLE File); //defined & documented in Extension.cpp - - //defined & documented in Extension.cpp - void Action(int ID, RD *rd, long param1, long param2); - long Condition(int ID, RD *rd, long param1, long param2); - long Expression(int ID, RD *rd, long param); -}; diff --git a/Extensions/Template/General.cpp b/Extensions/Template/General.cpp deleted file mode 100644 index 300c940..0000000 --- a/Extensions/Template/General.cpp +++ /dev/null @@ -1,165 +0,0 @@ - -// ============================================================================ -// -// The following routines are used internally by MMF, and should not need to -// be modified. -// -// -// ============================================================================ - -#include "Common.h" - -HINSTANCE hInstLib; - -// ============================================================================ -// -// LIBRARY ENTRY & QUIT POINTS -// -// ============================================================================ - -// ----------------- -// Entry points -// ----------------- -// Usually you do not need to do any initialization here: you will prefer to -// do them in "Initialize" found in Edittime.cpp -BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) -{ - switch (dwReason) - { - // DLL is attaching to the address space of the current process. - case DLL_PROCESS_ATTACH: - - hInstLib = hDLL; // Store HINSTANCE - break; - - // A new thread is being created in the current process. - case DLL_THREAD_ATTACH: - break; - - // A thread is exiting cleanly. - case DLL_THREAD_DETACH: - break; - - // The calling process is detaching the DLL from its address space. - case DLL_PROCESS_DETACH: - break; - } - - return TRUE; -} - - - -// ----------------- -// Initialize -// ----------------- -// Where you want to do COLD-START initialization. -// Called when the extension is loaded into memory. -// -extern "C" int WINAPI DLLExport Initialize(mv _far *mV, int quiet) -{ - return Edif::Init(mV); - - - // No error - return 0; -} - -// ----------------- -// Free -// ----------------- -// Where you want to kill and initialized data opened in the above routine -// Called just before freeing the DLL. -// -extern "C" int WINAPI DLLExport Free(mv _far *mV) -{ - Edif::Free(mV); - - // No error - return 0; -} - -// ============================================================================ -// -// GENERAL INFO -// -// ============================================================================ - - -// ----------------- -// LoadObject -// ----------------- -// Routine called for each object when the object is read from the MFA file (edit time) -// or from the CCN or EXE file (run time). -// You can load data here, reserve memory etc... -// -int WINAPI DLLExport LoadObject(mv _far *mV, LPCSTR fileName, LPEDATA edPtr, int reserved) -{ - Edif::Init(mV, edPtr); - - - return 0; -} - -// ----------------- -// UnloadObject -// ----------------- -// The counterpart of the above routine: called just before the object is -// deleted from the frame. -// -void WINAPI DLLExport UnloadObject(mv _far *mV, LPEDATA edPtr, int reserved) -{ -} - -// -------------------- -// UpdateEditStructure -// -------------------- -// For you to update your object structure to newer versions -// Called at both edit time and run time -// -HGLOBAL WINAPI DLLExport UpdateEditStructure(mv __far *mV, void __far * OldEdPtr) -{ - // We do nothing here - return 0; -} - -// -------------------- -// UpdateFileNames -// -------------------- -// If you store file names in your datazone, they have to be relocated when the -// application is moved to a different directory: this routine does it. -// Called at edit time and run time. -// -// Call lpfnUpdate to update your file pathname (refer to the documentation) -// -void WINAPI DLLExport UpdateFileNames(mv _far *mV, LPSTR appName, LPEDATA edPtr, void (WINAPI * lpfnUpdate)(LPSTR, LPSTR)) -{ -} - -// --------------------- -// EnumElts -// --------------------- -// -// Uncomment this function if you need to store an image in the image bank. -// -// Note: do not forget to enable the function in the .def file -// if you remove the comments below. -// -/* -int WINAPI DLLExport EnumElts (mv __far *mV, LPEDATA edPtr, ENUMELTPROC enumProc, ENUMELTPROC undoProc, LPARAM lp1, LPARAM lp2) -{ - int error = 0; - - // Replace wImgIdx with the name of the WORD variable you create within the edit structure - - // Enum images - if ( (error = enumProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2)) != 0 ) - { - // Undo enum images - undoProc (&edPtr->wImgIdx, IMG_TAB, lp1, lp2); - } - - return error; -} -*/ - diff --git a/Extensions/Template/Icon.png b/Extensions/Template/Icon.png deleted file mode 100644 index cc945e99d44d5cc99d69c46c7ced70e21878c3a1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4524 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.rsEffect & EFFECTFLAG_TRANSPARENT) == 0 ) // Note: only if your object has the OEPREFS_INKEFFECTS option - return NULL; - - // Transparent? Create mask - LPSMASK pMask = rdPtr->m_pColMask; - if ( pMask == NULL ) - { - if ( rdPtr->m_pSurface != NULL ) - { - DWORD dwMaskSize = rdPtr->m_pSurface->CreateMask(NULL, lParam); - if ( dwMaskSize != 0 ) - { - pMask = (LPSMASK)calloc(dwMaskSize, 1); - if ( pMask != NULL ) - { - rdPtr->m_pSurface->CreateMask(pMask, lParam); - rdPtr->m_pColMask = pMask; - } - } - } - } - - // Note: for active objects, lParam is always the same. - // For background objects (OEFLAG_BACKGROUND), lParam maybe be different if the user uses your object - // as obstacle and as platform. In this case, you should store 2 collision masks - // in your data: one if lParam is 0 and another one if lParam is different from 0. - - return pMask; -} -*/ - - -// ============================================================================ -// -// START APP / END APP / START FRAME / END FRAME routines -// -// ============================================================================ - -// ------------------- -// StartApp -// ------------------- -// Called when the application starts or restarts. -// Useful for storing global data -// -void WINAPI DLLExport StartApp(mv _far *mV, CRunApp* pApp) -{ - // Example - // ------- - // Delete global data (if restarts application) -// CMyData* pData = (CMyData*)mV->mvGetExtUserData(pApp, hInstLib); -// if ( pData != NULL ) -// { -// delete pData; -// mV->mvSetExtUserData(pApp, hInstLib, NULL); -// } -} - -// ------------------- -// EndApp -// ------------------- -// Called when the application ends. -// -void WINAPI DLLExport EndApp(mv _far *mV, CRunApp* pApp) -{ - // Example - // ------- - // Delete global data -// CMyData* pData = (CMyData*)mV->mvGetExtUserData(pApp, hInstLib); -// if ( pData != NULL ) -// { -// delete pData; -// mV->mvSetExtUserData(pApp, hInstLib, NULL); -// } -} - -// ------------------- -// StartFrame -// ------------------- -// Called when the frame starts or restarts. -// -void WINAPI DLLExport StartFrame(mv _far *mV, DWORD dwReserved, int nFrameIndex) -{ -} - -// ------------------- -// EndFrame -// ------------------- -// Called when the frame ends. -// -void WINAPI DLLExport EndFrame(mv _far *mV, DWORD dwReserved, int nFrameIndex) -{ -} - -// ============================================================================ -// -// TEXT ROUTINES (if OEFLAG_TEXT) -// -// ============================================================================ - -// ------------------- -// GetRunObjectFont -// ------------------- -// Return the font used by the object. -// -/* - - // Note: do not forget to enable the functions in the .def file - // if you remove the comments below. - -void WINAPI GetRunObjectFont(LPRDATA rdPtr, LOGFONT* pLf) -{ - // Example - // ------- - // GetObject(rdPtr->m_hFont, sizeof(LOGFONT), pLf); -} - -// ------------------- -// SetRunObjectFont -// ------------------- -// Change the font used by the object. -// -void WINAPI SetRunObjectFont(LPRDATA rdPtr, LOGFONT* pLf, RECT* pRc) -{ - // Example - // ------- -// HFONT hFont = CreateFontIndirect(pLf); -// if ( hFont != NULL ) -// { -// if (rdPtr->m_hFont!=0) -// DeleteObject(rdPtr->m_hFont); -// rdPtr->m_hFont = hFont; -// SendMessage(rdPtr->m_hWnd, WM_SETFONT, (WPARAM)rdPtr->m_hFont, FALSE); -// } - -} - -// --------------------- -// GetRunObjectTextColor -// --------------------- -// Return the text color of the object. -// -COLORREF WINAPI GetRunObjectTextColor(LPRDATA rdPtr) -{ - // Example - // ------- - return 0; // rdPtr->m_dwColor; -} - -// --------------------- -// SetRunObjectTextColor -// --------------------- -// Change the text color of the object. -// -void WINAPI SetRunObjectTextColor(LPRDATA rdPtr, COLORREF rgb) -{ - // Example - // ------- - rdPtr->m_dwColor = rgb; - InvalidateRect(rdPtr->m_hWnd, NULL, TRUE); -} -*/ - - -// ============================================================================ -// -// WINDOWPROC (interception of messages sent to hMainWin and hEditWin) -// -// Do not forget to enable the WindowProc function in the .def file if you implement it -// -// ============================================================================ -/* -// Get the pointer to the object's data from its window handle -// Note: the object's window must have been subclassed with a -// callRunTimeFunction(rdPtr, RFUNCTION_SUBCLASSWINDOW, 0, 0); -// See the documentation and the Simple Control example for more info. -// -LPRDATA GetRdPtr(HWND hwnd, LPRH rhPtr) -{ - return (LPRDATA)GetProp(hwnd, (LPCSTR)rhPtr->rh4.rh4AtomRd); -} - -// Called from the window proc of hMainWin and hEditWin. -// You can intercept the messages and/or tell the main proc to ignore them. -// -LRESULT CALLBACK DLLExport WindowProc(LPRH rhPtr, HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) -{ - LPRDATA rdPtr = NULL; - - switch (nMsg) { - - // Example - case WM_CTLCOLORSTATIC: - { - // Get the handle of the control - HWND hWndControl = (HWND)lParam; - - // Get a pointer to the RUNDATA structure (see GetRdptr function above for more info) - rdPtr = GetRdPtr(hWndControl, rhPtr); - - // Check if the rdPtr pointer is valid and points to an object created with this extension - if ( rdPtr == NULL || rdPtr->rHo.hoIdentifier != IDENTIFIER ) - break; - - // OK, intercept the message - HDC hDC = (HDC)wParam; - SetBkColor(hDC, rdPtr->backColor); - SetTextColor(hDC, rdPtr->fontColor); - rhPtr->rh4.rh4KpxReturn = (long)rdPtr->hBackBrush; - return REFLAG_MSGRETURNVALUE; - } - break; - } - - return 0; -} -*/ - -// ============================================================================ -// -// DEBUGGER ROUTINES -// -// ============================================================================ - -// ----------------- -// GetDebugTree -// ----------------- -// This routine returns the address of the debugger tree -// -LPWORD WINAPI DLLExport GetDebugTree(LPRDATA rdPtr) -{ -#if !defined(RUN_ONLY) - return DebugTree; -#else - return NULL; -#endif // !defined(RUN_ONLY) -} - -// ----------------- -// GetDebugItem -// ----------------- -// This routine returns the text of a given item. -// -void WINAPI DLLExport GetDebugItem(LPSTR pBuffer, LPRDATA rdPtr, int id) -{ -#if !defined(RUN_ONLY) - - // Example - // ------- -/* - char temp[DB_BUFFERSIZE]; - - switch (id) - { - case DB_CURRENTSTRING: - LoadString(hInstLib, IDS_CURRENTSTRING, temp, DB_BUFFERSIZE); - wsprintf(pBuffer, temp, rdPtr->text); - break; - case DB_CURRENTVALUE: - LoadString(hInstLib, IDS_CURRENTVALUE, temp, DB_BUFFERSIZE); - wsprintf(pBuffer, temp, rdPtr->value); - break; - case DB_CURRENTCHECK: - LoadString(hInstLib, IDS_CURRENTCHECK, temp, DB_BUFFERSIZE); - if (rdPtr->check) - wsprintf(pBuffer, temp, "TRUE"); - else - wsprintf(pBuffer, temp, "FALSE"); - break; - case DB_CURRENTCOMBO: - LoadString(hInstLib, IDS_CURRENTCOMBO, temp, DB_BUFFERSIZE); - wsprintf(pBuffer, temp, rdPtr->combo); - break; - } -*/ - -#endif // !defined(RUN_ONLY) -} - -// ----------------- -// EditDebugItem -// ----------------- -// This routine allows to edit editable items. -// -void WINAPI DLLExport EditDebugItem(LPRDATA rdPtr, int id) -{ -#if !defined(RUN_ONLY) - - // Example - // ------- -/* - switch (id) - { - case DB_CURRENTSTRING: - { - EditDebugInfo dbi; - char buffer[256]; - - dbi.pText=buffer; - dbi.lText=TEXT_MAX; - dbi.pTitle=NULL; - - strcpy(buffer, rdPtr->text); - long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITTEXT, 0, (LPARAM)&dbi); - if (ret) - strcpy(rdPtr->text, dbi.pText); - } - break; - case DB_CURRENTVALUE: - { - EditDebugInfo dbi; - - dbi.value=rdPtr->value; - dbi.pTitle=NULL; - - long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITINT, 0, (LPARAM)&dbi); - if (ret) - rdPtr->value=dbi.value; - } - break; - } -*/ -#endif // !defined(RUN_ONLY) -} - - diff --git a/Extensions/Template/Template.sln b/Extensions/Template/Template.sln deleted file mode 100644 index 224d791..0000000 --- a/Extensions/Template/Template.sln +++ /dev/null @@ -1,40 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template", "Template.vcproj", "{3BCB4C73-71F6-43B6-803D-41411F92652A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug HWA|Fusion-2.x = Debug HWA|Fusion-2.x - Debug Unicode|Fusion-2.x = Debug Unicode|Fusion-2.x - Debug|Fusion-2.x = Debug|Fusion-2.x - Edittime HWA|Fusion-2.x = Edittime HWA|Fusion-2.x - Edittime Unicode|Fusion-2.x = Edittime Unicode|Fusion-2.x - Edittime|Fusion-2.x = Edittime|Fusion-2.x - Runtime HWA|Fusion-2.x = Runtime HWA|Fusion-2.x - Runtime Unicode|Fusion-2.x = Runtime Unicode|Fusion-2.x - Runtime|Fusion-2.x = Runtime|Fusion-2.x - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Fusion-2.x.ActiveCfg = Debug HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Fusion-2.x.Build.0 = Debug HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Fusion-2.x.ActiveCfg = Debug Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug Unicode|Fusion-2.x.Build.0 = Debug Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.ActiveCfg = Debug|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.Build.0 = Debug|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Fusion-2.x.ActiveCfg = Edittime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Fusion-2.x.Build.0 = Edittime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Fusion-2.x.ActiveCfg = Edittime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime Unicode|Fusion-2.x.Build.0 = Edittime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.ActiveCfg = Edittime|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.Build.0 = Edittime|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Fusion-2.x.ActiveCfg = Runtime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Fusion-2.x.Build.0 = Runtime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Fusion-2.x.ActiveCfg = Runtime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime Unicode|Fusion-2.x.Build.0 = Runtime Unicode|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.ActiveCfg = Runtime|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.Build.0 = Runtime|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Extensions/Template/Template.vcproj b/Extensions/Template/Template.vcproj deleted file mode 100644 index ef9b0a8..0000000 --- a/Extensions/Template/Template.vcproj +++ /dev/null @@ -1,1585 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Extensions/Template/Template2015.sln b/Extensions/Template/Template2015.sln deleted file mode 100644 index 1a329fb..0000000 --- a/Extensions/Template/Template2015.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template", "Template2015.vcxproj", "{87325274-EF61-43D2-85A3-FF7CE13EDD69}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug UnicodeHWA|Fusion-2.5 = Debug UnicodeHWA|Fusion-2.5 - Edittime UnicodeHWA|Fusion-2.5 = Edittime UnicodeHWA|Fusion-2.5 - Runtime UnicodeHWA|Fusion-2.5 = Runtime UnicodeHWA|Fusion-2.5 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug UnicodeHWA|Fusion-2.5.ActiveCfg = Debug UnicodeHWA|Win32 - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug UnicodeHWA|Fusion-2.5.Build.0 = Debug UnicodeHWA|Win32 - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime UnicodeHWA|Fusion-2.5.ActiveCfg = Edittime UnicodeHWA|Win32 - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime UnicodeHWA|Fusion-2.5.Build.0 = Edittime UnicodeHWA|Win32 - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime UnicodeHWA|Fusion-2.5.ActiveCfg = Runtime UnicodeHWA|Win32 - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime UnicodeHWA|Fusion-2.5.Build.0 = Runtime UnicodeHWA|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Extensions/Template/Template2015.vcxproj b/Extensions/Template/Template2015.vcxproj deleted file mode 100644 index 69fe54a..0000000 --- a/Extensions/Template/Template2015.vcxproj +++ /dev/null @@ -1,260 +0,0 @@ - - - - - Debug UnicodeHWA - Win32 - - - Edittime UnicodeHWA - Win32 - - - Runtime UnicodeHWA - Win32 - - - - {87325274-EF61-43D2-85A3-FF7CE13EDD69} - Template2015 - Template - 8.1 - - - - DynamicLibrary - true - v140 - Unicode - - - DynamicLibrary - false - v140 - true - Unicode - - - DynamicLibrary - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - .mfx - false - C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset - true - $(ProjectDir)MFX\Extensions\Unicode\ - - - .mfx - false - $(ProjectDir)MFX\Extensions\Unicode\ - - - .mfx - false - $(ProjectDir)MFX\Data\Runtime\Unicode\ - - - - Level3 - Disabled - true - ..\..\Inc;.\; - DEBUG;EDITOR;HWABETA;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;%(PreprocessorDefinitions) - min;max;%(UndefinePreprocessorDefinitions) - true - Guard - true - true - CompileAsCpp - MultiThreadedDebug - true - ProgramDatabase - - - true - $(ProjectDir)\MFX\Extensions\Unicode\$(ProjectName)$(TargetExt) - ..\..\lib\mmfs2.5.lib;%(AdditionalDependencies) - false - ./Ext.def - $(IntDir)$(TargetName).pdb - $(IntDir)$(TargetName).lib - false - - - ..\AutoInstall.bat "$(TargetPath)" \Extensions\Unicode 2> nul - Automatically installs the extension to Fusion once it is built. - - - EDITOR;%(PreprocessorDefinitions) - - - - - Level3 - MaxSpeed - true - true - true - ..\..\Inc;.\; - EDITOR;HWABETA;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;%(PreprocessorDefinitions) - min;max;%(UndefinePreprocessorDefinitions) - true - Guard - true - true - CompileAsCpp - None - MultiThreaded - - - true - true - true - $(ProjectDir)\MFX\Extensions\Unicode\$(ProjectName)$(TargetExt) - ..\..\lib\mmfs2.5.lib;%(AdditionalDependencies) - false - ./Ext.def - $(IntDir)$(TargetName).pdb - $(IntDir)$(TargetName).lib - false - - - ..\AutoInstall.bat "$(TargetPath)" \Extensions\Unicode 2> nul - Automatically installs the extension to Fusion once it is built. - - - EDITOR;%(PreprocessorDefinitions) - - - - - Level3 - MaxSpeed - true - true - true - ..\..\Inc;.\; - _NDEBUG;RUN_ONLY;HWABETA;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;%(PreprocessorDefinitions) - min;max;%(UndefinePreprocessorDefinitions) - true - Guard - true - true - CompileAsCpp - None - MultiThreaded - - - true - true - true - $(ProjectDir)MFX\Data\Runtime\Unicode\$(ProjectName)$(TargetExt) - ..\..\lib\mmfs2.5.lib;%(AdditionalDependencies) - false - ./Ext.def - $(IntDir)$(TargetName).pdb - $(IntDir)$(TargetName).lib - false - - - ..\AutoInstall.bat "$(TargetPath)" \Data\Runtime\Unicode 2> nul - Automatically installs the extension to Fusion once it is built. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Extensions/Template/Template2015.vcxproj.filters b/Extensions/Template/Template2015.vcxproj.filters deleted file mode 100644 index b446d86..0000000 --- a/Extensions/Template/Template2015.vcxproj.filters +++ /dev/null @@ -1,224 +0,0 @@ - - - - - {2f2987a7-e80a-4858-ada9-cc257cdada00} - - - {187fb9d6-9e49-489c-b9e8-a933212aff49} - - - {343d78a4-26f2-421a-aaf4-60d9cd560080} - - - {cd4e03ba-2d8b-4bd6-a680-fb7550b15e72} - - - {61e65ed1-83c8-4a25-8f07-fec01e952a99} - - - {11227bd0-77c9-4d0c-8fec-69a9456c064f} - - - {e7feb950-1a6f-4ae0-bef7-6c7e2f50db95} - - - {aa6d4c30-b593-47da-80aa-802a1f1cef4d} - - - - - Global to All Extensions\Edif\json - - - Global to All Extensions\Edif\Riggs - - - Global to All Extensions\Edif - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions\Fusion SDK - - - Global to All Extensions - - - This Extension\Resource Files - - - This Extension\The Extension Class - - - This Extension - - - - - Global to All Extensions\Edif\json - - - Global to All Extensions\Edif\Riggs - - - Global to All Extensions\Edif - - - Global to All Extensions\Edif - - - Global to All Extensions\Edif - - - Global to All Extensions\Edif - - - This Extension\The Extension Class - - - This Extension\The Extension Class - - - This Extension\The Extension Class - - - This Extension\The Extension Class - - - This Extension - - - This Extension - - - This Extension - - - - - Global to All Extensions\Fusion SDK - - - - - This Extension\Resource Files - - - This Extension - - - - - This Extension\Resource Files - - - - - This Extension\Resource Files - - - \ No newline at end of file diff --git a/Extensions/Template/resource.h b/Extensions/Template/resource.h deleted file mode 100644 index 2b0d9f0..0000000 --- a/Extensions/Template/resource.h +++ /dev/null @@ -1,18 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Ext.rc -// -#define IDR_EDIF_ICON 101 -#define IDR_EDIF_JSON 102 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/Extensions/TemplatePlus/CMakeLists.txt b/Extensions/TemplatePlus/CMakeLists.txt deleted file mode 100644 index 94b7432..0000000 --- a/Extensions/TemplatePlus/CMakeLists.txt +++ /dev/null @@ -1,97 +0,0 @@ - -cmake_minimum_required(VERSION 2.8.11) - -project(EXTENSION) - -set(EXT_NAME Template) - -#Grab source & header files -file(GLOB EXTENSION_SOURCES "./*.c*") -file(GLOB EXTENSION_HEADERS "./*.h*") -file(GLOB SDK_SOURCES "../../Lib/*.c*") -file(GLOB SDK_HEADERS "../../Inc/*.h*") -set(EXTENSION_SOURCES ${EXTENSION_SOURCES} ${SDK_SOURCES}) -set(EXTENSION_HEADERS ${EXTENSION_HEADERS} ${SDK_HEADERS}) -include_directories("../../Inc/" "./") -link_directories("./" "../../Lib/") - -#Fix VC++ options -if(MSVC) - message(STATUS "Note: Building with MSVC (recommended)") - foreach(flag - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - if(${flag} MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}") - endif() - endforeach() -endif() - -#Fix settings for MinGW -set(lib_ext ".lib") -if(MINGW) - set(CMAKE_CXX_FLAGS "-std=c++11 -masm=intel ${CMAKE_CXX_FLAGS} -Wno-multichar") - set(lib_ext "") -endif() - -list(APPEND EXT_MFX_TYPE "Plain") -list(APPEND EXT_MFX_TYPE "HWA") -list(APPEND EXT_MFX_TYPE "Unicode") -list(APPEND EXT_BUILD_TYPE "Debug") -list(APPEND EXT_BUILD_TYPE "Release") -list(APPEND EXT_BUILD_TYPE "RunOnly") - -foreach(curr_mfx_t ${EXT_MFX_TYPE}) - foreach(curr_build_t ${EXT_BUILD_TYPE}) - set(curr_name ${curr_mfx_t}${curr_build_t}) - - add_library(${curr_name} SHARED ${EXTENSION_SOURCES}) - - set(curr_defs "_WINDLL;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS") - - if(curr_build_t STREQUAL "Release") - set(out_dir "./MFX/Extensions/") - list(APPEND curr_defs "EDITOR") - - elseif(curr_build_t STREQUAL "RunOnly") - set(out_dir "./MFX/Data/Runtime/") - list(APPEND curr_defs "RUN_ONLY") - - else() - set(out_dir "./MFX_Debug/Extensions/") - list(APPEND curr_defs "EDITOR;DEBUG;_DEBUG") - endif() - - set(curr_libs "kernel32${lib_ext}") - if(MSVC) - set(curr_libs "${curr_libs} user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib") - endif() - - if(curr_mfx_t STREQUAL "HWA") - set(out_dir "${out_dir}HWA/") - set(curr_libs "${curr_libs} mmfs2hwa${lib_ext}") - list(APPEND curr_defs "HWABETA") - - elseif(curr_mfx_t STREQUAL "Unicode") - set(out_dir "${out_dir}Unicode/") - set(curr_libs "${curr_libs} mmfs2u${lib_ext}") - list(APPEND curr_defs "_UNICODE;UNICODE") - - else() - set(curr_libs "${curr_libs} mmfs2${lib_ext}") - endif() - - set(curr_link "") - if(MSVC) - set(curr_link "/DLL /MANIFEST:NO /DEF:\"${CMAKE_SOURCE_DIR}/Ext.def\" /MACHINE:X86") - endif() - - target_link_libraries(${curr_name} ${curr_libs}) - SET_TARGET_PROPERTIES(${curr_mfx_t}${curr_build_t} PROPERTIES - LIBRARY_OUTPUT_NAME "${EXT_NAME}.mfx" - LIBRARY_OUTPUT_DIRECTORY "${out_dir}" - COMPILE_DEFINITIONS "${curr_defs}" - LINK_FLAGS "${curr_link}" - ) - endforeach() -endforeach() diff --git a/Extensions/TemplatePlus/Template.sln b/Extensions/TemplatePlus/Template.sln deleted file mode 100644 index 18fe76f..0000000 --- a/Extensions/TemplatePlus/Template.sln +++ /dev/null @@ -1,40 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template", "Template.vcproj", "{3BCB4C73-71F6-43B6-803D-41411F92652A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug HWA|Fusion-2.x = Debug HWA|Fusion-2.x - Debug UnicodeHWA|Fusion-2.x = Debug UnicodeHWA|Fusion-2.x - Debug|Fusion-2.x = Debug|Fusion-2.x - Edittime HWA|Fusion-2.x = Edittime HWA|Fusion-2.x - Edittime UnicodeHWA|Fusion-2.x = Edittime UnicodeHWA|Fusion-2.x - Edittime|Fusion-2.x = Edittime|Fusion-2.x - Runtime HWA|Fusion-2.x = Runtime HWA|Fusion-2.x - Runtime UnicodeHWA|Fusion-2.x = Runtime UnicodeHWA|Fusion-2.x - Runtime|Fusion-2.x = Runtime|Fusion-2.x - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Fusion-2.x.ActiveCfg = Debug HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug HWA|Fusion-2.x.Build.0 = Debug HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug UnicodeHWA|Fusion-2.x.ActiveCfg = Debug UnicodeHWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug UnicodeHWA|Fusion-2.x.Build.0 = Debug UnicodeHWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.ActiveCfg = Debug|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Debug|Fusion-2.x.Build.0 = Debug|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Fusion-2.x.ActiveCfg = Edittime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime HWA|Fusion-2.x.Build.0 = Edittime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime UnicodeHWA|Fusion-2.x.ActiveCfg = Edittime UnicodeHWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime UnicodeHWA|Fusion-2.x.Build.0 = Edittime UnicodeHWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.ActiveCfg = Edittime|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Edittime|Fusion-2.x.Build.0 = Edittime|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Fusion-2.x.ActiveCfg = Runtime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime HWA|Fusion-2.x.Build.0 = Runtime HWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime UnicodeHWA|Fusion-2.x.ActiveCfg = Runtime UnicodeHWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime UnicodeHWA|Fusion-2.x.Build.0 = Runtime UnicodeHWA|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.ActiveCfg = Runtime|Win32 - {3BCB4C73-71F6-43B6-803D-41411F92652A}.Runtime|Fusion-2.x.Build.0 = Runtime|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Extensions/TemplatePlus/Template.vcproj b/Extensions/TemplatePlus/Template.vcproj deleted file mode 100644 index 3e326dc..0000000 --- a/Extensions/TemplatePlus/Template.vcproj +++ /dev/null @@ -1,1612 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 270d133c46bd262ce1c0d2ba1f718c1d473de843 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Mon, 8 Feb 2016 11:55:24 -0600 Subject: [PATCH 116/127] Rename template project --- Extensions/README.md | 6 +----- Extensions/{TemplatePlus => Template}/.gitignore | 0 Extensions/{TemplatePlus => Template}/Actions.cpp | 0 Extensions/{TemplatePlus => Template}/Common.h | 0 .../{TemplatePlus => Template}/Conditions.cpp | 0 .../{TemplatePlus => Template}/CustomParams.cpp | 0 Extensions/{TemplatePlus => Template}/Debugger.cpp | 0 Extensions/{TemplatePlus => Template}/EditData.hpp | 0 Extensions/{TemplatePlus => Template}/Edittime.cpp | 0 .../{TemplatePlus => Template}/Expressions.cpp | 0 Extensions/{TemplatePlus => Template}/Ext.def | 0 Extensions/{TemplatePlus => Template}/Ext.json | 0 Extensions/{TemplatePlus => Template}/Ext.rc | 0 Extensions/{TemplatePlus => Template}/Extension.cpp | 0 Extensions/{TemplatePlus => Template}/Extension.hpp | 0 Extensions/{TemplatePlus => Template}/General.cpp | 0 Extensions/{TemplatePlus => Template}/Icon.png | Bin .../{TemplatePlus => Template}/Properties.cpp | 0 Extensions/{TemplatePlus => Template}/Resource.h | 0 Extensions/{TemplatePlus => Template}/Runtime.cpp | 0 .../{TemplatePlus => Template}/Template2015.sln | 0 .../{TemplatePlus => Template}/Template2015.vcxproj | 0 .../Template2015.vcxproj.filters | 0 Extensions/{TemplatePlus => Template}/Text.cpp | 0 Extensions/{TemplatePlus => Template}/TextProps.cpp | 0 25 files changed, 1 insertion(+), 5 deletions(-) rename Extensions/{TemplatePlus => Template}/.gitignore (100%) rename Extensions/{TemplatePlus => Template}/Actions.cpp (100%) rename Extensions/{TemplatePlus => Template}/Common.h (100%) rename Extensions/{TemplatePlus => Template}/Conditions.cpp (100%) rename Extensions/{TemplatePlus => Template}/CustomParams.cpp (100%) rename Extensions/{TemplatePlus => Template}/Debugger.cpp (100%) rename Extensions/{TemplatePlus => Template}/EditData.hpp (100%) rename Extensions/{TemplatePlus => Template}/Edittime.cpp (100%) rename Extensions/{TemplatePlus => Template}/Expressions.cpp (100%) rename Extensions/{TemplatePlus => Template}/Ext.def (100%) rename Extensions/{TemplatePlus => Template}/Ext.json (100%) rename Extensions/{TemplatePlus => Template}/Ext.rc (100%) rename Extensions/{TemplatePlus => Template}/Extension.cpp (100%) rename Extensions/{TemplatePlus => Template}/Extension.hpp (100%) rename Extensions/{TemplatePlus => Template}/General.cpp (100%) rename Extensions/{TemplatePlus => Template}/Icon.png (100%) rename Extensions/{TemplatePlus => Template}/Properties.cpp (100%) rename Extensions/{TemplatePlus => Template}/Resource.h (100%) rename Extensions/{TemplatePlus => Template}/Runtime.cpp (100%) rename Extensions/{TemplatePlus => Template}/Template2015.sln (100%) rename Extensions/{TemplatePlus => Template}/Template2015.vcxproj (100%) rename Extensions/{TemplatePlus => Template}/Template2015.vcxproj.filters (100%) rename Extensions/{TemplatePlus => Template}/Text.cpp (100%) rename Extensions/{TemplatePlus => Template}/TextProps.cpp (100%) diff --git a/Extensions/README.md b/Extensions/README.md index 3af904a..92085b5 100644 --- a/Extensions/README.md +++ b/Extensions/README.md @@ -1,8 +1,4 @@ Extension Templates =================== -This folder is where your extensions will stay. There are three template projects to choose from - pick one, copy it, and rename it to start a new extension. - -**Template** is the classic EDIF template project with a similar layout to rSDK (besides the A/C/Es of course). - -**TemplatePlus** is a slightly higher-level project with better organization and some more abstraction for tedious tasks such as the Edit Data. Most functions still resemble those of rSDK. +This folder is where your extensions will stay. Copy the Template folder and rename it to start a new extension. diff --git a/Extensions/TemplatePlus/.gitignore b/Extensions/Template/.gitignore similarity index 100% rename from Extensions/TemplatePlus/.gitignore rename to Extensions/Template/.gitignore diff --git a/Extensions/TemplatePlus/Actions.cpp b/Extensions/Template/Actions.cpp similarity index 100% rename from Extensions/TemplatePlus/Actions.cpp rename to Extensions/Template/Actions.cpp diff --git a/Extensions/TemplatePlus/Common.h b/Extensions/Template/Common.h similarity index 100% rename from Extensions/TemplatePlus/Common.h rename to Extensions/Template/Common.h diff --git a/Extensions/TemplatePlus/Conditions.cpp b/Extensions/Template/Conditions.cpp similarity index 100% rename from Extensions/TemplatePlus/Conditions.cpp rename to Extensions/Template/Conditions.cpp diff --git a/Extensions/TemplatePlus/CustomParams.cpp b/Extensions/Template/CustomParams.cpp similarity index 100% rename from Extensions/TemplatePlus/CustomParams.cpp rename to Extensions/Template/CustomParams.cpp diff --git a/Extensions/TemplatePlus/Debugger.cpp b/Extensions/Template/Debugger.cpp similarity index 100% rename from Extensions/TemplatePlus/Debugger.cpp rename to Extensions/Template/Debugger.cpp diff --git a/Extensions/TemplatePlus/EditData.hpp b/Extensions/Template/EditData.hpp similarity index 100% rename from Extensions/TemplatePlus/EditData.hpp rename to Extensions/Template/EditData.hpp diff --git a/Extensions/TemplatePlus/Edittime.cpp b/Extensions/Template/Edittime.cpp similarity index 100% rename from Extensions/TemplatePlus/Edittime.cpp rename to Extensions/Template/Edittime.cpp diff --git a/Extensions/TemplatePlus/Expressions.cpp b/Extensions/Template/Expressions.cpp similarity index 100% rename from Extensions/TemplatePlus/Expressions.cpp rename to Extensions/Template/Expressions.cpp diff --git a/Extensions/TemplatePlus/Ext.def b/Extensions/Template/Ext.def similarity index 100% rename from Extensions/TemplatePlus/Ext.def rename to Extensions/Template/Ext.def diff --git a/Extensions/TemplatePlus/Ext.json b/Extensions/Template/Ext.json similarity index 100% rename from Extensions/TemplatePlus/Ext.json rename to Extensions/Template/Ext.json diff --git a/Extensions/TemplatePlus/Ext.rc b/Extensions/Template/Ext.rc similarity index 100% rename from Extensions/TemplatePlus/Ext.rc rename to Extensions/Template/Ext.rc diff --git a/Extensions/TemplatePlus/Extension.cpp b/Extensions/Template/Extension.cpp similarity index 100% rename from Extensions/TemplatePlus/Extension.cpp rename to Extensions/Template/Extension.cpp diff --git a/Extensions/TemplatePlus/Extension.hpp b/Extensions/Template/Extension.hpp similarity index 100% rename from Extensions/TemplatePlus/Extension.hpp rename to Extensions/Template/Extension.hpp diff --git a/Extensions/TemplatePlus/General.cpp b/Extensions/Template/General.cpp similarity index 100% rename from Extensions/TemplatePlus/General.cpp rename to Extensions/Template/General.cpp diff --git a/Extensions/TemplatePlus/Icon.png b/Extensions/Template/Icon.png similarity index 100% rename from Extensions/TemplatePlus/Icon.png rename to Extensions/Template/Icon.png diff --git a/Extensions/TemplatePlus/Properties.cpp b/Extensions/Template/Properties.cpp similarity index 100% rename from Extensions/TemplatePlus/Properties.cpp rename to Extensions/Template/Properties.cpp diff --git a/Extensions/TemplatePlus/Resource.h b/Extensions/Template/Resource.h similarity index 100% rename from Extensions/TemplatePlus/Resource.h rename to Extensions/Template/Resource.h diff --git a/Extensions/TemplatePlus/Runtime.cpp b/Extensions/Template/Runtime.cpp similarity index 100% rename from Extensions/TemplatePlus/Runtime.cpp rename to Extensions/Template/Runtime.cpp diff --git a/Extensions/TemplatePlus/Template2015.sln b/Extensions/Template/Template2015.sln similarity index 100% rename from Extensions/TemplatePlus/Template2015.sln rename to Extensions/Template/Template2015.sln diff --git a/Extensions/TemplatePlus/Template2015.vcxproj b/Extensions/Template/Template2015.vcxproj similarity index 100% rename from Extensions/TemplatePlus/Template2015.vcxproj rename to Extensions/Template/Template2015.vcxproj diff --git a/Extensions/TemplatePlus/Template2015.vcxproj.filters b/Extensions/Template/Template2015.vcxproj.filters similarity index 100% rename from Extensions/TemplatePlus/Template2015.vcxproj.filters rename to Extensions/Template/Template2015.vcxproj.filters diff --git a/Extensions/TemplatePlus/Text.cpp b/Extensions/Template/Text.cpp similarity index 100% rename from Extensions/TemplatePlus/Text.cpp rename to Extensions/Template/Text.cpp diff --git a/Extensions/TemplatePlus/TextProps.cpp b/Extensions/Template/TextProps.cpp similarity index 100% rename from Extensions/TemplatePlus/TextProps.cpp rename to Extensions/Template/TextProps.cpp From 1cfefbbdc5d61c84f764e0b490d0ff3715e29f35 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Mon, 8 Feb 2016 11:56:23 -0600 Subject: [PATCH 117/127] Minor doc update --- Extensions/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Extensions/README.md b/Extensions/README.md index 92085b5..440497e 100644 --- a/Extensions/README.md +++ b/Extensions/README.md @@ -1,4 +1,4 @@ -Extension Templates -=================== +Extensions Directory +==================== This folder is where your extensions will stay. Copy the Template folder and rename it to start a new extension. From 3c66e3189760eef7e15c54598e2bda575fa8922e Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 2 Apr 2016 15:12:06 -0500 Subject: [PATCH 118/127] Misc improvements --- Extensions/Template/.gitignore | 2 ++ Extensions/Template/Common.h | 1 + Extensions/Template/EditData.hpp | 2 +- Extensions/Template/Extension.hpp | 2 +- Extensions/Template/Properties.cpp | 5 +++-- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Extensions/Template/.gitignore b/Extensions/Template/.gitignore index c022959..fdfe359 100644 --- a/Extensions/Template/.gitignore +++ b/Extensions/Template/.gitignore @@ -10,6 +10,8 @@ Runtime/ Runtime HWA/ Runtime UnicodeHWA/ +*.opendb +*.VC.db ################# ## Eclipse diff --git a/Extensions/Template/Common.h b/Extensions/Template/Common.h index 24de0fe..6a5c952 100644 --- a/Extensions/Template/Common.h +++ b/Extensions/Template/Common.h @@ -20,6 +20,7 @@ #include "Edif.h" #include "Resource.h" +#include //#include //#include "YourHeader.hpp" diff --git a/Extensions/Template/EditData.hpp b/Extensions/Template/EditData.hpp index 3d4b4c5..5329595 100644 --- a/Extensions/Template/EditData.hpp +++ b/Extensions/Template/EditData.hpp @@ -10,7 +10,7 @@ * start of the runtime. */ -struct EditData +struct EditData final { /* MyString, MyInt, MyArray_t, MyArray * Example data diff --git a/Extensions/Template/Extension.hpp b/Extensions/Template/Extension.hpp index 8661559..30bfdc3 100644 --- a/Extensions/Template/Extension.hpp +++ b/Extensions/Template/Extension.hpp @@ -9,7 +9,7 @@ * access to everything included by it. */ -class Extension +class Extension final { public: /* rd diff --git a/Extensions/Template/Properties.cpp b/Extensions/Template/Properties.cpp index ebffd54..c59a790 100644 --- a/Extensions/Template/Properties.cpp +++ b/Extensions/Template/Properties.cpp @@ -227,7 +227,8 @@ void MMF2Func SetPropCheck(mv *mV, SerializedED *SED, UINT PropID, BOOL Ticked) //{ //case Prop::MyCheckBoxPropertyOrPropertyThatHasTheCheckboxOptionSet: // { - // ed.WhetherOrNotThatPropertyOfMineIsTicked = Ticked != FALSE ? true : false; + // ed.WhetherOrNotThatPropertyOfMineIsTicked = (Ticked != FALSE ? true : false); + // break; // } //} //since you changed ed: @@ -277,7 +278,7 @@ BOOL MMF2Func IsPropEnabled(mv *mV, SerializedED *SED, UINT PropID) { case Prop::Version: { - return FALSE; //Makes the version proeprty greyed out + return FALSE; //Makes the version property greyed out } //case Prop::MyString: //intentional\\ //case Prop::MyInt: //fallthrough\\ From 323f2b3092e4d306a478b7e561a49787b177c519 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 10 Apr 2016 13:46:26 -0500 Subject: [PATCH 119/127] Replace MMF2 with Fusion where appropriate Yes I know this is bikeshedding. It was bothering me and it's better than nothing. --- Extensions/Template/Common.h | 2 +- Extensions/Template/CustomParams.cpp | 2 +- Extensions/Template/Debugger.cpp | 10 +++++----- Extensions/Template/Edittime.cpp | 22 +++++++++++----------- Extensions/Template/Extension.cpp | 16 ++++++++-------- Extensions/Template/Extension.hpp | 8 ++++---- Extensions/Template/General.cpp | 16 ++++++++-------- Extensions/Template/Properties.cpp | 4 ++-- Extensions/Template/Runtime.cpp | 4 ++-- Extensions/Template/TextProps.cpp | 2 +- Inc/Edif.h | 2 +- Lib/Edif.cpp | 8 ++++---- 12 files changed, 48 insertions(+), 48 deletions(-) diff --git a/Extensions/Template/Common.h b/Extensions/Template/Common.h index 6a5c952..3704c95 100644 --- a/Extensions/Template/Common.h +++ b/Extensions/Template/Common.h @@ -6,7 +6,7 @@ * everywhere else. You shouldn't need to * change anything in this file except * to include headers that you want and - * to change the edition of MMF2 you want + * to change the edition of Fusion you want * to support. */ diff --git a/Extensions/Template/CustomParams.cpp b/Extensions/Template/CustomParams.cpp index c32bad6..afab8b4 100644 --- a/Extensions/Template/CustomParams.cpp +++ b/Extensions/Template/CustomParams.cpp @@ -91,7 +91,7 @@ void MMF2Func EditParameter(mv _far *mV, short code, paramExt* pExt) } /* GetParameterString - * This is where you give MMF2 the display + * This is where you give Fusion the display * string for your custom parameter. Remember, * this is the display for ONE PARAMETER. It * will appear amongst all the other parameter diff --git a/Extensions/Template/Debugger.cpp b/Extensions/Template/Debugger.cpp index 53b6cbd..2e4c3d0 100644 --- a/Extensions/Template/Debugger.cpp +++ b/Extensions/Template/Debugger.cpp @@ -1,8 +1,8 @@ /* Debugger.cpp * Here you will be able to interact - * with the MMF2 debugger (that thing + * with the Fusion debugger (that thing * in the top left when you run your - * MFA from MMF2). You can add your own + * MFA from Fusion). You can add your own * fields of your choice to your object's * debugger tree. * Functions defined here: @@ -13,7 +13,7 @@ #include "Common.h" -#ifndef RUN_ONLY //The debugger is only available when running from MMF2, which uses the Edittime MFX +#ifndef RUN_ONLY //The debugger is only available when running from Fusion, which uses the Edittime MFX /* DB * This is the namespace the debugger identifiers @@ -65,7 +65,7 @@ LPWORD MMF2Func GetDebugTree(RD *rd) /* GetDebugItem * With respect to DB_BUFFERSIZE, give - * MMF2 the string to display in the + * Fusion the string to display in the * debugger. You must include both the * name and the value in the string, * or any format you want. @@ -96,7 +96,7 @@ void MMF2Func GetDebugItem(LPSTR Buffer, RD *rd, int ID) * When the user chooses to edit an * editable debug item, this function * is called. You can use the RFUNCTIONs - * provided by MMF2 to do simple text and + * provided by Fusion to do simple text and * number edits, or you can do whatever you * want, such as creating a dialog that lets * the user enter more sophisticated input to diff --git a/Extensions/Template/Edittime.cpp b/Extensions/Template/Edittime.cpp index e48e81b..8fd6728 100644 --- a/Extensions/Template/Edittime.cpp +++ b/Extensions/Template/Edittime.cpp @@ -36,7 +36,7 @@ int MMF2Func CreateObject(mv *mV, LO *lo, SerializedED *SED) { #ifndef RUN_ONLY - if(IS_COMPATIBLE(mV)) //Make sure MMF2 hasn't changed in a way that makes your extension incompatible + if(IS_COMPATIBLE(mV)) //Make sure Fusion hasn't changed in a way that makes your extension incompatible { Edif::Init(mV, SED); @@ -67,7 +67,7 @@ int MMF2Func MakeIconEx(mv *mV, cSurface *Icon, LPTSTR Name, OI *oi, SerializedE /* UsesFile * When the user chooses "Create From - * File", MMF2 asks each extension if + * File", Fusion asks each extension if * it supports being created from that * file. Here you should investigate * the file and see if your extension @@ -122,7 +122,7 @@ void MMF2Func CreateFromFile(mv *mV, LPTSTR FileName, SerializedED *SED) /* PutObject * Each time a duplicate is made of your - * object, MMF2 calls this function to + * object, Fusion calls this function to * let you know. You still share the same * editdata, the difference is the * LevelObject pointer and the number of @@ -161,7 +161,7 @@ void MMF2Func RemoveObject(mv *mV, LO *lo, SerializedED *SED, ushort NDup) /* CloneObject * When the user makes a clone of your object - * (not just another instance), MMF2 copies the + * (not just another instance), Fusion copies the * contents of the editdata and then lets you * know that the editdata in question is in * new hands. Here you can 'fix' anything that @@ -194,14 +194,14 @@ BOOL MMF2Func EditObject (mv *mV, OI *oi, LO *lo, SerializedED *SED) } /* SetEditSize - * If your object is resizeable, MMF2 calls this + * If your object is resizeable, Fusion calls this * to let you know that the user has just requested * a resize of the object. You can take the new * size as is, or if it reminds you too much of * 500 page essays you can limit the size to whatever * you want. If you uncomment this function, make * sure you also uncomment it in Ext.def. The - * presence of this function tells MMF2 that your + * presence of this function tells Fusion that your * object can be resized; otherwise it can't. */ /*BOOL MMF2Func SetEditSize(mv *mV, SerializedED *SED, int x, int y) @@ -217,7 +217,7 @@ BOOL MMF2Func EditObject (mv *mV, OI *oi, LO *lo, SerializedED *SED) }*/ /* GetObjectRect - * MMF2 wants to know from time to time how much + * Fusion wants to know from time to time how much * space your object is taking up on the frame * editor. Currently this just gives the size of * your Icon.png, but you can change it to parallel @@ -250,13 +250,13 @@ void MMF2Func EditorDisplay(mv *mV, OI *oi, LO *lo, SerializedED *SED, RECT *rec /* IsTransparent - * MMF2 calls this to ask if the mouse pointer + * Fusion calls this to ask if the mouse pointer * is over a transparent part of your object. * Don't ask why this isn't called "IsOpaque", * just accept that it isn't and move on. If the * given coordinates are over an opaque part of * your object, return TRUE, otherwise return - * FALSE. (Protip: MMF2 calls this function a + * FALSE. (Protip: Fusion calls this function a * LOT. Don't put a MessageBox function in here * or any other kind of debug function.) */ @@ -269,7 +269,7 @@ extern "C" BOOL MMF2Func IsTransparent(mv *mV, LO *lo, SerializedED *SED, int x, } /* PrepareToWriteObject (DEPRECATED) - * Just before MMF2 writes the editdata to the MFA, + * Just before Fusion writes the editdata to the MFA, * it calls this function to let you clean up * a temporary copy of the editdata. Because you * intelligently designed your EditData::Serialize @@ -279,7 +279,7 @@ extern "C" BOOL MMF2Func IsTransparent(mv *mV, LO *lo, SerializedED *SED, int x, void MMF2Func PrepareToWriteObject(mv *, SerializedED *, OI *){} /* GetFilters - * When the MFA filters are set to Automatic, MMF2 + * When the MFA filters are set to Automatic, Fusion * asks your extension if it uses filters or not. * If you use any of either kind of filters, return * TRUE for that kind. diff --git a/Extensions/Template/Extension.cpp b/Extensions/Template/Extension.cpp index a32768a..1f09854 100644 --- a/Extensions/Template/Extension.cpp +++ b/Extensions/Template/Extension.cpp @@ -68,8 +68,8 @@ Extension::~Extension() } /* Handle - * MMF2 calls this function to let your extension - * "live" - if you want, you can have MMF2 call this + * Fusion calls this function to let your extension + * "live" - if you want, you can have Fusion call this * every frame. This is where you'd, for instance, * simulate physics or move an object. This is * the analagous function to the old HandleRunObject. @@ -87,7 +87,7 @@ short Extension::Handle() to 1 whenever you want to redraw your object If your extension won't draw to the window, but it still needs - to do something every MMF2 loop use: + to do something every Fusion loop use: return 0; @@ -95,7 +95,7 @@ short Extension::Handle() return REFLAG_ONESHOT; - This doesn't mean this function can never run again. If you want MMF2 + This doesn't mean this function can never run again. If you want Fusion to handle your object again (causing this code to run) use this function: Runtime.Rehandle(); @@ -111,7 +111,7 @@ short Extension::Handle() * This is the analagous function to * DisplayRunObject. If you return * REFLAG_DISPLAY in Handle() this - * routine will run. If you want MMF2 + * routine will run. If you want Fusion * to apply ink effects for you, then * implement GetRunObjectSurface in * Runtime.cpp instead. @@ -123,7 +123,7 @@ short Extension::Display() /* Pause * If your extension plays sound, for - * example, then MMF2 calls this to + * example, then Fusion calls this to * let you know to pause the music, * usually by another extension's request * or by the player pausing the applcation. @@ -134,7 +134,7 @@ short Extension::Pause() } /* Continue - * Opposite to the above, MMF2 lets + * Opposite to the above, Fusion lets * you know that the silence is over; * your extension may live again. */ @@ -149,7 +149,7 @@ short Extension::Continue() * so serialize your runtime data to * the File given. It is a Windows * file handle, but you can use some - * of MMF2's built-in functions for + * of Fusion's built-in functions for * writing files. Check the MMF2SDK * Help file for more information. */ diff --git a/Extensions/Template/Extension.hpp b/Extensions/Template/Extension.hpp index 30bfdc3..42935b1 100644 --- a/Extensions/Template/Extension.hpp +++ b/Extensions/Template/Extension.hpp @@ -15,7 +15,7 @@ class Extension final /* rd * This is a pointer to the classic * RunData structure. Some things still - * have to be stored there for MMF2's + * have to be stored there for Fusion's * sake, so you need to have acces to * that data. You should not modify * the rundata structure, however, @@ -42,9 +42,9 @@ class Extension final /* MinimumBuild * Always set this to the latest build - * of MMF2 that has been released, unless + * of Fusion that has been released, unless * you need to set it higher for a beta - * version of MMF2 to get access to some + * version of Fusion to get access to some * new SDK feature. */ static const int MinimumBuild = 257; @@ -60,7 +60,7 @@ class Extension final /* OEFLAGS, OEPREFS * These are settings for your extension - * that tell MMF2 how to treat your extension + * that tell Fusion how to treat your extension * and what behaviors and responsibilities * to add. Check the MMF2SDK Help file for * more detailed information on the flags you diff --git a/Extensions/Template/General.cpp b/Extensions/Template/General.cpp index 23e405e..8afed86 100644 --- a/Extensions/Template/General.cpp +++ b/Extensions/Template/General.cpp @@ -58,7 +58,7 @@ BOOL WINAPI DllMain(HINSTANCE DLL, DWORD Reason, LPVOID) /* InitExtension - * MMF2 calls this before anything else when it loads your + * Fusion calls this before anything else when it loads your * extension. This includes during the splash screen, in which * case "Quiet" is true. This is where you should initialize * global information for either edittime or runtime. Be aware, @@ -66,7 +66,7 @@ BOOL WINAPI DllMain(HINSTANCE DLL, DWORD Reason, LPVOID) * extension will share the same global information. You can * use mV->mvEditApp to tell apart different MFAs from each * other. If an error occurs during this function, return - * -1 and MMF2 will not load your extension. + * -1 and Fusion will not load your extension. */ int MMF2Func InitExtension(mv *mV, int Quiet) { @@ -74,7 +74,7 @@ int MMF2Func InitExtension(mv *mV, int Quiet) } /* FreeExtension - * Called just before MMF2 unloads your extension. You + * Called just before Fusion unloads your extension. You * should release any memory you allocated above in * the InitializeExtension function. You should always * return a value of 0. @@ -88,7 +88,7 @@ int MMF2Func FreeExtension(mv *mV) /* LoadObject - * This is called at both edittime and runtime when MMF2 + * This is called at both edittime and runtime when Fusion * loads each unique instance of your object. (Each one * with a different name, not each instance of the same * one). Not much needs to be done here. @@ -109,7 +109,7 @@ void MMF2Func UnloadObject(mv *mV, SerializedED *SED, int) } /* UpdateEditStructure (DEPRECATED) - * This is called when MMF2 notices that your + * This is called when Fusion notices that your * extension has a newer version number than * the one in the header of the SerializedED. * Thankfully, however, we don't need this @@ -128,7 +128,7 @@ HGLOBAL MMF2Func UpdateEditStructure(mv *mV, SerializedED *OldSED) /* UpdateFileNames * When the application is moved to a new directory, - * MMF2 asks your extension to ensure that its file + * Fusion asks your extension to ensure that its file * paths are moving with it. Just call Update for * each file path - you will need to create buffers * of size MAX_PATH if you use C++ strings for @@ -140,8 +140,8 @@ void MMF2Func UpdateFileNames(mv *mV, LPSTR appName, SerializedED *SED, void (WI } /* EnumElts - * That whacky function that MMF2 uses to enumerate all the - * animation frames associated with your object, because MMF2 + * That whacky function that Fusion uses to enumerate all the + * animation frames associated with your object, because Fusion * is nice enough to deal with them for you so you can't-er, * don't have to. Refer to the MMF2SDK Help file for * information on how not to misuse this function. diff --git a/Extensions/Template/Properties.cpp b/Extensions/Template/Properties.cpp index c59a790..66efe2e 100644 --- a/Extensions/Template/Properties.cpp +++ b/Extensions/Template/Properties.cpp @@ -157,7 +157,7 @@ void *MMF2Func GetPropValue(mv *mV, SerializedED *SED, UINT PropID) /* SetPropValue * The user has just finished entering their * 500 page essay into your MyString field. - * MMF2 isn't so kind as to save that for them, + * Fusion isn't so kind as to save that for them, * so it entrusts it with you. Store it! */ void MMF2Func SetPropValue(mv *mV, SerializedED *SED, UINT PropID, CPropValue *PropVal) @@ -191,7 +191,7 @@ void MMF2Func SetPropValue(mv *mV, SerializedED *SED, UINT PropID, CPropValue *P * There are checkbox properties, and * there are properties that have their * own checkbox as an option. This is - * where you tell MMF2 whether those + * where you tell Fusion whether those * boxes are ticked or not. */ BOOL MMF2Func GetPropCheck(mv *mV, SerializedED *SED, UINT PropID) diff --git a/Extensions/Template/Runtime.cpp b/Extensions/Template/Runtime.cpp index f060dda..b919a34 100644 --- a/Extensions/Template/Runtime.cpp +++ b/Extensions/Template/Runtime.cpp @@ -20,7 +20,7 @@ * You can support ink effects in * DisplayRunObject too, but this is * done automatically if you implement - * GetRunObjectSurface (MMF2 applies the + * GetRunObjectSurface (Fusion applies the * ink effects to the surface). Don't * forget to enable the function in the * .def file if you uncomment & implement @@ -129,7 +129,7 @@ void MMF2Func StartFrame(mv *mV, CRunApp *App, int FrameIndex) } /* EndFrame - * Called when the frame ends. MMF2 + * Called when the frame ends. Fusion * does NOT call this function in the * event of a "Restart Frame" action. */ diff --git a/Extensions/Template/TextProps.cpp b/Extensions/Template/TextProps.cpp index d8ef389..168f457 100644 --- a/Extensions/Template/TextProps.cpp +++ b/Extensions/Template/TextProps.cpp @@ -1,5 +1,5 @@ /* TextProps.cpp - * If you plan on allowing MMF2 to manage + * If you plan on allowing Fusion to manage * your extension's text display properties * for you, this is the file to look into. * Functions defined here: diff --git a/Inc/Edif.h b/Inc/Edif.h index 315491c..7abb9bd 100644 --- a/Inc/Edif.h +++ b/Inc/Edif.h @@ -279,7 +279,7 @@ struct SerializedED /* Header * This required data member contains * information about your extension for - * MMF2, such as the version number + * Fusion, such as the version number * from Extension::Version. */ extHeader Header; diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 36c0ae6..51d9c80 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -91,7 +91,7 @@ int Edif::Init(mv _far * mV) { _tcscpy (LanguageCode, _T ("EN")); - // Get pathname of MMF2 + // Get pathname of Fusion LPTSTR mmfname = (LPTSTR)calloc(_MAX_PATH, sizeof(TCHAR)); if ( mmfname != NULL ) { @@ -502,7 +502,7 @@ int ActionOrCondition(vector &FloatFlags, LPEVENTINFOS2 Info, void * Func case 14: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13]); case 15: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13], P[14]); case 16: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13], P[14], P[15]); - //Since MMF2 doesn't fully support >16 parameters, they aren't supported here either + //Since Fusion doesn't fully support >16 parameters, they aren't supported here either } #endif @@ -725,7 +725,7 @@ long __stdcall Edif::Expression(LPRDATA rdPtr, long param) case 14: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13]); case 15: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13], P[14]); case 16: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13], P[14], P[15]); - //Since MMF2 doesn't fully support >16 parameters, they aren't supported here either + //Since Fusion doesn't fully support >16 parameters, they aren't supported here either } } else @@ -749,7 +749,7 @@ long __stdcall Edif::Expression(LPRDATA rdPtr, long param) case 14: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13]); case 15: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13], P[14]); case 16: Result = CallExtMFP(*(rdPtr->pExtension), Function, P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], P[11], P[12], P[13], P[14], P[15]); - //Since MMF2 doesn't fully support >16 parameters, they aren't supported here either + //Since Fusion doesn't fully support >16 parameters, they aren't supported here either } } #endif From b7d3fac208871c1d87d50dd8d47e974cbf1f971b Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 10 Apr 2016 19:59:51 -0500 Subject: [PATCH 120/127] Fix sketchy JSON code in Edif::Init Looks like `copy` was being leaked. To be honest I'm not even sure why a copy needs to be made here, but I assume it's for a good reason so I made the minimal fix necessary. It's not a performance concern anyway. --- Lib/Edif.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 51d9c80..168da48 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -143,20 +143,18 @@ int Edif::Init(mv _far * mV) Edif::ExternalJSON = (result == Edif::DependencyWasFile); - char * copy = (char *) malloc (JSON_Size + 1); - memcpy (copy, JSON, JSON_Size); - copy [JSON_Size] = 0; + std::string const copy {JSON, JSON_Size}; if ( result != Edif::DependencyWasResource ) free(JSON); - char json_error [256]; + char json_error [json_error_max+1]; json_settings settings; memset (&settings, 0, sizeof (settings)); settings.settings |= json_enable_comments; - json_value * json = json_parse_ex (&settings, copy, JSON_Size, json_error); + json_value * json = json_parse_ex (&settings, copy.c_str(), copy.size(), json_error); if (!json) { From d964552b56a139853dcf8870f6d1f13883117f69 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 10 Apr 2016 20:57:13 -0500 Subject: [PATCH 121/127] Refactor Edif::GetDependency to make it less sketchy Thanks to VC++'s Code Analysis for finding the sketchiness. --- Inc/Edif.h | 2 +- Lib/Edif.cpp | 71 ++++++++++++++++++++++++---------------------------- 2 files changed, 34 insertions(+), 39 deletions(-) diff --git a/Inc/Edif.h b/Inc/Edif.h index 7abb9bd..8a5b699 100644 --- a/Inc/Edif.h +++ b/Inc/Edif.h @@ -165,7 +165,7 @@ namespace Edif const int DependencyWasFile = 1; const int DependencyWasResource = 2; - int GetDependency (char *& Buffer, size_t &Size, const TCHAR * FileExtension, int Resource); + int GetDependency (std::vector &Buffer, const TCHAR * FileExtension, int Resource); TCHAR* ConvertString(const char* utf8String); TCHAR* ConvertAndCopyString(TCHAR* tstr, const char* utf8String, int maxLength); diff --git a/Lib/Edif.cpp b/Lib/Edif.cpp index 168da48..b163c1d 100644 --- a/Lib/Edif.cpp +++ b/Lib/Edif.cpp @@ -121,10 +121,9 @@ int Edif::Init(mv _far * mV) } // Get JSON file - char * JSON; - size_t JSON_Size; + std::vector JSON; - int result = Edif::GetDependency (JSON, JSON_Size, _T("json"), IDR_EDIF_JSON); + int result = Edif::GetDependency (JSON, _T("json"), IDR_EDIF_JSON); if (result == Edif::DependencyNotFound) { @@ -143,10 +142,6 @@ int Edif::Init(mv _far * mV) Edif::ExternalJSON = (result == Edif::DependencyWasFile); - std::string const copy {JSON, JSON_Size}; - if ( result != Edif::DependencyWasResource ) - free(JSON); - char json_error [json_error_max+1]; json_settings settings; @@ -154,7 +149,7 @@ int Edif::Init(mv _far * mV) settings.settings |= json_enable_comments; - json_value * json = json_parse_ex (&settings, copy.c_str(), copy.size(), json_error); + json_value * json = json_parse_ex (&settings, JSON.data(), JSON.size(), json_error); if (!json) { @@ -175,14 +170,13 @@ Edif::SDK::SDK(mv * mV, json_value &_json) : json (_json) Icon = new cSurface; if(mV->mvImgFilterMgr) { - char * IconData; - size_t IconSize; + std::vector IconData; - int result = Edif::GetDependency (IconData, IconSize, _T("png"), IDR_EDIF_ICON); + int result = Edif::GetDependency (IconData, _T("png"), IDR_EDIF_ICON); if (result != Edif::DependencyNotFound) { CInputMemFile * File = CInputMemFile::NewInstance (); - File->Create ((LPBYTE)IconData, IconSize); + File->Create ((LPBYTE)IconData.data(), IconData.size()); DWORD PNG = FILTERID_PNG; ImportImageFromInputFile(mV->mvImgFilterMgr, File, Icon, &PNG, 0); @@ -191,8 +185,6 @@ Edif::SDK::SDK(mv * mV, json_value &_json) : json (_json) if(!Icon->HasAlpha()) Icon->SetTransparentColor(RGB(255, 0, 255)); - if ( result != Edif::DependencyWasResource ) - free(IconData); } } #endif // RUN_ONLY @@ -770,46 +762,49 @@ long __stdcall Edif::Expression(LPRDATA rdPtr, long param) return Result; } -int Edif::GetDependency (char *& Buffer, size_t &Size, const TCHAR * FileExtension, int Resource) +int Edif::GetDependency (std::vector &Buffer, const TCHAR * FileExtension, int Resource) { TCHAR Filename [MAX_PATH]; GetSiblingPath (Filename, FileExtension); - Buffer = NULL; + Buffer.clear(); if (*Filename) { FILE * File = NULL; int error = _tfopen_s(&File, Filename, _T("rb")); - if (!File) - return DependencyNotFound; - - fseek (File, 0, SEEK_END); - Size = ftell (File); - fseek (File, 0, SEEK_SET); + if(File) + { + fseek(File, 0, SEEK_END); + Buffer.resize(ftell(File)); + fseek(File, 0, SEEK_SET); - Buffer = (char *) malloc (Size + 1); - Buffer [Size] = 0; + fread(Buffer.data(), 1, Buffer.size(), File); - fread (Buffer, 1, Size, File); - - fclose (File); + fclose(File); - return DependencyWasFile; + return DependencyWasFile; + } } - if (!Resource) - return DependencyNotFound; - - HRSRC res = FindResource (hInstLib, MAKEINTRESOURCE (Resource), _T("EDIF")); - - if (!res) - return DependencyNotFound; + if(Resource) + { + if(HRSRC res_r = FindResource(hInstLib, MAKEINTRESOURCE(Resource), _T("EDIF"))) + { + if(HGLOBAL res_g = LoadResource(hInstLib, res_r)) + { + if(LPVOID res_p = LockResource(res_g)) + { + Buffer.resize(SizeofResource(hInstLib, res_r)); + memcpy(Buffer.data(), res_p, Buffer.size()); - Size = SizeofResource (hInstLib, res); - Buffer = (char *) LockResource (LoadResource (hInstLib, res)); + return DependencyWasResource; + } + } + } + } - return DependencyWasResource; + return DependencyNotFound; } static void GetSiblingPath (TCHAR * Buffer, const TCHAR * FileExtension) From 6de87f317f9fe8c52738a793d5a76a9a6dafbb77 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 10 Apr 2016 21:08:58 -0500 Subject: [PATCH 122/127] Fix memory leak in GetDependencies https://github.com/ClickteamLLC/windows-edif/commit/e5de4b0d258a49b543dc20e03e5dc834b2fa096b fixed one bug, added another. --- Lib/Edif.General.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/Edif.General.cpp b/Lib/Edif.General.cpp index 47747c1..baf579e 100644 --- a/Lib/Edif.General.cpp +++ b/Lib/Edif.General.cpp @@ -14,7 +14,7 @@ LPCTSTR * WINAPI DLLExport GetDependencies() if (Edif::ExternalJSON) { - TCHAR * JSONFilename = (TCHAR *)malloc(MAX_PATH * sizeof(TCHAR)); + TCHAR JSONFilename [MAX_PATH * sizeof(TCHAR)]; GetModuleFileName (hInstLib, JSONFilename, MAX_PATH); From cb1a7ff8e45189078faf47460b78045c9e9f7712 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 15 May 2016 09:06:55 -0500 Subject: [PATCH 123/127] Improved gitignores, XP support, and no more iobj/ipdb files --- .gitignore | 6 ++---- Extensions/Template/.gitignore | 4 +++- Extensions/Template/Template2015.vcxproj | 10 ++++++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 2de7d01..15604e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,6 @@ # Only keep template projects -/Extensions/ -!/Extensions/Template/ -!/Extensions/TemplatePlus/ -!/Extensions/TemplatePlusPlus/ +/Extensions/* +!/Extensions/Template*/ !/Extensions/AutoInstall.bat !/Extensions/README.md diff --git a/Extensions/Template/.gitignore b/Extensions/Template/.gitignore index fdfe359..78484b9 100644 --- a/Extensions/Template/.gitignore +++ b/Extensions/Template/.gitignore @@ -1,5 +1,7 @@ # Template project built files -MFX/ +MFX/* +!MFX/Examples +*.0* Debug/ Debug HWA/ Debug UnicodeHWA/ diff --git a/Extensions/Template/Template2015.vcxproj b/Extensions/Template/Template2015.vcxproj index 84d1bb5..ab25873 100644 --- a/Extensions/Template/Template2015.vcxproj +++ b/Extensions/Template/Template2015.vcxproj @@ -30,14 +30,14 @@ DynamicLibrary false - v140 + v140_xp FastLTCG Unicode DynamicLibrary false - v140 + v140_xp FastLTCG Unicode @@ -103,6 +103,8 @@ $(IntDir)$(TargetName).lib false $(IntDir)$(TargetName).pgd + Default + Windows ..\AutoInstall.bat "$(TargetPath)" \Extensions\Unicode 2> nul @@ -148,6 +150,8 @@ $(IntDir)$(TargetName).lib false $(IntDir)$(TargetName).pgd + Default + Windows ..\AutoInstall.bat "$(TargetPath)" \Extensions\Unicode 2> nul @@ -193,6 +197,8 @@ $(IntDir)$(TargetName).lib false $(IntDir)$(TargetName).pgd + Default + Windows ..\AutoInstall.bat "$(TargetPath)" \Data\Runtime\Unicode 2> nul From d0713ca824cefa1044e0154380c708114e43f7ff Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sun, 15 May 2016 18:48:13 -0500 Subject: [PATCH 124/127] Fix crashing on XP Explanation: http://stackoverflow.com/a/32776479/1959975 --- Extensions/Template/Template2015.vcxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Extensions/Template/Template2015.vcxproj b/Extensions/Template/Template2015.vcxproj index ab25873..272251d 100644 --- a/Extensions/Template/Template2015.vcxproj +++ b/Extensions/Template/Template2015.vcxproj @@ -137,6 +137,7 @@ CompileAsCpp None MultiThreaded + /Zc:threadSafeInit- No @@ -184,6 +185,7 @@ CompileAsCpp None MultiThreaded + /Zc:threadSafeInit- No From 67d485716fd43bdf66dbc900a5bc1e2048818c53 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Thu, 19 May 2016 22:05:47 -0500 Subject: [PATCH 125/127] Add bacck support for Fusion 2.0 non-Unicode --- Extensions/Template/.gitignore | 16 +- Extensions/Template/Template2015.sln | 29 ++- Extensions/Template/Template2015.vcxproj | 234 +++++++++++++++++++++-- 3 files changed, 240 insertions(+), 39 deletions(-) diff --git a/Extensions/Template/.gitignore b/Extensions/Template/.gitignore index 78484b9..bb2948e 100644 --- a/Extensions/Template/.gitignore +++ b/Extensions/Template/.gitignore @@ -1,16 +1,10 @@ # Template project built files -MFX/* -!MFX/Examples +MFX/Data +MFX/Extensions *.0* -Debug/ -Debug HWA/ -Debug UnicodeHWA/ -Edittime/ -Edittime HWA/ -Edittime UnicodeHWA/ -Runtime/ -Runtime HWA/ -Runtime UnicodeHWA/ +Debug*/ +Edittime*/ +Runtime*/ *.opendb *.VC.db diff --git a/Extensions/Template/Template2015.sln b/Extensions/Template/Template2015.sln index 1a329fb..87a3a6e 100644 --- a/Extensions/Template/Template2015.sln +++ b/Extensions/Template/Template2015.sln @@ -1,23 +1,32 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 +VisualStudioVersion = 14.0.25123.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template", "Template2015.vcxproj", "{87325274-EF61-43D2-85A3-FF7CE13EDD69}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug UnicodeHWA|Fusion-2.5 = Debug UnicodeHWA|Fusion-2.5 - Edittime UnicodeHWA|Fusion-2.5 = Edittime UnicodeHWA|Fusion-2.5 - Runtime UnicodeHWA|Fusion-2.5 = Runtime UnicodeHWA|Fusion-2.5 + Debug|Fusion-2.x ANSI+HWA = Debug|Fusion-2.x ANSI+HWA + Debug|Fusion-2.x Unicode+HWA = Debug|Fusion-2.x Unicode+HWA + Edittime|Fusion-2.x ANSI+HWA = Edittime|Fusion-2.x ANSI+HWA + Edittime|Fusion-2.x Unicode+HWA = Edittime|Fusion-2.x Unicode+HWA + Runtime|Fusion-2.x ANSI+HWA = Runtime|Fusion-2.x ANSI+HWA + Runtime|Fusion-2.x Unicode+HWA = Runtime|Fusion-2.x Unicode+HWA EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug UnicodeHWA|Fusion-2.5.ActiveCfg = Debug UnicodeHWA|Win32 - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug UnicodeHWA|Fusion-2.5.Build.0 = Debug UnicodeHWA|Win32 - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime UnicodeHWA|Fusion-2.5.ActiveCfg = Edittime UnicodeHWA|Win32 - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime UnicodeHWA|Fusion-2.5.Build.0 = Edittime UnicodeHWA|Win32 - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime UnicodeHWA|Fusion-2.5.ActiveCfg = Runtime UnicodeHWA|Win32 - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime UnicodeHWA|Fusion-2.5.Build.0 = Runtime UnicodeHWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug|Fusion-2.x ANSI+HWA.ActiveCfg = Debug ANSI+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug|Fusion-2.x ANSI+HWA.Build.0 = Debug ANSI+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug|Fusion-2.x Unicode+HWA.ActiveCfg = Debug Unicode+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug|Fusion-2.x Unicode+HWA.Build.0 = Debug Unicode+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime|Fusion-2.x ANSI+HWA.ActiveCfg = Edittime ANSI+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime|Fusion-2.x ANSI+HWA.Build.0 = Edittime ANSI+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime|Fusion-2.x Unicode+HWA.ActiveCfg = Edittime Unicode+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime|Fusion-2.x Unicode+HWA.Build.0 = Edittime Unicode+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime|Fusion-2.x ANSI+HWA.ActiveCfg = Runtime ANSI+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime|Fusion-2.x ANSI+HWA.Build.0 = Runtime ANSI+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime|Fusion-2.x Unicode+HWA.ActiveCfg = Runtime Unicode+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime|Fusion-2.x Unicode+HWA.Build.0 = Runtime Unicode+HWA|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Extensions/Template/Template2015.vcxproj b/Extensions/Template/Template2015.vcxproj index 272251d..97f19df 100644 --- a/Extensions/Template/Template2015.vcxproj +++ b/Extensions/Template/Template2015.vcxproj @@ -1,16 +1,28 @@  - - Debug UnicodeHWA + + Debug ANSI+HWA Win32 - - Edittime UnicodeHWA + + Debug Unicode+HWA Win32 - - Runtime UnicodeHWA + + Edittime ANSI+HWA + Win32 + + + Edittime Unicode+HWA + Win32 + + + Runtime ANSI+HWA + Win32 + + + Runtime Unicode+HWA Win32 @@ -21,42 +33,71 @@ 8.1 - + DynamicLibrary true v140 Unicode - + + DynamicLibrary + true + v140 + MultiByte + + DynamicLibrary false v140_xp FastLTCG Unicode - + + DynamicLibrary + false + v140_xp + FastLTCG + MultiByte + + DynamicLibrary false v140_xp FastLTCG Unicode + + DynamicLibrary + false + v140_xp + FastLTCG + MultiByte + - + + + + + + + - + - + + + + - + .mfx false C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset @@ -64,19 +105,39 @@ $(ProjectDir)\MFX\Extensions\Unicode\ false - + + .mfx + false + C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset + true + $(ProjectDir)\MFX\Extensions\Hwa\ + false + + .mfx false $(ProjectDir)\MFX\Extensions\Unicode\ false - + + .mfx + false + $(ProjectDir)\MFX\Extensions\Hwa\ + false + + .mfx false $(ProjectDir)MFX\Data\Runtime\Unicode\ false - + + .mfx + false + $(ProjectDir)MFX\Data\Runtime\Hwa\ + false + + Level3 Disabled @@ -120,7 +181,51 @@ $(IntDir)$(TargetName).bsc - + + + Level3 + Disabled + true + ..\..\Inc;.\; + DEBUG;EDITOR;HWABETA;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;%(PreprocessorDefinitions) + min;max;%(UndefinePreprocessorDefinitions) + true + Guard + true + true + CompileAsCpp + MultiThreadedDebug + true + ProgramDatabase + + + true + $(ProjectDir)\MFX\Extensions\Hwa\$(ProjectName)$(TargetExt) + ..\..\lib\mmfs2.5.lib;%(AdditionalDependencies) + false + ./Ext.def + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).lib + false + $(IntDir)$(TargetName).pgd + Default + Windows + + + ..\AutoInstall.bat "$(TargetPath)" \Extensions\Hwa 2> nul + Automatically installs the extension to Fusion once it is built. + + + EDITOR;%(PreprocessorDefinitions) + + + $(IntDir)$(TargetName).xml + + + $(IntDir)$(TargetName).bsc + + + Level3 MaxSpeed @@ -168,7 +273,55 @@ $(IntDir)$(TargetName).bsc - + + + Level3 + MaxSpeed + true + true + true + ..\..\Inc;.\; + EDITOR;HWABETA;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;%(PreprocessorDefinitions) + min;max;%(UndefinePreprocessorDefinitions) + true + Guard + true + true + CompileAsCpp + None + MultiThreaded + /Zc:threadSafeInit- + + + No + true + true + $(ProjectDir)\MFX\Extensions\Hwa\$(ProjectName)$(TargetExt) + ..\..\lib\mmfs2.5.lib;%(AdditionalDependencies) + false + ./Ext.def + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).lib + false + $(IntDir)$(TargetName).pgd + Default + Windows + + + ..\AutoInstall.bat "$(TargetPath)" \Extensions\Hwa 2> nul + Automatically installs the extension to Fusion once it is built. + + + EDITOR;%(PreprocessorDefinitions) + + + $(IntDir)$(TargetName).xml + + + $(IntDir)$(TargetName).bsc + + + Level3 MaxSpeed @@ -213,6 +366,51 @@ $(IntDir)$(TargetName).bsc + + + Level3 + MaxSpeed + true + true + true + ..\..\Inc;.\; + _NDEBUG;RUN_ONLY;HWABETA;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;%(PreprocessorDefinitions) + min;max;%(UndefinePreprocessorDefinitions) + true + Guard + true + true + CompileAsCpp + None + MultiThreaded + /Zc:threadSafeInit- + + + No + true + true + $(ProjectDir)MFX\Data\Runtime\Hwa\$(ProjectName)$(TargetExt) + ..\..\lib\mmfs2.5.lib;%(AdditionalDependencies) + false + ./Ext.def + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).lib + false + $(IntDir)$(TargetName).pgd + Default + Windows + + + ..\AutoInstall.bat "$(TargetPath)" \Data\Runtime\Hwa 2> nul + Automatically installs the extension to Fusion once it is built. + + + $(IntDir)$(TargetName).xml + + + $(IntDir)$(TargetName).bsc + + From b8936a290fc23c7b1656fdd557d76ec875057ab1 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Thu, 19 May 2016 22:34:28 -0500 Subject: [PATCH 126/127] Use correct libs and add non-HWA variants of non-Unicode Apparently the MMF2 editor will load the Edittime HWA MFX but unless you change the display mode from Standard to one of the hardware accelerated modes, it needs a non-HWA MFX to be able to run the application. Makes sense, but adds so many more build variants... --- Extensions/Template/Template2015.sln | 27 ++- Extensions/Template/Template2015.vcxproj | 204 ++++++++++++++++++++++- 2 files changed, 219 insertions(+), 12 deletions(-) diff --git a/Extensions/Template/Template2015.sln b/Extensions/Template/Template2015.sln index 87a3a6e..210e26a 100644 --- a/Extensions/Template/Template2015.sln +++ b/Extensions/Template/Template2015.sln @@ -7,24 +7,33 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template", "Template2015.vc EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Fusion-2.x ANSI+HWA = Debug|Fusion-2.x ANSI+HWA + Debug|Fusion 2.0 ANSI = Debug|Fusion 2.0 ANSI + Debug|Fusion-2.0 ANSI+HWA = Debug|Fusion-2.0 ANSI+HWA Debug|Fusion-2.x Unicode+HWA = Debug|Fusion-2.x Unicode+HWA - Edittime|Fusion-2.x ANSI+HWA = Edittime|Fusion-2.x ANSI+HWA + Edittime|Fusion 2.0 ANSI = Edittime|Fusion 2.0 ANSI + Edittime|Fusion-2.0 ANSI+HWA = Edittime|Fusion-2.0 ANSI+HWA Edittime|Fusion-2.x Unicode+HWA = Edittime|Fusion-2.x Unicode+HWA - Runtime|Fusion-2.x ANSI+HWA = Runtime|Fusion-2.x ANSI+HWA + Runtime|Fusion 2.0 ANSI = Runtime|Fusion 2.0 ANSI + Runtime|Fusion-2.0 ANSI+HWA = Runtime|Fusion-2.0 ANSI+HWA Runtime|Fusion-2.x Unicode+HWA = Runtime|Fusion-2.x Unicode+HWA EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug|Fusion-2.x ANSI+HWA.ActiveCfg = Debug ANSI+HWA|Win32 - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug|Fusion-2.x ANSI+HWA.Build.0 = Debug ANSI+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug|Fusion 2.0 ANSI.ActiveCfg = Debug ANSI|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug|Fusion 2.0 ANSI.Build.0 = Debug ANSI|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug|Fusion-2.0 ANSI+HWA.ActiveCfg = Debug ANSI+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug|Fusion-2.0 ANSI+HWA.Build.0 = Debug ANSI+HWA|Win32 {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug|Fusion-2.x Unicode+HWA.ActiveCfg = Debug Unicode+HWA|Win32 {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Debug|Fusion-2.x Unicode+HWA.Build.0 = Debug Unicode+HWA|Win32 - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime|Fusion-2.x ANSI+HWA.ActiveCfg = Edittime ANSI+HWA|Win32 - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime|Fusion-2.x ANSI+HWA.Build.0 = Edittime ANSI+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime|Fusion 2.0 ANSI.ActiveCfg = Edittime ANSI|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime|Fusion 2.0 ANSI.Build.0 = Edittime ANSI|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime|Fusion-2.0 ANSI+HWA.ActiveCfg = Edittime ANSI+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime|Fusion-2.0 ANSI+HWA.Build.0 = Edittime ANSI+HWA|Win32 {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime|Fusion-2.x Unicode+HWA.ActiveCfg = Edittime Unicode+HWA|Win32 {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Edittime|Fusion-2.x Unicode+HWA.Build.0 = Edittime Unicode+HWA|Win32 - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime|Fusion-2.x ANSI+HWA.ActiveCfg = Runtime ANSI+HWA|Win32 - {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime|Fusion-2.x ANSI+HWA.Build.0 = Runtime ANSI+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime|Fusion 2.0 ANSI.ActiveCfg = Runtime ANSI|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime|Fusion 2.0 ANSI.Build.0 = Runtime ANSI|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime|Fusion-2.0 ANSI+HWA.ActiveCfg = Runtime ANSI+HWA|Win32 + {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime|Fusion-2.0 ANSI+HWA.Build.0 = Runtime ANSI+HWA|Win32 {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime|Fusion-2.x Unicode+HWA.ActiveCfg = Runtime Unicode+HWA|Win32 {87325274-EF61-43D2-85A3-FF7CE13EDD69}.Runtime|Fusion-2.x Unicode+HWA.Build.0 = Runtime Unicode+HWA|Win32 EndGlobalSection diff --git a/Extensions/Template/Template2015.vcxproj b/Extensions/Template/Template2015.vcxproj index 97f19df..28cf5cb 100644 --- a/Extensions/Template/Template2015.vcxproj +++ b/Extensions/Template/Template2015.vcxproj @@ -5,6 +5,10 @@ Debug ANSI+HWA Win32 + + Debug ANSI + Win32 + Debug Unicode+HWA Win32 @@ -13,6 +17,10 @@ Edittime ANSI+HWA Win32 + + Edittime ANSI + Win32 + Edittime Unicode+HWA Win32 @@ -21,6 +29,10 @@ Runtime ANSI+HWA Win32 + + Runtime ANSI + Win32 + Runtime Unicode+HWA Win32 @@ -45,6 +57,12 @@ v140 MultiByte + + DynamicLibrary + true + v140 + MultiByte + DynamicLibrary false @@ -59,6 +77,13 @@ FastLTCG MultiByte + + DynamicLibrary + false + v140_xp + FastLTCG + MultiByte + DynamicLibrary false @@ -73,6 +98,13 @@ FastLTCG MultiByte + + DynamicLibrary + false + v140_xp + FastLTCG + MultiByte + @@ -84,18 +116,27 @@ + + + + + + + + + .mfx @@ -113,6 +154,14 @@ $(ProjectDir)\MFX\Extensions\Hwa\ false + + .mfx + false + C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset + true + $(ProjectDir)\MFX\Extensions\ + false + .mfx false @@ -125,6 +174,12 @@ $(ProjectDir)\MFX\Extensions\Hwa\ false + + .mfx + false + $(ProjectDir)\MFX\Extensions\ + false + .mfx false @@ -137,6 +192,12 @@ $(ProjectDir)MFX\Data\Runtime\Hwa\ false + + .mfx + false + $(ProjectDir)MFX\Data\Runtime\ + false + Level3 @@ -201,7 +262,7 @@ true $(ProjectDir)\MFX\Extensions\Hwa\$(ProjectName)$(TargetExt) - ..\..\lib\mmfs2.5.lib;%(AdditionalDependencies) + ..\..\lib\mmfs2.0hwa.lib;%(AdditionalDependencies) false ./Ext.def $(IntDir)$(TargetName).pdb @@ -225,6 +286,50 @@ $(IntDir)$(TargetName).bsc + + + Level3 + Disabled + true + ..\..\Inc;.\; + DEBUG;EDITOR;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;%(PreprocessorDefinitions) + min;max;%(UndefinePreprocessorDefinitions) + true + Guard + true + true + CompileAsCpp + MultiThreadedDebug + true + ProgramDatabase + + + true + $(ProjectDir)\MFX\Extensions\$(ProjectName)$(TargetExt) + ..\..\lib\mmfs2.0.lib;%(AdditionalDependencies) + false + ./Ext.def + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).lib + false + $(IntDir)$(TargetName).pgd + Default + Windows + + + ..\AutoInstall.bat "$(TargetPath)" \Extensions 2> nul + Automatically installs the extension to Fusion once it is built. + + + EDITOR;%(PreprocessorDefinitions) + + + $(IntDir)$(TargetName).xml + + + $(IntDir)$(TargetName).bsc + + Level3 @@ -297,7 +402,7 @@ true true $(ProjectDir)\MFX\Extensions\Hwa\$(ProjectName)$(TargetExt) - ..\..\lib\mmfs2.5.lib;%(AdditionalDependencies) + ..\..\lib\mmfs2.0hwa.lib;%(AdditionalDependencies) false ./Ext.def $(IntDir)$(TargetName).pdb @@ -321,6 +426,54 @@ $(IntDir)$(TargetName).bsc + + + Level3 + MaxSpeed + true + true + true + ..\..\Inc;.\; + EDITOR;HWABETA;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;%(PreprocessorDefinitions) + min;max;%(UndefinePreprocessorDefinitions) + true + Guard + true + true + CompileAsCpp + None + MultiThreaded + /Zc:threadSafeInit- + + + No + true + true + $(ProjectDir)\MFX\Extensions\$(ProjectName)$(TargetExt) + ..\..\lib\mmfs2.0.lib;%(AdditionalDependencies) + false + ./Ext.def + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).lib + false + $(IntDir)$(TargetName).pgd + Default + Windows + + + ..\AutoInstall.bat "$(TargetPath)" \Extensions 2> nul + Automatically installs the extension to Fusion once it is built. + + + EDITOR;%(PreprocessorDefinitions) + + + $(IntDir)$(TargetName).xml + + + $(IntDir)$(TargetName).bsc + + Level3 @@ -390,7 +543,7 @@ true true $(ProjectDir)MFX\Data\Runtime\Hwa\$(ProjectName)$(TargetExt) - ..\..\lib\mmfs2.5.lib;%(AdditionalDependencies) + ..\..\lib\mmfs2.0hwa.lib;%(AdditionalDependencies) false ./Ext.def $(IntDir)$(TargetName).pdb @@ -411,6 +564,51 @@ $(IntDir)$(TargetName).bsc + + + Level3 + MaxSpeed + true + true + true + ..\..\Inc;.\; + _NDEBUG;RUN_ONLY;COXSDK;IN_EXT_VERSION2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;%(PreprocessorDefinitions) + min;max;%(UndefinePreprocessorDefinitions) + true + Guard + true + true + CompileAsCpp + None + MultiThreaded + /Zc:threadSafeInit- + + + No + true + true + $(ProjectDir)MFX\Data\Runtime\$(ProjectName)$(TargetExt) + ..\..\lib\mmfs2.0.lib;%(AdditionalDependencies) + false + ./Ext.def + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).lib + false + $(IntDir)$(TargetName).pgd + Default + Windows + + + ..\AutoInstall.bat "$(TargetPath)" \Data\Runtime 2> nul + Automatically installs the extension to Fusion once it is built. + + + $(IntDir)$(TargetName).xml + + + $(IntDir)$(TargetName).bsc + + From ea949f74bd08056864be616045a92411b7de59d5 Mon Sep 17 00:00:00 2001 From: "Nicholas \"LB\" Braden" Date: Sat, 21 May 2016 23:33:50 -0500 Subject: [PATCH 127/127] More Visual Studio files to ignore --- Extensions/Template/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/Extensions/Template/.gitignore b/Extensions/Template/.gitignore index bb2948e..999b623 100644 --- a/Extensions/Template/.gitignore +++ b/Extensions/Template/.gitignore @@ -8,6 +8,7 @@ Runtime*/ *.opendb *.VC.db +.vs/ ################# ## Eclipse