Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function vizimpacts
- res = 70;
- guns = {'ak47', 'aug', 'awp', 'bizon', 'deagle', 'elite', 'famas', 'fiveseven', 'g3sg1', 'galilar', 'glock', 'hkp2000', 'm249', 'm4a1', 'mac10', 'mag7', 'mp7', 'mp9', 'negev', 'nova', 'p250', 'p90', 'sawedoff', 'scar20', 'sg556', 'ssg08', 'tec9', 'ump45', 'xm1014'};
- bullets = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 1 1 1 9 1 1 9 1 1 1 1 1 6];
- clipsize = [30 30 10 64 7 30 25 20 20 35 20 13 100 30 30 5 30 30 150 8 13 50 7 20 30 10 32 25 7];
- cycletime = [0.1 0.09 1.455 0.08 0.225 0.12 0.09 0.15 0.25 0.09 0.15 0.17 0.08 0.09 0.075 0.65 0.08 0.07 0.06 0.88 0.15 0.07 0.85 0.25 0.09 1.25 0.12 0.090 0.25];
- for i=1:length(guns)
- % subtract the position of the first bullet from the rest of the bullets in the mag
- data = load(['data/nospread/weapon_' guns{i} '-stand.txt']);
- data = data(1:bullets(i):end,4:5);
- data = bsxfun(@minus,data,data(1,:));
- % invert the horizontal axis to make it consistent with the player's view
- data(:,1) = -data(:,1);
- hf = figure('InvertHardCopy','off','Color',[0.3 0.3 0.3]);
- % background text
- axes('Position',[0 0 1 1]);
- axis off;
- text(0,0,guns{i},'Units','normalized','Color',[0.4 0.4 0.4],'FontWeight','bold','FontName','Tahoma','FontSize',70,'VerticalAlignment','bottom','HorizontalAlignment','left');
- % plot impacts
- axes;
- axis image;
- axis off;
- % axis limits
- xlim([-110 110]);
- ylim([-5 300]);
- hold on;
- line([0 0],[-5 300],'Color',[0.4 0.4 0.4],'LineWidth',5);
- colors = [linspace(1,1,clipsize(i)); linspace(1,0,clipsize(i)); linspace(0,0,clipsize(i))]';
- for j=1:clipsize(i)
- scatter(data(j,1),data(j,2),100,'MarkerEdgeColor',colors(j,:),'MarkerFaceColor',colors(j,:));
- % save as image
- fn = sprintf('images/%s-%03d.png',guns{i},j);
- print(hf,'-dpng',['-r' num2str(res)],fn);
- end
- close(hf);
- % build animation using ImageMagick and remove the intermediate images
- system(sprintf('convert \\( -delay %d images/%s-*.png \\) \\( -delay 200 images/%s-%03d.png \\) images/%s.gif',round(cycletime(i)*100),guns{i},guns{i},clipsize(i),guns{i}));
- delete(sprintf('images/%s-*.png',guns{i}));
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement