本帖最后由 反对混合型 于 2011-6-11 07:44 编辑
原版第二条指令似乎是有BUG,虽然说显示的是减去物品,但是实际上测试游戏你可以发现一个问题,会这样显示
比如:
失去精气丸
数量: -5
当然我们希望的是没有负号,替换这个就好了,其实改了一点东西而已,全贴上方便其他跟我一样不怎么懂的使用
- //得到物品可显示数量, 数量为负显示失去物品
- procedure instruct_2(inum, amount: integer);
- var
- i, x: integer;
- word: widestring;
- begin
- i := 0;
- while (RItemList.Number >= 0) and (i < MAX_ITEM_AMOUNT) do
- begin
- if (RItemList.Number = inum) then
- begin
- RItemList.Amount := RItemList.Amount + amount;
- if (RItemList.Amount < 0) and (amount >= 0) then
- RItemList.Amount := 32767;
- if (RItemList.Amount < 0) and (amount < 0) then
- RItemList.Amount := 0;
- break;
- end;
- i := i + 1;
- end;
- if RItemList.number < 0 then
- begin
- RItemList.Number := inum;
- RItemList.Amount := amount;
- end;
- ReArrangeItem;
- x := CENTER_X;
- if where = 2 then
- x := 190;
- DrawRectangle(x - 75, 98, 145, 76, 0, colcolor(255), 30);
- if amount >= 0 then
- word := ' 得到物品'
- else
- word := ' 失去物品';
- drawshadowtext(@word[1], x - 90, 100, colcolor($23), colcolor($21));
- drawbig5shadowtext(@RItem[inum].Name, x - 90, 125, colcolor($7), colcolor($5));
- word := ' 數量';
- drawshadowtext(@word[1], x - 90, 150, colcolor($66), colcolor($64));
- word := format(' %5d', [abs(amount)]);
- drawengshadowtext(@word[1], x - 5, 150, colcolor($66), colcolor($64));
- sdl_updaterect(screen, 0, 0, screen.w, screen.h);
- waitanykey;
- redraw;
- sdl_updaterect(screen, 0, 0, screen.w, screen.h);
- end;
复制代码
|