资源简介
仙灵岛上别洞天,池中孤莲伴月眠。经典游戏源码,值得学习和研究。
代码片段和文件信息
//
// Copyright (c) 2009 Wei Mingzhi .
// All rights reserved.
//
// This file is part of SDLPAL.
//
// SDLPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation either version 3 of the License or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not see .
//
#include “main.h“
BATTLE g_Battle;
WORD
g_rgPlayerPos[3][3][2] = {
{{240 170}} // one player
{{200 176} {256 152}} // two players
{{180 180} {234 170} {270 146}} // three players
};
VOID
PAL_BattleMakeScene(
VOID
)
/*++
Purpose:
Generate the battle scene into the scene buffer.
Parameters:
None.
Return value:
None.
--*/
{
int i;
PAL_POS pos;
LPBYTE pSrc pDst;
BYTE b;
UTIL_WriteLog(LOG_DEBUG “[0x%08x][%s][%s] - %s“ (long)PAL_BattleMakeScene “PAL_BattleMakeScene“ __FILE__ “entry“);
//
// Draw the background
//
pSrc = g_Battle.lpBackground->pixels;
pDst = g_Battle.lpSceneBuf->pixels;
for (i = 0; i < g_Battle.lpSceneBuf->pitch * g_Battle.lpSceneBuf->h; i++)
{
b = (*pSrc & 0x0F);
b += g_Battle.sBackgroundColorShift;
if (b & 0x80)
{
b = 0;
}
else if (b & 0x70)
{
b = 0x0F;
}
*pDst = (b | (*pSrc & 0xF0));
++pSrc;
++pDst;
}
PAL_ApplyWave(g_Battle.lpSceneBuf);
//
// Draw the enemies
//
for (i = g_Battle.wMaxEnemyIndex; i >= 0; i--)
{
pos = g_Battle.rgEnemy[i].pos;
if (g_Battle.rgEnemy[i].rgwStatus[kStatusConfused] > 0 &&
g_Battle.rgEnemy[i].rgwStatus[kStatusSleep] == 0 &&
g_Battle.rgEnemy[i].rgwStatus[kStatusParalyzed] == 0)
{
//
// Enemy is confused
//
pos = PAL_XY(PAL_X(pos) + RandomLong(-1 1) PAL_Y(pos));
}
pos = PAL_XY(PAL_X(pos) - PAL_RLEGetWidth(PAL_SpriteGetframe(g_Battle.rgEnemy[i].lpSprite g_Battle.rgEnemy[i].wCurrentframe)) / 2
PAL_Y(pos) - PAL_RLEGetHeight(PAL_SpriteGetframe(g_Battle.rgEnemy[i].lpSprite g_Battle.rgEnemy[i].wCurrentframe)));
if (g_Battle.rgEnemy[i].wobjectID != 0)
{
if (g_Battle.rgEnemy[i].iColorShift)
{
PAL_RLEBlitWithColorShift(PAL_SpriteGetframe(g_Battle.rgEnemy[i].lpSprite g_Battle.rgEnemy[i].wCurrentframe)
g_Battle.lpSceneBuf pos g_Battle.rgEnemy[i].iColorShift);
}
else
{
PAL_RLEBlitToSurface(PAL
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-02-24 23:16 sdlpal\
文件 183488 2010-12-18 17:20 sdlpal\0.RPG
目录 0 2013-02-24 23:16 sdlpal\Debug\
文件 3214 2013-02-18 17:07 sdlpal\Debug\BscMake.command.1.tlog
文件 496734 2013-02-19 17:56 sdlpal\Debug\CL.read.1.tlog
文件 16992 2013-02-19 17:56 sdlpal\Debug\CL.write.1.tlog
文件 67960 2013-02-18 17:04 sdlpal\Debug\battle.obj
文件 0 2013-02-18 17:04 sdlpal\Debug\battle.sbr
文件 85885 2013-02-04 15:20 sdlpal\Debug\binfile.obj
文件 0 2013-02-04 15:20 sdlpal\Debug\binfile.sbr
文件 129047 2013-02-04 15:20 sdlpal\Debug\binio.obj
文件 0 2013-02-04 15:20 sdlpal\Debug\binio.sbr
文件 2012 2013-02-18 17:07 sdlpal\Debug\bscmake.read.1.tlog
文件 1914 2013-02-18 17:07 sdlpal\Debug\bscmake.write.1.tlog
文件 22088 2013-02-19 17:56 sdlpal\Debug\cl.command.1.tlog
文件 16530 2013-02-04 15:20 sdlpal\Debug\emuopl.obj
文件 0 2013-02-04 15:20 sdlpal\Debug\emuopl.sbr
文件 32987 2013-02-18 17:04 sdlpal\Debug\ending.obj
文件 0 2013-02-18 17:04 sdlpal\Debug\ending.sbr
文件 124260 2013-02-18 17:04 sdlpal\Debug\fight.obj
文件 0 2013-02-18 17:04 sdlpal\Debug\fight.sbr
文件 47063 2013-02-04 15:20 sdlpal\Debug\fmopl.obj
文件 0 2013-02-04 15:20 sdlpal\Debug\fmopl.sbr
文件 27857 2013-02-18 17:04 sdlpal\Debug\font.obj
文件 0 2013-02-18 17:04 sdlpal\Debug\font.sbr
文件 48031 2013-02-04 15:20 sdlpal\Debug\fprovide.obj
文件 0 2013-02-04 15:20 sdlpal\Debug\fprovide.sbr
文件 24086 2013-02-18 17:04 sdlpal\Debug\game.obj
文件 0 2013-02-18 17:04 sdlpal\Debug\game.sbr
文件 6442 2013-02-04 15:20 sdlpal\Debug\getopt.obj
文件 0 2013-02-04 15:20 sdlpal\Debug\getopt.sbr
............此处省略527个文件信息
评论
共有 条评论