cepane.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. //---------------------------------------------------------------------------
  2. //
  3. // cepane.cpp - This file contains the code for the VFX Pane Element
  4. //
  5. //---------------------------------------------------------------------------//
  6. // Copyright (C) Microsoft Corporation. All rights reserved. //
  7. //===========================================================================//
  8. //---------------------------------------------------------------------------
  9. // Include files
  10. #ifndef CEPANE_H
  11. #include "cepane.h"
  12. #endif
  13. #ifndef VPORT_H
  14. #include "vport.h"
  15. #endif
  16. #ifndef VFX_H
  17. #include "vfx.h"
  18. #endif
  19. //---------------------------------------------------------------------------
  20. // Static Globals
  21. #define SPRITE_MAX_X 320
  22. #define SPRITE_MAX_Y 240
  23. #define SPRITE_MIDDLE_X 160
  24. #define SPRITE_MIDDLE_Y 120
  25. //---------------------------------------------------------------------------
  26. PaneElement::PaneElement (PANE *_shapePane, long _x, long _y, long _midx, long _midy, long _SizeX, long _SizeY) : Element(-_y)
  27. {
  28. shapePane = _shapePane;
  29. x = _x;
  30. y = _y;
  31. midx = _midx;
  32. midy = _midy;
  33. SizeX = _SizeX;
  34. SizeY = _SizeY;
  35. }
  36. extern long DrawTransparent( PANE *pane, WINDOW *texture, int X, int Y, int Width, int Height );
  37. //---------------------------------------------------------------------------
  38. void PaneElement::draw (void)
  39. {
  40. DrawTransparent( globalPane, shapePane->window, x - midx, y - midy, SizeX, SizeY );
  41. }
  42. //---------------------------------------------------------------------------
  43. extern void AG_shape_draw (PANE *pane, void *shape_table,LONG shape_number, LONG hotX, LONG hotY);
  44. extern void AG_shape_translate_draw (PANE *pane, void *shape_table,LONG shape_number, LONG hotX, LONG hotY);
  45. extern void AG_shape_lookaside( UBYTE *table );
  46. //---------------------------------------------------------------------------
  47. // Static Globals
  48. //---------------------------------------------------------------------------
  49. DeltaElement::DeltaElement (MemoryPtr _shape, long _x, long _y, long frame, bool rev, MemoryPtr fTable, bool noScale, bool upScale) : Element(-_y)
  50. {
  51. shapeTable = _shape;
  52. x = _x;
  53. y = _y;
  54. frameNum = frame;
  55. reverse = rev;
  56. fadeTable = fTable;
  57. noScaleDraw = noScale;
  58. scaleUp = upScale;
  59. //-------------------------------------
  60. // Integrity Check here.
  61. #ifdef _DEBUG
  62. long result = VFX_shape_count(shapeTable);
  63. if (result <= frameNum)
  64. {
  65. frameNum = result-1;
  66. }
  67. result = VFX_shape_bounds(shapeTable,frameNum);
  68. long xMax = result>>16;
  69. long yMax = result & 0x0000ffff;
  70. #define MAX_X 360
  71. #define MAX_Y 360
  72. if ((yMax * xMax) >= (MAX_Y * MAX_X))
  73. {
  74. return;
  75. }
  76. #endif
  77. }
  78. //---------------------------------------------------------------------------
  79. void DeltaElement::draw (void)
  80. {
  81. {
  82. //----------------------------------------------------------------
  83. // Check if shape is actually valid.
  84. if ((*(int*)shapeTable!=*(int*)"1.10"))
  85. return;
  86. //----------------------------------------------------
  87. // DEBUG TEMP Until all are correct delta shapes!!!!!!
  88. long result = VFX_shape_count(shapeTable);
  89. if (result <= (frameNum+1))
  90. frameNum = result - 2;
  91. if (!fadeTable)
  92. {
  93. AG_shape_draw(globalPane,shapeTable,0,x,y); //KeyFrame First!!
  94. AG_shape_draw(globalPane,shapeTable,frameNum+1,x,y);
  95. }
  96. else
  97. {
  98. AG_shape_lookaside(fadeTable);
  99. AG_shape_translate_draw(globalPane,shapeTable,0,x,y); //KeyFrame First!!
  100. AG_shape_translate_draw(globalPane,shapeTable,frameNum+1,x,y);
  101. }
  102. }
  103. }