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