newspr.c

来自「十七种模拟器源代码 非常有用的作课程设计不可缺少的」· C语言 代码 · 共 836 行 · 第 1/5 页

C
836
字号
}                                                                              \                                                                               \static void FUNC##_R180_XY_FX(UINT8 *SPR, int x, int y, ARGS)                  \{                                                                              \   FUNC##_FlipXY(SPR, x,          YOFS## - y, ARGS_1);                         \}                                                                              \                                                                               \static void FUNC##_R270_XY_FX(UINT8 *SPR, int x, int y, ARGS)                  \{                                                                              \   FUNC##_FlipXY(SPR, YOFS## - y, XOFS## - x, ARGS_2);                         \}                                                                              \                                                                               \                                                                               \CMAP_FUNC *FUNC##_Flip_Rot[4];                                                 \                                                                               \static void FUNC##_init_jump_table(void)                                       \{                                                                              \   UINT32 i;                                                                    \                                                                               \   i  = display_cfg.rotate;                                                    \   i ^= display_cfg.flip & 2;                                                  \                                                                               \   if((display_cfg.flip == 0) || (display_cfg.flip == 3)){                     \                                                                               \   switch(i){                                                                  \   case 0:                                                                     \      FUNC##_Flip_Rot[0] = &FUNC##;                                            \      FUNC##_Flip_Rot[1] = &FUNC##_FlipY;                                      \      FUNC##_Flip_Rot[2] = &FUNC##_FlipX;                                      \      FUNC##_Flip_Rot[3] = &FUNC##_FlipXY;                                     \   break;                                                                      \   case 1:                                                                     \      FUNC##_Flip_Rot[0] = &FUNC##_R090;                                       \      FUNC##_Flip_Rot[1] = &FUNC##_R090_Y;                                     \      FUNC##_Flip_Rot[2] = &FUNC##_R090_X;                                     \      FUNC##_Flip_Rot[3] = &FUNC##_R090_XY;                                    \   break;                                                                      \   case 2:                                                                     \      FUNC##_Flip_Rot[0] = &FUNC##_R180;                                       \      FUNC##_Flip_Rot[1] = &FUNC##_R180_Y;                                     \      FUNC##_Flip_Rot[2] = &FUNC##_R180_X;                                     \      FUNC##_Flip_Rot[3] = &FUNC##_R180_XY;                                    \   break;                                                                      \   case 3:                                                                     \      FUNC##_Flip_Rot[0] = &FUNC##_R270;                                       \      FUNC##_Flip_Rot[1] = &FUNC##_R270_Y;                                     \      FUNC##_Flip_Rot[2] = &FUNC##_R270_X;                                     \      FUNC##_Flip_Rot[3] = &FUNC##_R270_XY;                                    \   break;                                                                      \   };                                                                          \                                                                               \   }                                                                           \   else{                                                                       \                                                                               \   switch(i){                                                                  \   case 0:                                                                     \      FUNC##_Flip_Rot[0] = &FUNC##_R000_FX;                                    \      FUNC##_Flip_Rot[1] = &FUNC##_R000_Y_FX;                                  \      FUNC##_Flip_Rot[2] = &FUNC##_R000_X_FX;                                  \      FUNC##_Flip_Rot[3] = &FUNC##_R000_XY_FX;                                 \   break;                                                                      \   case 1:                                                                     \      FUNC##_Flip_Rot[0] = &FUNC##_R090_FX;                                    \      FUNC##_Flip_Rot[1] = &FUNC##_R090_Y_FX;                                  \      FUNC##_Flip_Rot[2] = &FUNC##_R090_X_FX;                                  \      FUNC##_Flip_Rot[3] = &FUNC##_R090_XY_FX;                                 \   break;                                                                      \   case 2:                                                                     \      FUNC##_Flip_Rot[0] = &FUNC##_R180_FX;                                    \      FUNC##_Flip_Rot[1] = &FUNC##_R180_Y_FX;                                  \      FUNC##_Flip_Rot[2] = &FUNC##_R180_X_FX;                                  \      FUNC##_Flip_Rot[3] = &FUNC##_R180_XY_FX;                                 \   break;                                                                      \   case 3:                                                                     \      FUNC##_Flip_Rot[0] = &FUNC##_R270_FX;                                    \      FUNC##_Flip_Rot[1] = &FUNC##_R270_Y_FX;                                  \      FUNC##_Flip_Rot[2] = &FUNC##_R270_X_FX;                                  \      FUNC##_Flip_Rot[3] = &FUNC##_R270_XY_FX;                                 \   break;                                                                      \   };                                                                          \                                                                               \   };                                                                          \};                                                                             \                                                                               \/*rotation support, using jumptables and precomputing as much as we canit's a real macro overload, but rotation overhead is now *very small**/#define MAKE_ROT_JUMP_16( FUNC, XOFS, YOFS )                                   \                                                                               \                                                                               \static void FUNC##_R090(UINT8 *SPR, int x, int y, ARGS)                        \{                                                                              \   FUNC##(SPR, YOFS## - y, x,          ARGS_2);                                \}                                                                              \                                                                               \static void FUNC##_R180(UINT8 *SPR, int x, int y, ARGS)                        \{                                                                              \   FUNC##(SPR, XOFS## - x, YOFS## - y, ARGS_1);                                \}                                                                              \                                                                               \static void FUNC##_R270(UINT8 *SPR, int x, int y, ARGS)                        \{                                                                              \   FUNC##(SPR, y,          XOFS## - x, ARGS_2);                                \}                                                                              \                                                                               \                                                                               \static void FUNC##_R090_X(UINT8 *SPR, int x, int y, ARGS)                      \{                                                                              \   FUNC##_FlipY(SPR, YOFS## - y, x,          ARGS_2);                          \}                                                                              \                                                                               \static void FUNC##_R180_X(UINT8 *SPR, int x, int y, ARGS)                      \{                                                                              \   FUNC##_FlipX(SPR, XOFS## - x, YOFS## - y, ARGS_1);                          \}                                                                              \                                                                               \static void FUNC##_R270_X(UINT8 *SPR, int x, int y, ARGS)                      \{                                                                              \   FUNC##_FlipY(SPR, y,          XOFS## - x, ARGS_2);                          \}                                                                              \                                                                               \                                                                               \static void FUNC##_R090_Y(UINT8 *SPR, int x, int y, ARGS)                      \{                                                                              \   FUNC##_FlipX(SPR, YOFS## - y, x,          ARGS_2);                          \}                                                                              \                                                                               \static void FUNC##_R180_Y(UINT8 *SPR, int x, int y, ARGS)                      \{                                                                              \   FUNC##_FlipY(SPR, XOFS## - x, YOFS## - y, ARGS_1);                          \}                                                                              \                                                                               \static void FUNC##_R270_Y(UINT8 *SPR, int x, int y, ARGS)                      \{                                                                              \   FUNC##_FlipX(SPR, y,          XOFS## - x, ARGS_2);                          \}                                                                              \                                                                               \                                                                               \static void FUNC##_R090_XY(UINT8 *SPR, int x, int y, ARGS)                     \{                                                                              \   FUNC##_FlipXY(SPR, YOFS## - y, x,          ARGS_2);                         \}                                                                              \                                                                               \static void FUNC##_R180_XY(UINT8 *SPR, int x, int y, ARGS)                     \{                                                                              \   FUNC##_FlipXY(SPR, XOFS## - x, YOFS## - y, ARGS_1);                         \}                                                                              \                                                                               \static void FUNC##_R270_XY(UINT8 *SPR, int x, int y, ARGS)                     \{                                                                              \   FUNC##_FlipXY(SPR, y,          XOFS## - x, ARGS_2);                         \}                                                                              \                                                                               \                                                                               \static void FUNC##_R000_FX(UINT8 *SPR, int x, int y, ARGS)                     \{                                                                              \   FUNC##(SPR, XOFS## - x, y,          ARGS_1);                                \}                                                                              \                                                                               \static void FUNC##_R090_FX(UINT8 *SPR, int x, int y, ARGS)                     \{                                                                              \

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?