• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PAL_XY函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PAL_XY函数的典型用法代码示例。如果您正苦于以下问题:C++ PAL_XY函数的具体用法?C++ PAL_XY怎么用?C++ PAL_XY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PAL_XY函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: PAL_EndDialog

VOID
PAL_EndDialog(
   VOID
)
/*++
  Purpose:

    Ends a dialog.

  Parameters:

    None.

  Return value:

    None.

--*/
{
   PAL_ClearDialog(TRUE);

   //
   // Set some default parameters, as there are some parts of script
   // which doesn't have a "start dialog" instruction before showing the dialog.
   //
   g_TextLib.posDialogTitle = PAL_XY(12, 8);
   g_TextLib.posDialogText = PAL_XY(44, 26);
   g_TextLib.bCurrentFontColor = FONT_COLOR_DEFAULT;
   g_TextLib.bDialogPosition = kDialogUpper;
   g_TextLib.fUserSkip = FALSE;
   g_TextLib.fPlayingRNG = FALSE;
}
开发者ID:kkspeed,项目名称:sdlpal,代码行数:32,代码来源:text.c


示例2: PAL_ClearDialog

VOID
PAL_ClearDialog(
   BOOL       fWaitForKey
)
/*++
  Purpose:

    Clear the state of the dialog.

  Parameters:

    [IN]  fWaitForKey - whether wait for any key or not.

  Return value:

    None.

--*/
{
   if (g_TextLib.nCurrentDialogLine > 0 && fWaitForKey)
   {
      PAL_DialogWaitForKey();
   }

   g_TextLib.nCurrentDialogLine = 0;

   if (g_TextLib.bDialogPosition == kDialogCenter)
   {
      g_TextLib.posDialogTitle = PAL_XY(12, 8);
      g_TextLib.posDialogText = PAL_XY(44, 26);
      g_TextLib.bCurrentFontColor = FONT_COLOR_DEFAULT;
      g_TextLib.bDialogPosition = kDialogUpper;
   }
}
开发者ID:kkspeed,项目名称:sdlpal,代码行数:34,代码来源:text.c


示例3: PAL_InventoryMenu

static VOID
PAL_InventoryMenu(
   VOID
)
/*++
  Purpose:

    Show the inventory menu.

  Parameters:

    None.

  Return value:

    None.

--*/
{
   static WORD      w = 0;
   const SDL_Rect   rect = {30, 60, 75, 60};

   MENUITEM        rgMenuItem[2] =
   {
      // value  label                     enabled   pos
      { 1,      INVMENU_LABEL_USE,        TRUE,     PAL_XY(43, 73) },
      { 2,      INVMENU_LABEL_EQUIP,      TRUE,     PAL_XY(43, 73 + 18) },
   };

   PAL_CreateBox(PAL_XY(30, 60), 1, 1, 0, FALSE);
   VIDEO_UpdateScreen(&rect);

   w = PAL_ReadMenu(NULL, rgMenuItem, 2, w - 1, MENUITEM_COLOR);

   switch (w)
   {
   case 1:
      PAL_GameUseItem();
      break;

   case 2:
      PAL_GameEquipItem();
      break;
   }
}
开发者ID:HappyZ,项目名称:ChinesePaladinPort,代码行数:45,代码来源:uigame.c


示例4: PAL_LoadDefaultGame

/*++
 Load the default game data.
 --*/
static VOID PAL_LoadDefaultGame(void)
{
   const GAMEDATA    *p = &gpGlobals->g;
   UINT32             i;

   //
   // Load the default data from the game data files.
   //
   LOAD_DATA(p->lprgEventObject, p->nEventObject * sizeof(EVENTOBJECT),
      0, gpGlobals->f.fpSSS);
   PAL_MKFReadChunk((LPBYTE)(p->rgScene), sizeof(p->rgScene), 1, gpGlobals->f.fpSSS);
   DO_BYTESWAP(p->rgScene, sizeof(p->rgScene));
   PAL_MKFReadChunk((LPBYTE)(p->rgObject), sizeof(p->rgObject), 2, gpGlobals->f.fpSSS);
   DO_BYTESWAP(p->rgObject, sizeof(p->rgObject));

   PAL_MKFReadChunk((LPBYTE)(&(p->PlayerRoles)), sizeof(PLAYERROLES),
      3, gpGlobals->f.fpDATA);
   DO_BYTESWAP(&(p->PlayerRoles), sizeof(PLAYERROLES));

   //
   // Set some other default data.
   //
   gpGlobals->dwCash = 0;
   gpGlobals->wNumMusic = 0;
   gpGlobals->wNumPalette = 0;
   gpGlobals->wNumScene = 1;
   gpGlobals->wCollectValue = 0;
   gpGlobals->fNightPalette = FALSE;
   gpGlobals->wMaxPartyMemberIndex = 0;
   gpGlobals->viewport = PAL_XY(0, 0);
   gpGlobals->wLayer = 0;
   gpGlobals->wChaseRange = 1;
#ifndef PAL_CLASSIC
   gpGlobals->bBattleSpeed = 2;
#endif

   memset(gpGlobals->rgInventory, 0, sizeof(gpGlobals->rgInventory));
   memset(gpGlobals->rgPoisonStatus, 0, sizeof(gpGlobals->rgPoisonStatus));
   memset(gpGlobals->rgParty, 0, sizeof(gpGlobals->rgParty));
   memset(gpGlobals->rgTrail, 0, sizeof(gpGlobals->rgTrail));
   memset(&(gpGlobals->Exp), 0, sizeof(gpGlobals->Exp));

   for (i = 0; i < MAX_PLAYER_ROLES; i++)
   {
      gpGlobals->Exp.rgPrimaryExp[i].wLevel = p->PlayerRoles.rgwLevel[i];
      gpGlobals->Exp.rgHealthExp[i].wLevel = p->PlayerRoles.rgwLevel[i];
      gpGlobals->Exp.rgMagicExp[i].wLevel = p->PlayerRoles.rgwLevel[i];
      gpGlobals->Exp.rgAttackExp[i].wLevel = p->PlayerRoles.rgwLevel[i];
      gpGlobals->Exp.rgMagicPowerExp[i].wLevel = p->PlayerRoles.rgwLevel[i];
      gpGlobals->Exp.rgDefenseExp[i].wLevel = p->PlayerRoles.rgwLevel[i];
      gpGlobals->Exp.rgDexterityExp[i].wLevel = p->PlayerRoles.rgwLevel[i];
      gpGlobals->Exp.rgFleeExp[i].wLevel = p->PlayerRoles.rgwLevel[i];
   }

   gpGlobals->fEnteringScene = TRUE;
}
开发者ID:neonmori,项目名称:sdlpalX,代码行数:59,代码来源:global.c


示例5: PAL_ShowCash

LPBOX
PAL_ShowCash(
   DWORD      dwCash
)
/*++
  Purpose:

    Show the cash amount at the top left corner of the screen.

  Parameters:

    [IN]  dwCash - amount of cash.

  Return value:

    pointer to the saved screen part.

--*/
{
   LPBOX     lpBox;

   //
   // Create the box.
   //
   lpBox = PAL_CreateSingleLineBox(PAL_XY(0, 0), 5, TRUE);
   if (lpBox == NULL)
   {
      return NULL;
   }

   //
   // Draw the text label.
   //
   PAL_DrawText(PAL_GetWord(CASH_LABEL), PAL_XY(10, 10), 0, FALSE, FALSE);

   //
   // Draw the cash amount.
   //
   PAL_DrawNumber(dwCash, 6, PAL_XY(49, 14), kNumColorYellow, kNumAlignRight);

   return lpBox;
}
开发者ID:HappyZ,项目名称:ChinesePaladinPort,代码行数:42,代码来源:uigame.c


示例6: PAL_BattleSpeedMenu

static VOID
PAL_BattleSpeedMenu(
   VOID
)
/*++
  Purpose:

    Show the Battle Speed selection box.

  Parameters:

    None.

  Return value:

    None.

--*/
{
   LPBOX           lpBox;
   WORD            wReturnValue;
   const SDL_Rect  rect = {131, 100, 165, 50};

   MENUITEM        rgMenuItem[5] = {
      { 1,   BATTLESPEEDMENU_LABEL_1,       TRUE,   PAL_XY(145, 110) },
      { 2,   BATTLESPEEDMENU_LABEL_2,       TRUE,   PAL_XY(170, 110) },
      { 3,   BATTLESPEEDMENU_LABEL_3,       TRUE,   PAL_XY(195, 110) },
      { 4,   BATTLESPEEDMENU_LABEL_4,       TRUE,   PAL_XY(220, 110) },
      { 5,   BATTLESPEEDMENU_LABEL_5,       TRUE,   PAL_XY(245, 110) },
   };

   //
   // Create the boxes
   //
   lpBox = PAL_CreateSingleLineBox(PAL_XY(131, 100), 8, TRUE);
   VIDEO_UpdateScreen(&rect);

   //
   // Activate the menu
   //
   wReturnValue = PAL_ReadMenu(NULL, rgMenuItem, 5, gpGlobals->bBattleSpeed - 1,
      MENUITEM_COLOR);

   //
   // Delete the boxes
   //
   PAL_DeleteBox(lpBox);

   VIDEO_UpdateScreen(&rect);

   if (wReturnValue != MENUITEM_VALUE_CANCELLED)
   {
      gpGlobals->bBattleSpeed = wReturnValue;
   }
}
开发者ID:HappyZ,项目名称:ChinesePaladinPort,代码行数:55,代码来源:uigame.c


示例7: PAL_BattleEnemyEscape

/*++
 Enemy flee the battle.
 --*/
VOID PAL_BattleEnemyEscape(void)
{
    int j, x, y, w;
    BOOL f = TRUE;
    
    SOUND_Play(45);
    
    //
    // Show the animation
    //
    while (f)
    {
        f = FALSE;
        
        for (j = 0; j <= g_Battle.wMaxEnemyIndex; j++)
        {
            if (g_Battle.rgEnemy[j].wObjectID == 0)
            {
                continue;
            }
            
            x = PAL_X(g_Battle.rgEnemy[j].pos) - 5;
            y = PAL_Y(g_Battle.rgEnemy[j].pos);
            
            g_Battle.rgEnemy[j].pos = PAL_XY(x, y);
            
            w = PAL_RLEGetWidth(PAL_SpriteGetFrame(g_Battle.rgEnemy[j].lpSprite, 0));
            
            if (x + w > 0)
            {
                f = TRUE;
            }
        }
        
        PAL_BattleMakeScene();
        SDL_BlitSurface(g_Battle.lpSceneBuf, NULL, gpScreen, NULL);
        VIDEO_UpdateScreen(NULL);
        
        UTIL_Delay(10);
    }
    
    UTIL_Delay(500);
    g_Battle.BattleResult = kBattleResultTerminated;
}
开发者ID:neonmori,项目名称:sdlpalX,代码行数:47,代码来源:battle.c


示例8: PAL_BattleUIShowNum

VOID
PAL_BattleUIShowNum(
   WORD           wNum,
   PAL_POS        pos,
   NUMCOLOR       color
)
/*++
  Purpose:

    Show a number on battle screen (indicates HP/MP change).

  Parameters:

    [IN]  wNum - number to be shown.

    [IN]  pos - position of the number on the screen.

    [IN]  color - color of the number.

  Return value:

    None.

--*/
{
   int     i;

   for (i = 0; i < BATTLEUI_MAX_SHOWNUM; i++)
   {
      if (g_Battle.UI.rgShowNum[i].wNum == 0)
      {
         g_Battle.UI.rgShowNum[i].wNum = wNum;
         g_Battle.UI.rgShowNum[i].pos = PAL_XY(PAL_X(pos) - 15, PAL_Y(pos));
         g_Battle.UI.rgShowNum[i].color = color;
         g_Battle.UI.rgShowNum[i].dwTime = SDL_GetTicks();

         break;
      }
   }
}
开发者ID:AHEADer,项目名称:pa,代码行数:40,代码来源:uibattle.c


示例9: PAL_AddSpriteToDraw

static VOID
PAL_AddSpriteToDraw(
   LPCBITMAPRLE     lpSpriteFrame,
   int              x,
   int              y,
   int              iLayer
)
/*++
   Purpose:

     Add a sprite to our list of drawing.

   Parameters:

     [IN]  lpSpriteFrame - the bitmap of the sprite frame.

     [IN]  x - the X coordinate on the screen.

     [IN]  y - the Y coordinate on the screen.

     [IN]  iLayer - the layer of the sprite.

   Return value:

     None.

--*/
{
   assert(g_nSpriteToDraw < MAX_SPRITE_TO_DRAW);

   g_rgSpriteToDraw[g_nSpriteToDraw].lpSpriteFrame = lpSpriteFrame;
   g_rgSpriteToDraw[g_nSpriteToDraw].pos = PAL_XY(x, y);
   g_rgSpriteToDraw[g_nSpriteToDraw].iLayer = iLayer;

   g_nSpriteToDraw++;
}
开发者ID:ashurasunny,项目名称:PA,代码行数:36,代码来源:scene.c


示例10: PAL_SellMenu_OnItemChange

static VOID
PAL_SellMenu_OnItemChange(
   WORD         wCurrentItem
)
/*++
  Purpose:

    Callback function which is called when player selected another item
    in the sell item menu.

  Parameters:

    [IN]  wCurrentItem - current item on the menu, indicates the object ID of
                         the currently selected item.

  Return value:

    None.

--*/
{
   //
   // Draw the cash amount
   //
   PAL_CreateSingleLineBox(PAL_XY(100, 150), 5, FALSE);
   PAL_DrawText(PAL_GetWord(CASH_LABEL), PAL_XY(110, 160), 0, FALSE, FALSE);
   PAL_DrawNumber(gpGlobals->dwCash, 6, PAL_XY(149, 164), kNumColorYellow, kNumAlignRight);

   //
   // Draw the price
   //
   PAL_CreateSingleLineBox(PAL_XY(220, 150), 5, FALSE);

   if (gpGlobals->g.rgObject[wCurrentItem].item.wFlags & kItemFlagSellable)
   {
      PAL_DrawText(PAL_GetWord(SELLMENU_LABEL_PRICE), PAL_XY(230, 160), 0, FALSE, FALSE);
      PAL_DrawNumber(gpGlobals->g.rgObject[wCurrentItem].item.wPrice / 2, 6,
         PAL_XY(269, 164), kNumColorYellow, kNumAlignRight);
   }
}
开发者ID:HappyZ,项目名称:ChinesePaladinPort,代码行数:40,代码来源:uigame.c


示例11: PAL_DrawText

VOID
PAL_DrawText(
   LPCSTR     lpszText,
   PAL_POS    pos,
   BYTE       bColor,
   BOOL       fShadow,
   BOOL       fUpdate
)
/*++
  Purpose:

    Draw text on the screen.

  Parameters:

    [IN]  lpszText - the text to be drawn.

    [IN]  pos - Position of the text.

    [IN]  bColor - Color of the text.

    [IN]  fShadow - TRUE if the text is shadowed or not.

    [IN]  fUpdate - TRUE if update the screen area.

  Return value:

    None.

--*/
{
   SDL_Rect   rect, urect;
   WORD       wChar;

   rect.x = PAL_X(pos);
   rect.y = PAL_Y(pos);

   urect.x = rect.x;
   urect.y = rect.y;
   urect.h = 16;
   urect.w = 0;

   while (*lpszText)
   {
      //
      // Draw the character
      //
      if (*lpszText & 0x80)
      {
         //
         // BIG-5 Chinese Character
         //
         wChar = SWAP16(((LPBYTE)lpszText)[0] | (((LPBYTE)lpszText)[1] << 8));
         if (fShadow)
         {
            PAL_DrawCharOnSurface(wChar, gpScreen, PAL_XY(rect.x + 1, rect.y + 1), 0);
            PAL_DrawCharOnSurface(wChar, gpScreen, PAL_XY(rect.x + 1, rect.y), 0);
         }
         PAL_DrawCharOnSurface(wChar, gpScreen, PAL_XY(rect.x, rect.y), bColor);
         lpszText += 2;
         rect.x += 16;
         urect.w += 16;
      }
      else
      {
         //
         // ASCII character
         //
         if (fShadow)
         {
            PAL_DrawASCIICharOnSurface(*lpszText, gpScreen, PAL_XY(rect.x + 1, rect.y + 1), 0);
            PAL_DrawASCIICharOnSurface(*lpszText, gpScreen, PAL_XY(rect.x + 1, rect.y), 0);
         }
         PAL_DrawASCIICharOnSurface(*lpszText, gpScreen, PAL_XY(rect.x, rect.y), bColor);
         lpszText++;
         rect.x += 8;
         urect.w += 8;
      }
   }

   //
   // Update the screen area
   //
   if (fUpdate && urect.w > 0)
   {
      VIDEO_UpdateScreen(&urect);
   }
}
开发者ID:kkspeed,项目名称:sdlpal,代码行数:88,代码来源:text.c


示例12: PAL_BattlePlayerEscape

/*++
 Player flee the battle.
 --*/
VOID PAL_BattlePlayerEscape(void)
{
    int         i, j;
    WORD        wPlayerRole;
    
    SOUND_Play(45);
    
    PAL_BattleUpdateFighters();
    
    for (i = 0; i <= gpGlobals->wMaxPartyMemberIndex; i++)
    {
        wPlayerRole = gpGlobals->rgParty[i].wPlayerRole;
        
        if (gpGlobals->g.PlayerRoles.rgwHP[wPlayerRole] > 0)
        {
            g_Battle.rgPlayer[i].wCurrentFrame = 0;
        }
    }
    
    for (i = 0; i < 16; i++)
    {
        for (j = 0; j <= gpGlobals->wMaxPartyMemberIndex; j++)
        {
            wPlayerRole = gpGlobals->rgParty[j].wPlayerRole;
            
            if (gpGlobals->g.PlayerRoles.rgwHP[wPlayerRole] > 0)
            {
                //
                // TODO: This is still not the same as the original game
                //
                switch (j)
                {
                    case 0:
                        if (gpGlobals->wMaxPartyMemberIndex > 0)
                        {
                            g_Battle.rgPlayer[j].pos =
                            PAL_XY(PAL_X(g_Battle.rgPlayer[j].pos) + 4,
                                   PAL_Y(g_Battle.rgPlayer[j].pos) + 6);
                            break;
                        }
                        
                    case 1:
                        g_Battle.rgPlayer[j].pos =
                        PAL_XY(PAL_X(g_Battle.rgPlayer[j].pos) + 4,
                               PAL_Y(g_Battle.rgPlayer[j].pos) + 4);
                        break;
                        
                    case 2:
                        g_Battle.rgPlayer[j].pos =
                        PAL_XY(PAL_X(g_Battle.rgPlayer[j].pos) + 6,
                               PAL_Y(g_Battle.rgPlayer[j].pos) + 3);
                        break;
// @@@ - extra 4th role:
                    case 3:
                        g_Battle.rgPlayer[j].pos =
                        PAL_XY(PAL_X(g_Battle.rgPlayer[j].pos) + 6,
                               PAL_Y(g_Battle.rgPlayer[j].pos) + 3);
                        break;
                    default:
                        assert(FALSE); // Not possible
                        break;
                }
            }
        }
        
        PAL_BattleDelay(1, 0, FALSE);
    }
    
    //
    // Remove all players from the screen
    //
    for (i = 0; i <= gpGlobals->wMaxPartyMemberIndex; i++)
    {
        g_Battle.rgPlayer[i].pos = PAL_XY(9999, 9999);
    }
    
    PAL_BattleDelay(1, 0, FALSE);
    
    g_Battle.BattleResult = kBattleResultFleed;
}
开发者ID:neonmori,项目名称:sdlpalX,代码行数:83,代码来源:battle.c


示例13: PAL_BattleWon

/*++
 Show the "you win" message and add the experience points for players.
 --*/
static VOID PAL_BattleWon(void)
{
    const SDL_Rect   rect = {65, 60, 200, 100};
    const SDL_Rect   rect1 = {80, 0, 180, 200};
    
    int              i, j, iTotalCount;
    DWORD            dwExp;
    WORD             w;
    BOOL             fLevelUp;
    PLAYERROLES      OrigPlayerRoles;
    
    //
    // Backup the initial player stats
    //
    OrigPlayerRoles = gpGlobals->g.PlayerRoles;
    
    if (g_Battle.iExpGained > 0)
    {
        //
        // Play the "battle win" music
        //
        PAL_PlayMUS(g_Battle.fIsBoss ? 2 : 3, FALSE, 0);
        
        //
        // Show the message about the total number of exp. and cash gained
        //
        PAL_CreateSingleLineBox(PAL_XY(83, 60), 8, FALSE);
        PAL_CreateSingleLineBox(PAL_XY(65, 105), 10, FALSE);
        
        PAL_DrawText(PAL_GetWord(BATTLEWIN_GETEXP_LABEL), PAL_XY(95, 70), 0, FALSE, FALSE);
        PAL_DrawText(PAL_GetWord(BATTLEWIN_BEATENEMY_LABEL), PAL_XY(77, 115), 0, FALSE, FALSE);
        PAL_DrawText(PAL_GetWord(BATTLEWIN_DOLLAR_LABEL), PAL_XY(197, 115), 0, FALSE, FALSE);
        
        PAL_DrawNumber(g_Battle.iExpGained, 5, PAL_XY(182, 74), kNumColorYellow, kNumAlignRight);
        PAL_DrawNumber(g_Battle.iCashGained, 5, PAL_XY(162, 119), kNumColorYellow, kNumAlignMid);
        
        VIDEO_UpdateScreen(&rect);
        PAL_WaitForKey(g_Battle.fIsBoss ? 5500 : 3000);
    }
    
    //
    // Add the cash value
    //
    gpGlobals->dwCash += g_Battle.iCashGained;
    
    //
    // Add the experience points for each players
    //
    for (i = 0; i <= gpGlobals->wMaxPartyMemberIndex; i++)
    {
        fLevelUp = FALSE;
        
        w = gpGlobals->rgParty[i].wPlayerRole;
        if (gpGlobals->g.PlayerRoles.rgwHP[w] == 0)
        {
            continue; // don't care about dead players
        }
        
        dwExp = gpGlobals->Exp.rgPrimaryExp[w].wExp;
        dwExp += g_Battle.iExpGained;
        
        if (gpGlobals->g.PlayerRoles.rgwLevel[w] > MAX_LEVELS)
        {
            gpGlobals->g.PlayerRoles.rgwLevel[w] = MAX_LEVELS;
        }
        
        while (dwExp >= gpGlobals->g.rgLevelUpExp[gpGlobals->g.PlayerRoles.rgwLevel[w]])
        {
            dwExp -= gpGlobals->g.rgLevelUpExp[gpGlobals->g.PlayerRoles.rgwLevel[w]];
            
            if (gpGlobals->g.PlayerRoles.rgwLevel[w] < MAX_LEVELS)
            {
                fLevelUp = TRUE;
                PAL_PlayerLevelUp(w, 1);
                
                gpGlobals->g.PlayerRoles.rgwHP[w] = gpGlobals->g.PlayerRoles.rgwMaxHP[w];
                gpGlobals->g.PlayerRoles.rgwMP[w] = gpGlobals->g.PlayerRoles.rgwMaxMP[w];
            }
        }
        
        gpGlobals->Exp.rgPrimaryExp[w].wExp = (WORD)dwExp;
        
        if (fLevelUp)
        {
            //
            // Player has gained a level. Show the message
            //
            PAL_CreateSingleLineBox(PAL_XY(80, 0), 10, FALSE);
            PAL_CreateBox(PAL_XY(82, 32), 7, 8, 1, FALSE);
            
            PAL_DrawText(PAL_GetWord(gpGlobals->g.PlayerRoles.rgwName[w]), PAL_XY(110, 10), 0,
                         FALSE, FALSE);
            PAL_DrawText(PAL_GetWord(STATUS_LABEL_LEVEL), PAL_XY(110 + 16 * 3, 10), 0, FALSE, FALSE);
            PAL_DrawText(PAL_GetWord(BATTLEWIN_LEVELUP_LABEL), PAL_XY(110 + 16 * 5, 10), 0, FALSE, FALSE);
            
            for (j = 0; j < 8; j++)
            {
//.........这里部分代码省略.........
开发者ID:neonmori,项目名称:sdlpalX,代码行数:101,代码来源:battle.c


示例14: PAL_LoadBattleSprites

/*++
 Load all the loaded sprites.
 --*/
VOID PAL_LoadBattleSprites(void)
{
    int           i, l, x, y, s;
    FILE         *fp;
    
    PAL_FreeBattleSprites();
    
    fp = UTIL_OpenRequiredFile("abc.mkf");
    
    //
    // Load battle sprites for players
    //
    for (i = 0; i <= gpGlobals->wMaxPartyMemberIndex; i++)
    {
        s = PAL_GetPlayerBattleSprite(gpGlobals->rgParty[i].wPlayerRole);
        
        l = PAL_MKFGetDecompressedSize(s, gpGlobals->f.fpF);
        
        if (l <= 0)
        {
            continue;
        }
        
        g_Battle.rgPlayer[i].lpSprite = UTIL_calloc(l, 1);
        
        PAL_MKFDecompressChunk(g_Battle.rgPlayer[i].lpSprite, l,
                               s, gpGlobals->f.fpF);
        
        //
        // Set the default position for this player
        //
        x = g_rgPlayerPos[gpGlobals->wMaxPartyMemberIndex][i][0];
        y = g_rgPlayerPos[gpGlobals->wMaxPartyMemberIndex][i][1];
        
        g_Battle.rgPlayer[i].posOriginal = PAL_XY(x, y);
        g_Battle.rgPlayer[i].pos = PAL_XY(x, y);
    }
    
    //
    // Load battle sprites for enemies
    //
    for (i = 0; i < MAX_ENEMIES_IN_TEAM; i++)
    {
        if (g_Battle.rgEnemy[i].wObjectID == 0)
        {
            continue;
        }
        
        l = PAL_MKFGetDecompressedSize(
                                       gpGlobals->g.rgObject[g_Battle.rgEnemy[i].wObjectID].enemy.wEnemyID, fp);
        
        if (l <= 0)
        {
            continue;
        }
        
        g_Battle.rgEnemy[i].lpSprite = UTIL_calloc(l, 1);
        
        PAL_MKFDecompressChunk(g_Battle.rgEnemy[i].lpSprite, l,
                               gpGlobals->g.rgObject[g_Battle.rgEnemy[i].wObjectID].enemy.wEnemyID, fp);
        
        //
        // Set the default position for this enemy
        //
        x = gpGlobals->g.EnemyPos.pos[i][g_Battle.wMaxEnemyIndex].x;
        y = gpGlobals->g.EnemyPos.pos[i][g_Battle.wMaxEnemyIndex].y;
        
        y += g_Battle.rgEnemy[i].e.wYPosOffset;
        
        g_Battle.rgEnemy[i].posOriginal = PAL_XY(x, y);
        g_Battle.rgEnemy[i].pos = PAL_XY(x, y);
    }
    
    fclose(fp);
}
开发者ID:neonmori,项目名称:sdlpalX,代码行数:78,代码来源:battle.c


示例15: PAL_ItemSelectMenuUpdate

WORD
PAL_ItemSelectMenuUpdate(
   VOID
)
/*++
  Purpose:

    Initialize the item selection menu.

  Parameters:

    None.

  Return value:

    The object ID of the selected item. 0 if cancelled, 0xFFFF if not confirmed.

--*/
{
#ifndef PAL_WIN95
   int                i, j, k;
   WORD               wObject;
#else
   int                i, j, k, line;
   WORD               wObject, wScript;
#endif
   BYTE               bColor;
   static BYTE        bufImage[2048];
   static WORD        wPrevImageIndex = 0xFFFF;

   //
   // Process input
   //
   if (g_InputState.dwKeyPress & kKeyUp)
   {
      gpGlobals->iCurInvMenuItem -= 3;
   }
   else if (g_InputState.dwKeyPress & kKeyDown)
   {
      gpGlobals->iCurInvMenuItem += 3;
   }
   else if (g_InputState.dwKeyPress & kKeyLeft)
   {
      gpGlobals->iCurInvMenuItem--;
   }
   else if (g_InputState.dwKeyPress & kKeyRight)
   {
      gpGlobals->iCurInvMenuItem++;
   }
   else if (g_InputState.dwKeyPress & kKeyPgUp)
   {
      gpGlobals->iCurInvMenuItem -= 3 * 7;
   }
   else if (g_InputState.dwKeyPress & kKeyPgDn)
   {
      gpGlobals->iCurInvMenuItem += 3 * 7;
   }
   else if (g_InputState.dwKeyPress & kKeyMenu)
   {
      return 0;
   }

   //
   // Make sure the current menu item index is in bound
   //
   if (gpGlobals->iCurInvMenuItem < 0)
   {
      gpGlobals->iCurInvMenuItem = 0;
   }
   else if (gpGlobals->iCurInvMenuItem >= g_iNumInventory)
   {
      gpGlobals->iCurInvMenuItem = g_iNumInventory - 1;
   }

   //
   // Redraw the box
   //
   PAL_CreateBox(PAL_XY(2, 0), 6, 17, 1, FALSE);

   //
   // Draw the texts in the current page
   //
   i = gpGlobals->iCurInvMenuItem / 3 * 3 - 3 * 4;
   if (i < 0)
   {
      i = 0;
   }

   for (j = 0; j < 7; j++)
   {
      for (k = 0; k < 3; k++)
      {
         wObject = gpGlobals->rgInventory[i].wItem;
         bColor = MENUITEM_COLOR;

         if (i >= MAX_INVENTORY || wObject == 0)
         {
            //
            // End of the list reached
            //
//.........这里部分代码省略.........
开发者ID:ashurasunny,项目名称:PA,代码行数:101,代码来源:itemmenu.c


示例16: PAL_InitText


//.........这里部分代码省略.........
  Parameters:

    None.

  Return value:

    0 = success.
    -1 = memory allocation error.

--*/
{
   FILE       *fpMsg, *fpWord;
   int         i;

   //
   // Open the message and word data files.
   //
   fpMsg = UTIL_OpenRequiredFile("m.msg");
   fpWord = UTIL_OpenRequiredFile("word.dat");

   //
   // See how many words we have
   //
   fseek(fpWord, 0, SEEK_END);
   i = ftell(fpWord);

   //
   // Each word has 10 bytes
   //
   g_TextLib.nWords = (i + (WORD_LENGTH - 1)) / WORD_LENGTH;

   //
   // Read the words
   //
   g_TextLib.lpWordBuf = (LPBYTE)malloc(i);
   if (g_TextLib.lpWordBuf == NULL)
   {
      fclose(fpWord);
      fclose(fpMsg);
      return -1;
   }
   fseek(fpWord, 0, SEEK_SET);
   fread(g_TextLib.lpWordBuf, i, 1, fpWord);

   //
   // Close the words file
   //
   fclose(fpWord);

   //
   // Read the message offsets. The message offsets are in SSS.MKF #3
   //
   i = PAL_MKFGetChunkSize(3, gpGlobals->f.fpSSS) / sizeof(DWORD);
   g_TextLib.nMsgs = i - 1;

   g_TextLib.lpMsgOffset = (LPDWORD)malloc(i * sizeof(DWORD));
   if (g_TextLib.lpMsgOffset == NULL)
   {
      free(g_TextLib.lpWordBuf);
      fclose(fpMsg);
      return -1;
   }

   PAL_MKFReadChunk((LPBYTE)(g_TextLib.lpMsgOffset), i * sizeof(DWORD), 3,
      gpGlobals->f.fpSSS);

   //
   // Read the messages.
   //
   fseek(fpMsg, 0, SEEK_END);
   i = ftell(fpMsg);

   g_TextLib.lpMsgBuf = (LPBYTE)malloc(i);
   if (g_TextLib.lpMsgBuf == NULL)
   {
      free(g_TextLib.lpMsgOffset);
      free(g_TextLib.lpWordBuf);
      fclose(fpMsg);
      return -1;
   }

   fseek(fpMsg, 0, SEEK_SET);
   fread(g_TextLib.lpMsgBuf, 1, i, fpMsg);

   fclose(fpMsg);

   g_TextLib.bCurrentFontColor = FONT_COLOR_DEFAULT;
   g_TextLib.bIcon = 0;
   g_TextLib.posIcon = 0;
   g_TextLib.nCurrentDialogLine = 0;
   g_TextLib.iDelayTime = 3;
   g_TextLib.posDialogTitle = PAL_XY(12, 8);
   g_TextLib.posDialogText = PAL_XY(44, 26);
   g_TextLib.bDialogPosition = kDialogUpper;
   g_TextLib.fUserSkip = FALSE;

   PAL_MKFReadChunk(g_TextLib.bufDialogIcons, 282, 12, gpGlobals->f.fpDATA);

   return 0;
}
开发者ID:kkspeed,项目名称:sdlpal,代码行数:101,代码来源:text.c


示例17: PAL_ShowFBP

VOID
PAL_ShowFBP(
WORD         wChunkNum,
WORD         wFade
)
/*++
  Purpose:

  Draw an FBP picture to the screen.

  Parameters:

  [IN]  wChunkNum - number of chunk in fbp.mkf file.

  [IN]  wFade - fading speed of showing the picture.

  Return value:

  None.

  --*/
{
	PAL_LARGE BYTE            buf[320 * 200];
	PAL_LARGE BYTE            bufSprite[320 * 200];
	const int                 rgIndex[6] = {0, 3, 1, 5, 2, 4};
	SDL_Surface              *p;
	int                       i, j, k;
	BYTE                      a, b;

	if (PAL_MKFDecompressChunk(buf, 320 * 200, wChunkNum, gpGlobals->f.fpFBP) <= 0)
	{
		memset(buf, 0, sizeof(buf));
	}

	if (g_wCurEffectSprite != 0)
	{
		PAL_MKFDecompressChunk(bufSprite, 320 * 200, g_wCurEffectSprite, gpGlobals->f.fpMGO);
	}

	if (wFade)
	{
		wFade++;
		wFade *= 10;

		p = SDL_CreateRGBSurface(gpScreen->flags & ~SDL_HWSURFACE, 320, 200, 8,
			gpScreen->format->Rmask, gpScreen->format->Gmask,
			gpScreen->format->Bmask, gpScreen->format->Amask);
#if SDL_VERSION_ATLEAST(2, 0, 0)
		SDL_SetSurfacePalette(p, gpScreen->format->palette);
#else
		SDL_SetPalette(p, SDL_PHYSPAL | SDL_LOGPAL, VIDEO_GetPalette(), 0, 256);
#endif
		PAL_FBPBlitToSurface(buf, p);
		VIDEO_BackupScreen();

		for (i = 0; i < 16; i++)
		{
			for (j = 0; j < 6; j++)
			{
				//
				// Blend the pixels in the 2 buffers, and put the result into the
				// backup buffer
				//
				for (k = rgIndex[j]; k < gpScreen->pitch * gpScreen->h; k += 6)
				{
					a = ((LPBYTE)(p->pixels))[k];
					b = ((LPBYTE)(gpScreenBak->pixels))[k];

					if (i > 0)
					{
						if ((a & 0x0F) > (b & 0x0F))
						{
							b++;
						}
						else if ((a & 0x0F) < (b & 0x0F))
						{
							b--;
						}
					}

					((LPBYTE)(gpScreenBak->pixels))[k] = ((a & 0xF0) | (b & 0x0F));
				}

				SDL_BlitSurface(gpScreenBak, NULL, gpScreen, NULL);

				if (g_wCurEffectSprite != 0)
				{
					int f = SDL_GetTicks() / 150;
					PAL_RLEBlitToSurface(PAL_SpriteGetFrame(bufSprite, f % PAL_SpriteGetNumFrames(bufSprite)),
						gpScreen, PAL_XY(0, 0));
				}

				VIDEO_UpdateScreen(NULL);
				UTIL_Delay(wFade);
			}
		}

		SDL_FreeSurface(p);
	}

//.........这里部分代码省略.........
开发者ID:huoshan12345,项目名称:SdlpalEdit,代码行数:101,代码来源:ending.c


示例18: PAL_BattleEnemyEscape

VOID
PAL_BattleEnemyEscape(
   VOID
)
/*++
  Purpose:

    Enemy flee the battle.

  Parameters:

    None.

  Return value:

    None.

--*/
{
   int j, x, y, w;
   BOOL f = TRUE;
   
   UTIL_WriteLog(LOG_DEBUG, "[0x%08x][%s][%s] - %s", (long)PAL_BattleEnemyEscape, "PAL_BattleEnemyEscape", __FILE__, "start");
   
   SOUND_Play(45);

   //
   // Show the animation
   //
   while (f)
   {
   	  f = FALSE;

   	  for (j = 0; j <= g_Battle.wMaxEnemyIndex; j++)
   	  {
   	  	 if (g_Battle.rgEnemy[j].wObjectID == 0)
   	  	 {
   	  	 	continue;
   	  	 }

   	  	 x = PAL_X(g_Battle.rgEnemy[j].pos) - 5;
   	  	 y = PAL_Y(g_Battle.rgEnemy[j].pos);

   	  	 g_Battle.rgEnemy[j].pos = PAL_XY(x, y);

   	  	 w = PAL_RLEGetWidth(PAL_SpriteGetFrame(g_Battle.rgEnemy[j].lpSprite, 0));

   	  	 if (x + w > 0)
   	  	 {
   	  	 	f = TRUE;
   	  	 }
   	  }

   	  PAL_BattleMakeScene();
      SDL_BlitSurface(g_Battle.lpSceneBuf, NULL, gpScreen, NULL);
      VIDEO_UpdateScreen(NULL);

      UTIL_Delay(10);
   }

   UTIL_Delay(500);
   g_Battle.BattleResult = kBattleResultTerminated;
   
   UTIL_WriteLog(LOG_DEBUG, "[0x%08x][%s][%s] - %s", (long)PAL_BattleEnemyEscape, "PAL_BattleEnemyEscape", __FILE__, "end");
}
开发者ID:orionpax,项目名称:socoolpal,代码行数:65,代码来源:battle.c


示例19: PAL_MagicSelectionMenuUpdate

WORD
PAL_MagicSelectionMenuUpdate(
   VOID
)
/*++
  Purpose:

    Update the magic selection menu.

  Parameters:

    None.

  Return value:

    The selected magic. 0 if cancelled, 0xFFFF if not confirmed.

--*/
{
   int         i, j, k;
   BYTE        bColor;

   //
   // Check for inputs
   //
   if (g_InputState.dwKeyPress & kKeyUp)
   {
      g_iCurrentItem -= 3;
   }
   else if (g_InputState.dwKeyPress & kKeyDown)
   {
      g_iCurrentItem += 3;
   }
   else if (g_InputState.dwKeyPress & kKeyLeft)
   {
      g_iCurrentItem--;
   }
   else if (g_InputState.dwKeyPress & kKeyRight)
   {
      g_iCurrentItem++;
   }
   else if (g_InputState.dwKeyPress & kKeyPgUp)
   {
      g_iCurrentItem -= 3 * 5;
   }
   else if (g_InputState.dwKeyPress & kKeyPgDn)
   {
      g_iCurrentItem += 3 * 5;
   }
   else if (g_InputState.dwKeyPress & kKeyMenu)
   {
      return 0;
   }

   //
   // Make sure the current menu item index is in bound
   //
   if (g_iCurrentItem < 0)
   {
      g_iCurrentItem = 0;
   }
   else if (g_iCurrentItem >= g_iNumMagic)
   {
      g_iCurrentItem = g_iNumMagic - 1;
   }

   //
   // Create the box.
   //
   PAL_CreateBox(PAL_XY(10, 42), 4, 16, 1, FALSE);

   if (gpGlobals->lpObjectDesc == NULL)
   {
      //
      // Draw the cash amount.
      //
      PAL_CreateSingleLineBox(PAL_XY(0, 0), 5, FALSE);
      PAL_DrawText(PAL_GetWord(CASH_LABEL), PAL_XY(10, 10), 0, FALSE, FALSE);
      PAL_DrawNumber(gpGlobals->dwCash, 6, PAL_XY(49, 14), kNumColorYellow, kNumAlignRight);

      //
      // Draw the MP of the selected magic.
      //
      PAL_CreateSingleLineBox(PAL_XY(215, 0), 5, FALSE);
      PAL_RLEBlitToSurface(PAL_SpriteGetFrame(gpSpriteUI, SPRITENUM_SLASH),
         gpScreen, PAL_XY(260, 14));
      PAL_DrawNumber(rgMagicItem[g_iCurrentItem].wMP, 4, PAL_XY(230, 14),
         kNumColorYellow, kNumAlignRight);
      PAL_DrawNumber(g_wPlayerMP, 4, PAL_XY(265, 14), kNumColorCyan, kNumAlignRight);
   }
   else
   {
      char szDesc[512], *next;
      const char *d = PAL_GetObjectDesc(gpGlobals->lpObjectDesc, rgMagicItem[g_iCurrentItem].wMagic);

      //
      // Draw the magic description.
      //
      if (d != NULL)
      {
//.........这里部分代码省略.........
开发者ID:nbzwt,项目名称:nPal,代码行数:101,代码来源:magicmenu.c


示例20: PAL_UpdateParty

VOID
PAL_UpdateParty(
   VOID
)
/*++
   Purpose:

     Update the location and walking gesture of all the party members.

   Parameters:

     None.

   Return value:

     None.

--*/
{
   int              xSource, ySource, xTarget, yTarget, xOffset, yOffset, i;

   //
   // Has user pressed one of the arrow keys?
   //
   if (g_InputState.dir != kDirUnknown)
   {
      xOffset = ((g_InputState.dir == kDirWest || g_InputState.dir == kDirSouth) ? -16 : 16);
      yOffset = ((g_InputState.dir == kDirWest || g_InputState.dir == kDirNorth) ? -8 : 8);

      xSource = PAL_X(gpGlobals->viewport) + PAL_X(gpGlobals->partyoffset);
      ySource = PAL_Y(gpGlobals->viewport) + PAL_Y(gpGlobals->partyoffset);

      xTarget = xSource + xOffset;
      yTarget = ySource + yOffset;

      gpGlobals->wPartyDirection = g_InputState.dir;

      //
      // Check for obstacles on the destination location
      //
      if (!PAL_CheckObstacle(PAL_XY(xTarget, yTarget), TRUE, 0))
      {
         //
         // Player will actually be moved. Store trail.
         //
         for (i = 3; i >= 0; i--)
         {
            gpGlobals->rgTrail[i + 1] = gpGlobals->rgTrail[i];
         }

         gpGlobals->rgTrail[0].wDirection = g_InputState.dir;
         gpGlobals->rgTrail[0].x = xSource;
         gpGlobals->rgTrail[0].y = ySource;

         //
         // Move the viewport
         //
         gpGlobals->viewport =
            PAL_XY(PAL_X(gpGlobals->viewport) + xOffset, PAL_Y(gpGlobals->viewport) + yOffset);

         //
         // Update gestures
         //
         PAL_UpdatePartyGestures(TRUE);

         return; // don't go further
      }
   }

   PAL_UpdatePartyGestures(FALSE);
}
开发者ID:ashurasunny,项目名称:PA,代码行数:71,代码来源:scene.c



注:本文中的PAL_XY函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PANGO_PIXELS函数代码示例发布时间:2022-05-30
下一篇:
C++ PAL_Terminate函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap