annotate plugins/crazychat/models.c @ 12640:de306144dc8a

[gaim-migrate @ 14976] Yahoo profiles use links of this form: <a href="http://gaim.sf.net">gaim.sf.net</a> The Yahoo prpl strips HTML, manipulates the text, then passes it to the core, which passes to the UI, which calls another UI function which calls ...linkify. This leads to these URLs looking quite odd. The fix is to have the HTML stripping function deal properly with URLs of the above format. With HTTP being the most common type of URL these days, that's probably a good plan anyway. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Fri, 23 Dec 2005 06:48:27 +0000
parents ed017b9c532d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11218
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
1 #include"glm.h"
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
2 #include <GL/gl.h>
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
3 #include <GL/glu.h>
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
4 #include "face.h"
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
5
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
6 #define ASCII_DIGITS 48
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
7
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
8 void init_lists(GLint** lists, GLMmodel*** models, int num_lists, char* name, float my_scale){
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
9 int i;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
10 char c;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
11 GLint* temp_lists;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
12 GLMmodel** temp_models;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
13 char* temp = (char*)malloc(sizeof(char) * (strlen(name) + strlen(".obj" + 3)));
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
14 GLMmodel* model;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
15 float dum;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
16 temp_lists = (GLint*)malloc(sizeof(GLint) * num_lists);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
17 temp_models = (GLMmodel**)malloc(sizeof(GLMmodel*) * num_lists);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
18
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
19 for(i=0;i<num_lists;i++) {
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
20 strcpy(temp, name);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
21 if(i<10){
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
22 c = (char)(ASCII_DIGITS+i);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
23 strncat(temp, &c, 1);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
24 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
25 else{
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
26 c = (char)(i/10+ASCII_DIGITS);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
27 strncat(temp, &c, 1);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
28 c = (char)(i%10 + ASCII_DIGITS);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
29 strncat(temp, &c, 1);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
30 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
31 strcat(temp, ".obj");
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
32 temp_models[i]=glmReadOBJ(temp);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
33 glmScale(temp_models[i], my_scale);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
34 dum =glmUnitize(temp_models[i]); // this actually just centers
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
35 //printf("%s factor %f", temp, dum);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
36 temp_lists[i]=glmList(temp_models[i], GLM_SMOOTH);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
37 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
38
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
39 *lists = temp_lists;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
40 *models = temp_models;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
41 free(temp);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
42 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
43
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
44 int compute_lid(BOOL open, int curr_lid, int max){
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
45 if(open) {
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
46 if(curr_lid < max){
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
47 curr_lid++;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
48 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
49 else
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
50 curr_lid=max;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
51 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
52 else {
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
53 if(curr_lid >=2){
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
54 curr_lid-=2;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
55 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
56 else if(curr_lid==1){
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
57 curr_lid--;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
58 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
59 curr_lid=0;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
60 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
61 return curr_lid;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
62 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
63
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
64 void apply_output_mode(FACE f, GLfloat* angle, GLfloat* yangle, BOOL* left_open, BOOL* right_open, GLfloat* open, DIRECTION* dir)
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
65 {
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
66 struct doggy_struct* dog = (struct doggy_struct*)f->char_struct;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
67 if(f->my_mode==NORMAL){
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
68 f->curr_z_angle=0;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
69 return;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
70 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
71 if(f->my_mode==CRAZY1){
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
72 f->curr_z_angle = f->curr_z_angle+ANGLE_INC;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
73 *angle = f->curr_z_angle;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
74 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
75 }