太空之战程序项目matlab源码程序 - matlab算法设计 - 谷速源码
下载频道> 资源分类> matlab源码> 算法设计> 太空之战程序项目matlab源码程序

标题:太空之战程序项目matlab源码程序
分享到:

所属分类: 算法设计 资源类型:程序源码 文件大小: 5.94 KB 上传时间: 2019-07-16 22:16:38 下载次数: 1 资源积分:1分 提 供 者: jiqiren 太空之战程序项目matlab源码程序
内容:
function galactic(cmd)
%GALACTIC   Galactic game
%  刘昱显
%   To play this game, type: GALACTIC
%
%   Controls:
%    Mouse         Control ship
%    Left click    Shoot
%    Ctrl+P        Pause
%
%   During the game, use the game menu to set difficulty and to
%   enable/disable sound effects.  Only one game can run at a time.
%   Galactic was written and tested on Matlab 5.3 (R11), but may
%   work with as early as Matlab 5.0 without changes.
%
%   This game may be too computationally intense for slower systems.
%   Minimum system recommendation: 600 MHz CPU
 
% Pascal Getreuer 2004-2006
 
global MODE IMG MAP TSTEP NLIVE GAME SPR SSPR SPRP SPRT ...
HFIG HMENU SNDTMR SND;
ImgX = 80;
ImgY = 120;
if nargin < 1|cmd == 6
ClkV = [0;0;86400;3600;60;1];
KPts([6,7,4,5,8,9,10,11,12]) ...
 = [25,25,100,100,40,40,175,400,400];
if nargin == 0
GameInit(ImgY);
HFIG = figure('Name','Galactic','Numbertitle','off','Menubar','none',...
'Color',[0.3 0.3 0.3],'Resize','off','DoubleBuffer','on',...
'Position',[150,150,250,350],'CloseRequestFcn',[mfilename,'(-1)'],...
'Pointer','circle');
tmp = uimenu('Label','&Game');
HMENU(1) = uimenu(tmp,'Label','&Pause');
uimenu(tmp,'Label','&Stop','Callback',[mfilename,'(8)']);
HMENU(2) = uimenu(tmp,'Label','&Beginner','Callback',[mfilename,'(10)'],...
'Separator','on','Checked','on');
HMENU(3) = uimenu(tmp,'Label','&Intermediate','Callback',[mfilename,'(11)']);
HMENU(4) = uimenu(tmp,'Label','&Expert','Callback',[mfilename,'(12)']);
HMENU(5) = uimenu(tmp,'Label','&Custom...','Callback',[mfilename,'(13)']);
HMENU(6) = uimenu(tmp,'Label','S&ound','Callback',[mfilename,'(14)'],'Checked','on','Separator','on');
uimenu(tmp,'Label','&Highscores...','Separator','on','Callback',[mfilename,'(15)']);
uimenu(tmp,'Label','E&xit','Callback',[mfilename,'(-1)'],'Separator','on');
tmp = uimenu('Label','&Help');
uimenu(tmp,'Label','Help &Notes','Callback',['global MODE;if ~MODE,',...
mfilename,'(7);end;msgbox({''Controls:'',',...
'''   Mouse      Control ship'',''   Click         Shoot'','''',',...
'''   Ctrl+P       Pause/Unpause'','''',''Game Options (under game menu):'',',...
''' *  Choose beginner, intermediate, expert, or custom difficulty'','' *  ',...
'Enable/disable sound effects''},''Help Notes'')']);
uimenu(tmp,'Label','&M-File Info','Callback',['help ',mfilename]);
uimenu(tmp,'Label','&About Galactic','Separator','on','Callback',['global MODE;',...
'if ~MODE,',mfilename,'(7);end;msgbox(''Written by Pascal Getreuer, ',...
'August 2004.'',''About Galactic'')']);
colormap([0,0,0;1,1,1;0.6,0.6,1;0.4,0.4,0.7;1,1,0;0,0.5,0.5;1,0,1;0,1,1;1,0,0;0.4,0.6,0;1,1,1;0,0,0.5]);
set(HFIG,'Position',[150,150,250,350]);
IMG = zeros(ImgY,ImgX);
MAP = IMG;
SPRP = [ImgX/2,ImgY-8,1;1,0,0;floor(rand(1)*(ImgX-20))+2,35,1];
SPRT = [1;2;6];
MODE = 0;
GAME = [0,4];
TSTEP = 0.04;
NLIVE = -1;
drawnow;
tmp = repmat([1,2,3,2,3,6,4,10,9,14,11,16]/11,650,1);
sound(cos((1:7800)'/6).*sin((1:7800)'.*tmp(:))/3,11025);
SNDTMR = (clock)*ClkV+0.76;
set(HFIG,'WindowButtonMotionFcn',[mfilename,'(1)'],'WindowButtonDownFcn',[mfilename,'(5)']);
end
set(HMENU(1),'Label','&Pause','Callback',[mfilename,'(7)'],'Accelerator','P');
feval(mfilename,4);
while ~MODE
FrameStart = (clock)*ClkV;
if NLIVE > 1
NLIVE = NLIVE-1;
if NLIVE == 1
set(HFIG,'WindowButtonDownFcn',[mfilename,'(5)']);
feval(mfilename,4);
end;
end
IMG(:) = 0;
MAP(:) = 0;
SInd = (SPRP(:,1)-1)*ImgY+SPRP(:,2);
for k = length(SPRT):-1:1
IMG(SSPR{SPRT(k)}+SInd(k)) = SPR{SPRT(k)};
MAP(SSPR{SPRT(k)}+SInd(k)) = k;
end
i = find(SPRT == 13);
SPRInd = MAP((SPRP(i,1)-1)*ImgY+SPRP(i,2));
j = find(SPRInd);
if ~isempty(j)
SPRInd = SPRInd(j);
DelSPR = i(SPRT(SPRInd) == 17);
j = find(SPRT(SPRInd) >= 4&SPRT(SPRInd) <= 12);
if ~isempty(j)
DelSPR = [DelSPR;i(j)];
SPRInd = SPRInd(j);
k = find(SPRT(SPRInd) >= 5&SPRT(SPRInd) <= 9);
GAME(1) = GAME(1)+sum(KPts(SPRT(SPRInd(k))));
SPRT(SPRInd(k)) = 21;
k = find(SPRT(SPRInd) == 4);
SPRT(SPRInd(k)) = 5;
k = find(SPRT(SPRInd) >= 10&SPRT(SPRInd) <= 12);
if ~isempty(k)
SPRP(SPRInd(k),3) = SPRP(SPRInd(k),3)-1;
SPRT(SPRInd(k(find(SPRP(SPRInd(k),3) == 4&SPRT(SPRInd(k)) == 11)))) = 12;
k = k(find(SPRP(SPRInd(k),3) <= 0));
j = SPRInd(k);
GAME(1) = GAME(1)+sum(KPts(SPRT(j)));
SPRT(j) = 21;
SPRP(j,:) = SPRP(j,:)+repmat([4,2,0],length(j),1);
SPRP = [SPRP;SPRP(j,:)+repmat([5,0,0],length(j),1)];
SPRT = [SPRT;SPRT(j)];
end
feval(mfilename,4);
end
if ~isempty(DelSPR)
SPRT(DelSPR) = [];
SPRP(DelSPR,:) = [];
i = find(SPRT == 13);
end
end
SPRP(i,2) = SPRP(i,2)-5;
j = i(find(SPRP(i,2) <= 0));
SPRT(j) = [];
SPRP(j,:) = [];
i = find(SPRT >= 14&SPRT <= 16);
SInd = (SPRP(i,1)-1)*ImgY+SPRP(i,2);
j = find(SPRT >= 17);
k = (SPRP(j,1)-1)*ImgY+SPRP(j,2);
if (~isempty(i)&any(MAP(SInd+1+ImgY) == 1))|...
(~isempty(j)&any(MAP([k+4;k+8*ImgY+4;k+4*ImgY+9]) == 1))
SPRT(1) = 1;
SPRT = [SPRT;18];
SPRP(length(SPRT),:) = SPRP(1,:);
set(HFIG,'WindowButtonDownFcn',[mfilename,'(0)']);
GAME(2) = GAME(2)-1;
feval(mfilename,4);
if ~isinf(SNDTMR)
WaitSnd;
sound(SND{4},11025);
SNDTMR = (clock)*ClkV+0.37;
end
end
if ~isempty(i)
SPRP(i,1) = SPRP(i,1)+SPRT(i)-14-1;
SPRP(i,2) = SPRP(i,2)+2;
j = i(SPRP(i,2) > ImgY-3|SPRP(i,1) < 1|SPRP(i,1) > ImgX-3);
SPRT(j) = [];
SPRP(j,:) = [];
end
i = find(SPRT == 17);
SInd = (SPRP(i,1)-1)*ImgY+SPRP(i,2);
if ~isempty(i)
SPRP(i,2) = SPRP(i,2)+2;
j = i(SPRP(i,2) > ImgY-9);
SPRT(j) = [];
SPRP(j,:) = [];
end
i = find(SPRT == 23);
SPRT(i) = [];
SPRP(i,:) = [];
SPRT(SPRT == 22) = 23;
i = find(SPRT == 21);
SPRT(i) = 22;
if ~isempty(i)&(clock)*ClkV > SNDTMR
sound(SND{1},11025);
SNDTMR = (clock)*ClkV+0.05;
end
i = find(SPRT == 20);
if ~isempty(i)
SPRT(i) = [];
SPRP(i,:) = [];
if GAME(2) >= 0
NLIVE = 25;
else
feval(mfilename,8);
end
end
i = find(SPRT == 19);
SPRT(i) = 20;
i = find(SPRT == 18);
SPRT(i) = 19;
if (length(SPRT) < 3|rand(1) < 0.03)&~NLIVE
i = sum(SPRT >= 6&SPRT <= 11);
j = rand(1);
if j < 0.56&i < 12
SPRT = [SPRT;6];
SPRP(length(SPRT),:) = floor([rand(1)*(ImgX-15)+2,rand(1)*50+2,1]);
if (clock)*ClkV > SNDTMR
sound(SND{2},11025);
SNDTMR = (clock)*ClkV+0.28;
end
elseif j < 0.72&i < 8&GAME(1) > 100
SPRT = [SPRT;4];
SPRP(length(SPRT),:) = floor([rand(1)*(ImgX-15)+2,rand(1)*50+2,1]);
if (clock)*ClkV > SNDTMR
sound(SND{2},11025);
SNDTMR = (clock)*ClkV+0.28;
end
elseif j < 0.87&i < 10
SPRT = [SPRT;8];
SPRP(length(SPRT),:) = floor([rand(1)*(ImgX-15)+2,rand(1)*50+2,1]);
if (clock)*ClkV > SNDTMR
sound(SND{2},11025);
SNDTMR = (clock)*ClkV+0.28;
end
elseif sum(SPRT >= 10&SPRT <= 12) <= 1
if j < 0.92&i < 15&GAME(1) > 2500
SPRT = [SPRT;11];
SPRP(length(SPRT),:) = floor([rand(1)*(ImgX-27)+2,rand(1)*50+2,8]);
if (clock)*ClkV > SNDTMR
sound(SND{3},11025);
SNDTMR = (clock)*ClkV+0.37;
end
elseif i > 1&GAME(1) > 600
SPRT = [SPRT;10];
SPRP(length(SPRT),:) = floor([rand(1)*(ImgX-24)+2,rand(1)*50+2,4]);
if (clock)*ClkV > SNDTMR
sound(SND{3},11025);
SNDTMR = (clock)*ClkV+0.37;
end
end
end
end
i = find(SPRT == 6|SPRT == 7);
if ~isempty(i)
SPRP(i,1) = min(max(SPRP(i,1)+floor(rand(length(i),1)*3)-1,1),ImgX-11);
SPRP(i,2) = min(max(SPRP(i,2)+floor(rand(length(i),1)*3)-1,1),ImgY-40);
if rand(1) < 0.01*length(i)&~NLIVE
j = 1+round(rand(1)*(length(i)-1));
SPRT = [SPRT;14+2*round(rand(1))];
SPRP(length(SPRT),:) = SPRP(i(j),:)+[5,6,0];
end
SPRT(i) = min(max(round(SPRT(i)+rand(length(i),1)*1.2-0.6),6),7);
end
i = find(SPRT == 4|SPRT == 5);
Dir = sign(SPRP(1,1)-SPRP(i,1)-3);
SPRP(i,1) = min(max(SPRP(i,1)+floor(rand(length(i),1)*7)-3+Dir,1),ImgX-9);
SPRP(i,2) = min(max(SPRP(i,2)+floor(rand(length(i),1)*3)-1,1),ImgY-40);
if rand(1) < 0.05*length(i)&~NLIVE
j = 1+round(rand(1)*(length(i)-1));
SPRT = [SPRT;14+round(2*rand(2,1))];
SPRP(length(SPRT)+(-1:0),:) = [SPRP(i(j),:);SPRP(i(j),:)]+[5,10,0;5,10,0];
end
i = find(SPRT == 8|SPRT == 9);
if ~isempty(i)
SPRP(i,1) = min(max(SPRP(i,1)+floor(rand(length(i),1)*5)-2,1),ImgX-8);
SPRP(i,2) = min(max(SPRP(i,2)+floor(rand(length(i),1)*5)-2,1),ImgY-40);
if rand(1) < 0.02*length(i)&~NLIVE
j = 1+round(rand(1)*(length(i)-1));
SPRT = [SPRT;15];
SPRP(length(SPRT),:) = SPRP(i(j),:)+[4,5,0];
end
SPRT(i) = min(max(round(SPRT(i)+rand(length(i),1)*2-1),8),9);
end
i = find(SPRT == 10);
if ~isempty(i)
Dir = sign(SPRP(1,1)-SPRP(i,1)-11);
SPRP(i,1) = min(max(SPRP(i,1)+Dir,1),ImgX-22);
SPRP(i,2) = min(max(SPRP(i,2)+floor(rand(length(i),1)*3)-1,1),ImgY-55);
if rand(1) < 0.05*length(i)&~NLIVE
j = 1+round(rand(1)*(length(i)-1));
SPRT = [SPRT;17];
SPRP(length(SPRT),:) = SPRP(i(j),:)+[10,5,0];
end
end
i = find(SPRT == 11|SPRT == 12);
if ~isempty(i)
Dir = sign(SPRP(1,1)-SPRP(i,1)-11);
SPRP(i,1) = min(max(SPRP(i,1)-Dir,1),ImgX-25);
SPRP(i,2) = min(max(SPRP(i,2)+floor(rand(length(i),1)*3)-1,1),ImgY-55);
if rand(1) < 0.02*length(i)&sum(SPRT == 6) < 12&~NLIVE
j = 1+round(rand(1)*(length(i)-1));
SPRT = [SPRT;6+3*round(0.8*rand(1))];
SPRP(length(SPRT),:) = SPRP(i(j),:)+[10,11,0];
end
end
figure(HFIG);
image(IMG);
ax = gca;
set(ax,'Visible','off','DataAspectRatio',[1 1 1]);
while (clock)*ClkV-FrameStart < TSTEP&~MODE
drawnow;
end;
drawnow;
end
else
switch cmd
case 1
Mouse = floor(0.41*get(HFIG,'CurrentPoint'))-[16,12];
SPRP(1,:) = [max(5,min(ImgX-12,Mouse(1))),max(ImgY-45,min(ImgY-9,ImgY-Mouse(2))),0];
case 2
SPRT = [SPRT;13];
SPRP(length(SPRT),:) = [SPRP(1,1)+3,max(2,SPRP(1,2)-4),0];
case 4
if NLIVE == -1
SSPR{2} = [SSPR{38}+ImgY*11+20;SSPR{25}+ImgY*14+59];
SPR{2} = [SPR{38};SPR{25}];
else
Str = sprintf('%6d',min(GAME(1),999999));
SPR{2} = zeros(size(IMG));
SPR{2}(SSPR{24}+4+ImgY*3) = SPR{24};
Pos = 4+ImgY*27;
for i = 1:length(Str)
if Str(i) >= '0'&Str(i) <= '9'
j = 28+Str(i)-'0';
SPR{2}(SSPR{j}+Pos) = SPR{j};
end
Pos = Pos+ImgY*4;
end
Pos = 13+ImgY*4;
for i = 1:GAME(2)
SPR{2}(SSPR{3}+Pos) = 11;
Pos = Pos+ImgY*8;
end
if MODE == 2
SPR{2}(SSPR{26}+floor((ImgX-23)/2)*ImgY+floor(ImgY/3)) = SPR{26};
elseif NLIVE == 1
SPR{2}(SSPR{25}+floor((ImgX-51)/2)*ImgY+floor(ImgY/3)) = SPR{25};
end
SSPR{2} = find(SPR{2});
SPR{2} = SPR{2}(SSPR{2});
end
case 5
SPRT(1) = 3;
set(HFIG,'WindowButtonDownFcn',[mfilename,'(2)']);
if NLIVE
i = find(SPRT >= 14&SPRT <= 17);
SPRT(i) = [];
SPRP(i,:) = [];
NLIVE = 0;
end
if MODE
MODE = 0;
feval(mfilename,6);
else
feval(mfilename,4);
end
case 7
set(HMENU(1),'Label','&Resume','Callback',[mfilename,'(5)']);
set(HFIG,'WindowButtonDownFcn',[mfilename,'(5)']);
MODE = 2;
feval(mfilename,4);
feval(mfilename,9);
if ~isinf(SNDTMR)
WaitSnd;
sound(SND{5},11025);
SNDTMR = (clock)*[0;0;86400;3600;60;1]+0.19;
end
case 8
if MODE ~= 1
if ~isinf(SNDTMR)
WaitSnd;
tmp = repmat([9,0,0,6,11,5,10,4,9,3,8,2,7]/11,600,1);
sound(cos((1:7800)'/6).*sin((1:7800)'.*tmp(:))/3,11025);
SNDTMR = (clock)*[0;0;86400;3600;60;1]+1.26;
end
HighScore(GAME(1));
end
MODE = 1;
NLIVE = 0;
feval(mfilename,4);
SSPR{2} = [SSPR{2};SSPR{27}+floor((ImgX-37)/2)*ImgY+floor(ImgY/3)];
SPR{2} = [SPR{2};SPR{27}];
feval(mfilename,9);
GAME = [0,4];
SPRP = [ImgX/2,ImgY-8,1;1,0,0;floor(rand(1)*(ImgX-20))+2,35,1];
SPRT = [1;2;6];
NLIVE = 2;
set(HFIG,'WindowButtonDownFcn',[mfilename,'(5)']);
set(HMENU(1),'Label','&New','Accelerator','N','Callback',[mfilename,'(5)']);
case 9
IMG(:) = 0;
SInd = (SPRP(:,1)-1)*ImgY+SPRP(:,2);
for k = length(SPRT):-1:1
IMG(SSPR{SPRT(k)}+SInd(k)) = SPR{SPRT(k)};
end
figure(HFIG);
image(IMG);
ax = gca;
set(ax,'Visible','off');
set(get(ax,'Title'),'Visible','on');
set(ax,'DataAspectRatio',[1 1 1]);
case 10
TSTEP = 1/25;
set(HMENU(2),'Checked','on');
set(HMENU(3:5),'Checked','off');
case 11
TSTEP = 1/30;
set(HMENU(3),'Checked','on');
set(HMENU([2,4,5]),'Checked','off');
case 12
TSTEP = 1/35;
set(HMENU(4),'Checked','on');
set(HMENU([2,3,5]),'Checked','off');
case 13
tmp = inputdlg('Frames per second (increase for faster game)',...
'Custom Difficulty',1,{num2str(1/TSTEP)});
if ~isempty(tmp)
tmp = str2double(tmp);
if ~isnan(tmp)&isreal(tmp)&tmp >= 1
TSTEP = 1/tmp;
set(HMENU(5),'Checked','on');
set(HMENU(2:4),'Checked','off');
end;
end
case 14
if isinf(SNDTMR)
set(HMENU(6),'Checked','on');
SNDTMR = 0.05;
else
set(HMENU(6),'Checked','off');
SNDTMR = inf;
end
case 15
if ~MODE
feval(mfilename,7);
end
msgbox(HighScore,'Highscores');
case -1
MODE = 1;
drawnow;
IMG = [];
MAP = [];
SPR = [];
SSPR = [];
SND = [];
GAME = [];
closereq;
end
end
return;
function WaitSnd
global SNDTMR;
while (clock)*[0;0;86400;3600;60;1] < SNDTMR
drawnow;
end
return
function Scores = HighScore(NewScore)
ToolboxPath = fullfile(matlabroot,'toolbox','');
Scores = [];
if exist(ToolboxPath,'dir')
GameDataPath = fullfile(ToolboxPath,'gamedata','');
eval(['load(fullfile(''',GameDataPath,''',''galactic.mat''))'],'');
Scores = char(255-reshape(double(Scores),size(Scores,2),size(Scores,1)))';
end
if nargin == 1&NewScore >= 200&exist(ToolboxPath,'dir')&mkdir(ToolboxPath,'gamedata')
NewScore = min(NewScore,999999);
[tmp,i] = sortrows(strvcat(sprintf('%8d',NewScore),Scores));
i = find(i == 1);
Rank = size(Scores,1)+2-i;
if Rank <= 6
tmp = inputdlg(sprintf('You are #%d,enter your name:',Rank),'Highscore',1,{''});
if isempty(tmp)|isempty(tmp{1})
tmp = '???';
else
tmp = tmp{1};
end
Scores = strvcat(Scores(1:Rank-1,:),sprintf('%8d    %s',NewScore,tmp),Scores(Rank:end,:));
Scores = Scores(1:min(6,size(Scores,1)),:);
Scores = char(reshape(255-double(Scores)',size(Scores,1),size(Scores,2)));
save(fullfile(GameDataPath,'galactic.mat'),'Scores');
end
end
return
function GameInit(ImgY)
global SPR SSPR SND;
SND{1} = sin((1:256)'.*sin((1:256)'/20)/10)/4;
tmp = (1:2500)';
SND{2} = min(max(cumsum(sign(sin(tmp/13))).*(1+sin(tmp/130))/4.*linspace(0,1,2500)'.^0.2 ...
- 0.5,-1),1).*sqrt(abs(sin(tmp*pi/2500)))/2;
SND{3} = sin((1:3500)'.*cos((1:3500)'/100)/10)/4;
tmp = (3500:-1:1)';
SND{4} = (cos(tmp.*sin(tmp/200)/6)/2+sin(tmp.^1.5/170).*sign(sin(tmp.^1.3/40))).* ...
linspace(0.6,0.25,3500)'.^2;
tmp = repmat([5,0,3,0,0,9]/8,250,1);
SND{5} = cos((1:1500)').*sin((1:1500)'.*tmp(:))/3;
EChr = char([33:38,40:95,97:126]);
DChr(double(EChr)) = 1:length(EChr);
Dect = 0:63;
bit = 2.^(1:6)';
Dect = round(rem(Dect(ones(6,1),:),bit(:,ones(1,64)))./bit(:,ones(1,64)));
SPR = cell(38,1);
SSPR = cell(38,1);
SprDB = {'!','!',')##$^"^]Y1!^"~!Be*c~',['0$&)*f*"B%!4!*"B%f~(!GB)X#',...
'>-RO1Y#:-FBI"2~g.!Re.!Rf~'],['0%&)*+g"!%!2!B"!#f~c#B1B#!,!N1!#!/!',...
'B1!B~g.!Re.!Rf~B!:$!A!Z"^$!A!^!*"!*!~'],[',$&()g0B#c,B$f~!B$^"bfR',...
'1^"0d~cB!%!CAZ)a"2!%!#c~'],[',$&()g0B#c,B$f~0R)Z"^g1Z"AB$!~cB!%!C',...
'AZ)a"2!%!#c~'],'*#%))^B)!ZS$)!~B!-:a"(NB!~',['*#%)!RR)!^"$c~B!-:a',...
'"(NB!~'],['-$&)*k"R"%$Bd2!*d"D"0!#k~p.!(eR!:p!~*R*F%CF2,2F*,Z!5R[',...
'[Q^901H!>!3C*+&F%+4%#"#~'],['<$&()!#Zc*ZcBb"c^)cRb!BBC$:0X+!bQQ">',...
':b_SQbIr_A$aQb(Rba1!a]A!ZY""BQ$.!\)B!JA!#R^":BC)B"(@!a/F$.>!ZZda"',...
'cB$c~!R)cR)"!>!(!Z$:!R1!"!A!.!R"Re0pppoR$dAd0g~pi@d*(c22!BI!#!2!:',...
'c#B^"2![1!"Rb"%Bb)*aaA2^Ub"ZAb)Bb_1!aIA!ZAa"Bb"#!^$d)l~'],['<$&()',...
'!%2c2R)cb)cZ-cB1c")$:>.5!Eb@$.]b_SabIr_A#aQA!Rba).a]A0Z9"+BQ".!\"',...
'B!B1*#B^"=!E)E".@!a=J$.Z!ZZda"cB$c~!B1cB1c:!*!R)V!BAR$!a!>!B$B"d.',...
'pppoR)dbd0g~piZdR.dCc%!#d:c#!^"2!R1!"!R"%BR)*#XA2!Tb"!2b1!R_AcFb!',...
':2a$Ba!%!^$d)l~'],'$"%)~','$"*\#~','$"*\#~','$"*\#~',['+",^SArrrb',...
'YA^"~'],'!',')"%c2%IA@N2!~','*"%*L&A^_1A^K&D~','!',[')"+c2%IA@N2!',...
'~'],'*"+*L&A^_1A^K&D~','&",X<$ZD3B-(?BAKJ"b<%~',['&",P:%^CB1R&EB1',...
';$c2Z)!P:V"cBOX!CA!Z-@RQN"CA!~'],'&",bT"Z-@R)a"X<$^M3R1\!~',['&",',...
'P:(Z-@R1:#ARQ("cR&E0R$a!b<%^-=~'],  '&",bZ)~', '&",!R)~','&",_\&~',...
'&",W\)~','&",)T)~','&",Y<)~','&",b<)~','&",CR)~','&",b\)~',['&",Y',...
'\)~'],['@#,-gRb$!Br1^ZrAD^1!@Ta"!@!@!2@a@!:@L@!^AD>!^A!2!^1#eacbA',...
'#!abA!^b)!aa")!,^b)!X!abAdbAaeLarADarAe>ad>BeacbAcabAa^b)!La")!D^',...
'b)dabAacbA,eXRr$!^r1!@c@!0c>!@c@F>c0TeL0dF0earA>arAD0dD0d>f^rA>ar',...
'1DeDRr$>^r1!@c@00c>*@c@a>c0g~!Zb)!R1!>!>cR!(cB!$RbC!"@ZC!C$NC!C!H',...
'C!C!#B!E!#B!P!#R!ZBrcb!B!a"!B!$!Zb!"a*c$!Zb!a"!Bcb!B!rr!"cB!"cB!r',...
'bEeDcBrcb!B!a"!B!$!Zb!"a*c$!Zb!a"!Bcb!B!Zrb!0c>!$cR!CrC!ScE!CcC!E',...
'cS!bcA!3eSrb!"cB!"cB!Srb!3err!$cB!"cR!rbA!0c>!$cR!CrC!ScE!CcC!EcS',...
'!acA!~']};
for i = 1:38
% sprite decoder, Pascal Getreuer 2004
h = DChr(double(SprDB{i}(1)))-1;
if h
NumColors = DChr(double(SprDB{i}(2)))-1;
Color = DChr(double(SprDB{i}(2+(1:NumColors))));
tmp = SprDB{i}(3+NumColors:end);
for k = 2:15
tmp = strrep(tmp,EChr(63+k),EChr(ones(1,k)));
end
tmp = strrep(tmp,EChr(80),EChr([64,64]));
EncImg = DChr(double(tmp));
ColorEnd = find(EncImg == length(EChr));
eval('Img=Dect(:,EncImg(1:ColorEnd(1)-1))*Color(1);','error(''Sprite data corrupt.'')');
for k = 2:NumColors
eval('Img=Img+Dect(:,EncImg(ColorEnd(k-1)+1:ColorEnd(k)-1))*Color(k);',...
'error(''Sprite data corrupt.'')');
end
tmp = find(Img)-1;
SPR{i} = Img(tmp+1);
SSPR{i} = floor(tmp/h)*ImgY+rem(tmp,h)+1;
end
end
return;

文件列表(点击上边下载按钮,如果是垃圾文件请在下面评价差评或者投诉):

关键词: 太空之战 程序项目 matlab 源码程序

Top_arrow
回到顶部
联系方式| 版权声明| 招聘信息| 广告服务| 银行汇款| 法律顾问| 兼职技术| 付款方式| 关于我们|
网站客服网站客服 程序员兼职招聘 程序员兼职招聘
沪ICP备19040327号-3
公安备案号:沪公网安备 31011802003874号
库纳格流体控制系统(上海)有限公司 版权所有
Copyright © 1999-2014, GUSUCODE.COM, All Rights Reserved