#ifndef INCLUDED_MESSAGES #define INCLUDED_MESSAGES #ifndef MESSAGES_SKIP_SETUP #include "MessagesSetup.h" #endif #include #include // TODO: organisation, documentation, etc ////////////////////////////////////////////////////////////////////////// MESSAGE(Init, ((bool, initsimulation)) // whether to initialise simulation/game-specific objects ); MESSAGE(Shutdown, ); struct eRenderView { enum renderViews { NONE, GAME, ACTOR }; }; MESSAGE(RenderEnable, ((int, view)) // eRenderView ); // SetViewParam: used for hints to the renderer, e.g. to set wireframe mode; // unrecognised param names are ignored MESSAGE(SetViewParamB, ((int, view)) // eRenderView ((std::wstring, name)) ((bool, value)) ); MESSAGE(SetViewParamC, ((int, view)) // eRenderView ((std::wstring, name)) ((Colour, value)) ); MESSAGE(JavaScript, ((std::wstring, command)) ); ////////////////////////////////////////////////////////////////////////// MESSAGE(SimStateSave, ((std::wstring, label)) // named slot to store saved data ((bool, onlyentities)) // if true, ignore nonentities ); MESSAGE(SimStateRestore, ((std::wstring, label)) // named slot to find saved data ); MESSAGE(SimPlay, ((float, speed)) // 0 for pause, 1 for normal speed ); ////////////////////////////////////////////////////////////////////////// QUERY(Ping, , ); ////////////////////////////////////////////////////////////////////////// MESSAGE(SetCanvas, ((void*, canvas)) ); MESSAGE(ResizeScreen, ((int, width)) ((int, height)) ); ////////////////////////////////////////////////////////////////////////// MESSAGE(GenerateMap, ((int, size)) // size in number of patches ); MESSAGE(LoadMap, ((std::wstring, filename)) ); MESSAGE(SaveMap, ((std::wstring, filename)) ); ////////////////////////////////////////////////////////////////////////// MESSAGE(RenderStyle, ((bool, wireframe)) ); MESSAGE(MessageTrace, ((bool, enable)) ); MESSAGE(Screenshot, ((int, tiles)) // the final image will be (640*tiles)x(480*tiles) ); struct sCinemaRecordCB { unsigned char* buffer; }; SHAREABLE_STRUCT(sCinemaRecordCB); QUERY(CinemaRecord, ((std::wstring, path)) ((int, framerate)) ((float, duration)) ((int, width)) ((int, height)) ((Callback, cb)) , ); ////////////////////////////////////////////////////////////////////////// MESSAGE(Brush, ((int, width)) // number of vertices ((int, height)) ((std::vector, data)) // width*height array ); MESSAGE(BrushPreview, ((bool, enable)) ((Position, pos)) // only used if enable==true ); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// QUERY(GetTerrainGroups, , // no inputs ((std::vector, groupnames)) ); struct sTerrainGroupPreview { Shareable name; Shareable > imagedata; // RGB*size*size }; SHAREABLE_STRUCT(sTerrainGroupPreview); QUERY(GetTerrainGroupPreviews, ((std::wstring, groupname)) ((int, imagewidth)) ((int, imageheight)) , ((std::vector, previews)) ); ////////////////////////////////////////////////////////////////////////// struct sObjectsListItem { Shareable id; Shareable name; Shareable type; // 0 = entity, 1 = actor }; SHAREABLE_STRUCT(sObjectsListItem); QUERY(GetObjectsList, , // no inputs ((std::vector, objects)) // sorted by .name ); struct sObjectSettings { Shareable player; Shareable > selections; // Some settings are immutable and therefore are ignored (and should be left // empty) when passed from the editor to the game: Shareable > > variantgroups; }; SHAREABLE_STRUCT(sObjectSettings); // Preview object in the game world - creates a temporary unit at the given // position, and removes it when the preview is next changed MESSAGE(ObjectPreview, ((std::wstring, id)) // or empty string => disable ((sObjectSettings, settings)) ((Position, pos)) ((bool, usetarget)) // true => use 'target' for orientation; false => use 'angle' ((Position, target)) ((float, angle)) ); COMMAND(CreateObject, NOMERGE, ((std::wstring, id)) ((sObjectSettings, settings)) ((Position, pos)) ((bool, usetarget)) // true => use 'target' for orientation; false => use 'angle' ((Position, target)) ((float, angle)) ); // Set an actor to be previewed on its own (i.e. without the game world). // (Use RenderEnable to make it visible.) MESSAGE(SetActorViewer, ((std::wstring, id)) ((std::wstring, animation)) ((float, speed)) ((bool, flushcache)) // true => unload all actor files before starting the preview (because we don't have proper hotloading yet) ); ////////////////////////////////////////////////////////////////////////// QUERY(Exit,,); // no inputs nor outputs ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// struct eScrollConstantDir { enum { FORWARDS, BACKWARDS, LEFT, RIGHT }; }; MESSAGE(ScrollConstant, ((int, view)) // eRenderView ((int, dir)) // eScrollConstantDir ((float, speed)) // set speed 0.0f to stop scrolling ); struct eScrollType { enum { FROM, TO }; }; MESSAGE(Scroll, // for scrolling by dragging the mouse FROM somewhere TO elsewhere ((int, view)) // eRenderView ((int, type)) // eScrollType ((Position, pos)) ); MESSAGE(SmoothZoom, ((int, view)) // eRenderView ((float, amount)) ); struct eRotateAroundType { enum { FROM, TO }; }; MESSAGE(RotateAround, ((int, view)) // eRenderView ((int, type)) // eRotateAroundType ((Position, pos)) ); MESSAGE(LookAt, ((int, view)) // eRenderView ((Position, pos)) ((Position, target)) ); ////////////////////////////////////////////////////////////////////////// struct sEnvironmentSettings { Shareable waterheight; // range 0..1 corresponds to min..max terrain height; out-of-bounds values allowed Shareable watershininess; // range ??? Shareable waterwaviness; // range ??? Shareable watermurkiness; // range ??? Shareable watercolour; Shareable watertint; Shareable waterreflectiontint; Shareable waterreflectiontintstrength; // range ??? Shareable sunrotation; // range -pi..+pi Shareable sunelevation; // range -pi/2 .. +pi/2 Shareable skyset; Shareable suncolour; Shareable terraincolour; Shareable unitcolour; }; SHAREABLE_STRUCT(sEnvironmentSettings); QUERY(GetEnvironmentSettings, // no inputs , ((sEnvironmentSettings, settings)) ); COMMAND(SetEnvironmentSettings, MERGE, ((sEnvironmentSettings, settings)) ); QUERY(GetSkySets, // no inputs , ((std::vector, skysets)) ); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// COMMAND(AlterElevation, MERGE, ((Position, pos)) ((float, amount)) ); COMMAND(FlattenElevation, MERGE, ((Position, pos)) ((float, amount)) ); struct ePaintTerrainPriority { enum { HIGH, LOW }; }; COMMAND(PaintTerrain, MERGE, ((Position, pos)) ((std::wstring, texture)) ((int, priority)) // ePaintTerrainPriority ); ////////////////////////////////////////////////////////////////////////// QUERY(PickObject, ((Position, pos)) , ((ObjectID, id)) ((int, offsetx)) // offset of object centre from input position ((int, offsety)) // ); COMMAND(MoveObject, MERGE, ((ObjectID, id)) ((Position, pos)) ); COMMAND(RotateObject, MERGE, ((ObjectID, id)) ((bool, usetarget)) // true => use 'target' for orientation; false => use 'angle' ((Position, target)) ((float, angle)) ); COMMAND(DeleteObject, NOMERGE, ((ObjectID, id)) ); MESSAGE(SetSelectionPreview, ((std::vector, ids)) ); QUERY(GetObjectSettings, ((int, view)) // eRenderView ((ObjectID, id)) , ((sObjectSettings, settings)) ); COMMAND(SetObjectSettings, NOMERGE, ((int, view)) // eRenderView ((ObjectID, id)) ((sObjectSettings, settings)) ); ////////////////////////////////////////////////////////////////////////// QUERY(GetCinemaPaths, , // no inputs ((std::vector , paths)) ); QUERY(GetCameraInfo, , ((AtlasMessage::sCameraInfo, info)) ); COMMAND(SetCinemaPaths, NOMERGE, ((std::vector, paths)) ); MESSAGE(CinemaEvent, ((std::wstring, path)) ((int, mode)) ((float, t)) ((bool, drawCurrent)) ((bool, lines)) ); ////////////////////////////////////////////////////////////////////////// enum eTriggerListType { CINEMA_LIST, TRIGGER_LIST, TRIG_GROUP_LIST //list of trigger groups // [Eventually include things like entities and areas as the editor progresses...] }; QUERY(GetTriggerData, , //no inputs ((std::vector, groups)) ((std::vector, conditions)) ((std::vector, effects)) ); QUERY(GetTriggerChoices, ((std::wstring, name)), ((std::vector, choices)) ((std::vector, translations)) ); COMMAND(SetAllTriggers, NOMERGE, ((std::vector, groups)) ); QUERY(GetWorldPosition, ((int, x)) ((int, y)), ((Position, position)) ); MESSAGE(TriggerToggleSelector, ((bool, enable)) ((Position, position)) ); #ifndef MESSAGES_SKIP_SETUP #include "MessagesSetup.h" #endif #endif // INCLUDED_MESSAGES