我把kg的新对话指令编成可以使用半身像的了,我做的很烂,不好意思。。。
注:一定要使用半身像,否则会怪怪的。。。
p/s:若kg大大认为我盗用您的版权,我马上删掉。
procedure NewTalk(headnum, talknum, namenum, place, showhead, color, frame: integer);
var
k, alen, newcolor, color1, color2, nh, nw, ch, c1, r1, n, namelen, i, t1, grp, idx, offset, len, i1, i2, face, c, nx, ny, hx, hy, hw, hh, x, y, w, h, tx, ty, cell, row: integer;
np3, np, np1, np2, tp, p1, ap: pchar;
actorarray, talkarray, namearray, name1, name2: array of byte;
pword: array[0..1] of Uint16;
begin
pword[1] := 0;
//?????
case color of
0: color := 28515;
1: color := 28421;
2: color := 28435;
3: color := 28563;
4: color := 28466;
5: color := 28450;
end;
color1 := color and $FF;
color2 := (color shr 8) and $FF;
x := 0;//?????X
y := 299;//?????Y
w := 640;//????
h := 120;//????
nw := 86;//????
nh := 28;//????
hx := 1;//?????X
hy := 360;//?????Y
hw := 5;//????
hh := 5;//????
nx := 129;//?????X
ny := 299;//?????Y
tx := 100;//?????x
ty := 331;//?????y
if showhead = 1 then nx := x;//???????????????
row := 5;
cell := 25;
if place = 1 then//?????????????????
begin
hx := 546;
tx := 10;
nx := 431;
if showhead = 1 then nx := x + w - nw;
end;
//read talk
//????
idx := fileopen('resource\talk.idx', fmopenread);
grp := fileopen('resource\talk.grp', fmopenread);
if talknum = 0 then
begin
offset := 0;
fileread(idx, len, 4);
end
else
begin
fileseek(idx, (talknum - 1) * 4, 0);
fileread(idx, offset, 4);
fileread(idx, len, 4);
end;
len := (len - offset);
setlength(talkarray, len + 1);
fileseek(grp, offset, 0);
fileread(grp, talkarray[0], len);
fileclose(idx);
fileclose(grp);
for i := 0 to len - 1 do
begin
talkarray := talkarray xor $FF;
if talkarray = 255 then talkarray := 0;
end;
talkarray := 0;
tp := @talkarray[0];
//read name
//????
if namenum > 0 then
begin
idx := fileopen('resource\talk.idx', fmopenread);
grp := fileopen('resource\talk.grp', fmopenread);
fileseek(idx, (namenum - 1) * 4, 0);
fileread(idx, offset, 4);
fileread(idx, namelen, 4);
namelen := (namelen - offset);
setlength(namearray, namelen + 1);
fileseek(grp, offset, 0);
fileread(grp, namearray[0], namelen);
fileclose(idx);
fileclose(grp);
for i := 0 to namelen - 2 do
begin
namearray := namearray xor $FF;
if namearray = 255 then namearray := 0;
end;
namearray := 0;
np := @namearray[0];
end
else if namenum = -2 then
begin
for i := 0 to length(rrole) - 1 do
begin
if Rrole.HeadNum = headnum then
begin
p1 := @Rrole.Name;
namelen := 10;
setlength(namearray, namelen);
np := @namearray[0];
for n := 0 to namelen - 1 do
begin
(np + n)^ := (p1 + n)^;
// if (p1 + n)^ = char(0) then break;
end;
(np + n)^ := char(0);
(np + n + 1)^ := char(0);
break;
end;
end;
end;
p1 := @Rrole[0].Name;
alen := length(p1) + 2;
setlength(actorarray, alen);
ap := @actorarray[0];
for n := 0 to alen - 1 do
begin
(ap + n)^ := (p1 + n)^;
if (p1 + n)^ = char(0) then break;
end;
(ap + n)^ := char($0);
(ap + n + 1)^ := char(0);
//??????
if alen = 6 then
begin
setlength(name1, 4);
np1 := @name1[0];
np1^ := ap^;
(np1 + 1)^ := (ap + 1)^;
(np1 + 2)^ := char(0);
(np1 + 3)^ := char(0);
setlength(name2, 4);
np2 := @name2[0];
np2^ := ap^;
for i := 0 to length(name2) - 1 do
(np2 + i)^ := (ap + i + 2)^;
end
else if alen > 8 then
begin
setlength(name1, 6);
np1 := @name1[0];
np1^ := ap^;
(np1 + 1)^ := (ap + 1)^;
(np1 + 2)^ := (ap + 2)^;
(np1 + 3)^ := (ap + 3)^;
(np1 + 4)^ := char(0);
(np1 + 5)^ := char(0);
setlength(name2, 6);
np2 := @name2[0];
for i := 0 to length(name2) - 1 do
(np2 + i)^ := (ap + i + 4)^;
end
else if alen = 8 then
begin
if ((puint16(ap)^ = $6EAB) and ((puint16(ap + 2)^ = $63AE))) or
((puint16(ap)^ = $E8A6) and ((puint16(ap + 2)^ = $F9AA))) or
((puint16(ap)^ = $46AA) and ((puint16(ap + 2)^ = $E8A4))) or
((puint16(ap)^ = $4FA5) and ((puint16(ap + 2)^ = $B0AA))) or
((puint16(ap)^ = $7DBC) and ((puint16(ap + 2)^ = $65AE))) or
((puint16(ap)^ = $71A5) and ((puint16(ap + 2)^ = $A8B0))) or
((puint16(ap)^ = $D1BD) and ((puint16(ap + 2)^ = $AFB8))) or
((puint16(ap)^ = $71A5) and ((puint16(ap + 2)^ = $C5AA))) or
((puint16(ap)^ = $D3A4) and ((puint16(ap + 2)^ = $76A5))) or
((puint16(ap)^ = $BDA4) and ((puint16(ap + 2)^ = $5DAE))) or
((puint16(ap)^ = $DABC) and ((puint16(ap + 2)^ = $A7B6))) or
((puint16(ap)^ = $43AD) and ((puint16(ap + 2)^ = $DFAB))) or
((puint16(ap)^ = $71A5) and ((puint16(ap + 2)^ = $7BAE))) or
((puint16(ap)^ = $B9A7) and ((puint16(ap + 2)^ = $43C3))) or
((puint16(ap)^ = $61B0) and ((puint16(ap + 2)^ = $D5C1))) or
((puint16(ap)^ = $74A6) and ((puint16(ap + 2)^ = $E5A4))) or
((puint16(ap)^ = $DDA9) and ((puint16(ap + 2)^ = $5BB6))) then
begin
setlength(name1, 6);
np1 := @name1[0];
np1^ := ap^;
(np1 + 1)^ := (ap + 1)^;
(np1 + 2)^ := (ap + 2)^;
(np1 + 3)^ := (ap + 3)^;
(np1 + 4)^ := char(0);
(np1 + 5)^ := char(0);
setlength(name2, 4);
np2 := @name2[0];
for i := 0 to length(name2) - 1 do
(np2 + i)^ := (ap + i + 4)^;
end
else
begin
setlength(name1, 4);
np1 := @name1[0];
np1^ := ap^;
(np1 + 1)^ := (ap + 1)^;
(np1 + 2)^ := char(0);
(np1 + 3)^ := char(0);
setlength(name2, 6);
np2 := @name2[0];
for i := 0 to length(name2) - 1 do
(np2 + i)^ := (ap + i + 2)^;
end;
end;
ch := 0;
while ((puint16(tp + ch))^ shl 8 <> 0) and ((puint16(tp + ch))^ shr 8 <> 0) do
begin
redraw;
c1 := 0;
r1 := 0;
drawrectanglewithoutframe(x, y, w, h, frame, 40);
if (showhead = 0) or (headnum < 0) then
begin
if headnum = 0 then
begin
DrawHeadPic(RRole[0].HeadNum, hx, hy);
end
else
begin
DrawHeadPic(headnum, hx, hy);
end;
end;
if namenum <> 0 then
begin
namelen := length(np);
DrawBig5ShadowText(np, nx + 20 - namelen * 9 div 2, ny + 4, colcolor($63), colcolor($70));
end;
while r1 < row do
begin
pword[0] := (puint16(tp + ch))^;
if (pword[0] shr 8 <> 0) and (pword[0] shl 8 <> 0) then
begin
ch := ch + 2;
if (pword[0] and $FF) = $5E then //^^??????
begin
case smallint((pword[0] and $FF00) shr 8) - $30 of
0: newcolor := 28515;
1: newcolor := 28421;
2: newcolor := 28435;
3: newcolor := 28563;
4: newcolor := 28466;
5: newcolor := 28450;
64: newcolor := color;//^^??????
else newcolor := color;
end;
color1 := newcolor and $FF;
color2 := (newcolor shr 8) and $FF;
end
else if pword[0] = $2323 then //## ??
begin
sdl_delay(500);
end
else if pword[0] = $2A2A then //**??
begin
if c1 > 0 then
inc(r1);
c1 := 0;
end
else if pword[0] = $4040 then //@@????
begin
sdl_updaterect(screen, 0, 0, screen.w, screen.h);
k := waitanykey;
while (k = sdlk_right) or
(k = sdlk_left) or
(k = sdlk_up) or
(k = sdlk_down) do
begin
k := waitanykey;
end;
end
else if (pword[0] = $2626) or (pword[0] = $2525) or (pword[0] = $2424) then
begin
case pword[0] of
$2626: np3 := ap; //&&????
$2525: np3 := np2; //%%???
$2424: np3 := np1; //$$???
end;
i := 0;
while (puint16(np3 + i)^ shr 8 <> 0) and (puint16(np3 + i)^ shl 8 <> 0) do
begin
pword[0] := puint16(np3 + i)^;
i := i + 2;
Drawbig5ShadowText(@pword[0], tx - 14 + CHINESE_FONT_SIZE * c1, ty + 4 + CHINESE_FONT_SIZE * r1, colcolor(color1), colcolor(color2));
inc(c1);
if c1 = cell then
begin
c1 := 0;
inc(r1);
if r1 = row then
begin
sdl_updaterect(screen, 0, 0, screen.w, screen.h);
k := waitanykey;
while (k = sdlk_right) or
(k = sdlk_left) or
(k = sdlk_up) or
(k = sdlk_down) do
begin
k := waitanykey;
end;
c1 := 0;
r1 := 0;
redraw;
drawrectanglewithoutframe(x, y, w, h, frame, 40);
if (showhead = 0) or (headnum < 0) then
begin
if headnum = 0 then
begin
DrawHeadPic(RRole[0].HeadNum, hx, hy);
end
else
begin
DrawHeadPic(headnum, hx, hy );
end;
end;
if namenum <> 0 then
begin
namelen := length(np);
DrawBig5ShadowText(np, nx + 20 - namelen * 9 div 2, ny + 4, colcolor($63), colcolor($70));
end;
end;
end;
end;
end
else //????
begin
DrawBig5ShadowText(@pword, tx - 14 + CHINESE_FONT_SIZE * c1, ty + 4 + CHINESE_FONT_SIZE * r1, colcolor(color1), colcolor(color2));
inc(c1);
if c1 = cell then
begin
c1 := 0;
inc(r1);
end;
end;
end
else break;
end;
sdl_updaterect(screen, 0, 0, screen.w, screen.h);
k := waitanykey;
while (k = sdlk_right) or
(k = sdlk_left) or
(k = sdlk_up) or
(k = sdlk_down) do
begin
k := waitanykey;
end;
if (pword[0] and $FF = 0) or (pword[0] and $FF00 = 0) then break;
end;
redraw;
end;
;
补充:我想知道怎么编写出原版没有框框的对话框的,哪位大大肯教教小弟?
[ 本帖最后由 轩辕夏禹 于 2010-1-8 07:48 编辑 ] |