| 1 | #ifndef GAME_EDITOR_EDITOR_ACTIONS_H |
| 2 | #define GAME_EDITOR_EDITOR_ACTIONS_H |
| 3 | |
| 4 | #include "editor_action.h" |
| 5 | |
| 6 | #include <game/editor/mapitems/envelope.h> |
| 7 | #include <game/editor/mapitems/layer_speedup.h> |
| 8 | #include <game/editor/mapitems/layer_switch.h> |
| 9 | #include <game/editor/mapitems/layer_tele.h> |
| 10 | #include <game/editor/mapitems/layer_tiles.h> |
| 11 | #include <game/editor/mapitems/layer_tune.h> |
| 12 | #include <game/editor/quad_art.h> |
| 13 | #include <game/mapitems.h> |
| 14 | |
| 15 | #include <memory> |
| 16 | #include <string> |
| 17 | #include <vector> |
| 18 | |
| 19 | class CEditorMap; |
| 20 | class IEditorEnvelopeReference; |
| 21 | class CLayerGroup; |
| 22 | |
| 23 | class CEditorActionLayerBase : public IEditorAction |
| 24 | { |
| 25 | public: |
| 26 | CEditorActionLayerBase(CEditorMap *pMap, int GroupIndex, int LayerIndex); |
| 27 | |
| 28 | protected: |
| 29 | int m_GroupIndex; |
| 30 | int m_LayerIndex; |
| 31 | std::shared_ptr<CLayer> m_pLayer; |
| 32 | }; |
| 33 | |
| 34 | class CEditorBrushDrawAction : public IEditorAction |
| 35 | { |
| 36 | public: |
| 37 | CEditorBrushDrawAction(CEditorMap *pMap, int Group); |
| 38 | |
| 39 | void Undo() override; |
| 40 | void Redo() override; |
| 41 | bool IsEmpty() override; |
| 42 | |
| 43 | private: |
| 44 | int m_Group; |
| 45 | // m_vTileChanges is a list of changes for each layer that was modified. |
| 46 | // The std::pair is used to pair one layer (index) with its history (2D map). |
| 47 | // EditorTileStateChangeHistory<T> is a 2D map, storing a change item at a specific y,x position. |
| 48 | std::vector<std::pair<int, EditorTileStateChangeHistory<STileStateChange>>> m_vTileChanges; |
| 49 | EditorTileStateChangeHistory<STeleTileStateChange> m_TeleTileChanges; |
| 50 | EditorTileStateChangeHistory<SSpeedupTileStateChange> m_SpeedupTileChanges; |
| 51 | EditorTileStateChangeHistory<SSwitchTileStateChange> m_SwitchTileChanges; |
| 52 | EditorTileStateChangeHistory<STuneTileStateChange> m_TuneTileChanges; |
| 53 | |
| 54 | int m_TotalTilesDrawn; |
| 55 | int m_TotalLayers; |
| 56 | |
| 57 | void Apply(bool Undo); |
| 58 | void SetInfos(); |
| 59 | }; |
| 60 | |
| 61 | // --------------------------------------------------------- |
| 62 | |
| 63 | class CEditorActionQuadPlace : public CEditorActionLayerBase |
| 64 | { |
| 65 | public: |
| 66 | CEditorActionQuadPlace(CEditorMap *pMap, int GroupIndex, int LayerIndex, std::vector<CQuad> &vBrush); |
| 67 | |
| 68 | void Undo() override; |
| 69 | void Redo() override; |
| 70 | |
| 71 | private: |
| 72 | std::vector<CQuad> m_vBrush; |
| 73 | }; |
| 74 | |
| 75 | class CEditorActionSoundPlace : public CEditorActionLayerBase |
| 76 | { |
| 77 | public: |
| 78 | CEditorActionSoundPlace(CEditorMap *pMap, int GroupIndex, int LayerIndex, std::vector<CSoundSource> &vBrush); |
| 79 | |
| 80 | void Undo() override; |
| 81 | void Redo() override; |
| 82 | |
| 83 | private: |
| 84 | std::vector<CSoundSource> m_vBrush; |
| 85 | }; |
| 86 | |
| 87 | // ------------------------------------------------------------- |
| 88 | |
| 89 | class CEditorActionDeleteQuad : public CEditorActionLayerBase |
| 90 | { |
| 91 | public: |
| 92 | CEditorActionDeleteQuad(CEditorMap *pMap, int GroupIndex, int LayerIndex, std::vector<int> const &vQuadsIndices, std::vector<CQuad> const &vDeletedQuads); |
| 93 | |
| 94 | void Undo() override; |
| 95 | void Redo() override; |
| 96 | |
| 97 | private: |
| 98 | std::vector<int> m_vQuadsIndices; |
| 99 | std::vector<CQuad> m_vDeletedQuads; |
| 100 | }; |
| 101 | |
| 102 | // ------------------------------------------------------------- |
| 103 | |
| 104 | class CEditorActionEditQuadPoint : public CEditorActionLayerBase |
| 105 | { |
| 106 | public: |
| 107 | CEditorActionEditQuadPoint(CEditorMap *pMap, int GroupIndex, int LayerIndex, int QuadIndex, std::vector<CPoint> const &vPreviousPoints, std::vector<CPoint> const &vCurrentPoints); |
| 108 | |
| 109 | void Undo() override; |
| 110 | void Redo() override; |
| 111 | |
| 112 | private: |
| 113 | int m_QuadIndex; |
| 114 | std::vector<CPoint> m_vPreviousPoints; |
| 115 | std::vector<CPoint> m_vCurrentPoints; |
| 116 | |
| 117 | void Apply(const std::vector<CPoint> &vValue); |
| 118 | }; |
| 119 | |
| 120 | class CEditorActionEditQuadColor : public CEditorActionLayerBase |
| 121 | { |
| 122 | public: |
| 123 | CEditorActionEditQuadColor(CEditorMap *pMap, int GroupIndex, int LayerIndex, int QuadIndex, std::vector<CColor> const &vPreviousColors, std::vector<CColor> const &vCurrentColors); |
| 124 | |
| 125 | void Undo() override; |
| 126 | void Redo() override; |
| 127 | |
| 128 | private: |
| 129 | int m_QuadIndex; |
| 130 | std::vector<CColor> m_vPreviousColors; |
| 131 | std::vector<CColor> m_vCurrentColors; |
| 132 | |
| 133 | void Apply(std::vector<CColor> &vValue); |
| 134 | }; |
| 135 | |
| 136 | class CEditorActionEditQuadProp : public CEditorActionLayerBase |
| 137 | { |
| 138 | public: |
| 139 | CEditorActionEditQuadProp(CEditorMap *pMap, int GroupIndex, int LayerIndex, int QuadIndex, EQuadProp Prop, int Previous, int Current); |
| 140 | |
| 141 | void Undo() override; |
| 142 | void Redo() override; |
| 143 | |
| 144 | private: |
| 145 | int m_QuadIndex; |
| 146 | EQuadProp m_Prop; |
| 147 | int m_Previous; |
| 148 | int m_Current; |
| 149 | |
| 150 | void Apply(int Value); |
| 151 | }; |
| 152 | |
| 153 | class CEditorActionEditQuadPointProp : public CEditorActionLayerBase |
| 154 | { |
| 155 | public: |
| 156 | CEditorActionEditQuadPointProp(CEditorMap *pMap, int GroupIndex, int LayerIndex, int QuadIndex, int PointIndex, EQuadPointProp Prop, int Previous, int Current); |
| 157 | |
| 158 | void Undo() override; |
| 159 | void Redo() override; |
| 160 | |
| 161 | private: |
| 162 | int m_QuadIndex; |
| 163 | int m_PointIndex; |
| 164 | EQuadPointProp m_Prop; |
| 165 | int m_Previous; |
| 166 | int m_Current; |
| 167 | |
| 168 | void Apply(int Value); |
| 169 | }; |
| 170 | |
| 171 | // ------------------------------------------------------------- |
| 172 | |
| 173 | class CEditorActionBulk : public IEditorAction |
| 174 | { |
| 175 | public: |
| 176 | CEditorActionBulk(CEditorMap *pMap, const std::vector<std::shared_ptr<IEditorAction>> &vpActions, const char *pDisplay = nullptr, bool Reverse = false); |
| 177 | |
| 178 | void Undo() override; |
| 179 | void Redo() override; |
| 180 | |
| 181 | private: |
| 182 | std::vector<std::shared_ptr<IEditorAction>> m_vpActions; |
| 183 | std::string m_Display; |
| 184 | bool m_Reverse; |
| 185 | }; |
| 186 | |
| 187 | // |
| 188 | |
| 189 | class CEditorActionTileChanges : public CEditorActionLayerBase |
| 190 | { |
| 191 | public: |
| 192 | CEditorActionTileChanges(CEditorMap *pMap, int GroupIndex, int LayerIndex, const char *pAction, const EditorTileStateChangeHistory<STileStateChange> &Changes); |
| 193 | |
| 194 | void Undo() override; |
| 195 | void Redo() override; |
| 196 | |
| 197 | private: |
| 198 | EditorTileStateChangeHistory<STileStateChange> m_Changes; |
| 199 | int m_TotalChanges; |
| 200 | |
| 201 | void ComputeInfos(); |
| 202 | void Apply(bool Undo); |
| 203 | }; |
| 204 | |
| 205 | // ------------------------------------------------------------- |
| 206 | |
| 207 | class CEditorActionAddLayer : public CEditorActionLayerBase |
| 208 | { |
| 209 | public: |
| 210 | CEditorActionAddLayer(CEditorMap *pMap, int GroupIndex, int LayerIndex, bool Duplicate = false); |
| 211 | |
| 212 | void Undo() override; |
| 213 | void Redo() override; |
| 214 | |
| 215 | private: |
| 216 | bool m_Duplicate; |
| 217 | }; |
| 218 | |
| 219 | class CEditorActionDeleteLayer : public CEditorActionLayerBase |
| 220 | { |
| 221 | public: |
| 222 | CEditorActionDeleteLayer(CEditorMap *pMap, int GroupIndex, int LayerIndex); |
| 223 | |
| 224 | void Undo() override; |
| 225 | void Redo() override; |
| 226 | }; |
| 227 | |
| 228 | class CEditorActionGroup : public IEditorAction |
| 229 | { |
| 230 | public: |
| 231 | CEditorActionGroup(CEditorMap *pMap, int GroupIndex, bool Delete); |
| 232 | |
| 233 | void Undo() override; |
| 234 | void Redo() override; |
| 235 | |
| 236 | private: |
| 237 | int m_GroupIndex; |
| 238 | bool m_Delete; |
| 239 | std::shared_ptr<CLayerGroup> m_pGroup; |
| 240 | }; |
| 241 | |
| 242 | class CEditorActionEditGroupProp : public IEditorAction |
| 243 | { |
| 244 | public: |
| 245 | CEditorActionEditGroupProp(CEditorMap *pMap, int GroupIndex, EGroupProp Prop, int Previous, int Current); |
| 246 | |
| 247 | void Undo() override; |
| 248 | void Redo() override; |
| 249 | |
| 250 | private: |
| 251 | int m_GroupIndex; |
| 252 | EGroupProp m_Prop; |
| 253 | int m_Previous; |
| 254 | int m_Current; |
| 255 | |
| 256 | void Apply(int Value); |
| 257 | }; |
| 258 | |
| 259 | template<typename E> |
| 260 | class CEditorActionEditLayerPropBase : public CEditorActionLayerBase |
| 261 | { |
| 262 | public: |
| 263 | CEditorActionEditLayerPropBase(CEditorMap *pMap, int GroupIndex, int LayerIndex, E Prop, int Previous, int Current); |
| 264 | |
| 265 | protected: |
| 266 | E m_Prop; |
| 267 | int m_Previous; |
| 268 | int m_Current; |
| 269 | }; |
| 270 | |
| 271 | class CEditorActionEditLayerProp : public CEditorActionEditLayerPropBase<ELayerProp> |
| 272 | { |
| 273 | public: |
| 274 | CEditorActionEditLayerProp(CEditorMap *pMap, int GroupIndex, int LayerIndex, ELayerProp Prop, int Previous, int Current); |
| 275 | |
| 276 | void Undo() override; |
| 277 | void Redo() override; |
| 278 | |
| 279 | private: |
| 280 | void Apply(int Value); |
| 281 | }; |
| 282 | |
| 283 | class CEditorActionEditLayerTilesProp : public CEditorActionEditLayerPropBase<ETilesProp> |
| 284 | { |
| 285 | public: |
| 286 | CEditorActionEditLayerTilesProp(CEditorMap *pMap, int GroupIndex, int LayerIndex, ETilesProp Prop, int Previous, int Current); |
| 287 | |
| 288 | void Undo() override; |
| 289 | void Redo() override; |
| 290 | |
| 291 | void SetSavedLayers(const std::map<int, std::shared_ptr<CLayer>> &SavedLayers); |
| 292 | |
| 293 | private: |
| 294 | std::map<int, std::shared_ptr<CLayer>> m_SavedLayers; |
| 295 | |
| 296 | void RestoreLayer(int Layer, const std::shared_ptr<CLayerTiles> &pLayerTiles); |
| 297 | }; |
| 298 | |
| 299 | class CEditorActionEditLayerQuadsProp : public CEditorActionEditLayerPropBase<ELayerQuadsProp> |
| 300 | { |
| 301 | public: |
| 302 | CEditorActionEditLayerQuadsProp(CEditorMap *pMap, int GroupIndex, int LayerIndex, ELayerQuadsProp Prop, int Previous, int Current); |
| 303 | |
| 304 | void Undo() override; |
| 305 | void Redo() override; |
| 306 | |
| 307 | private: |
| 308 | void Apply(int Value); |
| 309 | }; |
| 310 | |
| 311 | class CEditorActionEditLayersGroupAndOrder : public IEditorAction |
| 312 | { |
| 313 | public: |
| 314 | CEditorActionEditLayersGroupAndOrder(CEditorMap *pMap, int GroupIndex, const std::vector<int> &LayerIndices, int NewGroupIndex, const std::vector<int> &NewLayerIndices); |
| 315 | |
| 316 | void Undo() override; |
| 317 | void Redo() override; |
| 318 | |
| 319 | private: |
| 320 | int m_GroupIndex; |
| 321 | std::vector<int> m_LayerIndices; |
| 322 | int m_NewGroupIndex; |
| 323 | std::vector<int> m_NewLayerIndices; |
| 324 | }; |
| 325 | |
| 326 | // -------------- |
| 327 | |
| 328 | class CEditorActionAppendMap : public IEditorAction |
| 329 | { |
| 330 | public: |
| 331 | struct SPrevInfo |
| 332 | { |
| 333 | int m_Groups; |
| 334 | int m_Images; |
| 335 | int m_Sounds; |
| 336 | int m_Envelopes; |
| 337 | }; |
| 338 | |
| 339 | CEditorActionAppendMap(CEditorMap *pMap, const char *pMapName, const SPrevInfo &PrevInfo, std::vector<int> &vImageIndexMap); |
| 340 | |
| 341 | void Undo() override; |
| 342 | void Redo() override; |
| 343 | |
| 344 | private: |
| 345 | char m_aMapName[IO_MAX_PATH_LENGTH]; |
| 346 | SPrevInfo m_PrevInfo; |
| 347 | std::vector<int> m_vImageIndexMap; |
| 348 | }; |
| 349 | |
| 350 | // -------------- |
| 351 | |
| 352 | class CEditorActionTileArt : public IEditorAction |
| 353 | { |
| 354 | public: |
| 355 | CEditorActionTileArt(CEditorMap *pMap, int PreviousImageCount, const char *pFilename, std::vector<int> &vImageIndexMap); |
| 356 | |
| 357 | void Undo() override; |
| 358 | void Redo() override; |
| 359 | |
| 360 | private: |
| 361 | int m_PreviousImageCount; |
| 362 | char m_aFilename[IO_MAX_PATH_LENGTH]; |
| 363 | std::vector<int> m_vImageIndexMap; |
| 364 | }; |
| 365 | |
| 366 | // -------------- |
| 367 | |
| 368 | class CEditorActionQuadArt : public IEditorAction |
| 369 | { |
| 370 | public: |
| 371 | CEditorActionQuadArt(CEditorMap *pMap, const std::shared_ptr<CLayerGroup> &pGroup); |
| 372 | |
| 373 | void Undo() override; |
| 374 | void Redo() override; |
| 375 | |
| 376 | private: |
| 377 | std::shared_ptr<CLayerGroup> m_pGroup; |
| 378 | }; |
| 379 | |
| 380 | // ---------------------- |
| 381 | |
| 382 | class CEditorCommandAction : public IEditorAction |
| 383 | { |
| 384 | public: |
| 385 | enum class EType |
| 386 | { |
| 387 | DELETE, |
| 388 | ADD, |
| 389 | EDIT, |
| 390 | MOVE_UP, |
| 391 | MOVE_DOWN, |
| 392 | }; |
| 393 | |
| 394 | CEditorCommandAction(CEditorMap *pMap, EType Type, int *pSelectedCommandIndex, int CommandIndex, const char *pPreviousCommand = nullptr, const char *pCurrentCommand = nullptr); |
| 395 | |
| 396 | void Undo() override; |
| 397 | void Redo() override; |
| 398 | |
| 399 | private: |
| 400 | EType m_Type; |
| 401 | int *m_pSelectedCommandIndex; |
| 402 | int m_CommandIndex; |
| 403 | std::string m_PreviousCommand; |
| 404 | std::string m_CurrentCommand; |
| 405 | }; |
| 406 | |
| 407 | // ------------------------------ |
| 408 | |
| 409 | class CEditorActionEnvelopeAdd : public IEditorAction |
| 410 | { |
| 411 | public: |
| 412 | CEditorActionEnvelopeAdd(CEditorMap *pMap, CEnvelope::EType EnvelopeType); |
| 413 | |
| 414 | void Undo() override; |
| 415 | void Redo() override; |
| 416 | |
| 417 | private: |
| 418 | CEnvelope::EType m_EnvelopeType; |
| 419 | int m_PreviousSelectedEnvelope; |
| 420 | }; |
| 421 | |
| 422 | class CEditorActionEnvelopeDelete : public IEditorAction |
| 423 | { |
| 424 | public: |
| 425 | CEditorActionEnvelopeDelete(CEditorMap *pMap, int EnvelopeIndex, std::vector<std::shared_ptr<IEditorEnvelopeReference>> &vpObjectReferences, std::shared_ptr<CEnvelope> &pEnvelope); |
| 426 | |
| 427 | void Undo() override; |
| 428 | void Redo() override; |
| 429 | |
| 430 | private: |
| 431 | int m_EnvelopeIndex; |
| 432 | std::shared_ptr<CEnvelope> m_pEnv; |
| 433 | std::vector<std::shared_ptr<IEditorEnvelopeReference>> m_vpObjectReferences; |
| 434 | }; |
| 435 | |
| 436 | class CEditorActionEnvelopeEdit : public IEditorAction |
| 437 | { |
| 438 | public: |
| 439 | enum class EEditType |
| 440 | { |
| 441 | SYNC, |
| 442 | ORDER, |
| 443 | }; |
| 444 | |
| 445 | CEditorActionEnvelopeEdit(CEditorMap *pMap, int EnvelopeIndex, EEditType EditType, int Previous, int Current); |
| 446 | |
| 447 | void Undo() override; |
| 448 | void Redo() override; |
| 449 | |
| 450 | private: |
| 451 | int m_EnvelopeIndex; |
| 452 | EEditType m_EditType; |
| 453 | int m_Previous; |
| 454 | int m_Current; |
| 455 | }; |
| 456 | |
| 457 | class CEditorActionEnvelopeEditPointTime : public IEditorAction |
| 458 | { |
| 459 | public: |
| 460 | CEditorActionEnvelopeEditPointTime(CEditorMap *pMap, int EnvelopeIndex, int PointIndex, CFixedTime Previous, CFixedTime Current); |
| 461 | |
| 462 | void Undo() override; |
| 463 | void Redo() override; |
| 464 | |
| 465 | private: |
| 466 | int m_EnvelopeIndex; |
| 467 | int m_PointIndex; |
| 468 | CFixedTime m_Previous; |
| 469 | CFixedTime m_Current; |
| 470 | |
| 471 | void Apply(CFixedTime Value); |
| 472 | }; |
| 473 | |
| 474 | class CEditorActionEnvelopeEditPoint : public IEditorAction |
| 475 | { |
| 476 | public: |
| 477 | enum class EEditType |
| 478 | { |
| 479 | VALUE, |
| 480 | CURVE_TYPE, |
| 481 | }; |
| 482 | |
| 483 | CEditorActionEnvelopeEditPoint(CEditorMap *pMap, int EnvelopeIndex, int PointIndex, int Channel, EEditType EditType, int Previous, int Current); |
| 484 | |
| 485 | void Undo() override; |
| 486 | void Redo() override; |
| 487 | |
| 488 | private: |
| 489 | int m_EnvelopeIndex; |
| 490 | int m_PointIndex; |
| 491 | int m_Channel; |
| 492 | EEditType m_EditType; |
| 493 | int m_Previous; |
| 494 | int m_Current; |
| 495 | |
| 496 | void Apply(int Value); |
| 497 | }; |
| 498 | |
| 499 | class CEditorActionAddEnvelopePoint : public IEditorAction |
| 500 | { |
| 501 | public: |
| 502 | CEditorActionAddEnvelopePoint(CEditorMap *pMap, int EnvelopeIndex, CFixedTime Time, ColorRGBA Channels); |
| 503 | |
| 504 | void Undo() override; |
| 505 | void Redo() override; |
| 506 | |
| 507 | private: |
| 508 | int m_EnvelopeIndex; |
| 509 | CFixedTime m_Time; |
| 510 | ColorRGBA m_Channels; |
| 511 | }; |
| 512 | |
| 513 | class CEditorActionDeleteEnvelopePoint : public IEditorAction |
| 514 | { |
| 515 | public: |
| 516 | CEditorActionDeleteEnvelopePoint(CEditorMap *pMap, int EnvelopeIndex, int PointIndex); |
| 517 | |
| 518 | void Undo() override; |
| 519 | void Redo() override; |
| 520 | |
| 521 | private: |
| 522 | int m_EnvelopeIndex; |
| 523 | int m_PointIndex; |
| 524 | CEnvPoint_runtime m_Point; |
| 525 | }; |
| 526 | |
| 527 | class CEditorActionEditEnvelopePointValue : public IEditorAction |
| 528 | { |
| 529 | public: |
| 530 | enum class EType |
| 531 | { |
| 532 | TANGENT_IN, |
| 533 | TANGENT_OUT, |
| 534 | POINT, |
| 535 | }; |
| 536 | |
| 537 | CEditorActionEditEnvelopePointValue(CEditorMap *pMap, int EnvelopeIndex, int PointIndex, int Channel, EType Type, CFixedTime OldTime, int OldValue, CFixedTime NewTime, int NewValue); |
| 538 | |
| 539 | void Undo() override; |
| 540 | void Redo() override; |
| 541 | |
| 542 | private: |
| 543 | int m_EnvelopeIndex; |
| 544 | int m_PointIndex; |
| 545 | int m_Channel; |
| 546 | EType m_Type; |
| 547 | CFixedTime m_OldTime; |
| 548 | int m_OldValue; |
| 549 | CFixedTime m_NewTime; |
| 550 | int m_NewValue; |
| 551 | |
| 552 | void Apply(bool Undo); |
| 553 | }; |
| 554 | |
| 555 | class CEditorActionResetEnvelopePointTangent : public CEditorActionEditEnvelopePointValue |
| 556 | { |
| 557 | public: |
| 558 | CEditorActionResetEnvelopePointTangent(CEditorMap *pMap, int EnvelopeIndex, int PointIndex, int Channel, bool In, CFixedTime OldTime, int OldValue); |
| 559 | }; |
| 560 | |
| 561 | class CEditorActionEditLayerSoundsProp : public CEditorActionEditLayerPropBase<ELayerSoundsProp> |
| 562 | { |
| 563 | public: |
| 564 | CEditorActionEditLayerSoundsProp(CEditorMap *pMap, int GroupIndex, int LayerIndex, ELayerSoundsProp Prop, int Previous, int Current); |
| 565 | |
| 566 | void Undo() override; |
| 567 | void Redo() override; |
| 568 | |
| 569 | private: |
| 570 | void Apply(int Value); |
| 571 | }; |
| 572 | |
| 573 | class CEditorActionDeleteSoundSource : public CEditorActionLayerBase |
| 574 | { |
| 575 | public: |
| 576 | CEditorActionDeleteSoundSource(CEditorMap *pMap, int GroupIndex, int LayerIndex, int SourceIndex); |
| 577 | |
| 578 | void Undo() override; |
| 579 | void Redo() override; |
| 580 | |
| 581 | private: |
| 582 | int m_SourceIndex; |
| 583 | CSoundSource m_Source; |
| 584 | }; |
| 585 | |
| 586 | class CEditorActionEditSoundSourceShape : public CEditorActionLayerBase |
| 587 | { |
| 588 | public: |
| 589 | CEditorActionEditSoundSourceShape(CEditorMap *pMap, int GroupIndex, int LayerIndex, int SourceIndex, int Value); |
| 590 | |
| 591 | void Undo() override; |
| 592 | void Redo() override; |
| 593 | |
| 594 | private: |
| 595 | int m_SourceIndex; |
| 596 | int m_CurrentValue; |
| 597 | |
| 598 | std::vector<int> m_vOriginalValues; |
| 599 | CSoundShape m_SavedShape; |
| 600 | |
| 601 | void Save(); |
| 602 | }; |
| 603 | |
| 604 | class CEditorActionEditSoundSourceProp : public CEditorActionEditLayerPropBase<ESoundProp> |
| 605 | { |
| 606 | public: |
| 607 | CEditorActionEditSoundSourceProp(CEditorMap *pMap, int GroupIndex, int LayerIndex, int SourceIndex, ESoundProp Prop, int Previous, int Current); |
| 608 | |
| 609 | void Undo() override; |
| 610 | void Redo() override; |
| 611 | |
| 612 | private: |
| 613 | int m_SourceIndex; |
| 614 | |
| 615 | void Apply(int Value); |
| 616 | }; |
| 617 | |
| 618 | class CEditorActionEditRectSoundSourceShapeProp : public CEditorActionEditLayerPropBase<ERectangleShapeProp> |
| 619 | { |
| 620 | public: |
| 621 | CEditorActionEditRectSoundSourceShapeProp(CEditorMap *pMap, int GroupIndex, int LayerIndex, int SourceIndex, ERectangleShapeProp Prop, int Previous, int Current); |
| 622 | |
| 623 | void Undo() override; |
| 624 | void Redo() override; |
| 625 | |
| 626 | private: |
| 627 | int m_SourceIndex; |
| 628 | |
| 629 | void Apply(int Value); |
| 630 | }; |
| 631 | |
| 632 | class CEditorActionEditCircleSoundSourceShapeProp : public CEditorActionEditLayerPropBase<ECircleShapeProp> |
| 633 | { |
| 634 | public: |
| 635 | CEditorActionEditCircleSoundSourceShapeProp(CEditorMap *pMap, int GroupIndex, int LayerIndex, int SourceIndex, ECircleShapeProp Prop, int Previous, int Current); |
| 636 | |
| 637 | void Undo() override; |
| 638 | void Redo() override; |
| 639 | |
| 640 | private: |
| 641 | int m_SourceIndex; |
| 642 | |
| 643 | void Apply(int Value); |
| 644 | }; |
| 645 | |
| 646 | class CEditorActionNewEmptySound : public CEditorActionLayerBase |
| 647 | { |
| 648 | public: |
| 649 | CEditorActionNewEmptySound(CEditorMap *pMap, int GroupIndex, int LayerIndex, int x, int y); |
| 650 | |
| 651 | void Undo() override; |
| 652 | void Redo() override; |
| 653 | |
| 654 | private: |
| 655 | int m_X; |
| 656 | int m_Y; |
| 657 | }; |
| 658 | |
| 659 | class CEditorActionNewEmptyQuad : public CEditorActionLayerBase |
| 660 | { |
| 661 | public: |
| 662 | CEditorActionNewEmptyQuad(CEditorMap *pMap, int GroupIndex, int LayerIndex, int x, int y); |
| 663 | |
| 664 | void Undo() override; |
| 665 | void Redo() override; |
| 666 | |
| 667 | private: |
| 668 | int m_X; |
| 669 | int m_Y; |
| 670 | }; |
| 671 | |
| 672 | class CEditorActionNewQuad : public CEditorActionLayerBase |
| 673 | { |
| 674 | public: |
| 675 | CEditorActionNewQuad(CEditorMap *pMap, int GroupIndex, int LayerIndex); |
| 676 | |
| 677 | void Undo() override; |
| 678 | void Redo() override; |
| 679 | |
| 680 | private: |
| 681 | CQuad m_Quad; |
| 682 | }; |
| 683 | |
| 684 | class CEditorActionMoveSoundSource : public CEditorActionLayerBase |
| 685 | { |
| 686 | public: |
| 687 | CEditorActionMoveSoundSource(CEditorMap *pMap, int GroupIndex, int LayerIndex, int SourceIndex, CPoint OriginalPosition, CPoint CurrentPosition); |
| 688 | |
| 689 | void Undo() override; |
| 690 | void Redo() override; |
| 691 | |
| 692 | private: |
| 693 | int m_SourceIndex; |
| 694 | CPoint m_OriginalPosition; |
| 695 | CPoint m_CurrentPosition; |
| 696 | }; |
| 697 | |
| 698 | #endif |
| 699 | |