Advertisement
Guest User

Untitled

a guest
Sep 19th, 2018
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.72 KB | None | 0 0
  1. typedef struct {
  2.     DISPENV disp;
  3.     DRAWENV draw;
  4.     u_long  ot[8];
  5.     POLY_FT4 dobik;
  6.     POLY_FT4 tree;
  7. } DB;
  8.  
  9. void init_robin(DB *db) {  
  10.     GsIMAGE tim1;
  11.  
  12.     /* Get texture information of TIM FORMAT */  
  13.     GsGetTimInfo((u_long *)(TEX_ADDR+4),&tim1);
  14.    
  15.     setPolyFT4(&db->dobik);
  16.     setShadeTex(&db->dobik, 1);
  17.     db->dobik.tpage = LoadTPage(tim1.pixel, 1, 0, 640, 0, 448, 64);
  18.     db->dobik.clut = LoadClut(tim1.clut, 0, 275);
  19. }
  20.  
  21. void bg_init(DB *db) {
  22.     GsIMAGE bg_tim_data;
  23.     GsGetTimInfo((u_long *)(BG_ADDR+4), &bg_tim_data);
  24.  
  25.     setPolyFT4(&db->tree);
  26.     setShadeTex(&db->tree, 1);
  27.     db->tree.tpage = LoadTPage(bg_tim_data.pixel, 1, 0, 640, 256, 512, 128);
  28.     db->tree.clut = LoadClut(bg_tim_data.clut, 640, 489);
  29. }
  30.  
  31.  
  32. int main() {
  33.     DB db[2];
  34.    
  35.     DB *cdb;   
  36.  
  37.     u_long *ot;
  38.    
  39.     ResetGraph(0);
  40.    
  41.     SetDefDrawEnv(&db[0].draw, 0,   0, 320, 240);
  42.     SetDefDrawEnv(&db[1].draw, 0, 240, 320, 240);
  43.     SetDefDispEnv(&db[0].disp, 0, 240, 320, 240);
  44.     SetDefDispEnv(&db[1].disp, 0,   0, 320, 240);
  45.    
  46.     bg_init(&db[0]);
  47.     bg_init(&db[1]);
  48.     init_robin(&db[0]);
  49.     init_robin(&db[1]);
  50.    
  51.     SetDispMask(1);
  52.    
  53.     db[0].draw.isbg = 1;
  54.     setRGB0(&db[0].draw, 60, 120, 120);
  55.    
  56.     db[1].draw.isbg = 1;
  57.     setRGB0(&db[1].draw, 60, 120, 120);
  58.    
  59.     while (1) {
  60.         cdb = (cdb==db)? db+1: db;
  61.        
  62.         ClearOTag(cdb->ot,8);
  63.        
  64.         setUVWH(&cdb->dobik, 0, 0, 64, 64);
  65.         setXYWH(&cdb->dobik, 0, 0, 64, 64);
  66.         setUVWH(&cdb->tree, 0, 0, 128, 128);
  67.         setXYWH(&cdb->tree, 50, 50, 128, 128);
  68.  
  69.        
  70.         ot = cdb->ot;
  71.  
  72.         AddPrim(&ot[0], &cdb->tree);           
  73.         AddPrim(&ot[1], &cdb->dobik);  
  74.        
  75.         DrawSync(0);
  76.         VSync(0);
  77.        
  78.         PutDrawEnv(&cdb->draw);
  79.         PutDispEnv(&cdb->disp);
  80.        
  81.         DumpOTag(cdb->ot);
  82.         DrawOTag(cdb->ot); 
  83.     }
  84.    
  85.     DrawSync(0);
  86.    
  87.     pollhost();
  88.     return 0;
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement