PageRenderTime 54ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/main.c

https://github.com/KarinnSisley/FashionfromKarinn
C | 1477 lines | 1346 code | 131 blank | 0 comment | 564 complexity | ba088e13376f3fa5eb1da998b26a59bc MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <SDL/SDL.h>
  4. #include <string.h>
  5. #include "SDL/SDL_image.h"
  6. #include "SDL_ttf.h"
  7. struct cloth
  8. {
  9. SDL_Surface*picture;
  10. SDL_Rect offset;
  11. int flag;
  12. };
  13. void blitcloth( struct cloth*c, SDL_Surface * dest)
  14. {
  15. if (c->flag)
  16. SDL_BlitSurface (c->picture, NULL, dest, &c->offset);
  17. }
  18. SDL_Surface *Load_Image (char *filename)
  19. {
  20. SDL_Surface *Loaded_Image=NULL;
  21. SDL_Surface *Optimized_Image=NULL;
  22. Loaded_Image = IMG_Load (filename);
  23. if (Loaded_Image != NULL)
  24. {
  25. Optimized_Image = SDL_DisplayFormat (Loaded_Image);
  26. SDL_FreeSurface (Loaded_Image);
  27. if (Optimized_Image != NULL)
  28. {
  29. Uint32 colorkey = SDL_MapRGB (Optimized_Image->format, 0xFF, 0xFF, 0xFF);
  30. SDL_SetColorKey (Optimized_Image, SDL_SRCCOLORKEY, colorkey);
  31. }
  32. }
  33. return Optimized_Image;
  34. }
  35. SDL_Event event;
  36. Uint32 callback ( Uint32 interval, void*p)
  37. {
  38. *(int*)p=0;
  39. return 0;
  40. }
  41. int main( int argc, char *args [])
  42. {
  43. char b[20];
  44. int shoulderx=36/2, shouldery=65,x,y,length,height,score=0,quite = 0,nenuzhnaya=1,level,n=700/4+100;
  45. double i=0;
  46. TTF_Init();
  47. SDL_Surface* screen = NULL;
  48. SDL_Surface *message = NULL;
  49. SDL_Surface *message2 = NULL;
  50. SDL_Surface *message3 = NULL;
  51. SDL_Surface *message4 = NULL;
  52. SDL_Surface *message5 = NULL;
  53. SDL_Surface *message6 = NULL;
  54. SDL_Surface *message7 = NULL;
  55. SDL_Surface *message8 = NULL;
  56. SDL_Surface *message9 = NULL;
  57. SDL_Surface *message10 = NULL;
  58. SDL_Surface *message11 = NULL;
  59. SDL_Surface *message12 = NULL;
  60. SDL_Surface *message13 = NULL;
  61. SDL_Surface *message14 = NULL;
  62. SDL_Surface *message15= NULL;
  63. SDL_Surface *message16 = NULL;
  64. TTF_Font *font = NULL;
  65. SDL_Surface* background = NULL;
  66. SDL_Rect text,text2,text3,text4,text5,text6,text7,text8,text9,text10,text11,text12,text13,text14,text15,text16;
  67. struct cloth girl,girl1, girl2,girl3,girl4, dress,shoes,coat,bag,jewelry,trousers,forjewelry,fortrousers,forcoat,fordress,forshoes,forbags,forshoestxt,forovercoatstxt,fordressestxt,forbagstxt,fortrouserstxt,forjewelrytxt;
  68. struct cloth *cloth_selected=NULL;
  69. font = TTF_OpenFont( "lazy.ttf", 28 );
  70. SDL_Color textColor = { 153, 51, 51 };
  71. SDL_Color textColor2 = { 244, 164, 94 };
  72. SDL_Init( SDL_INIT_EVERYTHING );
  73. screen = SDL_SetVideoMode( 1024, 700, 16, SDL_SWSURFACE );
  74. SDL_AddTimer(3000,callback, &nenuzhnaya);
  75. level=1;
  76. background = IMG_Load("background1.jpg");
  77. girl.picture = Load_Image("dita.png");
  78. girl.flag=1;
  79. dress.picture = Load_Image ("dress.png");
  80. dress.flag=1;
  81. shoes.picture = Load_Image ("blackshoes.png");
  82. shoes.flag=1;
  83. coat.picture = Load_Image("whitecoat.png");
  84. coat.flag=1;
  85. bag.picture= Load_Image("bag.png");
  86. bag.flag=1;
  87. forcoat.picture= IMG_Load ("forcoat1.png");
  88. forcoat.flag=1;
  89. fordress.picture= IMG_Load ("fordress.png");
  90. fordress.flag=1;
  91. forshoes.picture= Load_Image("forshoes.png");
  92. forshoes.flag=1;
  93. forbags.picture= Load_Image("forbags.png");
  94. forbags.flag=1;
  95. forshoestxt.picture= Load_Image("forshoestxt.png");
  96. forshoestxt.flag=1;
  97. forovercoatstxt.picture= Load_Image("forovercoatstxt.png");
  98. forovercoatstxt.flag=1;
  99. fordressestxt.picture= Load_Image("fordressestxt.png");
  100. fordressestxt.flag=1;
  101. forbagstxt.picture= Load_Image("forbagstxt.png");
  102. forbagstxt.flag=1;
  103. girl.offset.x = 1024/2-girl.picture->w/2;
  104. girl.offset.y = 700/2-girl.picture->h/2;
  105. dress.offset.x = (1024/2-girl.picture->w/2)+ shoulderx;
  106. dress.offset.y = (700/2-girl.picture->h/2)+ shouldery;
  107. shoes.offset.x = 1024/2-shoes.picture->w/2-10;
  108. shoes.offset.y = 1024/2-15;
  109. coat.offset.x = (1024/2-girl.picture->w/2)+ shoulderx-14;
  110. coat.offset.y = (700/2-girl.picture->h/2)+ shouldery-20;
  111. bag.offset.x = (1024/2-girl.picture->w/2)+ 5.3*shoulderx;
  112. bag.offset.y = (700/2-girl.picture->h/2)+ 3*shouldery;
  113. forcoat.offset.x = 1024/16;
  114. forcoat.offset.y = 700/12;
  115. fordress.offset.x = 3000/4;
  116. fordress.offset.y = 700/14;
  117. forshoes.offset.x= 1024/16;
  118. forshoes.offset.y=800/2;
  119. forbags.offset.x= 3000/4;
  120. forbags.offset.y= 800/2;
  121. forshoestxt.offset.x=1024/18;
  122. forshoestxt.offset.y=430;
  123. forovercoatstxt.offset.x=1024/16;
  124. forovercoatstxt.offset.y=700/9;
  125. fordressestxt.offset.x=3000/4;
  126. fordressestxt.offset.y= 22;
  127. forbagstxt.offset.x= 3000/4;
  128. forbagstxt.offset.y=800/2;
  129. while (quite == 0)
  130. {
  131. while ( SDL_PollEvent( &event ) )
  132. {
  133. if ( event.type == SDL_QUIT )
  134. quite = 1;
  135. if (level==1)
  136. {
  137. if ( !nenuzhnaya && event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_LEFT)
  138. {
  139. x = event.button.x;
  140. y = event.button.y;
  141. length=bag.offset.x + bag.offset.w;
  142. height=bag.offset.y + bag.offset.h;
  143. if (x>bag.offset.x && x<(length) && y>bag.offset.y && y<(height)&& bag.flag==1)
  144. {
  145. cloth_selected=&bag;
  146. continue;
  147. }
  148. if (cloth_selected==&bag)
  149. {
  150. length=forbags.offset.x + forbags.offset.w;
  151. height=forbags.offset.y + forcoat.offset.h;
  152. if (x>forbags.offset.x && x<(length) && y>forbags.offset.y && y<(height))
  153. score=score+10;
  154. bag.flag=0;
  155. cloth_selected=NULL;
  156. }
  157. length=coat.offset.x + coat.offset.w;
  158. height=coat.offset.y + coat.offset.h;
  159. if (x>coat.offset.x && x<(length) && y>coat.offset.y && y<(height)&&coat.flag==1)
  160. {
  161. cloth_selected=&coat;
  162. continue;
  163. }
  164. if (cloth_selected==&coat)
  165. {
  166. x = event.button.x;
  167. y = event.button.y;
  168. length=forcoat.offset.x + forcoat.offset.w;
  169. height=forcoat.offset.y + forcoat.offset.h;
  170. if (x>forcoat.offset.x && x<(length) && y>forcoat.offset.y && y<(height))
  171. score=score+10;
  172. coat.flag=0;
  173. cloth_selected=NULL;
  174. }
  175. x = event.button.x;
  176. y = event.button.y;
  177. length=shoes.offset.x + shoes.offset.w;
  178. height=shoes.offset.y + shoes.offset.h;
  179. if (x>shoes.offset.x && x<(length) && y>shoes.offset.y && y<(height)&& shoes.flag==1)
  180. {
  181. cloth_selected=&shoes;
  182. continue;
  183. }
  184. if (cloth_selected==&shoes)
  185. {
  186. x = event.button.x;
  187. y = event.button.y;
  188. length=forshoes.offset.x + forshoes.offset.w;
  189. height=forshoes.offset.y + forshoes.offset.h;
  190. if (x>forshoes.offset.x && x<(length) && y>forshoes.offset.y && y<(height))
  191. score=score+10;
  192. shoes.flag=0;
  193. cloth_selected=NULL;
  194. }
  195. x= event.button.x;
  196. y = event.button.y;
  197. length=dress.offset.x + dress.offset.w;
  198. height=dress.offset.y + dress.offset.h;
  199. if (x>dress.offset.x && x<(length) && y>dress.offset.y && y<(height)&& dress.flag==1)
  200. {
  201. cloth_selected=&dress;
  202. continue;
  203. }
  204. if (cloth_selected==&dress)
  205. {
  206. x = event.button.x;
  207. y = event.button.y;
  208. length=fordress.offset.x + fordress.offset.w;
  209. height=fordress.offset.y + fordress.offset.h;
  210. if (x>fordress.offset.x && x<(length) && y>fordress.offset.y && y<(height))
  211. score=score+10;
  212. dress.flag=0;
  213. cloth_selected=NULL;
  214. }
  215. }
  216. if ( event.type == SDL_QUIT )
  217. quite = 1;
  218. SDL_BlitSurface( background, NULL, screen, NULL );
  219. blitcloth (&girl, screen);
  220. blitcloth (&dress, screen);
  221. blitcloth (&shoes,screen);
  222. blitcloth (&coat, screen);
  223. blitcloth (&bag, screen);
  224. blitcloth (&forcoat,screen);
  225. blitcloth (&fordress,screen);
  226. blitcloth (&forshoes, screen);
  227. blitcloth (&forbags, screen);
  228. if (nenuzhnaya)
  229. {
  230. blitcloth (&forshoestxt,screen);
  231. blitcloth (&forovercoatstxt,screen);
  232. blitcloth (&fordressestxt,screen);
  233. blitcloth (&forbagstxt,screen);
  234. }
  235. snprintf(b, sizeof (b), "score: %d", score);
  236. message = TTF_RenderText_Solid( font, b, textColor );
  237. text.x= 900/2;
  238. text.y=700/10;
  239. text.w=message->w;
  240. text.h=message->h;
  241. SDL_BlitSurface( message, NULL,screen, &text );
  242. SDL_Flip( screen );
  243. if (score<40 && dress.flag==0 && bag.flag==0 && coat.flag==0 && shoes.flag==0 )
  244. {
  245. dress.flag=1;
  246. bag.flag=1;
  247. coat.flag=1;
  248. shoes.flag=1;
  249. score=0;
  250. continue;
  251. }
  252. else if (score==40)
  253. {
  254. nenuzhnaya=1;
  255. level=2;
  256. SDL_AddTimer(2000,callback, &nenuzhnaya);
  257. background = IMG_Load("background2.png");
  258. girl.picture = Load_Image("audrey.png");
  259. girl.flag=1;
  260. dress.picture = Load_Image ("audreydress.png");
  261. dress.flag=1;
  262. shoes.picture = Load_Image ("audreyboots.png");
  263. shoes.flag=1;
  264. jewelry.picture = Load_Image("audreybracelet.png");
  265. jewelry.flag=1;
  266. bag.picture= Load_Image("bag2.png");
  267. bag.flag=1;
  268. trousers.picture= Load_Image("audreytrousers.png");
  269. trousers.flag=1;
  270. fortrousers.picture= IMG_Load ("fortrousers.png");
  271. forcoat.flag=1;
  272. fordress.picture= IMG_Load ("fordress2.png");
  273. fordress.flag=1;
  274. forshoes.picture= IMG_Load ("forshoes2.png");
  275. forshoes.flag=1;
  276. forbags.picture= IMG_Load ("forbags2.png");
  277. forbags.flag=1;
  278. forjewelry.picture= IMG_Load ("forjew.png");
  279. forjewelry.flag=1;
  280. fortrouserstxt.picture= Load_Image("fortrouserstxt2.png");
  281. fortrouserstxt.flag=1;
  282. fordressestxt.picture= Load_Image("fordresstxt2.png");
  283. fordressestxt.flag=1;
  284. forbagstxt.picture= Load_Image("forbagstxt2.png");
  285. forbagstxt.flag=1;
  286. forjewelrytxt.picture= Load_Image("forjewtxt2.png");
  287. forjewelrytxt.flag=1;
  288. forshoestxt.picture= Load_Image("forshoestxt2.png");
  289. forshoestxt.flag=1;
  290. girl.offset.x = 1024/2-girl.picture->w/2;
  291. girl.offset.y = 700/2-girl.picture->h/2;
  292. dress.offset.x = (1024/2-girl.picture->w/2)+ 22;
  293. dress.offset.y = (700/2-girl.picture->h/2)+57;
  294. shoes.offset.x = 1024/2-shoes.picture->w/2-19;
  295. shoes.offset.y = 1024/2-73;
  296. trousers.offset.x = (1024/2-girl.picture->w/2)+18;
  297. trousers.offset.y = (700/2-girl.picture->h/2)+150;
  298. bag.offset.x = (1024/2-girl.picture->w/2)-3;
  299. bag.offset.y = (700/2-girl.picture->h/2)+230;
  300. jewelry.offset.x = (1024/2-girl.picture->w/2)+137;
  301. jewelry.offset.y = (700/2-girl.picture->h/2)+ 215;
  302. fortrousers.offset.x = 1024/20-70;
  303. fortrousers.offset.y = 700/20-50;
  304. fordress.offset.x = 810;
  305. fordress.offset.y = 700/20-30;
  306. forshoes.offset.x= 1024/20-30;
  307. forshoes.offset.y=800/1.6;
  308. forbags.offset.x=810;
  309. forbags.offset.y= 700/1.5+23;
  310. forjewelry.offset.x= 600;
  311. forjewelry.offset.y= 0.3;
  312. forshoestxt.offset.x=100;
  313. forshoestxt.offset.y=500;
  314. fortrouserstxt.offset.x=1024/26+50;
  315. fortrouserstxt.offset.y=700/18;
  316. fordressestxt.offset.x=790;
  317. fordressestxt.offset.y= 230;
  318. forbagstxt.offset.x= 700;
  319. forbagstxt.offset.y=800/2;
  320. forjewelrytxt.offset.x= 3000/5.5;
  321. forjewelrytxt.offset.y=800/10;
  322. }
  323. }
  324. if (level==2)
  325. {
  326. if ( !nenuzhnaya && event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_LEFT)
  327. {
  328. x = event.button.x;
  329. y = event.button.y;
  330. length=bag.offset.x + bag.offset.w;
  331. height=bag.offset.y + bag.offset.h;
  332. if (x>bag.offset.x && x<(length) && y>bag.offset.y && y<(height)&&bag.flag==1)
  333. {
  334. cloth_selected=&bag;
  335. continue;
  336. }
  337. if (cloth_selected==&bag)
  338. {
  339. length=forbags.offset.x + forbags.offset.w;
  340. height=forbags.offset.y + forcoat.offset.h;
  341. if (x>forbags.offset.x && x<(length) && y>forbags.offset.y && y<(height))
  342. score=score+10;
  343. bag.flag=0;
  344. cloth_selected=NULL;
  345. }
  346. x= event.button.x;
  347. y = event.button.y;
  348. length=dress.offset.x + dress.offset.w;
  349. height=dress.offset.y + dress.offset.h;
  350. if (x>dress.offset.x && x<(length) && y>dress.offset.y && y<(height)&&dress.flag==1)
  351. {
  352. cloth_selected=&dress;
  353. continue;
  354. }
  355. if (cloth_selected==&dress)
  356. {
  357. x = event.button.x;
  358. y = event.button.y;
  359. length=fordress.offset.x + fordress.offset.w;
  360. height=fordress.offset.y + fordress.offset.h;
  361. if (x>fordress.offset.x && x<(length) && y>fordress.offset.y && y<(height))
  362. score=score+10;
  363. dress.flag=0;
  364. cloth_selected=NULL;
  365. }
  366. length=trousers.offset.x + trousers.offset.w;
  367. height=trousers.offset.y + trousers.offset.h;
  368. if (x>trousers.offset.x && x<(length) && y>trousers.offset.y && y<(height)&&trousers.flag==1)
  369. {
  370. cloth_selected=&trousers;
  371. continue;
  372. }
  373. if (cloth_selected==&trousers)
  374. {
  375. x = event.button.x;
  376. y = event.button.y;
  377. length=fortrousers.offset.x + fortrousers.offset.w;
  378. height=fortrousers.offset.y + fortrousers.offset.h;
  379. if (x>fortrousers.offset.x && x<(length) && y>fortrousers.offset.y && y<(height))
  380. score=score+10;
  381. trousers.flag=0;
  382. cloth_selected=NULL;
  383. }
  384. length=jewelry.offset.x + jewelry.offset.w;
  385. height=jewelry.offset.y + jewelry.offset.h;
  386. if (x>jewelry.offset.x && x<(length) && y>jewelry.offset.y && y<(height)&&jewelry.flag==1)
  387. {
  388. cloth_selected=&jewelry;
  389. continue;
  390. }
  391. if (cloth_selected==&jewelry)
  392. {
  393. x = event.button.x;
  394. y = event.button.y;
  395. length=forjewelry.offset.x + forjewelry.offset.w;
  396. height=forjewelry.offset.y + forjewelry.offset.h;
  397. if (x>forjewelry.offset.x && x<(length) && y>forjewelry.offset.y && y<(height))
  398. score=score+10;
  399. jewelry.flag=0;
  400. cloth_selected=NULL;
  401. }
  402. x = event.button.x;
  403. y = event.button.y;
  404. length=shoes.offset.x + shoes.offset.w;
  405. height=shoes.offset.y + shoes.offset.h;
  406. if (x>shoes.offset.x && x<(length) && y>shoes.offset.y && y<(height)&&shoes.flag==1)
  407. {
  408. cloth_selected=&shoes;
  409. continue;
  410. }
  411. if (cloth_selected==&shoes)
  412. {
  413. x = event.button.x;
  414. y = event.button.y;
  415. length=forshoes.offset.x + forshoes.offset.w;
  416. height=forshoes.offset.y + forshoes.offset.h;
  417. if (x>forshoes.offset.x && x<(length) && y>forshoes.offset.y && y<(height))
  418. score=score+10;
  419. shoes.flag=0;
  420. cloth_selected=NULL;
  421. }
  422. }
  423. if ( event.type == SDL_QUIT )
  424. quite = 1;
  425. SDL_BlitSurface( background, NULL, screen, NULL );
  426. blitcloth (&girl, screen);
  427. blitcloth (&trousers, screen);
  428. blitcloth (&dress, screen);
  429. blitcloth (&shoes,screen);
  430. blitcloth (&bag, screen);
  431. blitcloth (&jewelry, screen);
  432. blitcloth (&fortrousers,screen);
  433. blitcloth (&fordress,screen);
  434. blitcloth (&forshoes, screen);
  435. blitcloth (&forbags, screen);
  436. blitcloth (&forjewelry, screen);
  437. if (nenuzhnaya)
  438. {
  439. blitcloth (&forshoestxt,screen);
  440. blitcloth (&fortrouserstxt,screen);
  441. blitcloth (&fordressestxt,screen);
  442. blitcloth (&forbagstxt,screen);
  443. blitcloth (&forjewelrytxt,screen);
  444. }
  445. snprintf(b, sizeof (b), "score: %d", score);
  446. SDL_Color textColor = { 50, 205, 50 };
  447. message = TTF_RenderText_Solid( font, b, textColor );
  448. text.x= 900/2;
  449. text.y=700/18;
  450. text.w=message->w;
  451. text.h=message->h;
  452. SDL_BlitSurface( message, NULL,screen, &text );
  453. SDL_Flip( screen );
  454. if (score<90 && dress.flag==0 && bag.flag==0 && trousers.flag==0 && shoes.flag==0 && jewelry.flag==0)
  455. {
  456. dress.flag=1;
  457. bag.flag=1;
  458. trousers.flag=1;
  459. shoes.flag=1;
  460. jewelry.flag=1;
  461. score=40;
  462. continue;
  463. }
  464. else if (score==90)
  465. {
  466. level=3;
  467. background = IMG_Load("background3.png");
  468. girl.picture=IMG_Load("lilcasual.png");
  469. girl.flag=1;
  470. girl1.picture=IMG_Load("lilengaged.png");
  471. girl1.flag=1;
  472. girl2.picture=IMG_Load("lilevent.png");
  473. girl2.flag=1;
  474. girl.offset.x = 10;
  475. girl.offset.y = 700/3;
  476. girl1.offset.x = 450;
  477. girl1.offset.y = 700/3;
  478. girl2.offset.x = 800;
  479. girl2.offset.y = 700/3;
  480. SDL_Color textColor = { 178, 34, 34 };
  481. message3 = TTF_RenderText_Solid( font, "choose the appropriate look for this occasion:", textColor );
  482. text3.x= 1024/2-((message3->w)/2);
  483. text3.y=700/18;
  484. text3.w=message3->w;
  485. text3.h=message3->h;
  486. message2=TTF_RenderText_Solid( font, "your friend's engagement", textColor2 );
  487. text2.x= 1024/2-((message2->w)/2);
  488. text2.y=700/9;
  489. text2.w=message->w;
  490. text2.h=message->h;
  491. event.type=0;
  492. }
  493. }
  494. if (level==3)
  495. {
  496. if ( event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_LEFT)
  497. {
  498. x= event.button.x;
  499. y = event.button.y;
  500. if (i==0)
  501. {
  502. if ((x>girl1.offset.x && x<(girl1.offset.x+girl1.offset.w)) && y>girl1.offset.y && y<(girl1.offset.y+girl1.offset.h))
  503. {
  504. score=score+10;
  505. girl1.flag=0;
  506. }
  507. else if ((x>girl2.offset.x && x<(girl2.offset.x+girl2.offset.w)) && (y>girl2.offset.y && y<(girl2.offset.y+girl2.offset.h)))
  508. {
  509. girl2.flag=0;
  510. }
  511. else if ((x>girl.offset.x && x<(girl.offset.x+girl.offset.w)) && (y>girl.offset.y && y<(girl.offset.y+girl.offset.h)))
  512. {
  513. girl.flag=0;
  514. }
  515. message2=TTF_RenderText_Solid( font, "film premiere", textColor2 );
  516. SDL_BlitSurface( background, &text2, screen, &text2 );
  517. i++;
  518. }
  519. else if (i==1)
  520. {
  521. if ((x>girl1.offset.x && x<(girl1.offset.x+girl1.offset.w)) && y>girl1.offset.y && y<(girl1.offset.y+girl1.offset.h))
  522. {
  523. girl1.flag=0;
  524. }
  525. else if ((x>girl2.offset.x && x<(girl2.offset.x+girl2.offset.w)) && (y>girl2.offset.y && y<(girl2.offset.y+girl2.offset.h)))
  526. {
  527. girl2.flag=0;
  528. score=score+10;
  529. }
  530. else if ((x>girl.offset.x && x<(girl.offset.x+girl.offset.w)) && (y>girl.offset.y && y<(girl.offset.y+girl.offset.h)))
  531. {
  532. girl.flag=0;
  533. }
  534. message2=TTF_RenderText_Solid( font, "meeting with friends", textColor2 );
  535. SDL_BlitSurface( background, &text2, screen, &text2 );
  536. i++;
  537. }
  538. else if (i==2)
  539. {
  540. if ((x>girl1.offset.x && x<(girl1.offset.x+girl1.offset.w)) && y>girl1.offset.y && y<(girl1.offset.y+girl1.offset.h))
  541. {
  542. girl1.flag=0;
  543. }
  544. else if ((x>girl2.offset.x && x<(girl2.offset.x+girl2.offset.w)) && (y>girl2.offset.y && y<(girl2.offset.y+girl2.offset.h)))
  545. {
  546. girl2.flag=0;
  547. }
  548. else if ((x>girl.offset.x && x<(girl.offset.x+girl.offset.w)) && (y>girl.offset.y && y<(girl.offset.y+girl.offset.h)))
  549. {
  550. girl.flag=0;
  551. score=score+10;
  552. }
  553. i++;
  554. }
  555. }
  556. SDL_BlitSurface( background, NULL, screen, NULL );
  557. SDL_BlitSurface( message3, NULL,screen, &text3 );
  558. SDL_BlitSurface( message2, NULL,screen, &text2 );
  559. blitcloth (&girl, screen);
  560. blitcloth (&girl1, screen);
  561. blitcloth (&girl2, screen);
  562. snprintf(b, sizeof (b), "score: %d", score);
  563. message = TTF_RenderText_Solid( font, b, textColor );
  564. text.x= 880;
  565. text.y=700/18;
  566. text.w=message->w;
  567. text.h=message->h;
  568. SDL_BlitSurface( message, NULL,screen, &text );
  569. SDL_Flip( screen );
  570. if (score<120 && girl.flag==0 && girl1.flag==0 && girl2.flag==0)
  571. {
  572. girl.flag=1;
  573. girl1.flag=1;
  574. girl2.flag=1;
  575. score=90;
  576. i=0;
  577. message2=TTF_RenderText_Solid( font, "your friend's engagement", textColor2 );
  578. text2.x= 1024/2-((message2->w)/2);
  579. text2.y=700/9;
  580. text2.w=message->w;
  581. text2.h=message->h;
  582. continue;
  583. }
  584. else if (score==120)
  585. {
  586. level=4;
  587. i=0;
  588. background = IMG_Load("background4.png");
  589. girl.picture=IMG_Load("emstyle.png");
  590. girl.flag=1;
  591. girl1.picture=Load_Image("glossy.png");
  592. girl1.flag=1;
  593. girl2.picture=Load_Image("lesbian.png");
  594. girl2.flag=1;
  595. girl3.picture=IMG_Load("Zhmerinka.png");
  596. girl3.flag=1;
  597. girl.offset.x = 10;
  598. girl.offset.y = 600/3;
  599. girl1.offset.x = 250;
  600. girl1.offset.y = 600/3;
  601. girl2.offset.x = 530;
  602. girl2.offset.y = 600/3;
  603. girl3.offset.x = 800;
  604. girl3.offset.y = 600/3;
  605. message3 = TTF_RenderText_Solid( font, "choose the appropriate look for graduation party, if you:", textColor );
  606. text3.x= 1024/2-((message3->w)/2);
  607. text3.y=700/18;
  608. text3.w=message3->w;
  609. text3.h=message3->h;
  610. SDL_Color textColor2 = {205,112,84};
  611. message2=TTF_RenderText_Solid( font, "always dress tastefully", textColor2 );
  612. text2.x= 1024/2-((message2->w)/2);
  613. text2.y=700/9;
  614. text2.w=message->w;
  615. text2.h=message->h;
  616. event.type=0;
  617. }
  618. }
  619. if (level==4)
  620. {
  621. SDL_Color textColor2 = {205,112,84};
  622. if ( event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_LEFT)
  623. {
  624. x= event.button.x;
  625. y = event.button.y;
  626. if (i==0)
  627. {
  628. if ((x>girl1.offset.x && x<(girl1.offset.x+girl1.offset.w)) && y>girl1.offset.y && y<(girl1.offset.y+girl1.offset.h))
  629. {
  630. girl1.flag=0;
  631. }
  632. else if ((x>girl2.offset.x && x<(girl2.offset.x+girl2.offset.w)) && (y>girl2.offset.y && y<(girl2.offset.y+girl2.offset.h)))
  633. {
  634. girl2.flag=0;
  635. }
  636. else if ((x>girl.offset.x && x<(girl.offset.x+girl.offset.w)) && (y>girl.offset.y && y<(girl.offset.y+girl.offset.h)))
  637. {
  638. girl.flag=0;
  639. score=score+10;
  640. }
  641. else if ((x>girl3.offset.x && x<(girl3.offset.x+girl3.offset.w)) && (y>girl3.offset.y && y<(girl3.offset.y+girl3.offset.h)))
  642. {
  643. girl3.flag=0;
  644. }
  645. message2=TTF_RenderText_Solid( font, "came from Zhmerinka-village", textColor2 );
  646. SDL_BlitSurface( background, &text2, screen, &text2 );
  647. i++;
  648. }
  649. else if (i==1)
  650. {
  651. if ((x>girl1.offset.x && x<(girl1.offset.x+girl1.offset.w)) && y>girl1.offset.y && y<(girl1.offset.y+girl1.offset.h))
  652. {
  653. girl1.flag=0;
  654. }
  655. else if ((x>girl2.offset.x && x<(girl2.offset.x+girl2.offset.w)) && (y>girl2.offset.y && y<(girl2.offset.y+girl2.offset.h)))
  656. {
  657. girl2.flag=0;
  658. }
  659. else if ((x>girl.offset.x && x<(girl.offset.x+girl.offset.w)) && (y>girl.offset.y && y<(girl.offset.y+girl.offset.h)))
  660. {
  661. girl.flag=0;
  662. }
  663. else if ((x>girl3.offset.x && x<(girl3.offset.x+girl3.offset.w)) && (y>girl3.offset.y && y<(girl3.offset.y+girl3.offset.h)))
  664. {
  665. girl3.flag=0;
  666. score=score+10;
  667. }
  668. message2=TTF_RenderText_Solid( font, "are keen on glossy magazines", textColor2 );
  669. SDL_BlitSurface( background, &text2, screen, &text2 );
  670. i++;
  671. }
  672. else if (i==2)
  673. {
  674. if ((x>girl1.offset.x && x<(girl1.offset.x+girl1.offset.w)) && y>girl1.offset.y && y<(girl1.offset.y+girl1.offset.h))
  675. {
  676. girl1.flag=0;
  677. score=score+10;
  678. }
  679. else if ((x>girl2.offset.x && x<(girl2.offset.x+girl2.offset.w)) && (y>girl2.offset.y && y<(girl2.offset.y+girl2.offset.h)))
  680. {
  681. girl2.flag=0;
  682. }
  683. else if ((x>girl.offset.x && x<(girl.offset.x+girl.offset.w)) && (y>girl.offset.y && y<(girl.offset.y+girl.offset.h)))
  684. {
  685. girl.flag=0;
  686. }
  687. else if ((x>girl3.offset.x && x<(girl3.offset.x+girl3.offset.w)) && (y>girl3.offset.y && y<(girl3.offset.y+girl3.offset.h)))
  688. {
  689. girl3.flag=0;
  690. }
  691. message2=TTF_RenderText_Solid( font, "are lesbian", textColor2 );
  692. SDL_BlitSurface( background, &text2, screen, &text2 );
  693. i++;
  694. }
  695. else if (i==3)
  696. {
  697. if ((x>girl1.offset.x && x<(girl1.offset.x+girl1.offset.w)) && y>girl1.offset.y && y<(girl1.offset.y+girl1.offset.h))
  698. {
  699. girl1.flag=0;
  700. }
  701. else if ((x>girl2.offset.x && x<(girl2.offset.x+girl2.offset.w)) && (y>girl2.offset.y && y<(girl2.offset.y+girl2.offset.h)))
  702. {
  703. girl2.flag=0;
  704. score=score+10;
  705. }
  706. else if ((x>girl.offset.x && x<(girl.offset.x+girl.offset.w)) && (y>girl.offset.y && y<(girl.offset.y+girl.offset.h)))
  707. {
  708. girl.flag=0;
  709. }
  710. else if ((x>girl3.offset.x && x<(girl3.offset.x+girl3.offset.w)) && (y>girl3.offset.y && y<(girl3.offset.y+girl3.offset.h)))
  711. {
  712. girl3.flag=0;
  713. }
  714. i++;
  715. }
  716. }
  717. SDL_BlitSurface( background, NULL, screen, NULL );
  718. SDL_BlitSurface( message3, NULL,screen, &text3 );
  719. SDL_BlitSurface( message2, NULL,screen, &text2 );
  720. blitcloth (&girl, screen);
  721. blitcloth (&girl1, screen);
  722. blitcloth (&girl2, screen);
  723. blitcloth (&girl3, screen);
  724. snprintf(b, sizeof (b), "score: %d", score);
  725. message = TTF_RenderText_Solid( font, b, textColor );
  726. text.x= 880;
  727. text.y=700/18;
  728. text.w=message->w;
  729. text.h=message->h;
  730. SDL_BlitSurface( message, NULL,screen, &text );
  731. SDL_Flip( screen );
  732. if (score<160 && girl.flag==0 && girl1.flag==0 && girl2.flag==0 && girl3.flag==0)
  733. {
  734. score=120;
  735. girl.flag=1;
  736. girl1.flag=1;
  737. girl2.flag=1;
  738. girl3.flag=1;
  739. i=0;
  740. SDL_Color textColor2 = {205,112,84};
  741. message2=TTF_RenderText_Solid( font, "always dress tastefully", textColor2 );
  742. text2.x= 1024/2-((message2->w)/2);
  743. text2.y=700/9;
  744. text2.w=message->w;
  745. text2.h=message->h;
  746. continue;
  747. }
  748. else if (score==160)
  749. {
  750. level=5;
  751. i=0;
  752. background = IMG_Load("background5.png");
  753. girl.picture=IMG_Load("18birthday.png");
  754. girl.flag=1;
  755. girl1.picture=IMG_Load("forboyfriend.png");
  756. girl1.flag=1;
  757. girl2.picture=Load_Image("cinema.png");
  758. girl2.flag=1;
  759. girl3.picture=IMG_Load("fordances.png");
  760. girl3.flag=1;
  761. girl4.picture=Load_Image("forwedding.png");
  762. girl4.flag=1;
  763. girl.offset.x = 8;
  764. girl.offset.y = 600/5+20;
  765. girl1.offset.x = 200;
  766. girl1.offset.y = 600/5+20;
  767. girl2.offset.x = 600;
  768. girl2.offset.y = 600/5+20;
  769. girl3.offset.x = 820;
  770. girl3.offset.y = 600/5+20;
  771. girl4.offset.x = 400;
  772. girl4.offset.y = 600/5+20;
  773. message3 = TTF_RenderText_Solid( font, "choose the appropriate look for this occasion", textColor );
  774. text3.x= 1024/2-((message3->w)/2);
  775. text3.y=700/18;
  776. text3.w=message3->w;
  777. text3.h=message3->h;
  778. SDL_Color textColor2 = {205,51,51};
  779. message2=TTF_RenderText_Solid( font, "you are going to dance", textColor2 );
  780. text2.x= 1024/2-((message2->w)/2);
  781. text2.y=700/9;
  782. text2.w=message->w;
  783. text2.h=message->h;
  784. event.type=0;
  785. }
  786. }
  787. if (level==5)
  788. {
  789. SDL_Color textColor2 = {205,51,51};
  790. if ( event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_LEFT)
  791. {
  792. x= event.button.x;
  793. y = event.button.y;
  794. if (i==0)
  795. {
  796. if ((x>girl1.offset.x && x<(girl1.offset.x+girl1.offset.w)) && y>girl1.offset.y && y<(girl1.offset.y+girl1.offset.h))
  797. {
  798. girl1.flag=0;
  799. }
  800. else if ((x>girl2.offset.x && x<(girl2.offset.x+girl2.offset.w)) && (y>girl2.offset.y && y<(girl2.offset.y+girl2.offset.h)))
  801. {
  802. girl2.flag=0;
  803. }
  804. else if ((x>girl.offset.x && x<(girl.offset.x+girl.offset.w)) && (y>girl.offset.y && y<(girl.offset.y+girl.offset.h)))
  805. {
  806. girl.flag=0;
  807. }
  808. else if ((x>girl3.offset.x && x<(girl3.offset.x+girl3.offset.w)) && (y>girl3.offset.y && y<(girl3.offset.y+girl3.offset.h)))
  809. {
  810. girl3.flag=0;
  811. score=score+10;
  812. }
  813. else if ((x>girl4.offset.x && x<(girl4.offset.x+girl4.offset.w)) && (y>girl4.offset.y && y<(girl4.offset.y+girl4.offset.h)))
  814. {
  815. girl4.flag=0;
  816. }
  817. message2=TTF_RenderText_Solid( font, "you are celebrating yiur 18-th birthday", textColor2 );
  818. SDL_BlitSurface( background, &text2, screen, &text2 );
  819. i++;
  820. }
  821. else if (i==1)
  822. {
  823. if ((x>girl1.offset.x && x<(girl1.offset.x+girl1.offset.w)) && y>girl1.offset.y && y<(girl1.offset.y+girl1.offset.h))
  824. {
  825. girl1.flag=0;
  826. }
  827. else if ((x>girl2.offset.x && x<(girl2.offset.x+girl2.offset.w)) && (y>girl2.offset.y && y<(girl2.offset.y+girl2.offset.h)))
  828. {
  829. girl2.flag=0;
  830. }
  831. else if ((x>girl.offset.x && x<(girl.offset.x+girl.offset.w)) && (y>girl.offset.y && y<(girl.offset.y+girl.offset.h)))
  832. {
  833. girl.flag=0;
  834. score=score+10;
  835. }
  836. else if ((x>girl3.offset.x && x<(girl3.offset.x+girl3.offset.w)) && (y>girl3.offset.y && y<(girl3.offset.y+girl3.offset.h)))
  837. {
  838. girl3.flag=0;
  839. }
  840. else if ((x>girl4.offset.x && x<(girl4.offset.x+girl4.offset.w)) && (y>girl4.offset.y && y<(girl4.offset.y+girl4.offset.h)))
  841. {
  842. girl4.flag=0;
  843. }
  844. message2=TTF_RenderText_Solid( font, "are looking for a boyfriend", textColor2 );
  845. SDL_BlitSurface( background, &text2, screen, &text2 );
  846. i++;
  847. }
  848. else if (i==2)
  849. {
  850. if ((x>girl1.offset.x && x<(girl1.offset.x+girl1.offset.w)) && y>girl1.offset.y && y<(girl1.offset.y+girl1.offset.h))
  851. {
  852. girl1.flag=0;
  853. score=score+10;
  854. }
  855. else if ((x>girl2.offset.x && x<(girl2.offset.x+girl2.offset.w)) && (y>girl2.offset.y && y<(girl2.offset.y+girl2.offset.h)))
  856. {
  857. girl2.flag=0;
  858. }
  859. else if ((x>girl.offset.x && x<(girl.offset.x+girl.offset.w)) && (y>girl.offset.y && y<(girl.offset.y+girl.offset.h)))
  860. {
  861. girl.flag=0;
  862. }
  863. else if ((x>girl3.offset.x && x<(girl3.offset.x+girl3.offset.w)) && (y>girl3.offset.y && y<(girl3.offset.y+girl3.offset.h)))
  864. {
  865. girl3.flag=0;
  866. }
  867. else if ((x>girl4.offset.x && x<(girl4.offset.x+girl4.offset.w)) && (y>girl4.offset.y && y<(girl4.offset.y+girl4.offset.h)))
  868. {
  869. girl4.flag=0;
  870. }
  871. message2=TTF_RenderText_Solid( font, "you are going to the cinema", textColor2 );
  872. SDL_BlitSurface( background, &text2, screen, &text2 );
  873. i++;
  874. }
  875. else if (i==3)
  876. {
  877. if ((x>girl1.offset.x && x<(girl1.offset.x+girl1.offset.w)) && y>girl1.offset.y && y<(girl1.offset.y+girl1.offset.h))
  878. {
  879. girl1.flag=0;
  880. }
  881. else if ((x>girl2.offset.x && x<(girl2.offset.x+girl2.offset.w)) && (y>girl2.offset.y && y<(girl2.offset.y+girl2.offset.h)))
  882. {
  883. girl2.flag=0;
  884. score=score+10;
  885. }
  886. else if ((x>girl.offset.x && x<(girl.offset.x+girl.offset.w)) && (y>girl.offset.y && y<(girl.offset.y+girl.offset.h)))
  887. {
  888. girl.flag=0;
  889. }
  890. else if ((x>girl3.offset.x && x<(girl3.offset.x+girl3.offset.w)) && (y>girl3.offset.y && y<(girl3.offset.y+girl3.offset.h)))
  891. {
  892. girl3.flag=0;
  893. }
  894. else if ((x>girl4.offset.x && x<(girl4.offset.x+girl4.offset.w)) && (y>girl4.offset.y && y<(girl4.offset.y+girl4.offset.h)))
  895. {
  896. girl4.flag=0;
  897. }
  898. message2=TTF_RenderText_Solid( font, "you are going to your daughter's wedding ceremony", textColor2 );
  899. SDL_BlitSurface( background, &text2, screen, &text2 );
  900. i++;
  901. }
  902. else if (i==4)
  903. {
  904. if ((x>girl1.offset.x && x<(girl1.offset.x+girl1.offset.w)) && y>girl1.offset.y && y<(girl1.offset.y+girl1.offset.h))
  905. {
  906. girl1.flag=0;
  907. }
  908. else if ((x>girl2.offset.x && x<(girl2.offset.x+girl2.offset.w)) && (y>girl2.offset.y && y<(girl2.offset.y+girl2.offset.h)))
  909. {
  910. girl2.flag=0;
  911. score=score+10;
  912. }
  913. else if ((x>girl.offset.x && x<(girl.offset.x+girl.offset.w)) && (y>girl.offset.y && y<(girl.offset.y+girl.offset.h)))
  914. {
  915. girl.flag=0;
  916. }
  917. else if ((x>girl3.offset.x && x<(girl3.offset.x+girl3.offset.w)) && (y>girl3.offset.y && y<(girl3.offset.y+girl3.offset.h)))
  918. {
  919. girl3.flag=0;
  920. }
  921. else if ((x>girl4.offset.x && x<(girl4.offset.x+girl4.offset.w)) && (y>girl4.offset.y && y<(girl4.offset.y+girl4.offset.h)))
  922. {
  923. girl4.flag=0;
  924. score=score+10;
  925. }
  926. i++;
  927. }
  928. }
  929. text2.x= 1024/2-((message2->w)/2);
  930. text2.y=700/9;
  931. text2.w=message->w;
  932. text2.h=message->h;
  933. SDL_BlitSurface( background, NULL, screen, NULL );
  934. SDL_BlitSurface( message3, NULL,screen, &text3 );
  935. SDL_BlitSurface( message2, NULL,screen, &text2 );
  936. blitcloth (&girl, screen);
  937. blitcloth (&girl1, screen);
  938. blitcloth (&girl2, screen);
  939. blitcloth (&girl3, screen);
  940. blitcloth (&girl4, screen);
  941. snprintf(b, sizeof (b), "score: %d", score);
  942. message = TTF_RenderText_Solid( font, b, textColor );
  943. text.x= 880;
  944. text.y=700/18;
  945. text.w=message->w;
  946. text.h=message->h;
  947. SDL_BlitSurface( message, NULL,screen, &text );
  948. SDL_Flip( screen );
  949. if (score<210 && girl.flag==0 && girl1.flag==0 && girl2.flag==0 && girl3.flag==0 && girl4.flag==0)
  950. {
  951. score=160;
  952. girl.flag=1;
  953. girl1.flag=1;
  954. girl2.flag=1;
  955. girl3.flag=1;
  956. girl4.flag=1;
  957. i=0;
  958. SDL_Color textColor2 = {205,112,84};
  959. message2=TTF_RenderText_Solid( font, "you are going to dance", textColor2 );
  960. text2.x= 1024/2-((message2->w)/2);
  961. text2.y=700/9;
  962. text2.w=message->w;
  963. text2.h=message->h;
  964. continue;
  965. }
  966. else if (score==210)
  967. {
  968. level=6;
  969. i=0;
  970. background = IMG_Load("background6.png");
  971. girl.picture=IMG_Load("lawer.png");
  972. girl.flag=1;
  973. girl1.picture=IMG_Load("candies.png");
  974. girl1.flag=1;
  975. girl2.picture=Load_Image("danceteacher.png");
  976. girl2.flag=1;
  977. girl3.picture=IMG_Load("diplomat.png");
  978. girl3.flag=1;
  979. girl4.picture=IMG_Load("businesswoman.png");
  980. girl4.flag=1;
  981. girl.offset.x = 8;
  982. girl.offset.y = 600/5;
  983. girl1.offset.x = 200;
  984. girl1.offset.y = 600/5+20;
  985. girl2.offset.x = 620;
  986. girl2.offset.y = 600/5+20;
  987. girl3.offset.x = 820;
  988. girl3.offset.y = 600/5;
  989. girl4.offset.x = 400;
  990. girl4.offset.y = 600/5+40;
  991. message3 = TTF_RenderText_Solid( font, "choose the appropriate look for each occupation", textColor );
  992. text3.x= 1024/2-((message3->w)/2);
  993. text3.y=700/18;
  994. text3.w=message3->w;
  995. text3.h=message3->h;
  996. SDL_Color textColor2 = {139,131,134};
  997. message2=TTF_RenderText_Solid( font, "you are a shop assistant in candy shop", textColor2 );
  998. text2.x= 1024/2-((message2->w)/2);
  999. text2.y=700/9;
  1000. text2.w=message->w;
  1001. text2.h=message->h;
  1002. event.type=0;
  1003. }
  1004. SDL_Flip( screen );
  1005. }
  1006. if (level==6)
  1007. {
  1008. SDL_Color textColor2 = {139,131,134};
  1009. if ( event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_LEFT)
  1010. {
  1011. x= event.button.x;
  1012. y = event.button.y;
  1013. if (i==0)
  1014. {
  1015. if ((x>girl1.offset.x && x<(girl1.offset.x+girl1.offset.w)) && y>girl1.offset.y && y<(girl1.offset.y+girl1.offset.h))
  1016. {
  1017. girl1.flag=0;
  1018. score=score+10;
  1019. }
  1020. else if ((x>girl2.offset.x && x<(girl2.offset.x+girl2.offset.w)) && (y>girl2.offset.y && y<(girl2.offset.y+girl2.offset.h)))
  1021. {
  1022. girl2.flag=0;
  1023. }
  1024. else if ((x>girl.offset.x && x<(girl.offset.x+girl.offset.w)) && (y>girl.offset.y && y<(girl.offset.y+girl.offset.h)))

Large files files are truncated, but you can click here to view the full file